Files
bl/logic/service/fight/effect/effect_41.go

56 lines
1.1 KiB
Go
Raw Normal View History

2025-11-13 23:48:34 +08:00
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"
2025-11-13 23:48:34 +08:00
)
/**
*m~n回合对本方的火系攻击伤害减半
*/
func init() {
input.InitEffect(input.EffectType.Skill, 41, &Effect41{})
}
type Effect41 struct {
node.EffectNode
}
2025-11-16 20:30:17 +00:00
func (e *Effect41) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
t1 := e.Input.FightC
t2 := t1.GetRand()
n := t2.Int31n(int32(e.Args()[1].Sub(e.Args()[0]).Add(alpacadecimal.NewFromInt(1)).IntPart()))
e.EffectNode.Duration(int(e.Args()[0].Add(alpacadecimal.NewFromInt(int64(n))).IntPart()))
2025-11-16 20:30:17 +00:00
}
2025-11-13 23:48:34 +08:00
// 伤害落实前触发,限制最大伤害
func (e *Effect41) DamageDivEx(t *info.DamageZone) bool {
2025-11-13 23:48:34 +08:00
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
2025-11-13 23:48:34 +08:00
return true
}
if e.Ctx().SkillEntity.XML.Type != int(element.ElementTypeFire) {
2025-11-13 23:48:34 +08:00
return true
}
if t.Type == info.DamageType.Red {
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(2))
2025-11-13 23:48:34 +08:00
}
return true
}