Merge branch 'master' into minmax
This commit is contained in:
@@ -9,10 +9,6 @@
|
||||
#include <JGui.h>
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
#define INACTIVE 0
|
||||
#define ACTION_REQUESTED 1
|
||||
#define ACTIVE 2
|
||||
|
||||
class MTGCardInstance;
|
||||
class ManaCost;
|
||||
class Targetable;
|
||||
@@ -22,31 +18,33 @@ class WEvent;
|
||||
class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
enum Activity{
|
||||
Inactive,
|
||||
ActionRequested,
|
||||
Active
|
||||
};
|
||||
|
||||
Activity activity;
|
||||
TargetChooser * tc;
|
||||
public:
|
||||
GamePhase currentPhase;
|
||||
GamePhase newPhase;
|
||||
int modal;
|
||||
int waitingForAnswer;
|
||||
int getActivity();
|
||||
virtual void Update(float){};
|
||||
virtual void Render(){};
|
||||
virtual void Update(float){}
|
||||
virtual void Render(){}
|
||||
virtual int testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int destroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
ActionElement(int id);
|
||||
ActionElement(const ActionElement& copyFromMe);
|
||||
TargetChooser * getActionTc(){return tc;}
|
||||
@@ -62,27 +60,22 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int stillInUse(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int receiveEvent(WEvent *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int reactToClick(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual const char * getMenuText()
|
||||
virtual const string getMenuText()
|
||||
{
|
||||
return "Ability";
|
||||
}
|
||||
;
|
||||
virtual ActionElement * clone() const = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -41,16 +41,9 @@ class DamageStack;
|
||||
class ManaCost;
|
||||
class TargetChooser;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable
|
||||
{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering()
|
||||
@@ -186,6 +179,11 @@ public:
|
||||
class ActionStack :public GuiLayer
|
||||
{
|
||||
public:
|
||||
enum ActionStackMode{
|
||||
ACTIONSTACK_STANDARD = 0,
|
||||
ACTIONSTACK_TARGET = 1
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NOT_DECIDED = 0,
|
||||
@@ -207,7 +205,7 @@ protected:
|
||||
InterruptDecision interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
ActionStackMode mode;
|
||||
int checked;
|
||||
ATutorialMessage* currentTutorial;
|
||||
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
|
||||
|
||||
+101
-189
@@ -873,8 +873,8 @@ public:
|
||||
return 0;
|
||||
if (!tc->canTarget(e->damage->target)) return 0;
|
||||
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == DAMAGE_COMBAT) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
|
||||
e->damage->target->thatmuch = e->damage->damage;
|
||||
e->damage->source->thatmuch = e->damage->damage;
|
||||
this->source->thatmuch = e->damage->damage;
|
||||
@@ -1081,7 +1081,7 @@ public:
|
||||
ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AACounter * clone() const;
|
||||
};
|
||||
|
||||
@@ -1100,7 +1100,7 @@ public:
|
||||
bool all,ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AARemoveAllCounter * clone() const;
|
||||
};
|
||||
|
||||
@@ -1110,7 +1110,7 @@ class AAResetDamage: public ActivatedAbility
|
||||
public:
|
||||
AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAResetDamage * clone() const;
|
||||
};
|
||||
|
||||
@@ -1120,7 +1120,7 @@ public:
|
||||
string named;
|
||||
AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAFakeAbility * clone() const;
|
||||
};
|
||||
|
||||
@@ -1131,7 +1131,7 @@ public:
|
||||
|
||||
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFizzler* clone() const;
|
||||
};
|
||||
|
||||
@@ -1160,7 +1160,7 @@ public:
|
||||
string Cond;
|
||||
IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
IfThenAbility * clone() const;
|
||||
~IfThenAbility();
|
||||
};
|
||||
@@ -1179,7 +1179,7 @@ public:
|
||||
|
||||
void Update(float dt);
|
||||
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int testDestroy();
|
||||
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
@@ -1209,7 +1209,7 @@ public:
|
||||
bool CheckUserInput(JButton key);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int testDestroy();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * object);
|
||||
@@ -1225,7 +1225,7 @@ class AAProliferate: public ActivatedAbility
|
||||
public:
|
||||
AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAProliferate * clone() const;
|
||||
~AAProliferate();
|
||||
};
|
||||
@@ -1243,7 +1243,7 @@ public:
|
||||
int resolve();
|
||||
int addToGame();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
MultiAbility * clone() const;
|
||||
~MultiAbility();
|
||||
};
|
||||
@@ -1258,8 +1258,9 @@ public:
|
||||
|
||||
GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
|
||||
int restrictions = 0, MTGGameZone * dest = NULL);
|
||||
GenericActivatedAbility(const GenericActivatedAbility& other);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
void Update(float dt);
|
||||
int testDestroy();
|
||||
@@ -1274,7 +1275,7 @@ class AALibraryBottom: public ActivatedAbility
|
||||
public:
|
||||
AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALibraryBottom * clone() const;
|
||||
};
|
||||
|
||||
@@ -1284,7 +1285,7 @@ class AACopier: public ActivatedAbility
|
||||
public:
|
||||
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AACopier * clone() const;
|
||||
};
|
||||
//imprint
|
||||
@@ -1293,7 +1294,7 @@ class AAPhaseOut: public ActivatedAbility
|
||||
public:
|
||||
AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAPhaseOut * clone() const;
|
||||
};
|
||||
//cloning...this makes a token thats a copy of the target.
|
||||
@@ -1310,7 +1311,7 @@ public:
|
||||
AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0,
|
||||
string abilitiesStringList = "",string typeslist = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
AACloner * clone() const;
|
||||
~AACloner();
|
||||
@@ -1326,7 +1327,7 @@ public:
|
||||
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
|
||||
MTGGameZone * destinationZone(Targetable * target = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
const char * getMenuText(TargetChooser * fromTc);
|
||||
AAMover * clone() const;
|
||||
~AAMover();
|
||||
@@ -1342,7 +1343,7 @@ public:
|
||||
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
|
||||
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARandomMover * clone() const;
|
||||
~AARandomMover();
|
||||
};
|
||||
@@ -1356,7 +1357,7 @@ public:
|
||||
string menu;
|
||||
AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AABuryCard * clone() const;
|
||||
~AABuryCard();
|
||||
};
|
||||
@@ -1367,7 +1368,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADestroyCard * clone() const;
|
||||
~AADestroyCard();
|
||||
};
|
||||
@@ -1378,7 +1379,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AASacrificeCard * clone() const;
|
||||
~AASacrificeCard();
|
||||
};
|
||||
@@ -1389,7 +1390,7 @@ public:
|
||||
MTGAbility * andAbility;
|
||||
AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADiscardCard * clone() const;
|
||||
~AADiscardCard();
|
||||
};
|
||||
@@ -1409,7 +1410,7 @@ public:
|
||||
string tcString;
|
||||
|
||||
GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString ="");
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
~GenericTargetAbility();
|
||||
GenericTargetAbility * clone() const;
|
||||
int resolve();
|
||||
@@ -1447,7 +1448,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Ninjutsu";
|
||||
}
|
||||
@@ -1479,7 +1480,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Remove From Combat";
|
||||
}
|
||||
@@ -1501,7 +1502,7 @@ public:
|
||||
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
|
||||
TargetChooser::UNSET,bool noReplace = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADrawer * clone() const;
|
||||
int getNumCards();
|
||||
};
|
||||
@@ -1521,7 +1522,7 @@ public:
|
||||
ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
|
||||
int addToGame();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ACastRestriction * clone() const;
|
||||
~ACastRestriction();
|
||||
|
||||
@@ -1536,7 +1537,7 @@ public:
|
||||
|
||||
AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AInstantCastRestrictionUEOT * clone() const;
|
||||
~AInstantCastRestrictionUEOT();
|
||||
};
|
||||
@@ -1549,7 +1550,7 @@ public:
|
||||
AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALifer * clone() const;
|
||||
int getLife();
|
||||
|
||||
@@ -1562,7 +1563,7 @@ public:
|
||||
AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAWinGame * clone() const;
|
||||
};
|
||||
|
||||
@@ -1603,7 +1604,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
@@ -1645,7 +1646,7 @@ public:
|
||||
return InstantAbility::addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return Constants::MTGBasicAbilities[ability];
|
||||
}
|
||||
@@ -1706,7 +1707,7 @@ public:
|
||||
return ActivatedAbility::addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -1862,7 +1863,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
sprintf(menuText,"Protection from %s",tcstr.c_str());
|
||||
return menuText;
|
||||
@@ -2054,7 +2055,7 @@ public:
|
||||
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
|
||||
return 1;
|
||||
}
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(PT.size())
|
||||
{
|
||||
@@ -2147,7 +2148,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -2189,7 +2190,7 @@ public:
|
||||
return toAdd->addToGame();
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -2287,7 +2288,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Regenerate";
|
||||
}
|
||||
@@ -2494,7 +2495,7 @@ public:
|
||||
SAFE_DELETE(ability);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(ability)
|
||||
{
|
||||
@@ -2577,7 +2578,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -2620,7 +2621,7 @@ public:
|
||||
SAFE_DELETE(ability);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
//Special case for move
|
||||
if (AAMover * move = dynamic_cast<AAMover *>(ability))
|
||||
@@ -2725,7 +2726,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -2794,113 +2795,24 @@ public:
|
||||
//equipment
|
||||
class AEquip: public TargetAbility
|
||||
{
|
||||
public:
|
||||
private:
|
||||
bool isAttach;
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int restrictions =
|
||||
ActivatedAbility::AS_SORCERY) :
|
||||
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
|
||||
{
|
||||
aType = MTGAbility::STANDARD_EQUIP;
|
||||
}
|
||||
|
||||
public:
|
||||
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL,
|
||||
int restrictions = ActivatedAbility::AS_SORCERY);
|
||||
|
||||
int unequip()
|
||||
{
|
||||
if (source->target)
|
||||
{
|
||||
source->target->equipment -= 1;
|
||||
source->parentCards.clear();
|
||||
for(unsigned int w = 0;w < source->target->childrenCards.size();w++)
|
||||
{
|
||||
MTGCardInstance * child = source->target->childrenCards[w];
|
||||
if(child == source)
|
||||
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
|
||||
}
|
||||
}
|
||||
source->target = NULL;
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
|
||||
{
|
||||
SAFE_DELETE(a);
|
||||
continue;
|
||||
}
|
||||
game->removeObserver(currentAbilities[i]);
|
||||
}
|
||||
currentAbilities.clear();
|
||||
return 1;
|
||||
}
|
||||
int unequip();
|
||||
int equip(MTGCardInstance * equipped);
|
||||
|
||||
int equip(MTGCardInstance * equipped)
|
||||
{
|
||||
source->target = equipped;
|
||||
source->target->equipment += 1;
|
||||
source->parentCards.push_back(equipped);
|
||||
source->target->childrenCards.push_back((MTGCardInstance*)source);
|
||||
AbilityFactory af(game);
|
||||
af.getAbilities(¤tAbilities, NULL, source);
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a)) continue;
|
||||
if (dynamic_cast<ATeach *> (a)) continue;
|
||||
if (dynamic_cast<AAConnect *> (a)) continue;
|
||||
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
|
||||
{
|
||||
a->forceDestroy = 1;
|
||||
continue;
|
||||
}
|
||||
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
|
||||
{
|
||||
a->forceDestroy = 1;
|
||||
continue;
|
||||
}
|
||||
//we generally dont want to pass oneShot tokencreators to the cards
|
||||
//we equip...
|
||||
a->addToGame();
|
||||
}
|
||||
return 1;
|
||||
int resolve();
|
||||
const string getMenuText();
|
||||
|
||||
}
|
||||
|
||||
int resolve()
|
||||
{
|
||||
MTGCardInstance * mTarget = tc->getNextCardTarget();
|
||||
if (!mTarget) return 0;
|
||||
if (mTarget == source) return 0;
|
||||
unequip();
|
||||
equip(mTarget);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Equip";
|
||||
}
|
||||
|
||||
int testDestroy()
|
||||
{
|
||||
if (source->target && !game->isInPlay(source->target))
|
||||
unequip();
|
||||
if(!game->connectRule)
|
||||
{
|
||||
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
|
||||
unequip();
|
||||
}
|
||||
return TargetAbility::testDestroy();
|
||||
}
|
||||
|
||||
int destroy()
|
||||
{
|
||||
unequip();
|
||||
return TargetAbility::destroy();
|
||||
}
|
||||
|
||||
AEquip * clone() const
|
||||
{
|
||||
return NEW AEquip(*this);
|
||||
}
|
||||
int testDestroy();
|
||||
int destroy();
|
||||
|
||||
AEquip * clone() const;
|
||||
};
|
||||
|
||||
class ATokenCreator: public ActivatedAbility
|
||||
@@ -3123,7 +3035,7 @@ public:
|
||||
card->setAttacker(1);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
sprintf(menuText, "Create %s", name.c_str());
|
||||
return menuText;
|
||||
@@ -3224,7 +3136,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(name.size())
|
||||
return name.c_str();
|
||||
@@ -3397,7 +3309,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3609,7 +3521,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3632,7 +3544,7 @@ public:
|
||||
AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AASetHand * clone() const;
|
||||
|
||||
};
|
||||
@@ -3646,7 +3558,7 @@ public:
|
||||
AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AALifeSet * clone() const;
|
||||
~AALifeSet();
|
||||
|
||||
@@ -3663,7 +3575,7 @@ public:
|
||||
AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int getDamage();
|
||||
AADamager * clone() const;
|
||||
|
||||
@@ -3677,7 +3589,7 @@ public:
|
||||
|
||||
AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADamagePrevent * clone() const;
|
||||
~AADamagePrevent();
|
||||
};
|
||||
@@ -3691,7 +3603,7 @@ public:
|
||||
AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAAlterPoison * clone() const;
|
||||
~AAAlterPoison();
|
||||
};
|
||||
@@ -3719,7 +3631,7 @@ class AATapper: public ActivatedAbility
|
||||
public:
|
||||
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AATapper * clone() const;
|
||||
};
|
||||
|
||||
@@ -3729,7 +3641,7 @@ class AAUntapper: public ActivatedAbility
|
||||
public:
|
||||
AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAUntapper * clone() const;
|
||||
};
|
||||
|
||||
@@ -3750,7 +3662,7 @@ class AAFrozen: public ActivatedAbility
|
||||
public:
|
||||
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFrozen * clone() const;
|
||||
};
|
||||
/* ghetto new target*/
|
||||
@@ -3760,7 +3672,7 @@ public:
|
||||
bool retarget;
|
||||
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AANewTarget * clone() const;
|
||||
};
|
||||
/* morph*/
|
||||
@@ -3771,7 +3683,7 @@ public:
|
||||
AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
int testDestroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAMorph * clone() const;
|
||||
};
|
||||
/* flip*/
|
||||
@@ -3783,7 +3695,7 @@ public:
|
||||
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
|
||||
int resolve();
|
||||
int testDestroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAFlip * clone() const;
|
||||
};
|
||||
/* dynamic ability build*/
|
||||
@@ -3848,7 +3760,7 @@ string menu;
|
||||
int resolve();
|
||||
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
|
||||
int activateStored();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADynamic * clone() const;
|
||||
~AADynamic();
|
||||
};
|
||||
@@ -3901,7 +3813,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Swap power and toughness";
|
||||
}
|
||||
@@ -3917,7 +3829,7 @@ public:
|
||||
AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAExchangeLife * clone() const;
|
||||
|
||||
};
|
||||
@@ -4153,7 +4065,7 @@ public:
|
||||
int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false);
|
||||
int testDestroy();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ATransformer * clone() const;
|
||||
~ATransformer();
|
||||
};
|
||||
@@ -4176,7 +4088,7 @@ public:
|
||||
|
||||
ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<string>newAbilitiesList = vector<string>(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false,string menutext = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ATransformerInstant * clone() const;
|
||||
~ATransformerInstant();
|
||||
};
|
||||
@@ -4192,7 +4104,7 @@ public:
|
||||
WParsedPT * newWppt;
|
||||
PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
PTInstant * clone() const;
|
||||
~PTInstant();
|
||||
};
|
||||
@@ -4251,7 +4163,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Exalted";
|
||||
}
|
||||
@@ -4269,7 +4181,7 @@ public:
|
||||
ASwapPT * ability;
|
||||
ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ASwapPTUEOT * clone() const;
|
||||
~ASwapPTUEOT();
|
||||
};
|
||||
@@ -4346,7 +4258,7 @@ public:
|
||||
APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0);
|
||||
int resolve();
|
||||
int destroy();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APreventDamageTypesUEOT * clone() const;
|
||||
~APreventDamageTypesUEOT();
|
||||
};
|
||||
@@ -4363,7 +4275,7 @@ public:
|
||||
AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AVanishing * clone() const;
|
||||
~AVanishing();
|
||||
};
|
||||
@@ -4385,7 +4297,7 @@ public:
|
||||
void Update(float dt);
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
AUpkeep * clone() const;
|
||||
~AUpkeep();
|
||||
@@ -4411,7 +4323,7 @@ public:
|
||||
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APhaseAction * clone() const;
|
||||
~APhaseAction();
|
||||
};
|
||||
@@ -4425,7 +4337,7 @@ public:
|
||||
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
||||
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
APhaseActionGeneric * clone() const;
|
||||
~APhaseActionGeneric();
|
||||
|
||||
@@ -4445,7 +4357,7 @@ public:
|
||||
void Update(float dt);
|
||||
void resolveBlink();
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ABlink * clone() const;
|
||||
~ABlink();
|
||||
private:
|
||||
@@ -4463,7 +4375,7 @@ public:
|
||||
MTGAbility * stored;
|
||||
ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ABlinkGeneric * clone() const;
|
||||
~ABlinkGeneric();
|
||||
|
||||
@@ -5369,7 +5281,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "phase alter";
|
||||
}
|
||||
@@ -5388,7 +5300,7 @@ public:
|
||||
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AADepleter * clone() const;
|
||||
};
|
||||
|
||||
@@ -5401,7 +5313,7 @@ public:
|
||||
AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAModTurn * clone() const;
|
||||
};
|
||||
|
||||
@@ -5412,7 +5324,7 @@ public:
|
||||
AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AAShuffle * clone() const;
|
||||
};
|
||||
|
||||
@@ -5425,7 +5337,7 @@ public:
|
||||
|
||||
AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARemoveMana * clone() const;
|
||||
~AARemoveMana();
|
||||
|
||||
@@ -5440,7 +5352,7 @@ public:
|
||||
AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
AARandomDiscarder * clone() const;
|
||||
};
|
||||
|
||||
@@ -5612,7 +5524,7 @@ public:
|
||||
|
||||
int testDestroy(){return 0;};
|
||||
void Update(float dt);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * object);
|
||||
MTGCardInstance * makeCard();
|
||||
@@ -5638,7 +5550,7 @@ public:
|
||||
{
|
||||
WEventDamage * e = (WEventDamage *) event;
|
||||
Damage * d = e->damage;
|
||||
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT)
|
||||
if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
|
||||
return 0;
|
||||
MTGCardInstance * card = d->source;
|
||||
if (d->damage > 0 && card && (card == source || card == source->target))
|
||||
@@ -5729,7 +5641,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetColorChosen * clone() const;
|
||||
~AASetColorChosen();
|
||||
};
|
||||
@@ -5742,7 +5654,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetTypeChosen * clone() const;
|
||||
~AASetTypeChosen();
|
||||
};
|
||||
@@ -5756,7 +5668,7 @@ public:
|
||||
bool ANonWall;
|
||||
GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericChooseTypeColor * clone() const;
|
||||
~GenericChooseTypeColor();
|
||||
|
||||
@@ -5773,7 +5685,7 @@ public:
|
||||
MTGAbility * abilityAltered;
|
||||
AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AASetCoin * clone() const;
|
||||
~AASetCoin();
|
||||
};
|
||||
@@ -5784,7 +5696,7 @@ public:
|
||||
AASetCoin * setCoin;
|
||||
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericFlipACoin * clone() const;
|
||||
~GenericFlipACoin();
|
||||
|
||||
@@ -5803,7 +5715,7 @@ public:
|
||||
|
||||
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
GenericPaidAbility * clone() const;
|
||||
~GenericPaidAbility();
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _CACHE_ENGINE_H_
|
||||
#define _CACHE_ENGINE_H_
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "Threading.h"
|
||||
@@ -208,3 +211,5 @@ public:
|
||||
|
||||
CardRetrieverBase* CacheEngine::sInstance = NULL;
|
||||
bool CacheEngine::sIsThreaded = false;
|
||||
|
||||
#endif //_CACHE_ENGINE_H_
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
#include "MTGGameZones.h"
|
||||
#include "Counters.h"
|
||||
|
||||
#define CD_OR 1
|
||||
#define CD_AND 2
|
||||
|
||||
enum ENUM_COMPARISON_MODES
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
@@ -31,7 +28,12 @@ class CardDescriptor: public MTGCardInstance
|
||||
MTGCardInstance * match_not(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
int mode;
|
||||
enum Operator{
|
||||
CD_OR = 1,
|
||||
CD_AND = 2
|
||||
};
|
||||
|
||||
Operator mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
int manacostComparisonMode;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef _CARDEFFECT_H_
|
||||
#define _CARDEFFECT_H_
|
||||
|
||||
#include <JGE.h>
|
||||
#include "Effects.h"
|
||||
|
||||
struct CardGui;
|
||||
|
||||
class CardEffect: public Effect
|
||||
{
|
||||
public:
|
||||
CardEffect(CardGui* target);
|
||||
~CardEffect();
|
||||
private:
|
||||
CardGui* target;
|
||||
|
||||
public:
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif // _CARDEFFECT_H_
|
||||
@@ -101,10 +101,9 @@ public:
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
bool hasSubtype(int _subtype);
|
||||
bool hasSubtype(const char * _subtype);
|
||||
bool hasSubtype(const string& _subtype);
|
||||
bool hasType(int _type);
|
||||
bool hasType(const char * type);
|
||||
bool hasType(const string& type);
|
||||
|
||||
void setManaCost(const string& value);
|
||||
ManaCost * getManaCost();
|
||||
|
||||
@@ -11,17 +11,15 @@ class JGuiObject;
|
||||
class MTGCardInstance;
|
||||
class GameObserver;
|
||||
|
||||
#define DAMAGEABLE_MTGCARDINSTANCE 0
|
||||
#define DAMAGEABLE_PLAYER 1
|
||||
|
||||
#define DAMAGE_ALL_TYPES 0
|
||||
#define DAMAGE_COMBAT 1
|
||||
#define DAMAGE_OTHER 2
|
||||
|
||||
class Damageable:public Targetable
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
enum DamageableType{
|
||||
DAMAGEABLE_MTGCARDINSTANCE = 0,
|
||||
DAMAGEABLE_PLAYER
|
||||
};
|
||||
|
||||
int life;
|
||||
int handsize;
|
||||
int poisonCount;
|
||||
@@ -29,12 +27,14 @@ public:
|
||||
int preventable;
|
||||
int thatmuch;
|
||||
int lifeLostThisTurn;
|
||||
int type_as_damageable;
|
||||
DamageableType type_as_damageable;
|
||||
Damageable(GameObserver* observer, int _life)
|
||||
: Targetable(observer)
|
||||
{life=_life;lifeLostThisTurn = 0;};
|
||||
int getLife(){return life;};
|
||||
virtual int dealDamage(int damage){life-=damage;return life;};
|
||||
: Targetable(observer), life(_life), handsize(0),
|
||||
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
|
||||
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{}
|
||||
int getLife(){return life;}
|
||||
virtual int dealDamage(int damage){life-=damage;return life;}
|
||||
virtual int afterDamage(){return 0;}
|
||||
virtual int poisoned(){return 0;}
|
||||
virtual int prevented(){return 0;}
|
||||
@@ -47,17 +47,23 @@ public:
|
||||
|
||||
class Damage: public Interruptible
|
||||
{
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
enum DamageType{
|
||||
DAMAGE_ALL_TYPES = 0,
|
||||
DAMAGE_COMBAT,
|
||||
DAMAGE_OTHER
|
||||
};
|
||||
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
DamageType typeOfDamage;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, DamageType typeOfDamage = DAMAGE_OTHER);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
|
||||
};
|
||||
|
||||
class DamageStack : public GuiLayer, public Interruptible
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifndef _DECK_EDITOR_MENU_H
|
||||
#define _DECK_EDITOR_MENU_H
|
||||
#pragma once
|
||||
#include "DeckMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
@@ -15,7 +17,8 @@ private:
|
||||
StatsWrapper *stw;
|
||||
|
||||
public:
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const string& _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
|
||||
void Render();
|
||||
virtual ~DeckEditorMenu();
|
||||
};
|
||||
#endif //_DECK_EDITOR_MENU_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _DECK_MANAGER_H
|
||||
#define _DECK_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -43,3 +46,5 @@ public:
|
||||
~DeckManager();
|
||||
|
||||
};
|
||||
|
||||
#endif //_DECK_MANAGER_H
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
using JGuiController::Add;
|
||||
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
|
||||
virtual void Add(int id, const string& Text, const string& desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
|
||||
virtual void Close();
|
||||
void updateScroller();
|
||||
void RenderBackground();
|
||||
|
||||
@@ -77,9 +77,7 @@ public:
|
||||
}
|
||||
|
||||
// Setters
|
||||
void setDescription( const string description ) { mDescription = description; };
|
||||
|
||||
;
|
||||
void setDescription( const string& description ) { mDescription = description; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
string getManaColorIndex();
|
||||
void updateStats(string filename, MTGAllCards * collection);
|
||||
void updateStats(DeckDataWrapper *mtgDeck);
|
||||
int countCardsByType(const char * _type, DeckDataWrapper * myDeck);
|
||||
int countCardsByType(const string& _type, DeckDataWrapper * myDeck);
|
||||
float noLuck(int n, int a, int x);
|
||||
|
||||
vector<string> aiDeckNames;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "MTGCard.h"
|
||||
#include "MTGGameZones.h"
|
||||
|
||||
#include "CardEffect.h"
|
||||
#ifdef NETWORK_SUPPORT
|
||||
#include "JNetwork.h"
|
||||
#endif //NETWORK_SUPPORT
|
||||
@@ -49,7 +48,6 @@ public:
|
||||
|
||||
GameType gameType;
|
||||
Rules * rules;
|
||||
CardEffect *effect;
|
||||
#ifdef NETWORK_SUPPORT
|
||||
string mServerAddress;
|
||||
JNetwork* mpNetwork;
|
||||
|
||||
@@ -98,8 +98,8 @@ class GameObserver{
|
||||
int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true);
|
||||
GamePhase getCurrentGamePhase();
|
||||
void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; };
|
||||
const char * getCurrentGamePhaseName();
|
||||
const char * getNextGamePhaseName();
|
||||
const string& getCurrentGamePhaseName();
|
||||
const string& getNextGamePhaseName();
|
||||
void nextCombatStep();
|
||||
void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true);
|
||||
void cleanupPhase();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _GUI_MANA_H
|
||||
#define _GUI_MANA_H
|
||||
|
||||
#include "string.h"
|
||||
#include <vector>
|
||||
#include <hge/hgeparticle.h>
|
||||
@@ -51,3 +54,5 @@ public:
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif //_GUI_MANA_H
|
||||
|
||||
@@ -317,7 +317,7 @@ public:
|
||||
virtual TargetAbility* clone() const = 0;
|
||||
virtual void Render();
|
||||
virtual int resolve();
|
||||
virtual const char * getMenuText();
|
||||
virtual const string getMenuText();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
@@ -436,7 +436,7 @@ public:
|
||||
|
||||
void Update(float dt);
|
||||
virtual GenericTriggeredAbility* clone() const;
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
~GenericTriggeredAbility();
|
||||
};
|
||||
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
|
||||
int resolve();
|
||||
int reactToClick(MTGCardInstance* _card);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
~AManaProducer();
|
||||
virtual AManaProducer * clone() const;
|
||||
};
|
||||
|
||||
@@ -129,11 +129,11 @@ public:
|
||||
|
||||
|
||||
//types
|
||||
void addType(char * type_text);
|
||||
void addType(const string& type_text);
|
||||
virtual void addType(int id);
|
||||
void setType(const char * type_text);
|
||||
void setSubtype( string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
void setType(const string& type_text);
|
||||
void setSubtype(const string &value);
|
||||
int removeType(const string &value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
|
||||
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
|
||||
|
||||
@@ -19,7 +19,7 @@ class MTGPack;
|
||||
class MTGSetInfo
|
||||
{
|
||||
public:
|
||||
MTGSetInfo(string _id);
|
||||
MTGSetInfo(const string& _id);
|
||||
~MTGSetInfo();
|
||||
string id; //Short name: 10E, RAV, etc. Automatic from folder.
|
||||
string author; //Author of set, for crediting mod makers, etc.
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
MTGSets();
|
||||
~MTGSets();
|
||||
|
||||
int Add(const char * subtype);
|
||||
int Add(const string& subtype);
|
||||
int findSet(string value);
|
||||
int findBlock(string s);
|
||||
int size();
|
||||
@@ -127,8 +127,10 @@ public:
|
||||
MTGCard * getCardByName(string name);
|
||||
void loadFolder(const string& folder, const string& filename="" );
|
||||
|
||||
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
||||
int countByType(const char * _type);
|
||||
int load(const string& config_file);
|
||||
int load(const string& config_file, const string& setName);
|
||||
int load(const string& config_file, int set_id);
|
||||
int countByType(const string& _type);
|
||||
int countByColor(int color);
|
||||
int countBySet(int setId);
|
||||
int totalCards();
|
||||
@@ -136,7 +138,7 @@ public:
|
||||
|
||||
static int findType(string subtype, bool forceAdd = true) {
|
||||
boost::mutex::scoped_lock lock(instance->mMutex);
|
||||
int result = instance->subtypesList.find(subtype, forceAdd);
|
||||
int result = instance->subtypesList.find(subtype, forceAdd);
|
||||
return result;
|
||||
};
|
||||
static int add(string value, unsigned int parentType) {
|
||||
@@ -218,8 +220,8 @@ public:
|
||||
int totalCards();
|
||||
int totalPrice();
|
||||
MTGDeck(MTGAllCards * _allcards);
|
||||
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
|
||||
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL,
|
||||
MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
|
||||
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const string& subtype = "",
|
||||
int * colors = NULL, int nbcolors = 0);
|
||||
int add(int cardid);
|
||||
int add(MTGDeck * deck); // adds the contents of "deck" into myself
|
||||
|
||||
@@ -293,7 +293,7 @@ class Constants
|
||||
|
||||
static map<string,int> MTGBasicAbilitiesMap;
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const string MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
|
||||
static int GetBasicAbilityIndex(string mtgAbility);
|
||||
|
||||
@@ -95,7 +95,7 @@ class MTGGameZone {
|
||||
void cleanupPhase();
|
||||
void beforeBeginPhase();
|
||||
|
||||
unsigned int countByType(const char * value);
|
||||
unsigned int countByType(const string &value);
|
||||
unsigned int countByCanTarget(TargetChooser * tc);
|
||||
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
|
||||
MTGCardInstance * findByName(string name);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef _MTGPACCK_H_
|
||||
#ifndef _MTGPACK_H_
|
||||
#define _MTGPACK_H_
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPutInPlayRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast card normally";
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGKickerRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "pay kicker";
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAlternativeCostRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(alternativeName.size())
|
||||
return alternativeName.c_str();
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBuyBackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast and buy back";
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGFlashBackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "flash back";
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGRetraceRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "retrace";
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGMorphCostRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "play morphed";
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
string suspendmenu;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGSuspendRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual MTGSuspendRule * clone() const;
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAttackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Attacker";
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Attack Planeswalker";
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
MTGCardInstance* attacker;
|
||||
AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
const string getMenuText();
|
||||
AAPlaneswalkerAttacked * clone() const;
|
||||
~AAPlaneswalkerAttacked();
|
||||
};
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGBlockRule(GameObserver* observer, int _id);
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
virtual MTGBlockRule * clone() const;
|
||||
~MTGBlockRule();
|
||||
};
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card, int id);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Momir";
|
||||
}
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
MTGCardInstance * genEquip(int id);
|
||||
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
|
||||
int receiveEvent(WEvent * event);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Stone Hewer";
|
||||
}
|
||||
@@ -419,7 +419,7 @@ class MTGHermitRule: public PermanentAbility
|
||||
public:
|
||||
MTGHermitRule(GameObserver* observer, int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Hermit";
|
||||
}
|
||||
@@ -447,7 +447,7 @@ public:
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Deathtouch";
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef _OSD_H_
|
||||
#define _OSD_H_
|
||||
|
||||
class OSDLayer: public PlayGuiObjectController
|
||||
{
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
int addCombatAfter(Player* player, int after_id, bool withMain = false);
|
||||
int addPhaseAfter(GamePhase id, Player* player, int after_id);
|
||||
int removePhase(int id);
|
||||
const char * phaseName(int id);
|
||||
const string& phaseName(int id);
|
||||
static GamePhase phaseStrToInt(string s);
|
||||
static string phaseIntToStr(int id);
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@ protected:
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
int typeOfDamage;
|
||||
Damage::DamageType typeOfDamage;
|
||||
public:
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL,
|
||||
int _damage = -1, bool _oneShot = true, Damage::DamageType typeOfDamage = Damage::DAMAGE_ALL_TYPES);
|
||||
WEvent * replace(WEvent *e);
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Update(float dt);
|
||||
using JGuiController::Add;
|
||||
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false);
|
||||
virtual void Add(int id, const string &Text, string desc = "", bool forceFocus = false);
|
||||
int getmCurr(){return mCurr;}
|
||||
float getWidth(){return mWidth; }
|
||||
virtual void Close();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _STYLE_MANAGER_H_
|
||||
#define _STYLE_MANAGER_H_
|
||||
|
||||
class WStyle
|
||||
{
|
||||
public:
|
||||
@@ -34,3 +37,5 @@ protected:
|
||||
string activeStyle;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
#endif //_STYLE_MANAGER_H_
|
||||
|
||||
@@ -140,4 +140,20 @@ template <class T> istream& operator>>(istream& in, T& p)
|
||||
/* replace_all ... replacement to avoid depending on boost for that */
|
||||
void ReplaceString(std::string& subject, const std::string& search, const std::string& replace);
|
||||
|
||||
/*! \brief Returns true if base starts with start, otherwise false
|
||||
*
|
||||
* Compares the first strlen(start) characters of base with start and
|
||||
* returns true if both match.
|
||||
*/
|
||||
bool StartsWith(const std::string& base, const char *start);
|
||||
|
||||
/*! \brief Returns true if base starts with start, otherwise false
|
||||
*
|
||||
* This version is slightly more efficient as strlen does not need to
|
||||
* get called. Otherwise, it behaves exactly like
|
||||
* StartsWith(const std::string& base, const char *start)
|
||||
*
|
||||
* \see StartsWith(const std::string& base, const char *start)
|
||||
*/
|
||||
bool StartsWith(const std::string& base, const std::string& start);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user