2 changes, first fixed the bug where auras were causing the cards to slide to the right, auras always have targets, so i added a conditional to guiplay to ignore adding it to the horizontal shift as these auras should never be just laying in the battlefield with no target.
2nd, started laying some ground work for planeswalkers. added the planeswalker rule, as per mtg rules, if you have a type=planeswalker subtype=jace already on the battlefield, both are sent to the graveyard. so you can not have a jace mind scuptor and a jace beleren out at the same time. i choose to use subtype= and type= rather then adding another variable to MTGCard... also, added GuiPlay positioning for planeswalker, i think theres been a HUGE misunderstanding about planeswalkers which has most going "battlefield is too crowded where would be put them...easy...slap them at the end of the lands ..done...theyre not creatures or artifacts/enchantments..so i moved them to the colum with the lands and have guiplay slap them at the end of that colum...btw this is in no means final...if someone can think of a better solution be my guest, but looking at the planeswalker (workaround) thread, its pretty obvious that no one will care where we slap the planeswalkers, as long as theyre supported. planeswalkers have alot more ground to cover...
This commit is contained in:
@@ -67,6 +67,7 @@ protected:
|
||||
|
||||
class Lands: public HorzStack {};
|
||||
class Creatures: public HorzStack {};
|
||||
class Planeswalker: public HorzStack {};
|
||||
class Spells: public VertStack {};
|
||||
|
||||
protected:
|
||||
@@ -75,6 +76,7 @@ protected:
|
||||
BattleField battleField;
|
||||
Lands selfLands, opponentLands;
|
||||
Spells selfSpells, opponentSpells;
|
||||
Planeswalker selfPlaneswalker,opponentPlaneswalker;
|
||||
iterator end_spells;
|
||||
|
||||
vector<CardView*> cards;
|
||||
|
||||
@@ -217,6 +217,17 @@ public:
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual MTGLegendRule * clone() const;
|
||||
};
|
||||
class MTGPlaneWalkerRule: public ListMaintainerAbility
|
||||
{
|
||||
public:
|
||||
MTGPlaneWalkerRule(int _id);
|
||||
int canBeInList(MTGCardInstance * card);
|
||||
int added(MTGCardInstance * card);
|
||||
int removed(MTGCardInstance * card);
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual MTGPlaneWalkerRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGMomirRule: public MTGAbility
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ void DuelLayers::init()
|
||||
action->Add(NEW MTGBlockRule(-1));
|
||||
action->Add(NEW MTGCombatTriggersRule(-1));
|
||||
action->Add(NEW MTGLegendRule(-1));
|
||||
action->Add(NEW MTGPlaneWalkerRule(-1));
|
||||
action->Add(NEW MTGTokensCleanup(-1)); // needs to be before persist
|
||||
action->Add(NEW MTGPersistRule(-1));
|
||||
action->Add(NEW MTGAffinityRule(-1));
|
||||
|
||||
@@ -173,23 +173,26 @@ GuiPlay::~GuiPlay()
|
||||
|
||||
bool isSpell(CardView* c)
|
||||
{
|
||||
return c->card->isSpell() && !c->card->isCreature();
|
||||
return c->card->isSpell() && !c->card->isCreature() && !c->card->hasType("Planeswalker");
|
||||
}
|
||||
void GuiPlay::Replace()
|
||||
{
|
||||
unsigned opponentSpellsN = 0, selfSpellsN = 0, opponentLandsN = 0, opponentCreaturesN = 0, battleFieldAttackersN = 0,
|
||||
battleFieldBlockersN = 0, selfCreaturesN = 0, selfLandsN = 0;
|
||||
battleFieldBlockersN = 0, selfCreaturesN = 0, selfLandsN = 0, selfPlaneswalkern = 0,opponentPlaneswalkern = 0;
|
||||
|
||||
end_spells = stable_partition(cards.begin(), cards.end(), &isSpell);
|
||||
|
||||
for (iterator it = cards.begin(); it != end_spells; ++it)
|
||||
if (!(*it)->card->target)
|
||||
{
|
||||
if(!(*it)->card->hasSubtype("aura") && !(*it)->card->hasType("Planeswalker"))
|
||||
{
|
||||
if (game->players[0] == (*it)->card->controller())
|
||||
++selfSpellsN;
|
||||
else
|
||||
++opponentSpellsN;
|
||||
}
|
||||
}
|
||||
for (iterator it = end_spells; it != cards.end(); ++it)
|
||||
{
|
||||
if ((*it)->card->isCreature())
|
||||
@@ -203,13 +206,20 @@ void GuiPlay::Replace()
|
||||
else
|
||||
++opponentCreaturesN;
|
||||
}
|
||||
else if ((*it)->card->isLand())
|
||||
else if ((*it)->card->isLand() || (*it)->card->hasType("Planeswalker"))
|
||||
{
|
||||
if (game->players[0] == (*it)->card->controller())
|
||||
++selfLandsN;
|
||||
else
|
||||
++opponentLandsN;
|
||||
}
|
||||
//else if ((*it)->card->hasType("Planeswalker"))
|
||||
//{
|
||||
// if (game->players[0] == (*it)->card->controller())
|
||||
// ++selfPlaneswalkern;
|
||||
// else
|
||||
// ++opponentPlaneswalkern;
|
||||
//}
|
||||
}
|
||||
|
||||
opponentSpells.reset(opponentSpellsN, 18, 60);
|
||||
@@ -217,18 +227,20 @@ void GuiPlay::Replace()
|
||||
|
||||
for (iterator it = cards.begin(); it != end_spells; ++it)
|
||||
if (!(*it)->card->target)
|
||||
{
|
||||
if(!(*it)->card->hasSubtype("aura") && !(*it)->card->hasType("Planeswalker"))
|
||||
{
|
||||
if (game->players[0] == (*it)->card->controller())
|
||||
selfSpells.Enstack(*it);
|
||||
else
|
||||
opponentSpells.Enstack(*it);
|
||||
}
|
||||
|
||||
}
|
||||
float x = 24 + opponentSpells.nextX();
|
||||
//seperated the varible X into 2 different varibles. There are 2 players here!!
|
||||
//we should not be using a single varible to determine the positioning of cards!!
|
||||
float myx = 24 + selfSpells.nextX();
|
||||
opponentLands.reset(opponentLandsN, x, 50);
|
||||
opponentLands.reset(opponentLandsN,55 + x, 50);
|
||||
opponentCreatures.reset(opponentCreaturesN, x, 95);
|
||||
battleField.reset(x, 145);//what does this varible do? i can comment it out with no reprocussions...is this being double handled?
|
||||
selfCreatures.reset(selfCreaturesN, myx, 195);
|
||||
@@ -254,6 +266,18 @@ void GuiPlay::Replace()
|
||||
else
|
||||
opponentLands.Enstack(*it);
|
||||
}
|
||||
|
||||
}
|
||||
//rerun the iter reattaching planes walkers to the back of the lands.
|
||||
for (iterator it = end_spells; it != cards.end(); ++it)
|
||||
{
|
||||
if ((*it)->card->hasType("Planeswalker"))
|
||||
{
|
||||
if (game->players[0] == (*it)->card->controller())
|
||||
selfLands.Enstack(*it);
|
||||
else
|
||||
opponentLands.Enstack(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +300,7 @@ void GuiPlay::Render()
|
||||
else
|
||||
opponentCreatures.Render(*it, cards.begin(), end_spells);
|
||||
}
|
||||
else
|
||||
else if(!(*it)->card->hasSubtype("Planeswalker"))
|
||||
{
|
||||
if (!(*it)->card->target)
|
||||
{
|
||||
@@ -286,6 +310,16 @@ void GuiPlay::Render()
|
||||
opponentSpells.Render(*it, cards.begin(), end_spells);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(*it)->card->target)
|
||||
{
|
||||
if (game->players[0] == (*it)->card->controller())
|
||||
selfPlaneswalker.Render(*it, cards.begin(), end_spells);
|
||||
else
|
||||
opponentPlaneswalker.Render(*it, cards.begin(), end_spells);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void GuiPlay::Update(float dt)
|
||||
|
||||
@@ -219,7 +219,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
break;
|
||||
|
||||
case 'r': //retrace/rarity
|
||||
if('s' == key[2])//restrictions
|
||||
if('s' == key[2] && 't' == key[3])//restrictions
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
string value = val;
|
||||
@@ -273,7 +273,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ('e' == key[1])
|
||||
else if ('e' == key[1] && 't' == key[2])
|
||||
{ //retrace
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
if (ManaCost * cost = primitive->getManaCost())
|
||||
@@ -283,13 +283,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
cost->Retrace = ManaCost::parseManaCost(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (s.find("rar") != string::npos)
|
||||
{//rarity
|
||||
if (!card) card = NEW MTGCard();
|
||||
card->setRarity(val[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 's': //subtype
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
while (true)
|
||||
|
||||
@@ -1852,6 +1852,65 @@ MTGLegendRule * MTGLegendRule::clone() const
|
||||
return a;
|
||||
}
|
||||
|
||||
/* PlaneWalker Rule */
|
||||
MTGPlaneWalkerRule::MTGPlaneWalkerRule(int _id) :
|
||||
ListMaintainerAbility(_id)
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
int MTGPlaneWalkerRule::canBeInList(MTGCardInstance * card)
|
||||
{
|
||||
if(card->isPhased)
|
||||
return 0;
|
||||
if (card->hasType("Planeswalker") && game->isInPlay(card))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MTGPlaneWalkerRule::added(MTGCardInstance * card)
|
||||
{
|
||||
map<MTGCardInstance *, bool>::iterator it;
|
||||
int destroy = 0;
|
||||
for (it = cards.begin(); it != cards.end(); it++)
|
||||
{
|
||||
MTGCardInstance * comparison = (*it).first;
|
||||
if (comparison != card && comparison->types == card->types)
|
||||
{
|
||||
comparison->controller()->game->putInGraveyard(comparison);
|
||||
destroy = 1;
|
||||
}
|
||||
}
|
||||
if (destroy)
|
||||
{
|
||||
card->owner->game->putInGraveyard(card);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MTGPlaneWalkerRule::removed(MTGCardInstance * card)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MTGPlaneWalkerRule::testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ostream& MTGPlaneWalkerRule::toString(ostream& out) const
|
||||
{
|
||||
return out << "MTGLegendRule :::";
|
||||
}
|
||||
MTGPlaneWalkerRule * MTGPlaneWalkerRule::clone() const
|
||||
{
|
||||
MTGPlaneWalkerRule * a = NEW MTGPlaneWalkerRule(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
/* Lifelink */
|
||||
MTGLifelinkRule::MTGLifelinkRule(int _id) :
|
||||
MTGAbility(_id, NULL)
|
||||
|
||||
Reference in New Issue
Block a user