clean up the isCounterable code a bit

This commit is contained in:
slapshot5
2011-11-24 20:23:47 +00:00
parent 5979b0c28d
commit d8c218bc8a
2 changed files with 22 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -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