Laurent - Added damage to the foreach parser (finally did it).

I tryed everything for weeks, adding lines of codes with no success...Finally the answer was so simple as 2 lines of code...
Also added/removed from code Spitting earth and corrupt... Need to chase and remove all the lookalike/alias in the rest of the code. And also as usual will require further testing...

Grü.

L.
This commit is contained in:
wagic.laurent
2009-06-27 09:49:31 +00:00
parent d5a253d147
commit dcdd0a18d8
4 changed files with 890 additions and 893 deletions
+1
View File
@@ -2538,6 +2538,7 @@ toughness=1
text=Spitting Earth deals damage equal to the number of Mountains you control to target creature. text=Spitting Earth deals damage equal to the number of Mountains you control to target creature.
id=136509 id=136509
target=creature target=creature
auto=foreach(mountain|myinplay)damage:1
name=Spitting Earth name=Spitting Earth
rarity=C rarity=C
color=Red color=Red
+3
View File
@@ -189,6 +189,9 @@ toughness=3
text=Corrupt deals damage equal to the number of Swamps you control to target creature or player. You gain life equal to the damage dealt this way. text=Corrupt deals damage equal to the number of Swamps you control to target creature or player. You gain life equal to the damage dealt this way.
target=creature,player target=creature,player
id=146013 id=146013
target=creature,player
auto=foreach(swamp|myinplay):damage:1
auto=foreach(swamp|myinplay):life:1
name=Corrupt name=Corrupt
rarity=U rarity=U
type=Sorcery type=Sorcery
+10 -17
View File
@@ -67,8 +67,6 @@ int AbilityFactory::damageAll(TargetChooser * tc, int damage){
return 1; return 1;
} }
int AbilityFactory::moveAll(TargetChooser * tc, string destinationZone){ int AbilityFactory::moveAll(TargetChooser * tc, string destinationZone){
MTGCardInstance * source = tc->source; MTGCardInstance * source = tc->source;
tc->source = NULL; // This is to prevent protection from... as objects that destroy all do not actually target tc->source = NULL; // This is to prevent protection from... as objects that destroy all do not actually target
@@ -618,6 +616,10 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
dryModeResult = BAKA_EFFECT_BAD; dryModeResult = BAKA_EFFECT_BAD;
break; break;
} }
if (lordType == PARSER_FOREACH){
int multiplier = countCards(lordTargets);
game->mLayers->stackLayer()->addDamage(card,spell->getNextDamageableTarget(),(damage*multiplier));
}else{
if (tc){ if (tc){
if (all){ if (all){
if (cost){ if (cost){
@@ -642,6 +644,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
multi->Add(NEW DamageEvent(card,target,damage)); multi->Add(NEW DamageEvent(card,target,damage));
}else{ }else{
game->mLayers->stackLayer()->addDamage(card,spell->getNextDamageableTarget(), damage); game->mLayers->stackLayer()->addDamage(card,spell->getNextDamageableTarget(), damage);
}
} }
} }
result++; result++;
@@ -663,6 +666,10 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
dryModeResult = BAKA_EFFECT_GOOD; dryModeResult = BAKA_EFFECT_GOOD;
break; break;
} }
if (lordType == PARSER_FOREACH){
int multiplier = countCards(lordTargets);
card->controller()->life+=multiplier;
}else{
if (tc){ if (tc){
//TODO ? //TODO ?
}else{ }else{
@@ -672,6 +679,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
game->addObserver(NEW ALifeGiver(id, card,cost, life, doTap)); game->addObserver(NEW ALifeGiver(id, card,cost, life, doTap));
} }
} }
}
result++; result++;
continue; continue;
} }
@@ -1976,13 +1984,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver( NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_WHITE, NEW ManaCost() , 1)); game->addObserver( NEW ASpellCastLife(_id, card, Constants::MTG_COLOR_WHITE, NEW ManaCost() , 1));
break; break;
} }
case 136509: //Spitting Earth
{
Damageable * target = spell->getNextDamageableTarget();
int damage = card->controller()->game->inPlay->countByType("mountain");
game->mLayers->stackLayer()->addDamage(card, target, damage);
break;
}
case 129909: //Cryoclasm case 129909: //Cryoclasm
{ {
card->target->controller()->game->putInGraveyard(card->target); card->target->controller()->game->putInGraveyard(card->target);
@@ -2114,14 +2115,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
//--- addon shm--- //--- addon shm---
case 146013: //Corrupt
{
Damageable * target = spell->getNextDamageableTarget();
int damage_life = card->controller()->game->inPlay->countByType("swamp");
game->mLayers->stackLayer()->addDamage(card, target, damage_life);
game->currentlyActing()->life+=damage_life;
break;
}
case 153996: // Howl of the Night Pack case 153996: // Howl of the Night Pack
{ {