public OneKeyCombo NewCombo( string name, List <IUnitOrbwalker> orbwalkers, List <IOrderIssuer> orderIssuers, uint key, Action targetAssign, Action targetReset, bool toggle = false, string description = null) { var subMenu = new AbilitySubMenu(name); subMenu.AddToMenu(this.Menu); foreach (var orbwalker in orbwalkers) { orderIssuers.Add(orbwalker); } var combo = new OneKeyCombo( orderIssuers, subMenu, key, 2000, targetAssign, targetReset, toggle, description); this.Combos.Add(combo); return(combo); }
public override void OnLoad() { this.LoneDruidOrbwalker = new LoneDruidOrbwalker(this.LocalHero); var loneRuneTaker = new RuneTaker(this.LocalHero, this.MapData, false); if (Game.ShortLevelName == "start") { this.LocalHero.AddOrderIssuer(loneRuneTaker); } this.AddOrbwalker(this.LoneDruidOrbwalker); var orbwalkers = new List <IUnitOrbwalker> { this.LoneDruidOrbwalker }; var orderIssuers = new List <IOrderIssuer>(); var targetReset = new Action(() => { this.LocalHero.TargetSelector.ResetTarget(); }); var targetAssign = new Action(() => { this.LocalHero.TargetSelector.GetTarget(); }); this.LocalHero.TargetSelector.TargetChanged.Subscribe( () => { foreach (var localHeroControllableUnit in this.LocalHero.ControllableUnits.Units) { localHeroControllableUnit.Value.TargetSelector.Target = this.LocalHero.TargetSelector.Target; } if (this.Bear == null) { return; } this.Bear.TargetSelector.Target = this.LocalHero.TargetSelector.Target; }); this.BodyBlockCombo = this.NewCombo( "BodyBlockCombo", orbwalkers, orderIssuers, 'B', targetAssign, targetReset, false, "bear will bodyblock, lone druid will attack"); this.ChaseCombo = this.NewCombo( "ChaseCombo", orbwalkers, orderIssuers, 'G', targetAssign, targetReset, false, "bear will chase enemy, lone will attack and move to mouse and keep range if not in true form"); this.BearRetreatOrbwalker = new BearRetreatOrbwalker { LocalHero = this.LocalHero }; this.RetreatCombo = this.NewCombo( "RetreatCombo", new List <IUnitOrbwalker> { new LoneDruidRetreatOrbwalker(this.LocalHero) }, new List <IOrderIssuer>(), 'H', () => { this.Bear?.TargetSelector.GetTarget(); foreach (var localHeroControllableUnit in this.LocalHero.ControllableUnits.Units) { localHeroControllableUnit.Value.TargetSelector.GetTarget(); } }, () => { this.Bear?.TargetSelector.ResetTarget(); foreach (var localHeroControllableUnit in this.LocalHero.ControllableUnits.Units) { localHeroControllableUnit.Value.TargetSelector.ResetTarget(); } }, false, "lone will run to mouse, bear will attack/bodyblock target or run if low hp"); this.BearRetreatOrbwalker.LowHp.AddToMenu(this.RetreatCombo.SubMenu); this.controllableUnits = this.LocalHero.ControllableUnits as LoneDruidControllableUnits; this.controllableUnits.BearAdded.Subscribe(this.BearAdded); this.controllableUnits.AddedUnit.Subscribe(new DataObserver <IAbilityUnit>(unit => this.UnitAdded(unit))); this.controllableUnits.RemovedUnit.Subscribe(new DataObserver <IAbilityUnit>(unit => this.UnitRemoved(unit))); var runeTakerMenu = new AbilitySubMenu("RuneTaker"); runeTakerMenu.AddToMenu(this.Menu); this.BearRuneTaker = new BearRuneTaker(null, this.MapData); this.BearRuneTaker.ConnectToMenu(runeTakerMenu, true, true); loneRuneTaker.ConnectToMenu(runeTakerMenu, false, false); if (this.controllableUnits.Bear != null) { this.BearAdded(); } foreach (var controllableUnitsUnit in this.controllableUnits.Units) { this.UnitAdded(controllableUnitsUnit.Value); } }
public override void OnLoad() { this.BrewmasterOrbwalker = new BrewmasterOrbwalker(this.LocalHero); var brewRuneTaker = new RuneTaker(this.LocalHero, this.MapData, false); if (Game.ShortLevelName == "start") { this.LocalHero.AddOrderIssuer(brewRuneTaker); } this.AddOrbwalker(this.BrewmasterOrbwalker); var orbwalkers = new List <IUnitOrbwalker> { this.BrewmasterOrbwalker }; var orderIssuers = new List <IOrderIssuer>(); var targetReset = new Action(() => { this.LocalHero.TargetSelector.ResetTarget(); }); var targetAssign = new Action(() => { this.LocalHero.TargetSelector.GetTarget(); }); this.LocalHero.TargetSelector.TargetChanged.Subscribe( () => { foreach (var controllableUnitsUnit in this.LocalHero.ControllableUnits.Units) { controllableUnitsUnit.Value.TargetSelector.Target = this.LocalHero.TargetSelector.Target; } }); this.ChaseCombo = this.NewCombo( "ChaseCombo", orbwalkers, orderIssuers, 'G', targetAssign, targetReset, false, "In this combo Brewmaster will chase enemy"); // this.RetreatCombo = this.NewCombo( // "RetreatCombo", // new List<IUnitOrbwalker> { new BrewmasterRetreatOrbwalker(this.LocalHero) }, // new List<IOrderIssuer>(), // 'H', // () => { this.Bear?.TargetSelector.GetTarget(); }, // () => { this.Bear?.TargetSelector.ResetTarget(); }, // false, // "lone will run to mouse, bear will attack/bodyblock target or run if low hp"); this.LocalHero.ControllableUnits.AddedUnit.Subscribe( new DataObserver <IAbilityUnit>(unit => this.UnitAdded(unit))); this.LocalHero.ControllableUnits.RemovedUnit.Subscribe( new DataObserver <IAbilityUnit>(unit => this.UnitRemoved(unit))); var runeTakerMenu = new AbilitySubMenu("RuneTaker"); runeTakerMenu.AddToMenu(this.Menu); brewRuneTaker.ConnectToMenu(runeTakerMenu, false, false); foreach (var controllableUnitsUnit in this.LocalHero.ControllableUnits.Units) { this.UnitAdded(controllableUnitsUnit.Value); } this.NewKey( "Cast Cyclone", 'D', () => { if (this.StormBear != null && this.StormBear.SourceUnit.IsValid && this.StormBear.SourceUnit.IsAlive) { var mouseDistance = 9999999f; var mousePosition = Game.MousePosition; IAbilityUnit result = null; // Console.WriteLine("looking for target"); foreach (var teamOtherTeam in this.LocalHero.Team.OtherTeams) { if (teamOtherTeam?.UnitManager == null || !teamOtherTeam.UnitManager.Units.Any()) { continue; } foreach (var unitManagerUnit in teamOtherTeam.UnitManager.Units) { if (!unitManagerUnit.Value.SourceUnit.IsValid || !unitManagerUnit.Value.SourceUnit.IsAlive || !unitManagerUnit.Value.Visibility.Visible || unitManagerUnit.Value.Health.Current <= 0) { continue; } // Console.WriteLine("unit " + unitManagerUnit.Value.Name); var distance = unitManagerUnit.Value.Position.Current.Distance2D(mousePosition); if (distance < mouseDistance) { mouseDistance = distance; result = unitManagerUnit.Value; } } } if (result != null && result.Position.Current.Distance(Game.MousePosition) < 1000) { this.StormSkillBook.Cyclone.CastFunction.Cast(result); //Console.WriteLine("Casting storm cyclone on " + result.PrettyName); } } }, () => { }, false, "Will cast Cyclone with StormBear on target near mouse"); this.NewKey( "Cast Dispel", 'X', () => { if (this.StormBear != null && this.StormBear.SourceUnit.IsValid && this.StormBear.SourceUnit.IsAlive) { var mouseDistance = 9999999f; var mousePosition = Game.MousePosition; IAbilityUnit result = null; // Console.WriteLine("looking for target"); foreach (var teamOtherTeam in this.LocalHero.Team.OtherTeams) { if (teamOtherTeam?.UnitManager == null || !teamOtherTeam.UnitManager.Units.Any()) { continue; } foreach (var unitManagerUnit in teamOtherTeam.UnitManager.Units) { if (!unitManagerUnit.Value.SourceUnit.IsValid || !unitManagerUnit.Value.SourceUnit.IsAlive || !unitManagerUnit.Value.Visibility.Visible || unitManagerUnit.Value.Health.Current <= 0) { continue; } // Console.WriteLine("unit " + unitManagerUnit.Value.Name); var distance = unitManagerUnit.Value.Position.Current.Distance2D(mousePosition); if (distance < mouseDistance) { mouseDistance = distance; result = unitManagerUnit.Value; } } } if (result != null && result.Position.Current.Distance(Game.MousePosition) < 1000) { this.StormSkillBook.Dispel.CastFunction.Cast(result); //Console.WriteLine("Casting storm cyclone on " + result.PrettyName); } } }, () => { }, false, "Will cast Dispel with StormBear on target near mouse"); }
public override void OnLoad() { this.BrewmasterOrbwalker = new BrewmasterOrbwalker(this.LocalHero); var brewRuneTaker = new RuneTaker(this.LocalHero, this.MapData, false); if (Game.ShortLevelName == "start") { this.LocalHero.AddOrderIssuer(brewRuneTaker); } this.AddOrbwalker(this.BrewmasterOrbwalker); var orbwalkers = new List <IUnitOrbwalker> { this.BrewmasterOrbwalker }; var orderIssuers = new List <IOrderIssuer>(); var targetReset = new Action(() => { this.LocalHero.TargetSelector.ResetTarget(); }); var targetAssign = new Action(() => { this.LocalHero.TargetSelector.GetTarget(); }); this.LocalHero.TargetSelector.TargetChanged.Subscribe( () => { foreach (var controllableUnitsUnit in this.LocalHero.ControllableUnits.Units) { controllableUnitsUnit.Value.TargetSelector.Target = this.LocalHero.TargetSelector.Target; } }); this.ChaseCombo = this.NewCombo( "ChaseCombo", orbwalkers, orderIssuers, 'G', targetAssign, targetReset, false, "In this combo Brewmaster will chase enemy"); //this.RetreatCombo = this.NewCombo( // "RetreatCombo", // new List<IUnitOrbwalker> { new BrewmasterRetreatOrbwalker(this.LocalHero) }, // new List<IOrderIssuer>(), // 'H', // () => { this.Bear?.TargetSelector.GetTarget(); }, // () => { this.Bear?.TargetSelector.ResetTarget(); }, // false, // "lone will run to mouse, bear will attack/bodyblock target or run if low hp"); this.LocalHero.ControllableUnits.AddedUnit.Subscribe(new DataObserver <IAbilityUnit>(unit => this.UnitAdded(unit))); this.LocalHero.ControllableUnits.RemovedUnit.Subscribe(new DataObserver <IAbilityUnit>(unit => this.UnitRemoved(unit))); var runeTakerMenu = new AbilitySubMenu("RuneTaker"); runeTakerMenu.AddToMenu(this.Menu); brewRuneTaker.ConnectToMenu(runeTakerMenu, false, false); foreach (var controllableUnitsUnit in this.LocalHero.ControllableUnits.Units) { this.UnitAdded(controllableUnitsUnit.Value); } }