3 things here, found my targets returns for @vampired we're screwy, which explained why doc didnt add 3 of the possible cards for it...corrected that but i need to rename the varibles which i will do at a later time, not in this patch..

2 fix for token creator livingweapons...this was actually a preexisting bug, but not noticed becuase these are the first equipments that use token gen...when equipping it would readd the oneshot tok gen as an activated ability with no cost...generally we dont want to pass oneshot token generation to another card by equipping...

and 3rd...
got rid of the disgusting vanishing workaround.
it was riddled with bugs, got exsample if the creatures would gain indestructible the -99/-99 they were reciving did nothing to rid the battlefield of the creature...

new vanishing is 
auto=vanishing:number
thats it, no crazy 2 trigger lines with lords ect...
This commit is contained in:
omegablast2002@yahoo.com
2011-02-03 14:17:25 +00:00
parent 22adbe4ab7
commit 75a9d7840d
4 changed files with 114 additions and 5 deletions

View File

@@ -2704,7 +2704,7 @@ public:
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a))
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
SAFE_DELETE(a);
continue;
@@ -2726,6 +2726,13 @@ public:
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a)) continue;
if (dynamic_cast<ATeach *> (a)) continue;
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
{
a->forceDestroy = 1;
continue;
}
//we generally dont want to pass oneShot tokencreators to the cards
//we equip...
a->addToGame();
}
return 1;
@@ -2962,7 +2969,7 @@ public:
{
AEquip* ae = dynamic_cast<AEquip*>(a);
ae->unequip();
ae->equip(card);
ae->equip(card);
}
}
}
@@ -3951,6 +3958,21 @@ public:
~APreventDamageTypesUEOT();
};
//Upkeep Cost
class AVanishing: public ActivatedAbility
{
public:
int timeLeft;
int amount;
AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap = 0, int restrictions = 0,int amount = 0);
void Update(float dt);
int resolve();
const char * getMenuText();
AVanishing * clone() const;
~AVanishing();
};
//Upkeep Cost
class AUpkeep: public ActivatedAbility, public NestedAbility
{

View File

@@ -2782,6 +2782,73 @@ APreventDamageTypesUEOT::~APreventDamageTypesUEOT()
SAFE_DELETE(ability);
}
//AVanishing creature
AVanishing::AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap, int restrictions, int amount) :
ActivatedAbility(_id, card, _cost, restrictions, _tap),amount(amount)
{
for(int i = 0;i< amount;i++)
source->counters->addCounter("time",0,0);
}
void AVanishing::Update(float dt)
{
if (newPhase != currentPhase && source->controller() == game->currentPlayer)
{
if(newPhase == Constants::MTG_PHASE_UPKEEP)
{
source->counters->removeCounter("time",0,0);
Counter * targetCounter = NULL;
timeLeft = 0;
if (source->counters && source->counters->hasCounter("time", 0, 0))
{
targetCounter = source->counters->hasCounter("time", 0, 0);
timeLeft = targetCounter->nb;
}
else
{
timeLeft = 0;
WEvent * e = NEW WEventCardSacrifice(source);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(e);
source->controller()->game->putInGraveyard(source);
}
}
else if (newPhase == Constants::MTG_PHASE_UPKEEP && timeLeft <= 0)
{
WEvent * e = NEW WEventCardSacrifice(source);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(e);
source->controller()->game->putInGraveyard(source);
}
}
ActivatedAbility::Update(dt);
}
int AVanishing::resolve()
{
return 1;
}
const char * AVanishing::getMenuText()
{
return "Vanishing";
}
AVanishing * AVanishing::clone() const
{
AVanishing * a = NEW AVanishing(*this);
a->isClone = 1;
return a;
}
AVanishing::~AVanishing()
{
}
//AUpkeep
AUpkeep::AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap, int restrictions, int _phase,
int _once,bool Cumulative) :

View File

@@ -1750,6 +1750,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, sname, stypes, power + value, toughness + value, sabilities, 0,starfound,
multiplier, who,aLivingWeapon);
tok->oneShot = 1;
if(aLivingWeapon)
tok->forceDestroy = 1;
return tok;
}
@@ -2422,7 +2424,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = NEW ABloodThirst(id, card, target, amount);
return a;
}
//Vanishing
found = s.find("vanishing:");
if (found != string::npos)
{
size_t start = s.find(":", found);
size_t end = s.find(" ", start);
int amount;
if (end != string::npos)
{
amount = atoi(s.substr(start + 1, end - start - 1).c_str());
}
else
{
amount = atoi(s.substr(start + 1).c_str());
}
MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount);
return a;
}
if (s.find("altercost(") != string::npos)
return getManaReduxAbility(s.substr(s.find("altercost(") + 10), id, spell, card, target);

View File

@@ -173,9 +173,9 @@ Targetable * WEventVampire::getTarget(int target)
switch (target)
{
case TARGET_TO:
return victem->next;
return source->next;
case TARGET_FROM:
return source;
return victem;
}
return NULL;
}