mirror of
https://github.com/correl/mage.git
synced 2024-12-28 11:14:13 +00:00
[VOW] Implemented Cemetery Prowler
This commit is contained in:
parent
f4774c1bd4
commit
d97d15edc9
2 changed files with 143 additions and 0 deletions
142
Mage.Sets/src/mage/cards/c/CemeteryProwler.java
Normal file
142
Mage.Sets/src/mage/cards/c/CemeteryProwler.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.*;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class CemeteryProwler extends CardImpl {
|
||||
|
||||
public CemeteryProwler(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
|
||||
|
||||
this.subtype.add(SubType.WOLF);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Vigilance
|
||||
this.addAbility(VigilanceAbility.getInstance());
|
||||
|
||||
// Whenever Cemetery Prowler enters the battlefield or attacks, exile a card from a graveyard.
|
||||
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new CemeteryProwlerExileEffect()));
|
||||
|
||||
// Spells you cast cost {1} less to cast for each card type they share with cards exiled with Cemetery Prowler.
|
||||
this.addAbility(new SimpleStaticAbility(new CemeteryProwlerCostReductionEffect()));
|
||||
}
|
||||
|
||||
private CemeteryProwler(final CemeteryProwler card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CemeteryProwler copy() {
|
||||
return new CemeteryProwler(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CemeteryProwlerExileEffect extends OneShotEffect {
|
||||
|
||||
public CemeteryProwlerExileEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "exile a card from a graveyard";
|
||||
}
|
||||
|
||||
private CemeteryProwlerExileEffect(final CemeteryProwlerExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CemeteryProwlerExileEffect copy() {
|
||||
return new CemeteryProwlerExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
TargetCardInGraveyard target = new TargetCardInGraveyard();
|
||||
target.setNotTarget(true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
String exileName = sourceObject == null ? null : sourceObject.getIdName();
|
||||
return controller.moveCardsToExile(card, source, game, true, exileId, exileName);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CemeteryProwlerCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
public CemeteryProwlerCostReductionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "Spells you cast cost {1} less to cast for each card type they share with cards exiled with {this}";
|
||||
}
|
||||
|
||||
private CemeteryProwlerCostReductionEffect(final CemeteryProwlerCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CemeteryProwlerCostReductionEffect copy() {
|
||||
return new CemeteryProwlerCostReductionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
// sourceObjectZoneChangeCounter is not working here. Getting it from GameState works.
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()));
|
||||
ExileZone exileZone = game.getExile().getExileZone(exileId);
|
||||
Card castCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
|
||||
if (exileZone != null && castCard != null) {
|
||||
HashSet<CardType> cardTypes = new HashSet<>();
|
||||
for (UUID cardId : exileZone) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
cardTypes.addAll(card.getCardType(game));
|
||||
}
|
||||
}
|
||||
int sharedTypes = 0;
|
||||
for (CardType type : castCard.getCardType(game)) {
|
||||
if (cardTypes.contains(type)) {
|
||||
sharedTypes++;
|
||||
}
|
||||
}
|
||||
if (sharedTypes > 0) {
|
||||
CardUtil.reduceCost(abilityToModify, sharedTypes);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility && abilityToModify.isControlledBy(source.getControllerId());
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bramble Wurm", 189, Rarity.UNCOMMON, mage.cards.b.BrambleWurm.class));
|
||||
cards.add(new SetCardInfo("By Invitation Only", 5, Rarity.RARE, mage.cards.b.ByInvitationOnly.class));
|
||||
cards.add(new SetCardInfo("Cemetery Protector", 6, Rarity.MYTHIC, mage.cards.c.CemeteryProtector.class));
|
||||
cards.add(new SetCardInfo("Cemetery Prowler", 191, Rarity.MYTHIC, mage.cards.c.CemeteryProwler.class));
|
||||
cards.add(new SetCardInfo("Change of Fortune", 150, Rarity.RARE, mage.cards.c.ChangeOfFortune.class));
|
||||
cards.add(new SetCardInfo("Clever Distraction", 9, Rarity.UNCOMMON, mage.cards.c.CleverDistraction.class));
|
||||
cards.add(new SetCardInfo("Cloaked Cadet", 192, Rarity.UNCOMMON, mage.cards.c.CloakedCadet.class));
|
||||
|
|
Loading…
Reference in a new issue