package effect import ( "blazing/logic/service/fight/action" "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" "github.com/alpacahq/alpacadecimal" ) // Effect 1418: 损失自身{0}点体力 type Effect1418 struct{ node.EffectNode } func (e *Effect1418) Skill_Use() bool { if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: e.Args()[0], }) return true } // Effect 1419: 消除双方能力提升状态,消除任意一方成功则自身免疫下{0}次异常状态且令对手随机{1}个技能PP值归零 type Effect1419 struct{ node.EffectNode } func (e *Effect1419) Skill_Use() bool { if len(e.Args()) < 2 { return true } cleared := clearPositiveProps(e.Ctx().Our, e.Ctx().Our) if clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) { cleared = true } if !cleared { return true } immune := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1419, int(e.Args()[0].IntPart())) if immune != nil { e.Ctx().Our.AddEffect(e.Ctx().Our, immune) } zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart())) return true } type Effect1419Sub struct { node.EffectNode remaining int } func (e *Effect1419Sub) SetArgs(t *input.Input, a ...int) { e.EffectNode.SetArgs(t, a...) e.Duration(-1) if len(a) > 0 { e.remaining = a[0] } } func (e *Effect1419Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { if e.remaining <= 0 { e.Alive(false) return true } if in != e.Ctx().Opp || !input.IS_Stat(effEffect) { return true } e.remaining-- if e.remaining <= 0 { e.Alive(false) } return false } // Effect 1420: 自身处于能力提升状态时50%打出致命一击 type Effect1420 struct{ node.EffectNode } func (e *Effect1420) SkillHit() bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { return true } if !e.Ctx().Our.HasPropADD() { return true } ok, _, _ := e.Input.Player.Roll(50, 100) if ok { e.Ctx().SkillEntity.XML.CritRate = 16 } return true } // Effect 1421: 当回合打出的攻击伤害在{0}—{1}之间则{2}%令对手{3} type Effect1421 struct{ node.EffectNode } func (e *Effect1421) Skill_Use() bool { if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 { return true } low := e.Args()[0] high := e.Args()[1] if low.Cmp(high) > 0 { low, high = high, low } if e.Ctx().Our.SumDamage.Cmp(low) < 0 || e.Ctx().Our.SumDamage.Cmp(high) > 0 { return true } ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100) if ok { addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart())) } return true } // Effect 1422: 获得{0}点护罩,护罩消失时恢复自身{1}点体力 type Effect1422 struct{ node.EffectNode } func (e *Effect1422) Skill_Use() bool { if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Our.AddShield(e.Args()[0]) sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1422, int(e.Args()[1].IntPart())) if sub != nil { e.Ctx().Our.AddEffect(e.Ctx().Our, sub) } return true } type Effect1422Sub struct{ node.EffectNode } func (e *Effect1422Sub) SetArgs(t *input.Input, a ...int) { e.EffectNode.SetArgs(t, a...) e.CanStack(false) e.Duration(-1) } func (e *Effect1422Sub) ShieldChange(before, after alpacadecimal.Decimal) bool { if before.Cmp(alpacadecimal.Zero) <= 0 || after.Cmp(alpacadecimal.Zero) > 0 || len(e.Args()) == 0 { return true } heal := e.Args()[0] if heal.Cmp(alpacadecimal.Zero) <= 0 { e.Alive(false) return true } e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) e.Alive(false) return true } func init() { input.InitEffect(input.EffectType.Skill, 1418, &Effect1418{}) input.InitEffect(input.EffectType.Skill, 1419, &Effect1419{}) input.InitEffect(input.EffectType.Sub, 1419, &Effect1419Sub{}) input.InitEffect(input.EffectType.Skill, 1420, &Effect1420{}) input.InitEffect(input.EffectType.Skill, 1421, &Effect1421{}) input.InitEffect(input.EffectType.Skill, 1422, &Effect1422{}) input.InitEffect(input.EffectType.Sub, 1422, &Effect1422Sub{}) }