Fixed primitives, fixed a commander deck for AI, improved all cards with partner ability, added a "partner=" key to associate the partner to a primitive, added new keywords "withpartner", "partname" and "haspartner" to improve the Target Chooser for cards with partner, improved the Commander rules to allow double commander just with specifc partner, improved background images management for game settings, deck selection, deck editor background, post-match credits, deck editor selection and trophies room (now it's possibile to randomly use up to 10 background images).
This commit is contained in:
@@ -25,6 +25,7 @@ CardDescriptor::CardDescriptor()
|
||||
hasKickerCost = 0;
|
||||
hasFlashbackCost = 0;
|
||||
hasBackSide = 0;
|
||||
hasPartner = 0;
|
||||
hasXCost = 0;
|
||||
compareName ="";
|
||||
nameComparisonMode = COMPARISON_NONE;
|
||||
@@ -78,6 +79,11 @@ void CardDescriptor::unsecureSetHasBackSide(int k)
|
||||
hasBackSide = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetHasPartner(int k)
|
||||
{
|
||||
hasPartner = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetTapped(int i)
|
||||
{
|
||||
tapped = i;
|
||||
@@ -287,6 +293,11 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((hasPartner == -1 && card->partner != "") || (hasPartner == 1 && card->partner == ""))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((hasXCost == -1 && card->getManaCost()->hasX()) || (hasXCost == 1 && !card->getManaCost()->hasX()))
|
||||
{
|
||||
match = NULL;
|
||||
|
||||
@@ -1544,6 +1544,18 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
cd.unsecureSetHasBackSide(1);
|
||||
}
|
||||
}
|
||||
//Has partner
|
||||
else if (attribute.find("haspartner") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.unsecureSetHasPartner(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.unsecureSetHasPartner(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
|
||||
@@ -517,11 +517,11 @@ void Credits::Render()
|
||||
return;
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
#if !defined (PSP)
|
||||
//Now it's possibile to randomly use up to 3 background images for post-match credits (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for post-match credits (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
JTexture * wpTex = NULL;
|
||||
if(kBgFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 10);
|
||||
kBgFile.assign(temp);
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex) {
|
||||
|
||||
@@ -11,10 +11,10 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
||||
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
|
||||
{
|
||||
#if !defined (PSP)
|
||||
//Now it's possibile to randomly use up to 3 background images for deck editor selection (if random index is 0, it will be rendered the default "menubgdeckeditor.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for deck editor selection (if random index is 0, it will be rendered the default "menubgdeckeditor.jpg" image).
|
||||
ostringstream bgFilename;
|
||||
char temp[4096];
|
||||
sprintf(temp, "menubgdeckeditor%i", std::rand() % 3);
|
||||
sprintf(temp, "menubgdeckeditor%i", std::rand() % 10);
|
||||
backgroundName.assign(temp);
|
||||
bgFilename << backgroundName << ".jpg";
|
||||
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(bgFilename.str(), TEXTURE_SUB_5551);
|
||||
|
||||
@@ -151,7 +151,7 @@ void DeckMenu::RenderBackground()
|
||||
{
|
||||
ostringstream bgFilename;
|
||||
#if !defined (PSP)
|
||||
if(backgroundName.find("menubgdeckeditor") != string::npos) //Now it's possibile to randomly use up to 3 background images for deck editor selection.
|
||||
if(backgroundName.find("menubgdeckeditor") != string::npos) //Now it's possibile to randomly use up to 10 background images for deck editor selection.
|
||||
bgFilename << backgroundName << ".jpg";
|
||||
else
|
||||
bgFilename << backgroundName << ".png";
|
||||
|
||||
@@ -172,18 +172,17 @@ void GameStateAwards::Render()
|
||||
#if defined (PSP)
|
||||
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("pspawardback.jpg", TEXTURE_SUB_5551);
|
||||
#else
|
||||
//Now it's possibile to randomly use up to 3 background images for trophies room (if random index is 0, it will be rendered the default "awardback.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for trophies room (if random index is 0, it will be rendered the default "awardback.jpg" image).
|
||||
JQuadPtr background;
|
||||
if(kAwardFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "awardback%i.jpg", std::rand() % 3);
|
||||
sprintf(temp, "awardback%i.jpg", std::rand() % 10);
|
||||
kAwardFile.assign(temp);
|
||||
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(kAwardFile);
|
||||
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(kAwardFile, TEXTURE_SUB_5551);
|
||||
if (!background.get())
|
||||
kAwardFile = "awardback.jpg"; //Fallback to default background image for trophies room.
|
||||
}
|
||||
background = WResourceManager::Instance()->RetrieveTempQuad(kAwardFile, TEXTURE_SUB_5551);
|
||||
//JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
|
||||
#endif
|
||||
|
||||
if (background.get())
|
||||
|
||||
@@ -1574,11 +1574,11 @@ void GameStateDeckViewer::Render()
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
|
||||
#if !defined (PSP)
|
||||
//Now it's possibile to randomly use up to 3 background images for deck editor background (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for deck editor background (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
JTexture * wpTex = NULL;
|
||||
if(kBgFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 10);
|
||||
kBgFile.assign(temp);
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex) {
|
||||
|
||||
@@ -1087,11 +1087,11 @@ void GameStateDuel::Render()
|
||||
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
}
|
||||
#else
|
||||
//Now it's possibile to randomly use up to 3 background images for deck selection (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for deck selection (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
JTexture * wpTex = NULL;
|
||||
if(kBgFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 10);
|
||||
kBgFile.assign(temp);
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex) {
|
||||
|
||||
@@ -244,11 +244,11 @@ void GameStateOptions::Render()
|
||||
//Erase
|
||||
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
|
||||
#if !defined (PSP)
|
||||
//Now it's possibile to randomly use up to 3 background images for game settings (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
//Now it's possibile to randomly use up to 10 background images for game settings (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
JTexture * wpTex = NULL;
|
||||
if(kBgFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 10);
|
||||
kBgFile.assign(temp);
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex) {
|
||||
|
||||
@@ -75,6 +75,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
revealedLast = NULL;
|
||||
MadnessPlay = false;
|
||||
backSide = card->data->backSide;
|
||||
partner = card->data->partner;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGCardInstance::createSnapShot()
|
||||
@@ -142,6 +143,7 @@ void MTGCardInstance::copy(MTGCardInstance * card, bool nolegend)
|
||||
setText(data->text); //The text is retrieved from the data anyways
|
||||
setName(data->name);
|
||||
backSide = data->backSide;
|
||||
partner = data->partner;
|
||||
power = data->power;//layer 7a
|
||||
toughness = data->toughness;//layer 7a
|
||||
power += pbonus;//layer 7b
|
||||
|
||||
@@ -314,6 +314,11 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
map<string, CardPrimitive*>::iterator it = primitives.find(val);
|
||||
if (it != primitives.end()) card->setPrimitive(it->second);
|
||||
}
|
||||
else if (key[1] == 'a' && key[2] == 'r')
|
||||
{ //partner
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
primitive->partner = val;
|
||||
}
|
||||
else
|
||||
{ //power
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
@@ -993,7 +998,7 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
|
||||
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability.
|
||||
if(newcard && newcard->data->basicAbilities[Constants::PARTNER]){
|
||||
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && oldcard->data->name != newcard->data->name)
|
||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name)))
|
||||
CommandZone.push_back(s);
|
||||
}
|
||||
}
|
||||
@@ -1010,7 +1015,7 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
|
||||
else if(CommandZone.size() == 1 && newcard->data->hasType("Legendary") && (newcard->data->hasType("Creature") || newcard->data->basicAbilities[Constants::CANBECOMMANDER])){ // If a commander has been added you can add a new one just if both have partner ability.
|
||||
if(newcard->data->basicAbilities[Constants::PARTNER]){
|
||||
MTGCard * oldcard = database->getCardById(atoi((CommandZone.at(0)).c_str()));
|
||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && oldcard->data->name != newcard->data->name)
|
||||
if(oldcard && oldcard->data->basicAbilities[Constants::PARTNER] && (oldcard->data->name != newcard->data->name) && ((oldcard->data->partner == "" && newcard->data->partner == "") || (oldcard->data->partner == newcard->data->name && newcard->data->partner == oldcard->data->name)))
|
||||
CommandZone.push_back(str_id.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,6 +607,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->unsecureSetHasBackSide(1);
|
||||
}
|
||||
}
|
||||
//Has partner
|
||||
else if (attribute.find("haspartner") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->unsecureSetHasPartner(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->unsecureSetHasPartner(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
@@ -1076,6 +1088,26 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->nameComparisonMode = COMPARISON_EQUAL;
|
||||
}
|
||||
|
||||
if (attribute.find("backname") != string::npos && card->backSide != "")
|
||||
{
|
||||
attributefound = 1;
|
||||
cd->compareName = card->backSide;
|
||||
if (minus)
|
||||
cd->nameComparisonMode = COMPARISON_UNEQUAL;
|
||||
else
|
||||
cd->nameComparisonMode = COMPARISON_EQUAL;
|
||||
}
|
||||
|
||||
if (attribute.find("partname") != string::npos && card->partner != "")
|
||||
{
|
||||
attributefound = 1;
|
||||
cd->compareName = card->partner;
|
||||
if (minus)
|
||||
cd->nameComparisonMode = COMPARISON_UNEQUAL;
|
||||
else
|
||||
cd->nameComparisonMode = COMPARISON_EQUAL;
|
||||
}
|
||||
|
||||
if (attribute.find("storedname") != string::npos && card->storedCard)
|
||||
{
|
||||
attributefound = 1;
|
||||
|
||||
@@ -1419,12 +1419,14 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
|
||||
{
|
||||
intValue = (s == "plastshlturn")?card->controller()->lastShuffleTurn:card->controller()->opponent()->lastShuffleTurn;
|
||||
}
|
||||
else if (s == "hasprey" || s == "dualfaced" || s == "totaldmg")
|
||||
else if (s == "hasprey" || s == "dualfaced" || s == "withpartner" || s == "totaldmg")
|
||||
{
|
||||
if (s == "hasprey")
|
||||
intValue = (card->hauntedCard)?1:0;
|
||||
else if (s == "dualfaced")
|
||||
intValue = (card->backSide != "")?1:0;
|
||||
else if (s == "withpartner")
|
||||
intValue = (card->partner != "")?1:0;
|
||||
else if (s == "totaldmg")
|
||||
intValue = (card->damageToController + card->damageToCreature + card->damageToOpponent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user