Implemented Peer into the Abyss

This commit is contained in:
Evan Kranzler 2020-06-06 15:07:40 -04:00
parent 154a620604
commit 55fc950a3f
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,65 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PeerIntoTheAbyss extends CardImpl {
public PeerIntoTheAbyss(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}{B}");
// Target player draws cards equal to half the number of cards in their library and loses half their life. Round up each time.
this.getSpellAbility().addEffect(new PeerIntoTheAbyssEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
private PeerIntoTheAbyss(final PeerIntoTheAbyss card) {
super(card);
}
@Override
public PeerIntoTheAbyss copy() {
return new PeerIntoTheAbyss(this);
}
}
class PeerIntoTheAbyssEffect extends OneShotEffect {
PeerIntoTheAbyssEffect() {
super(Outcome.Benefit);
staticText = "Target player draws cards equal to half the number of cards in their library " +
"and loses half their life. Round up each time.";
}
private PeerIntoTheAbyssEffect(final PeerIntoTheAbyssEffect effect) {
super(effect);
}
@Override
public PeerIntoTheAbyssEffect copy() {
return new PeerIntoTheAbyssEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.drawCards((int) Math.ceil(player.getLibrary().size() / 2), source.getSourceId(), game);
player.loseLife((int) Math.ceil(player.getLife() / 2), game, false);
return true;
}
}

View file

@ -47,6 +47,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Mangara, the Diplomat", 27, Rarity.MYTHIC, mage.cards.m.MangaraTheDiplomat.class));
cards.add(new SetCardInfo("Mystic Skyfish", 326, Rarity.COMMON, mage.cards.m.MysticSkyfish.class));
cards.add(new SetCardInfo("Pack Leader", 29, Rarity.RARE, mage.cards.p.PackLeader.class));
cards.add(new SetCardInfo("Peer into the Abyss", 117, Rarity.RARE, mage.cards.p.PeerIntoTheAbyss.class));
cards.add(new SetCardInfo("Quirion Dryad", 198, Rarity.UNCOMMON, mage.cards.q.QuirionDryad.class));
cards.add(new SetCardInfo("Rain of Revelation", 61, Rarity.UNCOMMON, mage.cards.r.RainOfRevelation.class));
cards.add(new SetCardInfo("Runed Halo", 32, Rarity.RARE, mage.cards.r.RunedHalo.class));