mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
[MID] updated Teferi, Who Slows the Sunset emblem
This commit is contained in:
parent
aec68ac9d5
commit
4ab41a5b12
7 changed files with 120 additions and 38 deletions
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
*
|
*
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -3261,7 +3265,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
for (Card card : getHand().getCards(game)) {
|
for (Card card : getHand().getCards(game)) {
|
||||||
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
||||||
= card.getAbilities(game).getAvailableActivatedManaAbilities(Zone.HAND, playerId, game);
|
= card.getAbilities(game).getAvailableActivatedManaAbilities(Zone.HAND, playerId, game);
|
||||||
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext();) {
|
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext(); ) {
|
||||||
ActivatedManaAbilityImpl ability = it.next();
|
ActivatedManaAbilityImpl ability = it.next();
|
||||||
Abilities<ActivatedManaAbilityImpl> noTapAbilities = new AbilitiesImpl<>(ability);
|
Abilities<ActivatedManaAbilityImpl> noTapAbilities = new AbilitiesImpl<>(ability);
|
||||||
if (ability.getManaCosts().isEmpty() && !ability.isPoolDependant()) {
|
if (ability.getManaCosts().isEmpty() && !ability.isPoolDependant()) {
|
||||||
|
@ -3278,7 +3282,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean useLater = false; // sources with mana costs or mana pool dependency
|
boolean useLater = false; // sources with mana costs or mana pool dependency
|
||||||
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
||||||
= permanent.getAbilities(game).getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game); // returns ability only if canActivate is true
|
= permanent.getAbilities(game).getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game); // returns ability only if canActivate is true
|
||||||
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext();) {
|
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext(); ) {
|
||||||
ActivatedManaAbilityImpl ability = it.next();
|
ActivatedManaAbilityImpl ability = it.next();
|
||||||
if (canUse == null) {
|
if (canUse == null) {
|
||||||
canUse = permanent.canUseActivatedAbilities(game);
|
canUse = permanent.canUseActivatedAbilities(game);
|
||||||
|
@ -3320,7 +3324,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean usePoolDependantAbilities = false; // use such abilities later than other if possible because it can maximize mana production
|
boolean usePoolDependantAbilities = false; // use such abilities later than other if possible because it can maximize mana production
|
||||||
while (anAbilityWasUsed && !sourceWithCosts.isEmpty()) {
|
while (anAbilityWasUsed && !sourceWithCosts.isEmpty()) {
|
||||||
anAbilityWasUsed = false;
|
anAbilityWasUsed = false;
|
||||||
for (Iterator<Abilities<ActivatedManaAbilityImpl>> iterator = sourceWithCosts.iterator(); iterator.hasNext();) {
|
for (Iterator<Abilities<ActivatedManaAbilityImpl>> iterator = sourceWithCosts.iterator(); iterator.hasNext(); ) {
|
||||||
Abilities<ActivatedManaAbilityImpl> manaAbilities = iterator.next();
|
Abilities<ActivatedManaAbilityImpl> manaAbilities = iterator.next();
|
||||||
if (usePoolDependantAbilities || !manaAbilities.hasPoolDependantAbilities()) {
|
if (usePoolDependantAbilities || !manaAbilities.hasPoolDependantAbilities()) {
|
||||||
boolean used;
|
boolean used;
|
||||||
|
@ -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;
|
||||||
|
@ -4621,7 +4635,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// identify cards from one owner
|
// identify cards from one owner
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
UUID ownerId = null;
|
UUID ownerId = null;
|
||||||
for (Iterator<? extends Card> it = allCards.iterator(); it.hasNext();) {
|
for (Iterator<? extends Card> it = allCards.iterator(); it.hasNext(); ) {
|
||||||
Card card = it.next();
|
Card card = it.next();
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
ownerId = card.getOwnerId();
|
ownerId = card.getOwnerId();
|
||||||
|
|
Loading…
Reference in a new issue