changes:
added abilities:
proliferate
ProliferateChooser:new targetchooser for cards with counter and poison counters "proliferation".
MenuAbility:new internal ability to create custom menus of abilities which can be activated in sequence one after another.
multikicker, syntax kicker=multi{b}
works with variable word "kicked", the amount of times it was kicked.
target=<number>tc,target=<upto:>tc,target=<anyamount>tc,target(<number>tc),target(<upto:>tc),target(<anynumber>tc);
multitarget is now supported with the exception of "devided any way you choose" which can not be supported becuase we allow detoggling of targeted cards with a "second" click....so you can not click the same card 2 times to add it to the targets list twice for example.
this is minor, as the bulk of multitarget is not "devided"
removed 's' parsing for multitarget, added a limit of 1000 to "unlimited" for easier handling; we currently can't handle activation of an ability on a 1000 cards very well on any platform(infact i don't suggest it)
Countershroud(counterstring), this MTGAbility allows you to denote that a card can not have counters of the type "counterstring" put on it.
"any" is for no counters allowed at all. this is a replacement effect. cards state that they can still be the targets of counter effects, however on resolve nothing is placed on them instead.
@counteradded(counterstring) from(target):,@counterremoved(counterstring) from(target):: these are triggers for cards which state "whenever you add a counter of "counterstring" to "target"; added counterEvents struct;
other changes:
added support for ai handling of multitargeted spells.
changed a few of delete( into SAFE_DELETE(, safed up a couple areas where they did not seem safe to me;
added better handling of menus presented to ai, it will try to select the best based on eff returns.
added varible lastactioncontroller for ai use, it keeps it truely from ever tripping over itself and brings ai more inline with MTG rules.
converted TC into a protected member.
added "abilitybelongsto" string to tc, and set "owner" of the tc. a tc should never belong to "no one" it should always have a owner.
abilitybelongs to string is solely for easier debugging, i found it was a pain to never know what ability created a tc while i coded multitarget. the owner of the tc is the only one that should be using it, if an ability needs to declare the opponent as the owner (choose discard which is currently unsupported for example) this will allow us to better handle that situation by setting the tc owner in the ability which called it.
rewrote the logic of "checkonly" in ai choose targets, the only time it is "checkonly" is when it is trying to see if it had a target for a spell before it cast it, i now set this in the actual function call instead, the old method was far to error prone.
wrote logic for ai checking of menu objects presented to it,
ai will now make better choices when a menu is presented to it based on what it already knows. this changes it from it's old method of "just click the first option".
taught ai how to use multi-mana producers such as birds and duel lands by adding a method for it to find it's mana for a payment. it can effectively use cards like birds of paradise and sol ring(without locking up). It's primary method of pMana searching was maintain for performance(no need to deep search if we have it in pMana).
added a vector to actionlayer to store mana abilities for pMana. this provides us with a dramatic improvement when mana lords are present by reducing the amount of objects that need checking when ai checks pMana.
with 80 mana objects and a ton of lords one instance i checked went from 8000ish checks down to 80<===big difference.
added "tapped" green coloring(sorry i missed that!)...added red coloring to current actionLayers current action card (usually the source).
changed "type(" restrictions second amount from atoi into wparsedint for more flexiable coding.
add "&" parsing to CD targetchooser, removed "iscolorandcolor" variables and functions becuase they were a hack the real fix was this.
cretaure[dragon&black&blue] a creature that is a dragon, and black and also blue.
changed some of the ai computeactions and
removed unneeded gaurds in ai chooseblockers, they did more harm then good.
This commit is contained in:
@@ -34,22 +34,37 @@ public:
|
||||
int id;
|
||||
MTGCardInstance * click;
|
||||
MTGCardInstance * target; // TODO Improve
|
||||
vector<Targetable*>mAbilityTargets;
|
||||
Targetable * playerAbilityTarget;
|
||||
//player targeting through abilities is handled completely seperate from spell targeting.
|
||||
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL)
|
||||
: efficiency(-1), ability(a), player(NULL), click(c), target(t)
|
||||
: efficiency(-1), ability(a), player(NULL), click(c), target(t),playerAbilityTarget(NULL)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
|
||||
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL);
|
||||
|
||||
AIAction(Player * p)
|
||||
: efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
|
||||
AIAction(Player * p)//player targeting through spells
|
||||
: efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL),playerAbilityTarget(NULL)
|
||||
{
|
||||
};
|
||||
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, vector<Targetable*>targetCards)
|
||||
: efficiency(-1), ability(a), player(NULL), click(c), mAbilityTargets(targetCards),playerAbilityTarget(NULL)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
|
||||
AIAction(MTGAbility * a, Player * p, MTGCardInstance * c)//player targeting through abilities.
|
||||
: efficiency(-1), ability(a), click(c),target(NULL), playerAbilityTarget(p)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
int getEfficiency();
|
||||
int Act();
|
||||
int clickMultiAct(vector<Targetable*>&actionTargets);
|
||||
};
|
||||
|
||||
// compares Abilities efficiency
|
||||
@@ -75,7 +90,7 @@ protected:
|
||||
MTGCardInstance * nextCardToPlay;
|
||||
AIHints * hints;
|
||||
queue<AIAction *> clickstream;
|
||||
bool tapLandsForMana(ManaCost * cost, MTGCardInstance * card = NULL);
|
||||
bool payTheManaCost(ManaCost * cost, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
|
||||
int orderBlockers();
|
||||
int combatDamages();
|
||||
int interruptIfICan();
|
||||
@@ -101,10 +116,15 @@ public:
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
|
||||
vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL,ManaCost * mCost = NULL);
|
||||
vector<MTGAbility*> canPaySunBurst(ManaCost * mCost = NULL);
|
||||
AIPlayer(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
||||
virtual ~AIPlayer();
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget =NULL,MTGCardInstance * Choosencard = NULL);
|
||||
virtual int selectMenuOption();
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget =NULL,MTGCardInstance * Choosencard = NULL,bool checkonly = false);
|
||||
virtual int clickMultiTarget(TargetChooser * tc,vector<Targetable*>&potentialTargets);
|
||||
virtual int clickSingleTarget(TargetChooser * tc,vector<Targetable*>&potentialTargets,int nbtargets = 0,MTGCardInstance * Choosencard = NULL);
|
||||
virtual int Act(float dt);
|
||||
virtual int affectCombatDamages(CombatStep);
|
||||
int isAI(){return 1;};
|
||||
@@ -123,6 +143,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
vector<MTGAbility*>gotPayments;
|
||||
int deckId;
|
||||
AIPlayerBaka(string deckFile, string deckfileSmall, string avatarFile, MTGDeck * deck = NULL);
|
||||
virtual int Act(float dt);
|
||||
|
||||
@@ -22,8 +22,8 @@ class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
public:
|
||||
TargetChooser * tc;
|
||||
public:
|
||||
int currentPhase;
|
||||
int newPhase;
|
||||
int modal;
|
||||
@@ -48,9 +48,15 @@ public:
|
||||
;
|
||||
ActionElement(int id);
|
||||
ActionElement(const ActionElement& copyFromMe);
|
||||
TargetChooser * getActionTc(){return tc;}
|
||||
virtual void setActionTC(TargetChooser * newTc = NULL){this->tc = newTc;}
|
||||
virtual ~ActionElement();
|
||||
virtual int isReactingToTargetClick(Targetable * card);
|
||||
virtual int reactToTargetClick(Targetable * card);
|
||||
virtual int reactToChoiceClick(Targetable * card,int choice = 0,int controlid = 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * man = NULL)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
vector<ActionElement *> garbage;
|
||||
Targetable * menuObject;
|
||||
SimpleMenu * abilitiesMenu;
|
||||
MTGCardInstance * currentActionCard;
|
||||
int stuffHappened;
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
@@ -41,11 +42,15 @@ public:
|
||||
int reactToTargetClick(ActionElement * ability, Targetable * card);
|
||||
int stillInUse(MTGCardInstance * card);
|
||||
void setMenuObject(Targetable * object, bool must = false);
|
||||
void setCustomMenuObject(Targetable * object, bool must = false,vector<MTGAbility*>abilities = vector<MTGAbility*>());
|
||||
void ButtonPressed(int controllerid, int controlid);
|
||||
void doMultipleChoice(int choice = -1);
|
||||
void ButtonPressedOnMultipleChoice(int choice = -1);
|
||||
void doReactTo(int menuIndex);
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void setCurrentWaitingAction(ActionElement * ae);
|
||||
MTGAbility * getAbility(int type);
|
||||
int checkCantCancel(){return cantCancel;};
|
||||
|
||||
//Removes from game but does not move the element to garbage. The caller must take care of deleting the element.
|
||||
int removeFromGame(ActionElement * e);
|
||||
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
DONT_INTERRUPT = 1,
|
||||
DONT_INTERRUPT_ALL = 2,
|
||||
};
|
||||
|
||||
Player * lastActionController;
|
||||
int setIsInterrupting(Player * player);
|
||||
int count( int type = 0 , int state = 0 , int display = -1);
|
||||
int getActionElementFromCard(MTGCardInstance * card);
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
|
||||
WParsedInt(string s, Spell * spell, MTGCardInstance * card)
|
||||
{
|
||||
if(!card)
|
||||
return;
|
||||
MTGCardInstance * target = card->target;
|
||||
intValue = 0;
|
||||
bool halfup = false;
|
||||
@@ -185,6 +187,10 @@ public:
|
||||
else if (s == "t" || s == "toughness")
|
||||
{
|
||||
intValue = target->getToughness();
|
||||
}
|
||||
else if (s == "kicked")
|
||||
{
|
||||
intValue = target->kicked;
|
||||
}
|
||||
else if (s == "handsize")
|
||||
{
|
||||
@@ -698,6 +704,40 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//targetted trigger
|
||||
class TrCounter: public Trigger
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
int type;
|
||||
TrCounter(int id, MTGCardInstance * source, Counter * counter, TargetChooser * tc, int type = 0,bool once = false) :
|
||||
Trigger(id, source, once, tc),counter(counter), type(type)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCounters * e = dynamic_cast<WEventCounters *> (event);
|
||||
if (!e) return 0;
|
||||
if (type == 0 && !e->removed) return 0;
|
||||
if (type == 1 && !e->added) return 0;
|
||||
if (!(e->power == counter->power && e->toughness == counter->toughness && e->name == counter->name)) return 0;
|
||||
if (tc && !tc->canTarget(e->targetCard)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
~TrCounter()
|
||||
{
|
||||
SAFE_DELETE(counter);
|
||||
}
|
||||
|
||||
TrCounter * clone() const
|
||||
{
|
||||
TrCounter * mClone = NEW TrCounter(*this);
|
||||
mClone->counter = NEW Counter(*this->counter);
|
||||
return mClone;
|
||||
}
|
||||
};
|
||||
|
||||
//Tutorial Messaging
|
||||
class ATutorialMessage: public MTGAbility, public IconButtonsController
|
||||
@@ -796,13 +836,14 @@ public:
|
||||
class IfThenAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
string delayAbility;
|
||||
MTGAbility * delayedAbility;
|
||||
int type;
|
||||
string Cond;
|
||||
IfThenAbility(int _id,string delayAbility = "", MTGCardInstance * _source=NULL, int type = 1,string Cond = "");
|
||||
IfThenAbility(int _id,MTGAbility * delayedAbility = NULL, MTGCardInstance * _source=NULL, int type = 1,string Cond = "");
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
IfThenAbility * clone() const;
|
||||
~IfThenAbility();
|
||||
};
|
||||
|
||||
//MayAbility: May do ...
|
||||
@@ -830,6 +871,39 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//MayAbility with custom menues.
|
||||
class MenuAbility: public MayAbility
|
||||
{
|
||||
public:
|
||||
int triggered;
|
||||
bool removeMenu;
|
||||
bool must;
|
||||
MTGAbility * mClone;
|
||||
vector<MTGAbility*>abilities;
|
||||
Player * who;
|
||||
MenuAbility(int _id, Targetable * target, MTGCardInstance * _source, bool must = false, vector<MTGAbility*>abilities = vector<MTGAbility*>(),Player * who = NULL);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
int testDestroy();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int reactToTargetClick(Targetable * object);
|
||||
int reactToChoiceClick(Targetable * object,int choice,int control);
|
||||
MenuAbility * clone() const;
|
||||
~MenuAbility();
|
||||
|
||||
};
|
||||
|
||||
class AAProliferate: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AAProliferate(int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
AAProliferate * clone() const;
|
||||
~AAProliferate();
|
||||
};
|
||||
|
||||
//MultiAbility : triggers several actions for a cost
|
||||
class MultiAbility: public ActivatedAbility
|
||||
{
|
||||
@@ -2531,7 +2605,7 @@ public:
|
||||
|
||||
void livingWeaponToken(MTGCardInstance * card)
|
||||
{
|
||||
GameObserver * g = g->GetInstance();
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
for (size_t i = 1; i < g->mLayers->actionLayer()->mObjects.size(); i++)
|
||||
{
|
||||
MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]);
|
||||
@@ -2660,6 +2734,13 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
int checkActivation()
|
||||
{
|
||||
checkCards.clear();
|
||||
checkTargets();
|
||||
return checkCards.size();
|
||||
}
|
||||
|
||||
~AForeach()
|
||||
{
|
||||
SAFE_DELETE(ability);
|
||||
@@ -3424,7 +3505,18 @@ public:
|
||||
APreventDamageTypes * clone() const;
|
||||
~APreventDamageTypes();
|
||||
};
|
||||
|
||||
//prevent counters
|
||||
class ACounterShroud: public MTGAbility
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
RECountersPrevention * re;
|
||||
ACounterShroud(int id, MTGCardInstance * source, MTGCardInstance * target, Counter * counter = NULL);
|
||||
int addToGame();
|
||||
int destroy();
|
||||
ACounterShroud * clone() const;
|
||||
~ACounterShroud();
|
||||
};
|
||||
//Remove all abilities from target
|
||||
class ALoseAbilities: public MTGAbility
|
||||
{
|
||||
|
||||
@@ -43,12 +43,6 @@ class CardDescriptor: public MTGCardInstance
|
||||
void unsecureSetTapped(int i);
|
||||
void unsecuresetfresh(int k);
|
||||
void setisMultiColored(int w);
|
||||
void setisBlackAndWhite(int w);
|
||||
void setisRedAndBlue(int w);
|
||||
void setisBlackAndGreen(int w);
|
||||
void setisBlueAndGreen(int w);
|
||||
void setisRedAndWhite(int w);
|
||||
|
||||
void setNegativeSubtype( string value);
|
||||
int counterPower;
|
||||
int counterToughness;
|
||||
|
||||
@@ -79,6 +79,7 @@ class GameObserver{
|
||||
bool removeObserver(ActionElement * observer);
|
||||
void startGame(Rules * rules);
|
||||
void untapPhase();
|
||||
MTGCardInstance * isCardWaiting(){ return cardWaitingForTargets; }
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
int isInGrave(MTGCardInstance * card);
|
||||
int isInExile(MTGCardInstance * card);
|
||||
|
||||
@@ -19,6 +19,7 @@ protected:
|
||||
public:
|
||||
int mCurr;
|
||||
vector<JGuiObject *> mObjects;
|
||||
vector<JGuiObject *> manaObjects;
|
||||
void Add(JGuiObject * object);
|
||||
int Remove(JGuiObject * object);
|
||||
int modal;
|
||||
|
||||
@@ -394,6 +394,7 @@ class ListMaintainerAbility:public MTGAbility
|
||||
{
|
||||
public:
|
||||
map<MTGCardInstance *,bool> cards;
|
||||
map<MTGCardInstance *,bool> checkCards;
|
||||
map<Player *,bool> players;
|
||||
ListMaintainerAbility(int _id)
|
||||
: MTGAbility(_id, NULL)
|
||||
@@ -412,6 +413,7 @@ public:
|
||||
|
||||
virtual void Update(float dt);
|
||||
void updateTargets();
|
||||
void checkTargets();
|
||||
virtual bool canTarget(MTGGameZone * zone);
|
||||
virtual int canBeInList(MTGCardInstance * card) = 0;
|
||||
virtual int added(MTGCardInstance * card) = 0;
|
||||
@@ -506,7 +508,6 @@ public:
|
||||
int parsePowerToughness(string s, int *power, int *toughness);
|
||||
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0, MTGGameZone * dest = NULL);
|
||||
MTGAbility* parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, bool activated = false, bool forceUEOT = false, MTGGameZone * dest = NULL);
|
||||
|
||||
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL,Targetable * target = NULL);
|
||||
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL, MTGGameZone * dest = NULL);
|
||||
static int computeX(Spell * spell, MTGCardInstance * card);
|
||||
|
||||
@@ -66,11 +66,6 @@ public:
|
||||
int origpower;
|
||||
int origtoughness;
|
||||
int isMultiColored;
|
||||
int isBlackAndWhite;
|
||||
int isRedAndBlue;
|
||||
int isBlackAndGreen;
|
||||
int isBlueAndGreen;
|
||||
int isRedAndWhite;
|
||||
int isLeveler;
|
||||
bool enchanted;
|
||||
int CDenchanted;
|
||||
@@ -92,6 +87,7 @@ public:
|
||||
int notblocked;
|
||||
int fresh;
|
||||
int MaxLevelUp;
|
||||
int kicked;
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
MTGGameZone * previousZone;
|
||||
|
||||
@@ -177,11 +177,9 @@ class Constants
|
||||
SNOWISLANDWALK = 89,
|
||||
SNOWSWAMPWALK = 90,
|
||||
CANATTACK = 91,
|
||||
HYDRA = 92,
|
||||
|
||||
|
||||
|
||||
|
||||
NB_BASIC_ABILITIES = 92,
|
||||
NB_BASIC_ABILITIES = 93,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
ManaCost * morph;
|
||||
ManaCost * suspend;
|
||||
string alternativeName;
|
||||
bool isMulti;
|
||||
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
|
||||
virtual void init();
|
||||
virtual void reinit();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using namespace std;
|
||||
#include "Damage.h"
|
||||
#include "WEvent.h"
|
||||
#include "Counters.h"
|
||||
|
||||
class TargetChooser;
|
||||
class MTGAbility;
|
||||
@@ -35,6 +36,19 @@ public:
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
class RECountersPrevention: public ReplacementEffect
|
||||
{
|
||||
protected:
|
||||
MTGAbility * source;
|
||||
MTGCardInstance * cardSource;
|
||||
MTGCardInstance * cardTarget;
|
||||
Counter * counter;
|
||||
public:
|
||||
RECountersPrevention(MTGAbility * _source,MTGCardInstance * cardSource = NULL,MTGCardInstance * cardTarget = NULL,Counter * counter = NULL);
|
||||
WEvent * replace(WEvent *e);
|
||||
~RECountersPrevention();
|
||||
};
|
||||
|
||||
class ReplacementEffects
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -37,11 +37,13 @@ private:
|
||||
|
||||
public:
|
||||
bool autoTranslate;
|
||||
bool isMultipleChoice;
|
||||
SimpleMenu(int id, JGuiListener* listener, int fontId, float x, float y, const char * _title = "", int _maxItems = 7, bool centerHorizontal = true, bool centerVertical = true);
|
||||
virtual ~SimpleMenu();
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void Add(int id, const char * Text, string desc = "", bool forceFocus = false);
|
||||
int getmCurr(){return mCurr;}
|
||||
void Close();
|
||||
|
||||
void RecenterMenu();
|
||||
|
||||
@@ -24,8 +24,8 @@ class TargetChooser: public TargetsList
|
||||
{
|
||||
protected:
|
||||
int forceTargetListReady;
|
||||
|
||||
public:
|
||||
const static int UNLITMITED_TARGETS = 1000;
|
||||
enum
|
||||
{
|
||||
UNSET = 0,
|
||||
@@ -36,13 +36,16 @@ public:
|
||||
};
|
||||
bool other;
|
||||
bool withoutProtections;
|
||||
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1, bool other = false);
|
||||
|
||||
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = UNLITMITED_TARGETS, bool other = false, bool targetMin = false);
|
||||
Player * Owner;
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
||||
|
||||
int maxtargets; //Set to -1 for "unlimited"
|
||||
bool validTargetsExist();
|
||||
int maxtargets;
|
||||
bool done;
|
||||
bool targetMin;
|
||||
bool validTargetsExist(int maxTarget = 1);
|
||||
int attemptsToFill;
|
||||
string belongsToAbility;
|
||||
int countValidTargets();
|
||||
virtual int setAllZones()
|
||||
{
|
||||
@@ -68,7 +71,7 @@ public:
|
||||
|
||||
virtual int full()
|
||||
{
|
||||
if (maxtargets != -1 && ((int) (targets.size())) >= maxtargets)
|
||||
if ( (maxtargets != UNLITMITED_TARGETS && (int(targets.size())) >= maxtargets) || done)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -107,8 +110,8 @@ public:
|
||||
bool targetsZone(MTGGameZone * z);
|
||||
bool targetsZone(MTGGameZone * z,MTGCardInstance * mSource);
|
||||
bool withoutProtections;
|
||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
virtual bool canTarget(Targetable * _card,bool withoutProtections = false);
|
||||
int setAllZones();
|
||||
virtual TargetZoneChooser * clone() const;
|
||||
@@ -133,8 +136,8 @@ public:
|
||||
int nbtypes;
|
||||
int types[10];
|
||||
bool withoutProtections;
|
||||
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
void addType(int type);
|
||||
void addType(const char * type);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
@@ -146,13 +149,13 @@ class DamageableTargetChooser: public TypeTargetChooser
|
||||
{
|
||||
public:
|
||||
bool withoutProtections;
|
||||
DamageableTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false) :
|
||||
TypeTargetChooser("creature",_zones, _nbzones, card, _maxtargets, other)
|
||||
DamageableTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
|
||||
TypeTargetChooser("creature",_zones, _nbzones, card, _maxtargets, other, targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false) :
|
||||
TypeTargetChooser("creature", card, _maxtargets, other)
|
||||
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
|
||||
TypeTargetChooser("creature", card, _maxtargets, other, targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
@@ -168,7 +171,7 @@ protected:
|
||||
public:
|
||||
bool withoutProtections;
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual PlayerTargetChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
@@ -178,8 +181,8 @@ class DescriptorTargetChooser: public TargetZoneChooser
|
||||
public:
|
||||
CardDescriptor * cd;
|
||||
bool withoutProtections;
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
~DescriptorTargetChooser();
|
||||
virtual DescriptorTargetChooser * clone() const;
|
||||
@@ -191,8 +194,8 @@ class SpellTargetChooser: public TargetChooser
|
||||
public:
|
||||
int color;
|
||||
bool withoutProtections;
|
||||
SpellTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
SpellTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual SpellTargetChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
@@ -202,8 +205,8 @@ class SpellOrPermanentTargetChooser: public TargetZoneChooser
|
||||
public:
|
||||
int color;
|
||||
bool withoutProtections;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false, bool targetMin = false);
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual SpellOrPermanentTargetChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
@@ -215,7 +218,7 @@ public:
|
||||
int state;
|
||||
bool withoutProtections;
|
||||
DamageTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
virtual bool canTarget(Targetable * target,bool withoutProtections = false);
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual DamageTargetChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
@@ -229,9 +232,27 @@ public:
|
||||
bool withoutProtections;
|
||||
TriggerTargetChooser(int _triggerTarget);
|
||||
virtual bool targetsZone(MTGGameZone * z);
|
||||
virtual bool canTarget(Targetable * _target,bool withoutProtections = false);
|
||||
virtual bool canTarget(Targetable * _target, bool withoutProtections = false);
|
||||
virtual TriggerTargetChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
|
||||
class ProliferateChooser: public TypeTargetChooser
|
||||
{
|
||||
public:
|
||||
bool withoutProtections;
|
||||
ProliferateChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
|
||||
TypeTargetChooser("*",_zones, _nbzones, card, _maxtargets, other, targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
ProliferateChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) :
|
||||
TypeTargetChooser("*", card, _maxtargets, other,targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual ProliferateChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,8 @@ class Damage;
|
||||
class Phase;
|
||||
class Targetable;
|
||||
class ManaPool;
|
||||
class AACounter;
|
||||
class Counters;
|
||||
|
||||
class WEvent {
|
||||
public:
|
||||
@@ -51,6 +53,18 @@ struct WEventDamage : public WEvent {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
struct WEventCounters : public WEvent {
|
||||
MTGCardInstance * targetCard;
|
||||
Counters * counter;
|
||||
string name;
|
||||
int power;
|
||||
int toughness;
|
||||
bool added;
|
||||
bool removed;
|
||||
WEventCounters(Counters *counter,string name,int power, int toughness,bool added = false, bool removed = false);
|
||||
virtual Targetable * getTarget();
|
||||
};
|
||||
|
||||
struct WEventLife : public WEvent {
|
||||
Player * player;
|
||||
int amount;
|
||||
|
||||
Reference in New Issue
Block a user