changed static zone function to enum method

This commit is contained in:
ingmargoudt 2017-03-07 22:02:15 +01:00
parent 1bc8e2248b
commit c5002983e3
2 changed files with 11 additions and 4 deletions

View file

@ -30,6 +30,7 @@ package mage.cards.g;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -112,7 +113,7 @@ class GhostlyFlickerEffect extends OneShotEffect {
Set<Card> toBattlefield = new HashSet<>();
for (Card card : toExile) {
Zone currentZone = game.getState().getZone(card.getId());
if (!(Zone.BATTLEFIELD == currentZone) && Zone.isPublicZone(currentZone)) {
if (Zone.BATTLEFIELD != currentZone && currentZone.isPublicZone()) {
toBattlefield.add(game.getCard(card.getId()));
}
}

View file

@ -33,7 +33,13 @@ package mage.constants;
*/
public enum Zone {
HAND, GRAVEYARD, LIBRARY, BATTLEFIELD, STACK, EXILED, ALL, OUTSIDE, COMMAND;
HAND(false), GRAVEYARD(true), LIBRARY(false), BATTLEFIELD(true), STACK(true), EXILED(true), ALL(false), OUTSIDE(false), COMMAND(false);
private boolean isPublic;
Zone(boolean isPublic){
this.isPublic = isPublic;
}
public boolean match(Zone zone) {
return (this == zone || this == ALL || zone == ALL);
@ -47,7 +53,7 @@ public enum Zone {
return super.toString();
}
public static boolean isPublicZone(Zone zone) {
return GRAVEYARD.equals(zone) || BATTLEFIELD.equals(zone) || STACK.equals(zone) || EXILED.equals(zone) || COMMAND.equals(zone);
public boolean isPublicZone(){
return isPublic;
}
}