/// <summary> /// check Opppnent base to see if it's engineered base or not /// </summary> /// <returns>true if engineered</returns> public static bool IsEngineeredBase() { var defenses = ArcherTower.Find()?.Count(); defenses += WizardTower.Find()?.Count(); defenses += AirDefense.Find().Count(); if (defenses <= 3) { return(true); } return(false); }
public void NewLevel(int currentLevel, ContentManager content, Texture2D buttonTexture) { this.currentLevel = currentLevel; enemies = new List <Enemy>(); if (playerTower == null) { playerTower = new Tower(content, new Vector2(0.0f, 280f), "playerTower"); } enemyTower = new Tower(content, new Vector2(730f, 280f), "enemyTower"); corpses = new List <Corpse>(); playerQueue = new List <Queueable>(); enemyQueue = new List <Queueable>(); queue = new Queue(content); inputManager = new BattleInputManager(buttonTexture, content); soldierManager = new SoldierManager(); if (currentLevel < 1) { return; } StreamReader reader = new StreamReader(Environment.CurrentDirectory + "/Level Data/level" + currentLevel.ToString() + ".txt"); string[] strArray = reader.ReadToEnd().Split('\n'); for (int index = 0; index < strArray.Length; index += 2) { enemies.Add(new Enemy(Convert.ToInt32(strArray[index]), Convert.ToInt32(strArray[index + 1]))); } if (hasTurretOne) { playerTurretOne = new Turret(content, playerTower.Rectangle, 3, "turretRightStraight"); } if (hasTurretTwo) { playerTurretTwo = new Turret(playerTower.Rectangle, content, 1, "turretRightDown"); } if (hasWizardTower) { wizardTower = new WizardTower(content, new Vector2(playerTower.Position.X, playerTower.Position.Y)); } if (hasArcher) { aimableArcher = new AimableArcher(content); } }
public void BuyWizard(ContentManager content) { hasWizardTower = true; wizardTower = new WizardTower(content, new Vector2(playerTower.Position.X, playerTower.Position.Y)); }
public ENDGAMERESULT CheckForEndGame(ContentManager content) { ENDGAMERESULT result = ENDGAMERESULT.NONE; if (enemyTower.Health <= 0) { result = ENDGAMERESULT.WIN; playerQueue = new List <Queueable>(); enemyQueue = new List <Queueable>(); soldierManager = new SoldierManager(); if (chargeInstance != null) { chargeInstance.Stop(); } queue.Clear(); if (hasWizardTower) { wizardTower.Stop(); } corpses = new List <Corpse>(); if (hasWizardTower) { wizardTower = new WizardTower(content, new Vector2(playerTower.Position.X, playerTower.Position.Y)); } if (hasArcher && aimableArcher.IsActive) { aimableArcher.Activate(); } } else if (playerTower.Health <= 0) { result = ENDGAMERESULT.LOSS; soldierManager = new SoldierManager(); playerQueue = new List <Queueable>(); enemyQueue = new List <Queueable>(); corpses = new List <Corpse>(); if (hasWizardTower) { wizardTower = new WizardTower(content, new Vector2(playerTower.Position.X, playerTower.Position.Y)); } playerTower.Health = 1; if (hasArcher && aimableArcher.IsActive) { aimableArcher.Activate(); } if (chargeInstance != null) { chargeInstance.Stop(); } queue.Clear(); if (hasWizardTower) { wizardTower.Stop(); } } return(result); }
void CreateDebugImages() { List <InfernoTower> infernos = InfernoTower.Find(CacheBehavior.Default).ToList(); List <WizardTower> wizTowers = WizardTower.Find(CacheBehavior.Default).ToList(); List <ArcherTower> archerTowers = ArcherTower.Find(CacheBehavior.Default).ToList(); List <ElixirStorage> elixirStorages = ElixirStorage.Find(CacheBehavior.Default).ToList(); EagleArtillery eagle = EagleArtillery.Find(CacheBehavior.Default); var d = DateTime.UtcNow; var debugFileName = $"Dragon Deploy {d.Year}-{d.Month}-{d.Day} {d.Hour}-{d.Minute}-{d.Second}-{d.Millisecond}"; using (Bitmap canvas = Screenshot.Capture()) { Screenshot.Save(canvas, $"{debugFileName}_1"); //Draw some stuff on it. Visualize.Axes(canvas); Visualize.Grid(canvas, redZone: true); Visualize.Target(canvas, mainTarget.Center, 40, Color.Red); Visualize.Target(canvas, deFunnelPoints[0], 40, Color.White); Visualize.Target(canvas, deFunnelPoints[1], 40, Color.White); Visualize.Target(canvas, balloonFunnelPoints[0], 40, Color.Pink); Visualize.Target(canvas, balloonFunnelPoints[1], 40, Color.Pink); for (int i = 0; i < infernos.Count(); i++) { Visualize.Target(canvas, infernos.ElementAt(i).Location.GetCenter(), 30, Color.Orange); } for (int i = 0; i < airDefenses.Count(); i++) { Visualize.Target(canvas, airDefenses.ElementAt(i).Location.GetCenter(), 30, Color.Cyan); } for (int i = 0; i < wizTowers.Count(); i++) { Visualize.Target(canvas, wizTowers.ElementAt(i).Location.GetCenter(), 30, Color.Purple); } for (int i = 0; i < archerTowers.Count(); i++) { Visualize.Target(canvas, archerTowers.ElementAt(i).Location.GetCenter(), 30, Color.RosyBrown); } if (eagle != null) { Visualize.Target(canvas, eagle.Location.GetCenter(), 30, Color.YellowGreen); } Visualize.Target(canvas, mainTarget.DeployGrunts, 40, Color.Beige); Screenshot.Save(canvas, $"{debugFileName}_2"); } //Write a text file that goes with all images that shows what is in the image. StringBuilder sb = new StringBuilder(); for (int i = 0; i < airDefenses.Count(); i++) { sb.AppendLine($"Air Defense {i + 1} - Level:{airDefenses.ElementAt(i).Level}"); } for (int i = 0; i < infernos.Count(); i++) { sb.AppendLine($"Inferno Tower {i + 1} - Level:{infernos.ElementAt(i).Level}"); } for (int i = 0; i < wizTowers.Count(); i++) { sb.AppendLine($"Wizard Tower {i + 1} - Level:{wizTowers.ElementAt(i).Level}"); } for (int i = 0; i < archerTowers.Count(); i++) { sb.AppendLine($"Archer Tower {i + 1} - Level:{archerTowers.ElementAt(i).Level}"); } if (eagle != null) { sb.AppendLine($"Eagle Artillery 1 - Level:{eagle.Level}"); } //System.IO.File.WriteAllText($@"C:\RaccoonBot\Debug Screenshots\{debugFileName}_3.txt", sb.ToString()); Log.Info($"{Tag} Deploy Debug Image Saved!"); }