Files
bl/logic/service/fight/effect/1358_1362.go
2026-04-01 02:53:23 +08:00

141 lines
3.8 KiB
Go

package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1358: {0}回合内每回合{1}%闪避对手攻击,未触发则令对手下{2}次使用的攻击技能无效
type Effect1358 struct{ RoundEffectArg0Base }
func (e *Effect1358) SkillHit_ex() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime == 2 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok && e.Ctx().SkillEntity.SetMiss() {
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2062, int(e.Args()[2].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1359: 将自身能力下降状态反馈给对手,反馈成功则自身全属性+{0},反馈失败则解除自身能力下降状态
type Effect1359 struct{ node.EffectNode }
func (e *Effect1359) OnSkill() bool {
reflected := false
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v) {
reflected = true
}
}
if reflected {
if len(e.Args()) == 0 {
return true
}
boost := int8(e.Args()[0].IntPart())
for i := range e.Ctx().Our.Prop[:] {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
}
return true
}
for i, v := range e.Ctx().Our.Prop[:] {
if v < 0 {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
// Effect 1360: 自己出手时若自身体力高于对手则造成的伤害提升{0}%
type Effect1360 struct{ node.EffectNode }
func (e *Effect1360) SkillHit() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
// Effect 1361: 消除对手能力提升状态,消除成功则恢复自身所有体力,若对手不处于能力提升状态则{0}回合内对手无法通过自身技能恢复体力
type Effect1361 struct{ node.EffectNode }
func (e *Effect1361) Skill_Use() bool {
hadPositive := false
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
hadPositive = true
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if cleared {
if e.Ctx().Our.CurrentPet != nil {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
}
return true
}
if hadPositive || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 679, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1362: 先出手时吸取对手{0}点体力
type Effect1362 struct{ node.EffectNode }
func (e *Effect1362) OnSkill() bool {
if len(e.Args()) == 0 || !e.IsFirst() || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
drain := e.Args()[0]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1358, &Effect1358{})
input.InitEffect(input.EffectType.Skill, 1359, &Effect1359{})
input.InitEffect(input.EffectType.Skill, 1360, &Effect1360{})
input.InitEffect(input.EffectType.Skill, 1361, &Effect1361{})
input.InitEffect(input.EffectType.Skill, 1362, &Effect1362{})
}