From 70e99e185b85015074343787444208eee8ad61a2 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 7 Jan 2018 03:46:07 +0400 Subject: [PATCH] Updated menace and explore abilities to show or hide description --- .../effects/keyword/ExploreSourceEffect.java | 46 +++++++++++++++++-- .../effects/keyword/ExploreTargetEffect.java | 6 ++- .../mage/abilities/keyword/MenaceAbility.java | 14 +++++- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java index 06030eb1a18..e8cc65a629d 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreSourceEffect.java @@ -43,19 +43,59 @@ import mage.players.Player; /** * - * @author TheElk801 + * @author TheElk801, JayDi85 */ public class ExploreSourceEffect extends OneShotEffect { - public static final String RULE_TEXT = "it explores. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on this creature, then put the card back or put it into your graveyard.)"; + // "it explores. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on this creature, then put the card back or put it into your graveyard.)"; + private static final String RULE_TEXT_START = "explores."; + private static final String RULE_TEXT_HINT = "(Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on this creature, then put the card back or put it into your graveyard.)"; + + public static String getRuleText(boolean showAbilityHint) { + return getRuleText(showAbilityHint, null); + } + public static String getRuleText(boolean showAbilityHint, String whosExplores) { + + String res = whosExplores; + if(res == null){ res = "it"; } + + res += " " + RULE_TEXT_START; + + if (showAbilityHint) { + res += " " + RULE_TEXT_HINT; + } + return res; + } + + private String sourceName = "it"; + private boolean showAbilityHint = true; public ExploreSourceEffect() { + this(true); + } + + public ExploreSourceEffect(boolean showAbilityHint) { + this(showAbilityHint, null); + } + + public ExploreSourceEffect(boolean showAbilityHint, String whosExplores) { super(Outcome.Benefit); - this.staticText = RULE_TEXT; + + if(whosExplores != null) { + this.sourceName = whosExplores; + } + setText(); } public ExploreSourceEffect(final ExploreSourceEffect effect) { super(effect); + this.showAbilityHint = effect.showAbilityHint; + this.sourceName = effect.sourceName; + setText(); + } + + private void setText(){ + this.staticText = getRuleText(this.showAbilityHint, this.sourceName); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreTargetEffect.java index 8c204656f94..160c78ec059 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ExploreTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ExploreTargetEffect.java @@ -39,8 +39,12 @@ import mage.game.Game; public class ExploreTargetEffect extends OneShotEffect { public ExploreTargetEffect() { + this(true); + } + + public ExploreTargetEffect(boolean showAbilityHint) { super(Outcome.Benefit); - this.staticText = ExploreSourceEffect.RULE_TEXT; + this.staticText = ExploreSourceEffect.getRuleText(showAbilityHint); } public ExploreTargetEffect(final ExploreTargetEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/keyword/MenaceAbility.java b/Mage/src/main/java/mage/abilities/keyword/MenaceAbility.java index 22654b647ba..4359a51a2a4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MenaceAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MenaceAbility.java @@ -16,12 +16,20 @@ import mage.constants.Zone; */ public class MenaceAbility extends StaticAbility { // Menace may not be a Singleton because the source ability is needed in the continuous effect + private boolean showAbilityHint = true; + public MenaceAbility() { + this(true); + } + + public MenaceAbility(boolean showAbilityHint) { super(Zone.BATTLEFIELD, new CantBeBlockedByOneEffect(2)); + this.showAbilityHint = showAbilityHint; } public MenaceAbility(final MenaceAbility ability) { super(ability); + this.showAbilityHint = ability.showAbilityHint; } @Override @@ -31,7 +39,11 @@ public class MenaceAbility extends StaticAbility { // Menace may not be a Single @Override public String getRule() { - return "Menace (This creature can't be blocked except by two or more creatures.)"; + String res = "Menace"; + if (this.showAbilityHint) { + res += " (This creature can't be blocked except by two or more creatures.)"; + } + return res; } }