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" ) type Effect1538 struct{ node.EffectNode } func (e *Effect1538) Damage_Mul(zone *info.DamageZone) bool { if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().Opp == nil || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 { return true } ourValue := e.Ctx().Our.GetProp(0) if e.Ctx().SkillEntity.Category() == info.Category.SPECIAL { ourValue = e.Ctx().Our.GetProp(2) } if ourValue.Cmp(alpacadecimal.Zero) <= 0 { return true } bestValue := e.Ctx().Opp.GetProp(0) if e.Ctx().Opp.GetProp(2).Cmp(bestValue) > 0 { bestValue = e.Ctx().Opp.GetProp(2) } if bestValue.Cmp(alpacadecimal.Zero) <= 0 { return true } zone.Damage = zone.Damage.Mul(bestValue).Div(ourValue) return true } type Effect1539 struct{ node.EffectNode } func (e *Effect1539) OnSkill() bool { if len(e.Args()) < 3 || e.Ctx().Opp == nil { return true } threshold := e.Args()[0] if e.Ctx().Our.SumDamage.Cmp(threshold) <= 0 { e.Ctx().Opp.CancelTurn(e.Ctx().Our) return true } ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) if ok { addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) return true } e.Ctx().Opp.CancelTurn(e.Ctx().Our) return true } type Effect1540 struct{ node.EffectNode } func (e *Effect1540) Skill_Use() bool { if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } if e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil { return true } threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]) if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) <= 0 { return true } drain := e.Args()[1] if drain.Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: drain, }) e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) return true } type Effect1541 struct{ node.EffectNode } func (e *Effect1541) Skill_Use() bool { if len(e.Args()) == 0 { return true } sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1541, int(e.Args()[0].IntPart())) if sub != nil { e.Ctx().Our.AddEffect(e.Ctx().Our, sub) } return true } type Effect1541Sub struct{ RoundEffectArg0Base } func (e *Effect1541Sub) ComparePre(first, second *action.SelectSkillAction) bool { current := actionByPlayer(first, second, e.Ctx().Our.UserID) if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS { return true } current.SkillEntity.XML.Priority++ return true } func (e *Effect1541Sub) ActionStart(first, second *action.SelectSkillAction) bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { return true } e.Ctx().SkillEntity.XML.MustHit = 1 return true } func (e *Effect1541Sub) OnSkill() bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { return true } extra := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.AttackValue.LostHp)).Div(alpacadecimal.NewFromInt(2)) if extra.Cmp(alpacadecimal.Zero) <= 0 { return true } e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: extra, }) return true } type Effect1542 struct{ node.EffectNode } func (e *Effect1542) Skill_Use() bool { if len(e.Args()) < 2 || e.Ctx().Opp == nil { return true } if transferPositiveProps(e.Ctx().Our, e.Ctx().Opp, e.Ctx().Our) { addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) return true } level := int8(e.Args()[1].IntPart()) if level == 0 { return true } for idx := range e.Ctx().Opp.Prop { e.Ctx().Opp.SetProp(e.Ctx().Our, int8(idx), -level) } return true } func init() { input.InitEffect(input.EffectType.Skill, 1538, &Effect1538{}) input.InitEffect(input.EffectType.Skill, 1539, &Effect1539{}) input.InitEffect(input.EffectType.Skill, 1540, &Effect1540{}) input.InitEffect(input.EffectType.Skill, 1541, &Effect1541{}) input.InitEffect(input.EffectType.Sub, 1541, &Effect1541Sub{}) input.InitEffect(input.EffectType.Skill, 1542, &Effect1542{}) }