- 为多个效果(effect_38、effect_45、effect_51、effect_55、effect_56)添加 `Alive` 方法, 用于在效果结束时还原精灵被修改的属性(如 MaxHp、Prop[0]、Prop[1]、PetInfo.Type)。 - 统一将对精灵属性类型的访问由 `PType` 修改为 `PetInfo.Type`,提升代码一致性与可维护性。 - 移除旧的回合开始/结束时手动保存和还原精灵信息的逻辑
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/action"
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
)
|
|
|
|
/**
|
|
* 降低对方 n 点 btl_Max体力
|
|
*/
|
|
type Effect38 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect38) OnSkill() bool {
|
|
if !e.Hit() {
|
|
return true
|
|
}
|
|
|
|
ee := &Effect38_sub{}
|
|
ee.EffectNode.Duration(-1) //给对方挂3回合子buff
|
|
ee.ID(e.ID() + int(input.EffectType.Sub)) //子效果ID
|
|
|
|
ee.SetArgs(e.Ctx().Our, e.SideEffectArgs...)
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, ee)
|
|
return true
|
|
}
|
|
|
|
// 命中之后
|
|
func (e *Effect38_sub) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
|
if uint32(e.Args()[0]) < e.Ctx().Our.CurrentPet.Info.MaxHp {
|
|
e.oldtype = e.Ctx().Our.CurrentPet.Info.MaxHp
|
|
e.Ctx().Our.CurrentPet.Info.MaxHp -= uint32(e.Args()[0])
|
|
}
|
|
|
|
}
|
|
func (e *Effect38_sub) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool {
|
|
return true
|
|
}
|
|
|
|
type Effect38_sub struct {
|
|
node.EffectNode
|
|
oldtype uint32
|
|
}
|
|
|
|
func (e *Effect38_sub) 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.Info.MaxHp = e.oldtype
|
|
}
|
|
}
|
|
return e.EffectNode.Alive()
|
|
}
|
|
|
|
func init() {
|
|
ret := &Effect38{}
|
|
|
|
input.InitEffect(input.EffectType.Skill, 38, ret)
|
|
|
|
}
|