mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
* Fixed some functions which locked or stopped the game after a player conceded the game.
This commit is contained in:
parent
f9a53e56fc
commit
4f2f08840b
7 changed files with 10 additions and 5 deletions
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue