mirror of
https://github.com/correl/mage.git
synced 2025-03-30 17:00:10 -09:00
* Fixed handling of face down card selection (e.g. for Scroll Rack).
This commit is contained in:
parent
ef1a487dd5
commit
662ee7ca10
6 changed files with 142 additions and 102 deletions
Mage.Common/src/mage/view
Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human
Mage.Server/src/main/java/mage/server/game
Mage/src/mage
|
@ -1,33 +1,35 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Modes;
|
||||
|
@ -35,9 +37,14 @@ import mage.abilities.SpellAbility;
|
|||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
|
@ -47,15 +54,11 @@ import mage.game.stack.StackAbility;
|
|||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardView extends SimpleCardView {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected UUID parentId;
|
||||
|
@ -88,7 +91,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
protected boolean flipCard;
|
||||
protected boolean faceDown;
|
||||
|
||||
|
||||
protected String alternateName;
|
||||
protected String originalName;
|
||||
|
||||
|
@ -114,7 +117,7 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean isPlayable;
|
||||
protected boolean isChoosable;
|
||||
protected boolean selected;
|
||||
protected boolean canAttack;
|
||||
protected boolean canAttack;
|
||||
|
||||
public CardView(Card card) {
|
||||
this(card, null, false);
|
||||
|
@ -134,13 +137,42 @@ public class CardView extends SimpleCardView {
|
|||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param controlled is the card view created for the card controller - used for morph / face down cards to know which player may see information for the card
|
||||
* @param controlled is the card view created for the card controller - used
|
||||
* for morph / face down cards to know which player may see information for
|
||||
* the card
|
||||
*/
|
||||
public CardView(Card card, Game game, boolean controlled) {
|
||||
this(card, game, controlled, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param controlled is the card view created for the card controller - used
|
||||
* for morph / face down cards to know which player may see information for
|
||||
* the card
|
||||
* @param showFaceDownCard if true and the card is not on the battelfield,
|
||||
* also a face dwon card is shown in the view dwon cards will be shown
|
||||
*/
|
||||
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
|
||||
// no information available for face down cards as long it's not a controlled face down morph card
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
if (game != null && card.isFaceDown(game)) {
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
boolean showFaceUp = true;
|
||||
if (game != null) {
|
||||
if (card.isFaceDown(game)) {
|
||||
showFaceUp = false;
|
||||
if (!Zone.BATTLEFIELD.equals(game.getState().getZone(card.getId()))) {
|
||||
if (showFaceDownCard) {
|
||||
showFaceUp = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// boolean showFaceUp = game == null || !card.isFaceDown(game) || (!game.getState().getZone(card.getId()).equals(Zone.BATTLEFIELD) && showFaceDownCard);
|
||||
|
||||
if (!showFaceUp) {
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card instanceof Spell) {
|
||||
// special handling for casting of Morph cards
|
||||
|
@ -151,10 +183,10 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
this.power = "2";
|
||||
this.toughness = "2";
|
||||
this.rules.add("You may cast this card as a 2/2 face-down creature, with no text," +
|
||||
" no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost.");
|
||||
this.rules.add("You may cast this card as a 2/2 face-down creature, with no text,"
|
||||
+ " no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost.");
|
||||
return;
|
||||
} else {
|
||||
} else {
|
||||
if (card instanceof Permanent) {
|
||||
this.power = Integer.toString(card.getPower().getValue());
|
||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
|
@ -172,7 +204,7 @@ public class CardView extends SimpleCardView {
|
|||
rotate = true;
|
||||
} else {
|
||||
if (card instanceof Spell) {
|
||||
switch(((Spell) card).getSpellAbility().getSpellAbilityType()) {
|
||||
switch (((Spell) card).getSpellAbility().getSpellAbilityType()) {
|
||||
case SPLIT_FUSED:
|
||||
splitCard = (SplitCard) ((Spell) card).getCard();
|
||||
rotate = true;
|
||||
|
@ -206,7 +238,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
if (card instanceof Permanent) {
|
||||
this.mageObjectType = MageObjectType.PERMANENT;
|
||||
Permanent permanent = (Permanent)card;
|
||||
Permanent permanent = (Permanent) card;
|
||||
this.loyalty = Integer.toString(permanent.getCounters().getCount(CounterType.LOYALTY));
|
||||
this.pairedCard = permanent.getPairedCard();
|
||||
if (!permanent.getControllerId().equals(permanent.getOwnerId())) {
|
||||
|
@ -214,7 +246,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
if (game != null && permanent.getCounters() != null && !permanent.getCounters().isEmpty()) {
|
||||
counters = new ArrayList<>();
|
||||
for (Counter counter: permanent.getCounters().values()) {
|
||||
for (Counter counter : permanent.getCounters().values()) {
|
||||
counters.add(new CounterView(counter));
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +259,7 @@ public class CardView extends SimpleCardView {
|
|||
this.loyalty = "";
|
||||
if (game != null && card.getCounters(game) != null && !card.getCounters(game).isEmpty()) {
|
||||
counters = new ArrayList<>();
|
||||
for (Counter counter: card.getCounters(game).values()) {
|
||||
for (Counter counter : card.getCounters(game).values()) {
|
||||
counters.add(new CounterView(counter));
|
||||
}
|
||||
}
|
||||
|
@ -240,8 +272,8 @@ public class CardView extends SimpleCardView {
|
|||
this.color = card.getColor(game);
|
||||
this.canTransform = card.canTransform();
|
||||
this.flipCard = card.isFlipCard();
|
||||
this.faceDown = game != null ? card.isFaceDown(game) : false;
|
||||
|
||||
this.faceDown = !showFaceUp;
|
||||
|
||||
if (card instanceof PermanentToken) {
|
||||
this.isToken = true;
|
||||
this.mageObjectType = MageObjectType.TOKEN;
|
||||
|
@ -257,7 +289,7 @@ public class CardView extends SimpleCardView {
|
|||
//
|
||||
// set code und card number for token copies to get the image
|
||||
this.rules = ((PermanentToken) card).getRules(game);
|
||||
this.type = ((PermanentToken)card).getToken().getTokenType();
|
||||
this.type = ((PermanentToken) card).getToken().getTokenType();
|
||||
} else {
|
||||
this.rarity = card.getRarity();
|
||||
this.isToken = false;
|
||||
|
@ -269,7 +301,7 @@ public class CardView extends SimpleCardView {
|
|||
this.originalName = card.getName();
|
||||
}
|
||||
this.flipCard = card.isFlipCard();
|
||||
if (card.isFlipCard() && card.getFlipCardName() != null) {
|
||||
if (card.isFlipCard() && card.getFlipCardName() != null) {
|
||||
this.alternateName = card.getFlipCardName();
|
||||
this.originalName = card.getName();
|
||||
}
|
||||
|
@ -277,8 +309,8 @@ public class CardView extends SimpleCardView {
|
|||
if (card instanceof Spell) {
|
||||
this.mageObjectType = MageObjectType.SPELL;
|
||||
Spell spell = (Spell) card;
|
||||
for (SpellAbility spellAbility: spell.getSpellAbilities()) {
|
||||
for(UUID modeId : spellAbility.getModes().getSelectedModes()) {
|
||||
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
|
||||
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
|
||||
spellAbility.getModes().setActiveMode(modeId);
|
||||
if (spellAbility.getTargets().size() > 0) {
|
||||
setTargets(spellAbility.getTargets());
|
||||
|
@ -288,12 +320,12 @@ public class CardView extends SimpleCardView {
|
|||
// show for modal spell, which mode was choosen
|
||||
if (spell.getSpellAbility().isModal()) {
|
||||
Modes modes = spell.getSpellAbility().getModes();
|
||||
for(UUID modeId : modes.getSelectedModes()) {
|
||||
for (UUID modeId : modes.getSelectedModes()) {
|
||||
modes.setActiveMode(modeId);
|
||||
this.rules.add("<span color='green'><i>Chosen mode: " + spell.getSpellAbility().getEffects().getText(modes.get(modeId))+"</i></span>");
|
||||
this.rules.add("<span color='green'><i>Chosen mode: " + spell.getSpellAbility().getEffects().getText(modes.get(modeId)) + "</i></span>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CardView(MageObject object) {
|
||||
|
@ -330,7 +362,7 @@ public class CardView extends SimpleCardView {
|
|||
this.rules = emblem.getAbilities().getRules(emblem.getName());
|
||||
}
|
||||
if (this.rarity == null && object instanceof StackAbility) {
|
||||
StackAbility stackAbility = (StackAbility)object;
|
||||
StackAbility stackAbility = (StackAbility) object;
|
||||
this.rarity = Rarity.NA;
|
||||
this.rules = new ArrayList<>();
|
||||
this.rules.add(stackAbility.getRule());
|
||||
|
@ -343,7 +375,7 @@ public class CardView extends SimpleCardView {
|
|||
protected CardView() {
|
||||
super(null, "", 0, false, "", true);
|
||||
}
|
||||
|
||||
|
||||
public CardView(EmblemView emblem) {
|
||||
this(true);
|
||||
this.gameObject = true;
|
||||
|
@ -397,7 +429,7 @@ public class CardView extends SimpleCardView {
|
|||
} else {
|
||||
this.mageObjectType = MageObjectType.CARD;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (card instanceof PermanentToken) {
|
||||
this.mageObjectType = MageObjectType.TOKEN;
|
||||
}
|
||||
|
@ -410,7 +442,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
CardView(Token token) {
|
||||
super(token.getId(), "", 0, false, "");
|
||||
this.isToken = true;
|
||||
this.isToken = true;
|
||||
this.id = token.getId();
|
||||
this.name = token.getName();
|
||||
this.displayName = token.getName();
|
||||
|
@ -517,11 +549,11 @@ public class CardView extends SimpleCardView {
|
|||
public String getExpansionSetCode() {
|
||||
return expansionSetCode;
|
||||
}
|
||||
|
||||
|
||||
public void setExpansionSetCode(String expansionSetCode) {
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -533,8 +565,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns UUIDs for targets.
|
||||
* Can be null if there is no target selected.
|
||||
* Returns UUIDs for targets. Can be null if there is no target selected.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -595,7 +626,8 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Stores the name of the original name, to provide it for a flipped or transformed or copying card
|
||||
* Stores the name of the original name, to provide it for a flipped or
|
||||
* transformed or copying card
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -706,7 +738,7 @@ public class CardView extends SimpleCardView {
|
|||
public boolean isChoosable() {
|
||||
return isChoosable;
|
||||
}
|
||||
|
||||
|
||||
public void setChoosable(boolean isChoosable) {
|
||||
this.isChoosable = isChoosable;
|
||||
}
|
||||
|
@ -726,5 +758,5 @@ public class CardView extends SimpleCardView {
|
|||
public void setCanAttack(boolean canAttack) {
|
||||
this.canAttack = canAttack;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -72,6 +72,12 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
}
|
||||
}
|
||||
|
||||
public CardsView(Game game, Collection<? extends Card> cards, boolean showFaceDown) {
|
||||
for (Card card : cards) {
|
||||
this.put(card.getId(), new CardView(card, game, false, showFaceDown));
|
||||
}
|
||||
}
|
||||
|
||||
public CardsView(Collection<? extends Ability> abilities, Game game) {
|
||||
for (Ability ability : abilities) {
|
||||
MageObject sourceObject = null;
|
||||
|
|
|
@ -431,6 +431,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (!choosable.isEmpty()) {
|
||||
options.put("choosable", (Serializable) choosable);
|
||||
}
|
||||
|
||||
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, required, options);
|
||||
waitForResponse(game);
|
||||
if (response.getUUID() != null) {
|
||||
|
|
|
@ -825,7 +825,9 @@ public class GameController implements GameCallback {
|
|||
@Override
|
||||
public void execute(UUID playerId) {
|
||||
if (cards != null) {
|
||||
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game)), targets, required, options);
|
||||
Zone targetZone = (Zone) options.get("targetZone");
|
||||
boolean showFaceDown = targetZone != null && targetZone.equals(Zone.PICK);
|
||||
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game), showFaceDown), targets, required, options);
|
||||
} else if (perms != null) {
|
||||
CardsView permsView = new CardsView();
|
||||
for (Permanent perm : perms) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import mage.players.Player;
|
|||
* @author Loki
|
||||
*/
|
||||
public class MayTapOrUntapTargetEffect extends OneShotEffect {
|
||||
|
||||
public MayTapOrUntapTargetEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -47,9 +48,9 @@ public class MayTapOrUntapTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "You may tap or untap it";
|
||||
return "you may tap or untap it";
|
||||
} else {
|
||||
return "You may tap or untap target " + mode.getTargets().get(0).getTargetName();
|
||||
return "you may tap or untap target " + mode.getTargets().get(0).getTargetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.game;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -39,7 +38,6 @@ import java.util.UUID;
|
|||
import mage.cards.Card;
|
||||
import mage.util.Copyable;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -48,14 +46,14 @@ public class Exile implements Serializable, Copyable<Exile> {
|
|||
|
||||
private static final UUID PERMANENT = UUID.randomUUID();
|
||||
|
||||
private Map<UUID, ExileZone> exileZones = new HashMap<UUID, ExileZone>();
|
||||
private Map<UUID, ExileZone> exileZones = new HashMap<>();
|
||||
|
||||
public Exile() {
|
||||
createZone(PERMANENT, "Permanent");
|
||||
}
|
||||
|
||||
public Exile(final Exile exile) {
|
||||
for (Entry<UUID, ExileZone> entry: exile.exileZones.entrySet()) {
|
||||
for (Entry<UUID, ExileZone> entry : exile.exileZones.entrySet()) {
|
||||
exileZones.put(entry.getKey(), entry.getValue().copy());
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +91,7 @@ public class Exile implements Serializable, Copyable<Exile> {
|
|||
}
|
||||
|
||||
public Card getCard(UUID cardId, Game game) {
|
||||
for (ExileZone exile: exileZones.values()) {
|
||||
for (ExileZone exile : exileZones.values()) {
|
||||
if (exile.contains(cardId)) {
|
||||
return game.getCard(cardId);
|
||||
}
|
||||
|
@ -103,14 +101,14 @@ public class Exile implements Serializable, Copyable<Exile> {
|
|||
|
||||
public List<Card> getAllCards(Game game) {
|
||||
List<Card> cards = new ArrayList<Card>();
|
||||
for (ExileZone exile: exileZones.values()) {
|
||||
for (ExileZone exile : exileZones.values()) {
|
||||
cards.addAll(exile.getCards(game));
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
public void removeCard(Card card, Game game) {
|
||||
for (ExileZone exile: exileZones.values()) {
|
||||
for (ExileZone exile : exileZones.values()) {
|
||||
if (exile.contains(card.getId())) {
|
||||
exile.remove(card);
|
||||
}
|
||||
|
@ -123,7 +121,7 @@ public class Exile implements Serializable, Copyable<Exile> {
|
|||
}
|
||||
|
||||
public void clear() {
|
||||
for (ExileZone exile: exileZones.values()) {
|
||||
for (ExileZone exile : exileZones.values()) {
|
||||
exile.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue