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:
omegablast2002@yahoo.com
2012-03-20 12:21:03 +00:00
parent 2ddf1d36da
commit 48e5608803
6 changed files with 20 additions and 10 deletions
+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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();
};
+3 -3
View File
@@ -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);
+7 -1
View File
@@ -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.
+5 -3
View File
@@ -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()
+1 -1
View File
@@ -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;");