-
Notifications
You must be signed in to change notification settings - Fork 0
/
TarotContext.h
47 lines (40 loc) · 1.15 KB
/
TarotContext.h
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
#ifndef TAROTCONTEXT_H
#define TAROTCONTEXT_H
#include "Deck.h"
#include "Common.h"
#include "JsonValue.h"
#include "Score.h"
struct TarotContext
{
public:
TarotContext();
void Initialize();
std::uint8_t mNbPlayers;
Tarot::Bid mBid;
Deck mDiscard;
Deck mDog;
Deck mAttackHandle;
Deck mDefenseHandle;
Place mFirstPlayer;
Deck mTricks[24]; // 24 tricks max with 3 players
Place mWinner[24];
int mTricksWon;
Deck::Statistics mStatsAttack;
Card mKingCalled;
// Modifiers
Contract SetBid(Contract c, bool slam, Place p);
Place SetTrick(const Deck &trick, std::uint8_t trickCounter);
bool LoadFromJson(const JsonValue &json);
bool ManageDogAfterBid();
void AnalyzeGame(Points &points);
void SetHandle(const Deck &handle, Place p);
// Getters
void SaveToJson(JsonObject &json) const;
Place GetOwner(Place firstPlayer, const Card &card, int turn) const;
Deck GetTrick(std::uint8_t turn) const;
Place GetWinner(std::uint8_t turn) const;
bool CheckKingCall(const Card &c, Deck::Statistics &stats) const;
private:
bool HasDecimal(float f);
};
#endif // TAROTCONTEXT_H