Sonar fixes

This commit is contained in:
Ingmar Goudt 2019-07-09 21:57:55 +02:00
parent 1621704b12
commit 178da75e4d
39 changed files with 97 additions and 79 deletions

View file

@ -50,9 +50,9 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
@Expose
protected String loyalty = "";
protected String startingLoyalty;
protected EnumSet<CardType> cardTypes;
protected Set<CardType> cardTypes;
protected SubTypeList subTypes;
protected EnumSet<SuperType> superTypes;
protected Set<SuperType> superTypes;
protected ObjectColor color;
protected ObjectColor frameColor;
protected FrameStyle frameStyle;
@ -731,7 +731,7 @@ public class CardView extends SimpleCardView implements SelectableObjectView {
return subTypes;
}
public EnumSet<SuperType> getSuperTypes() {
public Set<SuperType> getSuperTypes() {
return superTypes;
}

View file

@ -1642,7 +1642,7 @@ public class HumanPlayer extends PlayerImpl {
}
protected void specialAction(Game game) {
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, false);
Map<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, false);
if (!specialActions.isEmpty()) {
updateGameStatePriority("specialAction", game);
prepareForResponse(game);
@ -1659,7 +1659,7 @@ public class HumanPlayer extends PlayerImpl {
}
protected void specialManaAction(ManaCost unpaid, Game game) {
LinkedHashMap<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, true);
Map<UUID, SpecialAction> specialActions = game.getState().getSpecialActions().getControlledBy(playerId, true);
if (!specialActions.isEmpty()) {
updateGameStatePriority("specialAction", game);
prepareForResponse(game);

View file

@ -4,6 +4,7 @@ package mage.server;
import java.text.DateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ -25,7 +26,7 @@ public class ChatSession {
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final ConcurrentHashMap<UUID, String> clients = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, String> clients = new ConcurrentHashMap<>();
private final UUID chatId;
private final Date createTime;
private final String info;
@ -148,7 +149,7 @@ public class ChatSession {
return clients.containsKey(userId);
}
public ConcurrentHashMap<UUID, String> getClients() {
public ConcurrentMap<UUID, String> getClients() {
return clients;
}

View file

@ -22,6 +22,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
*
@ -32,8 +33,8 @@ public class DraftController {
private static final Logger logger = Logger.getLogger(GameController.class);
public static final String INIT_FILE_PATH = "config" + File.separator + "init.txt";
private final ConcurrentHashMap<UUID, DraftSession> draftSessions = new ConcurrentHashMap<>();
private final ConcurrentHashMap<UUID, UUID> userPlayerMap;
private final ConcurrentMap<UUID, DraftSession> draftSessions = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, UUID> userPlayerMap;
private final UUID draftSessionId;
private final Draft draft;
private final UUID tableId;

View file

@ -6,6 +6,8 @@ import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import mage.game.draft.Draft;
import mage.view.DraftPickView;
@ -16,7 +18,7 @@ import mage.view.DraftPickView;
public enum DraftManager {
instance;
private final ConcurrentHashMap<UUID, DraftController> draftControllers = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, DraftController> draftControllers = new ConcurrentHashMap<>();
public UUID createDraftSession(Draft draft, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId) {
DraftController draftController = new DraftController(draft, userPlayerMap, tableId);

View file

@ -60,15 +60,15 @@ public class GameController implements GameCallback {
private ScheduledFuture<?> futureTimeout;
protected static final ScheduledExecutorService timeoutIdleExecutor = ThreadExecutor.instance.getTimeoutIdleExecutor();
private final ConcurrentHashMap<UUID, GameSessionPlayer> gameSessions = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, GameSessionPlayer> gameSessions = new ConcurrentHashMap<>();
private final ReadWriteLock gameSessionsLock = new ReentrantReadWriteLock();
private final ConcurrentHashMap<UUID, GameSessionWatcher> watchers = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, GameSessionWatcher> watchers = new ConcurrentHashMap<>();
private final ReadWriteLock gameWatchersLock = new ReentrantReadWriteLock();
private final ConcurrentHashMap<UUID, PriorityTimer> timers = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, PriorityTimer> timers = new ConcurrentHashMap<>();
private final ConcurrentHashMap<UUID, UUID> userPlayerMap;
private final ConcurrentMap<UUID, UUID> userPlayerMap;
private final UUID gameSessionId;
private final Game game;
private final UUID chatId;
@ -82,7 +82,7 @@ public class GameController implements GameCallback {
private int turnsToRollback;
private int requestsOpen;
public GameController(Game game, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId, UUID choosingPlayerId, GameOptions gameOptions) {
public GameController(Game game, ConcurrentMap<UUID, UUID> userPlayerMap, UUID tableId, UUID choosingPlayerId, GameOptions gameOptions) {
gameSessionId = UUID.randomUUID();
this.userPlayerMap = userPlayerMap;
chatId = ChatManager.instance.createChatSession("Game " + game.getId());

View file

@ -12,6 +12,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ -22,7 +23,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
public enum GameManager {
instance;
private final ConcurrentHashMap<UUID, GameController> gameControllers = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, GameController> gameControllers = new ConcurrentHashMap<>();
private final ReadWriteLock gameControllersLock = new ReentrantReadWriteLock();
public UUID createGameSession(Game game, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId, UUID choosingPlayerId, GameOptions gameOptions) {

View file

@ -5,6 +5,8 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import mage.MageException;
import mage.cards.decks.Deck;
import mage.constants.TableState;
@ -47,10 +49,10 @@ public class TournamentController {
private final UUID tableId;
private boolean started = false;
private final Tournament tournament;
private ConcurrentHashMap<UUID, UUID> userPlayerMap = new ConcurrentHashMap<>();
private final ConcurrentHashMap<UUID, TournamentSession> tournamentSessions = new ConcurrentHashMap<>();
private ConcurrentMap<UUID, UUID> userPlayerMap = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, TournamentSession> tournamentSessions = new ConcurrentHashMap<>();
public TournamentController(Tournament tournament, ConcurrentHashMap<UUID, UUID> userPlayerMap, UUID tableId) {
public TournamentController(Tournament tournament, ConcurrentMap<UUID, UUID> userPlayerMap, UUID tableId) {
this.userPlayerMap = userPlayerMap;
chatId = ChatManager.instance.createChatSession("Tournament " + tournament.getId());
this.tournament = tournament;

View file

@ -4,6 +4,8 @@ package mage.server.tournament;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import mage.cards.decks.Deck;
import mage.game.tournament.Tournament;
import mage.view.TournamentView;
@ -14,7 +16,7 @@ import org.apache.log4j.Logger;
*/
public enum TournamentManager {
instance;
private final ConcurrentHashMap<UUID, TournamentController> controllers = new ConcurrentHashMap<>();
private final ConcurrentMap<UUID, TournamentController> controllers = new ConcurrentHashMap<>();
public Optional<TournamentController> getTournamentController(UUID tournamentId) {
return Optional.ofNullable(controllers.get(tournamentId));

View file

@ -3,6 +3,7 @@ package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
@ -55,7 +56,7 @@ class CallForBloodDynamicValue implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Card sourceCard = game.getCard(sourceAbility.getSourceId());
if (sourceCard != null) {
for (Object cost : sourceAbility.getCosts()) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD);
if (p != null) {

View file

@ -134,6 +134,7 @@ class CurseOfTheCabalTriggeredAbilityConditionalDelay extends AddCountersSourceE
super(CounterType.TIME.createInstance(), new StaticValue(2), false, true);
}
@Override
public boolean apply(Game game, Ability source) {
UUID activePlayerId = game.getActivePlayerId();
Player target = game.getPlayer(activePlayerId);

View file

@ -39,7 +39,7 @@ public final class DreamLeash extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ControlEnchantedEffect("permanent")));
}
public DreamLeash(final DreamLeash card) {
private DreamLeash(final DreamLeash card) {
super(card);
}
@ -51,7 +51,8 @@ public final class DreamLeash extends CardImpl {
class DreamLeashTarget extends TargetPermanent {
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if(super.canTarget(controllerId, id, source, game)){

View file

@ -61,6 +61,7 @@ class FblthpTheLostTriggeredAbility extends EntersBattlefieldTriggeredAbility {
super(ability);
}
@Override
public FblthpTheLostTriggeredAbility copy() {
return new FblthpTheLostTriggeredAbility(this);
}
@ -98,7 +99,7 @@ class FblthpTheLostTriggeredAbility extends EntersBattlefieldTriggeredAbility {
class FblthpTheLostWatcher extends Watcher {
private final Set<MageObjectReference> spellsCastFromLibrary = new HashSet();
private final Set<MageObjectReference> spellsCastFromLibrary = new HashSet<>();
FblthpTheLostWatcher() {
super(WatcherScope.GAME);
@ -131,10 +132,6 @@ class FblthpTheLostWatcher extends Watcher {
spellsCastFromLibrary.clear();
}
@Override
public FblthpTheLostWatcher copy() {
return new FblthpTheLostWatcher(this);
}
}
class FblthpTheLostTargetedTriggeredAbility extends TriggeredAbilityImpl {

View file

@ -42,7 +42,7 @@ public final class FlameBurst extends CardImpl {
this.getSpellAbility().addTarget(new TargetAnyTarget());
}
public FlameBurst(final FlameBurst card) {
private FlameBurst(final FlameBurst card) {
super(card);
}
@ -66,6 +66,7 @@ class FlameBurstCount extends CardsInAllGraveyardsCount {
super(value);
}
@Override
public FlameBurstCount copy() {
return new FlameBurstCount(this);
}
@ -83,7 +84,7 @@ class CountAsFlameBurstAbility extends SimpleStaticAbility {
super(Zone.GRAVEYARD, new InfoEffect("If {this} is in a graveyard, effects from spells named Flame Burst count it as a card named Flame Burst"));
}
public CountAsFlameBurstAbility(CountAsFlameBurstAbility ability) {
private CountAsFlameBurstAbility(CountAsFlameBurstAbility ability) {
super(ability);
}

View file

@ -3,6 +3,7 @@ package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
@ -52,7 +53,7 @@ class IchorExplosionDynamicValue implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Card sourceCard = game.getCard(sourceAbility.getSourceId());
if (sourceCard != null) {
for (Object cost : sourceAbility.getCosts()) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD);
return -1 * p.getPower().getValue();

View file

@ -64,7 +64,7 @@ class JaceMemoryAdeptEffect extends DrawCardTargetEffect {
staticText = "Any number of target players each draw twenty cards";
}
public JaceMemoryAdeptEffect(final DrawCardTargetEffect effect) {
private JaceMemoryAdeptEffect(final DrawCardTargetEffect effect) {
super(effect);
}
@ -84,6 +84,7 @@ class JaceMemoryAdeptEffect extends DrawCardTargetEffect {
return staticText;
}
@Override
public JaceMemoryAdeptEffect copy() {
return new JaceMemoryAdeptEffect(this);
}

View file

@ -3,6 +3,7 @@ package mage.cards.l;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -70,7 +71,7 @@ class LegacyOfTheBelovedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null) {
for (Object cost : source.getCosts()) {
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD);
if (p != null) {

View file

@ -65,8 +65,8 @@ class ManaSeismEffect extends OneShotEffect {
int amount = 0;
TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent(), true);
if(player.chooseTarget(Outcome.Sacrifice, sacrificeLand, source, game)){
for(Object uuid : sacrificeLand.getTargets()){
Permanent land = game.getPermanent((UUID)uuid);
for(UUID uuid : sacrificeLand.getTargets()){
Permanent land = game.getPermanent(uuid);
if(land != null){
land.sacrifice(source.getSourceId(), game);
amount++;

View file

@ -64,10 +64,11 @@ class MuscleBurstCount extends CardsInAllGraveyardsCount {
super(filter);
}
public MuscleBurstCount(MuscleBurstCount value) {
private MuscleBurstCount(MuscleBurstCount value) {
super(value);
}
@Override
public MuscleBurstCount copy() {
return new MuscleBurstCount(this);
}
@ -85,7 +86,7 @@ class CountAsMuscleBurstAbility extends SimpleStaticAbility {
super(Zone.GRAVEYARD, new InfoEffect("If {this} is in a graveyard, effects from spells named Muscle Burst count it as a card named Muscle Burst"));
}
public CountAsMuscleBurstAbility(CountAsMuscleBurstAbility ability) {
private CountAsMuscleBurstAbility(CountAsMuscleBurstAbility ability) {
super(ability);
}

View file

@ -62,8 +62,8 @@ class NightsnareDiscardEffect extends OneShotEffect {
if (controller.chooseUse(outcome, "Choose a a card to discard? (Otherwise " + player.getLogName() + " has to discard 2 cards).", source, game)) {
TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard());
if (controller.choose(Outcome.Benefit, revealedCards, target, game)) {
for (Object targetId : target.getTargets()) {
Card card = revealedCards.get((UUID) targetId, game);
for (UUID targetId : target.getTargets()) {
Card card = revealedCards.get(targetId, game);
if (card != null) {
player.discard(card, source, game);
}

View file

@ -2,6 +2,7 @@
package mage.cards.p;
import java.util.EnumSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.MageObjectReference;
@ -146,7 +147,7 @@ class PossibilityStormEffect extends OneShotEffect {
return false;
}
private boolean sharesType(Card card, EnumSet<CardType> cardTypes) {
private boolean sharesType(Card card, Set<CardType> cardTypes) {
for (CardType type : card.getCardType()) {
if (cardTypes.contains(type)) {
return true;

View file

@ -62,8 +62,8 @@ class RenounceEffect extends OneShotEffect {
int amount = 0;
TargetControlledPermanent toSacrifice = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledPermanent(), true);
if(player.chooseTarget(Outcome.Sacrifice, toSacrifice, source, game)) {
for(Object uuid : toSacrifice.getTargets()){
Permanent permanent = game.getPermanent((UUID)uuid);
for(UUID uuid : toSacrifice.getTargets()){
Permanent permanent = game.getPermanent(uuid);
if(permanent != null){
permanent.sacrifice(source.getSourceId(), game);
amount++;

View file

@ -72,8 +72,8 @@ class ReprocessEffect extends OneShotEffect {
int amount = 0;
TargetControlledPermanent toSacrifice = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true);
if(player.chooseTarget(Outcome.Sacrifice, toSacrifice, source, game)) {
for(Object uuid : toSacrifice.getTargets()){
Permanent permanent = game.getPermanent((UUID)uuid);
for(UUID uuid : toSacrifice.getTargets()){
Permanent permanent = game.getPermanent(uuid);
if(permanent != null){
permanent.sacrifice(source.getSourceId(), game);
amount++;

View file

@ -102,8 +102,7 @@ class TargetCreaturePermanentOpponentSameController extends TargetCreaturePerman
Permanent firstTargetPermanent = game.getPermanent(id);
if (firstTargetPermanent != null
&& game.getOpponents(controllerId).contains(firstTargetPermanent.getControllerId())) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
for (UUID targetId : getTargets()) {
Permanent targetPermanent = game.getPermanent(targetId);
if (targetPermanent != null) {
if (!firstTargetPermanent.getId().equals(targetPermanent.getId())) {

View file

@ -35,7 +35,7 @@ public final class WallOfDust extends CardImpl {
this.addAbility(new BlocksTriggeredAbility(new WallOfDustRestrictionEffect(), false, true));
}
public WallOfDust(final WallOfDust card) {
private WallOfDust(final WallOfDust card) {
super(card);
}
@ -93,6 +93,7 @@ class WallOfDustRestrictionEffect extends RestrictionEffect {
return false;
}
@Override
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
return false;
}

View file

@ -18,6 +18,7 @@ import mage.util.SubTypeList;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public interface MageObject extends MageItem, Serializable {
@ -32,13 +33,13 @@ public interface MageObject extends MageItem, Serializable {
void setName(String name);
EnumSet<CardType> getCardType();
Set<CardType> getCardType();
SubTypeList getSubtype(Game game);
boolean hasSubtype(SubType subtype, Game game);
EnumSet<SuperType> getSuperType();
Set<SuperType> getSuperType();
Abilities<Ability> getAbilities();
@ -199,7 +200,7 @@ public interface MageObject extends MageItem, Serializable {
void setIsAllCreatureTypes(boolean value);
default void addCardTypes(EnumSet<CardType> cardType) {
default void addCardTypes(Set<CardType> cardType) {
getCardType().addAll(cardType);
}

View file

@ -31,10 +31,10 @@ public abstract class MageObjectImpl implements MageObject {
protected ObjectColor color;
protected ObjectColor frameColor;
protected FrameStyle frameStyle;
protected EnumSet<CardType> cardType = EnumSet.noneOf(CardType.class);
protected Set<CardType> cardType = EnumSet.noneOf(CardType.class);
protected SubTypeList subtype = new SubTypeList();
protected boolean isAllCreatureTypes;
protected EnumSet<SuperType> supertype = EnumSet.noneOf(SuperType.class);
protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class);
protected Abilities<Ability> abilities;
protected String text;
protected MageInt power;
@ -111,7 +111,7 @@ public abstract class MageObjectImpl implements MageObject {
}
@Override
public EnumSet<CardType> getCardType() {
public Set<CardType> getCardType() {
return cardType;
}
@ -121,7 +121,7 @@ public abstract class MageObjectImpl implements MageObject {
}
@Override
public EnumSet<SuperType> getSuperType() {
public Set<SuperType> getSuperType() {
return supertype;
}

View file

@ -3,6 +3,7 @@
package mage.abilities;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
/**
@ -24,7 +25,7 @@ public class SpecialActions extends AbilitiesImpl<SpecialAction> {
* false = only non mana actions get returned
* @return
*/
public LinkedHashMap<UUID, SpecialAction> getControlledBy(UUID controllerId, boolean manaAction) {
public Map<UUID, SpecialAction> getControlledBy(UUID controllerId, boolean manaAction) {
LinkedHashMap<UUID, SpecialAction> controlledBy = new LinkedHashMap<>();
for (SpecialAction action: this) {
if (action.isControlledBy(controllerId) && action.isManaAction() == manaAction) {

View file

@ -19,6 +19,7 @@ public enum RaidCondition implements Condition {
return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) > 0;
}
@Override
public String toString() {
return "if you attacked with a creature this turn";
}

View file

@ -27,7 +27,7 @@ public class AlternativeCost2Impl<T extends AlternativeCost2Impl<T>> extends Cos
this.name = name;
this.delimiter = delimiter;
if (reminderText != null) {
this.reminderText = new StringBuilder("<i>").append(reminderText).append("</i>").toString();
this.reminderText = "<i>" + reminderText + "</i>";
}
this.add(cost);
}

View file

@ -22,7 +22,7 @@ import mage.util.CardUtil;
*/
public class AlternativeCostSourceAbility extends StaticAbility implements AlternativeSourceCosts {
Costs<AlternativeCost2> alternateCosts = new CostsImpl<>();
private Costs<AlternativeCost2> alternateCosts = new CostsImpl<>();
protected Condition condition;
protected String rule;
protected FilterCard filter;
@ -149,8 +149,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
if (!onlyMana) {
ability.getCosts().clear();
}
for (Cost cost : alternativeCostsToCheck) {
AlternativeCost2 alternateCost = (AlternativeCost2) cost;
for (AlternativeCost2 alternateCost : alternativeCostsToCheck) {
alternateCost.activate();
for (Iterator it = ((Costs) alternateCost).iterator(); it.hasNext();) {
Cost costDeailed = (Cost) it.next();

View file

@ -6,6 +6,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
@ -140,7 +141,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
if (permanent != null) {
// handle copies of copies
Permanent copyFromPermanent = permanent;
for (Effect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) {
for (ContinuousEffect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) {
if (effect instanceof CopyEffect) {
CopyEffect copyEffect = (CopyEffect) effect;
// there is another copy effect that our targetPermanent copies stats from

View file

@ -2,6 +2,7 @@
package mage.abilities.effects.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
@ -84,7 +85,7 @@ public class CreateTokenEffect extends OneShotEffect {
return lastAddedTokenId;
}
public ArrayList<UUID> getLastAddedTokenIds() {
public List<UUID> getLastAddedTokenIds() {
return lastAddedTokenIds;
}

View file

@ -64,8 +64,8 @@ public class UntapLandsEffect extends OneShotEffect {
}
}
if (target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) {
for (Object targetId : target.getTargets()) {
Permanent p = game.getPermanent((UUID) targetId);
for (UUID targetId : target.getTargets()) {
Permanent p = game.getPermanent(targetId);
if (p != null) {
p.untap(game);
}

View file

@ -132,8 +132,8 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
if (numberToDiscard > 0) {
TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter);
if (controller.choose(Outcome.Benefit, revealedCards, target, game)) {
for (Object targetId : target.getTargets()) {
Card card = revealedCards.get((UUID) targetId, game);
for (UUID targetId : target.getTargets()) {
Card card = revealedCards.get(targetId, game);
if (card != null) {
if (!player.discard(card, source, game)) {
result = false;

View file

@ -244,8 +244,8 @@ public class CardInfo {
return Arrays.asList(list.split(SEPARATOR));
}
public final EnumSet<CardType> getTypes() {
EnumSet<CardType> list = EnumSet.noneOf(CardType.class);
public final Set<CardType> getTypes() {
Set<CardType> list = EnumSet.noneOf(CardType.class);
for (String type : this.types.split(SEPARATOR)) {
try {
list.add(CardType.valueOf(type));
@ -310,8 +310,8 @@ public class CardInfo {
this.subtypes = joinList(subtypes);
}
public final EnumSet<SuperType> getSupertypes() {
EnumSet<SuperType> list = EnumSet.noneOf(SuperType.class);
public final Set<SuperType> getSupertypes() {
Set<SuperType> list = EnumSet.noneOf(SuperType.class);
for (String type : this.supertypes.split(SEPARATOR)) {
try {
list.add(SuperType.valueOf(type));

View file

@ -5,15 +5,16 @@ import mage.Mana;
import mage.ObjectColor;
import java.util.ArrayList;
import java.util.List;
/**
* @author BetaSteward_at_googlemail.com, JayDi85
*/
public class ChoiceColor extends ChoiceImpl {
private static final ArrayList<String> colorChoices = getBaseColors();
private static final List<String> colorChoices = getBaseColors();
public static ArrayList<String> getBaseColors() {
public static List<String> getBaseColors() {
ArrayList<String> arr = new ArrayList<>();
arr.add("Green");
arr.add("Blue");

View file

@ -21,6 +21,7 @@ import mage.util.SubTypeList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class Commander implements CommandObject {
@ -122,7 +123,7 @@ public class Commander implements CommandObject {
}
@Override
public EnumSet<CardType> getCardType() {
public Set<CardType> getCardType() {
return sourceObject.getCardType();
}
@ -137,7 +138,7 @@ public class Commander implements CommandObject {
}
@Override
public EnumSet<SuperType> getSuperType() {
public Set<SuperType> getSuperType() {
return sourceObject.getSuperType();
}

View file

@ -34,10 +34,7 @@ import mage.players.Player;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
@ -458,7 +455,7 @@ public class Spell extends StackObjImpl implements Card {
}
@Override
public EnumSet<CardType> getCardType() {
public Set<CardType> getCardType() {
if (faceDown) {
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class);
cardTypes.add(CardType.CREATURE);
@ -500,7 +497,7 @@ public class Spell extends StackObjImpl implements Card {
}
@Override
public EnumSet<SuperType> getSuperType() {
public Set<SuperType> getSuperType() {
return card.getSuperType();
}