Merge pull request #962 from kevlahnota/master

minor fixes
This commit is contained in:
Anthony Calosa
2017-03-15 12:54:44 +08:00
committed by GitHub
10 changed files with 3372 additions and 87 deletions
@@ -137670,6 +137670,16 @@ power=2
toughness=2
[/card]
[card]
name=Zombie Scavengers
auto={E(creature[zpos=type:*:mygraveyard]|mygraveyard)}:regenerate
text=Exile the top creature card of your graveyard: Regenerate Zombie Scavengers.
mana={2}{B}
type=Creature
subtype=Zombie
power=3
toughness=1
[/card]
[card]
name=Zombie Trailblazer
auto={T(zombie|mybattlefield)}:ueot name(land becomes a swamp) loseabilities && losesubtypesof(land) && transforms((swamp)) target(land)
auto={T(zombie|mybattlefield)}:swampwalk target(creature)
File diff suppressed because it is too large Load Diff
+18 -14
View File
@@ -19,23 +19,27 @@ int AIPlayer::totalAIDecks = -1;
AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
: owner(owner), ability(NULL), player(NULL), click(c), target(t)
{
// useability tweak - assume that the user is probably going to want to see the full res card,
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
// This is a good intercept point, as the AI has committed to using this card.
// if we're not in text mode, always get the thumb
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
if (prefetch && WResourceManager::Instance()->IsThreaded())
{
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
if(owner->getObserver()->getResourceManager())
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
// also cache the large image if we're using kNormal mode
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
// useability tweak - assume that the user is probably going to want to see the full res card,
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
// This is a good intercept point, as the AI has committed to using this card.
// if we're not in text mode, always get the thumb
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
{
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
if(owner->getObserver()->getResourceManager())
owner->getObserver()->getResourceManager()->RetrieveCard(c);
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
// also cache the large image if we're using kNormal mode
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
{
if(owner->getObserver()->getResourceManager())
owner->getObserver()->getResourceManager()->RetrieveCard(c);
}
}
}
}
+2 -1
View File
@@ -1041,7 +1041,8 @@ void ActionStack::Update(float dt)
return;
if (observer->mLayers->actionLayer()->menuObject || observer->LPWeffect)
return;//dont do any of this if a menuobject exist.
if(observer->players[0]->isHuman() || observer->players[1]->isHuman())
return;//dont do any of this if a menuobject exist.
askIfWishesToInterrupt = NULL;
//modal = 0;
+1 -1
View File
@@ -86,7 +86,7 @@ void CarouselDeckView::Render()
{
// even though we want to draw the cards in a particular z order for layering, we want to prefetch them
// in a different order, ie the center card should appear first, then the adjacent ones
bool prefetch = options[Options::CARDPREFETCHING].number?false:true;
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
if (prefetch && WResourceManager::Instance()->IsThreaded())
{
WResourceManager::Instance()->RetrieveCard(mCards[0].card);
-20
View File
@@ -1028,26 +1028,6 @@ void GameObserver::gameStateBasedEffects()
c->ProvokeTarget = NULL;
c->Provoker = NULL;
}
for (int jj = z->nb_cards - 1; jj >= 0; jj--)
{
MTGCardInstance * c = z->cards[jj];
if(c && !c->isPhased)
{
if (c->has(Constants::TREASON))
{
MTGCardInstance * beforeCard = c;
p->game->putInZone(c, c->currentZone, c->owner->game->graveyard);
WEvent * e = NEW WEventCardSacrifice(beforeCard,c);
receiveEvent(e);
}
if (c->has(Constants::UNEARTH))
{
p->game->putInZone(c, c->currentZone, c->owner->game->exile);
}
}
}
MTGGameZone * f = p->game->graveyard;
for (int k = 0; k < f->nb_cards; k++)
+1 -1
View File
@@ -108,7 +108,7 @@ void GridDeckView::Render()
int firstVisibleCard = 2;
int lastVisibleCard = mCards.size() - 2;
bool mode = options[Options::GDVLARGEIMAGE].number?false:true;
bool prefetch = options[Options::CARDPREFETCHING].number?false:true;
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
if(!mScrollEasing.finished())
{
+16 -12
View File
@@ -249,27 +249,31 @@ void MTGPlayerCards::drawFromLibrary()
toMove->miracle = true;
}
// useability tweak - assume that the user is probably going to want to see the new card,
// so prefetch it.
// if we're not in text mode, always get the thumb
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
&& library->owner->getObserver()->getResourceManager())
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
if (prefetch && WResourceManager::Instance()->IsThreaded())
{
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
// useability tweak - assume that the user is probably going to want to see the new card,
// so prefetch it.
// also cache the large image if we're using kNormal mode
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
// if we're not in text mode, always get the thumb
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
&& library->owner->getObserver()->getResourceManager())
{
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
// also cache the large image if we're using kNormal mode
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
{
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
}
}
}
if(putInZone(toMove, library, hand))
{
toMove->currentZone = hand;
}
}
}
void MTGPlayerCards::resetLibrary()
+36
View File
@@ -2531,7 +2531,11 @@ int MTGMomirRule::reactToClick(MTGCardInstance * card_to_discard, int cardId)
tokCreate = af.parseMagicLine(abi,game->mLayers->actionLayer()->getMaxId(),NULL, card->clone());
tokCreate->aType = MTGAbility::FORCED_TOKEN_CREATOR;
if(tokCreate)
{
if(tokCreate->source)
tokCreate->source->owner = player;
tokCreate->fireAbility();
}
alreadyplayed = 1;
textAlpha = 255;
@@ -3281,6 +3285,38 @@ int MTGUnearthRule::receiveEvent(WEvent * event)
}
}
}
else if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event))
{
if (MTG_PHASE_ENDOFTURN == pe->from->id)
{
bool found = false;
for (int i = 0; i < 2; i++)
{
MTGGameZone * z = game->players[i]->game->inPlay;
for (int j = z->nb_cards - 1; j >= 0; j--)
{
MTGCardInstance * c = z->cards[j];
if(c && c->has(Constants::UNEARTH) && !c->isPhased)
{
found = true;
c->controller()->game->putInZone(c, c->currentZone, c->owner->game->exile);
}
else if(c && c->has(Constants::TREASON) && !c->isPhased)
{
found = true;
MTGCardInstance * beforeCard = c;
c->controller()->game->putInZone(c, c->currentZone, c->owner->game->graveyard);
WEvent * e = NEW WEventCardSacrifice(beforeCard,c);
game->receiveEvent(e);
}
}
}
if(found)
return 1;
}
return 0;
}
return 0;
}
+10 -10
View File
@@ -40,28 +40,28 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
return NEW dredgeChooser(observer,zones,nbzones, card, maxtargets);
}
found = s.find("mytgt");
if (found == 0)
{
MTGCardInstance * target = card->target;
if (ability) target = (MTGCardInstance *) (ability->target);
return NEW CardTargetChooser(observer, target, card);
};
found = s.find("mychild");
if (found == 0)
if (found != string::npos)
{
int maxtargets = 1;
return NEW ChildrenChooser(observer, card, maxtargets);
};
found = s.find("mytotem");
if (found == 0)
if (found != string::npos)
{
int maxtargets = 1;
return NEW TotemChooser(observer, card, maxtargets);
};
found = s.find("mytgt");
if (found == 0)
{
MTGCardInstance * target = card->target;
if (ability) target = (MTGCardInstance *) (ability->target);
return NEW CardTargetChooser(observer, target, card);
};
found = s.find("targetedplayer");
if (found == 0)
{