[MID] updated Teferi, Who Slows the Sunset emblem

This commit is contained in:
Evan Kranzler 2021-09-22 09:39:21 -04:00
parent aec68ac9d5
commit 4ab41a5b12
7 changed files with 120 additions and 38 deletions

View file

@ -3714,6 +3714,16 @@ public class TestPlayer implements Player {
return computerPlayer.canPlayCardsFromGraveyard(); return computerPlayer.canPlayCardsFromGraveyard();
} }
@Override
public void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn) {
computerPlayer.setDrawsOnOpponentsTurn(drawsOnOpponentsTurn);
}
@Override
public boolean isDrawsOnOpponentsTurn() {
return computerPlayer.isDrawsOnOpponentsTurn();
}
@Override @Override
public void setPayManaMode(boolean payManaMode) { public void setPayManaMode(boolean payManaMode) {
computerPlayer.setPayManaMode(payManaMode); computerPlayer.setPayManaMode(payManaMode);

View file

@ -236,6 +236,16 @@ public class PlayerStub implements Player {
return false; return false;
} }
@Override
public void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn) {
}
@Override
public boolean isDrawsOnOpponentsTurn() {
return false;
}
@Override @Override
public List<AlternativeSourceCosts> getAlternativeSourceCosts() { public List<AlternativeSourceCosts> getAlternativeSourceCosts() {
return null; return null;

View file

@ -317,6 +317,12 @@ public final class StaticFilters {
FILTER_CONTROLLED_A_PERMANENT.setLockedFilter(true); FILTER_CONTROLLED_A_PERMANENT.setLockedFilter(true);
} }
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENTS = new FilterControlledPermanent("permanents you control");
static {
FILTER_CONTROLLED_PERMANENTS.setLockedFilter(true);
}
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_SHORT_TEXT = new FilterControlledPermanent("permanent"); public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_SHORT_TEXT = new FilterControlledPermanent("permanent");
static { static {

View file

@ -1,19 +1,49 @@
package mage.game.command.emblems; package mage.game.command.emblems;
import mage.abilities.common.BeginningOfDrawTriggeredAbility; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.UntapAllDuringEachOtherPlayersUntapStepEffect; import mage.abilities.effects.common.continuous.UntapAllDuringEachOtherPlayersUntapStepEffect;
import mage.constants.TargetController; import mage.constants.*;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent; import mage.game.Game;
import mage.game.command.Emblem; import mage.game.command.Emblem;
import mage.players.Player;
public class TeferiWhoSlowsTheSunsetEmblem extends Emblem { public class TeferiWhoSlowsTheSunsetEmblem extends Emblem {
// You get an emblem with "Untap all permanents you control during each opponent's untap step" and "You draw a card during each opponent's draw step." // You get an emblem with "Untap all permanents you control during each opponent's untap step" and "You draw a card during each opponent's draw step."
public TeferiWhoSlowsTheSunsetEmblem() { public TeferiWhoSlowsTheSunsetEmblem() {
this.setName("Emblem Teferi"); this.setName("Emblem Teferi");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new UntapAllDuringEachOtherPlayersUntapStepEffect(new FilterControlledPermanent("permanents you control")))); this.getAbilities().add(new SimpleStaticAbility(
this.getAbilities().add(new BeginningOfDrawTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(1), TargetController.OPPONENT, false)); Zone.COMMAND, new UntapAllDuringEachOtherPlayersUntapStepEffect(StaticFilters.FILTER_CONTROLLED_PERMANENTS)
));
this.getAbilities().add(new SimpleStaticAbility(new TeferiWhoSlowsTheSunsetEmblemEffect()));
}
}
class TeferiWhoSlowsTheSunsetEmblemEffect extends ContinuousEffectImpl {
TeferiWhoSlowsTheSunsetEmblemEffect() {
super(Duration.EndOfGame, Layer.RulesEffects, SubLayer.NA, Outcome.Benefit);
staticText = "you draw a card during each opponent's draw step";
}
private TeferiWhoSlowsTheSunsetEmblemEffect(final TeferiWhoSlowsTheSunsetEmblemEffect effect) {
super(effect);
}
@Override
public TeferiWhoSlowsTheSunsetEmblemEffect copy() {
return new TeferiWhoSlowsTheSunsetEmblemEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.setDrawsOnOpponentsTurn(true);
return true;
} }
} }

View file

@ -29,6 +29,14 @@ public class DrawStep extends Step {
//20091005 - 504.1/703.4c //20091005 - 504.1/703.4c
activePlayer.drawCards(1, null, game); activePlayer.drawCards(1, null, game);
game.applyEffects(); game.applyEffects();
for (UUID playerId : game.getState().getPlayersInRange(activePlayerId, game)) {
Player player = game.getPlayer(playerId);
if (player != null
&& player.isDrawsOnOpponentsTurn()
&& player.hasOpponent(activePlayerId, game)) {
player.drawCards(1, null, game);
}
}
super.beginStep(game, activePlayerId); super.beginStep(game, activePlayerId);
} }

View file

@ -178,6 +178,10 @@ public interface Player extends MageItem, Copyable<Player> {
boolean canPlayCardsFromGraveyard(); boolean canPlayCardsFromGraveyard();
void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn);
boolean isDrawsOnOpponentsTurn();
/** /**
* Returns alternative casting costs a player can cast spells for * Returns alternative casting costs a player can cast spells for
* *

View file

@ -138,6 +138,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean canPayLifeCost = true; protected boolean canPayLifeCost = true;
protected boolean loseByZeroOrLessLife = true; protected boolean loseByZeroOrLessLife = true;
protected boolean canPlayCardsFromGraveyard = true; protected boolean canPlayCardsFromGraveyard = true;
protected boolean drawsOnOpponentsTurn = false;
protected FilterPermanent sacrificeCostFilter; protected FilterPermanent sacrificeCostFilter;
@ -239,6 +240,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.canLoseLife = player.canLoseLife; this.canLoseLife = player.canLoseLife;
this.loseByZeroOrLessLife = player.loseByZeroOrLessLife; this.loseByZeroOrLessLife = player.loseByZeroOrLessLife;
this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard; this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard;
this.drawsOnOpponentsTurn = player.drawsOnOpponentsTurn;
this.attachments.addAll(player.attachments); this.attachments.addAll(player.attachments);
@ -347,6 +349,7 @@ public abstract class PlayerImpl implements Player, Serializable {
? player.getSacrificeCostFilter().copy() : null; ? player.getSacrificeCostFilter().copy() : null;
this.loseByZeroOrLessLife = player.canLoseByZeroOrLessLife(); this.loseByZeroOrLessLife = player.canLoseByZeroOrLessLife();
this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard(); this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard();
this.drawsOnOpponentsTurn = player.isDrawsOnOpponentsTurn();
this.alternativeSourceCosts.clear(); this.alternativeSourceCosts.clear();
this.alternativeSourceCosts.addAll(player.getAlternativeSourceCosts()); this.alternativeSourceCosts.addAll(player.getAlternativeSourceCosts());
@ -470,6 +473,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.sacrificeCostFilter = null; this.sacrificeCostFilter = null;
this.loseByZeroOrLessLife = true; this.loseByZeroOrLessLife = true;
this.canPlayCardsFromGraveyard = false; this.canPlayCardsFromGraveyard = false;
this.drawsOnOpponentsTurn = false;
this.topCardRevealed = false; this.topCardRevealed = false;
this.alternativeSourceCosts.clear(); this.alternativeSourceCosts.clear();
this.clearCastSourceIdManaCosts(); this.clearCastSourceIdManaCosts();
@ -4335,6 +4339,16 @@ public abstract class PlayerImpl implements Player, Serializable {
this.canPlayCardsFromGraveyard = playCardsFromGraveyard; this.canPlayCardsFromGraveyard = playCardsFromGraveyard;
} }
@Override
public void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn) {
this.drawsOnOpponentsTurn = drawsOnOpponentsTurn;
}
@Override
public boolean isDrawsOnOpponentsTurn() {
return drawsOnOpponentsTurn;
}
@Override @Override
public boolean autoLoseGame() { public boolean autoLoseGame() {
return false; return false;