Created
March 31, 2020 08:26
-
-
Save RomainMazB/3a9938e3dd72be7a6030b2cbd1a03833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testSacrifyEggsIncreaseFood(): void | |
{ | |
$expected_food = $this->city->getFood(); | |
$this->city->buildings->nursery->populate(4, 'warrior'); | |
$expected_food += 4 * config('city_default_values.abilities.food_ratio_for_sacrifices_egg'); | |
$this->city->buildings->nursery->sacrifyEggs(4, 'egg'); | |
$this->assertEquals($expected_food, $this->city->getFood()); | |
/** | |
* Test food increase for larvae | |
*/ | |
$this->city->buildings->nursery->populate(4, 'warrior'); | |
// Update the born_time to make them Larvae | |
$larvae_offset = config('game.total_development_time.end') - config('game.development_times.larvae.end') + 25; | |
DB::update("UPDATE ants SET born_time = NOW() + CONCAT(?::INT, ' minutes')::INTERVAL", [$larvae_offset]); | |
$expected_food += 4 * config('city_default_values.abilities.food_ratio_for_sacrifices_larvae'); | |
$this->city->buildings->nursery->sacrifyEggs(4, 'larvae'); | |
$this->assertEquals($expected_food, $this->city->getFood()); | |
/** | |
* Test food increase for pupae | |
*/ | |
$this->city->buildings->nursery->populate(4, 'warrior'); | |
// Update the born_time to make them Pupae | |
$pupae_offset = config('game.total_development_time.end') - config('game.development_times.pupae.end') + 25; | |
DB::update("UPDATE ants SET born_time = NOW() + CONCAT(?::INT, ' minutes')::INTERVAL", [$pupae_offset]); | |
$expected_food += 4 * (int) config('city_default_values.abilities.food_ratio_for_sacrifices_pupae'); | |
$this->city->buildings->nursery->sacrifyEggs(4, 'pupae'); | |
$this->assertEquals($expected_food, $this->city->getFood()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment