diff --git a/Mage/src/mage/abilities/AbilitiesImpl.java b/Mage/src/mage/abilities/AbilitiesImpl.java index 3ca3dca985..b5a9163ebd 100644 --- a/Mage/src/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/mage/abilities/AbilitiesImpl.java @@ -71,6 +71,9 @@ public class AbilitiesImpl extends ArrayList implements Ab List rules = new ArrayList(); for (T ability:this) { + if (!ability.getRuleVisible()) { + continue; + } if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) { if (ability.getRuleAtTheTop()) { rules.add(0, ability.getRule()); @@ -304,7 +307,9 @@ public class AbilitiesImpl extends ArrayList implements Ab public String getValue() { List abilities = new ArrayList(); for (T ability: this) { - abilities.add(ability.toString()); + if (ability.toString() != null) { + abilities.add(ability.toString()); + } } Collections.sort(abilities); StringBuilder sb = new StringBuilder(); diff --git a/Mage/src/mage/abilities/Ability.java b/Mage/src/mage/abilities/Ability.java index bd2149aabc..486b220dbd 100644 --- a/Mage/src/mage/abilities/Ability.java +++ b/Mage/src/mage/abilities/Ability.java @@ -375,10 +375,30 @@ public interface Ability extends Controllable, Serializable { /** * Sets the value for the ruleAtTheTop attribute * + * true = show the rule at the top position of the rules + * * @param ruleAtTheTop */ void setRuleAtTheTop(boolean ruleAtTheTop); + /** + * Returns true if this ability's rule is visible on the card tooltip + * + * @return + */ + boolean getRuleVisible(); + + /** + * Sets the value for the ruleVisible attribute + * + * true = rule will be shown for the card / permanent + * false = rule won't be shown + * + * @param ruleAtTheTop + */ + void setRuleVisible(boolean ruleVisible); + + /** * Get the originalId of the ability * diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index 6a430bf88b..cb7dd2f57b 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -77,6 +77,7 @@ public abstract class AbilityImpl> implements Ability { protected String name; protected boolean usesStack = true; protected boolean ruleAtTheTop = false; + protected boolean ruleVisible = true; @Override public abstract T copy(); @@ -111,6 +112,7 @@ public abstract class AbilityImpl> implements Ability { } this.modes = ability.modes.copy(); this.ruleAtTheTop = ability.ruleAtTheTop; + this.ruleVisible = ability.ruleVisible; } @Override @@ -417,7 +419,7 @@ public abstract class AbilityImpl> implements Ability { protected String formatRule(String rule, String source) { String replace = rule; - if (source != null && !source.isEmpty()) { + if (rule != null && source != null && !source.isEmpty()) { replace = rule.replace("{this}", source); replace = replace.replace("{source}", source); } @@ -574,6 +576,17 @@ public abstract class AbilityImpl> implements Ability { this.ruleAtTheTop = ruleAtTheTop; } + @Override + public boolean getRuleVisible() { + return ruleVisible; + } + + @Override + public void setRuleVisible(boolean ruleVisible) { + this.ruleVisible = ruleVisible; + } + + @Override public UUID getOriginalId() { return this.originalId; diff --git a/Mage/src/mage/game/stack/StackAbility.java b/Mage/src/mage/game/stack/StackAbility.java index a1f3535863..fe1ff4968f 100644 --- a/Mage/src/mage/game/stack/StackAbility.java +++ b/Mage/src/mage/game/stack/StackAbility.java @@ -373,6 +373,16 @@ public class StackAbility implements StackObject, Ability { this.ability.setRuleAtTheTop(ruleAtTheTop); } + @Override + public boolean getRuleVisible() { + return this.ability.getRuleVisible(); + } + + @Override + public void setRuleVisible(boolean ruleVisible) { + this.ability.setRuleVisible(ruleVisible); + } + @Override public UUID getOriginalId() { return this.ability.getOriginalId();