mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[DSK] Implement Paranormal Analyst
This commit is contained in:
parent
96a75d1a0e
commit
dc849bea4a
5 changed files with 155 additions and 0 deletions
119
Mage.Sets/src/mage/cards/p/ParanormalAnalyst.java
Normal file
119
Mage.Sets/src/mage/cards/p/ParanormalAnalyst.java
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.*;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.ManifestedDreadEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetCard;
|
||||||
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
import mage.target.targetpointer.FixedTargets;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ParanormalAnalyst extends CardImpl {
|
||||||
|
|
||||||
|
public ParanormalAnalyst(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.subtype.add(SubType.DETECTIVE);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Whenever you manifest dread, put a card you put into your graveyard this way into your hand.
|
||||||
|
this.addAbility(new ParanormalAnalystTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ParanormalAnalyst(final ParanormalAnalyst card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParanormalAnalyst copy() {
|
||||||
|
return new ParanormalAnalyst(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParanormalAnalystTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
ParanormalAnalystTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new ParanormalAnalystEffect());
|
||||||
|
setTriggerPhrase("Whenever you manifest dread, ");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ParanormalAnalystTriggeredAbility(final ParanormalAnalystTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParanormalAnalystTriggeredAbility copy() {
|
||||||
|
return new ParanormalAnalystTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.MANIFESTED_DREAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (!isControlledBy(event.getPlayerId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.getEffects().setTargetPointer(new FixedTargets(((ManifestedDreadEvent) event).getGraveyardCards()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParanormalAnalystEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
ParanormalAnalystEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "put a card you put into your graveyard this way into your hand";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ParanormalAnalystEffect(final ParanormalAnalystEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParanormalAnalystEffect copy() {
|
||||||
|
return new ParanormalAnalystEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||||
|
cards.retainZone(Zone.GRAVEYARD, game);
|
||||||
|
Card card;
|
||||||
|
switch (cards.size()) {
|
||||||
|
case 0:
|
||||||
|
return false;
|
||||||
|
case 1:
|
||||||
|
card = cards.getRandom(game);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
TargetCard target = new TargetCardInYourGraveyard();
|
||||||
|
target.withNotTarget(true);
|
||||||
|
player.choose(outcome, cards, target, source, game);
|
||||||
|
card = game.getCard(target.getFirstTarget());
|
||||||
|
}
|
||||||
|
return player.moveCards(card, Zone.HAND, source, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -131,6 +131,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Overlord of the Floodpits", 68, Rarity.MYTHIC, mage.cards.o.OverlordOfTheFloodpits.class));
|
cards.add(new SetCardInfo("Overlord of the Floodpits", 68, Rarity.MYTHIC, mage.cards.o.OverlordOfTheFloodpits.class));
|
||||||
cards.add(new SetCardInfo("Overlord of the Hauntwoods", 194, Rarity.MYTHIC, mage.cards.o.OverlordOfTheHauntwoods.class));
|
cards.add(new SetCardInfo("Overlord of the Hauntwoods", 194, Rarity.MYTHIC, mage.cards.o.OverlordOfTheHauntwoods.class));
|
||||||
cards.add(new SetCardInfo("Overlord of the Mistmoors", 23, Rarity.MYTHIC, mage.cards.o.OverlordOfTheMistmoors.class));
|
cards.add(new SetCardInfo("Overlord of the Mistmoors", 23, Rarity.MYTHIC, mage.cards.o.OverlordOfTheMistmoors.class));
|
||||||
|
cards.add(new SetCardInfo("Paranormal Analyst", 69, Rarity.UNCOMMON, mage.cards.p.ParanormalAnalyst.class));
|
||||||
cards.add(new SetCardInfo("Patched Plaything", 24, Rarity.UNCOMMON, mage.cards.p.PatchedPlaything.class));
|
cards.add(new SetCardInfo("Patched Plaything", 24, Rarity.UNCOMMON, mage.cards.p.PatchedPlaything.class));
|
||||||
cards.add(new SetCardInfo("Patchwork Beastie", 195, Rarity.UNCOMMON, mage.cards.p.PatchworkBeastie.class));
|
cards.add(new SetCardInfo("Patchwork Beastie", 195, Rarity.UNCOMMON, mage.cards.p.PatchworkBeastie.class));
|
||||||
cards.add(new SetCardInfo("Peculiar Lighthouse", 265, Rarity.COMMON, mage.cards.p.PeculiarLighthouse.class));
|
cards.add(new SetCardInfo("Peculiar Lighthouse", 265, Rarity.COMMON, mage.cards.p.PeculiarLighthouse.class));
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import mage.cards.CardsImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.events.ManifestedDreadEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
@ -65,6 +66,8 @@ public class ManifestDreadEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
cards.retainZone(Zone.LIBRARY, game);
|
cards.retainZone(Zone.LIBRARY, game);
|
||||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||||
|
cards.retainZone(Zone.GRAVEYARD, game);
|
||||||
|
game.fireEvent(new ManifestedDreadEvent(permanent, source, player.getId(), cards, game));
|
||||||
return permanent;
|
return permanent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -478,6 +478,7 @@ public class GameEvent implements Serializable {
|
||||||
PHASE_IN, PHASED_IN,
|
PHASE_IN, PHASED_IN,
|
||||||
TURN_FACE_UP, TURNED_FACE_UP,
|
TURN_FACE_UP, TURNED_FACE_UP,
|
||||||
TURN_FACE_DOWN, TURNED_FACE_DOWN,
|
TURN_FACE_DOWN, TURNED_FACE_DOWN,
|
||||||
|
MANIFESTED_DREAD,
|
||||||
/* OPTION_USED
|
/* OPTION_USED
|
||||||
targetId originalId of the ability that triggered the event
|
targetId originalId of the ability that triggered the event
|
||||||
sourceId sourceId of the ability that triggered the event
|
sourceId sourceId of the ability that triggered the event
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package mage.game.events;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class ManifestedDreadEvent extends GameEvent {
|
||||||
|
|
||||||
|
private final List<MageObjectReference> graveyardCards = new ArrayList<>();
|
||||||
|
|
||||||
|
public ManifestedDreadEvent(Permanent permanent, Ability source, UUID playerId, Cards cards, Game game) {
|
||||||
|
super(EventType.MANIFESTED_DREAD, permanent == null ? null : permanent.getId(), source, playerId);
|
||||||
|
cards.getCards(game)
|
||||||
|
.stream()
|
||||||
|
.map(card -> new MageObjectReference(card, game))
|
||||||
|
.forEach(graveyardCards::add);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MageObjectReference> getGraveyardCards() {
|
||||||
|
return graveyardCards;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue