Files
wagic/projects/mtg/include/GameObserver.h
omegablast2002@yahoo.com 0a60979554 fix and completely reworked affinity AGAIN.
moved it out of rules, it was FAR to error prone and after fixing bugs on this ability about 12 times, im done with it.

noticed yesterday that it was removing the completely wrong amounts, and not maintaining its cost AT ALL. so i got sick of adjusting it as a rule, its now a statebased effect, called through gamestatebasedeffect as a side function.

the new affinity is less then 100 lines of code, down from 300. to acomplish the effect with FAR less effort. it is also FAR easier to maintain in the future if i die or leave the scene or whatever.

added a new count tool for MTGGameZones canByCanTarget...which allows for returns of amounts based on if it can be targetted by a tc. much like how listmaintainer does it. affinitygreencreature will not be the only ability to use this function, just a heads up. its just the first to do so.

hopefully this much more accurate affinity will be the last version...considering adding the other types which old affinity couldnt handle :D
2011-02-12 15:06:28 +00:00

93 lines
2.3 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 enchantmentStatus();
void Affinity();
void eventOccured();
void addObserver(MTGAbility * observer);
void removeObserver(ActionElement * observer);
void startGame(Rules * rules);
void untapPhase();
int isInPlay(MTGCardInstance * card);
int isInGrave(MTGCardInstance * card);
int isInExile(MTGCardInstance * card);
void Update(float dt);
void Render();
void ButtonPressed(PlayGuiObject*);
int receiveEvent(WEvent * event);
};
#endif