예제 #1
0
파일: main.cpp 프로젝트: derekfle/Team-12
/**
* Simulates battles between a player and their opponent; this test ensures that the damage 
* that an Avatar takes during a battle is correct according to whether they tie, lose, or win
* the round. 
*/
TEST_F(TestBattleController, TestDetermineWinner)
{
	// Create the player and their opponent
	const Avatar &player = GetPlayer();
	const Avatar &opponent = GetOpponent();
	Skill *rock = new Skill("Rock", Skill::SkillType::Rock);
	int startPHealth = player.GetHealth();
	int startOHealth = opponent.GetHealth();

	// Set the player's move and run the round so that the Avatars tie
	SetPlayerMove(rock);
	DetermineWinner(rock->type);
	ASSERT_EQ(startPHealth, player.GetHealth());
	ASSERT_EQ(startOHealth, opponent.GetHealth());
	ASSERT_EQ(BattleController::BattleState::TieRound, GetBattleState());

	// Run the round so that the player loses
	DetermineWinner(Skill::SkillType::Paper);
	ASSERT_EQ(startPHealth - 1, player.GetHealth());
	ASSERT_EQ(startOHealth, opponent.GetHealth());
	ASSERT_EQ(BattleController::BattleState::LoseRound, GetBattleState());

	// Run the round so that the player wins
	DetermineWinner(Skill::SkillType::Scissors);
	ASSERT_EQ(startPHealth - 1, player.GetHealth());
	ASSERT_EQ(startOHealth - 1, opponent.GetHealth());
	ASSERT_EQ(BattleController::BattleState::WinRound, GetBattleState());
}
예제 #2
0
파일: Battle.cpp 프로젝트: Noxalus/YAPOG
 void Battle::HandleDraw (yap::IDrawingContext& context)
 {
   background_->Draw (context);
   playerGround_->Draw (context);
   playerTrainerBack_->Draw (context);
   opponentGround_->Draw (context);
   GetPlayerTeam ().Draw (context);
   GetOpponent ().Draw (context);
 }