Fixed primitives, added new ability "exploits" to sacrifice a creature, added new trigger "exploited" and improved all primitives with Exploit ability, improved "tokencreated" and "sacrificed" triggers to allow "turnlimited" option, improved "flip" ability in order to keep track of current zone before flip.
This commit is contained in:
@@ -4133,6 +4133,7 @@ AASacrificeCard::AASacrificeCard(GameObserver* observer, int _id, MTGCardInstanc
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
isExploited = false;
|
||||
}
|
||||
|
||||
int AASacrificeCard::resolve()
|
||||
@@ -4140,14 +4141,18 @@ int AASacrificeCard::resolve()
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (_target)
|
||||
{
|
||||
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be sacrificed, they will follow the fate of top-card
|
||||
if(_target->mutation && _target->parentCards.size() > 0) return 0; // Mutated down cards cannot be sacrificed or exploited, they will follow the fate of top-card
|
||||
Player * p = _target->controller();
|
||||
MTGCardInstance * beforeCard = _target;
|
||||
p->game->putInGraveyard(_target);
|
||||
while(_target->next)
|
||||
_target = _target->next;
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard, _target);
|
||||
game->receiveEvent(e);
|
||||
if(isExploited){
|
||||
WEvent * e = NEW WEventCardExploited(beforeCard, _target);
|
||||
game->receiveEvent(e);
|
||||
}
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
@@ -4169,7 +4174,10 @@ int AASacrificeCard::resolve()
|
||||
|
||||
const string AASacrificeCard::getMenuText()
|
||||
{
|
||||
return "Sacrifice";
|
||||
if(isExploited)
|
||||
return "Exploit";
|
||||
else
|
||||
return "Sacrifice";
|
||||
}
|
||||
|
||||
AASacrificeCard * AASacrificeCard::clone() const
|
||||
@@ -4802,10 +4810,12 @@ int AAFlip::resolve()
|
||||
}
|
||||
|
||||
while (_target->next)
|
||||
_target = _target->next;
|
||||
_target = _target->next;
|
||||
|
||||
MTGGameZone * currentZone = NULL;
|
||||
if(forcetype != "" && _target) // Added to flip Modal Double Faced cards (e.g. Zendikar Rising).
|
||||
{
|
||||
currentZone = _target->currentZone; // Added to keep track of current zone before flip.
|
||||
for (int i = ((int)_target->types.size())-1; i >= 0; --i)
|
||||
_target->removeType(_target->types[i]);
|
||||
list<int> typesToAdd;
|
||||
@@ -4994,9 +5004,10 @@ int AAFlip::resolve()
|
||||
|
||||
if(forcetype != "" && _target && _target->isPermanent()) // Added to flip Modal Double Faced cards (e.g. Zendikar Rising).
|
||||
{
|
||||
if(!currentZone) currentZone = _target->controller()->game->hand; // If NULL, we consider hand as the default currentZone.
|
||||
_target->castMethod = Constants::CAST_NORMALLY;
|
||||
_target->controller()->game->battlefield->addCard(_target);
|
||||
WEvent * e = NEW WEventZoneChange(_target, _target->controller()->game->hand, _target->controller()->game->battlefield);
|
||||
WEvent * e = NEW WEventZoneChange(_target, currentZone, _target->controller()->game->battlefield);
|
||||
game->receiveEvent(e);
|
||||
} else {
|
||||
WEvent * e = NEW WEventCardTransforms(_target);
|
||||
|
||||
@@ -1363,11 +1363,15 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
|
||||
//Token has been created
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "tokencreated", card))
|
||||
return NEW TrTokenCreated(observer, id, card, tc, once);
|
||||
return NEW TrTokenCreated(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Card is sacrificed
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "sacrificed", card))
|
||||
return NEW TrCardSacrificed(observer, id, card, tc, once);
|
||||
return NEW TrCardSacrificed(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Card is exploited
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "exploited", card))
|
||||
return NEW TrCardExploited(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Card is Discarded
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "discarded", card))
|
||||
@@ -3626,10 +3630,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
if (s.find("sacrifice") != string::npos)
|
||||
if (s.find("sacrifice") != string::npos || s.find("exploits") != string::npos)
|
||||
{
|
||||
MTGAbility *a = NEW AASacrificeCard(observer, id, card, target);
|
||||
a->oneShot = 1;
|
||||
((AASacrificeCard*)a)->isExploited = (s.find("exploits") != string::npos)?true:false; // added to allow the Exploit trigger.
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
@@ -7004,6 +7009,13 @@ int TriggeredAbility::receiveEvent(WEvent * e)
|
||||
resolve();
|
||||
return 1;
|
||||
}
|
||||
if(dynamic_cast<WEventCardExploited*>(e))
|
||||
{
|
||||
//exploited event must resolve instantly or by the time they do the cards that triggered them
|
||||
//have already been put in graveyard.
|
||||
resolve();
|
||||
return 1;
|
||||
}
|
||||
if(dynamic_cast<WEventCardDiscard*>(e))
|
||||
{
|
||||
//discard event must resolve instantly or by the time they do the cards that triggered them
|
||||
|
||||
@@ -110,6 +110,11 @@ WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardExploited::WEventCardExploited(MTGCardInstance * card, MTGCardInstance * after) :
|
||||
WEventCardUpdate(card),cardAfter(after)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardDiscard::WEventCardDiscard(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
@@ -440,6 +445,15 @@ Targetable * WEventCardSacrifice::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardExploited::getTarget(int target)
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
return cardAfter;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardDiscard::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
|
||||
Reference in New Issue
Block a user