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