forked from External/mage
[OTJ] Implement Lively Dirge
This commit is contained in:
parent
20865c4c3e
commit
7afff5d229
2 changed files with 118 additions and 0 deletions
117
Mage.Sets/src/mage/cards/l/LivelyDirge.java
Normal file
117
Mage.Sets/src/mage/cards/l/LivelyDirge.java
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect;
|
||||
import mage.abilities.keyword.SpreeAbility;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class LivelyDirge extends CardImpl {
|
||||
|
||||
public LivelyDirge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||
|
||||
// Spree
|
||||
this.addAbility(new SpreeAbility(this));
|
||||
|
||||
// + {1} -- Search your library for a card, put it into your graveyard, then shuffle.
|
||||
this.getSpellAbility().addEffect(new SearchLibraryPutInGraveyardEffect());
|
||||
this.getSpellAbility().withFirstModeCost(new GenericManaCost(1));
|
||||
|
||||
// + {2} -- Return up to two creature cards with total mana value 4 or less from your graveyard to the battlefield.
|
||||
this.getSpellAbility().addMode(new Mode(new LivelyDirgeEffect()).withCost(new GenericManaCost(2)));
|
||||
}
|
||||
|
||||
private LivelyDirge(final LivelyDirge card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivelyDirge copy() {
|
||||
return new LivelyDirge(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LivelyDirgeEffect extends OneShotEffect {
|
||||
|
||||
LivelyDirgeEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return up to two creature cards with total mana value 4 or less from your graveyard to the battlefield";
|
||||
}
|
||||
|
||||
private LivelyDirgeEffect(final LivelyDirgeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivelyDirgeEffect copy() {
|
||||
return new LivelyDirgeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCard targetCard = new LivelyDirgeTarget();
|
||||
player.choose(outcome, targetCard, source, game);
|
||||
Cards cards = new CardsImpl(targetCard.getTargets());
|
||||
return player.moveCards(cards, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
|
||||
class LivelyDirgeTarget extends TargetCardInYourGraveyard {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterCreatureCard("creature cards with total mana value 4 or less from your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 5));
|
||||
}
|
||||
|
||||
LivelyDirgeTarget() {
|
||||
super(0, 2, filter, true);
|
||||
}
|
||||
|
||||
private LivelyDirgeTarget(final LivelyDirgeTarget target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivelyDirgeTarget copy() {
|
||||
return new LivelyDirgeTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(controllerId, id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(id);
|
||||
return card != null &&
|
||||
this.getTargets()
|
||||
.stream()
|
||||
.map(game::getCard)
|
||||
.mapToInt(Card::getManaValue)
|
||||
.sum() + card.getManaValue() <= 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -123,6 +123,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Lassoed by the Law", 18, Rarity.UNCOMMON, mage.cards.l.LassoedByTheLaw.class));
|
||||
cards.add(new SetCardInfo("Lavaspur Boots", 243, Rarity.UNCOMMON, mage.cards.l.LavaspurBoots.class));
|
||||
cards.add(new SetCardInfo("Lilah, Undefeated Slickshot", 217, Rarity.RARE, mage.cards.l.LilahUndefeatedSlickshot.class));
|
||||
cards.add(new SetCardInfo("Lively Dirge", 93, Rarity.UNCOMMON, mage.cards.l.LivelyDirge.class));
|
||||
cards.add(new SetCardInfo("Loan Shark", 55, Rarity.COMMON, mage.cards.l.LoanShark.class));
|
||||
cards.add(new SetCardInfo("Lonely Arroyo", 260, Rarity.COMMON, mage.cards.l.LonelyArroyo.class));
|
||||
cards.add(new SetCardInfo("Longhorn Sharpshooter", 132, Rarity.UNCOMMON, mage.cards.l.LonghornSharpshooter.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue