- Merged canBeShownTo and canBeSeenBy.

This commit is contained in:
Sloth
2013-05-07 15:58:03 +00:00
parent cd0e94560e
commit d528323dd0
3 changed files with 24 additions and 22 deletions

View File

@@ -8229,7 +8229,28 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public boolean canBeShownTo(final Player viewer) {
return !isFaceDown() || getController() == viewer;
if (!isFaceDown()) {
return true;
}
if (getController() == viewer && isInZone(ZoneType.Battlefield)) {
return true;
}
final GameState game = this.getGame();
if (getController() == viewer && hasKeyword("You may look at this card.")) {
return true;
}
if (getController().isOpponentOf(viewer) && hasKeyword("Your opponent may look at this card.")) {
return true;
}
for (Card host : game.getCardsIn(ZoneType.Battlefield)) {
final ArrayList<StaticAbility> staticAbilities = host.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("MayLookAt", this, viewer)) {
return true;
}
}
}
return false;
}
/**
@@ -8298,25 +8319,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return true;
}
public boolean canBeSeenBy(final Player p) {
final GameState game = this.getGame();
if (getController().equals(p) && hasKeyword("You may look at this card.")) {
return true;
}
if (getController().isOpponentOf(p) && hasKeyword("Your opponent may look at this card.")) {
return true;
}
for (Card host : game.getCardsIn(ZoneType.Battlefield)) {
final ArrayList<StaticAbility> staticAbilities = host.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("MayLookAt", this, p)) {
return true;
}
}
}
return false;
}
CardRules cardRules;
public CardRules getRules() {
return cardRules;

View File

@@ -123,7 +123,7 @@ public class GuiChoose {
if (list.getSelectedValue() instanceof Card) {
Card card = (Card) list.getSelectedValue();
if (card.isFaceDown()) {
if (card.canBeSeenBy(Singletons.getControl().getLobby().getGuiPlayer().getPlayer(card.getGame()))) {
if (card.canBeShownTo(Singletons.getControl().getLobby().getGuiPlayer().getPlayer(card.getGame()))) {
card = CardFactory.copyCard(card);
card.setState(CardCharacteristicName.Original);
}

View File

@@ -54,7 +54,7 @@ class ZoneAction extends ForgeAction {
for (Card crd : choices) {
Card toAdd = crd;
if (crd.isFaceDown()) {
if (crd.canBeSeenBy(Singletons.getControl().getPlayer())) {
if (crd.canBeShownTo(Singletons.getControl().getPlayer())) {
toAdd = CardFactory.copyCard(crd);
toAdd.setState(CardCharacteristicName.Original);
} else {