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 class ACounterShroud: public MTGAbility
{ {
public: public:
TargetChooser * csTc;
Counter * counter; Counter * counter;
RECountersPrevention * re; 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 addToGame();
int destroy(); int destroy();
ACounterShroud * clone() const; ACounterShroud * clone() const;
+2 -1
View File
@@ -42,9 +42,10 @@ protected:
MTGAbility * source; MTGAbility * source;
MTGCardInstance * cardSource; MTGCardInstance * cardSource;
MTGCardInstance * cardTarget; MTGCardInstance * cardTarget;
TargetChooser * TargetingCards;
Counter * counter; Counter * counter;
public: 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); WEvent * replace(WEvent *e);
~RECountersPrevention(); ~RECountersPrevention();
}; };
+3 -3
View File
@@ -538,15 +538,15 @@ AACounter * AACounter::clone() const
} }
//shield a card from a certain type of counter. //shield a card from a certain type of counter.
ACounterShroud::ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, Counter * counter) : ACounterShroud::ACounterShroud(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,TargetChooser * tc, Counter * counter) :
MTGAbility(observer, id, source),counter(counter),re(NULL) MTGAbility(observer, id, source),csTc(tc),counter(counter),re(NULL)
{ {
} }
int ACounterShroud::addToGame() int ACounterShroud::addToGame()
{ {
SAFE_DELETE(re); SAFE_DELETE(re);
re = NEW RECountersPrevention(this,source,(MTGCardInstance*)target,counter); re = NEW RECountersPrevention(this,source,(MTGCardInstance*)target,csTc,counter);
if (re) if (re)
{ {
game->replacementEffects->add(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; 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; return a;
} }
//use counters to track by counters to track an efect by counter name. //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); SAFE_DELETE(tcTarget);
} }
//counters replacement effect/////////////////// //counters replacement effect///////////////////
RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance * cardSource,MTGCardInstance * cardTarget,Counter * counter) : RECountersPrevention::RECountersPrevention(MTGAbility * source,MTGCardInstance * cardSource,MTGCardInstance * cardTarget,TargetChooser * tc,Counter * counter) :
source(source),cardSource(cardSource),cardTarget(cardTarget),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) else if((MTGCardInstance*)e->targetCard == cardSource)
return event = NULL; return event = NULL;
else if(TargetingCards && TargetingCards->canTarget((MTGCardInstance*)e->targetCard))
return event = NULL;
} }
return event; return event;
} }
RECountersPrevention::~RECountersPrevention() RECountersPrevention::~RECountersPrevention()
{ {
SAFE_DELETE(TargetingCards);
} }
////////////////////////////////////////////// //////////////////////////////////////////////
ReplacementEffects::ReplacementEffects() ReplacementEffects::ReplacementEffects()
+1 -1
View File
@@ -2044,7 +2044,7 @@ void WGuiFilterItem::updateValue()
SAFE_DELETE(mParent->subMenu); SAFE_DELETE(mParent->subMenu);
mParent->clearArgs(); mParent->clearArgs();
mState = STATE_CHOOSE_VAL; 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) if (filterType == FILTER_TYPE)
{ {
mParent->addArg("Artifact", "t:Artifact;"); mParent->addArg("Artifact", "t:Artifact;");