* Fixed some functions which locked or stopped the game after a player conceded the game.

This commit is contained in:
LevelX2 2013-09-25 20:42:00 +02:00
parent f9a53e56fc
commit 4f2f08840b
7 changed files with 10 additions and 5 deletions

View file

@ -484,6 +484,9 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
updateGameStatePriority("playMana", game);
game.firePlayManaEvent(playerId, "Pay " + unpaid.getText());
waitForResponse(game);
if (!this.isInGame()) {
return false;
}
if (response.getBoolean() != null) {
return false;
} else if (response.getUUID() != null) {

View file

@ -92,7 +92,7 @@ public class SacrificeAllEffect extends OneShotEffect<SacrificeAllEffect> {
int numTargets = Math.min(amount.calculate(game, source), game.getBattlefield().countAll(filter, player.getId(), game));
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
if (target.canChoose(player.getId(), game)) {
while (!target.isChosen()) {
while (!target.isChosen() && player.isInGame()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
perms.addAll(target.getTargets());

View file

@ -94,7 +94,7 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
//had, if thats the case this ability should fizzle.
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
boolean abilityApplied = false;
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}

View file

@ -88,7 +88,7 @@ public class SacrificeOpponentsEffect extends OneShotEffect<SacrificeOpponentsEf
int numTargets = Math.min(amount.calculate(game, source), game.getBattlefield().countAll(filter, player.getId(), game));
TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false);
if (target.canChoose(player.getId(), game)) {
while (!target.isChosen()) {
while (!target.isChosen() && player.isInGame()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
perms.addAll(target.getTargets());

View file

@ -126,7 +126,7 @@ class AnnihilatorEffect extends OneShotEffect<AnnihilatorEffect> {
//had, if thats the case this ability should fizzle.
if (target.canChoose(player.getId(), game)) {
boolean abilityApplied = false;
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}

View file

@ -153,8 +153,9 @@ class ChampionExileCost extends CostImpl<ChampionExileCost> {
if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null)
if (permanent == null) {
return false;
}
paid |= permanent.moveToExile(sourceId, exileZone, sourceId, game);
}
}

View file

@ -54,6 +54,7 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
protected int minNumberOfTargets;
protected boolean required = false;
protected boolean chosen = false;
// is the target handled as targeted spell/ability (notTarget = true is used for not targeted effects like e.g. sacrifice)
protected boolean notTarget = false;
protected boolean atRandom = false;