48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#define main mana_pet_world_real_main
|
|
#include "../../src/app/main.cpp"
|
|
#undef main
|
|
|
|
#include <cassert>
|
|
#include <cmath>
|
|
#include <filesystem>
|
|
|
|
namespace {
|
|
|
|
void StartBattleHidesTriggeredMonster()
|
|
{
|
|
const std::filesystem::path savePath = std::filesystem::temp_directory_path() / "mana_pet_world_battle_encounter_test_save.txt";
|
|
std::filesystem::remove(savePath);
|
|
|
|
Runtime rt;
|
|
rt.currentMapName = "TestMap";
|
|
rt.savePath = savePath;
|
|
|
|
Entity wild;
|
|
wild.name = "TestMonster";
|
|
wild.objectKey = "TestMap#monster#1";
|
|
wild.pet = MakePet("Lulea", 20, 7);
|
|
wild.active = true;
|
|
wild.moving = true;
|
|
wild.respawnDelay = 42.0f;
|
|
rt.wildPets.push_back(wild);
|
|
|
|
StartBattle(rt, 0);
|
|
|
|
assert(rt.mode == Mode::Battle);
|
|
assert(rt.battlePetIndex == 0);
|
|
assert(!rt.wildPets[0].active);
|
|
assert(!rt.wildPets[0].moving);
|
|
assert(std::fabs(rt.wildPets[0].respawnTimer - wild.respawnDelay) < 0.001f);
|
|
assert(rt.monsterRespawnUntil.find(wild.objectKey) != rt.monsterRespawnUntil.end());
|
|
|
|
std::filesystem::remove(savePath);
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main()
|
|
{
|
|
StartBattleHidesTriggeredMonster();
|
|
return 0;
|
|
}
|