66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
// 59. 按一定条件触发魔王的附身,触发时,受到伤害时n回合内反弹m%伤害给玩家
|
||
type NewSel59 struct {
|
||
NewSel0
|
||
|
||
// 记录反弹效果的剩余回合数
|
||
reflectTurns int
|
||
}
|
||
|
||
// TODO: 需要了解魔王的附身触发条件
|
||
func (e *NewSel59) Action_end_ex() bool {
|
||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
|
||
// TODO: 这里需要根据某个条件触发魔王的附身
|
||
// 触发后,设置反弹效果的回合数和百分比
|
||
// e.reflectTurns = int(e.Args()[0].IntPart())
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *NewSel59) DamageSubEx(t *info.DamageZone) bool {
|
||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
|
||
// 检查是否处于反弹效果中
|
||
if e.reflectTurns > 0 {
|
||
// 反弹m%伤害给对手
|
||
reflectDamage := t.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: reflectDamage,
|
||
})
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *NewSel59) TurnEnd() {
|
||
// 魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return
|
||
}
|
||
|
||
// 减少反弹效果剩余回合数
|
||
if e.reflectTurns > 0 {
|
||
e.reflectTurns--
|
||
}
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 59, &NewSel59{})
|
||
}
|