Files
bl/logic/service/fight/effect/1473_1497.go
xinian 78a68148ce
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
chore: update fight logic and effect implementations
2026-04-05 02:25:44 +08:00

571 lines
17 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 1473: 消除对手所有护盾效果,消除成功则令对手随机{0}个技能PP值归零
type Effect1473 struct{ node.EffectNode }
func (e *Effect1473) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for _, eff := range e.TargetInput().Effects {
if eff == nil || !eff.Alive() {
continue
}
eff.Alive(false)
cleared = true
}
if cleared {
randomSkillPPZero(e.TargetInput(), int(e.Args()[0].IntPart()))
}
return true
}
// Effect 1474: {0}回合内若自身能力提升状态被消除每消除1项则附加{1}点固定伤害
type Effect1474 struct{ node.EffectNode }
func (e *Effect1474) Skill_Use() bool {
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1474, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1474Sub struct {
RoundEffectArg0Base
removed int
}
func (e *Effect1474Sub) PropBefer(in *input.Input, prop, level int8) bool {
if in != e.CarrierInput() || level >= 0 {
return true
}
e.removed++
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
return true
}
// Effect 1475: {0}回合内自身受到的固定伤害和百分比伤害减少{1}%
type Effect1475 struct{ node.EffectNode }
func (e *Effect1475) Skill_Use() bool {
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1475, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1475Sub struct{ RoundEffectArg0Base }
func (e *Effect1475Sub) DamageDivEx(zone *info.DamageZone) bool {
if zone == nil || len(e.Args()) < 2 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Sub(e.Args()[1])).Div(hundred)
return true
}
// Effect 1476: 使对手全属性-{0}自身体力低于1/{1}时弱化效果翻倍
type Effect1476 struct{ node.EffectNode }
func (e *Effect1476) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
delta := int8(-e.Args()[0].IntPart())
if e.CarrierInput().CurPet[0].GetHP().Mul(e.Args()[1]).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) < 0 {
delta *= 2
}
for i := range e.TargetInput().Prop[:] {
e.TargetInput().SetProp(e.CarrierInput(), int8(i), delta)
}
return true
}
// Effect 1477: 消除敌我双方能力提升状态消除任意一方成功则吸取对手最大体力的1/{0}
type Effect1477 struct{ node.EffectNode }
func (e *Effect1477) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for _, target := range []*input.Input{e.CarrierInput(), e.TargetInput()} {
for _, eff := range target.Effects {
if eff == nil || !eff.Alive() {
continue
}
eff.Alive(false)
cleared = true
}
}
if cleared {
drain := e.TargetInput().CurPet[0].GetMaxHP().Div(e.Args()[0])
e.TargetInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: drain})
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, drain)
}
return true
}
// Effect 1478: 下{0}回合令对手无法主动切换精灵
type Effect1478 struct{ node.EffectNode }
func (e *Effect1478) Skill_Use() bool {
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1478, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1478Sub struct{ RoundEffectArg0Base }
func (e *Effect1478Sub) SwitchOut(in *input.Input) bool {
if in == e.OpponentInput() {
e.Alive(false)
}
return true
}
// Effect 1479: 牺牲自己,消除对手能力提升状态、回合类效果、护盾效果、护罩效果、神耀能量、自然祝福,同时令对手{0}回合内属性技能无效
type Effect1479 struct{ node.EffectNode }
func (e *Effect1479) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1479, e.SideEffectArgs...)
if eff != nil {
e.TargetInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1479Sub struct{ RoundEffectArg0Base }
func (e *Effect1479Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
e.Ctx().SkillEntity.XML.MustHit = 1
}
return true
}
// Effect 1480: 附加{0}点固定伤害,每次使用额外附加{1}点,最高{2}点
type Effect1480 struct {
node.EffectNode
extra int64
}
func (e *Effect1480) DamageAdd(zone *info.DamageZone) bool {
if zone == nil || len(e.Args()) < 3 {
return true
}
base := e.Args()[0]
add := base.Add(alpacadecimal.NewFromInt(e.extra))
max := e.Args()[2]
if add.Cmp(max) > 0 {
add = max
}
zone.Damage = zone.Damage.Add(add)
e.extra += int64(e.Args()[1].IntPart())
return true
}
// Effect 1481: {0}%的概率造成伤害翻倍,对手处于能力下降状态时概率翻倍
type Effect1481 struct{ node.EffectNode }
func (e *Effect1481) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
return true
}
chance := int(e.Args()[0].IntPart())
for _, v := range e.OpponentInput().Prop[:] {
if v < 0 {
chance *= 2
break
}
}
if chance > 100 {
chance = 100
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
}
return true
}
// Effect 1482: {0}%令对手{1},未触发则吸取对手能力提升状态
type Effect1482 struct{ node.EffectNode }
func (e *Effect1482) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[1].IntPart()))
return true
}
for _, eff := range e.TargetInput().Effects {
if eff != nil && eff.Alive() {
eff.Alive(false)
}
}
return true
}
// Effect 1483: 本回合打出致命一击则令对手{0}回合属性技能无效
type Effect1483 struct{ node.EffectNode }
func (e *Effect1483) Skill_Use() bool {
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1483Sub struct{ RoundEffectArg0Base }
func (e *Effect1483Sub) Skill_Use() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit > 0 {
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
if eff != nil {
e.TargetInput().AddEffect(e.CarrierInput(), eff)
}
}
return true
}
func (e *Effect1483Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
e.Ctx().SkillEntity.XML.MustHit = 1
}
return true
}
// Effect 1484: 体力低于最大体力的1/2时先制+1
type Effect1484 struct{ node.EffectNode }
func (e *Effect1484) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.CarrierInput().CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) >= 0 {
return true
}
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
if current != nil && current.SkillEntity != nil {
current.SkillEntity.XML.Priority += 1
}
return true
}
// Effect 1485: 对手处于能力提升状态则命中后{0}%令对手{1},未触发则{2}%令对手{3}
type Effect1485 struct{ node.EffectNode }
func (e *Effect1485) OnSkill() bool {
if len(e.Args()) < 4 {
return true
}
boosted := false
for _, v := range e.TargetInput().Prop[:] {
if v > 0 {
boosted = true
break
}
}
if !boosted {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[1].IntPart()))
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[3].IntPart()))
}
return true
}
// Effect 1486: {0}%的概率造成伤害翻倍,自身处于护盾状态时概率翻倍
type Effect1486 struct{ node.EffectNode }
func (e *Effect1486) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
return true
}
chance := int(e.Args()[0].IntPart())
if e.CarrierInput().HasShield() {
chance *= 2
}
if chance > 100 {
chance = 100
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
}
return true
}
// Effect 1487: 自身处于护盾状态下先制+1
type Effect1487 struct{ node.EffectNode }
func (e *Effect1487) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.CarrierInput().HasShield() {
return true
}
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
if current != nil && current.SkillEntity != nil {
current.SkillEntity.XML.Priority += 1
}
return true
}
// Effect 1488: 遇到天敌时{0}%令对手{1}
type Effect1488 struct{ node.EffectNode }
func (e *Effect1488) OnSkill() bool {
if !e.ISNaturalEnemy() || len(e.Args()) < 2 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[1].IntPart()))
}
return true
}
// Effect 1489: 若对手为自身天敌则{0}%令对手{1},未触发则令自身{2}回合内{3}%闪避对手攻击
type Effect1489 struct{ node.EffectNode }
func (e *Effect1489) OnSkill() bool {
if len(e.Args()) < 4 || !e.ISNaturalEnemy() {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[1].IntPart()))
return true
}
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1489, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1489Sub struct{ RoundEffectArg0Base }
func (e *Effect1489Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[3].IntPart()), 100); ok {
e.Ctx().SkillEntity.XML.MustHit = 1
}
return true
}
// Effect 1490: 若对手为自身天敌则{0}%令对手{1},未触发则对手{2}回合内属性技能命中效果失效
type Effect1490 struct{ node.EffectNode }
func (e *Effect1490) OnSkill() bool {
if len(e.Args()) < 3 || !e.ISNaturalEnemy() {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
addStatusByID(e.CarrierInput(), e.TargetInput(), int(e.Args()[1].IntPart()))
return true
}
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1490, e.SideEffectArgs...)
if eff != nil {
e.TargetInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1490Sub struct{ RoundEffectArg0Base }
func (e *Effect1490Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
e.Ctx().SkillEntity.XML.MustHit = 1
}
return true
}
// Effect 1491: 遇到天敌时先制+1
type Effect1491 struct{ node.EffectNode }
func (e *Effect1491) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.ISNaturalEnemy() {
return true
}
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
if current != nil && current.SkillEntity != nil {
current.SkillEntity.XML.Priority += 1
}
return true
}
// Effect 1492: 对手处于能力下降状态时随机附加{0}种异常状态
type Effect1492 struct{ node.EffectNode }
func (e *Effect1492) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
down := false
for _, v := range e.TargetInput().Prop[:] {
if v < 0 {
down = true
break
}
}
if !down {
return true
}
applyRandomStatuses1507(e.CarrierInput(), e.TargetInput(), int(e.Args()[0].IntPart()))
return true
}
// Effect 1493: 消耗自身所有体力令自身下只登场精灵3回合内免疫异常状态若自身下只登场精灵为月照星魂则转变为5回合
type Effect1493 struct{ node.EffectNode }
func (e *Effect1493) Skill_Use() bool {
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1493)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1493Sub struct{ node.EffectNode }
func (e *Effect1493Sub) SwitchIn(in *input.Input) bool {
if in != e.CarrierInput() {
return true
}
e.Duration(3)
return true
}
// Effect 1494: 自身满体力时{0}%令对手随机{1}个技能PP值归零
type Effect1494 struct{ node.EffectNode }
func (e *Effect1494) OnSkill() bool {
if len(e.Args()) < 2 || e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) != 0 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
randomSkillPPZero(e.TargetInput(), int(e.Args()[1].IntPart()))
}
return true
}
// Effect 1495: 反转对手能力提升状态,反转成功则{0}%令对手随机{1}个技能PP值归零
type Effect1495 struct{ node.EffectNode }
func (e *Effect1495) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
swapped := false
for _, i := range e.TargetInput().Prop[:] {
if i > 0 {
swapped = true
break
}
}
if !swapped {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
randomSkillPPZero(e.TargetInput(), int(e.Args()[1].IntPart()))
}
return true
}
// Effect 1496: 消耗自身全部体力,使自身下只出场精灵获得{0}点的护盾且{1}回合内每回合结束时恢复{2}点体力
type Effect1496 struct{ node.EffectNode }
func (e *Effect1496) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
e.CarrierInput().AddShield(e.Args()[0])
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1496, e.SideEffectArgs...)
if eff != nil {
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
}
return true
}
type Effect1496Sub struct{ RoundEffectArg0Base }
func (e *Effect1496Sub) TurnEnd() {
if len(e.Args()) >= 3 {
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, e.Args()[2])
}
e.EffectNode.TurnEnd()
}
// Effect 1497: 恢复自身n点体力n=双方当前护盾值总和)
type Effect1497 struct{ node.EffectNode }
func (e *Effect1497) Skill_Use() bool {
heal := e.CarrierInput().CurrentShield().Add(e.TargetInput().CurrentShield())
if heal.Cmp(alpacadecimal.Zero) > 0 {
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1473, &Effect1473{})
input.InitEffect(input.EffectType.Skill, 1474, &Effect1474{})
input.InitEffect(input.EffectType.Sub, 1474, &Effect1474Sub{})
input.InitEffect(input.EffectType.Skill, 1475, &Effect1475{})
input.InitEffect(input.EffectType.Sub, 1475, &Effect1475Sub{})
input.InitEffect(input.EffectType.Skill, 1476, &Effect1476{})
input.InitEffect(input.EffectType.Skill, 1477, &Effect1477{})
input.InitEffect(input.EffectType.Skill, 1478, &Effect1478{})
input.InitEffect(input.EffectType.Sub, 1478, &Effect1478Sub{})
input.InitEffect(input.EffectType.Skill, 1479, &Effect1479{})
input.InitEffect(input.EffectType.Sub, 1479, &Effect1479Sub{})
input.InitEffect(input.EffectType.Skill, 1480, &Effect1480{})
input.InitEffect(input.EffectType.Skill, 1481, &Effect1481{})
input.InitEffect(input.EffectType.Skill, 1482, &Effect1482{})
input.InitEffect(input.EffectType.Skill, 1483, &Effect1483{})
input.InitEffect(input.EffectType.Sub, 1483, &Effect1483Sub{})
input.InitEffect(input.EffectType.Skill, 1484, &Effect1484{})
input.InitEffect(input.EffectType.Skill, 1485, &Effect1485{})
input.InitEffect(input.EffectType.Skill, 1486, &Effect1486{})
input.InitEffect(input.EffectType.Skill, 1487, &Effect1487{})
input.InitEffect(input.EffectType.Skill, 1488, &Effect1488{})
input.InitEffect(input.EffectType.Skill, 1489, &Effect1489{})
input.InitEffect(input.EffectType.Sub, 1489, &Effect1489Sub{})
input.InitEffect(input.EffectType.Skill, 1490, &Effect1490{})
input.InitEffect(input.EffectType.Sub, 1490, &Effect1490Sub{})
input.InitEffect(input.EffectType.Skill, 1491, &Effect1491{})
input.InitEffect(input.EffectType.Skill, 1492, &Effect1492{})
input.InitEffect(input.EffectType.Skill, 1493, &Effect1493{})
input.InitEffect(input.EffectType.Sub, 1493, &Effect1493Sub{})
input.InitEffect(input.EffectType.Skill, 1494, &Effect1494{})
input.InitEffect(input.EffectType.Skill, 1495, &Effect1495{})
input.InitEffect(input.EffectType.Skill, 1496, &Effect1496{})
input.InitEffect(input.EffectType.Sub, 1496, &Effect1496Sub{})
input.InitEffect(input.EffectType.Skill, 1497, &Effect1497{})
}