fixed Destiny Spinner (missing card hint);

This commit is contained in:
Oleg Agafonov 2020-01-12 07:54:00 +04:00
parent 261172c6ae
commit cff44f1436

View file

@ -5,9 +5,12 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect; import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -54,6 +57,7 @@ public final class DestinySpinner extends CardImpl {
// {3}{G}: Target land you control becomes an X/X Elemental creature with trample and haste until end of turn, where X is the number of enchantments you control. It's still a land. // {3}{G}: Target land you control becomes an X/X Elemental creature with trample and haste until end of turn, where X is the number of enchantments you control. It's still a land.
Ability ability = new SimpleActivatedAbility(new DestinySpinnerEffect(), new ManaCostsImpl("{3}{G}")); Ability ability = new SimpleActivatedAbility(new DestinySpinnerEffect(), new ManaCostsImpl("{3}{G}"));
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND)); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
ability.addHint(new ValueHint("Enchantments you control", DestinySpinnerCount.instance));
this.addAbility(ability); this.addAbility(ability);
} }
@ -67,6 +71,30 @@ public final class DestinySpinner extends CardImpl {
} }
} }
enum DestinySpinnerCount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game.getBattlefield().countAll(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, sourceAbility.getControllerId(), game);
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "";
}
}
class DestinySpinnerEffect extends OneShotEffect { class DestinySpinnerEffect extends OneShotEffect {
DestinySpinnerEffect() { DestinySpinnerEffect() {
@ -86,7 +114,7 @@ class DestinySpinnerEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int pt = game.getBattlefield().countAll(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, source.getControllerId(), game); int pt = DestinySpinnerCount.instance.calculate(game, source, this);
game.addEffect(new BecomesCreatureTargetEffect( game.addEffect(new BecomesCreatureTargetEffect(
new CreatureToken(pt, pt, "") new CreatureToken(pt, pt, "")
.withSubType(SubType.ELEMENTAL) .withSubType(SubType.ELEMENTAL)