public Score Start(bool auto) { TeamViewModel Team = TeamViewModel.Instance; BattleController battle = new BattleController(); int Miracle = 1; while (Team.Dataset.Count > 0) { round++; int Potions = 6; int Volcano = 20; string message = ""; Debug.WriteLine("New Round " + round.ToString()); foreach (var character in Team.Dataset) { character.CanFocusAttack = true; } if (GameGlobals.EnableRandomBadThings == true) { int dateSeed = DateTime.Now.Millisecond; Random rand = new Random(dateSeed); Volcano = rand.Next(1, 21); //Volcano = 4; //to force one of the effects if (GameGlobals.DisableRandomNumbers) { Volcano = 20; } if (Volcano == 1) { foreach (var character in Team.Dataset) { character.CurrHealth = character.MaxHealth; } message = "Volcano erupted, characters feel stronger"; } if (Volcano == 2) { foreach (var character in Team.Dataset) { double damage = character.CurrHealth * .2; character.CurrHealth -= (int)Math.Ceiling(damage); if (character.CurrHealth < 1) { character.CurrHealth = 1; } } message = "Volcano erupted, characters are sickened by the fumes"; } if (Volcano > 4) { message = "Volcano did not explode"; } } if (auto) { battle.SetBattleController(round); if (Volcano == 3) { foreach (var monster in battle.CurrMonsters.Dataset) { double damage = monster.CurrHealth * .2; monster.CurrHealth -= (int)Math.Ceiling(damage); if (monster.CurrHealth < 1) { monster.CurrHealth = 1; } } message = "Volcano erupted, falling ash hurts the monsters"; } if (Volcano == 4) { MonsterController mc = new MonsterController(); Creature strongestMonster = null; int strongest = 0; foreach (var monster in battle.CurrMonsters.Dataset) { int newStrongest = monster.CurrHealth + mc.GetBaseAttack(monster); if (strongest < newStrongest) { strongest = newStrongest; strongestMonster = monster; } } message = "Volcano erupted, " + strongestMonster.Name + " ran to watch"; battle.CurrMonsters.Dataset.Remove(strongestMonster); battle.TurnOrder.Remove(strongestMonster); battle.GameBoardRemove(strongestMonster); } if (GameGlobals.EnableRandomBadThings == true) { Debug.WriteLine(message); } GameScore = battle.AutoBattle(GameScore, round, Potions, Miracle); GameScore.Auto = true; } else { GameScore.Auto = false; battle.Battle(); } } return(ReportScore()); }