Merge pull request #636 from kevlahnota/master

LKI for power,  toughness and basic abilities,  produceextra ability, stack and life check, reduceto ability
This commit is contained in:
Anthony Calosa
2015-10-02 01:12:38 +08:00
13 changed files with 191 additions and 92 deletions
+28 -12
View File
@@ -2168,7 +2168,7 @@ toughness=1
[/card] [/card]
[card] [card]
name=Ali from Cairo name=Ali from Cairo
auto=@damaged(controller) restriction{compare(lifetotal)~lessthan~1}:this(controllerlife < 1) lifeset:1 controller auto=this(controllerlife >= 1) transforms((,newability[reduceto:1]))
text=Damage that would reduce your life total to less than 1 reduces it to 1 instead. text=Damage that would reduce your life total to less than 1 reduces it to 1 instead.
mana={2}{R}{R} mana={2}{R}{R}
type=Creature type=Creature
@@ -20600,7 +20600,7 @@ toughness=1
[card] [card]
name=Crypt Ghast name=Crypt Ghast
auto=@movedto(*|mystack):pay({WB}) life:-1 opponent && life:1 controller auto=@movedto(*|mystack):pay({WB}) life:-1 opponent && life:1 controller
auto=@tappedformana(swamp|mybattlefield):Add{B} auto=lord(swamp|mybattlefield) transforms((,newability[produceextra:{B}]))
text=Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) -- Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces). text=Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) -- Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces).
mana={3}{B} mana={3}{B}
type=Creature type=Creature
@@ -28928,7 +28928,7 @@ toughness=6
name=Elderscale Wurm name=Elderscale Wurm
abilities=trample abilities=trample
auto=if compare(lifetotal)~lessthan~7 then lifeset:7 controller auto=if compare(lifetotal)~lessthan~7 then lifeset:7 controller
auto=this(controllerlife > 6) transforms((,newability[@damaged(controller):if compare(lifetotal)~lessthan~7 then lifeset:7 controller])) auto=this(controllerlife >= 7) transforms((,newability[reduceto:7]))
text=Trample. -- When Elderscale Wurm enters the battlefield, if your life total is less than 7, your life total becomes 7. -- As long as you have 7 or more life, damage that would reduce your life total to less than 7 reduces it to 7 instead. text=Trample. -- When Elderscale Wurm enters the battlefield, if your life total is less than 7, your life total becomes 7. -- As long as you have 7 or more life, damage that would reduce your life total to less than 7 reduces it to 7 instead.
mana={4}{G}{G}{G} mana={4}{G}{G}{G}
type=Creature type=Creature
@@ -36160,7 +36160,7 @@ toughness=3
name=Fortune Thief name=Fortune Thief
facedown={3} facedown={3}
autofacedown={R}{R}:morph autofacedown={R}{R}:morph
auto=@damaged(controller) restriction{compare(lifetotal)~lessthan~1}:this(controllerlife < 1) lifeset:1 controller auto=this(controllerlife >= 1) transforms((,newability[reduceto:1]))
text=Damage that would reduce your life total to less than 1 reduces it to 1 instead. -- Morph {R}{R} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) text=Damage that would reduce your life total to less than 1 reduces it to 1 instead. -- Morph {R}{R} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)
mana={4}{R} mana={4}{R}
type=Creature type=Creature
@@ -37695,8 +37695,7 @@ toughness=3
[card] [card]
name=Gauntlet of Might name=Gauntlet of Might
auto=lord(creature[red]) 1/1 auto=lord(creature[red]) 1/1
auto=@tappedformana(mountain|mybattlefield):Add{R} controller auto=lord(mountain|battlefield) transforms((,newability[produceextra:{R}]))
auto=@tappedformana(mountain|opponentbattlefield):Add{R} opponent
text=Red creatures get +1/+1. -- Whenever a Mountain is tapped for mana, its controller adds {R} to his or her mana pool (in addition to the mana the land produces). text=Red creatures get +1/+1. -- Whenever a Mountain is tapped for mana, its controller adds {R} to his or her mana pool (in addition to the mana the land produces).
mana={4} mana={4}
type=Artifact type=Artifact
@@ -45724,7 +45723,7 @@ toughness=4
[/card] [/card]
[card] [card]
name=High Tide name=High Tide
auto=all(island) transforms((,newability[@tappedformana(this):add{U}])) ueot auto=all(island) transforms((,newability[produceextra:{U}])) ueot
text=Until end of turn, whenever a player taps an Island for mana, that player adds {U} to his or her mana pool (in addition to the mana the land produces). text=Until end of turn, whenever a player taps an Island for mana, that player adds {U} to his or her mana pool (in addition to the mana the land produces).
mana={U} mana={U}
type=Instant type=Instant
@@ -67601,7 +67600,7 @@ toughness=2
[/card] [/card]
[card] [card]
name=Nirkana Revenant name=Nirkana Revenant
auto=@tappedformana(swamp|mybattlefield):Add{B} auto=lord(swamp|mybattlefield) transforms((,newability[produceextra:{B}]))
auto={B}:1/1 auto={B}:1/1
text=Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces). -- {B}:Nirkana Revenant gets +1/+1 until end of turn. text=Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces). -- {B}:Nirkana Revenant gets +1/+1 until end of turn.
type=Creature type=Creature
@@ -70229,7 +70228,7 @@ subtype=Swamp Forest
[card] [card]
name=Overgrowth name=Overgrowth
target=land target=land
auto=@tappedformana(mytgt):Add{G}{G} targetcontroller auto=teach(land) transforms((,newability[produceextra:{G}{G}]))
text=Enchant land (Target a land as you cast this. This card enters the battlefield attached to that land.) -- Whenever enchanted land is tapped for mana, its controller adds {G}{G} to his or her mana pool (in addition to the mana the land produces). text=Enchant land (Target a land as you cast this. This card enters the battlefield attached to that land.) -- Whenever enchanted land is tapped for mana, its controller adds {G}{G} to his or her mana pool (in addition to the mana the land produces).
mana={2}{G} mana={2}{G}
type=Enchantment type=Enchantment
@@ -98228,6 +98227,17 @@ power=2
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Sustaining Spirit
auto=cumulativeupcost[{1}{W}] sacrifice
auto=this(controllerlife >= 1) transforms((,newability[reduceto:1]))
text=Cumulative upkeep {1}{W} (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.) -- Damage that would reduce your life total to less than 1 reduces it to 1 instead.
mana={1}{W}
type=Creature
subtype=Angel Spirit
power=0
toughness=3
[/card]
[card]
name=Sustenance name=Sustenance
auto={1}{S(land|myBattlefield)}:1/1 target(creature) auto={1}{S(land|myBattlefield)}:1/1 target(creature)
text={1}, Sacrifice a land: Target creature gets +1/+1 until end of turn. text={1}, Sacrifice a land: Target creature gets +1/+1 until end of turn.
@@ -108293,8 +108303,7 @@ toughness=1
[/card] [/card]
[card] [card]
name=Vernal Bloom name=Vernal Bloom
auto=@tappedformana(forest|mybattlefield):Add{G} controller auto=lord(forest|battlefield) transforms((,newability[produceextra:{G}]))
auto=@tappedformana(forest|opponentbattlefield):Add{G} opponent
text=Whenever a Forest is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces). text=Whenever a Forest is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces).
mana={3}{G} mana={3}{G}
type=Enchantment type=Enchantment
@@ -113018,7 +113027,7 @@ toughness=2
[card] [card]
name=Wild Growth name=Wild Growth
target=land target=land
auto=@tappedformana(mytgt):add{g} targetcontroller auto=teach(land) transforms((,newability[produceextra:{G}]))
text=Enchant land -- Whenever enchanted land is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces). text=Enchant land -- Whenever enchanted land is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces).
mana={G} mana={G}
type=Enchantment type=Enchantment
@@ -114656,6 +114665,13 @@ mana={3}
type=Artifact type=Artifact
[/card] [/card]
[card] [card]
name=Worship
auto=this(variable{worshipped} >= 1) transforms((,newability[reduceto:1]))
text=If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
mana={3}{W}
type=Enchantment
[/card]
[card]
name=Worthy Cause name=Worthy Cause
auto=life:storedtoughness controller auto=life:storedtoughness controller
buyback={W}{2} buyback={W}{2}
@@ -16201,15 +16201,6 @@ type=Sorcery
text=You gain 2 life. Then if you have more life than an opponent, draw a card. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.) text=You gain 2 life. Then if you have more life than an opponent, draw a card. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card] [/card]
[card] [card]
name=Sustaining Spirit
text=Cumulative upkeep {1}{W} (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.) -- Damage that would reduce your life total to less than 1 reduces it to 1 instead.
mana={1}{W}
type=Creature
subtype=Angel Spirit
power=0
toughness=3
[/card]
[card]
name=Sutured Ghoul name=Sutured Ghoul
text=Trample -- As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard. -- Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness. text=Trample -- As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard. -- Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
mana={4}{B}{B}{B} mana={4}{B}{B}{B}
@@ -18718,12 +18709,6 @@ mana={2}{B}{B}{B}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Worship
text=If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
mana={3}{W}
type=Enchantment
[/card]
[card]
name=Wort, the Raidmother name=Wort, the Raidmother
text=When Wort, the Raidmother enters the battlefield, put two 1/1 red and green Goblin Warrior creature tokens onto the battlefield. -- Each red or green instant or sorcery spell you cast has conspire. (As you cast the spell, you may tap two untapped creatures you control that share a color with it. When you do, copy it and you may choose new targets for the copy.) text=When Wort, the Raidmother enters the battlefield, put two 1/1 red and green Goblin Warrior creature tokens onto the battlefield. -- Each red or green instant or sorcery spell you cast has conspire. (As you cast the spell, you may tap two untapped creatures you control that share a color with it. When you do, copy it and you may choose new targets for the copy.)
mana={4}{RG}{RG} mana={4}{RG}{RG}
+71 -2
View File
@@ -654,11 +654,11 @@ private:
} }
else if (s == "p" || s == "power") else if (s == "p" || s == "power")
{ {
intValue = target->getPower(); intValue = target->getCurrentPower();
} }
else if (s == "t" || s == "toughness") else if (s == "t" || s == "toughness")
{ {
intValue = target->getToughness(); intValue = target->getCurrentToughness();
} }
else if (s == "kicked") else if (s == "kicked")
{ {
@@ -688,6 +688,13 @@ private:
{ {
intValue = target->controller()->opponent()->game->hand->nb_cards; intValue = target->controller()->opponent()->game->hand->nb_cards;
} }
else if (s == "worshipped")//Worship
{
if(card->controller()->game->battlefield->hasType("creature"))
intValue = card->controller()->life;
else
intValue = 0;
}
else if (s == "pancientooze")//Ancient Ooze else if (s == "pancientooze")//Ancient Ooze
{ {
intValue = 0; intValue = 0;
@@ -5966,6 +5973,68 @@ public:
} }
}; };
//ProduceExtra Mana when tapped for mana
class AProduceExtraAbility: public MTGAbility
{
public:
string ManaDescription;
AProduceExtraAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _ManaDescription) :
MTGAbility(observer, _id, _source)
{
ManaDescription = _ManaDescription;
}
int receiveEvent(WEvent * event)
{
if(WEventCardTappedForMana * isTappedForMana = dynamic_cast<WEventCardTappedForMana *> (event))
{
if ((isTappedForMana->card == source) && (isTappedForMana->card->controller() == source->controller()))
{
AManaProducer *amp = NEW AManaProducer(game, game->mLayers->actionLayer()->getMaxId(), source, source->controller(), ManaCost::parseManaCost(ManaDescription,NULL,source), NULL, 0,"",false);
amp->resolve();
SAFE_DELETE(amp);
}
}
return 1;
}
AProduceExtraAbility * clone() const
{
return NEW AProduceExtraAbility(*this);
}
};
//Reduce to .. Ali from Cairo...
class AReduceToAbility: public MTGAbility
{
public:
string life_s;
AReduceToAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _life_s) :
MTGAbility(observer, _id, _source)
{
life_s = _life_s;
}
int receiveEvent(WEvent * event)
{
if(WEventDamage * isDamaged = dynamic_cast<WEventDamage *> (event))
{
if (isDamaged->damage->target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
Player * p = (Player *) isDamaged->damage->target;
WParsedInt lifetoset(life_s, NULL, source);
if(p && p == source->controller() && p->life <= lifetoset.getValue())
p->life = lifetoset.getValue();
}
}
return 1;
}
AReduceToAbility * clone() const
{
return NEW AReduceToAbility(*this);
}
};
//flanking ability //flanking ability
class AFlankerAbility: public MTGAbility class AFlankerAbility: public MTGAbility
{ {
+1
View File
@@ -59,6 +59,7 @@ public:
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet; typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
BasicAbilitiesSet basicAbilities; BasicAbilitiesSet basicAbilities;
BasicAbilitiesSet origbasicAbilities; BasicAbilitiesSet origbasicAbilities;
BasicAbilitiesSet LKIbasicAbilities;
map<string,string> magicTexts; map<string,string> magicTexts;
string magicText; string magicText;
+5
View File
@@ -233,6 +233,10 @@ public:
void addbaseT(int t = 0); void addbaseT(int t = 0);
void revertbaseP(); void revertbaseP();
void revertbaseT(); void revertbaseT();
int getCurrentPower();
int getCurrentToughness();
int LKIpower;
int LKItoughness;
void cdaPT(int p = 0, int t = 0); void cdaPT(int p = 0, int t = 0);
bool isCDA; bool isCDA;
void switchPT(bool apply = false); void switchPT(bool apply = false);
@@ -244,6 +248,7 @@ public:
bool discarded; bool discarded;
int copiedID; int copiedID;
int modifiedbAbi; int modifiedbAbi;
bool StackIsEmptyandSorcerySpeed();
void eventattacked(); void eventattacked();
void eventattackedAlone(); void eventattackedAlone();
+1 -1
View File
@@ -71,7 +71,7 @@ public:
ManaPool * getManaPool(); ManaPool * getManaPool();
void takeMulligan(); void takeMulligan();
void serumMulligan(); void serumMulligan();
bool DeadLifeState(); bool DeadLifeState(bool check = false);
ManaCost * doesntEmpty; ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty; ManaCost * poolDoesntEmpty;
void cleanupPhase(); void cleanupPhase();
+6 -6
View File
@@ -2081,16 +2081,16 @@ int AADynamic::resolve()
switch(type) switch(type)
{ {
case DYNAMIC_ABILITY_TYPE_POWER: case DYNAMIC_ABILITY_TYPE_POWER:
sourceamount = ((MTGCardInstance *) source)->power; sourceamount = ((MTGCardInstance *) source)->getCurrentPower();
targetamount = ((MTGCardInstance *) _target)->power; targetamount = ((MTGCardInstance *) _target)->getCurrentPower();
if(eachother ) if(eachother )
sourceamount = ((MTGCardInstance *) source)->power; sourceamount = ((MTGCardInstance *) source)->getCurrentPower();
break; break;
case DYNAMIC_ABILITY_TYPE_TOUGHNESS: case DYNAMIC_ABILITY_TYPE_TOUGHNESS:
sourceamount = ((MTGCardInstance *) source)->toughness; sourceamount = ((MTGCardInstance *) source)->getCurrentToughness();
targetamount = ((MTGCardInstance *) _target)->toughness; targetamount = ((MTGCardInstance *) _target)->getCurrentToughness();
if(eachother ) if(eachother )
sourceamount = ((MTGCardInstance *) source)->toughness; sourceamount = ((MTGCardInstance *) source)->getCurrentToughness();
break; break;
case DYNAMIC_ABILITY_TYPE_MANACOST: case DYNAMIC_ABILITY_TYPE_MANACOST:
if(amountsource == 1) if(amountsource == 1)
+1
View File
@@ -42,6 +42,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
return; return;
basicAbilities = source->basicAbilities; basicAbilities = source->basicAbilities;
origbasicAbilities = source->basicAbilities; origbasicAbilities = source->basicAbilities;
LKIbasicAbilities = source->basicAbilities;
for (size_t i = 0; i < source->types.size(); ++i) for (size_t i = 0; i < source->types.size(); ++i)
types.push_back(source->types[i]); types.push_back(source->types[i]);
+6 -1
View File
@@ -578,6 +578,8 @@ void GameObserver::Update(float dt)
{ {
mLayers->actionLayer()->Update(0); mLayers->actionLayer()->Update(0);
} }
players[0]->DeadLifeState();
players[1]->DeadLifeState();
gameStateBasedEffects(); gameStateBasedEffects();
} }
oldGamePhase = mCurrentGamePhase; oldGamePhase = mCurrentGamePhase;
@@ -608,6 +610,9 @@ void GameObserver::gameStateBasedEffects()
for (int j = zone->nb_cards - 1; j >= 0; j--) for (int j = zone->nb_cards - 1; j >= 0; j--)
{ {
MTGCardInstance * card = zone->cards[j]; MTGCardInstance * card = zone->cards[j];
card->LKIpower = card->power;
card->LKItoughness = card->toughness;
card->LKIbasicAbilities = card->basicAbilities;
card->afterDamage(); card->afterDamage();
card->mPropertiesChangedSinceLastUpdate = false; card->mPropertiesChangedSinceLastUpdate = false;
if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0))) if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0)))
@@ -761,7 +766,7 @@ void GameObserver::gameStateBasedEffects()
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
//life checks/poison checks also checks cant win or lose.// //life checks/poison checks also checks cant win or lose.//
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
players[i]->DeadLifeState();//refactored players[i]->DeadLifeState(true);//refactored
} }
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//-------------card based states effects------------// //-------------card based states effects------------//
+15 -25
View File
@@ -2659,6 +2659,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return NEW AEvolveAbility(observer, id, card); return NEW AEvolveAbility(observer, id, card);
} }
//produce additional mana when tapped for mana
if (s.find("produceextra:") != string::npos)
{
return NEW AProduceExtraAbility(observer, id, card,s.substr(13));
}
//reducelife to specific value
if (s.find("reduceto:") != string::npos)
{
return NEW AReduceToAbility(observer, id, card,s.substr(9));
}
//flanking //flanking
if (s.find("flanker") != string::npos) if (s.find("flanker") != string::npos)
{ {
@@ -4259,7 +4271,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (current->hasType(Subtypes::TYPE_CREATURE)) if (current->hasType(Subtypes::TYPE_CREATURE))
{ {
card->controller()->game->putInGraveyard(current); card->controller()->game->putInGraveyard(current);
damage += current->power; damage += current->getCurrentPower();
} }
} }
observer->mLayers->stackLayer()->addDamage(card, target, damage); observer->mLayers->stackLayer()->addDamage(card, target, damage);
@@ -4588,6 +4600,8 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0; return 0;
if (cPhase != MTG_PHASE_FIRSTMAIN && cPhase != MTG_PHASE_SECONDMAIN) if (cPhase != MTG_PHASE_FIRSTMAIN && cPhase != MTG_PHASE_SECONDMAIN)
return 0; return 0;
if (player->opponent()->getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0||game->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0||player->getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
return 0;
break; break;
} }
if (restrictions >= MY_BEFORE_BEGIN && restrictions <= MY_AFTER_EOT) if (restrictions >= MY_BEFORE_BEGIN && restrictions <= MY_AFTER_EOT)
@@ -5010,30 +5024,6 @@ int TriggeredAbility::receiveEvent(WEvent * e)
resolve(); resolve();
return 1; return 1;
} }
if(dynamic_cast<WEventLife*>(e))
{
//check life state on life triger
WEventLife * lifecheck = dynamic_cast<WEventLife*>(e);
if (lifecheck->player->DeadLifeState())
{
return 0;
}
fireAbility();
return 1;
}
if(dynamic_cast<WEventDamage*>(e))
{
//check life state on damage trigger
WEventDamage * lifecheck = dynamic_cast<WEventDamage*>(e);
if (lifecheck->damage->target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
Player * triggerPlayer = (Player *) lifecheck->damage->target;
if(triggerPlayer->DeadLifeState())
return 0;
}
fireAbility();
return 1;
}
WEventZoneChange * stackCheck = dynamic_cast<WEventZoneChange*>(e); WEventZoneChange * stackCheck = dynamic_cast<WEventZoneChange*>(e);
if(stackCheck && (stackCheck->to == game->currentPlayer->game->stack||stackCheck->to == game->currentPlayer->opponent()->game->stack)) if(stackCheck && (stackCheck->to == game->currentPlayer->game->stack||stackCheck->to == game->currentPlayer->opponent()->game->stack))
{ {
+30
View File
@@ -61,6 +61,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
discarded = false; discarded = false;
copiedID = getId(); copiedID = getId();
modifiedbAbi = 0; modifiedbAbi = 0;
LKIpower = power;
LKItoughness = toughness;
} }
MTGCardInstance * MTGCardInstance::createSnapShot() MTGCardInstance * MTGCardInstance::createSnapShot()
@@ -723,6 +725,34 @@ void MTGCardInstance::switchPT(bool apply)
} }
} }
int MTGCardInstance::getCurrentPower()
{
if(!isInPlay(observer))
return LKIpower;
return power;
}
int MTGCardInstance::getCurrentToughness()
{
if(!isInPlay(observer))
return LKItoughness;
return toughness;
}
//check stack
bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
{
if((getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) &&
(getObserver()->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN ||
getObserver()->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN) &&
controller() == getObserver()->currentPlayer &&
!getObserver()->isInterrupting)
{
return true;
}
return false;
}
int MTGCardInstance::canBlock() int MTGCardInstance::canBlock()
{ {
if (tapped) if (tapped)
+11 -28
View File
@@ -284,7 +284,6 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{ {
int cardsinhand = game->players[0]->game->hand->nb_cards; int cardsinhand = game->players[0]->game->hand->nb_cards;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer;
if (!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card))
return 0; return 0;
if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[(int)Constants::LEYLINE]) if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[(int)Constants::LEYLINE])
@@ -310,18 +309,12 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{ {
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY) if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY)
return 0; return 0;
if (player == currentPlayer if (card->StackIsEmptyandSorcerySpeed())
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN)
)
{
return 1; return 1;
else
return 0;
} }
} else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed()))
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) if(card->controller()->epic)
return 0; return 0;
@@ -631,7 +624,6 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *, ManaCost *alternateManaCost) int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *, ManaCost *alternateManaCost)
{ {
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer;
if (!alternateManaCost) if (!alternateManaCost)
return 0; return 0;
@@ -645,17 +637,12 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
{ {
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY) if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->inPlay) == PlayRestriction::CANT_PLAY)
return 0; return 0;
if (player == currentPlayer if (card->StackIsEmptyandSorcerySpeed())
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN)
)
return 1; return 1;
else
return 0;
} }
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::SPELLMASTERY) || card->has(Constants::OFFERING) else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::SPELLMASTERY) || card->has(Constants::OFFERING) || (card->StackIsEmptyandSorcerySpeed()))
|| (player == card->controller() && !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{ {
if(card->controller()->epic) if(card->controller()->epic)
return 0; return 0;
@@ -1042,11 +1029,7 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(card->controller()->epic)//zoetic cavern... morph is casted for a cost... if(card->controller()->epic)//zoetic cavern... morph is casted for a cost...
return 0; return 0;
//note lands can morph too, this is different from other cost types. //note lands can morph too, this is different from other cost types.
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (player == card->controller() if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed()))
&& !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{ {
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY) if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0; return 0;
@@ -2707,7 +2690,7 @@ int MTGLifelinkRule::receiveEvent(WEvent * event)
WEventDamage * e = (WEventDamage *) event; WEventDamage * e = (WEventDamage *) event;
Damage * d = e->damage; Damage * d = e->damage;
MTGCardInstance * card = d->source; MTGCardInstance * card = d->source;
if (d->damage > 0 && card && card->basicAbilities[(int)Constants::LIFELINK]) if (d->damage > 0 && card && (card->basicAbilities[(int)Constants::LIFELINK]||card->LKIbasicAbilities[(int)Constants::LIFELINK]))
{ {
card->controller()->gainLife(d->damage); card->controller()->gainLife(d->damage);
return 1; return 1;
@@ -2751,7 +2734,7 @@ int MTGDeathtouchRule::receiveEvent(WEvent * event)
return 0; return 0;
MTGCardInstance * _target = (MTGCardInstance *) (d->target); MTGCardInstance * _target = (MTGCardInstance *) (d->target);
if (card->basicAbilities[(int)Constants::DEATHTOUCH]) if (card->basicAbilities[(int)Constants::DEATHTOUCH]||card->LKIbasicAbilities[(int)Constants::DEATHTOUCH])
{ {
_target->destroy(); _target->destroy();
return 1; return 1;
+16 -2
View File
@@ -236,7 +236,7 @@ void Player::serumMulligan()
//Draw hand no penalty //Draw hand no penalty
} }
bool Player::DeadLifeState() bool Player::DeadLifeState(bool check)
{ {
if ((life <= 0)||(poisonCount >= 10)) if ((life <= 0)||(poisonCount >= 10))
{ {
@@ -263,7 +263,21 @@ bool Player::DeadLifeState()
} }
if (cantlosers < 1) if (cantlosers < 1)
{ {
getObserver()->setLoser(this); if(!check)
{
ActionStack * stack = getObserver()->mLayers->stackLayer();
for (int i = stack->mObjects.size() - 1; i >= 0; i--)
{
Interruptible * current = ((Interruptible *) stack->mObjects[i]);
Spell * spell = (Spell *) current;
if (current->type == ACTION_SPELL)
spell->source->controller()->game->putInGraveyard(spell->source);
current->state = RESOLVED_NOK;
}
}
if(check)
game->owner->getObserver()->setLoser(this);
return true; return true;
} }
} }