Add Emblazoned Golem

This commit is contained in:
Lyu Zong-Hong
2021-04-11 18:56:49 +09:00
parent 34fb9bb865
commit 8ae916ac28
6 changed files with 87 additions and 19 deletions

View File

@@ -240,7 +240,7 @@ public class ManaCostBeingPaid {
public final boolean isNeeded(final Mana paid, final ManaPool pool) {
for (ManaCostShard shard : unpaidShards.keySet()) {
if (canBePaidWith(shard, paid, pool)) {
if (canBePaidWith(shard, paid, pool, xManaCostPaidByColor)) {
return true;
}
}
@@ -260,7 +260,7 @@ public class ManaCostBeingPaid {
shard = ManaCostShard.GENERIC;
}
else {
shard = ManaCostShard.valueOf(ManaAtom.fromName(xColor));
shard = ManaCostShard.parseNonGeneric(xColor);
}
increaseShard(shard, xCost, true);
}
@@ -441,6 +441,10 @@ public class ManaCostBeingPaid {
Predicate<ManaCostShard> predCanBePaid = new Predicate<ManaCostShard>() {
@Override
public boolean apply(ManaCostShard ms) {
// Check Colored X and see if the color is already used
if (ms == ManaCostShard.COLORED_X && !canColoredXShardBePaidByColor(MagicColor.toShortString(colorMask), xManaCostPaidByColor)) {
return false;
}
return pool.canPayForShardWithColor(ms, colorMask);
}
};
@@ -465,7 +469,7 @@ public class ManaCostBeingPaid {
Predicate<ManaCostShard> predCanBePaid = new Predicate<ManaCostShard>() {
@Override
public boolean apply(ManaCostShard ms) {
return canBePaidWith(ms, mana, pool);
return canBePaidWith(ms, mana, pool, xManaCostPaidByColor);
}
};
@@ -552,7 +556,14 @@ public class ManaCostBeingPaid {
return 5;
}
private static boolean canBePaidWith(final ManaCostShard shard, final Mana mana, final ManaPool pool) {
public static boolean canColoredXShardBePaidByColor(String color, Map<String, Integer> xManaCostPaidByColor) {
if (xManaCostPaidByColor != null && xManaCostPaidByColor.get(color) != null) {
return false;
}
return true;
}
private static boolean canBePaidWith(final ManaCostShard shard, final Mana mana, final ManaPool pool, Map<String, Integer> xManaCostPaidByColor) {
if (shard.isSnow() && !mana.isSnow()) {
return false;
}
@@ -565,6 +576,11 @@ public class ManaCostBeingPaid {
return true;
}
// Check Colored X and see if the color is already used
if (shard == ManaCostShard.COLORED_X && !canColoredXShardBePaidByColor(MagicColor.toShortString(mana.getColor()), xManaCostPaidByColor)) {
return false;
}
byte color = mana.getColor();
return pool.canPayForShardWithColor(shard, color);
}