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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()){
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user