Merge origin/master

This commit is contained in:
LevelX2 2019-01-07 11:39:10 +01:00
commit 7ef0a5f654
31 changed files with 136 additions and 238 deletions

View file

@ -94,8 +94,4 @@ class BattletideAlchemistEffect extends PreventionEffectImpl {
return event.getType() == EventType.DAMAGE_PLAYER; return event.getType() == EventType.DAMAGE_PLAYER;
} }
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return super.applies(event, source, game);
}
} }

View file

@ -117,7 +117,7 @@ class CloneShellDiesEffect extends OneShotEffect {
List<UUID> imprinted = permanent.getImprinted(); List<UUID> imprinted = permanent.getImprinted();
if (!imprinted.isEmpty()) { if (!imprinted.isEmpty()) {
Card imprintedCard = game.getCard(imprinted.get(0)); Card imprintedCard = game.getCard(imprinted.get(0));
if (imprinted != null) { if (imprintedCard != null) {
imprintedCard.setFaceDown(false, game); imprintedCard.setFaceDown(false, game);
if (imprintedCard.isCreature()) { if (imprintedCard.isCreature()) {
controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game); controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game);

View file

@ -226,11 +226,6 @@ class CyclopeanTombCounterWatcher extends Watcher {
} }
} }
@Override
public void reset() {
super.reset();
}
public Set<MageObjectReference> landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) { public Set<MageObjectReference> landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) {
if (counterData.containsKey(mor)) { if (counterData.containsKey(mor)) {
return counterData.get(mor); return counterData.get(mor);

View file

@ -98,10 +98,6 @@ class DreadWightTriggeredAbility extends TriggeredAbilityImpl {
return false; return false;
} }
@Override
public String getRule() {
return super.getRule();
}
} }
class DreadWightEffect extends OneShotEffect { class DreadWightEffect extends OneShotEffect {

View file

@ -124,11 +124,9 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
&& !eyeOfTheStorm.getImprinted().isEmpty()) { && !eyeOfTheStorm.getImprinted().isEmpty()) {
CardsImpl copiedCards = new CardsImpl(); CardsImpl copiedCards = new CardsImpl();
for (UUID uuid : eyeOfTheStorm.getImprinted()) { for (UUID uuid : eyeOfTheStorm.getImprinted()) {
card = game.getCard(uuid);
// Check if owner of card is still in game // Check if owner of card is still in game
if (card != null card = game.getCard(uuid);
&& game.getPlayer(card.getOwnerId()) != null) { if (card != null && game.getPlayer(card.getOwnerId()) != null) {
if (card.isSplitCard()) { if (card.isSplitCard()) {
copiedCards.add(((SplitCard) card).getLeftHalfCard()); copiedCards.add(((SplitCard) card).getLeftHalfCard());
copiedCards.add(((SplitCard) card).getRightHalfCard()); copiedCards.add(((SplitCard) card).getRightHalfCard());

View file

@ -1,7 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
@ -18,14 +16,16 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class ForgottenLore extends CardImpl { public final class ForgottenLore extends CardImpl {
public ForgottenLore(UUID ownerId, CardSetInfo setInfo) { public ForgottenLore(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
// Target opponent chooses a card in your graveyard. You may pay {G}. If you do, repeat this process except that opponent can't choose a card already chosen for Forgotten Lore. Then put the last chosen card into your hand. // Target opponent chooses a card in your graveyard. You may pay {G}. If you do, repeat this process except that opponent can't choose a card already chosen for Forgotten Lore. Then put the last chosen card into your hand.
this.getSpellAbility().addEffect(new ForgottenLoreEffect()); this.getSpellAbility().addEffect(new ForgottenLoreEffect());
@ -62,8 +62,7 @@ class ForgottenLoreEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId()); Player you = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
if(you != null && opponent != null) if (you != null && opponent != null) {
{
FilterCard filter = new FilterCard(); FilterCard filter = new FilterCard();
filter.add(new OwnerIdPredicate(you.getId())); filter.add(new OwnerIdPredicate(you.getId()));
Cost cost = new ManaCostsImpl("{G}"); Cost cost = new ManaCostsImpl("{G}");
@ -73,31 +72,31 @@ class ForgottenLoreEffect extends OneShotEffect {
do { do {
chosenCard = new TargetCardInGraveyard(filter); chosenCard = new TargetCardInGraveyard(filter);
chosenCard.setNotTarget(true); chosenCard.setNotTarget(true);
if(chosenCard.canChoose(opponent.getId(), game)) { if (chosenCard.canChoose(opponent.getId(), game)) {
opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game); opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game);
card = game.getCard(chosenCard.getFirstTarget()); card = game.getCard(chosenCard.getFirstTarget());
filter.add(Predicates.not(new CardIdPredicate(card.getId()))); if (card != null) {
game.informPlayers("Forgotten Lore: " + opponent.getLogName() + " has chosen " + card.getLogName()); filter.add(Predicates.not(new CardIdPredicate(card.getId())));
} game.informPlayers("Forgotten Lore: " + opponent.getLogName() + " has chosen " + card.getLogName());
else { }
} else {
done = true; done = true;
} }
if(!done) { if (!done) {
if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { if (cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) {
cost.clearPaid(); cost.clearPaid();
if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { if (!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
done = true; done = true;
} }
} } else {
else {
done = true; done = true;
} }
} }
} while(!done); } while (!done);
if(card != null) { if (card != null) {
Cards cardsToHand = new CardsImpl(); Cards cardsToHand = new CardsImpl();
cardsToHand.add(card); cardsToHand.add(card);
you.moveCards(cardsToHand, Zone.HAND, source, game); you.moveCards(cardsToHand, Zone.HAND, source, game);

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -15,8 +13,8 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
@ -26,8 +24,9 @@ import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class GalepowderMage extends CardImpl { public final class GalepowderMage extends CardImpl {
@ -39,7 +38,7 @@ public final class GalepowderMage extends CardImpl {
} }
public GalepowderMage(UUID ownerId, CardSetInfo setInfo) { public GalepowderMage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.KITHKIN); this.subtype.add(SubType.KITHKIN);
this.subtype.add(SubType.WIZARD); this.subtype.add(SubType.WIZARD);
@ -87,10 +86,10 @@ class GalepowderMageEffect extends OneShotEffect {
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
if (getTargetPointer().getFirst(game, source) != null) { if (getTargetPointer().getFirst(game, source) != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (permanent != null) { if (permanent != null) {
UUID exileId = UUID.randomUUID(); UUID exileId = UUID.randomUUID();
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) { if (card != null) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(); Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card; import mage.cards.Card;
@ -16,14 +14,15 @@ import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class GatherSpecimens extends CardImpl { public final class GatherSpecimens extends CardImpl {
public GatherSpecimens(UUID ownerId, CardSetInfo setInfo) { public GatherSpecimens(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}{U}");
// If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. // If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead.
this.getSpellAbility().addEffect(new GatherSpecimensReplacementEffect()); this.getSpellAbility().addEffect(new GatherSpecimensReplacementEffect());
@ -70,7 +69,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE if (event.getType() == GameEvent.EventType.ZONE_CHANGE
&& ((ZoneChangeEvent) event).getToZone().match(Zone.BATTLEFIELD)) { && ((ZoneChangeEvent) event).getToZone().match(Zone.BATTLEFIELD)) {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) {
return true; return true;
@ -79,9 +78,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl {
} }
if (event.getType() == GameEvent.EventType.CREATE_TOKEN && event.getFlag()) { // flag indicates if it's a creature token if (event.getType() == GameEvent.EventType.CREATE_TOKEN && event.getFlag()) { // flag indicates if it's a creature token
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { return controller != null && controller.hasOpponent(event.getPlayerId(), game);
return true;
}
} }
return false; return false;
} }

View file

@ -1,6 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -20,8 +19,9 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public final class GeodeGolem extends CardImpl { public final class GeodeGolem extends CardImpl {
@ -68,7 +68,6 @@ class GeodeGolemEffect extends OneShotEffect {
for (UUID commanderId : controller.getCommandersIds()) { for (UUID commanderId : controller.getCommandersIds()) {
if (game.getState().getZone(commanderId) == Zone.COMMAND) { if (game.getState().getZone(commanderId) == Zone.COMMAND) {
Card commander = game.getCard(commanderId); Card commander = game.getCard(commanderId);
if (commander != null && game.getState().getZone(commanderId) == Zone.COMMAND) { if (commander != null && game.getState().getZone(commanderId) == Zone.COMMAND) {
SpellAbility ability = commander.getSpellAbility(); SpellAbility ability = commander.getSpellAbility();
SpellAbility newAbility = commander.getSpellAbility().copy(); SpellAbility newAbility = commander.getSpellAbility().copy();

View file

@ -88,11 +88,6 @@ class GuildmagesForumWatcher extends Watcher {
} }
} }
@Override
public void reset() {
super.reset();
}
} }
class GuildmagesForumEntersBattlefieldEffect extends ReplacementEffectImpl { class GuildmagesForumEntersBattlefieldEffect extends ReplacementEffectImpl {

View file

@ -1,14 +1,8 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.FilterCard; import mage.filter.FilterCard;
@ -16,9 +10,11 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import mage.util.CardUtil;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class HintOfInsanity extends CardImpl { public final class HintOfInsanity extends CardImpl {
@ -62,8 +58,6 @@ class HintOfInsanityEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
FilterCard filter = new FilterCard("card from your hand"); FilterCard filter = new FilterCard("card from your hand");
Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player targetPlayer = game.getPlayer(source.getFirstTarget());
String nameOfChosenCard;
Card chosenCard;
if (targetPlayer != null) { if (targetPlayer != null) {
TargetCardInHand targetCard = new TargetCardInHand(filter); TargetCardInHand targetCard = new TargetCardInHand(filter);
targetCard.setNotTarget(true); targetCard.setNotTarget(true);
@ -72,12 +66,12 @@ class HintOfInsanityEffect extends OneShotEffect {
targetPlayer.revealCards("Hint of Insanity Reveal", cardsInHand, game); targetPlayer.revealCards("Hint of Insanity Reveal", cardsInHand, game);
if (!cardsInHand.isEmpty() if (!cardsInHand.isEmpty()
&& targetPlayer.choose(Outcome.Discard, targetCard, source.getSourceId(), game)) { && targetPlayer.choose(Outcome.Discard, targetCard, source.getSourceId(), game)) {
chosenCard = game.getCard(targetCard.getFirstTarget()); Card chosenCard = game.getCard(targetCard.getFirstTarget());
nameOfChosenCard = chosenCard.getName(); if (chosenCard != null) {
for (Card card : cardsInHand.getCards(game)) { for (Card card : cardsInHand.getCards(game)) {
if (card.getName().equals(nameOfChosenCard) if (CardUtil.haveSameNames(card, chosenCard) && !card.isLand()) {
&& !card.isLand()) { targetPlayer.discard(card, source, game);
targetPlayer.discard(card, source, game); }
} }
} }
return true; return true;

View file

@ -1,7 +1,5 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -12,11 +10,7 @@ import mage.abilities.effects.common.ExileUntilSourceLeavesEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterNonlandPermanent; import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.ExileZone; import mage.game.ExileZone;
@ -26,8 +20,9 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class IxalansBinding extends CardImpl { public final class IxalansBinding extends CardImpl {
@ -80,10 +75,10 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Card card = game.getCard(event.getSourceId()); if (event.getPlayerId().equals(source.getControllerId())) {
if(event.getPlayerId().equals(source.getControllerId())){
return false; return false;
} }
Card card = game.getCard(event.getSourceId());
if (sourcePermanent != null && card != null) { if (sourcePermanent != null && card != null) {
UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (exileZone != null) { if (exileZone != null) {

View file

@ -1,9 +1,5 @@
package mage.cards.j; package mage.cards.j;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -17,25 +13,24 @@ import mage.abilities.keyword.SuspendAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterNonlandCard; import mage.filter.common.FilterNonlandCard;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class JhoiraOfTheGhitu extends CardImpl { public final class JhoiraOfTheGhitu extends CardImpl {
public JhoiraOfTheGhitu(UUID ownerId, CardSetInfo setInfo) { public JhoiraOfTheGhitu(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD); this.subtype.add(SubType.WIZARD);
@ -83,13 +78,17 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect {
return false; return false;
} }
List<Card> cards = new ArrayList<>(); List<Card> cards = new ArrayList<>();
for (Cost cost: source.getCosts()) { for (Cost cost : source.getCosts()) {
if (cost instanceof ExileFromHandCost) { if (cost instanceof ExileFromHandCost) {
cards = ((ExileFromHandCost) cost).getCards(); cards = ((ExileFromHandCost) cost).getCards();
} }
} }
if (cards != null && !cards.isEmpty()) { if (cards != null && !cards.isEmpty()) {
// always one card to exile
Card card = game.getCard(cards.get(0).getId()); Card card = game.getCard(cards.get(0).getId());
if (card == null) {
return false;
}
boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class); boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class);
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);

View file

@ -1,13 +1,5 @@
package mage.cards.j; package mage.cards.j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
@ -15,12 +7,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.cards.Cards;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
@ -31,8 +18,9 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.*;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class Juxtapose extends CardImpl { public final class Juxtapose extends CardImpl {
@ -89,7 +77,6 @@ class JuxtaposeEffect extends ContinuousEffectImpl {
public void init(Ability source, Game game) { public void init(Ability source, Game game) {
Player you = game.getPlayer(source.getControllerId()); Player you = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getCard(source.getSourceId());
if (you != null && targetPlayer != null) { if (you != null && targetPlayer != null) {
Permanent permanent1 = chooseOnePermanentsWithTheHighestCMC(game, you, filter); Permanent permanent1 = chooseOnePermanentsWithTheHighestCMC(game, you, filter);
@ -109,6 +96,7 @@ class JuxtaposeEffect extends ContinuousEffectImpl {
permanent1.changeControllerId(targetPlayer.getId(), game); permanent1.changeControllerId(targetPlayer.getId(), game);
permanent2.changeControllerId(you.getId(), game); permanent2.changeControllerId(you.getId(), game);
MageObject sourceObject = game.getCard(source.getSourceId());
game.informPlayers((sourceObject != null ? sourceObject.getLogName() : "") + ": " + you.getLogName() + game.informPlayers((sourceObject != null ? sourceObject.getLogName() : "") + ": " + you.getLogName() +
" and " + targetPlayer.getLogName() + " exchange control of " + permanent1.getLogName() + " and " + targetPlayer.getLogName() + " exchange control of " + permanent1.getLogName() +
" and " + permanent2.getName()); " and " + permanent2.getName());

View file

@ -1,7 +1,5 @@
package mage.cards.k; package mage.cards.k;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -21,8 +19,9 @@ import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class Kudzu extends CardImpl { public final class Kudzu extends CardImpl {
@ -73,7 +72,6 @@ class KudzuEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent kudzu = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent kudzu = game.getPermanentOrLKIBattlefield(source.getSourceId());
Card kudzuCard = game.getCard(source.getSourceId());
if (kudzu != null) { if (kudzu != null) {
Permanent enchantedLand = game.getPermanentOrLKIBattlefield(kudzu.getAttachedTo()); Permanent enchantedLand = game.getPermanentOrLKIBattlefield(kudzu.getAttachedTo());
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
@ -86,8 +84,8 @@ class KudzuEffect extends OneShotEffect {
if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield
Target target = new TargetLandPermanent(); Target target = new TargetLandPermanent();
target.setNotTarget(true); //not a target, it is chosen target.setNotTarget(true); //not a target, it is chosen
if (kudzuCard != null Card kudzuCard = game.getCard(source.getSourceId());
&& landsController != null) { if (kudzuCard != null && landsController != null) {
if (landsController.choose(Outcome.Detriment, target, source.getId(), game)) { if (landsController.choose(Outcome.Detriment, target, source.getId(), game)) {
if (target.getFirstTarget() != null) { if (target.getFirstTarget() != null) {
Permanent landChosen = game.getPermanent(target.getFirstTarget()); Permanent landChosen = game.getPermanent(target.getFirstTarget());

View file

@ -1,7 +1,5 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -17,11 +15,7 @@ import mage.abilities.keyword.HasteAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
@ -32,8 +26,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class LegionsInitiative extends CardImpl { public final class LegionsInitiative extends CardImpl {
@ -47,7 +42,7 @@ public final class LegionsInitiative extends CardImpl {
} }
public LegionsInitiative(UUID ownerId, CardSetInfo setInfo) { public LegionsInitiative(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}{W}");
// Red creatures you control get +1/+0. // Red creatures you control get +1/+0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.WhileOnBattlefield, filterRedCreature))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.WhileOnBattlefield, filterRedCreature)));
@ -136,12 +131,14 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
exile = exile.copy(); exile = exile.copy();
for (UUID cardId : exile) { for (UUID cardId : exile) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); if (card != null) {
Permanent returnedCreature = game.getPermanent(cardId); card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
if (returnedCreature != null) { Permanent returnedCreature = game.getPermanent(cardId);
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); if (returnedCreature != null) {
effect.setTargetPointer(new FixedTarget(returnedCreature.getId())); ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
game.addEffect(effect, source); effect.setTargetPointer(new FixedTarget(returnedCreature.getId()));
game.addEffect(effect, source);
}
} }
} }
game.getExile().getExileZone(source.getSourceId()).clear(); game.getExile().getExileZone(source.getSourceId()).clear();

View file

@ -62,10 +62,10 @@ class LightUpTheStageEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (controller != null) { if (controller != null) {
Set<Card> cards = controller.getLibrary().getTopCards(game, 2); Set<Card> cards = controller.getLibrary().getTopCards(game, 2);
controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName()); Card sourceCard = game.getCard(source.getSourceId());
controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard != null ? sourceCard.getIdName() : "");
for (Card card : cards) { for (Card card : cards) {
ContinuousEffect effect = new LightUpTheStageMayPlayEffect(); ContinuousEffect effect = new LightUpTheStageMayPlayEffect();
@ -107,9 +107,7 @@ class LightUpTheStageMayPlayEffect extends AsThoughEffectImpl {
@Override @Override
public boolean isInactive(Ability source, Game game) { public boolean isInactive(Ability source, Game game) {
if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) { if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) {
if (game.isActivePlayer(source.getControllerId())) { return game.isActivePlayer(source.getControllerId());
return true;
}
} }
return false; return false;
} }

View file

@ -94,11 +94,6 @@ class MartyrdomActivatedAbility extends ActivatedAbilityImpl {
this.caster = ability.caster; this.caster = ability.caster;
} }
@Override
public Effects getEffects(Game game, EffectType effectType) {
return super.getEffects(game, effectType);
}
@Override @Override
public ActivationStatus canActivate(UUID playerId, Game game) { public ActivationStatus canActivate(UUID playerId, Game game) {
if (playerId.equals(caster)) { if (playerId.equals(caster)) {

View file

@ -77,11 +77,6 @@ class MerseineActivatedAbility extends SimpleActivatedAbility {
super(ability); super(ability);
} }
@Override
public Effects getEffects(Game game, EffectType effectType) {
return super.getEffects(game, effectType);
}
@Override @Override
public ActivationStatus canActivate(UUID playerId, Game game) { public ActivationStatus canActivate(UUID playerId, Game game) {
Permanent sourcePermanent = game.getBattlefield().getPermanent(this.getSourceId()); Permanent sourcePermanent = game.getBattlefield().getPermanent(this.getSourceId());

View file

@ -1,7 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.AsEntersBattlefieldAbility;
@ -13,17 +11,13 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author L_J * @author L_J
*/ */
public final class MinionOfTheWastes extends CardImpl { public final class MinionOfTheWastes extends CardImpl {
@ -74,10 +68,10 @@ class MinionOfTheWastesEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Card sourceCard = game.getCard(source.getSourceId());
int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game);
controller.loseLife(payAmount, game, false); controller.loseLife(payAmount, game, false);
game.informPlayers(sourceCard.getLogName() + ": " + controller.getLogName() + Card sourceCard = game.getCard(source.getSourceId());
game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() +
" pays " + payAmount + " life"); " pays " + payAmount + " life");
game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.Custom, SubLayer.SetPT_7b), source); game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.Custom, SubLayer.SetPT_7b), source);
return true; return true;

View file

@ -1,6 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -8,21 +7,18 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.TransformAbility; import mage.abilities.keyword.TransformAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.players.Player; import mage.players.Player;
import mage.watchers.common.CreatureWasCastWatcher; import mage.watchers.common.CreatureWasCastWatcher;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class Mistcaller extends CardImpl { public final class Mistcaller extends CardImpl {
@ -96,14 +92,14 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) { if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId()); if (card != null) {
if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) { Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId());
card = card.getSecondCardFace(); if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) {
} card = card.getSecondCardFace();
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly }
CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class); if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) { CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class);
return true; return watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId());
} }
} }
} }

View file

@ -1,7 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
@ -14,8 +12,9 @@ import mage.game.Game;
import mage.game.permanent.token.MoltenBirthElementalToken; import mage.game.permanent.token.MoltenBirthElementalToken;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class MoltenBirth extends CardImpl { public final class MoltenBirth extends CardImpl {
@ -57,13 +56,15 @@ class MoltenBirthEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card molten = game.getCard(source.getSourceId());
if (controller != null) { if (controller != null) {
MoltenBirthElementalToken token = new MoltenBirthElementalToken(); MoltenBirthElementalToken token = new MoltenBirthElementalToken();
token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId());
if (controller.flipCoin(game)) { if (controller.flipCoin(game)) {
molten.moveToZone(Zone.HAND, source.getSourceId(), game, true); Card molten = game.getCard(source.getSourceId());
game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand."); if (molten != null) {
molten.moveToZone(Zone.HAND, source.getSourceId(), game, true);
game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand.");
}
} }
return true; return true;
} }

View file

@ -59,11 +59,6 @@ class NightcreepLandEffect extends BecomesBasicLandTargetEffect {
this.setTargetPointer(new FixedTargets(targets, game)); this.setTargetPointer(new FixedTargets(targets, game));
} }
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
return super.apply(layer, sublayer, source, game);
}
@Override @Override
public NightcreepLandEffect copy() { public NightcreepLandEffect copy() {
return new NightcreepLandEffect(this); return new NightcreepLandEffect(this);
@ -88,11 +83,6 @@ class NightcreepCreatureEffect extends BecomesColorTargetEffect {
this.setTargetPointer(new FixedTargets(targets, game)); this.setTargetPointer(new FixedTargets(targets, game));
} }
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
return super.apply(layer, sublayer, source, game);
}
@Override @Override
public NightcreepCreatureEffect copy() { public NightcreepCreatureEffect copy() {
return new NightcreepCreatureEffect(this); return new NightcreepCreatureEffect(this);

View file

@ -98,8 +98,4 @@ class PatriciansScornWatcher extends Watcher {
} }
} }
@Override
public void reset() {
super.reset();
}
} }

View file

@ -64,11 +64,6 @@ class TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent extends
super(target); super(target);
} }
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
return super.canTarget(controllerId, id, source, game);
}
@Override @Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>(); Set<UUID> possibleTargets = new HashSet<>();

View file

@ -69,11 +69,6 @@ class TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent extend
super(target); super(target);
} }
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
return super.canTarget(controllerId, id, source, game);
}
@Override @Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>(); Set<UUID> possibleTargets = new HashSet<>();

View file

@ -1,7 +1,5 @@
package mage.abilities.effects; package mage.abilities.effects;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
@ -19,6 +17,8 @@ import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/** /**
* Cards with the Aura subtype don't change the zone they are in, if there is no * Cards with the Aura subtype don't change the zone they are in, if there is no
* valid target on the battlefield. Also, when entering the battlefield and it * valid target on the battlefield. Also, when entering the battlefield and it
@ -60,6 +60,9 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
UUID sourceId = event.getSourceId(); UUID sourceId = event.getSourceId();
UUID controllerId = event.getPlayerId(); UUID controllerId = event.getPlayerId();
if (card == null) {
return false;
}
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) { if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) {
card = card.getSecondCardFace(); card = card.getSecondCardFace();
@ -149,7 +152,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
} }
Player targetPlayer = game.getPlayer(targetId); Player targetPlayer = game.getPlayer(targetId);
if (targetCard != null || targetPermanent != null || targetPlayer != null) { if (targetCard != null || targetPermanent != null || targetPlayer != null) {
card = game.getCard(event.getTargetId());
card.removeFromZone(game, fromZone, sourceId); card.removeFromZone(game, fromZone, sourceId);
PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game); PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game);
ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD); ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD);
@ -184,14 +186,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) { && (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game) return card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game)
|| // in case of transformable enchantments || // in case of transformable enchantments
(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null
&& card.getSecondCardFace() != null && card.getSecondCardFace() != null
&& card.getSecondCardFace().isEnchantment() && card.getSecondCardFace().isEnchantment()
&& card.getSecondCardFace().hasSubtype(SubType.AURA, game)))) { && card.getSecondCardFace().hasSubtype(SubType.AURA, game)));
return true;
}
} }
return false; return false;
} }

View file

@ -1,8 +1,5 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -14,11 +11,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken; import mage.game.permanent.token.EmptyToken;
@ -27,8 +20,11 @@ import mage.util.CardUtil;
import mage.util.functions.ApplyToPermanent; import mage.util.functions.ApplyToPermanent;
import mage.util.functions.EmptyApplyToPermanent; import mage.util.functions.EmptyApplyToPermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class CreateTokenCopyTargetEffect extends OneShotEffect { public class CreateTokenCopyTargetEffect extends OneShotEffect {
@ -73,12 +69,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
} }
/** /**
* * @param playerId null the token is controlled/owned by the controller of
* @param playerId null the token is controlled/owned by the controller of * the source ability
* the source ability
* @param additionalCardType the token gains this card type in addition * @param additionalCardType the token gains this card type in addition
* @param hasHaste the token gains haste * @param hasHaste the token gains haste
* @param number number of tokens to put into play * @param number number of tokens to put into play
* @param tapped * @param tapped
* @param attacking * @param attacking
*/ */
@ -165,7 +160,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
copyFrom = game.getCard(getTargetPointer().getFirst(game, source)); copyFrom = game.getCard(getTargetPointer().getFirst(game, source));
} }
if (permanent == null && copyFrom == null) { if (copyFrom == null) {
return false; return false;
} }

View file

@ -1,8 +1,5 @@
package mage.abilities.effects.common.discard; package mage.abilities.effects.common.discard;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.StaticValue;
@ -20,8 +17,10 @@ import mage.target.TargetCard;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author noxx * @author noxx
*/ */
public class DiscardCardYouChooseTargetEffect extends OneShotEffect { public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
@ -98,7 +97,6 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player player = game.getPlayer(targetPointer.getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (player != null && controller != null) { if (player != null && controller != null) {
if (revealAllCards) { if (revealAllCards) {
this.numberCardsToReveal = new StaticValue(player.getHand().size()); this.numberCardsToReveal = new StaticValue(player.getHand().size());
@ -125,6 +123,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
revealedCards.addAll(player.getHand()); revealedCards.addAll(player.getHand());
} }
Card sourceCard = game.getCard(source.getSourceId());
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game); player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
boolean result = true; boolean result = true;

View file

@ -544,7 +544,7 @@ public class GameState implements Serializable, Copyable<GameState> {
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), uuid.toString())); return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), uuid.toString()));
} }
public <T extends Watcher> T getWatcher(Class<T> watcherClass,String prefix) { public <T extends Watcher> T getWatcher(Class<T> watcherClass, String prefix) {
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), prefix)); return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), prefix));
} }
@ -776,7 +776,9 @@ public class GameState implements Serializable, Copyable<GameState> {
ZoneChangeEvent castEvent = (ZoneChangeEvent) event; ZoneChangeEvent castEvent = (ZoneChangeEvent) event;
UUID targetId = castEvent.getTargetId(); UUID targetId = castEvent.getTargetId();
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
movedCards.add(card); if (card != null) {
movedCards.add(card);
}
} }
ZoneChangeData eventData = entry.getKey(); ZoneChangeData eventData = entry.getKey();
if (!movedCards.isEmpty()) { if (!movedCards.isEmpty()) {
@ -1117,7 +1119,7 @@ public class GameState implements Serializable, Copyable<GameState> {
this.watchers.add(watcher); this.watchers.add(watcher);
} }
public void resetWatchers(){ public void resetWatchers() {
this.watchers.reset(); this.watchers.reset();
} }

View file

@ -186,7 +186,9 @@ public class Library implements Serializable {
Map<String, Card> cards = new HashMap<>(); Map<String, Card> cards = new HashMap<>();
for (UUID cardId : library) { for (UUID cardId : library) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
cards.putIfAbsent(card.getName(), card); if (card != null) {
cards.putIfAbsent(card.getName(), card);
}
} }
return cards.values(); return cards.values();
} }