示例#1
0
		public void TestCreateCharacter() {
			Character pc = new Character("Name", 3, 6);
			Assert.IsNotNull(pc);
			Assert.IsTrue(pc.Name == "Name");
			Assert.IsTrue(pc.Strength == 3);
			Assert.IsTrue(pc.Health == 6);
		}
示例#2
0
 public Arena()
 {
     Player = new Character();
     createPlayer();
     Character Opponent = new Character();
     _ArenaLog = new ArenaLog();
     currentBattleNumber = 0;
 }
示例#3
0
 public void TestRollIsValid()
 {
     Character pc = new Character();
     Character npc = new Character();
     Battle battle = new Battle(pc, npc);
     battle.FightRound();
     Assert.IsTrue(battle.CurrentRound.PlayerRoll <= 6 && battle.CurrentRound.PlayerRoll >= 1);
     Assert.IsTrue(battle.CurrentRound.OpponentRoll <= 6 && battle.CurrentRound.OpponentRoll >= 1);
 }
示例#4
0
		public void TestBattleIsValid() {
            Character pc = new Character();
            Character npc = new Character();
            Battle battle = new Battle(pc, npc);
            
            Assert.IsNotNull(battle);
            Assert.AreEqual(pc, battle.Player);
            Assert.AreEqual(npc, battle.Opponent);
        }
示例#5
0
 public void DisplayContestants(Character pc, Character npc)
 {
     Console.WriteLine("********************************************");
     Console.WriteLine();
     Console.WriteLine("Battle Number {0}", pc.BattlesWon + 1);
     Console.WriteLine();
     Console.WriteLine("Contestants\n");
     Console.WriteLine("      {0}            vs        {1}", pc.Name, npc.Name);
     Console.WriteLine("   Strength : {0}            Strength : {1}", pc.Strength, npc.Strength);
     Console.WriteLine("   Agility  : {0}            Agility  : {1}", pc.Agility, npc.Agility);
     Console.WriteLine("   Health   : {0}            Health   : {1}", pc.Health, npc.Health);
     Console.WriteLine();
 }
示例#6
0
        public Battle(Character player, Character opponent)
        {
            _player = player;
            _opponent = opponent;
            Tie = new Character();
            Tie.Name = "Tie";
            Tie.Damage = 0;
            TotalRounds = 0;
            TotalDamagePlayerReceived = 0;
            TotalDamagePlayerDealt = 0;

            CurrentRound = new Round();
            _Arenalog = new ArenaLog();

        }
示例#7
0
        public void TestWinnerIsValid()
        {
            Character strongPC = new Character("strongPC", 10, 10);
            Character strongNPC = new Character("strongNPC", 10, 10);
            Character weakPC = new Character("weakPC", 1, 1);
            Character weakNPC = new Character("weakNPC", 1, 1);

            Battle playerWins = new Battle(strongPC, weakNPC);
            playerWins.FightRound();
            Assert.AreEqual(strongPC, playerWins.CurrentRound.Winner);

            Battle playerLoses = new Battle(weakPC, strongNPC);
            playerLoses.FightRound();
            Assert.AreEqual(strongNPC, playerLoses.CurrentRound.Winner);
        }
示例#8
0
        private void createOpponent()     // randomly selects opponent from pregenerated list of opponents
        {
            Character Bruiser = new Character("Bruiser", 5, 3, 2);
            Character Tank = new Character("Tank", 3, 2, 5);
            Character Rogue = new Character("Rogue", 2, 5, 3);

            List<Character> ArenaOpponents = new List<Character> { Bruiser, Tank, Rogue };
            Random rnd = new Random();

            int index = rnd.Next(1, ArenaOpponents.Count);
            Opponent = ArenaOpponents[index];

            _ArenaLog.OpponentStartingHealth.Add(Opponent.Health);   // stores opponents starting health to Arena Log

        }
示例#9
0
		public void TestEditCharacter() {
			Character pc = new Character("Name", 3, 6);
			Assert.IsNotNull(pc);

            // Check if name can be changed (should not be able to)
            //pc.Name = "newName";                                  // this test doesn't seem correct!!!
            //Assert.IsTrue(pc.Name == "Name");

            // Check if health can be changed (should succeed)
            pc.Health -= 1;
			Assert.IsTrue(pc.Health == 5);

			// Check if strength can be changed (should succeed)
			pc.Strength += 1;
			Assert.IsTrue(pc.Strength == 4);
		}
示例#10
0
        public void TestDamageIsApplied()
        {
            Character pc = new Character("player", 10, 10);
            Character npc = new Character("opponent", 1, 10);

            Battle battle = new Battle(pc, npc);
            battle.FightRound();
            Assert.IsTrue(npc.Health < 10);
        }
示例#11
0
        public void TestDamageIsCorrect()
        {
            Character pc = new Character("player", 10, 10);
            Character npc = new Character("opponent", 1, 10);

            Battle battle = new Battle(pc, npc);
            battle.FightRound();
            Assert.AreEqual(10 - pc.Damage, npc.Health);
        }
示例#12
0
 public bool checkIfContinuePlaying(Character pc, Battle battle)
 {
     Console.Write("\n\n C - Continue Playing or Q - quit ");              // check if player wants to play again or quit
     string reply = Console.ReadLine().ToLower();
     if (reply == "q")
     {
         if (!pc.IsDead)
         {
             Console.ForegroundColor = ConsoleColor.Green;
             Console.WriteLine("\nYou leave the arena Alive!  You won a total of {0} Battles\n", pc.BattlesWon);
             Console.ResetColor();
             printArenaLog();
             Console.ReadLine();
         }
         Console.Clear();
         return false;
     }
     return true;
 }