Implemented Netherborn Altar

This commit is contained in:
Evan Kranzler 2020-04-04 18:04:07 -04:00
parent 5fc1f96bab
commit 14a33f11aa
3 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.n;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PutCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.CommanderCardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class NetherbornAltar extends CardImpl {
public NetherbornAltar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{B}");
// {T}, Put a soul counter on Netherborn Altar: Put your commander into your hand from the command zone. Then you lose 3 life for each soul counter on Netherborn Altar.
Ability ability = new SimpleActivatedAbility(new NetherbornAltarEffect(), new TapSourceCost());
ability.addCost(new PutCountersSourceCost(CounterType.SOUL.createInstance()));
this.addAbility(ability);
}
private NetherbornAltar(final NetherbornAltar card) {
super(card);
}
@Override
public NetherbornAltar copy() {
return new NetherbornAltar(this);
}
}
class NetherbornAltarEffect extends OneShotEffect {
NetherbornAltarEffect() {
super(Outcome.Benefit);
staticText = "Put your commander into your hand from the command zone. Then you lose 3 life for each soul counter on {this}.";
}
private NetherbornAltarEffect(final NetherbornAltarEffect effect) {
super(effect);
}
@Override
public NetherbornAltarEffect copy() {
return new NetherbornAltarEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
List<Card> commandersInCommandZone = game
.getCommandersIds(controller, CommanderCardType.COMMANDER_OR_OATHBREAKER)
.stream()
.map(game::getCard)
.filter(Objects::nonNull)
.filter(commander -> game.getState().getZone(commander.getId()) == Zone.COMMAND)
.collect(Collectors.toList());
if (commandersInCommandZone.size() == 1) {
controller.moveCards(commandersInCommandZone.get(0), Zone.HAND, source, game);
} else if (commandersInCommandZone.size() == 2) {
Card firstCommander = commandersInCommandZone.get(0);
Card secondCommander = commandersInCommandZone.get(1);
if (controller.chooseUse(Outcome.ReturnToHand, "Return which commander to hand?", null, firstCommander.getName(), secondCommander.getName(), source, game)) {
controller.moveCards(firstCommander, Zone.HAND, source, game);
} else {
controller.moveCards(secondCommander, Zone.HAND, source, game);
}
}
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
int counterCount = permanent.getCounters(game).getCount(CounterType.SOUL);
controller.loseLife(3 * counterCount, game, false);
}
return true;
}
}

View file

@ -25,6 +25,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Crop Rotation", 169, Rarity.COMMON, mage.cards.c.CropRotation.class));
cards.add(new SetCardInfo("Curious Herd", 59, Rarity.RARE, mage.cards.c.CuriousHerd.class));
cards.add(new SetCardInfo("Lifecrafter's Bestiary", 244, Rarity.RARE, mage.cards.l.LifecraftersBestiary.class));
cards.add(new SetCardInfo("Netherborn Altar", 45, Rarity.RARE, mage.cards.n.NetherbornAltar.class));
cards.add(new SetCardInfo("Rashmi, Eternities Crafter", 229, Rarity.RARE, mage.cards.r.RashmiEternitiesCrafter.class));
cards.add(new SetCardInfo("Shared Animosity", 158, Rarity.RARE, mage.cards.s.SharedAnimosity.class));
}

View file

@ -127,6 +127,7 @@ public enum CounterType {
SLIME("slime"),
SLUMBER("slumber"),
SOOT("soot"),
SOUL("soul"),
SPITE("spite"),
SPORE("spore"),
STORAGE("storage"),