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

@ -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;