Some more changes concerning ThoughtAsEffects.

This commit is contained in:
LevelX2 2014-08-09 11:48:40 +02:00
parent d1a8678086
commit 2ca945fabf
45 changed files with 3306 additions and 206 deletions

View file

@ -96,7 +96,7 @@ class MisthollowGriffinPlayEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(source.getSourceId())) {
Card card = game.getCard(source.getSourceId());
if (card != null && card.getOwnerId().equals(source.getControllerId()) && game.getState().getZone(source.getSourceId()) == Zone.EXILED) {

View file

@ -40,6 +40,8 @@ import mage.players.Player;
import mage.target.common.TargetOpponent;
import java.util.UUID;
import mage.abilities.effects.ContinuousEffect;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -86,20 +88,22 @@ class StolenGoodsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null && player.getLibrary().size() > 0) {
Library library = player.getLibrary();
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
if (opponent != null && opponent.getLibrary().size() > 0) {
Library library = opponent.getLibrary();
Card card;
do {
card = library.removeFromTop(game);
if (card != null) {
card.moveToExile(source.getId(), "Stolen Goods", source.getSourceId(), game);
opponent.moveCardToExileWithInfo(card, source.getId(), "Stolen Goods", source.getSourceId(), game, Zone.LIBRARY);
}
} while (library.size() > 0 && card != null && card.getCardType().contains(CardType.LAND));
if (card != null) {
player.revealCards("Card to cast", new CardsImpl(card), game);
game.addEffect(new StolenGoodsCastFromExileEffect(card.getId()), source);
opponent.revealCards("Card to cast", new CardsImpl(card), game);
ContinuousEffect effect = new StolenGoodsCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
return true;
}
@ -109,17 +113,13 @@ class StolenGoodsEffect extends OneShotEffect {
class StolenGoodsCastFromExileEffect extends AsThoughEffectImpl {
private final UUID cardId;
public StolenGoodsCastFromExileEffect(UUID cardId) {
public StolenGoodsCastFromExileEffect() {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may cast card from exile";
this.cardId = cardId;
}
public StolenGoodsCastFromExileEffect(final StolenGoodsCastFromExileEffect effect) {
super(effect);
cardId = effect.cardId;
}
@Override
@ -133,14 +133,12 @@ class StolenGoodsCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getZone(this.cardId) == Zone.EXILED) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.chooseUse(Outcome.Benefit, "Cast the card without paying cost?", game)) {
player.cast(card.getSpellAbility(), game, true);
}
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (getTargetPointer().getFirst(game, source).equals(sourceId) && affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(sourceId);
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
Player player = game.getPlayer(affectedControllerId);
player.setCastSourceIdWithoutMana(sourceId);
return true;
}
}

View file

@ -134,7 +134,7 @@ class OrnateKanzashiCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getZone(this.cardId) == Zone.EXILED) {

View file

@ -99,7 +99,7 @@ class BlockTappedEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
return true;

View file

@ -99,7 +99,7 @@ class ThousandYearElixirEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
return permanent != null
&& permanent.getCardType().contains(CardType.CREATURE)

View file

@ -118,7 +118,7 @@ class FiendOfTheShadowsEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
if (card != null) {
ExileZone zone = game.getExile().getExileZone(exileId);

View file

@ -89,7 +89,7 @@ class GravecrawlerPlayEffect extends AsThoughEffectImpl {
public GravecrawlerPlayEffect() {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast Gravecrawler from your graveyard as long as you control a Zombie";
staticText = "You may cast {this} from your graveyard as long as you control a Zombie";
}
public GravecrawlerPlayEffect(final GravecrawlerPlayEffect effect) {
@ -107,10 +107,10 @@ class GravecrawlerPlayEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(source.getSourceId())) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(source.getSourceId()) && source.getControllerId().equals(affectedControllerId)) {
Card card = game.getCard(source.getSourceId());
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD && game.canPlaySorcery(source.getControllerId())) {
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) {
return true;
}

View file

@ -114,16 +114,8 @@ class HavengulLichPlayEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (targetPointer.getFirst(game, source).equals(sourceId)) {
if (game.getState().getZone(sourceId) == Zone.GRAVEYARD) {
Card card = game.getCard(sourceId);
if (card != null && card.getSpellAbility() != null && card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
return true;
}
}
}
return false;
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return targetPointer.getFirst(game, source).equals(sourceId) && game.getState().getZone(sourceId) == Zone.GRAVEYARD;
}
}

View file

@ -113,7 +113,7 @@ class AsThoughNoDefenderEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Permanent nivixCyclops = game.getPermanent(source.getSourceId());
if (nivixCyclops != null
&& nivixCyclops.getAbilities().containsKey(DefenderAbility.getInstance().getId())) {

View file

@ -246,7 +246,7 @@ class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
Card sourceCard = game.getCard(source.getSourceId());

View file

@ -111,7 +111,7 @@ class GlaringSpotlightEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Permanent creature = game.getPermanent(sourceId);
if (creature != null) {
if (game.getOpponents(source.getControllerId()).contains(creature.getControllerId())) {

View file

@ -149,7 +149,7 @@ class NightveilSpecterEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {

View file

@ -114,7 +114,7 @@ class QuickenAsThoughEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (quickenWatcher.isQuickenSpellActive(source.getSourceId(), zoneChangeCounter)) {
Card card = game.getCard(sourceId);
if (card != null && card.getCardType().contains(CardType.SORCERY) && card.getOwnerId().equals(source.getControllerId())) {

View file

@ -30,9 +30,9 @@ package mage.sets.journeyintonyx;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.TrampleAbility;
@ -42,13 +42,13 @@ import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Library;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -110,7 +110,9 @@ class PropheticFlamespeakerExileEffect extends OneShotEffect {
if (card != null) {
String exileName = new StringBuilder(sourcePermanent.getName()).append(" <this card may be played the turn it was exiled>").toString();
controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY);
game.addEffect(new PropheticFlamespeakerCastFromExileEffect(card.getId()), source);
ContinuousEffect effect = new PropheticFlamespeakerCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
return true;
}
@ -120,17 +122,13 @@ class PropheticFlamespeakerExileEffect extends OneShotEffect {
class PropheticFlamespeakerCastFromExileEffect extends AsThoughEffectImpl {
private final UUID cardId;
public PropheticFlamespeakerCastFromExileEffect(UUID cardId) {
public PropheticFlamespeakerCastFromExileEffect() {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play card from exile";
this.cardId = cardId;
}
public PropheticFlamespeakerCastFromExileEffect(final PropheticFlamespeakerCastFromExileEffect effect) {
super(effect);
cardId = effect.cardId;
}
@Override
@ -144,32 +142,7 @@ class PropheticFlamespeakerCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getZone(this.cardId) == Zone.EXILED) {
Player player = game.getPlayer(source.getControllerId());
if (player != null ) {
if (card.getCardType().contains(CardType.LAND)) {
// If the revealed card is a land, you can play it only if it's your turn and you can play still a land this turn.
if (player.canPlayLand()
&& game.getActivePlayerId().equals(player.getId())
&& game.getStack().isEmpty()
&& (game.getStep().getType().equals(PhaseStep.PRECOMBAT_MAIN) || game.getStep().getType().equals(PhaseStep.POSTCOMBAT_MAIN))
&& player.chooseUse(Outcome.Benefit, "Play this card?", game)) {
return player.playLand(card, game);
}
} else {
Ability ability = card.getSpellAbility();
if (ability != null && ability instanceof SpellAbility
&& ((SpellAbility)ability).spellCanBeActivatedRegularlyNow(player.getId(), game)
&& player.chooseUse(Outcome.Benefit, "Play this card?", game)) {
return player.cast((SpellAbility) ability, game, false);
}
}
}
}
}
return false;
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return sourceId.equals(getTargetPointer().getFirst(game, source)) && game.getState().getZone(sourceId) == Zone.EXILED;
}
}

View file

@ -248,7 +248,7 @@ class ChandraPyromasterCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (targetPointer.getTargets(game, source).contains(sourceId)) {
return game.getState().getZone(sourceId).equals(Zone.EXILED);
}

View file

@ -128,7 +128,7 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (watcher.isSavageSummoningSpellActive()) {
Card card = game.getCard(sourceId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getOwnerId().equals(source.getControllerId())) {

View file

@ -140,7 +140,7 @@ class ActOnImpulseMayPlayExiledEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(sourceId) == Zone.EXILED) {

View file

@ -138,7 +138,7 @@ class PraetorsGraspPlayEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId);
Player controller = game.getPlayer(source.getControllerId());
@ -177,7 +177,7 @@ class PraetorsGraspRevealEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId);
Card sourceCard = game.getCard(source.getSourceId());

View file

@ -104,7 +104,7 @@ class OgreJailbreakerEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(source.getSourceId()) && gateCondition.apply(game, source)) {
return true;
}

View file

@ -46,8 +46,6 @@ import java.util.UUID;
*/
public class WarmongersChariot extends CardImpl {
private static final String staticText = "As long as equipped creature has defender, it can attack as though it didn't have defender";
public WarmongersChariot(UUID ownerId) {
super(ownerId, 226, "Warmonger's Chariot", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "ROE";
@ -95,7 +93,7 @@ class WarmongersChariotEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo());

View file

@ -152,7 +152,7 @@ class KnacksawCliqueCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getExile().getExileZone(exileId).contains(cardId)) {

View file

@ -95,7 +95,7 @@ class CanBlockAsThoughtIthadShadowEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return sourceId.equals(source.getSourceId());
}

View file

@ -34,6 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.cards.Card;
@ -49,6 +50,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
@ -129,7 +131,9 @@ class DaxosOfMeletisEffect extends OneShotEffect {
// allow to cast the card
game.addEffect(new DaxosOfMeletisCastFromExileEffect(card.getId(), exileId), source);
// and you may spend mana as though it were mana of any color to cast it
game.addEffect(new DaxosOfMeletisSpendAnyManaEffect(card.getId()), source);
ContinuousEffect effect = new DaxosOfMeletisSpendAnyManaEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
}
return true;
@ -168,32 +172,20 @@ class DaxosOfMeletisCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getExile().getExileZone(exileId).contains(cardId)) {
if (card.getSpellAbility() != null && card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
return true;
}
}
}
return false;
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return sourceId.equals(cardId) && game.getState().getExile().getExileZone(exileId).contains(cardId);
}
}
class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl {
private final UUID cardId;
public DaxosOfMeletisSpendAnyManaEffect(UUID cardId) {
public DaxosOfMeletisSpendAnyManaEffect() {
super(AsThoughEffectType.SPEND_ANY_MANA, Duration.EndOfTurn, Outcome.Benefit);
staticText = "you may spend mana as though it were mana of any color to cast it";
this.cardId = cardId;
}
public DaxosOfMeletisSpendAnyManaEffect(final DaxosOfMeletisSpendAnyManaEffect effect) {
super(effect);
this.cardId = effect.cardId;
}
@Override
@ -207,7 +199,7 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
return sourceId.equals(this.cardId);
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return sourceId.equals(getTargetPointer().getFirst(game, source));
}
}

View file

@ -30,6 +30,7 @@ package mage.sets.theros;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -44,6 +45,7 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
@ -100,13 +102,13 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
if (opponent != null) {
opponent.revealCards("Psychic Intrusion", opponent.getHand(), game);
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int cardsGraveyard = opponent.getGraveyard().count(filter, game);
int cardsHand = opponent.getHand().count(filter, game);
boolean fromHand = false;
if (cardsGraveyard > 0 && cardsHand > 0) {
if (you.chooseUse(Outcome.Detriment, "Exile card from opponents Hand?", game)) {
if (controller.chooseUse(Outcome.Detriment, "Exile card from opponents Hand?", game)) {
fromHand = true;
}
} else {
@ -117,15 +119,15 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
Card card = null;
if (cardsHand > 0 && fromHand) {
TargetCard target = new TargetCard(Zone.PICK, filter);
if (you.choose(Outcome.Benefit, opponent.getHand(), target, game)) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (controller.choose(Outcome.Benefit, opponent.getHand(), target, game)) {
card = opponent.getHand().get(target.getFirstTarget(), game);
}
}
if (cardsGraveyard > 0 && !fromHand) {
TargetCard target = new TargetCard(Zone.PICK, filter);
if (you.choose(Outcome.Benefit, opponent.getGraveyard(), target, game)) {
TargetCard target = new TargetCard(Zone.GRAVEYARD, filter);
if (controller.choose(Outcome.Benefit, opponent.getGraveyard(), target, game)) {
card = opponent.getGraveyard().get(target.getFirstTarget(), game);
}
@ -133,18 +135,15 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
if (card != null) {
// move card to exile
UUID exileId = CardUtil.getCardExileZoneId(game, source);
card.moveToExile(exileId, "Psychic Intrusion", source.getSourceId(), game);
controller.moveCardToExileWithInfo(card, exileId, "Psychic Intrusion", source.getSourceId(), game, fromHand ? Zone.HAND:Zone.GRAVEYARD);
// allow to cast the card
game.addEffect(new PsychicIntrusionCastFromExileEffect(card.getId(), exileId), source);
ContinuousEffect effect = new PsychicIntrusionCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
// and you may spend mana as though it were mana of any color to cast it
game.addEffect(new PsychicIntrusionSpendAnyManaEffect(card.getId()), source);
game.informPlayers(new StringBuilder("Psychic Intrusion: ")
.append(you.getName())
.append(" exiles ")
.append(card.getName())
.append(" from")
.append(fromHand ? " hand":" graveyard").toString());
effect = new PsychicIntrusionSpendAnyManaEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
return true;
}
@ -155,20 +154,13 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
private UUID cardId;
private UUID exileId;
public PsychicIntrusionCastFromExileEffect(UUID cardId, UUID exileId) {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
public PsychicIntrusionCastFromExileEffect() {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
staticText = "You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color to cast that spell";
this.cardId = cardId;
this.exileId = exileId;
}
public PsychicIntrusionCastFromExileEffect(final PsychicIntrusionCastFromExileEffect effect) {
super(effect);
this.cardId = effect.cardId;
this.exileId = effect.exileId;
}
@Override
@ -182,13 +174,12 @@ class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getExile().getExileZone(exileId).contains(cardId)) {
if (card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
return true;
}
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(getTargetPointer().getFirst(game, source))) {
if (game.getState().getZone(sourceId).equals(Zone.EXILED)) {
return true;
} else {
discard();
}
}
return false;
@ -197,17 +188,13 @@ class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl {
private UUID cardId;
public PsychicIntrusionSpendAnyManaEffect(UUID cardId) {
super(AsThoughEffectType.SPEND_ANY_MANA, Duration.EndOfGame, Outcome.Benefit);
public PsychicIntrusionSpendAnyManaEffect() {
super(AsThoughEffectType.SPEND_ANY_MANA, Duration.Custom, Outcome.Benefit);
staticText = "you may spend mana as though it were mana of any color to cast it";
this.cardId = cardId;
}
public PsychicIntrusionSpendAnyManaEffect(final PsychicIntrusionSpendAnyManaEffect effect) {
super(effect);
this.cardId = effect.cardId;
}
@Override
@ -221,9 +208,13 @@ class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
return true;
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(getTargetPointer().getFirst(game, source))) {
if (game.getState().getZone(sourceId).equals(Zone.EXILED)) {
return true;
} else {
discard();
}
}
return false;
}

View file

@ -74,7 +74,6 @@ public class GrinningTotem extends CardImpl {
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetOpponent());
// ability.addEffect(new GrinningTotemMayPlayEffect());
// At the beginning of your next upkeep, if you haven't played it, put it into its owner's graveyard.
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new GrinningTotemDelayedTriggeredAbility()));
@ -165,7 +164,7 @@ class GrinningTotemMayPlayEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (targetPointer.getTargets(game, source).contains(sourceId)) {
return game.getState().getZone(sourceId).equals(Zone.EXILED);
}

View file

@ -28,20 +28,27 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -81,7 +88,7 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect {
ThadaAdelAcquisitorEffect() {
super(Outcome.Exile);
staticText = "search that player's library for an artifact card and exile it. Then that player shuffles his or her library. Until end of turn, you may play that card";
staticText = "search that player's library for an artifact card and exile it. Then that player shuffles his or her library. Until end of turn, you may play that card";
}
ThadaAdelAcquisitorEffect(final ThadaAdelAcquisitorEffect effect) {
@ -90,20 +97,21 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (you == null || damagedPlayer == null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || damagedPlayer == null || sourceObject == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard());
you.searchLibrary(target, game, damagedPlayer.getId());
if (you.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game, damagedPlayer.getId())) {
if (target.getTargets().size() > 0) {
UUID cardId = target.getTargets().get(0);
Card card = damagedPlayer.getLibrary().remove(cardId, game);
Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
card.moveToExile(source.getSourceId(), "Thada Adel", source.getId(), game);
game.addEffect(new ThadaAdelPlayFromExileEffect(card.getId()), source);
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY);
ContinuousEffect effect = new ThadaAdelPlayFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
}
}
@ -119,17 +127,13 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect {
class ThadaAdelPlayFromExileEffect extends AsThoughEffectImpl {
private final UUID cardId;
public ThadaAdelPlayFromExileEffect(UUID cardId) {
public ThadaAdelPlayFromExileEffect() {
super(AsThoughEffectType.CAST_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play this card from exile";
this.cardId = cardId;
}
public ThadaAdelPlayFromExileEffect(final ThadaAdelPlayFromExileEffect effect) {
super(effect);
cardId = effect.cardId;
}
@Override
@ -143,13 +147,7 @@ class ThadaAdelPlayFromExileEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(this.cardId)) {
Card card = game.getCard(this.cardId);
if (card != null && game.getState().getZone(this.cardId) == Zone.EXILED) {
return true;
}
}
return false;
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
return sourceId.equals(getTargetPointer().getFirst(game, source)) && game.getState().getZone(sourceId) == Zone.EXILED;
}
}