Files
bl/logic/service/fight/effect/effect_41.go
xinian 875ad668aa
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现战斗效果逻辑和接口重构
2026-03-28 21:57:22 +08:00

53 lines
1.1 KiB
Go

package effect
import (
element "blazing/common/data/Element"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
/**
*m~n回合对本方的火系攻击伤害减半
*/
func init() {
input.InitEffect(input.EffectType.Skill, 41, &Effect41{})
}
// Effect 41: 未在 effectInfo.json 配置说明
type Effect41 struct {
node.EffectNode
}
func (e *Effect41) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(grand.N(int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())))
}
// 伤害落实前触发,限制最大伤害
func (e *Effect41) DamageDivEx(t *info.DamageZone) bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.XML.Type != int(element.ElementTypeFire) {
return true
}
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(2))
}
return true
}