hide cards using necroed
also fix castcard target if its a land.
This commit is contained in:
Anthony Calosa
2017-02-15 10:27:56 +08:00
parent a9b42127d1
commit 60d7675a36
6 changed files with 65 additions and 16 deletions

View File

@@ -2115,6 +2115,7 @@ public:
class AAMover: public ActivatedAbility
{
public:
bool necro;
string destination;
MTGAbility * andAbility;
string named;

View File

@@ -265,7 +265,8 @@ class Constants
CANTCREW = 143,
HIDDENFACE = 144,
ANYTYPEOFMANA = 145,
NB_BASIC_ABILITIES = 146,
NECROED = 146,
NB_BASIC_ABILITIES = 147,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics

View File

@@ -4391,6 +4391,7 @@ AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTG
andAbility = NULL;
if(!named.size() && source->controller()->isAI())
named = overrideNamed(destination);
necro = false;
}
MTGGameZone * AAMover::destinationZone(Targetable * target)
@@ -4411,6 +4412,8 @@ int AAMover::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
if(necro)
_target->basicAbilities[Constants::NECROED] = 1;
Player* p = _target->controller();
if (p)
{
@@ -4496,18 +4499,23 @@ int AAMover::resolve()
MTGCardInstance *newTarget = p->game->putInZone(_target, fromZone, destZone);
/*while(_target->next)
_target = _target->next;*/
if(andAbility)
if(newTarget)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = newTarget;
if(andAbility->oneShot)
if(necro)
newTarget->basicAbilities[Constants::NECROED] = 1;
if(andAbility)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = newTarget;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
}
}
@@ -8104,7 +8112,13 @@ int AACastCard::resolveSpell()
if (_target)
{
if (_target->isLand())
putinplay = true;
{
MTGCardInstance * copy = _target->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->battlefield,noEvent);
copy->changeController(source->controller(),true);
this->forceDestroy = true;
processed = true;
return 1;
}
Spell * spell = NULL;
MTGCardInstance * copy = NULL;

View File

@@ -502,16 +502,32 @@ void CardGui::Render()
}
}
//shadow that covers the whole card for targetchooser...
if (tc && !tc->canTarget(card))
{
if (!shadow)
shadow = card->getObserver()->getResourceManager()->GetQuad("shadow");
if (shadow)
{
shadow->SetColor(ARGB(200,255,255,255));
shadow->SetColor(ARGB(190,255,255,255));
renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
}
}
//for necro
if (!shadow)
shadow = card->getObserver()->getResourceManager()->GetQuad("shadow");
if (shadow)
{
int myA = 0;
if(game && card->has(Constants::NECROED))//no peeking...
myA = 255;
else
myA = 0;
shadow->SetColor(ARGB(myA,255,255,255));
renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
}
PlayGuiObject::Render();
}
@@ -1151,6 +1167,20 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB)
: WResourceManager::Instance()->RetrieveCard(card);
MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
GameObserver * game = NULL;
//TargetChooser * tc = NULL;
bool myA = true;
if(kcard)
{
game = kcard->getObserver();
if(game)
{
if(kcard->has(Constants::NECROED))
myA = false;
else
myA = true;
}
}
if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name)
{
MTGCard * fcard = MTGCollection()->getCardByName(kcard->name);
@@ -1162,7 +1192,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID))
: WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_NORMAL, 1, abs(kcard->copiedID));
}
if (quad.get())
if (quad.get() && myA)
{
if (quad->mHeight < quad->mWidth)
{
@@ -1216,7 +1246,8 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
//DebugTrace("Unable to fetch image: " << card->getImageName());
// If we come here, we do not have the picture.
AlternateRender(card, pos);
if(myA)
AlternateRender(card, pos);
}
string CardGui::FormattedData(string data, string replace, string value)

View File

@@ -2797,6 +2797,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = NEW AAMover(observer, id, card, target, splitMove[1],newName);
a->oneShot = true;
((AAMover*)a)->necro = s.find("hiddenmoveto") != string::npos?true:false;
if(storedAndAbility.size())
{
string stored = storedAndAbility;

View File

@@ -176,7 +176,8 @@ const char* Constants::MTGBasicAbilities[] = {
"oppnomaxhand",
"cantcrew",
"hiddenface",//test for hiding card
"anytypeofmana"
"anytypeofmana",
"necroed"//hide necored
};
map<string,int> Constants::MTGBasicAbilitiesMap;