#include #include #include #include "Battle/BattleField.h" #include "Core/BasicPrintVisitor.h" #include "Core/PrettyPrintVisitor.h" #include "Core/Time.h" #include "Player/Enemy.h" #include "Player/EnemyEasyDifficultLvlStrategy.h" #include "Player/EnemyHardDifficultLvlStrategy.h" #include "Player/RealPlayer.h" #include "Ship/Cargo.h" #include "Ship/CargoDamageVisitor.h" #include "Ship/Ship.h" #include "Ship/ShipEasyDifficultLvlStrategy.h" #include "Ship/ShipHardDifficultLvlStrategy.h" #include "Store/Store.h" int main() { Time time; std::vector> cargoes; cargoes.push_back(std::make_unique(1'000)); cargoes.push_back(std::make_unique(1'000)); cargoes.push_back(std::make_unique(1'000)); auto store = std::unique_ptr>( [&cargoes, &time]() { auto* store = new Store(std::move(cargoes), std::make_unique()); try { time.attach(store); } catch (...) { abort(); } return store; }(), [&time](Store* store) { time.detach(store); delete store; }); Ship ship(&time, std::make_unique(), "Black Widow", 1000, 40, std::make_unique()); ship.load(std::make_unique(300)); ship.load(std::make_unique(200)); ship.load(std::make_unique(150)); std::cout << "Ship\n"; ship.printCargo(); std::cout << "\nStore\n"; store->printCargo(); std::cout << "\n\n****************************************************\n"; auto ship2 = std::make_unique(&time, std::make_unique(), "Queens Anne revenge", 1000, 40, std::make_unique()); Enemy enemy("Enemy1", std::move(ship2), std::make_unique(), CargoDamageVisitor{}); // UNCOMMENT THIS IN EXERCISE 2 // auto ship3 = std::make_unique(&time, std::make_unique(), "Black Pearl", 1000, 40, std::make_unique()); // RealPlayer user("Mateusz", std::move(ship3)); // BattleField battefield{&user, &enemy}; // while (true) { // for (auto* player : battefield.players()) { // std::cout << "-------------------------------------------------------------------\n"; // std::cout << "Player HP: " << user.getShip().durability() << " ARMOR: " << user.getShip().armor() << " | "; // std::cout << "Enemy HP: " << enemy.getShip().durability() << " ARMOR: " << enemy.getShip().armor() << '\n'; // std::cout << "-------------------------------------------------------------------\n"; // for (size_t i = 0; i < 3; ++i) { // const auto status = player->makeAction(battefield); // if (status == Action::Status::Escaped || status == Action::Status::Defeated) { // return 0; // } // } // } // } }