Merge pull request #7 from WagicProject/master

pull changes from master
This commit is contained in:
Anthony Calosa
2016-07-10 08:57:20 +08:00
committed by GitHub
10 changed files with 105 additions and 27 deletions
@@ -54596,6 +54596,14 @@ power=4
toughness=8 toughness=8
[/card] [/card]
[card] [card]
name=Isochron Scepter
auto=may imprint notatarget(instant[manacost<=2]|myhand)
auto={2}{t}:activate castcard(copied noevent named!:imprintedcard:!)
text=Imprint — When Isochron Scepter enters the battlefield, you may exile an instant card with converted mana cost 2 or less from your hand. -- {2}, {T}: You may copy the exiled card. If you do, you may cast the copy without paying its mana cost.
mana={2}
type=Artifact
[/card]
[card]
name=Isolated Chapel name=Isolated Chapel
auto=aslongas(plains,swamp|myBattlefield) tap(noevent) <1 oneshot auto=aslongas(plains,swamp|myBattlefield) tap(noevent) <1 oneshot
auto={T}:Add{W} auto={T}:Add{W}
@@ -102430,6 +102438,16 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Spellbinder
auto={4}:equip
auto=may imprint notatarget(instant|myhand)
auto=@combatdamaged(player) from(mytgt):activate castcard(copied noevent named!:imprintedcard:!)
text=Imprint — When Spellbinder enters the battlefield, you may exile an instant card from your hand. -- Whenever equipped creature deals combat damage to a player, you may copy the exiled card. If you do, you may cast the copy without paying its mana cost. -- Equip {4}
mana={3}
type=Artifact
subtype=Equipment
[/card]
[card]
name=Spell Blast name=Spell Blast
target=*[manacost=prex]|stack target=*[manacost=prex]|stack
auto=fizzle auto=fizzle
+3 -1
View File
@@ -3256,6 +3256,7 @@ public:
} }
else else
{ {
a->forcedAlive = 1;
a->addToGame(); a->addToGame();
abilities[d] = a; abilities[d] = a;
} }
@@ -3278,6 +3279,7 @@ public:
if (abilities.find(card) != abilities.end() if (abilities.find(card) != abilities.end()
&& !(forceDestroy == -1 && forcedAlive == 1)) //only embelms have forcedestroy = -1 and forcedalive = 1 && !(forceDestroy == -1 && forcedAlive == 1)) //only embelms have forcedestroy = -1 and forcedalive = 1
{ {
abilities[card]->forcedAlive = 0;
game->removeObserver(abilities[card]); game->removeObserver(abilities[card]);
abilities.erase(card); abilities.erase(card);
} }
@@ -6160,7 +6162,7 @@ public:
{ {
if(forceDestroy != -1) if(forceDestroy != -1)
return 1; return 1;
if(!(source->hasType(Subtypes::TYPE_INSTANT)||source->hasType(Subtypes::TYPE_INSTANT)) && !source->isInPlay(game)) if(!(source->hasType(Subtypes::TYPE_INSTANT)||source->hasType(Subtypes::TYPE_SORCERY)) && !source->isInPlay(game))
return 1; return 1;
return 0; return 0;
} }
+1
View File
@@ -124,6 +124,7 @@ class GameObserver{
void gameStateBasedEffects(); void gameStateBasedEffects();
void enchantmentStatus(); void enchantmentStatus();
void Affinity(); void Affinity();
bool AffinityNeedsUpdate;
void addObserver(MTGAbility * observer); void addObserver(MTGAbility * observer);
bool removeObserver(ActionElement * observer); bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules); void startGame(GameType, Rules * rules);
+7
View File
@@ -7189,6 +7189,13 @@ void AACastCard::Update(float dt)
return; return;
if(cardNamed.size() && !theNamedCard) if(cardNamed.size() && !theNamedCard)
{ {
if (cardNamed.find("imprintedcard") != string::npos)
{
if (source && source->currentimprintName.size())
{
cardNamed = source->currentimprintName;
}
}
theNamedCard = makeCard(); theNamedCard = makeCard();
} }
if(putinplay) if(putinplay)
+3
View File
@@ -426,6 +426,9 @@ uint8_t CardPrimitive::ConvertColorToBitMask(int inColor)
case Constants::MTG_COLOR_LAND: case Constants::MTG_COLOR_LAND:
value = kColorBitMask_Land; value = kColorBitMask_Land;
break; break;
case Constants::MTG_COLOR_WASTE://the true colorless mana shares the kbitmask of land. kbitmask dictates the color of the quad(no image boarder), and the symbol. nothing more.
value = kColorBitMask_Land;
break;
default: default:
break; break;
+29 -8
View File
@@ -53,6 +53,7 @@ void GameObserver::cleanup()
actionsList.clear(); actionsList.clear();
gameTurn.clear(); gameTurn.clear();
OpenedDisplay = NULL; OpenedDisplay = NULL;
AffinityNeedsUpdate = false;
} }
GameObserver::~GameObserver() GameObserver::~GameObserver()
@@ -1079,7 +1080,24 @@ void GameObserver::Affinity()
} }
} }
} }
//////////////////////////// ///we handle trisnisphere seperately because its a desaster.
if (card->has(Constants::TRINISPHERE))
{
for (int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)
{
card->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
card->countTrini++;
}
}
else
{
if (card->countTrini)
{
card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini);
card->countTrini = 0;
}
}
///////////////////////
bool NewAffinityFound = false; bool NewAffinityFound = false;
for (unsigned int na = 0; na < card->cardsAbilities.size(); na++) for (unsigned int na = 0; na < card->cardsAbilities.size(); na++)
{ {
@@ -1092,30 +1110,31 @@ void GameObserver::Affinity()
} }
} }
bool DoReduceIncrease = false; bool DoReduceIncrease = false;
if (card->has(Constants::AFFINITYARTIFACTS) || if (
(card->has(Constants::AFFINITYARTIFACTS) ||
card->has(Constants::AFFINITYFOREST) || card->has(Constants::AFFINITYFOREST) ||
card->has(Constants::AFFINITYGREENCREATURES) || card->has(Constants::AFFINITYGREENCREATURES) ||
card->has(Constants::AFFINITYISLAND) || card->has(Constants::AFFINITYISLAND) ||
card->has(Constants::AFFINITYMOUNTAIN) || card->has(Constants::AFFINITYMOUNTAIN) ||
card->has(Constants::AFFINITYPLAINS) || card->has(Constants::AFFINITYPLAINS) ||
card->has(Constants::AFFINITYSWAMP) || card->has(Constants::AFFINITYSWAMP) ||
card->has(Constants::TRINISPHERE) ||
card->getIncreasedManaCost()->getConvertedCost() || card->getIncreasedManaCost()->getConvertedCost() ||
card->getReducedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost() ||
NewAffinityFound) NewAffinityFound)
&&
AffinityNeedsUpdate
)
DoReduceIncrease = true; DoReduceIncrease = true;
if (!DoReduceIncrease) if (!DoReduceIncrease)
continue; continue;
//above we check if there are even any cards that effect cards manacost //above we check if there are even any cards that effect cards manacost
//if there are none, leave this function. manacost->copy( is a very expensive funtion
//1mb a sec to run at all time even when no known reducers or increasers are in play.
//memory snapshot shots pointed to this as such a heavy load that games with many cards inplay
//would slow to a crawl.
//only do any of the following if a card with the stated ability is in your hand. //only do any of the following if a card with the stated ability is in your hand.
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below. //kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
card->getManaCost()->resetCosts(); card->getManaCost()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost *newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost())); newCost->copy(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
card->getManaCost()->copy(newCost); card->getManaCost()->copy(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
if (card->getManaCost()->getAlternative()) if (card->getManaCost()->getAlternative())
@@ -1170,6 +1189,7 @@ void GameObserver::Affinity()
}//end }//end
} }
} }
AffinityNeedsUpdate = false;
} }
void GameObserver::Render() void GameObserver::Render()
@@ -1579,6 +1599,7 @@ int GameObserver::receiveEvent(WEvent * e)
SAFE_DELETE(ev); SAFE_DELETE(ev);
eventsQueue.pop(); eventsQueue.pop();
} }
AffinityNeedsUpdate = true;
return result; return result;
} }
+6 -3
View File
@@ -2503,9 +2503,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
found = s.find("imprint"); found = s.find("imprint");
if (found != string::npos) if (found != string::npos)
{ {
MTGAbility * a = NEW AAImprint(observer, id, card, target); if (s.find("imprintedcard") == string::npos)
a->oneShot = 1; {
return a; MTGAbility * a = NEW AAImprint(observer, id, card, target);
a->oneShot = 1;
return a;
}
} }
//phaseout //phaseout
+15
View File
@@ -970,6 +970,14 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
string type = ""; string type = "";
ManaCost * original = NEW ManaCost(); ManaCost * original = NEW ManaCost();
original->copy(Data); original->copy(Data);
Cost->copy(original);
if (Cost->extraCosts)
{
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
{
Cost->extraCosts->costs[i]->setSource(card);
}
}
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost()) if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost())
{//start1 {//start1
if (card->getIncreasedManaCost()->getConvertedCost()) if (card->getIncreasedManaCost()->getConvertedCost())
@@ -1076,6 +1084,13 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
Cost->extraCosts->costs[i]->setSource(card); Cost->extraCosts->costs[i]->setSource(card);
} }
} }
if (Cost->extraCosts)
{
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
{
Cost->extraCosts->costs[i]->setSource(card);
}
}
int reduce = 0; int reduce = 0;
if (card->has(Constants::AFFINITYGREENCREATURES)) if (card->has(Constants::AFFINITYGREENCREATURES))
{ {
+5 -1
View File
@@ -980,7 +980,11 @@ void MTGInPlay::untapAll()
MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2) MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
{ {
if (p2 != p && p2 && (p != p2->opponent()))
{
p = p2->opponent();
//these cases are generally handled this is a edge case fix.
}
switch (zoneId) switch (zoneId)
{ {
case MY_GRAVEYARD: case MY_GRAVEYARD:
+17 -13
View File
@@ -2774,9 +2774,12 @@ WEvent * MTGDredgeRule::replace(WEvent * event)
Player * p = game->players[i]; Player * p = game->players[i];
if (e->player == p) if (e->player == p)
{ {
int Dredgers = 0; vector<MTGAbility*>menusOfferedWithDredge;
for(int draw = 0;draw < e->nb_cards;draw++) for(int draw = 0;draw < e->nb_cards;draw++)
{ {
tcb = tf.createTargetChooser("dredgeable", card);
int toDredge = tcb->countValidTargets();
SAFE_DELETE(tcb);
vector<MTGAbility*>selection; vector<MTGAbility*>selection;
//look for other draw replacement effects //look for other draw replacement effects
list<ReplacementEffect *>::iterator it; list<ReplacementEffect *>::iterator it;
@@ -2801,16 +2804,14 @@ WEvent * MTGDredgeRule::replace(WEvent * event)
} }
//there is a memleak here that i have no idea what causes it. got it reduced to just 4 bytes but its still bothering me. //there is a memleak here that i have no idea what causes it. got it reduced to just 4 bytes but its still bothering me.
if (Dredgers < e->nb_cards) if (int(menusOfferedWithDredge.size()) < toDredge)
{ {
tcb = tf.createTargetChooser("dredgeable", card); tcb = tf.createTargetChooser("dredgeable", card);
tcb->targetter = NULL; tcb->targetter = NULL;
dredgeAbility = NEW dredgeCard(game, game->mLayers->actionLayer()->getMaxId(), card, NULL); dredgeAbility = NEW dredgeCard(game, game->mLayers->actionLayer()->getMaxId(), card, NULL);
dredgeAbility->oneShot = true; dredgeAbility->oneShot = true;
dredgeAbility->canBeInterrupted = false; dredgeAbility->canBeInterrupted = false;
targetAbility = NEW GenericTargetAbility(game, "Dredge A Card", "", game->mLayers->actionLayer()->getMaxId(), card, tcb->clone(), dredgeAbility->clone()); targetAbility = NEW GenericTargetAbility(game, "Dredge A Card", "", game->mLayers->actionLayer()->getMaxId(), card, tcb, dredgeAbility->clone());
SAFE_DELETE(tcb);
SAFE_DELETE(dredgeAbility); SAFE_DELETE(dredgeAbility);
targetAbility->oneShot = true; targetAbility->oneShot = true;
targetAbility->canBeInterrupted = false; targetAbility->canBeInterrupted = false;
@@ -2820,16 +2821,19 @@ WEvent * MTGDredgeRule::replace(WEvent * event)
MTGAbility * setDredge = targetAbilityAdder->clone(); MTGAbility * setDredge = targetAbilityAdder->clone();
SAFE_DELETE(targetAbilityAdder); SAFE_DELETE(targetAbilityAdder);
setDredge->oneShot = true; setDredge->oneShot = true;
selection.push_back(setDredge); selection.push_back(setDredge);
targetAbility1 = NEW AADrawer(game, this->GetId(), card, card, NULL, "1", TargetChooser::CONTROLLER, true);
targetAbility1->canBeInterrupted = false;
selection.push_back(targetAbility1);
MTGAbility * menuChoice = NEW MenuAbility(game, this->GetId(), card, card, true, selection, card->controller(), "Dredge or Draw");
menuChoice->addToGame();
} }
targetAbility1 = NEW AADrawer(game, this->GetId(), card, card, NULL, "1", TargetChooser::CONTROLLER, true);
targetAbility1->canBeInterrupted = false;
selection.push_back(targetAbility1);
MTGAbility * menuChoice = NEW MenuAbility(game, this->GetId(), card, card, true, selection, card->controller(), "Dredge or Draw");
menusOfferedWithDredge.push_back(menuChoice);
}
while (menusOfferedWithDredge.size())
{
menusOfferedWithDredge[0]->addToGame();
menusOfferedWithDredge.erase(menusOfferedWithDredge.begin());
} }
SAFE_DELETE(event); SAFE_DELETE(event);