2025-11-08 16:38:41 +08:00
|
|
|
|
package effect
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/logic/service/fight/info"
|
|
|
|
|
|
"blazing/logic/service/fight/input"
|
|
|
|
|
|
"blazing/logic/service/fight/node"
|
|
|
|
|
|
|
2025-12-05 00:24:02 +08:00
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
2025-11-08 16:38:41 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 对方体力高于自己时才能命中,将对方体力减到和自己相同
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
input.InitEffect(input.EffectType.Skill, 7, &Effect7{
|
|
|
|
|
|
EffectNode: node.EffectNode{},
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Effect7 struct {
|
|
|
|
|
|
node.EffectNode
|
2025-12-06 15:11:42 +08:00
|
|
|
|
max alpacadecimal.Decimal
|
2025-11-08 16:38:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 22:10:34 +08:00
|
|
|
|
func (e *Effect7) SkillHit() bool {
|
2025-11-12 21:44:56 +08:00
|
|
|
|
if e.Ctx().Opp.CurrentPet.Info.Hp <= e.Ctx().Our.CurrentPet.Info.Hp {
|
2025-11-11 05:54:24 +00:00
|
|
|
|
e.Ctx().SkillEntity.Accuracy = 0
|
2025-11-08 16:38:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
2025-12-06 15:11:42 +08:00
|
|
|
|
func (e *Effect7) DamageFloor(t *info.DamageZone) bool {
|
2026-01-04 21:41:10 +08:00
|
|
|
|
|
2025-11-26 23:09:20 +08:00
|
|
|
|
//fmt.Println("Effect7_old", t.Damage.IntPart())
|
2025-11-13 21:36:18 +08:00
|
|
|
|
if t.Type == info.DamageType.Red {
|
2025-11-12 13:44:21 +00:00
|
|
|
|
if e.Ctx().Our.CurrentPet.Info.Hp <= e.Ctx().Opp.CurrentPet.Info.Hp {
|
|
|
|
|
|
|
2025-12-05 00:24:02 +08:00
|
|
|
|
t.Damage = alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp - e.Ctx().Our.CurrentPet.Info.Hp))
|
2025-12-06 15:11:42 +08:00
|
|
|
|
e.max = t.Damage
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
// fmt.Println("Effect7_new", t.Damage.IntPart())
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
func (e *Effect7) DamageLock(t *info.DamageZone) bool {
|
2026-01-04 21:41:10 +08:00
|
|
|
|
|
2025-12-06 15:11:42 +08:00
|
|
|
|
//fmt.Println("Effect7_old", t.Damage.IntPart())
|
|
|
|
|
|
if t.Type == info.DamageType.Red {
|
|
|
|
|
|
if t.Damage.Cmp(e.max) == 1 {
|
|
|
|
|
|
|
|
|
|
|
|
t.Damage = e.max
|
2025-11-13 02:43:00 +08:00
|
|
|
|
|
2025-11-12 13:44:21 +00:00
|
|
|
|
}
|
2025-11-08 16:38:41 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
2025-11-26 23:09:20 +08:00
|
|
|
|
// fmt.Println("Effect7_new", t.Damage.IntPart())
|
2025-11-08 16:38:41 +08:00
|
|
|
|
return true
|
|
|
|
|
|
}
|