no need to do contains followed by an add on a set #2

This commit is contained in:
ingmargoudt 2016-09-13 17:27:44 +02:00
parent aad6a0d1f3
commit 5289dd3df8
3 changed files with 10 additions and 17 deletions

View file

@ -38,12 +38,7 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -54,6 +49,7 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.Watcher;
/**
*
* @author LevelX2
@ -159,9 +155,8 @@ class DamagedByEnchantedWatcher extends Watcher {
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (enchantment.getAttachedTo().equals(event.getSourceId())) {
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
if (!damagedCreatures.contains(mor)) {
damagedCreatures.add(mor);
}
}
}
}

View file

@ -46,6 +46,9 @@ import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author LevelX2
@ -103,7 +106,7 @@ class MinamosMeddlingCounterTargetEffect extends OneShotEffect {
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
if (spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) {
for (Card card: spellController.getHand().getCards(game)) {
if (card.getName().equals(spellAbility.getCardName()) && !cardsToDiscard.contains(card.getId())) {
if (card.getName().equals(spellAbility.getCardName())) {
cardsToDiscard.add(card);
}
}

View file

@ -34,16 +34,12 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.Watcher;
/**
*
* @author LevelX2
@ -96,9 +92,8 @@ class SpiritOfTheLabyrinthWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD ) {
if (!playersThatDrewCard.contains(event.getPlayerId())) {
playersThatDrewCard.add(event.getPlayerId());
}
}
}