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

151 lines
3.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"
)
func zeroAllSkillPP(target *input.Input) {
if target == nil || target.CurPet[0] == nil {
return
}
for i := range target.CurPet[0].Info.SkillList {
target.CurPet[0].Info.SkillList[i].PP = 0
}
}
// Effect 739: 当回合未击败对手则有{0}%将对手所有技能PP值降为0
type Effect739 struct {
node.EffectNode
}
func (e *Effect739) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.CurPet[0].Info.Hp == 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
zeroAllSkillPP(e.Ctx().Opp)
return true
}
// Effect 740: {0}回合内每回合自身的能力下降状态都会反馈到对手身上
type Effect740 struct {
RoundEffectArg0Base
}
func (e *Effect740) TurnEnd() {
for i, v := range e.Ctx().Our.Prop[:] {
if v < 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v)
}
}
e.EffectNode.TurnEnd()
}
// Effect 741: {0}回合内免疫大于{1}的攻击伤害
type Effect741 struct {
RoundEffectArg0Base
}
func (e *Effect741) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if zone.Damage.Cmp(e.Args()[1]) <= 0 {
return true
}
zone.Damage = alpacadecimal.Zero
return true
}
// Effect 742: {0}回合内若对手造成的伤害低于{1},则对手{2}
type Effect742 struct {
RoundEffectArg0Base
}
func (e *Effect742) Skill_Use_ex() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[1]) >= 0 {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 743: 反转对手能力提升,反转成功下{0}回合先制+{1}
type Effect743 struct {
node.EffectNode
}
func (e *Effect743) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
reversed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 && e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if !reversed {
return true
}
sub := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
743,
int(e.Args()[0].IntPart()),
int(e.Args()[1].IntPart()),
)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect743Sub struct {
RoundEffectArg0Base
}
func (e *Effect743Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 739, &Effect739{})
input.InitEffect(input.EffectType.Skill, 740, &Effect740{})
input.InitEffect(input.EffectType.Skill, 741, &Effect741{})
input.InitEffect(input.EffectType.Skill, 742, &Effect742{})
input.InitEffect(input.EffectType.Skill, 743, &Effect743{})
input.InitEffect(input.EffectType.Sub, 743, &Effect743Sub{})
}