- Initial checkin for Additive Mana Conversion Static Ability (Restrictive Conversions currently not 100% correct)

- Added Mycosynth Lattice
- Fixed Sunglasses of Urza
This commit is contained in:
Sol
2014-02-09 02:37:09 +00:00
parent 537f95c79d
commit c8eed79a2a
7 changed files with 58 additions and 5 deletions

1
.gitattributes vendored
View File

@@ -8211,6 +8211,7 @@ forge-gui/res/cardsfolder/m/mycologist.txt svneol=native#text/plain
forge-gui/res/cardsfolder/m/mycoloth.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mycoloth.txt svneol=native#text/plain
forge-gui/res/cardsfolder/m/mycosynth_fiend.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mycosynth_fiend.txt svneol=native#text/plain
forge-gui/res/cardsfolder/m/mycosynth_golem.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mycosynth_golem.txt svneol=native#text/plain
forge-gui/res/cardsfolder/m/mycosynth_lattice.txt -text
forge-gui/res/cardsfolder/m/mycosynth_wellspring.txt svneol=native#text/plain forge-gui/res/cardsfolder/m/mycosynth_wellspring.txt svneol=native#text/plain
forge-gui/res/cardsfolder/m/myojin_of_cleansing_fire.txt -text forge-gui/res/cardsfolder/m/myojin_of_cleansing_fire.txt -text
forge-gui/res/cardsfolder/m/myojin_of_infinite_rage.txt -text forge-gui/res/cardsfolder/m/myojin_of_infinite_rage.txt -text

View File

@@ -119,6 +119,7 @@ public class MagicColor {
/** The only colors. */ /** The only colors. */
public static final ImmutableList<String> ONLY_COLORS = ImmutableList.of(WHITE, BLUE, BLACK, RED, GREEN); public static final ImmutableList<String> ONLY_COLORS = ImmutableList.of(WHITE, BLUE, BLACK, RED, GREEN);
public static final ImmutableList<String> COLORS_AND_COLORLESS = ImmutableList.of(WHITE, BLUE, BLACK, RED, GREEN, COLORLESS);
/** The Snow. */ /** The Snow. */
public static final String SNOW = "snow"; public static final String SNOW = "snow";

View File

@@ -695,6 +695,10 @@ public class GameAction {
game.getTriggerHandler().cleanUpTemporaryTriggers(); game.getTriggerHandler().cleanUpTemporaryTriggers();
game.getReplacementHandler().cleanUpTemporaryReplacements(); game.getReplacementHandler().cleanUpTemporaryReplacements();
for(Player p : game.getPlayers()) {
p.getManaPool().restoreColorReplacements();
}
// search for cards with static abilities // search for cards with static abilities
final List<Card> allCards = game.getCardsInGame(); final List<Card> allCards = game.getCardsInGame();
final ArrayList<StaticAbility> staticAbilities = new ArrayList<StaticAbility>(); final ArrayList<StaticAbility> staticAbilities = new ArrayList<StaticAbility>();

View File

@@ -421,9 +421,13 @@ public class ManaPool {
private final byte[] colorConversionMatrix = new byte[6]; private final byte[] colorConversionMatrix = new byte[6];
private static final byte[] identityMatrix = { MagicColor.WHITE, MagicColor.BLUE, MagicColor.BLACK, MagicColor.RED, MagicColor.GREEN, 0 }; private static final byte[] identityMatrix = { MagicColor.WHITE, MagicColor.BLUE, MagicColor.BLACK, MagicColor.RED, MagicColor.GREEN, 0 };
public void addColorReplacement(byte originalColor, byte replacementColor) { public void adjustColorReplacement(byte originalColor, byte replacementColor, boolean additive) {
int rowIdx = MagicColor.getIndexOfFirstColor(originalColor); // Fix the index based on a 6 length array with colorless in the last slot
colorConversionMatrix[rowIdx] |= replacementColor; int rowIdx = (MagicColor.getIndexOfFirstColor(originalColor) + 6) % 6;
if (additive)
colorConversionMatrix[rowIdx] |= replacementColor;
else
colorConversionMatrix[rowIdx] &= replacementColor;
} }
public void restoreColorReplacements() { public void restoreColorReplacements() {

View File

@@ -23,11 +23,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import forge.card.CardType; import forge.card.CardType;
import forge.card.ColorSet; import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCostShard;
import forge.game.Game; import forge.game.Game;
import forge.game.GlobalRuleChange; import forge.game.GlobalRuleChange;
@@ -40,6 +42,7 @@ import forge.game.card.Card;
import forge.game.card.CardFactoryUtil; import forge.game.card.CardFactoryUtil;
import forge.game.card.CardLists; import forge.game.card.CardLists;
import forge.game.card.CardUtil; import forge.game.card.CardUtil;
import forge.game.mana.ManaPool;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.replacement.ReplacementEffect; import forge.game.replacement.ReplacementEffect;
import forge.game.replacement.ReplacementHandler; import forge.game.replacement.ReplacementHandler;
@@ -344,6 +347,37 @@ public class StaticAbilityContinuous {
int rmax = AbilityUtils.calculateAmount(hostCard, rmhs, null); int rmax = AbilityUtils.calculateAmount(hostCard, rmhs, null);
p.setMaxHandSize(p.getMaxHandSize() + rmax); p.setMaxHandSize(p.getMaxHandSize() + rmax);
} }
if (params.containsKey("ManaColorConversion")) {
String conversionType = params.get("ManaColorConversion");
// Choices are Additives(OR) or Restrictive(AND)
boolean additive = "Additive".equals(conversionType);
ManaPool pool = p.getManaPool();
for(String c : MagicColor.Constant.COLORS_AND_COLORLESS) {
// Use the strings from MagicColor, since that's how the Script will be coming in as
String key = WordUtils.capitalize(c) + "Conversion";
if (params.containsKey(key)) {
String convertTo = params.get(key);
byte convertByte = 0;
if ("All".equals(convertTo)) {
convertByte = MagicColor.ALL_COLORS;
} else{
for(String convertColor : convertTo.split(",")) {
convertByte |= MagicColor.fromName(convertColor);
}
}
// Celestial Dawn won't be 100% correct with this implementation
// Since all the additives need to happen first
// And all the restrictions need to happen second
// But this would mostly work unless a conflicting mana conversion card
// Is also out in play CD + Mycosynth Lattice depending on timestamps might be incorrect
pool.adjustColorReplacement(MagicColor.fromName(c), convertByte, additive);
}
}
}
} }
// start modifying the cards // start modifying the cards

View File

@@ -0,0 +1,10 @@
Name:Mycosynth Lattice
ManaCost:6
Types:Artifact
S:Mode$ Continuous | Affected$ Permanent | AddType$ Artifact | Description$ All permanents are artifact in addition to their other types.
S:Mode$ Continuous| Affected$ Card | SetColor$ Colorless | AffectedZone$ Battlefield,Hand,Library,Graveyard,Exile,Stack,Command | Description$ All cards that aren't on the battlefield, spells, and permanents are colorless.
S:Mode$ Continuous | Affected$ Player | ManaColorConversion$ Additive | WhiteConversion$ All | BlueConversion$ All | BlackConversion$ All | RedConversion$ All | GreenConversion$ All | ColorlessConversion$ All | Description$ Players may spend mana as though it were mana of any color.
SVar:NonStackingEffect:True
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/mycosynth_lattice.jpg
Oracle:All permanents are artifacts in addition to their other types.\nAll cards that aren't on the battlefield, spells, and permanents are colorless.\nPlayers may spend mana as though it were mana of any color.

View File

@@ -1,8 +1,7 @@
Name:Sunglasses of Urza Name:Sunglasses of Urza
ManaCost:3 ManaCost:3
Types:Artifact Types:Artifact
Text:You may spend white mana as though it were red mana. S:Mode$ Continuous | Affected$ You | ManaColorConversion$ Additive | WhiteConversion$ Red | Description$ You may spend white mana as though it were red mana.
A:AB$ Mana | Cost$ W | Produced$ R | SpellDescription$ Add {R} to your mana pool.
SVar:RemRandomDeck:True SVar:RemRandomDeck:True
SVar:RemAIDeck:True SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/sunglasses_of_urza.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/sunglasses_of_urza.jpg