refactor(fight/effect): 重构效果触发时机处理,统一命中前/后接口并移除冗余方法
This commit is contained in:
@@ -42,15 +42,17 @@ func init() {
|
||||
|
||||
}
|
||||
func (e *Effect10) OnHit(opp *input.Input, skill *info.SkillEntity) {
|
||||
t, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[0], 100)
|
||||
if t {
|
||||
if e.Hit() {
|
||||
t, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[0], 100)
|
||||
if t {
|
||||
|
||||
t1 := e.Input.FightC.GetRand().Int31n(3)
|
||||
t1 := e.Input.FightC.GetRand().Int31n(3)
|
||||
|
||||
eff := input.Geteffect(input.EffectType.Status, int(e.Status))
|
||||
eff.Effect.Duration(int(t1 + 1))
|
||||
e.Input.AddEffect(eff)
|
||||
eff := input.Geteffect(input.EffectType.Status, int(e.Status))
|
||||
eff.Effect.Duration(int(t1 + 1))
|
||||
e.Input.AddEffect(eff)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -23,7 +24,7 @@ func init() {
|
||||
|
||||
}
|
||||
|
||||
func (e *Effect62) SkillUseEnd(opp *input.Input) {
|
||||
func (e *Effect62) AfterHit(*input.Input, *info.SkillEntity) {
|
||||
if e.Duration() != 1 { //说明还没到生效节点
|
||||
e.Hide = true //隐藏效果
|
||||
} else {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user