From bd632ed34666048e9cf72ffd25cffdbb153e415c Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew" Date: Fri, 6 Feb 2009 13:10:28 +0000 Subject: [PATCH] Erwan - removed a useless .h file - fixed a bug with nantuko husk (see tests/nantuko_husk.txt) --- projects/mtg/bin/Res/sets/SHM/_cards.dat | 12 --------- projects/mtg/bin/Res/sets/SHM/todo.dat | 13 +++++++++- projects/mtg/bin/Res/test/_tests.txt | 1 + projects/mtg/bin/Res/test/nantuko_husk.txt | 29 ++++++++++++++++++++++ projects/mtg/include/AllAbilities.h | 25 +++++++++---------- projects/mtg/include/allTargetChoosers.h | 5 ---- projects/mtg/src/MTGAbility.cpp | 1 + projects/mtg/template.vcproj | 4 --- 8 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 projects/mtg/bin/Res/test/nantuko_husk.txt delete mode 100644 projects/mtg/include/allTargetChoosers.h diff --git a/projects/mtg/bin/Res/sets/SHM/_cards.dat b/projects/mtg/bin/Res/sets/SHM/_cards.dat index 83fb7ddd0..810a74486 100644 --- a/projects/mtg/bin/Res/sets/SHM/_cards.dat +++ b/projects/mtg/bin/Res/sets/SHM/_cards.dat @@ -180,18 +180,6 @@ subtype=Treefolk Shaman toughness=6 [/card] [card] -text=Sacrifice Fulminator Mage: Destroy target nonbasic land. -auto={S}:destroy target(land[-plains;-mountain;-swamp;-forest;-island]) -id=142009 -name=Fulminator Mage -rarity=R -type=Creature -mana={1}{BR}{BR} -power=2 -subtype=Elemental Shaman -toughness=2 -[/card] -[card] text=Flying Other blue creatures you control get +1/+1. Other black creatures you control get +1/+1. abilities=flying auto=lord(creature[blue]|myinplay) 1/1 diff --git a/projects/mtg/bin/Res/sets/SHM/todo.dat b/projects/mtg/bin/Res/sets/SHM/todo.dat index 16069644d..41fac3b13 100644 --- a/projects/mtg/bin/Res/sets/SHM/todo.dat +++ b/projects/mtg/bin/Res/sets/SHM/todo.dat @@ -622,7 +622,18 @@ rarity=R type=Instant mana={2}{GW}{GW}{GW} [/card] - +[card] +text=Sacrifice Fulminator Mage: Destroy target nonbasic land. +auto={S}:destroy target(land[-plains;-mountain;-swamp;-forest;-island]) +id=142009 +name=Fulminator Mage +rarity=R +type=Creature +mana={1}{BR}{BR} +power=2 +subtype=Elemental Shaman +toughness=2 +[/card] [card] text=When Furystoke Giant comes into play, other creatures you control gain "{T}: This creature deals 2 damage to target creature or player" until end of turn. Persist (When this creature is put into a graveyard from play, if it had no -1/-1 counters on it, return it to play under its owner's control with a -1/-1 counter on it.) id=152069 diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 076b0b143..3e05accf9 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -46,6 +46,7 @@ lifeforce.txt living_lands.txt lord_of_the_pit.txt lord_of_the_pit2.txt +nantuko_husk.txt orcish_lumberjack.txt paralysis.txt paralysis2.txt diff --git a/projects/mtg/bin/Res/test/nantuko_husk.txt b/projects/mtg/bin/Res/test/nantuko_husk.txt new file mode 100644 index 000000000..49f584d15 --- /dev/null +++ b/projects/mtg/bin/Res/test/nantuko_husk.txt @@ -0,0 +1,29 @@ +#Testing Nantuko Husk's ability on an orcish artillery +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:129653,129663 +[PLAYER2] +[DO] +129653 +129663 +next +#combat begin +next +#attackers +129653 +choice 0 +next +#defensers +next +#damage +next +#combat end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:129653 +graveyard:129663 +[PLAYER2] +life:16 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 60cf050aa..f28193d41 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -528,14 +528,14 @@ class ATargetterPowerToughnessModifierUntilEOT: public TargetAbility{ //Alteration of Power and Toughness until end of turn (Aura) -class APowerToughnessModifierUntilEndOfTurn: public MTGAbility{ +class APowerToughnessModifierUntilEndOfTurn: public ActivatedAbility{ public: int power, toughness; int counters; int maxcounters; - ManaCost * cost; - APowerToughnessModifierUntilEndOfTurn(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, ManaCost * _cost, int _maxcounters = 0):MTGAbility(id,_source,_target),power(_power),toughness(_toughness),maxcounters(_maxcounters), cost(_cost){ + APowerToughnessModifierUntilEndOfTurn(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, ManaCost * _cost, int _maxcounters = 0):ActivatedAbility(id,_source,_cost,0,0),power(_power),toughness(_toughness),maxcounters(_maxcounters){ counters = 0; + target=_target; } void Update(float dt){ @@ -546,20 +546,19 @@ class APowerToughnessModifierUntilEndOfTurn: public MTGAbility{ counters--; } } + ActivatedAbility::Update(dt); } - int isReactingToClick(MTGCardInstance * _card){ - if (_card == source && (!maxcounters || counters < maxcounters) && game->currentlyActing()->game->inPlay->hasCard(source)){ - if (game->currentlyActing()->getManaPool()->canAfford(cost)){ - return 1; - } - } - return 0; + int fireAbility(){ + return resolve(); } - int reactToClick(MTGCardInstance * _card){ - if (!isReactingToClick( _card)) return 0; - game->currentlyActing()->getManaPool()->pay(cost); + int isReactingToClick(MTGCardInstance * card){ + if (!ActivatedAbility::isReactingToClick(card)) return 0; + return (!maxcounters || (counters < maxcounters)); + } + + int resolve(){ ((MTGCardInstance *)target)->power += power; ((MTGCardInstance *)target)->addToToughness(toughness); counters++; diff --git a/projects/mtg/include/allTargetChoosers.h b/projects/mtg/include/allTargetChoosers.h deleted file mode 100644 index 239e794b0..000000000 --- a/projects/mtg/include/allTargetChoosers.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef _ALLTARGETCHOOSERS_H_ -#define _ALLTARGETCHOOSERS_H_ - - -#endif diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 8ff97841c..ff195373c 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -498,6 +498,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ game->addObserver(NEW AInstantPowerToughnessModifierUntilEOT(id, card, target,power,toughness)); } }else{ + OutputDebugString("NANTUKO OK\n"); game->addObserver(NEW APowerToughnessModifierUntilEndOfTurn(id, card, target,power,toughness, cost, limit)); } } diff --git a/projects/mtg/template.vcproj b/projects/mtg/template.vcproj index e9440f6f7..3ab367c0d 100644 --- a/projects/mtg/template.vcproj +++ b/projects/mtg/template.vcproj @@ -537,10 +537,6 @@ RelativePath=".\include\AllAbilities.h" > - -