57 lines
1.1 KiB
Go
57 lines
1.1 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"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
/**
|
|
* 当次攻击击败对方出战精灵时恢复自身最大体力的1/n
|
|
*/
|
|
type Effect66 struct {
|
|
node.EffectNode
|
|
can bool
|
|
}
|
|
|
|
func init() {
|
|
|
|
input.InitEffect(input.EffectType.Skill, 66, &Effect66{})
|
|
|
|
}
|
|
func (e *Effect66) OnSkill() bool {
|
|
if !e.Hit() {
|
|
return true
|
|
}
|
|
e.can = true
|
|
return true
|
|
}
|
|
|
|
// 重写死亡,如果击败,就出触发死亡事件,判断是目标精灵
|
|
func (e *Effect66) Switch(in *input.Input, at info.AttackValue, outpet *info.BattlePetEntity) bool {
|
|
//技能效果还没生效
|
|
if !e.can {
|
|
return true
|
|
}
|
|
//如果是我方切精灵
|
|
if in == e.Ctx().Our {
|
|
return true
|
|
}
|
|
|
|
if outpet.NotAlive { //如果上一只已经死亡后切换的,对对手直接施加扣血
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, decimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
|
|
|
}
|
|
|
|
return true
|
|
}
|
|
func (e *Effect66) SetArgs(t *input.Input, a ...int) {
|
|
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.EffectNode.Duration(1)
|
|
|
|
}
|