Merge pull request #45 from Northmoc/snc_ma

SNC: Maestros Ascendancy and support
This commit is contained in:
Agetian
2022-04-15 22:15:39 +03:00
committed by GitHub
4 changed files with 35 additions and 14 deletions

View File

@@ -3360,8 +3360,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
return result; return result;
} }
public final void setMayPlay(final Player player, final boolean withoutManaCost, final Cost altManaCost, final boolean withFlash, final boolean grantZonePermissions, final StaticAbility sta) { public final void setMayPlay(final Player player, final boolean withoutManaCost, final Cost altManaCost, final boolean altIsAdditional, final boolean withFlash, final boolean grantZonePermissions, final StaticAbility sta) {
this.mayPlay.put(sta, new CardPlayOption(player, sta, withoutManaCost, altManaCost, withFlash, grantZonePermissions)); this.mayPlay.put(sta, new CardPlayOption(player, sta, withoutManaCost, altManaCost, altIsAdditional, withFlash, grantZonePermissions));
this.updateMayPlay(); this.updateMayPlay();
} }
public final void removeMayPlay(final StaticAbility sta) { public final void removeMayPlay(final StaticAbility sta) {

View File

@@ -20,11 +20,12 @@ public final class CardPlayOption {
private final boolean withFlash; private final boolean withFlash;
private final boolean grantsZonePermissions; private final boolean grantsZonePermissions;
private final Cost altManaCost; private final Cost altManaCost;
private final boolean altIsAdditional;
public CardPlayOption(final Player player, final StaticAbility sta, final boolean withoutManaCost, final Cost altManaCost, final boolean withFlash, final boolean grantZonePermissions) { public CardPlayOption(final Player player, final StaticAbility sta, final boolean withoutManaCost, final Cost altManaCost, final boolean altIsAdditional, final boolean withFlash, final boolean grantZonePermissions) {
this(player, sta, withoutManaCost ? PayManaCost.NO : PayManaCost.YES, altManaCost, withFlash, grantZonePermissions); this(player, sta, withoutManaCost ? PayManaCost.NO : PayManaCost.YES, altManaCost, altIsAdditional, withFlash, grantZonePermissions);
} }
private CardPlayOption(final Player player, final StaticAbility sta, final PayManaCost payManaCost, final Cost altManaCost, final boolean withFlash, private CardPlayOption(final Player player, final StaticAbility sta, final PayManaCost payManaCost, final Cost altManaCost, final boolean altIsAdditional, final boolean withFlash,
final boolean grantZonePermissions) { final boolean grantZonePermissions) {
this.player = player; this.player = player;
this.sta = sta; this.sta = sta;
@@ -32,6 +33,7 @@ public final class CardPlayOption {
this.withFlash = withFlash; this.withFlash = withFlash;
this.grantsZonePermissions = grantZonePermissions; this.grantsZonePermissions = grantZonePermissions;
this.altManaCost = altManaCost; this.altManaCost = altManaCost;
this.altIsAdditional = altIsAdditional;
} }
@@ -86,9 +88,14 @@ public final class CardPlayOption {
switch (getPayManaCost()) { switch (getPayManaCost()) {
case YES: case YES:
if (altManaCost != null) { if (altManaCost != null) {
if (altIsAdditional) {
String desc = sta.getParam("Description");
sb.append(" (").append(desc, desc.indexOf("by "), desc.indexOf("."));
} else {
String insteadCost = getFormattedAltManaCost(); String insteadCost = getFormattedAltManaCost();
insteadCost = insteadCost.replace("Pay ",""); insteadCost = insteadCost.replace("Pay ","");
sb.append(" (by paying ").append(insteadCost).append(" instead of paying its mana cost"); sb.append(" (by paying ").append(insteadCost).append(" instead of paying its mana cost");
}
if (isWithFlash()) { if (isWithFlash()) {
sb.append(" and as though it has flash"); sb.append(" and as though it has flash");
} }

View File

@@ -937,25 +937,32 @@ public final class StaticAbilityContinuous {
if (controllerMayPlay && (mayPlayLimit == null || stAb.getMayPlayTurn() < mayPlayLimit)) { if (controllerMayPlay && (mayPlayLimit == null || stAb.getMayPlayTurn() < mayPlayLimit)) {
String mayPlayAltCost = mayPlayAltManaCost; String mayPlayAltCost = mayPlayAltManaCost;
boolean additional = mayPlayAltCost.contains("RegularCost");
if (mayPlayAltCost != null && mayPlayAltCost.contains("ConvertedManaCost")) { if (mayPlayAltCost != null) {
if (mayPlayAltCost.contains("ConvertedManaCost")) {
final String costcmc = Integer.toString(affectedCard.getCMC()); final String costcmc = Integer.toString(affectedCard.getCMC());
mayPlayAltCost = mayPlayAltCost.replace("ConvertedManaCost", costcmc); mayPlayAltCost = mayPlayAltCost.replace("ConvertedManaCost", costcmc);
} else if (additional) {
final String regCost = affectedCard.getManaCost().getShortString();
mayPlayAltCost = mayPlayAltManaCost.replace("RegularCost", regCost);
}
} }
Player mayPlayController = params.containsKey("MayPlayPlayer") ? Player mayPlayController = params.containsKey("MayPlayPlayer") ?
AbilityUtils.getDefinedPlayers(affectedCard, params.get("MayPlayPlayer"), stAb).get(0) : AbilityUtils.getDefinedPlayers(affectedCard, params.get("MayPlayPlayer"), stAb).get(0) :
controller; controller;
affectedCard.setMayPlay(mayPlayController, mayPlayWithoutManaCost, affectedCard.setMayPlay(mayPlayController, mayPlayWithoutManaCost,
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, additional, mayPlayWithFlash,
mayPlayWithFlash, mayPlayGrantZonePermissions, stAb); 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 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)) { if (stAb.hasParam("Affected") && stAb.getParam("Affected").equals("Card.Self") && affectedCard.isInZone(ZoneType.Graveyard)) {
for (final Player p : game.getPlayers()) { for (final Player p : game.getPlayers()) {
if (p.hasKeyword("Shaman's Trance") && mayPlayController != p) { if (p.hasKeyword("Shaman's Trance") && mayPlayController != p) {
affectedCard.setMayPlay(p, mayPlayWithoutManaCost, affectedCard.setMayPlay(p, mayPlayWithoutManaCost,
mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, mayPlayAltCost != null ? new Cost(mayPlayAltCost, false) : null, additional,
mayPlayWithFlash, mayPlayGrantZonePermissions, stAb); mayPlayWithFlash, mayPlayGrantZonePermissions, stAb);
} }
} }

View File

@@ -0,0 +1,7 @@
Name:Maestros Ascendancy
ManaCost:U B R
Types:Enchantment
S:Mode$ Continuous | Affected$ Instant.YouCtrl,Sorcery.YouCtrl | Condition$ PlayerTurn | MayPlay$ True | MayPlayAltManaCost$ RegularCost Sac<1/Creature> | MayPlayLimit$ 1 | EffectZone$ Battlefield | AffectedZone$ Graveyard | Description$ Once during each of your turns, you may cast an instant or sorcery spell from your graveyard by sacrificing a creature in addition to paying its other costs. If a spell cast this way would be put into your graveyard, exile it instead.
R:Event$ Moved | ValidLKI$ Card.CastSa Spell.MayPlaySource | Origin$ Stack | Destination$ Graveyard | ReplaceWith$ MoveExile
SVar:MoveExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile
Oracle:Once during each of your turns, you may cast an instant or sorcery spell from your graveyard by sacrificing a creature in addition to paying its other costs. If a spell cast this way would be put into your graveyard, exile it instead.