diff --git a/Mage/src/mage/abilities/effects/ContinuousEffectsList.java b/Mage/src/mage/abilities/effects/ContinuousEffectsList.java index 988537c7c7..435b350c46 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffectsList.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffectsList.java @@ -36,11 +36,12 @@ import mage.constants.Duration; /** * * @author BetaSteward_at_googlemail.com + * @param */ public class ContinuousEffectsList extends ArrayList { // the effectAbilityMap holds for each effect all abilities that are connected (used) with this effect - private final Map> effectAbilityMap = new HashMap>(); + private final Map> effectAbilityMap = new HashMap<>(); public ContinuousEffectsList() { } @@ -49,17 +50,17 @@ public class ContinuousEffectsList extends ArrayList for (ContinuousEffect cost: effects) { this.add((T)cost.copy()); } - for (Map.Entry> entry: effects.effectAbilityMap.entrySet()) { - HashSet newSet = new HashSet(); - for (Ability ability :(HashSet)entry.getValue()) { + for (Map.Entry> entry : effects.effectAbilityMap.entrySet()) { + HashSet newSet = new HashSet<>(); + for (Ability ability : entry.getValue()) { newSet.add(ability.copy()); } effectAbilityMap.put(entry.getKey(), newSet); } } - public ContinuousEffectsList copy() { - return new ContinuousEffectsList(this); + public ContinuousEffectsList copy() { + return new ContinuousEffectsList<>(this); } public void removeEndOfTurnEffects() { @@ -94,9 +95,9 @@ public class ContinuousEffectsList extends ArrayList private boolean isInactive(T effect, Game game) { HashSet set = effectAbilityMap.get(effect.getId()); - Iterator it = set.iterator(); + Iterator it = set.iterator(); while (it.hasNext()) { - Ability ability = (Ability)it.next(); + Ability ability = it.next(); if (ability == null) { it.remove(); } else if (effect.isDiscarded()) { @@ -107,10 +108,12 @@ public class ContinuousEffectsList extends ArrayList if (game.getObject(ability.getSourceId()) == null) {//TODO: does this really works?? object is returned across the game it.remove(); } + break; case OneUse: if (effect.isUsed()) { it.remove(); } + break; case Custom: if (effect.isInactive(ability , game)) { it.remove(); @@ -140,7 +143,7 @@ public class ContinuousEffectsList extends ArrayList set.add(source); return; } - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); set.add(source); this.effectAbilityMap.put(effect.getId(), set); this.add(effect);