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

View File

@@ -30,6 +30,7 @@ const int kInfoMenuID = -200;
const int kRandomPlayerMenuID = -11;
const int kRandomAIPlayerMenuID = -12;
const int kEvilTwinMenuID = -14;
const int kCommanderMenuID = -33;
class JGuiListener
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View File

@@ -1105,102 +1105,52 @@ id=457364
rarity=C
[/card]
[card]
primitive=Bedazzle
primitive=Bedeck // Bedazzle
id=457365
rarity=R
[/card]
[card]
primitive=Bedeck
id=457365
rarity=R
[/card]
[card]
primitive=Carnage
primitive=Carnival // Carnage
id=457366
rarity=U
[/card]
[card]
primitive=Carnival
id=457366
rarity=U
[/card]
[card]
primitive=Colossus
primitive=Collision // Colossus
id=457367
rarity=U
[/card]
[card]
primitive=Collision
id=457367
rarity=U
[/card]
[card]
primitive=Consume
primitive=Consecrate // Consume
id=457368
rarity=U
[/card]
[card]
primitive=Consecrate
id=457368
rarity=U
[/card]
[card]
primitive=Deploy
primitive=Depose // Deploy
id=457369
rarity=U
[/card]
[card]
primitive=Depose
id=457369
rarity=U
[/card]
[card]
primitive=Incongruity
primitive=Incubation // Incongruity
id=457370
rarity=U
[/card]
[card]
primitive=Incubation
id=457370
rarity=U
[/card]
[card]
primitive=Replicate
primitive=Repudiate // Replicate
id=457371
rarity=R
[/card]
[card]
primitive=Repudiate
id=457371
rarity=R
[/card]
[card]
primitive=Revenge
primitive=Revival // Revenge
id=457372
rarity=R
[/card]
[card]
primitive=Revival
id=457372
rarity=R
[/card]
[card]
primitive=Threat
primitive=Thrash // Threat
id=457373
rarity=R
[/card]
[card]
primitive=Thrash
id=457373
rarity=R
[/card]
[card]
primitive=Warden
id=457374
rarity=R
[/card]
[card]
primitive=Warrant
primitive=Warrant // Warden
id=457374
rarity=R
[/card]

File diff suppressed because it is too large Load Diff

View File

@@ -34231,8 +34231,11 @@ toughness=7
[card]
name=Elderwood Scion
abilities=trample,lifelink
auto=@targeted(this) from(mystack): altercost(colorless,-2)
auto=@targeted(this) from(opponentstack):add{2} opponent
auto=@targeted(this) from(instant[manacost=2]|myzones):choice name(This spell costs 2 less) name(This spell costs 2 less) add{C} controller
auto=@targeted(this) from(sorcery[manacost=2]|myzones):choice name(This spell costs 2 less) name(This spell costs 2 less) add{C} controller
auto=@targeted(this) from(instant[manacost>=3]|myzones):choice name(This spell costs 2 less) name(This spell costs 2 less) add{C}{C} controller
auto=@targeted(this) from(sorcery[manacost>=3]|myzones):choice name(This spell costs 2 less) name(This spell costs 2 less) add{C}{C} controller
auto=@targeted(this) from(*[instant;sorcery]|opponentzones):choice name(This spell costs 2 more) name(This spell costs 2 more) target(*[instant;sorcery]|opponentzones) transforms((,newability[pay[[{2}]] name(pay 2 mana) donothing?fizzle])) oneshot
text=Trample, Lifelink -- Spells you cast that target Elderwood Scion cost {2} less to cast. Spells your opponents cast that target Elderwood Scion cost {2} more to cast.
mana={3}{G}{W}
type=Creature
@@ -110539,7 +110542,7 @@ toughness=6
[card]
name=Sphinx of the Final Word
abilities=nofizzle,flying,opponentshroud
auto=lord(*[instant;sorcery]|mystack) nofizzle
auto=@targeted(*[instant;sorcery]|mystack) from(instant|opponentzones):choice name(Instant and sorcery can't be countered) name(Instant and sorcery can't be countered) all(instant|opponentzones) fizzle
text=Sphinx of the Final Word can't be countered. -- Flying, hexproof -- Instant and sorcery spells you control can't be countered by spells or abilities.
mana={5}{U}{U}
type=Creature

View File

@@ -626,8 +626,8 @@ subtype=Davriel
name=Domri, Anarch of Bolas
auto=counter(0/0,3,loyalty)
auto=lord(other creature|myBattlefield) +1/+0
auto={C(0/0,1,Loyalty)}:name(+1: Add Red mana and creatures can't be countered this turn) add{R} && lord(*[creature]|myStack) nofizzle ueot
auto={C(0/0,1,Loyalty)}:name(+1: Add Green mana and creatures can't be countered this turn) add{G} && lord(*[creature]|myStack) nofizzle ueot
auto={C(0/0,1,Loyalty)}:name(+1: Add Red mana and creatures can't be countered this turn) transforms((,newability[add{R}],newability[@targeted(creature|mystack) from(instant|opponentzones):choice name(Creaure can't be countered) name(Creaure can't be countered) all(instant|opponentzones) fizzle])) ueot
auto={C(0/0,1,Loyalty)}:name(+1: Add Green mana and creatures can't be countered this turn) transforms((,newability[add{G}],newability[@targeted(creature|mystack) from(instant|opponentzones):choice name(Creaure can't be countered) name(Creaure can't be countered) all(instant|opponentzones) fizzle])) ueot
auto={C(0/0,-2,Loyalty)}:name(-2: Target creature fights another creature) target(creature|myBattlefield) transforms((,newability[target(creature|opponentbattlefield) dynamicability<!powerstrike eachother!>])) ueot
text=Creatures you control get +1/+0. -- +1: Add {R} or {G}. Creature spells you cast this turn can't be countered. -- -2: Target creature you control fights target creature you don't control.
mana={1}{R}{G}
@@ -1352,7 +1352,7 @@ subtype=Karn
[card]
name=Kasmina, Enigmatic Mentor
auto=counter(0/0,5,loyalty)
auto=lord(*|opponentStack) altercost(colorless:+2)
auto=@targeted(*[creature;planeswalker]|myBattlefield) from(*[instant;sorcery]|opponentzones):choice name(This spell costs 2 more) name(This spell costs 2 more) target(*[instant;sorcery]|opponentzones) transforms((,newability[pay[[{2}]] name(pay 2 mana) donothing?fizzle])) oneshot
auto={C(0/0,-2,Loyalty)}:name(-2: Create a 2/2 Wizard, draw and discard a card) token(Wizard,Creature Wizard,2/2,blue) && ability$!name(Draw a card) draw:1!$ controller && ability$!name(discard a card) notatarget(*|myhand) reject!$ conroller
text=Spells your opponents cast that target a creature or planeswalker you control cost {2} more to cast. -- 2: Create a 2/2 blue Wizard creature token. Draw a card, then discard a card.
mana={3}{U}

View File

@@ -572,12 +572,6 @@ power=1
toughness=1
[/card]
[card]
name=As Luck Would Have It
text=Hexproof -- Whenever you roll a die, put a number of luck counters on As Luck Would Have It equal to the result. Then if there are 100 or more luck counters on As Luck Would Have It, you win the game. (Count both rolls if you reroll a die.)
mana={G}
type=Enchantment
[/card]
[card]
name=Ashcloud Phoenix
abilities=flying
text=Flying -- When Ashcloud Phoenix dies, return it to the battlefield face down. -- Morph {4}{R}{R} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) -- When Ashcloud Phoenix is turned face up, it deals 2 damage to each player.
@@ -1102,6 +1096,15 @@ mana={1}{G}
type=Instant
[/card]
[card]
name=Biomancer's Familiar
text=Activated abilities of creatures you control cost {2} less to activate. This effect can't reduce the mana in that cost to less than one mana. -- {T}: The next time target creature adapts this turn, it adapts as though it had no +1/+1 counters on it.
mana={G}{U}
type=Creature
subtype=Mutant
power=2
toughness=2
[/card]
[card]
name=Bioplasm
text=Whenever Bioplasm attacks, exile the top card of your library. If it's a creature card, Bioplasm gets +X/+Y until end of turn, where X is the exiled creature card's power and Y is its toughness.
mana={3}{G}{G}
@@ -2155,12 +2158,6 @@ power=1
toughness=1
[/card]
[card]
name=Chittering Doom
text=Whenever you roll a 4 or higher on a die, create a 1/1 green Squirrel creature token.
mana={3}{G}
type=Enchantment
[/card]
[card]
name=Chivalrous Chevalier
text=Flying -- When Chivalrous Chevalier enters the battlefield, return a creature you control to its owner's hand unless you compliment an opponent.
mana={4}{W}
@@ -2239,13 +2236,6 @@ type=Summon
subtype=Clamfolk
[/card]
[card]
name=Clam-I-Am
text=Whenever you roll a 3 on a six-sided die, you may reroll that die.
mana={2}{U}
type=Summon
subtype=Clamfolk
[/card]
[card]
name=Clarion Ultimatum
text=Choose five permanents you control. For each of those permanents, you may search your library for a card with the same name as that permanent. Put those cards onto the battlefield tapped, then shuffle your library.
mana={G}{G}{W}{W}{W}{U}{U}
@@ -2909,6 +2899,12 @@ mana={2}{W}
type=Enchantment
[/card]
[card]
name=Damping Sphere
text=If a land is tapped for two or more mana, it produces {C} instead of any other type and amount. -- Each spell a player casts costs 1 more to cast for each other spell that player has cast this turn.
mana={2}
type=Artifact
[/card]
[card]
name=Dance of Many
text=When Dance of Many enters the battlefield, put a token that's a copy of target nontoken creature onto the battlefield. -- When Dance of Many leaves the battlefield, exile the token. -- When the token leaves the battlefield, sacrifice Dance of Many. -- At the beginning of your upkeep, sacrifice Dance of Many unless you pay {U}{U}.
mana={U}{U}
@@ -4219,15 +4215,6 @@ mana={R}
type=Instant
[/card]
[card]
name=Feisty Stegosaurus
text=When this creature enters the battlefield, roll a six-sided die. This creature deals damage equal to the result to target creature an opponent controls.
mana={4}{R}
type=Host Creature
subtype=Dinosaur
power=2
toughness=1
[/card]
[card]
name=Fell the Mighty
text=Destroy all creatures with power greater than target creature's power.
mana={4}{W}
@@ -4923,6 +4910,12 @@ mana={2}{W}{W}
type=Enchantment
[/card]
[card]
name=Gideon's Sacrifice
text=Choose a creature or planeswalker you control. All damage that would be dealt this turn to you and permanents you control is dealt to the chosen permanent instead (if it's still on the battlefield) .
mana={W}
type=Instant
[/card]
[card]
name=Gift Horse
text=Whenever you crank Gift Horse, roll two six-sided dice. Create a number of 1/1 red Goblin creature tokens equal to the difference between those results.
type=Artifact
@@ -5498,15 +5491,6 @@ mana={4}{R}{R}
type=Enchantment
[/card]
[card]
name=Ground Pounder
text={3}{G}: Roll a six-sided die. Ground Pounder gets +X/+X until end of turn, where X is the result. -- Whenever you roll a 5 or higher on a die, Ground Pounder gains trample until end of turn.
mana={1}{G}
type=Creature
subtype=Goblin Warrior
power=2
toughness=2
[/card]
[card]
name=Grove of the Dreampods
text=When you planeswalk to Grove of the Dreampods or at the beginning of your upkeep, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield and the rest on the bottom of your library in a random order. -- Whenever you roll {K}, return target creature card from your graveyard to the battlefield.
type=Plane
@@ -5709,15 +5693,6 @@ mana={3}{R}
type=Sorcery
[/card]
[card]
name=Hammer Jammer
text=As Hammer Jammer enters the battlefield, roll a six-sided die. Hammer Jammer enters the battlefield with a number of +1/+1 counters on it equal to the result. -- Whenever you roll a die, remove all +1/+1 counters from Hammer Jammer, then put a number of +1/+1 counters on it equal to the result.
mana={3}{R}
type=Creature
subtype=Goblin Warrior
power=0
toughness=0
[/card]
[card]
name=Hammerfest Boomtacular
text=Whenever you cast a spell with a Goblin Explosioneers watermark, Hammerfest Boomtacular deals 2 damage to any target.
mana={3}{R}{R}
@@ -6855,6 +6830,15 @@ power=1
toughness=2
[/card]
[card]
name=Jodah, Archmage Eternal
text=Flying -- You may pay {W}{U}{B}{R}{G} rather than pay the mana cost for spells that you cast.
mana={1}{U}{R}{W}
type=Legendary Creature
subtype=Human Wizard
power=4
toughness=3
[/card]
[card]
name=Jotun Grunt
text=Cumulative upkeep—Put two cards from a single graveyard on the bottom of their owner's library. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)
mana={1}{W}
@@ -8447,6 +8431,12 @@ power=3
toughness=4
[/card]
[card]
name=Mirror March
text=Whenever a nontoken creature enters the battlefield under your control, flip a coin until you lose a flip. For each flip you won, create a token that's a copy of that creature. Those tokens gain haste. Exile them at the beginning of the next end step.
mana={5}{R}
type=Enchantment
[/card]
[card]
name=Mirror Mirror
text=Mirror Mirror comes into play tapped. -- {7}, {T}, Sacrifice Mirror Mirror: At end of turn, exchange life totals with target player and exchange all cards in play that you control, and all cards in your hand, library, and graveyard, with that player until end of game.
mana={7}
@@ -9283,6 +9273,12 @@ mana={3}{U}
type=Enchantment
[/card]
[card]
name=Oath of Teferi
text=When Oath of Teferi enters the battlefield, exile another target permanent you control. Return it to the battlefield under its owner's control at the beginning of the next end step. -- You may activate the loyalty abilities of planeswalkers you control twice each turn rather than only once.
mana={3}{W}{U}
type=Legendary Enchantment
[/card]
[card]
name=Oathkeeper, Takeno's Daisho
text=Equipped creature gets +3/+1. -- Whenever equipped creature dies, return that card to the battlefield under your control if it's a Samurai card. -- When Oathkeeper, Takeno's Daisho is put into a graveyard from the battlefield, exile equipped creature. -- Equip {2}
mana={3}
@@ -12735,15 +12731,6 @@ mana={4}{R}{R}
type=Instant
[/card]
[card]
name=Steel Squirrel
text=Whenever you roll a 5 or higher on a die, Steel Squirrel gets +X/+X until end of turn, where X is the result. -- {6}: Roll a six-sided die.
mana={2}
type=Artifact Creature
subtype=Squirrel
power=1
toughness=1
[/card]
[card]
name=Stet, Draconic Proofreader
text=Flying -- Whenever Stet, Draconic Proofreader attacks, you may exile a card from your graveyard. When you do, Stet, Draconic Proofreader deals 4 damage to any target whose name begins with the same letter as the exiled card. -- {W}: Delete the first letter of target permanent or player's name until end of turn.
mana={4}{R}{R}
@@ -14805,15 +14792,6 @@ power=2
toughness=3
[/card]
[card]
name=Willing Test Subject
text=Reach -- Whenever you roll a 4 or higher on a die, put a +1/+1 counter on Willing Test Subject. -- {6}: Roll a six-sided die.
mana={2}{G}
type=Creature
subtype=Spider Monkey Scientist
power=2
toughness=2
[/card]
[card]
name=Winding Constrictor
text=If one or more counters would be placed on an artifact or creature you control, that many plus one of each of those kinds of counters are placed on that permanent instead. -- If you would get one or more counters, you get that many plus one of each of those kinds of counters instead.
mana={B}{G}

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

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;

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.
};

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

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;

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);

View File

@@ -2670,7 +2670,7 @@ AASetTypeChosen::~AASetTypeChosen()
}
//
//choosing a type or color
//choosing flip coin
GenericFlipACoin::GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable *,string _toAdd, ManaCost * cost) :
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd)
{
@@ -2717,7 +2717,7 @@ GenericFlipACoin::~GenericFlipACoin()
{
}
//set color choosen
//set coin result
AASetCoin::AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target,int _side , string toAlter):
InstantAbility(observer, id, source),side(_side), abilityToAlter(toAlter)
{
@@ -2810,6 +2810,166 @@ AASetCoin::~AASetCoin()
{
}
//
//rolling a 6 side die
GenericRollDie::GenericRollDie(GameObserver* observer, int id, MTGCardInstance * source, Targetable *, string _toAdd, ManaCost * cost, int userchoice) :
ActivatedAbility(observer, id, source, cost, 0), baseAbility(_toAdd), userchoice(userchoice)
{
this->GetId();
setDie = NULL;
}
int GenericRollDie::resolve()
{
if (!target)
return 0;
vector<MTGAbility*>selection;
if(userchoice > 0 && userchoice < 7){
setDie = NEW AASetDie(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, userchoice, baseAbility);
MTGAbility * set = setDie->clone();
set->oneShot = true;
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
set->resolve();
SAFE_DELETE(setDie);
} else{
for (int i = 1; i < 7; ++i)
{
setDie = NEW AASetDie(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i, baseAbility);
MTGAbility * set = setDie->clone();
set->oneShot = true;
selection.push_back(set);
SAFE_DELETE(setDie);
}
}
if(selection.size() > 1)
{
MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, false, selection);
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
a1->resolve();
}
return 1;
}
const string GenericRollDie::getMenuText()
{
return "Roll a Die";
}
GenericRollDie * GenericRollDie::clone() const
{
GenericRollDie * a = NEW GenericRollDie(*this);
return a;
}
GenericRollDie::~GenericRollDie()
{
}
//set color choosen
AASetDie::AASetDie(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target, int _side, string toAlter):
InstantAbility(observer, id, source),side(_side), abilityToAlter(toAlter)
{
this->target = _target;
abilityAltered = NULL;
}
int AASetDie::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->dieSide = side;
int roll = 1 + game->getRandomGenerator()->random() % 6;
_target->lastRollResult = roll;
WEvent * e = NEW WEventCardRollDie(_target);
game->receiveEvent(e);
vector<string>Win = parseBetween(abilityToAlter,"winability "," winabilityend");
if(Win.size())
{
abilityWin = Win[1];
}
vector<string>Lose = parseBetween(abilityToAlter,"loseability "," loseabilityend");
if(Lose.size())
{
abilityLose = Lose[1];
}
if(abilityWin.size() && roll == side)
{
AbilityFactory af(game);
abilityAltered = af.parseMagicLine(abilityWin, 0, NULL, _target);
abilityAltered->canBeInterrupted = false;
if(abilityAltered->oneShot)
{
abilityAltered->resolve();
SAFE_DELETE(abilityAltered);
}
else
{
abilityAltered->addToGame();
}
MTGAbility * message = NEW MTGEventText(game,this->GetId(), source, "You Won The Die Roll");
message->oneShot = true;
message->addToGame();
}
else if(abilityWin.size() && !abilityLose.size())
{
MTGAbility * message = NEW MTGEventText(game,this->GetId(), source, "You Lost The Die Roll");
message->oneShot = true;
message->addToGame();
}
else if(abilityLose.size() && roll != side)
{
AbilityFactory af(game);
abilityAltered = af.parseMagicLine(abilityLose, 0, NULL, _target);
abilityAltered->canBeInterrupted = false;
if(abilityAltered->oneShot)
{
abilityAltered->resolve();
SAFE_DELETE(abilityAltered);
}
else
{
abilityAltered->addToGame();
}
MTGAbility * message = NEW MTGEventText(game,this->GetId(), source, "You Lost The Die Roll");
message->oneShot = true;
message->addToGame();
}
else if(abilityLose.size())
{
MTGAbility * message = NEW MTGEventText(game,this->GetId(), source, "You Won The Die Roll");
message->oneShot = true;
message->addToGame();
}
_target->skipDamageTestOnce = true;
return 1;
}
const string AASetDie::getMenuText()
{
if(side == 1)
return "Your choice is 1";
if(side == 2)
return "Your choice is 2";
if(side == 3)
return "Your choice is 3";
if(side == 4)
return "Your choice is 4";
if(side == 5)
return "Your choice is 5";
return "Your choice is 6";
}
AASetDie * AASetDie::clone() const
{
return NEW AASetDie(*this);
}
AASetDie::~AASetDie()
{
}
//paying for an ability as an effect but as a cost
GenericPaidAbility::GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source,
Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, bool asAlternate, ManaCost * cost) :

View File

@@ -277,6 +277,12 @@ void Credits::compute(GameObserver* g, GameApp * _app)
goa = (GameOptionAward*) &options[Options::EVILTWIN_MODE_UNLOCKED];
goa->giveAward();
}
else if ((unlocked = isCommanderUnlocked()))
{
unlockedTextureName = "commander_unlocked.png";
goa = (GameOptionAward*) &options[Options::COMMANDER_MODE_UNLOCKED];
goa->giveAward();
}
else if ((unlocked = isRandomDeckUnlocked()))
{
unlockedTextureName = "randomdeck_unlocked.png";
@@ -669,6 +675,15 @@ int Credits::isEvilTwinUnlocked()
return 0;
}
int Credits::isCommanderUnlocked()
{
if (options[Options::COMMANDER_MODE_UNLOCKED].number)
return 0;
if (p1->life >= 40 && p2->game->graveyard->nb_cards && (p1->game->graveyard->nb_cards < p2->game->graveyard->nb_cards))
return 1;
return 0;
}
int Credits::isRandomDeckUnlocked()
{
if (0 == options[Options::DIFFICULTY].number)

View File

@@ -61,6 +61,9 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
case kRandomAIPlayerMenuID:
mImageFilename = "noavatar.jpg";
break;
case kCommanderMenuID:
mImageFilename = "noavatar.jpg";
break;
case kEvilTwinMenuID:
{
mImageFilename = "avatar.jpg";

View File

@@ -74,6 +74,7 @@ const string Options::optionNames[] = {
"prx_eviltwin",
"prx_rnddeck",
"aw_collector",
"prx_commander",
};

View File

@@ -91,6 +91,10 @@ void GameStateAwards::Start()
btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::AWARD_COLLECTOR, this);
listview->Add(btn);
aw = NEW WGuiAward(Options::COMMANDER_MODE_UNLOCKED, "Commander Format", "Play a Commander Format game.");
btn = NEW WGuiButton(aw, GUI_AWARD_BUTTON, Options::COMMANDER_MODE_UNLOCKED, this);
listview->Add(btn);
wgh = NEW WGuiHeader("");
listview->Add(wgh);

View File

@@ -222,6 +222,8 @@ void GameStateMenu::fillScroller()
scroller->Add(_("You haven't unlocked the random deck mode yet"));
if (!options[Options::EVILTWIN_MODE_UNLOCKED].number)
scroller->Add(_("You haven't unlocked the evil twin mode yet"));
if (!options[Options::COMMANDER_MODE_UNLOCKED].number)
scroller->Add(_("You haven't unlocked the commander format yet"));
//Unlocked sets
int nbunlocked = 0;
@@ -264,6 +266,10 @@ int GameStateMenu::gamePercentComplete() {
if (options[Options::EVILTWIN_MODE_UNLOCKED].number)
done++;
total++;
if (options[Options::COMMANDER_MODE_UNLOCKED].number)
done++;
//Unlocked sets
total+= setlist.size();
for (int i = 0; i < setlist.size(); i++)

View File

@@ -1216,23 +1216,33 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
//Card is mutated
if (TargetChooser * tc = parseSimpleTC(s, "mutated", card))
return NEW TrCardMutated(observer, id, card, tc,once,limitOnceATurn);
return NEW TrCardMutated(observer, id, card, tc, once, limitOnceATurn);
//Surveil has been performed from controller
if (TargetChooser * tc = parseSimpleTC(s, "surveiled", card))
return NEW TrCardSurveiled(observer, id, card, tc,once,limitOnceATurn);
return NEW TrCardSurveiled(observer, id, card, tc, once, limitOnceATurn);
//Roll die has been performed from a card
if (TargetChooser * tc = parseSimpleTC(s, "dierolled", card)){
int rollresult = 0;
vector<string>res = parseBetween(s, "result(",")");
if(res.size()){
rollresult = atoi(res[1].c_str());
}
return NEW TrCardRolledDie(observer, id, card, tc, once, limitOnceATurn, rollresult);
}
//Token has been created
if (TargetChooser * tc = parseSimpleTC(s, "tokencreated", card))
return NEW TrTokenCreated(observer, id, card, tc,once);
return NEW TrTokenCreated(observer, id, card, tc, once);
//Card is sacrificed
if (TargetChooser * tc = parseSimpleTC(s, "sacrificed", card))
return NEW TrCardSacrificed(observer, id, card, tc,once);
return NEW TrCardSacrificed(observer, id, card, tc ,once);
//Card is Discarded
if (TargetChooser * tc = parseSimpleTC(s, "discarded", card))
return NEW TrCardDiscarded(observer, id, card, tc,once);
return NEW TrCardDiscarded(observer, id, card, tc, once);
//Card is cycled
if (TargetChooser * tc = parseSimpleTC(s, "cycled", card))
@@ -2585,7 +2595,23 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
if (splitFlipCoin.size())
{
string a1 = splitFlipCoin[1];
MTGAbility * a = NEW GenericFlipACoin(observer, id, card, target,a1);
MTGAbility * a = NEW GenericFlipACoin(observer, id, card, target, a1);
a->oneShot = 1;
a->canBeInterrupted = false;
return a;
}
//roll a die
vector<string> splitRollDie = parseBetween(s, "rolladie ", " rollend");
if (splitRollDie.size())
{
string a1 = splitRollDie[1];
int userchoice = 0;
if(a1[0] >= 48 && a1[0] <= 57){
userchoice = a1[0] - 48;
a1 = a1.substr(2);
}
MTGAbility * a = NEW GenericRollDie(observer, id, card, target, a1, NULL, userchoice);
a->oneShot = 1;
a->canBeInterrupted = false;
return a;
@@ -2600,6 +2626,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->canBeInterrupted = false;
return a;
}
//Upkeep Cost
found = s.find("upcost");
if (found != string::npos)

View File

@@ -262,6 +262,8 @@ void MTGCardInstance::initMTGCI()
chooseacolor = -1;
chooseasubtype = "";
coinSide = -1;
dieSide = 0;
lastRollResult = 0;
isAttacking = NULL;
storedCard = NULL;
storedSourceCard = NULL;

View File

@@ -297,6 +297,11 @@ WEventCardSurveiled::WEventCardSurveiled(MTGCardInstance * card) :
{
}
WEventCardRollDie::WEventCardRollDie(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCardMutated::WEventCardMutated(MTGCardInstance * card) :
WEventCardUpdate(card)
{
@@ -516,6 +521,12 @@ Targetable * WEventCardSurveiled::getTarget(int target)
return NULL;
}
Targetable * WEventCardRollDie::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventTokenCreated::getTarget(int target)
{
if (target) return card;