From 17894382875d35c6fc570118f029a3fffa687e40 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Mon, 7 Feb 2011 20:54:16 +0300 Subject: [PATCH] Missing PlainswalkAbility. Minor enchancement in GameImpl. Rating for rarity. --- Mage/src/mage/Constants.java | 20 ++++--- .../abilities/keyword/PlainswalkAbility.java | 59 +++++++++++++++++++ Mage/src/mage/game/GameImpl.java | 52 +++++----------- 3 files changed, 86 insertions(+), 45 deletions(-) create mode 100644 Mage/src/mage/abilities/keyword/PlainswalkAbility.java diff --git a/Mage/src/mage/Constants.java b/Mage/src/mage/Constants.java index 9db2b245ebd..d64dba26fce 100644 --- a/Mage/src/mage/Constants.java +++ b/Mage/src/mage/Constants.java @@ -90,21 +90,23 @@ public final class Constants { public enum Rarity { - NA ("na", "na", "N"), - LAND ("Land", "common", "C"), - COMMON ("Common", "common", "C"), - UNCOMMON ("Uncommon", "uncommon", "U"), - RARE ("Rare", "rare", "R"), - MYTHIC ("Mythic", "mythic", "M"); + NA ("na", "na", "N", 0), + LAND ("Land", "common", "C", 1), + COMMON ("Common", "common", "C", 1), + UNCOMMON ("Uncommon", "uncommon", "U", 2), + RARE ("Rare", "rare", "R", 3), + MYTHIC ("Mythic", "mythic", "M", 3); private String text; private String symbolCode; private String code; + private int rating; - Rarity(String text, String symbolCode, String code) { + Rarity(String text, String symbolCode, String code, int rating) { this.text = text; this.symbolCode = symbolCode; this.code = code; + this.rating = rating; } @Override @@ -119,6 +121,10 @@ public final class Constants { public String getCode() { return code; } + + public int getRating() { + return rating; + } } public enum AbilityType { diff --git a/Mage/src/mage/abilities/keyword/PlainswalkAbility.java b/Mage/src/mage/abilities/keyword/PlainswalkAbility.java new file mode 100644 index 00000000000..d616a519cdb --- /dev/null +++ b/Mage/src/mage/abilities/keyword/PlainswalkAbility.java @@ -0,0 +1,59 @@ +/* + * 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.abilities.keyword; + +import mage.filter.Filter.ComparisonScope; +import mage.filter.common.FilterLandPermanent; + +/** + * + * @author nantuko + */ +public class PlainswalkAbility extends LandwalkAbility { + + private static FilterLandPermanent filter = new FilterLandPermanent("Plains"); + + static { + filter.getSubtype().add("Plains"); + filter.setScopeSubtype(ComparisonScope.Any); + } + + public PlainswalkAbility() { + super(filter); + } + + public PlainswalkAbility(final PlainswalkAbility ability) { + super(ability); + } + + @Override + public PlainswalkAbility copy() { + return new PlainswalkAbility(this); + } +} \ No newline at end of file diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index 9ad29c5040f..c841c089cee 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -28,31 +28,9 @@ package mage.game; -import mage.counters.CounterType; -import java.io.IOException; -import mage.game.stack.SpellStack; -import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.Stack; -import java.util.UUID; -import java.util.logging.Logger; -import mage.Constants.CardType; -import mage.Constants.MultiplayerAttackOption; -import mage.Constants.Outcome; -import mage.Constants.PhaseStep; -import mage.Constants.RangeOfInfluence; -import mage.Constants.Zone; +import mage.Constants.*; import mage.MageObject; -import mage.abilities.Ability; -import mage.abilities.ActivatedAbility; -import mage.abilities.DelayedTriggeredAbility; -import mage.abilities.TriggeredAbilities; -import mage.abilities.TriggeredAbility; +import mage.abilities.*; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffects; import mage.abilities.keyword.LeylineAbility; @@ -60,34 +38,32 @@ import mage.cards.Card; import mage.cards.Cards; import mage.cards.decks.Deck; import mage.choices.Choice; +import mage.counters.CounterType; import mage.filter.Filter; import mage.filter.Filter.ComparisonScope; -import mage.filter.common.FilterAura; -import mage.filter.common.FilterEquipment; -import mage.filter.common.FilterFortification; -import mage.filter.common.FilterLegendaryPermanent; -import mage.filter.common.FilterPlaneswalkerPermanent; +import mage.filter.common.*; import mage.game.combat.Combat; -import mage.game.events.GameEvent; -import mage.players.Player; -import mage.game.events.Listener; -import mage.game.events.TableEvent; +import mage.game.events.*; import mage.game.events.TableEvent.EventType; -import mage.game.events.TableEventSource; -import mage.game.events.PlayerQueryEvent; -import mage.game.events.PlayerQueryEventSource; import mage.game.permanent.Battlefield; import mage.game.permanent.Permanent; +import mage.game.stack.SpellStack; import mage.game.stack.StackObject; import mage.game.turn.Phase; import mage.game.turn.Step; import mage.game.turn.Turn; +import mage.players.Player; import mage.players.PlayerList; import mage.players.Players; import mage.target.TargetPlayer; import mage.util.Logging; import mage.watchers.Watcher; +import java.io.IOException; +import java.io.Serializable; +import java.util.*; +import java.util.logging.Logger; + public abstract class GameImpl> implements Game, Serializable { private final static transient Logger logger = Logging.getLogger(GameImpl.class.getName()); @@ -135,8 +111,8 @@ public abstract class GameImpl> implements Game, Serializa this.range = game.range; this.attackOption = game.attackOption; this.state = game.state.copy(); - for (UUID cardId: game.gameCards.keySet()) { - this.gameCards.put(cardId, game.gameCards.get(cardId).copy()); + for (Map.Entry entry: game.gameCards.entrySet()) { + this.gameCards.put(entry.getKey(), entry.getValue().copy()); } }