* 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) {
// lock.readLock().lock();
try {
if (isConnected()) {
if (isConnected() && chatId != null) {
server.leaveChat(chatId, sessionId);
return true;
}
return true;
} catch (MageException ex) {
handleMageException(ex);
} catch (Throwable t) {

View file

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

View file

@ -53,11 +53,11 @@ import mage.target.targetpointer.FixedTarget;
public class MindsDesire extends CardImpl {
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.
this.getSpellAbility().addEffect(new MindsDesireEffect());
// Storm
this.addAbility(new StormAbility());
}
@ -73,21 +73,21 @@ public class MindsDesire extends CardImpl {
}
class MindsDesireEffect extends OneShotEffect {
MindsDesireEffect() {
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) {
super(effect);
}
@Override
public MindsDesireEffect copy() {
return new MindsDesireEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
@ -131,18 +131,21 @@ class MindsDesireCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
UUID targetId = getTargetPointer().getFirst(game, source);
Player player = game.getPlayer(affectedControllerId);
if (targetId != null && sourceId != null && targetId.equals(sourceId) && player != null) {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (objectId != null && objectId.equals(getTargetPointer().getFirst(game, source))) {
if (affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(sourceId);
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
player.setCastSourceIdWithAlternateMana(sourceId, null, card.getSpellAbility().getCosts());
Card card = game.getCard(objectId);
if (card != null && game.getState().getZone(objectId) == Zone.EXILED) {
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 false;
}
}
}