Added hint for Sphere of Safety. Closes
@@ -5,7 +5,10 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
+import mage.abilities.dynamicvalue.DynamicValue;
+import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.CantAttackYouUnlessPayManaAllEffect;
+import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@@ -26,8 +29,12 @@ public final class SphereOfSafety extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{W}");
// Creatures can't attack you or a planeswalker you control unless their controller pays {X} for each of those creatures, where X is the number of enchantments you control.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SphereOfSafetyPayManaToAttackAllEffect()));
-
+ Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new SphereOfSafetyPayManaToAttackAllEffect());
+ ability.addHint(new ValueHint(
+ NumberOfEnchantmentsYouControl.instance.getMessage(),
+ NumberOfEnchantmentsYouControl.instance)
+ );
+ this.addAbility(ability);
}
private SphereOfSafety(final SphereOfSafety card) {
@@ -54,7 +61,7 @@ class SphereOfSafetyPayManaToAttackAllEffect extends CantAttackYouUnlessPayManaA
@Override
public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) {
- int enchantments = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_ENCHANTMENT, source.getControllerId(), game);
+ int enchantments = NumberOfEnchantmentsYouControl.instance.calculate(game, source, this);
if (enchantments > 0) {
return new ManaCostsImpl<>("{" + enchantments + '}');
}
@@ -67,3 +74,27 @@ class SphereOfSafetyPayManaToAttackAllEffect extends CantAttackYouUnlessPayManaA
}
}
+
+enum NumberOfEnchantmentsYouControl implements DynamicValue {
+ instance;
+
+ @Override
+ public int calculate(Game game, Ability sourceAbility, Effect effect) {
+ return game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_ENCHANTMENT, sourceAbility.getControllerId(), game);
+ }
+
+ @Override
+ public NumberOfEnchantmentsYouControl copy() {
+ return instance;
+ }
+
+ @Override
+ public String toString() {
+ return "X";
+ }
+
+ @Override
+ public String getMessage() {
+ return "Number of enchantments controlled by controller";
+ }
+}
\ No newline at end of file
