Improved in-game menu (now the Cancel choice is on top and it's possibile to open/close the taskboard during game), improved add/remove "counter" keyword in order to avoid the trigger if needed (e.g. loop avoidance), fixed Italian and Spanish languages.

This commit is contained in:
Vittorio Alfieri
2021-06-18 12:22:16 +02:00
parent 5f0883943a
commit 5b7d8662b7
8 changed files with 70 additions and 38 deletions
+3
View File
@@ -1167,6 +1167,9 @@ Credits: =Creditos:
%s (%i)=%s (%i)
: Other cards=: Otras cartas
Check task board=Revisar las tareas en la pizarra
Open Task Board=Abrir las tareas en la pizarra
Close Task Board=Cerrar las tareas en la pizarra
Steal it=Robar
Steal 1,000 credits=Robar 1,000 creditos
Steal 2,000 credits=Robar 2,000 creditos
+3
View File
@@ -1190,6 +1190,9 @@ Credits per minute: %i=Crediti al minuto: %i
[]:other cards=[]:altre carte
See available tasks=Visualizza obiettivi disponibili
Task Board=Bacheca obiettivi
Check Task Board=Controlla Bacheca obiettivi
Open Task Board=Apri Bacheca obiettivi
Close Task Board=Chiudi Bacheca obiettivi
Toggle Images=Immagini Si/No
View Deck=Vedi Mazzo
+2 -1
View File
@@ -1165,8 +1165,9 @@ public:
int toughness;
string name;
string menu;
bool noevent;
AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness, int nb,int maxNb = 0,
AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness, int nb, int maxNb = 0, bool noevent = false,
ManaCost * cost = NULL);
int resolve();
+3
View File
@@ -5,6 +5,7 @@
#include "SimpleMenu.h"
#include "SimplePopup.h"
#include "DeckMenu.h"
#include "Tasks.h"
#include "MTGDeck.h"
#include "GameObserver.h"
#ifdef AI_CHANGE_TESTING
@@ -186,6 +187,7 @@ private:
DeckMenu * deckmenu;
DeckMenu * opponentMenu;
SimpleMenu * menu;
TaskList * taskList;
SimplePopup * popupScreen; // used for informational screens, modal
static int selectedPlayerDeckId;
static int selectedAIDeckId;
@@ -280,6 +282,7 @@ public:
MENUITEM_FILL_NEXT_STAGE = -31,
/////// End Tournament Mod ///////////
MENUITEM_TOGGLEATTACK_ALL_CREATURES = -32,
MENUITEM_TASKBOARD = -33,
MENUITEM_MORE_INFO = kInfoMenuID
};
+4 -4
View File
@@ -2226,8 +2226,8 @@ AAForetell * AAForetell::clone() const
//Counters
AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness,
int nb,int maxNb, ManaCost * cost) :
ActivatedAbility(observer, id, source, cost, 0),counterstring(counterstring), nb(nb),maxNb(maxNb), power(power), toughness(toughness), name(_name)
int nb, int maxNb, bool noevent, ManaCost * cost) :
ActivatedAbility(observer, id, source, cost, 0),counterstring(counterstring), nb(nb), maxNb(maxNb), power(power), toughness(toughness), name(_name), noevent(noevent)
{
this->target = target;
if (name.find("Level") != string::npos || name.find("level") != string::npos)
@@ -2281,7 +2281,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
}
if(!maxNb || (maxNb && currentAmount < maxNb))
{
_target->counters->addCounter(name.c_str(), power, toughness, false, false, source);
_target->counters->addCounter(name.c_str(), power, toughness, noevent, false, source);
}
}
}
@@ -2291,7 +2291,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
{
while (_target->next)
_target = _target->next;
_target->counters->removeCounter(name.c_str(), power, toughness, false, false, source);
_target->counters->removeCounter(name.c_str(), power, toughness, noevent, false, source);
}
}
+1 -1
View File
@@ -112,7 +112,7 @@ int Counters::addCounter(const char * _name, int _power, int _toughness, bool _n
{
counters[i]->added();
counters[i]->nb++;
if (!duplicated)
if (!_noevent && !duplicated)
{
WEvent * j = NEW WEventCounters(this,_name,_power,_toughness,true,false,_source);
dynamic_cast<WEventCounters*>(j)->targetCard = this->target;
+52 -30
View File
@@ -147,6 +147,7 @@ GameState(parent, "duel")
menu = NULL;
popupScreen = NULL;
mGamePhase = DUEL_STATE_UNSET;
taskList = NEW TaskList(options.profileFile(PLAYER_TASKS).c_str());
#ifdef TESTSUITE
testSuite = NULL;
@@ -929,40 +930,45 @@ void GameStateDuel::Update(float dt)
{
menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), DUEL_MENU_GAME_MENU, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25);
int cardsinhand = game->currentPlayer->game->hand->nb_cards;
//almosthumane - mulligan
if ((game->turn < 1) && (cardsinhand != 0) && game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
&& game->currentPlayer->game->inPlay->nb_cards == 0 && game->currentPlayer->game->graveyard->nb_cards == 0
&& game->currentPlayer->game->exile->nb_cards == 0 && game->currentlyActing() == (Player*)game->currentPlayer) //1st Play Check
//IF there was no play at the moment automatically mulligan
{
menu->Add(MENUITEM_MULLIGAN, "Mulligan");
}
//END almosthumane - mulligan
if(game->getCurrentGamePhase() == MTG_PHASE_COMBATATTACKERS){ // During attack phase it shows a button to toggle all creatures to attack mode
menu->Add(MENUITEM_TOGGLEATTACK_ALL_CREATURES, "Toggle Attack all Creatures");
}
menu->Add(MENUITEM_MAIN_MENU, "Back to main menu");
#ifdef TESTSUITE
menu->Add(MENUITEM_UNDO, "Undo");
#endif
#ifdef TESTSUITE
menu->Add(MENUITEM_LOAD, "Load");
#endif
if (mParent->players[1] == PLAYER_TYPE_CPU && (mParent->gameType == GAME_TYPE_COMMANDER || mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO))
{
menu->Add(MENUITEM_SHOW_SCORE, "Show current score");
if (mParent->players[0] == PLAYER_TYPE_CPU)
menu->Add(MENUITEM_CANCEL, "Cancel");
if(taskList->getState() != TaskList::TASKS_ACTIVE){
//almosthumane - mulligan
if ((game->turn < 1) && (cardsinhand != 0) && game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
&& game->currentPlayer->game->inPlay->nb_cards == 0 && game->currentPlayer->game->graveyard->nb_cards == 0
&& game->currentPlayer->game->exile->nb_cards == 0 && game->currentlyActing() == (Player*)game->currentPlayer) //1st Play Check
//IF there was no play at the moment automatically mulligan
{
if (tournament->getFastTimerMode())
menu->Add(MENUITEM_SPEED_NORMAL, "set Speed to NORMAL");
else
menu->Add(MENUITEM_SPEED_FAST, "set Speed to FAST");
menu->Add(MENUITEM_MULLIGAN, "Mulligan");
}
//END almosthumane - mulligan
if(game->getCurrentGamePhase() == MTG_PHASE_COMBATATTACKERS){ // During attack phase it shows a button to toggle all creatures to attack mode
menu->Add(MENUITEM_TOGGLEATTACK_ALL_CREATURES, "Toggle Attack all Creatures");
}
menu->Add(MENUITEM_MAIN_MENU, "Back to main menu");
#ifdef TESTSUITE
menu->Add(MENUITEM_UNDO, "Undo");
#endif
#ifdef TESTSUITE
menu->Add(MENUITEM_LOAD, "Load");
#endif
if (mParent->players[1] == PLAYER_TYPE_CPU && (mParent->gameType == GAME_TYPE_COMMANDER || mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO))
{
menu->Add(MENUITEM_SHOW_SCORE, "Show current score");
if (mParent->players[0] == PLAYER_TYPE_CPU)
{
if (tournament->getFastTimerMode())
menu->Add(MENUITEM_SPEED_NORMAL, "set Speed to NORMAL");
else
menu->Add(MENUITEM_SPEED_FAST, "set Speed to FAST");
}
}
}
menu->Add(MENUITEM_CANCEL, "Cancel");
}
if(taskList->getState() != TaskList::TASKS_ACTIVE){
menu->Add(MENUITEM_TASKBOARD, "Open task board");
} else {
menu->Add(MENUITEM_TASKBOARD, "Close task board");
}
setGamePhase(DUEL_STATE_MENU);
}
@@ -1038,6 +1044,8 @@ void GameStateDuel::Update(float dt)
default:
if (JGE_BTN_OK == mEngine->ReadButton()) mParent->SetNextState(GAME_STATE_MENU);
}
if(taskList && taskList->getState() == TaskList::TASKS_IN)
taskList->Update(dt);
}
void GameStateDuel::Render()
@@ -1235,6 +1243,11 @@ void GameStateDuel::Render()
}
}
}
if(taskList && taskList->getState() == TaskList::TASKS_ACTIVE){
taskList->Render();
if(menu)
menu->Render();
}
}
void GameStateDuel::ButtonPressed(int controllerId, int controlId)
@@ -1667,6 +1680,15 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
// menu->Close();
// mGamePhase = DUEL_STATE_CONTINUE;
// break;
case MENUITEM_TASKBOARD:
if(taskList->getState() != TaskList::TASKS_ACTIVE){
taskList->Start();
} else {
taskList->End();
}
menu->Close();
setGamePhase(DUEL_STATE_CANCEL);
break;
case MENUITEM_TOGGLEATTACK_ALL_CREATURES:
for(unsigned int i = 0; i < game->players[0]->inPlay()->cards.size(); i++){
if(game->players[0]->inPlay()->cards[i]->canAttack()){
+2 -2
View File
@@ -4004,9 +4004,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
DebugTrace("MTGAbility: can't parse counter:" << s);
return NULL;
}
bool noevent = (s.find("notrg") != string::npos)?true:false; // Added a way to don't trigger @counter effect.
MTGAbility * a =
NEW AACounter(observer, id, card, target,counterString, counter->name.c_str(), counter->power, counter->toughness, counter->nb,counter->maxNb);
NEW AACounter(observer, id, card, target,counterString, counter->name.c_str(), counter->power, counter->toughness, counter->nb, counter->maxNb, noevent);
delete (counter);
a->oneShot = 1;
return a;