ok here goes, first, fixed a crash that would happen when ever a player would gain more then 2000 life or take more then 2000 damage...the buffer was becoming corrupted i imagine because it was too small, increasing it to 10 slots allowed players to successfully take massive amounts of damage, highest i bothered checking was about 35k gained/lost, no crash... 2nd, removed the and refactored cantcaster rule, moved it to stateEffects() and renamed stateeffects to better reflect what it will be handling, removed sneak attack rule and moved it into stateeffects the following ints have been converted into bool, all the cantcasters, canputlandsintoplay is becoming a bool, the amount of lands you can play is now handled by a new varible int landsPlayerCanStillPlay (this is for my ability additional lands increase in support on perminents coming after the release) the changes to bools were for an obvious reason, they were all ints pretending to be bools, my varibles were confusing as you would often see code like this if(cantblahblah > 0) which to another coder might not make any sense. these varible ints were returning 0 as false and 1 as true...changed them all to bools, same goes for putlandsinplay int, in half the places it was being used as a bool, AND it was tracking the amount, when i was coding additional land ability, this made it impossible to maintain correct amounts without damaging the rest of the code. as a bool, controlled by stateeffects, it can now be used correctly as a bool in all cases, and the stateEffects manages the switch on it to false if you no longer have any landsPlayerCanStillPlay left. the refactor on cantcaster was also a bug fix, it was reported to me that cantcasters were not correctly working, sometimes ai or player would still be allowed to play a card with one in play, because of the old way i had it setup somecases of bothcantcaster were reseting the cantcast to 0, basically making the check do nothing. it is now handled in stateeffects if you have one in play, then its true, if not then false...this returns very accurate tracking of the cards instantly instead of checking as cards enter or left play. the "both" versions now have their own bools to avoid future conflicts with the single player cantcast... added a case for the fancy moving text, some move to library effects were incorrectly returing fetch.
91 lines
2.2 KiB
C++
91 lines
2.2 KiB
C++
#ifndef _GAMEOBSERVER_H_
|
|
#define _GAMEOBSERVER_H_
|
|
|
|
#include "Player.h"
|
|
#include "MTGAbility.h"
|
|
#include "DuelLayers.h"
|
|
#include "MTGCardInstance.h"
|
|
#include "PlayGuiObject.h"
|
|
#include "TargetChooser.h"
|
|
#include "PhaseRing.h"
|
|
#include "ReplacementEffects.h"
|
|
#include "GuiStatic.h"
|
|
#include <queue>
|
|
#include <time.h>
|
|
|
|
class MTGGamePhase;
|
|
class MTGAbility;
|
|
class MTGCardInstance;
|
|
struct CardGui;
|
|
class Player;
|
|
class TargetChooser;
|
|
class Rules;
|
|
using namespace std;
|
|
|
|
class GameObserver{
|
|
protected:
|
|
static GameObserver * mInstance;
|
|
MTGCardInstance * cardWaitingForTargets;
|
|
queue<WEvent *> eventsQueue;
|
|
|
|
int nbPlayers;
|
|
int untap(MTGCardInstance * card);
|
|
bool WaitForExtraPayment(MTGCardInstance* card);
|
|
|
|
public:
|
|
int currentPlayerId;
|
|
CombatStep combatStep;
|
|
int turn;
|
|
int forceShuffleLibraries();
|
|
int targetListIsSet(MTGCardInstance * card);
|
|
PhaseRing * phaseRing;
|
|
int cancelCurrentAction();
|
|
int currentGamePhase;
|
|
ExtraCosts * mExtraPayment;
|
|
int oldGamePhase;
|
|
TargetChooser * targetChooser;
|
|
DuelLayers * mLayers;
|
|
ReplacementEffects *replacementEffects;
|
|
Player * gameOver;
|
|
Player * players[2]; //created outside
|
|
time_t startedAt;
|
|
Rules * mRules;
|
|
|
|
TargetChooser * getCurrentTargetChooser();
|
|
void stackObjectClicked(Interruptible * action);
|
|
|
|
int cardClick(MTGCardInstance * card,Targetable * _object = NULL );
|
|
int getCurrentGamePhase();
|
|
void nextCombatStep();
|
|
void userRequestNextGamePhase();
|
|
void nextGamePhase();
|
|
void cleanupPhase();
|
|
void nextPlayer();
|
|
static void Init(Player * _players[], int _nbplayers);
|
|
static GameObserver * GetInstance();
|
|
static void EndInstance();
|
|
Player * currentPlayer;
|
|
Player * currentActionPlayer;
|
|
Player * isInterrupting;
|
|
Player * opponent();
|
|
Player * currentlyActing();
|
|
GameObserver(Player * _players[], int _nbplayers);
|
|
~GameObserver();
|
|
void gameStateBasedEffects();
|
|
void eventOccured();
|
|
void addObserver(MTGAbility * observer);
|
|
void removeObserver(ActionElement * observer);
|
|
void startGame(Rules * rules);
|
|
void untapPhase();
|
|
void draw();
|
|
int isInPlay(MTGCardInstance * card);
|
|
|
|
void Update(float dt);
|
|
void Render();
|
|
void ButtonPressed(PlayGuiObject*);
|
|
|
|
int receiveEvent(WEvent * event);
|
|
};
|
|
|
|
#endif
|