43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/action"
|
||
"blazing/logic/service/fight/input"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
// 16. hp 与 battle_lv 的某一种绑定, 自身体力每减少1/8, 则该battle_lv上升1个等级, 最高到12;(a1: which blv)
|
||
// TODO: 实现hp 与 battle_lv 的某一种绑定, 自身体力每减少1/8, 则该battle_lv上升1个等级, 最高到12;(a1: which blv)的核心逻辑
|
||
type NewSel16 struct {
|
||
NewSel0
|
||
curhp alpacadecimal.Decimal
|
||
}
|
||
|
||
func (e *NewSel16) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
||
|
||
// fmt.Println(e.ID().GetCatchTime(), e.Ctx().Our.CurPet[0].Info.CatchTime)
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
|
||
return
|
||
}
|
||
maxHP := e.Ctx().Our.CurPet[0].GetMaxHP()
|
||
if e.curhp.IntPart() == 0 {
|
||
e.curhp = maxHP
|
||
|
||
}
|
||
|
||
//如果当前被扣除的血量少于当前血,说明我方回血
|
||
if e.curhp.Cmp(e.Ctx().Our.CurPet[0].GetHP()) == -1 {
|
||
e.curhp = e.Ctx().Our.CurPet[0].GetHP()
|
||
return
|
||
}
|
||
if e.curhp.Sub(e.Ctx().Our.CurPet[0].GetHP()).Cmp(maxHP.Div(alpacadecimal.NewFromInt(8))) == 1 {
|
||
e.curhp = e.Ctx().Our.CurPet[0].GetHP()
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||
}
|
||
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 16, &NewSel16{})
|
||
}
|