Fixed bug that was not correctly showing the full Commander decks list in the deck choosing menu page, added a new gesture for Android to emulate back button pressure: now sliding from down to up for almost all screen size will trigger the back button in game (e.g. pause match in gameplay, going back from shop, and so on).

This commit is contained in:
Vittorio Alfieri
2021-09-05 01:15:01 +02:00
parent c211b2eaa4
commit ccae9673e6
7 changed files with 19 additions and 14 deletions
+4 -1
View File
@@ -2,8 +2,11 @@
## [master] (https://github.com/WagicProject/wagic/tree/master) ## [master] (https://github.com/WagicProject/wagic/tree/master)
### 05/09/21
- *Committed:* Fixed bug that was not correctly showing the full Commander decks list in the deck choosing menu page, added a new gesture for Android to emulate back button pressure: now sliding from down to up for almost all screen size will trigger the back button in game (e.g. pause match in gameplay, going back from shop, and so on). ([Vitty85](https://github.com/Vitty85))
### 04/09/21 ### 04/09/21
- *Committed:* Fixed several primitives with "castcard" ability, fixed a bug when using "noevent" and "copied" options togheter with "namedcard" option in "castcard" ability, allowed the usage of "and!()!" ability with "namedcard" option in "castcard" ability for permanents, added "daybound" and "nightbound" abilities. ([Vitty85](https://github.com/Vitty85)) - *Committed:* Fixed several primitives with "castcard" ability, fixed a bug when using "noevent" and "copied" options togheter with "namedcard" option in "castcard" ability, allowed the usage of "and!()!" ability with "namedcard" option in "castcard" ability for permanents, added "daybound" and "nightbound" abilities. https://github.com/WagicProject/wagic/commit/c211b2eaa481639725f29490d93f87797ea5a718 ([Vitty85](https://github.com/Vitty85))
- *Committed:* Added/fixed primitives, refactored and improved almost all transforming human cards (included all the Werewolves), improved "flip ability and "doubleside" ability adding a new "backside" option, fixed a bug on "doubleside" ability for planeswalkers, added "backside=" key to CardPrimitive in order to specify the other side of double-faced cards, added "hasbackside" option to target chooser in order to find cards which have a back side, added "dualfaced" that return 1 if a card has a backside card, fixed loyalty counter ability on planeswalker flip (is was not resolving correctly), changed type of damageToController, damageToOpponent, damageToCreature, wasDealtDamage, combatdamageToOpponent from bool to int in order to retrieve those values if needed, added "totaldmg" keyword that returns the total amount of damage dealt by a creature in the current turn, added new restriction "coven in order to check if a player controls three or more creatures with different powers, added new ability "hasdisturb" when the Retrace cost of a card is a disturb cost (e.g. "Beloved Beggar"). https://github.com/WagicProject/wagic/commit/cc16db7256138febf26c1bf7fd4d9907c4f708fa ([Vitty85](https://github.com/Vitty85)) - *Committed:* Added/fixed primitives, refactored and improved almost all transforming human cards (included all the Werewolves), improved "flip ability and "doubleside" ability adding a new "backside" option, fixed a bug on "doubleside" ability for planeswalkers, added "backside=" key to CardPrimitive in order to specify the other side of double-faced cards, added "hasbackside" option to target chooser in order to find cards which have a back side, added "dualfaced" that return 1 if a card has a backside card, fixed loyalty counter ability on planeswalker flip (is was not resolving correctly), changed type of damageToController, damageToOpponent, damageToCreature, wasDealtDamage, combatdamageToOpponent from bool to int in order to retrieve those values if needed, added "totaldmg" keyword that returns the total amount of damage dealt by a creature in the current turn, added new restriction "coven in order to check if a player controls three or more creatures with different powers, added new ability "hasdisturb" when the Retrace cost of a card is a disturb cost (e.g. "Beloved Beggar"). https://github.com/WagicProject/wagic/commit/cc16db7256138febf26c1bf7fd4d9907c4f708fa ([Vitty85](https://github.com/Vitty85))
@@ -1822,7 +1822,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
y2 = event.getY(); y2 = event.getY();
float deltaY = y2 - y1; float deltaY = y2 - y1;
if (deltaY > DELTA_Y) if (deltaY > DELTA_Y)
parent.showOptionMenu(); parent.showOptionMenu(); // Emulate Android option menu button pressure.
else if (deltaY < -DELTA_Y)
SDLActivity.onNativeKeyDown(KeyEvent.KEYCODE_BACK ); // Emulate Android back button pressure.
break; break;
} }
+3 -2
View File
@@ -23,7 +23,8 @@ private:
vector<int> mUnlockRequirements; vector<int> mUnlockRequirements;
int mDeckId; int mDeckId;
string mAvatarFilename; string mAvatarFilename;
string mColorIndex; string mColorIndex;
bool mCommanderDeck; //Added to read the command tag in deck's metafile.
// statistical information // statistical information
int mGamesPlayed, mVictories, mPercentVictories, mDifficulty; int mGamesPlayed, mVictories, mPercentVictories, mDifficulty;
@@ -33,12 +34,12 @@ private:
public: public:
bool isCommanderDeck; //Added to read the command tag in deck's metafile.
DeckMetaData(const string& filename, bool isAI = false); DeckMetaData(const string& filename, bool isAI = false);
void LoadDeck(); void LoadDeck();
void LoadStats(); void LoadStats();
// Accessors // Accessors
bool isCommanderDeck(); //Added to read the command tag in deck's metafile.
string getFilename(); string getFilename();
string getDescription(); string getDescription();
string getName(); string getName();
+1 -1
View File
@@ -446,7 +446,7 @@ void DeckMenu::Add(int id, const string& text, const string& desc, bool forceFoc
else else
deckDescription = deckMetaData ? deckMetaData->getDescription() : desc; deckDescription = deckMetaData ? deckMetaData->getDescription() : desc;
if(deckMetaData && deckMetaData->isCommanderDeck) if(deckMetaData && deckMetaData->isCommanderDeck())
deckDescription = deckDescription + " (" + _("CMD") + ")"; // It will show a CMD suffix for Commander Decks. deckDescription = deckDescription + " (" + _("CMD") + ")"; // It will show a CMD suffix for Commander Decks.
menuItem->setDescription(deckDescription); menuItem->setDescription(deckDescription);
+6 -6
View File
@@ -21,7 +21,6 @@ DeckMetaData::DeckMetaData(const string& filename, bool isAI)
LoadDeck(); LoadDeck();
} }
void DeckMetaData::LoadDeck() void DeckMetaData::LoadDeck()
{ {
if (!mDeckLoaded) if (!mDeckLoaded)
@@ -30,7 +29,7 @@ void DeckMetaData::LoadDeck()
mName = trim(deck.meta_name); mName = trim(deck.meta_name);
mDescription = trim(deck.meta_desc); mDescription = trim(deck.meta_desc);
mDeckId = atoi((mFilename.substr(mFilename.find("deck") + 4, mFilename.find(".txt"))).c_str()); mDeckId = atoi((mFilename.substr(mFilename.find("deck") + 4, mFilename.find(".txt"))).c_str());
isCommanderDeck = deck.meta_commander; //Added to read the command tag in deck's metafile. mCommanderDeck = deck.meta_commander; //Added to read the command tag in deck's metafile.
vector<string> requirements = split(deck.meta_unlockRequirements, ','); vector<string> requirements = split(deck.meta_unlockRequirements, ',');
for(size_t i = 0; i < requirements.size(); ++i) for(size_t i = 0; i < requirements.size(); ++i)
@@ -49,10 +48,8 @@ void DeckMetaData::LoadDeck()
} }
} }
} }
void DeckMetaData::LoadStats() void DeckMetaData::LoadStats()
{ {
if (!mStatsLoaded) if (!mStatsLoaded)
@@ -65,7 +62,6 @@ void DeckMetaData::LoadStats()
mGamesPlayed = 0; mGamesPlayed = 0;
mColorIndex = ""; mColorIndex = "";
mDifficulty = 0; mDifficulty = 0;
isCommanderDeck = false;
stats->load(mPlayerDeck); stats->load(mPlayerDeck);
DeckStat * opponentDeckStats = stats->getDeckStat(mStatsFilename); DeckStat * opponentDeckStats = stats->getDeckStat(mStatsFilename);
@@ -115,6 +111,11 @@ int DeckMetaData::getAvatarId()
//Accessors //Accessors
bool DeckMetaData::isCommanderDeck()
{
return mCommanderDeck;
}
string DeckMetaData::getFilename() string DeckMetaData::getFilename()
{ {
return mFilename; return mFilename;
@@ -135,7 +136,6 @@ vector<int> DeckMetaData::getUnlockRequirements()
return mUnlockRequirements; return mUnlockRequirements;
} }
string DeckMetaData::getAvatarFilename() string DeckMetaData::getAvatarFilename()
{ {
return mAvatarFilename; return mAvatarFilename;
+1 -1
View File
@@ -42,7 +42,7 @@ vector<DeckMetaData *> GameState::BuildDeckList(const string& path, const string
if (meta) if (meta)
{ {
found = 1; found = 1;
if(!showall && ((meta->isCommanderDeck && type != GAME_TYPE_COMMANDER) || (!meta->isCommanderDeck && type == GAME_TYPE_COMMANDER))){ if(!showall && ((meta->isCommanderDeck() && type != GAME_TYPE_COMMANDER) || (!meta->isCommanderDeck() && type == GAME_TYPE_COMMANDER))){
meta = NULL; // It will show commander decks only in commander mode and it will hide them in other modes. meta = NULL; // It will show commander decks only in commander mode and it will hide them in other modes.
nbDecks++; nbDecks++;
continue; continue;
+1 -2
View File
@@ -896,10 +896,10 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
size_t dot = filename.find("."); size_t dot = filename.find(".");
meta_name = filename.substr(slash + 1, dot - slash - 1); meta_name = filename.substr(slash + 1, dot - slash - 1);
meta_id = atoi(meta_name.substr(4).c_str()); meta_id = atoi(meta_name.substr(4).c_str());
meta_commander = false;
std::string contents; std::string contents;
if (JFileSystem::GetInstance()->readIntoString(config_file, contents)) if (JFileSystem::GetInstance()->readIntoString(config_file, contents))
{ {
meta_commander = (contents.find("#CMD:")!=string::npos)?true:false; //Added to read the command tag in metafile.
std::stringstream stream(contents); std::stringstream stream(contents);
std::string s; std::string s;
while (std::getline(stream, s)) while (std::getline(stream, s))
@@ -970,7 +970,6 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
found = s.find("CMD:"); // Now it's possible to add a card to Command Zone even using their Name instead of ID such as normal deck cards. found = s.find("CMD:"); // Now it's possible to add a card to Command Zone even using their Name instead of ID such as normal deck cards.
if (found != string::npos) if (found != string::npos)
{ {
meta_commander = true; //Added to read the command tag in metafile.
if(!database) continue; if(!database) continue;
s = s.substr(found + 4); s = s.substr(found + 4);
s.erase(s.find_last_not_of("\t\n\v\f\r ") + 1); s.erase(s.find_last_not_of("\t\n\v\f\r ") + 1);