Some changes/fixes to epic effect and cards using it.

This commit is contained in:
LevelX2 2014-02-08 14:08:53 +01:00
parent 1c2f0ae65d
commit 81d630b65b
10 changed files with 72 additions and 30 deletions

View file

@ -44,7 +44,7 @@ import mage.game.permanent.token.SnakeToken;
public class EndlessSwarm extends CardImpl<EndlessSwarm> {
public EndlessSwarm(UUID ownerId) {
super(ownerId, 129, "Endless Swarm", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{G}");
super(ownerId, 129, "Endless Swarm", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{G}{G}{G}");
this.expansionSetCode = "SOK";
this.color.setGreen(true);

View file

@ -51,7 +51,7 @@ import mage.target.common.TargetCardInLibrary;
public class EnduringIdeal extends CardImpl<EnduringIdeal> {
public EnduringIdeal(UUID ownerId) {
super(ownerId, 9, "Enduring Ideal", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{W}");
super(ownerId, 9, "Enduring Ideal", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{W}{W}");
this.expansionSetCode = "SOK";
this.color.setWhite(true);

View file

@ -58,7 +58,8 @@ public class EternalDominion extends CardImpl<EternalDominion> {
this.color.setBlue(true);
// Search target opponent's library for an artifact, creature, enchantment, or land card. Put that card onto the battlefield under your control. Then that player shuffles his or her library.
// Search target opponent's library for an artifact, creature, enchantment, or land card.
// Put that card onto the battlefield under your control. Then that player shuffles his or her library.
this.getSpellAbility().addEffect(new EternalDominionEffect());
this.getSpellAbility().addTarget(new TargetOpponent(true));
@ -108,7 +109,7 @@ class EternalDominionEffect extends OneShotEffect<EternalDominionEffect> {
you.searchLibrary(target, game, opponent.getId());
Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) {
applied = targetCard.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), you.getId());
applied = you.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId());
}
opponent.shuffleLibrary(game);
}
@ -119,4 +120,4 @@ class EternalDominionEffect extends OneShotEffect<EternalDominionEffect> {
public EternalDominionEffect copy() {
return new EternalDominionEffect(this);
}
}
}

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
@ -37,6 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
@ -52,7 +53,7 @@ import mage.util.CardUtil;
public class NeverendingTorment extends CardImpl<NeverendingTorment> {
public NeverendingTorment(UUID ownerId) {
super(ownerId, 83, "Neverending Torment", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{B}");
super(ownerId, 83, "Neverending Torment", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
this.expansionSetCode = "SOK";
this.color.setBlack(true);
@ -88,18 +89,17 @@ class NeverendingTormentEffect extends OneShotEffect<NeverendingTormentEffect> {
@Override
public boolean apply(Game game, Ability source) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
boolean applied = false;
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player you = game.getPlayer(source.getControllerId());
if (targetPlayer != null
&& you != null) {
TargetCardInLibrary target = new TargetCardInLibrary(new CardsInControllerHandCount().calculate(game, source), new FilterCard());
TargetCardInLibrary target = new TargetCardInLibrary(you.getHand().size(), new FilterCard());
you.searchLibrary(target, game, targetPlayer.getId());
for (UUID cardId : target.getTargets()) {
final Card targetCard = game.getCard(cardId);
if (targetCard != null) {
applied = targetCard.moveToExile(exileId, "Neverending Torment", source.getSourceId(), game);
applied |= you.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.LIBRARY);
}
}
targetPlayer.shuffleLibrary(game);
@ -111,4 +111,4 @@ class NeverendingTormentEffect extends OneShotEffect<NeverendingTormentEffect> {
public NeverendingTormentEffect copy() {
return new NeverendingTormentEffect(this);
}
}
}

View file

@ -36,12 +36,12 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCreatureOrPlayer;
import mage.util.CardUtil;
/**
*
@ -51,13 +51,14 @@ import mage.util.CardUtil;
public class UndyingFlames extends CardImpl<UndyingFlames> {
public UndyingFlames(UUID ownerId) {
super(ownerId, 119, "Undying Flames", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}");
super(ownerId, 119, "Undying Flames", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{R}{R}");
this.expansionSetCode = "SOK";
this.color.setRed(true);
// Exile cards from the top of your library until you exile a nonland card. Undying Flames deals damage to target creature or player equal to that card's converted mana cost.
this.getSpellAbility().addEffect(new UndyingFlamesEffect());
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true));
// Epic
this.getSpellAbility().addEffect(new EpicEffect());
@ -78,7 +79,7 @@ class UndyingFlamesEffect extends OneShotEffect<UndyingFlamesEffect> {
public UndyingFlamesEffect() {
super(Outcome.Benefit);
staticText = "Exile cards from the top of your library until you exile a nonland card. Undying Flames deals damage to target creature or player equal to that card's converted mana cost";
staticText = "Exile cards from the top of your library until you exile a nonland card. {this} deals damage to target creature or player equal to that card's converted mana cost";
}
public UndyingFlamesEffect(final UndyingFlamesEffect effect) {
@ -87,27 +88,28 @@ class UndyingFlamesEffect extends OneShotEffect<UndyingFlamesEffect> {
@Override
public boolean apply(Game game, Ability source) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
boolean applied = false;
Player you = game.getPlayer(source.getControllerId());
while (you != null
&& you.getLibrary().size() > 0) {
Card sourceCard = game.getCard(source.getSourceId());
while (you != null && sourceCard != null
&& you.getLibrary().size() > 0 && you.isInGame()) {
Card card = you.getLibrary().removeFromTop(game);
if (card != null) {
if (card.getCardType().contains(CardType.LAND)) {
card.moveToExile(exileId, "Undying Flames", source.getSourceId(), game);
} else {
Target target = new TargetCreatureOrPlayer();
if (you.chooseTarget(Outcome.Damage, target, source, game)) {
Permanent creature = game.getPermanent(target.getFirstTarget());
you.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY);
if (!card.getCardType().contains(CardType.LAND)) {
int damage = card.getManaCost().convertedManaCost();
if (damage > 0) {
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (creature != null) {
creature.damage(card.getManaCost().convertedManaCost(), source.getSourceId(), game, true, false);
creature.damage(damage, source.getSourceId(), game, true, false);
game.informPlayers(new StringBuilder(sourceCard.getName()).append(" deals ").append(damage).append(" damage to ").append(creature.getName()).toString());
applied = true;
break;
}
Player player = game.getPlayer(target.getFirstTarget());
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (player != null) {
player.damage(card.getManaCost().convertedManaCost(), source.getSourceId(), game, true, false);
player.damage(card.getManaCost().convertedManaCost(), source.getSourceId(), game, false, true);
game.informPlayers(new StringBuilder(sourceCard.getName()).append(" deals ").append(damage).append(" damage to ").append(player.getName()).toString());
applied = true;
break;
}
@ -122,4 +124,4 @@ class UndyingFlamesEffect extends OneShotEffect<UndyingFlamesEffect> {
public UndyingFlamesEffect copy() {
return new UndyingFlamesEffect(this);
}
}
}

View file

@ -59,6 +59,7 @@ public class EpicEffect extends OneShotEffect<EpicEffect> {
for (Effect effect : spell.getSpellAbility().getEffects()) {
if (effect instanceof EpicEffect) {
epicEffect = effect;
break;
}
}
spell.getSpellAbility().getEffects().remove(epicEffect);
@ -135,8 +136,11 @@ class EpicPushEffect extends OneShotEffect<EpicPushEffect> {
@Override
public boolean apply(Game game, Ability source) {
if (spell != null) {
game.getStack().push(spell);
spell.chooseNewTargets(game, spell.getControllerId());
// don't change the targets of the in the origin copied spell
Spell copySpell = spell.copy();
game.getStack().push(copySpell);
copySpell.chooseNewTargets(game, source.getControllerId());
return true;
}
return false;

View file

@ -86,6 +86,7 @@ public interface Game extends MageItem, Serializable {
MageObject getEmblem(UUID objectId);
UUID getControllerId(UUID objectId);
Permanent getPermanent(UUID permanentId);
Permanent getPermanentOrLKIBattlefield(UUID permanentId);
Card getCard(UUID cardId);
Ability getAbility(UUID abilityId, UUID sourceId);
void setZone(UUID objectId, Zone zone);

View file

@ -388,6 +388,15 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
return state.getPermanent(permanentId);
}
@Override
public Permanent getPermanentOrLKIBattlefield(UUID permanentId) {
Permanent permanent = state.getPermanent(permanentId);
if (permanent == null) {
permanent = (Permanent) this.getLastKnownInformation(permanentId, Zone.BATTLEFIELD);
}
return permanent;
}
@Override
public Card getCard(UUID cardId) {
if (cardId == null) {

View file

@ -369,6 +369,19 @@ public interface Player extends MageItem, Copyable<Player> {
* @return
*/
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
/**
* Uses card.moveToExile and posts a inform message about moving the card to exile
* into the game log
*
* @param card
* @param exileId exile zone id (optional)
* @param exileName name of exile zone (optional)
* @param sourceId
* @param game
* @param fromZone if null, this info isn't postet
* @return
*/
boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone);
/**
* Uses putOntoBattlefield and posts also a info message about in the game log

View file

@ -2100,13 +2100,25 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
return result;
}
@Override
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone) {
boolean result = false;
if (card.moveToExile(exileId, exileName, sourceId, game)) {
game.informPlayers(new StringBuilder(this.getName())
.append(" moves ").append(card.getName()).append(" ")
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"")
.append("to exile").toString());
}
return result;
}
@Override
public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId) {
boolean result = false;
if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId())) {
game.informPlayers(new StringBuilder(this.getName())
.append(" puts ").append(card.getName())
.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ")
.append(" from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ")
.append("onto the Battlefield").toString());
}
return result;