diff --git a/logic/service/fight/effect/effect_38.go b/logic/service/fight/effect/effect_38.go index 61d120b2..2e58affe 100644 --- a/logic/service/fight/effect/effect_38.go +++ b/logic/service/fight/effect/effect_38.go @@ -54,14 +54,11 @@ type Effect38_sub struct { } func (e *Effect38_sub) Alive(t ...bool) bool { - defer func() { - if len(t) > 0 { - if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 - //还原属性 - e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype - } - } - }() + + if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 + //还原属性 + e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype + } return e.EffectNode.Alive(t...) } diff --git a/logic/service/fight/effect/effect_45.go b/logic/service/fight/effect/effect_45.go index 98486e0e..813ea59a 100644 --- a/logic/service/fight/effect/effect_45.go +++ b/logic/service/fight/effect/effect_45.go @@ -40,15 +40,13 @@ func (e *Effect45) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } + func (e *Effect45) Alive(t ...bool) bool { - defer func() { - if len(t) > 0 { - if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 - //还原属性 - e.Ctx().Our.CurrentPet.Info.Prop[1] = e.oldtype - } - } - }() + + if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 + //还原属性 + e.Ctx().Our.CurrentPet.Info.Prop[1] = e.oldtype + } return e.EffectNode.Alive(t...) } diff --git a/logic/service/fight/effect/effect_51.go b/logic/service/fight/effect/effect_51.go index 47269ba0..9e3ca6f3 100644 --- a/logic/service/fight/effect/effect_51.go +++ b/logic/service/fight/effect/effect_51.go @@ -14,17 +14,8 @@ type Effect51 struct { oldtype uint32 } -func (e *Effect51) OnSkill() bool { - if !e.Hit() { - return true - } - - return true -} func (e *Effect51) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { - if !e.Hit() { - return - } + e.oldtype = e.Ctx().Opp.CurrentPet.Info.Prop[0] e.Ctx().Our.CurrentPet.Info.Prop[0] = e.Ctx().Opp.CurrentPet.Info.Prop[0] } @@ -40,16 +31,13 @@ func (e *Effect51) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } + func (e *Effect51) Alive(t ...bool) bool { - if !e.Hit() { - return e.EffectNode.Alive() + + if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 + //还原属性 + e.Ctx().Our.CurrentPet.Info.Prop[0] = e.oldtype } - e.EffectNode.Alive(t...) - if len(t) > 0 { - if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 - //还原属性 - e.Ctx().Our.CurrentPet.Info.Prop[0] = e.oldtype - } - } - return e.EffectNode.Alive() + + return e.EffectNode.Alive(t...) } diff --git a/logic/service/fight/effect/effect_55.go b/logic/service/fight/effect/effect_55.go index 9eaccaba..44620164 100644 --- a/logic/service/fight/effect/effect_55.go +++ b/logic/service/fight/effect/effect_55.go @@ -13,17 +13,8 @@ type Effect55 struct { node.EffectNode } -func (e *Effect55) OnSkill() bool { - if !e.Hit() { - return true - } - - return true -} func (e *Effect55) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { - if !e.Hit() { - return - } + e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type } func init() { @@ -38,15 +29,13 @@ func (e *Effect55) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } + func (e *Effect55) Alive(t ...bool) bool { - if !e.Hit() { - return e.EffectNode.Alive() + + if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 + //还原属性 + e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type } - e.EffectNode.Alive(t...) - if len(t) > 0 { - if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 - e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type - } - } - return e.EffectNode.Alive() + + return e.EffectNode.Alive(t...) } diff --git a/logic/service/fight/effect/effect_56.go b/logic/service/fight/effect/effect_56.go index 6e493fd6..8320ed63 100644 --- a/logic/service/fight/effect/effect_56.go +++ b/logic/service/fight/effect/effect_56.go @@ -14,17 +14,8 @@ type Effect56 struct { oldtype int } -func (e *Effect56) OnSkill() bool { - if !e.Hit() { - return true - } - - return true -} func (e *Effect56) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { - if !e.Hit() { - return - } + e.oldtype = e.Ctx().Opp.CurrentPet.PetInfo.Type e.Ctx().Our.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type } @@ -40,16 +31,13 @@ func (e *Effect56) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } + func (e *Effect56) Alive(t ...bool) bool { - if !e.Hit() { - return e.EffectNode.Alive() + + if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 + //还原属性 + e.Ctx().Our.CurrentPet.PetInfo.Type = e.oldtype } - e.EffectNode.Alive(t...) - if len(t) > 0 { - if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 - //还原属性 - e.Ctx().Our.CurrentPet.PetInfo.Type = e.oldtype - } - } - return e.EffectNode.Alive() + + return e.EffectNode.Alive(t...) } diff --git a/logic/service/fight/effect/effect_91.go b/logic/service/fight/effect/effect_91.go index ad54220a..805807ec 100644 --- a/logic/service/fight/effect/effect_91.go +++ b/logic/service/fight/effect/effect_91.go @@ -33,9 +33,6 @@ func (e *Effect91) SetArgs(t *input.Input, a ...int) { } func (e *Effect91) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { - if !e.Hit() { - return - } for i, v := range e.Ctx().Opp.Prop { diff --git a/logic/service/fight/input/prop.go b/logic/service/fight/input/prop.go index b9ff03ac..6b6c50cb 100644 --- a/logic/service/fight/input/prop.go +++ b/logic/service/fight/input/prop.go @@ -73,22 +73,24 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb case info.AbilityOpType.Reverse: currentProp := target.AttackValue.Prop[prop] - if level > 0 { // 反转强化(仅当有强化时生效) + if level > 0 { // 反转强化(仅当有强化时生效:+N → -N,需扣除2*N) if currentProp <= 0 { return false } - // 强化反转:当前值currentProp → -currentProp(调整量为-2*currentProp) - if calcNewValue(prop, -2*currentProp, info.AbilityOpType.ADD) { + // 强化反转:调整量为-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 { // 反转弱化(仅当有弱化时生效) + } else { // 反转弱化(仅当有弱化时生效:-N → +N,需增加2*N) if currentProp >= 0 { return false } - // 弱化反转:当前值currentProp → -currentProp(调整量为-2*currentProp) - if calcNewValue(prop, -2*currentProp, info.AbilityOpType.ADD) { + // 弱化反转:调整量为-2*currentProp(从-N到+N需要增加2N),用ADD操作 + adjustLevel := -2 * currentProp + if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) { target.AttackValue.Prop[prop] = newValue return true } @@ -110,10 +112,35 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb return false case info.AbilityOpType.COPY: - // 复制对手属性:将自身属性调整为与对手一致(在范围内) - oppProp := target.Opp.AttackValue.Prop[prop] - adjustLevel := oppProp - target.AttackValue.Prop[prop] - return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD) + // 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限) + 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) diff --git a/logic/service/fight/node/node.go b/logic/service/fight/node/node.go index 350bf1f2..7051aed4 100644 --- a/logic/service/fight/node/node.go +++ b/logic/service/fight/node/node.go @@ -105,3 +105,10 @@ func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool { func (e *EffectNode) Prop_Befer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool { return true } +func (e *EffectNode) GetBool(t ...bool) bool { + + if len(t) > 0 { + return t[0] + } + return false +}