- Integrating a reformatted fix by Seravy which makes Mox Amber AI playable (as well as Reflecting Pool) and fixes auto mana payment for these and other cards that use ManaReflected.

This commit is contained in:
Agetian
2018-05-02 06:55:59 +03:00
parent d664f8abcd
commit c66a8c20d2
3 changed files with 10 additions and 11 deletions

View File

@@ -58,25 +58,24 @@ public class ManaReflectedEffect extends SpellAbilityEffect {
String baseMana; String baseMana;
// Obey already made choice by AI // TODO: This effect explicitly obeys express color choice as set by auto payment and AI routines in order
// to avoid misplays. Perhaps a better solution is possible?
String colorsNeeded = sa.getManaPart().getExpressChoice(); String colorsNeeded = sa.getManaPart().getExpressChoice();
String choice = ""; String choice = "";
ColorSet colorMenu = null; ColorSet colorMenu = null;
byte mask = 0; byte mask = 0;
//loop through colors to make menu // loop through colors to make menu
for (int nChar = 0; nChar < colorsNeeded.length(); nChar++) { for (int nChar = 0; nChar < colorsNeeded.length(); nChar++) {
mask |= MagicColor.fromName(colorsNeeded.charAt(nChar)); mask |= MagicColor.fromName(colorsNeeded.charAt(nChar));
} }
// AI wanted a "color" but result came up with no colors -> AI wanted Colorless!
// Is that a thing? I assume it is?
if ((mask == 0) && (!("".equals(sa.getManaPart().getExpressChoice()))) && (colors.contains("colorless"))) { if ((mask == 0) && (!("".equals(sa.getManaPart().getExpressChoice()))) && (colors.contains("colorless"))) {
baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless("Select Mana to Produce", sa.getHostCard(), ColorSet.fromMask(mask))); baseMana = MagicColor.toShortString(player.getController().chooseColorAllowColorless("Select Mana to Produce", sa.getHostCard(), ColorSet.fromMask(mask)));
} else } else {
// Nothing set previously so ask player if needed // Nothing set previously so ask player if needed
if (mask == 0) { if (mask == 0) {
if (colors.size() == 0) { if (colors.isEmpty()) {
return "0"; return "0";
} else if (colors.size() == 1) { } else if (colors.size() == 1) {
baseMana = MagicColor.toShortString(colors.iterator().next()); baseMana = MagicColor.toShortString(colors.iterator().next());
@@ -86,15 +85,16 @@ public class ManaReflectedEffect extends SpellAbilityEffect {
} else { } else {
baseMana = MagicColor.toShortString(player.getController().chooseColor("Select Mana to Produce", sa, ColorSet.fromNames(colors))); baseMana = MagicColor.toShortString(player.getController().chooseColor("Select Mana to Produce", sa, ColorSet.fromNames(colors)));
} }
} }
} else { } else {
colorMenu = ColorSet.fromMask(mask); colorMenu = ColorSet.fromMask(mask);
byte val = sa.getActivatingPlayer().getController().chooseColor("Select Mana to Produce", sa, colorMenu); byte val = sa.getActivatingPlayer().getController().chooseColor("Select Mana to Produce", sa, colorMenu);
if (0 == val) { if (val == 0) {
throw new RuntimeException("ManaEffect::resolve() /*reflected mana*/ - " + sa.getActivatingPlayer() + " color mana choice is empty for " + sa.getHostCard().getName()); throw new RuntimeException("ManaEffect::resolve() /*reflected mana*/ - " + sa.getActivatingPlayer() + " color mana choice is empty for " + sa.getHostCard().getName());
} }
baseMana = MagicColor.toShortString(val); baseMana = MagicColor.toShortString(val);
} }
}
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
if (amount == 0) { if (amount == 0) {

View File

@@ -2,6 +2,5 @@ Name:Mox Amber
ManaCost:0 ManaCost:0
Types:Legendary Artifact Types:Legendary Artifact
A:AB$ ManaReflected | Cost$ T | ColorOrType$ Color | Valid$ Creature.Legendary+YouCtrl,Planeswalker.Legendary+YouCtrl | ReflectProperty$ Is | SpellDescription$ Add one mana of any color among legendary creatures and planeswalkers you control. A:AB$ ManaReflected | Cost$ T | ColorOrType$ Color | Valid$ Creature.Legendary+YouCtrl,Planeswalker.Legendary+YouCtrl | ReflectProperty$ Is | SpellDescription$ Add one mana of any color among legendary creatures and planeswalkers you control.
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/mox_amber.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mox_amber.jpg
Oracle:{T}: Add one mana of any color among legendary creatures and planeswalkers you control. Oracle:{T}: Add one mana of any color among legendary creatures and planeswalkers you control.

View File

@@ -1,6 +1,6 @@
Name:Reflecting Pool Name:Reflecting Pool
ManaCost:no cost ManaCost:no cost
Types:Land Types:Land
A:AB$ ManaReflected | Cost$ T | ColorOrType$ Type | Valid$ Land.YouCtrl | ReflectProperty$ Produce | SpellDescription$ Add to your mana pool one mana of any type that a land you control could produce. A:AB$ ManaReflected | Cost$ T | ColorOrType$ Type | Valid$ Land.YouCtrl | ReflectProperty$ Produce | SpellDescription$ Add one mana of any type that a land you control could produce.
SVar:Picture:http://www.wizards.com/global/images/magic/general/reflecting_pool.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/reflecting_pool.jpg
Oracle:{T}: Add to your mana pool one mana of any type that a land you control could produce. Oracle:{T}: Add one mana of any type that a land you control could produce.