added countertrack(counterstring) MTGAbility

what this does currently is remove a counter of the type counterstring and when the ability is destroyed it puts the counter back for us.
meant for weapons used as follows.
auto=teach(creature) countertrack(0/0,1,hand)

when the creature is equipped with this weapon it will remove a hand counter from the creature, when you remove the weapon, or the weapon is destroyed or whatever...it will put a hand counter back on the creature.

added dualwielding thisdescriptor...
auto=this(dualwielding) 2/2
auto=this(dualwielding) firststrike

enabled "restriction{" on phasebased triggers @next and @each...

i will work more on countertrack to extend it to domains if it currently isnt possible to use it in this case(haven't tested it on domains)....
This commit is contained in:
omegablast2002@yahoo.com
2011-09-13 14:33:13 +00:00
parent 713cb2aa45
commit 6ea7e00803
8 changed files with 158 additions and 3 deletions
+54
View File
@@ -416,6 +416,60 @@ ACounterShroud::~ACounterShroud()
SAFE_DELETE(counter);
}
//sheild a card from a certain type of counter.
ACounterTracker::ACounterTracker(int id, MTGCardInstance * source, MTGCardInstance * target, Counter * counter) :
MTGAbility(id, source, target),counter(counter)
{
removed = 0;
}
int ACounterTracker::addToGame()
{
MTGCardInstance * _target = (MTGCardInstance*)target;
if(_target && !removed)
{
if(_target->counters->hasCounter(counter->name.c_str(),counter->power,counter->toughness) && _target->counters->hasCounter(counter->name.c_str(),counter->power,counter->toughness)->nb >= counter->nb)
{
for(int nb = 0;nb < counter->nb;nb++)
{
_target->counters->removeCounter(counter->name.c_str(),counter->power,counter->toughness);
removed++;
}
}
return 1;
}
return 0;
}
int ACounterTracker::destroy()
{
MTGCardInstance * _target = (MTGCardInstance*)target;
if(_target)
{
if(removed == counter->nb)
{
for(int nb = 0;nb < counter->nb;nb++)
{
_target->counters->addCounter(counter->name.c_str(),counter->power,counter->toughness);
}
}
}
removeFromGame();
return 1;
}
ACounterTracker * ACounterTracker::clone() const
{
ACounterTracker * a = NEW ACounterTracker(*this);
a->counter = this->counter;
return a;
}
ACounterTracker::~ACounterTracker()
{
SAFE_DELETE(counter);
}
//removeall counters of a certain type or all.
AARemoveAllCounter::AARemoveAllCounter(int id, MTGCardInstance * source, MTGCardInstance * target, const char * _name, int power, int toughness,
int nb,bool all, ManaCost * cost) :