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

View File

@@ -2,8 +2,11 @@
## [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
- *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))

View File

@@ -1822,7 +1822,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
y2 = event.getY();
float deltaY = y2 - y1;
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;
}

View File

@@ -23,7 +23,8 @@ private:
vector<int> mUnlockRequirements;
int mDeckId;
string mAvatarFilename;
string mColorIndex;
string mColorIndex;
bool mCommanderDeck; //Added to read the command tag in deck's metafile.
// statistical information
int mGamesPlayed, mVictories, mPercentVictories, mDifficulty;
@@ -33,12 +34,12 @@ private:
public:
bool isCommanderDeck; //Added to read the command tag in deck's metafile.
DeckMetaData(const string& filename, bool isAI = false);
void LoadDeck();
void LoadStats();
// Accessors
bool isCommanderDeck(); //Added to read the command tag in deck's metafile.
string getFilename();
string getDescription();
string getName();

View File

@@ -446,7 +446,7 @@ void DeckMenu::Add(int id, const string& text, const string& desc, bool forceFoc
else
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.
menuItem->setDescription(deckDescription);

View File

@@ -21,7 +21,6 @@ DeckMetaData::DeckMetaData(const string& filename, bool isAI)
LoadDeck();
}
void DeckMetaData::LoadDeck()
{
if (!mDeckLoaded)
@@ -30,7 +29,7 @@ void DeckMetaData::LoadDeck()
mName = trim(deck.meta_name);
mDescription = trim(deck.meta_desc);
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, ',');
for(size_t i = 0; i < requirements.size(); ++i)
@@ -49,10 +48,8 @@ void DeckMetaData::LoadDeck()
}
}
}
void DeckMetaData::LoadStats()
{
if (!mStatsLoaded)
@@ -65,7 +62,6 @@ void DeckMetaData::LoadStats()
mGamesPlayed = 0;
mColorIndex = "";
mDifficulty = 0;
isCommanderDeck = false;
stats->load(mPlayerDeck);
DeckStat * opponentDeckStats = stats->getDeckStat(mStatsFilename);
@@ -115,6 +111,11 @@ int DeckMetaData::getAvatarId()
//Accessors
bool DeckMetaData::isCommanderDeck()
{
return mCommanderDeck;
}
string DeckMetaData::getFilename()
{
return mFilename;
@@ -135,7 +136,6 @@ vector<int> DeckMetaData::getUnlockRequirements()
return mUnlockRequirements;
}
string DeckMetaData::getAvatarFilename()
{
return mAvatarFilename;

View File

@@ -42,7 +42,7 @@ vector<DeckMetaData *> GameState::BuildDeckList(const string& path, const string
if (meta)
{
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.
nbDecks++;
continue;

View File

@@ -896,10 +896,10 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
size_t dot = filename.find(".");
meta_name = filename.substr(slash + 1, dot - slash - 1);
meta_id = atoi(meta_name.substr(4).c_str());
meta_commander = false;
std::string 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::string 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.
if (found != string::npos)
{
meta_commander = true; //Added to read the command tag in metafile.
if(!database) continue;
s = s.substr(found + 4);
s.erase(s.find_last_not_of("\t\n\v\f\r ") + 1);