* Remove ^M's.
* Re-indent automatically.
* Remove whitespace at the end of lines.
This commit is contained in:
jean.chalard
2008-11-12 13:45:42 +00:00
parent 6ad6f9b668
commit c97dd1f260
116 changed files with 18073 additions and 18073 deletions
+8 -8
View File
@@ -1,8 +1,8 @@
/* /*
* Wagic, The Homebrew ?! is licensed under the BSD license * Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root * See LICENSE in the Folder's root
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
#ifndef _IAPLAYER_H #ifndef _IAPLAYER_H
#define _IAPLAYER_H #define _IAPLAYER_H
@@ -17,7 +17,7 @@
class AIStats; class AIStats;
class AIPlayer: public Player{ class AIPlayer: public Player{
protected: protected:
MTGCardInstance * nextCardToPlay; MTGCardInstance * nextCardToPlay;
ManaCost * potentialMana; ManaCost * potentialMana;
void tapLandsForMana(ManaCost * potentialMana, ManaCost * cost); void tapLandsForMana(ManaCost * potentialMana, ManaCost * cost);
@@ -28,7 +28,7 @@ protected:
int effectBadOrGood(MTGCardInstance * card); int effectBadOrGood(MTGCardInstance * card);
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0); int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
AIStats * getStats(); AIStats * getStats();
public: public:
virtual int displayStack(){return 0;} virtual int displayStack(){return 0;}
AIStats * stats; AIStats * stats;
ManaCost * getPotentialMana(); ManaCost * getPotentialMana();
@@ -43,11 +43,11 @@ public:
class AIPlayerBaka: public AIPlayer{ class AIPlayerBaka: public AIPlayer{
protected: protected:
int oldGamePhase; int oldGamePhase;
int timer; int timer;
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type); MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
public: public:
AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile); AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile);
virtual int Act(float dt); virtual int Act(float dt);
void initTimer(); void initTimer();
+2 -2
View File
@@ -14,7 +14,7 @@ class MTGCard;
class Damage; class Damage;
class AIStat{ class AIStat{
public: public:
int source; //MTGId of the card int source; //MTGId of the card
int value; int value;
int occurences; int occurences;
@@ -25,7 +25,7 @@ public:
class AIStats{ class AIStats{
public: public:
Player * player; Player * player;
string filename; string filename;
list<AIStat *> stats; list<AIStat *> stats;
+6 -6
View File
@@ -1,8 +1,8 @@
/* /*
* Wagic, The Homebrew ?! is licensed under the BSD license * Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root * See LICENSE in the Folder's root
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
#ifndef _ACTIONELEMENT_H_ #ifndef _ACTIONELEMENT_H_
#define _ACTIONELEMENT_H_ #define _ACTIONELEMENT_H_
@@ -18,12 +18,12 @@ class Targetable;
class TargetChooser; class TargetChooser;
class ActionElement: public JGuiObject{ class ActionElement: public JGuiObject{
protected: protected:
int activeState; int activeState;
public: public:
TargetChooser * tc; TargetChooser * tc;
int currentPhase; int currentPhase;
int newPhase; int newPhase;
+4 -4
View File
@@ -1,8 +1,8 @@
/* /*
* Wagic, The Homebrew ?! is licensed under the BSD license * Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root * See LICENSE in the Folder's root
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
#ifndef _ACTIONLAYER_H_ #ifndef _ACTIONLAYER_H_
#define _ACTIONLAYER_H_ #define _ACTIONLAYER_H_
+13 -13
View File
@@ -1,8 +1,8 @@
/* /*
* Wagic, The Homebrew ?! is licensed under the BSD license * Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root * See LICENSE in the Folder's root
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
#ifndef _SPELLSTACK_H_ #ifndef _SPELLSTACK_H_
#define _SPELLSTACK_H_ #define _SPELLSTACK_H_
@@ -43,7 +43,7 @@ class ManaCost;
#define ACTIONSTACK_TARGET 1 #define ACTIONSTACK_TARGET 1
class Interruptible: public PlayGuiObject, public Targetable{ class Interruptible: public PlayGuiObject, public Targetable{
public: public:
int state, display; int state, display;
MTGCardInstance * source; MTGCardInstance * source;
virtual void Entering(){mHasFocus = true;}; virtual void Entering(){mHasFocus = true;};
@@ -56,16 +56,16 @@ public:
}; };
class NextGamePhase: public Interruptible { class NextGamePhase: public Interruptible {
public: public:
int resolve(); int resolve();
void Render(); void Render();
NextGamePhase(int id); NextGamePhase(int id);
}; };
class Spell: public Interruptible, public TargetsList { class Spell: public Interruptible, public TargetsList {
protected: protected:
public: public:
ManaCost * cost; ManaCost * cost;
Spell(MTGCardInstance* _source); Spell(MTGCardInstance* _source);
Spell(int id, MTGCardInstance* _source, Targetable * _targets[], int _nbtargets, ManaCost * _cost); Spell(int id, MTGCardInstance* _source, Targetable * _targets[], int _nbtargets, ManaCost * _cost);
@@ -75,7 +75,7 @@ public:
}; };
class StackAbility: public Interruptible { class StackAbility: public Interruptible {
public: public:
MTGAbility * ability; MTGAbility * ability;
int resolve(); int resolve();
void Render(); void Render();
@@ -83,7 +83,7 @@ public:
}; };
class PutInGraveyard: public Interruptible { class PutInGraveyard: public Interruptible {
public: public:
MTGCardInstance * card; MTGCardInstance * card;
int removeFromGame; int removeFromGame;
int resolve(); int resolve();
@@ -93,7 +93,7 @@ public:
class DrawAction: public Interruptible { class DrawAction: public Interruptible {
public: public:
int nbcards; int nbcards;
Player * player; Player * player;
int resolve(); int resolve();
@@ -102,7 +102,7 @@ public:
}; };
class ActionStack :public GuiLayer{ class ActionStack :public GuiLayer{
protected: protected:
int interruptDecision[2]; int interruptDecision[2];
int timer; int timer;
int currentState; int currentState;
@@ -113,7 +113,7 @@ protected:
void unpackDamageStacks(); void unpackDamageStacks();
void unpackDamageStack(DamageStack * ds); void unpackDamageStack(DamageStack * ds);
void repackDamageStacks(); void repackDamageStacks();
public: public:
int setIsInterrupting(Player * player); int setIsInterrupting(Player * player);
int count( int type = 0 , int state = 0 , int display = -1); int count( int type = 0 , int state = 0 , int display = -1);
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1); Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
+111 -111
View File
@@ -18,14 +18,14 @@
using std::map; using std::map;
/* /*
Generic classes Generic classes
*/ */
//Drawer, allows to draw a card for a cost: //Drawer, allows to draw a card for a cost:
class ADrawer:public ActivatedAbility{ class ADrawer:public ActivatedAbility{
public: public:
int nbcards; int nbcards;
ADrawer(int _id, MTGCardInstance * card,ManaCost * _cost, int _nbcards = 1, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap),nbcards(_nbcards){ ADrawer(int _id, MTGCardInstance * card,ManaCost * _cost, int _nbcards = 1, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap),nbcards(_nbcards){
} }
@@ -39,7 +39,7 @@ public:
//Destroyer. TargetAbility //Destroyer. TargetAbility
class ADestroyer:public TargetAbility{ class ADestroyer:public TargetAbility{
public: public:
int bury; int bury;
ADestroyer(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL, int _bury = 0):TargetAbility(_id,_source, tc),bury(_bury){ ADestroyer(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL, int _bury = 0):TargetAbility(_id,_source, tc),bury(_bury){
if (!tc) tc = NEW CreatureTargetChooser(); if (!tc) tc = NEW CreatureTargetChooser();
@@ -62,20 +62,20 @@ public:
//Destroyer. TargetAbility //Destroyer. TargetAbility
class ABurier:public ADestroyer{ class ABurier:public ADestroyer{
public: public:
ABurier(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL):ADestroyer(_id,_source, tc,1){ ABurier(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL):ADestroyer(_id,_source, tc,1){
} }
}; };
/*Changes one of the basic abilities of target /*Changes one of the basic abilities of target
source : spell source : spell
target : spell target (creature) target : spell target (creature)
modifier : 1 to add the ability, 0 to remove it modifier : 1 to add the ability, 0 to remove it
_ability : Id of the ability, as described in mtgdefinitions _ability : Id of the ability, as described in mtgdefinitions
*/ */
class ABasicAbilityModifier:public MTGAbility{ class ABasicAbilityModifier:public MTGAbility{
public: public:
int modifier; int modifier;
int ability; int ability;
int value_before_modification; int value_before_modification;
@@ -139,7 +139,7 @@ class ABasicAbilityModifierUntilEOT:public TargetAbility{
/*Instants that modifies a basic ability until end of turn */ /*Instants that modifies a basic ability until end of turn */
class AInstantBasicAbilityModifierUntilEOT: public InstantAbility{ class AInstantBasicAbilityModifierUntilEOT: public InstantAbility{
public: public:
int stateBeforeActivation; int stateBeforeActivation;
int ability; int ability;
AInstantBasicAbilityModifierUntilEOT(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _ability, int value):InstantAbility(_id, _source, _target),ability(_ability){ AInstantBasicAbilityModifierUntilEOT(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _ability, int value):InstantAbility(_id, _source, _target),ability(_ability){
@@ -156,7 +156,7 @@ public:
//Alteration of Ability until of turn (Aura) //Alteration of Ability until of turn (Aura)
class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{
public: public:
int stateBeforeActivation; int stateBeforeActivation;
int ability; int ability;
int value; int value;
@@ -186,7 +186,7 @@ public:
/*Gives life each time a spell matching CardDescriptor's criteria are match . Optionnal manacost*/ /*Gives life each time a spell matching CardDescriptor's criteria are match . Optionnal manacost*/
class ASpellCastLife:public MTGAbility{ class ASpellCastLife:public MTGAbility{
public: public:
CardDescriptor trigger; CardDescriptor trigger;
ManaCost * cost; ManaCost * cost;
int life; int life;
@@ -226,7 +226,7 @@ public:
//Allows to untap at any moment for an amount of mana //Allows to untap at any moment for an amount of mana
class AUnBlocker:public MTGAbility{ class AUnBlocker:public MTGAbility{
public: public:
ManaCost * cost; ManaCost * cost;
AUnBlocker(int id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost):MTGAbility(id, _source, _target), cost(_cost){ AUnBlocker(int id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost):MTGAbility(id, _source, _target), cost(_cost){
} }
@@ -251,7 +251,7 @@ public:
//Allows to untap target card once per turn for a manaCost //Allows to untap target card once per turn for a manaCost
class AUntaperOnceDuringTurn:public AUnBlocker{ class AUntaperOnceDuringTurn:public AUnBlocker{
public: public:
int untappedThisTurn; int untappedThisTurn;
int onlyPlayerTurn; int onlyPlayerTurn;
AUntaperOnceDuringTurn(int id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, int _onlyPlayerTurn = 1):AUnBlocker(id, _source, _target, _cost){ AUntaperOnceDuringTurn(int id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, int _onlyPlayerTurn = 1):AUnBlocker(id, _source, _target, _cost){
@@ -278,7 +278,7 @@ public:
//Alteration of Power and Toughness (enchantments) //Alteration of Power and Toughness (enchantments)
class APowerToughnessModifier: public MTGAbility{ class APowerToughnessModifier: public MTGAbility{
public: public:
int power, toughness; int power, toughness;
APowerToughnessModifier(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness):MTGAbility(id,_source,_target),power(_power),toughness(_toughness){ APowerToughnessModifier(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness):MTGAbility(id,_source,_target),power(_power),toughness(_toughness){
_target->power += power; _target->power += power;
@@ -294,7 +294,7 @@ public:
// Permanent life alteration evry turn of the target's controller. Useful only for unstable mutation currently // Permanent life alteration evry turn of the target's controller. Useful only for unstable mutation currently
class APowerToughnessModifierRegularCounter:public MTGAbility{ class APowerToughnessModifierRegularCounter:public MTGAbility{
public: public:
int power, toughness; int power, toughness;
int phase; int phase;
APowerToughnessModifierRegularCounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _phase, int _power, int _toughness):MTGAbility(id,_source,_target),power(_power),toughness(_toughness), phase(_phase){ APowerToughnessModifierRegularCounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _phase, int _power, int _toughness):MTGAbility(id,_source,_target),power(_power),toughness(_toughness), phase(_phase){
@@ -313,7 +313,7 @@ public:
//Alteration of Power and Toughness until end of turn (TargetAbility) //Alteration of Power and Toughness until end of turn (TargetAbility)
// Gives +n/+m until end of turn to any card that's a target // Gives +n/+m until end of turn to any card that's a target
class ATargetterPowerToughnessModifierUntilEOT: public TargetAbility{ class ATargetterPowerToughnessModifierUntilEOT: public TargetAbility{
public: public:
MTGCardInstance * mTargets[50]; MTGCardInstance * mTargets[50];
int nbTargets; int nbTargets;
int power, toughness; int power, toughness;
@@ -356,7 +356,7 @@ public:
//Alteration of Power and Toughness until end of turn (Aura) //Alteration of Power and Toughness until end of turn (Aura)
class APowerToughnessModifierUntilEndOfTurn: public MTGAbility{ class APowerToughnessModifierUntilEndOfTurn: public MTGAbility{
public: public:
int power, toughness; int power, toughness;
int counters; int counters;
int maxcounters; int maxcounters;
@@ -397,7 +397,7 @@ public:
//Alteration of Power and toughness until end of turn (instant) //Alteration of Power and toughness until end of turn (instant)
class AInstantPowerToughnessModifierUntilEOT: public InstantAbility{ class AInstantPowerToughnessModifierUntilEOT: public InstantAbility{
public: public:
int power, toughness; int power, toughness;
AInstantPowerToughnessModifierUntilEOT(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness): InstantAbility(_id, _source, _target), power(_power), toughness(_toughness){ AInstantPowerToughnessModifierUntilEOT(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness): InstantAbility(_id, _source, _target), power(_power), toughness(_toughness){
} }
@@ -417,7 +417,7 @@ public:
}; };
//Untap Blockers with simple Mana Mechanism //Untap Blockers with simple Mana Mechanism
class AUntapManaBlocker: public Blocker{ class AUntapManaBlocker: public Blocker{
public: public:
AUntapManaBlocker(int id, MTGCardInstance * card, ManaCost * _cost):Blocker(id, card, _cost){ AUntapManaBlocker(int id, MTGCardInstance * card, ManaCost * _cost):Blocker(id, card, _cost){
} }
@@ -428,7 +428,7 @@ public:
/* Spell Counters (Enchantment) for a mana cost */ /* Spell Counters (Enchantment) for a mana cost */
//LifeForce //LifeForce
class ASpellCounterEnchantment:public TargetAbility{ class ASpellCounterEnchantment:public TargetAbility{
public: public:
ASpellCounterEnchantment(int _id, MTGCardInstance * _source, ManaCost * _cost,int color = -1, int _tap = 0):TargetAbility(_id,_source,NEW SpellTargetChooser(_source,color),_cost,0,_tap){ ASpellCounterEnchantment(int _id, MTGCardInstance * _source, ManaCost * _cost,int color = -1, int _tap = 0):TargetAbility(_id,_source,NEW SpellTargetChooser(_source,color),_cost,0,_tap){
} }
@@ -450,14 +450,14 @@ public:
other solutions need to be provided for abilities that add mana (ex: mana flare) other solutions need to be provided for abilities that add mana (ex: mana flare)
*/ */
/* /*
Currently the mana is added to the pool AFTER the animation Currently the mana is added to the pool AFTER the animation
This is VERY BAD, since we don't have any control on the duration of the animation. This can lead to bugs with This is VERY BAD, since we don't have any control on the duration of the animation. This can lead to bugs with
the AI, who is expecting to have the mana in its manapool right after clicking the land card !!! the AI, who is expecting to have the mana in its manapool right after clicking the land card !!!
The sum of "dt" has to be 0.25 for the mana to be in the manapool currently The sum of "dt" has to be 0.25 for the mana to be in the manapool currently
*/ */
class AManaProducer: public MTGAbility{ class AManaProducer: public MTGAbility{
protected: protected:
ManaCost * cost; ManaCost * cost;
ManaCost * output; ManaCost * output;
string menutext; string menutext;
@@ -466,7 +466,7 @@ protected:
Player * controller; Player * controller;
hgeParticleSystem * mParticleSys; hgeParticleSystem * mParticleSys;
public: public:
AManaProducer(int id, MTGCardInstance * card, ManaCost * _output, ManaCost * _cost = NULL ):MTGAbility(id, card){ AManaProducer(int id, MTGCardInstance * card, ManaCost * _output, ManaCost * _cost = NULL ):MTGAbility(id, card){
LOG("==Creating ManaProducer Object"); LOG("==Creating ManaProducer Object");
cost = _cost; cost = _cost;
@@ -607,7 +607,7 @@ public:
/* Lifelink Ability */ /* Lifelink Ability */
class ALifeLink:public MTGAbility{ class ALifeLink:public MTGAbility{
public: public:
int nbdamagesthisturn; int nbdamagesthisturn;
Damage * lastDamage; Damage * lastDamage;
ALifeLink(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ ALifeLink(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
@@ -638,7 +638,7 @@ public:
//Circle of Protections //Circle of Protections
class ACircleOfProtection: public TargetAbility{ class ACircleOfProtection: public TargetAbility{
public: public:
ACircleOfProtection(int _id, MTGCardInstance * source, int _color):TargetAbility(_id,source,NEW DamageTargetChooser(source,_color),NEW ManaCost(),0,0){ ACircleOfProtection(int _id, MTGCardInstance * source, int _color):TargetAbility(_id,source,NEW DamageTargetChooser(source,_color),NEW ManaCost(),0,0){
cost->add(MTG_COLOR_ARTIFACT,1); cost->add(MTG_COLOR_ARTIFACT,1);
} }
@@ -653,7 +653,7 @@ public:
//Basic regeneration mechanism for a Mana cost //Basic regeneration mechanism for a Mana cost
class AStandardRegenerate:public ActivatedAbility{ class AStandardRegenerate:public ActivatedAbility{
public: public:
AStandardRegenerate(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost):ActivatedAbility(_id,_source,_cost,0,0){ AStandardRegenerate(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost):ActivatedAbility(_id,_source,_cost,0,0){
target = _target; target = _target;
} }
@@ -678,7 +678,7 @@ public:
/*Gives protection to a target */ /*Gives protection to a target */
class AProtectionFrom:public MTGAbility{ class AProtectionFrom:public MTGAbility{
public: public:
CardDescriptor * cd; CardDescriptor * cd;
void initProtection(){ void initProtection(){
((MTGCardInstance *)target)->addProtection(cd); ((MTGCardInstance *)target)->addProtection(cd);
@@ -702,7 +702,7 @@ public:
//Aura Enchantments that provide controller of target life or damages at a given phase of their turn //Aura Enchantments that provide controller of target life or damages at a given phase of their turn
class ARegularLifeModifierAura:public MTGAbility{ class ARegularLifeModifierAura:public MTGAbility{
public: public:
int life; int life;
int phase; int phase;
int onlyIfTargetTapped; int onlyIfTargetTapped;
@@ -725,7 +725,7 @@ public:
//ExaltedAbility (Shards of Alara) //ExaltedAbility (Shards of Alara)
class AExalted:public ListMaintainerAbility{ class AExalted:public ListMaintainerAbility{
public: public:
int power, toughness; int power, toughness;
MTGCardInstance * luckyWinner; MTGCardInstance * luckyWinner;
AExalted(int _id, MTGCardInstance * _source, int _power = 1, int _toughness = 1):ListMaintainerAbility(_id, _source),power(_power),toughness(_toughness){ AExalted(int _id, MTGCardInstance * _source, int _power = 1, int _toughness = 1):ListMaintainerAbility(_id, _source),power(_power),toughness(_toughness){
@@ -767,7 +767,7 @@ public:
//ExaltedAbility for basic abilities (Shards of Alara) //ExaltedAbility for basic abilities (Shards of Alara)
class AExaltedAbility:public ListMaintainerAbility{ class AExaltedAbility:public ListMaintainerAbility{
public: public:
int ability; int ability;
MTGCardInstance * luckyWinner; MTGCardInstance * luckyWinner;
AExaltedAbility(int _id, MTGCardInstance * _source, int _ability):ListMaintainerAbility(_id, _source),ability(_ability){ AExaltedAbility(int _id, MTGCardInstance * _source, int _ability):ListMaintainerAbility(_id, _source),ability(_ability){
@@ -804,7 +804,7 @@ public:
//Converts lands to creatures (Kormus bell, Living lands) //Converts lands to creatures (Kormus bell, Living lands)
class AConvertLandToCreatures:public ListMaintainerAbility{ class AConvertLandToCreatures:public ListMaintainerAbility{
public: public:
int type; int type;
int power, toughness; int power, toughness;
AConvertLandToCreatures(int _id, MTGCardInstance * _source, const char * _type, int _power = 1, int _toughness = 1):ListMaintainerAbility(_id, _source),power(_power),toughness(_toughness){ AConvertLandToCreatures(int _id, MTGCardInstance * _source, const char * _type, int _power = 1, int _toughness = 1):ListMaintainerAbility(_id, _source),power(_power),toughness(_toughness){
@@ -833,7 +833,7 @@ public:
//Lords (Merfolk lord...) give power and toughness to OTHER creatures of their type, they can give them special abilities, regeneration //Lords (Merfolk lord...) give power and toughness to OTHER creatures of their type, they can give them special abilities, regeneration
class ALord:public ListMaintainerAbility{ class ALord:public ListMaintainerAbility{
public: public:
string type; string type;
int power, toughness; int power, toughness;
int ability; int ability;
@@ -881,7 +881,7 @@ public:
//Lords (Merfolk lord...) give power and toughness to OTHER creatures of a given color, they can give them special abilities, regeneration //Lords (Merfolk lord...) give power and toughness to OTHER creatures of a given color, they can give them special abilities, regeneration
class AColorLord:public ListMaintainerAbility{ class AColorLord:public ListMaintainerAbility{
public: public:
int color; int color;
int notcolor; int notcolor;
int power, toughness; int power, toughness;
@@ -936,7 +936,7 @@ public:
/* Standard Damager, can choose a NEW target each time the price is paid */ /* Standard Damager, can choose a NEW target each time the price is paid */
class ADamager:public TargetAbility{ class ADamager:public TargetAbility{
public: public:
int damage; int damage;
ADamager(int id, MTGCardInstance * card, ManaCost * _cost, int _damage, TargetChooser * _tc = NULL, int _tap = 1):TargetAbility(id,card, _tc, _cost,0,_tap),damage(_damage){ ADamager(int id, MTGCardInstance * card, ManaCost * _cost, int _damage, TargetChooser * _tc = NULL, int _tap = 1):TargetAbility(id,card, _tc, _cost,0,_tap),damage(_damage){
if (!tc) tc = NEW DamageableTargetChooser(card); if (!tc) tc = NEW DamageableTargetChooser(card);
@@ -952,7 +952,7 @@ public:
/* Can tap a target for a cost */ /* Can tap a target for a cost */
class ATapper:public TargetAbility{ class ATapper:public TargetAbility{
public: public:
int damage; int damage;
ATapper(int id, MTGCardInstance * card, ManaCost * _cost, TargetChooser * _chooser):TargetAbility(id,card, _chooser, _cost){ ATapper(int id, MTGCardInstance * card, ManaCost * _cost, TargetChooser * _chooser):TargetAbility(id,card, _chooser, _cost){
} }
@@ -970,7 +970,7 @@ public:
// Add life of gives damage if a given zone has more or less than [condition] cards at the beginning of [phase] // Add life of gives damage if a given zone has more or less than [condition] cards at the beginning of [phase]
//Ex : the rack, ivory tower... //Ex : the rack, ivory tower...
class ALifeZoneLink:public MTGAbility{ class ALifeZoneLink:public MTGAbility{
public: public:
int phase; int phase;
int condition; int condition;
int life; int life;
@@ -1012,7 +1012,7 @@ public:
//Creatures that cannot attack if opponent has not a given type of land, and die if controller has not this type of land //Creatures that cannot attack if opponent has not a given type of land, and die if controller has not this type of land
//Ex : pirate ship... //Ex : pirate ship...
class AStrongLandLinkCreature: public MTGAbility{ class AStrongLandLinkCreature: public MTGAbility{
public: public:
char land[20]; char land[20];
AStrongLandLinkCreature(int _id, MTGCardInstance * _source, const char * _land):MTGAbility(_id, _source){ AStrongLandLinkCreature(int _id, MTGCardInstance * _source, const char * _land):MTGAbility(_id, _source){
sprintf(land,"%s",_land); sprintf(land,"%s",_land);
@@ -1035,7 +1035,7 @@ public:
//Steal control of a target //Steal control of a target
class AControlStealAura: public MTGAbility{ class AControlStealAura: public MTGAbility{
public: public:
Player * originalController; Player * originalController;
AControlStealAura(int _id , MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){ AControlStealAura(int _id , MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){
originalController = _target->controller(); originalController = _target->controller();
@@ -1054,7 +1054,7 @@ public:
//Ability to untap a target //Ability to untap a target
class AUntaper:public TargetAbility{ class AUntaper:public TargetAbility{
public: public:
AUntaper(int _id, MTGCardInstance * card, ManaCost * _manacost, TargetChooser * _tc):TargetAbility(_id,card,_tc,_manacost){ AUntaper(int _id, MTGCardInstance * card, ManaCost * _manacost, TargetChooser * _tc):TargetAbility(_id,card,_tc,_manacost){
} }
@@ -1068,7 +1068,7 @@ public:
//Same as StealControl Aura ???? Obsolete ? //Same as StealControl Aura ???? Obsolete ?
class ATakeControlAura:public MTGAbility{ class ATakeControlAura:public MTGAbility{
public: public:
Player * previousController; Player * previousController;
ATakeControlAura(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){ ATakeControlAura(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){
previousController = _target->controller(); previousController = _target->controller();
@@ -1089,7 +1089,7 @@ public:
//Creatures that kill their blockers //Creatures that kill their blockers
//Ex : Cockatrice //Ex : Cockatrice
class AOldSchoolDeathtouch:public MTGAbility{ class AOldSchoolDeathtouch:public MTGAbility{
public: public:
MTGCardInstance * opponents[20]; MTGCardInstance * opponents[20];
int nbOpponents; int nbOpponents;
AOldSchoolDeathtouch(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AOldSchoolDeathtouch(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
@@ -1126,7 +1126,7 @@ public:
//Converts a card to a creature (Aura) //Converts a card to a creature (Aura)
class AConvertToCreatureAura:public MTGAbility{ class AConvertToCreatureAura:public MTGAbility{
public: public:
AConvertToCreatureAura(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness):MTGAbility(_id, _source, _target){ AConvertToCreatureAura(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness):MTGAbility(_id, _source, _target){
_target->setSubtype("creature"); _target->setSubtype("creature");
_target->power = _power; _target->power = _power;
@@ -1144,7 +1144,7 @@ public:
}; };
/* /*
Specific Classes Specific Classes
*/ */
// 1092 Specific to Aladdin's Lamp // 1092 Specific to Aladdin's Lamp
@@ -1209,7 +1209,7 @@ class AAladdinsLamp: public TargetAbility{
//Ankh of Mishra //Ankh of Mishra
class AAnkhOfMishra: public MTGAbility{ class AAnkhOfMishra: public MTGAbility{
public: public:
int playerLands[2]; int playerLands[2];
AAnkhOfMishra(int id, MTGCardInstance * _source):MTGAbility(id, _source){ AAnkhOfMishra(int id, MTGCardInstance * _source):MTGAbility(id, _source){
for (int i=0; i< 2; i++){ for (int i=0; i< 2; i++){
@@ -1232,7 +1232,7 @@ public:
// Armageddon Clock // Armageddon Clock
class AArmageddonClock:public MTGAbility{ class AArmageddonClock:public MTGAbility{
public: public:
int counters; int counters;
ManaCost cost; ManaCost cost;
AArmageddonClock(int id, MTGCardInstance * _source):MTGAbility(id, _source){ AArmageddonClock(int id, MTGCardInstance * _source):MTGAbility(id, _source){
@@ -1271,7 +1271,7 @@ public:
//Black Vise //Black Vise
class ABlackVise: public MTGAbility{ class ABlackVise: public MTGAbility{
public: public:
int nbcards; int nbcards;
ABlackVise(int id, MTGCardInstance * _source):MTGAbility(id, _source){ ABlackVise(int id, MTGCardInstance * _source):MTGAbility(id, _source){
nbcards = game->opponent()->game->hand->nb_cards; nbcards = game->opponent()->game->hand->nb_cards;
@@ -1290,7 +1290,7 @@ public:
//Channel //Channel
class AChannel:public ActivatedAbility{ class AChannel:public ActivatedAbility{
public: public:
AChannel(int _id, MTGCardInstance * card):ActivatedAbility(_id, card,0,0,0){ AChannel(int _id, MTGCardInstance * card):ActivatedAbility(_id, card,0,0,0){
} }
@@ -1319,7 +1319,7 @@ public:
// Clockwork Beast // Clockwork Beast
class AClockworkBeast:public MTGAbility{ class AClockworkBeast:public MTGAbility{
public: public:
int counters; int counters;
ManaCost cost; ManaCost cost;
AClockworkBeast(int id, MTGCardInstance * _source):MTGAbility(id, _source){ AClockworkBeast(int id, MTGCardInstance * _source):MTGAbility(id, _source){
@@ -1358,7 +1358,7 @@ public:
//1102: Conservator //1102: Conservator
class AConservator: public MTGAbility{ class AConservator: public MTGAbility{
public: public:
int canprevent; int canprevent;
ManaCost cost; ManaCost cost;
AConservator(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AConservator(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
@@ -1426,7 +1426,7 @@ public:
//Creature bond //Creature bond
class ACreatureBond:public TriggeredAbility{ class ACreatureBond:public TriggeredAbility{
public: public:
int resolved; int resolved;
ACreatureBond(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source,_target){ ACreatureBond(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source,_target){
resolved = 1; resolved = 1;
@@ -1459,7 +1459,7 @@ public:
//1105: Dingus Egg //1105: Dingus Egg
class ADingusEgg: public MTGAbility{ class ADingusEgg: public MTGAbility{
public: public:
int playerLands[2]; int playerLands[2];
ADingusEgg(int id, MTGCardInstance * _source):MTGAbility(id, _source){ ADingusEgg(int id, MTGCardInstance * _source):MTGAbility(id, _source){
for (int i=0; i< 2; i++){ for (int i=0; i< 2; i++){
@@ -1482,7 +1482,7 @@ public:
//1106 DisruptingScepter //1106 DisruptingScepter
class ADisruptingScepter:public TargetAbility{ class ADisruptingScepter:public TargetAbility{
public: public:
ADisruptingScepter(int id, MTGCardInstance * _source):TargetAbility(id,_source){ ADisruptingScepter(int id, MTGCardInstance * _source):TargetAbility(id,_source){
MTGGameZone * zones[] = {GameObserver::GetInstance()->opponent()->game->hand}; MTGGameZone * zones[] = {GameObserver::GetInstance()->opponent()->game->hand};
tc = NEW TargetZoneChooser(zones,1,_source); tc = NEW TargetZoneChooser(zones,1,_source);
@@ -1514,7 +1514,7 @@ public:
//1108 Ebony Horse //1108 Ebony Horse
class AEbonyHorse:public TargetAbility{ class AEbonyHorse:public TargetAbility{
public: public:
AEbonyHorse(int _id, MTGCardInstance * _source):TargetAbility(_id,_source, NEW CreatureTargetChooser()){ AEbonyHorse(int _id, MTGCardInstance * _source):TargetAbility(_id,_source, NEW CreatureTargetChooser()){
int _cost[] = {MTG_COLOR_ARTIFACT, 2}; int _cost[] = {MTG_COLOR_ARTIFACT, 2};
@@ -1530,7 +1530,7 @@ public:
//1345 Farmstead //1345 Farmstead
class AFarmstead:public ActivatedAbility{ class AFarmstead:public ActivatedAbility{
public: public:
AFarmstead(int _id, MTGCardInstance * source, MTGCardInstance * _target):ActivatedAbility(_id, source,0,1,0){ AFarmstead(int _id, MTGCardInstance * source, MTGCardInstance * _target):ActivatedAbility(_id, source,0,1,0){
int _cost[] = {MTG_COLOR_WHITE, 2}; int _cost[] = {MTG_COLOR_WHITE, 2};
cost = NEW ManaCost(_cost,1); cost = NEW ManaCost(_cost,1);
@@ -1552,7 +1552,7 @@ public:
//1110 Glasses of Urza //1110 Glasses of Urza
class AGlassesOfUrza:public MTGAbility{ class AGlassesOfUrza:public MTGAbility{
public: public:
CardDisplay * display; CardDisplay * display;
AGlassesOfUrza(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AGlassesOfUrza(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
display = NEW CardDisplay(0, game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL); display = NEW CardDisplay(0, game,SCREEN_WIDTH/2, SCREEN_HEIGHT/2,NULL);
@@ -1600,7 +1600,7 @@ public:
//1112 Howling Mine //1112 Howling Mine
class AHowlingMine:public MTGAbility{ class AHowlingMine:public MTGAbility{
public: public:
AHowlingMine(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){} AHowlingMine(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){}
void Update(float dt){ void Update(float dt){
@@ -1612,7 +1612,7 @@ public:
//1119 Jayemdae Tome //1119 Jayemdae Tome
class AJayemdaeTome:public ActivatedAbility{ class AJayemdaeTome:public ActivatedAbility{
public: public:
AJayemdaeTome(int _id, MTGCardInstance * card):ActivatedAbility(_id, card){ AJayemdaeTome(int _id, MTGCardInstance * card):ActivatedAbility(_id, card){
int _cost[] = {MTG_COLOR_ARTIFACT, 4}; int _cost[] = {MTG_COLOR_ARTIFACT, 4};
cost = NEW ManaCost(_cost,1); cost = NEW ManaCost(_cost,1);
@@ -1627,7 +1627,7 @@ public:
//Living Artifact //Living Artifact
class ALivingArtifact:public MTGAbility{ class ALivingArtifact:public MTGAbility{
public: public:
int usedThisTurn; int usedThisTurn;
int counters; int counters;
Damage * latest; Damage * latest;
@@ -1667,7 +1667,7 @@ public:
//Lord of the Pit //Lord of the Pit
class ALordOfThePit: public TargetAbility{ class ALordOfThePit: public TargetAbility{
public: public:
int paidThisTurn; int paidThisTurn;
ALordOfThePit(int _id, MTGCardInstance * source):TargetAbility(_id, source, NEW CreatureTargetChooser(),0,1,0){ ALordOfThePit(int _id, MTGCardInstance * source):TargetAbility(_id, source, NEW CreatureTargetChooser(),0,1,0){
paidThisTurn = 1; paidThisTurn = 1;
@@ -1702,7 +1702,7 @@ public:
}; };
//1143 Animate Dead //1143 Animate Dead
class AAnimateDead:public MTGAbility{ class AAnimateDead:public MTGAbility{
public: public:
AAnimateDead(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){ AAnimateDead(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){
MTGCardInstance * card = _target; MTGCardInstance * card = _target;
card->power--; card->power--;
@@ -1725,7 +1725,7 @@ public:
//1144 Bad Moon, 1341 Crusade //1144 Bad Moon, 1341 Crusade
class ABadMoon:public ListMaintainerAbility{ class ABadMoon:public ListMaintainerAbility{
public: public:
int color; int color;
ABadMoon(int _id, MTGCardInstance * _source, int _color = MTG_COLOR_BLACK):ListMaintainerAbility(_id, _source),color(_color){ ABadMoon(int _id, MTGCardInstance * _source, int _color = MTG_COLOR_BLACK):ListMaintainerAbility(_id, _source),color(_color){
} }
@@ -1752,7 +1752,7 @@ public:
//1159 Erg Raiders //1159 Erg Raiders
class AErgRaiders:public MTGAbility{ class AErgRaiders:public MTGAbility{
public: public:
int init; int init;
int dealDamage; int dealDamage;
AErgRaiders(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AErgRaiders(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
@@ -1781,7 +1781,7 @@ public:
//Fastbond //Fastbond
class AFastbond:public TriggeredAbility{ class AFastbond:public TriggeredAbility{
public: public:
int alreadyPlayedALand; int alreadyPlayedALand;
AFastbond(int _id, MTGCardInstance * card):TriggeredAbility(_id, card){ AFastbond(int _id, MTGCardInstance * card):TriggeredAbility(_id, card){
alreadyPlayedALand = 0; alreadyPlayedALand = 0;
@@ -1813,7 +1813,7 @@ public:
//1165 Hypnotic Specter //1165 Hypnotic Specter
class AHypnoticSpecter:public MTGAbility{ class AHypnoticSpecter:public MTGAbility{
public: public:
int nbdamagesthisturn[2]; int nbdamagesthisturn[2];
AHypnoticSpecter(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AHypnoticSpecter(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
currentPhase = -1; currentPhase = -1;
@@ -1860,7 +1860,7 @@ public:
//1117 Jandor's Ring //1117 Jandor's Ring
class AJandorsRing:public ActivatedAbility{ class AJandorsRing:public ActivatedAbility{
public: public:
AJandorsRing(int _id, MTGCardInstance * _source):ActivatedAbility(_id,_source, NEW ManaCost()){ AJandorsRing(int _id, MTGCardInstance * _source):ActivatedAbility(_id,_source, NEW ManaCost()){
cost->add(MTG_COLOR_ARTIFACT, 2); cost->add(MTG_COLOR_ARTIFACT, 2);
} }
@@ -1882,7 +1882,7 @@ public:
//Kudzu. //Kudzu.
//What happens when there are no targets ??? //What happens when there are no targets ???
class AKudzu: public TargetAbility{ class AKudzu: public TargetAbility{
public: public:
int previouslyTapped; int previouslyTapped;
AKudzu(int _id, MTGCardInstance * card, MTGCardInstance * _target):TargetAbility(_id,card, NEW TypeTargetChooser("land",card)){ AKudzu(int _id, MTGCardInstance * card, MTGCardInstance * _target):TargetAbility(_id,card, NEW TypeTargetChooser("land",card)){
tc->toggleTarget(_target); tc->toggleTarget(_target);
@@ -1918,7 +1918,7 @@ public:
return 0; return 0;
} }
/* /*
int reactToClick(MTGCardInstance * card){ int reactToClick(MTGCardInstance * card){
if (!waitingForAnswer) { if (!waitingForAnswer) {
}else{ }else{
@@ -1959,7 +1959,7 @@ public:
//Millstone //Millstone
class AMillstone:public TargetAbility{ class AMillstone:public TargetAbility{
public: public:
AMillstone(int _id, MTGCardInstance * card):TargetAbility(_id,card, NEW PlayerTargetChooser(), NEW ManaCost()){ AMillstone(int _id, MTGCardInstance * card):TargetAbility(_id,card, NEW PlayerTargetChooser(), NEW ManaCost()){
cost->add(MTG_COLOR_ARTIFACT, 2); cost->add(MTG_COLOR_ARTIFACT, 2);
} }
@@ -1979,7 +1979,7 @@ public:
//1170: Nightmare //1170: Nightmare
class ANightmare:public ListMaintainerAbility{ class ANightmare:public ListMaintainerAbility{
public: public:
ANightmare(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ ANightmare(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2006,7 +2006,7 @@ public:
//1172 Pestilence //1172 Pestilence
class APestilence: public ActivatedAbility{ class APestilence: public ActivatedAbility{
public: public:
APestilence(int _id, MTGCardInstance * card):ActivatedAbility(_id, card, NEW ManaCost(), 0,0){ APestilence(int _id, MTGCardInstance * card):ActivatedAbility(_id, card, NEW ManaCost(), 0,0){
cost->add(MTG_COLOR_BLACK, 1); cost->add(MTG_COLOR_BLACK, 1);
} }
@@ -2034,7 +2034,7 @@ public:
//Plague Rats and similar. Power and toughness equal to number of cards that share a name //Plague Rats and similar. Power and toughness equal to number of cards that share a name
class APlagueRats:public ListMaintainerAbility{ class APlagueRats:public ListMaintainerAbility{
public: public:
string name; string name;
APlagueRats(int _id, MTGCardInstance * _source, const char * _name):ListMaintainerAbility(_id,_source){ APlagueRats(int _id, MTGCardInstance * _source, const char * _name):ListMaintainerAbility(_id,_source){
name = _name; name = _name;
@@ -2065,7 +2065,7 @@ public:
//Power Leak //Power Leak
class APowerLeak:public TriggeredAbility{ class APowerLeak:public TriggeredAbility{
public: public:
int damagesToDealThisTurn; int damagesToDealThisTurn;
ManaCost cost; ManaCost cost;
APowerLeak(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id, _source, _target){ APowerLeak(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id, _source, _target){
@@ -2112,7 +2112,7 @@ public:
//Power Surge //Power Surge
class APowerSurge:public TriggeredAbility{ class APowerSurge:public TriggeredAbility{
public: public:
int totalLands; int totalLands;
APowerSurge(int _id, MTGCardInstance * _source):TriggeredAbility(_id,_source){ APowerSurge(int _id, MTGCardInstance * _source):TriggeredAbility(_id,_source){
totalLands = 0; totalLands = 0;
@@ -2145,7 +2145,7 @@ public:
//1175 Royal Assassin //1175 Royal Assassin
class ARoyalAssassin:public TargetAbility{ class ARoyalAssassin:public TargetAbility{
public: public:
ARoyalAssassin(int _id, MTGCardInstance * _source):TargetAbility(_id,_source, NEW CreatureTargetChooser()){ ARoyalAssassin(int _id, MTGCardInstance * _source):TargetAbility(_id,_source, NEW CreatureTargetChooser()){
} }
@@ -2164,7 +2164,7 @@ public:
//1176 Sacrifice //1176 Sacrifice
class ASacrifice:public InstantAbility{ class ASacrifice:public InstantAbility{
public: public:
ASacrifice(int _id, MTGCardInstance * _source, MTGCardInstance * _target):InstantAbility(_id, _source){ ASacrifice(int _id, MTGCardInstance * _source, MTGCardInstance * _target):InstantAbility(_id, _source){
target = _target; target = _target;
} }
@@ -2183,7 +2183,7 @@ public:
//1178 Scavenging Ghoul //1178 Scavenging Ghoul
class AScavengingGhoul:public MTGAbility{ class AScavengingGhoul:public MTGAbility{
public: public:
int counters; int counters;
AScavengingGhoul(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){ AScavengingGhoul(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source, _target){
counters = 0; counters = 0;
@@ -2212,7 +2212,7 @@ public:
//1218 Psychic Venom //1218 Psychic Venom
class APsychicVenom:public MTGAbility{ class APsychicVenom:public MTGAbility{
public: public:
int tapped; int tapped;
APsychicVenom(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){ APsychicVenom(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){
tapped = _target->tapped; tapped = _target->tapped;
@@ -2231,7 +2231,7 @@ public:
//1221 Serendib Efreet //1221 Serendib Efreet
class ASerendibEfreet:public MTGAbility{ class ASerendibEfreet:public MTGAbility{
public: public:
ASerendibEfreet(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ ASerendibEfreet(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
} }
@@ -2245,7 +2245,7 @@ public:
//1235 Aspect of Wolf //1235 Aspect of Wolf
class AAspectOfWolf:public ListMaintainerAbility{ class AAspectOfWolf:public ListMaintainerAbility{
public: public:
int color; int color;
AAspectOfWolf(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ListMaintainerAbility(_id, _source, _target){ AAspectOfWolf(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ListMaintainerAbility(_id, _source, _target){
} }
@@ -2282,7 +2282,7 @@ public:
//1276 Wanderlust, 1148 Cursed Lands //1276 Wanderlust, 1148 Cursed Lands
class AWanderlust:public TriggeredAbility{ class AWanderlust:public TriggeredAbility{
public: public:
AWanderlust(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source, _target){} AWanderlust(int _id, MTGCardInstance * _source, MTGCardInstance * _target):TriggeredAbility(_id,_source, _target){}
int trigger(){ int trigger(){
@@ -2300,7 +2300,7 @@ public:
//1280 Atog //1280 Atog
class AAtog:public TargetAbility{ class AAtog:public TargetAbility{
public: public:
Player * currentController; Player * currentController;
int counters; int counters;
AAtog(int _id, MTGCardInstance * _source):TargetAbility(_id, _source,NULL, NULL, 0,0){ AAtog(int _id, MTGCardInstance * _source):TargetAbility(_id, _source,NULL, NULL, 0,0){
@@ -2342,7 +2342,7 @@ public:
//1284 Dragon Whelp //1284 Dragon Whelp
class ADragonWhelp: public APowerToughnessModifierUntilEndOfTurn{ class ADragonWhelp: public APowerToughnessModifierUntilEndOfTurn{
public: public:
ADragonWhelp(int id, MTGCardInstance * card):APowerToughnessModifierUntilEndOfTurn(id, card, card, 1, 0, NEW ManaCost()){ ADragonWhelp(int id, MTGCardInstance * card):APowerToughnessModifierUntilEndOfTurn(id, card, card, 1, 0, NEW ManaCost()){
cost->add(MTG_COLOR_RED, 1); cost->add(MTG_COLOR_RED, 1);
} }
@@ -2358,7 +2358,7 @@ public:
//1288 EarthBind //1288 EarthBind
class AEarthbind:public ABasicAbilityModifier{ class AEarthbind:public ABasicAbilityModifier{
public: public:
AEarthbind(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ABasicAbilityModifier(_id,_source,_target,FLYING,0){ AEarthbind(int _id, MTGCardInstance * _source, MTGCardInstance * _target):ABasicAbilityModifier(_id,_source,_target,FLYING,0){
if (value_before_modification) game->mLayers->stackLayer()->addDamage(source,target,2); if (value_before_modification) game->mLayers->stackLayer()->addDamage(source,target,2);
} }
@@ -2366,7 +2366,7 @@ public:
//1291 Fireball //1291 Fireball
class AFireball:public InstantAbility{ class AFireball:public InstantAbility{
public: public:
AFireball(int _id, MTGCardInstance * card, Spell * spell, int x):InstantAbility(_id, card){ AFireball(int _id, MTGCardInstance * card, Spell * spell, int x):InstantAbility(_id, card){
int nbtargets = spell->cursor; int nbtargets = spell->cursor;
int totaldamage = x+1-nbtargets; int totaldamage = x+1-nbtargets;
@@ -2381,7 +2381,7 @@ public:
//1245 ForceOfNature //1245 ForceOfNature
class AForceOfNature:public ActivatedAbility{ class AForceOfNature:public ActivatedAbility{
public: public:
int dealDamageThisTurn; int dealDamageThisTurn;
AForceOfNature(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){ AForceOfNature(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){
dealDamageThisTurn = 0; dealDamageThisTurn = 0;
@@ -2411,7 +2411,7 @@ public:
//1301 KeldonWarlord //1301 KeldonWarlord
class AKeldonWarlord:public ListMaintainerAbility{ class AKeldonWarlord:public ListMaintainerAbility{
public: public:
AKeldonWarlord(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ AKeldonWarlord(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2436,7 +2436,7 @@ public:
//1302 : Kird Ape //1302 : Kird Ape
class AKirdApe:public MTGAbility{ class AKirdApe:public MTGAbility{
public: public:
int init; int init;
AKirdApe(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AKirdApe(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
init = 0; init = 0;
@@ -2461,7 +2461,7 @@ public:
//1309 Orcish Artilery //1309 Orcish Artilery
class AOrcishArtillery: public ADamager{ class AOrcishArtillery: public ADamager{
public: public:
AOrcishArtillery(int _id,MTGCardInstance * card): ADamager(_id, card, NEW ManaCost(), 2){ AOrcishArtillery(int _id,MTGCardInstance * card): ADamager(_id, card, NEW ManaCost(), 2){
} }
@@ -2475,7 +2475,7 @@ public:
//1310 Orcish Oriflame //1310 Orcish Oriflame
class AOrcishOriflame:public ListMaintainerAbility{ class AOrcishOriflame:public ListMaintainerAbility{
public: public:
int color; int color;
AOrcishOriflame(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ AOrcishOriflame(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2499,7 +2499,7 @@ public:
//1334 Castle //1334 Castle
class ACastle:public ListMaintainerAbility{ class ACastle:public ListMaintainerAbility{
public: public:
ACastle(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ ACastle(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2522,7 +2522,7 @@ public:
//1351 Island Sanctuary //1351 Island Sanctuary
class AIslandSanctuary:public MTGAbility{ class AIslandSanctuary:public MTGAbility{
public: public:
int initThisTurn; int initThisTurn;
AIslandSanctuary(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AIslandSanctuary(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
initThisTurn = 0; initThisTurn = 0;
@@ -2559,7 +2559,7 @@ public:
//1352 Karma //1352 Karma
class AKarma: public TriggeredAbility{ class AKarma: public TriggeredAbility{
public: public:
AKarma(int _id, MTGCardInstance * _source):TriggeredAbility(_id, _source){ AKarma(int _id, MTGCardInstance * _source):TriggeredAbility(_id, _source){
} }
@@ -2581,7 +2581,7 @@ public:
//1355 Norther Paladin //1355 Norther Paladin
class ANorthernPaladin:public TargetAbility{ class ANorthernPaladin:public TargetAbility{
public: public:
ANorthernPaladin(int _id, MTGCardInstance * card):TargetAbility(_id, card){ ANorthernPaladin(int _id, MTGCardInstance * card):TargetAbility(_id, card){
int _cost[] = {MTG_COLOR_WHITE, 2}; int _cost[] = {MTG_COLOR_WHITE, 2};
cost = NEW ManaCost(_cost,1); cost = NEW ManaCost(_cost,1);
@@ -2602,7 +2602,7 @@ public:
//Sedge Troll //Sedge Troll
class ASedgeTroll:public MTGAbility{ class ASedgeTroll:public MTGAbility{
public: public:
int init; int init;
ASedgeTroll(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ ASedgeTroll(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
init = 0; init = 0;
@@ -2627,7 +2627,7 @@ public:
//Soul Net //Soul Net
class ASoulNet:public ActivatedAbility{ class ASoulNet:public ActivatedAbility{
public: public:
PutInGraveyard * latest; PutInGraveyard * latest;
PutInGraveyard * newDead; PutInGraveyard * newDead;
ASoulNet(int _id, MTGCardInstance * card):ActivatedAbility(_id, card,0,0,0){ ASoulNet(int _id, MTGCardInstance * card):ActivatedAbility(_id, card,0,0,0){
@@ -2653,7 +2653,7 @@ public:
//Stasis //Stasis
class AStasis:public ActivatedAbility{ class AStasis:public ActivatedAbility{
public: public:
int paidThisTurn; int paidThisTurn;
AStasis(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){ AStasis(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){
paidThisTurn = 1; paidThisTurn = 1;
@@ -2701,7 +2701,7 @@ public:
//--------------Addon Abra------------------ //--------------Addon Abra------------------
//ShieldOfTheAge //ShieldOfTheAge
class AShieldOfTheAge: public TargetAbility{ class AShieldOfTheAge: public TargetAbility{
public: public:
AShieldOfTheAge(int _id, MTGCardInstance * card):TargetAbility(_id,card,NEW DamageTargetChooser(card,_id),NEW ManaCost(),0,0){ AShieldOfTheAge(int _id, MTGCardInstance * card):TargetAbility(_id,card,NEW DamageTargetChooser(card,_id),NEW ManaCost(),0,0){
cost->add(MTG_COLOR_ARTIFACT,2); cost->add(MTG_COLOR_ARTIFACT,2);
} }
@@ -2716,7 +2716,7 @@ public:
// GiveLifeForTappedType // GiveLifeForTappedType
class AGiveLifeForTappedType:public MTGAbility{ class AGiveLifeForTappedType:public MTGAbility{
public: public:
char type[20]; char type[20];
int nbtypestapped; int nbtypestapped;
@@ -2747,7 +2747,7 @@ public:
// People of the Woods // People of the Woods
class APeopleOfTheWoods:public ListMaintainerAbility{ class APeopleOfTheWoods:public ListMaintainerAbility{
public: public:
APeopleOfTheWoods(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ APeopleOfTheWoods(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2770,7 +2770,7 @@ public:
//Abomination Kill blocking creature if white or green //Abomination Kill blocking creature if white or green
class AAbomination :public MTGAbility{ class AAbomination :public MTGAbility{
public: public:
MTGCardInstance * opponents[20]; MTGCardInstance * opponents[20];
int nbOpponents; int nbOpponents;
AAbomination (int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ AAbomination (int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
@@ -2782,7 +2782,7 @@ public:
if( newPhase == MTG_PHASE_COMBATDAMAGE){ if( newPhase == MTG_PHASE_COMBATDAMAGE){
nbOpponents = 0; nbOpponents = 0;
MTGCardInstance * opponent = source->getNextOpponent(); MTGCardInstance * opponent = source->getNextOpponent();
while (opponent && opponent->hasColor(MTG_COLOR_GREEN) || opponent->hasColor(MTG_COLOR_WHITE)){ while ((opponent && opponent->hasColor(MTG_COLOR_GREEN)) || opponent->hasColor(MTG_COLOR_WHITE)){
opponents[nbOpponents] = opponent; opponents[nbOpponents] = opponent;
nbOpponents ++; nbOpponents ++;
opponent = source->getNextOpponent(opponent); opponent = source->getNextOpponent(opponent);
@@ -2808,7 +2808,7 @@ public:
//Minion of Leshrac //Minion of Leshrac
class AMinionofLeshrac: public TargetAbility{ class AMinionofLeshrac: public TargetAbility{
public: public:
int paidThisTurn; int paidThisTurn;
AMinionofLeshrac(int _id, MTGCardInstance * source):TargetAbility(_id, source, NEW CreatureTargetChooser(),0,1,0){ AMinionofLeshrac(int _id, MTGCardInstance * source):TargetAbility(_id, source, NEW CreatureTargetChooser(),0,1,0){
paidThisTurn = 1; paidThisTurn = 1;
@@ -2845,7 +2845,7 @@ public:
//2703 Lost Order of Jarkeld //2703 Lost Order of Jarkeld
class ALostOrderofJarkeld:public ListMaintainerAbility{ class ALostOrderofJarkeld:public ListMaintainerAbility{
public: public:
ALostOrderofJarkeld(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ ALostOrderofJarkeld(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
} }
@@ -2870,7 +2870,7 @@ public:
//CreaturePowerToughnessModifierForAllTypeControlled //CreaturePowerToughnessModifierForAllTypeControlled
class ACreaturePowerToughnessModifierForAllTypeControlled:public ListMaintainerAbility{ class ACreaturePowerToughnessModifierForAllTypeControlled:public ListMaintainerAbility{
public: public:
char type[20]; char type[20];
ACreaturePowerToughnessModifierForAllTypeControlled(int _id, MTGCardInstance * _source, const char * _type):ListMaintainerAbility(_id, _source){ ACreaturePowerToughnessModifierForAllTypeControlled(int _id, MTGCardInstance * _source, const char * _type):ListMaintainerAbility(_id, _source){
} }
@@ -2896,7 +2896,7 @@ public:
//GenericKirdApe //GenericKirdApe
class AGenericKirdApe:public MTGAbility{ class AGenericKirdApe:public MTGAbility{
public: public:
int init; int init;
char type [20]; char type [20];
int power; int power;
@@ -2925,7 +2925,7 @@ public:
//Rampage ability Tentative 2 //Rampage ability Tentative 2
class ARampageAbility:public MTGAbility{ class ARampageAbility:public MTGAbility{
public: public:
int nbOpponents; int nbOpponents;
int PowerModifier; int PowerModifier;
int ToughnessModifier; int ToughnessModifier;
@@ -2951,7 +2951,7 @@ public:
//Rampage ability Tentative 1 - Did not work as expected //Rampage ability Tentative 1 - Did not work as expected
class A1RampageAbility:public MTGAbility{ class A1RampageAbility:public MTGAbility{
public: public:
MTGCardInstance * opponents[20]; MTGCardInstance * opponents[20];
int nbOpponents; int nbOpponents;
int PowerModifier; int PowerModifier;
+4 -4
View File
@@ -13,11 +13,11 @@ class GameObserver;
class MTGAbility; class MTGAbility;
class Blocker : public MTGAbility { class Blocker : public MTGAbility {
protected: protected:
ManaCost * manaCost; ManaCost * manaCost;
int currentPhase; int currentPhase;
void init(ManaCost * _cost); void init(ManaCost * _cost);
public: public:
virtual ManaCost * untapManaCost(){return manaCost;}; virtual ManaCost * untapManaCost(){return manaCost;};
virtual int unblock(){return 1;}; virtual int unblock(){return 1;};
Blocker(int id, MTGCardInstance * card, ManaCost * _cost); Blocker(int id, MTGCardInstance * card, ManaCost * _cost);
@@ -30,11 +30,11 @@ public:
class Blockers { class Blockers {
protected: protected:
int cursor; int cursor;
int blockers[MAX_BLOCKERS]; int blockers[MAX_BLOCKERS];
GameObserver * game; GameObserver * game;
public: public:
Blockers(); Blockers();
~Blockers(); ~Blockers();
int Add (Blocker * ability); int Add (Blocker * ability);
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
A Filter/Mask system for Card Instances to find cards matching specific settings such as color, type, etc... A Filter/Mask system for Card Instances to find cards matching specific settings such as color, type, etc...
*/ */
#ifndef _CARDDESCRIPTOR_H_ #ifndef _CARDDESCRIPTOR_H_
@@ -12,10 +12,10 @@ A Filter/Mask system for Card Instances to find cards matching specific settings
#define CD_AND 2 #define CD_AND 2
class CardDescriptor: public MTGCardInstance{ class CardDescriptor: public MTGCardInstance{
protected: protected:
MTGCardInstance * match_or(MTGCardInstance * card); MTGCardInstance * match_or(MTGCardInstance * card);
MTGCardInstance * match_and(MTGCardInstance * card); MTGCardInstance * match_and(MTGCardInstance * card);
public: public:
int mode; int mode;
int init(); int init();
CardDescriptor(); CardDescriptor();
+1 -1
View File
@@ -8,7 +8,7 @@ class MTGGameZone;
class MTGCardInstance; class MTGCardInstance;
class CardDisplay:public PlayGuiObjectController{ class CardDisplay:public PlayGuiObjectController{
public: public:
int x, y , start_item, nb_displayed_items; int x, y , start_item, nb_displayed_items;
TargetChooser * tc; TargetChooser * tc;
JGuiListener * listener; JGuiListener * listener;
+1 -1
View File
@@ -12,7 +12,7 @@ class MTGCardInstance;
class PlayGuiObject; class PlayGuiObject;
class CardGui: public PlayGuiObject{ class CardGui: public PlayGuiObject{
protected: protected:
hgeParticleSystem * mParticleSys; hgeParticleSystem * mParticleSys;
int alpha; int alpha;
public: public:
+2 -2
View File
@@ -6,8 +6,8 @@
class ConstraintResolver { class ConstraintResolver {
protected: protected:
public: public:
static int untap(GameObserver * game, MTGCardInstance * card); static int untap(GameObserver * game, MTGCardInstance * card);
}; };
+2 -2
View File
@@ -8,7 +8,7 @@ class MTGCardInstance;
/* One family of counters. Ex : +1/+1 */ /* One family of counters. Ex : +1/+1 */
class Counter{ class Counter{
public : public :
string name; string name;
int nb; int nb;
int power, toughness; int power, toughness;
@@ -24,7 +24,7 @@ public :
/* Various families of counters attached to an instance of a card */ /* Various families of counters attached to an instance of a card */
class Counters{ class Counters{
public: public:
int mCount; int mCount;
Counter * counters[10]; Counter * counters[10];
MTGCardInstance * target; MTGCardInstance * target;
+6 -6
View File
@@ -14,9 +14,9 @@ class GameObserver;
#define DAMAGEABLE_PLAYER 1 #define DAMAGEABLE_PLAYER 1
class Damageable { class Damageable {
protected: protected:
public: public:
int life; int life;
int type_as_damageable; int type_as_damageable;
Damageable(int _life){life=_life;}; Damageable(int _life){life=_life;};
@@ -27,9 +27,9 @@ public:
}; };
class Damage: public Interruptible { class Damage: public Interruptible {
protected: protected:
void init(MTGCardInstance * _source, Damageable * _target, int _damage); void init(MTGCardInstance * _source, Damageable * _target, int _damage);
public: public:
Damageable * target; Damageable * target;
MTGCardInstance * source; MTGCardInstance * source;
int damage; int damage;
@@ -41,11 +41,11 @@ public:
class DamageStack :public GuiLayer, public Interruptible{ class DamageStack :public GuiLayer, public Interruptible{
protected: protected:
int currentState; int currentState;
public: public:
int resolve(); int resolve();
void Render(); void Render();
int CombatDamages();//Deprecated ? int CombatDamages();//Deprecated ?
+5 -5
View File
@@ -8,9 +8,9 @@ class DamageStack;
class DamageResolverLayer:public PlayGuiObjectController{ class DamageResolverLayer:public PlayGuiObjectController{
protected: protected:
int trampleDamage(); int trampleDamage();
public: public:
int buttonOk; int buttonOk;
int currentPhase; int currentPhase;
int remainingDamageSteps; int remainingDamageSteps;
@@ -26,9 +26,9 @@ public:
int addIfNotExists(MTGCardInstance * card, Player * selecter); int addIfNotExists(MTGCardInstance * card, Player * selecter);
int addDamager(MTGCardInstance * card, Player * selecter); int addDamager(MTGCardInstance * card, Player * selecter);
DamagerDamaged * findByCard(MTGCardInstance * card); DamagerDamaged * findByCard(MTGCardInstance * card);
int canStopDealDamages(); int canStopDealDamages();
int resolveDamages(); int resolveDamages();
int isOpponent(DamagerDamaged * a, DamagerDamaged * b); int isOpponent(DamagerDamaged * a, DamagerDamaged * b);
void nextPlayer(); void nextPlayer();
virtual void Update(float dt); virtual void Update(float dt);
virtual void CheckUserInput(float dt); virtual void CheckUserInput(float dt);
+1 -1
View File
@@ -6,7 +6,7 @@
class Player; class Player;
class DamagerDamaged:public CardGui{ class DamagerDamaged:public CardGui{
public: public:
Player * damageSelecter; Player * damageSelecter;
int mCount; int mCount;
Damage * damages[10]; Damage * damages[10];
+1 -1
View File
@@ -25,7 +25,7 @@ class Cmp1 { // compares cards by their name
}; };
class DeckDataWrapper{ class DeckDataWrapper{
public: public:
int colors[MTG_NB_COLORS+1]; int colors[MTG_NB_COLORS+1];
int currentColor; int currentColor;
map<MTGCard *, int,Cmp1> cards; map<MTGCard *, int,Cmp1> cards;
+1 -1
View File
@@ -12,7 +12,7 @@ class DamageResolverLayer;
class DuelLayers: public GuiLayers{ class DuelLayers: public GuiLayers{
public: public:
ActionLayer * actionLayer(); ActionLayer * actionLayer();
MTGGuiHand * handLayer(); MTGGuiHand * handLayer();
MTGGuiPlay * playLayer(); MTGGuiPlay * playLayer();
+6 -6
View File
@@ -1,8 +1,8 @@
/* /*
* Wagic, The Homebrew ?! is licensed under the BSD license * Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root * See LICENSE in the Folder's root
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
@@ -51,7 +51,7 @@ class TexturesCache;
class GameApp: public JApp class GameApp: public JApp
{ {
private: private:
bool mShowDebugInfo; bool mShowDebugInfo;
int mScreenShotCount; int mScreenShotCount;
@@ -60,7 +60,7 @@ private:
GameState* mGameStates[MAX_STATE]; GameState* mGameStates[MAX_STATE];
public: public:
int players[2]; int players[2];
MTGAllCards * collection; MTGAllCards * collection;
TexturesCache * cache; TexturesCache * cache;
+2 -2
View File
@@ -7,14 +7,14 @@
#define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 1 #define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 1
#define OPTIONS_SAVEFILE "Res/settings/options.txt" #define OPTIONS_SAVEFILE "Res/settings/options.txt"
class GameOptions { class GameOptions {
public: public:
int values[MAX_OPTIONS]; int values[MAX_OPTIONS];
static GameOptions * GetInstance(); static GameOptions * GetInstance();
static void Destroy(); static void Destroy();
int save(); int save();
int load(); int load();
private: private:
GameOptions(); GameOptions();
~GameOptions(); ~GameOptions();
static GameOptions* mInstance; static GameOptions* mInstance;
+4 -4
View File
@@ -8,24 +8,24 @@ class JGE;
#include <JSoundSystem.h> #include <JSoundSystem.h>
enum _gameSates enum _gameSates
{ {
GAME_STATE_MENU, GAME_STATE_MENU,
GAME_STATE_DUEL, GAME_STATE_DUEL,
GAME_STATE_DECK_VIEWER, GAME_STATE_DECK_VIEWER,
GAME_STATE_SHOP, GAME_STATE_SHOP,
GAME_STATE_OPTIONS GAME_STATE_OPTIONS
}; };
class GameApp; class GameApp;
class GameState class GameState
{ {
protected: protected:
GameApp* mParent; GameApp* mParent;
JGE* mEngine; JGE* mEngine;
public: public:
static const char * const menuTexts[]; static const char * const menuTexts[];
GameState(GameApp* parent); GameState(GameApp* parent);
+13 -13
View File
@@ -37,7 +37,7 @@
class GameStateDeckViewer: public GameState, public JGuiListener class GameStateDeckViewer: public GameState, public JGuiListener
{ {
private: private:
JQuad * mIcons[7]; JQuad * mIcons[7];
JQuad * pspIcons[8]; JQuad * pspIcons[8];
JTexture * pspIconsTexture; JTexture * pspIconsTexture;
@@ -67,7 +67,7 @@ private:
MTGCard * currentCard; MTGCard * currentCard;
MTGCard * cardIndex[7]; MTGCard * cardIndex[7];
int hudAlpha; int hudAlpha;
public: public:
GameStateDeckViewer(GameApp* parent): GameState(parent) { GameStateDeckViewer(GameApp* parent): GameState(parent) {
bgMusic = NULL; bgMusic = NULL;
@@ -176,8 +176,8 @@ public:
backTex = JRenderer::GetInstance()->LoadTexture("sets/back.jpg", TEX_TYPE_USE_VRAM); backTex = JRenderer::GetInstance()->LoadTexture("sets/back.jpg", TEX_TYPE_USE_VRAM);
backQuad = NEW JQuad(backTex, 0, 0, 200, 285); // Create quad for rendering. backQuad = NEW JQuad(backTex, 0, 0, 200, 285); // Create quad for rendering.
//menuFont = NEW JLBFont("graphics/f3",16); //menuFont = NEW JLBFont("graphics/f3",16);
menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3"); menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20,200); welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20,200);
char buffer[100]; char buffer[100];
for (int i=1; i < 6; i++){ for (int i=1; i < 6; i++){
@@ -265,19 +265,19 @@ menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
return; return;
} }
if (mStage == STAGE_WAITING || mStage == STAGE_ONSCREEN_MENU){ if (mStage == STAGE_WAITING || mStage == STAGE_ONSCREEN_MENU){
if (mEngine->GetButtonState(PSP_CTRL_LEFT)){ if (mEngine->GetButtonClick(PSP_CTRL_LEFT)){
last_user_activity = 0; last_user_activity = 0;
currentCard = displayed_deck->getNext(currentCard,colorFilter); currentCard = displayed_deck->getNext(currentCard,colorFilter);
mStage = STAGE_TRANSITION_LEFT; mStage = STAGE_TRANSITION_LEFT;
} }
else if (mEngine->GetButtonState(PSP_CTRL_RIGHT)) else if (mEngine->GetButtonClick(PSP_CTRL_RIGHT))
{ {
last_user_activity = 0; last_user_activity = 0;
currentCard = displayed_deck->getPrevious(currentCard,colorFilter); currentCard = displayed_deck->getPrevious(currentCard,colorFilter);
mStage = STAGE_TRANSITION_RIGHT; mStage = STAGE_TRANSITION_RIGHT;
} }
else if (mEngine->GetButtonState(PSP_CTRL_UP)) else if (mEngine->GetButtonClick(PSP_CTRL_UP))
{ {
last_user_activity = 0; last_user_activity = 0;
mStage = STAGE_TRANSITION_UP; mStage = STAGE_TRANSITION_UP;
@@ -285,7 +285,7 @@ menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
if (colorFilter < -1) colorFilter = MTG_COLOR_LAND; if (colorFilter < -1) colorFilter = MTG_COLOR_LAND;
} }
else if (mEngine->GetButtonState(PSP_CTRL_DOWN)) else if (mEngine->GetButtonClick(PSP_CTRL_DOWN))
{ {
last_user_activity = 0; last_user_activity = 0;
mStage = STAGE_TRANSITION_DOWN; mStage = STAGE_TRANSITION_DOWN;
@@ -431,7 +431,7 @@ menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
r->FillRoundRect(filler,y,bar_size,0,3,ARGB(hudAlpha/2,128,128,128)); r->FillRoundRect(filler,y,bar_size,0,3,ARGB(hudAlpha/2,128,128,128));
//r->FillCircle(filler+cursor_pos + 3 ,SCREEN_HEIGHT - 15 + 3,6,ARGB(255,128,128,128)); //r->FillCircle(filler+cursor_pos + 3 ,SCREEN_HEIGHT - 15 + 3,6,ARGB(255,128,128,128));
r->DrawLine(filler+cursor_pos,y,filler+cursor_pos,y+5,ARGB(hudAlpha,255,255,255)); r->DrawLine(filler+cursor_pos,y,filler+cursor_pos,y+5,ARGB(hudAlpha,255,255,255));
char buffer[256]; char buffer[256];
string deckname = "Collection"; string deckname = "Collection";
if (displayed_deck == myDeck){ if (displayed_deck == myDeck){
@@ -730,7 +730,7 @@ r->DrawLine(filler+cursor_pos,y,filler+cursor_pos,y+5,ARGB(hudAlpha,255,255,255)
return 1; return 1;
} }
virtual void ButtonPressed(int controllerId, int controlId) virtual void ButtonPressed(int controllerId, int controlId)
{ {
switch (controlId) switch (controlId)
{ {
@@ -765,11 +765,11 @@ virtual void ButtonPressed(int controllerId, int controlId)
price = price - (rnd * price)/100; price = price - (rnd * price)/100;
playerdata->credits += price; playerdata->credits += price;
pricelist->setPrice(card->getMTGId(),price*2); pricelist->setPrice(card->getMTGId(),price*2);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "CARD'S NAME : %s", card->getName()); sprintf(buf, "CARD'S NAME : %s", card->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
playerdata->collection->remove(card->getMTGId()); playerdata->collection->remove(card->getMTGId());
Remove(card); Remove(card);
} }
@@ -779,7 +779,7 @@ virtual void ButtonPressed(int controllerId, int controlId)
break; break;
} }
} }
}; };
+2 -2
View File
@@ -22,7 +22,7 @@ class TestSuite;
class GameStateDuel: public GameState, public JGuiListener class GameStateDuel: public GameState, public JGuiListener
{ {
private: private:
#ifdef TESTSUITE #ifdef TESTSUITE
TestSuite * testSuite; TestSuite * testSuite;
#endif #endif
@@ -36,7 +36,7 @@ private:
JLBFont* mFont; JLBFont* mFont;
void loadPlayer(int playerId, int decknb = 0); void loadPlayer(int playerId, int decknb = 0);
public: public:
GameStateDuel(GameApp* parent); GameStateDuel(GameApp* parent);
virtual ~GameStateDuel(); virtual ~GameStateDuel();
#ifdef TESTSUITE #ifdef TESTSUITE
+5 -5
View File
@@ -25,7 +25,7 @@
class GameStateMenu: public GameState, public JGuiListener class GameStateMenu: public GameState, public JGuiListener
{ {
private: private:
JGuiController* mGuiController; JGuiController* mGuiController;
SimpleMenu* subMenuController; SimpleMenu* subMenuController;
JLBFont* mFont; JLBFont* mFont;
@@ -47,7 +47,7 @@ private:
int mReadConf; int mReadConf;
public: public:
GameStateMenu(GameApp* parent): GameState(parent) GameStateMenu(GameApp* parent): GameState(parent)
{ {
mGuiController = NULL; mGuiController = NULL;
@@ -245,9 +245,9 @@ public:
subMenuController->Add(12, "2 Players"); subMenuController->Add(12, "2 Players");
subMenuController->Add(13,"Demo"); subMenuController->Add(13,"Demo");
subMenuController->Add(14, "Cancel"); subMenuController->Add(14, "Cancel");
#ifdef TESTSUITE #ifdef TESTSUITE
subMenuController->Add(666, "Test Suite"); subMenuController->Add(666, "Test Suite");
#endif #endif
} }
} }
} }
@@ -358,7 +358,7 @@ public:
} }
} }
virtual void ButtonPressed(int controllerId, int controlId) virtual void ButtonPressed(int controllerId, int controlId)
+1 -1
View File
@@ -14,7 +14,7 @@ class SimpleMenu;
class GameStateOptions: public GameState, public JGuiListener class GameStateOptions: public GameState, public JGuiListener
{ {
public: public:
SimpleMenu * optionsMenu; SimpleMenu * optionsMenu;
int mState; int mState;
OptionsList * optionsList; OptionsList * optionsList;
+2 -2
View File
@@ -14,7 +14,7 @@
class GameStateShop: public GameState, public JGuiListener class GameStateShop: public GameState, public JGuiListener
{ {
private: private:
ShopItems * shop; ShopItems * shop;
JLBFont * mFont; JLBFont * mFont;
@@ -27,7 +27,7 @@ private:
char starterBuffer[128], boosterBuffer[128]; char starterBuffer[128], boosterBuffer[128];
int setId; int setId;
public: public:
GameStateShop(GameApp* parent); GameStateShop(GameApp* parent);
virtual ~GameStateShop(); virtual ~GameStateShop();
+1 -1
View File
@@ -5,7 +5,7 @@
#include "PlayGuiObjectController.h" #include "PlayGuiObjectController.h"
class GuiCardsController : public PlayGuiObjectController{ class GuiCardsController : public PlayGuiObjectController{
public: public:
GuiCardsController(int id, GameObserver* _game):PlayGuiObjectController(id, _game){}; GuiCardsController(int id, GameObserver* _game):PlayGuiObjectController(id, _game){};
}; };
+1 -1
View File
@@ -13,7 +13,7 @@
#define LOG_FILE "Res/debug.txt" #define LOG_FILE "Res/debug.txt"
class Logger{ class Logger{
public: public:
static void Log(char * text); static void Log(char * text);
}; };
+5 -5
View File
@@ -24,7 +24,7 @@ using std::map;
#define BAKA_EFFECT_BAD 11 #define BAKA_EFFECT_BAD 11
class AbilityFactory{ class AbilityFactory{
private: private:
int destroyAllFromTypeInPlay(const char * type, MTGCardInstance * source, int bury = 0); int destroyAllFromTypeInPlay(const char * type, MTGCardInstance * source, int bury = 0);
int destroyAllFromColorInPlay(int color, MTGCardInstance * source, int bury = 0); int destroyAllFromColorInPlay(int color, MTGCardInstance * source, int bury = 0);
int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p); int putInPlayFromZone(MTGCardInstance * card, MTGGameZone * zone, Player * p);
@@ -67,7 +67,7 @@ class TriggeredAbility:public MTGAbility{
class ActivatedAbility:public MTGAbility{ class ActivatedAbility:public MTGAbility{
public: public:
ManaCost * cost; ManaCost * cost;
int playerturnonly; int playerturnonly;
int needsTapping; int needsTapping;
@@ -80,7 +80,7 @@ public:
}; };
class TargetAbility:public ActivatedAbility{ class TargetAbility:public ActivatedAbility{
public: public:
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1); TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1); TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0,int tap = 1);
virtual void Update(float dt); virtual void Update(float dt);
@@ -90,7 +90,7 @@ public:
}; };
class InstantAbility:public MTGAbility{ class InstantAbility:public MTGAbility{
public: public:
int init; int init;
virtual void Update(float dt); virtual void Update(float dt);
virtual int testDestroy(); virtual int testDestroy();
@@ -101,7 +101,7 @@ public:
/* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */ /* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */
class ListMaintainerAbility:public MTGAbility{ class ListMaintainerAbility:public MTGAbility{
public: public:
map<MTGCardInstance *,bool> cards; map<MTGCardInstance *,bool> cards;
ListMaintainerAbility(int _id):MTGAbility(_id,NULL){}; ListMaintainerAbility(int _id):MTGAbility(_id,NULL){};
ListMaintainerAbility(int _id, MTGCardInstance *_source):MTGAbility(_id, _source){}; ListMaintainerAbility(int _id, MTGCardInstance *_source):MTGAbility(_id, _source){};
+1 -1
View File
@@ -33,7 +33,7 @@ class MTGCardInstance: public MTGCard, public Damageable, public Targetable {
Blockers * blockers; Blockers * blockers;
MTGPlayerCards * belongs_to; MTGPlayerCards * belongs_to;
MTGAbility * UntapBlockers[10]; MTGAbility * UntapBlockers[10];
void unband(); void unband();
MTGCardInstance * getNextPartner(); MTGCardInstance * getNextPartner();
void initMTGCI(); void initMTGCI();
public: public:
+5 -5
View File
@@ -24,12 +24,12 @@ class MTGCard;
class MtgSets{ class MtgSets{
protected: protected:
public: public:
int nb_items; int nb_items;
string values[MAX_SETS]; string values[MAX_SETS];
public: public:
static MtgSets * SetsList; static MtgSets * SetsList;
MtgSets(); MtgSets();
int Add(const char * subtype); int Add(const char * subtype);
@@ -73,10 +73,10 @@ class MTGAllCards {
class MTGDeck:public MTGAllCards{ class MTGDeck:public MTGAllCards{
protected: protected:
string filename; string filename;
MTGAllCards * allcards; MTGAllCards * allcards;
public: public:
MTGDeck(const char * config_file, TexturesCache * cache, MTGAllCards * _allcards); MTGDeck(const char * config_file, TexturesCache * cache, MTGAllCards * _allcards);
int addRandomCards(int howmany, int setId = -1, int rarity = -1, const char * subtype = NULL); int addRandomCards(int howmany, int setId = -1, int rarity = -1, const char * subtype = NULL);
int add(int cardid); int add(int cardid);
+40 -40
View File
@@ -99,44 +99,44 @@ static int _b[7] = {20, 0, 140,15, 50,255,128};
#define NB_BASIC_ABILITIES 38 #define NB_BASIC_ABILITIES 38
static const char * MTGBasicAbilities[] = { static const char * MTGBasicAbilities[] = {
"trample", "trample",
"forestwalk", "forestwalk",
"islandwalk", "islandwalk",
"mountainwalk", "mountainwalk",
"swampwalk", "swampwalk",
"plainwalk", "plainwalk",
"flying", "flying",
"first strike", "first strike",
"double strike", "double strike",
"fear", "fear",
"flash", "flash",
"haste", "haste",
"lifelink", "lifelink",
"reach", "reach",
"shroud", "shroud",
"vigilance", "vigilance",
"defender", "defender",
"banding", "banding",
"protection from green", "protection from green",
"protection from blue", "protection from blue",
"protection from red", "protection from red",
"protection from black", "protection from black",
"protection from white", "protection from white",
"unblockable", "unblockable",
"wither", "wither",
"persist", "persist",
"retrace", "retrace",
"exalted", "exalted",
"legendary", "legendary",
"shadow", "shadow",
"reachshadow", "reachshadow",
"foresthome", "foresthome",
"islandhome", "islandhome",
"moutainhome", "moutainhome",
"swamphome", "swamphome",
"plainshome", "plainshome",
"flanking", "flanking",
"rampage", "rampage",
}; };
@@ -152,7 +152,7 @@ static const char * MTGBasicAbilities[] = {
static const char *MTGPhaseNames[] = static const char *MTGPhaseNames[] =
{ {
"---", "---",
"Untap", "Untap",
"Upkeep", "Upkeep",
@@ -167,7 +167,7 @@ static const char *MTGPhaseNames[] =
"End of turn", "End of turn",
"cleanup", "cleanup",
"---" "---"
}; };
+1 -1
View File
@@ -14,7 +14,7 @@ class MTGGamePhase: public ActionElement {
int currentState; int currentState;
JLBFont * mFont; JLBFont * mFont;
public: public:
MTGGamePhase(int id); MTGGamePhase(int id);
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
void CheckUserInput(float dt); void CheckUserInput(float dt);
+1 -1
View File
@@ -54,7 +54,7 @@ class MTGHand: public MTGGameZone {
class MTGStack: public MTGGameZone { class MTGStack: public MTGGameZone {
public: public:
}; };
class MTGInPlay: public MTGGameZone { class MTGInPlay: public MTGGameZone {
+3 -3
View File
@@ -11,7 +11,7 @@ class GameObserver;
class CardGui; class CardGui;
class MTGGuiPlay: public PlayGuiObjectController { class MTGGuiPlay: public PlayGuiObjectController {
protected: protected:
int offset; int offset;
Player * currentPlayer; Player * currentPlayer;
MTGCardInstance * cardsGrid[SCREEN_WIDTH/5][SCREEN_HEIGHT/5]; MTGCardInstance * cardsGrid[SCREEN_WIDTH/5][SCREEN_HEIGHT/5];
@@ -42,8 +42,8 @@ protected:
void setCardPosition(CardGui * cardg, int player, int playerTurn, int spellMode); void setCardPosition(CardGui * cardg, int player, int playerTurn, int spellMode);
void setTargettingCardPosition(CardGui * cardg, int player, int playerTurn); void setTargettingCardPosition(CardGui * cardg, int player, int playerTurn);
void adjustCardPosition(CardGui * cardg); void adjustCardPosition(CardGui * cardg);
public: public:
CardGui * getByCard(MTGCardInstance * card); CardGui * getByCard(MTGCardInstance * card);
MTGGuiPlay(int id, GameObserver * game); MTGGuiPlay(int id, GameObserver * game);
~MTGGuiPlay(); ~MTGGuiPlay();
void Update(float dt); void Update(float dt);
+6 -6
View File
@@ -1,5 +1,5 @@
/* Default observers/Abilities that are added to the game for a standard Magic Game /* Default observers/Abilities that are added to the game for a standard Magic Game
*/ */
#ifndef _MTGRULES_H_ #ifndef _MTGRULES_H_
#define _MTGRULES_H_ #define _MTGRULES_H_
@@ -9,7 +9,7 @@
class MTGAttackRule:public MTGAbility{ class MTGAttackRule:public MTGAbility{
public: public:
int isReactingToClick(MTGCardInstance * card); int isReactingToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int testDestroy(); int testDestroy();
@@ -19,7 +19,7 @@ public:
}; };
class MTGBlockRule:public MTGAbility{ class MTGBlockRule:public MTGAbility{
public: public:
int isReactingToClick(MTGCardInstance * card); int isReactingToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int testDestroy(); int testDestroy();
@@ -30,7 +30,7 @@ public:
/* Persist Rule */ /* Persist Rule */
class MTGPersistRule:public ListMaintainerAbility{ class MTGPersistRule:public ListMaintainerAbility{
public: public:
MTGPersistRule(int _id):ListMaintainerAbility(_id){}; MTGPersistRule(int _id):ListMaintainerAbility(_id){};
virtual void Update(float dt){ virtual void Update(float dt){
@@ -84,9 +84,9 @@ public:
* If two or more legendary permanents with the same name are in play, all are put into their * If two or more legendary permanents with the same name are in play, all are put into their
* owners' graveyards. This is called the "legend rule." If only one of those permanents is * owners' graveyards. This is called the "legend rule." If only one of those permanents is
* legendary, this rule doesn't apply. * legendary, this rule doesn't apply.
*/ */
class MTGLegendRule:public ListMaintainerAbility{ class MTGLegendRule:public ListMaintainerAbility{
public: public:
MTGLegendRule(int _id):ListMaintainerAbility(_id){}; MTGLegendRule(int _id):ListMaintainerAbility(_id){};
int canBeInList(MTGCardInstance * card){ int canBeInList(MTGCardInstance * card){
+1 -1
View File
@@ -2,7 +2,7 @@
#define _MANACOST_HYBRID_H_ #define _MANACOST_HYBRID_H_
class ManaCostHybrid{ class ManaCostHybrid{
public: public:
int color1; int color1;
int color2; int color2;
int value1; int value1;
+2 -2
View File
@@ -12,7 +12,7 @@ class hgeParticleSystem;
class MenuItem: public JGuiObject class MenuItem: public JGuiObject
{ {
private: private:
bool mHasFocus; bool mHasFocus;
JLBFont *mFont; JLBFont *mFont;
const char* const mText; const char* const mText;
@@ -28,7 +28,7 @@ private:
hgeParticleSystem* mParticleSys; hgeParticleSystem* mParticleSys;
public: public:
MenuItem(int id, JLBFont *font, const char* text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false); MenuItem(int id, JLBFont *font, const char* text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
~MenuItem(); ~MenuItem();
virtual void Render(); virtual void Render();
+2 -2
View File
@@ -7,7 +7,7 @@
using std::string; using std::string;
class OptionItem:public JGuiObject{ class OptionItem:public JGuiObject{
public: public:
string displayValue; string displayValue;
int id, value; int id, value;
int hasFocus; int hasFocus;
@@ -25,7 +25,7 @@ public:
}; };
class OptionsList{ class OptionsList{
public: public:
OptionItem * options[20]; OptionItem * options[20];
int nbitems; int nbitems;
int current; int current;
+3 -3
View File
@@ -5,20 +5,20 @@
using std::list; using std::list;
/* /*
The class that handles the phases of a turn The class that handles the phases of a turn
*/ */
class Player; class Player;
class Phase{ class Phase{
public: public:
int id; int id;
Player * player; Player * player;
Phase(int _id, Player * _player):id(_id),player(_player){}; Phase(int _id, Player * _player):id(_id),player(_player){};
}; };
class PhaseRing{ class PhaseRing{
public: public:
list<Phase *> ring; list<Phase *> ring;
list<Phase *>::iterator current; list<Phase *>::iterator current;
Phase * getCurrentPhase(); Phase * getCurrentPhase();
+7 -7
View File
@@ -1,5 +1,5 @@
/* /*
A class for all interactive objects in the play area (cards, avatars, etc...) A class for all interactive objects in the play area (cards, avatars, etc...)
*/ */
#ifndef _PLAYGUIOBJECT_H_ #ifndef _PLAYGUIOBJECT_H_
@@ -39,21 +39,21 @@ class PlayGuiObject: public JGuiObject, public JGuiListener{
}; };
class GuiAvatar: public PlayGuiObject{ class GuiAvatar: public PlayGuiObject{
protected: protected:
int avatarRed; int avatarRed;
int currentLife; int currentLife;
public: public:
Player * player; Player * player;
virtual void Render(); virtual void Render();
GuiAvatar(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * _player); GuiAvatar(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * _player);
}; };
class GuiGameZone: public PlayGuiObject{ class GuiGameZone: public PlayGuiObject{
protected: protected:
MTGGameZone * zone; MTGGameZone * zone;
public: public:
CardDisplay * cd; CardDisplay * cd;
int showCards; int showCards;
virtual void Render(); virtual void Render();
@@ -65,12 +65,12 @@ public:
}; };
class GuiGraveyard: public GuiGameZone{ class GuiGraveyard: public GuiGameZone{
public: public:
GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player); GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
}; };
class GuiLibrary: public GuiGameZone{ class GuiLibrary: public GuiGameZone{
public: public:
GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player); GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
}; };
+2 -2
View File
@@ -6,8 +6,8 @@
#include "../include/MTGDeck.h" #include "../include/MTGDeck.h"
class PlayerData{ class PlayerData{
protected: protected:
public: public:
int credits; int credits;
MTGDeck * collection; MTGDeck * collection;
PlayerData(MTGAllCards * allcards); PlayerData(MTGAllCards * allcards);
+3 -3
View File
@@ -7,19 +7,19 @@
#include <stdio.h> #include <stdio.h>
class Price{ class Price{
public: public:
int cardid; int cardid;
int price; int price;
Price(int _cardid, int _price); Price(int _cardid, int _price);
}; };
class PriceList{ class PriceList{
private: private:
MTGAllCards * collection; MTGAllCards * collection;
string filename; string filename;
Price * prices[TOTAL_NUMBER_OF_CARDS]; Price * prices[TOTAL_NUMBER_OF_CARDS];
int nbprices; int nbprices;
public: public:
PriceList(const char * file, MTGAllCards * _collection); PriceList(const char * file, MTGAllCards * _collection);
~PriceList(); ~PriceList();
int save(); int save();
+4 -4
View File
@@ -13,7 +13,7 @@
using std::string; using std::string;
class ShopItem:public JGuiObject{ class ShopItem:public JGuiObject{
private: private:
bool mHasFocus; bool mHasFocus;
JLBFont *mFont; JLBFont *mFont;
string mText; string mText;
@@ -24,7 +24,7 @@ private:
float mScale; float mScale;
float mTargetScale; float mTargetScale;
public: public:
int quantity; int quantity;
MTGCard * card; MTGCard * card;
int price; int price;
@@ -43,7 +43,7 @@ public:
}; };
class ShopItems:public JGuiController,public JGuiListener{ class ShopItems:public JGuiController,public JGuiListener{
private: private:
PlayerData * playerdata; PlayerData * playerdata;
PriceList * pricelist; PriceList * pricelist;
int mX, mY, mHeight; int mX, mY, mHeight;
@@ -55,7 +55,7 @@ private:
MTGCardInstance * displayCards[100]; MTGCardInstance * displayCards[100];
CardDisplay * display; CardDisplay * display;
void safeDeleteDisplay(); void safeDeleteDisplay();
public: public:
ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int setId); ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int setId);
~ShopItems(); ~ShopItems();
void Render(); void Render();
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
A class for very simple menus structure A class for very simple menus structure
*/ */
#ifndef _SIMPLEMENU_H_ #ifndef _SIMPLEMENU_H_
#define _SIMPLEMENU_H_ #define _SIMPLEMENU_H_
@@ -9,12 +9,12 @@ A class for very simple menus structure
#include <string> #include <string>
class SimpleMenu:public JGuiController{ class SimpleMenu:public JGuiController{
private: private:
int mHeight, mWidth, mX, mY; int mHeight, mWidth, mX, mY;
JLBFont* mFont; JLBFont* mFont;
std::string title; std::string title;
int displaytitle; int displaytitle;
public: public:
SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, int width, const char * _title = NULL); SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, int width, const char * _title = NULL);
void Render(); void Render();
void Add(int id, const char * Text); void Add(int id, const char * Text);
+2 -2
View File
@@ -10,7 +10,7 @@
class SimpleMenuItem: public JGuiObject class SimpleMenuItem: public JGuiObject
{ {
private: private:
bool mHasFocus; bool mHasFocus;
JLBFont *mFont; JLBFont *mFont;
const char* mText; const char* mText;
@@ -22,7 +22,7 @@ private:
public: public:
SimpleMenuItem(int id, JLBFont *font, const char* text, int x, int y, bool hasFocus = false); SimpleMenuItem(int id, JLBFont *font, const char* text, int x, int y, bool hasFocus = false);
virtual void Render(); virtual void Render();
+2 -2
View File
@@ -8,11 +8,11 @@ using std::string;
using std::map; using std::map;
class Subtypes{ class Subtypes{
protected: protected:
int nb_items; int nb_items;
map<string,int> values; map<string,int> values;
public: public:
static Subtypes * subtypesList; static Subtypes * subtypesList;
Subtypes(); Subtypes();
int Add(const char * subtype); int Add(const char * subtype);
+12 -12
View File
@@ -23,10 +23,10 @@ class CardDescriptor;
class TargetChooser: public TargetsList { class TargetChooser: public TargetsList {
protected: protected:
int forceTargetListReady; int forceTargetListReady;
public: public:
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1); TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1);
MTGCardInstance * source; //Optionnal source, used for protection from... MTGCardInstance * source; //Optionnal source, used for protection from...
@@ -52,7 +52,7 @@ class TargetChooserFactory{
class TargetZoneChooser:public TargetChooser{ class TargetZoneChooser:public TargetChooser{
public: public:
MTGGameZone * zones[6]; MTGGameZone * zones[6];
int nbzones; int nbzones;
int init(MTGGameZone ** _zones, int _nbzones); int init(MTGGameZone ** _zones, int _nbzones);
@@ -62,7 +62,7 @@ public:
}; };
class CreatureTargetChooser:public TargetZoneChooser{ class CreatureTargetChooser:public TargetZoneChooser{
public: public:
int maxpower; int maxpower;
int maxtoughness; int maxtoughness;
CreatureTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1); CreatureTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1);
@@ -73,7 +73,7 @@ public:
class DamageableTargetChooser:public CreatureTargetChooser{ class DamageableTargetChooser:public CreatureTargetChooser{
public: public:
DamageableTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets){}; DamageableTargetChooser(MTGGameZone ** _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets){};
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser(card, _maxtargets){}; DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):CreatureTargetChooser(card, _maxtargets){};
virtual int canTarget(Targetable * target); virtual int canTarget(Targetable * target);
@@ -81,13 +81,13 @@ public:
class PlayerTargetChooser:public TargetChooser{ class PlayerTargetChooser:public TargetChooser{
public: public:
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):TargetChooser(card, _maxtargets){}; PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1):TargetChooser(card, _maxtargets){};
virtual int canTarget(Targetable * target); virtual int canTarget(Targetable * target);
}; };
class TypeTargetChooser:public TargetZoneChooser{ class TypeTargetChooser:public TargetZoneChooser{
public: public:
int nbtypes; int nbtypes;
int types[10]; int types[10];
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1); TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1);
@@ -98,7 +98,7 @@ public:
}; };
class DescriptorTargetChooser:public TargetZoneChooser{ class DescriptorTargetChooser:public TargetZoneChooser{
public: public:
CardDescriptor * cd; CardDescriptor * cd;
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1); DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1);
DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1); DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
@@ -107,14 +107,14 @@ public:
class SpellTargetChooser:public TargetChooser{ class SpellTargetChooser:public TargetChooser{
public: public:
int color; int color;
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 ); SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 );
virtual int canTarget(Targetable * target); virtual int canTarget(Targetable * target);
}; };
class SpellOrPermanentTargetChooser:public TargetZoneChooser{ class SpellOrPermanentTargetChooser:public TargetZoneChooser{
public: public:
int color; int color;
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1); SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1);
virtual int canTarget(Targetable * target); virtual int canTarget(Targetable * target);
@@ -123,7 +123,7 @@ public:
class DamageTargetChooser:public TargetChooser{ class DamageTargetChooser:public TargetChooser{
public: public:
int color; int color;
int state; int state;
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED); DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
@@ -131,7 +131,7 @@ public:
}; };
class DamageOrPermanentTargetChooser:public TargetZoneChooser{ class DamageOrPermanentTargetChooser:public TargetZoneChooser{
public: public:
int color; int color;
DamageOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1); DamageOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1);
virtual int canTarget(Targetable * target); virtual int canTarget(Targetable * target);
+1 -1
View File
@@ -6,7 +6,7 @@
#define TARGET_STACKACTION 3 #define TARGET_STACKACTION 3
class Targetable{ class Targetable{
public: public:
virtual int typeAsTarget() = 0; virtual int typeAsTarget() = 0;
}; };
+1 -1
View File
@@ -12,7 +12,7 @@ class Interruptible;
class Damage; class Damage;
class TargetsList{ class TargetsList{
public: public:
int cursor; int cursor;
TargetsList(); TargetsList();
TargetsList(Targetable * _targets[], int nbtargets); TargetsList(Targetable * _targets[], int nbtargets);
+6 -6
View File
@@ -7,7 +7,7 @@
#include "../include/AIPlayer.h" #include "../include/AIPlayer.h"
class TestSuiteActions{ class TestSuiteActions{
public: public:
int nbitems; int nbitems;
string actions[MAX_TESTSUITE_ACTIONS]; string actions[MAX_TESTSUITE_ACTIONS];
void add(string action); void add(string action);
@@ -16,7 +16,7 @@ public:
}; };
class TestSuitePlayerZone{ class TestSuitePlayerZone{
public: public:
int cards[MAX_TESTUITE_CARDS]; int cards[MAX_TESTUITE_CARDS];
int nbitems; int nbitems;
void add(int cardid); void add(int cardid);
@@ -25,7 +25,7 @@ public:
}; };
class TestSuitePlayerData{ class TestSuitePlayerData{
public: public:
int life; int life;
ManaCost * manapool; ManaCost * manapool;
TestSuitePlayerZone zones[5]; TestSuitePlayerZone zones[5];
@@ -38,7 +38,7 @@ public:
class TestSuiteState{ class TestSuiteState{
public: public:
int phase; int phase;
void parsePlayerState(int playerId, string s); void parsePlayerState(int playerId, string s);
TestSuiteState(); TestSuiteState();
@@ -46,7 +46,7 @@ public:
void cleanup(); void cleanup();
}; };
class TestSuite{ class TestSuite{
public: public:
float timerLimit; float timerLimit;
int currentAction; int currentAction;
TestSuiteState initState; TestSuiteState initState;
@@ -71,7 +71,7 @@ public:
}; };
class TestSuiteAI:public AIPlayer{ class TestSuiteAI:public AIPlayer{
public: public:
TestSuite * suite; TestSuite * suite;
float timer; float timer;
TestSuiteAI(MTGAllCards * collection,TestSuite * suite, int playerId); TestSuiteAI(MTGAllCards * collection,TestSuite * suite, int playerId);
+5 -5
View File
@@ -12,11 +12,11 @@
#endif #endif
#ifdef LINUX #ifdef LINUX
#ifdef _DEBUG #ifdef _DEBUG
#define OutputDebugString(val) (std::cerr << val); #define OutputDebugString(val) (std::cerr << val);
#else #else
#define OutputDebugString(val) {} #define OutputDebugString(val) {}
#endif #endif
#endif #endif
#endif #endif
+1 -1
View File
@@ -33,7 +33,7 @@
using std::string; using std::string;
template <typename T, size_t N> template <typename T, size_t N>
char ( &_ArraySizeHelper( T (&array)[N] ))[N]; char ( &_ArraySizeHelper( T (&array)[N] ))[N];
#define countof( array ) (sizeof( _ArraySizeHelper( array ) )) #define countof( array ) (sizeof( _ArraySizeHelper( array ) ))
+42 -42
View File
@@ -39,8 +39,8 @@ int AIPlayer::Act(float dt){
void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("tapping land for mana\n"); OutputDebugString("tapping land for mana\n");
#endif #endif
ManaCost * diff = potentialMana->Diff(cost); ManaCost * diff = potentialMana->Diff(cost);
@@ -76,20 +76,20 @@ OutputDebugString("tapping land for mana\n");
delete(diff); delete(diff);
/* /*
for (int i=MTG_NB_COLORS-1; i>= 0; i--){ for (int i=MTG_NB_COLORS-1; i>= 0; i--){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf,"Testing %s \n" ,MTG_LAND_TEXTS[i]); sprintf(buf,"Testing %s \n" ,MTG_LAND_TEXTS[i]);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
currentCost = cost->getCost(i); currentCost = cost->getCost(i);
while(currentCost){ while(currentCost){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
sprintf(buf,"Cost for %s is %i \n" ,MTG_LAND_TEXTS[i], currentCost); sprintf(buf,"Cost for %s is %i \n" ,MTG_LAND_TEXTS[i], currentCost);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
MTGCardInstance * card = NULL; MTGCardInstance * card = NULL;
while(currentCost && (card = cd.nextmatch(game->inPlay, card))){ while(currentCost && (card = cd.nextmatch(game->inPlay, card))){
if (i==MTG_COLOR_ARTIFACT || card->hasSubtype(MTG_LAND_TEXTS[i]) ){ if (i==MTG_COLOR_ARTIFACT || card->hasSubtype(MTG_LAND_TEXTS[i]) ){
@@ -100,9 +100,9 @@ OutputDebugString(buf);
} }
} }
*/ */
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("ok land tapped"); OutputDebugString("ok land tapped");
#endif #endif
} }
//TODO a better function that does not take into account only basic lands //TODO a better function that does not take into account only basic lands
@@ -117,29 +117,29 @@ ManaCost * AIPlayer::getPotentialMana(){
if (card->hasSubtype("plains")){ if (card->hasSubtype("plains")){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Found Potential plain\n"); OutputDebugString("Found Potential plain\n");
#endif #endif
potentialMana->add(MTG_COLOR_WHITE,1); potentialMana->add(MTG_COLOR_WHITE,1);
}else if(card->hasSubtype("swamp")){ }else if(card->hasSubtype("swamp")){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Found Potential swamp\n"); OutputDebugString("Found Potential swamp\n");
#endif #endif
potentialMana->add(MTG_COLOR_BLACK,1); potentialMana->add(MTG_COLOR_BLACK,1);
}else if(card->hasSubtype("forest")){ }else if(card->hasSubtype("forest")){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Found Potential forestn\n"); OutputDebugString("Found Potential forestn\n");
#endif #endif
potentialMana->add(MTG_COLOR_GREEN,1); potentialMana->add(MTG_COLOR_GREEN,1);
}else if(card->hasSubtype("mountain")){ }else if(card->hasSubtype("mountain")){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Found Potential Mountain\n"); OutputDebugString("Found Potential Mountain\n");
#endif #endif
potentialMana->add(MTG_COLOR_RED,1); potentialMana->add(MTG_COLOR_RED,1);
}else if(card->hasSubtype("island")){ }else if(card->hasSubtype("island")){
potentialMana->add(MTG_COLOR_BLUE,1); potentialMana->add(MTG_COLOR_BLUE,1);
}else{ }else{
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("WTF ????\n"); OutputDebugString("WTF ????\n");
#endif #endif
} }
} }
@@ -268,7 +268,7 @@ int AIPlayer::getCreaturesInfo(Player * player, int neededInfo , int untapMode,
int AIPlayer::chooseAttackers(){ int AIPlayer::chooseAttackers(){
//Attack with all creatures //Attack with all creatures
//How much damage can the other player do during his next Attack ? //How much damage can the other player do during his next Attack ?
int opponentForce = getCreaturesInfo(opponent(),INFO_CREATURESPOWER); int opponentForce = getCreaturesInfo(opponent(),INFO_CREATURESPOWER);
int opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES); int opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES);
@@ -355,16 +355,16 @@ int AIPlayer::combatDamages(){
int currentGamePhase = gameObs->getCurrentGamePhase(); int currentGamePhase = gameObs->getCurrentGamePhase();
if (currentGamePhase != MTG_PHASE_COMBATDAMAGE) return 0; if (currentGamePhase != MTG_PHASE_COMBATDAMAGE) return 0;
DamageResolverLayer * drl = gameObs->mLayers->combatLayer(); DamageResolverLayer * drl = gameObs->mLayers->combatLayer();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("AI Combat Phase START\n"); OutputDebugString("AI Combat Phase START\n");
#endif #endif
if (drl->currentChoosingPlayer == this){ if (drl->currentChoosingPlayer == this){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("This player chooses\n"); OutputDebugString("This player chooses\n");
#endif #endif
for (int i = 0; i < drl->mCount; i++){ for (int i = 0; i < drl->mCount; i++){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("AI Combat Phase\n"); OutputDebugString("AI Combat Phase\n");
#endif #endif
DamagerDamaged * current = (DamagerDamaged *) drl->mObjects[i]; DamagerDamaged * current = (DamagerDamaged *) drl->mObjects[i];
if (current->damageSelecter == this){ if (current->damageSelecter == this){
@@ -381,18 +381,18 @@ OutputDebugString("AI Combat Phase\n");
}else{ }else{
over = opponent->hasLethalDamage(); over = opponent->hasLethalDamage();
} }
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "==========\n%s deals %i damages to %s\n=============\n", current->card->getName(), 1, opponent->card->getName()); sprintf(buf, "==========\n%s deals %i damages to %s\n=============\n", current->card->getName(), 1, opponent->card->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
} }
} }
} }
if (canardEmissaire && !current->card->has(TRAMPLE)){ if (canardEmissaire && !current->card->has(TRAMPLE)){
while(current->dealOneDamage(canardEmissaire)){ while(current->dealOneDamage(canardEmissaire)){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("==========\nDealing damage to Canard Emissaire\n================\n"); OutputDebugString("==========\nDealing damage to Canard Emissaire\n================\n");
#endif #endif
} }
@@ -507,20 +507,20 @@ int AIPlayerBaka::Act(float dt){
return 0; return 0;
} }
initTimer(); initTimer();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("==========\nNew Act CALL\n================\n"); OutputDebugString("==========\nNew Act CALL\n================\n");
#endif #endif
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("==========\nCombat Damages ?\n================\n"); OutputDebugString("==========\nCombat Damages ?\n================\n");
#endif #endif
if (combatDamages()) return 0; if (combatDamages()) return 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("==========\nChoose Target ?\n================\n"); OutputDebugString("==========\nChoose Target ?\n================\n");
#endif #endif
if (chooseTarget()) return 0; if (chooseTarget()) return 0;
@@ -555,11 +555,11 @@ OutputDebugString("==========\nChoose Target ?\n================\n");
//No mana, try to get some //No mana, try to get some
getPotentialMana(); getPotentialMana();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buffe[4096]; char buffe[4096];
sprintf(buffe,"potentail mana %i\n",potentialMana->getConvertedCost() ); sprintf(buffe,"potentail mana %i\n",potentialMana->getConvertedCost() );
OutputDebugString(buffe); OutputDebugString(buffe);
#endif #endif
if (potentialMana->getConvertedCost() > 0){ if (potentialMana->getConvertedCost() > 0){
@@ -583,8 +583,8 @@ OutputDebugString(buffe);
SAFE_DELETE(potentialMana); SAFE_DELETE(potentialMana);
}else{ }else{
//We have mana, we can try to put the card into play //We have mana, we can try to put the card into play
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Mana paid, ready to put card into play\n"); OutputDebugString("Mana paid, ready to put card into play\n");
#endif #endif
if (nextCardToPlay){ if (nextCardToPlay){
gameObs->cardClick(nextCardToPlay); gameObs->cardClick(nextCardToPlay);
@@ -595,8 +595,8 @@ OutputDebugString("Mana paid, ready to put card into play\n");
} }
} }
if (NULL == card && NULL == nextCardToPlay){ if (NULL == card && NULL == nextCardToPlay){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Switching to next phase\n"); OutputDebugString("Switching to next phase\n");
#endif #endif
gameObs->userRequestNextGamePhase(); gameObs->userRequestNextGamePhase();
} }
+2 -2
View File
@@ -13,7 +13,7 @@ ActionElement::ActionElement(int id):JGuiObject(id){
} }
/* /*
void ActionElement::RenderMessageBackground(float y0, int _height){ void ActionElement::RenderMessageBackground(float y0, int _height){
float height = _height; float height = _height;
PIXEL_TYPE colors_up[] = PIXEL_TYPE colors_up[] =
{ {
@@ -36,7 +36,7 @@ void ActionElement::RenderMessageBackground(float y0, int _height){
renderer->FillRect(0,y0+height/2,SCREEN_WIDTH,height/2,colors_down); renderer->FillRect(0,y0+height/2,SCREEN_WIDTH,height/2,colors_down);
// mEngine->DrawLine(0,y0,SCREEN_WIDTH,y0,ARGB(128,255,255,255)); // mEngine->DrawLine(0,y0,SCREEN_WIDTH,y0,ARGB(128,255,255,255));
// mEngine->DrawLine(0,y0+height,SCREEN_WIDTH,y0+height,ARGB(128,255,255,255)); // mEngine->DrawLine(0,y0+height,SCREEN_WIDTH,y0+height,ARGB(128,255,255,255));
}*/ }*/
int ActionElement::getActivity(){ int ActionElement::getActivity(){
+5 -5
View File
@@ -1,5 +1,5 @@
/* /*
The Action Stack contains all information for Game Events that can be interrupted (Interruptible) The Action Stack contains all information for Game Events that can be interrupted (Interruptible)
*/ */
#include "../include/debug.h" #include "../include/debug.h"
#include "../include/ActionStack.h" #include "../include/ActionStack.h"
@@ -9,7 +9,7 @@ The Action Stack contains all information for Game Events that can be interrupte
#include "../include/ManaCost.h" #include "../include/ManaCost.h"
/* /*
NextGamePhase requested by user NextGamePhase requested by user
*/ */
int NextGamePhase::resolve(){ int NextGamePhase::resolve(){
@@ -233,9 +233,9 @@ int ActionStack::addAction(Interruptible * action){
int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){ int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096], *p = buf; char buf[4096], *p = buf;
sprintf(buf, "Add spell\n"); sprintf(buf, "Add spell\n");
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
Spell * spell = NEW Spell(mCount,_source,_targets,_nbtargets, mana); Spell * spell = NEW Spell(mCount,_source,_targets,_nbtargets, mana);
return addAction(spell); return addAction(spell);
+4 -4
View File
@@ -25,7 +25,7 @@ void Blocker::init(ManaCost * _cost){
//Default behaviour for blockers : they block the card they're attached to //Default behaviour for blockers : they block the card they're attached to
void Blocker::Update(float dt){ void Blocker::Update(float dt){
game = GameObserver::GetInstance(); game = GameObserver::GetInstance();
int newPhase = game->getCurrentGamePhase(); int newPhase = game->getCurrentGamePhase();
if (newPhase != currentPhase){ if (newPhase != currentPhase){
MTGCardInstance * _target; MTGCardInstance * _target;
@@ -36,9 +36,9 @@ game = GameObserver::GetInstance();
} }
_target->getBlockers()->Add(this); _target->getBlockers()->Add(this);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Adding Blocker to %s \n", _target->model->getName()); sprintf(buf, "Adding Blocker to %s \n", _target->model->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
} }
currentPhase = newPhase; currentPhase = newPhase;
+4 -4
View File
@@ -116,10 +116,10 @@ MTGCardInstance * CardDescriptor::nextmatch(MTGGameZone * zone, MTGCardInstance
if (NULL == previous) found = 1; if (NULL == previous) found = 1;
for(int i=0; i < zone->nb_cards; i++){ for(int i=0; i < zone->nb_cards; i++){
if(found && match(zone->cards[i])){ if(found && match(zone->cards[i])){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf,"Card Descriptor MATCH!: %s \n" ,(zone->cards[i])->getName()); sprintf(buf,"Card Descriptor MATCH!: %s \n" ,(zone->cards[i])->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
return zone->cards[i]; return zone->cards[i];
} }
+1 -1
View File
@@ -128,7 +128,7 @@ void CardDisplay::Render(){
JRenderer * r = JRenderer::GetInstance(); JRenderer * r = JRenderer::GetInstance();
r->DrawRect(x,y,nb_displayed_items * 30 + 20, 50, ARGB(255,255,255,255)); r->DrawRect(x,y,nb_displayed_items * 30 + 20, 50, ARGB(255,255,255,255));
if (!mCount) return; if (!mCount) return;
for (int i = start_item; i< start_item + nb_displayed_items && i < mCount; i++){ for (int i = start_item; i< start_item + nb_displayed_items && i < mCount; i++){
if (mObjects[i]){ if (mObjects[i]){
mObjects[i]->Render(); mObjects[i]->Render();
+3 -3
View File
@@ -14,9 +14,9 @@ int ConstraintResolver::untap(GameObserver * game, MTGCardInstance * card){
Player * player = game->currentPlayer; Player * player = game->currentPlayer;
while ((blocker = blockers->next())){ while ((blocker = blockers->next())){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "next\n"); sprintf(buf, "next\n");
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
untapManaCost->add(blocker->untapManaCost()); untapManaCost->add(blocker->untapManaCost());
} }
+28 -28
View File
@@ -9,52 +9,52 @@ Counter::Counter(MTGCardInstance * _target, const char * _name,int _power, int _
init(_target,_name,_power, _toughness); init(_target,_name,_power, _toughness);
} }
int Counter::init(MTGCardInstance * _target,const char * _name, int _power, int _toughness){ int Counter::init(MTGCardInstance * _target,const char * _name, int _power, int _toughness){
target = _target; target = _target;
name = _name; name = _name;
power = _power; power = _power;
toughness = _toughness; toughness = _toughness;
nb = 1; nb = 1;
return 1; return 1;
} }
bool Counter::sameAs(const char * _name, int _power, int _toughness){ bool Counter::sameAs(const char * _name, int _power, int _toughness){
if (power == 0 && toughness == 0) return (name.compare(_name) == 0); if (power == 0 && toughness == 0) return (name.compare(_name) == 0);
return (power == _power && toughness == _toughness); return (power == _power && toughness == _toughness);
} }
bool Counter::cancels(int _power, int _toughness){ bool Counter::cancels(int _power, int _toughness){
if (power == 0 && toughness == 0) return false; if (power == 0 && toughness == 0) return false;
return (power == -_power && toughness == -_toughness); return (power == -_power && toughness == -_toughness);
} }
int Counter::added(){ int Counter::added(){
if (power != 0 || toughness != 0){ if (power != 0 || toughness != 0){
target->power+= power; target->power+= power;
target->addToToughness(toughness); target->addToToughness(toughness);
} }
return 1; return 1;
} }
int Counter::removed(){ int Counter::removed(){
if (power != 0 || toughness != 0){ if (power != 0 || toughness != 0){
target->power-= power; target->power-= power;
target->addToToughness(-toughness); target->addToToughness(-toughness);
} }
return 1; return 1;
} }
Counters::Counters(MTGCardInstance * _target):target(_target){ Counters::Counters(MTGCardInstance * _target):target(_target){
mCount = 0; mCount = 0;
} }
Counters::~Counters(){ Counters::~Counters(){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
delete counters[i]; delete counters[i];
} }
} }
int Counters::addCounter(const char * _name,int _power, int _toughness){ int Counters::addCounter(const char * _name,int _power, int _toughness){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
if (counters[i]->cancels( _power,_toughness) && counters[i]->nb > 0){ if (counters[i]->cancels( _power,_toughness) && counters[i]->nb > 0){
counters[i]->removed(); counters[i]->removed();
@@ -75,13 +75,13 @@ Counter::Counter(MTGCardInstance * _target, const char * _name,int _power, int _
counter->added(); counter->added();
mCount++; mCount++;
return mCount; return mCount;
} }
int Counters::addCounter(int _power, int _toughness){ int Counters::addCounter(int _power, int _toughness){
return addCounter("",_power, _toughness); return addCounter("",_power, _toughness);
} }
int Counters::removeCounter(const char * _name,int _power, int _toughness){ int Counters::removeCounter(const char * _name,int _power, int _toughness){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
if (counters[i]->sameAs(_name, _power,_toughness)){ if (counters[i]->sameAs(_name, _power,_toughness)){
if (counters[i]->nb < 1) return 0; if (counters[i]->nb < 1) return 0;
@@ -91,30 +91,30 @@ Counter::Counter(MTGCardInstance * _target, const char * _name,int _power, int _
} }
} }
return 0; return 0;
} }
int Counters::removeCounter(int _power, int _toughness){ int Counters::removeCounter(int _power, int _toughness){
return removeCounter("",_power, _toughness); return removeCounter("",_power, _toughness);
} }
Counter * Counters::hasCounter(const char * _name,int _power, int _toughness){ Counter * Counters::hasCounter(const char * _name,int _power, int _toughness){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
if (counters[i]->sameAs(_name, _power,_toughness)){ if (counters[i]->sameAs(_name, _power,_toughness)){
if (counters[i]->nb > 0) return counters[i]; if (counters[i]->nb > 0) return counters[i];
} }
} }
return NULL; return NULL;
} }
Counter * Counters::hasCounter(int _power , int _toughness ){ Counter * Counters::hasCounter(int _power , int _toughness ){
return hasCounter("",_power, _toughness); return hasCounter("",_power, _toughness);
} }
Counter * Counters::getNext(Counter * previous){ Counter * Counters::getNext(Counter * previous){
int found = 0; int found = 0;
for (int i = 0; i < mCount ; i++){ for (int i = 0; i < mCount ; i++){
if (found && counters[i]->nb > 0) return counters[i]; if (found && counters[i]->nb > 0) return counters[i];
if (counters[i] == previous) found = 1; if (counters[i] == previous) found = 1;
} }
return NULL; return NULL;
} }
+20 -20
View File
@@ -4,44 +4,44 @@
DamagerDamaged::DamagerDamaged(CardGui * cardg, Player * _damageSelecter, bool _hasFocus):CardGui(0, cardg->card,cardg->defaultHeight,cardg->x,cardg->y, _hasFocus){ DamagerDamaged::DamagerDamaged(CardGui * cardg, Player * _damageSelecter, bool _hasFocus):CardGui(0, cardg->card,cardg->defaultHeight,cardg->x,cardg->y, _hasFocus){
mCount = 0; mCount = 0;
damageSelecter = _damageSelecter; damageSelecter = _damageSelecter;
damageToDeal = card->power; damageToDeal = card->power;
} }
DamagerDamaged::~DamagerDamaged(){ DamagerDamaged::~DamagerDamaged(){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
delete damages[i]; delete damages[i];
damages[i] = NULL; damages[i] = NULL;
} }
} }
int DamagerDamaged::sumDamages(){ int DamagerDamaged::sumDamages(){
int total = 0; int total = 0;
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
total += damages[i]->damage; total += damages[i]->damage;
} }
return total; return total;
} }
int DamagerDamaged::hasLethalDamage(){ int DamagerDamaged::hasLethalDamage(){
if (sumDamages() >= card->toughness) return 1; if (sumDamages() >= card->toughness) return 1;
return 0; return 0;
} }
int DamagerDamaged::dealOneDamage(DamagerDamaged * target){ int DamagerDamaged::dealOneDamage(DamagerDamaged * target){
if (!damageToDeal) return 0; if (!damageToDeal) return 0;
damageToDeal--; damageToDeal--;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "==========\n%s can still deal %i damages\n=============\n", card->getName(), damageToDeal); sprintf(buf, "==========\n%s can still deal %i damages\n=============\n", card->getName(), damageToDeal);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
return target->addDamage(1, this); return target->addDamage(1, this);
} }
int DamagerDamaged::addDamage(int damage, DamagerDamaged * source){ int DamagerDamaged::addDamage(int damage, DamagerDamaged * source){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
if (damages[i]->source == source->card){ if (damages[i]->source == source->card){
damages[i]->damage+= damage; damages[i]->damage+= damage;
@@ -51,14 +51,14 @@ OutputDebugString(buf);
damages[mCount] = NEW Damage(mCount, source->card, this->card,damage); damages[mCount] = NEW Damage(mCount, source->card, this->card,damage);
mCount++; mCount++;
return damage; return damage;
} }
int DamagerDamaged::removeDamagesTo(DamagerDamaged * target){ int DamagerDamaged::removeDamagesTo(DamagerDamaged * target){
damageToDeal+= target->removeDamagesFrom(this); damageToDeal+= target->removeDamagesFrom(this);
return 1; return 1;
} }
int DamagerDamaged::removeDamagesFrom(DamagerDamaged * source){ int DamagerDamaged::removeDamagesFrom(DamagerDamaged * source){
for (int i = 0; i < mCount; i++){ for (int i = 0; i < mCount; i++){
if (damages[i]->source == source->card){ if (damages[i]->source == source->card){
int damage = damages[i]->damage; int damage = damages[i]->damage;
@@ -70,9 +70,9 @@ OutputDebugString(buf);
} }
} }
return 0; return 0;
} }
void DamagerDamaged::Render(Player * currentPlayer){ void DamagerDamaged::Render(Player * currentPlayer){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(0.75);
@@ -92,4 +92,4 @@ OutputDebugString(buf);
mFont->DrawString(buf,x+5, y+5); mFont->DrawString(buf,x+5, y+5);
} }
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
} }
+27 -27
View File
@@ -60,7 +60,7 @@ void GameApp::Create()
//_CrtSetBreakAlloc(368); //_CrtSetBreakAlloc(368);
LOG("starting Game"); LOG("starting Game");
//Test for Music files presence //Test for Music files presence
std::ifstream file("Res/sound/Track0.mp3"); std::ifstream file("Res/sound/Track0.mp3");
if(file){ if(file){
file.close(); file.close();
@@ -75,43 +75,43 @@ void GameApp::Create()
} }
CommonRes->CreateTexture("graphics/menuicons.png"); CommonRes->CreateTexture("graphics/menuicons.png");
//Creating thes quad in this specific order allows us to have them in the correct order to call them by integer id //Creating thes quad in this specific order allows us to have them in the correct order to call them by integer id
CommonRes->CreateQuad("c_artifact", "graphics/menuicons.png", 10 + 6*32, 32, 32, 32); CommonRes->CreateQuad("c_artifact", "graphics/menuicons.png", 10 + 6*32, 32, 32, 32);
CommonRes->CreateQuad("c_green", "graphics/menuicons.png", 10 + 0*32, 32, 32, 32); CommonRes->CreateQuad("c_green", "graphics/menuicons.png", 10 + 0*32, 32, 32, 32);
CommonRes->CreateQuad("c_blue", "graphics/menuicons.png", 10 + 1*32, 32, 32, 32); CommonRes->CreateQuad("c_blue", "graphics/menuicons.png", 10 + 1*32, 32, 32, 32);
CommonRes->CreateQuad("c_red", "graphics/menuicons.png", 10 + 3*32, 32, 32, 32); CommonRes->CreateQuad("c_red", "graphics/menuicons.png", 10 + 3*32, 32, 32, 32);
CommonRes->CreateQuad("c_black", "graphics/menuicons.png", 10 + 2*32, 32, 32, 32); CommonRes->CreateQuad("c_black", "graphics/menuicons.png", 10 + 2*32, 32, 32, 32);
CommonRes->CreateQuad("c_white", "graphics/menuicons.png", 10 + 4*32, 32, 32, 32); CommonRes->CreateQuad("c_white", "graphics/menuicons.png", 10 + 4*32, 32, 32, 32);
CommonRes->CreateQuad("c_land", "graphics/menuicons.png", 10 + 5*32, 32, 32, 32); CommonRes->CreateQuad("c_land", "graphics/menuicons.png", 10 + 5*32, 32, 32, 32);
CommonRes->CreateTexture("sets/back.jpg"); CommonRes->CreateTexture("sets/back.jpg");
CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285); CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285);
CommonRes->CreateTexture("sets/back_thumb.jpg"); CommonRes->CreateTexture("sets/back_thumb.jpg");
CommonRes->CreateQuad("back_thumb", "sets/back_thumb.jpg", 0, 0, 45, 64); CommonRes->CreateQuad("back_thumb", "sets/back_thumb.jpg", 0, 0, 45, 64);
CommonRes->CreateTexture("graphics/particles.png"); CommonRes->CreateTexture("graphics/particles.png");
CommonRes->CreateQuad("particles", "graphics/particles.png", 0, 0, 32, 32); CommonRes->CreateQuad("particles", "graphics/particles.png", 0, 0, 32, 32);
CommonRes->GetQuad("particles")->SetHotSpot(16,16); CommonRes->GetQuad("particles")->SetHotSpot(16,16);
CommonRes->LoadJLBFont("graphics/f3",16); CommonRes->LoadJLBFont("graphics/f3",16);
CommonRes->LoadJLBFont("graphics/magic",16); CommonRes->LoadJLBFont("graphics/magic",16);
//CommonRes->CreateTexture("graphics/interrupt.png"); //CommonRes->CreateTexture("graphics/interrupt.png");
//CommonRes->CreateQuad("interrupt", "graphics/interrupt.png", 0, 0, 256, 128); //CommonRes->CreateQuad("interrupt", "graphics/interrupt.png", 0, 0, 256, 128);
cache = NEW TexturesCache(); cache = NEW TexturesCache();
collection = NEW MTGAllCards(cache); collection = NEW MTGAllCards(cache);
Particles[0] = NEW hgeParticleSystem("graphics/particle1.psi", CommonRes->GetQuad("particles")); Particles[0] = NEW hgeParticleSystem("graphics/particle1.psi", CommonRes->GetQuad("particles"));
Particles[1] = NEW hgeParticleSystem("graphics/particle2.psi", CommonRes->GetQuad("particles")); Particles[1] = NEW hgeParticleSystem("graphics/particle2.psi", CommonRes->GetQuad("particles"));
Particles[2] = NEW hgeParticleSystem("graphics/particle3.psi", CommonRes->GetQuad("particles")); Particles[2] = NEW hgeParticleSystem("graphics/particle3.psi", CommonRes->GetQuad("particles"));
Particles[3] = NEW hgeParticleSystem("graphics/particle4.psi", CommonRes->GetQuad("particles")); Particles[3] = NEW hgeParticleSystem("graphics/particle4.psi", CommonRes->GetQuad("particles"));
Particles[4] = NEW hgeParticleSystem("graphics/particle5.psi", CommonRes->GetQuad("particles")); Particles[4] = NEW hgeParticleSystem("graphics/particle5.psi", CommonRes->GetQuad("particles"));
Particles[5] = NEW hgeParticleSystem("graphics/particle7.psi", CommonRes->GetQuad("particles")); Particles[5] = NEW hgeParticleSystem("graphics/particle7.psi", CommonRes->GetQuad("particles"));
mGameStates[GAME_STATE_DECK_VIEWER] = NEW GameStateDeckViewer(this); mGameStates[GAME_STATE_DECK_VIEWER] = NEW GameStateDeckViewer(this);
mGameStates[GAME_STATE_DECK_VIEWER]->Create(); mGameStates[GAME_STATE_DECK_VIEWER]->Create();
+1 -1
View File
@@ -16,7 +16,7 @@
class GameApp: public JApp class GameApp: public JApp
{ {
public: public:
GameApp(); GameApp();
virtual ~GameApp(); virtual ~GameApp();
virtual void Create(); virtual void Create();
+3 -3
View File
@@ -225,8 +225,8 @@ void GameObserver::nextStep(){
void GameObserver::ButtonPressed (int controllerId, PlayGuiObject * _object){ void GameObserver::ButtonPressed (int controllerId, PlayGuiObject * _object){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Click\n"); OutputDebugString("Click\n");
#endif #endif
int id = _object->GetId(); int id = _object->GetId();
if (id >=0){ if (id >=0){
@@ -240,7 +240,7 @@ OutputDebugString("Click\n");
} }
if (id == -1 || id == -2){ if (id == -1 || id == -2){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Click Player !\n"); OutputDebugString("Click Player !\n");
#endif #endif
cardClick(NULL, ((GuiAvatar *)_object)->player); cardClick(NULL, ((GuiAvatar *)_object)->player);
} }
+9 -9
View File
@@ -5,7 +5,7 @@
#include "../include/PlayerData.h" #include "../include/PlayerData.h"
#ifdef TESTSUITE #ifdef TESTSUITE
#include "../include/TestSuiteAI.h" #include "../include/TestSuiteAI.h"
#endif #endif
GameStateDuel::GameStateDuel(GameApp* parent): GameState(parent) { GameStateDuel::GameStateDuel(GameApp* parent): GameState(parent) {
@@ -34,8 +34,8 @@ void GameStateDuel::Start()
#ifdef TESTSUITE #ifdef TESTSUITE
if (testSuite) delete testSuite; if (testSuite) delete testSuite;
testSuite = NEW TestSuite("Res/test/_tests.txt"); testSuite = NEW TestSuite("Res/test/_tests.txt");
#endif #endif
@@ -98,14 +98,14 @@ void GameStateDuel::loadPlayer(int playerId, int decknb){
#ifdef TESTSUITE #ifdef TESTSUITE
void GameStateDuel::loadTestSuitePlayers(){ void GameStateDuel::loadTestSuitePlayers(){
OutputDebugString ("loading suite 1\n"); OutputDebugString ("loading suite 1\n");
if (!testSuite) return; if (!testSuite) return;
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
if (mPlayers[i]){ if (mPlayers[i]){
delete mPlayers[i]; delete mPlayers[i];
} }
mPlayers[i] = NEW TestSuiteAI(mParent->collection,testSuite, i); mPlayers[i] = NEW TestSuiteAI(mParent->collection,testSuite, i);
OutputDebugString ("loading suite 2\n"); OutputDebugString ("loading suite 2\n");
deck[i] = mPlayers[i]->game; deck[i] = mPlayers[i]->game;
} }
@@ -113,11 +113,11 @@ OutputDebugString ("loading suite 2\n");
game = NULL; game = NULL;
if (!game){ if (!game){
GameObserver::Init(mPlayers, 2); GameObserver::Init(mPlayers, 2);
OutputDebugString ("loading suite 3\n"); OutputDebugString ("loading suite 3\n");
game = GameObserver::GetInstance(); game = GameObserver::GetInstance();
OutputDebugString ("loading suite 4\n"); OutputDebugString ("loading suite 4\n");
game->startGame(0,0); game->startGame(0,0);
OutputDebugString ("loading suite 5\n"); OutputDebugString ("loading suite 5\n");
} }
} }
#endif #endif
@@ -270,7 +270,7 @@ void GameStateDuel::Render()
} }
void GameStateDuel::ButtonPressed(int controllerId, int controlId) void GameStateDuel::ButtonPressed(int controllerId, int controlId)
{ {
switch (controlId) switch (controlId)
{ {
case 1: case 1:
+1 -1
View File
@@ -102,7 +102,7 @@ void GameStateOptions::Render()
void GameStateOptions::ButtonPressed(int controllerId, int controlId) void GameStateOptions::ButtonPressed(int controllerId, int controlId)
{ {
switch (controlId){ switch (controlId){
case 1: case 1:
optionsList->save(); optionsList->save();
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
The shop is where the player can buy cards, decks... The shop is where the player can buy cards, decks...
*/ */
#include "../include/debug.h" #include "../include/debug.h"
#include <JRenderer.h> #include <JRenderer.h>
+1 -1
View File
@@ -5,7 +5,7 @@
using namespace std; using namespace std;
#if defined (WIN32) #if defined (WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
void Logger::Log(char * text){ void Logger::Log(char * text){
+20 -20
View File
@@ -1271,7 +1271,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
} }
// Addons ALA // Addons ALA
case 175114: // Master of Etherium case 175114: // Master of Etherium
{ {
@@ -1286,7 +1286,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break; break;
} }
//Addons The Dark //Addons The Dark
case 1797: //Inferno does 6 damage to all players and all creatures. case 1797: //Inferno does 6 damage to all players and all creatures.
{ {
@@ -1314,7 +1314,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break; break;
} }
//Addons Legends //Addons Legends
case 1470: //Acid Rain case 1470: //Acid Rain
{ {
destroyAllFromTypeInPlay("forest", card); destroyAllFromTypeInPlay("forest", card);
@@ -1341,7 +1341,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island")); game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island"));
break; break;
} }
//Addons ICE-AGE Cards //Addons ICE-AGE Cards
case 2631: //Jokulhaups case 2631: //Jokulhaups
{ {
destroyAllFromTypeInPlay("artifact", card); destroyAllFromTypeInPlay("artifact", card);
@@ -1632,44 +1632,44 @@ void TriggeredAbility::Update(float dt){
// //
InstantAbility::InstantAbility(int _id, MTGCardInstance * source):MTGAbility(_id, source){ InstantAbility::InstantAbility(int _id, MTGCardInstance * source):MTGAbility(_id, source){
init = 0; init = 0;
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
if(game->players[i]->game->inPlay->hasCard(source)){ if(game->players[i]->game->inPlay->hasCard(source)){
game->players[i]->game->putInGraveyard(source); game->players[i]->game->putInGraveyard(source);
} }
} }
} }
void InstantAbility::Update(float dt){ void InstantAbility::Update(float dt){
if (!init){ if (!init){
init = resolve(); init = resolve();
} }
} }
InstantAbility::InstantAbility(int _id, MTGCardInstance * source, Damageable * _target):MTGAbility(_id, source, _target){ InstantAbility::InstantAbility(int _id, MTGCardInstance * source, Damageable * _target):MTGAbility(_id, source, _target){
init = 0; init = 0;
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
if(game->players[i]->game->inPlay->hasCard(source)){ if(game->players[i]->game->inPlay->hasCard(source)){
game->players[i]->game->putInGraveyard(source); game->players[i]->game->putInGraveyard(source);
} }
} }
} }
//Instant abilities last generally until the end of the turn //Instant abilities last generally until the end of the turn
int InstantAbility::testDestroy(){ int InstantAbility::testDestroy(){
int newPhase = game->getCurrentGamePhase(); int newPhase = game->getCurrentGamePhase();
if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) return 1; if (newPhase != currentPhase && newPhase == MTG_PHASE_UNTAP) return 1;
currentPhase = newPhase; currentPhase = newPhase;
return 0; return 0;
} }
void ListMaintainerAbility::Update(float dt){ void ListMaintainerAbility::Update(float dt){
map<MTGCardInstance *,bool>::iterator it=cards.begin(); map<MTGCardInstance *,bool>::iterator it=cards.begin();
while(it != cards.end()){ while(it != cards.end()){
MTGCardInstance * card = (*it).first; MTGCardInstance * card = (*it).first;
@@ -1688,7 +1688,7 @@ void TriggeredAbility::Update(float dt){
} }
if (doDelete || !canBeInList(card)){ if (doDelete || !canBeInList(card)){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("DELETE FRO LISTMAINTAINER\n"); OutputDebugString("DELETE FRO LISTMAINTAINER\n");
#endif #endif
cards.erase(card); cards.erase(card);
removed(card); removed(card);
@@ -1709,10 +1709,10 @@ OutputDebugString("DELETE FRO LISTMAINTAINER\n");
} }
} }
} }
} }
//Destroy the spell -> remove all targets //Destroy the spell -> remove all targets
int ListMaintainerAbility::destroy(){ int ListMaintainerAbility::destroy(){
map<MTGCardInstance *,bool>::iterator it; map<MTGCardInstance *,bool>::iterator it;
for ( it=cards.begin() ; it != cards.end(); it++ ){ for ( it=cards.begin() ; it != cards.end(); it++ ){
@@ -1720,4 +1720,4 @@ OutputDebugString("DELETE FRO LISTMAINTAINER\n");
} }
cards.clear(); cards.clear();
return 1; return 1;
} }
+10 -10
View File
@@ -1,8 +1,8 @@
/*--------------------------------------------- /*---------------------------------------------
Card Instance Card Instance
Instance of a given MTGCard in the game Instance of a given MTGCard in the game
Although there is only one MTGCard of each type, there can be as much Instances of it as needed in the game Although there is only one MTGCard of each type, there can be as much Instances of it as needed in the game
-------------------------------------------- --------------------------------------------
*/ */
#include "../include/debug.h" #include "../include/debug.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
@@ -11,8 +11,8 @@ Although there is only one MTGCard of each type, there can be as much Instances
MTGCardInstance::MTGCardInstance(): MTGCard(), Damageable(0){ MTGCardInstance::MTGCardInstance(): MTGCard(), Damageable(0){
LOG("==Creating MTGCardInstance=="); LOG("==Creating MTGCardInstance==");
initMTGCI(); initMTGCI();
LOG("==Creating MTGCardInstance Successful=="); LOG("==Creating MTGCardInstance Successful==");
} }
MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to): MTGCard(card), Damageable(card->getToughness()){ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to): MTGCard(card), Damageable(card->getToughness()){
LOG("==Creating MTGCardInstance=="); LOG("==Creating MTGCardInstance==");
@@ -71,10 +71,10 @@ int MTGCardInstance::isInPlay(){
int MTGCardInstance::afterDamage(){ int MTGCardInstance::afterDamage(){
if (!doDamageTest) return 0; if (!doDamageTest) return 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096], *p = buf; char buf[4096], *p = buf;
sprintf(buf,"After Damage Test, life is %i for %s \n",life,model->getName()); sprintf(buf,"After Damage Test, life is %i for %s \n",life,model->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
doDamageTest = 0; doDamageTest = 0;
if (life <=0 && isInPlay()){ if (life <=0 && isInPlay()){
+1 -1
View File
@@ -108,7 +108,7 @@ int MTGAllCards::processConfLine(char *buffer, MTGCard *card){
}else if(key.compare("toughness")==0){ }else if(key.compare("toughness")==0){
card->setToughness(atoi(value.c_str())); card->setToughness(atoi(value.c_str()));
}else{ }else{
} }
return i; return i;
+3 -3
View File
@@ -284,9 +284,9 @@ void MTGInPlay::untapAll(){
cards[i]->setUntapping(); cards[i]->setUntapping();
if (cards[i]->getBlockers()->isEmpty()){ if (cards[i]->getBlockers()->isEmpty()){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Can untap %s\n", cards[i]->getName()); sprintf(buf, "Can untap %s\n", cards[i]->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
cards[i]->untap(); cards[i]->untap();
} }
+2 -2
View File
@@ -1,5 +1,5 @@
/* This class handles the display on the main game screen : /* This class handles the display on the main game screen :
cards in play, graveyard, library, games phases, Players avatars cards in play, graveyard, library, games phases, Players avatars
*/ */
#include "../include/debug.h" #include "../include/debug.h"
@@ -327,7 +327,7 @@ void MTGGuiPlay::Render(){
//alphaBg[2]= 255; //alphaBg[2]= 255;
//alphaBg[3] = 255; //alphaBg[3] = 255;
//mBg2->SetColor(ARGB(alphaBg[0], alphaBg[1],alphaBg[2],alphaBg[3])); //mBg2->SetColor(ARGB(alphaBg[0], alphaBg[1],alphaBg[2],alphaBg[3]));
renderer->RenderQuad(mBg2,0,17); renderer->RenderQuad(mBg2,0,17);
if (game->currentGamePhase >=MTG_PHASE_COMBATBEGIN && game->currentGamePhase < MTG_PHASE_COMBATEND){ if (game->currentGamePhase >=MTG_PHASE_COMBATBEGIN && game->currentGamePhase < MTG_PHASE_COMBATEND){
if (alphaBg[0] < 50){ if (alphaBg[0] < 50){
+2 -2
View File
@@ -43,11 +43,11 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card){
int candefend = 0; int candefend = 0;
while (!result){ while (!result){
currentOpponent = game->currentPlayer->game->inPlay->getNextAttacker(currentOpponent); currentOpponent = game->currentPlayer->game->inPlay->getNextAttacker(currentOpponent);
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf,"Defenser Toggle %s \n" ,card->model->getName()); sprintf(buf,"Defenser Toggle %s \n" ,card->model->getName());
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
candefend = card->toggleDefenser(currentOpponent); candefend = card->toggleDefenser(currentOpponent);
result = (candefend || currentOpponent == NULL); result = (candefend || currentOpponent == NULL);
} }
+9 -9
View File
@@ -5,12 +5,12 @@
#if defined (WIN32) #if defined (WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
#endif #endif
ManaCost * manaCost; ManaCost * manaCost;
if (_manaCost){ if (_manaCost){
@@ -56,7 +56,7 @@ char buf[4096];
int values[2]; int values[2];
if (!intvalue && value.size() > 1){ if (!intvalue && value.size() > 1){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Hybrid Mana ???\n"); OutputDebugString("Hybrid Mana ???\n");
#endif #endif
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
char c = value[i]; char c = value[i];
@@ -96,9 +96,9 @@ ManaCost::ManaCost(int _cost[], int nb_elems){
int i; int i;
int total = nb_elems; int total = nb_elems;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Create New MAnaCost, total Colors : %i\n", total); sprintf(buf, "Create New MAnaCost, total Colors : %i\n", total);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
for (i = 0; i < total; i++){ for (i = 0; i < total; i++){
cost[_cost[i*2]] = _cost[i*2 + 1]; cost[_cost[i*2]] = _cost[i*2 + 1];
@@ -285,9 +285,9 @@ ManaCost * ManaCost::Diff(ManaCost * _cost){
int colorless_idx = MTG_COLOR_ARTIFACT * 2 + 1; int colorless_idx = MTG_COLOR_ARTIFACT * 2 + 1;
if (diff[colorless_idx] < 0){ if (diff[colorless_idx] < 0){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
//char buf[4096], *p = buf; //char buf[4096], *p = buf;
//sprintf(buf, "--Diff color TEST %i : %i\n", i, cost[i]); //sprintf(buf, "--Diff color TEST %i : %i\n", i, cost[i]);
OutputDebugString("Colorless mana not enough\n"); OutputDebugString("Colorless mana not enough\n");
#endif #endif
for (int i=0; i < MTG_NB_COLORS; i++){ for (int i=0; i < MTG_NB_COLORS; i++){
if (diff[i*2 + 1] > 0){ if (diff[i*2 + 1] > 0){
+27 -27
View File
@@ -4,7 +4,7 @@
#include "../include/GameOptions.h" #include "../include/GameOptions.h"
OptionItem::OptionItem(int _id, string _displayValue, int _maxValue, int _increment):JGuiObject(0){ OptionItem::OptionItem(int _id, string _displayValue, int _maxValue, int _increment):JGuiObject(0){
id = _id; id = _id;
maxValue = _maxValue; maxValue = _maxValue;
increment = _increment; increment = _increment;
@@ -13,17 +13,17 @@
hasFocus = 0; hasFocus = 0;
x = 0; x = 0;
y = 0; y = 0;
} }
OptionItem::~OptionItem(){ OptionItem::~OptionItem(){
//TODO //TODO
} }
void OptionItem::setData(){ void OptionItem::setData(){
GameOptions::GetInstance()->values[id] = value; GameOptions::GetInstance()->values[id] = value;
} }
void OptionItem::Render(){ void OptionItem::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont("graphics/f3"); JLBFont * mFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
if (hasFocus){ if (hasFocus){
mFont->SetColor(ARGB(255,255,255,0)); mFont->SetColor(ARGB(255,255,255,0));
@@ -35,37 +35,37 @@
char buf[512]; char buf[512];
sprintf(buf, "%i", value); sprintf(buf, "%i", value);
mFont->DrawString(buf,SCREEN_WIDTH -10 ,y,JGETEXT_RIGHT); mFont->DrawString(buf,SCREEN_WIDTH -10 ,y,JGETEXT_RIGHT);
} }
void OptionItem::Update(float dt){ void OptionItem::Update(float dt){
JGE * mEngine = JGE::GetInstance(); JGE * mEngine = JGE::GetInstance();
if (hasFocus){ if (hasFocus){
if (mEngine->GetButtonClick(PSP_CTRL_CIRCLE)) updateValue(); if (mEngine->GetButtonClick(PSP_CTRL_CIRCLE)) updateValue();
} }
} }
void OptionItem::Entering(){ void OptionItem::Entering(){
hasFocus = true; hasFocus = true;
} }
bool OptionItem::Leaving(){ bool OptionItem::Leaving(){
hasFocus = false; hasFocus = false;
return true; return true;
} }
OptionItem * options[20]; OptionItem * options[20];
int nbitems; int nbitems;
OptionsList::OptionsList(){ OptionsList::OptionsList(){
nbitems = 0; nbitems = 0;
current = -1; current = -1;
} }
OptionsList::~OptionsList(){ OptionsList::~OptionsList(){
for (int i = 0 ; i < nbitems; i++){ for (int i = 0 ; i < nbitems; i++){
SAFE_DELETE(options[i]); SAFE_DELETE(options[i]);
} }
} }
void OptionsList::Add(OptionItem * item){ void OptionsList::Add(OptionItem * item){
if (nbitems < 20){ if (nbitems < 20){
options[nbitems] = item; options[nbitems] = item;
item->x = 10; item->x = 10;
@@ -77,9 +77,9 @@
} }
} }
} }
void OptionsList::Render(){ void OptionsList::Render(){
if (!nbitems){ if (!nbitems){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont("graphics/f3"); JLBFont * mFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
mFont->DrawString("NO OPTIONS AVAILABLE",SCREEN_WIDTH/2, 5, JGETEXT_RIGHT); mFont->DrawString("NO OPTIONS AVAILABLE",SCREEN_WIDTH/2, 5, JGETEXT_RIGHT);
@@ -87,16 +87,16 @@
for (int i = 0 ; i < nbitems; i++){ for (int i = 0 ; i < nbitems; i++){
options[i]->Render(); options[i]->Render();
} }
} }
void OptionsList::save(){ void OptionsList::save(){
for (int i = 0; i < nbitems; i++){ for (int i = 0; i < nbitems; i++){
options[i]->setData(); options[i]->setData();
} }
GameOptions::GetInstance()->save(); GameOptions::GetInstance()->save();
} }
void OptionsList::Update(float dt){ void OptionsList::Update(float dt){
JGE * mEngine = JGE::GetInstance(); JGE * mEngine = JGE::GetInstance();
if (mEngine->GetButtonClick(PSP_CTRL_UP)) if (mEngine->GetButtonClick(PSP_CTRL_UP))
{ {
+14 -14
View File
@@ -100,7 +100,7 @@ void GuiGameZone::toggleDisplay(){
} }
void GuiGameZone::Render(){ void GuiGameZone::Render(){
//Texture //Texture
JQuad * quad = GameApp::CommonRes->GetQuad("back_thumb"); JQuad * quad = GameApp::CommonRes->GetQuad("back_thumb");
float scale = defaultHeight / quad->mHeight; float scale = defaultHeight / quad->mHeight;
@@ -121,32 +121,32 @@ void GuiGameZone::toggleDisplay(){
mFont->DrawString(buffer, x, y); mFont->DrawString(buffer, x, y);
if (showCards) cd->Render(); if (showCards) cd->Render();
} }
void GuiGameZone::ButtonPressed(int controllerId, int controlId){ void GuiGameZone::ButtonPressed(int controllerId, int controlId){
toggleDisplay(); toggleDisplay();
} }
void GuiGameZone::Update(float dt){ void GuiGameZone::Update(float dt){
if (showCards) cd->Update(dt); if (showCards) cd->Update(dt);
PlayGuiObject::Update(dt); PlayGuiObject::Update(dt);
} }
GuiGameZone::GuiGameZone(int id, float desiredHeight,float _x, float _y, bool hasFocus,MTGGameZone * _zone): PlayGuiObject(id, desiredHeight, _x, _y, hasFocus), zone(_zone){ GuiGameZone::GuiGameZone(int id, float desiredHeight,float _x, float _y, bool hasFocus,MTGGameZone * _zone): PlayGuiObject(id, desiredHeight, _x, _y, hasFocus), zone(_zone){
cd = NEW CardDisplay(id, GameObserver::GetInstance(), _x, _y, this); cd = NEW CardDisplay(id, GameObserver::GetInstance(), _x, _y, this);
showCards = 0; showCards = 0;
} }
GuiGameZone::~GuiGameZone(){ GuiGameZone::~GuiGameZone(){
if(cd) delete cd; if(cd) delete cd;
} }
GuiGraveyard::GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->graveyard){ GuiGraveyard::GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->graveyard){
type= GUI_GRAVEYARD; type= GUI_GRAVEYARD;
} }
GuiLibrary::GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->library){ GuiLibrary::GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->library){
type = GUI_LIBRARY; type = GUI_LIBRARY;
} }
+2 -2
View File
@@ -75,7 +75,7 @@ int PlayGuiObjectController::getClosestItem(int direction, float tolerance){
/* /*
int PlayGuiObjectController::getClosestItem(int direction, float tolerance){ int PlayGuiObjectController::getClosestItem(int direction, float tolerance){
if (mCount == 0){ if (mCount == 0){
return -1; return -1;
} }
@@ -165,7 +165,7 @@ int PlayGuiObjectController::getClosestItem(int direction, float tolerance){
fprintf(stderr, "Closest Match ID: %i\n", closest_match_id); fprintf(stderr, "Closest Match ID: %i\n", closest_match_id);
return closest_match_id; return closest_match_id;
} }
*/ */
void PlayGuiObjectController::Update(float dt){ void PlayGuiObjectController::Update(float dt){
for (int i=0;i<mCount;i++){ for (int i=0;i<mCount;i++){
+4 -4
View File
@@ -64,10 +64,10 @@ int Player::manaBurn(){
int Player::testLife(){ int Player::testLife(){
if (life <=0){ if (life <=0){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
//char buf[4096], *p = buf; //char buf[4096], *p = buf;
//sprintf(buf, "--Diff color TEST %i : %i\n", i, cost[i]); //sprintf(buf, "--Diff color TEST %i : %i\n", i, cost[i]);
OutputDebugString("GAME OVER\n"); OutputDebugString("GAME OVER\n");
#endif #endif
//return GameObserver::GetInstance()->endOfGame(); //return GameObserver::GetInstance()->endOfGame();
} }
+3 -3
View File
@@ -337,7 +337,7 @@ int TargetChooser::targetListSet(){
/** /**
Choose anything that has a given list of types Choose anything that has a given list of types
**/ **/
TypeTargetChooser::TypeTargetChooser(const char * _type, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){ TypeTargetChooser::TypeTargetChooser(const char * _type, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
int id = Subtypes::subtypesList->Add(_type); int id = Subtypes::subtypesList->Add(_type);
@@ -386,7 +386,7 @@ int TypeTargetChooser::canTarget(Targetable * target ){
/** /**
A Target Chooser associated to a Card Descriptor object, for fine tuning of targets description A Target Chooser associated to a Card Descriptor object, for fine tuning of targets description
**/ **/
DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){ DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
GameObserver * game = GameObserver::GetInstance(); GameObserver * game = GameObserver::GetInstance();
@@ -418,7 +418,7 @@ int DescriptorTargetChooser::canTarget(Targetable * target){
/** /**
Choose a creature Choose a creature
**/ **/
CreatureTargetChooser::CreatureTargetChooser( MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){ CreatureTargetChooser::CreatureTargetChooser( MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
+9 -9
View File
@@ -204,7 +204,7 @@ void TestSuite::initGame(){
}else{ }else{
timerLimit = 0.26; timerLimit = 0.26;
} }
//Put the GameObserver in the initial state //Put the GameObserver in the initial state
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
OutputDebugString("Init Game\n"); OutputDebugString("Init Game\n");
g->phaseRing->goToPhase(initState.phase, g->players[0]); g->phaseRing->goToPhase(initState.phase, g->players[0]);
@@ -254,7 +254,7 @@ int TestSuite::Log(const char * text){
} }
int TestSuite::assertGame(){ int TestSuite::assertGame(){
//compare the game state with the results //compare the game state with the results
char result[4096]; char result[4096];
sprintf(result,"<h3>%s</h3>",files[currentfile-1].c_str()); sprintf(result,"<h3>%s</h3>",files[currentfile-1].c_str());
Log(result); Log(result);
@@ -352,17 +352,17 @@ int TestSuite::loadNext(){
int TestSuite::phaseStrToInt(string s){ int TestSuite::phaseStrToInt(string s){
if (s.compare("untap") == 0) return MTG_PHASE_UNTAP; if (s.compare("untap") == 0) return MTG_PHASE_UNTAP;
if (s.compare("upkeep") == 0)return MTG_PHASE_UPKEEP; if (s.compare("upkeep") == 0)return MTG_PHASE_UPKEEP;
if (s.compare("draw") == 0)return MTG_PHASE_DRAW; if (s.compare("draw") == 0)return MTG_PHASE_DRAW;
if (s.compare("firstmain") == 0)return MTG_PHASE_FIRSTMAIN; if (s.compare("firstmain") == 0)return MTG_PHASE_FIRSTMAIN;
if (s.compare("combatbegin") == 0)return MTG_PHASE_COMBATBEGIN; if (s.compare("combatbegin") == 0)return MTG_PHASE_COMBATBEGIN;
if (s.compare("combatattackers") == 0)return MTG_PHASE_COMBATATTACKERS; if (s.compare("combatattackers") == 0)return MTG_PHASE_COMBATATTACKERS;
if (s.compare("combatblockers") == 0)return MTG_PHASE_COMBATBLOCKERS; if (s.compare("combatblockers") == 0)return MTG_PHASE_COMBATBLOCKERS;
if (s.compare("combatdamage") == 0)return MTG_PHASE_COMBATDAMAGE; if (s.compare("combatdamage") == 0)return MTG_PHASE_COMBATDAMAGE;
if (s.compare("combatend") == 0)return MTG_PHASE_COMBATEND; if (s.compare("combatend") == 0)return MTG_PHASE_COMBATEND;
if (s.compare("secondmain") == 0)return MTG_PHASE_SECONDMAIN; if (s.compare("secondmain") == 0)return MTG_PHASE_SECONDMAIN;
if (s.compare("endofturn") == 0)return MTG_PHASE_ENDOFTURN; if (s.compare("endofturn") == 0)return MTG_PHASE_ENDOFTURN;
if (s.compare("cleanup") == 0)return MTG_PHASE_CLEANUP; if (s.compare("cleanup") == 0)return MTG_PHASE_CLEANUP;
return -1; return -1;
} }
void TestSuiteActions::cleanup(){ void TestSuiteActions::cleanup(){
+10 -10
View File
@@ -3,8 +3,8 @@
int lowercase(string sBuffer) { int lowercase(string sBuffer) {
std::transform( sBuffer.begin(), sBuffer.end(), sBuffer.begin(), std::transform( sBuffer.begin(), sBuffer.end(), sBuffer.begin(),
::tolower ); ::tolower );
return 1; return 1;
} }
@@ -36,7 +36,7 @@ int append_str(char * s1, char * s2, char * target){
int filesize(const char * filename){ int filesize(const char * filename){
int file_size = 0; int file_size = 0;
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
FILE * file = fopen(filename, "rb"); FILE * file = fopen(filename, "rb");
if (file != NULL) if (file != NULL)
{ {
@@ -45,14 +45,14 @@ int filesize(const char * filename){
fclose(file); fclose(file);
} }
#else #else
int file = sceIoOpen(filename,PSP_O_RDONLY, 0777); int file = sceIoOpen(filename,PSP_O_RDONLY, 0777);
if (file > 0){ if (file > 0){
file_size = sceIoLseek(file, 0, PSP_SEEK_END); file_size = sceIoLseek(file, 0, PSP_SEEK_END);
sceIoClose(file); sceIoClose(file);
} }
#endif #endif
return file_size; return file_size;
} }
@@ -120,7 +120,7 @@ int readline (char * in_buffer, char * out_buffer, int cursor){
} }
out_buffer[i] = 0; out_buffer[i] = 0;
return(cursor); return(cursor);
} }
@@ -128,7 +128,7 @@ int readfile_to_ints(const char * filename, int * out_buffer){
std::ifstream fichier(filename); std::ifstream fichier(filename);
std::string s; std::string s;
unsigned int count = 0; unsigned int count = 0;
if(fichier){ if(fichier){
while(std::getline(fichier,s)){ while(std::getline(fichier,s)){
int value = atoi(s.c_str()); int value = atoi(s.c_str());
if (value){ if (value){
@@ -137,8 +137,8 @@ if(fichier){
} }
} }
} }
fichier.close(); fichier.close();
return count; return count;
} }