[CMR] Implemented Emberwilde Captain

This commit is contained in:
Evan Kranzler 2020-10-29 21:33:18 -04:00
parent f76910b827
commit 6fdc244085
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,107 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BecomesMonarchSourceEffect;
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.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EmberwildeCaptain extends CardImpl {
public EmberwildeCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.DJINN);
this.subtype.add(SubType.PIRATE);
this.power = new MageInt(4);
this.toughness = new MageInt(2);
// When Emberwilde Captain enters the battlefield, you become the monarch.
this.addAbility(new EntersBattlefieldTriggeredAbility(new BecomesMonarchSourceEffect()));
// Whenever an opponent attacks you while you're the monarch, Emberwilde Captain deals damage to that player equal to the number of cards in their hand.
this.addAbility(new EmberwildeCaptainTriggeredAbility());
}
private EmberwildeCaptain(final EmberwildeCaptain card) {
super(card);
}
@Override
public EmberwildeCaptain copy() {
return new EmberwildeCaptain(this);
}
}
class EmberwildeCaptainTriggeredAbility extends TriggeredAbilityImpl {
public EmberwildeCaptainTriggeredAbility() {
super(Zone.BATTLEFIELD, new EmberwildeCaptainEffect(), false);
}
public EmberwildeCaptainTriggeredAbility(final EmberwildeCaptainTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getCombat().getDefenders().contains(getControllerId())
&& getSourceId().equals(game.getMonarchId());
}
@Override
public String getRule() {
return "Whenever an opponent attacks you while you're the monarch, " +
"{this} deals damage to that player equal to the number of cards in their hand.";
}
@Override
public EmberwildeCaptainTriggeredAbility copy() {
return new EmberwildeCaptainTriggeredAbility(this);
}
}
class EmberwildeCaptainEffect extends OneShotEffect {
EmberwildeCaptainEffect() {
super(Outcome.Benefit);
}
private EmberwildeCaptainEffect(final EmberwildeCaptainEffect effect) {
super(effect);
}
@Override
public EmberwildeCaptainEffect copy() {
return new EmberwildeCaptainEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
if (player == null || player.getHand().size() < 1) {
return false;
}
return player.damage(player.getHand().size(), source.getSourceId(), game) > 0;
}
}

View file

@ -45,6 +45,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Court of Cunning", 63, Rarity.RARE, mage.cards.c.CourtOfCunning.class));
cards.add(new SetCardInfo("Demonic Lore", 118, Rarity.UNCOMMON, mage.cards.d.DemonicLore.class));
cards.add(new SetCardInfo("Dragon Mantle", 174, Rarity.COMMON, mage.cards.d.DragonMantle.class));
cards.add(new SetCardInfo("Emberwilde Captain", 175, Rarity.RARE, mage.cards.e.EmberwildeCaptain.class));
cards.add(new SetCardInfo("Entourage of Trest", 224, Rarity.COMMON, mage.cards.e.EntourageOfTrest.class));
cards.add(new SetCardInfo("Exquisite Huntmaster", 122, Rarity.COMMON, mage.cards.e.ExquisiteHuntmaster.class));
cards.add(new SetCardInfo("Eyeblight Cullers", 124, Rarity.COMMON, mage.cards.e.EyeblightCullers.class));