Merge pull request #574 from WagicProject/feature/play-from-grave

Feature/play from grave
This commit is contained in:
Xawotihs
2013-12-02 12:34:52 -08:00
10 changed files with 112 additions and 16 deletions
+1
View File
@@ -16,6 +16,7 @@ auto=flashbackrule
auto=retracerule auto=retracerule
auto=suspendrule auto=suspendrule
auto=morphrule auto=morphrule
auto=playfromgraveyardrule
auto=attackrule auto=attackrule
auto=blockrule auto=blockrule
auto=combattriggerrule auto=combattriggerrule
@@ -18104,6 +18104,13 @@ mana={3}{R}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Crucible of Worlds
auto=lord(land|mygraveyard) CanPlayFromGraveyard
text=You may play land cards from your graveyard.
mana={3}
type=Artifact
[/card]
[card]
name=Crude Rampart name=Crude Rampart
abilities=defender abilities=defender
facedown={3} facedown={3}
@@ -103468,6 +103475,15 @@ mana={1}{B}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Yawgmoth's Will
auto=lord(*|mygraveyard) canPlayFromGraveyard
auto=emblem transforms((,newability[@movedTo(*|mygraveyard):all(trigger[to]) moveTo(exile)])) ueot
auto=moveTo(exile)
text=Until end of turn, you may play cards from your graveyard. -- If a card would be put into your graveyard from anywhere this turn, exile that card instead.
mana={2}{B}
type=Sorcery
[/card]
[card]
name=Yawning Fissure name=Yawning Fissure
auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent
text=Each opponent sacrifices a land. text=Each opponent sacrifices a land.
@@ -3187,19 +3187,6 @@ mana={2}
type=Artifact type=Artifact
[/card] [/card]
[card] [card]
name=Crucible of Worlds
auto={0}:may moveTo(myBattlefield) target(land|mygraveyard) limit:1 myTurnOnly
# Above line does not work: "May moveto" from graveyards does
# not work due to interface issues. The "limit:1" doesn't work
# here either. Even if both worked, then the card would allow
# you to play lands *in addition* to the 1 land you can play per
# turn. Instead it should just give you the option to play this
# 1 land from your hand or your graveyard.
text=You may play land cards from your graveyard.
mana={3}
type=Artifact
[/card]
[card]
name=Cruel Deceiver name=Cruel Deceiver
text={1}: Look at the top card of your library. -- {2}: Reveal the top card of your library. If it's a land card, Cruel Deceiver gains "Whenever Cruel Deceiver deals damage to a creature, destroy that creature" until end of turn. Activate this ability only once each turn. text={1}: Look at the top card of your library. -- {2}: Reveal the top card of your library. If it's a land card, Cruel Deceiver gains "Whenever Cruel Deceiver deals damage to a creature, destroy that creature" until end of turn. Activate this ability only once each turn.
mana={1}{B} mana={1}{B}
+1
View File
@@ -249,6 +249,7 @@ curiosity2_i217.txt
crimson_kobolds.txt crimson_kobolds.txt
crosis_s_catacombs_1.txt crosis_s_catacombs_1.txt
crosis_s_catacombs_2.txt crosis_s_catacombs_2.txt
crucible_of_worlds.txt
crumble.txt crumble.txt
crystal_rod_i172.txt crystal_rod_i172.txt
cursed_land1_i188.txt cursed_land1_i188.txt
@@ -0,0 +1,26 @@
# Testing crucible of worlds (keyword: CANPLAYFROMGRAVEYARD)
# name=Crucible of Worlds
# text=You may play land cards from your graveyard.
[INIT]
FIRSTMAIN
[PLAYER1]
hand:island,plains
inplay:crucible of worlds
graveyard:forest,mountain
[PLAYER2]
[DO]
forest
# all next lands shouldn't be played
island
mountain
plains
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:crucible of worlds,forest
hand:island,plains
graveyard:mountain
[PLAYER2]
[END]
+2 -1
View File
@@ -218,7 +218,8 @@ class Constants
soulbond = 100, soulbond = 100,
LURE = 101, LURE = 101,
NOLEGEND = 102, NOLEGEND = 102,
NB_BASIC_ABILITIES = 103, CANPLAYFROMGRAVEYARD = 103,
NB_BASIC_ABILITIES = 104,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
+16
View File
@@ -66,6 +66,7 @@ public:
MTGEventBonus(GameObserver* observer, int _id); MTGEventBonus(GameObserver* observer, int _id);
virtual MTGEventBonus * clone() const; virtual MTGEventBonus * clone() const;
}; };
class MTGPutInPlayRule: public PermanentAbility class MTGPutInPlayRule: public PermanentAbility
{ {
public: public:
@@ -172,6 +173,21 @@ public:
virtual MTGMorphCostRule * clone() const; virtual MTGMorphCostRule * clone() const;
}; };
class MTGPlayFromGraveyardRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "cast card from graveyard";
}
virtual MTGPlayFromGraveyardRule * clone() const;
};
class MTGSuspendRule: public MTGAlternativeCostRule class MTGSuspendRule: public MTGAlternativeCostRule
{ {
public: public:
+6
View File
@@ -1039,6 +1039,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
observer->addObserver(NEW MTGMorphCostRule(observer, -1)); observer->addObserver(NEW MTGMorphCostRule(observer, -1));
return NULL; return NULL;
} }
found = s.find("playfromgraveyardrule");
if(found != string::npos)
{
observer->addObserver(NEW MTGPlayFromGraveyardRule(observer, -1));
return NULL;
}
//this rule handles attacking ability during attacker phase //this rule handles attacking ability during attacker phase
found = s.find("attackrule"); found = s.find("attackrule");
if(found != string::npos) if(found != string::npos)
+2 -1
View File
@@ -131,7 +131,8 @@ const char* Constants::MTGBasicAbilities[] = {
"poisondamager",//deals damage to players as poison counters. "poisondamager",//deals damage to players as poison counters.
"soulbond", "soulbond",
"lure", "lure",
"nolegend" "nolegend",
"canplayfromgraveyard"
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;
+42 -1
View File
@@ -273,6 +273,7 @@ MTGEventBonus * MTGEventBonus::clone() const
{ {
return NEW MTGEventBonus(*this); return NEW MTGEventBonus(*this);
} }
MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) : MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) :
PermanentAbility(observer, _id) PermanentAbility(observer, _id)
{ {
@@ -716,7 +717,6 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
copy->alternateCostPaid[alternateCostType] = 1; copy->alternateCostPaid[alternateCostType] = 1;
spell->resolve(); spell->resolve();
SAFE_DELETE(spell); SAFE_DELETE(spell);
game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, alternateCostType, 1);
} }
else else
{ {
@@ -1140,8 +1140,49 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id)
{
aType = MTGAbility::PUT_INTO_PLAY;
}
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
Player * player = game->currentlyActing();
ManaCost * cost = card->getManaCost();
if (!player->game->graveyard->hasCard(card))
return 0;
if (!card->has(Constants::CANPLAYFROMGRAVEYARD))
return 0;
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
}
int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
{
if (!isReactingToClick(card))
return 0;
ManaCost * cost = card->getManaCost();
card->paymenttype = MTGAbility::PUT_INTO_PLAY;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
}
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const
{
out << "MTGPlayFromGraveyardRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGPlayFromGraveyardRule * MTGPlayFromGraveyardRule::clone() const
{
return NEW MTGPlayFromGraveyardRule(*this);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
bool MTGAttackRule::select(Target* t) bool MTGAttackRule::select(Target* t)
{ {