mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Cleanup: use Lists rather than arrays whenever applicable (removes some methods)
This commit is contained in:
@@ -5,6 +5,8 @@ import forge.game.trigger.TriggerType;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Represents the planar dice for Planechase games.
|
||||
*
|
||||
@@ -59,4 +61,6 @@ public enum PlanarDice {
|
||||
|
||||
throw new RuntimeException("Element " + value + " not found in PlanarDice enum");
|
||||
}
|
||||
|
||||
public static final ImmutableList<PlanarDice> values = ImmutableList.copyOf(values());
|
||||
}
|
||||
|
||||
@@ -12,8 +12,11 @@ import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
protected String getStackDescription(SpellAbility sa) {
|
||||
@@ -93,7 +96,7 @@ public class CountersRemoveEffect extends SpellAbilityEffect {
|
||||
while (cntToRemove > 0 && tgtCard.hasCounters()) {
|
||||
final Map<CounterType, Integer> tgtCounters = tgtCard.getCounters();
|
||||
|
||||
CounterType chosenType = pc.chooseCounterType(tgtCounters.keySet(), sa, "Select type of counters to remove");
|
||||
CounterType chosenType = pc.chooseCounterType(ImmutableList.copyOf(tgtCounters.keySet()), sa, "Select type of counters to remove");
|
||||
String prompt = "Select the number of " + chosenType.getName() + " counters to remove";
|
||||
int chosenAmount = pc.chooseNumber(sa, prompt, 1, Math.min(cntToRemove, tgtCounters.get(chosenType)));
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package forge.game.card;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* The class Counters.
|
||||
*
|
||||
@@ -311,4 +313,6 @@ public enum CounterType {
|
||||
final String replacedName = name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase();
|
||||
return Enum.valueOf(CounterType.class, replacedName);
|
||||
}
|
||||
|
||||
public static final ImmutableList<CounterType> values = ImmutableList.copyOf(values());
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package forge.game.player;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.trackable.TrackableCollection;
|
||||
|
||||
/**
|
||||
* Stores information to reveal cards after a delay unless those cards can be
|
||||
@@ -14,22 +14,22 @@ import forge.game.zone.ZoneType;
|
||||
public class DelayedReveal implements Serializable {
|
||||
private static final long serialVersionUID = 5516713460440436615L;
|
||||
|
||||
private final Collection<CardView> cards;
|
||||
private final TrackableCollection<CardView> cards;
|
||||
private final ZoneType zone;
|
||||
private final PlayerView owner;
|
||||
private final String messagePrefix;
|
||||
|
||||
public DelayedReveal(Iterable<Card> cards0, ZoneType zone0, PlayerView owner0) {
|
||||
public DelayedReveal(final Iterable<Card> cards0, final ZoneType zone0, final PlayerView owner0) {
|
||||
this(cards0, zone0, owner0, null);
|
||||
}
|
||||
public DelayedReveal(Iterable<Card> cards0, ZoneType zone0, PlayerView owner0, String messagePrefix0) {
|
||||
public DelayedReveal(final Iterable<Card> cards0, final ZoneType zone0, final PlayerView owner0, final String messagePrefix0) {
|
||||
cards = CardView.getCollection(cards0);
|
||||
zone = zone0;
|
||||
owner = owner0;
|
||||
messagePrefix = messagePrefix0;
|
||||
}
|
||||
|
||||
public Collection<CardView> getCards() {
|
||||
public TrackableCollection<CardView> getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DelayedReveal implements Serializable {
|
||||
return messagePrefix;
|
||||
}
|
||||
|
||||
public void remove(CardView card) {
|
||||
public void remove(final CardView card) {
|
||||
cards.remove(card);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class PlayerController {
|
||||
reveal(cards, zone, owner, null);
|
||||
}
|
||||
public abstract void reveal(CardCollectionView cards, ZoneType zone, Player owner, String messagePrefix);
|
||||
public abstract void reveal(Collection<CardView> cards, ZoneType zone, PlayerView owner, String messagePrefix);
|
||||
public abstract void reveal(List<CardView> cards, ZoneType zone, PlayerView owner, String messagePrefix);
|
||||
|
||||
/** Shows message to player to reveal chosen cardName, creatureType, number etc. AI must analyze API to understand what that is */
|
||||
public abstract void notifyOfValue(SpellAbility saSource, GameObject realtedTarget, String value);
|
||||
@@ -192,7 +192,7 @@ public abstract class PlayerController {
|
||||
|
||||
public abstract PaperCard chooseSinglePaperCard(SpellAbility sa, String message, Predicate<PaperCard> cpp, String name);
|
||||
public abstract List<String> chooseColors(String message, SpellAbility sa, int min, int max, List<String> options);
|
||||
public abstract CounterType chooseCounterType(Collection<CounterType> options, SpellAbility sa, String prompt);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user