fixed two small refactor errors

This commit is contained in:
Evan Kranzler 2020-09-12 20:56:46 -04:00
parent 8876d39491
commit 29efa7b067
3 changed files with 25 additions and 25 deletions

View file

@ -20,7 +20,7 @@ public final class Hindervines extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with no +1/+1 counters on them"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with no +1/+1 counters on them");
static { static {
filter.add(Predicates.not(CounterType.P1P1).getPredicate()); filter.add(Predicates.not(CounterType.P1P1.getPredicate()));
} }
public Hindervines(UUID ownerId, CardSetInfo setInfo) { public Hindervines(UUID ownerId, CardSetInfo setInfo) {

View file

@ -39,7 +39,7 @@ public final class ObsidianFireheart extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("land without a blaze counter on it"); private static final FilterLandPermanent filter = new FilterLandPermanent("land without a blaze counter on it");
static { static {
filter.add(Predicates.not(CounterType.BLAZE).getPredicate()); filter.add(Predicates.not(CounterType.BLAZE.getPredicate()));
} }
public ObsidianFireheart(UUID ownerId, CardSetInfo setInfo) { public ObsidianFireheart(UUID ownerId, CardSetInfo setInfo) {

View file

@ -163,29 +163,6 @@ public enum CounterType {
WIND("wind"), WIND("wind"),
WISH("wish"); WISH("wish");
private static class CounterPredicate implements Predicate<Card> {
private final CounterType counter;
private CounterPredicate(CounterType counter) {
this.counter = counter;
}
@Override
public boolean apply(Card input, Game game) {
if (counter == null) {
return !input.getCounters(game).keySet().isEmpty();
} else {
return input.getCounters(game).containsKey(counter);
}
}
@Override
public String toString() {
return "CounterType(" + counter.getName() + ')';
}
}
private final String name; private final String name;
private final CounterPredicate predicate; private final CounterPredicate predicate;
@ -281,4 +258,27 @@ public enum CounterType {
public CounterPredicate getPredicate() { public CounterPredicate getPredicate() {
return predicate; return predicate;
} }
private static class CounterPredicate implements Predicate<Card> {
private final CounterType counter;
private CounterPredicate(CounterType counter) {
this.counter = counter;
}
@Override
public boolean apply(Card input, Game game) {
if (counter == null) {
return !input.getCounters(game).keySet().isEmpty();
} else {
return input.getCounters(game).containsKey(counter);
}
}
@Override
public String toString() {
return "CounterType(" + counter.getName() + ')';
}
}
} }