Switching PT, Token Indicator

Added Switching PT like Layer 7e, Token Indicator for cloned Cards
This commit is contained in:
Anthony Calosa
2015-09-19 23:25:33 +08:00
parent 8e15ad7ed0
commit c372ffa111
9 changed files with 150 additions and 43 deletions
+16 -2
View File
@@ -4197,7 +4197,14 @@ for (it = types.begin(); it != types.end(); it++)
if(newpowerfound )
{
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
_target->addbaseP(val->getValue());
if(_target->isSwitchedPT)
{
_target->switchPT(false);
_target->addbaseP(val->getValue());
_target->switchPT(true);
}
else
_target->addbaseP(val->getValue());
delete val;
}
if(newtoughnessfound )
@@ -4205,7 +4212,14 @@ for (it = types.begin(); it != types.end(); it++)
//and you turn it into 1/1, the 1 damage is still there and the creature must die...
//the toughness is intact but what we see in the game is the life...
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
_target->addbaseT(val->getValue());
if(_target->isSwitchedPT)
{
_target->switchPT(false);
_target->addbaseT(val->getValue());
_target->switchPT(true);
}
else
_target->addbaseT(val->getValue());
delete val;
}
+11
View File
@@ -302,6 +302,17 @@ void CardGui::Render()
mFont->SetScale(1);
}
if(card->getRarity() == Constants::RARITY_T)
{
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "T");
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,222,173));//Navajo
mFont->SetScale(0.8f);
mFont->DrawString(buffer, actX - 10 * actZ, actY - (18 * actZ));
mFont->SetScale(1);
}
if (card->counters->mCount > 0)
{
unsigned c = -1;
+15 -1
View File
@@ -56,7 +56,14 @@ int Counter::added()
{
if (power != 0 || toughness != 0)
{
target->addcounter(power, toughness);
if(target->isSwitchedPT)
{
target->switchPT(false);
target->addcounter(power, toughness);
target->switchPT(true);
}
else
target->addcounter(power, toughness);
}
return 1;
}
@@ -65,6 +72,13 @@ int Counter::removed()
{
if (power != 0 || toughness != 0)
{
if(target->isSwitchedPT)
{
target->switchPT(false);
target->removecounter(power, toughness);
target->switchPT(true);
}
else
target->removecounter(power, toughness);
}
return 1;
+3 -1
View File
@@ -1857,7 +1857,9 @@ int Tournament::getRandomDeck(bool noEasyDecks)
while(isDouble && decks.size()>0)
{
isDouble=false;
k = rand() % (int)decks.size();
int lowest=0, highest = (int)decks.size();
int range=(highest-lowest);
k = lowest+int(range*rand()/(RAND_MAX + 1.0));
random = decks.at(k);
deckNumber = deckList->at(random)->getDeckId();
+21
View File
@@ -55,6 +55,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
castMethod = Constants::NOT_CAST;
isSettingBase = 0;
isCDA = false;
isSwitchedPT = false;
}
MTGCardInstance * MTGCardInstance::createSnapShot()
@@ -695,6 +696,26 @@ void MTGCardInstance::cdaPT(int p, int t)
applyPTbonus();
}
void MTGCardInstance::switchPT(bool apply)
{
stripPTbonus();
swapP = power;
swapT = toughness;
power += origpower;
power -= swapP;
addToToughness(origtoughness);
addToToughness(-swapT);
applyPTbonus();
if(apply)
{
swapP = toughness;
swapT = power;
addToToughness(swapT);
addToToughness(-swapP);
setPower(swapP);
}
}
int MTGCardInstance::canBlock()
{
if (tapped)
+11
View File
@@ -98,6 +98,17 @@ bool FileExists(const string & filename)
return JFileSystem::GetInstance()->FileExists(filename);
}
std::string cReplaceString(string subject, const string& search, const string& replace)
{
size_t pos = 0;
while ((pos = subject.find(search, pos)) != string::npos)
{
subject.replace(pos, search.length(), replace);
pos += replace.length();
}
return subject;
}
/*
#ifdef LINUX