Skip to content

Commit

Permalink
[DSK] Implement Fear of Abduction (#13079)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cguy7777 authored Nov 30, 2024
1 parent ecb5dcc commit aaa6116
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
125 changes: 125 additions & 0 deletions Mage.Sets/src/mage/cards/f/FearOfAbduction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package mage.cards.f;

import java.util.UUID;

import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.costs.common.ExileTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;

/**
* @author Cguy7777
*/
public final class FearOfAbduction extends CardImpl {

public FearOfAbduction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{4}{W}{W}");

this.subtype.add(SubType.NIGHTMARE);
this.power = new MageInt(5);
this.toughness = new MageInt(5);

// As an additional cost to cast this spell, exile a creature you control.
this.getSpellAbility().addCost(
new ExileTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE)));

// Flying
this.addAbility(FlyingAbility.getInstance());

// When Fear of Abduction enters, exile target creature an opponent controls.
Ability ability = new EntersBattlefieldTriggeredAbility(new FearOfAbductionExileEffect());
ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
this.addAbility(ability);

// When Fear of Abduction leaves the battlefield, put each card exiled with it into its owner's hand.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new FearOfAbductionReturnEffect()));
}

private FearOfAbduction(final FearOfAbduction card) {
super(card);
}

@Override
public FearOfAbduction copy() {
return new FearOfAbduction(this);
}
}

class FearOfAbductionExileEffect extends OneShotEffect {

FearOfAbductionExileEffect() {
super(Outcome.Benefit);
this.staticText = "exile target creature an opponent controls";
}

private FearOfAbductionExileEffect(final FearOfAbductionExileEffect effect) {
super(effect);
}

@Override
public FearOfAbductionExileEffect copy() {
return new FearOfAbductionExileEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null) {
return new ExileTargetEffect(
// Offset -1 so that opponent's creature is exiled to the same exile zone as your creature
CardUtil.getExileZoneId(game, source, -1),
CardUtil.getSourceName(game, source))
.apply(game, source);
}
return false;
}
}

class FearOfAbductionReturnEffect extends OneShotEffect {

FearOfAbductionReturnEffect() {
super(Outcome.Neutral);
this.staticText = "put each card exiled with it into its owner's hand";
}

private FearOfAbductionReturnEffect(final FearOfAbductionReturnEffect effect) {
super(effect);
}

@Override
public FearOfAbductionReturnEffect copy() {
return new FearOfAbductionReturnEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
// Offset -2 since Fear of Abduction has left the battlefield since last time
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source, -2));
if (exileZone != null) {
controller.moveCards(exileZone, Zone.HAND, source, game);
}
return true;
}
return false;
}
}
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private DuskmournHouseOfHorror() {
cards.add(new SetCardInfo("Ethereal Armor", 7, Rarity.UNCOMMON, mage.cards.e.EtherealArmor.class));
cards.add(new SetCardInfo("Exorcise", 8, Rarity.UNCOMMON, mage.cards.e.Exorcise.class));
cards.add(new SetCardInfo("Fanatic of the Harrowing", 96, Rarity.COMMON, mage.cards.f.FanaticOfTheHarrowing.class));
cards.add(new SetCardInfo("Fear of Abduction", 9, Rarity.UNCOMMON, mage.cards.f.FearOfAbduction.class));
cards.add(new SetCardInfo("Fear of Being Hunted", 134, Rarity.UNCOMMON, mage.cards.f.FearOfBeingHunted.class));
cards.add(new SetCardInfo("Fear of Burning Alive", 135, Rarity.UNCOMMON, mage.cards.f.FearOfBurningAlive.class));
cards.add(new SetCardInfo("Fear of Exposure", 177, Rarity.UNCOMMON, mage.cards.f.FearOfExposure.class));
Expand Down

0 comments on commit aaa6116

Please sign in to comment.