diff --git a/logic/service/fight/effect/effect_680_690.go b/logic/service/fight/effect/effect_680_690.go new file mode 100644 index 000000000..85e67c792 --- /dev/null +++ b/logic/service/fight/effect/effect_680_690.go @@ -0,0 +1,277 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" + "github.com/gogf/gf/v2/util/grand" +) + +// 680 - 先出手时{0}%使对手{1}{2}回合 +type Effect680 struct { + node.EffectNode +} + +func (e *Effect680) Skill_Use() bool { + if !e.IsFirst() { + return true + } + chance := int(e.Args()[0].IntPart()) + success, _, _ := e.Input.Player.Roll(chance, 100) + if success { + statusID := int(e.Args()[1].IntPart()) + duration := int(e.Args()[2].IntPart()) + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID) + if statusEffect != nil { + statusEffect.Duration(duration) + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + return true +} + +// 681 - 下{0}回合自身攻击技能必定致命、必定命中 +type Effect681 struct { + node.EffectNode +} + +func (e *Effect681) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) +} + +func (e *Effect681) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.XML.CritRate = 16 + e.Ctx().SkillEntity.XML.MustHit = 1 + return true +} + +// 682 - 受到的伤害超过{0},自身{1} +type Effect682 struct { + node.EffectNode + can bool +} + +func (e *Effect682) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(-1) +} + +func (e *Effect682) DamageLockEx(t *info.DamageZone) bool { + if t.Type != info.DamageType.Red { + return true + } + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 && !e.can { + e.can = true + triggerEffectID := int(e.Args()[1].IntPart()) + effect := e.Ctx().Our.InitEffect(input.EffectType.Skill, triggerEffectID, e.SideEffectArgs[2:]...) + if effect != nil { + effect.Duration(int(e.Args()[2].IntPart())) + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + } + return true +} + +// 683 - 随机附加{0}~{1}点固定伤害 +type Effect683 struct { + node.EffectNode +} + +func (e *Effect683) Skill_Use() bool { + min := e.Args()[0].IntPart() + max := e.Args()[1].IntPart() + damage := alpacadecimal.NewFromInt(int64(min) + int64(grand.N(0, int(max-min)))) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + }) + return true +} + +// 684 - 双方任意一方处于能力下降状态均会附加{0}点固定伤害,同时解除自身能力下降状态 +type Effect684 struct { + node.EffectNode +} + +func (e *Effect684) Skill_Use() bool { + if e.Ctx().Our.HasPropSub() || e.Ctx().Opp.HasPropSub() { + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Args()[0], + }) + // 解除自身能力下降状态 + for i, v := range e.Ctx().Our.Prop[:] { + if v < 0 { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) + } + } + } + return true +} + +// 685 - 若自身处于能力提升状态,附加{0}点固定伤害 +type Effect685 struct { + node.EffectNode +} + +func (e *Effect685) Skill_Use() bool { + if e.Ctx().Our.HasPropADD() { + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Args()[0], + }) + } + return true +} + +// 686 - 若对手{0}则使对手下{1}回合攻击必定MISS +type Effect686 struct { + node.EffectNode +} + +func (e *Effect686) Skill_Use() bool { + statusID := int(e.Args()[0].IntPart()) + duration := int(e.Args()[1].IntPart()) + if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID)) { + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 686, duration) + if effect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + } + } + return true +} + +// 686 sub - 使对手攻击技能MISS +type SubEffect686 struct { + node.EffectNode +} + +func (e *SubEffect686) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() != info.Category.STATUS { + e.Ctx().SkillEntity.SetMiss() + } + return true +} + +// 687 - 若对手{0},则对对方造成伤害的{1}%恢复自身体力 +type Effect687 struct { + node.EffectNode +} + +func (e *Effect687) Skill_Use() bool { + statusID := int(e.Args()[0].IntPart()) + percent := e.Args()[1] + if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID)) { + healAmount := e.Ctx().Our.SumDamage.Mul(percent).Div(alpacadecimal.NewFromInt(100)) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +// 688 - {0}回合内抵挡受到的攻击 +type Effect688 struct { + node.EffectNode + conut int +} + +func (e *Effect688) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(-1) +} + +func (e *Effect688) Damage_Shield(t *info.DamageZone) bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if t.Type == info.DamageType.Red { + e.conut++ + t.Damage = alpacadecimal.Zero + } + if e.Args()[0].IntPart() == int64(e.conut) { + e.Alive(false) + } + return true +} + +// 689 - 若造成的伤害高于{0},则恢复自身1/{1}最大体力 +type Effect689 struct { + node.EffectNode +} + +func (e *Effect689) Skill_Use() bool { + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +// 690 - 下{0}回合,能力提升状态消失则对手使用属性技能失效 +type Effect690 struct { + node.EffectNode +} + +func (e *Effect690) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) +} + +func (e *Effect690) PropBefer(in *input.Input, prop int8, level int8) bool { + if in == e.Ctx().Our && level < 0 { + // 能力下降被应用时(自身能力提升被消除),让对手属性技能失效 + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 690) + if effect != nil { + effect.Duration(e.Duration()) + e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + } + } + return true +} + +// 690 sub - 令对手属性技能失效 +type SubEffect690 struct { + node.EffectNode +} + +func (e *SubEffect690) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + e.Ctx().SkillEntity.SetMiss() + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 680, &Effect680{}) + input.InitEffect(input.EffectType.Skill, 681, &Effect681{}) + input.InitEffect(input.EffectType.Skill, 682, &Effect682{}) + input.InitEffect(input.EffectType.Skill, 683, &Effect683{}) + input.InitEffect(input.EffectType.Skill, 684, &Effect684{}) + input.InitEffect(input.EffectType.Skill, 685, &Effect685{}) + input.InitEffect(input.EffectType.Skill, 686, &Effect686{}) + input.InitEffect(input.EffectType.Sub, 686, &SubEffect686{}) + input.InitEffect(input.EffectType.Skill, 687, &Effect687{}) + input.InitEffect(input.EffectType.Skill, 688, &Effect688{}) + input.InitEffect(input.EffectType.Skill, 689, &Effect689{}) + input.InitEffect(input.EffectType.Skill, 690, &Effect690{}) + input.InitEffect(input.EffectType.Sub, 690, &SubEffect690{}) +}