From d367f9d1d4ef560f135adda8d3d9fe6cc1cee94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Sat, 7 Mar 2026 23:54:01 +0800 Subject: [PATCH] 41 --- logic/service/fight/effect/effect509.go | 27 + logic/service/fight/effect/effect_163.go | 43 + logic/service/fight/effect/effect_174.go | 39 + logic/service/fight/effect/effect_187.go | 33 + logic/service/fight/effect/effect_189.go | 30 + logic/service/fight/effect/effect_192.go | 36 + logic/service/fight/effect/effect_411.go | 49 + logic/service/fight/effect/effect_415.go | 28 + logic/service/fight/effect/effect_447.go | 26 + logic/service/fight/effect/effect_452.go | 30 + logic/service/fight/effect/effect_455.go | 39 + logic/service/fight/effect/effect_459.go | 31 + logic/service/fight/effect/effect_472.go | 26 + logic/service/fight/effect/effect_479.go | 52 + logic/service/fight/effect/effect_482.go | 26 + logic/service/fight/effect/effect_484.go | 44 + logic/service/fight/effect/effect_487.go | 28 + logic/service/fight/effect/effect_502.go | 40 + logic/service/fight/effect/effect_510.go | 23 + logic/service/fight/effect/effect_514.go | 36 + logic/service/fight/effect/effect_515.go | 38 + logic/service/fight/effect/effect_517.go | 39 + logic/service/fight/effect/effect_519.go | 44 + logic/service/fight/effect/effect_520.go | 29 + logic/service/fight/effect/effect_545.go | 31 + logic/service/fight/effect/effect_missing.go1 | 2894 +++++++++++++++++ 26 files changed, 3761 insertions(+) create mode 100644 logic/service/fight/effect/effect509.go create mode 100644 logic/service/fight/effect/effect_163.go create mode 100644 logic/service/fight/effect/effect_174.go create mode 100644 logic/service/fight/effect/effect_187.go create mode 100644 logic/service/fight/effect/effect_189.go create mode 100644 logic/service/fight/effect/effect_192.go create mode 100644 logic/service/fight/effect/effect_411.go create mode 100644 logic/service/fight/effect/effect_415.go create mode 100644 logic/service/fight/effect/effect_447.go create mode 100644 logic/service/fight/effect/effect_452.go create mode 100644 logic/service/fight/effect/effect_455.go create mode 100644 logic/service/fight/effect/effect_459.go create mode 100644 logic/service/fight/effect/effect_472.go create mode 100644 logic/service/fight/effect/effect_479.go create mode 100644 logic/service/fight/effect/effect_482.go create mode 100644 logic/service/fight/effect/effect_484.go create mode 100644 logic/service/fight/effect/effect_487.go create mode 100644 logic/service/fight/effect/effect_502.go create mode 100644 logic/service/fight/effect/effect_510.go create mode 100644 logic/service/fight/effect/effect_514.go create mode 100644 logic/service/fight/effect/effect_515.go create mode 100644 logic/service/fight/effect/effect_517.go create mode 100644 logic/service/fight/effect/effect_519.go create mode 100644 logic/service/fight/effect/effect_520.go create mode 100644 logic/service/fight/effect/effect_545.go create mode 100644 logic/service/fight/effect/effect_missing.go1 diff --git a/logic/service/fight/effect/effect509.go b/logic/service/fight/effect/effect509.go new file mode 100644 index 000000000..0795ae243 --- /dev/null +++ b/logic/service/fight/effect/effect509.go @@ -0,0 +1,27 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 509 - 恢复当前受损体力值1/m的体力 +type Effect509 struct { + node.EffectNode +} + +func (e *Effect509) OnSkill() bool { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + lostHp := maxHp.Sub(currentHp) + + healAmount := lostHp.Div(e.Args()[0]) // 受损体力值的1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 509, &Effect509{}) +} diff --git a/logic/service/fight/effect/effect_163.go b/logic/service/fight/effect/effect_163.go new file mode 100644 index 000000000..b460843a0 --- /dev/null +++ b/logic/service/fight/effect/effect_163.go @@ -0,0 +1,43 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 163 - n回合内,若对手使用属性技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态 +type Effect163 struct { + node.EffectNode +} + +func (e *Effect163) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + // 随机选择一个异常状态 + statusTypes := []int{ + int(info.PetStatus.Burned), + int(info.PetStatus.Frozen), + int(info.PetStatus.Poisoned), + int(info.PetStatus.Paralysis), + int(info.PetStatus.Fear), + int(info.PetStatus.Sleep), + } + + randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(statusTypes)))) + selectedStatus := statusTypes[randomIndex] + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + return true +} + +func (e *Effect163) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.NewSel, 163, &Effect163{}) +} diff --git a/logic/service/fight/effect/effect_174.go b/logic/service/fight/effect/effect_174.go new file mode 100644 index 000000000..d366b3602 --- /dev/null +++ b/logic/service/fight/effect/effect_174.go @@ -0,0 +1,39 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 174 - n回合内,若对手使用属性攻击则m%自身XX等级k +type Effect174 struct { + node.EffectNode +} + +func (e *Effect174) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + // 提升自身能力等级 + effectType := e.Args()[1].IntPart() // 状态类型 + effectValue := e.Args()[2].IntPart() // 等级提升数量 + + boostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effectType)) + if boostEffect != nil { + boostEffect.SetArgs(e.Ctx().Our, int(effectValue)) + e.Ctx().Our.AddEffect(e.Ctx().Our, boostEffect) + } + } + } + return true +} + +func (e *Effect174) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.NewSel, 174, &Effect174{}) +} diff --git a/logic/service/fight/effect/effect_187.go b/logic/service/fight/effect/effect_187.go new file mode 100644 index 000000000..1770730e8 --- /dev/null +++ b/logic/service/fight/effect/effect_187.go @@ -0,0 +1,33 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 187 - n回合内,若对手使用属性技能,则自身恢复1/m最大体力值 +type Effect187 struct { + node.EffectNode +} + +func (e *Effect187) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) // 1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +func (e *Effect187) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +func init() { + input.InitEffect(input.EffectType.NewSel, 187, &Effect187{}) +} diff --git a/logic/service/fight/effect/effect_189.go b/logic/service/fight/effect/effect_189.go new file mode 100644 index 000000000..50839bb30 --- /dev/null +++ b/logic/service/fight/effect/effect_189.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 189 - n回合内,若受到攻击,对手攻击等级-1、特攻等级-1 +type Effect189 struct { + node.EffectNode +} + +func (e *Effect189) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + e.Ctx().Opp.SetProp(e.Ctx().Our, 0, -1, info.AbilityOpType.SUB) + e.Ctx().Opp.SetProp(e.Ctx().Our, 2, -1, info.AbilityOpType.SUB) + return true +} + +func (e *Effect189) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.NewSel, 189, &Effect189{}) +} diff --git a/logic/service/fight/effect/effect_192.go b/logic/service/fight/effect/effect_192.go new file mode 100644 index 000000000..4b3a1c31a --- /dev/null +++ b/logic/service/fight/effect/effect_192.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 192 - 附加n%当前体力值的伤害 +type Effect192 struct { + node.EffectNode +} + +func (e *Effect192) OnSkill() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + currentHp := e.Ctx().Our.CurrentPet.GetHP() + percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) + additionalDamage := currentHp.Mul(percent) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: additionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} + +func init() { + input.InitEffect(input.EffectType.NewSel, 192, &Effect192{}) +} diff --git a/logic/service/fight/effect/effect_411.go b/logic/service/fight/effect/effect_411.go new file mode 100644 index 000000000..3a211a21a --- /dev/null +++ b/logic/service/fight/effect/effect_411.go @@ -0,0 +1,49 @@ +package effect + +import ( + "blazing/common/utils" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +func init() { + t := &Effect411{} + t.Duration(-1) //次数类无限回合 + t.CanStack(true) //后续的不会顶掉这个效果 + input.InitEffect(input.EffectType.Skill, 411, t) + +} + +// 411 - 附加对手当前体力值n%的百分比伤害,连续使用每次增加m%,最高k% +type Effect411 struct { + node.EffectNode + Skillid int //记录使用的技能 ,如果技能变了就删除effect + UseSkillCount int //技能使用了多少次,切换后置0 +} + +func (e *Effect411) OnSkill() bool { + if e.Skillid != 0 && e.Ctx().SkillEntity.ID != e.Skillid { + e.Alive(false) + e.UseSkillCount = 0 + return true + + } + e.Skillid = e.Ctx().SkillEntity.ID + opponentHp := e.Ctx().Opp.CurrentPet.GetHP() + + addhe := utils.Min(e.Args()[1].IntPart()*int64(e.UseSkillCount), e.Args()[2].IntPart()) + + // 附加百分比伤害 + damageZone := &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: opponentHp.Mul((e.Args()[0].Add(alpacadecimal.NewFromInt(addhe))).Mul(alpacadecimal.NewFromInt(100))), + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + e.UseSkillCount++ + + return true +} diff --git a/logic/service/fight/effect/effect_415.go b/logic/service/fight/effect/effect_415.go new file mode 100644 index 000000000..29c60b3d1 --- /dev/null +++ b/logic/service/fight/effect/effect_415.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 415 - 若造成的伤害大于m点,则自身恢复n点体力 +type Effect415 struct { + node.EffectNode +} + +func (e *Effect415) SkillUseed() bool { + damageThreshold := int(e.Args()[0].IntPart()) + healAmount := e.Args()[1].IntPart() + + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 { + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, alpacadecimal.NewFromInt(int64(healAmount))) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 415, &Effect415{}) +} diff --git a/logic/service/fight/effect/effect_447.go b/logic/service/fight/effect/effect_447.go new file mode 100644 index 000000000..0e379b42f --- /dev/null +++ b/logic/service/fight/effect/effect_447.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 447 - 造成的伤害不少于m +type Effect447 struct { + node.EffectNode +} + +func (e *Effect447) DamageLockEx(t *info.DamageZone) bool { + if t.Type != info.DamageType.Red { + return true + } + t.Damage = alpacadecimal.Max(e.Args()[0], t.Damage) + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 447, &Effect447{}) +} diff --git a/logic/service/fight/effect/effect_452.go b/logic/service/fight/effect/effect_452.go new file mode 100644 index 000000000..bf36e4c52 --- /dev/null +++ b/logic/service/fight/effect/effect_452.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 452 - n回合内自身所有攻击造成的伤害都将为自己恢复体力 +type Effect452 struct { + node.EffectNode +} + +func (e *Effect452) SkillUseed() bool { + damageDone := e.Ctx().Our.SumDamage + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damageDone) + + return true +} + +func (e *Effect452) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) + +} + +func init() { + input.InitEffect(input.EffectType.NewSel, 452, &Effect452{}) +} diff --git a/logic/service/fight/effect/effect_455.go b/logic/service/fight/effect/effect_455.go new file mode 100644 index 000000000..3e8188c6e --- /dev/null +++ b/logic/service/fight/effect/effect_455.go @@ -0,0 +1,39 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 455 - 当损失n点体力时,额外附加m点固定伤害 +type Effect455 struct { + node.EffectNode +} + +func (e *Effect455) Skill_Use_ex() bool { + // 计算受到的伤害 + damageTaken := e.Ctx().Our.SumDamage + + // 计算应该附加的额外伤害 + damageRatio := damageTaken.Div(e.Args()[0]) // 损失n点的次数 + additionalDamagePerHit := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + + // 总额外伤害 + totalAdditionalDamage := additionalDamagePerHit.Mul(damageRatio) + + if totalAdditionalDamage.Cmp(alpacadecimal.NewFromInt(0)) > 0 { + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: totalAdditionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 455, &Effect455{}) +} diff --git a/logic/service/fight/effect/effect_459.go b/logic/service/fight/effect/effect_459.go new file mode 100644 index 000000000..1ce49fdae --- /dev/null +++ b/logic/service/fight/effect/effect_459.go @@ -0,0 +1,31 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 459 - 附加对手防御值m%的固定伤害 +type Effect459 struct { + node.EffectNode +} + +func (e *Effect459) OnSkill() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + opponentDef := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Prop[1])) + percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) + additionalDamage := opponentDef.Mul(percent) + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: additionalDamage}) + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 459, &Effect459{}) +} diff --git a/logic/service/fight/effect/effect_472.go b/logic/service/fight/effect/effect_472.go new file mode 100644 index 000000000..82f8b9ac4 --- /dev/null +++ b/logic/service/fight/effect/effect_472.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 472 - 若对手处于XX状态则每次攻击造成的伤害都将恢复自身体力 +type Effect472 struct { + node.EffectNode +} + +func (e *Effect472) SkillUseed() bool { + if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { // 对手处于异常状态 + // 造成的伤害恢复自身体力 + damageDone := e.Ctx().Our.SumDamage + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damageDone) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 472, &Effect472{}) +} diff --git a/logic/service/fight/effect/effect_479.go b/logic/service/fight/effect/effect_479.go new file mode 100644 index 000000000..82b8d4e19 --- /dev/null +++ b/logic/service/fight/effect/effect_479.go @@ -0,0 +1,52 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 479 - 损失自身n点体力,给对手造成m点固定伤害 +type Effect479 struct { + node.EffectNode +} + +func (e *Effect479) OnSkill() bool { + selfDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + opponentDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + + // 检查自身体力是否低于200 + currentHp := e.Ctx().Our.CurrentPet.GetHP() + minHp := alpacadecimal.NewFromInt(200) + + if currentHp.Cmp(minHp) < 0 { + // 如果自身体力不足200,保留1点体力 + damageToTake := currentHp.Sub(alpacadecimal.NewFromInt(1)) + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damageToTake, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + } else { + // 损失n点体力 + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: selfDamage, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + } + + // 给对手造成m点固定伤害 + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: opponentDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 479, &Effect479{}) +} diff --git a/logic/service/fight/effect/effect_482.go b/logic/service/fight/effect/effect_482.go new file mode 100644 index 000000000..f9ecf500c --- /dev/null +++ b/logic/service/fight/effect/effect_482.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 482 - m%几率先制+n +type Effect482 struct { + node.EffectNode +} + +func (e *Effect482) ActionStartEx(fattack, sattack *action.SelectSkillAction) bool { + + // n%几率触发 + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if success && e.Ctx().SkillEntity != nil { + // 先制+1(提升优先级) + e.Ctx().SkillEntity.AttackTime += uint32(e.Args()[1].IntPart()) + } + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 482, &Effect482{}) +} diff --git a/logic/service/fight/effect/effect_484.go b/logic/service/fight/effect/effect_484.go new file mode 100644 index 000000000..e2c5833a3 --- /dev/null +++ b/logic/service/fight/effect/effect_484.go @@ -0,0 +1,44 @@ +package effect + +import ( + "blazing/common/utils" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 484 - 连击n次,每次命中后连击数+m,最高连击p次 +type Effect484 struct { + node.EffectNode + count int64 +} + +func (e *Effect484) Damage_Mul(t *info.DamageZone) bool { + + if t.Type == info.DamageType.Red { + n := utils.Min(e.Args()[0].IntPart()+e.count, e.Args()[1].IntPart()) + t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(int64(n))) + + } + + return true +} +func (e *Effect484) SkillHit() bool { + + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().SkillEntity.AttackTime != 0 { + e.count = 0 + return true + } + e.count += e.Args()[1].IntPart() + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 484, &Effect484{}) +} diff --git a/logic/service/fight/effect/effect_487.go b/logic/service/fight/effect/effect_487.go new file mode 100644 index 000000000..34fc00208 --- /dev/null +++ b/logic/service/fight/effect/effect_487.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 487 - 若对手的体力大于400,则每次使用自身攻击+1 +type Effect487 struct { + node.EffectNode +} + +func (e *Effect487) OnSkill() bool { + opponentHp := e.Ctx().Opp.CurrentPet.GetHP() + + if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) > 0 { + // 提升自身攻击等级 + e.Ctx().Our.SetProp(e.Ctx().Our, 0, 1, info.AbilityOpType.ADD) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 487, &Effect487{}) +} diff --git a/logic/service/fight/effect/effect_502.go b/logic/service/fight/effect/effect_502.go new file mode 100644 index 000000000..e791a4d12 --- /dev/null +++ b/logic/service/fight/effect/effect_502.go @@ -0,0 +1,40 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 502 - n回合内所有直接攻击都将降低对手1/m的体力 +type Effect502 struct { + node.EffectNode +} + +func (e *Effect502) OnSkill() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().SkillEntity.Category() != info.Category.STATUS { // 非属性技能,即直接攻击 + // 计算对手最大体力的1/m + maxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + damage := maxHp.Div(e.Args()[1]) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +func (e *Effect502) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.NewSel, 502, &Effect502{}) +} diff --git a/logic/service/fight/effect/effect_510.go b/logic/service/fight/effect/effect_510.go new file mode 100644 index 000000000..c8bec02f3 --- /dev/null +++ b/logic/service/fight/effect/effect_510.go @@ -0,0 +1,23 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 510 - 1 当对手处于防御能力提升时,恢复n点体力值 +type Effect510 struct { + node.EffectNode +} + +func (e *Effect510) Skill_Use_ex() bool { + + if e.Ctx().Opp.Prop[1] > 0 { + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0]) + } + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 510, &Effect510{}) +} diff --git a/logic/service/fight/effect/effect_514.go b/logic/service/fight/effect/effect_514.go new file mode 100644 index 000000000..6a0dd76bb --- /dev/null +++ b/logic/service/fight/effect/effect_514.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 514 - 附加对手已损失体力n%的固定伤害 +type Effect514 struct { + node.EffectNode +} + +func (e *Effect514) OnSkill() bool { + maxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Opp.CurrentPet.GetHP() + lostHp := maxHp.Sub(currentHp) + + damagePercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) + additionalDamage := lostHp.Mul(damagePercent) + + if additionalDamage.Cmp(alpacadecimal.NewFromInt(0)) > 0 { + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: additionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 514, &Effect514{}) +} diff --git a/logic/service/fight/effect/effect_515.go b/logic/service/fight/effect/effect_515.go new file mode 100644 index 000000000..aa66e62a9 --- /dev/null +++ b/logic/service/fight/effect/effect_515.go @@ -0,0 +1,38 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 515 - 自身处于能力下降状态时附加n点固定伤害,并解除这些能力下降状态 +type Effect515 struct { + node.EffectNode +} + +func (e *Effect515) OnSkill() bool { + var is bool + for i := 0; i < 6; i++ { + if e.Ctx().Our.Prop[i] < 0 { + is = true + } + + } + if !is { + return true + } + + fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: fixedDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 515, &Effect515{}) +} diff --git a/logic/service/fight/effect/effect_517.go b/logic/service/fight/effect/effect_517.go new file mode 100644 index 000000000..a86f85914 --- /dev/null +++ b/logic/service/fight/effect/effect_517.go @@ -0,0 +1,39 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 517 - n%概率使对手害怕,每损失m%体力,害怕几率提升k% +type Effect517 struct { + node.EffectNode +} + +func (e *Effect517) OnSkill() bool { + + baseChance := e.Args()[0].IntPart() + lostHpPercent := (e.Ctx().Opp.CurrentPet.GetMaxHP().Sub(e.Ctx().Opp.CurrentPet.GetHP())).Div(e.Ctx().Opp.CurrentPet.GetMaxHP()).Mul(alpacadecimal.NewFromInt(100)).IntPart() + + // 计算额外几率 + additionalStacks := lostHpPercent / e.Args()[1].IntPart() + extraChance := additionalStacks * e.Args()[2].IntPart() + + totalChance := baseChance + extraChance + success, _, _ := e.Input.Player.Roll(int(totalChance), 100) + if success { + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + } + } + + return true +} + +func init() { + input.InitEffect(input.EffectType.NewSel, 452, &Effect517{}) +} diff --git a/logic/service/fight/effect/effect_519.go b/logic/service/fight/effect/effect_519.go new file mode 100644 index 000000000..4fc832258 --- /dev/null +++ b/logic/service/fight/effect/effect_519.go @@ -0,0 +1,44 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 519 - n回合内自身每处于一种能力强化或弱化状态时都会回复m点体力 +type Effect519 struct { + node.EffectNode +} + +func init() { + + input.InitEffect(input.EffectType.Skill, 519, &Effect519{}) + +} +func (e *Effect519) Action_start() bool { + var buffCount int + for _, v := range e.Ctx().Our.Prop { + + if v != 0 { + buffCount++ + } + } + + // 每种状态回复m点体力 + healPerBuff := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + totalHeal := healPerBuff.Mul(alpacadecimal.NewFromInt(int64(buffCount))) + + if totalHeal.Cmp(alpacadecimal.NewFromInt(0)) > 0 { + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, totalHeal) + } + + return true +} + +func (e *Effect519) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} diff --git a/logic/service/fight/effect/effect_520.go b/logic/service/fight/effect/effect_520.go new file mode 100644 index 000000000..37f8dc11b --- /dev/null +++ b/logic/service/fight/effect/effect_520.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 520 - 有n%的几率使自己害怕 +type Effect520 struct { + node.EffectNode +} + +func (e *Effect520) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) + if fearEffect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, fearEffect) + } + } + + return true +} + +func init() { + input.InitEffect(input.EffectType.NewSel, 520, &Effect520{}) +} diff --git a/logic/service/fight/effect/effect_545.go b/logic/service/fight/effect/effect_545.go new file mode 100644 index 000000000..aaf110789 --- /dev/null +++ b/logic/service/fight/effect/effect_545.go @@ -0,0 +1,31 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 545 - n回合内若受到伤害高于m则对手XX +type Effect545 struct { + node.EffectNode +} + +func (e *Effect545) Skill_Use_ex() bool { + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))) > 0 { + 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 +} + +func (e *Effect545) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.NewSel, 545, &Effect545{}) +} diff --git a/logic/service/fight/effect/effect_missing.go1 b/logic/service/fight/effect/effect_missing.go1 new file mode 100644 index 000000000..05541612f --- /dev/null +++ b/logic/service/fight/effect/effect_missing.go1 @@ -0,0 +1,2894 @@ +package effect + +import ( + element "blazing/common/data/Element" + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 160 - n回合内,若对手MISS则下回合自身必定致命一击 +type Effect160 struct { + node.EffectNode +} + +func (e *Effect160) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + if e.Ctx().Opp.LastAttackMissed { + // 添加一个效果,下回合必定暴击 + nextAttackCritEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.NextCrit)) + if nextAttackCritEffect != nil { + nextAttackCritEffect.Duration(1) // 持续1回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, nextAttackCritEffect) + } + } + return true +} + +func (e *Effect160) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 172 - 2 若后出手,则给予对方损伤的1/n会回复自己的体力 +type Effect172 struct { + node.EffectNode +} + +func (e *Effect172) SkillHit_ex() bool { + if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 + damage := e.Ctx().Opp.SumDamage + healAmount := damage.Div(e.Args()[0]) // 损伤的1/n + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +// 406 - 2 n回合内受到攻击m%几率回复k点体力 +type Effect406 struct { + node.EffectNode +} + +func (e *Effect406) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + chance := e.Args()[1].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + healAmount := alpacadecimal.NewFromInt(int64(e.Args()[2].IntPart())) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +func (e *Effect406) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 190 - n回合内,若受到攻击,消除对手所有能力强化状态 +type Effect190 struct { + node.EffectNode +} + +func (e *Effect190) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + // 消除对手所有能力强化状态 + e.Ctx().Opp.ResetPositiveBuff() + return true +} + +func (e *Effect190) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 503 - 若造成的伤害不足m,则回合结束时对手损失n点固定体力 +type Effect503 struct { + node.EffectNode + triggered bool + damageThreshold int +} + +func (e *Effect503) SkillHit_ex() bool { + damageDone := e.Ctx().Our.SumDamage + e.damageThreshold = int(e.Args()[0].IntPart()) + + if damageDone.IntPart() < int64(e.damageThreshold) { + e.triggered = true + } + return true +} + +func (e *Effect503) Action_end_ex() bool { + if e.triggered { + fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: fixedDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + e.triggered = false + } + return true +} + +// 181 - n%几率令对手XX,连续攻击每次提高m%几率最高提高k% +type Effect181 struct { + node.EffectNode + increaseChance int + maxChance int + currentChance int +} + +func (e *Effect181) OnSkill() bool { + if !e.Hit() { + return true + } + + baseChance := e.Args()[0].IntPart() + e.currentChance = int(baseChance) + e.increaseChance + + if e.currentChance > e.maxChance { + e.currentChance = e.maxChance + } + + success, _, _ := e.Input.Player.Roll(e.currentChance, 100) + if success { + // 添加异常状态 + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例 + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + // 增加下次攻击的触发几率 + e.increaseChance += int(e.Args()[1].IntPart()) + + return true +} + +func (e *Effect181) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.maxChance = a[2] // 最大几率 +} + +// 499 - 后出手时下回合所有技能先制+m +type Effect499 struct { + node.EffectNode +} + +func (e *Effect499) OnSkill() bool { + if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 + // 添加先制效果 + speedBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedPlus)) + if speedBoostEffect != nil { + speedBoostEffect.Duration(1) // 持续1回合 + speedBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[0].IntPart())) // 先制+m + e.Ctx().Our.AddEffect(e.Ctx().Our, speedBoostEffect) + } + } + return true +} + +// 441 - 每次攻击提升n%的致命几率,最高提升m% +type Effect441 struct { + node.EffectNode + totalCritIncrease int + maxCritIncrease int +} + +func (e *Effect441) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + currentCrit := e.Ctx().Our.CurrentPet.CritRate + increase := int(e.Args()[0].IntPart()) + + if e.totalCritIncrease+increase <= e.maxCritIncrease { + e.totalCritIncrease += increase + e.Ctx().Our.CurrentPet.CritRate = currentCrit + increase + } + + return true +} + +func (e *Effect441) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.maxCritIncrease = a[1] +} + +// 194 - 造成伤害的1/n回复自身体力,若对手XX,则造成伤害的1/m回复自身体力 +type Effect194 struct { + node.EffectNode +} + +func (e *Effect194) SkillHit_ex() bool { + damageDone := e.Ctx().Our.SumDamage + + var healAmount alpacadecimal.Decimal + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 假设有检查异常状态的方法 + healAmount = damageDone.Div(e.Args()[1]) // 1/m + } else { + healAmount = damageDone.Div(e.Args()[0]) // 1/n + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} + +// 169 - n回合内,每回合额外附加m%几率令对手XX +type Effect169 struct { + node.EffectNode +} + +func (e *Effect169) OnSkill() bool { + if !e.Hit() { + return true + } + + chance := e.Args()[1].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + // 添加异常状态 + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例 + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + return true +} + +func (e *Effect169) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 464 - 遇到天敌时m%令对手烧伤 +type Effect464 struct { + node.EffectNode +} + +func (e *Effect464) OnSkill() bool { + if !e.Hit() { + return true + } + + // 检查是否遇到天敌 + if e.isDisadvantageousMatch() { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + burnEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Burned)) + if burnEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, burnEffect) + } + } + } + return true +} + +func (e *Effect464) isDisadvantageousMatch() bool { + // 这里需要根据具体的克制关系判断 + // 暂时用伪代码实现 + return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire && + e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater +} + +// 507 - 下回合若受到的伤害大于m,则恢复自身所有体力 +type Effect507 struct { + node.EffectNode + threshold int + triggered bool +} + +func (e *Effect507) OnSkill() bool { + e.threshold = int(e.Args()[0].IntPart()) + e.triggered = true + return true +} + +func (e *Effect507) Skill_Use_ex() bool { + if e.triggered && e.Ctx().Our.SumDamage.IntPart() > int64(e.threshold) { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp) + } + e.triggered = false + return true +} + +// 489 - 若自身处于能力提升状态,则每次攻击恢复自身体力的1/m +type Effect489 struct { + node.EffectNode +} + +func (e *Effect489) SkillHit_ex() bool { + if e.Ctx().Our.CurrentPet.HasPositiveBuff() { // 假设有检查能力提升的方法 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[0]) // 1/m + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +// 477 - n回合内若受到攻击,则对手攻击,防御,特攻,特防,速度,命中等级降低 +type Effect477 struct { + node.EffectNode +} + +func (e *Effect477) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + // 降低对手多项能力等级 + debuffEffects := []int{ + int(info.PetStatus.AtkDown), + int(info.PetStatus.DefDown), + int(info.PetStatus.SpAtkDown), + int(info.PetStatus.SpDefDown), + int(info.PetStatus.SpeedDown), + int(info.PetStatus.AccuracyDown), + } + + for _, effectId := range debuffEffects { + debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectId) + if debuffEffect != nil { + debuffEffect.SetArgs(e.Ctx().Our, 1) // 默认降低1级 + e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect) + } + } + + return true +} + +func (e *Effect477) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 442 - m%令对手XX,每次造成的伤害值都将恢复自身体力 +type Effect442 struct { + node.EffectNode +} + +func (e *Effect442) OnSkill() bool { + if !e.Hit() { + return true + } + + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例 + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + // 伤害值恢复自身体力 + damageDone := e.Ctx().Our.SumDamage + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damageDone) + + return true +} + +// 173 - 先出手时,n%概率令对方xx +type Effect173 struct { + node.EffectNode +} + +func (e *Effect173) OnSkill() bool { + if !e.Hit() { + return true + } + + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例 + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 165 - n回合内,每回合防御和特防等级+m +type Effect165 struct { + node.EffectNode +} + +func (e *Effect165) OnSkill() bool { + // 增加防御和特防等级 + defBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefUp)) + if defBoostEffect != nil { + defBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) + e.Ctx().Our.AddEffect(e.Ctx().Our, defBoostEffect) + } + + spDefBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefUp)) + if spDefBoostEffect != nil { + spDefBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) + e.Ctx().Our.AddEffect(e.Ctx().Our, spDefBoostEffect) + } + + return true +} + +func (e *Effect165) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 483 - -1 -1 -1 -1 -1 -1,后出手时弱化效果翻倍 +type Effect483 struct { + node.EffectNode +} + +func (e *Effect483) OnSkill() bool { + if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 + // 这里是标记后出手时弱化效果翻倍的逻辑 + // 实际的翻倍逻辑需要在应用弱化效果的地方实现 + e.Ctx().Our.DoubleNegativeEffects = true + } + return true +} + +// 424 - n回合内,对手每回合速度等级m +type Effect424 struct { + node.EffectNode +} + +func (e *Effect424) OnSkill() bool { + speedEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedDown)) + if speedEffect != nil { + speedEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) + e.Ctx().Opp.AddEffect(e.Ctx().Our, speedEffect) + } + return true +} + +func (e *Effect424) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 485 - 消除对手能力强化状态,若消除成功,则自身恢复所有体力 +type Effect485 struct { + node.EffectNode +} + +func (e *Effect485) OnSkill() bool { + if !e.Hit() { + return true + } + + // 检查是否有能力强化状态可以消除 + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { + // 消除对手的能力强化状态 + e.Ctx().Opp.RemoveAllPositiveBuffs() + + // 恢复自身所有体力 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp) + } + + return true +} + +// 188 - 若对手处于异常状态,则威力翻倍并消除对手相应的防御能力提升效果 +type Effect188 struct { + node.EffectNode +} + +func (e *Effect188) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态 + // 威力翻倍 + e.Ctx().SkillEntity.Power *= 2 + + // 消除对手相应的防御能力提升效果 + e.Ctx().Opp.RemovePositiveBuffs() + } + + return true +} + +// 445 - 使用后在战斗结束时可以获得500赛尔豆,每日上限5000 +type Effect445 struct { + node.EffectNode +} + +func (e *Effect445) OnSkill() bool { + // 这个效果需要在战斗结束后执行,暂时记录奖励 + e.Ctx().Our.EndReward = 500 + return true +} + +// 420 - 使用了该技能后,若受到消除强化类技能攻击,则对方则对方攻击和特攻等级+/-n +type Effect420 struct { + node.EffectNode +} + +func (e *Effect420) OnSkill() bool { + // 这里注册监听对手强化消除事件的逻辑 + // 暂时使用一个flag标记 + e.Ctx().Our.TriggerOnBuffRemoved = true + return true +} + +// 407 - 下回合起,每回合XX等级+n,持续m回合 +type Effect407 struct { + node.EffectNode +} + +func (e *Effect407) OnSkill() bool { + // 创建一个延迟生效的效果,在下一回合开始生效 + go func() { + effectType := int(e.Args()[0].IntPart()) // XX类型 + effectValue := int(e.Args()[1].IntPart()) // 等级+n + duration := int(e.Args()[2].IntPart()) // 持续m回合 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + statusEffect.Duration(duration) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + }() + + return true +} + +// 403 - 技能使用成功时,n%令自身特攻和速度等级+m。若和对手属性相同,则技能效果翻倍 +type Effect403 struct { + node.EffectNode +} + +func (e *Effect403) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + boostValue := int(e.Args()[1].IntPart()) + + // 提升自身特攻等级 + spAtkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpAtkUp)) + if spAtkUpEffect != nil { + spAtkUpEffect.SetArgs(e.Ctx().Our, boostValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, spAtkUpEffect) + } + + // 提升自身速度等级 + speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp)) + if speedUpEffect != nil { + speedUpEffect.SetArgs(e.Ctx().Our, boostValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect) + } + } + + // 检查属性是否相同 + if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type { + // 技能效果翻倍,这需要在实际的技能计算中实现 + if e.Ctx().SkillEntity != nil { + e.Ctx().SkillEntity.Power *= 2 + } + } + + return true +} + +// 193 - 若对手XX,则必定致命一击 +type Effect193 struct { + node.EffectNode +} + +func (e *Effect193) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态 + // 设定必定暴击 + e.Ctx().SkillEntity.MustCrit = true + } + + return true +} + +// 491 - 3回合内对手造成的伤害降低m% +type Effect491 struct { + node.EffectNode +} + +func (e *Effect491) OnSkill() bool { + // 创建一个降低对手伤害的效果 + damageReduceEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ReduceDamageTaken)) + if damageReduceEffect != nil { + damageReduceEffect.SetArgs(e.Ctx().Our, int(e.Args()[0].IntPart())) + damageReduceEffect.Duration(3) // 持续3回合 + e.Ctx().Opp.AddEffect(e.Ctx().Our, damageReduceEffect) + } + + return true +} + +// 490 - 造成的伤害大于m,则对自身速度+n +type Effect490 struct { + node.EffectNode +} + +func (e *Effect490) SkillHit_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + speedBoost := int(e.Args()[1].IntPart()) + + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 { + // 提升自身速度等级 + speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp)) + if speedUpEffect != nil { + speedUpEffect.SetArgs(e.Ctx().Our, speedBoost) + e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect) + } + } + + return true +} + +// 140 - 降低对手1/n至1/m体力 +type Effect140 struct { + node.EffectNode +} + +func (e *Effect140) OnSkill() bool { + maxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + + // 随机降低1/n 到 1/m 的体力 + minRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[0]) // 1/n + maxRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m + + randDamage := minRatio.Add(maxRatio.Sub(minRatio).Div(alpacadecimal.NewFromInt(2))) + damageZone := &info.DamageZone{ + Type: info.DamageType.PercentageBased, + Damage: maxHp.Mul(randDamage), + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} + +// 462 - n回合内受攻击时反弹m点固定伤害 +type Effect462 struct { + node.EffectNode +} + +func (e *Effect462) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + // 反弹m点固定伤害 + bounceDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: bounceDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} + +func (e *Effect462) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 153 - n回合内,每回合对对方造成伤害的1/m恢复自身体力 +type Effect153 struct { + node.EffectNode +} + +func (e *Effect153) SkillHit_ex() bool { + damageDone := e.Ctx().Our.SumDamage + healAmount := damageDone.Div(e.Args()[1]) // 伤害的1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} + +func (e *Effect153) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 423 - 直接造成等同于对手防御值的固定伤害 +type Effect423 struct { + node.EffectNode +} + +func (e *Effect423) OnSkill() bool { + defenseValue := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Def)) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: defenseValue, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} + +// 450 - 随机恢复m到n点体力 +type Effect450 struct { + node.EffectNode +} + +func (e *Effect450) OnSkill() bool { + minHeal := e.Args()[0].IntPart() + maxHeal := e.Args()[1].IntPart() + + // 随机值在m到n之间 + rangeVal := maxHeal - minHeal + randomVal := int64(e.Input.FightC.GetRand().Int31n(int32(rangeVal)) + int32(minHeal)) + + healAmount := alpacadecimal.NewFromInt(randomVal) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} + +// 184 - 若对手处于能力提升状态,则m%自身XX等级k +type Effect184 struct { + node.EffectNode +} + +func (e *Effect184) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级k + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 504 - m%令对手害怕,若没有触发害怕效果,则对手攻击,防御,特攻,特防,速度,命中等级下降 +type Effect504 struct { + node.EffectNode +} + +func (e *Effect504) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + // 令对手害怕 + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + } + } else { + // 没有触发害怕效果,降低对手各项等级 + debuffEffects := []int{ + int(info.PetStatus.AtkDown), + int(info.PetStatus.DefDown), + int(info.PetStatus.SpAtkDown), + int(info.PetStatus.SpDefDown), + int(info.PetStatus.SpeedDown), + int(info.PetStatus.AccuracyDown), + } + + for _, effectId := range debuffEffects { + debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectId) + if debuffEffect != nil { + debuffEffect.SetArgs(e.Ctx().Our, 1) // 默认降低1级 + e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect) + } + } + } + + return true +} + +// 171 - n回合内,自身使用属性技能时能较快出手 +type Effect171 struct { + node.EffectNode +} + +func (e *Effect171) Skill_Pre() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + // 提高速度,确保较快出手 + e.Ctx().Our.TempSpeedBoost = true + } + return true +} + +func (e *Effect171) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 1044 - 吸取对手能力提升状态,吸取成功则下n回合造成的伤害翻倍 +type Effect1044 struct { + node.EffectNode + damageMultiplierActive bool + multiplierDuration int +} + +func (e *Effect1044) OnSkill() bool { + // 检查对手是否有能力提升状态可以吸取 + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { + // 吸取对手的能力提升状态 + e.Ctx().Our.StealPositiveBuffsFrom(e.Ctx().Opp) + + // 下n回合造成的伤害翻倍 + e.damageMultiplierActive = true + e.multiplierDuration = int(e.Args()[0].IntPart()) + + // 添加一个临时效果来处理伤害翻倍 + damageDoubleEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DamageDouble)) + if damageDoubleEffect != nil { + damageDoubleEffect.Duration(e.multiplierDuration) + e.Ctx().Our.AddEffect(e.Ctx().Our, damageDoubleEffect) + } + } + + return true +} + +// 418 - 若对手处于能力提升状态则对方XX等级+/-n +type Effect418 struct { + node.EffectNode +} + +func (e *Effect418) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态 + effectValue := int(e.Args()[0].IntPart()) // 等级变化值n + + // 对对手施加降低能力的效果 + debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.RandomStatDown)) + if debuffEffect != nil { + debuffEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect) + } + } + + return true +} + +// 523 - 若当回合未击败对手,则自身1 1 1 1 1 1能力+1 +type Effect523 struct { + node.EffectNode +} + +func (e *Effect523) Action_end_ex() bool { + // 检查对手是否还活着 + if e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + // 提升自身的全部能力等级 + stats := []int{ + int(info.PetStatus.AtkUp), + int(info.PetStatus.DefUp), + int(info.PetStatus.SpAtkUp), + int(info.PetStatus.SpDefUp), + int(info.PetStatus.SpeedUp), + int(info.PetStatus.AccuracyUp), + } + + for _, stat := range stats { + statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, stat) + if statEffect != nil { + statEffect.SetArgs(e.Ctx().Our, 1) // 提升1级 + e.Ctx().Our.AddEffect(e.Ctx().Our, statEffect) + } + } + } + + return true +} + +// 161 - n%降低自身当前体力值的1/m +type Effect161 struct { + node.EffectNode +} + +func (e *Effect161) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + currentHp := e.Ctx().Our.CurrentPet.GetHP() + damageRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m + damageAmount := currentHp.Mul(damageRatio) + + damageZone := &info.DamageZone{ + Type: info.DamageType.PercentageBased, + Damage: damageAmount, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +// 500 - 若对手处于害怕状态则伤害翻倍 +type Effect500 struct { + node.EffectNode +} + +func (e *Effect500) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Opp.CurrentPet.HasStatus(info.PetStatus.Fear) { + // 伤害翻倍 + e.Ctx().SkillEntity.Power *= 2 + } + + return true +} + +// 177 - n回合内,若对手MISS则自身恢复1/m的最大体力值 +type Effect177 struct { + node.EffectNode +} + +func (e *Effect177) Skill_Use_ex() bool { + if e.Ctx().Opp.LastAttackMissed { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) // 1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +func (e *Effect177) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 417 - n回合内自身攻击技能造成伤害的m%会恢复自身体力 +type Effect417 struct { + node.EffectNode +} + +func (e *Effect417) SkillHit_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + // 是攻击技能 + damageDone := e.Ctx().Our.SumDamage + healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m% + healAmount := damageDone.Mul(healPercent) + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +func (e *Effect417) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 178 - 造成伤害的1/n回复自身体力,若属性相同则造成伤害的1/m回复自身体力 +type Effect178 struct { + node.EffectNode +} + +func (e *Effect178) SkillHit_ex() bool { + damageDone := e.Ctx().Our.SumDamage + var healAmount alpacadecimal.Decimal + + if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type { + // 属性相同,1/m + healAmount = damageDone.Div(e.Args()[1]) + } else { + // 属性不同,1/n + healAmount = damageDone.Div(e.Args()[0]) + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} + +// 444 - 降低对手所有PP一点,并恢复自身所有PP一点 +type Effect444 struct { + node.EffectNode +} + +func (e *Effect444) OnSkill() bool { + // 降低对手所有技能PP + for _, skill := range e.Ctx().Opp.CurrentPet.Skills { + if skill.PP > 0 { + skill.PP-- + } + } + + // 恢复自身所有技能PP + for _, skill := range e.Ctx().Our.CurrentPet.Skills { + if skill.MaxPP > skill.PP { + skill.PP = skill.MaxPP + } + } + + return true +} + +// 198 - 随机使对手n种能力等级-m +type Effect198 struct { + node.EffectNode +} + +func (e *Effect198) OnSkill() bool { + numStats := int(e.Args()[0].IntPart()) // n种能力 + reduction := int(e.Args()[1].IntPart()) // 等级-m + + // 定义可降低的能力列表 + stats := []int{ + int(info.PetStatus.AtkDown), + int(info.PetStatus.DefDown), + int(info.PetStatus.SpAtkDown), + int(info.PetStatus.SpDefDown), + int(info.PetStatus.SpeedDown), + int(info.PetStatus.AccuracyDown), + } + + // 随机选择n种能力 + for i := 0; i < numStats && i < len(stats); i++ { + randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(stats)))) + selectedStat := stats[randomIndex] + + statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat) + if statEffect != nil { + statEffect.SetArgs(e.Ctx().Our, reduction) + e.Ctx().Opp.AddEffect(e.Ctx().Our, statEffect) + } + } + + return true +} + +// 475 - 若造成的伤害不足m,则下n回合的攻击必定致命一击 +type Effect475 struct { + node.EffectNode + damageThreshold int + critDuration int +} + +func (e *Effect475) SkillHit_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + damageDone := e.Ctx().Our.SumDamage + + if damageDone.IntPart() < int64(damageThreshold) { + critDuration := int(e.Args()[1].IntPart()) + + // 添加必定暴击效果 + critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit)) + if critEffect != nil { + critEffect.Duration(critDuration) + e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect) + } + } + + return true +} + +// 496 - 若打出致命一击则恢复自身所有体力 +type Effect496 struct { + node.EffectNode +} + +func (e *Effect496) SkillHit_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical { + // 如果造成了致命一击,恢复所有体力 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp) + } + + return true +} + +// 404 - 恢复双方所有体力 +type Effect404 struct { + node.EffectNode +} + +func (e *Effect404) OnSkill() bool { + // 恢复我方所有体力 + ourMaxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, ourMaxHp) + + // 恢复对手所有体力 + oppMaxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, oppMaxHp) + + return true +} + +// 430 - 消除对手能力强化状态,若消除状态成功,则自身XX等级m +type Effect430 struct { + node.EffectNode +} + +func (e *Effect430) OnSkill() bool { + // 检查对手是否有能力强化状态 + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { + // 消除对手的能力强化状态 + removedCount := e.Ctx().Opp.RemoveAllPositiveBuffs() + + if removedCount > 0 { + // 如果成功消除了状态,提升自身能力等级 + effectType := int(e.Args()[0].IntPart()) // XX类型 + effectValue := int(e.Args()[1].IntPart()) // 等级m + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 473 - 若造成的伤害不足m,则自身XX等级+n +type Effect473 struct { + node.EffectNode +} + +func (e *Effect473) SkillHit_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + damageDone := e.Ctx().Our.SumDamage + + if damageDone.IntPart() < int64(damageThreshold) { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级+n + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// 465 - m%令对手疲惫n回合,每次使用几率提升x%,最高y% +type Effect465 struct { + node.EffectNode + accumulatedChance int + maxChance int + incrementPerUse int +} + +func (e *Effect465) OnSkill() bool { + chance := int(e.Args()[0].IntPart()) + e.accumulatedChance + if chance > e.maxChance { + chance = e.maxChance + } + + success, _, _ := e.Input.Player.Roll(chance, 100) + if success { + // 令对手疲惫n回合 + tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) + if tiredEffect != nil { + tiredEffect.Duration(int(e.Args()[1].IntPart())) + e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect) + } + } + + // 增加下次使用的几率 + e.accumulatedChance += e.incrementPerUse + if e.accumulatedChance > e.maxChance { + e.accumulatedChance = e.maxChance + } + + return true +} + +func (e *Effect465) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.maxChance = a[2] // 最高y% + e.incrementPerUse = a[3] // 每次使用几率提升x% +} + +// 454 - 当自身血量少于1/n时先制+m(写死了先制只能+1) +type Effect454 struct { + node.EffectNode +} + +func (e *Effect454) Skill_Pre() bool { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + + threshold := maxHp.Div(e.Args()[0]) // 1/n + + if currentHp.Cmp(threshold) < 0 { + // 血量少于1/n,先制+1(固定为1) + e.Ctx().Our.TempSpeedBoost = true + } + + return true +} + +// 501 - 若造成的伤害不足m,则对手XX等级-n +type Effect501 struct { + node.EffectNode +} + +func (e *Effect501) SkillHit_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + damageDone := e.Ctx().Our.SumDamage + + if damageDone.IntPart() < int64(damageThreshold) { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级-n + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// 494 - 无视对手能力提升状态 +type Effect494 struct { + node.EffectNode +} + +func (e *Effect494) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + // 设置标志,忽略对手的强化状态 + e.Ctx().IgnoreOpponentBuffs = true + + return true +} + +// 620 - n回合内致命一击率上升m/16 +type Effect620 struct { + node.EffectNode +} + +func (e *Effect620) OnSkill() bool { + // 增加暴击率 + critIncrease := int(e.Args()[1].IntPart()) // m/16 + e.Ctx().Our.CurrentPet.CritRate += critIncrease + + return true +} + +func (e *Effect620) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 474 - 先出手时m%自身XX等级+n +type Effect474 struct { + node.EffectNode +} + +func (e *Effect474) OnSkill() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级+n + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 175 - 若对手处于异常状态,则m%自身XX等级k +type Effect175 struct { + node.EffectNode +} + +func (e *Effect175) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级k + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 410 - n%回复自身1/m体力值 +type Effect410 struct { + node.EffectNode +} + +func (e *Effect410) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) // 1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +// 476 - 后出手时恢复m点体力 +type Effect476 struct { + node.EffectNode +} + +func (e *Effect476) OnSkill() bool { + if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 + healAmount := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +// 440 - n回合内对手使用技能消耗的PP值变为m倍 +type Effect440 struct { + node.EffectNode +} + +func (e *Effect440) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 516 - 1 1 1 1 1 1 1 体力低于1/n时强化效果翻倍 +type Effect516 struct { + node.EffectNode +} + +func (e *Effect516) OnSkill() bool { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + threshold := maxHp.Div(e.Args()[0]) // 1/n + + if currentHp.Cmp(threshold) < 0 { + // 体力低于1/n时,设置强化效果翻倍 + e.Ctx().Our.BoostPositiveEffects = true + } + + return true +} + +// 431 - 若对手处于能力下降状态,则威力翻倍 +type Effect431 struct { + node.EffectNode +} + +func (e *Effect431) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Opp.CurrentPet.HasNegativeBuff() { // 对手处于能力下降状态 + // 威力翻倍 + e.Ctx().SkillEntity.Power *= 2 + } + + return true +} + +// 434 - 若自身处于能力强化状态,则n%几率令对手XX +type Effect434 struct { + node.EffectNode +} + +func (e *Effect434) OnSkill() bool { + if e.Ctx().Our.CurrentPet.HasPositiveBuff() { // 自身处于能力强化状态 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型,比如麻痹 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 495 - 若对手处于XX状态,则30%几率秒杀对手 +type Effect495 struct { + node.EffectNode +} + +func (e *Effect495) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态 + chance := 30 // 固定30% + success, _, _ := e.Input.Player.Roll(chance, 100) + if success { + // 秒杀对手 + e.Ctx().Opp.CurrentPet.Info.Hp = 0 + e.Ctx().Opp.CurrentPet.NotAlive = true + } + } + + return true +} + +// 457 - 复制对手释放的技能(组队对战时无效) +type Effect457 struct { + node.EffectNode +} + +func (e *Effect457) Skill_Use_ex() bool { + // 这里需要检查是否在组队对战中 + if !e.Ctx().IsTeamBattle { // 不是组队对战 + if e.Ctx().SkillEntity != nil { + // 复制对手释放的技能 + e.Ctx().Our.CopySkill(e.Ctx().SkillEntity) + } + } + + return true +} + +// 144 - 消耗自己所有体力,使下一个出战的精灵n回合免疫异常状态 +type Effect144 struct { + node.EffectNode +} + +func (e *Effect144) OnSkill() bool { + // 消耗所有体力 + e.Ctx().Our.CurrentPet.Info.Hp = 0 + e.Ctx().Our.CurrentPet.NotAlive = true + + // 设置下一个出战精灵的免疫异常状态效果 + nextPetImmunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus)) + if nextPetImmunityEffect != nil { + nextPetImmunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Our.SetNextPetStatusImmunity(nextPetImmunityEffect) + } + + return true +} + +// 468 - 回合开始时,若自身处于能力下降状态,则威力翻倍,同时解除能力下降状态 +type Effect468 struct { + node.EffectNode +} + +func (e *Effect468) Action_start() bool { + if e.Ctx().Our.CurrentPet.HasNegativeBuff() { + // 威力翻倍 + if e.Ctx().SkillEntity != nil { + e.Ctx().SkillEntity.Power *= 2 + } + + // 解除能力下降状态 + e.Ctx().Our.RemoveNegativeBuffs() + } + + return true +} + +// 492 - 2回合内若对手使用属性技能,自身立刻恢复1/m体力且防御+x特防+y +type Effect492 struct { + node.EffectNode +} + +func (e *Effect492) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + // 恢复1/m体力 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[0]) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + // 防御+x + defUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefUp)) + if defUpEffect != nil { + defUpEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // x + e.Ctx().Our.AddEffect(e.Ctx().Our, defUpEffect) + } + + // 特防+y + spDefUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefUp)) + if spDefUpEffect != nil { + spDefUpEffect.SetArgs(e.Ctx().Our, int(e.Args()[2].IntPart())) // y + e.Ctx().Our.AddEffect(e.Ctx().Our, spDefUpEffect) + } + } + + return true +} + +func (e *Effect492) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(2) // 持续2回合 +} + +// 138 - 先出手时,n回合自己不会受到对手攻击性技能伤害并反弹对手1/n造成的伤害 +type Effect138 struct { + node.EffectNode +} + +func (e *Effect138) Skill_Use_ex() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + // 本次受到的攻击伤害无效 + e.Ctx().Our.CancelDamage() + + // 反弹1/n造成的伤害 + damageToBounce := e.Ctx().Opp.SumDamage.Div(e.Args()[1]) // 1/n + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damageToBounce, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + } + + return true +} + +func (e *Effect138) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 469 - m回合内若对手使用属性技能则n%几率另对手XX +type Effect469 struct { + node.EffectNode +} + +func (e *Effect469) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + chance := e.Args()[1].IntPart() // n% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[2].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +func (e *Effect469) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续m回合 +} + +// 146 - n回合内,受到物理攻击时有m%几率使对方中毒 +type Effect146 struct { + node.EffectNode +} + +func (e *Effect146) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL { + chance := e.Args()[1].IntPart() // m% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + poisonEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned)) + if poisonEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, poisonEffect) + } + } + } + + return true +} + +func (e *Effect146) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 156 - n回合内,使得对手所有能力增强效果失效 +type Effect156 struct { + node.EffectNode +} + +func (e *Effect156) OnSkill() bool { + // 使对手的所有能力增强效果失效 + e.Ctx().Opp.DisablePositiveBuffs() + + return true +} + +func (e *Effect156) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 432 - n回合内对手所有攻击必定MISS,必中技能有效 +type Effect432 struct { + node.EffectNode +} + +func (e *Effect432) Skill_Use_ex() bool { + // 这里不能直接让攻击miss,因为需要在命中判定之前处理 + // 可以设置一个标志,让对手的攻击miss + e.Ctx().Opp.ForceMiss = true + + return true +} + +func (e *Effect432) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 488 - 若对手的体力小于400,则造成的伤害增加10% +type Effect488 struct { + node.EffectNode +} + +func (e *Effect488) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + opponentHp := e.Ctx().Opp.CurrentPet.GetHP() + + if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) < 0 { + // 伤害增加10% + e.Ctx().SkillEntity.Power = int(float64(e.Ctx().SkillEntity.Power) * 1.1) + } + + return true +} + +// 456 - 若对手体力不足n则直接秒杀 +type Effect456 struct { + node.EffectNode +} + +func (e *Effect456) OnSkill() bool { + opponentHp := e.Ctx().Opp.CurrentPet.GetHP() + threshold := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + + if opponentHp.Cmp(threshold) < 0 { + // 直接秒杀对手 + e.Ctx().Opp.CurrentPet.Info.Hp = 0 + e.Ctx().Opp.CurrentPet.NotAlive = true + } + + return true +} + +// 437 - 若对手处于能力强化状态,则对手XX等级m +type Effect437 struct { + node.EffectNode +} + +func (e *Effect437) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力强化状态 + effectType := int(e.Args()[0].IntPart()) // XX类型 + effectValue := int(e.Args()[1].IntPart()) // 等级m + + // 应用负面效果来抵消强化 + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// 486 - 下n回合若自身选择使用技能则无视对手能力提升状态 +type Effect486 struct { + node.EffectNode +} + +func (e *Effect486) OnSkill() bool { + // 设置标志,接下来n回合内无视对手能力提升 + e.Ctx().Our.IgnoreOpponentPositiveBuffsForNDuration(int(e.Args()[0].IntPart())) + + return true +} + +// 429 - 附加m点固定伤害,连续使用每次增加n点固定伤害,最高附加k点固定伤害 +type Effect429 struct { + node.EffectNode + stackedDamage int + maxDamage int + incrementPerUse int +} + +func (e *Effect429) OnSkill() bool { + // 计算附加伤害 + baseDamage := int(e.Args()[0].IntPart()) // m点固定伤害 + currentDamage := baseDamage + e.stackedDamage + + if currentDamage > e.maxDamage { + currentDamage = e.maxDamage + } + + // 附加固定伤害 + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: alpacadecimal.NewFromInt(int64(currentDamage)), + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + // 更新叠加伤害 + e.stackedDamage += e.incrementPerUse + if e.stackedDamage > e.maxDamage-baseDamage { + e.stackedDamage = e.maxDamage - baseDamage + } + + return true +} + +func (e *Effect429) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.maxDamage = a[2] // 最高k点 + e.incrementPerUse = a[1] // 每次增加n点 +} + +// 196 - n%令对方XX等级-m;若先出手,则j%使对方XX等级-k +type Effect196 struct { + node.EffectNode +} + +func (e *Effect196) OnSkill() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + chance := e.Args()[2].IntPart() // j% + effectValue := e.Args()[3].IntPart() // 等级-k + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[4].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } else { // 后出手 + chance := e.Args()[0].IntPart() // n% + effectValue := e.Args()[1].IntPart() // 等级-m + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[4].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 471 - 先出手时n回合内免疫异常状态 +type Effect471 struct { + node.EffectNode +} + +func (e *Effect471) OnSkill() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + immunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus)) + if immunityEffect != nil { + immunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, immunityEffect) + } + } + + return true +} + +// 176 - n%几率令对手随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态 +type Effect176 struct { + node.EffectNode +} + +func (e *Effect176) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + statusTypes := []int{ + int(info.PetStatus.Burned), + int(info.PetStatus.Frozen), + int(info.PetStatus.Poisoned), + int(info.PetStatus.Paralysis), + int(info.PetStatus.Fear), + int(info.PetStatus.Sleep), + } + + randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(statusTypes)))) + selectedStatus := statusTypes[randomIndex] + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// 427 - n回合内每次直接攻击都会使对手防御和特防m +type Effect427 struct { + node.EffectNode +} + +func (e *Effect427) SkillHit_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + // 降低对手防御 + defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown)) + if defDownEffect != nil { + defDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m + e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect) + } + + // 降低对手特防 + spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown)) + if spDefDownEffect != nil { + spDefDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m + e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect) + } + } + + return true +} + +func (e *Effect427) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 150 - n回合内,对手每回合防御和特防等级m +type Effect150 struct { + node.EffectNode +} + +func (e *Effect150) OnSkill() bool { + // 降低对手防御 + defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown)) + if defDownEffect != nil { + defDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m + defDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect) + } + + // 降低对手特防 + spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown)) + if spDefDownEffect != nil { + spDefDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m + spDefDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect) + } + + return true +} + +// 197 - n回合内若被对方击败,则对手所有能力加强状态消失 +type Effect197 struct { + node.EffectNode +} + +func (e *Effect197) SkillUseed() bool { + if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败 + // 清除对手的所有能力加强状态 + e.Ctx().Opp.RemoveAllPositiveBuffs() + } + + return true +} + +func (e *Effect197) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 453 - 消除对手能力强化状态,若消除成功,则对手XX +type Effect453 struct { + node.EffectNode +} + +func (e *Effect453) OnSkill() bool { + // 检查对手是否有能力强化状态 + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { + // 消除对手的能力强化状态 + removedCount := e.Ctx().Opp.RemoveAllPositiveBuffs() + + if removedCount > 0 { + // 如果成功消除了状态,对对手施加异常状态 + effectType := int(e.Args()[0].IntPart()) // XX类型,比如麻痹 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 518 - 若伤害高于m,则自身XX等级+n +type Effect518 struct { + node.EffectNode +} + +func (e *Effect518) SkillHit_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + damageDone := e.Ctx().Our.SumDamage + + if damageDone.IntPart() > int64(damageThreshold) { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级+n + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// 505 - 若打出致命一击,则造成伤害值的m%恢复自身体力 +type Effect505 struct { + node.EffectNode +} + +func (e *Effect505) SkillHit_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical { + damageDone := e.Ctx().Our.SumDamage + healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m% + healAmount := damageDone.Mul(healPercent) + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +// 522 - n回合内若处于异常状态则受到伤害减少m点 +type Effect522 struct { + node.EffectNode +} + +func (e *Effect522) Skill_Use_ex() bool { + if e.Ctx().Our.CurrentPet.HasAnyStatus() { // 自身处于异常状态 + // 减少受到的伤害m点 + damageReduction := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + e.Ctx().Our.ReduceIncomingDamage(damageReduction) + } + + return true +} + +func (e *Effect522) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 170 - 若先出手,则免疫当回合伤害并回复1/n的最大体力值 +type Effect170 struct { + node.EffectNode +} + +func (e *Effect170) OnSkill() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + // 免疫当回合伤害 + e.Ctx().Our.ImmuneDamageThisTurn = true + + // 回复1/n的最大体力值 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) // 1/n + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +// 561 - 先出手时当回合对手使用技能后若自身体力为0,则令自身体力等于最大体力 +type Effect561 struct { + node.EffectNode +} + +func (e *Effect561) OnSkill() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + // 设置一个标志,用于在回合结束时检查 + e.Ctx().Our.ActivateReviveIfFaint = true + } + + return true +} + +// 155 - 恢复全部体力,消除所有能力下降,使自己进入睡眠n回合 +type Effect155 struct { + node.EffectNode +} + +func (e *Effect155) OnSkill() bool { + // 恢复全部体力 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp) + + // 消除所有能力下降 + e.Ctx().Our.RemoveNegativeBuffs() + + // 使自己进入睡眠n回合 + sleepEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Sleep)) + if sleepEffect != nil { + sleepEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, sleepEffect) + } + + return true +} + +// 149 - 命中后,n%令对方xx,m%令对方XX +type Effect149 struct { + node.EffectNode +} + +func (e *Effect149) OnSkill() bool { + if !e.Hit() { + return true + } + + // n%令对方xx + firstChance := e.Args()[0].IntPart() + success1, _, _ := e.Input.Player.Roll(int(firstChance), 100) + if success1 { + effectType1 := int(e.Args()[2].IntPart()) // 第一个异常状态类型 + + statusEffect1 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType1) + if statusEffect1 != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect1) + } + } + + // m%令对方XX + secondChance := e.Args()[1].IntPart() + success2, _, _ := e.Input.Player.Roll(int(secondChance), 100) + if success2 { + effectType2 := int(e.Args()[3].IntPart()) // 第二个异常状态类型 + + statusEffect2 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType2) + if statusEffect2 != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect2) + } + } + + return true +} + +// 449 - 若对手处于能力下降状态则N%几率XX +type Effect449 struct { + node.EffectNode +} + +func (e *Effect449) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasNegativeBuff() { // 对手处于能力下降状态 + chance := e.Args()[0].IntPart() // N% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 425 - 随机使对手n项属性m,并将该属性附加给自己 +type Effect425 struct { + node.EffectNode +} + +func (e *Effect425) OnSkill() bool { + numStats := int(e.Args()[0].IntPart()) // n项属性 + changeValue := int(e.Args()[1].IntPart()) // m + + // 定义可变化的属性列表 + stats := []int{ + int(info.PetStatus.AtkUp), + int(info.PetStatus.DefUp), + int(info.PetStatus.SpAtkUp), + int(info.PetStatus.SpDefUp), + int(info.PetStatus.SpeedUp), + int(info.PetStatus.AccuracyUp), + } + + // 随机选择n项属性 + for i := 0; i < numStats && i < len(stats); i++ { + randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(stats)))) + selectedStat := stats[randomIndex] + + // 对对手施加降低效果 + oppEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat) + if oppEffect != nil { + oppEffect.SetArgs(e.Ctx().Our, -changeValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, oppEffect) + } + + // 对自己施加提升效果 + selfEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat) + if selfEffect != nil { + selfEffect.SetArgs(e.Ctx().Our, changeValue) // 正值表示提升 + e.Ctx().Our.AddEffect(e.Ctx().Our, selfEffect) + } + } + + return true +} + +// 521 - 反转自身能力下降状态 +type Effect521 struct { + node.EffectNode +} + +func (e *Effect521) OnSkill() bool { + // 反转自身的能力下降状态,即将下降变为提升 + e.Ctx().Our.ReverseNegativeBuffs() + + return true +} + +// 511 - n%概率威力翻倍 体力低于1/m时概率增加k% +type Effect511 struct { + node.EffectNode +} + +func (e *Effect511) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + // 基础概率 + baseChance := e.Args()[0].IntPart() + + // 检查体力是否低于1/m + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + threshold := maxHp.Div(e.Args()[1]) // 1/m + + chance := baseChance + if currentHp.Cmp(threshold) < 0 { + // 体力低于阈值,概率增加k% + chance += int(e.Args()[2].IntPart()) + } + + success, _, _ := e.Input.Player.Roll(chance, 100) + if success { + // 威力翻倍 + e.Ctx().SkillEntity.Power *= 2 + } + + return true +} + +// 137 - 损失一半当前体力值,攻击和速度提升2个等级 +type Effect137 struct { + node.EffectNode +} + +func (e *Effect137) OnSkill() bool { + // 损失一半当前体力值 + currentHp := e.Ctx().Our.CurrentPet.GetHP() + halfHp := currentHp.Div(alpacadecimal.NewFromInt(2)) + + damageZone := &info.DamageZone{ + Type: info.DamageType.PercentageBased, + Damage: halfHp, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + + // 攻击提升2个等级 + atkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.AtkUp)) + if atkUpEffect != nil { + atkUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级 + e.Ctx().Our.AddEffect(e.Ctx().Our, atkUpEffect) + } + + // 速度提升2个等级 + speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp)) + if speedUpEffect != nil { + speedUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级 + e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect) + } + + return true +} + +// 497 - 附加m点固定伤害,每次使用额外附加n点,最高k点,遇到天敌时效果翻倍 +type Effect497 struct { + node.EffectNode + stackedDamage int + maxExtraDamage int +} + +func (e *Effect497) SkillHit_ex() bool { + // 基础伤害 + baseDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + + // 额外伤害 + extraDamage := alpacadecimal.NewFromInt(int64(e.stackedDamage)) + + // 总伤害 + totalDamage := baseDamage.Add(extraDamage) + + // 检查是否遇到天敌 + if e.isDisadvantageousMatch() { + // 遇到天敌,效果翻倍 + totalDamage = totalDamage.Mul(alpacadecimal.NewFromInt(2)) + } + + // 附加固定伤害 + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: totalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + // 更新叠加伤害 + e.stackedDamage += int(e.Args()[1].IntPart()) + if e.stackedDamage > e.maxExtraDamage { + e.stackedDamage = e.maxExtraDamage + } + + return true +} + +func (e *Effect497) isDisadvantageousMatch() bool { + // 检查是否遇到天敌 + return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire && + e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater +} + +func (e *Effect497) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.maxExtraDamage = a[2] // 最高k点 +} + +// 443 - n回合内若受到的伤害超过m,则对手疲惫x回合 +type Effect443 struct { + node.EffectNode +} + +func (e *Effect443) Skill_Use_ex() bool { + damageThreshold := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + + if e.Ctx().Our.SumDamage.Cmp(damageThreshold) > 0 { + // 对手疲惫x回合 + tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) + if tiredEffect != nil { + tiredEffect.Duration(int(e.Args()[2].IntPart())) // x回合 + e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect) + } + } + + return true +} + +func (e *Effect443) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 200 - 若对手处于能力提升状态,n%几率令对手XX +type Effect200 struct { + node.EffectNode +} + +func (e *Effect200) OnSkill() bool { + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态 + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +// 609 - 若对手XX,技能威力翻倍(XX代表异常状态:麻痹0,中毒1,烧伤2,冻伤5,害怕6,疲惫7,睡眠8,石化9,冰封15) +type Effect609 struct { + node.EffectNode +} + +func (e *Effect609) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + // 检查对手是否处于任何异常状态 + if e.Ctx().Opp.CurrentPet.HasAnyStatus() { + // 威力翻倍 + e.Ctx().SkillEntity.Power *= 2 + } + + return true +} + +// 157 - n回合内,若受到攻击对手防御等级-1、特防等级-1、命中等级-1 +type Effect157 struct { + node.EffectNode +} + +func (e *Effect157) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + + // 降低对手防御等级 + defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown)) + if defDownEffect != nil { + defDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级 + e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect) + } + + // 降低对手特防等级 + spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown)) + if spDefDownEffect != nil { + spDefDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级 + e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect) + } + + // 降低对手命中等级 + accuracyDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.AccuracyDown)) + if accuracyDownEffect != nil { + accuracyDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级 + e.Ctx().Opp.AddEffect(e.Ctx().Our, accuracyDownEffect) + } + + return true +} + +func (e *Effect157) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 179 - 若属性相同则技能威力提升n +type Effect179 struct { + node.EffectNode +} + +func (e *Effect179) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type { + // 属性相同,技能威力提升n + e.Ctx().SkillEntity.Power += int(e.Args()[0].IntPart()) + } + + return true +} + +// 412 - 若自身体力小于1/n,则每次攻击不消耗PP值 +type Effect412 struct { + node.EffectNode +} + +func (e *Effect412) SkillHit() bool { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + threshold := maxHp.Div(e.Args()[0]) // 1/n + + if currentHp.Cmp(threshold) < 0 { + // 本次攻击不消耗PP + e.Ctx().Our.SkipPpConsumption = true + } + + return true +} + +// 191 - n回合内免疫并反弹所有受到的异常状态 +type Effect191 struct { + node.EffectNode +} + +func (e *Effect191) OnSkill() bool { + // 设置免疫异常状态效果 + immunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus)) + if immunityEffect != nil { + immunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, immunityEffect) + } + + // 设置反弹异常状态效果 + reflectEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ReflectStatus)) + if reflectEffect != nil { + reflectEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, reflectEffect) + } + + return true +} + +// 199 - 下次被击败后,下一个出场的精灵xx等级+k +type Effect199 struct { + node.EffectNode +} + +func (e *Effect199) SkillUseed() bool { + if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败 + // 设置下一个出场精灵的增益效果 + effectType := int(e.Args()[0].IntPart()) // xx类型 + effectValue := int(e.Args()[1].IntPart()) // 等级+k + + buffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if buffEffect != nil { + buffEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Our.SetNextPetBuff(buffEffect) + } + } + + return true +} + +// 498 - n回合内致命一击几率上升1/m +type Effect498 struct { + node.EffectNode +} + +func (e *Effect498) OnSkill() bool { + // 增加暴击率 + critIncrease := alpacadecimal.NewFromInt(1).Div(e.Args()[1]) // 1/m + e.Ctx().Our.CurrentPet.CritRate += int(critIncrease.IntPart()) + + return true +} + +func (e *Effect498) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 470 - n回合内若自身攻击技能命中则m%令对手p +type Effect470 struct { + node.EffectNode +} + +func (e *Effect470) SkillHit() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + chance := e.Args()[1].IntPart() // m% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[2].IntPart()) // p类型(异常状态) + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +func (e *Effect470) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 461 - 使用后若自身体力低于1/m则从下回合开始必定致命一击 +type Effect461 struct { + node.EffectNode +} + +func (e *Effect461) OnSkill() bool { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + currentHp := e.Ctx().Our.CurrentPet.GetHP() + threshold := maxHp.Div(e.Args()[1]) // 1/m + + if currentHp.Cmp(threshold) < 0 { + // 添加必定暴击效果,从下回合开始 + critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit)) + if critEffect != nil { + critEffect.Duration(int(e.Args()[0].IntPart())) // 持续回合数 + e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect) + } + } + + return true +} + +// 506 - 下回合受到致命伤害时残留m点体力 +type Effect506 struct { + node.EffectNode +} + +func (e *Effect506) OnSkill() bool { + minHealth := int(e.Args()[0].IntPart()) // m点体力 + + // 设置保护效果,下回合受到致命伤害时保留m点体力 + protectEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ProtectFromKO)) + if protectEffect != nil { + protectEffect.SetArgs(e.Ctx().Our, minHealth) + protectEffect.Duration(1) // 仅下回合有效 + e.Ctx().Our.AddEffect(e.Ctx().Our, protectEffect) + } + + return true +} + +// 422 - 附加所造成伤害值X%的固定伤害 +type Effect422 struct { + node.EffectNode +} + +func (e *Effect422) SkillHit_ex() bool { + damageDone := e.Ctx().Our.SumDamage + percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // X% + + additionalDamage := damageDone.Mul(percent) + + if additionalDamage.Cmp(alpacadecimal.NewFromInt(0)) > 0 { + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: additionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +// 513 - 处在烧伤、中毒、冻伤状态时威力翻倍,命中后解除这些异常状态 +type Effect513 struct { + node.EffectNode +} + +func (e *Effect513) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + // 检查是否处在烧伤、中毒、冻伤状态之一 + hasSpecificStatus := e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Burned) || + e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Poisoned) || + e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Frozen) + + if hasSpecificStatus { + // 威力翻倍 + e.Ctx().SkillEntity.Power *= 2 + + // 解除这些异常状态 + e.Ctx().Our.RemoveSpecificStatus([]info.EnumPetStatus{ + info.PetStatus.Burned, + info.PetStatus.Poisoned, + info.PetStatus.Frozen, + }) + } + + return true +} + +// 201 - 组队时恢复己方1/n的体力 +type Effect201 struct { + node.EffectNode +} + +func (e *Effect201) OnSkill() bool { + // 检查是否在组队战斗中 + if e.Ctx().IsTeamBattle { + // 计算恢复量 + team := e.Ctx().Our.TeamPets // 假设有队伍宠物列表 + for _, pet := range team { + if pet.Info.Hp > 0 { // 只恢复还活着的宠物 + maxHp := pet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[0]) // 1/n + + // 恢复体力 + pet.Heal(pet, &action.SelectSkillAction{}, healAmount) + } + } + } + + return true +} + +// 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击 +type Effect493 struct { + node.EffectNode + critDuration int +} + +func (e *Effect493) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + // 对手使用了攻击技能,设置下n回合必定暴击 + critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit)) + if critEffect != nil { + critEffect.Duration(e.critDuration) // n回合 + e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect) + } + } + + return true +} + +func (e *Effect493) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.critDuration = a[1] // n回合 + e.EffectNode.Duration(a[0]) // 持续m回合 +} + +// 428 - 遇到天敌时附加m点固定伤害 +type Effect428 struct { + node.EffectNode +} + +func (e *Effect428) SkillHit_ex() bool { + // 检查是否遇到天敌 + if e.isDisadvantageousMatch() { + // 附加m点固定伤害 + additionalDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: additionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +func (e *Effect428) isDisadvantageousMatch() bool { + // 检查是否遇到天敌 + return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire && + e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater +} + +// 458 - 若先出手则造成攻击伤害的n%恢复自身体力 +type Effect458 struct { + node.EffectNode +} + +func (e *Effect458) SkillHit_ex() bool { + if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 + damageDone := e.Ctx().Our.SumDamage + healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // n% + healAmount := damageDone.Mul(healPercent) + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +// 166 - n回合内,若对手使用属性攻击则m%对手XX等级k +type Effect166 struct { + node.EffectNode +} + +func (e *Effect166) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS { + chance := e.Args()[0].IntPart() // m% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 等级k + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, effectValue) + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + return true +} + +func (e *Effect166) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 416 - n回合内,受到任何伤害,对手XX降低m个等级 +type Effect416 struct { + node.EffectNode +} + +func (e *Effect416) Skill_Use_ex() bool { + effectType := int(e.Args()[1].IntPart()) // XX类型 + effectValue := int(e.Args()[2].IntPart()) // 降低m个等级 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + + return true +} + +func (e *Effect416) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} + +// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手 +type Effect435 struct { + node.EffectNode +} + +func (e *Effect435) SkillUseed() bool { + if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 牺牲自己(被击败) + // 设置下个出场精灵的效果 + e.Ctx().Our.SetNextPetMustHit(true) + e.Ctx().Our.SetNextPetMustGoFirst(true) + } + + return true +} + +// 142 - 损失1/n的体力值,下回合能较快出手 +type Effect142 struct { + node.EffectNode +} + +func (e *Effect142) OnSkill() bool { + // 损失1/n的体力值 + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + damageAmount := maxHp.Div(e.Args()[0]) // 1/n + + damageZone := &info.DamageZone{ + Type: info.DamageType.PercentageBased, + Damage: damageAmount, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + + // 设置下回合能较快出手 + speedBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedPlus)) + if speedBoostEffect != nil { + speedBoostEffect.Duration(1) // 仅下回合 + speedBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // 先制度+m + e.Ctx().Our.AddEffect(e.Ctx().Our, speedBoostEffect) + } + + return true +} + +// 409 - n回合内,对手每回合速度等级m +type Effect409 struct { + node.EffectNode +} + +func (e *Effect409) OnSkill() bool { + speedEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedDown)) + if speedEffect != nil { + speedEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // 速度等级m(负值降低,正值提升,根据上下文推测应该是降低) + speedEffect.Duration(int(e.Args()[0].IntPart())) // n回合 + e.Ctx().Opp.AddEffect(e.Ctx().Our, speedEffect) + } + + return true +} + +// 460 - m%几率令对手害怕,若对手处于能力强化状态则额外附加n%几率 +type Effect460 struct { + node.EffectNode +} + +func (e *Effect460) OnSkill() bool { + baseChance := e.Args()[0].IntPart() // m% + + // 检查对手是否处于能力强化状态 + extraChance := 0 + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { + extraChance = int(e.Args()[1].IntPart()) // 额外n% + } + + totalChance := baseChance + extraChance + success, _, _ := e.Input.Player.Roll(totalChance, 100) + + if success { + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + } + } + + return true +} + +// 419 - m回合内,若对手处于能力强化状态,则每回合都会受到k点固定伤害 +type Effect419 struct { + node.EffectNode +} + +func (e *Effect419) Action_start() bool { + if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力强化状态 + fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) // k点固定伤害 + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: fixedDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +func (e *Effect419) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续m回合 +}