diff --git a/projects/mtg/bin/Res/graphics/smallface.dat b/projects/mtg/bin/Res/graphics/smallface.dat deleted file mode 100644 index adddccfd2..000000000 Binary files a/projects/mtg/bin/Res/graphics/smallface.dat and /dev/null differ diff --git a/projects/mtg/bin/Res/graphics/smallface.png b/projects/mtg/bin/Res/graphics/smallface.png deleted file mode 100644 index e3d155039..000000000 Binary files a/projects/mtg/bin/Res/graphics/smallface.png and /dev/null differ diff --git a/projects/mtg/bin/Res/sets/M10/_cards.dat b/projects/mtg/bin/Res/sets/M10/_cards.dat index 7b61b05e2..7c495e1fc 100644 --- a/projects/mtg/bin/Res/sets/M10/_cards.dat +++ b/projects/mtg/bin/Res/sets/M10/_cards.dat @@ -872,7 +872,7 @@ name=Kraken's Eye mana={2} type=Artifact text=Whenever a player casts a blue spell, you may gain 1 life. -auto=@movedTo(*[blue]|stack): may life:1 +auto=@movedTo(*[blue]|stack):may life:1 rarity=U [/card] [card] diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index b86b12bc8..8935e3d57 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -39,6 +39,7 @@ ascendant_evincar2.txt ascendant_evincar3.txt ashen_firebeast.txt ashen_firebeast2.txt +beacon_of_unrest.txt #befoul.txt blessed_wine.txt #blinking_spirit.txt @@ -100,6 +101,8 @@ jump.txt keldon_warlord.txt keldon_warlord2.txt kird_ape.txt +kraken_eye.txt +kraken_eye2.txt kudzu.txt kudzu2.txt lhurgoyf.txt diff --git a/projects/mtg/bin/Res/test/beacon_of_unrest.txt b/projects/mtg/bin/Res/test/beacon_of_unrest.txt new file mode 100644 index 000000000..5bdf10669 --- /dev/null +++ b/projects/mtg/bin/Res/test/beacon_of_unrest.txt @@ -0,0 +1,18 @@ +#Bug: Beacon of unrest goes to graveyard +[INIT] +FIRSTMAIN +[PLAYER1] +hand:beacon of unrest +manapool:{3}{B}{B} +[PLAYER2] +graveyard:shivan dragon +[DO] +beacon of unrest +shivan dragon +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:shivan dragon +library:beacon of unrest +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/kraken_eye.txt b/projects/mtg/bin/Res/test/kraken_eye.txt new file mode 100644 index 000000000..6f9751e12 --- /dev/null +++ b/projects/mtg/bin/Res/test/kraken_eye.txt @@ -0,0 +1,18 @@ +#Bug:Kraken's eye does nothing +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:kraken's eye +hand:air elemental +manapool:{3}{U}{U} +[PLAYER2] +[DO] +air elemental +choice 0 +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:kraken's eye,air elemental +life:21 +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/kraken_eye2.txt b/projects/mtg/bin/Res/test/kraken_eye2.txt new file mode 100644 index 000000000..8824f2068 --- /dev/null +++ b/projects/mtg/bin/Res/test/kraken_eye2.txt @@ -0,0 +1,36 @@ +#Kraken eye works ok twice in a turn ? +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:kraken's eye,island +hand:air elemental,unsummon +manapool:{3}{U}{U} +[PLAYER2] +[DO] +air elemental +choice 0 +next +#begin +next +#attack +next +#blockers +next +#dmage +next +#end +next +#secondmain +island +unsummon +air elemental +choice 0 +[ASSERT] +SECONDMAIN +[PLAYER1] +inplay:kraken's eye,island +hand:air elemental +graveyard:unsummon +life:22 +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 3badc3f59..93a65bc95 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -63,7 +63,7 @@ class AACounter: public ActivatedAbility{ int nb; int power; int toughness; - AACounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, int nb,ManaCost * cost=NULL, int doTap = 1):ActivatedAbility(id,_source,cost,0,doTap),power(_power),toughness(_toughness),nb(nb){ + AACounter(int id, MTGCardInstance * _source, MTGCardInstance * _target, int _power, int _toughness, int nb,ManaCost * cost=NULL, int doTap = 0):ActivatedAbility(id,_source,cost,0,doTap),power(_power),toughness(_toughness),nb(nb){ target=_target; } @@ -95,7 +95,7 @@ class AACounter: public ActivatedAbility{ class AAFizzler:public ActivatedAbility{ public: - AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap){ + AAFizzler(int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL, int _tap = 0):ActivatedAbility(_id, card,_cost,0,_tap){ target = _target; } @@ -129,11 +129,10 @@ class MayAbility:public MTGAbility{ public: int triggered; MTGAbility * ability; - int deleteAbility; + MTGAbility * mClone; MayAbility(int _id, MTGAbility * _ability, MTGCardInstance * _source):MTGAbility(_id,_source),ability(_ability){ triggered = 0; - ability->forceDestroy = 1; - deleteAbility = 1; + mClone = NULL; } void Update(float dt){ @@ -150,7 +149,7 @@ public: } int testDestroy(){ - if (triggered && !game->mLayers->actionLayer()->menuObject){ + if (triggered && !game->mLayers->actionLayer()->menuObject && game->mLayers->actionLayer()->getIndexOf(mClone) ==-1){ OutputDebugString("Destroy!\n"); return 1; } @@ -165,22 +164,14 @@ public: int reactToTargetClick(Targetable * object){ OutputDebugString("ReactToTargetClick!\n"); - deleteAbility = 0; - game->addObserver(ability); - return ability->reactToTargetClick(object); + mClone = ability->clone(); + mClone->addToGame(); + mClone->forceDestroy = 1; + return mClone->reactToTargetClick(object); } ~MayAbility(){ - if (deleteAbility) SAFE_DELETE(ability); - } - - virtual ostream& toString(ostream& out) const - { - out << "MayAbility ::: triggered : " << triggered - << " ; ability : " << ability - << " ; deleteAbility : " << deleteAbility - << " ("; - return MTGAbility::toString(out) << ")"; + if (!isClone) SAFE_DELETE(ability); } MayAbility * clone() const{ @@ -241,7 +232,7 @@ class GenericActivatedAbility:public ActivatedAbility{ MTGAbility * ability; int limitPerTurn; int counters; - GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 1, int limit = 0):ActivatedAbility(_id, card,_cost,0,_tap),ability(a),limitPerTurn(limit){ + GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0):ActivatedAbility(_id, card,_cost,0,_tap),ability(a),limitPerTurn(limit){ counters = 0; target = ability->target; } @@ -321,7 +312,7 @@ public: class AADrawer:public ActivatedAbility{ public: int nbcards; - AADrawer(int _id, MTGCardInstance * card,ManaCost * _cost, int _nbcards = 1, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap),nbcards(_nbcards){ + AADrawer(int _id, MTGCardInstance * card,ManaCost * _cost, int _nbcards = 1, int _tap = 0):ActivatedAbility(_id, card,_cost,0,_tap),nbcards(_nbcards){ } int resolve(){ @@ -346,7 +337,7 @@ class AADrawer:public ActivatedAbility{ class AALifer:public ActivatedAbility{ public: int life; - AALifer(int _id, MTGCardInstance * card, MTGCardInstance * _target, int life, ManaCost * _cost = NULL, int _tap = 1):ActivatedAbility(_id, card,_cost,0,_tap),life(life){ + AALifer(int _id, MTGCardInstance * card, MTGCardInstance * _target, int life, ManaCost * _cost = NULL, int _tap = 0):ActivatedAbility(_id, card,_cost,0,_tap),life(life){ target = _target; } @@ -1663,7 +1654,7 @@ AADamager(int _id, MTGCardInstance * _source, Damageable * _target, int _damage class TADamager:public TargetAbility{ public: int damage; - TADamager(int id, MTGCardInstance * card, ManaCost * _cost, int _damage, TargetChooser * _tc = NULL, int _tap = 1):TargetAbility(id,card, _tc, _cost,0,_tap),damage(_damage){ + TADamager(int id, MTGCardInstance * card, ManaCost * _cost, int _damage, TargetChooser * _tc = NULL, int _tap = 0):TargetAbility(id,card, _tc, _cost,0,_tap),damage(_damage){ if (!tc) tc = NEW DamageableTargetChooser(card); ability = NEW AADamager(id,card,NULL,damage); } @@ -3689,7 +3680,7 @@ ALavaborn * clone() const{ class AADepleter:public ActivatedAbility{ public: int nbcards; - AADepleter(int _id, MTGCardInstance * card, Player * _target, int nbcards = 1, ManaCost * _cost=NULL, int _tap = 1):ActivatedAbility(_id,card, _cost,0,_tap),nbcards(nbcards){ + AADepleter(int _id, MTGCardInstance * card, Player * _target, int nbcards = 1, ManaCost * _cost=NULL, int _tap = 0):ActivatedAbility(_id,card, _cost,0,_tap),nbcards(nbcards){ target = _target; } int resolve(){ @@ -3719,7 +3710,7 @@ class AADepleter:public ActivatedAbility{ class AARandomDiscarder:public ActivatedAbility{ public: int nbcards; - AARandomDiscarder(int _id, MTGCardInstance * card, Player * _target, int nbcards = 1, ManaCost * _cost=NULL, int _tap = 1):ActivatedAbility(_id,card, _cost,0,_tap),nbcards(nbcards){ + AARandomDiscarder(int _id, MTGCardInstance * card, Player * _target, int nbcards = 1, ManaCost * _cost=NULL, int _tap = 0):ActivatedAbility(_id,card, _cost,0,_tap),nbcards(nbcards){ target = _target; } int resolve(){ diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index a8f503a0b..5d2d6e687 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -106,7 +106,10 @@ int Spell::resolve(){ while (source->next){ source = source->next; } - source = source->controller()->game->putInPlay(source); + if (!source->hasType("instant") && !source->hasType("sorcery")){ + source = source->controller()->game->putInPlay(source); + } + //Play SFX if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME].getIntValue() > 0){ diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 970d966bb..bb4cb3657 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -816,16 +816,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ MTGCardInstance * card = spell->source; - if (card->hasType("instant") || card->hasType("sorcery")){ - MTGPlayerCards * zones = card->controller()->game; - zones->putInGraveyard(card); - } - if (spell->cursor==1) card->target = spell->getNextCardTarget(); _id = magicText(_id, spell); GameObserver * game = GameObserver::GetInstance(); - + MTGPlayerCards * zones = card->controller()->game; int id = card->getId(); @@ -1697,33 +1692,17 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } case 130553:// Beacon of Immortality { - int life; - Player * player = spell->getNextPlayerTarget(); - MTGLibrary * library = card->controller()->game->library; - life = player->life; - player->life+=life; - MTGGameZone * zones[] = {card->controller()->game->inPlay,card->controller()->game->graveyard,card->controller()->game->hand}; - for (int k = 0; k < 3; k++){ - MTGGameZone * zone = zones[k]; - if (zone->hasCard(card)){ - card->controller()->game->putInZone(card,zone,library); - library->shuffle(); - } - } - break; + Player * player = spell->getNextPlayerTarget(); + player->life+=player->life; + zones->putInZone(card,zones->stack,zones->library); + zones->library->shuffle(); + break; } case 135262:// Beacon of Destruction & unrest { - MTGLibrary * library = card->controller()->game->library; - MTGGameZone * zones[] = {card->controller()->game->inPlay,card->controller()->game->graveyard,card->controller()->game->hand}; - for (int k = 0; k < 3; k++){ - MTGGameZone * zone = zones[k]; - if (zone->hasCard(card)){ - card->controller()->game->putInZone(card,zone,library); - library->shuffle(); - } - } - break; + zones->putInZone(card,zones->stack,zones->library); + zones->library->shuffle(); + break; } case 129750: //Sudden Impact { @@ -1897,6 +1876,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AStrongLandLinkCreature(_id, card,"plains")); } + if (card->hasType("instant") || card->hasType("sorcery")){ + MTGPlayerCards * zones = card->controller()->game; + zones->putInZone(card,zones->stack,zones->graveyard); + } + + } MTGAbility::MTGAbility(int id, MTGCardInstance * card):ActionElement(id){ @@ -2363,7 +2348,10 @@ void GenericTriggeredAbility::Update(float dt){ } int GenericTriggeredAbility::resolve(){ - return ability->resolve(); + if (ability->oneShot) return ability->resolve(); + MTGAbility * clone = ability->clone(); + clone->addToGame(); + return 1; } int GenericTriggeredAbility::testDestroy(){