* Mind's Desire - Fixed a problem with playing lands.

This commit is contained in:
LevelX2 2017-07-22 12:09:28 +02:00
parent fb19f257a7
commit c6cd713f0d
3 changed files with 22 additions and 20 deletions

View file

@ -920,10 +920,10 @@ public class SessionImpl implements Session {
public boolean leaveChat(UUID chatId) { public boolean leaveChat(UUID chatId) {
// lock.readLock().lock(); // lock.readLock().lock();
try { try {
if (isConnected()) { if (isConnected() && chatId != null) {
server.leaveChat(chatId, sessionId); server.leaveChat(chatId, sessionId);
return true;
} }
return true;
} catch (MageException ex) { } catch (MageException ex) {
handleMageException(ex); handleMageException(ex);
} catch (Throwable t) { } catch (Throwable t) {

View file

@ -27,6 +27,7 @@
*/ */
package mage.cards.k; package mage.cards.k;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -49,8 +50,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -60,7 +59,7 @@ public class KaronaFalseGod extends CardImpl {
public KaronaFalseGod(UUID ownerId, CardSetInfo setInfo) { public KaronaFalseGod(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}{B}{R}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}{B}{R}{G}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add("Avatar"); this.subtype.add(SubType.AVATAR);
this.power = new MageInt(5); this.power = new MageInt(5);
this.toughness = new MageInt(5); this.toughness = new MageInt(5);

View file

@ -53,7 +53,7 @@ import mage.target.targetpointer.FixedTarget;
public class MindsDesire extends CardImpl { public class MindsDesire extends CardImpl {
public MindsDesire(UUID ownerId, CardSetInfo setInfo) { public MindsDesire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
// Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost. // Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost.
this.getSpellAbility().addEffect(new MindsDesireEffect()); this.getSpellAbility().addEffect(new MindsDesireEffect());
@ -76,7 +76,7 @@ class MindsDesireEffect extends OneShotEffect {
MindsDesireEffect() { MindsDesireEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost."; this.staticText = "Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost";
} }
MindsDesireEffect(final MindsDesireEffect effect) { MindsDesireEffect(final MindsDesireEffect effect) {
@ -131,14 +131,17 @@ class MindsDesireCastFromExileEffect extends AsThoughEffectImpl {
} }
@Override @Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
UUID targetId = getTargetPointer().getFirst(game, source); if (objectId != null && objectId.equals(getTargetPointer().getFirst(game, source))) {
Player player = game.getPlayer(affectedControllerId);
if (targetId != null && sourceId != null && targetId.equals(sourceId) && player != null) {
if (affectedControllerId.equals(source.getControllerId())) { if (affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(sourceId); Card card = game.getCard(objectId);
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) { if (card != null && game.getState().getZone(objectId) == Zone.EXILED) {
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts()); if (!card.isLand() && card.getSpellAbility().getCosts() != null) {
Player player = game.getPlayer(affectedControllerId);
if (player != null) {
player.setCastSourceIdWithAlternateMana(objectId, null, card.getSpellAbility().getCosts());
}
}
return true; return true;
} }
} }