diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index 699a408e48c..e9e1313cc01 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -2653,13 +2653,19 @@ public class AbilityUtils { } int colorOcurrencices = 0; - byte colorCode = ManaAtom.fromName(sq[1]); + byte colorCode; + if (sq.length > 1) { + colorCode = ManaAtom.fromName(sq[1]); + } else { + colorCode = ManaAtom.ALL_MANA_COLORS; + } for (Card c0 : cards) { for (ManaCostShard sh : c0.getManaCost()) { if (sh.isColor(colorCode)) colorOcurrencices++; } } + return doXMath(colorOcurrencices, expr, c, ctb); } diff --git a/forge-game/src/main/java/forge/game/ability/effects/PeekAndRevealEffect.java b/forge-game/src/main/java/forge/game/ability/effects/PeekAndRevealEffect.java index 2f1a8f7f88f..aef91c53c93 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/PeekAndRevealEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/PeekAndRevealEffect.java @@ -66,7 +66,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect { int numPeek = AbilityUtils.calculateAmount(source, peekAmount, sa); List libraryPlayers = getDefinedPlayersOrTargeted(sa); - Player peekingPlayer = sa.getActivatingPlayer(); + final Player peekingPlayer = sa.getActivatingPlayer(); for (Player libraryToPeek : libraryPlayers) { final PlayerZone library = libraryToPeek.getZone(ZoneType.Library); @@ -77,8 +77,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect { peekCards.add(library.get(i)); } - CardCollectionView revealableCards = CardLists.getValidCards(peekCards, revealValid, - sa.getActivatingPlayer(), source, sa); + CardCollectionView revealableCards = CardLists.getValidCards(peekCards, revealValid, peekingPlayer, source, sa); boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty(); if (!noPeek) { peekingPlayer.getController().reveal(peekCards, ZoneType.Library, libraryToPeek, diff --git a/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java index f96a864c2bf..11a28442dad 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ReplaceManaEffect.java @@ -34,16 +34,14 @@ public class ReplaceManaEffect extends SpellAbilityEffect { // replace type and amount replaced = sa.getParam("ReplaceMana"); if ("Any".equals(replaced)) { - byte rs = MagicColor.GREEN; - rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS); + byte rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS); replaced = MagicColor.toShortString(rs); } } else if (sa.hasParam("ReplaceType")) { // replace color and colorless String color = sa.getParam("ReplaceType"); if ("Any".equals(color)) { - byte rs = MagicColor.GREEN; - rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS); + byte rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS); color = MagicColor.toShortString(rs); } for (byte c : MagicColor.WUBRGC) { diff --git a/forge-game/src/main/java/forge/game/mana/ManaPool.java b/forge-game/src/main/java/forge/game/mana/ManaPool.java index b798edf06c6..3cbdb5b4ba3 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaPool.java +++ b/forge-game/src/main/java/forge/game/mana/ManaPool.java @@ -121,16 +121,17 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { List cleared = Lists.newArrayList(); if (floatingMana.isEmpty()) { return cleared; } - boolean convertToColorless = false; + Byte convertTo = null; final Map runParams = AbilityKey.mapFromAffected(owner); + runParams.put(AbilityKey.Mana, "C"); switch (owner.getGame().getReplacementHandler().run(ReplacementType.LoseMana, runParams)) { case NotReplaced: break; case Skipped: return cleared; - default: // the only ones that does replace losing Mana are making it colorless instead - convertToColorless = true; + default: + convertTo = ManaAtom.fromName((String) runParams.get(AbilityKey.Mana)); break; } @@ -139,8 +140,8 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { if (isEndOfPhase) { keys.removeAll(StaticAbilityUnspentMana.getManaToKeep(owner)); } - if (convertToColorless) { - keys.remove(Byte.valueOf((byte)ManaAtom.COLORLESS)); + if (convertTo != null) { + keys.remove(convertTo); } for (Byte b : keys) { @@ -148,14 +149,14 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { final List pMana = Lists.newArrayList(); if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) { for (final Mana mana : cm) { - if (mana.getManaAbility()!= null && mana.getManaAbility().isPersistentMana()) { + if (mana.getManaAbility() != null && mana.getManaAbility().isPersistentMana()) { pMana.add(mana); } } } cm.removeAll(pMana); - if (convertToColorless) { - convertManaColor(b, (byte)ManaAtom.COLORLESS); + if (convertTo != null) { + convertManaColor(b, convertTo); cm.addAll(pMana); } else { cleared.addAll(cm); diff --git a/forge-game/src/main/java/forge/game/replacement/ReplaceLoseMana.java b/forge-game/src/main/java/forge/game/replacement/ReplaceLoseMana.java index 8b888be7462..3b609f43072 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplaceLoseMana.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplaceLoseMana.java @@ -47,6 +47,7 @@ public class ReplaceLoseMana extends ReplacementEffect { @Override public void setReplacingObjects(Map runParams, SpellAbility sa) { sa.setReplacingObject(AbilityKey.Player, runParams.get(AbilityKey.Affected)); + sa.setReplacingObject(AbilityKey.Mana, runParams.get(AbilityKey.Mana)); } } diff --git a/forge-gui/res/cardsfolder/h/horizon_stone.txt b/forge-gui/res/cardsfolder/h/horizon_stone.txt index 1c32f21e733..4ae22b28c36 100644 --- a/forge-gui/res/cardsfolder/h/horizon_stone.txt +++ b/forge-gui/res/cardsfolder/h/horizon_stone.txt @@ -1,5 +1,6 @@ Name:Horizon Stone ManaCost:5 Types:Artifact -R:Event$ LoseMana | ValidPlayer$ You | ReplacementResult$ Replaced | ActiveZones$ Battlefield | Description$ If you would lose unspent mana, that mana becomes colorless instead. +R:Event$ LoseMana | ValidPlayer$ You | ReplacementResult$ Replaced | ReplaceWith$ ConvertMana | ActiveZones$ Battlefield | Description$ If you would lose unspent mana, that mana becomes colorless instead. +SVar:ConvertMana:DB$ ReplaceMana | ReplaceType$ C Oracle:If you would lose unspent mana, that mana becomes colorless instead. diff --git a/forge-gui/res/cardsfolder/k/kruphix_god_of_horizons.txt b/forge-gui/res/cardsfolder/k/kruphix_god_of_horizons.txt index d9352ae9d5d..c4f49efcf4b 100644 --- a/forge-gui/res/cardsfolder/k/kruphix_god_of_horizons.txt +++ b/forge-gui/res/cardsfolder/k/kruphix_god_of_horizons.txt @@ -6,6 +6,7 @@ K:Indestructible S:Mode$ Continuous | Affected$ Card.Self | RemoveType$ Creature | CheckSVar$ X | SVarCompare$ LT7 | Description$ As long as your devotion to green and blue is less than seven, CARDNAME isn't a creature. SVar:X:Count$DevotionDual.Green.Blue S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. -R:Event$ LoseMana | ValidPlayer$ You | ReplacementResult$ Replaced | ActiveZones$ Battlefield | Description$ If you would lose unspent mana, that mana becomes colorless instead. +R:Event$ LoseMana | ValidPlayer$ You | ReplacementResult$ Replaced | ReplaceWith$ ConvertMana | ActiveZones$ Battlefield | Description$ If you would lose unspent mana, that mana becomes colorless instead. +SVar:ConvertMana:DB$ ReplaceMana | ReplaceType$ C SVar:BuffedBy:Permanent.Green,Permanent.Blue Oracle:Indestructible\nAs long as your devotion to green and blue is less than seven, Kruphix isn't a creature.\nYou have no maximum hand size.\nIf you would lose unspent mana, that mana becomes colorless instead. diff --git a/forge-gui/res/cardsfolder/upcoming/omnath_locus_of_all.txt b/forge-gui/res/cardsfolder/upcoming/omnath_locus_of_all.txt new file mode 100644 index 00000000000..8050f3c7621 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/omnath_locus_of_all.txt @@ -0,0 +1,14 @@ +Name:Omnath, Locus of All +ManaCost:W U P R G +Types:Legendary Creature Phyrexian Elemental +PT:4/4 +R:Event$ LoseMana | ValidPlayer$ You | ReplacementResult$ Replaced | ReplaceWith$ ConvertMana | ActiveZones$ Battlefield | Description$ If you would lose unspent mana, that mana becomes black instead. +SVar:ConvertMana:DB$ ReplaceMana | ReplaceType$ B +T:Mode$ Phase | ValidPlayer$ You | Phase$ Main1 | TriggerZones$ Battlefield | Execute$ TrigPeek | TriggerDescription$ At the beginning of your precombat main phase, look at the top card of your library. You may reveal that card if it has three or more colored mana symbols in its mana cost. If you do, add three mana in any combination of colors and put it into your hand. If you don’t reveal it, put it into your hand. +SVar:TrigPeek:DB$ PeekAndReveal | Defined$ You | NoReveal$ True | RememberPeeked$ True | SubAbility$ DBReveal +SVar:DBReveal:DB$ PeekAndReveal | Defined$ You | NoPeek$ True | RevealOptional$ True | ImprintRevealed$ True | ConditionCheckSVar$ ColorAmount | ConditionSVarCompare$ GE3 | SubAbility$ DBMana +SVar:DBMana:DB$ Mana | Produced$ Combo Any | Amount$ 3 | ConditionDefined$ Imprinted | ConditionPresent$ Card | SubAbility$ DBMove +SVar:DBMove:DB$ ChangeZone | Origin$ Library | Destination$ Hand | Defined$ Remembered | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True +SVar:ColorAmount:Remembered$ChromaSource +Oracle:If you would lose unspent mana, that mana becomes black instead.\nAt the beginning of your precombat main phase, look at the top card of your library. You may reveal that card if it has three or more colored mana symbols in its mana cost. If you do, add three mana in any combination of colors and put it into your hand. If you don’t reveal it, put it into your hand. diff --git a/forge-gui/res/lists/NonStackingKWList.txt b/forge-gui/res/lists/NonStackingKWList.txt index e8eb2a90962..19778734af7 100644 --- a/forge-gui/res/lists/NonStackingKWList.txt +++ b/forge-gui/res/lists/NonStackingKWList.txt @@ -1,7 +1,6 @@ All creatures able to block CARDNAME do so. Banding CARDNAME's activated abilities can't be activated. -CARDNAME can block any number of creatures. CARDNAME can't be regenerated. CARDNAME must be blocked if able. CARDNAME doesn't untap during your untap step. @@ -38,7 +37,6 @@ Shroud Split Second Swampwalk Trample -Unblockable Undying Vigilance Wither