From ea6ba3c0a9f6783a061f56a77981fb999f160432 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Thu, 6 Apr 2017 16:30:22 +0200 Subject: [PATCH 1/4] enum conditions --- Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java | 2 +- Mage.Sets/src/mage/cards/a/AngelOfTheDireHour.java | 2 +- Mage.Sets/src/mage/cards/b/BreachingLeviathan.java | 2 +- Mage.Sets/src/mage/cards/c/CoalStoker.java | 2 +- Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java | 2 +- Mage.Sets/src/mage/cards/d/DeathbringerRegent.java | 2 +- Mage.Sets/src/mage/cards/d/DescendantOfKiyomaro.java | 4 ++-- Mage.Sets/src/mage/cards/d/Dismantle.java | 3 ++- Mage.Sets/src/mage/cards/d/DreadCacodemon.java | 2 +- Mage.Sets/src/mage/cards/e/Epochrasite.java | 2 +- Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java | 2 +- Mage.Sets/src/mage/cards/f/FurnaceDragon.java | 2 +- Mage.Sets/src/mage/cards/i/InameAsOne.java | 2 +- Mage.Sets/src/mage/cards/k/KitsuneBonesetter.java | 5 +++-- Mage.Sets/src/mage/cards/l/LinvalaThePreserver.java | 2 +- Mage.Sets/src/mage/cards/m/MyojinOfCleansingFire.java | 2 +- Mage.Sets/src/mage/cards/m/MyojinOfInfiniteRage.java | 2 +- Mage.Sets/src/mage/cards/m/MyojinOfLifesWeb.java | 5 +++-- Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java | 8 ++++---- Mage.Sets/src/mage/cards/m/MyojinOfSeeingWinds.java | 10 +++++----- Mage.Sets/src/mage/cards/o/OkinaNightwatch.java | 5 +++-- Mage.Sets/src/mage/cards/p/PhageTheUntouchable.java | 2 +- Mage.Sets/src/mage/cards/r/ReiverDemon.java | 5 +++-- Mage.Sets/src/mage/cards/s/ScionOfVituGhazi.java | 5 +++-- Mage.Sets/src/mage/cards/s/Secretkeeper.java | 7 ++++--- .../condition/common/CastFromHandSourceCondition.java | 4 +++- .../common/MoreCardsInHandThanOpponentsCondition.java | 4 +++- .../condition/common/OpponentHasMoreLifeCondition.java | 8 ++++---- 28 files changed, 57 insertions(+), 46 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java b/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java index a7089fa86a..3d38e0cd67 100644 --- a/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java +++ b/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java @@ -74,7 +74,7 @@ public class AkutaBornOfAsh extends CardImpl { new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filterSwamp))), TargetController.YOU, false), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may sacrifice a Swamp. If you do, return {this} from your graveyard to the battlefield."); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AngelOfTheDireHour.java b/Mage.Sets/src/mage/cards/a/AngelOfTheDireHour.java index 171fd05b33..6f1d8edfbc 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfTheDireHour.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfTheDireHour.java @@ -62,7 +62,7 @@ public class AngelOfTheDireHour extends CardImpl { // When Angel of the Dire Hour enters the battlefield, if you cast it from your hand, exile all attacking creatures. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new ExileAllEffect(new FilterAttackingCreature("attacking creatures")), false), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, exile all attacking creatures."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java b/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java index 5325edbd38..37dfcb11b4 100644 --- a/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java +++ b/Mage.Sets/src/mage/cards/b/BreachingLeviathan.java @@ -68,7 +68,7 @@ public class BreachingLeviathan extends CardImpl { // When Breaching Leviathan enters the battlefield, if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new BreachingLeviathanEffect(), false), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/c/CoalStoker.java b/Mage.Sets/src/mage/cards/c/CoalStoker.java index a74b8ad258..3af3fca1cb 100644 --- a/Mage.Sets/src/mage/cards/c/CoalStoker.java +++ b/Mage.Sets/src/mage/cards/c/CoalStoker.java @@ -55,7 +55,7 @@ public class CoalStoker extends CardImpl { // When Coal Stoker enters the battlefield, if you cast it from your hand, add {R}{R}{R} to your mana pool. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new BasicManaEffect(Mana.RedMana(3)), false), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, add {R}{R}{R} to your mana pool."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java b/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java index 470334319a..ba003a6acc 100644 --- a/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java +++ b/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java @@ -66,7 +66,7 @@ public class DeathOfAThousandStings extends CardImpl { new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), TargetController.YOU, true), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand."); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java b/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java index 21a0060208..316f26eb7d 100644 --- a/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java +++ b/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java @@ -88,7 +88,7 @@ class DeathbringerRegentCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - return new CastFromHandSourceCondition().apply(game, source) + return CastFromHandSourceCondition.instance.apply(game, source) && game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game).size() >= 6; } } diff --git a/Mage.Sets/src/mage/cards/d/DescendantOfKiyomaro.java b/Mage.Sets/src/mage/cards/d/DescendantOfKiyomaro.java index e80da5d9a5..1c0d5d425a 100644 --- a/Mage.Sets/src/mage/cards/d/DescendantOfKiyomaro.java +++ b/Mage.Sets/src/mage/cards/d/DescendantOfKiyomaro.java @@ -61,11 +61,11 @@ public class DescendantOfKiyomaro extends CardImpl { // As long as you have more cards in hand than each opponent, Descendant of Kiyomaro gets +1/+2 and has "Whenever this creature deals combat damage, you gain 3 life." Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostSourceEffect(1,2, Duration.WhileOnBattlefield), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "As long as you have more cards in hand than each opponent, {this} gets +1/+2")); ability.addEffect(new ConditionalContinuousEffect( new GainAbilitySourceEffect(new DealsCombatDamageTriggeredAbility(new GainLifeEffect(3), false)), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "and has \"Whenever this creature deals combat damage, you gain 3 life.\"")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/Dismantle.java b/Mage.Sets/src/mage/cards/d/Dismantle.java index a890154451..7276dd1054 100644 --- a/Mage.Sets/src/mage/cards/d/Dismantle.java +++ b/Mage.Sets/src/mage/cards/d/Dismantle.java @@ -27,7 +27,6 @@ */ package mage.cards.d; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; @@ -44,6 +43,8 @@ import mage.target.Target; import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetControlledPermanent; +import java.util.UUID; + /** * * @author Styxo diff --git a/Mage.Sets/src/mage/cards/d/DreadCacodemon.java b/Mage.Sets/src/mage/cards/d/DreadCacodemon.java index 6b2c9ae436..5bdeae024d 100644 --- a/Mage.Sets/src/mage/cards/d/DreadCacodemon.java +++ b/Mage.Sets/src/mage/cards/d/DreadCacodemon.java @@ -71,7 +71,7 @@ public class DreadCacodemon extends CardImpl { // if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control. TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(opponentsCreatures, false)); ability.addEffect(new TapAllEffect(otherCreaturesYouControl)); - this.addAbility(new ConditionalTriggeredAbility(ability, new CastFromHandSourceCondition(), + this.addAbility(new ConditionalTriggeredAbility(ability, CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/e/Epochrasite.java b/Mage.Sets/src/mage/cards/e/Epochrasite.java index bce085d6ef..bec3033140 100644 --- a/Mage.Sets/src/mage/cards/e/Epochrasite.java +++ b/Mage.Sets/src/mage/cards/e/Epochrasite.java @@ -67,7 +67,7 @@ public class Epochrasite extends CardImpl { // Epochrasite enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand. this.addAbility(new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), - new InvertCondition(new CastFromHandSourceCondition()), + new InvertCondition(CastFromHandSourceCondition.instance), "{this} enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand",""), new CastFromHandWatcher()); diff --git a/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java b/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java index e81d976d4d..d488c0cd72 100644 --- a/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java +++ b/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java @@ -71,7 +71,7 @@ public class ExileIntoDarkness extends CardImpl { new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), TargetController.YOU, true), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand."); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/FurnaceDragon.java b/Mage.Sets/src/mage/cards/f/FurnaceDragon.java index a0b754c008..a456e333c3 100644 --- a/Mage.Sets/src/mage/cards/f/FurnaceDragon.java +++ b/Mage.Sets/src/mage/cards/f/FurnaceDragon.java @@ -70,7 +70,7 @@ public class FurnaceDragon extends CardImpl { // When Furnace Dragon enters the battlefield, if you cast it from your hand, exile all artifacts. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new ExileAllEffect(filter), false), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, exile all artifacts."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/i/InameAsOne.java b/Mage.Sets/src/mage/cards/i/InameAsOne.java index 52bcacb2fb..c582af12e1 100644 --- a/Mage.Sets/src/mage/cards/i/InameAsOne.java +++ b/Mage.Sets/src/mage/cards/i/InameAsOne.java @@ -78,7 +78,7 @@ public class InameAsOne extends CardImpl { // When Iname as One enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter)), true), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library."), new CastFromHandWatcher()); diff --git a/Mage.Sets/src/mage/cards/k/KitsuneBonesetter.java b/Mage.Sets/src/mage/cards/k/KitsuneBonesetter.java index 6e867b6a2b..66e5dce8f8 100644 --- a/Mage.Sets/src/mage/cards/k/KitsuneBonesetter.java +++ b/Mage.Sets/src/mage/cards/k/KitsuneBonesetter.java @@ -27,7 +27,6 @@ */ package mage.cards.k; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; @@ -41,6 +40,8 @@ import mage.constants.Duration; import mage.constants.Zone; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -60,7 +61,7 @@ public class KitsuneBonesetter extends CardImpl { Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 3), new TapSourceCost(), - new MoreCardsInHandThanOpponentsCondition() + MoreCardsInHandThanOpponentsCondition.instance ); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/l/LinvalaThePreserver.java b/Mage.Sets/src/mage/cards/l/LinvalaThePreserver.java index 63d2c485af..aa656cfc4f 100644 --- a/Mage.Sets/src/mage/cards/l/LinvalaThePreserver.java +++ b/Mage.Sets/src/mage/cards/l/LinvalaThePreserver.java @@ -62,7 +62,7 @@ public class LinvalaThePreserver extends CardImpl { // When Linvala, the Preserver enters the battlefield, if an opponent has more life than you, you gain 5 life. this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(5), false), - new OpponentHasMoreLifeCondition(), + OpponentHasMoreLifeCondition.instance, "When {this} enters the battlefield, if an opponent has more life than you, you gain 5 life.")); // When Linvala enters the battlefield, if an opponent controls more creatures than you, create a 3/3 white Angel creature token with flying. diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfCleansingFire.java b/Mage.Sets/src/mage/cards/m/MyojinOfCleansingFire.java index b5abe49962..9dd391390e 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfCleansingFire.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfCleansingFire.java @@ -74,7 +74,7 @@ public class MyojinOfCleansingFire extends CardImpl { this.getSpellAbility().addWatcher(new CastFromHandWatcher()); // Myojin of Cleansing Fire enters the battlefield with a divinity counter on it if you cast it from your hand. - this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); + this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Cleansing Fire is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfInfiniteRage.java b/Mage.Sets/src/mage/cards/m/MyojinOfInfiniteRage.java index efa4a18a09..3f39280b9f 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfInfiniteRage.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfInfiniteRage.java @@ -70,7 +70,7 @@ public class MyojinOfInfiniteRage extends CardImpl { this.getSpellAbility().addWatcher(new CastFromHandWatcher()); // Myojin of Infinite Rage enters the battlefield with a divinity counter on it if you cast it from your hand. - this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); + this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Infinite Rage is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfLifesWeb.java b/Mage.Sets/src/mage/cards/m/MyojinOfLifesWeb.java index aec28e2016..60b9b157f9 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfLifesWeb.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfLifesWeb.java @@ -27,7 +27,6 @@ */ package mage.cards.m; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -53,6 +52,8 @@ import mage.players.Player; import mage.target.common.TargetCardInHand; import mage.watchers.common.CastFromHandWatcher; +import java.util.UUID; + /** * @author LevelX */ @@ -69,7 +70,7 @@ public class MyojinOfLifesWeb extends CardImpl { this.getSpellAbility().addWatcher(new CastFromHandWatcher()); // Myojin of Life's Web enters the battlefield with a divinity counter on it if you cast it from your hand. - this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); + this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Life's Web is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java b/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java index f7963e9dfa..439d9c6291 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfNightsReach.java @@ -27,9 +27,6 @@ */ package mage.cards.m; -import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -47,11 +44,14 @@ import mage.abilities.keyword.IndestructibleAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.*; import mage.counters.CounterType; import mage.game.Game; import mage.players.Player; import mage.watchers.common.CastFromHandWatcher; +import java.util.UUID; + /** * @author LevelX */ @@ -68,7 +68,7 @@ public class MyojinOfNightsReach extends CardImpl { this.getSpellAbility().addWatcher(new CastFromHandWatcher()); // Myojin of Night's Reach enters the battlefield with a divinity counter on it if you cast it from your hand. - this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); + this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Night's Reach is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); diff --git a/Mage.Sets/src/mage/cards/m/MyojinOfSeeingWinds.java b/Mage.Sets/src/mage/cards/m/MyojinOfSeeingWinds.java index 7e1d239c02..006433da0d 100644 --- a/Mage.Sets/src/mage/cards/m/MyojinOfSeeingWinds.java +++ b/Mage.Sets/src/mage/cards/m/MyojinOfSeeingWinds.java @@ -27,9 +27,6 @@ */ package mage.cards.m; -import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -47,11 +44,14 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.watchers.common.CastFromHandWatcher; +import java.util.UUID; + /** * @author LevelX */ @@ -73,12 +73,12 @@ public class MyojinOfSeeingWinds extends CardImpl { this.getSpellAbility().addWatcher(new CastFromHandWatcher()); // Myojin of Seeing Winds enters the battlefield with a divinity counter on it if you cast it from your hand. - this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); + this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand")); // Myojin of Seeing Winds is indestructible as long as it has a divinity counter on it. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it"))); // Remove a divinity counter from Myojin of Seeing Winds: Draw a card for each permanent you control. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter, 1)), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance())); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/o/OkinaNightwatch.java b/Mage.Sets/src/mage/cards/o/OkinaNightwatch.java index cccd572f32..302fa46b9a 100644 --- a/Mage.Sets/src/mage/cards/o/OkinaNightwatch.java +++ b/Mage.Sets/src/mage/cards/o/OkinaNightwatch.java @@ -27,7 +27,6 @@ */ package mage.cards.o; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -40,6 +39,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author LevelX2 @@ -57,7 +58,7 @@ public class OkinaNightwatch extends CardImpl { // As long as you have more cards in hand than each opponent, Okina Nightwatch gets +3/+3. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostSourceEffect(3,3, Duration.WhileOnBattlefield), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "As long as you have more cards in hand than each opponent, Okina Nightwatch gets +3/+3")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PhageTheUntouchable.java b/Mage.Sets/src/mage/cards/p/PhageTheUntouchable.java index d90a45b935..298e062309 100644 --- a/Mage.Sets/src/mage/cards/p/PhageTheUntouchable.java +++ b/Mage.Sets/src/mage/cards/p/PhageTheUntouchable.java @@ -63,7 +63,7 @@ public class PhageTheUntouchable extends CardImpl { // When Phage the Untouchable enters the battlefield, if you didn't cast it from your hand, you lose the game. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new LoseGameSourceControllerEffect(), false), - new InvertCondition(new CastFromHandSourceCondition()), + new InvertCondition(CastFromHandSourceCondition.instance), "When {this} enters the battlefield, if you didn't cast it from your hand, you lose the game" ), new CastFromHandWatcher()); diff --git a/Mage.Sets/src/mage/cards/r/ReiverDemon.java b/Mage.Sets/src/mage/cards/r/ReiverDemon.java index 618cffb87a..f8c8088285 100644 --- a/Mage.Sets/src/mage/cards/r/ReiverDemon.java +++ b/Mage.Sets/src/mage/cards/r/ReiverDemon.java @@ -27,7 +27,6 @@ */ package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -44,6 +43,8 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; import mage.watchers.common.CastFromHandWatcher; +import java.util.UUID; + /** * * @author daagar @@ -69,7 +70,7 @@ public class ReiverDemon extends CardImpl { // When Reiver Demon enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter, true), false), - new CastFromHandSourceCondition(), + CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/s/ScionOfVituGhazi.java b/Mage.Sets/src/mage/cards/s/ScionOfVituGhazi.java index aa1b268067..3cf6296048 100644 --- a/Mage.Sets/src/mage/cards/s/ScionOfVituGhazi.java +++ b/Mage.Sets/src/mage/cards/s/ScionOfVituGhazi.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -41,6 +40,8 @@ import mage.constants.CardType; import mage.game.permanent.token.BirdToken; import mage.watchers.common.CastFromHandWatcher; +import java.util.UUID; + /** * * @author LevelX2 @@ -56,7 +57,7 @@ public class ScionOfVituGhazi extends CardImpl { TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new BirdToken()), false); ability.addEffect(new PopulateEffect("then")); - this.addAbility(new ConditionalTriggeredAbility(ability, new CastFromHandSourceCondition(), + this.addAbility(new ConditionalTriggeredAbility(ability, CastFromHandSourceCondition.instance, "When {this} enters the battlefield, if you cast it from your hand, create a 1/1 white Bird creature token with flying, then populate."), new CastFromHandWatcher()); } diff --git a/Mage.Sets/src/mage/cards/s/Secretkeeper.java b/Mage.Sets/src/mage/cards/s/Secretkeeper.java index 9aeb29e508..6836816308 100644 --- a/Mage.Sets/src/mage/cards/s/Secretkeeper.java +++ b/Mage.Sets/src/mage/cards/s/Secretkeeper.java @@ -27,7 +27,6 @@ */ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -42,6 +41,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import java.util.UUID; + /** * * @author LevelX2 @@ -58,11 +59,11 @@ public class Secretkeeper extends CardImpl { // As long as you have more cards in hand than each opponent, Secretkeeper gets +2/+2 and has flying. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostSourceEffect(2,2, Duration.WhileOnBattlefield), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "As long as you have more cards in hand than each opponent, Secretkeeper gets +2/+2")); ability.addEffect(new ConditionalContinuousEffect( new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), - new MoreCardsInHandThanOpponentsCondition(), + MoreCardsInHandThanOpponentsCondition.instance, "and has flying")); this.addAbility(ability); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/CastFromHandSourceCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CastFromHandSourceCondition.java index b74eaf37c1..b047628e52 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CastFromHandSourceCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CastFromHandSourceCondition.java @@ -13,7 +13,9 @@ import mage.watchers.common.CastFromHandWatcher; * * @author Loki */ -public class CastFromHandSourceCondition implements Condition { +public enum CastFromHandSourceCondition implements Condition { + + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java index 846f59eb22..d2d873d523 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java @@ -7,7 +7,9 @@ import mage.players.Player; import java.util.UUID; -public class MoreCardsInHandThanOpponentsCondition implements Condition { +public enum MoreCardsInHandThanOpponentsCondition implements Condition { + + instance; @Override public boolean apply(Game game, Ability source) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/OpponentHasMoreLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/OpponentHasMoreLifeCondition.java index d78083d48d..85293b8b80 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/OpponentHasMoreLifeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/OpponentHasMoreLifeCondition.java @@ -28,21 +28,21 @@ package mage.abilities.condition.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author fireshoes */ -public class OpponentHasMoreLifeCondition implements Condition { +public enum OpponentHasMoreLifeCondition implements Condition { - public OpponentHasMoreLifeCondition() { - } + instance; @Override public boolean apply(Game game, Ability source) { From f22ebd3677be8439c46d09ca5933f6b56e7c78d0 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Thu, 6 Apr 2017 16:38:34 +0200 Subject: [PATCH 2/4] removed contains cardtype calls --- .../continuous/AddCardTypeSourceEffect.java | 4 +--- .../continuous/BecomesCreatureSourceEffect.java | 16 +++++----------- .../mage/util/functions/CardTypeApplier.java | 4 ---- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java index 6a2e18f61d..6fe7d4d7ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeSourceEffect.java @@ -65,9 +65,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) { - if (!permanent.getCardType().contains(addedCardType)) { - permanent.addCardType(addedCardType); - } + permanent.addCardType(addedCardType); return true; } else if (this.getDuration() == Duration.Custom) { this.discard(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index a47f8d0c77..b4a562073d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -42,7 +42,6 @@ import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; /** - * * @author BetaSteward_at_googlemail.com */ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements SourceEffect { @@ -113,12 +112,8 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if (losePreviousTypes) { permanent.getCardType().clear(); } - if (!token.getCardType().isEmpty()) { - for (CardType t : token.getCardType()) { - if (!permanent.getCardType().contains(t)) { - permanent.addCardType(t); - } - } + for (CardType t : token.getCardType()) { + permanent.addCardType(t); } if (type != null && type.isEmpty() || type == null && permanent.isLand()) { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); @@ -137,11 +132,10 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (!token.getAbilities().isEmpty()) { - for (Ability ability : token.getAbilities()) { - permanent.addAbility(ability, source.getSourceId(), game); - } + for (Ability ability : token.getAbilities()) { + permanent.addAbility(ability, source.getSourceId(), game); } + } break; case PTChangingEffects_7: diff --git a/Mage/src/main/java/mage/util/functions/CardTypeApplier.java b/Mage/src/main/java/mage/util/functions/CardTypeApplier.java index 00409a1cf6..a1fa21435a 100644 --- a/Mage/src/main/java/mage/util/functions/CardTypeApplier.java +++ b/Mage/src/main/java/mage/util/functions/CardTypeApplier.java @@ -46,17 +46,13 @@ public class CardTypeApplier extends ApplyToPermanent { @Override public boolean apply(Game game, Permanent permanent) { - if (!permanent.getCardType().contains(cardType)) { permanent.addCardType(cardType); - } return true; } @Override public boolean apply(Game game, MageObject mageObject) { - if (!mageObject.getCardType().contains(cardType)) { mageObject.addCardType(cardType); - } return true; } } From 63df7f65a78e0cbfa602492405b05c26e2c278ce Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Thu, 6 Apr 2017 22:07:59 +0200 Subject: [PATCH 3/4] remove isCreature from CardHelper, move to Cardview --- .../client/deckeditor/table/CardHelper.java | 3 -- .../deckeditor/table/MageCardComparator.java | 7 +++-- .../client/deckeditor/table/TableModel.java | 30 +++++++------------ Mage.Common/src/mage/view/CardView.java | 4 +++ 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index b07fe03c08..e0407e0723 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -77,7 +77,4 @@ public final class CardHelper { return type.toString(); } - public static boolean isCreature(CardView c) { - return c.getCardTypes().contains(CardType.CREATURE); - } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java index 71f67900d9..217aa1e782 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java @@ -26,10 +26,11 @@ */ package mage.client.deckeditor.table; -import java.util.Comparator; import mage.cards.MageCard; import mage.view.CardView; +import java.util.Comparator; + /** * {@link MageCard} comparator. Used to sort cards in Deck Editor Table View * pane. @@ -85,10 +86,10 @@ public class MageCardComparator implements Comparator { case 5: aCom = (float) -1; bCom = (float) -1; - if (CardHelper.isCreature(a)) { + if (a.isCreature()) { aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness())); } - if (CardHelper.isCreature(b)) { + if (b.isCreature()) { bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness())); } break; diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index 31ea45eb34..b1655cd968 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -27,24 +27,6 @@ */ package mage.client.deckeditor.table; -import java.awt.Dimension; -import java.awt.Image; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; -import javax.swing.JTable; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableColumnModel; import mage.client.MageFrame; import mage.client.cards.BigCard; import mage.client.cards.CardEventSource; @@ -64,6 +46,16 @@ import org.jdesktop.swingx.JXPanel; import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.UI; +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableColumnModel; +import java.awt.*; +import java.awt.event.*; +import java.awt.image.BufferedImage; +import java.util.*; +import java.util.List; +import java.util.Map.Entry; + /** * Table Model for card list. * @@ -264,7 +256,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid { case 4: return CardHelper.getType(c); case 5: - return CardHelper.isCreature(c) ? c.getPower() + '/' + return c.isCreature() ? c.getPower() + '/' + c.getToughness() : "-"; case 6: return c.getRarity().toString(); diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index b611d8ae76..c8f14d59c0 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -957,4 +957,8 @@ public class CardView extends SimpleCardView { this.canAttack = canAttack; } + public boolean isCreature(){ + return cardTypes.contains(CardType.CREATURE); + } + } From d60e01d497f1b54dde35d405d7d39ca2bf338c98 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Thu, 6 Apr 2017 22:11:57 +0200 Subject: [PATCH 4/4] move CardHelper::getColor to CardView::getColorText --- .../mage/client/deckeditor/table/CardHelper.java | 13 +------------ .../client/deckeditor/table/MageCardComparator.java | 4 ++-- .../mage/client/deckeditor/table/TableModel.java | 2 +- Mage.Common/src/mage/view/CardView.java | 11 +++++++++++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index e0407e0723..356dafdfd8 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -41,18 +41,7 @@ import mage.view.CardView; public final class CardHelper { private CardHelper() { } - - public static String getColor(CardView c) { - if (c.getColor().getColorCount() == 0) return "Colorless"; - else if (c.getColor().getColorCount() > 1) return "Gold"; - else if (c.getColor().isBlack()) return "Black"; - else if (c.getColor().isBlue()) return "Blue"; - else if (c.getColor().isWhite()) return "White"; - else if (c.getColor().isGreen()) return "Green"; - else if (c.getColor().isRed()) return "Red"; - return ""; - } - + public static String getType(CardView c) { StringBuilder type = new StringBuilder(); for (SuperType superType : c.getSuperTypes()) { diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java index 217aa1e782..b8b145d09d 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java @@ -74,8 +74,8 @@ public class MageCardComparator implements Comparator { break; // Color case 3: - aCom = CardHelper.getColor(a); - bCom = CardHelper.getColor(b); + aCom = a.getColorText(); + bCom = a.getColorText(); break; // Type case 4: diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index b1655cd968..e4f2452900 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -252,7 +252,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid { castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE); return "" + castingCost + ""; case 3: - return CardHelper.getColor(c); + return c.getColorText(); case 4: return CardHelper.getType(c); case 5: diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index c8f14d59c0..e9eba628fa 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -961,4 +961,15 @@ public class CardView extends SimpleCardView { return cardTypes.contains(CardType.CREATURE); } + public String getColorText() { + if (getColor().getColorCount() == 0) return "Colorless"; + else if (getColor().getColorCount() > 1) return "Gold"; + else if (getColor().isBlack()) return "Black"; + else if (getColor().isBlue()) return "Blue"; + else if (getColor().isWhite()) return "White"; + else if (getColor().isGreen()) return "Green"; + else if (getColor().isRed()) return "Red"; + return ""; + } + }