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:
omegablast2002@yahoo.com
2011-01-24 17:58:14 +00:00
parent 556df85a31
commit beec00c254
6 changed files with 124 additions and 18 deletions

View File

@@ -67,6 +67,7 @@ protected:
class Lands: public HorzStack {}; class Lands: public HorzStack {};
class Creatures: public HorzStack {}; class Creatures: public HorzStack {};
class Planeswalker: public HorzStack {};
class Spells: public VertStack {}; class Spells: public VertStack {};
protected: protected:
@@ -75,6 +76,7 @@ protected:
BattleField battleField; BattleField battleField;
Lands selfLands, opponentLands; Lands selfLands, opponentLands;
Spells selfSpells, opponentSpells; Spells selfSpells, opponentSpells;
Planeswalker selfPlaneswalker,opponentPlaneswalker;
iterator end_spells; iterator end_spells;
vector<CardView*> cards; vector<CardView*> cards;

View File

@@ -217,6 +217,17 @@ public:
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
virtual MTGLegendRule * clone() 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 class MTGMomirRule: public MTGAbility
{ {

View File

@@ -32,6 +32,7 @@ void DuelLayers::init()
action->Add(NEW MTGBlockRule(-1)); action->Add(NEW MTGBlockRule(-1));
action->Add(NEW MTGCombatTriggersRule(-1)); action->Add(NEW MTGCombatTriggersRule(-1));
action->Add(NEW MTGLegendRule(-1)); action->Add(NEW MTGLegendRule(-1));
action->Add(NEW MTGPlaneWalkerRule(-1));
action->Add(NEW MTGTokensCleanup(-1)); // needs to be before persist action->Add(NEW MTGTokensCleanup(-1)); // needs to be before persist
action->Add(NEW MTGPersistRule(-1)); action->Add(NEW MTGPersistRule(-1));
action->Add(NEW MTGAffinityRule(-1)); action->Add(NEW MTGAffinityRule(-1));

View File

@@ -173,22 +173,25 @@ GuiPlay::~GuiPlay()
bool isSpell(CardView* c) 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() void GuiPlay::Replace()
{ {
unsigned opponentSpellsN = 0, selfSpellsN = 0, opponentLandsN = 0, opponentCreaturesN = 0, battleFieldAttackersN = 0, 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); end_spells = stable_partition(cards.begin(), cards.end(), &isSpell);
for (iterator it = cards.begin(); it != end_spells; ++it) for (iterator it = cards.begin(); it != end_spells; ++it)
if (!(*it)->card->target) if (!(*it)->card->target)
{ {
if (game->players[0] == (*it)->card->controller()) if(!(*it)->card->hasSubtype("aura") && !(*it)->card->hasType("Planeswalker"))
++selfSpellsN; {
else if (game->players[0] == (*it)->card->controller())
++opponentSpellsN; ++selfSpellsN;
else
++opponentSpellsN;
}
} }
for (iterator it = end_spells; it != cards.end(); ++it) for (iterator it = end_spells; it != cards.end(); ++it)
{ {
@@ -203,13 +206,20 @@ void GuiPlay::Replace()
else else
++opponentCreaturesN; ++opponentCreaturesN;
} }
else if ((*it)->card->isLand()) else if ((*it)->card->isLand() || (*it)->card->hasType("Planeswalker"))
{ {
if (game->players[0] == (*it)->card->controller()) if (game->players[0] == (*it)->card->controller())
++selfLandsN; ++selfLandsN;
else else
++opponentLandsN; ++opponentLandsN;
} }
//else if ((*it)->card->hasType("Planeswalker"))
//{
// if (game->players[0] == (*it)->card->controller())
// ++selfPlaneswalkern;
// else
// ++opponentPlaneswalkern;
//}
} }
opponentSpells.reset(opponentSpellsN, 18, 60); opponentSpells.reset(opponentSpellsN, 18, 60);
@@ -218,17 +228,19 @@ void GuiPlay::Replace()
for (iterator it = cards.begin(); it != end_spells; ++it) for (iterator it = cards.begin(); it != end_spells; ++it)
if (!(*it)->card->target) if (!(*it)->card->target)
{ {
if (game->players[0] == (*it)->card->controller()) if(!(*it)->card->hasSubtype("aura") && !(*it)->card->hasType("Planeswalker"))
selfSpells.Enstack(*it); {
else if (game->players[0] == (*it)->card->controller())
opponentSpells.Enstack(*it); selfSpells.Enstack(*it);
else
opponentSpells.Enstack(*it);
}
} }
float x = 24 + opponentSpells.nextX(); float x = 24 + opponentSpells.nextX();
//seperated the varible X into 2 different varibles. There are 2 players here!! //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!! //we should not be using a single varible to determine the positioning of cards!!
float myx = 24 + selfSpells.nextX(); float myx = 24 + selfSpells.nextX();
opponentLands.reset(opponentLandsN, x, 50); opponentLands.reset(opponentLandsN,55 + x, 50);
opponentCreatures.reset(opponentCreaturesN, x, 95); 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? 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); selfCreatures.reset(selfCreaturesN, myx, 195);
@@ -254,6 +266,18 @@ void GuiPlay::Replace()
else else
opponentLands.Enstack(*it); 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 else
opponentCreatures.Render(*it, cards.begin(), end_spells); opponentCreatures.Render(*it, cards.begin(), end_spells);
} }
else else if(!(*it)->card->hasSubtype("Planeswalker"))
{ {
if (!(*it)->card->target) if (!(*it)->card->target)
{ {
@@ -286,6 +310,16 @@ void GuiPlay::Render()
opponentSpells.Render(*it, cards.begin(), end_spells); 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) void GuiPlay::Update(float dt)

View File

@@ -219,7 +219,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
break; break;
case 'r': //retrace/rarity case 'r': //retrace/rarity
if('s' == key[2])//restrictions if('s' == key[2] && 't' == key[3])//restrictions
{ {
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
string value = val; 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 { //retrace
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
if (ManaCost * cost = primitive->getManaCost()) if (ManaCost * cost = primitive->getManaCost())
@@ -283,13 +283,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
cost->Retrace = ManaCost::parseManaCost(value); cost->Retrace = ManaCost::parseManaCost(value);
} }
} }
else else if (s.find("rar") != string::npos)
{//rarity {//rarity
if (!card) card = NEW MTGCard(); if (!card) card = NEW MTGCard();
card->setRarity(val[0]); card->setRarity(val[0]);
} }
break; break;
case 's': //subtype case 's': //subtype
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
while (true) while (true)

View File

@@ -1852,6 +1852,65 @@ MTGLegendRule * MTGLegendRule::clone() const
return a; 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 */ /* Lifelink */
MTGLifelinkRule::MTGLifelinkRule(int _id) : MTGLifelinkRule::MTGLifelinkRule(int _id) :
MTGAbility(_id, NULL) MTGAbility(_id, NULL)