mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Show playable cards - Fixed that this feature created NPEs because it was already called if no proper game step is set (small update).
This commit is contained in:
parent
2c6aaf272f
commit
d70a35961b
1 changed files with 4 additions and 1 deletions
|
@ -1982,7 +1982,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public Set<UUID> getPlayableInHand(Game game) {
|
||||
Set<UUID> playable = new HashSet<>();
|
||||
if (game.getStep() != null && !shouldSkipGettingPlayable(game)) {
|
||||
if (!shouldSkipGettingPlayable(game)) {
|
||||
// for clean_up phase show all cards
|
||||
if (game.getPhase() != null && PhaseStep.CLEANUP.equals(game.getPhase().getStep().getType())) {
|
||||
for (Card card: hand.getCards(game)) {
|
||||
|
@ -2025,6 +2025,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* @return
|
||||
*/
|
||||
private boolean shouldSkipGettingPlayable(Game game) {
|
||||
if (game.getStep() == null) { // happens at the start of the game
|
||||
return true;
|
||||
}
|
||||
for (Entry<PhaseStep, Step.StepPart> phaseStep : silentPhaseSteps.entrySet()) {
|
||||
if (game.getPhase() != null && game.getPhase().getStep() != null && phaseStep.getKey().equals(game.getPhase().getStep().getType())) {
|
||||
if (phaseStep.getValue() == null || phaseStep.getValue().equals(game.getPhase().getStep().getStepPart())) {
|
||||
|
|
Loading…
Reference in a new issue