diff --git a/Mage.Sets/src/mage/cards/a/AncientKavu.java b/Mage.Sets/src/mage/cards/a/AncientKavu.java index 9737b5ad955..5cffc720f8d 100644 --- a/Mage.Sets/src/mage/cards/a/AncientKavu.java +++ b/Mage.Sets/src/mage/cards/a/AncientKavu.java @@ -27,7 +27,7 @@ public final class AncientKavu extends CardImpl { this.toughness = new MageInt(3); // {2}: Ancient Kavu becomes colorless until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(ObjectColor.COLORLESS, Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); } private AncientKavu(final AncientKavu card) { diff --git a/Mage.Sets/src/mage/cards/b/BlazingBladeAskari.java b/Mage.Sets/src/mage/cards/b/BlazingBladeAskari.java index 91178bbb89f..27c57c4f158 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingBladeAskari.java +++ b/Mage.Sets/src/mage/cards/b/BlazingBladeAskari.java @@ -31,7 +31,7 @@ public final class BlazingBladeAskari extends CardImpl { // Flanking this.addAbility(new FlankingAbility()); // {2}: Blazing Blade Askari becomes colorless until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(ObjectColor.COLORLESS, Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); } private BlazingBladeAskari(final BlazingBladeAskari card) { diff --git a/Mage.Sets/src/mage/cards/e/ErsatzGnomes.java b/Mage.Sets/src/mage/cards/e/ErsatzGnomes.java index 6b080b306dd..7e6f4dd35f9 100644 --- a/Mage.Sets/src/mage/cards/e/ErsatzGnomes.java +++ b/Mage.Sets/src/mage/cards/e/ErsatzGnomes.java @@ -30,12 +30,12 @@ public final class ErsatzGnomes extends CardImpl { this.toughness = new MageInt(1); // {T}: Target spell becomes colorless. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(new ObjectColor(), Duration.Custom), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(ObjectColor.COLORLESS, Duration.Custom), new TapSourceCost()); ability.addTarget(new TargetSpell()); this.addAbility(ability); // {T}: Target permanent becomes colorless until end of turn. - ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(new ObjectColor(), Duration.EndOfTurn), new TapSourceCost()); + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(ObjectColor.COLORLESS, Duration.EndOfTurn), new TapSourceCost()); ability.addTarget(new TargetPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GhostflameSliver.java b/Mage.Sets/src/mage/cards/g/GhostflameSliver.java index a9b43a57a7e..4a6ff714b6f 100644 --- a/Mage.Sets/src/mage/cards/g/GhostflameSliver.java +++ b/Mage.Sets/src/mage/cards/g/GhostflameSliver.java @@ -44,8 +44,6 @@ class GhostflameSliverEffect extends ContinuousEffectImpl { private static final FilterPermanent filter = new FilterPermanent(SubType.SLIVER, "All Slivers"); - private static ObjectColor colorless = new ObjectColor(); - public GhostflameSliverEffect() { super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit); staticText = "All Slivers are colorless"; @@ -55,7 +53,7 @@ class GhostflameSliverEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { if (filter.match(perm, game)) { - perm.getColor(game).setColor(colorless); + perm.getColor(game).setColor(ObjectColor.COLORLESS); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/Moonlace.java b/Mage.Sets/src/mage/cards/m/Moonlace.java index aff531f8c2a..6667522bb68 100644 --- a/Mage.Sets/src/mage/cards/m/Moonlace.java +++ b/Mage.Sets/src/mage/cards/m/Moonlace.java @@ -21,7 +21,7 @@ public final class Moonlace extends CardImpl { // Target spell or permanent becomes colorless. this.getSpellAbility().addTarget(new TargetSpellOrPermanent()); - this.getSpellAbility().addEffect(new BecomesColorTargetEffect(new ObjectColor(), Duration.Custom)); + this.getSpellAbility().addEffect(new BecomesColorTargetEffect(ObjectColor.COLORLESS, Duration.Custom)); } private Moonlace(final Moonlace card) { diff --git a/Mage.Sets/src/mage/cards/r/RagingSpirit.java b/Mage.Sets/src/mage/cards/r/RagingSpirit.java index 4e8fd9ea11e..f82f0bd60b2 100644 --- a/Mage.Sets/src/mage/cards/r/RagingSpirit.java +++ b/Mage.Sets/src/mage/cards/r/RagingSpirit.java @@ -27,7 +27,7 @@ public final class RagingSpirit extends CardImpl { this.toughness = new MageInt(3); // {2}: Raging Spirit becomes colorless until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(ObjectColor.COLORLESS, Duration.EndOfTurn), new ManaCostsImpl<>("{2}"))); } private RagingSpirit(final RagingSpirit card) { diff --git a/Mage.Sets/src/mage/cards/t/ThranLens.java b/Mage.Sets/src/mage/cards/t/ThranLens.java index 8fe527cf551..6ce7bf706b1 100644 --- a/Mage.Sets/src/mage/cards/t/ThranLens.java +++ b/Mage.Sets/src/mage/cards/t/ThranLens.java @@ -37,8 +37,6 @@ public final class ThranLens extends CardImpl { } class ThranLensEffect extends ContinuousEffectImpl { - private static ObjectColor colorless = new ObjectColor(); - public ThranLensEffect() { super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit); @@ -47,7 +45,7 @@ public final class ThranLens extends CardImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent perm: game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { - perm.getColor(game).setColor(colorless); + perm.getColor(game).setColor(ObjectColor.COLORLESS); } return true; } diff --git a/Mage.Sets/src/mage/cards/x/XathridGorgon.java b/Mage.Sets/src/mage/cards/x/XathridGorgon.java index bf0f65c7be7..33f6b264d65 100644 --- a/Mage.Sets/src/mage/cards/x/XathridGorgon.java +++ b/Mage.Sets/src/mage/cards/x/XathridGorgon.java @@ -52,7 +52,7 @@ public final class XathridGorgon extends CardImpl { effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ARTIFACT); effect.setText("and becomes a colorless"); ability.addEffect(effect); - ability.addEffect(new BecomesColorTargetEffect(new ObjectColor(), Duration.Custom, "artifact in addition to its other types")); + ability.addEffect(new BecomesColorTargetEffect(ObjectColor.COLORLESS, Duration.Custom, "artifact in addition to its other types")); ability.addEffect(new XathridGorgonCantActivateEffect()); this.addAbility(ability); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorAllEffect.java deleted file mode 100644 index 3e0c8f12b14..00000000000 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorAllEffect.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * - * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - * - */ -package mage.abilities.effects.common.continuous; - -import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.Mode; -import mage.abilities.effects.ContinuousEffectImpl; -import mage.choices.ChoiceColor; -import mage.constants.*; -import mage.filter.FilterPermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; - - -/** - * @author LevelX - */ -public class BecomesColorAllEffect extends ContinuousEffectImpl { - - private ObjectColor setColor; - protected boolean loseOther; - protected FilterPermanent filter; - - /** - * Set the color of a spell or permanent - * - * @param duration - */ - public BecomesColorAllEffect(Duration duration) { - this(null, duration); - } - - public BecomesColorAllEffect(ObjectColor setColor, Duration duration) { - this(setColor, duration, new FilterPermanent("All permanents"), true, null); - } - - public BecomesColorAllEffect(ObjectColor setColor, Duration duration, FilterPermanent filter, boolean loseOther, String text) { - super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral); - this.setColor = setColor; - this.filter = filter; - this.loseOther = loseOther; - staticText = text; - } - - public BecomesColorAllEffect(final BecomesColorAllEffect effect) { - super(effect); - this.setColor = effect.setColor; - this.filter = effect.filter; - this.loseOther = effect.loseOther; - } - - @Override - public void init(Ability source, Game game) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return; - } - if (setColor == null) { - ChoiceColor choice = new ChoiceColor(); - if (!controller.choose(Outcome.PutManaInPool, choice, game)) { - discard(); - return; - } - setColor = choice.getColor(); - if (!game.isSimulation()) { - game.informPlayers(controller.getLogName() + " has chosen the color: " + setColor.toString()); - } - } - - super.init(source, game); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return false; - } - if (setColor != null) { - for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { - if (permanent != null) { - switch (layer) { - case ColorChangingEffects_5: - if (loseOther) { - permanent.getColor(game).setColor(new ObjectColor()); - } - permanent.getColor(game).addColor(setColor); - break; - } - } else if (duration == Duration.Custom) { - discard(); - } - } - return true; - } - return false; - } - - @Override - public BecomesColorAllEffect copy() { - return new BecomesColorAllEffect(this); - } - - @Override - public String getText(Mode mode) { - if (staticText != null && !staticText.isEmpty()) { - return staticText; - } - StringBuilder sb = new StringBuilder(); - sb.append(filter.getMessage()); - sb.append(" become "); - if (setColor == null) { - sb.append("the color of your choice"); - } else { - sb.append(setColor.getDescription()); - } - if (!duration.toString().equals("")) { - sb.append(' ').append(duration.toString()); - } - return sb.toString(); - } -} diff --git a/Mage/src/main/java/mage/designations/Designation.java b/Mage/src/main/java/mage/designations/Designation.java index d53d3b73818..2ea993bb256 100644 --- a/Mage/src/main/java/mage/designations/Designation.java +++ b/Mage/src/main/java/mage/designations/Designation.java @@ -25,7 +25,6 @@ import java.util.UUID; */ public abstract class Designation extends MageObjectImpl { - private static final ObjectColor emptyColor = new ObjectColor(); private static final ManaCostsImpl emptyCost = new ManaCostsImpl<>(); private final DesignationType designationType; @@ -82,7 +81,7 @@ public abstract class Designation extends MageObjectImpl { @Override public ObjectColor getFrameColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } public DesignationType getDesignationType() { @@ -121,12 +120,12 @@ public abstract class Designation extends MageObjectImpl { @Override public ObjectColor getColor() { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override diff --git a/Mage/src/main/java/mage/game/command/Dungeon.java b/Mage/src/main/java/mage/game/command/Dungeon.java index 2778f630f6a..ca21b99f44d 100644 --- a/Mage/src/main/java/mage/game/command/Dungeon.java +++ b/Mage/src/main/java/mage/game/command/Dungeon.java @@ -45,7 +45,6 @@ public class Dungeon extends CommandObjectImpl { } private static final List cardTypes = Collections.unmodifiableList(Arrays.asList(CardType.DUNGEON)); - private static final ObjectColor emptyColor = new ObjectColor(); private static final ManaCosts emptyCost = new ManaCostsImpl<>(); private UUID controllerId; @@ -238,17 +237,17 @@ public class Dungeon extends CommandObjectImpl { @Override public ObjectColor getColor() { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getFrameColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override diff --git a/Mage/src/main/java/mage/game/command/Emblem.java b/Mage/src/main/java/mage/game/command/Emblem.java index dead7355e10..fc2ff98db3f 100644 --- a/Mage/src/main/java/mage/game/command/Emblem.java +++ b/Mage/src/main/java/mage/game/command/Emblem.java @@ -30,7 +30,6 @@ import java.util.UUID; */ public abstract class Emblem extends CommandObjectImpl { - private static final ObjectColor emptyColor = new ObjectColor(); private static final ManaCosts emptyCost = new ManaCostsImpl<>(); private UUID controllerId; @@ -153,17 +152,17 @@ public abstract class Emblem extends CommandObjectImpl { @Override public ObjectColor getColor() { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getFrameColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override diff --git a/Mage/src/main/java/mage/game/command/Plane.java b/Mage/src/main/java/mage/game/command/Plane.java index 9dddc959d30..fe41964badc 100644 --- a/Mage/src/main/java/mage/game/command/Plane.java +++ b/Mage/src/main/java/mage/game/command/Plane.java @@ -33,7 +33,6 @@ import java.util.UUID; */ public abstract class Plane extends CommandObjectImpl { - private static final ObjectColor emptyColor = new ObjectColor(); private static final ManaCosts emptyCost = new ManaCostsImpl<>(); private Planes planeType = null; @@ -178,17 +177,17 @@ public abstract class Plane extends CommandObjectImpl { @Override public ObjectColor getColor() { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getFrameColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 7465d921096..73584137922 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -45,7 +45,6 @@ public class StackAbility extends StackObjectImpl implements Ability { private static final List emptyCardType = Collections.unmodifiableList(new ArrayList<>()); private static final List emptyString = Collections.unmodifiableList(new ArrayList<>()); - private static final ObjectColor emptyColor = new ObjectColor(); private static final ManaCosts emptyCost = new ManaCostsImpl<>(); private static final Costs emptyCosts = new CostsImpl<>(); private static final Abilities emptyAbilites = new AbilitiesImpl<>(); @@ -223,12 +222,12 @@ public class StackAbility extends StackObjectImpl implements Ability { @Override public ObjectColor getColor() { - return emptyColor; + return ObjectColor.COLORLESS; } @Override public ObjectColor getColor(Game game) { - return emptyColor; + return ObjectColor.COLORLESS; } @Override