Merge pull request #618 from kevlahnota/master

Life state check and multicolor attribute
This commit is contained in:
Xawotihs
2015-09-03 20:33:01 +02:00
9 changed files with 68 additions and 29 deletions

View File

@@ -35578,7 +35578,7 @@ toughness=3
[/card] [/card]
[card] [card]
name=Furnace Celebration name=Furnace Celebration
auto=@sacrificed(other *|mybattlefield):pay({2}) damage:2 target(creature,player) auto=@sacrificed(other *|mybattlefield):ability$!name(pay 2 for damage) pay[[{2}]] name(pay 2 for damage) damage:2 target(creature,player)!$ controller
mana={1}{R}{R} mana={1}{R}{R}
type=Enchantment type=Enchantment
text=Whenever you sacrifice another permanent, you may pay {2}. If you do, Furnace Celebration deals 2 damage to target creature or player. text=Whenever you sacrifice another permanent, you may pay {2}. If you do, Furnace Celebration deals 2 damage to target creature or player.

View File

@@ -313,6 +313,7 @@ executioners_swing.txt
executioners_swing2.txt executioners_swing2.txt
executioners_swing3.txt executioners_swing3.txt
explore.txt explore.txt
exquisite_blood_i953.txt
Faceless_Butcher.txt Faceless_Butcher.txt
fading.txt fading.txt
fangren_pathcutter.txt fangren_pathcutter.txt

View File

@@ -69,6 +69,7 @@ public:
ManaPool * getManaPool(); ManaPool * getManaPool();
void takeMulligan(); void takeMulligan();
void serumMulligan(); void serumMulligan();
bool DeadLifeState();
ManaCost * doesntEmpty; ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty; ManaCost * poolDoesntEmpty;
void cleanupPhase(); void cleanupPhase();

View File

@@ -1242,6 +1242,9 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
if (minus) if (minus)
{ {
cd.setisMultiColored(-1); cd.setisMultiColored(-1);
cd.SetExclusionColor(0);//not multicolored is monocolored not colorless, use iscolorless attribute
cd.SetExclusionColor(6);//restriction... green, red, blue, black or white colored only
cd.mode = CardDescriptor::CD_OR;
} }
else else
{ {

View File

@@ -727,34 +727,7 @@ void GameObserver::gameStateBasedEffects()
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
//life checks/poison checks also checks cant win or lose.// //life checks/poison checks also checks cant win or lose.//
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
if (players[i]->life <= 0 || players[i]->poisonCount >= 10) players[i]->DeadLifeState();//refactored
{
int cantlosers = 0;
MTGGameZone * z = players[i]->game->inPlay;
int nbcards = z->nb_cards;
for (int j = 0; j < nbcards; ++j)
{
MTGCardInstance * c = z->cards[j];
if (c->has(Constants::CANTLOSE) || (c->has(Constants::CANTLIFELOSE) && players[i]->poisonCount < 10))
{
cantlosers++;
}
}
MTGGameZone * k = players[i]->opponent()->game->inPlay;
int onbcards = k->nb_cards;
for (int m = 0; m < onbcards; ++m)
{
MTGCardInstance * e = k->cards[m];
if (e->has(Constants::CANTWIN))
{
cantlosers++;
}
}
if (cantlosers < 1)
{
setLoser(players[i]);
}
}
} }
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//-------------card based states effects------------// //-------------card based states effects------------//

View File

@@ -4961,6 +4961,30 @@ 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))
{ {

View File

@@ -233,6 +233,40 @@ void Player::serumMulligan()
//Draw hand no penalty //Draw hand no penalty
} }
bool Player::DeadLifeState()
{
if ((life <= 0)||(poisonCount >= 10))
{
int cantlosers = 0;
MTGGameZone * z = game->inPlay;
int nbcards = z->nb_cards;
for (int j = 0; j < nbcards; ++j)
{
MTGCardInstance * c = z->cards[j];
if (c->has(Constants::CANTLOSE) || (c->has(Constants::CANTLIFELOSE) && poisonCount < 10))
{
cantlosers++;
}
}
MTGGameZone * k = opponent()->game->inPlay;
int onbcards = k->nb_cards;
for (int m = 0; m < onbcards; ++m)
{
MTGCardInstance * e = k->cards[m];
if (e->has(Constants::CANTWIN))
{
cantlosers++;
}
}
if (cantlosers < 1)
{
getObserver()->setLoser(this);
return true;
}
}
return false;
}
//Cleanup phase at the end of a turn //Cleanup phase at the end of a turn
void Player::cleanupPhase() void Player::cleanupPhase()
{ {

View File

@@ -503,6 +503,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
if (minus) if (minus)
{ {
cd->setisMultiColored(-1); cd->setisMultiColored(-1);
cd->SetExclusionColor(0);//not multicolored is monocolored not colorless, use iscolorless attribute
cd->SetExclusionColor(6);//restriction... green, red, blue, black or white colored only
cd->mode = CardDescriptor::CD_OR;
} }
else else
{ {