added support for doubling cube, recoded the curses to follow the rules better, with the exception of 1 which can not quite be supported
Curse of Oblivion moved back to unsupported. added support for targeting a zone by targeting a player... any time you have targeted a player, you can access items in thier zones by using targetedpersonsZONE targetedpersonsbattlefield for example... added "targetedplayer" as a targetchooser and who. added "mycurses" targetchooser. added "targetedcurses" word variable.
This commit is contained in:
@@ -614,6 +614,7 @@ void GameObserver::gameStateBasedEffects()
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
MTGGameZone * zone = players[i]->game->inPlay;
|
||||
players[i]->curses.clear();
|
||||
for (int j = zone->nb_cards - 1; j >= 0; j--)
|
||||
{
|
||||
MTGCardInstance * card = zone->cards[j];
|
||||
@@ -634,6 +635,10 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
card->target->enchanted = true;
|
||||
}
|
||||
if (card->playerTarget && card->hasType("curse"))
|
||||
{
|
||||
card->playerTarget->curses.push_back(card);
|
||||
}
|
||||
///////////////////////////
|
||||
//reset extracost shadows//
|
||||
///////////////////////////
|
||||
@@ -1263,6 +1268,8 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
|
||||
else
|
||||
{
|
||||
result = targetChooser->toggleTarget(clickedPlayer);
|
||||
if(card)
|
||||
card->playerTarget = clickedPlayer;
|
||||
}
|
||||
if (result == TARGET_OK_FULL)
|
||||
card = cardWaitingForTargets;
|
||||
|
||||
@@ -748,6 +748,8 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string magicText, int
|
||||
who = -1;
|
||||
if (s.find(" targetcontroller") != string::npos)
|
||||
who = -2;
|
||||
if (s.find(" targetedplayer") != string::npos)
|
||||
who = -3;
|
||||
|
||||
//Next Time...
|
||||
found = s.find("next");
|
||||
@@ -1747,6 +1749,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
who = TargetChooser::OPPONENT;
|
||||
if (s.find(" targetcontroller") != string::npos)
|
||||
who = TargetChooser::TARGET_CONTROLLER;
|
||||
if (s.find(" targetedplayer") != string::npos)
|
||||
who = TargetChooser::TARGETED_PLAYER;
|
||||
if (s.find(" owner") != string::npos)
|
||||
who = TargetChooser::OWNER;
|
||||
|
||||
@@ -2512,7 +2516,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
ManaCost * output = ManaCost::parseManaCost(s.substr(found),NULL,card);
|
||||
Targetable * t = spell ? spell->getNextTarget() : NULL;
|
||||
MTGAbility * a = NEW AManaProducer(observer, id, card, t, output, NULL, who);
|
||||
MTGAbility * a = NEW AManaProducer(observer, id, card, t, output, NULL, who,s.substr(found));
|
||||
a->oneShot = 1;
|
||||
if(newName.size())
|
||||
((AManaProducer*)a)->menutext = newName;
|
||||
@@ -3649,13 +3653,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Addons ICE-AGE Cards
|
||||
|
||||
case 2474: //Minion of Leshrac
|
||||
{
|
||||
observer->addObserver(NEW AMinionofLeshrac(observer, _id, card));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2732: //Kjeldoran Frostbeast
|
||||
{
|
||||
@@ -4402,6 +4399,11 @@ int TargetAbility::resolve()
|
||||
//do nothing if the target controller responded by phasing out the target.
|
||||
if (dynamic_cast<MTGCardInstance *>(t) && ((MTGCardInstance*)t)->isPhased)
|
||||
return 0;
|
||||
Player * targetedPlyr = dynamic_cast<Player *>(t);
|
||||
if (targetedPlyr)
|
||||
{
|
||||
source->playerTarget = targetedPlyr;
|
||||
}
|
||||
if (ability->oneShot)
|
||||
{
|
||||
while(t)
|
||||
@@ -4774,6 +4776,13 @@ TriggerAtPhase::TriggerAtPhase(GameObserver* observer, int id, MTGCardInstance *
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
case -3:
|
||||
if (source->playerTarget)
|
||||
{
|
||||
if (game->currentPlayer == source->playerTarget)
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = 1;
|
||||
break;
|
||||
@@ -4965,14 +4974,14 @@ GenericTriggeredAbility* GenericTriggeredAbility::clone() const
|
||||
*/
|
||||
|
||||
AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost,
|
||||
int who) :
|
||||
int who,string producing) :
|
||||
ActivatedAbilityTP(observer, id, card, t, _cost, who)
|
||||
{
|
||||
|
||||
aType = MTGAbility::MANA_PRODUCER;
|
||||
setCost(_cost);
|
||||
output = _output;
|
||||
|
||||
Producing = producing;
|
||||
menutext = "";
|
||||
}
|
||||
|
||||
@@ -5028,6 +5037,9 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
|
||||
{
|
||||
WResourceManager::Instance()->PlaySample("mana.wav");
|
||||
}
|
||||
if(Producing.size())
|
||||
if(Producing.find("manapool") != string::npos)//unique card doubling cube.
|
||||
output->copy(source->controller()->getManaPool());
|
||||
return ActivatedAbility::activateAbility();
|
||||
}
|
||||
|
||||
@@ -5089,6 +5101,8 @@ Targetable * AbilityTP::getTarget()
|
||||
return source->controller()->opponent();
|
||||
case TargetChooser::OWNER:
|
||||
return source->owner;
|
||||
case TargetChooser::TARGETED_PLAYER:
|
||||
return source->playerTarget;
|
||||
default:
|
||||
return target;
|
||||
}
|
||||
@@ -5114,6 +5128,8 @@ Targetable * ActivatedAbilityTP::getTarget()
|
||||
return source->controller()->opponent();
|
||||
case TargetChooser::OWNER:
|
||||
return source->owner;
|
||||
case TargetChooser::TARGETED_PLAYER:
|
||||
return source->playerTarget;
|
||||
default:
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -881,7 +881,6 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
|
||||
MTGGameZone * result = intToZone(zoneId, p, p2);
|
||||
if (result) return result;
|
||||
|
||||
switch (zoneId)
|
||||
{
|
||||
case TARGET_OWNER_GRAVEYARD:
|
||||
@@ -890,11 +889,19 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
return target->owner->game->graveyard;
|
||||
case OWNER_GRAVEYARD:
|
||||
return target->owner->game->graveyard;
|
||||
case TARGETED_PLAYER_GRAVEYARD:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->graveyard;
|
||||
else return source->controller()->game->graveyard;
|
||||
|
||||
case TARGET_OWNER_BATTLEFIELD:
|
||||
return target->owner->game->inPlay;
|
||||
case OWNER_BATTLEFIELD:
|
||||
return target->owner->game->inPlay;
|
||||
case TARGETED_PLAYER_BATTLEFIELD:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->inPlay;
|
||||
else return source->controller()->game->inPlay;
|
||||
|
||||
case TARGET_OWNER_HAND:
|
||||
return target->owner->game->hand;
|
||||
@@ -902,6 +909,10 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
return target->owner->game->hand;
|
||||
case OWNER_HAND:
|
||||
return target->owner->game->hand;
|
||||
case TARGETED_PLAYER_HAND:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->hand;
|
||||
else return source->controller()->game->hand;
|
||||
|
||||
case TARGET_OWNER_EXILE:
|
||||
return target->owner->game->removedFromGame;
|
||||
@@ -909,16 +920,28 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
return target->owner->game->removedFromGame;
|
||||
case OWNER_EXILE:
|
||||
return target->owner->game->removedFromGame;
|
||||
case TARGETED_PLAYER_EXILE:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->removedFromGame;
|
||||
else return source->controller()->game->removedFromGame;
|
||||
|
||||
case TARGET_OWNER_LIBRARY:
|
||||
return target->owner->game->library;
|
||||
case OWNER_LIBRARY:
|
||||
return target->owner->game->library;
|
||||
case TARGETED_PLAYER_LIBRARY:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->library;
|
||||
else return source->controller()->game->library;
|
||||
|
||||
case TARGET_OWNER_STACK:
|
||||
return target->owner->game->stack;
|
||||
case OWNER_STACK:
|
||||
return target->owner->game->stack;
|
||||
case TARGETED_PLAYER_STACK:
|
||||
if(source->playerTarget)
|
||||
return source->playerTarget->game->stack;
|
||||
else return source->controller()->game->stack;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -928,44 +951,44 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
int MTGGameZone::zoneStringToId(string zoneName)
|
||||
{
|
||||
const char * strings[] = { "mygraveyard", "opponentgraveyard", "targetownergraveyard", "targetcontrollergraveyard",
|
||||
"ownergraveyard", "graveyard",
|
||||
"ownergraveyard", "graveyard","targetedpersonsgraveyard",
|
||||
|
||||
"myinplay", "opponentinplay", "targetownerinplay", "targetcontrollerinplay", "ownerinplay", "inplay",
|
||||
"myinplay", "opponentinplay", "targetownerinplay", "targetcontrollerinplay", "ownerinplay", "inplay","targetedpersonsinplay",
|
||||
|
||||
"mybattlefield", "opponentbattlefield", "targetownerbattlefield", "targetcontrollerbattlefield",
|
||||
"ownerbattlefield", "battlefield",
|
||||
"ownerbattlefield", "battlefield","targetedpersonsbattlefield",
|
||||
|
||||
"myhand", "opponenthand", "targetownerhand", "targetcontrollerhand", "ownerhand", "hand",
|
||||
"myhand", "opponenthand", "targetownerhand", "targetcontrollerhand", "ownerhand", "hand","targetedpersonshand",
|
||||
|
||||
"mylibrary", "opponentlibrary", "targetownerlibrary", "targetcontrollerlibrary", "ownerlibrary", "library",
|
||||
"mylibrary", "opponentlibrary", "targetownerlibrary", "targetcontrollerlibrary", "ownerlibrary", "library","targetedpersonslibrary",
|
||||
|
||||
"myremovedfromgame", "opponentremovedfromgame", "targetownerremovedfromgame",
|
||||
"targetcontrollerremovedfromgame", "ownerremovedfromgame", "removedfromgame",
|
||||
"targetcontrollerremovedfromgame", "ownerremovedfromgame", "removedfromgame","targetedpersonsremovefromgame",
|
||||
|
||||
"myexile", "opponentexile", "targetownerexile", "targetcontrollerexile", "ownerexile", "exile",
|
||||
"myexile", "opponentexile", "targetownerexile", "targetcontrollerexile", "ownerexile", "exile","targetedpersonsexile",
|
||||
|
||||
"mystack", "opponentstack", "targetownerstack", "targetcontrollerstack", "ownerstack", "stack",
|
||||
"mystack", "opponentstack", "targetownerstack", "targetcontrollerstack", "ownerstack", "stack","targetedpersonsstack",
|
||||
|
||||
};
|
||||
|
||||
int values[] = { MY_GRAVEYARD, OPPONENT_GRAVEYARD, TARGET_OWNER_GRAVEYARD, TARGET_CONTROLLER_GRAVEYARD, OWNER_GRAVEYARD,
|
||||
GRAVEYARD,
|
||||
GRAVEYARD,TARGETED_PLAYER_GRAVEYARD,
|
||||
|
||||
MY_BATTLEFIELD, OPPONENT_BATTLEFIELD, TARGET_OWNER_BATTLEFIELD, TARGET_CONTROLLER_BATTLEFIELD,
|
||||
OWNER_BATTLEFIELD, BATTLEFIELD,
|
||||
OWNER_BATTLEFIELD, BATTLEFIELD,TARGETED_PLAYER_BATTLEFIELD,
|
||||
|
||||
MY_BATTLEFIELD, OPPONENT_BATTLEFIELD, TARGET_OWNER_BATTLEFIELD, TARGET_CONTROLLER_BATTLEFIELD,
|
||||
OWNER_BATTLEFIELD, BATTLEFIELD,
|
||||
OWNER_BATTLEFIELD, BATTLEFIELD,TARGETED_PLAYER_BATTLEFIELD,
|
||||
|
||||
MY_HAND, OPPONENT_HAND, TARGET_OWNER_HAND, TARGET_CONTROLLER_HAND, OWNER_HAND, HAND,
|
||||
MY_HAND, OPPONENT_HAND, TARGET_OWNER_HAND, TARGET_CONTROLLER_HAND, OWNER_HAND, HAND,TARGETED_PLAYER_HAND,
|
||||
|
||||
MY_LIBRARY, OPPONENT_LIBRARY, TARGET_OWNER_LIBRARY, TARGET_CONTROLLER_LIBRARY, OWNER_LIBRARY, LIBRARY,
|
||||
MY_LIBRARY, OPPONENT_LIBRARY, TARGET_OWNER_LIBRARY, TARGET_CONTROLLER_LIBRARY, OWNER_LIBRARY, LIBRARY,TARGETED_PLAYER_LIBRARY,
|
||||
|
||||
MY_EXILE, OPPONENT_EXILE, TARGET_OWNER_EXILE, TARGET_CONTROLLER_EXILE, OWNER_EXILE, EXILE,
|
||||
MY_EXILE, OPPONENT_EXILE, TARGET_OWNER_EXILE, TARGET_CONTROLLER_EXILE, OWNER_EXILE, EXILE,TARGETED_PLAYER_EXILE,
|
||||
|
||||
MY_EXILE, OPPONENT_EXILE, TARGET_OWNER_EXILE, TARGET_CONTROLLER_EXILE, OWNER_EXILE, EXILE,
|
||||
MY_EXILE, OPPONENT_EXILE, TARGET_OWNER_EXILE, TARGET_CONTROLLER_EXILE, OWNER_EXILE, EXILE,TARGETED_PLAYER_EXILE,
|
||||
|
||||
MY_STACK, OPPONENT_STACK, TARGET_OWNER_STACK, TARGET_CONTROLLER_STACK, OWNER_STACK, STACK, };
|
||||
MY_STACK, OPPONENT_STACK, TARGET_OWNER_STACK, TARGET_CONTROLLER_STACK, OWNER_STACK, STACK,TARGETED_PLAYER_STACK };
|
||||
|
||||
int max = sizeof(values) / sizeof *(values);
|
||||
|
||||
|
||||
@@ -82,11 +82,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
return NEW PlayerTargetChooser(observer, card, maxtargets); //Any player
|
||||
}
|
||||
|
||||
found = s.find("mycurses");
|
||||
if (found != string::npos)
|
||||
{
|
||||
int maxtargets = TargetChooser::UNLITMITED_TARGETS;
|
||||
return NEW myCursesChooser(observer, card, maxtargets);
|
||||
}
|
||||
|
||||
found = s.find("proliferation");
|
||||
if (found != string::npos)
|
||||
{
|
||||
int maxtargets = TargetChooser::UNLITMITED_TARGETS;
|
||||
return NEW ProliferateChooser(observer, card, maxtargets); //Any player
|
||||
return NEW ProliferateChooser(observer, card, maxtargets);
|
||||
}
|
||||
|
||||
string s1;
|
||||
@@ -1472,6 +1479,34 @@ bool TriggerTargetChooser::equals(TargetChooser * tc)
|
||||
return TargetChooser::equals(tc);
|
||||
}
|
||||
|
||||
/*my curses */
|
||||
bool myCursesChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
for(unsigned int i = 0;i < source->controller()->curses.size();++i)
|
||||
{
|
||||
MTGCardInstance * compare = source->controller()->curses[i];
|
||||
if(compare == dynamic_cast<MTGCardInstance*>(target))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
myCursesChooser* myCursesChooser::clone() const
|
||||
{
|
||||
myCursesChooser * a = NEW myCursesChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
bool myCursesChooser::equals(TargetChooser * tc)
|
||||
{
|
||||
|
||||
myCursesChooser * dtc = dynamic_cast<myCursesChooser *> (tc);
|
||||
if (!dtc)
|
||||
return false;
|
||||
|
||||
return TypeTargetChooser::equals(tc);
|
||||
}
|
||||
|
||||
/*Proliferate Target */
|
||||
bool ProliferateChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user