44 lines
836 B
Go
44 lines
836 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
/**
|
|
* 对方体力高于自己时才能命中,将对方体力减到和自己相同
|
|
*/
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 7, &Effect7{
|
|
EffectNode: node.EffectNode{},
|
|
})
|
|
|
|
}
|
|
|
|
type Effect7 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect7) Skill_Hit_Pre(ctx input.Ctx) bool {
|
|
if ctx.CurrentPet.Info.Hp <= e.Input.CurrentPet.Info.Hp {
|
|
ctx.SkillEntity.Accuracy = 0
|
|
}
|
|
|
|
return true
|
|
}
|
|
func (e *Effect7) Damage_Floor(ctx input.Ctx) bool {
|
|
if !e.Hit() {
|
|
return true
|
|
}
|
|
if ctx.DamageZone.Type == info.DamageType.Red {
|
|
ctx.DamageZone.Damage = decimal.NewFromInt(int64(ctx.CurrentPet.Info.Hp - e.Input.CurrentPet.Info.Hp))
|
|
|
|
}
|
|
|
|
return true
|
|
}
|