Files
bl/logic/service/fight/effect/effect_411.go
昔念 d367f9d1d4
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
41
2026-03-07 23:54:01 +08:00

50 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}