Merge branch 'master' into iOS-Build

This commit is contained in:
xawotihs
2015-09-13 18:42:31 +02:00
25 changed files with 2390 additions and 201 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4509,24 +4509,12 @@ mana={3}{W}
type=Enchantment
[/card]
[card]
name=Endless Swarm
text=Put a 1/1 green Snake creature token onto the battlefield for each card in your hand. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability.)
mana={5}{G}{G}{G}
type=Sorcery
[/card]
[card]
name=Endoskeleton
text=You may choose not to untap Endoskeleton during your untap step. -- {2}, {T}: Target creature gets +0/+3 for as long as Endoskeleton remains tapped.
mana={2}
type=Artifact
[/card]
[card]
name=Enduring Ideal
text=Search your library for an enchantment card and put it onto the battlefield. Then shuffle your library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability.)
mana={5}{W}{W}
type=Sorcery
[/card]
[card]
name=Enduring Renewal
text=Play with your hand revealed. -- If you would draw a card, reveal the top card of your library instead. If it's a creature card, put it into your graveyard. Otherwise, draw a card. -- Whenever a creature is put into your graveyard from the battlefield, return it to your hand.
mana={2}{W}{W}
@@ -4707,12 +4695,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Eternal Dominion
text=Search target opponent's library for an artifact, creature, enchantment, or land card. Put that card onto the battlefield under your control. Then that player shuffles his or her library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. You may choose a new target for the copy.)
mana={7}{U}{U}{U}
type=Sorcery
[/card]
[card]
name=Etherium-Horn Sorcerer
text={1}{U}{R}: Return Etherium-Horn Sorcerer to its owner's hand. -- Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)
mana={4}{U}{R}
@@ -5428,12 +5410,6 @@ mana={2}{G}
type=Enchantment
[/card]
[card]
name=Forbidden Crypt
text=If you would draw a card, return a card from your graveyard to your hand instead. If you can't, you lose the game. -- If a card would be put into your graveyard from anywhere, exile that card instead.
mana={3}{B}{B}
type=Enchantment
[/card]
[card]
name=Forbidden Ritual
text=Sacrifice a nontoken permanent. If you do, target opponent loses 2 life unless he or she sacrifices a permanent or discards a card. You may repeat this process any number of times.
mana={2}{B}{B}
@@ -6598,15 +6574,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Gravebane Zombie
text=If Gravebane Zombie would be put into a graveyard from the battlefield, put Gravebane Zombie on top of its owner's library instead.
mana={3}{B}
type=Creature
subtype=Zombie
power=3
toughness=2
[/card]
[card]
name=Graven Dominator
text=Flying -- Haunt (When this card is put into a graveyard from the battlefield, exile it haunting target creature.) -- When Graven Dominator enters the battlefield or the creature it haunts is put into a graveyard, each other creature becomes 1/1 until end of turn.
mana={4}{W}{W}
@@ -10813,12 +10780,6 @@ power=2
toughness=2
[/card]
[card]
name=Neverending Torment
text=Search target player's library for X cards, where X is the number of cards in your hand, and exile them. Then that player shuffles his or her library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. You may choose a new target for the copy.)
mana={4}{B}{B}
type=Sorcery
[/card]
[card]
name=New Benalia
text=New Benalia enters the battlefield tapped. -- When New Benalia enters the battlefield, scry 1. (To scry 1, look at the top card of your library, then you may put that card on the bottom of your library.) -- {T}: Add {W} to your mana pool.
type=Land
@@ -11676,51 +11637,6 @@ mana={3}{B}{B}
type=Sorcery
[/card]
[card]
name=Patron of the Akki
text=Goblin offering (You may cast this card any time you could cast an instant by sacrificing a Goblin and paying the difference in mana costs between this and the sacrificed Goblin. Mana cost includes color.) -- Whenever Patron of the Akki attacks, creatures you control get +2/+0 until end of turn.
mana={4}{R}{R}
type=Legendary Creature
subtype=Spirit
power=5
toughness=5
[/card]
[card]
name=Patron of the Kitsune
text=Fox offering (You may cast this card any time you could cast an instant by sacrificing a Fox and paying the difference in mana costs between this and the sacrificed Fox. Mana cost includes color.) -- Whenever a creature attacks, you may gain 1 life.
mana={4}{W}{W}
type=Legendary Creature
subtype=Spirit
power=5
toughness=6
[/card]
[card]
name=Patron of the Moon
text=Moonfolk offering (You may cast this card any time you could cast an instant by sacrificing a Moonfolk and paying the difference in mana costs between this and the sacrificed Moonfolk. Mana cost includes color.) -- Flying -- {1}: Put up to two land cards from your hand onto the battlefield tapped.
mana={5}{U}{U}
type=Legendary Creature
subtype=Spirit
power=5
toughness=4
[/card]
[card]
name=Patron of the Nezumi
text=Rat offering (You may cast this card any time you could cast an instant by sacrificing a Rat and paying the difference in mana costs between this and the sacrificed Rat. Mana cost includes color.) -- Whenever a permanent is put into an opponent's graveyard, that player loses 1 life.
mana={5}{B}{B}
type=Legendary Creature
subtype=Spirit
power=6
toughness=6
[/card]
[card]
name=Patron of the Orochi
text=Snake offering (You may cast this card any time you could cast an instant by sacrificing a Snake and paying the difference in mana costs between this and the sacrificed Snake. Mana cost includes color.) -- {T}: Untap all Forests and all green creatures. Activate this ability only once each turn.
mana={6}{G}{G}
type=Legendary Creature
subtype=Spirit
power=7
toughness=7
[/card]
[card]
name=Pay No Heed
text=Prevent all damage a source of your choice would deal this turn.
mana={W}
@@ -13271,15 +13187,6 @@ mana={1}{U}
type=Sorcery
[/card]
[card]
name=Rest in Peace
#Note this is replacement effect, I think wagic has no override rule.
auto=moveto(exile) all(*|graveyard)
auto=@movedTo(*|graveyard):all(trigger[to]) moveTo(exile)
text=When Rest in Peace enters the battlefield, exile all cards from all graveyards. -- If a card or token would be put into a graveyard from anywhere, exile it instead.
mana={1}{W}
type=Enchantment
[/card]
[card]
name=Restless Dreams
text=As an additional cost to cast Restless Dreams, discard X cards. -- Return X target creature cards from your graveyard to your hand.
mana={B}
@@ -18954,12 +18861,6 @@ mana={2}{W}
type=Instant
[/card]
[card]
name=Yawgmoth's Agenda
text=You can't cast more than one spell each turn. -- You may play cards from your graveyard. -- If a card would be put into your graveyard from anywhere, exile it instead.
mana={3}{B}{B}
type=Enchantment
[/card]
[card]
name=Ydwen Efreet
text=Whenever Ydwen Efreet blocks, flip a coin. If you lose the flip, remove Ydwen Efreet from combat and it can't block this turn. Creatures it was blocking that had become blocked by only Ydwen Efreet this combat become unblocked.
mana={R}{R}{R}

View File

@@ -0,0 +1,28 @@
#Testing Gravebane Zombie
#after gravebane zombie dies, activate archivist
#and you must draw gravebane zombie if its on the top
#of your library
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Gravebane Zombie, Archivist
hand:Wrecking Ball
library:mountain, plains, swamp
manapool:{2}{R}{B}
[PLAYER2]
[DO]
Wrecking Ball
Gravebane Zombie
Archivist
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:Archivist
library:mountain, plains, swamp
hand:Gravebane Zombie
graveyard:Wrecking Ball
manapool:{0}
life:20
[PLAYER2]
life:20
[END]

View File

@@ -0,0 +1,47 @@
#Testing Turn to Frog to Serra Angel with Crusade in play.
#M15 uses base power template, so setting the power/toughness.
#only affects the base or original power/toughness.
#Turn to Frog makes Serra Angel a 1/1 blue frog... latest pull
#request from GIT fixes the issue of Serra Angel dying
#from crusade because of invalid reduction of P/T :)
#
#First attack is 1/1 blue Serra Angel unaffected by Crusade
#Second attack is 5/5 Serra Angel affected by Crusade :)
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Serra Angel, Crusade
hand:Turn to Frog
manapool:{1}{U}
[PLAYER2]
[DO]
Turn to Frog
Serra Angel
next
next
Serra Angel
next
eot
eot
#untap
next
#upkeep
next
#draw
next
#main1
next
#combat begin
next
#attackers
Serra Angel
eot
[ASSERT]
UNTAP
[PLAYER1]
inplay:Serra Angel, Crusade
graveyard:Turn to Frog
manapool:{0}
[PLAYER2]
life:14
[END]

View File

@@ -0,0 +1,41 @@
#Testing Turn to Frog to Serra Angel with Glorious Anthem in play.
#First attack is 2/2 blue Serra Angel affected by Glorious Anthem
#Second attack is 5/5 Serra Angel affected by Glorious Anthem :)
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Serra Angel, Glorious Anthem
hand:Turn to Frog
manapool:{1}{U}
[PLAYER2]
[DO]
Turn to Frog
Serra Angel
next
next
Serra Angel
next
eot
eot
#untap
next
#upkeep
next
#draw
next
#main1
next
#combat begin
next
#attackers
Serra Angel
eot
[ASSERT]
UNTAP
[PLAYER1]
inplay:Serra Angel, Glorious Anthem
graveyard:Turn to Frog
manapool:{0}
[PLAYER2]
life:13
[END]

View File

@@ -374,6 +374,7 @@ goblin_lackey4.txt
goblin_offensive.txt
goblin_razerunners.txt
golgari_germination_i153.txt
Gravebane_Zombie.txt
gravedigger.txt
gravity_well.txt
gravity_well2.txt
@@ -440,6 +441,7 @@ kudzu_i168.txt
Lethargy_Trap.txt
Lethargy_Trap2.txt
leveler.txt
leyline_of_the_void.txt
lhurgoyf.txt
liability.txt
library_of_alexandria1.txt
@@ -532,6 +534,8 @@ prowess_of_the_fair.txt
prowess_of_the_fair2.txt
prowess_of_the_fair3.txt
PTInstant.txt
PT_M15_errata.txt
PT_M15_errata2.txt
pygmy_troll.txt
pyknite_i426.txt
pyroclasm.txt
@@ -569,6 +573,7 @@ Rending_Vines2.txt
resounding_roar.txt
resurrection.txt
resuscitate_i210.txt
restinpeace.txt
righteous_cause.txt
rise_from_the_grave.txt
river_kelpie2_i335.txt

View File

@@ -0,0 +1,26 @@
#Testing Leyline of the Void vs Darksteel Colossus and Black Sun's Zenith
#Darksteel Colossus must be on owners library
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Leyline of the Void, Forbidden Orchard
hand:Black Sun's Zenith
manapool:{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}
[PLAYER2]
inplay:Darksteel Colossus
library:Mountain
[DO]
Forbidden Orchard
choice 2
Black Sun's Zenith
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:Leyline of the Void, Forbidden Orchard
library:Black Sun's Zenith
manapool:{0}
life:20
[PLAYER2]
library:Mountain, Darksteel Colossus
life:20
[END]

View File

@@ -0,0 +1,23 @@
#Testing Rest in Peace vs Disenchant
#Rest in Peace should be exiled while Disenchant must be put
#in the owner's graveyard..
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Rest in Peace
hand:Disenchant
manapool:{W}{W}
[PLAYER2]
[DO]
Disenchant
Rest in Peace
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:Disenchant
manapool:{0}
exile:Rest in Peace
life:20
[PLAYER2]
life:20
[END]

View File

@@ -599,6 +599,10 @@ private:
{
intValue = target->controller()->opponent()->drawCounter;
}
else if (s == "epicactivated")
{
intValue = target->controller()->epic;
}
else if (s == "p" || s == "power")
{
intValue = target->getPower();
@@ -635,6 +639,21 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "morethanfourcards")
{
if(card->playerTarget)
{//blackvise
intValue = 0;
if ((card->playerTarget->game->hand->nb_cards - 4)>0)
intValue = (card->playerTarget->game->hand->nb_cards - 4);
}
else
{//viseling
intValue = 0;
if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0)
intValue = (card->controller()->opponent()->game->hand->nb_cards - 4);
}
}
else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable
{
intValue = 0;
@@ -1335,6 +1354,16 @@ public:
AAFakeAbility * clone() const;
};
class AAEPIC: public ActivatedAbility
{
public:
string named;
AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve();
const string getMenuText();
AAEPIC * clone() const;
};
class AAFizzler: public ActivatedAbility
{
public:
@@ -2231,16 +2260,18 @@ public:
{
if(!nonstatic)
return;
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
if(PT.size())
{
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
MTGCardInstance * _target = (MTGCardInstance *) target;
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
}
int addToGame()
@@ -2251,8 +2282,9 @@ public:
SAFE_DELETE(wppt);
wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source);
}
_target->power += wppt->power.getValue();
_target->addToToughness(wppt->toughness.getValue());
_target->pbonus += wppt->power.getValue();
_target->tbonus += wppt->toughness.getValue();
_target->applyPTL();
if(_target->has(Constants::INDESTRUCTIBLE) && wppt->toughness.getValue() < 0 && _target->toughness <= 0)
{
_target->controller()->game->putInGraveyard(_target);
@@ -2262,8 +2294,9 @@ public:
int destroy()
{
((MTGCardInstance *) target)->power -= wppt->power.getValue();
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
((MTGCardInstance *) target)->pbonus -= wppt->power.getValue();
((MTGCardInstance *) target)->tbonus -= wppt->toughness.getValue();
((MTGCardInstance *) target)->applyPTL();
return 1;
}
const string getMenuText()
@@ -3998,8 +4031,6 @@ string menu;
class ASwapPT: public InstantAbility
{
public:
int oldpower;
int oldtoughness;
ASwapPT(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
InstantAbility(observer, _id, _source, _target)
{
@@ -4013,13 +4044,13 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
if(_target->isPTswitch)
_target->isPTswitch = false;
else
_target->isPTswitch = true;
_target->applyPTL();
}
return 1;
}
@@ -4031,12 +4062,10 @@ public:
{
while (_target->next)
_target = _target->next; //This is for cards such as rampant growth
oldpower = _target->power;
oldtoughness = _target->toughness;
_target->isPTswitch = false;
_target->addToToughness(oldpower);
_target->addToToughness(-oldtoughness);
_target->power = oldtoughness;
_target->applyPTL();
}
return 1;
@@ -4278,10 +4307,9 @@ public:
string newpower;
bool newpowerfound;
int oldpower;
string newtoughness;
bool newtoughnessfound;
int oldtoughness;
map<Damageable *, vector<MTGAbility *> > newAbilities;
vector<string> newAbilitiesList;
bool newAbilityFound;
@@ -5619,15 +5647,17 @@ public:
{
nbOpponents = source->blockers.size();
if (nbOpponents <= MaxOpponent) return 0;
source->power += PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus += PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus += ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
}
else if (WEventPhaseChange* pe = dynamic_cast<WEventPhaseChange*>(event))
{
if (MTG_PHASE_AFTER_EOT == pe->to->id && nbOpponents > MaxOpponent)
{
source->power -= PowerModifier * (nbOpponents - MaxOpponent);
source->addToToughness(-ToughnessModifier * (nbOpponents - MaxOpponent));
source->pbonus -= PowerModifier * (nbOpponents - MaxOpponent);
source->tbonus -= ToughnessModifier * (nbOpponents - MaxOpponent);
source->applyPTL();
nbOpponents = 0;
}
}

View File

@@ -33,8 +33,9 @@ public:
MTGCardInstance * target;
Counters(MTGCardInstance * _target);
~Counters();
int addCounter(const char * _name, int _power = 0, int _toughness = 0);
int addCounter(const char * _name, int _power = 0, int _toughness = 0, bool _noevent = false);
int addCounter(int _power, int _toughness);
int addCounter(int _power, int _toughness, bool _noevent);
int removeCounter(const char * _name, int _power = 0, int _toughness = 0);
int removeCounter(int _power, int _toughness);
Counter * hasCounter(const char * _name, int _power = 0, int _toughness = 0);

View File

@@ -254,6 +254,17 @@ public:
virtual Ninja * clone() const;
};
//offering cost
class Offering : public ExtraCost
{
public:
Offering(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Offering * clone() const;
};
class CounterCost : public ExtraCost
{
public:

View File

@@ -72,7 +72,11 @@ public:
int regenerateTokens;
int isToken;
int origpower;
int basepower;//to keep origpower intact
int pbonus;
int origtoughness;
int basetoughness;//to keep origtoughness intact
int tbonus;
int isMultiColored;
int isLeveler;
bool enchanted;
@@ -182,6 +186,11 @@ public:
int addToToughness(int value);
int setToughness(int value);
bool isSettingBase;
bool isPTswitch;
int oldP;
int oldT;
void applyPTL();
vector<TargetChooser *>protections;
int addProtection(TargetChooser * tc);

View File

@@ -220,7 +220,12 @@ class Constants
NOLEGEND = 102,
CANPLAYFROMGRAVEYARD = 103,
TOKENIZER = 104,
NB_BASIC_ABILITIES = 105,
MYGRAVEEXILER = 105,
OPPGRAVEEXILER = 106,
LIBRARYDEATH = 107,
SHUFFLELIBRARYDEATH = 108,
OFFERING = 109,
NB_BASIC_ABILITIES = 110,
RARITY_S = 'S', //Special Rarity

View File

@@ -42,6 +42,7 @@ public:
int skippingTurn;
int extraTurn;
int drawCounter;
int epic;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);

View File

@@ -1328,6 +1328,31 @@ AAFakeAbility * AAFakeAbility::clone() const
return NEW AAFakeAbility(*this);
}
//EPIC
AAEPIC::AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target, string _named,ManaCost * cost):
ActivatedAbility(observer, id, source, cost, 0),named(_named)
{
this->target = _target;
}
int AAEPIC::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->controller()->epic = 1;
return 1;
}
const string AAEPIC::getMenuText()
{
if(named.size())
return named.c_str();
return "EPIC";
}
AAEPIC * AAEPIC::clone() const
{
return NEW AAEPIC(*this);
}
// Fizzler
AAFizzler::AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, card, _cost, 0)
@@ -4156,22 +4181,19 @@ for (it = types.begin(); it != types.end(); it++)
}
}
if(newpowerfound )
{
{//setting p/t only overrides base p/t as of M15 changes
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
oldpower = _target->power;
_target->power += val->getValue();
_target->power -= oldpower;
_target->power += reapplyCountersBonus(_target,false,true);
_target->basepower = val->getValue();
_target->isSettingBase = true;
_target->applyPTL();
delete val;
}
if(newtoughnessfound )
{
{//setting p/t only overrides base p/t as of M15 changes
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
oldtoughness = _target->toughness;
_target->addToToughness(val->getValue());
_target->addToToughness(-oldtoughness);
_target->addToToughness(reapplyCountersBonus(_target,true,false));
_target->life = _target->toughness;
_target->basetoughness = val->getValue();
_target->isSettingBase = true;
_target->applyPTL();
delete val;
}
@@ -4257,12 +4279,16 @@ int ATransformer::destroy()
}
if(newpowerfound )
{
_target->power = oldpower;
{//override since we changed tha base, the bonus must have changed
_target->isSettingBase = false;
_target->basepower = _target->origpower;
_target->applyPTL();
}
if(newtoughnessfound )
{
_target->setToughness(oldtoughness);
_target->isSettingBase = false;
_target->basetoughness = _target->origtoughness;
_target->applyPTL();
}
if(newAbilityFound)
{

View File

@@ -56,8 +56,9 @@ int Counter::added()
{
if (power != 0 || toughness != 0)
{
target->power += power;
target->addToToughness(toughness);
target->pbonus += power;
target->tbonus += toughness;
target->applyPTL();
}
return 1;
}
@@ -66,8 +67,9 @@ int Counter::removed()
{
if (power != 0 || toughness != 0)
{
target->power -= power;
target->addToToughness(-toughness);
target->pbonus -= power;
target->tbonus -= toughness;
target->applyPTL();
}
return 1;
}
@@ -85,7 +87,7 @@ Counters::~Counters()
}
}
int Counters::addCounter(const char * _name, int _power, int _toughness)
int Counters::addCounter(const char * _name, int _power, int _toughness, bool _noevent)
{
/*420.5n If a permanent has both a +1/+1 counter and a -1/-1 counter on it, N +1/+1 and N -1/-1 counters are removed from it, where N is the smaller of the number of +1/+1 and -1/-1 counters on it.*/
GameObserver *g = target->getObserver();
@@ -109,9 +111,12 @@ int Counters::addCounter(const char * _name, int _power, int _toughness)
Counter * counter = NEW Counter(target, _name, _power, _toughness);
counters.push_back(counter);
counter->added();
WEvent * w = NEW WEventCounters(this,_name,_power,_toughness,true,false);
dynamic_cast<WEventCounters*>(w)->targetCard = this->target;
g->receiveEvent(w);
if (!_noevent)
{
WEvent * w = NEW WEventCounters(this,_name,_power,_toughness,true,false);
dynamic_cast<WEventCounters*>(w)->targetCard = this->target;
g->receiveEvent(w);
}
mCount++;
this->target->doDamageTest = 1;
this->target->afterDamage();
@@ -122,7 +127,12 @@ int Counters::addCounter(const char * _name, int _power, int _toughness)
int Counters::addCounter(int _power, int _toughness)
{
return addCounter("", _power, _toughness);
return addCounter("", _power, _toughness, false);
}
int Counters::addCounter(int _power, int _toughness, bool _noevent)
{
return addCounter("", _power, _toughness, _noevent);
}
int Counters::init()

View File

@@ -540,7 +540,12 @@ ExtraCost("UnTap")
int UnTapCost::isPaymentSet()
{
if (source && !source->isTapped())
/*602.5a A creature's activated ability with the tap symbol ({T}) or the untap symbol ({Q})
* in its activation cost can't be activated unless the creature has been under its
* controller's control since the start of his or her most recent turn.
* Ignore this rule for creatures with haste (see rule 702.10). As of 6/1/2014 Comprehensive Rules
*/
if (source && (!source->isTapped() || source->hasSummoningSickness()))
{
return 0;
}
@@ -757,6 +762,65 @@ int Ninja::doPay()
}
//endbouncetargetcostforninja
//Sacrifice target as cost for Offering
Offering * Offering::clone() const
{
Offering * ec = NEW Offering(*this);
if (tc)
ec->tc = tc->clone();
return ec;
}
Offering::Offering(TargetChooser *_tc) :
ExtraCost("Select creature to offer", _tc)
{
}
int Offering::canPay()
{
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
{
tc->removeTarget(target);
target = NULL;
return 0;
}
if (target && (source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
return 1;
return 0;
}
int Offering::isPaymentSet()
{
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
{
tc->removeTarget(target);
target = NULL;
return 0;
}
if (target && (source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
return 1;
return 0;
}
int Offering::doPay()
{
if (target)
{
target->controller()->getManaPool()->pay(source->getManaCost()->Diff(target->getManaCost()));
MTGCardInstance * beforeCard = target;
source->storedCard = target->createSnapShot();
target->controller()->game->putInGraveyard(target);
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
GameObserver * game = target->owner->getObserver();
game->receiveEvent(e);
target = NULL;
if (tc)
tc->initTargets();
return 1;
}
return 0;
}
//------------------------------------------------------------
SacrificeCost * SacrificeCost::clone() const
@@ -885,8 +949,8 @@ int CounterCost::doPay()
if (counter->nb >= 0)
{ //Add counters as a cost
for (int i = 0; i < counter->nb; i++)
{
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness);
{//send no event because its a cost not an effect... for doubling season
target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness, true);
}
if (tc)
tc->initTargets();

View File

@@ -447,6 +447,12 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(cPhase < MTG_PHASE_COMBATBEGIN ||cPhase > MTG_PHASE_COMBATEND )
return 0;
}
check = restriction[i].find("during my main phases");
if(check != string::npos)
{
if( player != observer->currentPlayer && (cPhase != MTG_PHASE_FIRSTMAIN ||cPhase != MTG_PHASE_SECONDMAIN) )
return 0;
}
check = restriction[i].find("during my turn");
if(check != string::npos)
{
@@ -2408,7 +2414,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//Reset damages on cards
//Do nothing
found = s.find("donothing");
if (found != string::npos)
{
@@ -2418,6 +2424,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//Epic
found = s.find("epic");
if (found != string::npos)
{
MTGAbility * a = NEW AAEPIC(observer, id, card, target,newName);
a->oneShot = 1;
return a;
}
//Damage
vector<string> splitDamage = parseBetween(s, "damage:", " ", false);
if (splitDamage.size())
@@ -3581,9 +3597,9 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
if(card->previous && card->previous->morphed && !card->turningOver)
{
magicText = card->magicTexts["facedown"];
card->power = 2;
card->basepower = 2;
card->life = 2;
card->toughness = 2;
card->basetoughness = 2;
card->setColor(0,1);
card->name = "Morph";
card->types.clear();
@@ -3591,12 +3607,17 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
card->setType(cre.c_str());
card->basicAbilities.reset();
card->getManaCost()->resetCosts();
card->isSettingBase = true;
card->applyPTL();
}
else if(card && !card->morphed && card->turningOver)
{
card->power += card->origpower-2;
card->life += card->origtoughness-2;
card->toughness += card->origtoughness-2;
card->isSettingBase = false;
card->power = card->origpower;
card->basepower = card->origpower;
card->life = card->origtoughness;
card->toughness = card->origtoughness;
card->basetoughness = card->origtoughness;
card->setColor(0,1);
card->name = card->model->data->name;
card->types = card->model->data->types;
@@ -3610,6 +3631,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
string faceupC= card->magicTexts["faceup"];
magicText.append("\n");
magicText.append(faceupC);
card->applyPTL();
}
else if(card && card->hasType(Subtypes::TYPE_EQUIPMENT) && card->target)

View File

@@ -36,7 +36,11 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
attacker = 0;
lifeOrig = life;
origpower = power;
basepower = origpower;
pbonus = 0;
origtoughness = toughness;
basetoughness = origtoughness;
tbonus = 0;
belongs_to = arg_belongs_to;
owner = NULL;
if (arg_belongs_to)
@@ -49,6 +53,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
thatmuch = 0;
flanked = 0;
castMethod = Constants::NOT_CAST;
isSettingBase = false;
isPTswitch = false;
}
MTGCardInstance * MTGCardInstance::createSnapShot()
@@ -60,6 +66,34 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
return snapShot;
}
void MTGCardInstance::applyPTL()
{
//7a ??how to add cda(Characteristic Defining Ability)??
power = origpower;
toughness = origtoughness;
//7b
if (isSettingBase)
{
power = basepower;
toughness = basetoughness;
}
//7c - 7d shared?
power += pbonus;
toughness += tbonus;
life = toughness;
//7e switch is last
if (isPTswitch)
{
oldP = power;
oldT = toughness;
this->addToToughness(oldP);
this->addToToughness(-oldT);
this->power = oldT;
}
/* end */
doDamageTest = 1;
}
void MTGCardInstance::copy(MTGCardInstance * card)
{
MTGCard * source = card->model;

View File

@@ -133,7 +133,12 @@ const char* Constants::MTGBasicAbilities[] = {
"lure",
"nolegend",
"canplayfromgraveyard",
"tokenizer"//parallel lives
"tokenizer",//parallel lives,
"mygraveexiler",
"oppgraveexiler",
"librarydeath",
"shufflelibrarydeath",
"offering"
};
map<string,int> Constants::MTGBasicAbilitiesMap;

View File

@@ -321,6 +321,33 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
return card; //Error check
int doCopy = 1;
bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH];
bool ripToken = false;
if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace"))
ripToken = true;
//Darksteel Colossus, Legacy Weapon ... top priority since we replace destination directly automatically...
for(int i = 0; i < 2; ++i)
{
if ((to == g->players[i]->game->graveyard) && (
card->basicAbilities[(int)Constants::LIBRARYDEATH]||
card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH]))
{
to = g->players[i]->game->library;
}
}
//Leyline of the Void, Yawgmoth's Agenda... effect...
for(int i = 0; i < 2; ++i)
{
if ((to == g->players[i]->game->graveyard) && (
g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) ||
g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER)))
{
if ((card->isToken && ripToken))
to = g->players[i]->game->exile;
if (!card->isToken)
to = g->players[i]->game->exile;
}
}
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
== g->players[1]->game->inPlay))
@@ -384,6 +411,9 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
}
if(!asCopy)
{
if(shufflelibrary)
copy->owner->game->library->shuffle();
WEvent * e = NEW WEventZoneChange(copy, from, to);
g->receiveEvent(e);
}

View File

@@ -317,14 +317,16 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
return 1;
}
}
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH)
|| (player == currentPlayer && !game->isInterrupting
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH)
|| (player == card->controller() && !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if(card->controller()->epic)
return 0;
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if (card->controller()->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
ManaCost * cost = card->getManaCost();
@@ -649,13 +651,15 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
)
return 1;
}
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH)
|| (player == currentPlayer && !game->isInterrupting
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::OFFERING)
|| (player == card->controller() && !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if(card->controller()->epic)
return 0;
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
@@ -1028,21 +1032,23 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{
Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer;
//Player * currentPlayer = game->currentPlayer;
if (!player->game->hand->hasCard(card))
return 0;
if (!card->getManaCost()->getMorph())
return 0;
if(!allowedToAltCast(card,player))
return 0;
if(card->controller()->epic)//zoetic cavern... morph is casted for a cost...
return 0;
//note lands can morph too, this is different from other cost types.
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (player == currentPlayer
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (player == card->controller()
&& !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
ManaCost * morph = card->getManaCost()->getMorph();

View File

@@ -193,6 +193,33 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
manaCost->addExtraCost(NEW Ninja(tc));
break;
}
case 'k': //kill offering
{
TargetChooserFactory tcf(g);
if (value == "kgoblin")
{
tc = tcf.createTargetChooser("creature[goblin]|myBattlefield", c);
}
else if (value == "kfox")
{
tc = tcf.createTargetChooser("creature[fox]|myBattlefield", c);
}
else if (value == "kmoonfolk")
{
tc = tcf.createTargetChooser("creature[moonfolk]|myBattlefield", c);
}
else if (value == "krat")
{
tc = tcf.createTargetChooser("creature[rat]|myBattlefield", c);
}
else if (value == "ksnake")
{
tc = tcf.createTargetChooser("creature[snake]|myBattlefield", c);
}
//TODO iterate subtypes of creatures
manaCost->addExtraCost(NEW Offering(tc));
break;
}
case 'p' :
{
SAFE_DELETE(tc);

View File

@@ -33,6 +33,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
skippingTurn = 0;
extraTurn = 0;
drawCounter = 0;
epic = 0;
prowledTypes.clear();
doesntEmpty = NEW ManaCost();
poolDoesntEmpty = NEW ManaCost();

View File

@@ -1078,7 +1078,13 @@ bool TypeTargetChooser::canTarget(Targetable * target,bool withoutProtections)
{
if (card->hasSubtype(types[i])) return true;
if (card->data->basicAbilities[(int)Constants::CHANGELING]) return true;//changelings can be targeted as any subtype.
if (card->data->basicAbilities[(int)Constants::CHANGELING])
{
if (!MTGAllCards::isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
return false;
return true;
}
if(card->getLCName().size())
{
if (MTGAllCards::findType(card->getLCName()) == types[i])