aura parent
This commit is contained in:
@@ -56038,7 +56038,7 @@ toughness=3
|
|||||||
[card]
|
[card]
|
||||||
name=Hubris
|
name=Hubris
|
||||||
target=creature|battlefield
|
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.
|
text=Return target creature and all Auras attached to it to their owners' hands.
|
||||||
mana={1}{U}
|
mana={1}{U}
|
||||||
type=Instant
|
type=Instant
|
||||||
@@ -114622,7 +114622,7 @@ type=Instant
|
|||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Street Sweeper
|
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.
|
text=Whenever Street Sweeper attacks, destroy all Auras attached to target land.
|
||||||
mana={6}
|
mana={6}
|
||||||
type=Artifact Creature
|
type=Artifact Creature
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public:
|
|||||||
MTGCardInstance * tokCard;
|
MTGCardInstance * tokCard;
|
||||||
MTGCardInstance * previous;
|
MTGCardInstance * previous;
|
||||||
MTGCardInstance * next;
|
MTGCardInstance * next;
|
||||||
|
MTGCardInstance * auraParent;
|
||||||
MTGAbility * TokenAndAbility;
|
MTGAbility * TokenAndAbility;
|
||||||
MTGAbility * GrantedAndAbility;
|
MTGAbility * GrantedAndAbility;
|
||||||
int doDamageTest;
|
int doDamageTest;
|
||||||
|
|||||||
@@ -357,4 +357,24 @@ public:
|
|||||||
virtual bool equals(TargetChooser * tc);
|
virtual bool equals(TargetChooser * tc);
|
||||||
~ParentChildChooser();
|
~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
|
#endif
|
||||||
|
|||||||
@@ -1142,6 +1142,7 @@ void GameObserver::enchantmentStatus()
|
|||||||
{
|
{
|
||||||
card->target->enchanted = true;
|
card->target->enchanted = true;
|
||||||
card->target->auras += 1;
|
card->target->auras += 1;
|
||||||
|
card->auraParent = card->target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1161,6 +1162,7 @@ void GameObserver::Affinity()
|
|||||||
if (!card)
|
if (!card)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
bool checkAuraP = false;
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
//reset extracost shadows//
|
//reset extracost shadows//
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -1185,6 +1187,10 @@ void GameObserver::Affinity()
|
|||||||
///we handle trisnisphere seperately because its a desaster.
|
///we handle trisnisphere seperately because its a desaster.
|
||||||
if(card->getManaCost())//make sure we check, abiliy$!/token dont have a mancost object.
|
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
|
//change cost to colorless for anytypeofmana ability
|
||||||
if(card->has(Constants::ANYTYPEOFMANA))
|
if(card->has(Constants::ANYTYPEOFMANA))
|
||||||
{
|
{
|
||||||
@@ -1244,11 +1250,9 @@ void GameObserver::Affinity()
|
|||||||
card->has(Constants::AFFINITYPLAINS) ||
|
card->has(Constants::AFFINITYPLAINS) ||
|
||||||
card->has(Constants::AFFINITYSWAMP) ||
|
card->has(Constants::AFFINITYSWAMP) ||
|
||||||
card->has(Constants::CONDUITED) ||
|
card->has(Constants::CONDUITED) ||
|
||||||
card->controller()->AuraIncreased->getConvertedCost() ||
|
|
||||||
card->controller()->AuraReduced->getConvertedCost() ||
|
|
||||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||||
card->getReducedManaCost()->getConvertedCost() ||
|
card->getReducedManaCost()->getConvertedCost() ||
|
||||||
NewAffinityFound)
|
NewAffinityFound || checkAuraP)
|
||||||
&&
|
&&
|
||||||
AffinityNeedsUpdate
|
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.
|
//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.
|
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
|
||||||
card->getManaCost()->resetCosts();
|
card->getManaCost()->resetCosts();
|
||||||
ManaCost *newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
|
||||||
|
|
||||||
card->getManaCost()->changeCostTo(newCost);
|
card->getManaCost()->changeCostTo(newCost);
|
||||||
SAFE_DELETE(newCost);
|
SAFE_DELETE(newCost);
|
||||||
if (card->getManaCost()->getAlternative())
|
if (card->getManaCost()->getAlternative())
|
||||||
{
|
{
|
||||||
card->getManaCost()->getAlternative()->resetCosts();
|
card->getManaCost()->getAlternative()->resetCosts();
|
||||||
ManaCost * newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
|
||||||
card->getManaCost()->getAlternative()->changeCostTo(newCost);
|
card->getManaCost()->getAlternative()->changeCostTo(newCost);
|
||||||
SAFE_DELETE(newCost);
|
SAFE_DELETE(newCost);
|
||||||
}
|
}
|
||||||
if (card->getManaCost()->getBestow())
|
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();
|
card->getManaCost()->getBestow()->resetCosts();
|
||||||
ManaCost * newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(),false,true));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||||
card->getManaCost()->getRetrace()->changeCostTo(newCost);
|
|
||||||
SAFE_DELETE(newCost);
|
SAFE_DELETE(newCost);
|
||||||
}
|
}
|
||||||
if (card->getManaCost()->getBuyback())
|
if (card->getManaCost()->getBuyback())
|
||||||
{
|
{
|
||||||
card->getManaCost()->getBuyback()->resetCosts();
|
card->getManaCost()->getBuyback()->resetCosts();
|
||||||
ManaCost * newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
|
||||||
card->getManaCost()->getBuyback()->changeCostTo(newCost);
|
card->getManaCost()->getBuyback()->changeCostTo(newCost);
|
||||||
SAFE_DELETE(newCost);
|
SAFE_DELETE(newCost);
|
||||||
}
|
}
|
||||||
if (card->getManaCost()->getFlashback())
|
if (card->getManaCost()->getFlashback())
|
||||||
{
|
{
|
||||||
card->getManaCost()->getFlashback()->resetCosts();
|
card->getManaCost()->getFlashback()->resetCosts();
|
||||||
ManaCost * newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
|
||||||
card->getManaCost()->getFlashback()->changeCostTo(newCost);
|
card->getManaCost()->getFlashback()->changeCostTo(newCost);
|
||||||
SAFE_DELETE(newCost);
|
SAFE_DELETE(newCost);
|
||||||
}
|
}
|
||||||
if (card->getManaCost()->getMorph())
|
if (card->getManaCost()->getMorph())
|
||||||
{
|
{
|
||||||
card->getManaCost()->getMorph()->resetCosts();
|
card->getManaCost()->getMorph()->resetCosts();
|
||||||
ManaCost * newCost = NEW ManaCost();
|
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
|
||||||
card->getManaCost()->getMorph()->changeCostTo(newCost);
|
card->getManaCost()->getMorph()->changeCostTo(newCost);
|
||||||
SAFE_DELETE(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
|
}//end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
tokCard = NULL;
|
tokCard = NULL;
|
||||||
previous = NULL;
|
previous = NULL;
|
||||||
next = NULL;
|
next = NULL;
|
||||||
|
auraParent = NULL;
|
||||||
TokenAndAbility = NULL;
|
TokenAndAbility = NULL;
|
||||||
GrantedAndAbility = NULL;
|
GrantedAndAbility = NULL;
|
||||||
lastController = NULL;
|
lastController = NULL;
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
return NEW CardTargetChooser(observer, target, card);
|
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");
|
found = s.find("targetedplayer");
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
{
|
{
|
||||||
@@ -2015,3 +2022,42 @@ ParentChildChooser::~ParentChildChooser()
|
|||||||
{
|
{
|
||||||
SAFE_DELETE(deeperTargeting);
|
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