diff --git a/logic/service/fight/boss/NewSeIdx_1.go b/logic/service/fight/boss/NewSeIdx_1.go index ba57697e1..73a934f30 100644 --- a/logic/service/fight/boss/NewSeIdx_1.go +++ b/logic/service/fight/boss/NewSeIdx_1.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -36,7 +35,7 @@ type NewSel1 struct { NewSel0 } -func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool { +func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8) bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if !e.IsOwner() { @@ -47,7 +46,7 @@ func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8, ptype info.E } //能力下降类 - if ptype == info.AbilityOpType.SUB { + if level < 0 { return false diff --git a/logic/service/fight/boss/NewSeIdx_112.go b/logic/service/fight/boss/NewSeIdx_112.go index f782529a4..fef2ad868 100644 --- a/logic/service/fight/boss/NewSeIdx_112.go +++ b/logic/service/fight/boss/NewSeIdx_112.go @@ -30,7 +30,7 @@ func (e *NewSel112) DamageDivEx(t *info.DamageZone) bool { return true } - 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()[0].IntPart()), 1) e.count++ return true } diff --git a/logic/service/fight/boss/NewSeIdx_12.go b/logic/service/fight/boss/NewSeIdx_12.go index 2d09b3f9c..465f6cb8a 100644 --- a/logic/service/fight/boss/NewSeIdx_12.go +++ b/logic/service/fight/boss/NewSeIdx_12.go @@ -30,7 +30,7 @@ func (e *NewSel12) DamageDivEx(t *info.DamageZone) bool { return true } - 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()[0].IntPart()), 1) e.count++ return true } diff --git a/logic/service/fight/boss/NewSeIdx_144.go b/logic/service/fight/boss/NewSeIdx_144.go index 520c11e7d..6897348f6 100644 --- a/logic/service/fight/boss/NewSeIdx_144.go +++ b/logic/service/fight/boss/NewSeIdx_144.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) @@ -27,7 +26,7 @@ func (e *NewSel144) Action_end_ex() bool { e.Ctx().Our.CurrentPet.Info.Hp = e.Ctx().Our.CurrentPet.Info.MaxHp e.Ctx().Our.HealPP(-1) for i := 0; i < 6; i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 6, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 6) } } diff --git a/logic/service/fight/boss/NewSeIdx_16.go b/logic/service/fight/boss/NewSeIdx_16.go index 9112fd080..2b3b4be20 100644 --- a/logic/service/fight/boss/NewSeIdx_16.go +++ b/logic/service/fight/boss/NewSeIdx_16.go @@ -2,7 +2,6 @@ package effect import ( "blazing/logic/service/fight/action" - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "github.com/alpacahq/alpacadecimal" @@ -34,7 +33,7 @@ func (e *NewSel16) TurnStart(fattack *action.SelectSkillAction, sattack *action. } if e.curhp.Sub(e.Ctx().Our.CurrentPet.GetHP()).Cmp(maxHP.Div(alpacadecimal.NewFromInt(8))) == 1 { e.curhp = e.Ctx().Our.CurrentPet.GetHP() - 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()[0].IntPart()), 1) } } diff --git a/logic/service/fight/boss/NewSeIdx_283.go b/logic/service/fight/boss/NewSeIdx_283.go index 4873fdff6..d6e844e63 100644 --- a/logic/service/fight/boss/NewSeIdx_283.go +++ b/logic/service/fight/boss/NewSeIdx_283.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) @@ -20,7 +19,7 @@ func (e *NewSel283) SkillUseed() bool { if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 { for i := 0; i < 6; i++ { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(e.Args()[1].IntPart())) } } diff --git a/logic/service/fight/boss/NewSeIdx_34.go b/logic/service/fight/boss/NewSeIdx_34.go index f3c728d75..f944fb330 100644 --- a/logic/service/fight/boss/NewSeIdx_34.go +++ b/logic/service/fight/boss/NewSeIdx_34.go @@ -30,7 +30,7 @@ func (e *NewSel34) DamageDivEx(t *info.DamageZone) bool { return true } - e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), -1, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), -1) return true } func init() { diff --git a/logic/service/fight/boss/NewSeIdx_35.go b/logic/service/fight/boss/NewSeIdx_35.go index bc79e70c7..333b4e4ec 100644 --- a/logic/service/fight/boss/NewSeIdx_35.go +++ b/logic/service/fight/boss/NewSeIdx_35.go @@ -29,7 +29,7 @@ func (e *NewSel35) DamageDivEx(t *info.DamageZone) bool { return true } - 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()[0].IntPart()), 1) return true } func init() { diff --git a/logic/service/fight/boss/NewSeIdx_408.go b/logic/service/fight/boss/NewSeIdx_408.go index 708916be8..db75644e7 100644 --- a/logic/service/fight/boss/NewSeIdx_408.go +++ b/logic/service/fight/boss/NewSeIdx_408.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) @@ -19,7 +18,7 @@ func (e *NewSel408) Action_end_ex() bool { // TODO: 需要判断是否是PVP战斗 for i := 0; i < 6; i++ { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) } // 消除对手的能力强化效果 diff --git a/logic/service/fight/effect/137.go b/logic/service/fight/effect/137.go index a72d5d4c2..c12608d97 100644 --- a/logic/service/fight/effect/137.go +++ b/logic/service/fight/effect/137.go @@ -23,9 +23,9 @@ func (e *Effect137) OnSkill() bool { Damage: halfHp, } e.Ctx().Our.Damage(e.Ctx().Our, damageZone) - e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2) - e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2) return true } diff --git a/logic/service/fight/effect/150.go b/logic/service/fight/effect/150.go index 15ecfb871..b2efef1e0 100644 --- a/logic/service/fight/effect/150.go +++ b/logic/service/fight/effect/150.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -12,9 +11,9 @@ type Effect150 struct { } func (e *Effect150) Skill_Use() bool { - e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1])) - e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1])) return true } func (e *Effect150) SetArgs(t *input.Input, a ...int) { diff --git a/logic/service/fight/effect/155.go b/logic/service/fight/effect/155.go index 24ae85fbd..7cbc99afd 100644 --- a/logic/service/fight/effect/155.go +++ b/logic/service/fight/effect/155.go @@ -20,7 +20,7 @@ func (e *Effect155) OnSkill() bool { // 消除所有能力下降 for i := 0; i < 6; i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -1, info.AbilityOpType.RESET) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) } // 使自己进入睡眠n回合 sleepEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Sleep)) diff --git a/logic/service/fight/effect/157.go b/logic/service/fight/effect/157.go index 47131d4c7..47a4722bb 100644 --- a/logic/service/fight/effect/157.go +++ b/logic/service/fight/effect/157.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -15,9 +14,9 @@ func (e *Effect157) Skill_Use_ex() bool { if e.Ctx().SkillEntity == nil { return true } - e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -1, info.AbilityOpType.SUB) - e.Ctx().Opp.SetProp(e.Ctx().Our, 3, -1, info.AbilityOpType.SUB) - e.Ctx().Opp.SetProp(e.Ctx().Our, 5, -1, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -1) + e.Ctx().Opp.SetProp(e.Ctx().Our, 3, -1) + e.Ctx().Opp.SetProp(e.Ctx().Our, 5, -1) return true } diff --git a/logic/service/fight/effect/166.go b/logic/service/fight/effect/166.go index 5e8a6234c..beada769d 100644 --- a/logic/service/fight/effect/166.go +++ b/logic/service/fight/effect/166.go @@ -18,7 +18,7 @@ func (e *Effect166) Skill_Use_ex() bool { if success { effectType := int8(e.Args()[1].IntPart()) // XX类型 effectValue := int8(e.Args()[2].IntPart()) // 等级k - e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue) } } diff --git a/logic/service/fight/effect/190.go b/logic/service/fight/effect/190.go index 7811f8c39..88b894643 100644 --- a/logic/service/fight/effect/190.go +++ b/logic/service/fight/effect/190.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -18,7 +17,7 @@ func (e *Effect190) Skill_Use_ex() bool { // 消除对手所有能力强化状态 for i, _ := range e.Ctx().Opp.Prop[:] { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) } return true diff --git a/logic/service/fight/effect/196.go b/logic/service/fight/effect/196.go index 05043ebdf..fd0252183 100644 --- a/logic/service/fight/effect/196.go +++ b/logic/service/fight/effect/196.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -17,14 +16,14 @@ func (e *Effect196) OnSkill() bool { effectValue := e.Args()[5].IntPart() // 等级-k success, _, _ := e.Input.Player.Roll(int(chance), 100) if success { - e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue)) } } else { // 后出手 chance := e.Args()[1].IntPart() // j% effectValue := e.Args()[2].IntPart() // 等级-k success, _, _ := e.Input.Player.Roll(int(chance), 100) if success { - e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue)) } } diff --git a/logic/service/fight/effect/198.go b/logic/service/fight/effect/198.go index 8f7f23811..f97be8bde 100644 --- a/logic/service/fight/effect/198.go +++ b/logic/service/fight/effect/198.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" @@ -14,12 +13,12 @@ type Effect198 struct { } func (e *Effect198) OnSkill() bool { - numStats := int(e.Args()[0].IntPart()) // n种能力 + numStats := int(e.Args()[0].IntPart()) // n种能力 reduction := int8(e.Args()[1].IntPart()) // 等级-m // 随机选择n种能力 for i := 0; i < numStats; i++ { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(grand.Intn(5)), reduction, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(grand.Intn(5)), reduction) } return true diff --git a/logic/service/fight/effect/403.go b/logic/service/fight/effect/403.go index 747bf43cb..4ceeda959 100644 --- a/logic/service/fight/effect/403.go +++ b/logic/service/fight/effect/403.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -22,8 +21,8 @@ func (e *Effect403) OnSkill() bool { boostValue *= 2 } - e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue, info.AbilityOpType.ADD) - e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue) + e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue) } return true diff --git a/logic/service/fight/effect/418.go b/logic/service/fight/effect/418.go index 2e50b7f99..38bac22b0 100644 --- a/logic/service/fight/effect/418.go +++ b/logic/service/fight/effect/418.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -14,7 +13,7 @@ type Effect418 struct { func (e *Effect418) OnSkill() bool { for _, v := range e.Ctx().Opp.Prop[:] { if v > 0 { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1])) return true } diff --git a/logic/service/fight/effect/424.go b/logic/service/fight/effect/424.go index d17be3fb5..2128fe029 100644 --- a/logic/service/fight/effect/424.go +++ b/logic/service/fight/effect/424.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -12,7 +11,7 @@ type Effect424 struct { } func (e *Effect424) Skill_Use() bool { - e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart())) return true } diff --git a/logic/service/fight/effect/427.go b/logic/service/fight/effect/427.go index 93bcdae36..4e282001b 100644 --- a/logic/service/fight/effect/427.go +++ b/logic/service/fight/effect/427.go @@ -17,9 +17,9 @@ func (e *Effect427) Skill_Use() bool { } if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { // 降低对手防御 - e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1])) - e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1])) } return true diff --git a/logic/service/fight/effect/437.go b/logic/service/fight/effect/437.go index c83fe6262..c4845a880 100644 --- a/logic/service/fight/effect/437.go +++ b/logic/service/fight/effect/437.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -16,7 +15,7 @@ func (e *Effect437) OnSkill() bool { for _, v := range e.Ctx().Opp.Prop[:] { if v > 0 { - e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1])) return true } diff --git a/logic/service/fight/effect/473.go b/logic/service/fight/effect/473.go index 28efaeff8..9e727380d 100644 --- a/logic/service/fight/effect/473.go +++ b/logic/service/fight/effect/473.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -18,7 +17,7 @@ func (e *Effect473) Skill_Use() bool { if damageDone.IntPart() < int64(damageThreshold) { effectType := int(e.Args()[1].IntPart()) // XX类型 effectValue := int(e.Args()[2].IntPart()) // 等级+n - e.Ctx().Our.SetProp(e.Ctx().Our, int8(effectType), int8(effectValue), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(effectType), int8(effectValue)) } return true diff --git a/logic/service/fight/effect/477.go b/logic/service/fight/effect/477.go index 5cf0da942..f3127c6c8 100644 --- a/logic/service/fight/effect/477.go +++ b/logic/service/fight/effect/477.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -17,7 +16,7 @@ func (e *Effect477) Skill_Use_ex() bool { } for i, effectId := range e.SideEffectArgs[1:] { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId)) } return true diff --git a/logic/service/fight/effect/504.go b/logic/service/fight/effect/504.go index 21f2a4286..3c0cf5312 100644 --- a/logic/service/fight/effect/504.go +++ b/logic/service/fight/effect/504.go @@ -23,7 +23,7 @@ func (e *Effect504) OnSkill() bool { } } else { for i, effectId := range e.SideEffectArgs[1:] { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId)) } } diff --git a/logic/service/fight/effect/EffectDefeatTrigger.go b/logic/service/fight/effect/EffectDefeatTrigger.go index 918abe4a1..272b616d6 100644 --- a/logic/service/fight/effect/EffectDefeatTrigger.go +++ b/logic/service/fight/effect/EffectDefeatTrigger.go @@ -155,7 +155,7 @@ func (e *EffectDefeatTrigger) triggerLevelUpOnDefeat(_ model.AttackValue) { } // 3. 提升对应等级 - e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2]), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2])) } // triggerNextEnemyStatusOnDefeat:击败指定类型对手后,下一个出场对手进入指定状态(对应Effect185) diff --git a/logic/service/fight/effect/effct_122.go b/logic/service/fight/effect/effct_122.go index c7fb02dec..e94c59829 100644 --- a/logic/service/fight/effect/effct_122.go +++ b/logic/service/fight/effect/effct_122.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -47,9 +46,9 @@ func (e *Effect122) OnSkill() bool { if e.rev { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount)) } else { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount)) } } diff --git a/logic/service/fight/effect/effect_107.go b/logic/service/fight/effect/effect_107.go index 03d11e90d..15b0c5680 100644 --- a/logic/service/fight/effect/effect_107.go +++ b/logic/service/fight/effect/effect_107.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" @@ -28,7 +27,7 @@ func (e *Effect107) Skill_Use() bool { //说明伤害小于N if d == -1 { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1) } return true } diff --git a/logic/service/fight/effect/effect_110.go b/logic/service/fight/effect/effect_110.go index 302125f14..d61f5f52e 100644 --- a/logic/service/fight/effect/effect_110.go +++ b/logic/service/fight/effect/effect_110.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -32,7 +31,7 @@ func (e *Effect110) Skill_Use_ex() bool { return true } - e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[2]), 1, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[2]), 1) return true } diff --git a/logic/service/fight/effect/effect_119_123.go b/logic/service/fight/effect/effect_119_123.go index decfca971..3aad8dcb7 100644 --- a/logic/service/fight/effect/effect_119_123.go +++ b/logic/service/fight/effect/effect_119_123.go @@ -45,7 +45,7 @@ func (e *Effect119) DamageLock(damageValue *info.DamageZone) bool { // 偶数:30%速度+1 ok, _, _ := e.Input.Player.Roll(30, 100) if ok { - e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1) } } e.can = false @@ -144,7 +144,7 @@ func (e *Effect123) Be_Damage(at, _ alpacadecimal.Decimal) { if e.can { propIndex := int(e.Args()[1].IntPart()) changeAmount := int(e.Args()[2].IntPart()) - e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount)) e.can = false } } diff --git a/logic/service/fight/effect/effect_124_126.go b/logic/service/fight/effect/effect_124_126.go index 5204e3690..d4b42ccdc 100644 --- a/logic/service/fight/effect/effect_124_126.go +++ b/logic/service/fight/effect/effect_124_126.go @@ -2,7 +2,6 @@ package effect import ( "blazing/logic/service/fight/action" - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -27,12 +26,7 @@ func (e *Effect124) OnSkill() bool { // 随机选择一个属性(0-5,包含攻击、防御、特攻、特防、速度、命中) propIndex := int(e.Input.FightC.GetRand().Int31n(6)) - opType := info.AbilityOpType.ADD - if changeAmount < 0 { - opType = info.AbilityOpType.SUB - } - - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount)) return true } @@ -53,10 +47,10 @@ func (e *Effect126) TurnStart(_, _ *action.SelectSkillAction) { changeAmount := int(e.Args()[1].IntPart()) // 攻击等级+1 (属性索引0) - e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount)) // 速度等级+1 (属性索引4) - e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount)) } // ----------------------------------------------------------- diff --git a/logic/service/fight/effect/effect_147_159.go b/logic/service/fight/effect/effect_147_159.go index cb9f07279..c5f4396ae 100644 --- a/logic/service/fight/effect/effect_147_159.go +++ b/logic/service/fight/effect/effect_147_159.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -54,11 +53,8 @@ func (e *Effect148) OnSkill() bool { ok, _, _ := e.Input.Player.Roll(chance, 100) if ok { - opType := info.AbilityOpType.ADD - if changeAmount < 0 { - opType = info.AbilityOpType.SUB - } - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType) + + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount)) } return true diff --git a/logic/service/fight/effect/effect_182.go b/logic/service/fight/effect/effect_182.go index 005e2944f..0f2455dc7 100644 --- a/logic/service/fight/effect/effect_182.go +++ b/logic/service/fight/effect/effect_182.go @@ -28,7 +28,7 @@ func (e *Effect182) OnSkill() bool { if !success { return true } - e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), int8(e.Args()[3].IntPart()), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), int8(e.Args()[3].IntPart())) } return true diff --git a/logic/service/fight/effect/effect_189.go b/logic/service/fight/effect/effect_189.go index 50839bb30..9707f797d 100644 --- a/logic/service/fight/effect/effect_189.go +++ b/logic/service/fight/effect/effect_189.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -16,8 +15,8 @@ func (e *Effect189) Skill_Use_ex() bool { return true } - e.Ctx().Opp.SetProp(e.Ctx().Our, 0, -1, info.AbilityOpType.SUB) - e.Ctx().Opp.SetProp(e.Ctx().Our, 2, -1, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, 0, -1) + e.Ctx().Opp.SetProp(e.Ctx().Our, 2, -1) return true } diff --git a/logic/service/fight/effect/effect_409.go b/logic/service/fight/effect/effect_409.go index 5bb2f8d2d..a11420938 100644 --- a/logic/service/fight/effect/effect_409.go +++ b/logic/service/fight/effect/effect_409.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -17,7 +16,7 @@ func (e *Effect409) SetArgs(t *input.Input, a ...int) { } func (e *Effect409) Skill_Use() bool { - e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart())), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart()))) return true } func init() { diff --git a/logic/service/fight/effect/effect_414.go b/logic/service/fight/effect/effect_414.go index ba4a1874e..ce73e2649 100644 --- a/logic/service/fight/effect/effect_414.go +++ b/logic/service/fight/effect/effect_414.go @@ -18,9 +18,9 @@ type Effect414 struct { // 使用技能时,不可被继承,继承Miss和Hit就行 func (e *Effect414) OnSkill() bool { if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[2].IntPart())) { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart())*2, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart())*2) } else { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart())) } return true diff --git a/logic/service/fight/effect/effect_416.go b/logic/service/fight/effect/effect_416.go index 253d40e69..6e3bcf1f7 100644 --- a/logic/service/fight/effect/effect_416.go +++ b/logic/service/fight/effect/effect_416.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -15,7 +14,7 @@ func (e *Effect416) Skill_Use_ex() bool { effectType := int8(e.Args()[1].IntPart()) // XX类型 effectValue := int8(e.Args()[2].IntPart()) // 降低m个等级 - e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue) return true } diff --git a/logic/service/fight/effect/effect_448.go b/logic/service/fight/effect/effect_448.go index 9149cc9ea..d5bb18e0f 100644 --- a/logic/service/fight/effect/effect_448.go +++ b/logic/service/fight/effect/effect_448.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -19,9 +18,9 @@ func (e *Effect448) OnSkill() bool { for i, v := range e.SideEffectArgs[1:] { if e.rev { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v)) } else { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v)) } } diff --git a/logic/service/fight/effect/effect_47.go b/logic/service/fight/effect/effect_47.go index 9acf07ad3..af644be44 100644 --- a/logic/service/fight/effect/effect_47.go +++ b/logic/service/fight/effect/effect_47.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -14,8 +13,8 @@ type Effect47 struct { conut int } -func (e *Effect47) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool { - if in == e.Ctx().Opp && ptype == info.AbilityOpType.SUB { +func (e *Effect47) PropBefer(in *input.Input, prop int8, level int8) bool { + if in == e.Ctx().Opp && level < 0 { return false } diff --git a/logic/service/fight/effect/effect_487.go b/logic/service/fight/effect/effect_487.go index 34fc00208..5a3949ff1 100644 --- a/logic/service/fight/effect/effect_487.go +++ b/logic/service/fight/effect/effect_487.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" @@ -18,7 +17,7 @@ func (e *Effect487) OnSkill() bool { if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) > 0 { // 提升自身攻击等级 - e.Ctx().Our.SetProp(e.Ctx().Our, 0, 1, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 0, 1) } return true diff --git a/logic/service/fight/effect/effect_490.go b/logic/service/fight/effect/effect_490.go index dd2b14add..571fdcaba 100644 --- a/logic/service/fight/effect/effect_490.go +++ b/logic/service/fight/effect/effect_490.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" @@ -19,7 +18,7 @@ func (e *Effect490) Skill_Use_ex() bool { if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 { // 提升自身速度等级 - e.Ctx().Our.SetProp(e.Ctx().Our, 5, speedBoost, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 5, speedBoost) } return true diff --git a/logic/service/fight/effect/effect_4_5.go b/logic/service/fight/effect/effect_4_5.go index 8c8bba491..355436090 100644 --- a/logic/service/fight/effect/effect_4_5.go +++ b/logic/service/fight/effect/effect_4_5.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) @@ -61,19 +60,13 @@ func (e *EffectStat) OnSkill() bool { return true } - // 判断加减类型 - opType := info.AbilityOpType.ADD - if level < 0 { - opType = info.AbilityOpType.SUB - } - // 执行属性变化 if e.Etype { // 对方属性变化 - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level)) } else { // 自身属性变化 - e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level)) } return true diff --git a/logic/service/fight/effect/effect_79.go b/logic/service/fight/effect/effect_79.go index a98e57cad..058af16db 100644 --- a/logic/service/fight/effect/effect_79.go +++ b/logic/service/fight/effect/effect_79.go @@ -25,9 +25,9 @@ func init() { // 特攻+2速度+1命中+1, func (e *Effect79) OnSkill() bool { - e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2, info.AbilityOpType.ADD) - e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD) - e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1, info.AbilityOpType.ADD) + e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2) + e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1) + e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1) e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)).Div(alpacadecimal.NewFromInt(2)), diff --git a/logic/service/fight/effect/effect_prop.go b/logic/service/fight/effect/effect_prop.go index c399d4476..1d9f74b24 100644 --- a/logic/service/fight/effect/effect_prop.go +++ b/logic/service/fight/effect/effect_prop.go @@ -11,7 +11,6 @@ type Effect3 struct { node.EffectNode Reverse bool Level int8 - OpType info.EnumAbilityOpType } // ---------------------- @@ -23,10 +22,10 @@ func (e *Effect3) OnSkill() bool { for i := 0; i < 6; i++ { if e.Reverse { // 对对手生效 - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType) + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level) } else { // 对自己生效 - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level) } } @@ -36,11 +35,10 @@ func (e *Effect3) OnSkill() bool { // ---------------------- // 工厂函数 // ---------------------- -func newEffect3(reverse bool, level int8, opType info.EnumAbilityOpType) *Effect3 { +func newEffect3(reverse bool, level int) *Effect3 { return &Effect3{ Reverse: reverse, Level: level, - OpType: opType, } } diff --git a/logic/service/fight/effect/selfkill.go b/logic/service/fight/effect/selfkill.go index 9d70c90a1..d8efdf478 100644 --- a/logic/service/fight/effect/selfkill.go +++ b/logic/service/fight/effect/selfkill.go @@ -57,8 +57,8 @@ func (e *Effect59) TurnStart(fattack *action.SelectSkillAction, sattack *action. if !e.can { return } - 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.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1) + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1) e.Alive(false) return } diff --git a/logic/service/fight/info/battle.go b/logic/service/fight/info/battle.go index 82fc8ac52..72bcafe82 100644 --- a/logic/service/fight/info/battle.go +++ b/logic/service/fight/info/battle.go @@ -99,17 +99,17 @@ type Playerinvite struct { //挂载到[]Playerinvite上? 被邀请者->邀请 InviteTime uint32 //游戏模式 } -// 能力操作类型枚举 -type EnumAbilityOpType string +// // 能力操作类型枚举 +// type EnumAbilityOpType string -var AbilityOpType = enum.New[struct { - ADD EnumAbilityOpType `enum:"1"` // 能力增加(强化) - SUB EnumAbilityOpType `enum:"2"` // 能力减少(弱化) - COPY EnumAbilityOpType `enum:"3"` // 复制强化/弱化 - RESET EnumAbilityOpType `enum:"4"` // 能力重置 +// var AbilityOpType = enum.New[struct { +// ADD EnumAbilityOpType `enum:"1"` // 能力增加(强化) +// SUB EnumAbilityOpType `enum:"2"` // 能力减少(弱化) +// COPY EnumAbilityOpType `enum:"3"` // 复制强化/弱化 +// RESET EnumAbilityOpType `enum:"4"` // 能力重置 - StealStrengthen EnumAbilityOpType `enum:"6"` // 吸取强化 - Reverse EnumAbilityOpType `enum:"7"` // 反转强化/弱化 +// StealStrengthen EnumAbilityOpType `enum:"6"` // 吸取强化 +// Reverse EnumAbilityOpType `enum:"7"` // 反转强化/弱化 - BounceWeaken EnumAbilityOpType `enum:"10"` // 弹弱(反弹弱化效果) -}]() +// BounceWeaken EnumAbilityOpType `enum:"10"` // 弹弱(反弹弱化效果) +// }]() diff --git a/logic/service/fight/input/interface.go b/logic/service/fight/input/interface.go index 21231e4f4..4ea5d7d88 100644 --- a/logic/service/fight/input/interface.go +++ b/logic/service/fight/input/interface.go @@ -51,8 +51,8 @@ type Effect interface { TurnEnd() //回合结束计算 HookAction() bool //出手前的hook参数,返回false阻止继续出手 //PreBattleEnd() bool //战斗结束前 - OnBattleEnd() bool //战斗结束 - PropBefer(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool //锁定属性 + OnBattleEnd() bool //战斗结束 + PropBefer(in *Input, prop, level int8) bool //锁定属性 //效果添加时候应该区分主动方和被动方来确认是主动添加的还是受击添加的 //boss是进入防守方才被添加抵御异常状态效果的,boss免疫的实质是给挑战者挂载一个阻止添加给对手的debuff EFFect_Befer(in *Input, effEffect Effect) bool //属性免疫 diff --git a/logic/service/fight/input/prop.go b/logic/service/fight/input/prop.go index 6e949b5cf..71b777ca8 100644 --- a/logic/service/fight/input/prop.go +++ b/logic/service/fight/input/prop.go @@ -1,157 +1,196 @@ package input -import ( - "blazing/common/utils" - "blazing/logic/service/fight/info" -) - -// 攻击,防御,特攻,特防,速度,命中 -// 施加方(source),属性类型(prop),等级(level),操作类别(opType),返回是否成功 -func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAbilityOpType) bool { +func (target *Input) SetProp(source *Input, index, level int8) bool { // 前置状态结算:判断是否允许执行属性操作 canExecute := target.Exec(func(effect Effect) bool { // 执行前置效果,返回true表示可以继续操作 - return effect.PropBefer(source, prop, level, opType) + return effect.PropBefer(source, index, level) }) if !canExecute { return false } - var newValue int8 - // 计算新属性值并判断操作是否有效(属性是否会发生变化) - calcNewValue := func(p, l int8, t info.EnumAbilityOpType) bool { - switch t { - case info.AbilityOpType.ADD: - // 属性提升,上限为6 - if l < 0 { - l = -l - } - newValue = utils.Min(target.AttackValue.Prop[p]+l, 6) - if newValue > target.AttackValue.Prop[p] { - //fmt.Println("属性值会增加") - return true - } - //fmt.Println("属性值不会增加") - return false - - case info.AbilityOpType.SUB: - if l > 0 { - l = -l - } - // 属性降低,下限为-6 - newValue = utils.Max(target.AttackValue.Prop[p]+l, -6) - if newValue < target.AttackValue.Prop[p] { - //fmt.Println("属性值会减少") - return true - } - //fmt.Println("属性值不会减少") - return false - - case info.AbilityOpType.RESET: - // 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0) - if (level > 0 && target.AttackValue.Prop[p] > 0) || - (level < 0 && target.AttackValue.Prop[p] < 0) { - newValue = 0 - return true - } - return false - } - return false - } - - switch opType { - case info.AbilityOpType.StealStrengthen: - // 窃取强化:获取对手的强化属性并转移到自身 - oppProp := target.Opp.AttackValue.Prop[prop] - if oppProp <= 0 { // 对手无强化,无法窃取 - return false - } - // 尝试添加对手的强化值到自身 - if calcNewValue(prop, oppProp, info.AbilityOpType.ADD) { - target.AttackValue.Prop[prop] = newValue - // 窃取后清除对手的强化 - target.Opp.SetProp(source, prop, 1, info.AbilityOpType.RESET) - return true - } - return false - - case info.AbilityOpType.Reverse: - currentProp := target.AttackValue.Prop[prop] - if level > 0 { // 反转强化(仅当有强化时生效:+N → -N,需扣除2*N) - if currentProp <= 0 { - return false - } - // 强化反转:调整量为-2*currentProp(从+N到-N需要减少2N),用SUB操作 - adjustLevel := -2 * currentProp - if calcNewValue(prop, adjustLevel, info.AbilityOpType.SUB) { - target.AttackValue.Prop[prop] = newValue - return true - } - return false - } else { // 反转弱化(仅当有弱化时生效:-N → +N,需增加2*N) - if currentProp >= 0 { - return false - } - // 弱化反转:调整量为-2*currentProp(从-N到+N需要增加2N),用ADD操作 - adjustLevel := -2 * currentProp - if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) { - target.AttackValue.Prop[prop] = newValue - return true - } - return false - } - - case info.AbilityOpType.BounceWeaken: - // 反弹弱化:将自身弱化转移给对手并清除自身弱化 - currentProp := target.AttackValue.Prop[prop] - if currentProp >= 0 { // 无弱化可反弹 - return false - } - // 向对手施加同等弱化 - if target.Opp.SetProp(source, prop, currentProp, info.AbilityOpType.SUB) { - // 清除自身弱化 - target.SetProp(source, prop, -1, info.AbilityOpType.RESET) - return true - } - return false - - case info.AbilityOpType.COPY: - // 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限) - oppProp := target.Opp.AttackValue.Prop[prop] // 对手的属性值(可正可负) - currentProp := target.AttackValue.Prop[prop] // 自身当前属性值 - - // 1. 计算叠加后的目标值(自身+对手) - targetProp := currentProp + oppProp - - // 2. 限制目标值在 [-6, 6] 范围内 - if targetProp > 6 { - targetProp = 6 - } else if targetProp < -6 { - targetProp = -6 - } - - // 3. 若目标值与当前值一致,无需操作 - if targetProp == currentProp { - return false - } - - // 4. 根据目标值与当前值的差异,选择 ADD 或 SUB 操作叠加 - if targetProp > currentProp { - // 目标值更高:用 ADD 操作提升(调整量为差值) - adjustLevel := targetProp - currentProp - return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD) + switch { + case level < 0: + if target.AttackValue.Prop[index] > -6 { + target.AttackValue.Prop[index] -= level } else { - // 目标值更低:用 SUB 操作降低(调整量为差值的绝对值) - adjustLevel := currentProp - targetProp - return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.SUB) + return false } - default: - // 处理常规操作(ADD/SUB/RESET) - if calcNewValue(prop, level, opType) { - target.AttackValue.Prop[prop] = newValue - return true + case level > 0: + if target.AttackValue.Prop[index] < 6 { + target.AttackValue.Prop[index] += level + } else { + return false } - return false + + case level == 0: + + if target.AttackValue.Prop[index] != 0 { + target.AttackValue.Prop[index] = 0 + return true + } else { + return false + } + // // 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0) + // if (level > 0 && target.AttackValue.Prop[p] > 0) || + // (level < 0 && target.AttackValue.Prop[p] < 0) { + // newValue = 0 + // return true + // } + //return true } + return true } + +// // 攻击,防御,特攻,特防,速度,命中 +// // 施加方(source),属性类型(prop),等级(level), 返回是否成功 +// func (target *Input) SetProp(source *Input, prop, level int8) bool { +// // 前置状态结算:判断是否允许执行属性操作 +// canExecute := target.Exec(func(effect Effect) bool { +// // 执行前置效果,返回true表示可以继续操作 +// return effect.PropBefer(source, prop, level) +// }) +// if !canExecute { +// return false +// } + +// var newValue int8 +// // 计算新属性值并判断操作是否有效(属性是否会发生变化) +// calcNewValue := func(p, l int8, t info.EnumAbilityOpType) bool { +// switch t { +// case info.AbilityOpType.ADD: +// // 属性提升,上限为6 +// if l < 0 { +// l = -l +// } +// newValue = utils.Min(target.AttackValue.Prop[p]+l, 6) +// if newValue > target.AttackValue.Prop[p] { +// //fmt.Println("属性值会增加") +// return true +// } +// //fmt.Println("属性值不会增加") +// return false + +// case info.AbilityOpType.SUB: +// if l > 0 { +// l = -l +// } +// // 属性降低,下限为-6 +// newValue = utils.Max(target.AttackValue.Prop[p]+l, -6) +// if newValue < target.AttackValue.Prop[p] { +// //fmt.Println("属性值会减少") +// return true +// } +// //fmt.Println("属性值不会减少") +// return false + +// case info.AbilityOpType.RESET: +// // 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0) +// if (level > 0 && target.AttackValue.Prop[p] > 0) || +// (level < 0 && target.AttackValue.Prop[p] < 0) { +// newValue = 0 +// return true +// } +// return false +// } +// return false +// } + +// switch opType { +// case info.AbilityOpType.StealStrengthen: +// // 窃取强化:获取对手的强化属性并转移到自身 +// oppProp := target.Opp.AttackValue.Prop[prop] +// if oppProp <= 0 { // 对手无强化,无法窃取 +// return false +// } +// // 尝试添加对手的强化值到自身 +// if calcNewValue(prop, oppProp, info.AbilityOpType.ADD) { +// target.AttackValue.Prop[prop] = newValue +// // 窃取后清除对手的强化 +// target.Opp.SetProp(source, prop, 1, info.AbilityOpType.RESET) +// return true +// } +// return false + +// case info.AbilityOpType.Reverse: +// currentProp := target.AttackValue.Prop[prop] +// if level > 0 { // 反转强化(仅当有强化时生效:+N → -N,需扣除2*N) +// if currentProp <= 0 { +// return false +// } +// // 强化反转:调整量为-2*currentProp(从+N到-N需要减少2N),用SUB操作 +// adjustLevel := -2 * currentProp +// if calcNewValue(prop, adjustLevel, info.AbilityOpType.SUB) { +// target.AttackValue.Prop[prop] = newValue +// return true +// } +// return false +// } else { // 反转弱化(仅当有弱化时生效:-N → +N,需增加2*N) +// if currentProp >= 0 { +// return false +// } +// // 弱化反转:调整量为-2*currentProp(从-N到+N需要增加2N),用ADD操作 +// adjustLevel := -2 * currentProp +// if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) { +// target.AttackValue.Prop[prop] = newValue +// return true +// } +// return false +// } + +// case info.AbilityOpType.BounceWeaken: +// // 反弹弱化:将自身弱化转移给对手并清除自身弱化 +// currentProp := target.AttackValue.Prop[prop] +// if currentProp >= 0 { // 无弱化可反弹 +// return false +// } +// // 向对手施加同等弱化 +// if target.Opp.SetProp(source, prop, currentProp, info.AbilityOpType.SUB) { +// // 清除自身弱化 +// target.SetProp(source, prop, -1, info.AbilityOpType.RESET) +// return true +// } +// return false + +// case info.AbilityOpType.COPY: +// // 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限) +// oppProp := target.Opp.AttackValue.Prop[prop] // 对手的属性值(可正可负) +// currentProp := target.AttackValue.Prop[prop] // 自身当前属性值 + +// // 1. 计算叠加后的目标值(自身+对手) +// targetProp := currentProp + oppProp + +// // 2. 限制目标值在 [-6, 6] 范围内 +// if targetProp > 6 { +// targetProp = 6 +// } else if targetProp < -6 { +// targetProp = -6 +// } + +// // 3. 若目标值与当前值一致,无需操作 +// if targetProp == currentProp { +// return false +// } + +// // 4. 根据目标值与当前值的差异,选择 ADD 或 SUB 操作叠加 +// if targetProp > currentProp { +// // 目标值更高:用 ADD 操作提升(调整量为差值) +// adjustLevel := targetProp - currentProp +// return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD) +// } else { +// // 目标值更低:用 SUB 操作降低(调整量为差值的绝对值) +// adjustLevel := currentProp - targetProp +// return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.SUB) +// } + +// default: +// // 处理常规操作(ADD/SUB/RESET) +// if calcNewValue(prop, level, opType) { +// target.AttackValue.Prop[prop] = newValue +// return true +// } +// return false +// } +// } diff --git a/logic/service/fight/node/node.go b/logic/service/fight/node/node.go index 046066949..f357b2fef 100644 --- a/logic/service/fight/node/node.go +++ b/logic/service/fight/node/node.go @@ -2,7 +2,6 @@ package node import ( element "blazing/common/data/Element" - "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "sync" @@ -121,7 +120,7 @@ func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool { return true } -func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool { +func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8) bool { return true }