Added new primitives from LTR set, improved "steal" ability with "and" option, printed the nember of ring temptations on "The Ring" card, improved "hasdead" restriction to calculate if a card of a specific type has died during the current turn.
This commit is contained in:
@@ -9200,6 +9200,7 @@ ASeizeWrapper::ASeizeWrapper(GameObserver* observer, int _id, MTGCardInstance *
|
||||
InstantAbility(observer, _id, source, _target)
|
||||
{
|
||||
ability = NEW ASeize(observer, _id,card,_target);
|
||||
andAbility = NULL;
|
||||
}
|
||||
|
||||
int ASeizeWrapper::resolve()
|
||||
@@ -9207,6 +9208,20 @@ int ASeizeWrapper::resolve()
|
||||
ASeize * a = ability->clone();
|
||||
a->target = target;
|
||||
a->addToGame();
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
andAbilityClone->target = target;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -9220,12 +9235,15 @@ ASeizeWrapper * ASeizeWrapper::clone() const
|
||||
ASeizeWrapper * a = NEW ASeizeWrapper(*this);
|
||||
a->ability = this->ability->clone();
|
||||
a->oneShot = 1;
|
||||
if(andAbility)
|
||||
a->andAbility = andAbility->clone();
|
||||
return a;
|
||||
}
|
||||
|
||||
ASeizeWrapper::~ASeizeWrapper()
|
||||
{
|
||||
SAFE_DELETE(ability);
|
||||
SAFE_DELETE(andAbility);
|
||||
}
|
||||
|
||||
//AShackle
|
||||
|
||||
@@ -1887,9 +1887,11 @@ void CardGui::RenderCountersBig(MTGCard * mtgcard, const Pos& pos, int drawMode)
|
||||
if (!card)
|
||||
return;
|
||||
|
||||
if (!card->counters)
|
||||
int ringTemptations = card->controller()->ringTemptations;
|
||||
|
||||
if (!card->counters && !ringTemptations)
|
||||
return;
|
||||
if (!card->counters->mCount)
|
||||
if (!card->counters->mCount && !ringTemptations)
|
||||
return;
|
||||
|
||||
// Write Named Counters
|
||||
@@ -1904,6 +1906,73 @@ void CardGui::RenderCountersBig(MTGCard * mtgcard, const Pos& pos, int drawMode)
|
||||
i = txt.size() + 1;
|
||||
}
|
||||
|
||||
if (ringTemptations > 0 && card->name == "The Ring") // Added a label on Ring to show the number of temptations.
|
||||
{
|
||||
char buf[512];
|
||||
bool renderText = true;
|
||||
string gfx = "";
|
||||
if (counterGraphics.find("temptations") == counterGraphics.end())
|
||||
{
|
||||
string gfxRelativeName = "counters/";
|
||||
gfxRelativeName.append("temptations");
|
||||
gfxRelativeName.append(".png");
|
||||
string _gfx = WResourceManager::Instance()->graphicsFile(gfxRelativeName);
|
||||
if (!fileExists(_gfx.c_str()))
|
||||
_gfx = "";
|
||||
counterGraphics["temptations"] = _gfx;
|
||||
}
|
||||
gfx = counterGraphics["temptations"];
|
||||
if (gfx.size())
|
||||
renderText = false;
|
||||
|
||||
if (renderText)
|
||||
{
|
||||
std::string s = "temptations";
|
||||
s[0] = toupper(s[0]);
|
||||
sprintf(buf, _("%s: %i").c_str(), s.c_str(), ringTemptations);
|
||||
}
|
||||
|
||||
if (!gfx.size())
|
||||
{
|
||||
gfx = "counters/default.png";
|
||||
}
|
||||
|
||||
float x = pos.actX + (22 - BigWidth / 2) * pos.actZ;
|
||||
float y = pos.actY + (-BigHeight / 2 + 80 + 11 * i + 21 * 0) * pos.actZ;
|
||||
if (y > pos.actY + 105)
|
||||
{
|
||||
y = (-BigHeight / 2 + 80 + 11 * i) * pos.actZ + (y - 105 - 21);
|
||||
x += (BigWidth / 2) * pos.actZ;
|
||||
}
|
||||
|
||||
if (gfx.size())
|
||||
{
|
||||
JQuadPtr q = WResourceManager::Instance()->RetrieveTempQuad(gfx);
|
||||
|
||||
if (q.get() && q->mTex)
|
||||
{
|
||||
float scale = 20.f / q->mHeight;
|
||||
if (renderText)
|
||||
{
|
||||
float scaleX = (font->GetStringWidth(buf) + 20) / q->mWidth;
|
||||
JRenderer::GetInstance()->RenderQuad(q.get(), x, y, 0, scaleX, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
JRenderer::GetInstance()->RenderQuad(q.get(), x + (scale * q->mWidth * 0), y, 0, scale, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (renderText)
|
||||
{
|
||||
font->SetColor(ARGB(255,0,0,0));
|
||||
font->DrawString(buf, x + 5, y + 5);
|
||||
}
|
||||
|
||||
return; // No need to check counters on The Ring.
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < card->counters->counters.size(); t++)
|
||||
{
|
||||
Counter * c = card->counters->counters[t];
|
||||
|
||||
@@ -521,25 +521,25 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
if(check != string::npos)
|
||||
{
|
||||
bool hasdeadtype = false;
|
||||
string checktype = restriction[i].substr(7);
|
||||
for(int cp = 0;cp < 2;cp++)
|
||||
string checktype = "";
|
||||
Player * checkCurrent = NULL;
|
||||
if(restriction[i].find("oppo") != string::npos){
|
||||
checktype = restriction[i].substr(11);
|
||||
checkCurrent = card->controller()->opponent();
|
||||
} else {
|
||||
checktype = restriction[i].substr(9);
|
||||
checkCurrent = card->controller();
|
||||
}
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
for(unsigned int gy = 0; gy < grave->cardsSeenThisTurn.size(); gy++)
|
||||
{
|
||||
Player * checkCurrent = observer->players[cp];
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++)
|
||||
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
|
||||
if(checkCard->hasType(checktype) &&
|
||||
((checkCard->previousZone == checkCurrent->game->battlefield))) //died from battlefield
|
||||
{
|
||||
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
|
||||
if(checkCard->hasType(checktype) &&
|
||||
((checkCard->previousZone == checkCurrent->game->battlefield)||
|
||||
(checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield
|
||||
)
|
||||
{
|
||||
hasdeadtype = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hasdeadtype)
|
||||
hasdeadtype = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!hasdeadtype)
|
||||
return 0;
|
||||
@@ -5665,6 +5665,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
MTGAbility * a = NEW ASeizeWrapper(observer, id, card, target);
|
||||
a->oneShot = 1;
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((ASeizeWrapper*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user