* Icon of Ancestry - some fixes to PR#6509 (fixes #6333).

This commit is contained in:
LevelX2 2020-06-14 19:22:17 +02:00
parent cd27ee4ac3
commit b5127fdce2

View file

@ -1,10 +1,13 @@
package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
@ -14,10 +17,6 @@ import mage.constants.*;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.game.Game;
/**
@ -44,10 +43,10 @@ public final class IconOfAncestry extends CardImpl {
new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)
));
// {3}, {T}: Look at the top three cards of your library. You may reveal a creature card of the
// {3}, {T}: Look at the top three cards of your library. You may reveal a creature card of the
// chosen type from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
FilterCreatureCard filter2 = new FilterCreatureCard("creature card that matches the chosen subtype");
Ability ability = new SimpleActivatedAbility(new IconOfAncestryEffect(filter2), new ManaCostsImpl("{3}"));
Ability ability = new SimpleActivatedAbility(new IconOfAncestryEffect(filter2), new GenericManaCost(3));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
@ -63,6 +62,7 @@ public final class IconOfAncestry extends CardImpl {
}
class IconOfAncestryEffect extends LookLibraryAndPickControllerEffect {
public IconOfAncestryEffect(FilterCreatureCard filter) {
super(StaticValue.get(3), false, StaticValue.get(1), filter, Zone.LIBRARY, false,
true, false, Zone.HAND, true, false, false);
@ -75,7 +75,19 @@ class IconOfAncestryEffect extends LookLibraryAndPickControllerEffect {
SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type");
if (subtype != null) {
filter.add(subtype.getPredicate());
filter.setMessage("creature card of subtype " + subtype.toString());
} else {
return false;
}
return super.apply(game, source);
}
}
public IconOfAncestryEffect(final IconOfAncestryEffect effect) {
super(effect);
}
@Override
public IconOfAncestryEffect copy() {
return new IconOfAncestryEffect(this);
}
}