- "foreach" auto keyword improved, now works like lord
- a few cards using "foreach" added
This commit is contained in:
wagic.the.homebrew
2009-03-03 14:02:40 +00:00
parent 58700417da
commit bb23db4b16
17 changed files with 274 additions and 327 deletions

View File

@@ -176,6 +176,18 @@ subtype=Bird
toughness=1
[/card]
[card]
text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature gets +1/+1 for each Forest you control.
id=135267
target=creature
auto=foreach(forest|myinplay) 1/1
name=Blanchwood Armor
rarity=U
color=Green
type=Enchantment
mana={2}{G}
subtype=Aura
[/card]
[card]
text=Blaze deals X damage to target creature or player.
target=creature,player
alias=1291
@@ -1177,6 +1189,34 @@ subtype=Goblin
toughness=1
[/card]
[card]
text=Trample (If this creature would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.) Molimo, Maro-Sorcerer's power and toughness are equal to the number of lands you control.
abilities=trample, legendary
auto=foreach(land|myinplay) 1/1 includeself
id=106368
name=Molimo, Maro-Sorcerer
rarity=R
color=Green
type=Creature
mana={4}{G}{G}{G}
power=*
subtype=Elemental
toughness=*
[/card]
[card]
text=Mortivore's power and toughness are each equal to the number of creature cards in all graveyards. {B}: Regenerate Mortivore. (The next time this creature would be destroyed this turn, it isn't. Instead tap it, remove all damage from it, and remove it from combat.)
auto={B}:regenerate
auto=foreach(creature|graveyard) 1/1
id=129648
name=Mortivore
rarity=R
color=Black
type=Creature
mana={2}{B}{B}
power=*
subtype=Lhurgoyf
toughness=*
[/card]
[card]
text={T}: Add {R} to your mana pool.
auto={T}: Add {R}
id=129652
@@ -1516,7 +1556,7 @@ subtype=Aura
[card]
text=Relentless Rats gets +1/+1 for each other creature in play named Relentless Rats. A deck can have any number of cards named Relentless Rats.
id=135236
auto=foreach(name:Relentless Rats)
auto=foreach(relentless rats) 1/1
name=Relentless Rats
rarity=U
color=Black
@@ -1648,6 +1688,19 @@ subtype=Zombie
toughness=2
[/card]
[card]
text=Scion of the Wild's power and toughness are each equal to the number of creatures you control.
id=130504
auto=foreach(creature|myinplay) 1/1 includeself
name=Scion of the Wild
rarity=R
color=Green
type=Creature
mana={1}{G}{G}
power=*
subtype=Avatar
toughness=*
[/card]
[card]
text=Flying, vigilance (This creature can't be blocked except by creatures with flying or reach, and attacking doesn't cause this creature to tap.)
abilities=flying,vigilance
id=129726
@@ -2221,6 +2274,19 @@ color=Land
type=Land
[/card]
[card]
text=Yavimaya Enchantress gets +1/+1 for each enchantment in play.
auto=foreach(enchantment) 1/1 includeself
id=130515
name=Yavimaya Enchantress
rarity=U
color=Green
type=Creature
mana={2}{G}
power=2
subtype=Human Druid
toughness=2
[/card]
[card]
text=First strike (This creature deals combat damage before creatures without first strike.)
abilities=first strike
id=129790

View File

@@ -199,16 +199,6 @@ type=Sorcery
mana={3}{B}{B}
[/card]
[card]
text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature gets +1/+1 for each Forest you control.
id=135267
name=Blanchwood Armor
rarity=U
color=Green
type=Enchantment
mana={2}{G}
subtype=Aura
[/card]
[card]
text={R}, Sacrifice Bloodfire Colossus: Bloodfire Colossus deals 6 damage to each creature and each player.
id=129709
name=Bloodfire Colossus
@@ -1050,18 +1040,7 @@ color=Black
type=Sorcery
mana={2}{B}
[/card]
[card]
text=Trample (If this creature would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.) Molimo, Maro-Sorcerer's power and toughness are each equal to the number of lands you control.
id=106368
name=Molimo, Maro-Sorcerer
rarity=R
color=Green
type=Legendary Creature
mana={4}{G}{G}{G}
power=*
subtype=Elemental
toughness=*
[/card]
[card]
text=At the beginning of your upkeep, if twenty or more creature cards are in your graveyard, you win the game.
id=135259
@@ -1072,18 +1051,6 @@ type=Enchantment
mana={2}{B}{B}
[/card]
[card]
text=Mortivore's power and toughness are each equal to the number of creature cards in all graveyards. {B}: Regenerate Mortivore. (The next time this creature would be destroyed this turn, it isn't. Instead tap it, remove all damage from it, and remove it from combat.)
id=129648
name=Mortivore
rarity=R
color=Black
type=Creature
mana={2}{B}{B}
power=*
subtype=Lhurgoyf
toughness=*
[/card]
[card]
text=Target player gains 8 life.
id=129655
name=Natural Spring
@@ -1407,18 +1374,7 @@ power=1
subtype=Beast
toughness=5
[/card]
[card]
text=Scion of the Wild's power and toughness are each equal to the number of creatures you control.
id=130504
name=Scion of the Wild
rarity=R
color=Green
type=Creature
mana={1}{G}{G}
power=*
subtype=Avatar
toughness=*
[/card]
[card]
text=At the beginning of your upkeep, flip a coin. If you lose the flip, return Scoria Wurm to its owner's hand.
id=130374
@@ -2030,15 +1986,4 @@ color=Artifact
type=Artifact
mana={2}
[/card]
[card]
text=Yavimaya Enchantress gets +1/+1 for each enchantment in play.
id=130515
name=Yavimaya Enchantress
rarity=U
color=Green
type=Creature
mana={2}{G}
power=2
subtype=Human Druid
toughness=2
[/card]

View File

@@ -470,6 +470,19 @@ type=Artifact
mana={2}{W}
[/card]
[card]
text=Master of Etherium's power and toughness are each equal to the number of artifacts you control. Other artifact creatures you control get +1/+1.
id=175114
auto=lord(creature[artifact]|myinplay) 1/1
auto=foreach(artifact|myinplay) 1/1 includeself
name=Master of Etherium
rarity=R
type=Artifact Creature
mana={2}{U}
power=*
subtype=Vedalken Wizard
toughness=*
[/card]
[card]
text={W}, {T}: Regenerate target artifact.
id=175113
auto={W},{T}:Regenerate target(artifact)

View File

@@ -813,17 +813,7 @@ power=1
subtype=Ooze
toughness=1
[/card]
[card]
text=Master of Etherium's power and toughness are each equal to the number of artifacts you control. Other artifact creatures you control get +1/+1.
id=175114
name=Master of Etherium
rarity=R
type=Artifact Creature
mana={2}{U}
power=*
subtype=Vedalken Wizard
toughness=*
[/card]
[card]
text={3}{R}{G}{W}, {T}: Look at the top five cards of your library. You may put a creature card with power 5 or greater from among them into play. Put the rest on the bottom of your library in any order.
id=175058

View File

@@ -202,6 +202,18 @@ subtype=Human Druid
toughness=1
[/card]
[card]
text=As Nyxathid comes into play, choose an opponent. Nyxathid gets -1/-1 for each card in the chosen player's hand.
auto=foreach(*|opponenthand) -1/-1
id=186616
name=Nyxathid
rarity=R
type=Creature
mana={1}{B}{B}
power=7
subtype=Elemental
toughness=7
[/card]
[card]
text={1}{W}, {T}: You gain 5 life. {1}{U}, {T}: Draw a card, then discard a card. {1}{B}, {T}: Target creature gets -2/-2 until end of turn. {1}{R}, {T}: Obelisk of Alara deals 3 damage to target player. {1}{G}, {T}: Target creature gets +4/+4 until end of turn.
auto={1}{W}{T}:life 5
auto={1}{U}{T}:Draw:1
@@ -253,6 +265,18 @@ subtype=Elf Archer
toughness=3
[/card]
[card]
text=Salvage Slasher gets +1/+0 for each artifact card in your graveyard.
auto=foreach(artifact|mygraveyard) 1/0
id=179254
name=Salvage Slasher
rarity=C
type=Artifact Creature
mana={1}{B}
power=1
subtype=Human Rogue
toughness=1
[/card]
[card]
text={W}, {T}: Tap target permanent.
auto={W}{T}:tap target(*)
id=174792

View File

@@ -697,17 +697,7 @@ subtype=Bolas
toughness=5
[/card]
[card]
text=As Nyxathid comes into play, choose an opponent. Nyxathid gets -1/-1 for each card in the chosen player's hand.
id=186616
name=Nyxathid
rarity=R
type=Creature
mana={1}{B}{B}
power=7
subtype=Elemental
toughness=7
[/card]
[card]
text=Whenever another creature with power 5 or greater comes into play under your control, you may return target creature card from your graveyard to your hand.
@@ -819,17 +809,7 @@ rarity=C
type=Land
[/card]
[card]
text=Salvage Slasher gets +1/+0 for each artifact card in your graveyard.
id=179254
name=Salvage Slasher
rarity=C
type=Artifact Creature
mana={1}{B}
power=1
subtype=Human Rogue
toughness=1
[/card]
[card]
text=Sacrifice a creature: Put a +1/+1 counter on Scarland Thrinax.
id=183025

View File

@@ -955,6 +955,7 @@ toughness=2
[/card]
[card]
text=Overbeing of Myth's power and toughness are each equal to the number of cards in your hand. At the beginning of your draw step, draw a card.
auto=foreach(*|myhand) 1/1
id=151151
name=Overbeing of Myth
rarity=R

View File

@@ -1408,6 +1408,7 @@ mana={2}
[card]
text=Lost Order of Jarkeld has power and toughness each equal to 1 plus the number of creatures target opponent controls.
id=2703
auto=foreach(creature|opponentinplay) 1/1
name=Lost Order of Jarkeld
rarity=R
type=Creature

View File

@@ -1158,6 +1158,7 @@ mana={2}{W}{W}
[card]
text=Keldon Warlord's power and toughness are each equal to the number of non-Wall creatures you control.
id=1301
auto=foreach(creature[-wall]|myinplay) 1/1 includeself
name=Keldon Warlord
rarity=U
type=Creature
@@ -1441,6 +1442,7 @@ mana={4}
[card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) Nightmare's power and toughness are each equal to the number of Swamps you control.
abilities=flying
auto=foreach(swamp|myinplay) 1/1 includeself
id=1170
name=Nightmare
rarity=R
@@ -1487,7 +1489,7 @@ toughness=3
text=Attacking creatures you control get +1/+0.
id=1310
name=Orcish Oriflamme
auto=lord(creature[attacking]|myinplay)1/0
auto=lord(creature[attacking]|myinplay) 1/0
rarity=U
type=Enchantment
mana={3}{R}
@@ -1599,14 +1601,14 @@ subtype=Plains Mountain
text=Plague Rats's power and toughness are each equal to the number of creatures named Plague Rats in play.
id=1173
name=Plague Rats
auto=foreach(name:Plague Rats)
auto=foreach(plague rats) 1/1 includeself
rarity=C
color=Black
type=Creature
mana={2}{B}
power=1
power=0
subtype=Rat
toughness=1
toughness=0
[/card]
[card]
text=Enchant enchantment At the beginning of the upkeep of enchanted enchantment's controller, that player may pay up to {2}. For each one mana less than {2} he or she pays this way, Power Leak deals 1 damage to him or her.

View File

@@ -1,4 +1,16 @@
[card]
text=Enchant creature Enchanted creature gets +1/+1 for each Plains you control and has flying.
target=creature
auto=foreach(plains|myinplay) 1/1 includeself
auto=flying
id=146041
name=Armored Ascension
rarity=U
type=Enchantment
mana={3}{W}
subtype=Aura
[/card]
[card]
text=Flying {BR}: Blistering Dieflyn gets +1/+0 until end of turn.
abilities=flying
auto={BR}:1/0
@@ -88,6 +100,19 @@ subtype=Elemental Rogue
toughness=3
[/card]
[card]
text=Fear Crowd of Cinders's power and toughness are each equal to the number of black permanents you control.
abilities=fear
auto=foreach(*[black]|myinplay) 1/1 includeself
id=146051
name=Crowd of Cinders
rarity=U
type=Creature
mana={3}{B}
power=*
subtype=Elemental
toughness=*
[/card]
[card]
text=Blue creatures you control are unblockable.
auto=lord(creature[blue]|myinplay) unblockable includeself
id=141981
@@ -112,6 +137,19 @@ subtype=Elf Shaman
toughness=1
[/card]
[card]
text=Flying Faerie Swarm's power and toughness are each equal to the number of blue permanents you control.
auto=foreach(*[blue]|myinplay) 1/1 includeself
abilities=flying
id=158685
name=Faerie Swarm
rarity=U
type=Creature
mana={3}{U}
power=*
subtype=Faerie
toughness=*
[/card]
[card]
text={T}: Add {1} to your mana pool. {RG}, {T}: Add {R}{R}, {R}{G}, or {G}{G} to your mana pool.
auto={T}:Add{1}
auto={RG}{T}:Add{R}{R}
@@ -291,6 +329,19 @@ subtype=Ouphe
toughness=2
[/card]
[card]
text=Vigilance Kithkin Rabble's power and toughness are each equal to the number of white permanents you control.
auto=foreach(*[white]|myinplay) 1/1 includeself
abilities=vigilance
id=158695
name=Kithkin Rabble
rarity=U
type=Creature
mana={3}{W}
power=*
subtype=Kithkin
toughness=*
[/card]
[card]
text={W}, {T}: Target blocking creature gets +2/+2 until end of turn.
auto={W}{T}:2/2 target(creature[blocking])
id=158238

View File

@@ -33,15 +33,7 @@ power=1
subtype=Kithkin Cleric
toughness=1
[/card]
[card]
text=Enchant creature Enchanted creature gets +1/+1 for each Plains you control and has flying.
id=146041
name=Armored Ascension
rarity=U
type=Enchantment
mana={3}{W}
subtype=Aura
[/card]
[card]
text=Ashenmoor Cohort gets +1/+1 as long as you control another black creature.
id=142060
@@ -312,17 +304,7 @@ rarity=C
type=Instant
mana={R}
[/card]
[card]
text=Fear Crowd of Cinders's power and toughness are each equal to the number of black permanents you control.
id=146051
name=Crowd of Cinders
rarity=U
type=Creature
mana={3}{B}
power=*
subtype=Elemental
toughness=*
[/card]
[card]
text=When Cultbrand Cinder comes into play, put a -1/-1 counter on target creature.
id=142068
@@ -543,17 +525,7 @@ power=2
subtype=Faerie Rogue
toughness=2
[/card]
[card]
text=Flying Faerie Swarm's power and toughness are each equal to the number of blue permanents you control.
id=158685
name=Faerie Swarm
rarity=U
type=Creature
mana={3}{U}
power=*
subtype=Faerie
toughness=*
[/card]
[card]
text=When Farhaven Elf comes into play, you may search your library for a basic land card and put it into play tapped. If you do, shuffle your library.
id=153289
@@ -976,17 +948,7 @@ power=2
subtype=Kithkin Soldier
toughness=2
[/card]
[card]
text=Vigilance Kithkin Rabble's power and toughness are each equal to the number of white permanents you control.
id=158695
name=Kithkin Rabble
rarity=U
type=Creature
mana={3}{W}
power=*
subtype=Kithkin
toughness=*
[/card]
[card]
text=Flying {1}{U}, {T}: Target opponent removes the top card of his or her library from the game. Until end of turn, you may play that card. ({T} is the untap symbol.)
id=146036

View File

@@ -724,6 +724,18 @@ power=1
toughness=1
[/card]
[card]
text=Mogg Squad gets -1/-1 for each other creature in play.
auto=foreach(creature) -1/-1
id=4834
name=Mogg Squad
rarity=U
type=Creature
mana={1}{R}
power=3
subtype=Goblin
toughness=3
[/card]
[card]
text={T}: Add {R} to your mana pool.
auto={T}: Add {R}
id=4945

View File

@@ -1733,17 +1733,7 @@ power=1
subtype=Goblin
toughness=1
[/card]
[card]
text=Mogg Squad gets -1/-1 for each other creature in play.
id=4834
name=Mogg Squad
rarity=U
type=Creature
mana={1}{R}
power=3
subtype=Goblin
toughness=3
[/card]
[card]
text=When Mongrel Pack is put into a graveyard from play during combat, put four 1/1 green Hound creature tokens into play.
id=4771

View File

@@ -777,7 +777,7 @@ class AExalted:public ListMaintainerAbility{
int canBeInList(MTGCardInstance * card){
if (card->isAttacker() && game->currentPlayer == source->controller()) return 1;
if (card->isAttacker() && game->currentPlayer == source->controller() && game->isInPlay(card)) return 1;
return 0;
}
@@ -819,7 +819,7 @@ class AExaltedAbility:public ListMaintainerAbility{
int canBeInList(MTGCardInstance * card){
if (card->isAttacker() && game->currentPlayer == source->controller()) return 1;
if (card->isAttacker() && game->currentPlayer == source->controller() && game->isInPlay(card)) return 1;
return 0;
}
@@ -856,7 +856,7 @@ class AConvertLandToCreatures:public ListMaintainerAbility{
int canBeInList(MTGCardInstance * card){
if (card->hasType(type)) return 1;
if (card->hasType(type) && game->isInPlay(card)) return 1;
return 0;
}
@@ -917,8 +917,8 @@ class ALord:public ListMaintainerAbility{
if (ability != -1 && card->basicAbilities[ability]) card->basicAbilities[ability] -=1;
if (regenCost){
if(regenerations.find(card) != regenerations.end()){
if (game->isInPlay(card)) game->removeObserver(regenerations[card]);
regenerations.erase(card);
if (game->isInPlay(card)) game->removeObserver(regenerations[card]);
regenerations.erase(card);
}
}
return 1;
@@ -927,6 +927,42 @@ class ALord:public ListMaintainerAbility{
};
//Foreach (plague rats...)
class AForeach:public ListMaintainerAbility{
public:
TargetChooser * tc;
int power, toughness;
int includeSelf;
AForeach(int _id, MTGCardInstance * card,MTGCardInstance * _target, TargetChooser * _tc, int _includeSelf, int _power = 0 , int _toughness = 0):ListMaintainerAbility(_id,card,_target){
tc = _tc;
tc->source = NULL;
includeSelf = _includeSelf;
power = _power;
toughness = _toughness;
if (!target) target = source; //Is this needed ?
}
int canBeInList(MTGCardInstance * card){
if ( (includeSelf || card!=source) && tc->canTarget(card)) return 1;
return 0;
}
int added(MTGCardInstance * card){
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->power += power;
_target->addToToughness(toughness);
return 1;
}
int removed(MTGCardInstance * card){
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->power -= power;
_target->addToToughness(-toughness);
return 1;
}
};
/* Standard Damager, can choose a NEW target each time the price is paid */
class ADamager:public TargetAbility{
@@ -1235,7 +1271,7 @@ class AAnkhOfMishra: public ListMaintainerAbility{
}
int canBeInList(MTGCardInstance * card){
if (card->hasType("land")) return 1;
if (card->hasType("land") && game->isInPlay(card)) return 1;
return 0;
}
@@ -1481,7 +1517,7 @@ class ADingusEgg: public ListMaintainerAbility{
}
int canBeInList(MTGCardInstance * card){
if (card->hasType("land")) return 1;
if (card->hasType("land") && game->isInPlay(card)) return 1;
return 0;
}
@@ -1974,30 +2010,6 @@ class AMillstone:public TargetAbility{
};
//1170: Nightmare
class ANightmare:public ListMaintainerAbility{
public:
ANightmare(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
}
int canBeInList(MTGCardInstance * card){
if (source->controller()->game->inPlay->hasCard(card) && card->hasType("swamp") ) return 1;
return 0;
}
int added(MTGCardInstance * card){
source->power += 1;
source->addToToughness(1);
return 1;
}
int removed(MTGCardInstance * card){
source->power -= 1;
source->addToToughness(-1);
return 1;
}
};
@@ -2029,36 +2041,6 @@ class APestilence: public ActivatedAbility{
};
//Plague Rats and similar. Power and toughness equal to number of cards that share a name
class APlagueRats:public ListMaintainerAbility{
public:
string name;
APlagueRats(int _id, MTGCardInstance * _source, const char * _name):ListMaintainerAbility(_id,_source){
name = _name;
std::transform(name.begin(), name.end(), name.begin(),::tolower );
}
int canBeInList(MTGCardInstance * card){
if (card == source) return 0;
string compared = card->name;
std::transform( compared.begin(), compared.end(), compared.begin(),::tolower );
if (name.compare(compared) == 0) return 1;
return 0;
}
int added(MTGCardInstance * card){
source->power += 1;
source->addToToughness(1);
return 1;
}
int removed(MTGCardInstance * card){
source->power -= 1;
source->addToToughness(-1);
return 1;
}
};
//Power Leak
class APowerLeak:public TriggeredAbility{
@@ -2249,7 +2231,7 @@ class AAspectOfWolf:public ListMaintainerAbility{
int canBeInList(MTGCardInstance * card){
if (card->controller() == source->controller() && card->hasType("forest")) return 1;
if (card->controller() == source->controller() && card->hasType("forest") && game->isInPlay(card)) return 1;
return 0;
}
@@ -2365,30 +2347,6 @@ class AForceOfNature:public ActivatedAbility{
}
};
//1301 KeldonWarlord
class AKeldonWarlord:public ListMaintainerAbility{
public:
AKeldonWarlord(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
}
int canBeInList(MTGCardInstance * card){
if (source->controller()->game->inPlay->hasCard(card) && card->isACreature() && !card->hasType("wall") ) return 1;
return 0;
}
int added(MTGCardInstance * card){
source->power += 1;
source->addToToughness(1);
return 1;
}
int removed(MTGCardInstance * card){
source->power -= 1;
source->addToToughness(-1);
return 1;
}
};
@@ -2704,58 +2662,9 @@ class AMinionofLeshrac: public TargetAbility{
};
//2703 Lost Order of Jarkeld
class ALostOrderofJarkeld:public ListMaintainerAbility{
public:
ALostOrderofJarkeld(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){
}
int canBeInList(MTGCardInstance * card){
if (source->controller()->opponent()->game->inPlay->hasCard(card) && card->isACreature() ) return 1;
return 0;
}
int added(MTGCardInstance * card){
source->power += 1;
source->addToToughness(1);
return 1;
}
int removed(MTGCardInstance * card){
source->power -= 1;
source->addToToughness(-1);
return 1;
}
};
//CreaturePowerToughnessModifierForAllTypeControlled
class ACreaturePowerToughnessModifierForAllTypeControlled:public ListMaintainerAbility{
public:
char type[20];
ACreaturePowerToughnessModifierForAllTypeControlled(int _id, MTGCardInstance * _source, const char * _type):ListMaintainerAbility(_id, _source){
}
int canBeInList(MTGCardInstance * card){
if (source->controller()->game->inPlay->hasCard(card) && card->hasType(type) ) return 1;
return 0;
}
int added(MTGCardInstance * card){
source->power += 1;
source->addToToughness(1);
return 1;
}
int removed(MTGCardInstance * card){
source->power -= 1;
source->addToToughness(-1);
return 1;
}
};
//Generic Kird Ape
class AKirdApe:public ListMaintainerAbility{

View File

@@ -31,6 +31,9 @@ using std::map;
#define COUNT_POWER 1
#define PARSER_LORD 1
#define PARSER_FOREACH 2
class MTGAbility: public ActionElement{
protected:
char menuText[25];

View File

@@ -149,7 +149,7 @@ class MTGLegendRule:public ListMaintainerAbility{
MTGLegendRule(int _id):ListMaintainerAbility(_id){};
int canBeInList(MTGCardInstance * card){
if (card->basicAbilities[Constants::LEGENDARY]){
if (card->basicAbilities[Constants::LEGENDARY] && game->isInPlay(card)){
return 1;
}
return 0;

View File

@@ -67,8 +67,8 @@ Damageable * AbilityFactory::parseCollateralTarget(MTGCardInstance * card, strin
int AbilityFactory::parsePowerToughness(string s, int *power, int *toughness){
size_t found = s.find("/");
if (found != string::npos){
size_t start = s.find(":");
if (start == string::npos) start = s.find(" ");
size_t start = s.find(":", found - 4);
if (start == string::npos) start = s.find(" ", found - 4);
if (start == string::npos) start = -1;
*power = atoi(s.substr(start+1,s.size()-found).c_str());
size_t end = s.find(" ",start);
@@ -180,6 +180,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
TargetChooser * lordTargets = NULL;
int lordIncludeSelf = 0;
int lordType = 0;
string lordTargetsString;
Trigger * trigger = parseTrigger(s);
//Dirty way to remove the trigger text (could get in the way)
@@ -205,25 +207,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
if (dryMode) return BAKA_EFFECT_GOOD;
unsigned int end = s.find(")", found+5);
if (end != string::npos){
string lordType = s.substr(found+5,end-found-5).c_str();
TargetChooserFactory tcf;
lordTargets = tcf.createTargetChooser(lordType, card);
lordTargetsString = s.substr(found+5,end-found-5).c_str();
lordType = PARSER_LORD;
}
if (s.find("includeself") != string::npos) lordIncludeSelf = 1;
}
//foreach. Very basic, needs to be improved !
found = s.find("foreach(name:");
found = s.find("foreach(");
if (found != string::npos){
if (dryMode) return BAKA_EFFECT_GOOD;
unsigned int end = s.find(")", found+13);
unsigned int end = s.find(")", found+8);
if (end != string::npos){
string type = s.substr(found+13,end-found-13).c_str();
game->addObserver(NEW APlagueRats(id,card,type.c_str()));
result++;
continue;
lordTargetsString = s.substr(found+8,end-found-8).c_str();
lordType = PARSER_FOREACH;
}
}
if (lordTargetsString.size()){
TargetChooserFactory tcf;
lordTargets = tcf.createTargetChooser(lordTargetsString, card);
if (s.find("includeself") != string::npos) lordIncludeSelf = 1;
}
//Untapper (Ley Druid...)
found = s.find("untap");
@@ -485,21 +487,28 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
}
if (lordTargets){
if (lordType == PARSER_LORD){
game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,power,toughness));
}else{
if(tc){
game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card,power,toughness, cost, tc,doTap));
game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card,power,toughness, cost, tc,doTap));
}else{
if (!cost){
if(card->hasType("enchantment")){
game->addObserver(NEW APowerToughnessModifier(id, card, target,power,toughness));
if (lordType == PARSER_FOREACH){
char buf[4096];
sprintf(buf, "KELDON : %i/%i , includeself = %i\n", power,toughness,lordIncludeSelf);
OutputDebugString(buf);
game->addObserver(NEW AForeach(id,card,target,lordTargets,lordIncludeSelf,power,toughness));
}else{
if (!cost){
if(card->hasType("enchantment")){
game->addObserver(NEW APowerToughnessModifier(id, card, target,power,toughness));
}else{
game->addObserver(NEW AInstantPowerToughnessModifierUntilEOT(id, card, target,power,toughness));
}
}else{
game->addObserver(NEW AInstantPowerToughnessModifierUntilEOT(id, card, target,power,toughness));
game->addObserver(NEW APowerToughnessModifierUntilEndOfTurn(id, card, target,power,toughness, cost, limit));
}
}else{
game->addObserver(NEW APowerToughnessModifierUntilEndOfTurn(id, card, target,power,toughness, cost, limit));
}
}
}
}
result++;
@@ -1026,11 +1035,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
}
break;
}
case 1170: //Nightmare
{
game->addObserver(NEW ANightmare(_id, card));
break;
}
case 1171: //Paralysis
{
int cost[] = {Constants::MTG_COLOR_ARTIFACT, 4};
@@ -1242,11 +1246,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
break;
}
case 1301: // Keldon Warlord
{
game->addObserver(NEW AKeldonWarlord(_id, card));
break;
}
case 1302: //Kird Ape
{
TargetChooser * tc = NEW TypeTargetChooser("forest",card);
@@ -1477,11 +1476,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card, 1,2, NEW ManaCost(cost,1),tc));
break;
}
case 2703: // Lost Order of Jarkeld
{
game->addObserver(NEW ALostOrderofJarkeld(_id, card));
break;
}
default:
break;
}
@@ -1780,8 +1774,10 @@ void ListMaintainerAbility::Update(float dt){
int doDelete = 1;
for (int i = 0; i < 2; i++){
Player * p = game->players[i];
MTGGameZone * zones[] = {p->game->inPlay};
for (int k = 0; k < 1; k++){
MTGGameZone * zones[] = {p->game->inPlay,p->game->graveyard,p->game->hand};
for (int k = 0; k < 3; k++){
//MTGGameZone * zones[] = {p->game->inPlay};
//for (int k = 0; k < 1; k++){
MTGGameZone * zone = zones[k];
if (zone->hasCard(card)){
doDelete = 0;
@@ -1796,8 +1792,10 @@ void ListMaintainerAbility::Update(float dt){
}
for (int i = 0; i < 2; i++){
Player * p = game->players[i];
MTGGameZone * zones[] = {p->game->inPlay};
for (int k = 0; k < 1; k++){
MTGGameZone * zones[] = {p->game->inPlay,p->game->graveyard,p->game->hand};
for (int k = 0; k < 3; k++){
// MTGGameZone * zones[] = {p->game->inPlay};
// for (int k = 0; k < 1; k++){
MTGGameZone * zone = zones[k];
for (int j = 0; j < zone->nb_cards; j++){
if (canBeInList(zone->cards[j])){