From 226c1329469a9e37bf6931d640974b14e7ea9300 Mon Sep 17 00:00:00 2001 From: "wagic.laurent" Date: Mon, 7 Dec 2009 16:16:01 +0000 Subject: [PATCH] Laurent - Code Clean-Up removed some Hardcode replace with softcode, mostly RV. Tested most of them (except exile from ALL but that should be the same as Swords to plowshares)... Did not manage to remove/softcode The Rack. --- projects/mtg/bin/Res/sets/ALL/_cards.dat | 3 +- projects/mtg/bin/Res/sets/ICE/_cards.dat | 3 +- projects/mtg/bin/Res/sets/RV/_cards.dat | 10 +- projects/mtg/include/AllAbilities.h | 126 ----------------------- projects/mtg/src/MTGAbility.cpp | 57 ---------- 5 files changed, 13 insertions(+), 186 deletions(-) diff --git a/projects/mtg/bin/Res/sets/ALL/_cards.dat b/projects/mtg/bin/Res/sets/ALL/_cards.dat index be973db0f..559a6e098 100644 --- a/projects/mtg/bin/Res/sets/ALL/_cards.dat +++ b/projects/mtg/bin/Res/sets/ALL/_cards.dat @@ -162,7 +162,8 @@ type=Instant text=Exile target nonwhite attacking creature. You gain life equal to its toughness. rarity=R target=creature[-white;attacking] -#Hardcoded could be softcoded and removed from code +auto=moveto(exile) +auto=life:t controller [/card] [card] id=3075 diff --git a/projects/mtg/bin/Res/sets/ICE/_cards.dat b/projects/mtg/bin/Res/sets/ICE/_cards.dat index 08e7910b1..2d5b3e56d 100644 --- a/projects/mtg/bin/Res/sets/ICE/_cards.dat +++ b/projects/mtg/bin/Res/sets/ICE/_cards.dat @@ -1345,7 +1345,8 @@ subtype=Swamp text=Exile target creature. That creature's controller gains life equal to its power. id=2714 target=creature -alias=1367 +auto=moveto(exile) +auto=life:p targetController name=Swords to Plowshares rarity=U mana={W} diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index d8e9195a6..b8841423a 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -251,7 +251,7 @@ type=Sorcery [card] text=Brass Man doesn't untap during your untap step. At the beginning of your upkeep, you may pay {1}. If you do, untap Brass Man. id=1099 -auto={1}:untap +auto={1}:untap myTurnOnly name=Brass Man rarity=U mana={1} @@ -426,6 +426,7 @@ toughness=4 [card] text=Enchant creature When enchanted creature is put into a graveyard, Creature Bond deals damage equal to that creature's toughness to the creature's controller. target=creature +auto=@movedto(mytgt|graveyard) from(Battlefield):damage:t targetController id=1197 name=Creature Bond rarity=C @@ -1171,6 +1172,7 @@ type=Artifact text=At the beginning of your upkeep, you gain X life, where X is the number of cards in your hand minus four. id=1115 name=Ivory Tower +auto=@each my upkeep:foreach(*|myhand)life:1 controller >4 rarity=R mana={1} type=Artifact @@ -1703,6 +1705,7 @@ toughness=1 text=Enchant land Whenever enchanted land becomes tapped, Psychic Venom deals 2 damage to that land's controller. target=land id=1218 +auto=@tapped(mytgt):damage:2 targetController name=Psychic Venom rarity=C mana={1}{U} @@ -1760,6 +1763,7 @@ subtype=Aura text=Enchant creature (Target a creature as you cast this. This card enters the battlefield 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 id=1262 +auto={G}:regenerate name=Regeneration rarity=C mana={1}{G} @@ -2037,6 +2041,7 @@ type=Enchantment text=Enchant artifact You control enchanted artifact. target=artifact id=1226 +alias=1194 name=Steal Artifact rarity=U mana={2}{U}{U} @@ -2056,6 +2061,7 @@ type=Sorcery [card] text=Target player gains X life. target=player +auto=life:X id=1266 name=Stream of Life rarity=C @@ -2101,6 +2107,8 @@ subtype=Swamp [card] text=Exile target creature. Its controller gains life equal to its power. target=creature +auto=moveto(exile) +auto=life:p targetController id=1367 name=Swords to Plowshares rarity=U diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index ee8660be5..de2dd86dd 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2559,46 +2559,6 @@ class AConservator: public MTGAbility{ }; -//Creature bond -class ACreatureBond:public MTGAbility{ - public: - int resolved; - ACreatureBond(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id,_source,_target){ - resolved = 0; - } - - int receiveEvent(WEvent * event){ - MTGCardInstance * _target = (MTGCardInstance *) target; - if (event->type == WEvent::CHANGE_ZONE){ - WEventZoneChange * e = (WEventZoneChange *) event; - MTGCardInstance * card = e->card->previous; - if (card == _target){ - for (int i = 0; i < 2 ; i++){ - Player * p = game->players[i]; - if (e->to == p->game->graveyard){ - game->mLayers->stackLayer()->addDamage(source,_target->controller(),_target->toughness); - return 1; - } - } - } - } - return 0; - } - - virtual ostream& toString(ostream& out) const - { - out << "ACreatureBond ::: resolved : " << resolved - << " ("; - return MTGAbility::toString(out) << ")"; - } - ACreatureBond * clone() const{ - ACreatureBond * a = NEW ACreatureBond(*this); - a->isClone = 1; - return a; - } -}; - - //1106 DisruptingScepter class ADisruptingScepter:public TargetAbility{ public: @@ -3296,36 +3256,6 @@ class AScavengingGhoul:public MTGAbility{ } }; -//1218 Psychic Venom -class APsychicVenom:public MTGAbility{ - public: - int tapped; - APsychicVenom(int _id, MTGCardInstance * _source, MTGCardInstance * _target):MTGAbility(_id, _source,_target){ - tapped = _target->isTapped(); - } - - void Update(float dt){ - MTGCardInstance* _target = (MTGCardInstance* )target; - int newState = _target->isTapped(); - if (newState != tapped && newState == 1){ - game->mLayers->stackLayer()->addDamage(source,_target->controller(),2); - } - tapped = newState; - } - - virtual ostream& toString(ostream& out) const - { - out << "APsychicVenom ::: tapped : " << tapped - << " ("; - return MTGAbility::toString(out) << ")"; - } - APsychicVenom * clone() const{ - APsychicVenom * a = NEW APsychicVenom(*this); - a->isClone = 1; - return a; - } -}; - //1235 Aspect of Wolf class AAspectOfWolf:public ListMaintainerAbility{ @@ -4046,60 +3976,4 @@ class AAngelicChorus: public ListMaintainerAbility{ }; -/// Work in Progress also from no on all code could be removed... - - - -///// Not working need to work on this one -///Abomination Kill blocking creature if white or green -class AAbomination :public MTGAbility{ - public: - MTGCardInstance * opponents[20]; - int nbOpponents; - AAbomination (int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ - nbOpponents = 0; - } - - void Update(float dt){ - if (newPhase != currentPhase){ - if( newPhase == Constants::MTG_PHASE_COMBATDAMAGE){ - nbOpponents = 0; - MTGCardInstance * opponent = source->getNextOpponent(); - while ((opponent && opponent->hasColor(Constants::MTG_COLOR_GREEN)) || opponent->hasColor(Constants::MTG_COLOR_WHITE)){ - opponents[nbOpponents] = opponent; - nbOpponents ++; - opponent = source->getNextOpponent(opponent); - } - }else if (newPhase == Constants::MTG_PHASE_COMBATEND){ - for (int i = 0; i < nbOpponents ; i++){ - game->mLayers->stackLayer()->addPutInGraveyard(opponents[i]); - } - } - } - } - - int testDestroy(){ - if(!game->isInPlay(source) && currentPhase != Constants::MTG_PHASE_UNTAP){ - return 0; - }else{ - return MTGAbility::testDestroy(); - } - } - - virtual ostream& toString(ostream& out) const - { - out << "AAbomination ::: opponents : " << opponents - << " ; nbOpponents : " << nbOpponents - << " ("; - return MTGAbility::toString(out) << ")"; - } - - AAbomination * clone() const{ - AAbomination * a = NEW AAbomination(*this); - a->isClone = 1; - return a; - } -}; - - #endif diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 8237bdc04..84d907417 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -983,11 +983,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ break; } - case 1197: //Creature Bond - { - game->addObserver(NEW ACreatureBond(_id,card, card->target)); - break; - } case 1103: //Crystal Rod { int cost[] = {Constants::MTG_COLOR_ARTIFACT, 1}; @@ -1063,11 +1058,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(ability); break; } - case 1115: //Ivory Tower - { - game->addObserver(NEW ALifeZoneLink(_id ,card, Constants::MTG_PHASE_UPKEEP, 4, 1, 1)); - break; - } case 1117: //Jandors Ring { game->addObserver(NEW AJandorsRing( _id, card)); @@ -1267,36 +1257,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AControlStealAura(_id, card, card->target)); break; } - case 1218: //Psychic Venom - { - game->addObserver(NEW APsychicVenom(_id, card, card->target)); - break; - } - case 1226: //Steal Artifact - { - game->addObserver( NEW AControlStealAura(_id, card, card->target)); - break; - } case 1235: //Aspect of Wolf { game->addObserver(NEW AAspectOfWolf(_id, card, card->target)); break; } - case 1262: //Regeneration - { - int cost[] = {Constants::MTG_COLOR_GREEN, 1}; - game->addObserver(NEW AStandardRegenerate(_id,card,card->target,NEW ManaCost(cost,1))); - break; - } - - case 1266: //stream of life - { - int x = computeX(spell,card); - spell->getNextPlayerTarget()->life += x; - break; - } - - case 1231: //Volcanic Eruption { int x = computeX(spell,card); @@ -1319,7 +1284,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } break; } - case 1285: //Dwarven Warriors { CreatureTargetChooser * tc = NEW CreatureTargetChooser(card); @@ -1368,14 +1332,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AStasis(_id, card)); break; } - - case 1367: //Swords to Plowshares - { - Player * p = card->target->controller(); - p->life+= card->target->power; - p->game->putInZone(card->target,p->game->inPlay,card->owner->game->removedFromGame); - break; - } case 1267: //Thicket Basilic { game->addObserver(NEW AOldSchoolDeathtouch(_id,card)); @@ -1393,11 +1349,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } //Addons Legends - case 1427: //Abomination (does not work make the game crash) - { - game->addObserver(NEW AAbomination(_id,card)); - break; - } case 1533: //Livingplane { game->addObserver(NEW AConvertLandToCreatures(id, card, "land")); @@ -1456,14 +1407,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ break; } -//---addon Alliance--- - - case 3194: // Exile - { - game->currentlyActing()->life+=card->target->toughness; - break; - } - // --- addon Mirage --- case 3410: //Seed of Innocence