-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathGameEngine.hpp
More file actions
78 lines (59 loc) · 2.18 KB
/
Copy pathGameEngine.hpp
File metadata and controls
78 lines (59 loc) · 2.18 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
73
74
75
76
77
78
#ifndef GAME_ENGINE_HPP
#define GAME_ENGINE_HPP
#include "../models/Card.hpp"
#include "Enums.hpp"
#include <map>
#include <string>
#include <vector>
class Player;
class Board;
class TransactionLogger;
class PropertyTile;
class GameEngine {
private:
Board *board;
TransactionLogger *logger;
std::vector<Player *> player;
// NOTE: TUNGGU IMPLEMENTASI MIGUEL, MASIH RANCU BANGET MAU DIBAWA KEMANA
// CardDeck<SkillCard> *skillDeck; // Kartu Kemampuan Spesial
// CardDeck<SkillCard> *chanceDeck; // Kartu Kesempatan
// CardDeck<SkillCard> *communityChestDeck; // Kartu Dana Umum
// Jumlah ronde yang sudah dilalui, harus < MAX_TURN (dari file konfigurasi)
int roundCount;
// Indeks ke vektor player, menandakan giliran pemain mana
int currentTurn;
// Jumlah petak yang dilewati = dice1 + dice2
// Streak jika dice1 == dice2
int dice1;
int dice2;
// Bernilai 0 setiap awal giliran, setiap dice1 == dice2, doubleStreak++
int doubleStreak;
public:
GameEngine(Board *board, TransactionLogger *logger);
~GameEngine();
// Permainan baru. Input jumlah pemain, nama pemain. Acak giliran.
// SYARAT: config sudah diload oleh config loader.
void startNewGame();
// Permainan berdasarkan saved game sebelumnya.
// SYARAT: sudah diload oleh config loader.
void startLoadedGame();
// Proses pengocokan dadu hingga doubleStreak = 3, atau dice1 != dice2
void rollDice();
// proses korupsi dadu (ATUR MANUAL HEHE), exception kalau d1, d2 > 6, d1,
// d2 < 0
void rollDice(int d1, int d2);
// Total nilai dadu terakhir
int getDiceTotal() const;
// True jika dice1 == dice2
bool isDouble() const;
// NOTE: PANGGIL FUNGSI FESTIVAL, belum tau implementasinya
// Urutan: Festival, Bagi kartu spesial, reset giliran
void executeTurn();
// Pindahkan currentTurn ke pemain ACTIVE selanjutnya, BANKRUPT gak dihitung
// Tambahkan roundCount, setelah currentTurn, kembali ke indeks 1
void advanceTurn();
// Cek apakah kondisi saat ini sudah ada yang memenangkan pertandingan,
// dipanggil di setiap akhir giliran.
void checkWinCondition();
};
#endif