Fixed LTC and SIR dat files, added new primitives from LTR set, implemented the new abilities and trigers related to ring bearer and ring temptations for LTR and LTC sets.
This commit is contained in:
@@ -1066,6 +1066,88 @@ AAAlterPoison::~AAAlterPoison()
|
||||
{
|
||||
}
|
||||
|
||||
//AA Bearer Chosen
|
||||
AARingBearerChosen::AARingBearerChosen(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
|
||||
ActivatedAbility(observer, _id, _source, _cost, 0)
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
}
|
||||
|
||||
int AARingBearerChosen::resolve()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if(_target)
|
||||
{
|
||||
MTGCardInstance * currentBearer = NULL;
|
||||
for (int j = _target->controller()->game->inPlay->nb_cards - 1; j >= 0; --j){
|
||||
if(_target->controller()->game->inPlay->cards[j]->basicAbilities[Constants::RINGBEARER] == 1){
|
||||
currentBearer = _target->controller()->game->inPlay->cards[j];
|
||||
_target->controller()->game->inPlay->cards[j]->basicAbilities[Constants::RINGBEARER] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_target->basicAbilities[Constants::RINGBEARER] = 1;
|
||||
bool bearerChanged = false;
|
||||
if(currentBearer == NULL || currentBearer != _target){
|
||||
for (int j = _target->controller()->game->inPlay->nb_cards - 1; j >= 0; --j){
|
||||
if(_target->controller()->game->inPlay->cards[j]->name == "The Ring"){
|
||||
for (size_t i = 1; i < game->mLayers->actionLayer()->mObjects.size(); i++)
|
||||
{
|
||||
MTGAbility * a = ((MTGAbility *) game->mLayers->actionLayer()->mObjects[i]);
|
||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||
if (eq && eq->source == _target->controller()->game->inPlay->cards[j])
|
||||
{
|
||||
((AEquip*)a)->unequip();
|
||||
((AEquip*)a)->equip(_target);
|
||||
bearerChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
WEventCardBearerChosen * e = NEW WEventCardBearerChosen(_target);
|
||||
e->bearerChanged = bearerChanged;
|
||||
game->receiveEvent(e);
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
andAbilityClone->target = _target;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string AARingBearerChosen::getMenuText()
|
||||
{
|
||||
return "The Ring bearer has been chosen";
|
||||
}
|
||||
|
||||
AARingBearerChosen * AARingBearerChosen::clone() const
|
||||
{
|
||||
AARingBearerChosen * a = NEW AARingBearerChosen(*this);
|
||||
if(andAbility)
|
||||
a->andAbility = andAbility->clone();
|
||||
return a;
|
||||
}
|
||||
|
||||
AARingBearerChosen::~AARingBearerChosen()
|
||||
{
|
||||
SAFE_DELETE(andAbility);
|
||||
}
|
||||
|
||||
//AA Explores Event
|
||||
AAExploresEvent::AAExploresEvent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost,
|
||||
int who) :
|
||||
@@ -1330,6 +1412,64 @@ AAAlterYidaroCount::~AAAlterYidaroCount()
|
||||
{
|
||||
}
|
||||
|
||||
//AA Ring Temptations
|
||||
AAAlterRingTemptations::AAAlterRingTemptations(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int temptations, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(observer, _id, _source, _target, _cost, who), temptations(temptations)
|
||||
{
|
||||
andAbility = NULL;
|
||||
}
|
||||
|
||||
int AAAlterRingTemptations::resolve()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
if (_target)
|
||||
{
|
||||
Player * pTarget = (Player*)_target;
|
||||
if(pTarget)
|
||||
{
|
||||
pTarget->ringTemptations += temptations;
|
||||
if(pTarget->ringTemptations < 0)
|
||||
pTarget->ringTemptations = 0;
|
||||
WEvent * e = NEW WEventplayerTempted(pTarget);
|
||||
game->receiveEvent(e);
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
andAbilityClone->target = _target;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string AAAlterRingTemptations::getMenuText()
|
||||
{
|
||||
return "The Ring tempts you";
|
||||
}
|
||||
|
||||
AAAlterRingTemptations * AAAlterRingTemptations::clone() const
|
||||
{
|
||||
AAAlterRingTemptations * a = NEW AAAlterRingTemptations(*this);
|
||||
if(andAbility)
|
||||
a->andAbility = andAbility->clone();
|
||||
return a;
|
||||
}
|
||||
|
||||
AAAlterRingTemptations::~AAAlterRingTemptations()
|
||||
{
|
||||
SAFE_DELETE(andAbility);
|
||||
}
|
||||
|
||||
//AA Monarch
|
||||
AAAlterMonarch::AAAlterMonarch(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost,
|
||||
int who) :
|
||||
|
||||
@@ -1527,6 +1527,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
return NEW TrplayerProliferated(observer, id, card, tc, once, false, true);
|
||||
}
|
||||
|
||||
//ring temptations - controller of card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "ringtemptedof", card))
|
||||
return NEW TrplayerTempted(observer, id, card, tc, once, true, false);
|
||||
|
||||
//ring temptations - opponent of card controller
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "ringtemptedfoeof", card))
|
||||
return NEW TrplayerTempted(observer, id, card, tc, once, false, true);
|
||||
|
||||
//becomes monarch - controller of card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "becomesmonarchof", card))
|
||||
return NEW TrplayerMonarch(observer, id, card, tc, once, true, false);
|
||||
@@ -1540,7 +1548,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
return NEW TrplayerInitiative(observer, id, card, tc, once, true, false);
|
||||
|
||||
//takes the initiative - opponent of card controller
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "takeninitiativeof", card))
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "takeninitiativefoeof", card))
|
||||
return NEW TrplayerInitiative(observer, id, card, tc, once, false, true);
|
||||
|
||||
//shuffled library - controller of card
|
||||
@@ -1595,10 +1603,18 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "ninjutsued", card))
|
||||
return NEW TrCardNinja(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//Esplores has been performed from a cardr
|
||||
//Explores has been performed from a card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "explored", card))
|
||||
return NEW TrCardExplored(observer, id, card, tc, once, limitOnceATurn);
|
||||
|
||||
//A Ring bearer has been chosen
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "bearerchosen", card))
|
||||
return NEW TrCardBearerChosen(observer, id, card, tc, once, limitOnceATurn, false);
|
||||
|
||||
//A different Ring bearer has been chosen
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "bearernewchosen", card))
|
||||
return NEW TrCardBearerChosen(observer, id, card, tc, once, limitOnceATurn, true);
|
||||
|
||||
//Dungeon has been completer from a card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "dungeoncompleted", card)){
|
||||
int totaldng = 0;
|
||||
@@ -4293,6 +4309,28 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//Ring temptations
|
||||
vector<string> splitRingTemptations = parseBetween(s, "theringtempts:", " ", false);
|
||||
if (splitRingTemptations.size())
|
||||
{
|
||||
int temptations = 1;
|
||||
WParsedInt* parser = NEW WParsedInt(splitRingTemptations[1], card);
|
||||
if(parser){
|
||||
temptations = parser->intValue;
|
||||
SAFE_DELETE(parser);
|
||||
}
|
||||
Targetable * t = spell ? spell->getNextTarget() : NULL;
|
||||
MTGAbility * a = NEW AAAlterRingTemptations(observer, id, card, t, temptations, NULL, who);
|
||||
a->oneShot = 1;
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((AAAlterRingTemptations*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
//becomes monarch
|
||||
vector<string> splitMonarch = parseBetween(s, "becomesmonarch", " ", false);
|
||||
if (splitMonarch.size())
|
||||
@@ -4376,6 +4414,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//becomes the Ring bearer
|
||||
found = s.find("becomesringbearer");
|
||||
if (found != string::npos)
|
||||
{
|
||||
MTGAbility * a = NEW AARingBearerChosen(observer, id, card, target, NULL);
|
||||
a->oneShot = 1;
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((AARingBearerChosen*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
//set surveil offset of a player (eg. Enhanced Surveillance)
|
||||
vector<string> splitSurveilOffset = parseBetween(s, "altersurvoffset:", " ", false);
|
||||
if (splitSurveilOffset.size())
|
||||
|
||||
@@ -267,7 +267,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"poisonseventoxic", // Card has toxic 7
|
||||
"poisoneighttoxic", // Card has toxic 8
|
||||
"poisonninetoxic", // Card has toxic 9
|
||||
"poisontentoxic" // Card has toxic 10
|
||||
"poisontentoxic", // Card has toxic 10
|
||||
"ringbearer" // The creature is The Ring bearer.
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -37,6 +37,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
energyCount = 0;
|
||||
experienceCount = 0;
|
||||
yidaroCount = 0;
|
||||
ringTemptations = 0;
|
||||
dungeonCompleted = 0;
|
||||
numOfCommandCast = 0;
|
||||
monarch = 0;
|
||||
|
||||
@@ -667,6 +667,7 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
||||
p->energyCount = initState.playerData[i].player->energyCount;
|
||||
p->experienceCount = initState.playerData[i].player->experienceCount;
|
||||
p->yidaroCount = initState.playerData[i].player->yidaroCount;
|
||||
p->ringTemptations = initState.playerData[i].player->ringTemptations;
|
||||
p->dungeonCompleted = initState.playerData[i].player->dungeonCompleted;
|
||||
p->numOfCommandCast = initState.playerData[i].player->numOfCommandCast;
|
||||
p->monarch = initState.playerData[i].player->monarch;
|
||||
|
||||
@@ -317,6 +317,11 @@ WEventplayerMonarch::WEventplayerMonarch(Player * player) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventplayerTempted::WEventplayerTempted(Player * player) :
|
||||
player(player)
|
||||
{
|
||||
}
|
||||
|
||||
WEventplayerProliferated::WEventplayerProliferated(Player * player) :
|
||||
player(player)
|
||||
{
|
||||
@@ -372,6 +377,11 @@ WEventCardExplored::WEventCardExplored(MTGCardInstance * card) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardBearerChosen::WEventCardBearerChosen(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardDungeonCompleted::WEventCardDungeonCompleted(MTGCardInstance * card, int totaldng, string playerName) :
|
||||
WEventCardUpdate(card), totaldng(totaldng), playerName(playerName)
|
||||
{
|
||||
@@ -668,6 +678,12 @@ Targetable * WEventCardExplored::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardBearerChosen::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardDungeonCompleted::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
@@ -716,6 +732,12 @@ Targetable * WEventplayerMonarch::getTarget(Player * player)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventplayerTempted::getTarget(Player * player)
|
||||
{
|
||||
if (player) return player;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventplayerProliferated::getTarget(Player * player)
|
||||
{
|
||||
if (player) return player;
|
||||
|
||||
@@ -1642,6 +1642,10 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s == "pringtemptations" || s == "oringtemptations") // How many times the player has been tempted by the Ring.
|
||||
{
|
||||
intValue = (s == "pringtemptations")?card->controller()->ringTemptations:card->controller()->opponent()->ringTemptations;
|
||||
}
|
||||
else if(!intValue)//found nothing, try parsing a atoi
|
||||
{
|
||||
intValue = atoi(s.c_str());
|
||||
|
||||
Reference in New Issue
Block a user