private void HandleMultipleEnemies() { //Credits to dgcfus for this snippet. if (Local.HasPet) { if (Attackers.Count >= 2 && Local.HasPet && Pet.IsAlive()) { var attackUnit = Attackers.FirstOrDefault(Mob => Mob.TargetGuid == Local.Guid); if (attackUnit != null) { Local.SetTarget(attackUnit); if (!Pet.IsOnMyTarget()) { Pet.Attack(); Pet.Cast("Suffering"); } } else { int LowerHP = Attackers.Min(Mob => Mob.HealthPercent); var LowerHPUnit = Attackers.SingleOrDefault(Mob => Mob.HealthPercent == LowerHP); if (LowerHPUnit != null && LowerHPUnit.Guid != Target.Guid) { Local.SetTarget(LowerHPUnit); } } } } }
private bool MultiDot() { if (Attackers.Count >= 2 && Local.ManaPercent >= 40) { int properTargetH = Attackers.Min(Target => Target.HealthPercent); var properTarget = Attackers.FirstOrDefault(Target => Target.HealthPercent == properTargetH); int newAddH = Attackers.Max(Enemy => Enemy.HealthPercent); var newAdd = Attackers.FirstOrDefault(Enemy => Enemy.HealthPercent == newAddH); if (newAdd != null && newAdd.Guid != Target.Guid && (!newAdd.GotDebuff("Curse of Agony") && Spell.GetSpellRank("Curse of Agony") != 0) && (!newAdd.GotDebuff("Corruption") && Spell.GetSpellRank("Corruption") != 0) && (!newAdd.GotDebuff("Siphon Life") && Spell.GetSpellRank("Siphon Life") != 0)) { if (Spell.IsSpellReady("Curse of Agony")) { Local.SetTarget(newAdd); Spell.Cast("Curse of Agony"); Spell.Cast("Corruption"); Spell.Cast("Siphon Life"); } } Local.SetTarget(properTarget); } return(true); }
private void KickEnemy() { if (Spell.GetSpellRank("Pummel") != 0 && Spell.IsSpellReady("Pummel")) { int properTargetH = Attackers.Min(Target => Target.HealthPercent); var properTarget = Attackers.FirstOrDefault(Target => Target.HealthPercent == properTargetH); var castingUnit = Attackers.FirstOrDefault(Caster => Caster.Casting != 0 || Caster.Channeling != 0); if (castingUnit != null && Spell.IsSpellReady("Pummel")) { Spell.Instance.StopCasting(); if (castingUnit.Guid != Target.Guid) { Local.SetTarget(castingUnit); } if (Target.Casting != 0 || Target.Channeling != 0) { Spell.Instance.Cast("Pummel"); } Local.SetTarget(properTarget); return; } } }
public ICombatGroup GetCombatGroup(uint id) { return(Attackers.FirstOrDefault(group => group.Id == id) ?? Defenders.FirstOrDefault(group => group.Id == id)); }
private bool HandledMultiTargetCombat() { if (this.Player.ManaPercent < 15) { return(true); } if (Attackers.Count > 1) { if (Target.GotDebuff("Curse of Agony") && Target.GotDebuff("Corruption")) { var unitDotToAttack = Attackers.FirstOrDefault( a => !a.GotDebuff("Curse of Agony") || !a.GotDebuff("Corruption")); var unitToAttack = Attackers.FirstOrDefault(a => a.TargetGuid == this.Player.Guid); if (unitDotToAttack != null) { this.Player.StopWand(); this.Player.StopAttack(); this.Player.SetTargetTo(unitDotToAttack); if (this.Player.GotPet()) { this.Pet.Attack(); if (this.Player.CanUse("Suffering")) { this.Player.Cast("Suffering"); } } DotTarget(unitToAttack, "Curse of Agony"); DotTarget(unitToAttack, "Corruption"); return(false); } if (unitToAttack != null) { this.Player.SetTargetTo(unitToAttack); if (this.Player.GotPet()) { this.Pet.Attack(); if (this.Player.CanUse("Suffering")) { this.Player.Cast("Suffering"); } } } else { int LowerHP = this.Attackers.Min(Mob => Mob.HealthPercent); var LowerHPUnit = this.Attackers.SingleOrDefault(Mob => Mob.HealthPercent == LowerHP); if (LowerHPUnit != null && LowerHPUnit.Guid != this.Target.Guid) { this.Player.SetTargetTo(LowerHPUnit); this.Pet.Attack(); } if (handleaggrofear) { int HigherHp = this.Attackers.Max(Mob => Mob.HealthPercent); var HigherHpUnit = this.Attackers.SingleOrDefault(Mob => Mob.HealthPercent == HigherHp); if (HigherHpUnit != null && !HigherHpUnit.GotDebuff("Fear") && HigherHpUnit.Guid != this.Target.Guid) { this.Player.SetTargetTo(HigherHpUnit); if (!this.Target.GotDebuff("Fear") && CheckSpell("Fear")) { this.Player.Cast("Fear"); } this.Player.SetTargetTo(LowerHPUnit); } } } } } return(true); }