refactor(fight): 统一战斗系统函数命名规范 统一了boss技能和效果系统中的函数命名规范,将下划线命名方式 改为驼峰命名方式,提高代码一致性和可读性。 函数名变更包括: - Prop_Befer -> PropBefer - Damage_DIV_ex -> DamageDivEx - Compare_Pre -> ComparePre - Skill_Hit_ex -> SkillHit_ex - Damage_SUB_ex -> DamageSubEx - Skill_Hit -> SkillHit - DamageLock_ex -> DamageLock_ex 同时更新了相关注释中的函数名引用,
56 lines
1.1 KiB
Go
56 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) 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.Type != int(element.ElementTypeFire) {
|
|
return true
|
|
}
|
|
if t.Type == info.DamageType.Red {
|
|
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(2))
|
|
|
|
}
|
|
|
|
return true
|
|
}
|