Files
bl/logic/service/fight/effect/503.go
xinian 0cff02158b
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 统一效果接口方法名为Skill_Use
2026-03-08 20:07:59 +08:00

44 lines
958 B
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/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 503 - 若造成的伤害不足m则回合结束时对手损失n点固定体力
type Effect503 struct {
node.EffectNode
triggered bool
damageThreshold int
}
func (e *Effect503) Skill_Use() bool {
damageDone := e.Ctx().Our.SumDamage
e.damageThreshold = int(e.Args()[0].IntPart())
if damageDone.IntPart() < int64(e.damageThreshold) {
e.triggered = true
}
return true
}
func (e *Effect503) Action_end_ex() bool {
if e.triggered {
fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: fixedDamage,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.triggered = false
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 503, &Effect503{})
}