added a new method to use countershroud to create a globel shroud by targetchooser...auto=countershroud(-1/-1)creature|mybattlefield...like this....
This commit is contained in:
@@ -3910,9 +3910,10 @@ public:
|
||||
class ACounterShroud: public MTGAbility
|
||||
{
|
||||
public:
|
||||
TargetChooser * csTc;
|
||||
Counter * counter;
|
||||
RECountersPrevention * re;
|
||||
ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, Counter * counter = NULL);
|
||||
ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,TargetChooser * tc, Counter * counter = NULL);
|
||||
int addToGame();
|
||||
int destroy();
|
||||
ACounterShroud * clone() const;
|
||||
|
||||
@@ -42,9 +42,10 @@ protected:
|
||||
MTGAbility * source;
|
||||
MTGCardInstance * cardSource;
|
||||
MTGCardInstance * cardTarget;
|
||||
TargetChooser * TargetingCards;
|
||||
Counter * counter;
|
||||
public:
|
||||
RECountersPrevention(MTGAbility * _source,MTGCardInstance * cardSource = NULL,MTGCardInstance * cardTarget = NULL,Counter * counter = NULL);
|
||||
RECountersPrevention(MTGAbility * _source,MTGCardInstance * cardSource = NULL,MTGCardInstance * cardTarget = NULL,TargetChooser * tc = NULL,Counter * counter = NULL);
|
||||
WEvent * replace(WEvent *e);
|
||||
~RECountersPrevention();
|
||||
};
|
||||
|
||||
@@ -538,15 +538,15 @@ AACounter * AACounter::clone() const
|
||||
}
|
||||
|
||||
//shield a card from a certain type of counter.
|
||||
ACounterShroud::ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, Counter * counter) :
|
||||
MTGAbility(observer, id, source),counter(counter),re(NULL)
|
||||
ACounterShroud::ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,TargetChooser * tc, Counter * counter) :
|
||||
MTGAbility(observer, id, source),csTc(tc),counter(counter),re(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
int ACounterShroud::addToGame()
|
||||
{
|
||||
SAFE_DELETE(re);
|
||||
re = NEW RECountersPrevention(this,source,(MTGCardInstance*)target,counter);
|
||||
re = NEW RECountersPrevention(this,source,(MTGCardInstance*)target,csTc,counter);
|
||||
if (re)
|
||||
{
|
||||
game->replacementEffects->add(re);
|
||||
|
||||
@@ -2330,7 +2330,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
MTGAbility * a = NEW ACounterShroud(observer, id, card, target,counter);
|
||||
TargetChooser * csTc = NULL;
|
||||
if(splitCounterShroud[2].size() > 1)
|
||||
{
|
||||
TargetChooserFactory af(card->getObserver());
|
||||
csTc = af.createTargetChooser(splitCounterShroud[2],card);
|
||||
}
|
||||
MTGAbility * a = NEW ACounterShroud(observer, id, card, target,csTc,counter);
|
||||
return a;
|
||||
}
|
||||
//use counters to track by counters to track an efect by counter name.
|
||||
|
||||
@@ -49,8 +49,8 @@ REDamagePrevention::~REDamagePrevention()
|
||||
SAFE_DELETE(tcTarget);
|
||||
}
|
||||
//counters replacement effect///////////////////
|
||||
RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance * cardSource,MTGCardInstance * cardTarget,Counter * counter) :
|
||||
source(source),cardSource(cardSource),cardTarget(cardTarget),counter(counter)
|
||||
RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance * cardSource,MTGCardInstance * cardTarget,TargetChooser * tc,Counter * counter) :
|
||||
source(source),cardSource(cardSource),cardTarget(cardTarget),TargetingCards(tc),counter(counter)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -68,12 +68,14 @@ RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance *
|
||||
}
|
||||
else if((MTGCardInstance*)e->targetCard == cardSource)
|
||||
return event = NULL;
|
||||
else if(TargetingCards && TargetingCards->canTarget((MTGCardInstance*)e->targetCard))
|
||||
return event = NULL;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
RECountersPrevention::~RECountersPrevention()
|
||||
{
|
||||
|
||||
SAFE_DELETE(TargetingCards);
|
||||
}
|
||||
//////////////////////////////////////////////
|
||||
ReplacementEffects::ReplacementEffects()
|
||||
|
||||
@@ -2044,7 +2044,7 @@ void WGuiFilterItem::updateValue()
|
||||
SAFE_DELETE(mParent->subMenu);
|
||||
mParent->clearArgs();
|
||||
mState = STATE_CHOOSE_VAL;
|
||||
mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MENU_FONT, 20, 20, "Filter:");
|
||||
mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MAIN_FONT, 20, 20, "Filter:");
|
||||
if (filterType == FILTER_TYPE)
|
||||
{
|
||||
mParent->addArg("Artifact", "t:Artifact;");
|
||||
|
||||
Reference in New Issue
Block a user