refactor(fight/effect): 重构效果触发时机处理,统一命中前/后接口并移除冗余方法

This commit is contained in:
1
2025-09-24 20:01:12 +00:00
parent 3314c11b48
commit 5a8d84ed40
7 changed files with 22 additions and 42 deletions

View File

@@ -12,16 +12,6 @@ type Effect0 struct {
node.EffectNode
}
// 技能命中计算
func (this *Effect0) IsHit(opp *input.Input, skill *info.SkillEntity) {
skill.AttackTimeC(int(opp.GetProp(5, true))) //计算命中
}
// 比如xx技能无效
func (this *Effect0) UseSkill(opp *input.Input) bool {
return true
}
func (e *Effect0) TurnEnd(opp *input.Input) {
e.Input.AttackValue.RemainHp = int32(e.Input.CurrentPet.Info.Hp)
@@ -35,7 +25,6 @@ func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
e.Input.Exec(func(t input.Effect) bool { //计算暴击率加成
t.IsCrit(opp, skill)
e.Input.AttackValue.IsCritical = skill.Crit
return e.Input.AttackValue.IsCritical == 0
})
@@ -45,7 +34,8 @@ func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
}
}
func (this *Effect0) IsCrit(opp *input.Input, skill *info.SkillEntity) {
func (this *Effect0) BeforHit(opp *input.Input, skill *info.SkillEntity) {
skill.AttackTimeC(int(opp.GetProp(5, true))) //计算命中
skill.Crit = 0
CritRate := utils.Max(skill.CritRate, 1)
CritRateR := this.Input.FightC.GetRand().Int31n(16)