New Omnath and support

This commit is contained in:
tool4EvEr
2023-02-20 11:47:30 +01:00
parent e2290c7079
commit 022f3e0cb1
9 changed files with 39 additions and 20 deletions

View File

@@ -2653,13 +2653,19 @@ public class AbilityUtils {
} }
int colorOcurrencices = 0; 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 (Card c0 : cards) {
for (ManaCostShard sh : c0.getManaCost()) { for (ManaCostShard sh : c0.getManaCost()) {
if (sh.isColor(colorCode)) if (sh.isColor(colorCode))
colorOcurrencices++; colorOcurrencices++;
} }
} }
return doXMath(colorOcurrencices, expr, c, ctb); return doXMath(colorOcurrencices, expr, c, ctb);
} }

View File

@@ -66,7 +66,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
int numPeek = AbilityUtils.calculateAmount(source, peekAmount, sa); int numPeek = AbilityUtils.calculateAmount(source, peekAmount, sa);
List<Player> libraryPlayers = getDefinedPlayersOrTargeted(sa); List<Player> libraryPlayers = getDefinedPlayersOrTargeted(sa);
Player peekingPlayer = sa.getActivatingPlayer(); final Player peekingPlayer = sa.getActivatingPlayer();
for (Player libraryToPeek : libraryPlayers) { for (Player libraryToPeek : libraryPlayers) {
final PlayerZone library = libraryToPeek.getZone(ZoneType.Library); final PlayerZone library = libraryToPeek.getZone(ZoneType.Library);
@@ -77,8 +77,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
peekCards.add(library.get(i)); peekCards.add(library.get(i));
} }
CardCollectionView revealableCards = CardLists.getValidCards(peekCards, revealValid, CardCollectionView revealableCards = CardLists.getValidCards(peekCards, revealValid, peekingPlayer, source, sa);
sa.getActivatingPlayer(), source, sa);
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty(); boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
if (!noPeek) { if (!noPeek) {
peekingPlayer.getController().reveal(peekCards, ZoneType.Library, libraryToPeek, peekingPlayer.getController().reveal(peekCards, ZoneType.Library, libraryToPeek,

View File

@@ -34,16 +34,14 @@ public class ReplaceManaEffect extends SpellAbilityEffect {
// replace type and amount // replace type and amount
replaced = sa.getParam("ReplaceMana"); replaced = sa.getParam("ReplaceMana");
if ("Any".equals(replaced)) { if ("Any".equals(replaced)) {
byte rs = MagicColor.GREEN; byte rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS);
rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS);
replaced = MagicColor.toShortString(rs); replaced = MagicColor.toShortString(rs);
} }
} else if (sa.hasParam("ReplaceType")) { } else if (sa.hasParam("ReplaceType")) {
// replace color and colorless // replace color and colorless
String color = sa.getParam("ReplaceType"); String color = sa.getParam("ReplaceType");
if ("Any".equals(color)) { if ("Any".equals(color)) {
byte rs = MagicColor.GREEN; byte rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS);
rs = player.getController().chooseColor("Choose a color", sa, ColorSet.ALL_COLORS);
color = MagicColor.toShortString(rs); color = MagicColor.toShortString(rs);
} }
for (byte c : MagicColor.WUBRGC) { for (byte c : MagicColor.WUBRGC) {

View File

@@ -121,16 +121,17 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
List<Mana> cleared = Lists.newArrayList(); List<Mana> cleared = Lists.newArrayList();
if (floatingMana.isEmpty()) { return cleared; } if (floatingMana.isEmpty()) { return cleared; }
boolean convertToColorless = false; Byte convertTo = null;
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromAffected(owner); final Map<AbilityKey, Object> runParams = AbilityKey.mapFromAffected(owner);
runParams.put(AbilityKey.Mana, "C");
switch (owner.getGame().getReplacementHandler().run(ReplacementType.LoseMana, runParams)) { switch (owner.getGame().getReplacementHandler().run(ReplacementType.LoseMana, runParams)) {
case NotReplaced: case NotReplaced:
break; break;
case Skipped: case Skipped:
return cleared; return cleared;
default: // the only ones that does replace losing Mana are making it colorless instead default:
convertToColorless = true; convertTo = ManaAtom.fromName((String) runParams.get(AbilityKey.Mana));
break; break;
} }
@@ -139,8 +140,8 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
if (isEndOfPhase) { if (isEndOfPhase) {
keys.removeAll(StaticAbilityUnspentMana.getManaToKeep(owner)); keys.removeAll(StaticAbilityUnspentMana.getManaToKeep(owner));
} }
if (convertToColorless) { if (convertTo != null) {
keys.remove(Byte.valueOf((byte)ManaAtom.COLORLESS)); keys.remove(convertTo);
} }
for (Byte b : keys) { for (Byte b : keys) {
@@ -148,14 +149,14 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
final List<Mana> pMana = Lists.newArrayList(); final List<Mana> pMana = Lists.newArrayList();
if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) { if (isEndOfPhase && !owner.getGame().getPhaseHandler().is(PhaseType.CLEANUP)) {
for (final Mana mana : cm) { for (final Mana mana : cm) {
if (mana.getManaAbility()!= null && mana.getManaAbility().isPersistentMana()) { if (mana.getManaAbility() != null && mana.getManaAbility().isPersistentMana()) {
pMana.add(mana); pMana.add(mana);
} }
} }
} }
cm.removeAll(pMana); cm.removeAll(pMana);
if (convertToColorless) { if (convertTo != null) {
convertManaColor(b, (byte)ManaAtom.COLORLESS); convertManaColor(b, convertTo);
cm.addAll(pMana); cm.addAll(pMana);
} else { } else {
cleared.addAll(cm); cleared.addAll(cm);

View File

@@ -47,6 +47,7 @@ public class ReplaceLoseMana extends ReplacementEffect {
@Override @Override
public void setReplacingObjects(Map<AbilityKey, Object> runParams, SpellAbility sa) { public void setReplacingObjects(Map<AbilityKey, Object> runParams, SpellAbility sa) {
sa.setReplacingObject(AbilityKey.Player, runParams.get(AbilityKey.Affected)); sa.setReplacingObject(AbilityKey.Player, runParams.get(AbilityKey.Affected));
sa.setReplacingObject(AbilityKey.Mana, runParams.get(AbilityKey.Mana));
} }
} }

View File

@@ -1,5 +1,6 @@
Name:Horizon Stone Name:Horizon Stone
ManaCost:5 ManaCost:5
Types:Artifact 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. Oracle:If you would lose unspent mana, that mana becomes colorless instead.

View File

@@ -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. 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 SVar:X:Count$DevotionDual.Green.Blue
S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size. 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 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. 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.

View File

@@ -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 dont 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 dont reveal it, put it into your hand.

View File

@@ -1,7 +1,6 @@
All creatures able to block CARDNAME do so. All creatures able to block CARDNAME do so.
Banding Banding
CARDNAME's activated abilities can't be activated. CARDNAME's activated abilities can't be activated.
CARDNAME can block any number of creatures.
CARDNAME can't be regenerated. CARDNAME can't be regenerated.
CARDNAME must be blocked if able. CARDNAME must be blocked if able.
CARDNAME doesn't untap during your untap step. CARDNAME doesn't untap during your untap step.
@@ -38,7 +37,6 @@ Shroud
Split Second Split Second
Swampwalk Swampwalk
Trample Trample
Unblockable
Undying Undying
Vigilance Vigilance
Wither Wither