diff --git a/Mage.Server/src/main/java/mage/server/TableManager.java b/Mage.Server/src/main/java/mage/server/TableManager.java index ae1f7a35cf..48b2088a80 100644 --- a/Mage.Server/src/main/java/mage/server/TableManager.java +++ b/Mage.Server/src/main/java/mage/server/TableManager.java @@ -40,7 +40,7 @@ public enum TableManager { // protected static ScheduledExecutorService expireExecutor = ThreadExecutor.getInstance().getExpireExecutor(); private final Logger logger = Logger.getLogger(TableManager.class); - private static final DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + private final DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); private final ConcurrentHashMap controllers = new ConcurrentHashMap<>(); private final ReadWriteLock controllersLock = new ReentrantReadWriteLock(); diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java index df8c2f51e5..c7c9f7518a 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java @@ -50,13 +50,13 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl { // checks for compatibility EffectType needType = EffectType.CONTINUOUS; - if (effect != null && !effect.getEffectType().equals(needType)) { + if (effect.getEffectType() != needType) { Assert.fail("ConditionalContinuousEffect supports only " + needType.toString() + " but found " + effect.getEffectType().toString()); } - if (otherwiseEffect != null && !otherwiseEffect.getEffectType().equals(needType)) { + if (otherwiseEffect != null && otherwiseEffect.getEffectType() != needType) { Assert.fail("ConditionalContinuousEffect supports only " + needType.toString() + " but found " + effect.getEffectType().toString()); } - if (effect != null && otherwiseEffect != null && !effect.getEffectType().equals(otherwiseEffect.getEffectType())) { + if (otherwiseEffect != null && effect.getEffectType() != otherwiseEffect.getEffectType()) { Assert.fail("ConditionalContinuousEffect must be same but found " + effect.getEffectType().toString() + " and " + otherwiseEffect.getEffectType().toString()); } } @@ -119,7 +119,7 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl { if (condition == null && baseCondition != null) { condition = baseCondition; } - boolean conditionState = condition.apply(game, source); + boolean conditionState = condition != null && condition.apply(game, source); if (conditionState) { effect.setTargetPointer(this.targetPointer); return effect.apply(game, source); @@ -127,10 +127,10 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl { otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.apply(game, source); } - if (!conditionState && effect.getDuration() == Duration.OneUse) { + if (effect.getDuration() == Duration.OneUse) { used = true; } - if (!conditionState && effect.getDuration() == Duration.Custom) { + if (effect.getDuration() == Duration.Custom) { this.discard(); } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java index db8b80f874..22fdb166fe 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java @@ -1,6 +1,5 @@ package mage.abilities.effects.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; @@ -9,8 +8,9 @@ import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** - * * @author BetaSteward_at_googlemail.com */ public class FightTargetsEffect extends OneShotEffect { @@ -57,27 +57,23 @@ public class FightTargetsEffect extends OneShotEffect { return creature1.fight(creature2, source, game); } } + if (!game.isSimulation()) { + game.informPlayers(card.getName() + " has been fizzled."); + } } - if (!game.isSimulation()) { - game.informPlayers(card.getName() + " has been fizzled."); - } + return false; } @Override - public FightTargetsEffect - copy() { + public FightTargetsEffect copy() { return new FightTargetsEffect(this); } @Override - public String - getText(Mode mode - ) { - if (staticText - != null && !staticText - .isEmpty()) { + public String getText(Mode mode) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } @@ -86,4 +82,4 @@ public class FightTargetsEffect extends OneShotEffect { .getTargets().get(1).getTargetName(); } -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java index a5ca86b2b1..9c43b5c4c3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java @@ -10,7 +10,6 @@ import mage.game.permanent.Permanent; import org.apache.log4j.Logger; /** - * * @author BetaSteward_at_googlemail.com */ public class LoseAbilityAttachedEffect extends ContinuousEffectImpl { @@ -47,7 +46,7 @@ public class LoseAbilityAttachedEffect extends ContinuousEffectImpl { while (creature.getAbilities().contains(ability)) { if (!creature.getAbilities().remove(ability)) { // Something went wrong - ability has an other id? - logger.warn("ability" + ability.getRule() + "couldn't be removed."); + logger.warn("ability" + ability.getRule() + "couldn't be removed."); } } } @@ -59,12 +58,8 @@ public class LoseAbilityAttachedEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append(attachmentType.verb()); sb.append(" creature "); - if (duration == Duration.WhileOnBattlefield) { - sb.append("loses "); - } else { - sb.append("loses "); - } - sb.append(ability.getRule()); + sb.append("loses "); + sb.append(ability.getRule()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/game/turn/TurnMods.java b/Mage/src/main/java/mage/game/turn/TurnMods.java index e15f415d4e..a1ab81b7cd 100644 --- a/Mage/src/main/java/mage/game/turn/TurnMods.java +++ b/Mage/src/main/java/mage/game/turn/TurnMods.java @@ -118,7 +118,7 @@ public class TurnMods extends ArrayList { ListIterator it = this.listIterator(this.size()); while (it.hasPrevious()) { TurnMod turnMod = it.previous(); - if (turnMod.getExtraPhase() != null && turnMod.getPlayerId().equals(playerId) && turnMod.getExtraPhase() != null && (turnMod.getAfterPhase() == null || turnMod.getAfterPhase() == afterPhase)) { + if (turnMod.getExtraPhase() != null && turnMod.getPlayerId().equals(playerId) && (turnMod.getAfterPhase() == null || turnMod.getAfterPhase() == afterPhase)) { it.remove(); return turnMod; }