feat(boss-effect): 统一处理参数类型转换,提升数值比较与运算准确性

对多个 boss 技能效果文件中的参数调用进行了统一调整,将原先直接使用 `e.Args()[index]` 的地方,
改为通过 `e.Args()[index].IntPart()` 或 `e.Args()[index]` 进行类型转换后再参与逻辑判断或数值计算。
同时修正了部分 HP 比较方式,由整型比较转为 decimal
This commit is contained in:
2025-12-06 15:11:42 +08:00
parent 3803f0a11d
commit 91690658b5
76 changed files with 172 additions and 157 deletions

View File

@@ -26,12 +26,12 @@ func (e *NewSel12) Damage_DIV_ex(t *info.DamageZone) bool {
return true
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0]), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
return true
}
func init() {

View File

@@ -24,7 +24,7 @@ func (e *NewSel17) Action_start(a, b *action.SelectSkillAction) bool {
return true
}
if e.Ctx().Our.CurrentPet.HP <= int(e.Args()[0]) {
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0]) == -1 {
e.Ctx().SkillEntity.CritRate = 16
}

View File

@@ -3,8 +3,6 @@ package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 22. 被打时受到直接攻击伤害提高至n倍;a1: n
@@ -21,7 +19,7 @@ func (e *NewSel22) Damage_DIV_ex(t *info.DamageZone) bool {
if t.Type != info.DamageType.Red {
return true
}
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[0])))
t.Damage = t.Damage.Mul(e.Args()[0])
return true

View File

@@ -35,8 +35,8 @@ func (e *NewSel23) Compare_Pre(fattack *action.SelectSkillAction, sattack *actio
return true
}
full32 := int(e.Args()[0])<<16 | int(e.Args()[1])
if int(e.Ctx().Our.CurrentPet.Info.Hp) <= full32 {
//full32 := int(e.Args()[0])<<16 | int(e.Args()[1])
if int(e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0])) == -1 {
sattack.SkillEntity.Priority = math.MaxInt
}
@@ -44,8 +44,8 @@ func (e *NewSel23) Compare_Pre(fattack *action.SelectSkillAction, sattack *actio
}
func (e *NewSel23) OnSkill() bool {
full32 := int(e.Args()[0])<<16 | int(e.Args()[1])
if int(e.Ctx().Our.CurrentPet.Info.Hp) <= full32 {
//full32 := int(e.Args()[0])<<16 | int(e.Args()[1])
if int(e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0])) == -1 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Red,

View File

@@ -3,6 +3,7 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
"github.com/samber/lo"
)
@@ -22,9 +23,9 @@ func (e *NewSel24) Skill_Hit_ex() bool {
return true
}
_, ok := lo.Find(e.Args(), func(item int) bool {
_, ok := lo.Find(e.Args(), func(item alpacadecimal.Decimal) bool {
return skill.ID == item
return skill.ID == int(item.IntPart())
})
if !ok {
return true

View File

@@ -30,7 +30,7 @@ func (e *NewSel27) Damage_DIV_ex(t *info.DamageZone) bool {
e.index = 0
}
if e.Args()[e.index] == e.Ctx().SkillEntity.Type {
if int(e.Args()[e.index].IntPart()) == e.Ctx().SkillEntity.Type {
e.index++
return true
}

View File

@@ -21,10 +21,10 @@ func (e *NewSel28) Damage_ADD(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Type != int(e.Args()[0]) {
if e.Ctx().SkillEntity.Type != int(e.Args()[0].IntPart()) {
return true
}
t.Damage = t.Damage.Add(t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[1])).Div(alpacadecimal.NewFromInt(100))))
t.Damage = t.Damage.Add(t.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100)))
return true
}
func init() {

View File

@@ -23,7 +23,7 @@ func (e *NewSel29) Action_start(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.Accuracy += e.Args()[0]
e.Ctx().SkillEntity.Accuracy += int(e.Args()[0].IntPart())
return true
}
func init() {

View File

@@ -20,7 +20,7 @@ func (e *NewSel3) Damage_DIV_ex(t *info.DamageZone) bool {
}
if t.Type == info.DamageType.Red {
reduceRatio := alpacadecimal.NewFromInt(100).Sub(alpacadecimal.NewFromInt(int64(e.Args()[0]))).Div(alpacadecimal.NewFromInt(100))
reduceRatio := alpacadecimal.NewFromInt(100).Sub(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
t.Damage = t.Damage.Mul(reduceRatio)
}

View File

@@ -15,14 +15,14 @@ func (e *NewSel31) Action_end_ex() bool {
return true
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
if e.Ctx().Our.CurrentPet.Info.Hp == 0 {
e.Ctx().Our.CurrentPet.Info.Hp = uint32(e.Args()[1])
e.Ctx().Our.CurrentPet.Info.Hp = uint32(e.Args()[1].IntPart())
}

View File

@@ -18,14 +18,14 @@ func (e *NewSel32) OnSkill() bool {
return true
}
success, _, _ := e.Input.Player.Roll(e.Args()[0]/10, 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].Div(alpacadecimal.NewFromInt(10)).IntPart()), 100)
if !success {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp)),
Damage: e.Ctx().Opp.CurrentPet.GetHP(),
})
return true
}

View File

@@ -2,8 +2,6 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 33. 精灵体力降低到 1/n 时有 m% 几率体力回满;a1: n, a2: m 百分比)
@@ -18,9 +16,9 @@ func (e *NewSel33) Action_end_ex() bool {
}
// 3. 概率判定Args()[1]为触发概率)
cmp := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(int64(e.Args()[0])))
cmp := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(cmp) == -1 {
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}

View File

@@ -25,12 +25,12 @@ func (e *NewSel34) Damage_DIV_ex(t *info.DamageZone) bool {
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0]), -1, info.AbilityOpType.SUB)
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), -1, info.AbilityOpType.SUB)
return true
}
func init() {

View File

@@ -24,12 +24,12 @@ func (e *NewSel35) Damage_DIV_ex(t *info.DamageZone) bool {
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0]), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
return true
}
func init() {

View File

@@ -29,7 +29,7 @@ func (e *NewSel36) Turn_Start(fattack *action.SelectSkillAction, sattack *action
}
func (e *NewSel36) Damage_DIV_ex(t *info.DamageZone) bool {
e.Ctx().Our.AttackValue.State = uint32(e.Args()[e.index])
e.Ctx().Our.AttackValue.State = uint32(e.Args()[e.index].IntPart())
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
@@ -43,7 +43,7 @@ func (e *NewSel36) Damage_DIV_ex(t *info.DamageZone) bool {
return true
}
if e.Args()[e.index] != e.Ctx().SkillEntity.Type {
if int(e.Args()[e.index].IntPart()) != e.Ctx().SkillEntity.Type {
t.Damage = alpacadecimal.NewFromInt(0)
}

View File

@@ -11,7 +11,7 @@ type NewSel37 struct {
NewSel0
}
func (e *NewSel37) Damage_Lock_ex(t *info.DamageZone) bool {
func (e *NewSel37) DamageLock_ex(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
@@ -20,7 +20,7 @@ func (e *NewSel37) Damage_Lock_ex(t *info.DamageZone) bool {
return true
}
if t.Damage.IntPart() > int64(e.Args()[0]) {
if t.Damage.IntPart() > int64(e.Args()[0].IntPart()) {
e.Ctx().Opp.CurrentPet.Info.Hp = 0

View File

@@ -19,7 +19,7 @@ func (e *NewSel39) Damage_ADD(t *info.DamageZone) bool {
return true
}
t.Damage = t.Damage.Add(t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[0]))))
t.Damage = t.Damage.Add(t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))))
return true
}

View File

@@ -3,8 +3,6 @@ package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 39. 偶数伤害(dmg) 提升到 n * dmg;a1: n
@@ -23,7 +21,7 @@ func (e *NewSel39) Damage_Mul(t *info.DamageZone) bool {
return true
}
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[0])))
t.Damage = t.Damage.Mul(e.Args()[0])
return true
}

View File

@@ -23,7 +23,7 @@ func (e *NewSel40) Damage_DIV_ex(t *info.DamageZone) bool {
return true
}
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(1).Div(alpacadecimal.NewFromInt(int64(e.Args()[0]))))
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(1).Div(e.Args()[0]))
return true
}

View File

@@ -2,8 +2,6 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 41. 每回合恢复自身n点体力a1: n
@@ -14,7 +12,7 @@ type NewSel41 struct {
func (e *NewSel41) Turn_End() {
e.Ctx().Our.Heal(e.Ctx().Our, nil, alpacadecimal.NewFromInt(int64(e.Args()[0])))
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Args()[0])
}
func init() {

View File

@@ -17,7 +17,7 @@ func (e *NewSel44) Action_end_ex() bool {
}
if e.Ctx().Our.CurrentPet.Info.Hp == 0 {
if e.count >= e.Args()[0] {
if e.count >= int(e.Args()[0].IntPart()) {
return true
}

View File

@@ -23,7 +23,7 @@ func (e *NewSel45) Action_start(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate = e.Args()[0]
e.Ctx().SkillEntity.CritRate = int(e.Args()[0].IntPart())
return true
}

View File

@@ -14,7 +14,7 @@ type NewSel5 struct {
NewSel0
}
func (e *NewSel5) Damage_Lock_ex(t *info.DamageZone) bool {
func (e *NewSel5) DamageLock_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
@@ -23,8 +23,8 @@ func (e *NewSel5) Damage_Lock_ex(t *info.DamageZone) bool {
return true
}
_, ok := lo.Find(append(e.Args(), 8), func(item int) bool {
return item == e.Ctx().SkillEntity.Type
_, ok := lo.Find(append(e.Args(), alpacadecimal.NewFromInt(8)), func(item alpacadecimal.Decimal) bool {
return int(item.IntPart()) == e.Ctx().SkillEntity.Type
})
if !ok {
return true

View File

@@ -3,6 +3,7 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
"github.com/samber/lo"
)
@@ -22,9 +23,9 @@ func (e *NewSel50) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if in != e.Ctx().Opp {
return true
}
_, ok := lo.Find(e.Args(), func(item int) bool {
_, ok := lo.Find(e.Args(), func(item alpacadecimal.Decimal) bool {
return effEffect.ID().Suffix() == uint16(item)
return effEffect.ID().Suffix() == uint16(item.IntPart())
})
if ok {
return false

View File

@@ -24,7 +24,7 @@ func (e *NewSel6) Action_end_ex() bool {
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
@@ -32,7 +32,7 @@ func (e *NewSel6) Action_end_ex() bool {
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 2~3 回合
duration++
// 5. 获取状态效果实例并设置参数
statusEffect := input.Geteffect(input.EffectType.Status, int(e.Args()[0]))
statusEffect := input.Geteffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
if statusEffect == nil {
return true
}

View File

@@ -21,7 +21,7 @@ func (e *NewSel61) Damage_DIV_ex(t *info.DamageZone) bool {
return true
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}

View File

@@ -24,11 +24,11 @@ func (e *NewSel62) Damage_ADD(t *info.DamageZone) bool {
if e.Ctx().SkillEntity.Category() != info.Category.PHYSICAL {
return true
}
success, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
t.Damage = t.Damage.Add(alpacadecimal.NewFromInt(int64(e.Args()[1])))
t.Damage = t.Damage.Add(alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())))
return true
}
func init() {

View File

@@ -3,8 +3,6 @@ package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 63. 特殊攻击有n%几率使伤害提高m点a1: n, a2: m
@@ -24,11 +22,11 @@ func (e *NewSel63) Damage_ADD(t *info.DamageZone) bool {
if e.Ctx().SkillEntity.Category() != info.Category.SPECIAL {
return true
}
success, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
t.Damage = t.Damage.Add(alpacadecimal.NewFromInt(int64(e.Args()[1])))
t.Damage = t.Damage.Add(e.Args()[1])
return true
}
func init() {

View File

@@ -20,7 +20,7 @@ func (e *NewSel64) Skill_Hit_ex() bool {
return true
}
skill.CritRate -= int(e.Args()[0])
skill.CritRate -= int(e.Args()[0].IntPart())
return true
}
func init() {

View File

@@ -3,8 +3,6 @@ package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 65. 物理攻击或特殊攻击伤害增加m%a1: 1=物理/3=特殊, a2: m
@@ -21,11 +19,11 @@ func (e *NewSel65) Damage_ADD(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Category() != info.EnumCategory(e.Args()[0]) {
if e.Ctx().SkillEntity.Category() != info.EnumCategory(e.Args()[0].IntPart()) {
return true
}
t.Damage = t.Damage.Add(t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[1]))))
t.Damage = t.Damage.Add(t.Damage.Mul(e.Args()[1]))
return true
}
func init() {

View File

@@ -32,7 +32,7 @@ func (e *NewSel66) OnSkill() bool {
duration++
// 获取状态效果
eff := input.Geteffect(input.EffectType.Status, int(e.Args()[1]))
eff := input.Geteffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if eff == nil {
return true
}

View File

@@ -32,7 +32,7 @@ func (e *NewSel67) OnSkill() bool {
duration++
// 获取状态效果
eff := input.Geteffect(input.EffectType.Status, int(e.Args()[1]))
eff := input.Geteffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if eff == nil {
return true
}

View File

@@ -22,7 +22,7 @@ func (e *NewSel7) Skill_Hit_ex() bool {
if skill.AttackTime == 2 {
return true
}
success, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
skill.SetMiss()

View File

@@ -23,7 +23,7 @@ func (e *NewSel30) Action_start(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate += e.Args()[0]
e.Ctx().SkillEntity.CritRate += int(e.Args()[0].IntPart())
return true
}

View File

@@ -14,8 +14,8 @@ func (e *NewSel9) Action_end_ex() bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
full32 := int64(e.Args()[0])<<32 | int64(e.Args()[1])
if e.Ctx().Our.CurrentPet.Info.Hp > uint32(e.Args()[0]) && e.Ctx().Our.CurrentPet.Info.Hp < uint32(full32) {
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0]) == -1 {
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Ctx().Our.CurrentPet.GetMaxHP())

View File

@@ -98,7 +98,7 @@ func (e *EffectDefeatTrigger) triggerByID(at info.AttackValue) {
// -----------------------------------------------------------
// triggerHealSelfOnDefeat击败对方后恢复自身最大体力的1/n对应Effect66
func (e *EffectDefeatTrigger) triggerHealSelfOnDefeat(at info.AttackValue) {
func (e *EffectDefeatTrigger) triggerHealSelfOnDefeat(_ info.AttackValue) {
// 计算恢复量:自身最大体力 / nn=SideEffectArgs[0]
maxHP := e.Ctx().Our.CurrentPet.Info.MaxHp
healAmount := alpacadecimal.NewFromInt(int64(maxHP)).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0])))

View File

@@ -59,7 +59,7 @@ func (e *EffectPhysicalAttackAddStatus) Skill_Use_ex() bool {
}
// 3. 概率判定Args()[1]为触发概率)
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}

View File

@@ -28,7 +28,7 @@ func (e *Effect101) OnSkill() bool {
}
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Mul(alpacadecimal.NewFromInt(int64(e.Args()[0])).Div(alpacadecimal.NewFromInt(100))),
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Mul(e.Args()[0].Div(alpacadecimal.NewFromInt(100))),
)
return true
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -28,7 +26,7 @@ func (e *Effect105) OnSkill() bool {
}
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(int64(e.Args()[0]))),
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[0]),
)
return true
}

View File

@@ -31,7 +31,7 @@ func (e *Effect107) Skill_Useed() bool {
//说明伤害小于N
if d == -1 {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1]), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1, info.AbilityOpType.ADD)
}
return true
}

View File

@@ -28,7 +28,7 @@ func (e *Effect115) OnSkill() bool {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {
return true
}

View File

@@ -21,7 +21,7 @@ func (e *Effect130) OnSkill() bool {
return true
}
if e.Ctx().Opp.CurrentPet.PetInfo.Gender != e.Args()[0] {
if e.Ctx().Opp.CurrentPet.PetInfo.Gender != int(e.Args()[0].IntPart()) {
return true
}
// 4. 附加固定伤害从SideEffectArgs[0]获取伤害值)

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -21,17 +19,17 @@ type Effect134 struct {
node.EffectNode
}
func (e *Effect134) Damage_Floor(t *info.DamageZone) bool {
func (e *Effect134) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
// fmt.Println("Effect134_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
is := t.Damage.Cmp(alpacadecimal.NewFromInt(int64(e.Args()[0])))
is := t.Damage.Cmp(e.Args()[0])
if is == -1 {
e.Ctx().Our.HealPP(e.Args()[1])
e.Ctx().Our.HealPP(int(e.Args()[1].IntPart()))
}

View File

@@ -21,14 +21,14 @@ type Effect135 struct {
node.EffectNode
}
func (e *Effect135) Damage_Floor(t *info.DamageZone) bool {
func (e *Effect135) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
// fmt.Println("Effect135_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
t.Damage = alpacadecimal.Max(t.Damage, alpacadecimal.NewFromInt(int64(e.Args()[0])))
t.Damage = alpacadecimal.Max(t.Damage, e.Args()[0])
}
//fmt.Println("Effect135_new", t.Damage.IntPart())

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -25,7 +23,7 @@ func init() {
// 命中之后
func (e *Effect136) OnSkill() bool {
if !e.Hit() {
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(int64(e.Args()[0])))
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -30,7 +28,7 @@ func (e *Effect28) OnSkill() bool {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp)).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0]))),
Damage: e.Ctx().Opp.CurrentPet.GetHP().Div(e.Args()[0]),
})
return true
}

View File

@@ -32,7 +32,7 @@ func (e *Effect34) OnSkill() bool {
}
// 被攻击时候反弹
func (e *Effect34) Damage_Floor(t *info.DamageZone) bool {
func (e *Effect34) DamageFloor(t *info.DamageZone) bool {
if !e.can {
return true

View File

@@ -29,7 +29,7 @@ func (e *Effect36) OnSkill() bool {
e.can = true
return true
}
func (e *Effect36) Damage_Floor(b *info.DamageZone) bool {
func (e *Effect36) DamageFloor(b *info.DamageZone) bool {
if !e.can {
return true
}

View File

@@ -3,8 +3,6 @@ package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 自身体力小于1/n时威力为m倍
@@ -15,9 +13,9 @@ type Effect37 struct {
func (e *Effect37) Skill_Hit() bool {
cmphp := e.GetInput().CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(int64(e.Args()[0])))
cmphp := e.GetInput().CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.GetInput().CurrentPet.GetHP().Cmp(cmphp) == -1 {
e.Ctx().SkillEntity.Power *= e.Args()[1]
e.Ctx().SkillEntity.Power *= int(e.Args()[1].IntPart())
}
return true
}

View File

@@ -36,11 +36,11 @@ func (e *Effect38) OnSkill() bool {
// 命中之后
func (e *Effect38_sub) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if uint32(e.Args()[0]) < e.Ctx().Our.CurrentPet.Info.MaxHp {
if e.Args()[0].Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) == -1 {
e.l.Do(func() {
e.oldtype = e.Ctx().Our.CurrentPet.Info.MaxHp
e.Ctx().Our.CurrentPet.Info.MaxHp -= uint32(e.Args()[0])
e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Args()[0])
})

View File

@@ -26,9 +26,10 @@ func (e *Effect41) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
t1 := e.Input.FightC
t2 := t1.GetRand()
n := t2.Int31n(int32(e.Args()[1]-e.Args()[0]+1)) + int32(e.Args()[0])
e.EffectNode.Duration(int(n))
n := t2.Int31n(int32(e.Args()[1].Sub(e.Args()[0]).Add(alpacadecimal.NewFromInt(1)).IntPart()))
e.EffectNode.Duration(int(e.Args()[0].Add(alpacadecimal.NewFromInt(int64(n))).IntPart()))
}

View File

@@ -13,7 +13,7 @@ import (
type Effect46 struct {
node.EffectNode
//StatusID int
conut int
conut int64
}
func (e *Effect46) Damage_DIV_ex(t *info.DamageZone) bool {
@@ -26,7 +26,7 @@ func (e *Effect46) Damage_DIV_ex(t *info.DamageZone) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Args()[0] == e.conut {
if e.Args()[0].IntPart() == e.conut {
e.Alive(false)
return true
}

View File

@@ -25,7 +25,7 @@ func (e *Effect47) SetArgs(t *input.Input, a ...int) {
//e.CanStack(-1)//后续的不会顶掉这个效果
e.EffectNode.SetArgs(t, a...)
e.Duration(e.Args()[0]) //次数类,无限回合
e.Duration(int(e.Args()[0].IntPart())) //次数类,无限回合
}

View File

@@ -32,7 +32,7 @@ func (e *Effect48) SetArgs(t *input.Input, a ...int) {
//e.CanStack(-1)//后续的不会顶掉这个效果
e.EffectNode.SetArgs(t, a...)
e.Duration(e.Args()[0]) //次数类,无限回合
e.Duration(int(e.Args()[0].IntPart())) //次数类,无限回合
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 可以抵挡n点伤害
@@ -27,8 +25,8 @@ func (e *Effect49) Damage_SUB_ex(t *info.DamageZone) bool {
//fmt.Println("Effect49_o", t.Damage)
if t.Type == info.DamageType.Red {
if alpacadecimal.NewFromInt(int64(e.Args()[0])).Cmp(t.Damage) == -1 {
t.Damage = t.Damage.Sub(alpacadecimal.NewFromInt(int64(e.Args()[0])))
if e.Args()[0].Cmp(t.Damage) == -1 {
t.Damage = t.Damage.Sub(e.Args()[0])
}
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// n 回合使对方攻击伤害是正常状态下的 1/m
@@ -29,7 +27,7 @@ func (e *Effect54) Damage_DIV_ex(t *info.DamageZone) bool {
//fmt.Println("Effect54_o", t.Damage)
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(int64(e.Args()[1])))
t.Damage = t.Damage.Div(e.Args()[1])
}
//fmt.Println("Effect54_n", t.Damage)

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -33,7 +31,7 @@ func (e *Effect57) OnSkill() bool {
if !e.Hit() {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(int64(e.Args()[1])))
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}

View File

@@ -52,8 +52,8 @@ func (e *Effect59) Switch(in *input.Input, at info.AttackValue, oldpet *info.Bat
return true
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0]), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1]), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1, info.AbilityOpType.ADD)
e.Alive(false)
return true
}

View File

@@ -26,12 +26,12 @@ func (e *Effect65) Skill_Hit() bool {
return true
}
if info.EnumCategory(e.Ctx().SkillEntity.Move.Type) != info.EnumCategory(e.Args()[1]) {
if info.EnumCategory(e.Ctx().SkillEntity.Move.Type) != info.EnumCategory(e.Args()[1].IntPart()) {
return true
}
//技能威力=【165-65*【当前体力百分比】】,任意体力百分比对应的威力浮动范围∈[-10+10]
e.Ctx().SkillEntity.Power *= e.Args()[2]
e.Ctx().SkillEntity.Power *= int(e.Args()[2].IntPart())
return true
}

View File

@@ -15,7 +15,7 @@ type Effect68 struct {
StatusID int
}
func (e *Effect68) Damage_Lock_ex(t *info.DamageZone) bool {
func (e *Effect68) DamageLock_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}

View File

@@ -22,6 +22,7 @@ func init() {
type Effect7 struct {
node.EffectNode
max alpacadecimal.Decimal
}
func (e *Effect7) Action_start(a, b *action.SelectSkillAction) bool {
@@ -31,7 +32,7 @@ func (e *Effect7) Action_start(a, b *action.SelectSkillAction) bool {
return true
}
func (e *Effect7) Damage_Lock(t *info.DamageZone) bool {
func (e *Effect7) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
@@ -40,6 +41,23 @@ func (e *Effect7) Damage_Lock(t *info.DamageZone) bool {
if e.Ctx().Our.CurrentPet.Info.Hp <= e.Ctx().Opp.CurrentPet.Info.Hp {
t.Damage = alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp - e.Ctx().Our.CurrentPet.Info.Hp))
e.max = t.Damage
}
}
// fmt.Println("Effect7_new", t.Damage.IntPart())
return true
}
func (e *Effect7) DamageLock(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if t.Damage.Cmp(e.max) == 1 {
t.Damage = e.max
}

View File

@@ -28,7 +28,7 @@ func (e *Effect76) OnSkill() bool {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {
return true
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -33,6 +31,6 @@ func (e *Effect77) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, alpacadecimal.NewFromInt(int64(e.Args()[1])))
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
return true
}

View File

@@ -20,10 +20,11 @@ func init() {
type Effect8 struct {
node.EffectNode
max alpacadecimal.Decimal
}
// 伤害落实前触发,限制最大伤害
func (e *Effect8) Damage_Lock(t *info.DamageZone) bool {
// DamageFloor 伤害落实前触发,限制最大伤害
func (e *Effect8) DamageFloor(t *info.DamageZone) bool {
if t.Type == info.DamageType.Red {
t.Damage = alpacadecimal.NewFromInt(utils.Min(t.Damage.IntPart(),
int64(e.Ctx().Opp.CurrentPet.Info.Hp)-1))
@@ -32,3 +33,19 @@ func (e *Effect8) Damage_Lock(t *info.DamageZone) bool {
return true
}
func (e *Effect8) DamageLock(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if t.Damage.Cmp(e.max) == 1 {
t.Damage = e.max
}
}
// fmt.Println("Effect7_new", t.Damage.IntPart())
return true
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -28,13 +26,13 @@ func (e *Effect88) Damage_Mul(t *info.DamageZone) bool {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {
return true
}
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[1])))
t.Damage = t.Damage.Mul(e.Args()[1])
}

View File

@@ -4,8 +4,6 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
/**
@@ -37,7 +35,7 @@ func (e *Effect89) Skill_Useed() bool {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(int64(e.Args()[1]))))
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[1]))
return true
}

View File

@@ -28,7 +28,7 @@ func (e *Effect93) OnSkill() bool {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100)
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {
return true
}

View File

@@ -36,7 +36,7 @@ func (e *Effect95) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Ctx().Opp.StatEffect_Exist(input.StatusSleep) {
return true
}
e.Ctx().SkillEntity.CritRate += e.Args()[0]
e.Ctx().SkillEntity.CritRate += int(e.Args()[0].IntPart())
return true
}

View File

@@ -98,7 +98,7 @@ func conditionIsFrozen(e *EffectConditionalAddDamage) bool {
// conditionIsTypeX判断对方是否为X属性对方为X性则附加n点伤害
func conditionIsTypeX(e *EffectConditionalAddDamage) bool {
// 示例假设Args[0]为目标属性值,判断对方属性是否匹配
return e.Ctx().Opp.CurrentPet.PetInfo.Gender == e.Args()[0]
return e.Ctx().Opp.CurrentPet.PetInfo.Gender == int(e.Args()[0].IntPart())
}
// conditionIsAbnormal判断对方是否处于任意异常状态

View File

@@ -8,6 +8,7 @@ import (
"blazing/modules/blazing/model"
"github.com/alpacahq/alpacadecimal"
"github.com/brunoga/deep"
"github.com/gogf/gf/v2/util/gconv"
"github.com/tnnmigga/enum"
@@ -143,14 +144,14 @@ func (our *Input) GetCurrAttr(id int) model.PetInfo {
}
// 比较两个[]int是否内容相等
func equalInts(a, b []int) bool {
func equalInts(a, b []alpacadecimal.Decimal) bool {
// 先判断长度是否相等
if len(a) != len(b) {
return false
}
// 逐个比较元素
for i := range a {
if a[i] != b[i] {
if a[i].IntPart() != b[i].IntPart() {
return false
}
}

View File

@@ -127,7 +127,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
if ok {
ok = our.Opp.Exec(func(t Effect) bool {
t.Damage_Floor(sub) //红伤落实,内部有befer
t.DamageFloor(sub) //红伤落实,内部有befer
return true
})
@@ -158,7 +158,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
if ok && in != our {
ok = our.Opp.Exec(func(t Effect) bool {
t.Damage_Lock(sub)
t.DamageLock(sub)
return true
})
@@ -167,7 +167,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
if ok {
our.Exec(func(t Effect) bool {
t.Damage_Lock_ex(sub)
t.DamageLock_ex(sub)
return true
})

View File

@@ -3,6 +3,8 @@ package input
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"github.com/alpacahq/alpacadecimal"
)
type Effect interface {
@@ -23,12 +25,12 @@ type Effect interface {
Damage_ADD(*info.DamageZone) bool // 攻击前触发 ,这时候就是+区间
Damage_Mul(*info.DamageZone) bool // 攻击触发
Damage_Floor(*info.DamageZone) bool // 保底伤害
Damage_DIV_ex(*info.DamageZone) bool //受击前触发 这时候就是百分比减伤区间
Damage_SUB_ex(*info.DamageZone) bool // 受击触发 这时候就是点数减伤
Damage_Lock(*info.DamageZone) bool //锁定伤害
Damage_Lock_ex(*info.DamageZone) bool //被动方锁定伤害
Damage_Shield(*info.DamageZone) bool // 护盾值变化时触发
DamageFloor(*info.DamageZone) bool // 保底伤害
Damage_DIV_ex(*info.DamageZone) bool //受击前触发 这时候就是百分比减伤区间
Damage_SUB_ex(*info.DamageZone) bool // 受击触发 这时候就是点数减伤
DamageLock(*info.DamageZone) bool //锁定伤害
DamageLock_ex(*info.DamageZone) bool //被动方锁定伤害
Damage_Shield(*info.DamageZone) bool // 护盾值变化时触发
//Damage_Use() bool // 伤害作用
Skill_Use_ex() bool //技能PP减少节点
Skill_Useed() bool //技能PP减少节点
@@ -51,7 +53,7 @@ type Effect interface {
//boss是进入防守方才被添加抵御异常状态效果的boss免疫的实质是给挑战者挂载一个阻止添加给对手的debuff
EFFect_Befer(in *Input, effEffect Effect) bool //属性免疫
SetArgs(input *Input, param ...int)
Args() []int
Args() []alpacadecimal.Decimal
// 治疗相关触发
Heal_Pre(action.BattleActionI, *int) bool // 治疗前触发 回复翻倍效果
//Heal(action.BattleActionI) bool // 治疗生效时触发 药剂反噬

View File

@@ -11,7 +11,7 @@ func (e *EffectNode) Damage_Mul(_ *info.DamageZone) bool {
return true
}
func (e *EffectNode) Damage_Floor(_ *info.DamageZone) bool {
func (e *EffectNode) DamageFloor(_ *info.DamageZone) bool {
return true
}
@@ -23,11 +23,11 @@ func (e *EffectNode) Damage_SUB_ex(_ *info.DamageZone) bool {
return true
}
func (e *EffectNode) Damage_Lock(_ *info.DamageZone) bool {
func (e *EffectNode) DamageLock(_ *info.DamageZone) bool {
return true
}
func (e *EffectNode) Damage_Lock_ex(_ *info.DamageZone) bool {
func (e *EffectNode) DamageLock_ex(_ *info.DamageZone) bool {
return true
}

View File

@@ -4,6 +4,8 @@ import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"sync"
"github.com/alpacahq/alpacadecimal"
)
// 检查,激活,延后
@@ -97,9 +99,15 @@ func (e *EffectNode) SetArgs(t *input.Input, a ...int) {
e.SideEffectArgs = a
}
func (e *EffectNode) Args() []int {
func (e *EffectNode) Args() []alpacadecimal.Decimal {
var ret []alpacadecimal.Decimal
return e.SideEffectArgs
for _, v := range e.SideEffectArgs {
ret = append(ret, alpacadecimal.NewFromInt(int64(v)))
}
return ret
}

View File

@@ -65,7 +65,7 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
})
if effect.Trait1Idx != 0 {
r := grand.Intn(3)
r := grand.Intn(4)
switch r {
case 0:
return gconv.Uint32(effect2s[effect.Trait1Idx].Remark)

View File

@@ -379,7 +379,7 @@
<NewSeIdx Idx="55" Stat="1" Eid="8" Args="4" />
<NewSeIdx Idx="56" Stat="1" Eid="8" Args="8" />
<NewSeIdx Idx="57" Stat="1" Eid="9" Args="0 100" />
<NewSeIdx Idx="57" Stat="1" Eid="9" Args="100" />
<NewSeIdx Idx="58" Stat="1" Eid="10" Args="" />
@@ -420,8 +420,8 @@
<NewSeIdx Idx="83" Stat="1" Eid="22" Args="100" />
<NewSeIdx Idx="84" Stat="1" Eid="23" Args="15 16960" Desc="1000000" />
<NewSeIdx Idx="85" Stat="1" Eid="23" Args="0 20000" />
<NewSeIdx Idx="84" Stat="1" Eid="23" Args="1000000" />
<NewSeIdx Idx="85" Stat="1" Eid="23" Args="20000" />
<NewSeIdx Idx="86" Stat="1" Eid="24" Args="10036 10210 20215" />
<NewSeIdx Idx="87" Stat="1" Eid="24" Args="10036 10210 20215 20099" />