mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Implemented Call of the Death-Dweller
This commit is contained in:
parent
1a26f57222
commit
2004c50ab0
2 changed files with 147 additions and 0 deletions
146
Mage.Sets/src/mage/cards/c/CallOfTheDeathDweller.java
Normal file
146
Mage.Sets/src/mage/cards/c/CallOfTheDeathDweller.java
Normal file
|
@ -0,0 +1,146 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageItem;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CallOfTheDeathDweller extends CardImpl {
|
||||
|
||||
public CallOfTheDeathDweller(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
|
||||
|
||||
// Return up to two target creature cards with total converted mana cost 3 or less from your graveyard to the battlefield. Put a deathtouch counter on either of them. Then put a menace counter on either of them.
|
||||
this.getSpellAbility().addEffect(new CallOfTheDeathDwellerEffect());
|
||||
this.getSpellAbility().addTarget(new CallOfTheDeathDwellerTarget());
|
||||
}
|
||||
|
||||
private CallOfTheDeathDweller(final CallOfTheDeathDweller card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallOfTheDeathDweller copy() {
|
||||
return new CallOfTheDeathDweller(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CallOfTheDeathDwellerEffect extends OneShotEffect {
|
||||
|
||||
CallOfTheDeathDwellerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Return up to two target creature cards with total converted mana cost 3 or less " +
|
||||
"from your graveyard to the battlefield. Put a deathtouch counter on either of them. " +
|
||||
"Then put a menace counter on either of them.";
|
||||
}
|
||||
|
||||
private CallOfTheDeathDwellerEffect(final CallOfTheDeathDwellerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallOfTheDeathDwellerEffect copy() {
|
||||
return new CallOfTheDeathDwellerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Cards cards = new CardsImpl(
|
||||
source.getTargets()
|
||||
.stream()
|
||||
.map(Target::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
if (player == null || cards.isEmpty()
|
||||
|| !player.moveCards(cards, Zone.BATTLEFIELD, source, game)) {
|
||||
return false;
|
||||
}
|
||||
List<PermanentIdPredicate> predicates = cards
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.map(MageItem::getId)
|
||||
.map(PermanentIdPredicate::new)
|
||||
.collect(Collectors.toList());
|
||||
if (predicates.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent("creature to put a menace counter on");
|
||||
filter.add(Predicates.or(predicates));
|
||||
Target target = new TargetPermanent(0, 1, filter, true);
|
||||
if (player.choose(outcome, target, source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.MENACE.createInstance(), source, game);
|
||||
}
|
||||
}
|
||||
target.clearChosen();
|
||||
filter.setMessage("creature to put a deathtouch counter on");
|
||||
if (player.choose(outcome, target, source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.DEATHTOUCH.createInstance(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class CallOfTheDeathDwellerTarget extends TargetCardInYourGraveyard {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterCreatureCard("creature cards with total converted mana cost 3 or less from your graveyard");
|
||||
|
||||
CallOfTheDeathDwellerTarget() {
|
||||
super(0, 2, filter, false);
|
||||
}
|
||||
|
||||
private CallOfTheDeathDwellerTarget(final CallOfTheDeathDwellerTarget target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallOfTheDeathDwellerTarget copy() {
|
||||
return new CallOfTheDeathDwellerTarget(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::getConvertedManaCost)
|
||||
.sum() + card.getConvertedManaCost() <= 3;
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Blood Curdle", 75, Rarity.COMMON, mage.cards.b.BloodCurdle.class));
|
||||
cards.add(new SetCardInfo("Boon of the Wish-Giver", 43, Rarity.UNCOMMON, mage.cards.b.BoonOfTheWishGiver.class));
|
||||
cards.add(new SetCardInfo("Bristling Boar", 146, Rarity.COMMON, mage.cards.b.BristlingBoar.class));
|
||||
cards.add(new SetCardInfo("Call of the Death-Dweller", 78, Rarity.UNCOMMON, mage.cards.c.CallOfTheDeathDweller.class));
|
||||
cards.add(new SetCardInfo("Cavern Whisperer", 79, Rarity.COMMON, mage.cards.c.CavernWhisperer.class));
|
||||
cards.add(new SetCardInfo("Chittering Harvester", 80, Rarity.UNCOMMON, mage.cards.c.ChitteringHarvester.class));
|
||||
cards.add(new SetCardInfo("Cloudpiercer", 112, Rarity.COMMON, mage.cards.c.Cloudpiercer.class));
|
||||
|
|
Loading…
Reference in a new issue