Implemented Misers' Cage

This commit is contained in:
Evan Kranzler 2018-06-03 17:45:18 -04:00
parent c9e0598270
commit 0dc14603f6
4 changed files with 99 additions and 16 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.e;
import java.util.UUID;
@ -22,13 +21,12 @@ import mage.target.targetpointer.FixedTarget;
public final class EbonyOwlNetsuke extends CardImpl {
public EbonyOwlNetsuke(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// At the beginning of each opponent's upkeep, if that player has seven or more cards in hand, Ebony Owl Netsuke deals 4 damage to him or her.
this.addAbility(new EbonyOwlNetsukeTriggeredAbility(new DamageTargetEffect(4, true)));
this.addAbility(new EbonyOwlNetsukeTriggeredAbility());
}
public EbonyOwlNetsuke(final EbonyOwlNetsuke card) {
super(card);
}
@ -40,15 +38,15 @@ public final class EbonyOwlNetsuke extends CardImpl {
}
class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl {
EbonyOwlNetsukeTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
EbonyOwlNetsukeTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(4), false);
}
EbonyOwlNetsukeTriggeredAbility(final EbonyOwlNetsukeTriggeredAbility ability) {
super(ability);
}
@Override
public EbonyOwlNetsukeTriggeredAbility copy() {
return new EbonyOwlNetsukeTriggeredAbility(this);
@ -58,29 +56,29 @@ class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
for (Effect effect: getEffects() ) {
effect.setTargetPointer(new FixedTarget(player.getId()));
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId(), game));
}
return true;
}
}
return false;
}
@Override
public boolean checkInterveningIfClause(Game game) {
Player player = game.getPlayer(game.getActivePlayerId());
return player != null && player.getHand().size() >= 7;
}
}
@Override
public String getRule() {
return "At the beginning of each opponent's upkeep, if that player has seven or more cards in hand, {this} deals 4 damage to him or her.";
return "At the beginning of each opponent's upkeep, if that player has seven or more cards in hand, {this} deals 4 damage to that player";
}
}

View file

@ -0,0 +1,83 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class MisersCage extends CardImpl {
public MisersCage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// At the beginning of each opponent's upkeep, if that player has five or more cards in hand, Misers' Cage deals 2 damage to him or her.
this.addAbility(new MisersCageTriggeredAbility());
}
public MisersCage(final MisersCage card) {
super(card);
}
@Override
public MisersCage copy() {
return new MisersCage(this);
}
}
class MisersCageTriggeredAbility extends TriggeredAbilityImpl {
MisersCageTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2), false);
}
MisersCageTriggeredAbility(final MisersCageTriggeredAbility ability) {
super(ability);
}
@Override
public MisersCageTriggeredAbility copy() {
return new MisersCageTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId(), game));
}
return true;
}
}
return false;
}
@Override
public boolean checkInterveningIfClause(Game game) {
Player player = game.getPlayer(game.getActivePlayerId());
return player != null && player.getHand().size() >= 5;
}
@Override
public String getRule() {
return "at the beginning of each opponents upkeep, if that player has five or more cards in hand, {this} deals 2 damage to that player";
}
}

View file

@ -33,6 +33,7 @@ public final class PyricSalamander extends CardImpl {
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(
new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect())
).setText("Sacrifice {this} at the beginning of the next end step"));
this.addAbility(ability);
}
public PyricSalamander(final PyricSalamander card) {

View file

@ -185,6 +185,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Merfolk Seer", 76, Rarity.COMMON, mage.cards.m.MerfolkSeer.class));
cards.add(new SetCardInfo("Mind Harness", 78, Rarity.UNCOMMON, mage.cards.m.MindHarness.class));
cards.add(new SetCardInfo("Mire Shade", 131, Rarity.UNCOMMON, mage.cards.m.MireShade.class));
cards.add(new SetCardInfo("Misers' Cage", 276, Rarity.RARE, mage.cards.m.MisersCage.class));
cards.add(new SetCardInfo("Mist Dragon", 79, Rarity.RARE, mage.cards.m.MistDragon.class));
cards.add(new SetCardInfo("Moss Diamond", 312, Rarity.UNCOMMON, mage.cards.m.MossDiamond.class));
cards.add(new SetCardInfo("Mountain Valley", 328, Rarity.UNCOMMON, mage.cards.m.MountainValley.class));