refactor(effect): 更新状态枚举类型为 EnumPetStatus 将多个技能效果文件中的 EnumBattleStatus 类型统一更新为 EnumPetStatus, 以更准确地反映其用途。同时修改了相关函数签名和变量声明。 此外,清理了部分注释格式,并补充了关于被动效果不能被免疫的说明。 ```
42 lines
785 B
Go
42 lines
785 B
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/shopspring/decimal"
|
||
)
|
||
|
||
/**
|
||
* 损失1/2的体力,给于对手同等的伤害
|
||
*/
|
||
type Effect80 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func init() {
|
||
|
||
input.InitEffect(input.EffectType.Skill, 80, &Effect80{})
|
||
|
||
}
|
||
|
||
// 命中之后
|
||
// 特攻+2速度+1命中+1,
|
||
func (e *Effect80) OnSkill() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
att := decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)).Div(decimal.NewFromInt(2))
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: att,
|
||
})
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: att,
|
||
})
|
||
return true
|
||
}
|