Implemented Gravebreaker Lamia.

This commit is contained in:
LevelX2 2020-01-12 11:29:43 +01:00
parent fe0717cbc7
commit 7d3f17d578
5 changed files with 133 additions and 4 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.SearchEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.other.CastFromZonePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public final class GravebreakerLamia extends CardImpl {
public GravebreakerLamia(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{4}{B}");
this.subtype.add(SubType.SNAKE);
this.subtype.add(SubType.LAMIA);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// When Gravebreaker Lamia enters the battlefield, search your library for a card, put it into your graveyard, then shuffle your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GravebreakerLamiaSearchEffect(), false));
// Spells you cast from your graveyard cost {1} less to cast.
FilterCard filter = new FilterCard("Spells you cast from your graveyard");
filter.add(new CastFromZonePredicate(Zone.GRAVEYARD));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1)));
}
private GravebreakerLamia(final GravebreakerLamia card) {
super(card);
}
@Override
public GravebreakerLamia copy() {
return new GravebreakerLamia(this);
}
}
class GravebreakerLamiaSearchEffect extends SearchEffect {
GravebreakerLamiaSearchEffect() {
super(new TargetCardInLibrary(), Outcome.Neutral);
staticText = "search your library for a card, put it into your graveyard, then shuffle your library";
}
private GravebreakerLamiaSearchEffect(final GravebreakerLamiaSearchEffect effect) {
super(effect);
}
@Override
public GravebreakerLamiaSearchEffect copy() {
return new GravebreakerLamiaSearchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
}

View file

@ -1,5 +1,6 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
@ -24,8 +25,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
@ -54,7 +53,7 @@ public final class ThassaDeepDwelling extends CardImpl {
// At the beginning of your end step, exile up to one other target creature you control, then return that card to the battlefield under your control.
Ability ability = new BeginningOfEndStepTriggeredAbility(
new ExileTargetForSourceEffect().setText("exile up to one other target creature you control,"),
new ExileTargetForSourceEffect().setText("exile up to one other target creature you control, then "),
TargetController.YOU, false
);
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true));

View file

@ -107,6 +107,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Glimpse of Freedom", 50, Rarity.UNCOMMON, mage.cards.g.GlimpseOfFreedom.class));
cards.add(new SetCardInfo("Glory Bearers", 17, Rarity.COMMON, mage.cards.g.GloryBearers.class));
cards.add(new SetCardInfo("Grasping Giant", 288, Rarity.RARE, mage.cards.g.GraspingGiant.class));
cards.add(new SetCardInfo("Gravebreaker Lamia", 98, Rarity.RARE, mage.cards.g.GravebreakerLamia.class));
cards.add(new SetCardInfo("Gray Merchant of Asphodel", 99, Rarity.UNCOMMON, mage.cards.g.GrayMerchantOfAsphodel.class));
cards.add(new SetCardInfo("Grim Physician", 100, Rarity.COMMON, mage.cards.g.GrimPhysician.class));
cards.add(new SetCardInfo("Haktos the Unscarred", 218, Rarity.RARE, mage.cards.h.HaktosTheUnscarred.class));

View file

@ -55,7 +55,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
this.filter = filter;
this.amount = amount;
this.upTo = upTo;
this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast";
this.staticText = (filter.getMessage().contains("you cast") ? filter.getMessage() : filter.getMessage() + " you cast")
+ " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast";
}
protected SpellsCostReductionControllerEffect(final SpellsCostReductionControllerEffect effect) {

View file

@ -0,0 +1,39 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.filter.predicate.other;
import mage.cards.Card;
import mage.constants.Zone;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.stack.Spell;
/**
*
* @author LevelX2
*/
public class CastFromZonePredicate implements Predicate<Card> {
private final Zone zone;
public CastFromZonePredicate(Zone zone) {
this.zone = zone;
}
@Override
public boolean apply(Card input, Game game) {
if (input instanceof Spell) {
return zone.match(((Spell) input).getFromZone());
} else {
return zone.match(game.getState().getZone(input.getId()));
}
}
@Override
public String toString() {
return "Spells you cast from your " + zone.toString();
}
}