Updated menace and explore abilities to show or hide description

This commit is contained in:
Oleg Agafonov 2018-01-07 03:46:07 +04:00
parent 096d020c94
commit 70e99e185b
3 changed files with 61 additions and 5 deletions

View file

@ -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. <i>(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.)</i>";
// "it explores. <i>(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.)</i>";
private static final String RULE_TEXT_START = "explores.";
private static final String RULE_TEXT_HINT = "<i>(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.)</i>";
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

View file

@ -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) {

View file

@ -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 <i>(This creature can't be blocked except by two or more creatures.)</i>";
String res = "Menace";
if (this.showAbilityHint) {
res += " <i>(This creature can't be blocked except by two or more creatures.)</i>";
}
return res;
}
}