feat(fight): 实现属性变化还原机制并优化属性操作逻辑

- 为多个效果(effect_38、effect_45、effect_51、effect_55、effect_56)添加 `Alive` 方法,
  用于在效果结束时还原精灵被修改的属性(如 MaxHp、Prop[0]、Prop[1]、PetInfo.Type)。
- 统一将对精灵属性类型的访问由 `PType` 修改为 `PetInfo.Type`,提升代码一致性与可维护性。
- 移除旧的回合开始/结束时手动保存和还原精灵信息的逻辑
This commit is contained in:
2025-11-15 00:15:09 +08:00
parent a86782b1ea
commit d73eb9eb26
12 changed files with 206 additions and 187 deletions

View File

@@ -24,7 +24,7 @@ func (e *Effect55) Turn_Start(fattack *action.SelectSkillAction, sattack *action
if !e.Hit() {
return
}
e.Ctx().Our.CurrentPet.PType, e.Ctx().Opp.CurrentPet.PType = e.Ctx().Opp.CurrentPet.PType, e.Ctx().Our.CurrentPet.PType
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() {
ret := &Effect55{}
@@ -38,3 +38,15 @@ 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()
}
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()
}