diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index c3abb8dc3..d73069212 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2759,8 +2759,66 @@ public: } }; -// GiveLifeForTappedType +// People of the Woods +class APeopleOfTheWoods:public ListMaintainerAbility{ +public: + APeopleOfTheWoods(int _id, MTGCardInstance * _source):ListMaintainerAbility(_id, _source){ + } + int canBeInList(MTGCardInstance * card){ + if (source->controller()->game->inPlay->hasCard(card) && card->hasType("forest") ) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + source->addToToughness(1); + return 1; + } + + int removed(MTGCardInstance * card){ + source->addToToughness(-1); + return 1; + } + +}; + +//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 == MTG_PHASE_COMBATDAMAGE){ + nbOpponents = 0; + MTGCardInstance * opponent = source->getNextOpponent(); + while (opponent && opponent->hasColor(MTG_COLOR_GREEN) || opponent->hasColor(MTG_COLOR_WHITE)){ + opponents[nbOpponents] = opponent; + nbOpponents ++; + opponent = source->getNextOpponent(opponent); + } + }else if (newPhase == MTG_PHASE_COMBATEND){ + for (int i = 0; i < nbOpponents ; i++){ + game->mLayers->stackLayer()->addPutInGraveyard(opponents[i]); + } + } + } + } + + int testDestroy(){ + if(!game->isInPlay(source) && currentPhase != MTG_PHASE_UNTAP){ + return 0; + }else{ + return MTGAbility::testDestroy(); + } + } +}; + +// GiveLifeForTappedType class AGiveLifeForTappedType:public MTGAbility{ public: char type[20]; @@ -2854,4 +2912,116 @@ public: }; + +//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; + } + +}; + +//GenericKirdApe +class AGenericKirdApe:public MTGAbility{ +public: + int init; + char type [20]; + int power; + int toughness; + AGenericKirdApe(int _id, MTGCardInstance * _source, const char * _type, int _power, int _toughness):MTGAbility(_id, _source){ + init = 0; + } + + void Update(float dt){ + if (source->controller()->game->inPlay->hasType(type)){ + if(!init){ + init = 1; + source->power+=power; + source->addToToughness(toughness); + } + }else{ + if (init){ + init = 0; + source->power-=power; + source->addToToughness(-toughness); + } + } + } +}; + + +//Rampage ability Tentative 2 +class ARampageAbility:public MTGAbility{ +public: + int nbOpponents; + int PowerModifier; + int ToughnessModifier; + int modifier; + ARampageAbility(int _id, MTGCardInstance * _source,int _PowerModifier, int _ToughnessModifier):MTGAbility(_id, _source){ + modifier=0; + } + void Update(float dt){ + if (source->isAttacker()){ + MTGInPlay * inPlay = game->opponent()->game->inPlay; + for (int i = 0; i < inPlay->nb_cards; i ++){ + MTGCardInstance * current = inPlay->cards[i]; + if (current->isDefenser()){ + modifier++; + } + } + source->power+= (PowerModifier * modifier); + source->addToToughness(ToughnessModifier * modifier); + } + } +}; + + +//Rampage ability Tentative 1 - Did not work as expected +class A1RampageAbility:public MTGAbility{ +public: + MTGCardInstance * opponents[20]; + int nbOpponents; + int PowerModifier; + int ToughnessModifier; + A1RampageAbility(int _id, MTGCardInstance * _source,int _PowerModifier, int _ToughnessModifier):MTGAbility(_id, _source){ + nbOpponents = 0; + } + + void Update(float dt){ + if (source->isAttacker()){ + if (newPhase != currentPhase){ + if( newPhase == MTG_PHASE_COMBATDAMAGE){ + nbOpponents = 0; + MTGCardInstance * opponent = source->getNextOpponent(); + while (opponent){ + opponents[nbOpponents] = opponent; + nbOpponents ++; + source->power+= PowerModifier; + source->addToToughness(ToughnessModifier); + opponent = source->getNextOpponent(opponent); + } + } + } + } + } +}; + #endif diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index c0939e6ed..58bfc4805 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -93,8 +93,10 @@ static int _b[7] = {20, 0, 140,15, 50,255,128}; #define MOUNTAINHOME 33 #define SWAMPHOME 34 #define PLAINSHOME 35 +#define FLANKING 36 +#define RAMPAGE1 37 -#define NB_BASIC_ABILITIES 36 +#define NB_BASIC_ABILITIES 38 static const char * MTGBasicAbilities[] = { "trample", @@ -132,7 +134,9 @@ static const char * MTGBasicAbilities[] = { "islandhome", "moutainhome", "swamphome", -"plainshome" +"plainshome", +"flanking", +"rampage", }; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index e3bef1d38..9545e2f7e 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1286,7 +1286,61 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ destroyAllFromTypeInPlay("creature", card); //TODO -> bury !!! break; } +//Addons The Dark + case 1797: //Inferno does 6 damage to all players and all creatures. + { + for (int i = 0; i < 2 ; i++){ + game->mLayers->stackLayer()->addDamage(card, game->players[i], 6); + for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++){ + MTGCardInstance * current = game->players[i]->game->inPlay->cards[j]; + if (current->isACreature()){ + game->mLayers->stackLayer()->addDamage(card, current, 6); + } + } + } + break; + } + + case 1773 : //People of the Woods + { + game->addObserver(NEW APeopleOfTheWoods(_id, card)); + break; + } + + case 1818: //Tivadar's Crusade + { + destroyAllFromTypeInPlay("goblin", card); + break; + } + +//Addons Legends + case 1470: //Acid Rain + { + destroyAllFromTypeInPlay("forest", card); + break; + } + case 1427: //Abomination + { + game->addObserver(NEW AAbomination(_id,card)); + break; + } + case 1533: //Livingplane + { + game->addObserver(NEW AConvertLandToCreatures(id, card, "land")); + break; + } + case 1607: //Divine Offering + { + card->target->controller()->game->putInGraveyard(card->target); + game->currentlyActing()->life+= card->target->getManaCost()->getConvertedCost(); + break; + } + case 1625: //Lifeblood + { + game->addObserver(NEW AGiveLifeForTappedType (_id, card, "island")); + break; + } //Addons ICE-AGE Cards case 2631: //Jokulhaups { @@ -1385,6 +1439,13 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ break; } + /* Erwan - 2008/11/13: We want to get rid of these basicAbility things. + * basicAbilities themselves are alright, but creating new object depending on them is dangerous + * The main reason is that classes that add an ability to a card do NOT create these objects, and therefore do NOT + * Work. + * For example, setting LIFELINK for a creature is not enough right now... + * It shouldn't be necessary to add an object. State based abilities could do the trick + */ if (card->basicAbilities[LIFELINK]){ ALifeLink * ability = NEW ALifeLink(_id, card); game->addObserver(ability); @@ -1416,6 +1477,13 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ if (card->basicAbilities[PLAINSHOME]){ game->addObserver(NEW AStrongLandLinkCreature(_id, card,"plains")); } + + // New Abilities Flanking and Rampage + + if (card->basicAbilities [RAMPAGE1]){ + game->addObserver (NEW ARampageAbility(_id, card, 1, 1)); + } + //Instants are put in the graveyard automatically if that's not already done if (!putSourceInGraveyard){ if (card->hasType("instant") || card->hasType("sorcery")){