Files
bl/logic/service/fight/effect/1233_1237.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

139 lines
3.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1233: 吸取对手最大体力的{0}%,每次使用增加{1}%,最高{2}%
type Effect1233 struct {
AddLvelEffect
}
func (e *Effect1233) Skill_Use() bool {
percent := e.Args()[0]
if e.UseSkillCount > 1 {
percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1)))
}
if percent.Cmp(e.Args()[2]) > 0 {
percent = e.Args()[2]
}
if percent.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(percent).Div(alpacadecimal.NewFromInt(100))
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, nil, damage)
return true
}
// Effect 1234: 消除对手回合类效果,消除成功则对手全属性-{0}
type Effect1234 struct {
node.EffectNode
}
func (e *Effect1234) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart()))
return true
}
// Effect 1235: {0}回合内每回合{1}%闪避对手攻击,未触发则使对手随机{2}项技能PP值归零
type Effect1235 struct {
RoundEffectArg0Base
}
func (e *Effect1235) 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
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
e.Ctx().SkillEntity.SetMiss()
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[2].IntPart()))
return true
}
// Effect 1236: {0}回合内若对手使用攻击技能则造成伤害前附加对手最大体力1/{1}的百分比伤害
type Effect1236 struct {
RoundEffectArg0Base
}
func (e *Effect1236) SkillHit_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1237: 使双方精灵所有技能PP值归零消除双方能力提升、下降状态以及回合类效果
type Effect1237 struct {
node.EffectNode
}
func (e *Effect1237) OnSkill() bool {
for i := range e.Ctx().Our.CurPet[0].Info.SkillList {
e.Ctx().Our.CurPet[0].Info.SkillList[i].PP = 0
}
for i := range e.Ctx().Opp.CurPet[0].Info.SkillList {
e.Ctx().Opp.CurPet[0].Info.SkillList[i].PP = 0
}
for i := range e.Ctx().Our.Prop {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
e.Ctx().Our.CancelTurn(e.Ctx().Our)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1233, &Effect1233{})
input.InitEffect(input.EffectType.Skill, 1234, &Effect1234{})
input.InitEffect(input.EffectType.Skill, 1235, &Effect1235{})
input.InitEffect(input.EffectType.Skill, 1236, &Effect1236{})
input.InitEffect(input.EffectType.Skill, 1237, &Effect1237{})
}