removed the variable doTap in Tap from all classes, all test pass but there could be an edge case where i missed removing one...if so just let me know, tweaked some ai eff returns, trying to teach it to use counters more effectively, i noticed it was not using -1/-1 counters on the players creature and was using off counters +1/-1 on its own creatures to the point where they died.
doTap now only serves a single purpose, to pass Tap variable to amanaproducer class so that "tappedformana" will trigger is a manaproducer was tapped for mana.
This commit is contained in:
@@ -894,7 +894,7 @@ public:
|
||||
string menu;
|
||||
|
||||
AACounter(int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness, int nb,int maxNb = 0,
|
||||
ManaCost * cost = NULL, int doTap = 0);
|
||||
ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
@@ -913,7 +913,7 @@ public:
|
||||
bool all;
|
||||
|
||||
AARemoveAllCounter(int id, MTGCardInstance * source, MTGCardInstance * target, const char * _name, int power, int toughness, int nb,
|
||||
bool all,ManaCost * cost = NULL, int doTap = 0);
|
||||
bool all,ManaCost * cost = NULL);
|
||||
|
||||
int resolve();
|
||||
const char* getMenuText();
|
||||
@@ -925,7 +925,7 @@ class AAFizzler: public ActivatedAbility
|
||||
{
|
||||
|
||||
public:
|
||||
AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL, int _tap = 0);
|
||||
AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AAFizzler* clone() const;
|
||||
@@ -965,7 +965,7 @@ class MultiAbility: public ActivatedAbility
|
||||
public:
|
||||
vector<MTGAbility *> abilities;
|
||||
|
||||
MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap);
|
||||
MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost);
|
||||
int Add(MTGAbility * ability);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -981,7 +981,7 @@ public:
|
||||
MTGGameZone * activeZone;
|
||||
string newName;
|
||||
|
||||
GenericActivatedAbility(string newName,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
|
||||
GenericActivatedAbility(string newName,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
|
||||
int restrictions = 0, MTGGameZone * dest = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -1035,7 +1035,7 @@ class AAMover: public ActivatedAbility
|
||||
public:
|
||||
string destination;
|
||||
|
||||
AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost = NULL);
|
||||
MTGGameZone * destinationZone();
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -1109,8 +1109,7 @@ public:
|
||||
MTGGameZone * activeZone;
|
||||
string newName;
|
||||
|
||||
GenericTargetAbility(string newName,int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL,
|
||||
int _tap = 0, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL);
|
||||
GenericTargetAbility(string newName,int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL);
|
||||
const char * getMenuText();
|
||||
~GenericTargetAbility();
|
||||
GenericTargetAbility * clone() const;
|
||||
@@ -1239,7 +1238,7 @@ public:
|
||||
|
||||
string nbcardsStr;
|
||||
|
||||
AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int _tap = 0, int who =
|
||||
AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -1287,7 +1286,7 @@ class AALifer: public ActivatedAbilityTP
|
||||
{
|
||||
public:
|
||||
string life_s;
|
||||
AALifer(int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL, int _tap = 0,
|
||||
AALifer(int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -1300,7 +1299,7 @@ public:
|
||||
class AAWinGame: public ActivatedAbilityTP
|
||||
{
|
||||
public:
|
||||
AAWinGame(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int _tap = 0, int who =
|
||||
AAWinGame(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -1390,8 +1389,8 @@ public:
|
||||
int stateBeforeActivation[50];
|
||||
int ability;
|
||||
ABasicAbilityModifierUntilEOT(int _id, MTGCardInstance * _source, int _ability, ManaCost * _cost, TargetChooser * _tc = NULL,
|
||||
int _modifier = 1, int _tap = 1) :
|
||||
TargetAbility(_id, _source, _cost, 0, _tap), modifier(_modifier), ability(_ability)
|
||||
int _modifier = 1) :
|
||||
TargetAbility(_id, _source, _cost, 0), modifier(_modifier), ability(_ability)
|
||||
{
|
||||
aType = MTGAbility::STANDARDABILITYGRANT;
|
||||
abilitygranted = ability;
|
||||
@@ -1520,7 +1519,7 @@ public:
|
||||
AInstantBasicAbilityModifierUntilEOT * ability;
|
||||
ABasicAbilityAuraModifierUntilEOT(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost,
|
||||
int _ability, int _value = 1) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, 0)
|
||||
ActivatedAbility(_id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
ability = NEW AInstantBasicAbilityModifierUntilEOT(_id, _source, _target, _ability, _value);
|
||||
@@ -1916,7 +1915,7 @@ protected:
|
||||
map<ReplacementEffect*, int> current;
|
||||
public:
|
||||
ACircleOfProtection(int _id, MTGCardInstance * source, int _color) :
|
||||
TargetAbility(_id, source, NEW SpellOrPermanentTargetChooser(source, _color), NEW ManaCost(), 0, 0)
|
||||
TargetAbility(_id, source, NEW SpellOrPermanentTargetChooser(source, _color), NEW ManaCost(), 0)
|
||||
{
|
||||
cost->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
tc->targetter = NULL; //Circle of Protection doesn't use the word "source"
|
||||
@@ -1978,7 +1977,7 @@ class AStandardRegenerate: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AStandardRegenerate(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost = NULL) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, 0)
|
||||
ActivatedAbility(_id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
aType = MTGAbility::STANDARD_REGENERATE;
|
||||
@@ -2628,9 +2627,9 @@ class AEquip: public TargetAbility
|
||||
{
|
||||
public:
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
AEquip(int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int doTap = 0, int restrictions =
|
||||
AEquip(int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int restrictions =
|
||||
ActivatedAbility::AS_SORCERY) :
|
||||
TargetAbility(_id, _source, NULL, _cost, restrictions, doTap)
|
||||
TargetAbility(_id, _source, NULL, _cost, restrictions)
|
||||
{
|
||||
aType = MTGAbility::STANDARD_EQUIP;
|
||||
}
|
||||
@@ -2744,9 +2743,9 @@ ATOKEN_WHO_TARGETCONTROLLER = 2
|
||||
MTGCardInstance * myToken;
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
Player * tokenReciever;
|
||||
ATokenCreator(int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost, int tokenId, int _doTap,string starfound, WParsedInt * multiplier = NULL,
|
||||
ATokenCreator(int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost, int tokenId,string starfound, WParsedInt * multiplier = NULL,
|
||||
int who = 0,bool aLivingWeapon = false) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, _doTap), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
||||
ActivatedAbility(_id, _source, _cost, 0), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
||||
{
|
||||
if (!multiplier) this->multiplier = NEW WParsedInt(1);
|
||||
MTGCard * card = MTGCollection()->getCardById(tokenId);
|
||||
@@ -2755,8 +2754,8 @@ ATOKEN_WHO_TARGETCONTROLLER = 2
|
||||
}
|
||||
|
||||
ATokenCreator(int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost, string sname, string stypes, int _power, int _toughness,
|
||||
string sabilities, int _doTap, string starfound,WParsedInt * multiplier = NULL, int who = 0,bool aLivingWeapon = false,string spt = "") :
|
||||
ActivatedAbility(_id, _source, _cost, 0, _doTap),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon),spt(spt)
|
||||
string sabilities, string starfound,WParsedInt * multiplier = NULL, int who = 0,bool aLivingWeapon = false,string spt = "") :
|
||||
ActivatedAbility(_id, _source, _cost, 0),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon),spt(spt)
|
||||
{
|
||||
power = _power;
|
||||
toughness = _toughness;
|
||||
@@ -3243,7 +3242,7 @@ class AALifeSet: public ActivatedAbilityTP
|
||||
public:
|
||||
WParsedInt * life;
|
||||
|
||||
AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL, int doTap = 0,
|
||||
AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -3260,7 +3259,7 @@ public:
|
||||
string d;
|
||||
|
||||
AADamager(int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
|
||||
int doTap = 0, int who = TargetChooser::UNSET);
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
int getDamage();
|
||||
@@ -3274,8 +3273,7 @@ class AADamagePrevent: public ActivatedAbilityTP
|
||||
public:
|
||||
int preventing;
|
||||
|
||||
AADamagePrevent(int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int doTap =
|
||||
0, int who = TargetChooser::UNSET);
|
||||
AADamagePrevent(int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AADamagePrevent * clone() const;
|
||||
@@ -3288,7 +3286,7 @@ class AAAlterPoison: public ActivatedAbilityTP
|
||||
public:
|
||||
int poison;
|
||||
|
||||
AAAlterPoison(int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL, int doTap = 0,
|
||||
AAAlterPoison(int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -3300,8 +3298,8 @@ class TADamager: public TargetAbility
|
||||
{
|
||||
public:
|
||||
|
||||
TADamager(int id, MTGCardInstance * card, ManaCost * _cost, string d, TargetChooser * _tc = NULL, int _tap = 0) :
|
||||
TargetAbility(id, card, _tc, _cost, 0, _tap)
|
||||
TADamager(int id, MTGCardInstance * card, ManaCost * _cost, string d, TargetChooser * _tc = NULL) :
|
||||
TargetAbility(id, card, _tc, _cost, 0)
|
||||
{
|
||||
if (!tc) tc = NEW DamageableTargetChooser(card);
|
||||
ability = NEW AADamager(id, card, NULL, d);
|
||||
@@ -3319,7 +3317,7 @@ public:
|
||||
class AATapper: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AATapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AATapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AATapper * clone() const;
|
||||
@@ -3329,7 +3327,7 @@ public:
|
||||
class AAUntapper: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AAUntapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AAUntapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AAUntapper * clone() const;
|
||||
@@ -3341,7 +3339,7 @@ class AAWhatsMax: public ActivatedAbility
|
||||
public:
|
||||
int value;
|
||||
|
||||
AAWhatsMax(int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost = NULL, int doTap = 0, int value = 0);
|
||||
AAWhatsMax(int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost = NULL, int value = 0);
|
||||
int resolve();
|
||||
AAWhatsMax * clone() const;
|
||||
};
|
||||
@@ -3350,7 +3348,7 @@ public:
|
||||
class AAFrozen: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AAFrozen * clone() const;
|
||||
@@ -3360,7 +3358,7 @@ class AANewTarget: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
bool retarget;
|
||||
AANewTarget(int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AANewTarget(int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AANewTarget * clone() const;
|
||||
@@ -3370,7 +3368,7 @@ class AAMorph: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
AAMorph(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AAMorph(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
int testDestroy();
|
||||
const char * getMenuText();
|
||||
@@ -3433,7 +3431,7 @@ MTGAbility * storedAbility;
|
||||
MTGAbility * clonedStored;
|
||||
string menu;
|
||||
|
||||
AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type = 0,int effect = 0,int who = 0,int amountsource = 1,MTGAbility * storedAbility = NULL, ManaCost * _cost = NULL, int doTap = 0);
|
||||
AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type = 0,int effect = 0,int who = 0,int amountsource = 1,MTGAbility * storedAbility = NULL, ManaCost * _cost = NULL);
|
||||
int resolve();
|
||||
int activateStored();
|
||||
const char * getMenuText();
|
||||
@@ -3890,7 +3888,7 @@ public:
|
||||
string counterName;
|
||||
int next;
|
||||
|
||||
AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap = 0, int restrictions = 0,int amount = 0,string counterName = "");
|
||||
AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -3908,7 +3906,7 @@ public:
|
||||
bool Cumulative;
|
||||
int currentage;
|
||||
|
||||
AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int restrictions = 0, int _phase =
|
||||
AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int restrictions = 0, int _phase =
|
||||
Constants::MTG_PHASE_UPKEEP, int _once = 0,bool Cumulative = false);
|
||||
int receiveEvent(WEvent * event);
|
||||
void Update(float dt);
|
||||
@@ -3935,7 +3933,7 @@ public:
|
||||
bool opponentturn;
|
||||
Player * abilityOwner;
|
||||
|
||||
APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int _tap = 0, int restrictions = 0, int _phase =
|
||||
APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
||||
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true);
|
||||
void Update(float dt);
|
||||
int resolve();
|
||||
@@ -3950,7 +3948,7 @@ class APhaseActionGeneric: public InstantAbility
|
||||
public:
|
||||
string sAbility;
|
||||
APhaseAction * ability;
|
||||
APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int _tap = 0, int restrictions = 0, int _phase =
|
||||
APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
|
||||
Constants::MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -4251,7 +4249,7 @@ class AFarmstead: public ActivatedAbility
|
||||
public:
|
||||
int usedThisTurn;
|
||||
AFarmstead(int _id, MTGCardInstance * source, MTGCardInstance * _target) :
|
||||
ActivatedAbility(_id, source, 0, 1, 0)
|
||||
ActivatedAbility(_id, source, 0, 1)
|
||||
{
|
||||
int _cost[] = { Constants::MTG_COLOR_WHITE, 2 };
|
||||
cost = NEW ManaCost(_cost, 1);
|
||||
@@ -4880,7 +4878,7 @@ class AStasis: public ActivatedAbility
|
||||
public:
|
||||
int paidThisTurn;
|
||||
AStasis(int _id, MTGCardInstance * card) :
|
||||
ActivatedAbility(_id, card, NEW ManaCost(), 1, 0)
|
||||
ActivatedAbility(_id, card, NEW ManaCost(), 0)
|
||||
{
|
||||
paidThisTurn = 1;
|
||||
cost->add(Constants::MTG_COLOR_BLUE, 1);
|
||||
@@ -5003,7 +5001,7 @@ class AADepleter: public ActivatedAbilityTP
|
||||
public:
|
||||
string nbcardsStr;
|
||||
|
||||
AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL, int _tap = 0,
|
||||
AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -5014,7 +5012,7 @@ public:
|
||||
class AAShuffle: public ActivatedAbilityTP
|
||||
{
|
||||
public:
|
||||
AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int _tap = 0, int who =
|
||||
AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
|
||||
TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
@@ -5029,7 +5027,7 @@ public:
|
||||
string nbcardsStr;
|
||||
|
||||
AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
|
||||
int _tap = 0, int who = TargetChooser::UNSET);
|
||||
int who = TargetChooser::UNSET);
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
AARandomDiscarder * clone() const;
|
||||
@@ -5041,7 +5039,7 @@ class AMinionofLeshrac: public TargetAbility
|
||||
public:
|
||||
int paidThisTurn;
|
||||
AMinionofLeshrac(int _id, MTGCardInstance * source) :
|
||||
TargetAbility(_id, source, NEW TypeTargetChooser("creature"), 0, 1, 0)
|
||||
TargetAbility(_id, source, NEW TypeTargetChooser("creature"), 0, 1)
|
||||
{
|
||||
paidThisTurn = 1;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,7 @@ class MTGAbility: public ActionElement{
|
||||
STANDARD_TOKENCREATOR = 27,
|
||||
MORPH_COST = 28,
|
||||
SUSPEND_COST = 29,
|
||||
COUNTERS = 30,
|
||||
|
||||
|
||||
};
|
||||
@@ -261,7 +262,7 @@ class ActivatedAbility:public MTGAbility{
|
||||
MTGAbility * sa;
|
||||
string usesBeforeSideEffects;
|
||||
int uses;
|
||||
ActivatedAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _restrictions = NO_RESTRICTION,int tap = 1,string limit = "",MTGAbility * sideEffect = NULL,string usesBeforeSideEffects = "");
|
||||
ActivatedAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _restrictions = NO_RESTRICTION,string limit = "",MTGAbility * sideEffect = NULL,string usesBeforeSideEffects = "");
|
||||
virtual ~ActivatedAbility();
|
||||
virtual void Update(float dt)
|
||||
{
|
||||
@@ -283,8 +284,8 @@ class ActivatedAbility:public MTGAbility{
|
||||
|
||||
class TargetAbility:public ActivatedAbility, public NestedAbility{
|
||||
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);
|
||||
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0);
|
||||
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0);
|
||||
virtual int reactToClick(MTGCardInstance * card);
|
||||
virtual int reactToTargetClick(Targetable * object);
|
||||
virtual TargetAbility* clone() const = 0;
|
||||
@@ -408,7 +409,7 @@ public:
|
||||
class ActivatedAbilityTP:public ActivatedAbility{
|
||||
public:
|
||||
int who;
|
||||
ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, ManaCost * cost=NULL, int doTap = 0, int who = TargetChooser::UNSET);
|
||||
ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, ManaCost * cost=NULL, int who = TargetChooser::UNSET);
|
||||
Targetable * getTarget();
|
||||
};
|
||||
|
||||
@@ -437,7 +438,7 @@ class AManaProducer: public ActivatedAbilityTP{
|
||||
string menutext;
|
||||
ManaCost * output;
|
||||
int tap;
|
||||
AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost = NULL, int doTap = 0, int who = TargetChooser::UNSET );
|
||||
AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost = NULL, int who = TargetChooser::UNSET );
|
||||
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
|
||||
int resolve();
|
||||
int reactToClick(MTGCardInstance * _card);
|
||||
|
||||
@@ -216,8 +216,7 @@ int AIPlayer::canHandleCost(MTGAbility * ability)
|
||||
// I can't remember as I type this in which condition we use one or the other for this function, if you find out please replace this comment
|
||||
int AIAction::getEfficiency()
|
||||
{
|
||||
//TODO add multiplier according to what the player wants
|
||||
if (efficiency != -1)
|
||||
if (efficiency > -1)
|
||||
return efficiency;
|
||||
if (!ability)
|
||||
return 0;
|
||||
@@ -282,91 +281,90 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
efficiency = 95;
|
||||
}
|
||||
|
||||
//TODO If the card is the target of a damage spell
|
||||
break;
|
||||
}
|
||||
case MTGAbility::STANDARD_PREVENT:
|
||||
{
|
||||
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
//this is a special case for all(this) targetting workaround.
|
||||
//adding a direct method for targetting the source is planned for
|
||||
//the coming releases, all(this) workaround prevents eff from being returned
|
||||
//as its not targetted the same as abilities
|
||||
//for now this dirty hack will calculate eff on lords as tho the source is
|
||||
//the target...otherwise these abilities will never be used.
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power)
|
||||
NeedPreventing = true;
|
||||
if (p == target->controller() && target->controller()->isAI() && NeedPreventing && !(target->getNextOpponent()->has(Constants::DEATHTOUCH)
|
||||
|| target->getNextOpponent()->has(Constants::WITHER)))
|
||||
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
||||
if (!target && !dynamic_cast<ALord*> (a))
|
||||
break;
|
||||
if(dynamic_cast<ALord*> (a) && !target)
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved"..
|
||||
if (target->toughness == 1 && target->getNextOpponent()->power == 1)
|
||||
efficiency += 15;
|
||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
||||
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
|
||||
int calculateAfterDamage = 0;
|
||||
int damages = 0;
|
||||
if((target->defenser || target->blockers.size()) && target->controller()->isAI())
|
||||
//this is a special case for all(this) targetting workaround.
|
||||
//adding a direct method for targetting the source is planned for
|
||||
//the coming releases, all(this) workaround prevents eff from being returned
|
||||
//as its not targetted the same as abilities
|
||||
//for now this dirty hack will calculate eff on lords as tho the source is
|
||||
//the target...otherwise these abilities will never be used.
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power)
|
||||
NeedPreventing = true;
|
||||
if (p == target->controller() && target->controller()->isAI() && NeedPreventing && !(target->getNextOpponent()->has(Constants::DEATHTOUCH)
|
||||
|| target->getNextOpponent()->has(Constants::WITHER)))
|
||||
{
|
||||
damages = target->getNextOpponent()->power;
|
||||
calculateAfterDamage = int(target->toughness - damages);
|
||||
if((calculateAfterDamage + target->preventable) > 0)
|
||||
efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved"..
|
||||
if (target->toughness == 1 && target->getNextOpponent()->power == 1)
|
||||
efficiency += 15;
|
||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
||||
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
|
||||
int calculateAfterDamage = 0;
|
||||
int damages = 0;
|
||||
if((target->defenser || target->blockers.size()) && target->controller()->isAI())
|
||||
{
|
||||
efficiency = 0;
|
||||
//this is to avoid wasting prevents on creatures that will already survive.
|
||||
//this should take into account bushido and flanking as this check is run after every trigger.
|
||||
damages = target->getNextOpponent()->power;
|
||||
calculateAfterDamage = int(target->toughness - damages);
|
||||
if((calculateAfterDamage + target->preventable) > 0)
|
||||
{
|
||||
efficiency = 0;
|
||||
//this is to avoid wasting prevents on creatures that will already survive.
|
||||
//this should take into account bushido and flanking as this check is run after every trigger.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO If the card is the target of a damage spell
|
||||
break;
|
||||
}
|
||||
case MTGAbility::STANDARD_EQUIP:
|
||||
{
|
||||
|
||||
efficiency = 0;
|
||||
if (!target)
|
||||
//TODO If the card is the target of a damage spell
|
||||
break;
|
||||
|
||||
int equips = p->game->battlefield->countByType("Equipment");
|
||||
int myArmy = p->game->battlefield->countByType("Creature");
|
||||
// when can this ever be negative?
|
||||
int equilized = myArmy ? abs(equips / myArmy) : 0;
|
||||
|
||||
if (p == target->controller() && target->equipment <= 1 && !a->source->target)
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());
|
||||
if (target->hasColor(Constants::MTG_COLOR_WHITE))
|
||||
efficiency += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking.
|
||||
if (target->power == 1 && target->toughness == 1 && target->isToken == 0)
|
||||
efficiency += 10; //small bonus to encourage equipping nontoken 1/1 creatures.
|
||||
}
|
||||
|
||||
if (p == target->controller() && !a->source->target && target->equipment < equilized)
|
||||
case MTGAbility::STANDARD_EQUIP:
|
||||
{
|
||||
efficiency = 15 * (target->DangerRanking());
|
||||
efficiency -= 5 * (target->equipment);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
efficiency = 0;
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
int equips = p->game->battlefield->countByType("Equipment");
|
||||
int myArmy = p->game->battlefield->countByType("Creature");
|
||||
// when can this ever be negative?
|
||||
int equilized = myArmy ? abs(equips / myArmy) : 0;
|
||||
|
||||
if (p == target->controller() && target->equipment <= 1 && !a->source->target)
|
||||
{
|
||||
efficiency = 20 * (target->DangerRanking());
|
||||
if (target->hasColor(Constants::MTG_COLOR_WHITE))
|
||||
efficiency += 20;//this is to encourage Ai to equip white creatures in a weenie deck. ultimately it will depend on what had the higher dangerranking.
|
||||
if (target->power == 1 && target->toughness == 1 && target->isToken == 0)
|
||||
efficiency += 10; //small bonus to encourage equipping nontoken 1/1 creatures.
|
||||
}
|
||||
|
||||
if (p == target->controller() && !a->source->target && target->equipment < equilized)
|
||||
{
|
||||
efficiency = 15 * (target->DangerRanking());
|
||||
efficiency -= 5 * (target->equipment);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MTGAbility::STANDARD_LEVELUP:
|
||||
case MTGAbility::COUNTERS:
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
efficiency = 0;
|
||||
Counter * targetCounter = NULL;
|
||||
int currentlevel = 0;
|
||||
@@ -379,27 +377,47 @@ int AIAction::getEfficiency()
|
||||
currentlevel = targetCounter->nb;
|
||||
}
|
||||
}
|
||||
if(AACounter * cc = dynamic_cast<AACounter*> (a))
|
||||
{
|
||||
if(cc && !targetCounter)
|
||||
{
|
||||
if(_target && _target->controller()->isAI() && cc->toughness>=0)
|
||||
{
|
||||
efficiency = 90;
|
||||
|
||||
if (currentlevel < _target->MaxLevelUp)
|
||||
{
|
||||
efficiency = 85;
|
||||
//increase the efficeincy of leveling up by a small amount equal to current level.
|
||||
efficiency += currentlevel;
|
||||
}
|
||||
if(_target && !_target->controller()->isAI() && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0)))
|
||||
{
|
||||
efficiency = 90;
|
||||
|
||||
if (p->game->hand->nb_cards > 0 && p->isAI())
|
||||
{
|
||||
efficiency -= (10 * p->game->hand->nb_cards);//reduce the eff if by 10 times the amount of cards in Ais hand.
|
||||
//it should always try playing more cards before deciding
|
||||
}
|
||||
}
|
||||
if(_target && _target->counters && _target->counters->counters && _target->counters->hasCounter(cc->power,cc->toughness) && _target->counters->hasCounter(cc->power,cc->toughness)->nb > 15)
|
||||
{
|
||||
efficiency = _target->counters->hasCounter(cc->power,cc->toughness)->nb;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentlevel < _target->MaxLevelUp)
|
||||
{
|
||||
efficiency = 85;
|
||||
//increase the efficeincy of leveling up by a small amount equal to current level.
|
||||
efficiency += currentlevel;
|
||||
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_SECONDMAIN)
|
||||
{
|
||||
efficiency = 100;
|
||||
//in 2nd main, go all out and try to max stuff.
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (p->game->hand->nb_cards > 0 && p->isAI())
|
||||
{
|
||||
efficiency -= (10 * p->game->hand->nb_cards);//reduce the eff if by 10 times the amount of cards in Ais hand.
|
||||
//it should always try playing more cards before deciding
|
||||
}
|
||||
|
||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_SECONDMAIN)
|
||||
{
|
||||
efficiency = 100;
|
||||
//in 2nd main, go all out and try to max stuff.
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MTGAbility::STANDARD_PUMP:
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||
@@ -416,7 +434,6 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
target = a->source;
|
||||
}
|
||||
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
//i do not set a starting eff. on this ability, this allows Ai to sometimes randomly do it as it normally does.
|
||||
@@ -440,7 +457,7 @@ int AIAction::getEfficiency()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (suggestion == BAKA_EFFECT_BAD && !target->controller()->isAI())
|
||||
if (suggestion == BAKA_EFFECT_BAD && !target->controller()->isAI() && target->toughness > 0)
|
||||
{
|
||||
efficiency = 100;
|
||||
}
|
||||
@@ -532,7 +549,7 @@ int AIAction::getEfficiency()
|
||||
int efficiencyModifier = (25 * target->DangerRanking());
|
||||
if (p->game->hand->nb_cards > 1)
|
||||
{
|
||||
efficiencyModifier /= p->game->hand->nb_cards;
|
||||
efficiencyModifier -= p->game->hand->nb_cards*3;
|
||||
}
|
||||
if (suggestion == BAKA_EFFECT_BAD && p != target->controller() && target->has(a->abilitygranted) && p->isAI())
|
||||
{
|
||||
@@ -677,7 +694,17 @@ int AIAction::getEfficiency()
|
||||
{
|
||||
ExtraCosts * ec = ability->cost->extraCosts;
|
||||
if (ec)
|
||||
efficiency = efficiency / 3; //Decrease chance of using ability if there is an extra cost to use the ability
|
||||
{
|
||||
for(unsigned int i = 0; i < ec->costs.size();i++)
|
||||
{
|
||||
ExtraCost * tapper = dynamic_cast<TapCost*>(ec->costs[i]);
|
||||
if(tapper)
|
||||
continue;
|
||||
else
|
||||
efficiency = efficiency / 2;
|
||||
}
|
||||
//Decrease chance of using ability if there is an extra cost to use the ability, ignore tap
|
||||
}
|
||||
}
|
||||
return efficiency;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
//Activated Abilities
|
||||
|
||||
//Generic Activated Abilities
|
||||
GenericActivatedAbility::GenericActivatedAbility(string newName,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap,
|
||||
GenericActivatedAbility::GenericActivatedAbility(string newName,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost,
|
||||
string limit,MTGAbility * sideEffects,string usesBeforeSideEffects, int restrictions, MTGGameZone * dest) :
|
||||
ActivatedAbility(_id, card, _cost, restrictions, _tap,limit,sideEffects,usesBeforeSideEffects), NestedAbility(a), activeZone(dest),newName(newName)
|
||||
ActivatedAbility(_id, card, _cost, restrictions,limit,sideEffects,usesBeforeSideEffects), NestedAbility(a), activeZone(dest),newName(newName)
|
||||
{
|
||||
counters = 0;
|
||||
target = ability->target;
|
||||
@@ -71,9 +71,9 @@ GenericActivatedAbility::~GenericActivatedAbility()
|
||||
}
|
||||
|
||||
//AA Alter Poison
|
||||
AAAlterPoison::AAAlterPoison(int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost, int doTap,
|
||||
AAAlterPoison::AAAlterPoison(int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who), poison(poison)
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, who), poison(poison)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ AAAlterPoison::~AAAlterPoison()
|
||||
|
||||
//Damage Prevent
|
||||
AADamagePrevent::AADamagePrevent(int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost,
|
||||
int doTap, int who) :
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who), preventing(preventing)
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, who), preventing(preventing)
|
||||
{
|
||||
aType = MTGAbility::STANDARD_PREVENT;
|
||||
}
|
||||
@@ -138,9 +138,9 @@ AADamagePrevent::~AADamagePrevent()
|
||||
}
|
||||
|
||||
//AADamager
|
||||
AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost, int doTap,
|
||||
AADamager::AADamager(int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who), d(d)
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, who), d(d)
|
||||
{
|
||||
aType = MTGAbility::DAMAGER;
|
||||
}
|
||||
@@ -178,8 +178,8 @@ AADamager * AADamager::clone() const
|
||||
|
||||
|
||||
//AADepleter
|
||||
AADepleter::AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),nbcardsStr(nbcardsStr)
|
||||
AADepleter::AADepleter(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who),nbcardsStr(nbcardsStr)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -223,7 +223,7 @@ AADepleter * AADepleter::clone() const
|
||||
|
||||
//AACopier
|
||||
AACopier::AACopier(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, 0)
|
||||
ActivatedAbility(_id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ AACopier * AACopier::clone() const
|
||||
|
||||
//phaser
|
||||
AAPhaseOut::AAPhaseOut(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, 0)
|
||||
ActivatedAbility(_id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -288,12 +288,15 @@ AAPhaseOut * AAPhaseOut::clone() const
|
||||
|
||||
//Counters
|
||||
AACounter::AACounter(int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness,
|
||||
int nb,int maxNb, ManaCost * cost, int doTap) :
|
||||
ActivatedAbility(id, source, cost, 0, doTap),counterstring(counterstring), nb(nb),maxNb(maxNb), power(power), toughness(toughness), name(_name)
|
||||
int nb,int maxNb, ManaCost * cost) :
|
||||
ActivatedAbility(id, source, cost, 0),counterstring(counterstring), nb(nb),maxNb(maxNb), power(power), toughness(toughness), name(_name)
|
||||
{
|
||||
this->target = target;
|
||||
if (name.find("Level"))
|
||||
aType = MTGAbility::STANDARD_LEVELUP;
|
||||
else
|
||||
aType = MTGAbility::COUNTERS;
|
||||
|
||||
menu = "";
|
||||
}
|
||||
|
||||
@@ -381,8 +384,8 @@ AACounter * AACounter::clone() const
|
||||
|
||||
//Counters
|
||||
AARemoveAllCounter::AARemoveAllCounter(int id, MTGCardInstance * source, MTGCardInstance * target, const char * _name, int power, int toughness,
|
||||
int nb,bool all, ManaCost * cost, int doTap) :
|
||||
ActivatedAbility(id, source, cost, 0, doTap), nb(nb), power(power), toughness(toughness), name(_name),all(all)
|
||||
int nb,bool all, ManaCost * cost) :
|
||||
ActivatedAbility(id, source, cost, 0), nb(nb), power(power), toughness(toughness), name(_name),all(all)
|
||||
{
|
||||
this->target = target;
|
||||
menu = "";
|
||||
@@ -462,8 +465,8 @@ AARemoveAllCounter * AARemoveAllCounter::clone() const
|
||||
}
|
||||
|
||||
// Fizzler
|
||||
AAFizzler::AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost, int _tap) :
|
||||
ActivatedAbility(_id, card, _cost, 0, _tap)
|
||||
AAFizzler::AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(_id, card, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -650,9 +653,9 @@ AADiscardCard * AADiscardCard::clone() const
|
||||
return a;
|
||||
}
|
||||
|
||||
AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, string nbcardsStr, int _tap,
|
||||
AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, string nbcardsStr,
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcardsStr(nbcardsStr)
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who), nbcardsStr(nbcardsStr)
|
||||
{
|
||||
aType = MTGAbility::STANDARD_DRAW;
|
||||
}
|
||||
@@ -697,8 +700,8 @@ AADrawer * AADrawer::clone() const
|
||||
}
|
||||
|
||||
// AAFrozen: Prevent a card from untapping during next untap phase
|
||||
AAFrozen::AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap)
|
||||
AAFrozen::AAFrozen(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -728,8 +731,8 @@ AAFrozen * AAFrozen::clone() const
|
||||
}
|
||||
|
||||
// chose a new target for an aura or enchantment and equip it note: VERY basic right now.
|
||||
AANewTarget::AANewTarget(int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap),retarget(retarget)
|
||||
AANewTarget::AANewTarget(int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0),retarget(retarget)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -796,8 +799,8 @@ AANewTarget * AANewTarget::clone() const
|
||||
return a;
|
||||
}
|
||||
// morph a card
|
||||
AAMorph::AAMorph(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, restrictions, doTap)
|
||||
AAMorph::AAMorph(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, restrictions)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
@@ -875,8 +878,8 @@ AAMorph * AAMorph::clone() const
|
||||
return a;
|
||||
}
|
||||
// AADYNAMIC: dynamic ability builder
|
||||
AADynamic::AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type,int effect,int who,int amountsource,MTGAbility * storedAbility, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap),type(type),effect(effect),who(who),amountsource(amountsource),eachother(eachother),storedAbility(storedAbility)
|
||||
AADynamic::AADynamic(int id, MTGCardInstance * card, Damageable * _target,int type,int effect,int who,int amountsource,MTGAbility * storedAbility, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0),type(type),effect(effect),who(who),amountsource(amountsource),eachother(eachother),storedAbility(storedAbility)
|
||||
{
|
||||
target = _target;
|
||||
sourceamount = 0;
|
||||
@@ -1293,8 +1296,8 @@ AADynamic::~AADynamic()
|
||||
}
|
||||
|
||||
//AALifer
|
||||
AALifer::AALifer(int _id, MTGCardInstance * card, Targetable * _target, string life_s, ManaCost * _cost, int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who),life_s(life_s)
|
||||
AALifer::AALifer(int _id, MTGCardInstance * card, Targetable * _target, string life_s, ManaCost * _cost, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who),life_s(life_s)
|
||||
{
|
||||
aType = MTGAbility::LIFER;
|
||||
}
|
||||
@@ -1339,9 +1342,9 @@ AALifer * AALifer::clone() const
|
||||
|
||||
|
||||
//Lifeset
|
||||
AALifeSet::AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost, int doTap,
|
||||
AALifeSet::AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, doTap, who), life(life)
|
||||
ActivatedAbilityTP(_id, _source, _target, _cost, who), life(life)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1389,7 +1392,7 @@ AALifeSet::~AALifeSet()
|
||||
//cloning...this makes a token thats a copy of the target.
|
||||
AACloner::AACloner(int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost, int who,
|
||||
string abilitiesStringList) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, 0), who(who)
|
||||
ActivatedAbility(_id, _source, _cost, 0), who(who)
|
||||
{
|
||||
aType = MTGAbility::CLONING;
|
||||
target = _target;
|
||||
@@ -1587,8 +1590,8 @@ AInstantCastRestrictionUEOT::~AInstantCastRestrictionUEOT()
|
||||
|
||||
|
||||
//AAMover
|
||||
AAMover::AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(_id, _source, _cost, 0, doTap), destination(dest)
|
||||
AAMover::AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost) :
|
||||
ActivatedAbility(_id, _source, _cost, 0), destination(dest)
|
||||
{
|
||||
if (_target)
|
||||
target = _target;
|
||||
@@ -1646,8 +1649,8 @@ AAMover * AAMover::clone() const
|
||||
|
||||
//Random Discard
|
||||
AARandomDiscarder::AARandomDiscarder(int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost,
|
||||
int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), nbcardsStr(nbcardsStr)
|
||||
int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who), nbcardsStr(nbcardsStr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1690,8 +1693,8 @@ AARandomDiscarder * AARandomDiscarder::clone() const
|
||||
}
|
||||
|
||||
// Shuffle
|
||||
AAShuffle::AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who)
|
||||
AAShuffle::AAShuffle(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1728,8 +1731,8 @@ AAShuffle * AAShuffle::clone() const
|
||||
}
|
||||
|
||||
//Tapper
|
||||
AATapper::AATapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap)
|
||||
AATapper::AATapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
aType = MTGAbility::TAPPER;
|
||||
@@ -1760,8 +1763,8 @@ AATapper * AATapper::clone() const
|
||||
}
|
||||
|
||||
//AA Untapper
|
||||
AAUntapper::AAUntapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost, int doTap) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap)
|
||||
AAUntapper::AAUntapper(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(id, card, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
aType = MTGAbility::UNTAPPER;
|
||||
@@ -1791,8 +1794,8 @@ AAUntapper * AAUntapper::clone() const
|
||||
return a;
|
||||
}
|
||||
|
||||
AAWhatsMax::AAWhatsMax(int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost, int doTap, int value) :
|
||||
ActivatedAbility(id, card, _cost, 0, doTap), value(value)
|
||||
AAWhatsMax::AAWhatsMax(int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost, int value) :
|
||||
ActivatedAbility(id, card, _cost, 0), value(value)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1815,8 +1818,8 @@ AAWhatsMax * AAWhatsMax::clone() const
|
||||
}
|
||||
|
||||
// Win Game
|
||||
AAWinGame::AAWinGame(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who)
|
||||
AAWinGame::AAWinGame(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, who)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1942,8 +1945,8 @@ MayAbility::~MayAbility()
|
||||
}
|
||||
|
||||
//MultiAbility : triggers several actions for a cost
|
||||
MultiAbility::MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, int _tap) :
|
||||
ActivatedAbility(_id, card, _cost, 0, _tap)
|
||||
MultiAbility::MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(_id, card, _cost, 0)
|
||||
{
|
||||
if (_target)
|
||||
target = _target;
|
||||
@@ -2012,8 +2015,8 @@ MultiAbility::~MultiAbility()
|
||||
|
||||
//Generic Target Ability
|
||||
GenericTargetAbility::GenericTargetAbility(string newName,int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a,
|
||||
ManaCost * _cost, int _tap, string limit,MTGAbility * sideEffects,string usesBeforeSideEffects, int restrictions, MTGGameZone * dest) :
|
||||
TargetAbility(_id, _source, _tc, _cost, restrictions, _tap), limit(limit), activeZone(dest),newName(newName)
|
||||
ManaCost * _cost, string limit,MTGAbility * sideEffects,string usesBeforeSideEffects, int restrictions, MTGGameZone * dest) :
|
||||
TargetAbility(_id, _source, _tc, _cost, restrictions), limit(limit), activeZone(dest),newName(newName)
|
||||
{
|
||||
ability = a;
|
||||
MTGAbility * core = AbilityFactory::getCoreAbility(a);
|
||||
@@ -2749,7 +2752,7 @@ APreventDamageTypesUEOT::~APreventDamageTypesUEOT()
|
||||
}
|
||||
|
||||
//AVanishing creature also fading
|
||||
AVanishing::AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap, int restrictions, int amount, string counterName) :
|
||||
AVanishing::AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions, int amount, string counterName) :
|
||||
MTGAbility(_id, source, target),amount(amount),counterName(counterName)
|
||||
{
|
||||
target = card;
|
||||
@@ -2823,9 +2826,9 @@ AVanishing::~AVanishing()
|
||||
}
|
||||
|
||||
//AUpkeep
|
||||
AUpkeep::AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap, int restrictions, int _phase,
|
||||
AUpkeep::AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int restrictions, int _phase,
|
||||
int _once,bool Cumulative) :
|
||||
ActivatedAbility(_id, card, _cost, restrictions, _tap), NestedAbility(a), phase(_phase), once(_once),Cumulative(Cumulative)
|
||||
ActivatedAbility(_id, card, _cost, restrictions), NestedAbility(a), phase(_phase), once(_once),Cumulative(Cumulative)
|
||||
{
|
||||
paidThisTurn = 0;
|
||||
aType = MTGAbility::UPCOST;
|
||||
@@ -2913,7 +2916,7 @@ AUpkeep::~AUpkeep()
|
||||
}
|
||||
|
||||
//A Phase based Action
|
||||
APhaseAction::APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int _tap, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
||||
APhaseAction::APhaseAction(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
||||
MTGAbility(_id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn)
|
||||
{
|
||||
abilityId = _id;
|
||||
@@ -3005,11 +3008,11 @@ APhaseAction::~APhaseAction()
|
||||
}
|
||||
|
||||
// the main ability
|
||||
APhaseActionGeneric::APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int _tap, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
||||
APhaseActionGeneric::APhaseActionGeneric(int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn) :
|
||||
InstantAbility(_id, source, target)
|
||||
{
|
||||
MTGCardInstance * _target = target;
|
||||
ability = NEW APhaseAction(_id, card,_target, sAbility,_tap, restrictions, _phase,forcedestroy,next,myturn,opponentturn);
|
||||
ability = NEW APhaseAction(_id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn);
|
||||
}
|
||||
|
||||
int APhaseActionGeneric::resolve()
|
||||
|
||||
@@ -897,9 +897,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
}
|
||||
}
|
||||
}
|
||||
int doTap = 0; //Tap in the cost ?
|
||||
if (s.find("{t}") != string::npos)
|
||||
doTap = 1;
|
||||
|
||||
int restrictions = parseRestriction(s);
|
||||
|
||||
@@ -938,6 +935,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
if (delimiter != string::npos && firstNonSpace != string::npos && sWithoutTc[firstNonSpace] == '{')
|
||||
{
|
||||
ManaCost * cost = ManaCost::parseManaCost(sWithoutTc.substr(0, delimiter + 1), NULL, card);
|
||||
int doTap = 0; //Tap in the cost ?
|
||||
if(cost && cost->extraCosts)
|
||||
{
|
||||
for(unsigned int i = 0; i < cost->extraCosts->costs.size();i++)
|
||||
{
|
||||
ExtraCost * tapper = dynamic_cast<TapCost*>(cost->extraCosts->costs[i]);
|
||||
if(tapper)
|
||||
doTap = 1;
|
||||
|
||||
}
|
||||
}
|
||||
if (doTap || cost)
|
||||
{
|
||||
string s1 = sWithoutTc.substr(delimiter + 2);
|
||||
@@ -997,8 +1005,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return ae;
|
||||
}
|
||||
if (tc)
|
||||
return NEW GenericTargetAbility(newName,id, card, tc, a, cost, doTap, limit,sideEffect,usesBeforeSideEffect, restrictions, dest);
|
||||
return NEW GenericActivatedAbility(newName,id, card, a, cost, doTap, limit,sideEffect,usesBeforeSideEffect,restrictions, dest);
|
||||
return NEW GenericTargetAbility(newName,id, card, tc, a, cost, limit,sideEffect,usesBeforeSideEffect, restrictions, dest);
|
||||
return NEW GenericActivatedAbility(newName,id, card, a, cost, limit,sideEffect,usesBeforeSideEffect,restrictions, dest);
|
||||
}
|
||||
SAFE_DELETE(cost);
|
||||
}
|
||||
@@ -1127,7 +1135,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NEW AUpkeep(id, card, a, cost, doTap, restrictions, phase, once,Cumulative);
|
||||
return NEW AUpkeep(id, card, a, cost, restrictions, phase, once,Cumulative);
|
||||
}
|
||||
|
||||
//Phase based actions
|
||||
@@ -1171,7 +1179,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
_target = spell->getNextCardTarget();
|
||||
if(!_target)
|
||||
_target = target;
|
||||
return NEW APhaseActionGeneric(id, card,_target,sAbility, doTap, restrictions, phase,sourceinPlay,next);
|
||||
return NEW APhaseActionGeneric(id, card,_target,sAbility, restrictions, phase,sourceinPlay,next);
|
||||
}
|
||||
|
||||
//Multiple abilities for ONE cost
|
||||
@@ -1180,7 +1188,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
SAFE_DELETE(tc);
|
||||
vector<string> multiEffects = split(s,'&');
|
||||
MultiAbility * multi = NEW MultiAbility(id, card, target, NULL, 0);
|
||||
MultiAbility * multi = NEW MultiAbility(id, card, target, NULL);
|
||||
for(unsigned int i = 0;i < multiEffects.size();i++)
|
||||
{
|
||||
if(!multiEffects[i].empty())
|
||||
@@ -1658,7 +1666,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
_target = spell->getNextCardTarget();
|
||||
if(!_target)
|
||||
_target = target;
|
||||
return NEW APhaseActionGeneric(id, card,_target, sAbility, doTap, restrictions, phase,sourceinPlay,next,myturn,opponentturn);
|
||||
return NEW APhaseActionGeneric(id, card,_target, sAbility, restrictions, phase,sourceinPlay,next,myturn,opponentturn);
|
||||
}
|
||||
|
||||
//Upkeep Cost
|
||||
@@ -1706,7 +1714,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NEW AUpkeep(id, card, a, cost, doTap, restrictions, phase, once,Cumulative);
|
||||
return NEW AUpkeep(id, card, a, cost, restrictions, phase, once,Cumulative);
|
||||
}
|
||||
|
||||
//Cycling
|
||||
@@ -1820,14 +1828,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
MTGCard * safetycard = MTGCollection()->getCardById(tokenId);
|
||||
if (safetycard)
|
||||
{//contenue
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, tokenId, 0, starfound, multiplier, who);
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, tokenId, starfound, multiplier, who);
|
||||
tok->oneShot = 1;
|
||||
return tok;
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenId = 0;
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card, target, NULL, "ID NOT FOUND", "ERROR ID", 0, 0, "", 0, NULL);
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card, target, NULL, "ID NOT FOUND", "ERROR ID",0, 0, "",0, NULL,0);
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
@@ -1854,7 +1862,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
}
|
||||
parsePowerToughness(spt, &power, &toughness);
|
||||
string sabilities = s.substr(end + 1);
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, sname, stypes, power + value, toughness + value, sabilities, 0,starfound,
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, sname, stypes, power + value, toughness + value, sabilities,starfound,
|
||||
multiplier, who,aLivingWeapon,spt);
|
||||
tok->oneShot = 1;
|
||||
if(aLivingWeapon)
|
||||
@@ -1874,7 +1882,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
found = s.find("attach");
|
||||
if (found != string::npos)
|
||||
{
|
||||
MTGAbility * a = NEW AEquip(id, card, 0, 0, ActivatedAbility::NO_RESTRICTION);
|
||||
MTGAbility * a = NEW AEquip(id, card, 0, ActivatedAbility::NO_RESTRICTION);
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -2117,7 +2125,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AADamager(id, card, t, d, NULL, 0, who);
|
||||
MTGAbility * a = NEW AADamager(id, card, t, d, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2141,7 +2149,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextPlayerTarget();
|
||||
MTGAbility * a = NEW AAAlterPoison(id, card, t, poison, NULL, 0, who);
|
||||
MTGAbility * a = NEW AAAlterPoison(id, card, t, poison, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2164,7 +2172,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextDamageableTarget();
|
||||
MTGAbility * a = NEW AADamagePrevent(id, card, t, preventing, NULL, 0, who);
|
||||
MTGAbility * a = NEW AADamagePrevent(id, card, t, preventing, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2189,7 +2197,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Damageable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextDamageableTarget();
|
||||
MTGAbility * a = NEW AALifeSet(id, card, t, life, NULL, 0, who);
|
||||
MTGAbility * a = NEW AALifeSet(id, card, t, life, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2212,7 +2220,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AALifer(id, card, t, life_s, NULL, 0, who);
|
||||
MTGAbility * a = NEW AALifer(id, card, t, life_s, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2224,7 +2232,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Damageable * d = NULL;
|
||||
if (spell)
|
||||
d = spell->getNextDamageableTarget();
|
||||
MTGAbility * a = NEW AAWinGame(id, card, d, NULL, 0, who);
|
||||
MTGAbility * a = NEW AAWinGame(id, card, d, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2247,7 +2255,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AADrawer(id, card, t, NULL,nbcardsStr, 0, who);
|
||||
MTGAbility * a = NEW AADrawer(id, card, t, NULL,nbcardsStr, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2271,7 +2279,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AADepleter(id, card, t ,nbcardsStr, NULL, 0, who);
|
||||
MTGAbility * a = NEW AADepleter(id, card, t ,nbcardsStr, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2283,7 +2291,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AAShuffle(id, card, t, NULL, 0, who);
|
||||
MTGAbility * a = NEW AAShuffle(id, card, t, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2344,7 +2352,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextPlayerTarget();
|
||||
MTGAbility * a = NEW AARandomDiscarder(id, card, t, nbcardsStr, NULL, 0, who);
|
||||
MTGAbility * a = NEW AARandomDiscarder(id, card, t, nbcardsStr, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -2532,7 +2540,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
amount = atoi(s.substr(start + 1).c_str());
|
||||
}
|
||||
MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount,"time");
|
||||
MTGAbility * a = NEW AVanishing(id, card, NULL, restrictions,amount,"time");
|
||||
return a;
|
||||
}
|
||||
//Fading
|
||||
@@ -2550,7 +2558,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
amount = atoi(s.substr(start + 1).c_str());
|
||||
}
|
||||
MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount,"fade");
|
||||
MTGAbility * a = NEW AVanishing(id, card, NULL, restrictions,amount,"fade");
|
||||
return a;
|
||||
}
|
||||
if (s.find("altercost(") != string::npos)
|
||||
@@ -2669,7 +2677,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
Targetable * t = NULL;
|
||||
if (spell)
|
||||
t = spell->getNextTarget();
|
||||
MTGAbility * a = NEW AManaProducer(id, card, t, output, NULL, doTap, who);
|
||||
MTGAbility * a = NEW AManaProducer(id, card, t, output, NULL, who);
|
||||
a->oneShot = 1;
|
||||
if(newName.size())
|
||||
((AManaProducer*)a)->menutext = newName;
|
||||
@@ -2791,7 +2799,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
value = atoi(s.substr(start + 1).c_str());
|
||||
}
|
||||
MTGAbility * a = NEW AAWhatsMax(id, card, card, NULL, 0, value);
|
||||
MTGAbility * a = NEW AAWhatsMax(id, card, card, NULL, value);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
@@ -3977,8 +3985,8 @@ NestedAbility::NestedAbility(MTGAbility * _ability)
|
||||
|
||||
//
|
||||
|
||||
ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int restrictions, int tap,string limit,MTGAbility * sideEffect,string usesBeforeSideEffects) :
|
||||
MTGAbility(id, card), restrictions(restrictions), needsTapping(tap),limit(limit),sideEffect(sideEffect),usesBeforeSideEffects(usesBeforeSideEffects)
|
||||
ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int restrictions,string limit,MTGAbility * sideEffect,string usesBeforeSideEffects) :
|
||||
MTGAbility(id, card), restrictions(restrictions), needsTapping(0),limit(limit),sideEffect(sideEffect),usesBeforeSideEffects(usesBeforeSideEffects)
|
||||
{
|
||||
counters = 0;
|
||||
cost = _cost;
|
||||
@@ -4203,14 +4211,14 @@ ostream& ActivatedAbility::toString(ostream& out) const
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc, ManaCost * _cost, int _playerturnonly, int tap) :
|
||||
ActivatedAbility(id, card, _cost, _playerturnonly, tap), NestedAbility(NULL)
|
||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc, ManaCost * _cost, int _playerturnonly) :
|
||||
ActivatedAbility(id, card, _cost, _playerturnonly), NestedAbility(NULL)
|
||||
{
|
||||
tc = _tc;
|
||||
}
|
||||
|
||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, ManaCost * _cost, int _playerturnonly, int tap) :
|
||||
ActivatedAbility(id, card, _cost, _playerturnonly, tap), NestedAbility(NULL)
|
||||
TargetAbility::TargetAbility(int id, MTGCardInstance * card, ManaCost * _cost, int _playerturnonly) :
|
||||
ActivatedAbility(id, card, _cost, _playerturnonly), NestedAbility(NULL)
|
||||
{
|
||||
tc = NULL;
|
||||
}
|
||||
@@ -4758,9 +4766,9 @@ GenericTriggeredAbility* GenericTriggeredAbility::clone() const
|
||||
other solutions need to be provided for abilities that add mana (ex: mana flare)
|
||||
*/
|
||||
|
||||
AManaProducer::AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost, int doTap,
|
||||
AManaProducer::AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(id, card, t, _cost, doTap, who)
|
||||
ActivatedAbilityTP(id, card, t, _cost, who)
|
||||
{
|
||||
|
||||
aType = MTGAbility::MANA_PRODUCER;
|
||||
@@ -4830,7 +4838,6 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
|
||||
GameObserver *g = GameObserver::GetInstance();
|
||||
WEvent * e = NEW WEventCardTappedForMana(source, 0, 1);
|
||||
g->receiveEvent(e);
|
||||
source->tap();
|
||||
}
|
||||
|
||||
if (options[Options::SFXVOLUME].number > 0)
|
||||
@@ -4940,8 +4947,8 @@ Targetable * AbilityTP::getTarget()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ActivatedAbilityTP::ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target, ManaCost * cost, int doTap, int who) :
|
||||
ActivatedAbility(id, card, cost, 0, doTap), who(who)
|
||||
ActivatedAbilityTP::ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target, ManaCost * cost, int who) :
|
||||
ActivatedAbility(id, card, cost, 0), who(who)
|
||||
{
|
||||
if (_target)
|
||||
target = _target;
|
||||
|
||||
Reference in New Issue
Block a user