Added commander mode achievement and improved its graphic resources, added fixed primitives, fixes RNA set file, added new keyword and events to code the ability of six-side die roll.

This commit is contained in:
valfieri
2020-12-14 19:20:05 +01:00
parent a753bb0c1b
commit bf3d35463f
22 changed files with 1224 additions and 189 deletions
+63 -4
View File
@@ -655,9 +655,9 @@ private:
if(card->playerTarget)
intValue = card->playerTarget->curses.size();
}
else if (s == "lifetotal")
else if (s == "lifetotal" || s == "opponentlifetotal")
{
intValue = target->controller()->life;
intValue = (s == "lifetotal")?target->controller()->life:target->controller()->opponent()->life;
}
else if (s == "startinglife")
{
@@ -729,9 +729,9 @@ private:
{
intValue = (s == "mypoisoncount")?target->controller()->poisonCount:target->controller()->opponent()->poisonCount;
}
else if (s == "opponentlifetotal")
else if(s == "lastrollresult" || s == "lastrollchoice")
{
intValue = target->controller()->opponent()->life;
intValue = (s == "lastrollresult")?target->lastRollResult:target->dieSide;
}
else if (s == "pdrewcount" || s == "odrewcount")
{
@@ -1762,6 +1762,36 @@ public:
}
};
class TrCardRolledDie: public Trigger
{
public:
bool limitOnceATurn;
int triggeredTurn;
int rollresult;
TrCardRolledDie(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool limitOnceATurn = false, int rollresult = 0) :
Trigger(observer, id, source,once, tc),limitOnceATurn(limitOnceATurn), rollresult(rollresult)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardRollDie * e = dynamic_cast<WEventCardRollDie *> (event);
if (!e) return 0;
if (limitOnceATurn && triggeredTurn == game->turn)
return 0;
if (rollresult > 0 && rollresult != e->card->lastRollResult)
return 0;
if (!tc->canTarget(e->card)) return 0;
triggeredTurn = game->turn;
return 1;
}
TrCardRolledDie * clone() const
{
return NEW TrCardRolledDie(*this);
}
};
class TrTokenCreated: public Trigger
{
public:
@@ -7411,6 +7441,35 @@ public:
GenericFlipACoin * clone() const;
~GenericFlipACoin();
};
//------------------------------------------------
//Roll a die and call it, with win or lose abilities
class AASetDie: public InstantAbility
{
public:
int side;
string abilityToAlter;
string abilityWin;
string abilityLose;
MTGAbility * abilityAltered;
AASetDie(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
int resolve();
const string getMenuText();
AASetDie * clone() const;
~AASetDie();
};
class GenericRollDie: public ActivatedAbility
{
public:
string baseAbility;
AASetDie * setDie;
int userchoice;
GenericRollDie(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL, int userchoice = 0);
int resolve();
const string getMenuText();
GenericRollDie * clone() const;
~GenericRollDie();
};
//------------
class GenericPaidAbility: public ActivatedAbility
+1
View File
@@ -44,6 +44,7 @@ private:
time_t gameLength;
int isDifficultyUnlocked(DeckStats * stats);
int isEvilTwinUnlocked();
int isCommanderUnlocked();
int isRandomDeckUnlocked();
int IsMoreAIDecksUnlocked(DeckStats * stats);
string unlockedTextureName;
+1
View File
@@ -89,6 +89,7 @@ public:
EVILTWIN_MODE_UNLOCKED,
RANDOMDECK_MODE_UNLOCKED,
AWARD_COLLECTOR,
COMMANDER_MODE_UNLOCKED,
LAST_NAMED, //Any option after this does not look up in optionNames.
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
};
+1
View File
@@ -255,6 +255,7 @@ public:
MENUITEM_RANDOM_AI = kRandomAIPlayerMenuID,
MENUITEM_MAIN_MENU = -13,
MENUITEM_EVIL_TWIN = kEvilTwinMenuID,
MENUITEM_COMMANDER = kCommanderMenuID,
MENUITEM_MULLIGAN = -15,
MENUITEM_UNDO = -16,
#ifdef TESTSUITE
+3 -1
View File
@@ -113,7 +113,9 @@ public:
int chooseacolor;
string chooseasubtype;
int coinSide;//1 = tails
int dieSide;
int lastRollResult;
int stillInUse();
int didattacked;
int didblocked;
+6
View File
@@ -366,6 +366,12 @@ struct WEventCardSurveiled : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//roll die event
struct WEventCardRollDie : public WEventCardUpdate {
WEventCardRollDie(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//mutation event
struct WEventCardMutated : public WEventCardUpdate {
WEventCardMutated(MTGCardInstance * card);