Implemented K'rrik, Son of Yawgmoth

KNOWN ISSUE: K'rrik's ability allowing the player to pay Phyrexian for black mana remains active after K'rrik leaves the battlefield.
This commit is contained in:
ssouders412 2019-11-11 00:17:57 -05:00
parent b4325b1daa
commit 6fd9cab283
9 changed files with 593 additions and 311 deletions

View file

@ -17,6 +17,7 @@ import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.cards.Card;
import mage.cards.SplitCard;
import mage.constants.*;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.command.Plane;
@ -548,6 +549,11 @@ public abstract class AbilityImpl implements Ability {
Iterator<ManaCost> costIterator = manaCostsToPay.iterator();
while (costIterator.hasNext()) {
ManaCost cost = costIterator.next();
PhyrexianManaCost tempPhyrexianCost = null;
Mana mana = cost.getMana();
FilterMana phyrexianColors = controller.getPhyrexianColors();
if (cost instanceof PhyrexianManaCost) {
PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) cost;
PayLifeCost payLifeCost = new PayLifeCost(2);
@ -557,6 +563,37 @@ public abstract class AbilityImpl implements Ability {
costs.add(payLifeCost);
}
}
/* K'rrik, Son of Yawgmoth ability check */
else if (phyrexianColors != null) {
int phyrexianEnabledPips = mana.count(phyrexianColors);
if (phyrexianEnabledPips > 0) {
/* find which color mana is in the cost and set it in the temp Phyrexian cost */
if (phyrexianColors.isWhite() && mana.getWhite() > 0) {
tempPhyrexianCost = new PhyrexianManaCost(ColoredManaSymbol.W);
}
else if (phyrexianColors.isBlue() && mana.getBlue() > 0) {
tempPhyrexianCost = new PhyrexianManaCost(ColoredManaSymbol.U);
}
else if (phyrexianColors.isBlack() && mana.getBlack() > 0) {
tempPhyrexianCost = new PhyrexianManaCost(ColoredManaSymbol.B);
}
else if (phyrexianColors.isRed() && mana.getRed() > 0) {
tempPhyrexianCost = new PhyrexianManaCost(ColoredManaSymbol.R);
}
else if (phyrexianColors.isGreen() && mana.getGreen() > 0) {
tempPhyrexianCost = new PhyrexianManaCost(ColoredManaSymbol.G);
}
if (tempPhyrexianCost != null) {
PayLifeCost payLifeCost = new PayLifeCost(2);
if (payLifeCost.canPay(this, sourceId, controller.getId(), game)
&& controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + tempPhyrexianCost.getBaseText() + '?', this, game)) {
costIterator.remove();
costs.add(payLifeCost);
}
}
}
}
}
}