mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Merged canBeShownTo and canBeSeenBy.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user