mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
delete duplicate method
This commit is contained in:
@@ -60,44 +60,6 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
|||||||
useManaFromPool(colorCode);
|
useManaFromPool(colorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* canMake. color is like "G", returns "Green".
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param am
|
|
||||||
* a {@link forge.card.spellability.AbilityMana} object.
|
|
||||||
* @param mana
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
private static boolean canMake(final SpellAbility am, final byte colorMask) {
|
|
||||||
if (colorMask == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
AbilityManaPart m = am.getManaPart();
|
|
||||||
|
|
||||||
if (m.isAnyMana()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (am.getApi() == ApiType.ManaReflected) {
|
|
||||||
final Iterable<String> reflectableColors = CardUtil.getReflectableManaColors(am);
|
|
||||||
for (final String color : reflectableColors) {
|
|
||||||
if (0 != (colorMask & MagicColor.fromName(color))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String colorsProduced = m.isComboMana() ? m.getComboColors() : m.getOrigProduced();
|
|
||||||
for (final String color : colorsProduced.split(" ")) {
|
|
||||||
if (0 != (colorMask & MagicColor.fromName(color))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* activateManaAbility.
|
* activateManaAbility.
|
||||||
@@ -164,7 +126,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m == null || !ma.canPlay()) continue;
|
if (m == null || !ma.canPlay()) continue;
|
||||||
if (!canUseColorless && !InputPayManaBase.canMake(ma, colorCanUse)) continue;
|
if (!canUseColorless && !abilityProducesManaColor(ma, colorCanUse)) continue;
|
||||||
if (ma.isAbility() && ma.getRestrictions().isInstantSpeed()) continue;
|
if (ma.isAbility() && ma.getRestrictions().isInstantSpeed()) continue;
|
||||||
if (!m.meetsManaRestrictions(saPaidFor)) continue;
|
if (!m.meetsManaRestrictions(saPaidFor)) continue;
|
||||||
|
|
||||||
@@ -204,7 +166,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
|||||||
// express Mana Choice
|
// express Mana Choice
|
||||||
final ArrayList<SpellAbility> colorMatches = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> colorMatches = new ArrayList<SpellAbility>();
|
||||||
for (SpellAbility sa : abilities) {
|
for (SpellAbility sa : abilities) {
|
||||||
if (abilityProducesManaOfColor(sa, colorNeeded))
|
if (abilityProducesManaColor(sa, colorNeeded))
|
||||||
colorMatches.add(sa);
|
colorMatches.add(sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,22 +203,37 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static boolean abilityProducesManaOfColor(SpellAbility am, byte neededColor) {
|
/**
|
||||||
|
* <p>
|
||||||
|
* canMake. color is like "G", returns "Green".
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param am
|
||||||
|
* a {@link forge.card.spellability.AbilityMana} object.
|
||||||
|
* @param mana
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @return a boolean.
|
||||||
|
*/
|
||||||
|
private static boolean abilityProducesManaColor(final SpellAbility am, final byte neededColor) {
|
||||||
|
if (neededColor == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
AbilityManaPart m = am.getManaPart();
|
AbilityManaPart m = am.getManaPart();
|
||||||
|
|
||||||
|
if (m.isAnyMana()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (am.getApi() == ApiType.ManaReflected) {
|
if (am.getApi() == ApiType.ManaReflected) {
|
||||||
final Iterable<String> reflectableColors = CardUtil.getReflectableManaColors(am);
|
final Iterable<String> reflectableColors = CardUtil.getReflectableManaColors(am);
|
||||||
for (final String color : reflectableColors) {
|
for (final String color : reflectableColors) {
|
||||||
if ((neededColor & MagicColor.fromName(color)) != 0) {
|
if (0 != (neededColor & MagicColor.fromName(color))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (m.isAnyMana()) {
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
String colorsProduced = m.isComboMana() ? m.getComboColors() : m.getOrigProduced();
|
String colorsProduced = m.isComboMana() ? m.getComboColors() : m.getOrigProduced();
|
||||||
for (final String color : colorsProduced.split(" ")) {
|
for (final String color : colorsProduced.split(" ")) {
|
||||||
if ((neededColor & MagicColor.fromName(color)) != 0) {
|
if (0 != (neededColor & MagicColor.fromName(color))) {
|
||||||
// checking if color
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user