stjernan

Untitled

Oct 27th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.42 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Converters;
  5. using ReBot.API;
  6. using RogueCommon;
  7.  
  8. namespace geReBot
  9. {
  10.     [Rotation("Rogue Combat223", "asd", WoWClass.Rogue, Specialization.RogueCombat, 5, 25)]
  11.     public class RogueCombat : CombatRotation
  12.     {
  13.         [JsonProperty("Poison1"), JsonConverter(typeof(StringEnumConverter))]
  14.         public Poison Poison1 = Poison.DeadlyPoison;
  15.  
  16.         [JsonProperty("Poison2"), JsonConverter(typeof(StringEnumConverter))]
  17.         public Poison Poison2 = Poison.CripplingPoison;
  18.  
  19.         bool needToStartAttack = false;
  20.  
  21.         public RogueCombat()
  22.         {
  23.         }
  24.  
  25.         public override bool OutOfCombat()
  26.         {
  27.             if (CastSelf("Recuperate", () => Me.HealthFraction < 0.8 && Me.GetPower(WoWPowerType.Energy) >= 30 && Me.ComboPoints > 0 && Me.ComboPoints * 6 > AuraTimeRemaining("Recuperate"))) return true;
  28.             if (CastSelf("Slice and Dice", () =>  !HasAura("Slice and Dice"))) return true;
  29.  
  30.             //dispell
  31.             CastSelf("Cloak of Shadows", () => Me.Auras.Any(x => x.IsDebuff && x.DebuffType.Contains("magic")));
  32.            
  33.             // Poisons
  34.             if (this.CastPoison(Poison1)) return true;
  35.             if (this.CastPoison(Poison2)) return true;
  36.  
  37.             return false;
  38.         }
  39.  
  40.         public override void Combat()
  41.         {
  42.             if (needToStartAttack)
  43.             {
  44.                 needToStartAttack = false;
  45.                 Me.StartAttack();
  46.             }
  47.             //if (Cast("Redirect", () => Me.ComboPoints > 0 && Target.HealthFraction == 1)) return;
  48.  
  49.             List<UnitObject> addsInRange = Adds.Where(x => x.IsInCombatRangeAndLoS).ToList();
  50.  
  51.             // in stealth
  52.             if (HasAura("Stealth"))
  53.             {
  54.                 if (HasSpell("Sap") && Me.GetPower(WoWPowerType.Energy) >= 35)
  55.                 {
  56.                     UnitObject add = addsInRange.FirstOrDefault(x => !x.InCombat && x.GetUnitCreatureType() == WoWUnitCreatureType.Humanoid);
  57.                     if (add != null)
  58.                         if (CastPreventDouble("Sap", null, add, 10 * 1000)) return;
  59.                 }
  60.  
  61.                 Cast("Premeditation", () => Me.ComboPoints <= 2);
  62.  
  63.                 if (Target.IsInCombatRangeAndLoS)
  64.                 {
  65.                     if (Cast("Ambush", () => Me.GetPower(WoWPowerType.Energy) >= 60)) return;
  66.                     if (Cast("Garrote")) return;
  67.                     if (Cast("Cheap Shot")) return;
  68.  
  69.                     // if we can't use one from above
  70.                     if (Cast("Sinister Strike", () => Me.GetPower(WoWPowerType.Energy) >= 60)) return;
  71.                 }
  72.                 else
  73.                 {
  74.                     if (CastSelf("Sprint", () => !HasAura("Sprint") && !HasAura("Burst of Speed"))) return;
  75.                     if (CastSelf("Burst of Speed", () => !HasAura("Sprint") && !HasAura("Burst of Speed"))) return;
  76.                     if (Cast("Shadowstep", () => !HasAura("Sprint"))) return;
  77.                     if (CastSelfPreventDouble("Shadow Walk")) return;
  78.                 }
  79.             }
  80.             else
  81.             {
  82.                 if (HasSpell("Gouge") && Me.GetPower(WoWPowerType.Energy) >= 45)
  83.                 {
  84.                     UnitObject fistAdd = addsInRange.FirstOrDefault();
  85.                     if (fistAdd != null)
  86.                         if (CastPreventDouble("Gouge", null, fistAdd, 5000))
  87.                         {
  88.                             needToStartAttack = true;
  89.                             return;
  90.                         }
  91.                 }
  92.                 if (HasSpell("Kick"))
  93.                 {
  94.                     UnitObject castingAddInRange = addsInRange.FirstOrDefault(x => x.IsCasting);
  95.                     if (castingAddInRange != null)
  96.                         Cast("Kick", null, castingAddInRange);
  97.                 }
  98.  
  99.                 if (HasSpell("Blind") && Me.HealthFraction < 0.5 && Me.GetPower(WoWPowerType.Energy) >= 15)
  100.                 {
  101.                     UnitObject blindAdd = Adds.FirstOrDefault(x => x.DistanceSquared <= 15 * 15 && !x.IsInCombatRangeAndLoS);
  102.                     if (blindAdd != null)
  103.                         Cast("Blind", null, blindAdd);
  104.                 }
  105.  
  106.  
  107.                 if (Target.IsInCombatRangeAndLoS)
  108.                 {
  109.                     CastSelf("Shadow Blades");
  110.                     CastSelf("Combat Readiness", () => Me.HpLessThanOrElite(0.85) && !Target.HasPower(WoWPowerType.Mana));
  111.                     CastSelf("Cloak of Shadows", () => Me.HealthFraction <= 0.75 && Target.IsCasting);
  112.                     CastSelf("Evasion", () => Me.HpLessThanOrElite(0.6));
  113.                     CastSelf("Smoke Bomb", () => Me.HealthFraction <= 0.5);
  114.                     Cast("Kick", () => Target.IsCastingAndInterruptible());
  115.  
  116.                     CastSelf("Preparation", () => HasSpell("Evasion") && SpellCooldown("Evasion") > 0 && !HasAura("Evasion") && Me.HealthFraction < 0.5);
  117.  
  118.                     if (Cast("Dismantle", () => Target.IsPlayer && ((PlayerObject) Target).IsMelee)) return;
  119.  
  120.                     if (addsInRange.Count > 0 && addsInRange.Count <= 4)
  121.                     {
  122.                         if (Cast("Blade Flurry", () => !HasAura("Blade Flurry"))) return;
  123.                     }
  124.                     else
  125.                     {
  126.                         //disable bladeflurry
  127.                         if (Cast("Blade Flurry", () => HasAura("Blade Flurry"))) return;
  128.                     }
  129.  
  130.                     if (CastSelf("Recuperate", () => Me.HealthFraction < 0.75 && Me.ComboPoints > 2 && Me.GetPower(WoWPowerType.Energy) >= 30 && !HasAura("Recuperate"))) return;
  131.  
  132.                     if (CastSelf("Slice and Dice", () => Me.ComboPoints >= 2 && Me.GetPower(WoWPowerType.Energy) >= 25 && !HasAura("Slice and Dice"))) return;
  133.  
  134.                     if (HasSpell("Crimson Tempest") && addsInRange.Count > 4)
  135.                     {
  136.                         if (CastSelf("Crimson Tempest", () => Me.ComboPoints >= 2 && Me.GetPower(WoWPowerType.Energy) >= 25)) return;
  137.                     }
  138.                     else
  139.                     {
  140.                         if (Cast("Eviscerate", () => Me.GetPower(WoWPowerType.Energy) >= 35 &&
  141.                                                      (Me.ComboPoints > 2 || Me.ComboPoints == 2 && Target.HealthFraction <= 0.4))) return;
  142.                     }
  143.  
  144.                     if (Cast("Revealing Strike", () => Me.GetPower(WoWPowerType.Energy) >= 40 && !Target.HasAura("Revealing Strike"))) return;
  145.                     if (addsInRange.Count > 0)
  146.                     {
  147.                         if (Cast("Fan of Knives", () => Me.GetPower(WoWPowerType.Energy) >= 35)) return;
  148.                     }
  149.                     Cast("Sinister Strike", () => Me.GetPower(WoWPowerType.Energy) >= 40);
  150.                 }
  151.                 else
  152.                 {
  153.                     if (CastSelf("Sprint", () => !HasAura("Sprint") && !HasAura("Burst of Speed"))) return;
  154.                     if (CastSelf("Burst of Speed", () => !HasAura("Sprint") && !HasAura("Burst of Speed"))) return;
  155.                     if (CastSelfPreventDouble("Stealth", () => !Me.InCombat && Target.CombatRange <= RotationInfo.DismountRange && !HasAura("Stealth"))) return;
  156.  
  157.                     if (Cast("Shadowstep", () => !HasAura("Sprint"))) return;
  158.                 }
  159.             }
  160.         }
  161.  
  162.         public override bool AfterCombat()
  163.         {
  164.  
  165.                 //if (CastSelf("Recuperate", () => Me.HealthFraction < 0.9 && Me.GetPower(WoWPowerType.Energy) >= 30 && Me.ComboPoints > 0)) return true;
  166.                 //if (CastSelf("Slice and Dice", () => Me.ComboPoints > 0 && Me.GetPower(WoWPowerType.Energy) >= 25)) return true;
  167.  
  168.             return false;
  169.         }
  170.     }
  171. }
Advertisement
Add Comment
Please, Sign In to add comment