mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
fix crash during mulligan
This commit is contained in:
@@ -318,10 +318,23 @@ public enum FControl {
|
|||||||
return lobby;
|
return lobby;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getCurrentPlayer() {
|
||||||
|
// try current priority
|
||||||
|
Player currentPriority = game.getPhaseHandler().getPriorityPlayer();
|
||||||
|
if( null != currentPriority && currentPriority.getLobbyPlayer() == getLobby().getGuiPlayer() )
|
||||||
|
return currentPriority;
|
||||||
|
|
||||||
|
// otherwise find just any player, belonging to this lobbyplayer
|
||||||
|
for(Player p : game.getPlayers())
|
||||||
|
if(p.getLobbyPlayer() == getLobby().getGuiPlayer() )
|
||||||
|
return p;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean mayShowCard(Card c) {
|
public boolean mayShowCard(Card c) {
|
||||||
if ( game == null ) return true;
|
if ( game == null ) return true;
|
||||||
Player p = game.getPhaseHandler().getPriorityPlayer();
|
return c.canBeShownTo(getCurrentPlayer());
|
||||||
return c.canBeShownTo(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import forge.CardLists;
|
|||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
|
import forge.control.FControl;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.phase.CombatUtil;
|
import forge.game.phase.CombatUtil;
|
||||||
@@ -64,25 +65,13 @@ public enum CDock implements ICDoc {
|
|||||||
|
|
||||||
private int arcState;
|
private int arcState;
|
||||||
private GameState game;
|
private GameState game;
|
||||||
private LobbyPlayer player;
|
|
||||||
|
|
||||||
public void setModel(GameState game0, LobbyPlayer player0) {
|
public void setModel(GameState game0, LobbyPlayer player0) {
|
||||||
game = game0;
|
game = game0;
|
||||||
player = player0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Player findAffectedPlayer() {
|
public Player findAffectedPlayer() {
|
||||||
// try current priority
|
return FControl.SINGLETON_INSTANCE.getCurrentPlayer();
|
||||||
Player currentPriority = game.getPhaseHandler().getPriorityPlayer();
|
|
||||||
if( currentPriority.getLobbyPlayer() == player )
|
|
||||||
return currentPriority;
|
|
||||||
|
|
||||||
// otherwise find just any player, belonging to this lobbyplayer
|
|
||||||
for(Player p : game.getPlayers())
|
|
||||||
if(p.getLobbyPlayer() == player )
|
|
||||||
return p;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Concede game, bring up WinLose UI. */
|
/** Concede game, bring up WinLose UI. */
|
||||||
|
|||||||
Reference in New Issue
Block a user