50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/utils"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
func init() {
|
||
t := &Effect411{}
|
||
t.Duration(-1) //次数类无限回合
|
||
t.CanStack(true) //后续的不会顶掉这个效果
|
||
input.InitEffect(input.EffectType.Skill, 411, t)
|
||
|
||
}
|
||
|
||
// 411 - 附加对手当前体力值n%的百分比伤害,连续使用每次增加m%,最高k%
|
||
type Effect411 struct {
|
||
node.EffectNode
|
||
Skillid int //记录使用的技能 ,如果技能变了就删除effect
|
||
UseSkillCount int //技能使用了多少次,切换后置0
|
||
}
|
||
|
||
func (e *Effect411) OnSkill() bool {
|
||
if e.Skillid != 0 && e.Ctx().SkillEntity.ID != e.Skillid {
|
||
e.Alive(false)
|
||
e.UseSkillCount = 0
|
||
return true
|
||
|
||
}
|
||
e.Skillid = e.Ctx().SkillEntity.ID
|
||
opponentHp := e.Ctx().Opp.CurrentPet.GetHP()
|
||
|
||
addhe := utils.Min(e.Args()[1].IntPart()*int64(e.UseSkillCount), e.Args()[2].IntPart())
|
||
|
||
// 附加百分比伤害
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: opponentHp.Mul((e.Args()[0].Add(alpacadecimal.NewFromInt(addhe))).Mul(alpacadecimal.NewFromInt(100))),
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
|
||
e.UseSkillCount++
|
||
|
||
return true
|
||
}
|