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 830: 若后出手,则免疫本回合受到的伤害 type Effect830 struct{ node.EffectNode } func (e *Effect830) DamageLockEx(zone *info.DamageZone) bool { if e.IsFirst() || zone == nil { return true } zone.Damage = alpacadecimal.Zero return true } func (e *Effect830) DamageDivEx(zone *info.DamageZone) bool { if e.IsFirst() || zone == nil { return true } zone.Damage = alpacadecimal.Zero return true } // Effect 831: 附加自身最大体力{0}%的百分比伤害 type Effect831 struct{ node.EffectNode } func (e *Effect831) OnSkill() bool { if len(e.Args()) == 0 { return true } damage := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(hundred) if damage.Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Percent, Damage: damage, }) return true } // Effect 833: 当回合若未击败对手则吸取对手最大体力的1/{0} type Effect833 struct{ node.EffectNode } func (e *Effect833) Skill_Use() bool { if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { return true } drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) if drain.Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Percent, Damage: drain, }) e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) return true } // Effect 834: {0}回合内自身能力提升状态被消除或吸取时,{1}回合内对手属性技能无效 type Effect834 struct{ node.EffectNode } func (e *Effect834) Skill_Use() bool { if len(e.Args()) < 2 { return true } sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 834, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) if sub != nil { e.Ctx().Our.AddEffect(e.Ctx().Our, sub) } return true } type Effect834Sub struct{ RoundEffectArg0Base } func (e *Effect834Sub) PropBefer(in *input.Input, prop, level int8) bool { if in != e.Ctx().Opp || level != 0 || len(e.Args()) < 2 { return true } if e.Ctx().Our.Prop[prop] <= 0 { return true } sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 8341, int(e.Args()[1].IntPart())) if sub != nil { e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) } e.Alive(false) return true } type Effect834SealSub struct{ RoundEffectArg0Base } func (e *Effect834SealSub) ActionStart(a, b *action.SelectSkillAction) bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { return true } e.Ctx().SkillEntity.SetNoSide() e.Ctx().SkillEntity.AttackTime = 0 return true } // Effect 835: 反转自身能力下降状态,反转成功则恢复自身全部体力 type Effect835 struct{ node.EffectNode } func (e *Effect835) Skill_Use() bool { reversed := false for i, v := range e.Ctx().Our.Prop[:] { if v >= 0 { continue } if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) { reversed = true } } if !reversed { return true } heal := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP()) if heal.Cmp(alpacadecimal.Zero) > 0 { e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) } return true } func init() { input.InitEffect(input.EffectType.Skill, 830, &Effect830{}) input.InitEffect(input.EffectType.Skill, 831, &Effect831{}) input.InitEffect(input.EffectType.Skill, 833, &Effect833{}) input.InitEffect(input.EffectType.Skill, 834, &Effect834{}) input.InitEffect(input.EffectType.Sub, 834, &Effect834Sub{}) input.InitEffect(input.EffectType.Sub, 8341, &Effect834SealSub{}) input.InitEffect(input.EffectType.Skill, 835, &Effect835{}) }