mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
- 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:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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/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_lattice.txt -text
|
||||
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_infinite_rage.txt -text
|
||||
|
||||
@@ -119,6 +119,7 @@ public class MagicColor {
|
||||
|
||||
/** The only colors. */
|
||||
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. */
|
||||
public static final String SNOW = "snow";
|
||||
|
||||
@@ -695,6 +695,10 @@ public class GameAction {
|
||||
game.getTriggerHandler().cleanUpTemporaryTriggers();
|
||||
game.getReplacementHandler().cleanUpTemporaryReplacements();
|
||||
|
||||
for(Player p : game.getPlayers()) {
|
||||
p.getManaPool().restoreColorReplacements();
|
||||
}
|
||||
|
||||
// search for cards with static abilities
|
||||
final List<Card> allCards = game.getCardsInGame();
|
||||
final ArrayList<StaticAbility> staticAbilities = new ArrayList<StaticAbility>();
|
||||
|
||||
@@ -421,9 +421,13 @@ public class ManaPool {
|
||||
private final byte[] colorConversionMatrix = new byte[6];
|
||||
private static final byte[] identityMatrix = { MagicColor.WHITE, MagicColor.BLUE, MagicColor.BLACK, MagicColor.RED, MagicColor.GREEN, 0 };
|
||||
|
||||
public void addColorReplacement(byte originalColor, byte replacementColor) {
|
||||
int rowIdx = MagicColor.getIndexOfFirstColor(originalColor);
|
||||
colorConversionMatrix[rowIdx] |= replacementColor;
|
||||
public void adjustColorReplacement(byte originalColor, byte replacementColor, boolean additive) {
|
||||
// Fix the index based on a 6 length array with colorless in the last slot
|
||||
int rowIdx = (MagicColor.getIndexOfFirstColor(originalColor) + 6) % 6;
|
||||
if (additive)
|
||||
colorConversionMatrix[rowIdx] |= replacementColor;
|
||||
else
|
||||
colorConversionMatrix[rowIdx] &= replacementColor;
|
||||
}
|
||||
|
||||
public void restoreColorReplacements() {
|
||||
|
||||
@@ -23,11 +23,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.CardType;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
import forge.game.Game;
|
||||
import forge.game.GlobalRuleChange;
|
||||
@@ -40,6 +42,7 @@ import forge.game.card.Card;
|
||||
import forge.game.card.CardFactoryUtil;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.mana.ManaPool;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementHandler;
|
||||
@@ -344,6 +347,37 @@ public class StaticAbilityContinuous {
|
||||
int rmax = AbilityUtils.calculateAmount(hostCard, rmhs, null);
|
||||
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
|
||||
|
||||
10
forge-gui/res/cardsfolder/m/mycosynth_lattice.txt
Normal file
10
forge-gui/res/cardsfolder/m/mycosynth_lattice.txt
Normal 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.
|
||||
@@ -1,8 +1,7 @@
|
||||
Name:Sunglasses of Urza
|
||||
ManaCost:3
|
||||
Types:Artifact
|
||||
Text: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.
|
||||
S:Mode$ Continuous | Affected$ You | ManaColorConversion$ Additive | WhiteConversion$ Red | Description$ You may spend white mana as though it were red mana.
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:RemAIDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/sunglasses_of_urza.jpg
|
||||
|
||||
Reference in New Issue
Block a user