mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[CMR] Implemented Ghost of Ramirez DePietro
This commit is contained in:
parent
f20b130391
commit
64a49712b2
4 changed files with 122 additions and 0 deletions
117
Mage.Sets/src/mage/cards/g/GhostOfRamirezDePietro.java
Normal file
117
Mage.Sets/src/mage/cards/g/GhostOfRamirezDePietro.java
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
package mage.cards.g;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleEvasionAbility;
|
||||||
|
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||||
|
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
|
||||||
|
import mage.abilities.keyword.PartnerAbility;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.Predicate;
|
||||||
|
import mage.filter.predicate.mageobject.ToughnessPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.target.common.TargetCardInGraveyard;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class GhostOfRamirezDePietro extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCreaturePermanent filter
|
||||||
|
= new FilterCreaturePermanent("creatures with toughness 3 or greater");
|
||||||
|
private static final FilterCard filter2
|
||||||
|
= new FilterCard("card in any graveyard that has been discarded or milled this turn");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 2));
|
||||||
|
filter2.add(GhostOfRamirezDePietroPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GhostOfRamirezDePietro(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
|
||||||
|
|
||||||
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.PIRATE);
|
||||||
|
this.subtype.add(SubType.SPIRIT);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Ghost of Ramirez DePietro can't be blocked by creatures with toughness 3 or greater.
|
||||||
|
this.addAbility(new SimpleEvasionAbility(
|
||||||
|
new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Whenever Ghost of Ramirez DePietro deals combat damage to a player, choose up to one target card in any graveyard that has been discarded or milled this turn. Put that card into its owner's hand.
|
||||||
|
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||||
|
new ReturnFromGraveyardToHandTargetEffect()
|
||||||
|
.setText("choose up to one target card in any graveyard that has been discarded " +
|
||||||
|
"or milled this turn. Put that card into its owner's hand"),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
ability.addTarget(new TargetCardInGraveyard(filter2));
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// Partner
|
||||||
|
this.addAbility(PartnerAbility.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
private GhostOfRamirezDePietro(final GhostOfRamirezDePietro card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GhostOfRamirezDePietro copy() {
|
||||||
|
return new GhostOfRamirezDePietro(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GhostOfRamirezDePietroPredicate implements Predicate<Card> {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Card input, Game game) {
|
||||||
|
GhostOfRamirezDePietroWatcher watcher = game.getState().getWatcher(GhostOfRamirezDePietroWatcher.class);
|
||||||
|
return watcher != null && watcher.checkCard(input, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GhostOfRamirezDePietroWatcher extends Watcher {
|
||||||
|
|
||||||
|
private final Set<MageObjectReference> morSet = new HashSet<>();
|
||||||
|
|
||||||
|
GhostOfRamirezDePietroWatcher() {
|
||||||
|
super(WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() == GameEvent.EventType.DISCARDED_CARD
|
||||||
|
|| event.getType() == GameEvent.EventType.MILLED_CARD) {
|
||||||
|
morSet.add(new MageObjectReference(event.getTargetId(), game));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
morSet.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean checkCard(Card card, Game game) {
|
||||||
|
return morSet.stream().anyMatch(mor -> mor.refersTo(card, game));
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ public final class CommanderLegends extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Farhaven Elf", 225, Rarity.COMMON, mage.cards.f.FarhavenElf.class));
|
cards.add(new SetCardInfo("Farhaven Elf", 225, Rarity.COMMON, mage.cards.f.FarhavenElf.class));
|
||||||
cards.add(new SetCardInfo("Forceful Denial", 69, Rarity.COMMON, mage.cards.f.ForcefulDenial.class));
|
cards.add(new SetCardInfo("Forceful Denial", 69, Rarity.COMMON, mage.cards.f.ForcefulDenial.class));
|
||||||
cards.add(new SetCardInfo("Fyndhorn Elves", 228, Rarity.COMMON, mage.cards.f.FyndhornElves.class));
|
cards.add(new SetCardInfo("Fyndhorn Elves", 228, Rarity.COMMON, mage.cards.f.FyndhornElves.class));
|
||||||
|
cards.add(new SetCardInfo("Ghost of Ramirez DePietro", 71, Rarity.UNCOMMON, mage.cards.g.GhostOfRamirezDePietro.class));
|
||||||
cards.add(new SetCardInfo("Halana, Kessig Ranger", 231, Rarity.UNCOMMON, mage.cards.h.HalanaKessigRanger.class));
|
cards.add(new SetCardInfo("Halana, Kessig Ranger", 231, Rarity.UNCOMMON, mage.cards.h.HalanaKessigRanger.class));
|
||||||
cards.add(new SetCardInfo("Horizon Scholar", 73, Rarity.UNCOMMON, mage.cards.h.HorizonScholar.class));
|
cards.add(new SetCardInfo("Horizon Scholar", 73, Rarity.UNCOMMON, mage.cards.h.HorizonScholar.class));
|
||||||
cards.add(new SetCardInfo("Ikra Shidiqi, the Usurper", 519, Rarity.MYTHIC, mage.cards.i.IkraShidiqiTheUsurper.class));
|
cards.add(new SetCardInfo("Ikra Shidiqi, the Usurper", 519, Rarity.MYTHIC, mage.cards.i.IkraShidiqiTheUsurper.class));
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class GameEvent implements Serializable {
|
||||||
CLASH, CLASHED,
|
CLASH, CLASHED,
|
||||||
DAMAGE_PLAYER,
|
DAMAGE_PLAYER,
|
||||||
MILL_CARDS,
|
MILL_CARDS,
|
||||||
|
MILLED_CARD,
|
||||||
/* DAMAGED_PLAYER
|
/* DAMAGED_PLAYER
|
||||||
targetId the id of the damaged player
|
targetId the id of the damaged player
|
||||||
sourceId sourceId of the ability which caused the damage
|
sourceId sourceId of the ability which caused the damage
|
||||||
|
|
|
@ -4414,6 +4414,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
Cards cards = new CardsImpl(this.getLibrary().getTopCards(game, event.getAmount()));
|
Cards cards = new CardsImpl(this.getLibrary().getTopCards(game, event.getAmount()));
|
||||||
this.moveCards(cards, Zone.GRAVEYARD, source, game);
|
this.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||||
|
for (Card card : cards.getCards(game)) {
|
||||||
|
game.fireEvent(GameEvent.getEvent(EventType.MILLED_CARD, card.getId(), source.getSourceId(), getId()));
|
||||||
|
}
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue