Files
bl/logic/service/fight/effect/1153_1157.go
2026-04-01 00:48:42 +08:00

193 lines
4.4 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 1153: 解除自身能力下降状态,解除成功则自身下{0}回合受到的伤害减少{1}点
type Effect1153 struct {
node.EffectNode
}
func (e *Effect1153) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
cleared := false
for i, v := range e.Ctx().Our.Prop[:] {
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1153, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1153Sub struct {
RoundEffectArg0Base
}
func (e *Effect1153Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
reduce := e.Args()[1]
if zone.Damage.Cmp(reduce) <= 0 {
zone.Damage = alpacadecimal.Zero
return true
}
zone.Damage = zone.Damage.Sub(reduce)
return true
}
// Effect 1154: {0}回合内使用技能附加{1}点固定伤害,若自身体力低于对手则效果翻倍
type Effect1154 struct {
RoundEffectArg0Base
}
func (e *Effect1154) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
damage := e.Args()[1]
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) < 0 {
damage = damage.Mul(alpacadecimal.NewFromInt(2))
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 1155: 附加自身最大体力值{0}%的百分比伤害,连续使用每次增加{1}%,最高{2}%
type Effect1155 struct {
node.EffectNode
bonus int
}
func (e *Effect1155) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
percent := int(e.Args()[0].IntPart()) + e.bonus
maxPercent := int(e.Args()[2].IntPart())
if percent > maxPercent {
percent = maxPercent
}
if percent <= 0 {
return true
}
damage := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(alpacadecimal.NewFromInt(int64(percent))).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
e.bonus += int(e.Args()[1].IntPart())
return true
}
// Effect 1156: 击败对手则恢复自身全部体力和所有技能PP值
type Effect1156 struct {
node.EffectNode
}
func (e *Effect1156) OnSkill() bool {
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(alpacadecimal.Zero) > 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
e.Ctx().Our.HealPP(-1)
return true
}
// Effect 1157: 消除双方能力提升、下降状态,消除任意一方成功则使对手下{0}次施放的技能无效(包括必中技能)
type Effect1157 struct {
node.EffectNode
}
func (e *Effect1157) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for i := range e.Ctx().Our.Prop[:] {
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1157, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1157Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1157Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1157Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1153, &Effect1153{})
input.InitEffect(input.EffectType.Sub, 1153, &Effect1153Sub{})
input.InitEffect(input.EffectType.Skill, 1154, &Effect1154{})
input.InitEffect(input.EffectType.Skill, 1155, &Effect1155{})
input.InitEffect(input.EffectType.Skill, 1156, &Effect1156{})
input.InitEffect(input.EffectType.Skill, 1157, &Effect1157{})
input.InitEffect(input.EffectType.Sub, 1157, &Effect1157Sub{})
}