diff --git a/logic/service/fight/effect/155.go b/logic/service/fight/effect/155.go new file mode 100644 index 00000000..24ae85fb --- /dev/null +++ b/logic/service/fight/effect/155.go @@ -0,0 +1,37 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 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) + + // 消除所有能力下降 + + for i := 0; i < 6; i++ { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -1, info.AbilityOpType.RESET) + } + // 使自己进入睡眠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 +} +func init() { + input.InitEffect(input.EffectType.Skill, 155, &Effect155{}) + +} diff --git a/logic/service/fight/effect/175.go b/logic/service/fight/effect/175.go new file mode 100644 index 00000000..e8c46293 --- /dev/null +++ b/logic/service/fight/effect/175.go @@ -0,0 +1,34 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 175 - 若对手处于异常状态,则m%自身XX等级k +type Effect175 struct { + node.EffectNode +} + +func (e *Effect175) OnSkill() bool { + if e.Ctx().Opp.StatEffect_Exist_all() { // 对手处于异常状态 + 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 +} +func init() { + input.InitEffect(input.EffectType.Skill, 175, &Effect175{}) + +} diff --git a/logic/service/fight/effect/418.go b/logic/service/fight/effect/418.go new file mode 100644 index 00000000..2e50b7f9 --- /dev/null +++ b/logic/service/fight/effect/418.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 418 - 若对手处于能力提升状态则对方XX等级+/-n +type Effect418 struct { + node.EffectNode +} + +func (e *Effect418) OnSkill() bool { + for _, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + return true + } + + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 418, &Effect418{}) + +} diff --git a/logic/service/fight/effect/477.go b/logic/service/fight/effect/477.go new file mode 100644 index 00000000..5cf0da94 --- /dev/null +++ b/logic/service/fight/effect/477.go @@ -0,0 +1,33 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 477 - n回合内若受到攻击,则对手攻击,防御,特攻,特防,速度,命中等级降低 +type Effect477 struct { + node.EffectNode +} + +func (e *Effect477) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + for i, effectId := range e.SideEffectArgs[1:] { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB) + } + + return true +} + +func (e *Effect477) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 477, &Effect477{}) + +} diff --git a/logic/service/fight/effect/494.go b/logic/service/fight/effect/494.go new file mode 100644 index 00000000..dc69a1ed --- /dev/null +++ b/logic/service/fight/effect/494.go @@ -0,0 +1,22 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 494 - 无视对手能力提升状态 +type Effect494 struct { + node.EffectNode +} + +func (e *Effect494) CalculatePre() bool { + + e.Ctx().Opp.Prop = [6]int8{} + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 494, &Effect494{}) + +} diff --git a/logic/service/fight/effect/504.go b/logic/service/fight/effect/504.go new file mode 100644 index 00000000..21f2a428 --- /dev/null +++ b/logic/service/fight/effect/504.go @@ -0,0 +1,35 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 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 { + for i, effectId := range e.SideEffectArgs[1:] { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB) + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 504, &Effect504{}) + +} diff --git a/logic/service/fight/effect/518.go b/logic/service/fight/effect/518.go new file mode 100644 index 00000000..a1ea4514 --- /dev/null +++ b/logic/service/fight/effect/518.go @@ -0,0 +1,33 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 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 +} +func init() { + input.InitEffect(input.EffectType.Skill, 518, &Effect518{}) + +} diff --git a/logic/service/fight/effect/522.go b/logic/service/fight/effect/522.go new file mode 100644 index 00000000..cf608e75 --- /dev/null +++ b/logic/service/fight/effect/522.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" +) + +// 522 - n回合内若处于异常状态则受到伤害减少m点 +type Effect522 struct { + node.EffectNode +} + +func (e *Effect522) DamageSubEx(t *info.DamageZone) bool { + if e.Ctx().Our.StatEffect_Exist_all() { // 自身处于异常状态 + // 减少受到的伤害m点 + damageReduction := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + if t.Damage.Cmp(e.Args()[1]) > 0 { + t.Damage = t.Damage.Sub(damageReduction) + } else { + t.Damage = alpacadecimal.Zero + } + + } + + return true +} + +func (e *Effect522) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 522, &Effect522{}) + +} diff --git a/logic/service/fight/effect/back.go1 b/logic/service/fight/effect/back.go1 index 1a171231..ab34ead8 100644 --- a/logic/service/fight/effect/back.go1 +++ b/logic/service/fight/effect/back.go1 @@ -78,42 +78,6 @@ func (e *Effect441) SetArgs(t *input.Input, a ...int) { e.maxCritIncrease = a[1] } -// 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回合 -} - // 165 - n回合内,每回合防御和特防等级+m type Effect165 struct { node.EffectNode @@ -301,44 +265,6 @@ func (e *Effect184) OnSkill() bool { 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 -} - // 1044 - 吸取对手能力提升状态,吸取成功则下n回合造成的伤害翻倍 type Effect1044 struct { node.EffectNode @@ -367,26 +293,6 @@ func (e *Effect1044) OnSkill() bool { 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 @@ -611,22 +517,6 @@ func (e *Effect501) SkillHit_ex() bool { 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 -} - // 474 - 先出手时m%自身XX等级+n type Effect474 struct { node.EffectNode @@ -651,30 +541,6 @@ func (e *Effect474) OnSkill() bool { 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 -} - // 440 - n回合内对手使用技能消耗的PP值变为m倍 type Effect440 struct { node.EffectNode @@ -1133,29 +999,6 @@ func (e *Effect453) OnSkill() bool { 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 @@ -1173,26 +1016,6 @@ func (e *Effect505) SkillHit_ex() bool { 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 @@ -1227,29 +1050,6 @@ func (e *Effect561) OnSkill() bool { 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 -} - // 425 - 随机使对手n项属性m,并将该属性附加给自己 type Effect425 struct { node.EffectNode