* Removed some data from player restoring to fix unintended draws after a player concedes game (#1205)

This commit is contained in:
LevelX2 2015-08-18 17:20:04 +02:00
parent 692148d3c2
commit aa1eb354ef
7 changed files with 65 additions and 29 deletions

View file

@ -50,6 +50,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.targetpointer.FixedTarget;
@ -68,8 +69,8 @@ public class OutpostSiege extends CardImpl {
this.expansionSetCode = "FRF";
// As Outpost Siege enters the battlefield, choose Khans or Dragons.
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null, true,
"As {this} enters the battlefield, choose Khans or Dragons.",""));
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null, true,
"As {this} enters the battlefield, choose Khans or Dragons.", ""));
// * Khans - At the beginning of your upkeep, exile the top card of your library. Until end of turn, you may play that card.
this.addAbility(new ConditionalTriggeredAbility(
@ -80,10 +81,10 @@ public class OutpostSiege extends CardImpl {
// * Dragons - Whenever a creature you control leaves the battlefield, Outpost Siege deals 1 damage to target creature or player.
Ability ability2 = new ConditionalTriggeredAbility(
new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, null, new DamageTargetEffect(1),
new FilterControlledCreaturePermanent(), "", false),
new FilterControlledCreaturePermanent(), "", false),
new ModeChoiceSourceCondition("Dragons"),
ruleTrigger2);
ability2.addTarget(new TargetCreatureOrPlayer());
ability2.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability2);
}
@ -117,13 +118,15 @@ class OutpostSiegeExileEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled";
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName);
if (game.getState().getZone(card.getId()) == Zone.EXILED) {
ContinuousEffect effect = new CastFromNonHandZoneTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
game.addEffect(effect, source);
}
}
@ -156,8 +159,8 @@ class CastFromNonHandZoneTargetEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (getTargetPointer().getTargets(game, source).contains(objectId) &&
source.getControllerId().equals(affectedControllerId)) {
if (getTargetPointer().getTargets(game, source).contains(objectId)
&& source.getControllerId().equals(affectedControllerId)) {
Card card = game.getCard(objectId);
if (card != null) {
return true;

View file

@ -42,7 +42,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Library;
@ -65,7 +64,7 @@ public class AbbotOfKeralKeep extends CardImpl {
// Prowess
this.addAbility(new ProwessAbility());
// When Abbot of Keral Keep enters the battlefield, exile the top card of your library. Until end of turn, you may play that card.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AbbotOfKeralKeepExileEffect()));
}
@ -104,10 +103,10 @@ class AbbotOfKeralKeepExileEffect extends OneShotEffect {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
if (card != null) {
String exileName = new StringBuilder(sourcePermanent.getIdName()).append(" <this card may be played the turn it was exiled>").toString();
controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY, true);
String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>";
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName);
ContinuousEffect effect = new AbbotOfKeralKeepCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
game.addEffect(effect, source);
}
return true;
@ -139,7 +138,7 @@ class AbbotOfKeralKeepCastFromExileEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return source.getControllerId().equals(affectedControllerId) &&
objectId.equals(getTargetPointer().getFirst(game, source));
return source.getControllerId().equals(affectedControllerId)
&& objectId.equals(getTargetPointer().getFirst(game, source));
}
}