Fixed/added primitives, added keyword to alter devotion count, added keyword to target cards with flashback cost, added "duplicatecounters(single)" keyword to add a counter of a specific kind already present on a permanent or a player.
This commit is contained in:
@@ -1133,6 +1133,44 @@ AAAlterSurveilOffset::~AAAlterSurveilOffset()
|
||||
{
|
||||
}
|
||||
|
||||
//AA Devotion Offset
|
||||
AAAlterDevotionOffset::AAAlterDevotionOffset(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int devotionOffset, ManaCost * _cost,
|
||||
int who) :
|
||||
ActivatedAbilityTP(observer, _id, _source, _target, _cost, who), devotionOffset(devotionOffset)
|
||||
{
|
||||
}
|
||||
|
||||
int AAAlterDevotionOffset::resolve()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
if (_target)
|
||||
{
|
||||
Player * pTarget = (Player*)_target;
|
||||
if(pTarget)
|
||||
{
|
||||
pTarget->devotionOffset += devotionOffset;
|
||||
if(pTarget->devotionOffset < 0)
|
||||
pTarget->devotionOffset = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string AAAlterDevotionOffset::getMenuText()
|
||||
{
|
||||
WParsedInt parsedNum(devotionOffset);
|
||||
return _(parsedNum.getStringValue() + " Devotion Offset ").c_str();
|
||||
}
|
||||
|
||||
AAAlterDevotionOffset * AAAlterDevotionOffset::clone() const
|
||||
{
|
||||
return NEW AAAlterDevotionOffset(*this);
|
||||
}
|
||||
|
||||
AAAlterDevotionOffset::~AAAlterDevotionOffset()
|
||||
{
|
||||
}
|
||||
|
||||
//AA Yidaro Count
|
||||
AAAlterYidaroCount::AAAlterYidaroCount(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int yidarocount, ManaCost * _cost,
|
||||
int who) :
|
||||
@@ -2376,6 +2414,7 @@ ActivatedAbility(observer, id, source, cost, 0)
|
||||
{
|
||||
this->GetId();
|
||||
allcounters = false;
|
||||
single = false;
|
||||
}
|
||||
|
||||
int AADuplicateCounters::resolve()
|
||||
@@ -2390,13 +2429,21 @@ int AADuplicateCounters::resolve()
|
||||
|
||||
if(pTarget && pTarget->poisonCount)
|
||||
{
|
||||
MTGAbility * a = NEW AAAlterPoison(game, game->mLayers->actionLayer()->getMaxId(), source, target, pTarget->poisonCount, NULL);
|
||||
MTGAbility * a = NULL;
|
||||
if(single)
|
||||
a = NEW AAAlterPoison(game, game->mLayers->actionLayer()->getMaxId(), source, target, pTarget->poisonCount, NULL);
|
||||
else
|
||||
a = NEW AAAlterPoison(game, game->mLayers->actionLayer()->getMaxId(), source, target, 1, NULL);
|
||||
a->oneShot = true;
|
||||
pcounters.push_back(a);
|
||||
}
|
||||
else if(pTarget && pTarget->energyCount)
|
||||
{
|
||||
MTGAbility * a = NEW AAAlterEnergy(game, game->mLayers->actionLayer()->getMaxId(), source, target, pTarget->energyCount, NULL);
|
||||
MTGAbility * a = NULL;
|
||||
if(single)
|
||||
a = NEW AAAlterEnergy(game, game->mLayers->actionLayer()->getMaxId(), source, target, 1, NULL);
|
||||
else
|
||||
a = NEW AAAlterEnergy(game, game->mLayers->actionLayer()->getMaxId(), source, target, pTarget->energyCount, NULL);
|
||||
a->oneShot = true;
|
||||
pcounters.push_back(a);
|
||||
}
|
||||
@@ -2406,7 +2453,11 @@ int AADuplicateCounters::resolve()
|
||||
for(size_t i = 0; i < counters->counters.size(); ++i)
|
||||
{
|
||||
Counter * counter = counters->counters[i];
|
||||
MTGAbility * a = NEW AACounter(game, game->mLayers->actionLayer()->getMaxId(), source, cTarget,"", counter->name.c_str(), counter->power, counter->toughness, counter->nb, 0);
|
||||
MTGAbility * a = NULL;
|
||||
if(single)
|
||||
a = NEW AACounter(game, game->mLayers->actionLayer()->getMaxId(), source, cTarget,"", counter->name.c_str(), counter->power, counter->toughness, 1, 0);
|
||||
else
|
||||
a = NEW AACounter(game, game->mLayers->actionLayer()->getMaxId(), source, cTarget,"", counter->name.c_str(), counter->power, counter->toughness, counter->nb, 0);
|
||||
a->oneShot = true;
|
||||
pcounters.push_back(a);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ CardDescriptor::CardDescriptor()
|
||||
zposComparisonMode = COMPARISON_NONE;
|
||||
zposition = -1;
|
||||
hasKickerCost = 0;
|
||||
hasFlashbackCost = 0;
|
||||
compareName ="";
|
||||
nameComparisonMode = COMPARISON_NONE;
|
||||
colorComparisonMode = COMPARISON_NONE;
|
||||
@@ -62,6 +63,11 @@ void CardDescriptor::unsecureSetHasKickerCost(int k)
|
||||
hasKickerCost = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetHasFlashbackCost(int k)
|
||||
{
|
||||
hasFlashbackCost = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetTapped(int i)
|
||||
{
|
||||
tapped = i;
|
||||
@@ -241,6 +247,11 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((hasFlashbackCost == -1 && card->getManaCost()->getFlashback()) || (hasFlashbackCost == 1 && !card->getManaCost()->getFlashback()))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped()))
|
||||
{
|
||||
match = NULL;
|
||||
|
||||
@@ -1503,6 +1503,18 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
cd.unsecureSetHasKickerCost(1);
|
||||
}
|
||||
}
|
||||
//Has kicker cost
|
||||
else if (attribute.find("hasflashback") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.unsecureSetHasFlashbackCost(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.unsecureSetHasFlashbackCost(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
|
||||
@@ -3488,7 +3488,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//set surveil offset controller (eg. Enhanced Surveillance)
|
||||
//set surveil offset of a player (eg. Enhanced Surveillance)
|
||||
vector<string> splitSurveilOffset = parseBetween(s, "altersurvoffset:", " ", false);
|
||||
if (splitSurveilOffset.size())
|
||||
{
|
||||
@@ -3499,6 +3499,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//set devotion offset of a player (eg. Altar of the Pantheon)
|
||||
vector<string> splitDevotionOffset = parseBetween(s, "alterdevoffset:", " ", false);
|
||||
if (splitDevotionOffset.size())
|
||||
{
|
||||
int devotionOffset = atoi(splitDevotionOffset[1].c_str());
|
||||
Targetable * t = spell ? spell->getNextTarget() : NULL;
|
||||
MTGAbility * a = NEW AAAlterDevotionOffset(observer, id, card, t, devotionOffset, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//prevent next damage
|
||||
vector<string> splitPrevent = parseBetween(s, "prevent:", " ", false);
|
||||
if (splitPrevent.size())
|
||||
@@ -3916,6 +3927,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
string counterString = splitDuplicateCounters[1];
|
||||
if(counterString.find("all") != string::npos)
|
||||
((AADuplicateCounters*)a)->allcounters = true;
|
||||
else if(counterString.find("single") != string::npos)
|
||||
((AADuplicateCounters*)a)->single = true;
|
||||
return a;
|
||||
}
|
||||
//remove single counter of any type
|
||||
|
||||
@@ -39,6 +39,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
numOfCommandCast = 0;
|
||||
monarch = 0;
|
||||
surveilOffset = 0;
|
||||
devotionOffset = 0;
|
||||
epic = 0;
|
||||
forcefield = 0;
|
||||
dealsdamagebycombat = 0;
|
||||
|
||||
@@ -606,6 +606,7 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
||||
p->numOfCommandCast = initState.playerData[i].player->numOfCommandCast;
|
||||
p->monarch = initState.playerData[i].player->monarch;
|
||||
p->surveilOffset = initState.playerData[i].player->surveilOffset;
|
||||
p->devotionOffset = initState.playerData[i].player->devotionOffset;
|
||||
if (initState.playerData[i].player->mAvatarName.size())
|
||||
{
|
||||
p->mAvatarName = initState.playerData[i].player->mAvatarName;
|
||||
|
||||
@@ -542,6 +542,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->unsecureSetHasKickerCost(1);
|
||||
}
|
||||
}
|
||||
//Has flashback cost
|
||||
else if (attribute.find("hasflashback") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->unsecureSetHasFlashbackCost(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->unsecureSetHasFlashbackCost(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user