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:
+119
-92
@@ -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