redid the counters menutext function to be more like the one "add mana" uses. makes it easier to read and add to later if needed.
This commit is contained in:
@@ -625,6 +625,7 @@ public:
|
|||||||
int power;
|
int power;
|
||||||
int toughness;
|
int toughness;
|
||||||
string name;
|
string name;
|
||||||
|
string menu;
|
||||||
|
|
||||||
AACounter(int id, MTGCardInstance * source, MTGCardInstance * target, const char * _name, int power, int toughness, int nb,
|
AACounter(int id, MTGCardInstance * source, MTGCardInstance * target, const char * _name, int power, int toughness, int nb,
|
||||||
ManaCost * cost = NULL, int doTap = 0);
|
ManaCost * cost = NULL, int doTap = 0);
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ AACounter::AACounter(int id, MTGCardInstance * source, MTGCardInstance * target,
|
|||||||
{
|
{
|
||||||
this->target = target;
|
this->target = target;
|
||||||
if (name.find("Level")) aType = MTGAbility::STANDARD_LEVELUP;
|
if (name.find("Level")) aType = MTGAbility::STANDARD_LEVELUP;
|
||||||
|
menu = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int AACounter::resolve()
|
int AACounter::resolve()
|
||||||
@@ -282,27 +283,34 @@ int AACounter::resolve()
|
|||||||
|
|
||||||
const char* AACounter::getMenuText()
|
const char* AACounter::getMenuText()
|
||||||
{
|
{
|
||||||
|
if(menu.size())
|
||||||
|
{
|
||||||
|
return menu.c_str();
|
||||||
|
}
|
||||||
|
char buffer[128];
|
||||||
|
|
||||||
if(name.size()){
|
if(name.size())
|
||||||
|
{
|
||||||
string s = name;
|
string s = name;
|
||||||
if(power == 0 && toughness == 0)
|
menu.append(s.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(power != 0 || toughness != 0)
|
||||||
{
|
{
|
||||||
if( nb != 1) sprintf(menuText, "%s Counter:%i", s.c_str(),nb);
|
sprintf(buffer, " %i/%i", power,toughness);
|
||||||
else sprintf(menuText, "%s Counter", s.c_str(),nb);
|
menu.append(buffer);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
menu.append(" Counter");
|
||||||
|
if(nb != 1)
|
||||||
{
|
{
|
||||||
if( nb != 1) sprintf(menuText, "%i/%i %s Counter:%i",power,toughness, s.c_str(),nb);
|
sprintf(buffer, ": %i", nb);
|
||||||
else sprintf(menuText, "%i/%i %s Counter",power,toughness, s.c_str(),nb);
|
menu.append(buffer);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(nb != 1) sprintf(menuText, "%i/%i Counter:%i",power,toughness,nb);
|
|
||||||
else sprintf(menuText, "%i/%i Counter",power,toughness,nb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(menuText, "%s",menu.c_str());
|
||||||
return menuText;
|
return menuText;
|
||||||
}
|
}
|
||||||
|
|
||||||
AACounter * AACounter::clone() const
|
AACounter * AACounter::clone() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user