Files
bl/logic/service/fight/effect/790_794.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

213 lines
5.2 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 790: {0}回合内自身所有攻击无视伤害限制效果
type Effect790 struct {
node.EffectNode
}
func (e *Effect790) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 790, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect790Sub struct {
RoundEffectArg0Base
disabled []input.Effect
}
func (e *Effect790Sub) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.disabled = e.disabled[:0]
for _, effect := range e.Ctx().Opp.Effects {
if effect == nil || !effect.Alive() {
continue
}
if _, ok := effect697IgnoredLimitIDs[int(effect.ID().Suffix())]; !ok {
continue
}
effect.Alive(false)
e.disabled = append(e.disabled, effect)
}
return true
}
func (e *Effect790Sub) Skill_Use() bool {
restoreTemporarilyDisabledEffects(e.disabled)
e.disabled = e.disabled[:0]
return true
}
func (e *Effect790Sub) Action_end() bool {
restoreTemporarilyDisabledEffects(e.disabled)
e.disabled = e.disabled[:0]
return true
}
// Effect 791: {0}回合内每回合使用技能恢复自身最大体力的1/{1},恢复体力时若自身当前体力低于对手则恢复效果翻倍
type Effect791 struct {
node.EffectNode
}
func (e *Effect791) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 791, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect791Sub struct {
RoundEffectArg0Base
}
func (e *Effect791Sub) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1])
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 {
heal = heal.Mul(alpacadecimal.NewFromInt(2))
}
if heal.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}
// Effect 792: 先出手时对手当回合攻击技能无效
type Effect792 struct {
node.EffectNode
}
func (e *Effect792) Skill_Use() bool {
if !e.IsFirst() {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 792, 1)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect792Sub struct {
FixedDuration1Base
}
func (e *Effect792Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
return true
}
// Effect 793: 若造成的伤害低于{0},则下{1}回合每回合造成{2}点固定伤害
type Effect793 struct {
node.EffectNode
}
func (e *Effect793) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 793, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect793Sub struct {
RoundEffectArg0Base
}
func (e *Effect793Sub) TurnEnd() {
if len(e.Args()) >= 2 && e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
}
e.EffectNode.TurnEnd()
}
// Effect 794: 消除对手能力提升,消除成功可以抵挡{0}回合内对手的攻击伤害
type Effect794 struct {
node.EffectNode
}
func (e *Effect794) Skill_Use() bool {
if len(e.Args()) == 0 || !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 794, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect794Sub struct {
RoundEffectArg0Base
}
func (e *Effect794Sub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = alpacadecimal.Zero
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 790, &Effect790{})
input.InitEffect(input.EffectType.Sub, 790, &Effect790Sub{})
input.InitEffect(input.EffectType.Skill, 791, &Effect791{})
input.InitEffect(input.EffectType.Sub, 791, &Effect791Sub{})
input.InitEffect(input.EffectType.Skill, 792, &Effect792{})
input.InitEffect(input.EffectType.Sub, 792, &Effect792Sub{})
input.InitEffect(input.EffectType.Skill, 793, &Effect793{})
input.InitEffect(input.EffectType.Sub, 793, &Effect793Sub{})
input.InitEffect(input.EffectType.Skill, 794, &Effect794{})
input.InitEffect(input.EffectType.Sub, 794, &Effect794Sub{})
}