[MID] Implement Old Stickfingers

This commit is contained in:
ciaccona007 2021-09-15 14:03:22 -04:00 committed by ciaccona007
parent e72f13c0e9
commit e19abadee4
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.o;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.*;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author ciaccona007
*/
public final class OldStickfingers extends CardImpl {
public OldStickfingers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{B}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HORROR);
// When you cast this spell, reveal cards from the top of your library until you reveal X creature cards. Put all the creature cards revealed this way into your graveyard and the rest on the bottom of your library in a random order.
this.addAbility(new CastSourceTriggeredAbility(new OldStickfingersEffect()));
// Old Stickfingers' power and toughness are equal to the number of creature cards in your graveyard.
DynamicValue value = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(value, Duration.EndOfGame)));
}
private OldStickfingers(final OldStickfingers card) {
super(card);
}
@Override
public OldStickfingers copy() {
return new OldStickfingers(this);
}
}
class OldStickfingersEffect extends OneShotEffect {
public OldStickfingersEffect() {
super(Outcome.Discard);
this.staticText = "reveal cards from the top of your library until you reveal X creature cards. Put all the creature cards revealed this way into your graveyard and the rest on the bottom of your library in a random order";
}
public OldStickfingersEffect(final OldStickfingersEffect effect) {
super(effect);
}
@Override
public OldStickfingersEffect copy() {
return new OldStickfingersEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Object obj = getValue(CastSourceTriggeredAbility.SOURCE_CAST_SPELL_ABILITY);
if (!(obj instanceof SpellAbility)) {
return false;
}
int xValue = ((SpellAbility) obj).getManaCostsToPay().getX();
if (xValue < 1) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
Cards revealed = new CardsImpl();
Cards otherCards = new CardsImpl();
Set<Card> creatureCards = new LinkedHashSet<>();
for (Card card : controller.getLibrary().getCards(game)) {
revealed.add(card);
if (card.isCreature(game)) {
creatureCards.add(card);
if(creatureCards.size() == xValue) {
break;
}
} else {
otherCards.add(card);
}
}
controller.revealCards(source, revealed, game);
controller.moveCards(creatureCards, Zone.GRAVEYARD, source, game);
controller.putCardsOnBottomOfLibrary(otherCards, game, source, false);
return true;
}
}

View file

@ -218,6 +218,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Novice Occultist", 117, Rarity.COMMON, mage.cards.n.NoviceOccultist.class)); cards.add(new SetCardInfo("Novice Occultist", 117, Rarity.COMMON, mage.cards.n.NoviceOccultist.class));
cards.add(new SetCardInfo("Obsessive Astronomer", 152, Rarity.UNCOMMON, mage.cards.o.ObsessiveAstronomer.class)); cards.add(new SetCardInfo("Obsessive Astronomer", 152, Rarity.UNCOMMON, mage.cards.o.ObsessiveAstronomer.class));
cards.add(new SetCardInfo("Odric's Outrider", 29, Rarity.UNCOMMON, mage.cards.o.OdricsOutrider.class)); cards.add(new SetCardInfo("Odric's Outrider", 29, Rarity.UNCOMMON, mage.cards.o.OdricsOutrider.class));
cards.add(new SetCardInfo("Old Stickfingers", 234, Rarity.RARE, mage.cards.o.OldStickfingers.class));
cards.add(new SetCardInfo("Olivia's Midnight Ambush", 118, Rarity.COMMON, mage.cards.o.OliviasMidnightAmbush.class)); cards.add(new SetCardInfo("Olivia's Midnight Ambush", 118, Rarity.COMMON, mage.cards.o.OliviasMidnightAmbush.class));
cards.add(new SetCardInfo("Ominous Roost", 65, Rarity.UNCOMMON, mage.cards.o.OminousRoost.class)); cards.add(new SetCardInfo("Ominous Roost", 65, Rarity.UNCOMMON, mage.cards.o.OminousRoost.class));
cards.add(new SetCardInfo("Organ Hoarder", 66, Rarity.COMMON, mage.cards.o.OrganHoarder.class)); cards.add(new SetCardInfo("Organ Hoarder", 66, Rarity.COMMON, mage.cards.o.OrganHoarder.class));