diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 753b0fd67..261522a02 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -35578,7 +35578,7 @@ toughness=3 [/card] [card] 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} 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. diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 8898324a5..598704221 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -313,6 +313,7 @@ executioners_swing.txt executioners_swing2.txt executioners_swing3.txt explore.txt +exquisite_blood_i953.txt Faceless_Butcher.txt fading.txt fangren_pathcutter.txt diff --git a/projects/mtg/bin/Res/test/bugs/exquisite_blood_i953.txt b/projects/mtg/bin/Res/test/exquisite_blood_i953.txt similarity index 100% rename from projects/mtg/bin/Res/test/bugs/exquisite_blood_i953.txt rename to projects/mtg/bin/Res/test/exquisite_blood_i953.txt diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index 66d66acd1..589e8766a 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -69,6 +69,7 @@ public: ManaPool * getManaPool(); void takeMulligan(); void serumMulligan(); + bool DeadLifeState(); ManaCost * doesntEmpty; ManaCost * poolDoesntEmpty; void cleanupPhase(); diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 0b5b9d44a..de5efb003 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1242,6 +1242,9 @@ bool CardGui::FilterCard(MTGCard * _card,string filter) if (minus) { 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 { diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 2f77f9d36..b82960119 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -727,34 +727,7 @@ void GameObserver::gameStateBasedEffects() /////////////////////////////////////////////////////////// //life checks/poison checks also checks cant win or lose.// /////////////////////////////////////////////////////////// - if (players[i]->life <= 0 || players[i]->poisonCount >= 10) - { - 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]); - } - } + players[i]->DeadLifeState();//refactored } ////////////////////////////////////////////////////// //-------------card based states effects------------// diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index d38ce37b0..e8d6c34ed 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -4961,6 +4961,30 @@ int TriggeredAbility::receiveEvent(WEvent * e) resolve(); return 1; } + if(dynamic_cast(e)) + { + //check life state on life triger + WEventLife * lifecheck = dynamic_cast(e); + if (lifecheck->player->DeadLifeState()) + { + return 0; + } + fireAbility(); + return 1; + } + if(dynamic_cast(e)) + { + //check life state on damage trigger + WEventDamage * lifecheck = dynamic_cast(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(e); if(stackCheck && (stackCheck->to == game->currentPlayer->game->stack||stackCheck->to == game->currentPlayer->opponent()->game->stack)) { diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 6cbb98dbd..2003d0b83 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -233,6 +233,40 @@ void Player::serumMulligan() //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 void Player::cleanupPhase() { diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index e69f29702..fd12b317a 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -503,6 +503,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta if (minus) { 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 {