mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Huge cleanup: use collection interfaces (List, Set, Map) rather than
implementations (ArrayList etc.) in references to objects
This commit is contained in:
@@ -1414,13 +1414,13 @@ public class GameAction {
|
||||
// Power Play - Each player with a Power Play in the CommandZone becomes the Starting Player
|
||||
Set<Player> powerPlayers = new HashSet<>();
|
||||
for (Card c : game.getCardsIn(ZoneType.Command)) {
|
||||
if (c.getName().equals("Power Play")) {
|
||||
powerPlayers.add(c.getOwner());
|
||||
}
|
||||
if (c.getName().equals("Power Play")) {
|
||||
powerPlayers.add(c.getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
if (!powerPlayers.isEmpty()) {
|
||||
ArrayList<Player> players = Lists.newArrayList(powerPlayers);
|
||||
List<Player> players = Lists.newArrayList(powerPlayers);
|
||||
Collections.shuffle(players);
|
||||
return players.get(0);
|
||||
}
|
||||
|
||||
@@ -450,9 +450,9 @@ public final class GameActionUtil {
|
||||
* @return an ArrayList<SpellAbility>.
|
||||
* get abilities with all Splice options
|
||||
*/
|
||||
private static final ArrayList<SpellAbility> getSpliceAbilities(SpellAbility sa) {
|
||||
ArrayList<SpellAbility> newSAs = new ArrayList<SpellAbility>();
|
||||
ArrayList<SpellAbility> allSaCombinations = new ArrayList<SpellAbility>();
|
||||
private static final List<SpellAbility> getSpliceAbilities(SpellAbility sa) {
|
||||
List<SpellAbility> newSAs = new ArrayList<SpellAbility>();
|
||||
List<SpellAbility> allSaCombinations = new ArrayList<SpellAbility>();
|
||||
allSaCombinations.add(sa);
|
||||
Card source = sa.getHostCard();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
private String name = "";
|
||||
private int preventNextDamage = 0;
|
||||
private CardCollection enchantedBy;
|
||||
private TreeMap<Card, Map<String, String>> preventionShieldsWithEffects = new TreeMap<Card, Map<String, String>>();
|
||||
private Map<Card, Map<String, String>> preventionShieldsWithEffects = new TreeMap<Card, Map<String, String>>();
|
||||
|
||||
protected GameEntity(int id0) {
|
||||
id = id0;
|
||||
@@ -97,7 +97,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
}
|
||||
|
||||
// PreventNextDamageWithEffect
|
||||
public TreeMap<Card, Map<String, String>> getPreventNextDamageWithEffect() {
|
||||
public Map<Card, Map<String, String>> getPreventNextDamageWithEffect() {
|
||||
return preventionShieldsWithEffects;
|
||||
}
|
||||
public int getPreventNextDamageTotalShields() {
|
||||
@@ -112,7 +112,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
* @param shieldSource - The source card which generated the shield
|
||||
* @param effectMap - A map of the effect occurring with the damage prevention
|
||||
*/
|
||||
public void addPreventNextDamageWithEffect(final Card shieldSource, TreeMap<String, String> effectMap) {
|
||||
public void addPreventNextDamageWithEffect(final Card shieldSource, Map<String, String> effectMap) {
|
||||
if (preventionShieldsWithEffects.containsKey(shieldSource)) {
|
||||
int currentShields = Integer.valueOf(preventionShieldsWithEffects.get(shieldSource).get("ShieldAmount"));
|
||||
currentShields += Integer.valueOf(effectMap.get("ShieldAmount"));
|
||||
|
||||
@@ -1,22 +1,36 @@
|
||||
package forge.game;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.event.*;
|
||||
import forge.game.event.GameEvent;
|
||||
import forge.game.event.GameEventAttackersDeclared;
|
||||
import forge.game.event.GameEventBlockersDeclared;
|
||||
import forge.game.event.GameEventCardDamaged;
|
||||
import forge.game.event.GameEventCardDamaged.DamageType;
|
||||
import forge.game.event.GameEventGameOutcome;
|
||||
import forge.game.event.GameEventLandPlayed;
|
||||
import forge.game.event.GameEventMulligan;
|
||||
import forge.game.event.GameEventPlayerControl;
|
||||
import forge.game.event.GameEventPlayerDamaged;
|
||||
import forge.game.event.GameEventPlayerPoisoned;
|
||||
import forge.game.event.GameEventScry;
|
||||
import forge.game.event.GameEventSpellAbilityCast;
|
||||
import forge.game.event.GameEventSpellResolved;
|
||||
import forge.game.event.GameEventTurnBegan;
|
||||
import forge.game.event.GameEventTurnPhase;
|
||||
import forge.game.event.IGameEventVisitor;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.TargetChoices;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.maps.MapOfLists;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
private final GameLog log;
|
||||
|
||||
@@ -68,7 +82,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
if (event.sa.getTargetRestrictions() != null) {
|
||||
sb.append(" targeting ");
|
||||
|
||||
ArrayList<TargetChoices> targets = event.sa.getAllTargetChoices();
|
||||
List<TargetChoices> targets = event.sa.getAllTargetChoices();
|
||||
// Include the TargetChoices from the stack instance, since the real target choices
|
||||
// are on that object at this point (see SpellAbilityStackInstance constructor).
|
||||
targets.add(event.si.getTargetChoices());
|
||||
|
||||
@@ -14,37 +14,37 @@ public abstract class GameObjectMap {
|
||||
|
||||
public abstract GameObject map(GameObject o);
|
||||
|
||||
public Player map(Player p) {
|
||||
public Player map(final Player p) {
|
||||
return (Player) map((GameObject) p);
|
||||
}
|
||||
|
||||
public Card map(Card c) {
|
||||
|
||||
public Card map(final Card c) {
|
||||
return (Card) map((GameObject) c);
|
||||
}
|
||||
|
||||
public GameEntity map(GameEntity e) {
|
||||
public GameEntity map(final GameEntity e) {
|
||||
return (GameEntity) map((GameObject) e);
|
||||
}
|
||||
|
||||
public CardCollectionView mapCollection(CardCollectionView cards) {
|
||||
CardCollection collection = new CardCollection();
|
||||
for (Card c : cards) {
|
||||
public CardCollectionView mapCollection(final CardCollectionView cards) {
|
||||
final CardCollection collection = new CardCollection();
|
||||
for (final Card c : cards) {
|
||||
collection.add(map(c));
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends GameObject> List<T> mapList(List<T> objects) {
|
||||
ArrayList<T> result = new ArrayList<T>();
|
||||
for (T o : objects) {
|
||||
public <T extends GameObject> List<T> mapList(final List<T> objects) {
|
||||
final List<T> result = new ArrayList<T>();
|
||||
for (final T o : objects) {
|
||||
result.add((T) map(o));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public <K extends GameObject, V> void fillKeyedMap(Map<K, V> dest, Map<K, V> src) {
|
||||
for (Map.Entry<K, V> entry : src.entrySet()) {
|
||||
public <K extends GameObject, V> void fillKeyedMap(final Map<K, V> dest, final Map<K, V> src) {
|
||||
for (final Map.Entry<K, V> entry : src.entrySet()) {
|
||||
dest.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class StaticEffect {
|
||||
* @param c
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @param s
|
||||
* a {@link java.util.ArrayList} object.
|
||||
* a {@link java.util.List} object.
|
||||
*/
|
||||
public final void addOriginalAbilities(final Card c, final List<SpellAbility> s) {
|
||||
final List<SpellAbility> list = new ArrayList<SpellAbility>(s);
|
||||
@@ -200,10 +200,10 @@ public class StaticEffect {
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public final ArrayList<SpellAbility> getOriginalAbilities(final Card c) {
|
||||
final ArrayList<SpellAbility> returnList = new ArrayList<SpellAbility>();
|
||||
public final List<SpellAbility> getOriginalAbilities(final Card c) {
|
||||
final List<SpellAbility> returnList = new ArrayList<SpellAbility>();
|
||||
if (this.originalAbilities.containsKey(c)) {
|
||||
returnList.addAll(this.originalAbilities.get(c));
|
||||
}
|
||||
@@ -566,7 +566,7 @@ public class StaticEffect {
|
||||
*/
|
||||
public final void addType(final Card c, final String s) {
|
||||
if (!this.types.containsKey(c)) {
|
||||
final ArrayList<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<String>();
|
||||
list.add(s);
|
||||
this.types.put(c, list);
|
||||
} else {
|
||||
@@ -581,10 +581,10 @@ public class StaticEffect {
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public final ArrayList<String> getTypes(final Card c) {
|
||||
final ArrayList<String> returnList = new ArrayList<String>();
|
||||
public final List<String> getTypes(final Card c) {
|
||||
final List<String> returnList = new ArrayList<String>();
|
||||
if (this.types.containsKey(c)) {
|
||||
returnList.addAll(this.types.get(c));
|
||||
}
|
||||
@@ -749,7 +749,7 @@ public class StaticEffect {
|
||||
* @param list
|
||||
* the new affected players
|
||||
*/
|
||||
public final void setAffectedPlayers(final ArrayList<Player> list) {
|
||||
public final void setAffectedPlayers(final List<Player> list) {
|
||||
this.affectedPlayers = list;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,17 +69,17 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
types.add(host.getChosenType());
|
||||
}
|
||||
|
||||
final ArrayList<String> keywords = new ArrayList<String>();
|
||||
final List<String> keywords = new ArrayList<String>();
|
||||
if (sa.hasParam("Keywords")) {
|
||||
keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & ")));
|
||||
}
|
||||
|
||||
final ArrayList<String> removeKeywords = new ArrayList<String>();
|
||||
final List<String> removeKeywords = new ArrayList<String>();
|
||||
if (sa.hasParam("RemoveKeywords")) {
|
||||
removeKeywords.addAll(Arrays.asList(sa.getParam("RemoveKeywords").split(" & ")));
|
||||
}
|
||||
|
||||
final ArrayList<String> hiddenKeywords = new ArrayList<String>();
|
||||
final List<String> hiddenKeywords = new ArrayList<String>();
|
||||
if (sa.hasParam("HiddenKeywords")) {
|
||||
hiddenKeywords.addAll(Arrays.asList(sa.getParam("HiddenKeywords").split(" & ")));
|
||||
}
|
||||
@@ -105,23 +105,23 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
final String finalDesc = tmpDesc;
|
||||
|
||||
// abilities to add to the animated being
|
||||
final ArrayList<String> abilities = new ArrayList<String>();
|
||||
final List<String> abilities = new ArrayList<String>();
|
||||
if (sa.hasParam("Abilities")) {
|
||||
abilities.addAll(Arrays.asList(sa.getParam("Abilities").split(",")));
|
||||
}
|
||||
// replacement effects to add to the animated being
|
||||
final ArrayList<String> replacements = new ArrayList<String>();
|
||||
final List<String> replacements = new ArrayList<String>();
|
||||
if (sa.hasParam("Replacements")) {
|
||||
replacements.addAll(Arrays.asList(sa.getParam("Replacements").split(",")));
|
||||
}
|
||||
// triggers to add to the animated being
|
||||
final ArrayList<String> triggers = new ArrayList<String>();
|
||||
final List<String> triggers = new ArrayList<String>();
|
||||
if (sa.hasParam("Triggers")) {
|
||||
triggers.addAll(Arrays.asList(sa.getParam("Triggers").split(",")));
|
||||
}
|
||||
|
||||
// sVars to add to the animated being
|
||||
final ArrayList<String> sVars = new ArrayList<String>();
|
||||
final List<String> sVars = new ArrayList<String>();
|
||||
if (sa.hasParam("sVars")) {
|
||||
sVars.addAll(Arrays.asList(sa.getParam("sVars").split(",")));
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
keywords, removeKeywords, hiddenKeywords, timestamp);
|
||||
|
||||
// give abilities
|
||||
final ArrayList<SpellAbility> addedAbilities = new ArrayList<SpellAbility>();
|
||||
final List<SpellAbility> addedAbilities = new ArrayList<SpellAbility>();
|
||||
if (abilities.size() > 0) {
|
||||
for (final String s : abilities) {
|
||||
final String actualAbility = host.getSVar(s);
|
||||
@@ -160,7 +160,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
}
|
||||
|
||||
// remove abilities
|
||||
final ArrayList<SpellAbility> removedAbilities = new ArrayList<SpellAbility>();
|
||||
final List<SpellAbility> removedAbilities = new ArrayList<SpellAbility>();
|
||||
if (sa.hasParam("OverwriteAbilities") || sa.hasParam("RemoveAllAbilities")) {
|
||||
for (final SpellAbility ab : c.getSpellAbilities()) {
|
||||
if (ab.isAbility()) {
|
||||
@@ -170,7 +170,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
}
|
||||
}
|
||||
// give replacement effects
|
||||
final ArrayList<ReplacementEffect> addedReplacements = new ArrayList<ReplacementEffect>();
|
||||
final List<ReplacementEffect> addedReplacements = new ArrayList<ReplacementEffect>();
|
||||
if (replacements.size() > 0) {
|
||||
for (final String s : replacements) {
|
||||
final String actualReplacement = host.getSVar(s);
|
||||
@@ -179,7 +179,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
}
|
||||
}
|
||||
// Grant triggers
|
||||
final ArrayList<Trigger> addedTriggers = new ArrayList<Trigger>();
|
||||
final List<Trigger> addedTriggers = new ArrayList<Trigger>();
|
||||
if (triggers.size() > 0) {
|
||||
for (final String s : triggers) {
|
||||
final String actualTrigger = host.getSVar(s);
|
||||
@@ -189,7 +189,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
}
|
||||
|
||||
// suppress triggers from the animated card
|
||||
final ArrayList<Trigger> removedTriggers = new ArrayList<Trigger>();
|
||||
final List<Trigger> removedTriggers = new ArrayList<Trigger>();
|
||||
if (sa.hasParam("OverwriteTriggers") || sa.hasParam("RemoveAllAbilities")) {
|
||||
final FCollectionView<Trigger> triggersToRemove = c.getTriggers();
|
||||
for (final Trigger trigger : triggersToRemove) {
|
||||
@@ -199,7 +199,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
}
|
||||
|
||||
// suppress static abilities from the animated card
|
||||
final ArrayList<StaticAbility> removedStatics = new ArrayList<StaticAbility>();
|
||||
final List<StaticAbility> removedStatics = new ArrayList<StaticAbility>();
|
||||
if (sa.hasParam("OverwriteStatics") || sa.hasParam("RemoveAllAbilities")) {
|
||||
final FCollectionView<StaticAbility> staticsToRemove = c.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticsToRemove) {
|
||||
|
||||
@@ -202,7 +202,7 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// triggers to add to clone
|
||||
final ArrayList<String> triggers = new ArrayList<String>();
|
||||
final List<String> triggers = new ArrayList<String>();
|
||||
if (sa.hasParam("AddTriggers")) {
|
||||
triggers.addAll(Arrays.asList(sa.getParam("AddTriggers").split(",")));
|
||||
for (final String s : triggers) {
|
||||
@@ -237,7 +237,7 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// keywords to add to clone
|
||||
final ArrayList<String> keywords = new ArrayList<String>();
|
||||
final List<String> keywords = new ArrayList<String>();
|
||||
if (sa.hasParam("AddKeywords")) {
|
||||
keywords.addAll(Arrays.asList(sa.getParam("AddKeywords").split(" & ")));
|
||||
// allow SVar substitution for keywords
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
public void resolve(final SpellAbility sa) {
|
||||
final Card hostCard = sa.getHostCard();
|
||||
final Game game = hostCard.getGame();
|
||||
final ArrayList<String> keywords = new ArrayList<String>();
|
||||
final List<String> keywords = new ArrayList<String>();
|
||||
final List<String> types = new ArrayList<String>();
|
||||
final List<String> svars = new ArrayList<String>();
|
||||
final List<String> triggers = new ArrayList<String>();
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
|
||||
while (cntToMove > 0 && source.hasCounters()) {
|
||||
final Map<CounterType, Integer> tgtCounters = source.getCounters();
|
||||
|
||||
final ArrayList<CounterType> typeChoices = new ArrayList<CounterType>();
|
||||
final List<CounterType> typeChoices = new ArrayList<CounterType>();
|
||||
// get types of counters
|
||||
for (CounterType ct : tgtCounters.keySet()) {
|
||||
if (ct != CounterType.M1M1 || canPlaceM1M1Counters) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import forge.game.GameObject;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
@@ -8,10 +13,6 @@ import forge.game.card.CardUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class DamagePreventEffect extends SpellAbilityEffect {
|
||||
|
||||
@Override
|
||||
@@ -68,7 +69,7 @@ public class DamagePreventEffect extends SpellAbilityEffect {
|
||||
int numDam = AbilityUtils.calculateAmount(host, sa.getParam("Amount"), sa);
|
||||
|
||||
final List<GameObject> tgts = getTargets(sa);
|
||||
final ArrayList<Card> untargetedCards = new ArrayList<Card>();
|
||||
final List<Card> untargetedCards = new ArrayList<Card>();
|
||||
|
||||
if (sa.hasParam("Radiance") && (sa.usesTargeting())) {
|
||||
Card origin = null;
|
||||
@@ -95,7 +96,7 @@ public class DamagePreventEffect extends SpellAbilityEffect {
|
||||
final Card c = (Card) o;
|
||||
if (c.isInPlay() && (!targeted || c.canBeTargetedBy(sa))) {
|
||||
if (preventionWithEffect) {
|
||||
TreeMap<String, String> effectMap = new TreeMap<String, String>();
|
||||
Map<String, String> effectMap = new TreeMap<String, String>();
|
||||
effectMap.put("EffectString", sa.getSVar(sa.getParam("PreventionSubAbility")));
|
||||
effectMap.put("ShieldAmount", String.valueOf(numDam));
|
||||
if (sa.hasParam("ShieldEffectTarget")) {
|
||||
@@ -122,7 +123,7 @@ public class DamagePreventEffect extends SpellAbilityEffect {
|
||||
final Player p = (Player) o;
|
||||
if (!targeted || p.canBeTargetedBy(sa)) {
|
||||
if (preventionWithEffect) {
|
||||
TreeMap<String, String> effectMap = new TreeMap<String, String>();
|
||||
Map<String, String> effectMap = new TreeMap<String, String>();
|
||||
effectMap.put("EffectString", sa.getSVar(sa.getParam("PreventionSubAbility")));
|
||||
effectMap.put("ShieldAmount", String.valueOf(numDam));
|
||||
if (sa.hasParam("ShieldEffectTarget")) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
final long timestamp = game.getNextTimestamp();
|
||||
|
||||
for (final Card tgtC : getTargetCards(sa)) {
|
||||
final ArrayList<String> hadIntrinsic = new ArrayList<String>();
|
||||
final List<String> hadIntrinsic = new ArrayList<String>();
|
||||
if (tgtC.isInPlay() && tgtC.canBeTargetedBy(sa)) {
|
||||
if (sa.hasParam("AllSuffixKeywords")) {
|
||||
String suffix = sa.getParam("AllSuffixKeywords");
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DestroyEffect extends SpellAbilityEffect {
|
||||
final boolean sac = sa.hasParam("Sacrifice");
|
||||
|
||||
final List<Card> tgtCards = getTargetCards(sa);
|
||||
final ArrayList<Card> untargetedCards = new ArrayList<Card>();
|
||||
final List<Card> untargetedCards = new ArrayList<Card>();
|
||||
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
|
||||
boolean changeAll = false;
|
||||
boolean allButOne = false;
|
||||
final ArrayList<String> keywords = new ArrayList<String>();
|
||||
final List<String> keywords = new ArrayList<String>();
|
||||
if (sa.hasParam("Keywords")) {
|
||||
keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & ")));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ProtectEffect extends SpellAbilityEffect {
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -122,7 +121,7 @@ public class ProtectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
final ArrayList<Card> untargetedCards = new ArrayList<Card>();
|
||||
final List<Card> untargetedCards = new ArrayList<Card>();
|
||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||
|
||||
if (sa.hasParam("Radiance") && (tgt != null)) {
|
||||
@@ -205,7 +204,7 @@ public class ProtectEffect extends SpellAbilityEffect {
|
||||
|
||||
|
||||
public static List<String> getProtectionList(final SpellAbility sa) {
|
||||
final ArrayList<String> gains = new ArrayList<String>();
|
||||
final List<String> gains = new ArrayList<String>();
|
||||
|
||||
final String gainStr = sa.getParam("Gains");
|
||||
if (gainStr.equals("Choice")) {
|
||||
|
||||
@@ -19,12 +19,12 @@ import java.util.List;
|
||||
public class PumpAllEffect extends SpellAbilityEffect {
|
||||
private static void applyPumpAll(final SpellAbility sa,
|
||||
final List<Card> list, final int a, final int d,
|
||||
final List<String> keywords, final ArrayList<ZoneType> affectedZones) {
|
||||
final List<String> keywords, final List<ZoneType> affectedZones) {
|
||||
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
final long timestamp = game.getNextTimestamp();
|
||||
final ArrayList<String> kws = new ArrayList<String>();
|
||||
final ArrayList<String> hiddenkws = new ArrayList<String>();
|
||||
final List<String> kws = new ArrayList<String>();
|
||||
final List<String> hiddenkws = new ArrayList<String>();
|
||||
boolean suspend = false;
|
||||
|
||||
for (String kw : keywords) {
|
||||
@@ -124,7 +124,7 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(final SpellAbility sa) {
|
||||
final List<Player> tgtPlayers = getTargetPlayers(sa);
|
||||
final ArrayList<ZoneType> affectedZones = new ArrayList<ZoneType>();
|
||||
final List<ZoneType> affectedZones = new ArrayList<ZoneType>();
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
|
||||
if (sa.hasParam("PumpZone")) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
return;
|
||||
}
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
final ArrayList<String> kws = new ArrayList<String>();
|
||||
final List<String> kws = new ArrayList<String>();
|
||||
|
||||
for (String kw : keywords) {
|
||||
if (kw.startsWith("HIDDEN")) {
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.game.Game;
|
||||
@@ -16,12 +24,6 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class VoteEffect extends SpellAbilityEffect {
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -66,7 +68,7 @@ public class VoteEffect extends SpellAbilityEffect {
|
||||
while (tgtPlayers.contains(activator) && !activator.equals(Iterables.getFirst(tgtPlayers, null))) {
|
||||
tgtPlayers.add(pSize - 1, tgtPlayers.remove(0));
|
||||
}
|
||||
ArrayListMultimap<Object, Player> votes = ArrayListMultimap.create();
|
||||
ListMultimap<Object, Player> votes = ArrayListMultimap.create();
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
int voteAmount = p.getKeywords().getAmount("You get an additional vote.") + 1;
|
||||
@@ -107,7 +109,7 @@ public class VoteEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Object> getMostVotes(final ArrayListMultimap<Object, Player> votes) {
|
||||
private static List<Object> getMostVotes(final ListMultimap<Object, Player> votes) {
|
||||
final List<Object> most = Lists.newArrayList();
|
||||
int amount = 0;
|
||||
for (final Object voteType : votes.keySet()) {
|
||||
|
||||
@@ -642,7 +642,7 @@ public class CardFactory {
|
||||
}
|
||||
|
||||
private static String[] getCardTypes(Card c) {
|
||||
ArrayList<String> relevantTypes = new ArrayList<String>();
|
||||
List<String> relevantTypes = new ArrayList<String>();
|
||||
for (CoreType t : c.getType().getCoreTypes()) {
|
||||
relevantTypes.add(t.name());
|
||||
}
|
||||
|
||||
@@ -2007,8 +2007,8 @@ public class CardFactoryUtil {
|
||||
return types.size();
|
||||
}
|
||||
|
||||
public static ArrayList<SpellAbility> getBushidoEffects(final Card c) {
|
||||
final ArrayList<SpellAbility> list = new ArrayList<SpellAbility>();
|
||||
public static List<SpellAbility> getBushidoEffects(final Card c) {
|
||||
final List<SpellAbility> list = new ArrayList<SpellAbility>();
|
||||
for (final String kw : c.getKeywords()) {
|
||||
if (kw.contains("Bushido")) {
|
||||
final String[] parse = kw.split(" ");
|
||||
|
||||
@@ -153,7 +153,7 @@ public class CardState {
|
||||
public final boolean hasIntrinsicKeyword(String k) {
|
||||
return intrinsicKeywords.contains(k);
|
||||
}
|
||||
public final void setIntrinsicKeywords(final ArrayList<String> intrinsicKeyword0) {
|
||||
public final void setIntrinsicKeywords(final List<String> intrinsicKeyword0) {
|
||||
intrinsicKeywords = intrinsicKeyword0;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ public class CardState {
|
||||
public final Iterable<String> getStaticAbilityStrings() {
|
||||
return staticAbilityStrings;
|
||||
}
|
||||
public final void setStaticAbilityStrings(final ArrayList<String> staticAbilityStrings0) {
|
||||
public final void setStaticAbilityStrings(final List<String> staticAbilityStrings0) {
|
||||
staticAbilityStrings = staticAbilityStrings0;
|
||||
}
|
||||
public boolean addStaticAbilityString(String s) {
|
||||
|
||||
@@ -17,15 +17,17 @@
|
||||
*/
|
||||
package forge.game.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.mana.Mana;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* The Class CostAddMana.
|
||||
@@ -73,7 +75,7 @@ public class CostAddMana extends CostPart {
|
||||
if (ai.getGame().getRules().hasCommander()) {
|
||||
cid = ai.getCommander().getRules().getColorIdentity();
|
||||
}
|
||||
ArrayList<Mana> manaProduced = new ArrayList<Mana>();
|
||||
List<Mana> manaProduced = new ArrayList<Mana>();
|
||||
final String type = this.getType();
|
||||
for (int n = 0; n < decision.c; n++) {
|
||||
if (StringUtils.isNumeric(type)) {
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.Map;
|
||||
public class CostPayment {
|
||||
private final Cost cost;
|
||||
private final SpellAbility ability;
|
||||
private final ArrayList<CostPart> paidCostParts = new ArrayList<CostPart>();
|
||||
private final List<CostPart> paidCostParts = new ArrayList<CostPart>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -52,9 +52,9 @@ public class ManaCostAdjustment {
|
||||
if (!cardsOnBattlefield.contains(originalCard)) {
|
||||
cardsOnBattlefield.add(originalCard);
|
||||
}
|
||||
final ArrayList<StaticAbility> raiseAbilities = new ArrayList<StaticAbility>();
|
||||
final ArrayList<StaticAbility> reduceAbilities = new ArrayList<StaticAbility>();
|
||||
final ArrayList<StaticAbility> setAbilities = new ArrayList<StaticAbility>();
|
||||
final List<StaticAbility> raiseAbilities = new ArrayList<StaticAbility>();
|
||||
final List<StaticAbility> reduceAbilities = new ArrayList<StaticAbility>();
|
||||
final List<StaticAbility> setAbilities = new ArrayList<StaticAbility>();
|
||||
|
||||
// Sort abilities to apply them in proper order
|
||||
for (Card c : cardsOnBattlefield) {
|
||||
|
||||
@@ -494,7 +494,7 @@ public class ManaCostBeingPaid {
|
||||
}
|
||||
|
||||
// Sort the keys to get a deterministic ordering.
|
||||
ArrayList<ManaCostShard> shards = new ArrayList<ManaCostShard>(unpaidShards.keySet());
|
||||
List<ManaCostShard> shards = new ArrayList<ManaCostShard>(unpaidShards.keySet());
|
||||
Collections.sort(shards);
|
||||
for (ManaCostShard shard : shards) {
|
||||
if (shard == ManaCostShard.COLORLESS) {
|
||||
|
||||
@@ -280,14 +280,14 @@ public class ManaPool implements Iterable<Mana> {
|
||||
|
||||
//Account for mana part of ability when undoing it
|
||||
public boolean accountFor(final AbilityManaPart ma) {
|
||||
if (ma == null) {
|
||||
return false;
|
||||
}
|
||||
if (ma == null) {
|
||||
return false;
|
||||
}
|
||||
if (floatingMana.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ArrayList<Mana> removeFloating = new ArrayList<Mana>();
|
||||
final List<Mana> removeFloating = new ArrayList<Mana>();
|
||||
|
||||
boolean manaNotAccountedFor = false;
|
||||
// loop over mana produced by mana ability
|
||||
|
||||
@@ -45,8 +45,8 @@ public class Phase implements java.io.Serializable {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
protected final ArrayList<GameCommand> at = new ArrayList<GameCommand>();
|
||||
private final ArrayList<GameCommand> until = new ArrayList<GameCommand>();
|
||||
protected final List<GameCommand> at = new ArrayList<GameCommand>();
|
||||
private final List<GameCommand> until = new ArrayList<GameCommand>();
|
||||
private final HashMap<Player, ArrayList<GameCommand>> untilMap = new HashMap<Player, ArrayList<GameCommand>>();
|
||||
private final HashMap<Player, ArrayList<GameCommand>> untilEndMap = new HashMap<Player, ArrayList<GameCommand>>();
|
||||
private final HashMap<Player, ArrayList<GameCommand>> registerMap = new HashMap<Player, ArrayList<GameCommand>>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.game.card.Card;
|
||||
@@ -8,8 +9,8 @@ import forge.game.spellability.SpellAbility;
|
||||
|
||||
//class for storing information during a game that is used at the end of the game to determine achievements
|
||||
public class AchievementTracker {
|
||||
public final HashSet<String> activatedUltimates = new HashSet<String>();
|
||||
public final HashSet<String> challengesCompleted = new HashSet<String>();
|
||||
public final Set<String> activatedUltimates = new HashSet<String>();
|
||||
public final Set<String> challengesCompleted = new HashSet<String>();
|
||||
public int mulliganTo = 7;
|
||||
public int spellsCast = 0;
|
||||
public int maxStormCount = 0;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
private final Map<ZoneType, PlayerZone> zones = new EnumMap<ZoneType, PlayerZone>(ZoneType.class);
|
||||
|
||||
private CardCollection currentPlanes = new CardCollection();
|
||||
private ArrayList<String> prowl = new ArrayList<String>();
|
||||
private List<String> prowl = new ArrayList<String>();
|
||||
|
||||
private PlayerStatistics stats = new PlayerStatistics();
|
||||
private PlayerController controller;
|
||||
@@ -692,7 +692,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
boolean DEBUGShieldsWithEffects = false;
|
||||
while (!getPreventNextDamageWithEffect().isEmpty() && restDamage != 0) {
|
||||
TreeMap<Card, Map<String, String>> shieldMap = getPreventNextDamageWithEffect();
|
||||
Map<Card, Map<String, String>> shieldMap = getPreventNextDamageWithEffect();
|
||||
CardCollection preventionEffectSources = new CardCollection(shieldMap.keySet());
|
||||
Card shieldSource = preventionEffectSources.get(0);
|
||||
if (preventionEffectSources.size() > 1) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -9,7 +8,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
@@ -164,7 +163,7 @@ public abstract class PlayerController {
|
||||
return chooseSomeType(kindOfType, sa, validTypes, invalidTypes, false);
|
||||
}
|
||||
|
||||
public abstract Object vote(SpellAbility sa, String prompt, List<Object> options, ArrayListMultimap<Object, Player> votes);
|
||||
public abstract Object vote(SpellAbility sa, String prompt, List<Object> options, ListMultimap<Object, Player> votes);
|
||||
public abstract Pair<CounterType,String> chooseAndRemoveOrPutCounter(Card cardWithCounter);
|
||||
public abstract boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question);
|
||||
public abstract CardCollectionView getCardsToMulligan(boolean isCommander, Player firstPlayer);
|
||||
@@ -195,7 +194,7 @@ public abstract class PlayerController {
|
||||
public abstract CounterType chooseCounterType(List<CounterType> options, SpellAbility sa, String prompt);
|
||||
|
||||
public abstract boolean confirmPayment(CostPart costPart, String string);
|
||||
public abstract ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, HashMap<String, Object> runParams);
|
||||
public abstract ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, Map<String, Object> runParams);
|
||||
public abstract String chooseProtectionType(String string, SpellAbility sa, List<String> choices);
|
||||
public abstract CardShields chooseRegenerationShield(Card c);
|
||||
|
||||
|
||||
@@ -17,6 +17,15 @@
|
||||
*/
|
||||
package forge.game.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.game.card.Card;
|
||||
@@ -29,14 +38,6 @@ import forge.game.replacement.ReplacementLayer;
|
||||
import forge.game.replacement.ReplacementResult;
|
||||
import forge.game.trigger.TriggerType;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract AbilityMana class.
|
||||
@@ -60,7 +61,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
private final boolean persistentMana;
|
||||
private String manaReplaceType;
|
||||
|
||||
private transient ArrayList<Mana> lastManaProduced = new ArrayList<Mana>();
|
||||
private transient List<Mana> lastManaProduced = new ArrayList<Mana>();
|
||||
|
||||
private final transient Card sourceCard;
|
||||
|
||||
@@ -405,7 +406,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public ArrayList<Mana> getLastManaProduced() {
|
||||
public List<Mana> getLastManaProduced() {
|
||||
return this.lastManaProduced;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
|
||||
protected ApiType api = null;
|
||||
|
||||
private final ArrayList<Mana> payingMana = new ArrayList<Mana>();
|
||||
private final List<Mana> payingMana = new ArrayList<Mana>();
|
||||
private final List<SpellAbility> paidAbilities = new ArrayList<SpellAbility>();
|
||||
|
||||
private HashMap<String, CardCollection> paidLists = new HashMap<String, CardCollection>();
|
||||
@@ -946,8 +946,8 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public final ArrayList<TargetChoices> getAllTargetChoices() {
|
||||
final ArrayList<TargetChoices> res = new ArrayList<TargetChoices>();
|
||||
public final List<TargetChoices> getAllTargetChoices() {
|
||||
final List<TargetChoices> res = new ArrayList<TargetChoices>();
|
||||
|
||||
SpellAbility sa = getRootAbility();
|
||||
if (sa.getTargetRestrictions() != null) {
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
*/
|
||||
package forge.game.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.card.Card;
|
||||
@@ -29,9 +33,6 @@ import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Expressions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* SpellAbilityRestriction class.
|
||||
@@ -80,7 +81,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
this.setHellbent(true);
|
||||
}
|
||||
if (value.startsWith("Prowl")) {
|
||||
final ArrayList<String> prowlTypes = new ArrayList<String>();
|
||||
final List<String> prowlTypes = new ArrayList<String>();
|
||||
prowlTypes.add("Rogue");
|
||||
if (value.split("Prowl").length > 1) {
|
||||
prowlTypes.add(value.split("Prowl")[1]);
|
||||
|
||||
@@ -254,9 +254,9 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
|
||||
view.updateText(this);
|
||||
|
||||
// Run BecomesTargetTrigger
|
||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
Map<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("SourceSA", ability);
|
||||
HashSet<Object> distinctObjects = new HashSet<Object>();
|
||||
Set<Object> distinctObjects = new HashSet<Object>();
|
||||
for (final Object tgt : target.getTargets()) {
|
||||
if (distinctObjects.contains(tgt)) {
|
||||
continue;
|
||||
|
||||
@@ -156,7 +156,7 @@ public class SpellAbilityVariables {
|
||||
private boolean allTargetsLegal = false;
|
||||
|
||||
/** The prowl. */
|
||||
private ArrayList<String> prowlTypes = new ArrayList<String>();
|
||||
private List<String> prowlTypes = new ArrayList<String>();
|
||||
|
||||
/** The s is present. */
|
||||
private String isPresent = null;
|
||||
@@ -518,7 +518,7 @@ public class SpellAbilityVariables {
|
||||
* @param types
|
||||
* the new prowl
|
||||
*/
|
||||
public final void setProwlTypes(final ArrayList<String> types) {
|
||||
public final void setProwlTypes(final List<String> types) {
|
||||
this.prowlTypes = types;
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ public class SpellAbilityVariables {
|
||||
*
|
||||
* @return the prowl
|
||||
*/
|
||||
public final ArrayList<String> getProwlTypes() {
|
||||
public final List<String> getProwlTypes() {
|
||||
return this.prowlTypes;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class TargetChoices implements Cloneable {
|
||||
}
|
||||
|
||||
public final List<GameObject> getTargets() {
|
||||
final ArrayList<GameObject> tgts = new ArrayList<GameObject>();
|
||||
final List<GameObject> tgts = new ArrayList<GameObject>();
|
||||
tgts.addAll(targetPlayers);
|
||||
tgts.addAll(targetCards);
|
||||
tgts.addAll(targetSpells);
|
||||
|
||||
@@ -100,7 +100,7 @@ public final class StaticAbilityContinuous {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
final Player controller = hostCard.getController();
|
||||
|
||||
final ArrayList<Player> affectedPlayers = StaticAbilityContinuous.getAffectedPlayers(stAb);
|
||||
final List<Player> affectedPlayers = StaticAbilityContinuous.getAffectedPlayers(stAb);
|
||||
final Game game = hostCard.getGame();
|
||||
|
||||
final StaticEffect se = game.getStaticEffects().getStaticEffect(stAb);
|
||||
@@ -132,7 +132,7 @@ public final class StaticAbilityContinuous {
|
||||
String addColors = null;
|
||||
String[] addTriggers = null;
|
||||
String[] addStatics = null;
|
||||
ArrayList<SpellAbility> addFullAbs = null;
|
||||
List<SpellAbility> addFullAbs = null;
|
||||
boolean removeAllAbilities = false;
|
||||
boolean removeSuperTypes = false;
|
||||
boolean removeCardTypes = false;
|
||||
@@ -329,7 +329,7 @@ public final class StaticAbilityContinuous {
|
||||
|
||||
if (layer == StaticAbilityLayer.ABILITIES1 && params.containsKey("GainsAbilitiesOf")) {
|
||||
final String[] valids = params.get("GainsAbilitiesOf").split(",");
|
||||
ArrayList<ZoneType> validZones = new ArrayList<ZoneType>();
|
||||
List<ZoneType> validZones = new ArrayList<ZoneType>();
|
||||
validZones.add(ZoneType.Battlefield);
|
||||
if (params.containsKey("GainsAbilitiesOfZones")) {
|
||||
validZones.clear();
|
||||
@@ -656,12 +656,12 @@ public final class StaticAbilityContinuous {
|
||||
sourceCard.addLeavesPlayCommand(removeIgnore);
|
||||
}
|
||||
|
||||
private static ArrayList<Player> getAffectedPlayers(final StaticAbility stAb) {
|
||||
private static List<Player> getAffectedPlayers(final StaticAbility stAb) {
|
||||
final Map<String, String> params = stAb.getMapParams();
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
final Player controller = hostCard.getController();
|
||||
|
||||
final ArrayList<Player> players = new ArrayList<Player>();
|
||||
final List<Player> players = new ArrayList<Player>();
|
||||
|
||||
if (!params.containsKey("Affected")) {
|
||||
return players;
|
||||
|
||||
@@ -17,15 +17,16 @@
|
||||
*/
|
||||
package forge.game.trigger;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.FCollection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.util.FCollection;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -63,12 +64,12 @@ public class TriggerVote extends Trigger {
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final ArrayListMultimap<Object, Player> votes = (ArrayListMultimap<Object, Player>) this.getRunParams().get("AllVotes");
|
||||
final ListMultimap<Object, Player> votes = (ArrayListMultimap<Object, Player>) this.getRunParams().get("AllVotes");
|
||||
sa.setTriggeringObject("OtherVoters", getVoters(this.getHostCard().getController(), votes, true, true));
|
||||
}
|
||||
|
||||
private static FCollection<Player> getVoters(final Player player,
|
||||
final ArrayListMultimap<Object, Player> votes,
|
||||
final ListMultimap<Object, Player> votes,
|
||||
final boolean isOpponent, final boolean votedOtherchoice) {
|
||||
final FCollection<Player> voters = new FCollection<Player>();
|
||||
for (final Object voteType : votes.keySet()) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
@@ -377,7 +378,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
s = si.getSpellAbility(true);
|
||||
}
|
||||
runParams.put("SourceSA", s);
|
||||
HashSet<Object> distinctObjects = new HashSet<Object>();
|
||||
Set<Object> distinctObjects = new HashSet<Object>();
|
||||
for (final TargetChoices tc : chosenTargets) {
|
||||
if (tc != null && tc.getTargetCards() != null) {
|
||||
for (final Object tgt : tc.getTargets()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Set;
|
||||
public class FCollection<T> implements List<T>, Set<T>, FCollectionView<T>, Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -1664555336364294106L;
|
||||
|
||||
private final HashSet<T> set = new HashSet<T>();
|
||||
private final Set<T> set = new HashSet<T>();
|
||||
private final LinkedList<T> list = new LinkedList<T>();
|
||||
|
||||
public FCollection() {
|
||||
|
||||
Reference in New Issue
Block a user