mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
include more player null checks
This commit is contained in:
parent
2ebad63595
commit
09dd9d5a26
141 changed files with 550 additions and 500 deletions
|
|
@ -120,6 +120,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
|
|||
AbandonedSarcophagusWatcher watcher = (AbandonedSarcophagusWatcher) game.getState().getWatchers().get(AbandonedSarcophagusWatcher.class.getSimpleName());
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null
|
||||
&& controller != null
|
||||
&& watcher != null
|
||||
&& card.isOwnedBy(controller.getId())) {
|
||||
for (Ability ability : card.getAbilities()) {
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ class WellEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
int life = 2 * game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
if (player != null) {
|
||||
int life = 2 * game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
player.gainLife(life, game, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
|
|
@ -15,7 +16,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AncestorDragon extends CardImpl {
|
||||
|
|
@ -46,8 +46,6 @@ public final class AncestorDragon extends CardImpl {
|
|||
|
||||
class AncestorDragonEffect extends OneShotEffect {
|
||||
|
||||
private int attackers;
|
||||
|
||||
public AncestorDragonEffect() {
|
||||
super(Outcome.GainLife);
|
||||
staticText = "you gain 1 life for each attacking creature";
|
||||
|
|
@ -65,10 +63,9 @@ class AncestorDragonEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
attackers = game.getCombat().getAttackers().size();
|
||||
if (you != null) {
|
||||
int attackers = game.getCombat().getAttackers().size();
|
||||
you.gainLife(attackers, game, source);
|
||||
attackers = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ class AngelsTrumpetTapEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
int count = 0;
|
||||
if (player != null) {
|
||||
int count = 0;
|
||||
for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game)) {
|
||||
// Untapped creatures are safe.
|
||||
if (creature.isTapped()) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
|
|
@ -21,7 +22,6 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AssassinsTrophy extends CardImpl {
|
||||
|
|
@ -74,17 +74,19 @@ class AssassinsTrophyEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(permanent.getControllerId());
|
||||
if (controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
if (controller != null) {
|
||||
if (controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
|
|||
if (opponent != null) {
|
||||
Cost cost = new PayLifeCost(3);
|
||||
if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
|
||||
&& opponent.chooseUse(outcome, new StringBuilder("Pay 3 live to prevent that ").append(creature.getLogName()).append(" returns to ").append(controller.getLogName()).append("'s hand?").toString(), source, game)) {
|
||||
&& opponent.chooseUse(outcome, "Pay 3 life to prevent that " + creature.getLogName() + " returns to " + controller.getLogName() + "'s hand?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) {
|
||||
paid = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ class AyliEternalPilgrimCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
return player.getLife() >= game.getLife() + 10;
|
||||
if(player != null) {
|
||||
return player.getLife() >= game.getLife() + 10;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,16 +67,18 @@ class BarrinsSpiteEffect extends OneShotEffect {
|
|||
Permanent creature = game.getPermanent(targetId);
|
||||
if (creature != null) {
|
||||
Player controllerOfCreature = game.getPlayer(creature.getControllerId());
|
||||
if ((count == 0
|
||||
&& controllerOfCreature.chooseUse(Outcome.Sacrifice, "Sacrifice " + creature.getLogName() + '?', source, game))
|
||||
|| (count == 1
|
||||
&& !sacrificeDone)) {
|
||||
creature.sacrifice(source.getId(), game);
|
||||
sacrificeDone = true;
|
||||
} else {
|
||||
creature.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
if(controllerOfCreature != null) {
|
||||
if ((count == 0
|
||||
&& controllerOfCreature.chooseUse(Outcome.Sacrifice, "Sacrifice " + creature.getLogName() + '?', source, game))
|
||||
|| (count == 1
|
||||
&& !sacrificeDone)) {
|
||||
creature.sacrifice(source.getId(), game);
|
||||
sacrificeDone = true;
|
||||
} else {
|
||||
creature.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -17,13 +18,12 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class BattletideAlchemist extends CardImpl {
|
||||
|
||||
public BattletideAlchemist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
|
||||
this.subtype.add(SubType.KITHKIN, SubType.CLERIC);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
|
@ -63,7 +63,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl {
|
|||
boolean result = false;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(event.getTargetId());
|
||||
if (controller != null) {
|
||||
if (controller != null && targetPlayer != null) {
|
||||
int numberOfClericsControlled = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent(SubType.CLERIC, "Clerics")).calculate(game, source, this);
|
||||
int toPrevent = Math.min(numberOfClericsControlled, event.getAmount());
|
||||
if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) {
|
||||
|
|
@ -71,20 +71,18 @@ class BattletideAlchemistEffect extends PreventionEffectImpl {
|
|||
if (!game.replaceEvent(preventEvent)) {
|
||||
if (event.getAmount() >= toPrevent) {
|
||||
event.setAmount(event.getAmount() - toPrevent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
event.setAmount(0);
|
||||
result = true;
|
||||
}
|
||||
if (toPrevent > 0) {
|
||||
game.informPlayers("Battletide Alchemist prevented " + toPrevent + " damage to " + targetPlayer.getName());
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.PREVENTED_DAMAGE,
|
||||
targetPlayer.getId(),
|
||||
source.getSourceId(),
|
||||
source.getControllerId(),
|
||||
toPrevent));
|
||||
}
|
||||
game.informPlayers("Battletide Alchemist prevented " + toPrevent + " damage to " + targetPlayer.getName());
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.PREVENTED_DAMAGE,
|
||||
targetPlayer.getId(),
|
||||
source.getSourceId(),
|
||||
source.getControllerId(),
|
||||
toPrevent));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,10 @@ class BloodScrivenerReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
Player player = game.getPlayer(event.getPlayerId());
|
||||
if (player.getHand().isEmpty()) {
|
||||
return true;
|
||||
if(player != null) {
|
||||
if (player.getHand().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -49,9 +49,12 @@ class BraidOfFireCost extends CostImpl {
|
|||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
player.getManaPool().addMana(Mana.RedMana(1), game, ability);
|
||||
paid = true;
|
||||
return true;
|
||||
if(player != null) {
|
||||
player.getManaPool().addMana(Mana.RedMana(1), game, ability);
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
|
||||
cost.clearPaid();
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + '?', source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + '.');
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -15,13 +16,12 @@ import mage.players.Player;
|
|||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author dustinconrad
|
||||
*/
|
||||
public final class Browbeat extends CardImpl {
|
||||
|
||||
public Browbeat(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
||||
|
||||
// Any player may have Browbeat deal 5 damage to him or her. If no one does, target player draws three cards.
|
||||
this.getSpellAbility().addEffect(new BrowbeatDrawEffect());
|
||||
|
|
@ -61,16 +61,16 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
StackObject spell = null;
|
||||
for(StackObject object : game.getStack()){
|
||||
if(object instanceof Spell && object.getSourceId().equals(source.getSourceId())){
|
||||
for (StackObject object : game.getStack()) {
|
||||
if (object instanceof Spell && object.getSourceId().equals(source.getSourceId())) {
|
||||
spell = object;
|
||||
}
|
||||
}
|
||||
if(spell != null){
|
||||
if (spell != null) {
|
||||
boolean drawCards = true;
|
||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)){
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 5 damage to you?", source, game)){
|
||||
if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 5 damage to you?", source, game)) {
|
||||
drawCards = false;
|
||||
player.damage(5, source.getSourceId(), game, false, true);
|
||||
game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 5 to him or her");
|
||||
|
|
@ -80,7 +80,9 @@ class BrowbeatDrawEffect extends OneShotEffect {
|
|||
UUID targetPlayer = getTargetPointer().getFirst(game, source);
|
||||
if (targetPlayer != null) {
|
||||
Player player = game.getPlayer(targetPlayer);
|
||||
player.drawCards(3, game);
|
||||
if (player != null) {
|
||||
player.drawCards(3, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return drawCards;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ class BrudicladTelchorEngineerEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller == null){
|
||||
return false;
|
||||
}
|
||||
CreateTokenEffect effect = new CreateTokenEffect(new BrudicladTelchorMyrToken(), 1);
|
||||
|
||||
if (effect.apply(game, source)) {
|
||||
|
|
|
|||
|
|
@ -72,11 +72,16 @@ class BubblingCauldronEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = 0;
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
damage += opponent.loseLife(4, game, false);
|
||||
if(opponent != null) {
|
||||
damage += opponent.loseLife(4, game, false);
|
||||
}
|
||||
}
|
||||
if(you != null){
|
||||
you.gainLife(damage, game, source);
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ class CandlesOfLengEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if(controller == null || sourceObject == null){
|
||||
return false;
|
||||
}
|
||||
if (controller.getLibrary().hasCards()) {
|
||||
CardsImpl cards = new CardsImpl();
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ChainOfSilenceEffect extends OneShotEffect {
|
|||
game.addEffect(effect, source);
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true);
|
||||
if (player.chooseTarget(Outcome.Sacrifice, target, source, game)) {
|
||||
if (player != null && player.chooseTarget(Outcome.Sacrifice, target, source, game)) {
|
||||
Permanent land = game.getPermanent(target.getFirstTarget());
|
||||
if (land != null && land.sacrifice(source.getSourceId(), game)) {
|
||||
if (player.chooseUse(outcome, "Copy the spell?", source, game)) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class ChainOfVaporEffect extends OneShotEffect {
|
|||
controller.moveCards(permanent, Zone.HAND, source, game);
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true);
|
||||
if (player.chooseTarget(Outcome.Sacrifice, target, source, game)) {
|
||||
if (player != null && player.chooseTarget(Outcome.Sacrifice, target, source, game)) {
|
||||
Permanent land = game.getPermanent(target.getFirstTarget());
|
||||
if (land != null && land.sacrifice(source.getSourceId(), game)) {
|
||||
if (player.chooseUse(outcome, "Copy the spell?", source, game)) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ class ChainStasisEffect extends OneShotEffect {
|
|||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
effect.apply(game, source);
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if(player == null){
|
||||
return false;
|
||||
}
|
||||
Cost cost = new ManaCostsImpl("{2}{U}");
|
||||
if (cost.pay(source, game, player.getId(), controller.getId(), false)) {
|
||||
if (player.chooseUse(outcome, "Copy the spell?", source, game)) {
|
||||
|
|
|
|||
|
|
@ -60,13 +60,15 @@ class ChaliceOfLifeEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
//gain 1 life
|
||||
player.gainLife(1, game, source);
|
||||
if(player != null) {
|
||||
//gain 1 life
|
||||
player.gainLife(1, game, source);
|
||||
|
||||
// if you have at least 10 life more than your starting life total, transform Chalice of Life.
|
||||
if (player.getLife() >= game.getLife() + 10) {
|
||||
permanent.transform(game);
|
||||
game.informPlayers(new StringBuilder(permanent.getName()).append(" transforms into ").append(permanent.getSecondCardFace().getName()).toString());
|
||||
// if you have at least 10 life more than your starting life total, transform Chalice of Life.
|
||||
if (player.getLife() >= game.getLife() + 10) {
|
||||
permanent.transform(game);
|
||||
game.informPlayers(permanent.getName() + " transforms into " + permanent.getSecondCardFace().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -55,17 +55,18 @@ class CleansingEffect extends OneShotEffect {
|
|||
boolean paidLife = false;
|
||||
Permanent p = permanents.next();
|
||||
if (p.isLand()) {
|
||||
paidLife = false;
|
||||
game.informPlayers("Any player may pay 1 life to prevent the destruction of " + p.getLogName() + " controlled by " + game.getPlayer(p.getControllerId()).getLogName() + ".");
|
||||
PayLifeCost cost = new PayLifeCost(1);
|
||||
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay 1 life to prevent this?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays 1 life to prevent the destruction of " + p.getLogName());
|
||||
paidLife = true;
|
||||
if(player != null) {
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay 1 life to prevent this?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays 1 life to prevent the destruction of " + p.getLogName());
|
||||
paidLife = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.DamageEvent;
|
||||
|
|
@ -23,11 +17,13 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class CloakOfConfusion extends CardImpl {
|
||||
|
|
@ -128,19 +124,18 @@ class CloakOfConfusionEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent enchantedCreature = game.getPermanent(game.getPermanent(source.getSourceId()).getAttachedTo());
|
||||
if (controller != null) {
|
||||
if (controller.chooseUse(outcome, "Do you wish to not assign combat damage from "
|
||||
+ enchantedCreature.getName() + " and have the defending player discard a card at random?", source, game)) {
|
||||
ContinuousEffect effect = new AssignNoCombatDamageTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (defendingPlayer != null) {
|
||||
defendingPlayer.discard(1, true, source, game);
|
||||
}
|
||||
if (controller != null && controller.chooseUse(outcome, "Do you wish to not assign combat damage from "
|
||||
+ enchantedCreature.getName() + " and have the defending player discard a card at random?", source, game)) {
|
||||
ContinuousEffect effect = new AssignNoCombatDamageTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(enchantedCreature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (defendingPlayer != null) {
|
||||
defendingPlayer.discard(1, true, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ class CompellingDeterrenceEffect extends OneShotEffect {
|
|||
if (controller != null && player != null) {
|
||||
player.moveCards(target, Zone.HAND, source, game);
|
||||
game.applyEffects();
|
||||
FilterPermanent FILTER = new FilterPermanent();
|
||||
FILTER.add(new SubtypePredicate(SubType.ZOMBIE));
|
||||
if (game.getState().getBattlefield().countAll(FILTER, controller.getId(), game) > 0) {
|
||||
FilterPermanent zombieFilter = new FilterPermanent();
|
||||
zombieFilter.add(new SubtypePredicate(SubType.ZOMBIE));
|
||||
if (game.getState().getBattlefield().countAll(zombieFilter, controller.getId(), game) > 0) {
|
||||
player.discard(1, false, source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -90,9 +90,8 @@ class ConquerorsFlailColorCount implements DynamicValue {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
return 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -64,19 +64,19 @@ class ConsulateCracksownExileEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player contoller = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
|
||||
//If the permanent leaves the battlefield before the ability resolves, artifacts won't be exiled.
|
||||
if (permanent == null || contoller == null) return false;
|
||||
if (permanent == null || controller == null) return false;
|
||||
|
||||
Set<Card> toExile = new LinkedHashSet<>();
|
||||
for (Permanent artifact : game.getBattlefield().getActivePermanents(filter, contoller.getId(), game)) {
|
||||
for (Permanent artifact : game.getBattlefield().getActivePermanents(filter, controller.getId(), game)) {
|
||||
toExile.add(artifact);
|
||||
}
|
||||
|
||||
if (!toExile.isEmpty()) {
|
||||
contoller.moveCardsToExile(toExile, source, game, true, CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
|
||||
controller.moveCardsToExile(toExile, source, game, true, CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
|
||||
new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility()).apply(game, source);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ConsumingVaporsEffect extends OneShotEffect {
|
|||
|
||||
//A spell or ability could have removed the only legal target this player
|
||||
//had, if thats the case this ability should fizzle.
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
if (player != null && target.canChoose(player.getId(), game)) {
|
||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ConvalescenceEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.getLife() <= 10) {
|
||||
if (player != null && player.getLife() <= 10) {
|
||||
player.gainLife(1, game, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,63 +47,3 @@ public final class CopyEnchantment extends CardImpl {
|
|||
return new CopyEnchantment(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CopyEnchantmentEffect extends CopyPermanentEffect {
|
||||
|
||||
public CopyEnchantmentEffect(FilterPermanent filter) {
|
||||
super(filter, new EmptyApplyToPermanent());
|
||||
}
|
||||
|
||||
public CopyEnchantmentEffect(final CopyEnchantmentEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
if (super.apply(game, source)) {
|
||||
Permanent permanentToCopy = getBluePrintPermanent();
|
||||
if (permanentToCopy != null) {
|
||||
if (permanentToCopy.hasSubtype(SubType.AURA, game)) {
|
||||
Target target = getBluePrintPermanent().getSpellAbility().getTargets().get(0);
|
||||
Outcome auraOutcome = Outcome.BoostCreature;
|
||||
Ability:
|
||||
for (Ability ability : getBluePrintPermanent().getAbilities()) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof AttachEffect) {
|
||||
auraOutcome = effect.getOutcome();
|
||||
break Ability;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
target.setNotTarget(true);
|
||||
if (controller.choose(auraOutcome, target, source.getSourceId(), game)) {
|
||||
UUID targetId = target.getFirstTarget();
|
||||
Permanent targetPermanent = game.getPermanent(targetId);
|
||||
Player targetPlayer = game.getPlayer(targetId);
|
||||
if (targetPermanent != null) {
|
||||
targetPermanent.addAttachment(sourcePermanent.getId(), game);
|
||||
} else if (targetPlayer != null) {
|
||||
targetPlayer.addAttachment(sourcePermanent.getId(), game);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopyEnchantmentEffect copy() {
|
||||
return new CopyEnchantmentEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class CreepingDreadEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
// opponent discards a card - if it is same card type as controller, add to opponentsAffected
|
||||
if(!opponent.getHand().isEmpty()) {
|
||||
if(opponent != null && !opponent.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
|
||||
if(opponent.choose(Outcome.Discard, opponent.getHand(), target, game)) {
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
|
|
|
|||
|
|
@ -78,22 +78,24 @@ class CrosisThePurgerEffect extends OneShotEffect {
|
|||
ChoiceColor choice = new ChoiceColor();
|
||||
player.choose(outcome, choice, game);
|
||||
if (choice.isChosen()) {
|
||||
game.informPlayers(new StringBuilder(player.getLogName()).append(" chooses ").append(choice.getColor()).toString());
|
||||
game.informPlayers(player.getLogName() + " chooses " + choice.getColor());
|
||||
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
List<Card> toDiscard = new ArrayList<>();
|
||||
for (UUID cardId : damagedPlayer.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (filter.match(card, game)) {
|
||||
toDiscard.add(card);
|
||||
if(damagedPlayer != null) {
|
||||
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
List<Card> toDiscard = new ArrayList<>();
|
||||
for (UUID cardId : damagedPlayer.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (filter.match(card, game)) {
|
||||
toDiscard.add(card);
|
||||
}
|
||||
}
|
||||
for (Card card : toDiscard) {
|
||||
damagedPlayer.discard(card, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
for (Card card : toDiscard) {
|
||||
damagedPlayer.discard(card, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ class CrypticGatewayEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (source.getCosts() == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,9 +121,9 @@ class CurseOfEchoesEffect extends OneShotEffect {
|
|||
if (spell != null) {
|
||||
String chooseMessage = "Copy target spell? You may choose new targets for the copy.";
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
if (!playerId.equals(spell.getControllerId())) {
|
||||
if (!spell.isControlledBy(playerId)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player.chooseUse(Outcome.Copy, chooseMessage, source, game)) {
|
||||
if (player != null && player.chooseUse(Outcome.Copy, chooseMessage, source, game)) {
|
||||
spell.createCopyOnStack(game, source, player.getId(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourceObject = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
if (sourceObject.getCounters(game).containsKey(CounterType.SPITE)) {
|
||||
controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), game);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class CyclopsGladiatorEffect extends OneShotEffect {
|
|||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
|
||||
if (player != null && player.chooseTarget(Outcome.Detriment, target, source, game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
Permanent cyclops = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && cyclops != null) {
|
||||
|
|
|
|||
|
|
@ -68,8 +68,10 @@ class DarkRevenantEffect extends OneShotEffect {
|
|||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
owner.getGraveyard().remove(card);
|
||||
return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
if(owner != null) {
|
||||
owner.getGraveyard().remove(card);
|
||||
return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,14 +67,16 @@ class DashHopesCounterSourceEffect extends OneShotEffect {
|
|||
PayLifeCost cost = new PayLifeCost(5);
|
||||
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + '?', source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + '.');
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||
if(player != null) {
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + '?', source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + '.');
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,16 +85,14 @@ class DauntlessBodyguardChooseCreatureEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent mageObject = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, true);
|
||||
if (controller.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Permanent chosenCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (chosenCreature != null) {
|
||||
game.getState().setValue(mageObject.getId() + "_chosenCreature", new MageObjectReference(chosenCreature, game));
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen creature", CardUtil.addToolTipMarkTags("Chosen creature: " + chosenCreature.getIdName()), game);
|
||||
}
|
||||
mageObject.addInfo("chosen creature", CardUtil.addToolTipMarkTags("Chosen creature: " + chosenCreature.getIdName()), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class DeicideExileEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE
|
|||
Card cardInExile = game.getExile().getCard(targetEnchantment.getId(), game);
|
||||
if (cardInExile != null && cardInExile.hasSubtype(SubType.GOD, game)) {
|
||||
Player enchantmentController = game.getPlayer(targetEnchantment.getControllerId());
|
||||
return super.applySearchAndExile(game, source, cardInExile.getName(), enchantmentController.getId());
|
||||
return enchantmentController != null && super.applySearchAndExile(game, source, cardInExile.getName(), enchantmentController.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,11 @@ class DesperateGambitEffect extends PreventionEffectImpl {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
this.target.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), game);
|
||||
this.wonFlip = game.getPlayer(source.getControllerId()).flipCoin(game);
|
||||
super.init(source, game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if(you != null) {
|
||||
wonFlip = you.flipCoin(game);
|
||||
super.init(source, game);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class DiscordantDirgeEffect extends OneShotEffect {
|
|||
TargetCard target = new TargetCard(0, verseCounters, Zone.HAND, new FilterCard());
|
||||
target.setNotTarget(true);
|
||||
if (controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) {
|
||||
target.getTargets().stream().map((targetCardId) -> game.getCard(targetCardId)).filter((card) -> (card != null
|
||||
target.getTargets().stream().map(game::getCard).filter((card) -> (card != null
|
||||
&& targetOpponent.getHand().contains(card.getId()))).forEachOrdered((card) -> {
|
||||
targetOpponent.discard(card, source, game);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class DivineCongregationEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null) {
|
||||
if (controller != null && player != null) {
|
||||
int critters = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game).size();
|
||||
controller.gainLife(2 * critters, game, source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package mage.cards.d;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -28,7 +29,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
public final class DivineReckoning extends CardImpl {
|
||||
|
||||
public DivineReckoning(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}{W}");
|
||||
|
||||
// Each player chooses a creature he or she controls. Destroy the rest.
|
||||
this.getSpellAbility().addEffect(new DivineReckoningEffect());
|
||||
|
|
@ -65,15 +66,16 @@ class DivineReckoningEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(Outcome.Benefit, target, source, game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
chosen.add(permanent);
|
||||
if (player != null) {
|
||||
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(Outcome.Benefit, target, source, game);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
chosen.add(permanent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,16 +89,18 @@ class DragonlordKolaghanTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Spell spell = game.getStack().getSpell(event.getSourceId());
|
||||
if (spell != null && !spell.isFaceDown(game) && (spell.isCreature() || spell.isPlaneswalker())) {
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
boolean sameName = false;
|
||||
for (Card graveCard : opponent.getGraveyard().getCards(game)) {
|
||||
if (CardUtil.haveSameNames(graveCard, spell)) {
|
||||
sameName = true;
|
||||
break;
|
||||
if(opponent != null) {
|
||||
boolean sameName = false;
|
||||
for (Card graveCard : opponent.getGraveyard().getCards(game)) {
|
||||
if (CardUtil.haveSameNames(graveCard, spell)) {
|
||||
sameName = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sameName) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (sameName) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,13 +54,15 @@ class DrasticRevelationEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
you.discardToMax(game);
|
||||
you.drawCards(7, game);
|
||||
Cards hand = you.getHand();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Card card = hand.getRandom(game);
|
||||
if (card != null) {
|
||||
you.discard(card, source, game);
|
||||
if(you != null) {
|
||||
you.discardToMax(game);
|
||||
you.drawCards(7, game);
|
||||
Cards hand = you.getHand();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Card card = hand.getRandom(game);
|
||||
if (card != null) {
|
||||
you.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class EliteArcanistImprintEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (!player.getHand().isEmpty()) {
|
||||
if (player != null && !player.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
|
||||
&& player.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
|
|
@ -105,7 +105,7 @@ class EliteArcanistImprintEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.imprint(card.getId(), game);
|
||||
permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append(']').toString(), game);
|
||||
permanent.addInfo("imprint", "[Exiled card - " + card.getName() + ']', game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,11 @@ class EnfysNestEffect extends ExileTargetEffect {
|
|||
|
||||
// If you do, that player gains life equal to that creature's power.
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
player.gainLife(permanent.getPower().getValue(), game, source);
|
||||
if(player != null) {
|
||||
player.gainLife(permanent.getPower().getValue(), game, source);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class EurekaEffect extends OneShotEffect {
|
|||
playerList.getNext();
|
||||
currentPlayer = game.getPlayer(playerList.get());
|
||||
// if all player since this player didn't put permanent in play finish the process
|
||||
if (currentPlayer.getId().equals(firstInactivePlayer)) {
|
||||
if (currentPlayer != null &¤tPlayer.getId().equals(firstInactivePlayer)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class EyeOfDoomEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
do {
|
||||
target.clearChosen();
|
||||
if (player.chooseTarget(outcome, target, source, game)) {
|
||||
if (player != null && player.chooseTarget(outcome, target, source, game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanents.add(permanent);
|
||||
|
|
|
|||
|
|
@ -77,13 +77,15 @@ class FallOfTheThranReturnEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(2, 2, StaticFilters.FILTER_CARD_LAND);
|
||||
target.setNotTarget(true);
|
||||
target.setTargetController(playerId);
|
||||
if (target.canChoose(source.getSourceId(), playerId, game)) {
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
if (target.getTargets().size() == 2) {
|
||||
toBattlefield.put(playerId, new CardsImpl(target.getTargets()).getCards(game));
|
||||
if(player != null) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(2, 2, StaticFilters.FILTER_CARD_LAND);
|
||||
target.setNotTarget(true);
|
||||
target.setTargetController(playerId);
|
||||
if (target.canChoose(source.getSourceId(), playerId, game)) {
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
if (target.getTargets().size() == 2) {
|
||||
toBattlefield.put(playerId, new CardsImpl(target.getTargets()).getCards(game));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class FeedThePackEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Target target = new TargetPermanent(filter);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
if (player != null && player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) {
|
||||
int toughness = permanent.getToughness().getValue();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ForesightEffect extends SearchEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (player != null && player.searchLibrary(target, game)) {
|
||||
for (UUID targetId : getTargets()) {
|
||||
Card card = player.getLibrary().getCard(targetId, game);
|
||||
if (card != null) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class ForkEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
if (spell != null && controller != null) {
|
||||
Spell copy = spell.copySpell(source.getControllerId());
|
||||
copy.getColor(game).setRed(true);
|
||||
game.getStack().push(copy);
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ class GoToJailUpkeepEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
|
||||
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class GhostQuarterEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(permanent.getControllerId());
|
||||
if (controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
|
||||
if (controller != null && controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class GiantAlbatrossEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
if (sourcePermanent != null && controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
|||
|
|
@ -67,13 +67,15 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect {
|
|||
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
for (SubType landName : Arrays.stream(SubType.values()).filter(p -> p.getSubTypeSet() == SubTypeSet.BasicLandType).collect(Collectors.toSet())) {
|
||||
FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control");
|
||||
filter.add(new SubtypePredicate(landName));
|
||||
Target target = new TargetControlledPermanent(1, 1, filter, true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
lands.add(target.getFirstTarget());
|
||||
if(player != null) {
|
||||
for (SubType landName : Arrays.stream(SubType.values()).filter(p -> p.getSubTypeSet() == SubTypeSet.BasicLandType).collect(Collectors.toSet())) {
|
||||
FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control");
|
||||
filter.add(new SubtypePredicate(landName));
|
||||
Target target = new TargetControlledPermanent(1, 1, filter, true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
lands.add(target.getFirstTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ class GloomlanceEffect extends OneShotEffect {
|
|||
Permanent destroyedCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
if (destroyedCreature.getColor(game).isGreen()
|
||||
|| destroyedCreature.getColor(game).isWhite()) {
|
||||
targetController.discard(1, false, source, game);
|
||||
return true;
|
||||
if(targetController != null) {
|
||||
targetController.discard(1, false, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ class GroveOfTheBurnwillowsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
player.gainLife(1, game, source);
|
||||
if(player != null) {
|
||||
player.gainLife(1, game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class HallOfGemstoneEffect extends ReplacementEffectImpl {
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Permanent mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (player != null && mageObject != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
|
|
@ -81,9 +81,7 @@ class HallOfGemstoneEffect extends ReplacementEffectImpl {
|
|||
game.informPlayers(mageObject.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_color", choice.getColor());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
|
||||
}
|
||||
mageObject.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class HarshMercyEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
if (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
|
||||
if (player != null && !player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
|
||||
continue PlayerIteration;
|
||||
}
|
||||
String chosenType = typeChoice.getChoice();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class HauntingEchoesEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
if (targetPlayer != null && player != null) {
|
||||
for (Card card : targetPlayer.getGraveyard().getCards(game)) {
|
||||
if (!StaticFilters.FILTER_CARD_BASIC_LAND.match(card, game)) {
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class HeraldsHornEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
|
||||
// Look at the top card of your library.
|
||||
if (controller.getLibrary().hasCards()) {
|
||||
if (controller != null && controller.getLibrary().hasCards()) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
|
|
|
|||
|
|
@ -75,13 +75,15 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
for (UUID targetId: targets.get(0).getTargets()) {
|
||||
card = player.getHand().get(targetId, game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
paid |= player.discard(card, null, game);
|
||||
if(player != null) {
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
card = player.getHand().get(targetId, game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
paid |= player.discard(card, null, game);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return paid;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class HydradoodleEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (permanent != null) {
|
||||
if (permanent != null && controller != null) {
|
||||
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (spellAbility != null
|
||||
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.cards.i;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -21,13 +22,12 @@ import mage.target.common.TargetCardInLibrary;
|
|||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public final class Intuition extends CardImpl {
|
||||
|
||||
public Intuition(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
|
||||
|
||||
|
||||
// Search your library for three cards and reveal them. Target opponent chooses one. Put that card into your hand and the rest into your graveyard. Then shuffle your library.
|
||||
|
|
@ -47,7 +47,6 @@ public final class Intuition extends CardImpl {
|
|||
|
||||
class IntuitionEffect extends SearchEffect {
|
||||
|
||||
|
||||
|
||||
public IntuitionEffect() {
|
||||
super(new TargetCardInLibrary(3, new FilterCard()), Outcome.Benefit);
|
||||
|
|
@ -70,22 +69,22 @@ class IntuitionEffect extends SearchEffect {
|
|||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (controller == null || opponent == null)
|
||||
return false;
|
||||
|
||||
|
||||
if (controller.getLibrary().size() >= 3 && controller.searchLibrary(target, game)) {
|
||||
|
||||
|
||||
if (target.getTargets().size() == 3) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = controller.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
controller.revealCards("Reveal", cards, game);
|
||||
|
||||
|
||||
TargetCard targetCard = new TargetCard(Zone.LIBRARY, new FilterCard());
|
||||
|
||||
while(!opponent.choose(Outcome.Neutral, cards, targetCard, game)) {
|
||||
|
||||
while (!opponent.choose(Outcome.Neutral, cards, targetCard, game)) {
|
||||
if (!opponent.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -100,7 +99,7 @@ class IntuitionEffect extends SearchEffect {
|
|||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
controller.shuffleLibrary(source, game);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,23 +62,24 @@ class JacesArchivistEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int maxDiscarded = 0;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int discarded = player.getHand().size();
|
||||
player.discard(discarded, false, source, game);
|
||||
if (discarded > maxDiscarded) {
|
||||
maxDiscarded = discarded;
|
||||
if(controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
int discarded = player.getHand().size();
|
||||
player.discard(discarded, false, source, game);
|
||||
if (discarded > maxDiscarded) {
|
||||
maxDiscarded = discarded;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(maxDiscarded, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.drawCards(maxDiscarded, game);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class JaddiLifestriderEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
if (tappedAmount > 0 && you != null) {
|
||||
you.gainLife(tappedAmount * 2, game, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ class JandorsRingEffect extends OneShotEffect {
|
|||
DiscardCardYouChooseTargetEffect effect = new DiscardCardYouChooseTargetEffect(filter, TargetController.YOU);
|
||||
if (effect.apply(game, source)) {//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
controller.drawCards(1, game);
|
||||
if(controller != null) {
|
||||
controller.drawCards(1, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -70,8 +70,12 @@ class KarnsTemporalSunderingEffect extends OneShotEffect {
|
|||
|
||||
if (returnPermanent != null) {
|
||||
Card returnCard = returnPermanent.getMainCard();
|
||||
Player cardOwner = game.getPlayer(returnCard.getOwnerId());
|
||||
cardOwner.moveCards(returnCard, Zone.HAND, source, game);
|
||||
if(returnCard != null) {
|
||||
Player cardOwner = game.getPlayer(returnCard.getOwnerId());
|
||||
if (cardOwner != null) {
|
||||
cardOwner.moveCards(returnCard, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -126,8 +126,10 @@ class KheruSpellsnatcherCastFromExileEffect extends AsThoughEffectImpl {
|
|||
if (card != null) {
|
||||
if (game.getState().getZone(sourceId) == Zone.EXILED) {
|
||||
Player player = game.getPlayer(affectedControllerId);
|
||||
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
|
||||
return true;
|
||||
if(player != null) {
|
||||
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
this.discard();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,11 @@ class KozilekDiscardCost extends CostImpl {
|
|||
}
|
||||
}
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
for (Card card : controller.getHand().getCards(game)) {
|
||||
if (stackCMC.contains(card.getConvertedManaCost())) {
|
||||
return true;
|
||||
if(controller != null) {
|
||||
for (Card card : controller.getHand().getCards(game)) {
|
||||
if (stackCMC.contains(card.getConvertedManaCost())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -57,9 +57,11 @@ class LaquatussCreativityEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
int handCount = player.getHand().count(new FilterCard(), game);
|
||||
player.drawCards(handCount, game);
|
||||
player.discard(handCount, false, source, game);
|
||||
if(player != null) {
|
||||
int handCount = player.getHand().count(new FilterCard(), game);
|
||||
player.drawCards(handCount, game);
|
||||
player.discard(handCount, false, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class LatNamsLegacyEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (!controller.getHand().isEmpty()) {
|
||||
if (controller != null && !controller.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library"));
|
||||
controller.choose(Outcome.Detriment, controller.getHand(), target, game);
|
||||
Card card = controller.getHand().get(target.getFirstTarget(), game);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class LayBareEffect extends OneShotEffect {
|
|||
Card target = (Card) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
|
||||
if (target != null) {
|
||||
Player controller = game.getPlayer(target.getOwnerId());
|
||||
if (controller != null) {
|
||||
if (controller != null && player != null) {
|
||||
player.lookAtCards("Lay Bare", controller.getHand(), game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -26,7 +27,6 @@ import mage.players.Player;
|
|||
import mage.players.Players;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class LeechriddenSwamp extends CardImpl {
|
||||
|
|
@ -38,7 +38,7 @@ public final class LeechriddenSwamp extends CardImpl {
|
|||
}
|
||||
|
||||
public LeechriddenSwamp(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
this.subtype.add(SubType.SWAMP);
|
||||
|
||||
// ({tap}: Add {B}.)
|
||||
|
|
@ -70,28 +70,28 @@ class LeechriddenSwampLoseLifeEffect extends OneShotEffect {
|
|||
|
||||
private static final String effectText = "each opponent loses 1 life";
|
||||
|
||||
LeechriddenSwampLoseLifeEffect ( ) {
|
||||
LeechriddenSwampLoseLifeEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = effectText;
|
||||
staticText = effectText;
|
||||
}
|
||||
|
||||
LeechriddenSwampLoseLifeEffect ( LeechriddenSwampLoseLifeEffect effect ) {
|
||||
super(effect);
|
||||
LeechriddenSwampLoseLifeEffect(LeechriddenSwampLoseLifeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Players players = game.getPlayers();
|
||||
for ( Player player : players.values() ) {
|
||||
if ( !player.getId().equals(source.getControllerId()) ) {
|
||||
Players players = game.getPlayers();
|
||||
for (Player player : players.values()) {
|
||||
if (!player.getId().equals(source.getControllerId())) {
|
||||
player.loseLife(1, game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeechriddenSwampLoseLifeEffect copy() {
|
||||
return new LeechriddenSwampLoseLifeEffect(this);
|
||||
return new LeechriddenSwampLoseLifeEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ class MagusOfTheMindEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
int stormCount = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() + 1;
|
||||
System.out.println(stormCount);
|
||||
if (controller != null && sourceObject != null) {
|
||||
controller.shuffleLibrary(source, game);
|
||||
if (controller.getLibrary().hasCards()) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class CounterSourceEffect extends OneShotEffect {
|
|||
}
|
||||
if(spell != null){
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + '?', source, game)){
|
||||
if(controller != null && controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + '?', source, game)){
|
||||
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent()));
|
||||
if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){
|
||||
game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + '.');
|
||||
|
|
|
|||
|
|
@ -66,16 +66,18 @@ class ManipulateFateEffect extends SearchEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
for (UUID targetId : getTargets()) {
|
||||
Card card = player.getLibrary().getCard(targetId, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(null, null, targetId, game);
|
||||
if(player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
for (UUID targetId : getTargets()) {
|
||||
Card card = player.getLibrary().getCard(targetId, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(null, null, targetId, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
player.shuffleLibrary(source, game);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,10 @@ class MasterOfTheWildHuntEffect extends OneShotEffect {
|
|||
wolves.add(permanent.getId());
|
||||
}
|
||||
Player player = game.getPlayer(target.getControllerId());
|
||||
player.assignDamage(target.getPower().getValue(), wolves, "Wolf", target.getId(), game);
|
||||
return true;
|
||||
if(player != null) {
|
||||
player.assignDamage(target.getPower().getValue(), wolves, "Wolf", target.getId(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -27,7 +28,6 @@ import mage.target.common.TargetControlledPermanent;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class MechanizedProduction extends CardImpl {
|
||||
|
|
@ -86,15 +86,17 @@ class MechanizedProductionEffect extends OneShotEffect {
|
|||
}
|
||||
Map<String, Integer> countNames = new HashMap<>();
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game)) {
|
||||
int counter = countNames.getOrDefault(permanent.getName(),0);
|
||||
int counter = countNames.getOrDefault(permanent.getName(), 0);
|
||||
countNames.put(permanent.getName(), counter + 1);
|
||||
}
|
||||
for (Entry<String, Integer> entry : countNames.entrySet()) {
|
||||
if (entry.getValue() > 7) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
game.informPlayers(controller.getLogName() + " controls eight or more artifacts with the same name as one another (" + entry.getKey() + ").");
|
||||
controller.won(game);
|
||||
return true;
|
||||
if (controller != null) {
|
||||
game.informPlayers(controller.getLogName() + " controls eight or more artifacts with the same name as one another (" + entry.getKey() + ").");
|
||||
controller.won(game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ class MnemonicNexusEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
if(sourcePlayer == null){
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class MoltenInfluenceEffect extends OneShotEffect {
|
|||
if (spell != null) {
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
String message = "Have Molten Influence do 4 damage to you?";
|
||||
if (player.chooseUse(Outcome.Damage, message, source, game)) {
|
||||
if (player != null && player.chooseUse(Outcome.Damage, message, source, game)) {
|
||||
player.damage(4, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class MultanisDecreeDestroyEffect extends OneShotEffect {
|
|||
enchantmentsDestoyed++;
|
||||
}
|
||||
}
|
||||
if(enchantmentsDestoyed > 0) {
|
||||
if(enchantmentsDestoyed > 0 && controller != null) {
|
||||
controller.gainLife(enchantmentsDestoyed * 2, game, source);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,10 @@ class MyojinOfNightsReachEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
for (Card c : opponent.getHand().getCards(game)) {
|
||||
opponent.discard(c, source, game);
|
||||
if(opponent != null) {
|
||||
for (Card c : opponent.getHand().getCards(game)) {
|
||||
opponent.discard(c, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -67,14 +67,16 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
Card card = player.getHand().get(targetId, game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
isZombieCard = card.hasSubtype(SubType.ZOMBIE, game);
|
||||
paid |= player.discard(card, null, game);
|
||||
if(player != null) {
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
Card card = player.getHand().get(targetId, game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
isZombieCard = card.hasSubtype(SubType.ZOMBIE, game);
|
||||
paid |= player.discard(card, null, game);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return paid;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ class NecroplasmEffect extends OneShotEffect {
|
|||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, numCounters));
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
if(permanent != null) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,8 +193,10 @@ class NicolBolasGodPharaohFromExileEffect extends AsThoughEffectImpl {
|
|||
Card card = game.getCard(sourceId);
|
||||
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
|
||||
Player player = game.getPlayer(affectedControllerId);
|
||||
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
|
||||
return true;
|
||||
if(player != null) {
|
||||
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ class OpenTheVaultsEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
LinkedHashSet<Card> cardsToReturn = new LinkedHashSet<>();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Cards graveyard = game.getPlayer(playerId).getGraveyard();
|
||||
Player player = game.getPlayer(playerId);
|
||||
Cards graveyard = player.getGraveyard();
|
||||
for (UUID cardId : graveyard) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (permanent != null && sourcePlayer != null) {
|
||||
int amount = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
if (amount > 0) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ class PatronOfTheVeinExileCreatureEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller == null){
|
||||
return false;
|
||||
}
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ class CounterSourceEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
if (player != null
|
||||
&& cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + '?', source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||
game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + '.');
|
||||
|
|
|
|||
|
|
@ -43,8 +43,10 @@ public final class PhyrexianPurge extends CardImpl {
|
|||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
Player you = game.getPlayer(ownerId);
|
||||
int maxTargets = you.getLife() / 3;
|
||||
ability.addTarget(new TargetCreaturePermanent(0, maxTargets));
|
||||
if(you != null) {
|
||||
int maxTargets = you.getLife() / 3;
|
||||
ability.addTarget(new TargetCreaturePermanent(0, maxTargets));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class PirsWhimEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
ChooseFriendsAndFoes choice = new ChooseFriendsAndFoes();
|
||||
if (!choice.chooseFriendOrFoe(controller, source, game)) {
|
||||
if (controller != null && !choice.chooseFriendOrFoe(controller, source, game)) {
|
||||
return false;
|
||||
}
|
||||
for (Player player : choice.getFriends()) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class PossessedPortalEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Cost discardCost = new DiscardCardCost();
|
||||
if (discardCost.canPay(source, source.getSourceId(), playerId, game)
|
||||
if (player != null && discardCost.canPay(source, source.getSourceId(), playerId, game)
|
||||
&& player.chooseUse(Outcome.Discard, "Discard a card? (Otherwise sacrifice a permanent)", source, game)) {
|
||||
discardCost.pay(source, game, source.getSourceId(), playerId, true, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class PreeminentCaptainEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
TargetCardInHand target = new TargetCardInHand(filter);
|
||||
if (target.canChoose(controller.getId(), game)
|
||||
if (controller != null && target.canChoose(controller.getId(), game)
|
||||
&& target.choose(getOutcome(), controller.getId(), source.getSourceId(), game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID cardId = target.getFirstTarget();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class PsychicVortexCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
return controller.getLibrary().hasCards();
|
||||
return controller != null && controller.getLibrary().hasCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class RansackEffect extends OneShotEffect {
|
|||
Set<Card> cards = player.getLibrary().getTopCards(game, number);
|
||||
Cards cardsRemaining = new CardsImpl();
|
||||
cardsRemaining.addAll(cards);
|
||||
TargetCard target = new TargetCard((true ? 0 : number), number, Zone.LIBRARY, filter);
|
||||
TargetCard target = new TargetCard(0, number, Zone.LIBRARY, filter);
|
||||
if (player.choose(Outcome.DrawCard, cardsRemaining, target, game)) {
|
||||
Cards pickedCards = new CardsImpl(target.getTargets());
|
||||
cardsRemaining.removeAll(pickedCards);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class RaziasPurificationEffect extends OneShotEffect {
|
|||
|
||||
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true);
|
||||
|
||||
if (target1.canChoose(player.getId(), game)) {
|
||||
if (player != null && target1.canChoose(player.getId(), game)) {
|
||||
int chosenPermanents = 0;
|
||||
while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game) && chosenPermanents < 3) {
|
||||
player.chooseTarget(Outcome.Benefit, target1, source, game);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class RegnaTheRedeemerCondition extends IntCompareCondition {
|
|||
if (watcher != null) {
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (!player.hasOpponent(source.getControllerId(), game)) {
|
||||
if (player != null && !player.hasOpponent(source.getControllerId(), game)) {
|
||||
gainedLife = watcher.getLiveGained(playerId);
|
||||
if (gainedLife > 0) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TapAllEffect;
|
||||
|
|
@ -22,7 +23,6 @@ import mage.players.Player;
|
|||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class RegnasSanction extends CardImpl {
|
||||
|
|
@ -64,7 +64,7 @@ class RegnasSanctionEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
ChooseFriendsAndFoes choice = new ChooseFriendsAndFoes();
|
||||
if (!choice.chooseFriendOrFoe(controller, source, game)) {
|
||||
if (controller != null || !choice.chooseFriendOrFoe(controller, source, game)) {
|
||||
return false;
|
||||
}
|
||||
FilterCreaturePermanent filterToTap = new FilterCreaturePermanent();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue