diff --git a/projects/mtg/bin/Res/sets/10E/_cards.dat b/projects/mtg/bin/Res/sets/10E/_cards.dat index 046622581..d332329ef 100644 --- a/projects/mtg/bin/Res/sets/10E/_cards.dat +++ b/projects/mtg/bin/Res/sets/10E/_cards.dat @@ -102,6 +102,8 @@ toughness=3 [card] text=Flying (This creature can't be blocked except by creatures with flying or reach.) Other black creatures get +1/+1. Nonblack creatures get -1/-1. abilities=Legendary, flying +auto=lord(creature[black]) 1/1 +auto=lord(creature[-black]) -1/-1 includeself id=106525 name=Ascendant Evincar rarity=R @@ -151,6 +153,17 @@ subtype=Bird toughness=1 [/card] [card] +text=Blaze deals X damage to target creature or player. +target=creature,player +alias=1291 +id=129484 +name=Blaze +rarity=U +color=Red +type=Sorcery +mana={X}{R} +[/card] +[card] text=Swampwalk (This creature is unblockable as long as defending player controls a Swamp.) abilities=swampwalk id=129491 @@ -329,7 +342,8 @@ toughness=5 [card] text=Other Elf creatures get +1/+1 and have forestwalk. (They're unblockable as long as defending player controls a Forest.) id=129534 -auto=lord(elf) 1/1 forestwalk +auto=lord(elf) 1/1 +auto=lord(elf) forestwalk name=Elvish Champion rarity=R color=Green @@ -391,7 +405,8 @@ toughness=2 [card] text=Other Soldier creatures get +1/+1 and have first strike. (They deal combat damage before creatures without first strike.) id=135258 -auto=lord(soldier) 1/1 first strike +auto=lord(soldier) 1/1 +auto=lord(soldier) first strike name=Field Marshal rarity=R color=White @@ -541,9 +556,20 @@ subtype=Spider toughness=4 [/card] [card] +text=Creatures you control get +1/+1. +auto=lord(creature|myinplay) 1/1 includeself +id=129572 +name=Glorious Anthem +rarity=R +color=White +type=Enchantment +mana={1}{W}{W} +[/card] +[card] text=Other Goblin creatures get +1/+1 and have mountainwalk. (They're unblockable as long as defending player controls a Mountain.) id=129578 -alias=1296 +auto=lord(goblin) 1/1 +auto=lord(goblin) mountainwalk name=Goblin King rarity=R color=Red @@ -848,6 +874,20 @@ subtype=Demon toughness=7 [/card] [card] +text=Other Zombie creatures get +1/+1. {1}{B}, {T}: Return target Zombie card from your graveyard to your hand. +auto=lord(zombie) 1/1 +auto={1}{B}{T}:moveTo(myhand) target(zombie|mygraveyard) +id=129629 +name=Lord of the Undead +rarity=R +color=Black +type=Creature +mana={1}{B}{B} +power=2 +subtype=Zombie +toughness=2 +[/card] +[card] text={W}, {T}: Tap target creature. auto={W},{T}:tap target(creature) id=129638 @@ -1075,6 +1115,19 @@ mana={3}{U}{U} subtype=Aura [/card] [card] +text=Phantom Warrior is unblockable. +abilities=unblockable +id=132064 +name=Phantom Warrior +rarity=U +color=Blue +type=Creature +mana={1}{U}{U} +power=2 +subtype=Illusion Warrior +toughness=2 +[/card] +[card] text=When Phyrexian Rager comes into play, you draw a card and you lose 1 life. auto=draw:1 auto=life:-1 @@ -1165,6 +1218,16 @@ type=Basic Land subtype=Plains [/card] [card] +text=Creatures you control have trample. (If a creature you control would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.) +auto=lord(creature|myinplay) trample includeself +id=136288 +name=Primal Rage +rarity=U +color=Green +type=Enchantment +mana={1}{G} +[/card] +[card] text={T}: Prodigal Pyromancer deals 1 damage to target creature or player. id=134752 alias=1217 @@ -1226,6 +1289,18 @@ type=Sorcery mana={2}{G} [/card] [card] +text=Return target creature card from your graveyard to your hand. Draw a card. +target=creature|mygraveyard +auto=moveTo(myhand) +auto=Draw:1 +id=135188 +name=Recover +rarity=C +color=Black +type=Sorcery +mana={2}{B} +[/card] +[card] text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) {G}: Regenerate enchanted creature. (The next time that creature would be destroyed this turn, it isn't. Instead tap it, remove all damage from it, and remove it from combat.) target=creature auto={G}:regenerate @@ -1775,6 +1850,19 @@ subtype=Bat toughness=1 [/card] [card] +text={U}, {T}: Return target permanent you control to its owner's hand. +auto={U}{T}:moveTo(ownerhand) target(*|myinplay) +id=130834 +name=Vedalken Mastermind +rarity=U +color=Blue +type=Creature +mana={U}{U} +power=1 +subtype=Vedalken Wizard +toughness=2 +[/card] +[card] text=When Venerable Monk comes into play, you gain 2 life. auto=life:2 id=129786 diff --git a/projects/mtg/bin/Res/sets/10E/todo.dat b/projects/mtg/bin/Res/sets/10E/todo.dat index 76cbb70e6..d11b14269 100644 --- a/projects/mtg/bin/Res/sets/10E/todo.dat +++ b/projects/mtg/bin/Res/sets/10E/todo.dat @@ -78,6 +78,8 @@ subtype=Aura [/card] [card] text={T}: Draw three cards. {2}{U}{U}: Return Arcanis the Omnipotent to its owner's hand. +abilities=legendary +auto={T}:Draw:3 id=106426 name=Arcanis the Omnipotent rarity=R @@ -221,15 +223,6 @@ mana={2}{G} subtype=Aura [/card] [card] -text=Blaze deals X damage to target creature or player. -id=129484 -name=Blaze -rarity=U -color=Red -type=Sorcery -mana={X}{R} -[/card] -[card] text={R}, Sacrifice Bloodfire Colossus: Bloodfire Colossus deals 6 damage to each creature and each player. id=129709 name=Bloodfire Colossus @@ -771,15 +764,6 @@ color=Land type=Land [/card] [card] -text=Creatures you control get +1/+1. -id=129572 -name=Glorious Anthem -rarity=R -color=White -type=Enchantment -mana={1}{W}{W} -[/card] -[card] text=Whenever Goblin Elite Infantry blocks or becomes blocked, it gets -1/-1 until end of turn. id=130380 name=Goblin Elite Infantry @@ -1074,18 +1058,6 @@ color=Land type=Land [/card] [card] -text=Other Zombie creatures get +1/+1. {1}{B}, {T}: Return target Zombie card from your graveyard to your hand. -id=129629 -name=Lord of the Undead -rarity=R -color=Black -type=Creature -mana={1}{B}{B} -power=2 -subtype=Zombie -toughness=2 -[/card] -[card] text=Equipped creature gets +3/+0 and has lifelink and trample. (When it deals damage, you gain that much life. If it would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.) Equip {3} ({3}: Attach to target creature you control. Equip only as a sorcery.) id=129630 name=Loxodon Warhammer @@ -1203,6 +1175,7 @@ mana={2} [/card] [card] text=Soldier creatures have vigilance. (Attacking doesn't cause them to tap.) {2}{W}: Put a 1/1 white Soldier creature token into play. +auto=lord(soldier) vigilance includeself id=129716 name=Mobilization rarity=R @@ -1370,18 +1343,6 @@ subtype=Zombie Minion toughness=4 [/card] [card] -text=Phantom Warrior is unblockable. -id=132064 -name=Phantom Warrior -rarity=U -color=Blue -type=Creature -mana={1}{U}{U} -power=2 -subtype=Illusion Warrior -toughness=2 -[/card] -[card] text={2}, {T}, Sacrifice a creature: Draw a card. id=135281 name=Phyrexian Vault @@ -1421,15 +1382,6 @@ subtype=Angel toughness=4 [/card] [card] -text=Creatures you control have trample. (If a creature you control would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.) -id=136288 -name=Primal Rage -rarity=U -color=Green -type=Enchantment -mana={1}{G} -[/card] -[card] text={U}, {T}: You may tap or untap target creature. id=129685 name=Puppeteer @@ -1504,15 +1456,6 @@ subtype=Masticore toughness=5 [/card] [card] -text=Return target creature card from your graveyard to your hand. Draw a card. -id=135188 -name=Recover -rarity=C -color=Black -type=Sorcery -mana={2}{B} -[/card] -[card] text=Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase. id=129697 name=Relentless Assault @@ -1709,6 +1652,8 @@ toughness=4 [/card] [card] text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature has flying. (It can't be blocked except by creatures with flying or reach.) {U}: Return Shimmering Wings to its owner's hand. +target=creature +auto=flying id=129553 name=Shimmering Wings rarity=C @@ -2185,18 +2130,6 @@ type=Enchantment mana={3}{G} [/card] [card] -text={U}, {T}: Return target permanent you control to its owner's hand. -id=130834 -name=Vedalken Mastermind -rarity=U -color=Blue -type=Creature -mana={U}{U} -power=1 -subtype=Vedalken Wizard -toughness=2 -[/card] -[card] text=At the beginning of each upkeep, put a 1/1 green Saproling creature token into play under your control. id=129788 name=Verdant Force diff --git a/projects/mtg/bin/Res/sets/EVE/todo.dat b/projects/mtg/bin/Res/sets/EVE/todo.dat index 7f20b861a..6cbbee153 100644 --- a/projects/mtg/bin/Res/sets/EVE/todo.dat +++ b/projects/mtg/bin/Res/sets/EVE/todo.dat @@ -46,6 +46,8 @@ toughness=4 [card] text=Other red creatures you control get +1/+1. Other white creatures you control get +1/+1. Whenever you play a red spell, Balefire Liege deals 3 damage to target player. Whenever you play a white spell, you gain 3 life. id=158104 +auto=lord(creature[red]) 1/1 +auto=lord(creature[white]) 1/1 name=Balefire Liege rarity=R type=Creature @@ -259,6 +261,8 @@ toughness=3 [card] text=Other black creatures you control get +1/+1. Other green creatures you control get +1/+1. At the beginning of your upkeep, you may put a 1/1 black and green Worm creature token into play. id=157406 +auto=lord(creature[black]) 1/1 +auto=lord(creature[green]) 1/1 name=Creakwood Liege rarity=R type=Creature @@ -278,6 +282,8 @@ mana={1}{B} [card] text=Other white creatures you control get +1/+1. Other black creatures you control get +1/+1. Whenever you play a white spell, you may tap target creature. Whenever you play a black spell, you may destroy target creature if it's tapped. id=157288 +auto=lord(creature[black]) 1/1 +auto=lord(creature[white]) 1/1 name=Deathbringer Liege rarity=R type=Creature @@ -786,6 +792,8 @@ toughness=3 [card] text=Other blue creatures you control get +1/+1. Other red creatures you control get +1/+1. {UR}{UR}{UR}{UR}: You may put a blue or red creature card from your hand into play. id=151132 +auto=lord(creature[blue]) 1/1 +auto=lord(creature[red]) 1/1 name=Mindwrack Liege rarity=R type=Creature @@ -813,6 +821,8 @@ mana={2}{RW} [card] text=Other green creatures you control get +1/+1. Other blue creatures you control get +1/+1. Untap all green and/or blue creatures you control during each other player's untap step. id=152091 +auto=lord(creature[green]) 1/1 +auto=lord(creature[blue]) 1/1 name=Murkfiend Liege rarity=R type=Creature diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index 06fd7a3ff..d9e128af1 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -107,6 +107,7 @@ toughness=2 [/card] [card] text=Black creatures get +1/+1. +auto=lord(creature[black]) 1/1 includeself id=1144 name=Bad Moon rarity=R @@ -423,6 +424,7 @@ mana={G} [/card] [card] text=White creatures get +1/+1. +auto=lord(creature[white]) 1/1 includeself id=1341 name=Crusade rarity=R @@ -860,7 +862,8 @@ toughness=1 [card] text=Other Goblin creatures get +1/+1 and have mountainwalk. (They're unblockable as long as defending player controls a Mountain.) id=1296 -auto=lord(goblin) 1/1 mountainwalk +auto=lord(goblin) 1/1 +auto=lord(goblin) mountainwalk name=Goblin King rarity=R type=Creature @@ -1292,7 +1295,8 @@ toughness=1 [/card] [card] text=Other Merfolk creatures get +1/+1 and have islandwalk. -auto=lord(merfolk) 1/1 islandwalk +auto=lord(merfolk) 1/1 +auto=lord(merfolk) islandwalk id=1206 name=Lord of Atlantis rarity=R @@ -2448,7 +2452,8 @@ mana={2}{W}{W} [/card] [card] text=Zombie creatures have swampwalk. All Zombies have "{B}: Regenerate this permanent." -auto=lord(zombie) swampwalk {B}:regenerate +auto=lord(zombie) swampwalk +auto=lord(zombie) {B}:regenerate id=1188 name=Zombie Master rarity=R diff --git a/projects/mtg/bin/Res/sets/SHM/_cards.dat b/projects/mtg/bin/Res/sets/SHM/_cards.dat index aff6af8d0..7bba27e00 100644 --- a/projects/mtg/bin/Res/sets/SHM/_cards.dat +++ b/projects/mtg/bin/Res/sets/SHM/_cards.dat @@ -225,6 +225,15 @@ subtype=Spirit toughness=1 [/card] [card] +text=Destroy all nonwhite creatures. +auto=destroy all(creature[-white]) +id=146053 +name=Mass Calcify +rarity=R +type=Sorcery +mana={5}{W}{W} +[/card] +[card] text={T}: Add {R} to your mana pool. auto={T}:Add{R} id=157888 @@ -295,6 +304,27 @@ subtype=Faerie Soldier toughness=1 [/card] [card] +text=Creatures you control have double strike. +auto=lord(creature|myinplay) double strike +id=146727 +name=Rage Reflection +rarity=R +type=Enchantment +mana={4}{R}{R} +[/card] +[card] +text=Green creatures you control have trample. +auto=lord(creature[green]|myinplay) trample +id=141972 +name=Roughshod Mentor +rarity=U +type=Creature +mana={5}{G} +power=5 +subtype=Giant Warrior +toughness=4 +[/card] +[card] text=Protection from blue, from black, and from red abilities=protection from blue, protection from black, protection from red id=146735 @@ -540,6 +570,20 @@ type=Basic Land subtype=Swamp [/card] [card] +text=Flash Other white creatures you control get +1/+1. Other blue creatures you control get +1/+1. +abilities=flash +auto=lord(creature[white]|myinplay) 1/1 +auto=lord(creature[blue]|myinplay) 1/1 +id=147409 +name=Thistledown Liege +rarity=R +type=Creature +mana={1}{WU}{WU}{WU} +power=1 +subtype=Kithkin Knight +toughness=3 +[/card] +[card] text=Flash Enchant creature Enchanted creature gets -3/-0. abilities=flash auto=-3/0 @@ -551,6 +595,15 @@ mana={2}{UB} subtype=Aura [/card] [card] +text={2}, {T}: Tap target creature. +auto={2},[T}:tap target(creature) +id=147420 +name=Trip Noose +rarity=U +type=Artifact +mana={2} +[/card] +[card] text=Flying abilities=flying id=153967 diff --git a/projects/mtg/bin/Res/sets/SHM/todo.dat b/projects/mtg/bin/Res/sets/SHM/todo.dat index 3665b7a00..f08f62804 100644 --- a/projects/mtg/bin/Res/sets/SHM/todo.dat +++ b/projects/mtg/bin/Res/sets/SHM/todo.dat @@ -1197,14 +1197,6 @@ type=Instant mana={1}{RG} [/card] [card] -text=Destroy all nonwhite creatures. -id=146053 -name=Mass Calcify -rarity=R -type=Sorcery -mana={5}{W}{W} -[/card] -[card] text=When Medicine Runner comes into play, you may remove a counter from target permanent. id=141977 name=Medicine Runner @@ -1572,14 +1564,6 @@ type=Instant mana={2}{U}{U} [/card] [card] -text=Creatures you control have double strike. -id=146727 -name=Rage Reflection -rarity=R -type=Enchantment -mana={4}{R}{R} -[/card] -[card] text=Whenever a creature with flying attacks you, Raking Canopy deals 4 damage to it. id=158691 name=Raking Canopy @@ -1704,17 +1688,6 @@ subtype=Giant Shaman toughness=4 [/card] [card] -text=Green creatures you control have trample. -id=141972 -name=Roughshod Mentor -rarity=U -type=Creature -mana={5}{G} -power=5 -subtype=Giant Warrior -toughness=4 -[/card] -[card] text=As Runed Halo comes into play, name a card. You have protection from the chosen name. (You can't be targeted, dealt damage, or enchanted by anything with that name.) id=154005 name=Runed Halo @@ -1836,7 +1809,7 @@ mana={2}{GW} subtype=Aura [/card] [card] -text=Flying {1}{WU}, {T}: Tap target creature. ({T} is the untap symbol.) +text=Flying {1}{WU}, {Q}: Tap target creature. ({Q} is the untap symbol.) id=142027 name=Silkbind Faerie rarity=C @@ -2056,17 +2029,6 @@ subtype=Kithkin Soldier Wizard toughness=2 [/card] [card] -text=Flash Other white creatures you control get +1/+1. Other blue creatures you control get +1/+1. -id=147409 -name=Thistledown Liege -rarity=R -type=Creature -mana={1}{WU}{WU}{WU} -power=1 -subtype=Kithkin Knight -toughness=3 -[/card] -[card] text=Thornwatch Scarecrow has wither as long as you control a green creature. (It deals damage to creatures in the form of -1/-1 counters.) Thornwatch Scarecrow has vigilance as long as you control a white creature. id=151634 name=Thornwatch Scarecrow @@ -2135,14 +2097,6 @@ type=Sorcery mana={4}{BR} [/card] [card] -text={2}, {T}: Tap target creature. -id=147420 -name=Trip Noose -rarity=U -type=Artifact -mana={2} -[/card] -[card] text=Remove target creature from the game. Return that card to play under its owner's control at end of turn. id=158752 name=Turn to Mist @@ -2271,6 +2225,8 @@ mana={3}{R} [/card] [card] text=Other green creatures you control get +1/+1. Other white creatures you control get +1/+1. If a spell or ability an opponent controls causes you to discard Wilt-Leaf Liege, put it into play instead of putting it into your graveyard. +auto=lord(creature[green]) 1/1 +auto=lord(creature[white]) 1/1 id=147439 name=Wilt-Leaf Liege rarity=R diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 0d887ef9f..5cc62f715 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -43,11 +43,36 @@ class ADrawer:public ActivatedAbility{ }; +//Moves Cards from a zone to another +class AZoneMover:public TargetAbility{ + +public: + string destinationZone; + + AZoneMover(int _id, MTGCardInstance * _source, TargetChooser * _tc,string destZone, ManaCost * _cost = NULL):TargetAbility(_id,_source, _tc,_cost){ + destinationZone = destZone; + } + + int resolve(){ + MTGCardInstance * _target = tc->getNextCardTarget(); + if(_target){ + Player* p = _target->controller(); + if (p){ + MTGGameZone * fromZone = _target->getCurrentZone(); + MTGGameZone * destZone = MTGGameZone::stringToZone(destinationZone, source); + p->game->putInZone(_target,fromZone,destZone); + } + return 1; + } + return 0; + } +}; + //Destroyer. TargetAbility class ADestroyer:public TargetAbility{ public: int bury; - ADestroyer(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL, int _bury = 0):TargetAbility(_id,_source, _tc),bury(_bury){ + ADestroyer(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL, int _bury = 0, ManaCost * _cost=NULL):TargetAbility(_id,_source, _tc,_cost),bury(_bury){ if (!tc) tc = NEW CreatureTargetChooser(); } @@ -73,7 +98,7 @@ class ADestroyer:public TargetAbility{ //Destroyer. TargetAbility class ABurier:public ADestroyer{ public: - ABurier(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL):ADestroyer(_id,_source, tc,1){ + ABurier(int _id, MTGCardInstance * _source, TargetChooser * _tc = NULL,ManaCost * _cost=NULL):ADestroyer(_id,_source, _tc,1,_cost){ } const char * getMenuText(){ @@ -869,13 +894,16 @@ class AConvertLandToCreatures:public ListMaintainerAbility{ //Lords (Merfolk lord...) give power and toughness to OTHER creatures of their type, they can give them special abilities, regeneration class ALord:public ListMaintainerAbility{ public: - string type; + TargetChooser * tc; int power, toughness; int ability; ManaCost * regenCost; + int includeSelf; map regenerations; - ALord(int _id, MTGCardInstance * card, const char * _type, int _power = 0 , int _toughness = 0, int _ability = -1, ManaCost * _regenCost = NULL):ListMaintainerAbility(_id,card){ - type = _type; + ALord(int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, int _power = 0 , int _toughness = 0, int _ability = -1, ManaCost * _regenCost = NULL):ListMaintainerAbility(_id,card){ + tc = _tc; + tc->source = NULL; + includeSelf = _includeSelf; power = _power; toughness = _toughness; ability = _ability; @@ -883,7 +911,7 @@ class ALord:public ListMaintainerAbility{ } int canBeInList(MTGCardInstance * card){ - if (card!=source && card->isACreature() && card->hasSubtype(type)) return 1; + if ( (includeSelf || card!=source) && tc->canTarget(card)) return 1; return 0; } @@ -915,59 +943,6 @@ class ALord:public ListMaintainerAbility{ }; -//Lords (Merfolk lord...) give power and toughness to OTHER creatures of a given color, they can give them special abilities, regeneration -class AColorLord:public ListMaintainerAbility{ - public: - int color; - int notcolor; - int power, toughness; - int ability; - ManaCost * regenCost; - map regenerations; - AColorLord(int _id, MTGCardInstance * card, int _color, int _notcolor = -1, int _power = 0 , int _toughness = 0, int _ability = -1, ManaCost * _regenCost = NULL):ListMaintainerAbility(_id,card){ - color = _color; - notcolor = _notcolor; - power = _power; - toughness = _toughness; - ability = _ability; - regenCost = _regenCost; - } - - int canBeInList(MTGCardInstance * card){ - if (notcolor > -1){ - if (card!=source && card->isACreature() && !card->hasColor(notcolor)) return 1; - }else{ - if (card!=source && card->isACreature() && card->hasColor(color)) return 1; - } - return 0; - } - - int added(MTGCardInstance * card){ - card->power += power; - card->addToToughness(toughness); - if (ability != -1) card->basicAbilities[ability] +=1; - if (regenCost){ - AStandardRegenerate * regen = NEW AStandardRegenerate(0, card, card, regenCost); - regenerations[card] = regen; - game->addObserver(regen); - } - return 1; - } - - int removed(MTGCardInstance * card){ - card->power -= power; - card->addToToughness(-toughness); - if (ability != -1 && card->basicAbilities[ability]) card->basicAbilities[ability] -=1; - if (regenCost){ - if(regenerations.find(card) != regenerations.end()){ - game->removeObserver(regenerations[card]); - regenerations.erase(card); - } - } - return 1; - } - -}; /* Standard Damager, can choose a NEW target each time the price is paid */ @@ -1785,32 +1760,6 @@ class AAnimateDead:public MTGAbility{ } }; -//1144 Bad Moon, 1341 Crusade -class ABadMoon:public ListMaintainerAbility{ - public: - int color; - ABadMoon(int _id, MTGCardInstance * _source, int _color = MTG_COLOR_BLACK):ListMaintainerAbility(_id, _source),color(_color){ - } - - int canBeInList(MTGCardInstance * card){ - if (card->isACreature() && card->hasColor(color)) return 1; - return 0; - } - - int added(MTGCardInstance * card){ - card->power += 1; - card->addToToughness(1); - return 1; - } - - int removed(MTGCardInstance * card){ - card->power -= 1; - card->addToToughness(-1); - return 1; - } - -}; - //1159 Erg Raiders class AErgRaiders:public MTGAbility{ diff --git a/projects/mtg/include/MTGGameZones.h b/projects/mtg/include/MTGGameZones.h index 2074f427e..68ddb8973 100644 --- a/projects/mtg/include/MTGGameZones.h +++ b/projects/mtg/include/MTGGameZones.h @@ -34,6 +34,7 @@ class MTGGameZone { int hasType(const char * value); void setOwner(Player * player); MTGCardInstance * lastCardDrawn; + static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source); }; class MTGLibrary: public MTGGameZone { @@ -52,6 +53,9 @@ class MTGHand: public MTGGameZone { public: }; +class MTGRemovedFromGame: public MTGGameZone { + public: +}; class MTGStack: public MTGGameZone { public: @@ -78,6 +82,8 @@ class MTGPlayerCards { MTGHand * hand; MTGInPlay * inPlay; MTGStack * stack; + MTGRemovedFromGame * removedFromGame; + MTGAllCards * collection; MTGPlayerCards(MTGAllCards * _collection, int * idList, int idListSize); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index c6944e8fb..79ac118dc 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -9,6 +9,8 @@ #include "../include/MTGDeck.h" + + int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option){ int result = 0; GameObserver * game = GameObserver::GetInstance(); @@ -122,7 +124,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ TargetChooser * tc = NULL; int doTap = 0; - string lordType = ""; + TargetChooser * lordTargets = NULL; + int lordIncludeSelf = 0; Trigger * trigger = parseTrigger(s); //Dirty way to remove the trigger text (could get in the way) @@ -150,8 +153,11 @@ 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){ - lordType = s.substr(found+5,end-found-5).c_str(); + string lordType = s.substr(found+5,end-found-5).c_str(); + TargetChooserFactory tcf; + lordTargets = tcf.createTargetChooser(lordType, card); } + if (s.find("includeself") != string::npos) lordIncludeSelf = 1; } //foreach. Very basic, needs to be improved ! @@ -189,8 +195,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (dryMode) return BAKA_EFFECT_GOOD; ManaCost * cost = ManaCost::parseManaCost(s); - if (lordType.size() > 0){ - game->addObserver(NEW ALord(id,card,lordType.c_str(),0,0,-1,cost)); + if (lordTargets){ + game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,0,0,-1,cost)); }else{ if (tc){ @@ -204,6 +210,27 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ continue; } + //MoveTo Move a card from a zone to another + found = s.find("moveto("); + if (found != string::npos){ + if (dryMode) return BAKA_EFFECT_BAD; //TODO : depends on where from, where to... + int end = s.find(")"); + string szone = s.substr(found + 7,end - found - 7); + if (tc){ + ManaCost * cost = ManaCost::parseManaCost(s); + if (cost->getConvertedCost() == 0){ + delete cost; + cost = NULL; + } + game->addObserver(NEW AZoneMover(id,card,tc,szone,cost)); + }else{ + MTGGameZone * fromZone = target->getCurrentZone(); + MTGGameZone * destZone = MTGGameZone::stringToZone(szone, target); + target->controller()->game->putInZone(target,fromZone,destZone); + } + result++; + continue; + } //Bury found = s.find("bury"); if (found != string::npos){ @@ -371,38 +398,38 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ unsigned int end = s.find(" ",start); int toughness; if (end != string::npos){ - toughness = atoi(s.substr(found+1,end-found-1).c_str()); + toughness = atoi(s.substr(found+1,end-found-1).c_str()); }else{ - toughness = atoi(s.substr(found+1).c_str()); + toughness = atoi(s.substr(found+1).c_str()); } if (dryMode){ - if (power >=0 && toughness >= 0 ) return BAKA_EFFECT_GOOD; - return BAKA_EFFECT_BAD; + if (power >=0 && toughness >= 0 ) return BAKA_EFFECT_GOOD; + return BAKA_EFFECT_BAD; } int limit = 0; unsigned int limit_str = s.find("limit:"); if (limit_str != string::npos){ - limit = atoi(s.substr(limit_str+6).c_str()); + limit = atoi(s.substr(limit_str+6).c_str()); } ManaCost * cost = ManaCost::parseManaCost(s); - if (lordType.size() > 0){ - game->addObserver(NEW ALord(id,card,lordType.c_str(),power,toughness)); + if (lordTargets){ + game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,power,toughness)); }else{ - if(tc){ - game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card,power,toughness, cost, tc)); - }else{ - if (cost->getConvertedCost() == 0){ - delete 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 APowerToughnessModifierUntilEndOfTurn(id, card, target,power,toughness, cost, limit)); - } - } + if(tc){ + game->addObserver(NEW ATargetterPowerToughnessModifierUntilEOT(id, card,power,toughness, cost, tc)); + }else{ + if (cost->getConvertedCost() == 0){ + delete 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 APowerToughnessModifierUntilEndOfTurn(id, card, target,power,toughness, cost, limit)); + } + } } result++; continue; @@ -447,8 +474,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ } ManaCost * cost = ManaCost::parseManaCost(s); - if (lordType.size() > 0){ - game->addObserver(NEW ALord(id,card,lordType.c_str(),0,0,j)); + if (lordTargets){ + game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,0,0,j)); }else{ if (tc){ @@ -539,12 +566,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(ability); break; } - case 106525: //Ascendant Evincar - { - game->addObserver(NEW AColorLord(_id, card,MTG_COLOR_BLACK,-1,1,1)); - game->addObserver(NEW AColorLord(_id + 1, card,0,MTG_COLOR_BLACK,-1,-1)); - break; - } case 1096: //Basalt Monolith { @@ -856,11 +877,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AAnimateDead(_id, card, card->target)); break; } - case 1144: //Bad moon - { - game->addObserver(NEW ABadMoon(_id,card)); - break; - } case 1148 : //Cursed lands { game->addObserver(NEW AWanderlust(_id, card, card->target)); @@ -1249,12 +1265,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AOldSchoolDeathtouch(_id,card)); break; } - case 1341: //Crusade: - { - game->addObserver(NEW ABadMoon(_id,card, MTG_COLOR_WHITE)); - break; - - } case 1346: //Green Ward { game->addObserver(NEW AProtectionFrom( _id,card, card->target, MTG_COLOR_GREEN)); diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 676b3fe69..85670a920 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -201,6 +201,7 @@ int MTGCardInstance::reset(){ return 1; } + Player * MTGCardInstance::controller(){ GameObserver * game = GameObserver::GetInstance(); if (!game) return NULL; diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 614873592..9d60bbf3d 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -320,3 +320,23 @@ void MTGLibrary::shuffleTopToBottom(int nbcards){ cards[i] = _cards[i]; } } + +MTGGameZone * MTGGameZone::stringToZone(string zoneName, MTGCardInstance * source){ + Player * p = source->controller(); + if(zoneName.compare("mygraveyard") == 0)return p->game->graveyard; + if(zoneName.compare("opponentgraveyard") == 0) return p->opponent()->game->graveyard; + if(zoneName.compare("ownergraveyard") == 0) return source->owner->game->graveyard; + + if(zoneName.compare("myinplay") == 0)return p->game->inPlay; + if(zoneName.compare("opponentinplay") == 0) return p->opponent()->game->inPlay; + if(zoneName.compare("ownerinplay") == 0) return source->owner->game->inPlay; + + if(zoneName.compare("myhand") == 0)return p->game->hand; + if(zoneName.compare("opponenthand") == 0) return p->opponent()->game->hand; + if(zoneName.compare("ownerhand") == 0) return source->owner->game->hand; + + if(zoneName.compare("myremovedfromgame") == 0)return p->game->removedFromGame; + if(zoneName.compare("opponentremovedfromgame") == 0) return p->opponent()->game->removedFromGame; + if(zoneName.compare("ownerhremovedfromgame") == 0) return source->owner->game->removedFromGame; + +} \ No newline at end of file