[DSC] Implement Into the Pit

This commit is contained in:
theelk801 2025-04-30 11:07:05 -04:00
parent efc95e1636
commit 253f6c10e4
3 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,101 @@
package mage.cards.i;
import mage.MageIdentifier;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class IntoThePit extends CardImpl {
public IntoThePit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
// You may look at the top card of your library any time.
this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect()));
// You may cast spells from the top of your library by sacrificing a nonland permanent in addition to paying their other costs.
this.addAbility(new SimpleStaticAbility(new IntoThePitEffect())
.setIdentifier(MageIdentifier.IntoThePitAlternateCast));
}
private IntoThePit(final IntoThePit card) {
super(card);
}
@Override
public IntoThePit copy() {
return new IntoThePit(this);
}
}
class IntoThePitEffect extends AsThoughEffectImpl {
IntoThePitEffect() {
super(AsThoughEffectType.CAST_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.AIDontUseIt);
staticText = "you may cast spells from the top of your library by sacrificing " +
"a nonland permanent in addition to paying their other costs";
}
private IntoThePitEffect(final IntoThePitEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public IntoThePitEffect copy() {
return new IntoThePitEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card cardToCheck = game.getCard(objectId);
if (cardToCheck == null
|| !source.isControlledBy(affectedControllerId)
|| !cardToCheck.isOwnedBy(affectedControllerId)) {
return false;
}
Player player = game.getPlayer(cardToCheck.getOwnerId());
if (player == null) {
return false;
}
Card topCard = player.getLibrary().getFromTop(game);
if (topCard == null
|| !topCard.getId().equals(cardToCheck.getMainCard().getId())
|| cardToCheck.isLand(game)) {
return false;
}
Costs<Cost> newCosts = new CostsImpl<>();
newCosts.add(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT_NON_LAND));
newCosts.addAll(cardToCheck.getSpellAbility().getCosts());
player.setCastSourceIdWithAlternateMana(
cardToCheck.getId(), cardToCheck.getManaCost(), newCosts,
MageIdentifier.IntoThePitAlternateCast
);
return true;
}
}

View file

@ -148,6 +148,7 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet {
cards.add(new SetCardInfo("Infernal Grasp", 143, Rarity.UNCOMMON, mage.cards.i.InfernalGrasp.class));
cards.add(new SetCardInfo("Inkshield", 221, Rarity.RARE, mage.cards.i.Inkshield.class));
cards.add(new SetCardInfo("Inscription of Abundance", 186, Rarity.RARE, mage.cards.i.InscriptionOfAbundance.class));
cards.add(new SetCardInfo("Into the Pit", 20, Rarity.RARE, mage.cards.i.IntoThePit.class));
cards.add(new SetCardInfo("Ishkanah, Grafwidow", 187, Rarity.MYTHIC, mage.cards.i.IshkanahGrafwidow.class));
cards.add(new SetCardInfo("Jungle Hollow", 285, Rarity.COMMON, mage.cards.j.JungleHollow.class));
cards.add(new SetCardInfo("Kaervek the Merciless", 222, Rarity.RARE, mage.cards.k.KaervekTheMerciless.class));

View file

@ -60,6 +60,7 @@ public enum MageIdentifier {
DemonicEmbraceAlternateCast,
FalcoSparaPactweaverAlternateCast,
HelbruteAlternateCast,
IntoThePitAlternateCast,
MaestrosAscendencyAlternateCast,
NashiMoonSagesScionAlternateCast,
OsteomancerAdeptAlternateCast,