aura parent
This commit is contained in:
@@ -56038,7 +56038,7 @@ toughness=3
|
||||
[card]
|
||||
name=Hubris
|
||||
target=creature|battlefield
|
||||
auto=transforms((,newability[moveto(ownerhand) all(children[aura]],newability[moveto(ownerhand)])) forever
|
||||
auto=transforms((,newability[moveto(ownerhand) all(mychild)],newability[moveto(ownerhand)])) forever
|
||||
text=Return target creature and all Auras attached to it to their owners' hands.
|
||||
mana={1}{U}
|
||||
type=Instant
|
||||
@@ -114622,7 +114622,7 @@ type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Street Sweeper
|
||||
auto=@combat(attacking) source(this) restriction{type(land[enchanted]|battlefield)~morethan~0}:name(destroy auras) target(land[enchanted]|battlefield) transforms((,newability[destroy all(children[aura])]))
|
||||
auto=@combat(attacking) source(this) restriction{type(land[enchanted]|battlefield)~morethan~0}:name(destroy auras) target(land[enchanted]|battlefield) transforms((,newability[destroy all(mychild)]))
|
||||
text=Whenever Street Sweeper attacks, destroy all Auras attached to target land.
|
||||
mana={6}
|
||||
type=Artifact Creature
|
||||
|
||||
@@ -128,6 +128,7 @@ public:
|
||||
MTGCardInstance * tokCard;
|
||||
MTGCardInstance * previous;
|
||||
MTGCardInstance * next;
|
||||
MTGCardInstance * auraParent;
|
||||
MTGAbility * TokenAndAbility;
|
||||
MTGAbility * GrantedAndAbility;
|
||||
int doDamageTest;
|
||||
|
||||
@@ -357,4 +357,24 @@ public:
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
~ParentChildChooser();
|
||||
};
|
||||
|
||||
class ChildrenChooser: public TypeTargetChooser
|
||||
{
|
||||
public:
|
||||
bool withoutProtections;
|
||||
ChildrenChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) :
|
||||
TypeTargetChooser(observer, "*",_zones, _nbzones, card, _maxtargets, other, targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
ChildrenChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) :
|
||||
TypeTargetChooser(observer, "*", card, _maxtargets, other,targetMin)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual bool canTarget(Targetable * target, bool withoutProtections = false);
|
||||
virtual ChildrenChooser * clone() const;
|
||||
virtual bool equals(TargetChooser * tc);
|
||||
~ChildrenChooser();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1142,6 +1142,7 @@ void GameObserver::enchantmentStatus()
|
||||
{
|
||||
card->target->enchanted = true;
|
||||
card->target->auras += 1;
|
||||
card->auraParent = card->target;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1161,6 +1162,7 @@ void GameObserver::Affinity()
|
||||
if (!card)
|
||||
continue;
|
||||
|
||||
bool checkAuraP = false;
|
||||
///////////////////////////
|
||||
//reset extracost shadows//
|
||||
///////////////////////////
|
||||
@@ -1185,6 +1187,10 @@ void GameObserver::Affinity()
|
||||
///we handle trisnisphere seperately because its a desaster.
|
||||
if(card->getManaCost())//make sure we check, abiliy$!/token dont have a mancost object.
|
||||
{
|
||||
if (card->controller()->AuraIncreased->getConvertedCost() || card->controller()->AuraReduced->getConvertedCost())
|
||||
if(card->model->data->getManaCost()->getBestow())
|
||||
checkAuraP = true;
|
||||
|
||||
//change cost to colorless for anytypeofmana ability
|
||||
if(card->has(Constants::ANYTYPEOFMANA))
|
||||
{
|
||||
@@ -1244,11 +1250,9 @@ void GameObserver::Affinity()
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::CONDUITED) ||
|
||||
card->controller()->AuraIncreased->getConvertedCost() ||
|
||||
card->controller()->AuraReduced->getConvertedCost() ||
|
||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||
card->getReducedManaCost()->getConvertedCost() ||
|
||||
NewAffinityFound)
|
||||
NewAffinityFound || checkAuraP)
|
||||
&&
|
||||
AffinityNeedsUpdate
|
||||
)
|
||||
@@ -1260,60 +1264,52 @@ void GameObserver::Affinity()
|
||||
//only do any of the following if a card with the stated ability is in your hand.
|
||||
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
|
||||
card->getManaCost()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||
card->getManaCost()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
if (card->getManaCost()->getAlternative())
|
||||
{
|
||||
card->getManaCost()->getAlternative()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||
card->getManaCost()->getAlternative()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBestow())
|
||||
{//NOTE: there should be a limitation when the spell is cast with bestow its not both creature and aura...
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(), false, true));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getRetrace())
|
||||
{
|
||||
card->getManaCost()->getRetrace()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
||||
card->getManaCost()->getRetrace()->changeCostTo(newCost);
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(),false,true));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBuyback())
|
||||
{
|
||||
card->getManaCost()->getBuyback()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||
card->getManaCost()->getBuyback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getFlashback())
|
||||
{
|
||||
card->getManaCost()->getFlashback()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||
card->getManaCost()->getFlashback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getMorph())
|
||||
{
|
||||
card->getManaCost()->getMorph()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||
card->getManaCost()->getMorph()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
if (card->getManaCost()->getRetrace())
|
||||
{
|
||||
card->getManaCost()->getRetrace()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
||||
card->getManaCost()->getRetrace()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
}//end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,6 +303,7 @@ void MTGCardInstance::initMTGCI()
|
||||
tokCard = NULL;
|
||||
previous = NULL;
|
||||
next = NULL;
|
||||
auraParent = NULL;
|
||||
TokenAndAbility = NULL;
|
||||
GrantedAndAbility = NULL;
|
||||
lastController = NULL;
|
||||
|
||||
@@ -48,6 +48,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
return NEW CardTargetChooser(observer, target, card);
|
||||
};
|
||||
|
||||
found = s.find("mychild");
|
||||
if (found == 0)
|
||||
{
|
||||
int maxtargets = 1;
|
||||
return NEW ChildrenChooser(observer, card, maxtargets);
|
||||
};
|
||||
|
||||
found = s.find("targetedplayer");
|
||||
if (found == 0)
|
||||
{
|
||||
@@ -2015,3 +2022,42 @@ ParentChildChooser::~ParentChildChooser()
|
||||
{
|
||||
SAFE_DELETE(deeperTargeting);
|
||||
}
|
||||
|
||||
//child only
|
||||
bool ChildrenChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
if (MTGCardInstance * card = dynamic_cast<MTGCardInstance*>(target))
|
||||
{
|
||||
if(card == source)
|
||||
return false;
|
||||
if(!card->isInPlay(observer))
|
||||
return false;
|
||||
if(card->auraParent)
|
||||
{
|
||||
if(card->auraParent == source)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ChildrenChooser* ChildrenChooser::clone() const
|
||||
{
|
||||
ChildrenChooser * a = NEW ChildrenChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
bool ChildrenChooser::equals(TargetChooser * tc)
|
||||
{
|
||||
|
||||
ChildrenChooser * dtc = dynamic_cast<ChildrenChooser *> (tc);
|
||||
if (!dtc)
|
||||
return false;
|
||||
|
||||
return TypeTargetChooser::equals(tc);
|
||||
}
|
||||
|
||||
ChildrenChooser::~ChildrenChooser()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user