Implemented Underworld Sentinel

This commit is contained in:
Evan Kranzler 2019-12-20 17:00:25 -05:00
parent 0a8a9ed00d
commit e453b2ad4f
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.u;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
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.StaticFilters;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UnderworldSentinel extends CardImpl {
public UnderworldSentinel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.SKELETON);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// Whenever Underworld Sentinel attacks, exile target creature card from your graveyard.
Ability ability = new AttacksTriggeredAbility(new ExileTargetForSourceEffect(), false);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
this.addAbility(ability);
// When Underworld Sentinel dies, put all cards exiled with it onto the battlefield.
this.addAbility(new DiesTriggeredAbility(new UnderworldSentinelEffect()));
}
private UnderworldSentinel(final UnderworldSentinel card) {
super(card);
}
@Override
public UnderworldSentinel copy() {
return new UnderworldSentinel(this);
}
}
class UnderworldSentinelEffect extends OneShotEffect {
UnderworldSentinelEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "put all cards exiled with it onto the battlefield";
}
private UnderworldSentinelEffect(final UnderworldSentinelEffect effect) {
super(effect);
}
@Override
public UnderworldSentinelEffect copy() {
return new UnderworldSentinelEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
ExileZone exileZone = game.getExile().getExileZone(
CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())
);
return exileZone != null && controller.moveCards(exileZone, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -57,6 +57,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Terror of Mount Velus", 295, Rarity.RARE, mage.cards.t.TerrorOfMountVelus.class));
cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class));
cards.add(new SetCardInfo("Treeshaker Chimera", 297, Rarity.RARE, mage.cards.t.TreeshakerChimera.class));
cards.add(new SetCardInfo("Underworld Sentinel", 293, Rarity.COMMON, mage.cards.u.UnderworldSentinel.class));
cards.add(new SetCardInfo("Victory's Envoy", 289, Rarity.COMMON, mage.cards.v.VictorysEnvoy.class));
}
}