-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathGameEngine.hpp
More file actions
72 lines (58 loc) · 2.14 KB
/
Copy pathGameEngine.hpp
File metadata and controls
72 lines (58 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef GAME_ENGINE_HPP
#define GAME_ENGINE_HPP
#include <vector>
#include <string>
#include <random>
// Forward Declarations - Hindari include di header untuk mencegah circular dependency
class Player;
class Board;
class SaveLoadManager;
class TransactionLogger;
class Auction;
class SkillCard;
template <typename T> class CardDeck;
class GameEngine {
private:
// State Game
std::vector<Player*> players;
Board* board;
SaveLoadManager* saveLoadManager;
TransactionLogger* logger;
CardDeck<SkillCard>* skillDeck; // Sesuaikan dengan tipe dari Miguel
CardDeck<ActionCard>* chanceDeck;
CardDeck<ActionCard>* communityDeck;
int currentTurnIdx; // Indeks pemain aktif (0-3)
int roundCount; // Jumlah putaran yang sudah berjalan
bool diceRolled;
bool turnEnded;
// Utilitas Internal
void checkWinCondition();
void nextTurn();
void handleBankruptcy(Player* bankruptPlayer, Player* creditor = nullptr);
void runAuction(PropertyTile* prop);
void handleActionCardEffect(Player& player, ActionCardEffect effect);
void initDecks();
public:
GameEngine(Board *board, TransactionLogger *logger);
~GameEngine();
void startNewGame(const std::vector<std::string>& playerNames);
void loadGame(const std::string& filePath);
void saveGame(const std::string& filePath);
void rollDice(int d1 = 0, int d2 = 0);
void executeTileAction();
void endTurn();
void buyBuilding(const std::string& propertyCode);
void sellBuilding(const std::string& colorGroup);
void mortgageProperty(const std::string& propertyCode);
void unmortgageProperty(const std::string& propertyCode);
void useSkillCard(int cardIdx);
Player* getCurrentPlayer() const;
std::vector<Player*> getAllPlayers() const { return players; }
Board* getBoard() const { return board; }
int getCurrentRound() const { return roundCount; }
int getCurrentTurnIdx() const { return currentTurnIdx; }
bool hasDiceRolled() const { return diceRolled; }
bool isTurnEnded() const { return turnEnded; }
const std::vector<SkillCard*>& getSkillDeckCards() const;
};
#endif