public void ShouldPerformMoveAction() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleStatus = BattleStatus.InBattle, BattleMode = BattleMode.PlayerVsComputer }, Player = new Player() }; g.Player.SetName("Player"); g.CurrentBattleDetails.Participants.Add(new Participant { Character = g.Player, Status = ParticipantStatus.InBattle }); var b = new Dumbass(); b.SetName("Dumbass"); g.CurrentBattleDetails.Participants.Add(new Participant { Character = b, Status = ParticipantStatus.InBattle }); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var tile = g.CurrentBattleDetails.Arena.SelectFloorTile(new ArenaFloorPosition(0, 1)); var actions = g.Player.TargetTileAndSelectActions(tile); g.PerformPlayerAction(actions.Find(i => i.Name == "Run")); Assert.IsTrue(g.Player.ArenaLocation == tile); Assert.IsTrue(g.Player.CurrentAvailableActions == null); }
public void ShouldThrowExceptionIfBattleOverAndActionPerformed() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleStatus = BattleStatus.InBattle, BattleMode = BattleMode.PlayerVsComputer }, Player = new Player() }; g.Player.SetName("Player"); g.Player.ChangeAlliance(Alliance.TeamOne); g.CurrentBattleDetails.Participants.Add(new Participant { Character = g.Player, Status = ParticipantStatus.InBattle }); var b = new Dumbass(); b.ChangeAlliance(Alliance.TeamTwo); b.SetName("Dumbass"); g.CurrentBattleDetails.Participants.Add(new Participant { Character = b, Status = ParticipantStatus.InBattle }); g.EndBattle(Alliance.TeamOne); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, 0, 0); var tile = g.CurrentBattleDetails.Arena.SelectFloorTile(new ArenaFloorPosition(0, 1)); var actions = g.Player.TargetTileAndSelectActions(tile); g.PerformPlayerAction(actions.Find(i => i.Name == "Run")); }
public void ShouldSimulateAllBattles() { var g = new Game {Player = new Player(), Tournament = new Tournament(true)}; g.Tournament.Populate(); g.Tournament.Start(); g.SimulateAllComputerBattles(); Assert.IsTrue(g.Tournament.BattlesByRound[g.Tournament.Round].TrueForAll(b => b.BattleMode == BattleMode.ComputerVsComputer && b.BattleStatus == BattleStatus.BattleOver)); }
public void ShouldSimulateBattle() { var g = new Game { Player = new Player(), Tournament = new Tournament() }; g.Tournament.Populate(); g.Tournament.Start(); var battleDetails = g.Tournament.BattlesByRound[g.Tournament.Round].First(b => b.BattleMode == BattleMode.ComputerVsComputer); g.SimulateComputerVsComputerBattle(battleDetails.BattleGuid); Assert.IsTrue(battleDetails.BattleStatus == BattleStatus.BattleOver); }
public ActionResult Index() { var g = (Game) Session["Game"]; if (g != null) { return View(); } g = new Game(); Session["Game"] = g; return View(); }
public void ShouldPerformMoveActionWhenOutOfAttackRange() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamTwo }, Player = new Player() }; g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var b = new Dumbass(); b.LevelUp(); g.CurrentBattleDetails.Arena.AddCharacterToArena(b, Alliance.TeamTwo, 4, 4); g.PerformAITurn(); var endPosition = b.ArenaLocation.GetTileLocation(); Assert.IsTrue(endPosition.XCoord != 4 && endPosition.YCoord != 4); }
public void ShouldHaveHealActionOnSelf() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.LevelUp(); g.Player.ChooseSkill(new PathOfTheWizard()); g.Player.AddAction(new LittleHeal()); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne); var c = new Dumbass(); g.CurrentBattleDetails.Arena.AddCharacterToArena(c, Alliance.TeamTwo); var actions = g.Player.TargetTileAndSelectActions(g.Player.ArenaLocation); Assert.IsTrue(actions.Exists(i => i is LittleHeal)); }
public void ShouldAddPhysicalDamageToAttack() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; EquipmentHelper.EquipEquipment(g.Player, new ReliableTreeBranch()); g.Player.AddPhysicalDamage(10); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var o = new Dumbass(); g.CurrentBattleDetails.Arena.AddCharacterToArena(o, Alliance.TeamTwo, 0, 1); var tile = g.CurrentBattleDetails.Arena.SelectFloorTile(new ArenaFloorPosition(0, 1)); var actions = g.Player.TargetTileAndSelectActions(tile); g.PerformPlayerAction(actions.Find(i => i.Name == "Swing")); Assert.IsTrue(o.Health == 60); }
public void ShouldLevelPlayerUpWhenBotDefeated() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.SetName("Player"); var b = new Dumbass(); b.SetName("Idiot"); g.Tournament.AddCharacterToTournament(b); g.StartPlayerVsComputerTournament(); g.CurrentBattleDetails.Arena.Characters.First(i => i is Dumbass).LoseHealth(200); g.EndBattle(g.Player.GetAlliance()); g.ProcessBattleOver(); Assert.IsTrue(g.Player.GetLevel() == 2); }
public void ShouldAddMagicDamagePercentageToSpell() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.LevelUp(); g.Player.ChooseSkill(new PathOfTheWizard()); g.Player.SetName("Player"); g.CurrentBattleDetails.Participants.Add(new Participant { Status = ParticipantStatus.InBattle, Character = g.Player }); g.CurrentBattleDetails.Arena.BuildArenaFloor(10); g.Player.AddAction(new SpellSpear()); g.Player.AddMagicDamageBonusPercent(1000); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var o = new Dumbass(); o.SetName("Dumbass"); g.CurrentBattleDetails.Participants.Add(new Participant { Status = ParticipantStatus.InBattle, Character = o }); g.CurrentBattleDetails.Arena.AddCharacterToArena(o, Alliance.TeamTwo, 0, 1); var tile = g.CurrentBattleDetails.Arena.SelectFloorTile(new ArenaFloorPosition(0, 1)); var actions = g.Player.TargetTileAndSelectActions(tile); g.PerformPlayerAction(actions.Find(i => i is SpellSpear)); Assert.IsTrue(o.Health < 0); }
public void ShouldPerformAttackActionWhenInAttackRange() { const int playerStartingHealth = 150; var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamTwo }, Player = new Player() }; g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var b = new Dumbass(); b.LevelUp(); EquipmentHelper.EquipEquipment(b, new Sword()); g.CurrentBattleDetails.Arena.AddCharacterToArena(b, Alliance.TeamTwo, 0, 1); g.PerformAITurn(); var endPosition = b.ArenaLocation.GetTileLocation(); Assert.IsTrue(endPosition.XCoord == 0 && endPosition.YCoord == 1); Assert.IsTrue(g.Player.Health < playerStartingHealth); }
public void ShouldPerformSwingAttackAction() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.CurrentBattleDetails.Arena.BuildArenaFloor(10); EquipmentHelper.EquipEquipment(g.Player, new Sword()); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne, 0, 0); var o = new Dumbass(); Assert.IsTrue(o.Health == 100); g.CurrentBattleDetails.Arena.AddCharacterToArena(o, Alliance.TeamTwo, 0, 1); var tile = g.CurrentBattleDetails.Arena.SelectFloorTile(new ArenaFloorPosition(0, 1)); var actions = g.Player.TargetTileAndSelectActions(tile); g.PerformPlayerAction(actions.Find(i => i.Name == "Swing")); Assert.IsTrue(o.Health < 100); Assert.IsTrue(g.Player.CurrentAvailableActions == null); }
public void ShouldResetCharacterAfterBattle() { const int playerStartingHealth = 150; var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.SetName("Player"); var b = new Dumbass(); b.SetName("Idiot"); g.Tournament.AddCharacterToTournament(b); g.StartPlayerVsComputerTournament(); g.CurrentBattleDetails.Arena.Characters.First(i => i is Player).LoseHealth(50); Assert.IsTrue(g.Player.Health == playerStartingHealth - 50); g.EndBattle(g.Player.GetAlliance()); g.ProcessBattleOver(); Assert.IsTrue(g.Player.Health == playerStartingHealth); }
public void ShouldNotHaveAttackSpellActionOnSelf() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.AddAction(new SpellSpear()); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne); var c = new Dumbass(); g.CurrentBattleDetails.Arena.AddCharacterToArena(c, Alliance.TeamTwo); var actions = g.Player.TargetTileAndSelectActions(g.Player.ArenaLocation); Assert.IsFalse(actions.Exists(i => i is SpellSpear)); }
public void ShouldDealDamageWhenAttackCast() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleMode = BattleMode.PlayerVsComputer, BattleStatus = BattleStatus.InBattle, BattleTurn = Alliance.TeamOne }, Player = new Player() }; g.Player.LevelUp(); g.Player.ChooseSkill(new PathOfTheWizard()); g.CurrentBattleDetails.Arena.AddCharacterToArena(g.Player, Alliance.TeamOne); g.Player.AddAction(new SpellSpear()); var c = new Dumbass(); g.CurrentBattleDetails.Arena.AddCharacterToArena(c, Alliance.TeamTwo, 0, 2); var actions = g.Player.TargetTileAndSelectActions(c.ArenaLocation); g.PerformPlayerAction(actions.First(i => i is SpellSpear)); Assert.IsTrue(c.Health < 100); }
private void InitializeTurnBar(GameLogic.Game.Game game) { TurnControl playerTurnControl = new TurnControl(game); TurnBar.Children.Add(playerTurnControl); }
public void ShouldThrowExceptionIfPostBattleProcessAttemptedBeforeBattleOver() { var g = new Game { CurrentBattleDetails = new BattleDetails { BattleStatus = BattleStatus.InBattle } }; g.ProcessBattleOver(); }
public void ShouldStartComputerVsComputerTournament() { var g = new Game(true, true); g.StartComputerVsComputerGame(); }