Advertisement
Guest User

Untitled

a guest
Dec 12th, 2016
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.16 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using Singular.Dynamics;
  4. using Singular.Helpers;
  5. using Singular.Managers;
  6. using Singular.Settings;
  7. using Styx;
  8. using Styx.Common.Helpers;
  9. using Styx.TreeSharp;
  10. using System.Collections.Generic;
  11. using System.Numerics;
  12. using Styx.CommonBot;
  13. using Action = Styx.TreeSharp.Action;
  14. using Styx.WoWInternals.WoWObjects;
  15. using Styx.WoWInternals;
  16. using CommonBehaviors.Actions;
  17. using Styx.Common;
  18.  
  19. namespace Singular.ClassSpecific.Monk
  20. {
  21. public class Brewmaster
  22. {
  23. private static LocalPlayer Me => StyxWoW.Me;
  24. private static MonkSettings MonkSettings => SingularSettings.Instance.Monk();
  25.  
  26.  
  27. [Behavior(BehaviorType.PreCombatBuffs, WoWClass.Monk, WoWSpec.MonkBrewmaster)]
  28. public static Composite CreateMonkPreCombatBuffs()
  29. {
  30. return new PrioritySelector(
  31. PartyBuff.BuffGroup("Legacy of the White Tiger")
  32. );
  33. }
  34.  
  35. [Behavior(BehaviorType.CombatBuffs, WoWClass.Monk, WoWSpec.MonkBrewmaster)]
  36. public static Composite CreateBrewmasterMonkCombatBuffs()
  37. {
  38. return new PrioritySelector(
  39. Spell.Cast(122280, req => Me.HealthPercent <= 80),
  40. Spell.Cast("Healing Elixir", req => Me.HealthPercent <= 80),
  41. Spell.BuffSelf("Fortifying Brew", req => Me.HealthPercent <= 40),
  42. Spell.BuffSelf("Ironskin Brew", req => MonkSettings.UseIronskinBrew && Spell.GetCharges("Ironskin Brew") > MonkSettings.IronskinBrewCharges),
  43. Spell.BuffSelf("Purifying Brew", req => Me.HasAura((int)MonkSettings.Stagger)),
  44. Spell.BuffSelf("Expel Harm", req => Common.SphereCount(SphereType.Ox, 30) >= 3 ||
  45. Common.SphereCount(SphereType.Ox, 30) >= 1 && Me.HealthPercent < 20),
  46. Spell.BuffSelf("Black Ox Brew", req => Spell.GetCharges("Ironskin Brew") <= 0)
  47. );
  48. }
  49.  
  50. [Behavior(BehaviorType.Pull | BehaviorType.Combat, WoWClass.Monk, WoWSpec.MonkBrewmaster)]
  51. public static Composite CreateBrewmasterMonkCombat()
  52. {
  53. TankManager.NeedTankTargeting = (SingularRoutine.CurrentWoWContext == WoWContext.Instances);
  54.  
  55. return new PrioritySelector(
  56. Common.CreateAttackFlyingOrUnreachableMobs(),
  57. Helpers.Common.EnsureReadyToAttackFromMelee(),
  58. Spell.WaitForCastOrChannel(),
  59.  
  60. new Decorator(
  61. req => !Spell.IsGlobalCooldown(),
  62. new PrioritySelector(
  63.  
  64. Spell.Cast("Spear Hand Strike", on => (WoWUnit)on, req => Me.CurrentTarget.IsCasting),
  65. Helpers.Common.CreateInterruptBehavior(),
  66. CreateBrewmasterMonkCombatBuffs(),
  67. SingularRoutine.MoveBehaviorInlineToCombat(BehaviorType.CombatBuffs),
  68.  
  69. Movement.WaitForFacing(),
  70. Movement.WaitForLineOfSpellSight(),
  71.  
  72. new Decorator(
  73. ret => SingularRoutine.CurrentWoWContext == WoWContext.Instances && Unit.NearbyUnfriendlyUnits.Count(u => !u.IsBoss) > 2,
  74. new PrioritySelector(
  75. CreateSummonBlackOxStatueBehavior(on => Me.CurrentTarget),
  76. Spell.Cast("Provoke", on => FindStatue(), ret => TankManager.Instance.NeedToTaunt.Count >= 2)
  77. )
  78. ),
  79. // taunt if needed
  80. Spell.Cast("Provoke", ret => TankManager.Instance.NeedToTaunt.FirstOrDefault(), ret => SingularSettings.Instance.EnableTaunting),
  81. new Decorator(ret => Unit.UnfriendlyUnits(8).Count() >= 2,
  82. new PrioritySelector(
  83. Spell.CastOnGround("Exploding Keg", on => (WoWUnit)on, ret => Me.CurrentTarget.IsWithinMeleeRange &&
  84. (Me.HealthPercent <= MonkSettings.ArtifactHealthPercent || Unit.NearbyUnfriendlyUnits.Count(u => !u.IsBoss) > 2)),
  85. Spell.Cast("Keg Smash", on => (WoWUnit)on),
  86. Spell.Cast("Breath of Fire", on => (WoWUnit)on),
  87. Spell.Cast("Blackout Strike", on => (WoWUnit)on, req => Common.HasTalent(MonkTalents.BlackoutCombo)),
  88. Spell.Cast("Chi Burst", on => (WoWUnit)on),
  89. Spell.Cast("Breath of Fire", on => (WoWUnit)on),
  90. Spell.Cast("Rushing Jade Wind", on => (WoWUnit)on),
  91. Spell.Cast("Tiger Palm", on => (WoWUnit)on, req => Me.CurrentEnergy >= 65),
  92. Spell.Cast("Leg Sweep", on => (WoWUnit)on, ret => ((WoWUnit)ret).IsWithinMeleeRange),
  93. Spell.Cast("Blackout Strike", on => (WoWUnit)on)
  94. )
  95. ),
  96.  
  97. Spell.Cast("Blackout Strike", on => (WoWUnit)on),
  98. Spell.Cast("Tiger Palm", on => (WoWUnit)on, req => Me.CurrentEnergy >= 65),
  99. Spell.Cast("Rushing Jade Wind", on => (WoWUnit)on),
  100. Spell.Cast("Chi Wave", on => (WoWUnit)on),
  101. Spell.Cast("Leg Sweep", on => (WoWUnit)on, ret => ((WoWUnit)ret).IsWithinMeleeRange),
  102. Spell.Cast("Breath of Fire", on => (WoWUnit)on, req => Me.CurrentTarget.IsPlayer || Me.CurrentTarget.IsBoss || Me.CurrentTarget.Elite),
  103. SingularRoutine.MoveBehaviorInlineToCombat(BehaviorType.Heal),
  104. Common.CreateCloseDistanceBehavior()
  105. )
  106. )
  107. );
  108. }
  109.  
  110. private static WoWUnit _statue;
  111.  
  112. private static Composite CreateSummonBlackOxStatueBehavior( UnitSelectionDelegate on )
  113. {
  114. if (!SpellManager.HasSpell("Summon Black Ox Statue"))
  115. return new ActionAlwaysFail();
  116.  
  117. return new Throttle(
  118. 8,
  119. new Decorator(
  120. req => !Spell.IsSpellOnCooldown("Summon Black Ox Statue"),
  121.  
  122. new PrioritySelector(
  123. ctx => _statue = FindStatue(),
  124.  
  125. new Decorator(
  126.  
  127. req => _statue == null || (Me.GotTarget() && _statue.SpellDistance(on(req)) > 30),
  128.  
  129. new Throttle(
  130. 10,
  131. new PrioritySelector(
  132.  
  133. ctx => on(ctx),
  134.  
  135. Spell.CastOnGround(
  136. "Summon Black Ox Statue",
  137. loc =>
  138. {
  139. WoWUnit unit = on(loc);
  140. Vector3 locStatue = WoWMovement.CalculatePointFrom(unit.Location, -5);
  141. if (locStatue.Distance(Me.Location) > 30)
  142. {
  143. float needFacing = Styx.Helpers.WoWMathHelper.CalculateNeededFacing(Me.Location, locStatue );
  144. locStatue = locStatue.RayCast(needFacing, 30f);
  145. }
  146. return locStatue;
  147. },
  148. req => req != null,
  149. false,
  150. desc => string.Format("{0:F1} yds from {1}", 5, (desc as WoWUnit).SafeName())
  151. )
  152. )
  153. )
  154. )
  155. )
  156. )
  157. );
  158. }
  159.  
  160. public static WoWUnit FindStatue()
  161. {
  162. const uint BLACK_OX_STATUE = 61146;
  163. WoWGuid guidMe = Me.Guid;
  164. return ObjectManager.GetObjectsOfType<WoWUnit>()
  165. .FirstOrDefault(u => u.Entry == BLACK_OX_STATUE && u.CreatedByUnitGuid == guidMe);
  166. }
  167.  
  168. }
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement