mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
clean up the isCounterable code a bit
This commit is contained in:
@@ -290,7 +290,7 @@ public class AbilityFactoryCounterMagic {
|
||||
* a boolean.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean counterDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
||||
private boolean counterDoTriggerAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
||||
boolean toReturn = true;
|
||||
if (AllZone.getStack().size() < 1) {
|
||||
return false;
|
||||
@@ -388,7 +388,7 @@ public class AbilityFactoryCounterMagic {
|
||||
for (final SpellAbility tgtSA : sas) {
|
||||
final Card tgtSACard = tgtSA.getSourceCard();
|
||||
|
||||
if (tgtSA.isSpell() && tgtSACard.keywordsContain("CARDNAME can't be countered.")) {
|
||||
if (tgtSA.isSpell() && !CardFactoryUtil.isCounterable(tgtSACard)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2404,11 +2404,28 @@ public class CardFactoryUtil {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean isCounterable(final Card c) {
|
||||
if (!c.hasKeyword("CARDNAME can't be countered.")) {
|
||||
return true;
|
||||
} else {
|
||||
if (c.hasKeyword("CARDNAME can't be countered.")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* isCounterableBy.
|
||||
* </p>
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean isCounterableBy(final Card c, final SpellAbility sa) {
|
||||
if (!isCounterable(c)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns the number of equipments named "e" card c is equipped by
|
||||
|
||||
Reference in New Issue
Block a user