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

239 lines
5.8 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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1122: 使对手全属性-{0},未触发则对手{1}
type Effect1122 struct {
node.EffectNode
}
func (e *Effect1122) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
level := int8(e.Args()[0].IntPart())
applied := false
if level > 0 {
for i := range e.Ctx().Opp.Prop[:] {
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -level) {
applied = true
}
}
}
if applied {
return true
}
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
// Effect 1123: 吸取对手能力提升状态,吸取成功则下{0}回合自身所有技能先制+{1}
type Effect1123 struct {
node.EffectNode
}
func (e *Effect1123) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
absorbed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
absorbed = true
}
}
if !absorbed {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1123, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1123Sub struct {
RoundEffectArg0Base
}
func (e *Effect1123Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 1124: 消除对手回合类效果,消除成功则自身下{0}回合造成的攻击伤害额外提升{1}%
type Effect1124 struct {
node.EffectNode
}
func (e *Effect1124) 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 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1124, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1124Sub struct {
RoundEffectArg0Base
}
func (e *Effect1124Sub) Damage_Mul(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
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[1])).Div(hundred)
return true
}
// Effect 1125: {0}回合内对手所有攻击必定Miss若对手命中则下{1}回合对手使用属性技能无效
type Effect1125 struct {
node.EffectNode
}
func (e *Effect1125) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1125, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1125Sub struct {
RoundEffectArg0Base
}
func (e *Effect1125Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
return true
}
func (e *Effect1125Sub) Action_end_ex() bool {
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 11251, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1125StatusLockSub struct {
RoundEffectArg0Base
}
func (e *Effect1125StatusLockSub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}
// Effect 1126: 使对手随机{0}项技能PP值归零若当回合受到攻击则额外使对手随机{1}项技能PP值归零
type Effect1126 struct {
node.EffectNode
}
func (e *Effect1126) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1126, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1126Sub struct {
node.EffectNode
attacked bool
}
func (e *Effect1126Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(1)
}
func (e *Effect1126Sub) Action_end_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
e.attacked = true
return true
}
func (e *Effect1126Sub) TurnEnd() {
if e.attacked && len(e.Args()) > 0 {
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
}
e.EffectNode.TurnEnd()
}
func init() {
input.InitEffect(input.EffectType.Skill, 1122, &Effect1122{})
input.InitEffect(input.EffectType.Skill, 1123, &Effect1123{})
input.InitEffect(input.EffectType.Sub, 1123, &Effect1123Sub{})
input.InitEffect(input.EffectType.Skill, 1124, &Effect1124{})
input.InitEffect(input.EffectType.Sub, 1124, &Effect1124Sub{})
input.InitEffect(input.EffectType.Skill, 1125, &Effect1125{})
input.InitEffect(input.EffectType.Sub, 1125, &Effect1125Sub{})
input.InitEffect(input.EffectType.Sub, 11251, &Effect1125StatusLockSub{})
input.InitEffect(input.EffectType.Skill, 1126, &Effect1126{})
input.InitEffect(input.EffectType.Sub, 1126, &Effect1126Sub{})
}