mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
server: fixed game freeze on leaving player before finish target selection (example: Nethergoyf, close #13567, related to #11285)
This commit is contained in:
parent
99ca1e6029
commit
62aa310a4f
2 changed files with 26 additions and 13 deletions
|
|
@ -6,7 +6,6 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessPlusOneSourceEffect;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
|
|
@ -100,7 +99,11 @@ class NethergoyfTarget extends TargetCardInYourGraveyard {
|
|||
types.size() + " of 4",
|
||||
types.size() >= 4 ? Color.GREEN : Color.RED
|
||||
);
|
||||
text += " [" + types.stream().map(CardType::toString).collect(Collectors.joining(", ")) + "])";
|
||||
String info = types.stream().map(CardType::toString).collect(Collectors.joining(", "));
|
||||
if (!info.isEmpty()) {
|
||||
text += " [" + info + "]";
|
||||
}
|
||||
text += ")";
|
||||
return text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,17 @@ public class Targets extends ArrayList<Target> implements Copyable<Targets> {
|
|||
}
|
||||
|
||||
public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Ability source, Game game) {
|
||||
if (this.size() > 0) {
|
||||
if (!canChoose(playerId, source, game)) {
|
||||
return false;
|
||||
}
|
||||
while (!isChosen(game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.size() > 0 && !this.doneChoosing(game)) {
|
||||
do {
|
||||
if (!player.canRespond() || !canChoose(playerId, source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Target target = this.getUnchosen(game).get(0);
|
||||
if (!target.choose(outcome, playerId, sourceId, source, game)) {
|
||||
return false;
|
||||
|
|
@ -67,13 +73,17 @@ public class Targets extends ArrayList<Target> implements Copyable<Targets> {
|
|||
}
|
||||
|
||||
public boolean chooseTargets(Outcome outcome, UUID playerId, Ability source, boolean noMana, Game game, boolean canCancel) {
|
||||
if (this.size() > 0) {
|
||||
if (!canChoose(playerId, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.size() > 0 && !this.doneChoosing(game)) {
|
||||
do {
|
||||
if (!player.canRespond() || !canChoose(playerId, source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//int state = game.bookmarkState();
|
||||
while (!isChosen(game)) {
|
||||
Target target = this.getUnchosen(game).get(0);
|
||||
UUID targetController = playerId;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue