Beispiel #1
0
void Random::attackPhase(Player* player)
{
	cout << "Performing battle phase for " << player->getName() << "." << endl;
	//iterate through all countries
	vector<Country*> countries = player->getCountries();
	for (size_t i = 0; i < countries.size(); i++)
	{
		if (countries[i]->getArmies() > 1)
		{
			for (size_t j = 0; j < countries[i]->getBorderCount(); j++)
			{
				if (countries[i]->borderCountries[j]->owner->getName() != player->getName())
				{
					if (rand() % 1)
					{
						Battle battle;
						battle.fight(countries[i], countries[i]->borderCountries[j]);
					}
				}
			}
		}
	}
}