Files
bl/logic/service/fight/effect/effect_missing.go1
昔念 d367f9d1d4
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
41
2026-03-07 23:54:01 +08:00

2895 lines
74 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

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

package effect
import (
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%令对方xxm%令对方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回合
}