From 4f412489783350ed6d81b27e81a658bb2008e70b Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 27 Nov 2014 14:38:55 +0800 Subject: [PATCH] Added specific life cost. if we use {l}{l}{l} to pay 3 life, and you have 2 life, you cannot afford to pay the cost but instead the game allows it. if we use specific life cost like: {l:3}, the restriction works. --- projects/mtg/src/ManaCost.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index 7f866c179..08afcdbb0 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -159,10 +159,19 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan { //Mill to exile yourself as a cost (Library 2 Exile) manaCost->addExtraCost(NEW MillExileCost(tc)); } - else + else if (value == "l") { //Life cost manaCost->addExtraCost(NEW LifeCost(tc)); } + else + { //Specific Life cost + vectorvalSplit = parseBetween(value,"l:"," ",false); + if (valSplit.size()) { + WParsedInt* lifetopay = NEW WParsedInt(valSplit[1], NULL, c); + manaCost->addExtraCost(NEW SpecificLifeCost(tc,lifetopay->getValue())); + SAFE_DELETE(lifetopay); + } + } break; case 'd': //DiscardRandom cost if (value == "d")