[ECL] Implement Gathering Stone (#14222)

This commit is contained in:
Muz 2026-01-10 12:42:26 -06:00 committed by GitHub
parent 763d975f18
commit 345eda08a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 113 additions and 0 deletions

View file

@ -0,0 +1,112 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionAllOfChosenSubtypeEffect;
import mage.abilities.meta.OrTriggeredAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author muz
*/
public final class GatheringStone extends CardImpl {
public GatheringStone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// As this artifact enters, choose a creature type.
this.addAbility(new AsEntersBattlefieldAbility(
new ChooseCreatureTypeEffect(Outcome.Benefit)
));
// Spells you cast of the chosen type cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(
new SpellsCostReductionAllOfChosenSubtypeEffect(
new FilterCreatureCard("Creature spells you cast of the chosen type"), 1, true
)
));
// When this artifact enters and at the beginning of your upkeep, look at the top card of your library.
// If it's a card of the chosen type, you may reveal it and put it into your hand.
// If you don't put the card into your hand, you may put it into your graveyard.
this.addAbility(new OrTriggeredAbility(
Zone.BATTLEFIELD,
new GatheringStoneEffect(),
false,
"When this artifact enters and at the beginning of your upkeep, ",
new EntersBattlefieldTriggeredAbility(null),
new BeginningOfUpkeepTriggeredAbility(null)
));
}
private GatheringStone(final GatheringStone card) {
super(card);
}
@Override
public GatheringStone copy() {
return new GatheringStone(this);
}
}
class GatheringStoneEffect extends OneShotEffect {
GatheringStoneEffect() {
super(Outcome.Benefit);
staticText = "look at the top card of your library. " +
"If it's a card of the chosen type, you may reveal it and put it into your hand. " +
"If you don't put the card into your hand, you may put it into your graveyard";
}
private GatheringStoneEffect(final GatheringStoneEffect effect) {
super(effect);
}
@Override
public GatheringStoneEffect copy() {
return new GatheringStoneEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card topCard = controller.getLibrary().getFromTop(game);
if (topCard == null) {
return false;
}
SubType subtype = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
controller.lookAtCards("Top card of library", topCard, game);
if (topCard.hasSubtype(subtype, game)) {
if (controller.chooseUse(Outcome.DrawCard, "Reveal " + topCard.getName() + " and put it into your hand?", source, game)) {
controller.revealCards(source, new CardsImpl(topCard), game);
controller.moveCards(topCard, Zone.HAND, source, game);
return true;
}
}
if (controller.chooseUse(Outcome.Neutral, "Put " + topCard.getName() + " into your graveyard?", source, game)) {
controller.moveCards(topCard, Zone.GRAVEYARD, source, game);
}
return true;
}
}

View file

@ -141,6 +141,7 @@ public final class LorwynEclipsed extends ExpansionSet {
cards.add(new SetCardInfo("Formidable Speaker", 366, Rarity.RARE, mage.cards.f.FormidableSpeaker.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Gallant Fowlknight", 17, Rarity.COMMON, mage.cards.g.GallantFowlknight.class));
cards.add(new SetCardInfo("Gangly Stompling", 226, Rarity.COMMON, mage.cards.g.GanglyStompling.class));
cards.add(new SetCardInfo("Gathering Stone", 257, Rarity.UNCOMMON, mage.cards.g.GatheringStone.class));
cards.add(new SetCardInfo("Giantfall", 141, Rarity.UNCOMMON, mage.cards.g.Giantfall.class));
cards.add(new SetCardInfo("Gilt-Leaf's Embrace", 177, Rarity.COMMON, mage.cards.g.GiltLeafsEmbrace.class));
cards.add(new SetCardInfo("Glamer Gifter", 49, Rarity.UNCOMMON, mage.cards.g.GlamerGifter.class));