Make the handling of counters more consistent.

This dramatically reduces the code duplication around counters handling.
This commit is contained in:
Samuel Sandeen 2016-09-03 16:52:41 -04:00
parent 148f633672
commit bec11804f5
11 changed files with 116 additions and 134 deletions

View file

@ -346,21 +346,4 @@ public abstract class MeldCard extends CardImpl {
return returnState;
}
}
@Override
public boolean addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {
if (this.isMelded()) {
return super.addCounters(name, amount, game, appliedEffects);
} else {
// can this really happen?
boolean returnState = true;
if (topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game)) {
returnState |= topHalfCard.addCounters(name, amount, game, appliedEffects);
}
if (bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game)) {
returnState |= bottomHalfCard.addCounters(name, amount, game, appliedEffects);
}
return returnState;
}
}
}