mirror of
https://github.com/correl/mage.git
synced 2025-01-12 03:00:13 +00:00
Implemented Etrata, the Silencer
This commit is contained in:
parent
214a527ae0
commit
ce0b647a36
4 changed files with 156 additions and 5 deletions
151
Mage.Sets/src/mage/cards/e/EtrataTheSilencer.java
Normal file
151
Mage.Sets/src/mage/cards/e/EtrataTheSilencer.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.CantBeBlockedSourceAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EtrataTheSilencer extends CardImpl {
|
||||
|
||||
public EtrataTheSilencer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.VAMPIRE);
|
||||
this.subtype.add(SubType.ASSASSIN);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Etrata, the Silencer can't be blocked.
|
||||
this.addAbility(new CantBeBlockedSourceAbility());
|
||||
|
||||
// Whenever Etrata deals combat damage to a player, exile target creature that player controls and put a hit counter on that card. That player loses the game if they own three or more exiled card with hit counters on them. Etrata's owner shuffles Etrata into their library.
|
||||
this.addAbility(new EtrataTheSilencerTriggeredAbility());
|
||||
}
|
||||
|
||||
public EtrataTheSilencer(final EtrataTheSilencer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtrataTheSilencer copy() {
|
||||
return new EtrataTheSilencer(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EtrataTheSilencerTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public EtrataTheSilencerTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new EtrataTheSilencerEffect());
|
||||
}
|
||||
|
||||
public EtrataTheSilencerTriggeredAbility(final EtrataTheSilencerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtrataTheSilencerTriggeredAbility copy() {
|
||||
return new EtrataTheSilencerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
if (opponent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
|
||||
filter.add(new ControllerIdPredicate(opponent.getId()));
|
||||
this.getTargets().clear();
|
||||
this.addTarget(new TargetCreaturePermanent(filter));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} deals combat damage to a player, "
|
||||
+ "exile target creature that player controls "
|
||||
+ "and put a hit counter on that card. "
|
||||
+ "That player loses the game if they own three or more "
|
||||
+ "exiled cards with hit counters on them. "
|
||||
+ "{this}'s owner shuffles {this} into their library.";
|
||||
}
|
||||
}
|
||||
|
||||
class EtrataTheSilencerEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
|
||||
static {
|
||||
filter.add(new CounterPredicate(CounterType.HIT));
|
||||
}
|
||||
|
||||
public EtrataTheSilencerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
||||
public EtrataTheSilencerEffect(final EtrataTheSilencerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtrataTheSilencerEffect copy() {
|
||||
return new EtrataTheSilencerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(creature.getControllerId());
|
||||
if (controller == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
controller.moveCards(creature, Zone.EXILED, source, game);
|
||||
Card card = game.getCard(source.getFirstTarget());
|
||||
if (card != null) {
|
||||
card.addCounters(CounterType.HIT.createInstance(), source, game);
|
||||
}
|
||||
if (game.getExile().getExileZone(player.getId()).count(filter, game) > 2) {
|
||||
player.lost(game);
|
||||
}
|
||||
return new ShuffleIntoLibrarySourceEffect().apply(game, source);
|
||||
}
|
||||
}
|
|
@ -72,6 +72,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class));
|
||||
cards.add(new SetCardInfo("Enhanced Surveillance", 40, Rarity.UNCOMMON, mage.cards.e.EnhancedSurveillance.class));
|
||||
cards.add(new SetCardInfo("Erratic Cyclops", 98, Rarity.RARE, mage.cards.e.ErraticCyclops.class));
|
||||
cards.add(new SetCardInfo("Etrata, the Silencer", 170, Rarity.RARE, mage.cards.e.EtrataTheSilencer.class));
|
||||
cards.add(new SetCardInfo("Expansion // Explosion", 224, Rarity.RARE, mage.cards.e.ExpansionExplosion.class));
|
||||
cards.add(new SetCardInfo("Find // Finality", 225, Rarity.RARE, mage.cards.f.FindFinality.class));
|
||||
cards.add(new SetCardInfo("Firemind's Research", 171, Rarity.RARE, mage.cards.f.FiremindsResearch.class));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.counters;
|
||||
|
||||
/**
|
||||
|
@ -54,6 +53,7 @@ public enum CounterType {
|
|||
GROWTH("growth"),
|
||||
HATCHLING("hatchling"),
|
||||
HEALING("healing"),
|
||||
HIT("hit"),
|
||||
HOOFPRINT("hoofprint"),
|
||||
HOUR("hour"),
|
||||
HOURGLASS("hourglass"),
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class CounterPredicate implements Predicate<Permanent> {
|
||||
public class CounterPredicate implements Predicate<Card> {
|
||||
|
||||
private final CounterType counter;
|
||||
|
||||
|
@ -23,7 +22,7 @@ public class CounterPredicate implements Predicate<Permanent> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
public boolean apply(Card input, Game game) {
|
||||
if (counter == null) {
|
||||
return !input.getCounters(game).keySet().isEmpty();
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue