StaticAbilityContinuous support MayPlay altCost being additional using "RegularCost"

This commit is contained in:
Northmoc
2022-04-15 12:15:08 -04:00
parent f747176d7e
commit 0a1a15ae89

View File

@@ -937,25 +937,32 @@ public final class StaticAbilityContinuous {
if (controllerMayPlay && (mayPlayLimit == null || stAb.getMayPlayTurn() < mayPlayLimit)) {
String mayPlayAltCost = mayPlayAltManaCost;
boolean additional = mayPlayAltCost.contains("RegularCost");
if (mayPlayAltCost != null && mayPlayAltCost.contains("ConvertedManaCost")) {
final String costcmc = Integer.toString(affectedCard.getCMC());
mayPlayAltCost = mayPlayAltCost.replace("ConvertedManaCost", costcmc);
if (mayPlayAltCost != null) {
if (mayPlayAltCost.contains("ConvertedManaCost")) {
final String costcmc = Integer.toString(affectedCard.getCMC());
mayPlayAltCost = mayPlayAltCost.replace("ConvertedManaCost", costcmc);
} else if (additional) {
final String regCost = affectedCard.getManaCost().getShortString();
mayPlayAltCost = mayPlayAltManaCost.replace("RegularCost", regCost);
}
}
Player mayPlayController = params.containsKey("MayPlayPlayer") ?
AbilityUtils.getDefinedPlayers(affectedCard, params.get("MayPlayPlayer"), stAb).get(0) :
controller;
affectedCard.setMayPlay(mayPlayController, mayPlayWithoutManaCost,
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null,
mayPlayWithFlash, mayPlayGrantZonePermissions, stAb);
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, additional, mayPlayWithFlash,
mayPlayGrantZonePermissions, stAb);
// If the MayPlay effect only affected itself, check if it is in graveyard and give other player who cast Shaman's Trance MayPlay
if (stAb.hasParam("Affected") && stAb.getParam("Affected").equals("Card.Self") && affectedCard.isInZone(ZoneType.Graveyard)) {
for (final Player p : game.getPlayers()) {
if (p.hasKeyword("Shaman's Trance") && mayPlayController != p) {
affectedCard.setMayPlay(p, mayPlayWithoutManaCost,
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null,
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, additional,
mayPlayWithFlash, mayPlayGrantZonePermissions, stAb);
}
}