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

137 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 1368: 消除对手所有护盾效果,消除成功则对手下{0}回合所有技能失效
type Effect1368 struct{ node.EffectNode }
func (e *Effect1368) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.ConsumeAllShield()
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 902, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1369: {0}回合内每回合{1}%令对手使用的攻击技能无效,未触发则当回合受到的攻击伤害减少{2}%
type Effect1369 struct {
RoundEffectArg0Base
reduceCurrentAttack bool
}
func (e *Effect1369) ActionStart(a, b *action.SelectSkillAction) bool {
e.reduceCurrentAttack = false
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok {
e.Ctx().SkillEntity.SetMiss()
return true
}
e.reduceCurrentAttack = true
return true
}
func (e *Effect1369) DamageDivEx(zone *info.DamageZone) bool {
if !e.reduceCurrentAttack || zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Sub(e.Args()[2])).Div(hundred)
e.reduceCurrentAttack = false
return true
}
// Effect 1370: 消除对手回合类效果,消除成功则对手{0},未触发则{1}回合内对手无法通过自身技能恢复体力
type Effect1370 struct{ node.EffectNode }
func (e *Effect1370) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before > 0 {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 679, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1371: 若自身未满体力则吸取对手最大体力的1/{0}
type Effect1371 struct{ node.EffectNode }
func (e *Effect1371) OnSkill() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) >= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 1372: {0}回合内对手使用攻击技能则{1}%{2},未触发则消除对手回合类效果
type Effect1372 struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1372) Skill_Use_ex() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok && addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) {
e.triggered = true
}
return true
}
func (e *Effect1372) TurnEnd() {
if !e.triggered && e.Duration() == 1 {
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
}
e.EffectNode.TurnEnd()
}
func init() {
input.InitEffect(input.EffectType.Skill, 1368, &Effect1368{})
input.InitEffect(input.EffectType.Skill, 1369, &Effect1369{})
input.InitEffect(input.EffectType.Skill, 1370, &Effect1370{})
input.InitEffect(input.EffectType.Skill, 1371, &Effect1371{})
input.InitEffect(input.EffectType.Skill, 1372, &Effect1372{})
}