J :
* New interface. * This breaks a lot of things. It is not feature-equivalent. It probably doesn't compile under windows and doesn't work on PSP. * Damage is not resolved any more. This will have to be fixed. * Blockers can't be ordered any more. This will have to be fixed. * A lot of new art is included.
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
#ifndef _AIMOMIRPLAYER_H_
|
||||
#define _AIMOMIRPLAYER_H_
|
||||
|
||||
#include "AIPlayer.h"
|
||||
|
||||
|
||||
class AIMomirPlayer:public AIPlayerBaka{
|
||||
public:
|
||||
AIMomirPlayer(MTGPlayerCards * _deck, char * file, const char * fileSmall, char * avatarFile);
|
||||
int getEfficiency(AIAction * action);
|
||||
int momir();
|
||||
int computeActions();
|
||||
static MTGAbility * momirAbility;
|
||||
static MTGAbility * getMomirAbility();
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef _AIMOMIRPLAYER_H_
|
||||
#define _AIMOMIRPLAYER_H_
|
||||
|
||||
#include "AIPlayer.h"
|
||||
|
||||
|
||||
class AIMomirPlayer:public AIPlayerBaka{
|
||||
public:
|
||||
AIMomirPlayer(MTGPlayerCards * deck, string file, string fileSmall, string avatarFile);
|
||||
int getEfficiency(AIAction * action);
|
||||
int momir();
|
||||
int computeActions();
|
||||
static MTGAbility * momirAbility;
|
||||
static MTGAbility * getMomirAbility();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,11 +61,11 @@ class AIPlayer: public Player{
|
||||
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
|
||||
AIStats * getStats();
|
||||
public:
|
||||
void End(){};
|
||||
void End(){};
|
||||
virtual int displayStack(){return 0;};
|
||||
AIStats * stats;
|
||||
ManaCost * getPotentialMana();
|
||||
AIPlayer(MTGPlayerCards * _deck, string deckFile, string deckFileSmall);
|
||||
AIPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);
|
||||
virtual ~AIPlayer();
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL);
|
||||
@@ -86,7 +86,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile, const char * deckfileSmall, char * avatarFile);
|
||||
AIPlayerBaka(MTGPlayerCards * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
|
||||
@@ -25,12 +25,12 @@ class ActionLayer: public GuiLayer, public JGuiListener{
|
||||
virtual void Update(float dt);
|
||||
int unstoppableRenderInProgress();
|
||||
bool CheckUserInput(u32 key);
|
||||
ActionLayer(int id, GameObserver* _game):GuiLayer(id, _game){ menuObject = NULL; abilitiesMenu = NULL; stuffHappened = 0;};
|
||||
ActionLayer(){ menuObject = NULL; abilitiesMenu = NULL; stuffHappened = 0;};
|
||||
~ActionLayer();
|
||||
int cancelCurrentAction();
|
||||
ActionElement * isWaitingForAnswer();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int receiveEvent(WEvent * event);
|
||||
int receiveEventPlus(WEvent * event);
|
||||
int reactToTargetClick(Targetable * card);
|
||||
int isReactingToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
|
||||
@@ -45,6 +45,9 @@ class TargetChooser;
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering(){mHasFocus = true;};
|
||||
@@ -53,8 +56,8 @@ class Interruptible: public PlayGuiObject, public Targetable{
|
||||
virtual int resolve(){return 0;};
|
||||
virtual void Render(){};
|
||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||
Interruptible(int id,bool hasFocus = false):PlayGuiObject(id,40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||
virtual const char *getDisplayName(){return "stack object";};
|
||||
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||
virtual const string getDisplayName(){return "stack object";};
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
virtual void Dump();
|
||||
#endif
|
||||
@@ -79,7 +82,7 @@ class Spell: public Interruptible {
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
const char *getDisplayName();
|
||||
const string getDisplayName();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||
Player * getNextPlayerTarget(Player * previous = 0);
|
||||
@@ -123,6 +126,7 @@ class DrawAction: public Interruptible {
|
||||
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
GameObserver* game;
|
||||
int interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
@@ -165,7 +169,7 @@ class ActionStack :public GuiLayer{
|
||||
void Update(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
ActionStack(int id, GameObserver* _game);
|
||||
ActionStack(GameObserver* game);
|
||||
int resolve();
|
||||
int CombatDamages();
|
||||
int CombatDamages(int firststrike);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Token.h"
|
||||
#include "Counters.h"
|
||||
#include "WEvent.h"
|
||||
#include "GuiStatic.h"
|
||||
|
||||
#include <JGui.h>
|
||||
#include <hge/hgeparticle.h>
|
||||
@@ -29,8 +30,7 @@ class TrCardAddedToZone:public TriggeredAbility{
|
||||
public:
|
||||
TargetChooser * toTc;
|
||||
TargetZoneChooser * fromTc;
|
||||
TrCardAddedToZone(int id,MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTc = NULL):TriggeredAbility(id,source), toTc(toTc),fromTc(fromTc){
|
||||
}
|
||||
TrCardAddedToZone(int id, MTGCardInstance * source, TargetChooser * toTc, TargetZoneChooser * fromTc = NULL):TriggeredAbility(id,source), toTc(toTc), fromTc(fromTc){}
|
||||
|
||||
int resolve(){
|
||||
return 0; //This is a trigger, this function should not be called
|
||||
@@ -63,8 +63,8 @@ class AACounter: public ActivatedAbility{
|
||||
int nb;
|
||||
int power;
|
||||
int toughness;
|
||||
AACounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, int nb,ManaCost * cost=NULL, int doTap = 0):ActivatedAbility(id,_source,cost,0,doTap),nb(nb),power(_power),toughness(_toughness){
|
||||
target=_target;
|
||||
AACounter(int id, MTGCardInstance * source, MTGCardInstance * target, int power, int toughness, int nb, ManaCost * cost = NULL, int doTap = 0) : ActivatedAbility(id, source, cost, 0, doTap), nb(nb), power(power), toughness(toughness) {
|
||||
target = target;
|
||||
}
|
||||
|
||||
|
||||
@@ -1962,10 +1962,10 @@ class AAladdinsLamp: public TargetAbility{
|
||||
int nbcards;
|
||||
int init;
|
||||
|
||||
AAladdinsLamp(int _id, MTGCardInstance * card):TargetAbility(_id,card){
|
||||
AAladdinsLamp(int id, MTGCardInstance * card) : TargetAbility(id,card) {
|
||||
cost = NEW ManaCost();
|
||||
cost->x();
|
||||
cd = CardDisplay(1,game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
|
||||
cd = CardDisplay(1, game, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, NULL);
|
||||
int zones[] = {MTGGameZone::MY_LIBRARY};
|
||||
tc = NEW TargetZoneChooser(zones,1,source);
|
||||
nbcards = 0;
|
||||
@@ -2485,7 +2485,7 @@ class AGlassesOfUrza:public MTGAbility{
|
||||
CardDisplay * display;
|
||||
bool isActive;
|
||||
AGlassesOfUrza(int _id, MTGCardInstance * _source):MTGAbility(_id, _source),isActive(false){
|
||||
display = NEW CardDisplay(0, game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
|
||||
display = NEW CardDisplay(0, game, SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
|
||||
}
|
||||
|
||||
void Update(float dt){
|
||||
@@ -2979,7 +2979,7 @@ class APestilence: public ActivatedAbility{
|
||||
for (int i = 0; i < 2 ; i++){
|
||||
MTGInPlay * inplay = game->players[i]->game->inPlay;
|
||||
for (int j = inplay->nb_cards - 1 ; j >=0; j--){
|
||||
if (inplay->cards[j]->isACreature()) game->mLayers->stackLayer()->addDamage(source,inplay->cards[j],1);
|
||||
if (inplay->cards[j]->isCreature()) game->mLayers->stackLayer()->addDamage(source,inplay->cards[j],1);
|
||||
}
|
||||
game->mLayers->stackLayer()->addDamage(source,game->players[i],1);
|
||||
}
|
||||
@@ -3489,7 +3489,7 @@ class ASoulNet:public ActivatedAbility{
|
||||
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){
|
||||
newDead = ((PutInGraveyard *) GameObserver::GetInstance()->mLayers->stackLayer()->getPrevious(NULL,ACTION_PUTINGRAVEYARD,RESOLVED_OK));
|
||||
if (newDead && newDead != latest && newDead->card->isACreature())
|
||||
if (newDead && newDead != latest && newDead->card->isCreature())
|
||||
return ActivatedAbility::isReactingToClick(card,mana);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ class MTGGameZone;
|
||||
class MTGCardInstance;
|
||||
|
||||
class CardDisplay:public PlayGuiObjectController{
|
||||
int mId;
|
||||
GameObserver* game;
|
||||
public:
|
||||
int x, y , start_item, nb_displayed_items;
|
||||
TargetChooser * tc;
|
||||
JGuiListener * listener;
|
||||
CardDisplay();
|
||||
CardDisplay(int id, GameObserver* _game, int _x, int _y, JGuiListener * _listener = NULL, TargetChooser * _tc = NULL, int _nb_displayed_items = 7 );
|
||||
CardDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL, int nb_displayed_items = 7);
|
||||
void AddCard(MTGCardInstance * _card);
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
@@ -27,7 +29,7 @@ class CardDisplay:public PlayGuiObjectController{
|
||||
|
||||
class DefaultTargetDisplay:CardDisplay{
|
||||
public:
|
||||
DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y, JGuiListener * _listener, int _nb_displayed_items );
|
||||
DefaultTargetDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener, int nb_displayed_items );
|
||||
~DefaultTargetDisplay();
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#define _CARD_GUI_H_
|
||||
|
||||
#include <JGui.h>
|
||||
#include "Pos.h"
|
||||
#include "PlayGuiObject.h"
|
||||
#include "MTGCardInstance.h"
|
||||
#include <hge/hgeparticle.h>
|
||||
@@ -11,10 +12,53 @@
|
||||
class MTGCardInstance;
|
||||
class PlayGuiObject;
|
||||
|
||||
struct CardGui : public PlayGuiObject {
|
||||
protected:
|
||||
JQuad* quad;
|
||||
|
||||
public:
|
||||
static const float Width = 28.0;
|
||||
static const float Height = 40.0;
|
||||
static const float BigWidth = 200.0;
|
||||
static const float BigHeight = 285.0;
|
||||
|
||||
MTGCardInstance* card;
|
||||
CardGui(MTGCardInstance* card, float x, float y);
|
||||
CardGui(MTGCardInstance* card, const Pos& ref);
|
||||
virtual void Render() = 0;
|
||||
void RenderBig(const Pos&);
|
||||
virtual void Update(float dt) = 0;
|
||||
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class CardView : public CardGui {
|
||||
public:
|
||||
|
||||
MTGCardInstance* getCard(); // remove this when possible
|
||||
CardView(MTGCardInstance* card, float x, float y);
|
||||
CardView(MTGCardInstance* card, const Pos& ref);
|
||||
virtual void Render();
|
||||
void Render(JQuad* q){Pos::Render(q);};
|
||||
void RenderSelected();
|
||||
virtual void Update(float dt);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class TransientCardView : public CardView {
|
||||
public:
|
||||
TransientCardView(MTGCardInstance* card, float x, float y);
|
||||
TransientCardView(MTGCardInstance* card, const Pos& ref);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
class CardGui: public PlayGuiObject{
|
||||
protected:
|
||||
hgeParticleSystem * mParticleSys;
|
||||
int alpha;
|
||||
float actX, actY;
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
CardGui(int id, MTGCardInstance * _card, float desiredHeight, float _x=0, float _y=0, bool hasFocus = false);
|
||||
@@ -22,10 +66,13 @@ class CardGui: public PlayGuiObject{
|
||||
virtual void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
float Height();
|
||||
float Width();
|
||||
|
||||
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);
|
||||
~CardGui();
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,13 +28,13 @@ class Damageable:public Targetable {
|
||||
|
||||
class Damage: public Interruptible {
|
||||
protected:
|
||||
void init(MTGCardInstance * _source, Damageable * _target, int _damage);
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage);
|
||||
public:
|
||||
Damageable * target;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(int id, MTGCardInstance* _source, Damageable * _target);
|
||||
Damage(int id, MTGCardInstance* _source, Damageable * _target, int _damage);
|
||||
Damage(int id, MTGCardInstance* source, Damageable * target);
|
||||
Damage(int id, MTGCardInstance* source, Damageable * target, int damage);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
@@ -43,7 +43,7 @@ class Damage: public Interruptible {
|
||||
class DamageStack :public GuiLayer, public Interruptible{
|
||||
protected:
|
||||
int currentState;
|
||||
|
||||
GameObserver* game;
|
||||
|
||||
public:
|
||||
int resolve();
|
||||
@@ -51,7 +51,7 @@ class DamageStack :public GuiLayer, public Interruptible{
|
||||
int CombatDamages();//Deprecated ?
|
||||
int CombatDamages(int strike);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DamageStack(int id, GameObserver* _game);
|
||||
DamageStack(GameObserver* game);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -9,8 +9,10 @@ class DamageStack;
|
||||
|
||||
class DamageResolverLayer:public PlayGuiObjectController{
|
||||
protected:
|
||||
GameObserver* game;
|
||||
int trampleDamage();
|
||||
void updateAllCoordinates();
|
||||
|
||||
public:
|
||||
int buttonOk;
|
||||
int orderingIsNeeded;
|
||||
@@ -21,7 +23,7 @@ class DamageResolverLayer:public PlayGuiObjectController{
|
||||
DamageStack * damageStack;
|
||||
DamagerDamaged * currentSource;
|
||||
|
||||
DamageResolverLayer(int id, GameObserver* _game);
|
||||
DamageResolverLayer(GameObserver* game);
|
||||
int init();
|
||||
int initResolve();
|
||||
Player * whoSelectsDamagesDealtBy(MTGCardInstance * card);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef _DAMAGERDAMAGED_H_
|
||||
#define _DAMAGERDAMAGED_H_
|
||||
|
||||
#include "../include/CardGui.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
|
||||
class Player;
|
||||
|
||||
class DamagerDamaged:public CardGui{
|
||||
public:
|
||||
struct DamagerDamaged {
|
||||
MTGCardInstance* card;
|
||||
Player * damageSelecter;
|
||||
int mCount;
|
||||
Damage * damages[10];
|
||||
@@ -18,12 +18,9 @@ class DamagerDamaged:public CardGui{
|
||||
int removeDamagesFrom(DamagerDamaged * source);
|
||||
int sumDamages();
|
||||
int hasLethalDamage();
|
||||
DamagerDamaged(CardGui * cardg, Player * _damageSelecter, bool _hasFocus);
|
||||
DamagerDamaged(MTGCardInstance* card, Player * _damageSelecter, bool _hasFocus);
|
||||
~DamagerDamaged();
|
||||
void Render(Player * currentPlayer);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +1,51 @@
|
||||
#ifndef _DUELLAYERS_H_
|
||||
#define _DUELLAYERS_H_
|
||||
|
||||
|
||||
#include "GuiLayers.h"
|
||||
#include "CardSelector.h"
|
||||
|
||||
class MTGGuiHand;
|
||||
class MTGGuiPlay;
|
||||
class ActionLayer;
|
||||
class ActionStack;
|
||||
class DamageResolverLayer;
|
||||
class GuiHandSelf;
|
||||
class GuiHandOpponent;
|
||||
class GuiCombat;
|
||||
class Pos;
|
||||
|
||||
class DuelLayers: public GuiLayers{
|
||||
class DuelLayers {
|
||||
protected:
|
||||
int nbitems;
|
||||
vector<GuiLayer*> objects;
|
||||
vector<Pos*> waiters;
|
||||
GuiCombat* combat;
|
||||
ActionLayer* action;
|
||||
ActionStack* stack;
|
||||
GuiHandSelf *hand;
|
||||
|
||||
public:
|
||||
DuelLayers();
|
||||
~DuelLayers();
|
||||
|
||||
public :
|
||||
ActionLayer * actionLayer();
|
||||
MTGGuiHand * handLayer();
|
||||
MTGGuiPlay * playLayer();
|
||||
ActionStack * stackLayer();
|
||||
DamageResolverLayer * combatLayer();
|
||||
void init();
|
||||
virtual void Update(float dt, Player * player);
|
||||
|
||||
void Render();
|
||||
void Add(GuiLayer * layer);
|
||||
void Remove();
|
||||
int unstoppableRenderInProgress();
|
||||
int receiveEvent(WEvent * e);
|
||||
float RightBoundary();
|
||||
|
||||
CardSelector* cs;
|
||||
};
|
||||
|
||||
#include "ActionLayer.h"
|
||||
#include "GameObserver.h"
|
||||
#include "MTGGamePhase.h"
|
||||
#include "MTGGuiHand.h"
|
||||
#include "MTGGuiPlay.h"
|
||||
#include "ActionStack.h"
|
||||
#include "Damage.h"
|
||||
|
||||
|
||||
@@ -94,6 +94,6 @@ class GameApp: public JApp
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern JQuad* manaIcons[7];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "TargetChooser.h"
|
||||
#include "PhaseRing.h"
|
||||
#include "ReplacementEffects.h"
|
||||
#include "GuiStatic.h"
|
||||
|
||||
class MTGGamePhase;
|
||||
class MTGAbility;
|
||||
@@ -30,10 +31,9 @@ class GameObserver{
|
||||
int currentRound;
|
||||
int blockersAssigned;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
int blockersSorted;
|
||||
int forceShuffleLibrary[2];
|
||||
int turn;
|
||||
int forceShuffleLibraries();
|
||||
int targetListIsSet(MTGCardInstance * card);
|
||||
@@ -78,11 +78,11 @@ class GameObserver{
|
||||
void untapPhase();
|
||||
void draw();
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
int isACreature(MTGCardInstance * card);
|
||||
bool isCreature(MTGCardInstance * card);
|
||||
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int, PlayGuiObject*);
|
||||
void ButtonPressed(PlayGuiObject*);
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
};
|
||||
|
||||
@@ -6,53 +6,47 @@
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
#define OPTIONS_MUSICVOLUME "musicVolume"
|
||||
#define OPTIONS_SFXVOLUME "sfxVolume"
|
||||
|
||||
#define OPTIONS_DIFFICULTY_MODE_UNLOCKED "prx_handler" //huhu
|
||||
#define OPTIONS_MOMIR_MODE_UNLOCKED "prx_rimom" //haha
|
||||
#define OPTIONS_EVILTWIN_MODE_UNLOCKED "prx_eviltwin"
|
||||
#define OPTIONS_RANDOMDECK_MODE_UNLOCKED "prx_rnddeck"
|
||||
|
||||
#define OPTIONS_DIFFICULTY "difficulty"
|
||||
#define OPTIONS_CACHESIZE "cacheSize"
|
||||
#define OPTIONS_PLASMAEFFECT "plasmaEffect"
|
||||
#define OPTIONS_INTERRUPTMYSPELLS "interruptMySpells"
|
||||
#define OPTIONS_INTERRUPTMYABILITIES "interruptMyAbilities"
|
||||
#define OPTIONS_OSD "displayOSD"
|
||||
|
||||
// WALDORF - added
|
||||
#define OPTIONS_INTERRUPT_SECONDS "interruptSeconds"
|
||||
|
||||
|
||||
#define OPTIONS_SAVEFILE RESPATH"/settings/options.txt"
|
||||
|
||||
struct Options {
|
||||
static const string MUSICVOLUME;
|
||||
static const string SFXVOLUME;
|
||||
static const string DIFFICULTY_MODE_UNLOCKED;
|
||||
static const string MOMIR_MODE_UNLOCKED;
|
||||
static const string EVILTWIN_MODE_UNLOCKED;
|
||||
static const string RANDOMDECK_MODE_UNLOCKED;
|
||||
static const string DIFFICULTY;
|
||||
static const string CACHESIZE;
|
||||
static const string PLASMAEFFECT;
|
||||
static const string INTERRUPT_SECONDS;
|
||||
static const string INTERRUPTMYSPELLS;
|
||||
static const string INTERRUPTMYABILITIES;
|
||||
static const string OSD;
|
||||
};
|
||||
|
||||
class GameOption {
|
||||
public:
|
||||
int value;
|
||||
string svalue;
|
||||
int getIntValue();
|
||||
GameOption(int _value = 0);
|
||||
int number;
|
||||
string str;
|
||||
GameOption(int value = 0);
|
||||
GameOption(string value);
|
||||
};
|
||||
|
||||
|
||||
class GameOptions {
|
||||
public:
|
||||
map<string,GameOption> values;
|
||||
static GameOptions * GetInstance();
|
||||
static void Destroy();
|
||||
int save();
|
||||
int load();
|
||||
static const char * phaseInterrupts[];
|
||||
|
||||
private:
|
||||
static const char * phaseInterrupts[];
|
||||
GameOption& operator[](string);
|
||||
GameOptions();
|
||||
~GameOptions();
|
||||
static GameOptions* mInstance;
|
||||
|
||||
private:
|
||||
static map <string,int> optionsTypes;
|
||||
|
||||
|
||||
map<string,GameOption> values;
|
||||
};
|
||||
|
||||
extern GameOptions options;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
#include <JGE.h>
|
||||
|
||||
#include "GameState.h"
|
||||
#include "SimpleMenu.h"
|
||||
#include "../include/GameState.h"
|
||||
#include "../include/SimpleMenu.h"
|
||||
#include "../include/TexturesCache.h"
|
||||
#include "../include/CardGui.h"
|
||||
#include "../include/GameOptions.h"
|
||||
#include "../include/PriceList.h"
|
||||
@@ -116,7 +117,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf,"Loadindexes[%i] is NULL\n", i);
|
||||
if(_current) sprintf(buf, "LoadIndexes[%i] : %s\n", i, _current->getName());
|
||||
if(_current) sprintf(buf, "LoadIndexes[%i] : %s\n", i, _current->getName().c_str());
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
_current = displayed_deck->getNext(_current,colorFilter);
|
||||
@@ -187,7 +188,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
welcome_menu->Add(nbDecks+1, "--NEW--");
|
||||
welcome_menu->Add(-1, "Cancel");
|
||||
|
||||
if (GameApp::HasMusic && GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME].getIntValue() > 0){
|
||||
if (GameApp::HasMusic && options[Options::MUSICVOLUME].number > 0){
|
||||
if (GameApp::music){
|
||||
JSoundSystem::GetInstance()->StopMusic(GameApp::music);
|
||||
SAFE_DELETE(GameApp::music);
|
||||
@@ -617,7 +618,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
|
||||
int showName = 1;
|
||||
if (mParent->cache->isInCache(card) || last_user_activity > (abs(2-id) + 1)* NO_USER_ACTIVITY_SHOWCARD_DELAY){
|
||||
quad = card->getQuad(mParent->cache);
|
||||
quad = cache.getQuad(card);
|
||||
showName = 0;
|
||||
}
|
||||
|
||||
@@ -638,8 +639,8 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
mFont->SetScale(scaleBackup);
|
||||
}
|
||||
}else{
|
||||
CardGui::alternateRender(card, mIcons, x_center, y + 142.5*scale, 0, scale);
|
||||
quad = card->getThumb();
|
||||
// CardGui::alternateRender(card, mIcons, x_center, y + 142.5*scale, 0, scale);
|
||||
quad = cache.getThumb(card);
|
||||
if (quad){
|
||||
float _scale = 285 * scale / quad->mHeight;
|
||||
quad->SetColor(ARGB(40,255,255,255));
|
||||
@@ -782,7 +783,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
pricelist->setPrice(card->getMTGId(),price*2);
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "CARD'S NAME : %s", card->getName());
|
||||
sprintf(buf, "CARD'S NAME : %s", card->getName().c_str());
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
playerdata->collection->remove(card->getMTGId());
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class GuiCardsController : public PlayGuiObjectController{
|
||||
public:
|
||||
GuiCardsController(int id, GameObserver* _game):PlayGuiObjectController(id, _game){};
|
||||
GuiCardsController(){};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef _GUI_LAYERS_H_
|
||||
#define _GUI_LAYERS_H_
|
||||
|
||||
#define MAX_GUI_LAYERS 7
|
||||
|
||||
#define DIR_DOWN 1
|
||||
#define DIR_UP 2
|
||||
#define DIR_LEFT 3
|
||||
@@ -14,16 +12,13 @@
|
||||
class GameObserver;
|
||||
class Player;
|
||||
|
||||
|
||||
class GuiLayer{
|
||||
protected:
|
||||
GameObserver * game;
|
||||
int mId;
|
||||
u32 mActionButton;
|
||||
public:
|
||||
int mCount;
|
||||
int mCurr;
|
||||
vector<JGuiObject *>mObjects;
|
||||
vector<JGuiObject *> mObjects;
|
||||
void Add(JGuiObject * object);
|
||||
int Remove(JGuiObject * object);
|
||||
int modal;
|
||||
@@ -32,7 +27,7 @@ class GuiLayer{
|
||||
int getMaxId();
|
||||
void RenderMessageBackground(float x0, float y0, float width, int height);
|
||||
void RenderMessageBackground(float y0, int height);
|
||||
GuiLayer(int id, GameObserver* _game);
|
||||
GuiLayer();
|
||||
virtual ~GuiLayer();
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(u32 key){ return false; };
|
||||
@@ -45,23 +40,8 @@ class GuiLayer{
|
||||
return 1;
|
||||
};
|
||||
|
||||
virtual int receiveEvent(WEvent * e){return 0;};
|
||||
};
|
||||
|
||||
class GuiLayers{
|
||||
protected:
|
||||
int nbitems;
|
||||
GuiLayer * objects[MAX_GUI_LAYERS];
|
||||
public:
|
||||
GuiLayers();
|
||||
virtual void Update(float dt, Player * player);
|
||||
void Render();
|
||||
void Add(GuiLayer * layer);
|
||||
void Remove();
|
||||
int unstoppableRenderInProgress();
|
||||
~GuiLayers();
|
||||
int receiveEvent(WEvent * e);
|
||||
|
||||
virtual int receiveEventPlus(WEvent * e){return 0;};
|
||||
virtual int receiveEventMinus(WEvent * e){return 0;};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,11 +17,11 @@ class GuiPhaseBar : public GuiLayer
|
||||
float angle;
|
||||
|
||||
public:
|
||||
GuiPhaseBar(GameObserver* game);
|
||||
GuiPhaseBar();
|
||||
~GuiPhaseBar();
|
||||
void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual int receiveEvent(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif // _GUIPHASEBAR_H_
|
||||
|
||||
@@ -10,51 +10,35 @@
|
||||
#define MTG_MINIIMAGE_WIDTH 45
|
||||
#define MTG_MINIIMAGE_HEIGHT 64
|
||||
|
||||
|
||||
#define MAX_TYPES_PER_CARD 10
|
||||
|
||||
|
||||
|
||||
|
||||
#include "ManaCost.h"
|
||||
|
||||
|
||||
class TexturesCache;
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "ManaCost.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MTGCard {
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
int mtgid;
|
||||
ManaCost manaCost;
|
||||
|
||||
|
||||
char rarity;
|
||||
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
|
||||
vector<string> ftdText;
|
||||
int init();
|
||||
|
||||
|
||||
public:
|
||||
TexturesCache * mCache;
|
||||
string text;
|
||||
string name;
|
||||
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
map<int,int> basicAbilities;
|
||||
vector<string> formattedText;
|
||||
string magicText;
|
||||
int alias;
|
||||
string spellTargetType;
|
||||
int formattedTextInit;
|
||||
int power;
|
||||
int toughness;
|
||||
int setId;
|
||||
@@ -62,11 +46,8 @@ class MTGCard {
|
||||
int nb_types;
|
||||
int types[MAX_TYPES_PER_CARD];
|
||||
MTGCard();
|
||||
MTGCard(TexturesCache * cache, int set_id);
|
||||
MTGCard(int set_id);
|
||||
MTGCard(MTGCard * source);
|
||||
JQuad * getQuad(TexturesCache * cache);
|
||||
JQuad * getQuad(int type=1);
|
||||
JQuad * getThumb();
|
||||
|
||||
void setColor(int _color, int removeAllOthers = 0);
|
||||
int getColor();
|
||||
@@ -87,13 +68,13 @@ class MTGCard {
|
||||
//void setImageName( char * value);
|
||||
char * getImageName ();
|
||||
|
||||
void setText( string value);
|
||||
void setText(string value);
|
||||
const char * getText();
|
||||
|
||||
void addMagicText(string value);
|
||||
|
||||
void setName( string value);
|
||||
const char * getName();
|
||||
void setName(string value);
|
||||
const string getName() const;
|
||||
|
||||
void addType(char * type_text);
|
||||
void addType(int id);
|
||||
@@ -101,22 +82,24 @@ class MTGCard {
|
||||
void setSubtype( string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
int hasSubtype(int _subtype);
|
||||
int hasSubtype(const char * _subtype);
|
||||
int hasSubtype(string _subtype);
|
||||
int hasType(int _type);
|
||||
int hasType(const char * type);
|
||||
bool hasSubtype(int _subtype);
|
||||
bool hasSubtype(const char * _subtype);
|
||||
bool hasSubtype(string _subtype);
|
||||
bool hasType(int _type);
|
||||
bool hasType(const char * type);
|
||||
|
||||
void setManaCost(string value);
|
||||
ManaCost * getManaCost();
|
||||
int isACreature();
|
||||
bool isCreature();
|
||||
bool isLand();
|
||||
bool isSpell();
|
||||
|
||||
void setPower(int _power);
|
||||
int getPower();
|
||||
void setToughness(int _toughness);
|
||||
int getToughness();
|
||||
|
||||
|
||||
const vector<string>& formattedText();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class ManaCost;
|
||||
class UntapBlockers;
|
||||
class CardDescriptor;
|
||||
class Counters;
|
||||
class Pos;
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
@@ -41,6 +42,7 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
int setDefenser(MTGCardInstance * c);
|
||||
int setAttacker(int value);
|
||||
public:
|
||||
Pos* view;
|
||||
int regenerateTokens;
|
||||
bool isToken;
|
||||
int stillInUse();
|
||||
@@ -58,7 +60,7 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget(){return TARGET_CARD;}
|
||||
const char * getDisplayName();
|
||||
const string getDisplayName();
|
||||
MTGCardInstance * target;
|
||||
void addType(int type);
|
||||
|
||||
@@ -94,7 +96,6 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
int regenerate();
|
||||
int triggerRegenerate();
|
||||
Player * controller();
|
||||
JQuad * getIcon();
|
||||
|
||||
~MTGCardInstance();
|
||||
int bury();
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
#define MTG_ERROR -1
|
||||
|
||||
#include "../include/MTGDefinitions.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "../include/GameApp.h"
|
||||
#include "../include/TexturesCache.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Player;
|
||||
|
||||
class MTGGameZone {
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
enum{
|
||||
@@ -65,26 +65,27 @@ class MTGGameZone {
|
||||
};
|
||||
|
||||
Player * owner;
|
||||
//Both cards and cardsMap contain the cards of a zone. The long term objective is to get rid of the array
|
||||
vector<MTGCardInstance *> cards; //[MTG_MAX_PLAYER_CARDS];
|
||||
map<MTGCardInstance *,int> cardsMap;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
void shuffle();
|
||||
virtual MTGCardInstance * draw();
|
||||
void addCard(MTGCardInstance * card);
|
||||
void debugPrint();
|
||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||
void cleanupPhase();
|
||||
int countByType(const char * value);
|
||||
int hasType(const char * value);
|
||||
void setOwner(Player * player);
|
||||
MTGCardInstance * lastCardDrawn;
|
||||
static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target);
|
||||
static int zoneStringToId(string zoneName);
|
||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
|
||||
//Both cards and cardsMap contain the cards of a zone. The long term objective is to get rid of the array
|
||||
vector<MTGCardInstance *> cards; //[MTG_MAX_PLAYER_CARDS];
|
||||
map<MTGCardInstance *,int> cardsMap;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
void shuffle();
|
||||
virtual MTGCardInstance * draw();
|
||||
void addCard(MTGCardInstance * card);
|
||||
void debugPrint();
|
||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||
void cleanupPhase();
|
||||
int countByType(const char * value);
|
||||
int hasType(const char * value);
|
||||
void setOwner(Player * player);
|
||||
MTGCardInstance * lastCardDrawn;
|
||||
static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target);
|
||||
static int zoneStringToId(string zoneName);
|
||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
|
||||
bool needShuffle;
|
||||
};
|
||||
|
||||
class MTGLibrary: public MTGGameZone {
|
||||
|
||||
@@ -17,17 +17,18 @@ class GuiCardscontroller;
|
||||
|
||||
class MTGGuiHand: public GuiCardsController{
|
||||
protected:
|
||||
GameObserver* game;
|
||||
int currentId[2];
|
||||
Player * currentPlayer;
|
||||
int mShowHand;
|
||||
float mAnimState;
|
||||
JLBFont * mFont;
|
||||
public:
|
||||
MTGGuiHand(int id, GameObserver * _game);
|
||||
MTGGuiHand(GameObserver*);
|
||||
void Update(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
void updateCards();
|
||||
void updateCards();
|
||||
void showHand (bool show);// WALDORF - added
|
||||
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ class CardGui;
|
||||
|
||||
class MTGGuiPlay: public PlayGuiObjectController {
|
||||
protected:
|
||||
GameObserver* game;
|
||||
int offset;
|
||||
Player * currentPlayer;
|
||||
MTGCardInstance * cardsGrid[SCREEN_WIDTH/5][SCREEN_HEIGHT/5];
|
||||
@@ -43,14 +44,14 @@ class MTGGuiPlay: public PlayGuiObjectController {
|
||||
void adjustCardPosition(CardGui * cardg);
|
||||
public:
|
||||
CardGui * getByCard(MTGCardInstance * card);
|
||||
MTGGuiPlay(int id, GameObserver * game);
|
||||
MTGGuiPlay(GameObserver * game);
|
||||
~MTGGuiPlay();
|
||||
void Update(float dt);
|
||||
bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
void forceUpdateCards();
|
||||
void updateCards();
|
||||
int receiveEvent(WEvent * e);
|
||||
int receiveEventPlus(WEvent * e);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Phase{
|
||||
public:
|
||||
int id;
|
||||
Player * player;
|
||||
Phase(int _id, Player * _player):id(_id),player(_player){};
|
||||
Phase(int id, Player *player):id(id),player(player){};
|
||||
};
|
||||
|
||||
class PhaseRing{
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
#define GUI_LIBRARY 4
|
||||
|
||||
#include <JGui.h>
|
||||
#include "Effects.h"
|
||||
#include "WEvent.h"
|
||||
#include "Pos.h"
|
||||
|
||||
class MTGGameZone;
|
||||
class Player;
|
||||
class CardDisplay;
|
||||
|
||||
class PlayGuiObject: public JGuiObject, public JGuiListener{
|
||||
class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos{
|
||||
protected:
|
||||
|
||||
public:
|
||||
@@ -24,59 +23,17 @@ class PlayGuiObject: public JGuiObject, public JGuiListener{
|
||||
float mHeight;
|
||||
float defaultHeight;
|
||||
bool mHasFocus;
|
||||
int x;
|
||||
int y;
|
||||
int type;
|
||||
virtual void Entering(){mHasFocus = true;};
|
||||
virtual bool Leaving(u32 key){mHasFocus = false;return true;};
|
||||
virtual bool ButtonPressed(){return true;};
|
||||
virtual void Render(){};
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
PlayGuiObject(int id, float desiredHeight,float _x, float _y, bool hasFocus);
|
||||
PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus);
|
||||
PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus);
|
||||
virtual void ButtonPressed(int controllerId, int controlId){};
|
||||
virtual ~PlayGuiObject(){};
|
||||
|
||||
vector<Effect*> effects;
|
||||
};
|
||||
|
||||
class GuiAvatar: public PlayGuiObject{
|
||||
protected:
|
||||
|
||||
int avatarRed;
|
||||
int currentLife;
|
||||
public:
|
||||
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{
|
||||
protected:
|
||||
MTGGameZone * zone;
|
||||
|
||||
public:
|
||||
CardDisplay * cd;
|
||||
int showCards;
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
GuiGameZone(int id, float desiredHeight,float _x, float _y, bool hasFocus,MTGGameZone * _zone);
|
||||
~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;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ class PlayGuiObjectController : public GuiLayer{
|
||||
public:
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(u32 key);
|
||||
PlayGuiObjectController(int id, GameObserver* _game):GuiLayer(id, _game){last_user_move=0;};
|
||||
PlayGuiObjectController(){last_user_move=0;};
|
||||
virtual void Render(){GuiLayer::Render();};
|
||||
};
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ class Player: public Damageable{
|
||||
public:
|
||||
virtual void End();
|
||||
int typeAsTarget(){return TARGET_PLAYER;}
|
||||
const char * getDisplayName();
|
||||
const string getDisplayName();
|
||||
virtual int displayStack(){return 1;}
|
||||
JTexture * mAvatarTex;
|
||||
JQuad * mAvatar;
|
||||
int canPutLandsIntoPlay;
|
||||
MTGPlayerCards * game;
|
||||
int afterDamage();
|
||||
Player(MTGPlayerCards * _deck, string deckFile, string deckFileSmall);
|
||||
Player(MTGPlayerCards * deck, string deckFile, string deckFileSmall);
|
||||
virtual ~Player();
|
||||
void unTapPhase();
|
||||
MTGInPlay * inPlay();
|
||||
@@ -41,7 +41,7 @@ class Player: public Damageable{
|
||||
|
||||
class HumanPlayer: public Player{
|
||||
public:
|
||||
HumanPlayer(MTGPlayerCards * _deck, char * _deckFile, string _deckFileSmall);
|
||||
HumanPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@ class TargetChooser: public TargetsList {
|
||||
|
||||
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1);
|
||||
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
||||
int maxtargets; //Set to -1 for "unlimited"
|
||||
virtual int targetsZone(MTGGameZone * z){return 0;};
|
||||
int ForceTargetListReady();
|
||||
int targetsReadyCheck();
|
||||
virtual int addTarget(Targetable * target);
|
||||
virtual int canTarget(Targetable * _target);
|
||||
virtual bool canTarget(Targetable * _target);
|
||||
virtual int full(){if (maxtargets != -1 && cursor>=maxtargets) {return 1;} else{return 0;}};
|
||||
virtual int ready(){return cursor;};
|
||||
virtual ~TargetChooser(){};
|
||||
@@ -61,7 +61,6 @@ class TargetChooserFactory{
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TargetZoneChooser:public TargetChooser{
|
||||
public:
|
||||
int zones[10];
|
||||
@@ -70,16 +69,15 @@ class TargetZoneChooser:public TargetChooser{
|
||||
int targetsZone(MTGGameZone * z);
|
||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
virtual int canTarget(Targetable * _card);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
};
|
||||
|
||||
class CardTargetChooser:public TargetZoneChooser {
|
||||
|
||||
protected:
|
||||
MTGCardInstance * validTarget;
|
||||
public:
|
||||
CardTargetChooser(MTGCardInstance * _card, MTGCardInstance * source,int * _zones = NULL, int _nbzones = 0);
|
||||
virtual int canTarget(Targetable * target );
|
||||
CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
|
||||
@@ -89,7 +87,7 @@ class CreatureTargetChooser:public TargetZoneChooser{
|
||||
int maxtoughness;
|
||||
CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
virtual int canTarget(Targetable * _card);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
|
||||
};
|
||||
|
||||
@@ -98,7 +96,7 @@ class DamageableTargetChooser:public CreatureTargetChooser{
|
||||
public:
|
||||
DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets){};
|
||||
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser(card, _maxtargets){};
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
|
||||
@@ -107,7 +105,7 @@ protected:
|
||||
Player * p; //In Case we can only target a specific player
|
||||
public:
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
class TypeTargetChooser:public TargetZoneChooser{
|
||||
@@ -118,7 +116,7 @@ class TypeTargetChooser:public TargetZoneChooser{
|
||||
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
void addType(int type);
|
||||
void addType(const char * type);
|
||||
virtual int canTarget(Targetable * targe);
|
||||
virtual bool canTarget(Targetable * targe);
|
||||
};
|
||||
|
||||
class DescriptorTargetChooser:public TargetZoneChooser{
|
||||
@@ -126,7 +124,7 @@ class DescriptorTargetChooser:public TargetZoneChooser{
|
||||
CardDescriptor * cd;
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
~DescriptorTargetChooser();
|
||||
};
|
||||
|
||||
@@ -135,14 +133,14 @@ class SpellTargetChooser:public TargetChooser{
|
||||
public:
|
||||
int color;
|
||||
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 );
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
class SpellOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
int color;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1);
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
|
||||
@@ -152,13 +150,13 @@ class DamageTargetChooser:public TargetChooser{
|
||||
int color;
|
||||
int state;
|
||||
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
|
||||
class DamageOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
int color;
|
||||
DamageOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1);
|
||||
virtual int canTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class Targetable{
|
||||
public:
|
||||
virtual int typeAsTarget() = 0;
|
||||
virtual const char * getDisplayName() =0;
|
||||
virtual const string getDisplayName() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,6 @@ class TexturesCache{
|
||||
int nb_textures;
|
||||
int delete_previous;
|
||||
int totalsize;
|
||||
int maxSize;
|
||||
CardTexture * cache[MAX_CACHE_OBJECTS];
|
||||
public:
|
||||
int isInCache(MTGCard * card, int type=CACHE_CARD);
|
||||
@@ -55,8 +54,8 @@ class TexturesCache{
|
||||
int getCacheById(int id, int type=CACHE_CARD);
|
||||
JQuad * getQuad(MTGCard * card, int type=CACHE_CARD);
|
||||
JQuad * getThumb(MTGCard * card){return getQuad(card, CACHE_THUMB);};
|
||||
|
||||
};
|
||||
extern TexturesCache cache;
|
||||
|
||||
|
||||
class SampleCached{
|
||||
|
||||
+100
-96
@@ -1,96 +1,100 @@
|
||||
#ifndef _WEVENT_H_
|
||||
#define _WEVENT_H_
|
||||
|
||||
class MTGCardInstance;
|
||||
class MTGGameZone;
|
||||
class Damage;
|
||||
class Phase;
|
||||
class Targetable;
|
||||
|
||||
class WEvent{
|
||||
public:
|
||||
enum{
|
||||
NOT_SPECIFIED = 0,
|
||||
CHANGE_ZONE = 1,
|
||||
DAMAGE = 2,
|
||||
CHANGE_PHASE = 3,
|
||||
};
|
||||
int type; //Deprecated, use dynamic casting instead
|
||||
WEvent(int _type = NOT_SPECIFIED);
|
||||
virtual ~WEvent() {};
|
||||
};
|
||||
|
||||
class WEventZoneChange: public WEvent{
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
MTGGameZone * from;
|
||||
MTGGameZone * to;
|
||||
WEventZoneChange(MTGCardInstance * _card, MTGGameZone * _from, MTGGameZone *_to);
|
||||
virtual ~WEventZoneChange() {};
|
||||
};
|
||||
|
||||
|
||||
class WEventDamage: public WEvent{
|
||||
public:
|
||||
Damage * damage;
|
||||
WEventDamage(Damage * _damage);
|
||||
};
|
||||
|
||||
class WEventPhaseChange: public WEvent{
|
||||
public:
|
||||
Phase * from;
|
||||
Phase * to;
|
||||
WEventPhaseChange(Phase * _from, Phase * _to);
|
||||
};
|
||||
|
||||
|
||||
//Abstract class of event when a card's status changes
|
||||
class WEventCardUpdate: public WEvent{
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card):WEvent(),card(card){};
|
||||
};
|
||||
|
||||
//Event when a card is tapped/untapped
|
||||
class WEventCardTap: public WEventCardUpdate{
|
||||
public:
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
};
|
||||
|
||||
//Event when a card's "attacker" status changes
|
||||
//before:Player/Planeswalker that card was attacking previously
|
||||
//after: Player/Planeswalker that card is attacking now
|
||||
class WEventCreatureAttacker: public WEventCardUpdate{
|
||||
public:
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card,Targetable * from, Targetable * to);
|
||||
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
class WEventCreatureBlocker: public WEventCardUpdate{
|
||||
public:
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
|
||||
|
||||
};
|
||||
|
||||
//Event when a blocker is reordered
|
||||
//exchangeWith: exchange card's position with exchangeWith's position
|
||||
//attacker:both card and exchangeWith *should* be in attacker's "blockers" list.
|
||||
class WEventCreatureBlockerRank: public WEventCardUpdate{
|
||||
public:
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card,MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _WEVENT_H_
|
||||
#define _WEVENT_H_
|
||||
|
||||
class MTGCardInstance;
|
||||
class MTGGameZone;
|
||||
class Damage;
|
||||
class Phase;
|
||||
class Targetable;
|
||||
|
||||
class WEvent{
|
||||
public:
|
||||
enum{
|
||||
NOT_SPECIFIED = 0,
|
||||
CHANGE_ZONE = 1,
|
||||
DAMAGE = 2,
|
||||
CHANGE_PHASE = 3,
|
||||
};
|
||||
int type; //Deprecated, use dynamic casting instead
|
||||
WEvent(int type = NOT_SPECIFIED);
|
||||
virtual ~WEvent() {};
|
||||
};
|
||||
|
||||
struct WEventZoneChange: public WEvent{
|
||||
MTGCardInstance * card;
|
||||
MTGGameZone * from;
|
||||
MTGGameZone * to;
|
||||
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
|
||||
virtual ~WEventZoneChange() {};
|
||||
};
|
||||
|
||||
|
||||
struct WEventDamage: public WEvent{
|
||||
Damage * damage;
|
||||
WEventDamage(Damage * damage);
|
||||
};
|
||||
|
||||
struct WEventPhaseChange: public WEvent{
|
||||
Phase * from;
|
||||
Phase * to;
|
||||
WEventPhaseChange(Phase * from, Phase * to);
|
||||
};
|
||||
|
||||
|
||||
//Abstract class of event when a card's status changes
|
||||
struct WEventCardUpdate: public WEvent{
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
//Event when a card is tapped/untapped
|
||||
struct WEventCardTap: public WEventCardUpdate{
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
};
|
||||
|
||||
//Event when a card's "attacker" status changes
|
||||
//before:Player/Planeswalker that card was attacking previously
|
||||
//after: Player/Planeswalker that card is attacking now
|
||||
struct WEventCreatureAttacker: public WEventCardUpdate{
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to);
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
struct WEventCreatureBlocker: public WEventCardUpdate{
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
|
||||
};
|
||||
|
||||
//Event when a blocker is reordered
|
||||
//exchangeWith: exchange card's position with exchangeWith's position
|
||||
//attacker:both card and exchangeWith *should* be in attacker's "blockers" list.
|
||||
struct WEventCreatureBlockerRank: public WEventCardUpdate{
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card,MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
|
||||
|
||||
};
|
||||
|
||||
//Event when a mana is engaged
|
||||
//color : color
|
||||
struct WEventEngageMana : public WEvent {
|
||||
int color;
|
||||
MTGCardInstance* card;
|
||||
WEventEngageMana(int color, MTGCardInstance* card);
|
||||
};
|
||||
|
||||
//Event when a mana is consumed
|
||||
//color : color
|
||||
struct WEventConsumeMana : public WEvent {
|
||||
int color;
|
||||
WEventConsumeMana(int color);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,4 +26,11 @@
|
||||
#define RESPATH "Res"
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user