J :
* ostream printing of JGui objects.
This commit is contained in:
@@ -62,6 +62,7 @@ class NextGamePhase: public Interruptible {
|
||||
public:
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
NextGamePhase(int id);
|
||||
};
|
||||
|
||||
@@ -75,6 +76,7 @@ class Spell: public Interruptible, public TargetsList {
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class StackAbility: public Interruptible {
|
||||
@@ -82,6 +84,7 @@ class StackAbility: public Interruptible {
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
};
|
||||
|
||||
@@ -91,6 +94,7 @@ class PutInGraveyard: public Interruptible {
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
};
|
||||
|
||||
@@ -101,6 +105,7 @@ class DrawAction: public Interruptible {
|
||||
Player * player;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ class CardDisplay:public PlayGuiObjectController{
|
||||
bool CheckUserInput(u32 key);
|
||||
void Render();
|
||||
void init(MTGGameZone * zone);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -29,4 +30,7 @@ class DefaultTargetDisplay:CardDisplay{
|
||||
DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y, JGuiListener * _listener, int _nb_displayed_items );
|
||||
~DefaultTargetDisplay();
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ class CardGui: public PlayGuiObject{
|
||||
CardGui(int id, MTGCardInstance * _card, float desiredHeight, float _x=0, float _y=0, bool hasFocus = false);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
void RenderBig(float x=-1, float y = -1, int alternate = 0);
|
||||
static void alternateRender(MTGCard * card, JQuad ** manaIcons, float x, float y, float rotation= 0, float scale=1);
|
||||
|
||||
@@ -36,6 +36,7 @@ class Damage: public Interruptible {
|
||||
Damage(int id, MTGCardInstance* _source, Damageable * _target);
|
||||
Damage(int id, MTGCardInstance* _source, Damageable * _target, int _damage);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,6 +50,7 @@ class DamageStack :public GuiLayer, public Interruptible{
|
||||
void Render();
|
||||
int CombatDamages();//Deprecated ?
|
||||
int CombatDamages(int strike);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DamageStack(int id, GameObserver* _game);
|
||||
};
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
|
||||
int nextCardSet(); // Retrieves the next set subfolder automatically
|
||||
void createUsersFirstDeck(int setId);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,8 +25,8 @@ using std::map;
|
||||
|
||||
//Two stupid variables used to give a hint to the AI:
|
||||
// Should I cast a spell on an enemy or friendly unit ?
|
||||
#define BAKA_EFFECT_GOOD 1
|
||||
#define BAKA_EFFECT_BAD -1
|
||||
#define BAKA_EFFECT_GOOD 1
|
||||
#define BAKA_EFFECT_BAD -1
|
||||
#define BAKA_EFFECT_DONTKNOW 0
|
||||
|
||||
#define COUNT_POWER 1
|
||||
@@ -38,7 +38,7 @@ using std::map;
|
||||
class MTGAbility: public ActionElement{
|
||||
protected:
|
||||
char menuText[25];
|
||||
|
||||
|
||||
GameObserver * game;
|
||||
public:
|
||||
int forceDestroy;
|
||||
@@ -58,6 +58,7 @@ class MTGAbility: public ActionElement{
|
||||
virtual int fireAbility();
|
||||
virtual int stillInUse(MTGCardInstance * card){if (card==source) return 1; return 0;};
|
||||
virtual int resolve(){return 0;};
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
/*Poor man's casting */
|
||||
/* Todo replace that crap with dynamic casting */
|
||||
@@ -70,7 +71,6 @@ class MTGAbility: public ActionElement{
|
||||
PUT_INTO_PLAY = 5,
|
||||
MOMIR = 6,
|
||||
MTG_BLOCK_RULE = 7,
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -83,6 +83,7 @@ class TriggeredAbility:public MTGAbility{
|
||||
virtual void Render(){};
|
||||
virtual int trigger()=0;
|
||||
virtual int resolve() = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -95,6 +96,7 @@ class ActivatedAbility:public MTGAbility{
|
||||
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
virtual int reactToTargetClick(Targetable * object);
|
||||
virtual int resolve() = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class TargetAbility:public ActivatedAbility{
|
||||
@@ -105,6 +107,7 @@ class TargetAbility:public ActivatedAbility{
|
||||
virtual int reactToClick(MTGCardInstance * card);
|
||||
virtual int reactToTargetClick(Targetable * object);
|
||||
virtual void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class InstantAbility:public MTGAbility{
|
||||
@@ -115,6 +118,7 @@ class InstantAbility:public MTGAbility{
|
||||
InstantAbility(int _id, MTGCardInstance * source);
|
||||
InstantAbility(int _id, MTGCardInstance * source,Damageable * _target);
|
||||
virtual int resolve(){return 0;};
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
/* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */
|
||||
@@ -129,6 +133,7 @@ class ListMaintainerAbility:public MTGAbility{
|
||||
virtual int added(MTGCardInstance * card) = 0;
|
||||
virtual int removed(MTGCardInstance * card) = 0;
|
||||
virtual int destroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
/* An attempt to globalize triggered abilities as much as possible */
|
||||
@@ -234,7 +239,7 @@ class AbilityFactory{
|
||||
|
||||
class AManaProducer: public MTGAbility{
|
||||
protected:
|
||||
|
||||
|
||||
ManaCost * cost;
|
||||
ManaCost * output;
|
||||
string menutext;
|
||||
@@ -255,9 +260,10 @@ class AManaProducer: public MTGAbility{
|
||||
const char * getMenuText();
|
||||
int testDestroy();
|
||||
~AManaProducer();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#include "MTGCardInstance.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class MTGGamePhase: public ActionElement {
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ class MTGPutInPlayRule:public MTGAbility{
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPutInPlayRule(int _id);
|
||||
const char * getMenuText(){return "Put into play";}
|
||||
|
||||
};
|
||||
|
||||
class MTGAttackRule:public MTGAbility{
|
||||
@@ -23,10 +23,10 @@ class MTGAttackRule:public MTGAbility{
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAttackRule(int _id);
|
||||
const char * getMenuText(){return "Attacker";}
|
||||
void Update(float dt);
|
||||
|
||||
};
|
||||
|
||||
class MTGBlockRule:public MTGAbility{
|
||||
@@ -34,6 +34,7 @@ class MTGBlockRule:public MTGAbility{
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBlockRule(int _id);
|
||||
const char * getMenuText(){return "Blocker";}
|
||||
};
|
||||
@@ -78,8 +79,12 @@ OutputDebugString("Receive5\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "MTGPersistRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
int testDestroy(){return 0;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -119,6 +124,11 @@ class MTGLegendRule:public ListMaintainerAbility{
|
||||
int removed(MTGCardInstance * card){return 0;}
|
||||
|
||||
int testDestroy(){return 0;}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
return out << "MTGLegendRule :::";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -143,6 +153,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card, int id);
|
||||
const char * getMenuText(){return "Momir";}
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -166,6 +177,11 @@ class MTGLifelinkRule:public MTGAbility{
|
||||
|
||||
int testDestroy(){return 0;}
|
||||
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "MTGLifelinkRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -64,4 +64,6 @@ class ManaCost{
|
||||
#endif
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,8 @@ class MenuItem: public JGuiObject
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(u32 key);
|
||||
virtual bool ButtonPressed();
|
||||
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@ class OptionItem:public JGuiObject{
|
||||
virtual bool Leaving();
|
||||
void setData();
|
||||
virtual void updateValue(){value+=increment; if (value>maxValue) value=0;};
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class OptionsList{
|
||||
|
||||
@@ -47,6 +47,7 @@ class GuiAvatar: public PlayGuiObject{
|
||||
Player * player;
|
||||
virtual void Render();
|
||||
GuiAvatar(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * _player);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiGameZone: public PlayGuiObject{
|
||||
@@ -62,16 +63,19 @@ class GuiGameZone: public PlayGuiObject{
|
||||
~GuiGameZone();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
void toggleDisplay();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiGraveyard: public GuiGameZone{
|
||||
public:
|
||||
GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiLibrary: public GuiGameZone{
|
||||
public:
|
||||
GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class ShopItem:public JGuiObject{
|
||||
virtual bool ButtonPressed();
|
||||
|
||||
const char * getText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class ShopItems:public JGuiController,public JGuiListener{
|
||||
|
||||
@@ -40,6 +40,7 @@ class SimpleMenuItem: public JGuiObject
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(u32 key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@ private:
|
||||
float start;
|
||||
int timer;
|
||||
vector<string> strings;
|
||||
int currentId;
|
||||
unsigned int currentId;
|
||||
int mRandom;
|
||||
public:
|
||||
void Add(string text);
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
TextScroller(JLBFont * font, float x, float y, float width, float speed = 30);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user