对多个 boss 技能效果文件中的参数调用进行了统一调整,将原先直接使用 `e.Args()[index]` 的地方, 改为通过 `e.Args()[index].IntPart()` 或 `e.Args()[index]` 进行类型转换后再参与逻辑判断或数值计算。 同时修正了部分 HP 比较方式,由整型比较转为 decimal
59 lines
1.1 KiB
Go
59 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"
|
|
)
|
|
|
|
/**
|
|
*m~n回合对本方的火系攻击伤害减半
|
|
*/
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 41, &Effect41{})
|
|
|
|
}
|
|
|
|
type Effect41 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
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()))
|
|
|
|
}
|
|
|
|
// 伤害落实前触发,限制最大伤害
|
|
func (e *Effect41) Damage_DIV_ex(t *info.DamageZone) bool {
|
|
|
|
if !e.Hit() {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
if e.Ctx().SkillEntity.Type != int(element.ElementTypeFire) {
|
|
return true
|
|
}
|
|
if t.Type == info.DamageType.Red {
|
|
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(2))
|
|
|
|
}
|
|
|
|
return true
|
|
}
|