Files
2026-06-19 23:09:49 +02:00

1155 lines
82 KiB
HTML

<!DOCTYPE HTML>
<html lang="it">
<head>
<!-- Generated by javadoc (25) on Fri Jun 19 23:05:23 CEST 2026 -->
<title>Game</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2026-06-19">
<meta name="description" content="declaration: module: it.polimi.ingsw.gc14, package: it.polimi.ingsw.gc14.Model, class: Game">
<meta name="generator" content="javadoc/ClassWriter">
<link rel="stylesheet" type="text/css" href="../../../../../../resource-files/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="../../../../../../resource-files/stylesheet.css">
<script type="text/javascript" src="../../../../../../script-files/script.js"></script>
<script type="text/javascript" src="../../../../../../script-files/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="../../../../../../script-files/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">const pathtoroot = "../../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="nav-content">
<div class="nav-menu-button"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button></div>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../module-summary.html">Module</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../search.html">Search</a></li>
<li><a href="../../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
</div>
<div class="sub-nav">
<div class="nav-content">
<ol class="sub-nav-list">
<li><a href="../../../../../module-summary.html">it.polimi.ingsw.gc14</a></li>
<li><a href="package-summary.html">it.polimi.ingsw.gc14.Model</a></li>
<li><a href="Game.html" class="current-selection">Game</a></li>
</ol>
<div class="nav-list-search"><input type="text" id="search-input" disabled placeholder="Search documentation (type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false"><input type="reset" id="reset-search" disabled value="Reset"></div>
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="main-grid">
<nav role="navigation" class="toc" aria-label="Table of contents">
<div class="toc-header">Contents&nbsp;<input type="text" class="filter-input" disabled placeholder="Filter contents (type .)" aria-label="Filter table of contents" autocomplete="off" spellcheck="false"><input type="reset" class="reset-filter" disabled tabindex="-1" value="Reset"></div>
<ol class="toc-list" tabindex="-1">
<li><a href="#" tabindex="0">Description</a></li>
<li><a href="#field-summary" tabindex="0">Field Summary</a></li>
<li><a href="#constructor-summary" tabindex="0">Constructor Summary</a></li>
<li><a href="#method-summary" tabindex="0">Method Summary</a></li>
<li><a href="#field-detail" tabindex="0">Field Details</a>
<ol class="toc-list">
<li><a href="#playerStanding" tabindex="0">playerStanding</a></li>
<li><a href="#totemChoiceQueue" tabindex="0">totemChoiceQueue</a></li>
<li><a href="#disconnectedPlayers" tabindex="0">disconnectedPlayers</a></li>
<li><a href="#playersList" tabindex="0">playersList</a></li>
<li><a href="#currentState" tabindex="0">currentState</a></li>
<li><a href="#slotMap" tabindex="0">slotMap</a></li>
<li><a href="#nPlayers" tabindex="0">nPlayers</a></li>
<li><a href="#optionalCardQueue" tabindex="0">optionalCardQueue</a></li>
<li><a href="#orderLogicCard" tabindex="0">orderLogicCard</a></li>
<li><a href="#board" tabindex="0">board</a></li>
</ol>
</li>
<li><a href="#constructor-detail" tabindex="0">Constructor Details</a>
<ol class="toc-list">
<li><a href="#%3Cinit%3E(int)" tabindex="0">Game(int)</a></li>
<li><a href="#%3Cinit%3E()" tabindex="0">Game()</a></li>
</ol>
</li>
<li><a href="#method-detail" tabindex="0">Method Details</a>
<ol class="toc-list">
<li><a href="#getPlayerStanding()" tabindex="0">getPlayerStanding()</a></li>
<li><a href="#getPlayers()" tabindex="0">getPlayers()</a></li>
<li><a href="#getAvailableTotems()" tabindex="0">getAvailableTotems()</a></li>
<li><a href="#totemChoice(it.polimi.ingsw.gc14.Model.Player,it.polimi.ingsw.gc14.Model.Totems)" tabindex="0">totemChoice(Player, Totems)</a></li>
<li><a href="#getDisconnectedPlayers()" tabindex="0">getDisconnectedPlayers()</a></li>
<li><a href="#disconnectedPlayer(it.polimi.ingsw.gc14.Model.Player)" tabindex="0">disconnectedPlayer(Player)</a></li>
<li><a href="#reconnectPlayer(it.polimi.ingsw.gc14.Model.Player)" tabindex="0">reconnectPlayer(Player)</a></li>
<li><a href="#clearDisconnected()" tabindex="0">clearDisconnected()</a></li>
<li><a href="#getCurrentPlayerNumber()" tabindex="0">getCurrentPlayerNumber()</a></li>
<li><a href="#getSlotMap()" tabindex="0">getSlotMap()</a></li>
<li><a href="#getOrderLogicCard()" tabindex="0">getOrderLogicCard()</a></li>
<li><a href="#getBoard()" tabindex="0">getBoard()</a></li>
<li><a href="#getUpperListTribeCards()" tabindex="0">getUpperListTribeCards()</a></li>
<li><a href="#getLowerListTribeCards()" tabindex="0">getLowerListTribeCards()</a></li>
<li><a href="#getUpperListBuilding()" tabindex="0">getUpperListBuilding()</a></li>
<li><a href="#getLowerListBuilding()" tabindex="0">getLowerListBuilding()</a></li>
<li><a href="#getCurrentState()" tabindex="0">getCurrentState()</a></li>
<li><a href="#getPlayerByUsername(java.lang.String)" tabindex="0">getPlayerByUsername(String)</a></li>
<li><a href="#getNPlayers()" tabindex="0">getNPlayers()</a></li>
<li><a href="#addPlayer(it.polimi.ingsw.gc14.Model.Player)" tabindex="0">addPlayer(Player)</a></li>
<li><a href="#init()" tabindex="0">init()</a></li>
<li><a href="#slotChoiceByIndex(it.polimi.ingsw.gc14.Model.Player,int)" tabindex="0">slotChoiceByIndex(Player, int)</a></li>
<li><a href="#drawUpperTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" tabindex="0">drawUpperTribeCardByIndex(Player, int)</a></li>
<li><a href="#skipTurn(it.polimi.ingsw.gc14.Model.Player)" tabindex="0">skipTurn(Player)</a></li>
<li><a href="#drawLowerTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" tabindex="0">drawLowerTribeCardByIndex(Player, int)</a></li>
<li><a href="#drawUpperBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" tabindex="0">drawUpperBuildingCardByIndex(Player, int)</a></li>
<li><a href="#drawLowerBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" tabindex="0">drawLowerBuildingCardByIndex(Player, int)</a></li>
<li><a href="#nextPlayerSetup()" tabindex="0">nextPlayerSetup()</a></li>
<li><a href="#transitionToOptionalOrNextRound()" tabindex="0">transitionToOptionalOrNextRound()</a></li>
<li><a href="#hasDrawableUp()" tabindex="0">hasDrawableUp()</a></li>
<li><a href="#hasDrawableDown()" tabindex="0">hasDrawableDown()</a></li>
<li><a href="#eventResolution()" tabindex="0">eventResolution()</a></li>
<li><a href="#nextRound()" tabindex="0">nextRound()</a></li>
<li><a href="#endGame()" tabindex="0">endGame()</a></li>
<li><a href="#setNPlayer(int)" tabindex="0">setNPlayer(int)</a></li>
<li><a href="#endGameForfeit()" tabindex="0">endGameForfeit()</a></li>
</ol>
</li>
</ol>
<button class="hide-sidebar"><span>Hide sidebar&nbsp;</span><img src="../../../../../../resource-files/left.svg" alt="Hide sidebar"></button><button class="show-sidebar"><img src="../../../../../../resource-files/right.svg" alt="Show sidebar"><span>&nbsp;Show sidebar</span></button></nav>
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h1 title="Class Game" class="title">Class Game</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">it.polimi.ingsw.gc14.Model.Game</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code></dd>
</dl>
<hr>
<div class="horizontal-scroll">
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Game</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
implements <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></span></div>
<div class="block">Represents the main game model.
A Game object stores the players, the current state of the match,
the slot assignments, the board, and the logic required to manage the game flow.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../../../serialized-form.html#it.polimi.ingsw.gc14.Model.Game">Serialized Form</a></li>
</ul>
</dd>
</dl>
</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>private <a href="GamePackage/Board.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">Board</a></code></div>
<div class="col-second even-row-color"><code><a href="#board" class="member-name-link">board</a></code></div>
<div class="col-last even-row-color">
<div class="block">The board associated with this game.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="GamePackage/CurrentState.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">CurrentState</a></code></div>
<div class="col-second odd-row-color"><code><a href="#currentState" class="member-name-link">currentState</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The current state of the game.</div>
</div>
<div class="col-first even-row-color"><code>private final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#disconnectedPlayers" class="member-name-link">disconnectedPlayers</a></code></div>
<div class="col-last even-row-color">
<div class="block">Map tracking the players who are currently disconnected.</div>
</div>
<div class="col-first odd-row-color"><code>private int</code></div>
<div class="col-second odd-row-color"><code><a href="#nPlayers" class="member-name-link">nPlayers</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The configured number of players for this game.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Queue.html" title="class or interface in java.util" class="external-link">Queue</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#optionalCardQueue" class="member-name-link">optionalCardQueue</a></code></div>
<div class="col-last even-row-color">
<div class="block">The queue of players involved in optional card resolution.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="OrderLogicCard.html" title="class in it.polimi.ingsw.gc14.Model">OrderLogicCard</a></code></div>
<div class="col-second odd-row-color"><code><a href="#orderLogicCard" class="member-name-link">orderLogicCard</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The order logic card associated with this game.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#playersList" class="member-name-link">playersList</a></code></div>
<div class="col-last even-row-color">
<div class="block">The list of players participating in the game.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second odd-row-color"><code><a href="#playerStanding" class="member-name-link">playerStanding</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The final ranking of players at the end of the game.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/HashMap.html" title="class or interface in java.util" class="external-link">HashMap</a><wbr>&lt;<a href="Slot.html" title="class in it.polimi.ingsw.gc14.Model">Slot</a>,<wbr><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#slotMap" class="member-name-link">slotMap</a></code></div>
<div class="col-last even-row-color">
<div class="block">The mapping between slots and the players assigned to them.</div>
</div>
<div class="col-first odd-row-color"><code>private final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Queue.html" title="class or interface in java.util" class="external-link">Queue</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second odd-row-color"><code><a href="#totemChoiceQueue" class="member-name-link">totemChoiceQueue</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Queue containing the players who still have to choose their totem.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">Game</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a game with 0 configured players.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(int)" class="member-name-link">Game</a><wbr>(int&nbsp;nPlayers)</code></div>
<div class="col-last odd-row-color">
<div class="block">Creates a game with the specified number of players.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addPlayer(it.polimi.ingsw.gc14.Model.Player)" class="member-name-link">addPlayer</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to add the specified player to the game.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clearDisconnected()" class="member-name-link">clearDisconnected</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Clears the collection of disconnected players.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#disconnectedPlayer(it.polimi.ingsw.gc14.Model.Player)" class="member-name-link">disconnectedPlayer</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Marks the specified player as disconnected and updates the game flow accordingly.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#drawLowerBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" class="member-name-link">drawLowerBuildingCardByIndex</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to draw the lower building card at the specified index for the specified player.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#drawLowerTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" class="member-name-link">drawLowerTribeCardByIndex</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to draw the lower tribe card at the specified index for the specified player.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#drawUpperBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" class="member-name-link">drawUpperBuildingCardByIndex</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to draw the upper building card at the specified index for the specified player.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#drawUpperTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)" class="member-name-link">drawUpperTribeCardByIndex</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to draw the upper tribe card at the specified index for the specified player.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#endGame()" class="member-name-link">endGame</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Ends the game by applying all final building effects owned by each player
and updating the game stage to <code>ENDED</code>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#endGameForfeit()" class="member-name-link">endGameForfeit</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Ends the game by forfeit and determines the final player standing.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#eventResolution()" class="member-name-link">eventResolution</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Resolves all pending event cards if the current game stage is <code>RESOLVING_EVENT</code>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a><wbr>&lt;<a href="Totems.html" title="enum class in it.polimi.ingsw.gc14.Model">Totems</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getAvailableTotems()" class="member-name-link">getAvailableTotems</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the list of totems that have not yet been assigned to any player.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GamePackage/Board.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">Board</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getBoard()" class="member-name-link">getBoard</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the game board.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getCurrentPlayerNumber()" class="member-name-link">getCurrentPlayerNumber</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the current number of players participating in the game.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GamePackage/CurrentState.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">CurrentState</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getCurrentState()" class="member-name-link">getCurrentState</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the current state of the game.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDisconnectedPlayers()" class="member-name-link">getDisconnectedPlayers</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns an unmodifiable view of the disconnected-players map.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Cards/BuildingCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">BuildingCard</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getLowerListBuilding()" class="member-name-link">getLowerListBuilding</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a copy of the lower building cards currently available on the board.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Cards/TribeCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">TribeCard</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getLowerListTribeCards()" class="member-name-link">getLowerListTribeCards</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a copy of the lower tribe cards currently available on the board.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getNPlayers()" class="member-name-link">getNPlayers</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the configured number of players for this game.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="OrderLogicCard.html" title="class in it.polimi.ingsw.gc14.Model">OrderLogicCard</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getOrderLogicCard()" class="member-name-link">getOrderLogicCard</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the order logic card associated with this game.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPlayerByUsername(java.lang.String)" class="member-name-link">getPlayerByUsername</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;username)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the player with the specified username, if present.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPlayers()" class="member-name-link">getPlayers</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the list of players participating in the game.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPlayerStanding()" class="member-name-link">getPlayerStanding</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the final ranking of players.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/HashMap.html" title="class or interface in java.util" class="external-link">HashMap</a><wbr>&lt;<a href="Slot.html" title="class in it.polimi.ingsw.gc14.Model">Slot</a>,<wbr><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSlotMap()" class="member-name-link">getSlotMap</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the map of slots assigned to players.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Cards/BuildingCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">BuildingCard</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getUpperListBuilding()" class="member-name-link">getUpperListBuilding</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a copy of the upper building cards currently available on the board.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="Cards/TribeCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">TribeCard</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getUpperListTribeCards()" class="member-name-link">getUpperListTribeCards</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a copy of the upper tribe cards currently available on the board.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#hasDrawableDown()" class="member-name-link">hasDrawableDown</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Checks whether there are any drawable lower tribe cards on the board,
i.e. lower tribe cards that are not event cards.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#hasDrawableUp()" class="member-name-link">hasDrawableUp</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Checks whether there are any drawable upper tribe cards on the board,
i.e. upper tribe cards that are not event cards.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#init()" class="member-name-link">init</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Initializes the game after all required players have been added.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#nextPlayerSetup()" class="member-name-link">nextPlayerSetup</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Prepares the next player and updates the game state according to the current game stage.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#nextRound()" class="member-name-link">nextRound</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Advances the game to the next round.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#reconnectPlayer(it.polimi.ingsw.gc14.Model.Player)" class="member-name-link">reconnectPlayer</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Marks the specified player as reconnected.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setNPlayer(int)" class="member-name-link">setNPlayer</a><wbr>(int&nbsp;nPlayers)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets the configured number of players for this game.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#skipTurn(it.polimi.ingsw.gc14.Model.Player)" class="member-name-link">skipTurn</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Skips the turn for the specified player when no drawable cards are available.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#slotChoiceByIndex(it.polimi.ingsw.gc14.Model.Player,int)" class="member-name-link">slotChoiceByIndex</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;slotIndex)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Attempts to assign the slot at the specified index to the specified player.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#totemChoice(it.polimi.ingsw.gc14.Model.Player,it.polimi.ingsw.gc14.Model.Totems)" class="member-name-link">totemChoice</a><wbr>(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
<a href="Totems.html" title="enum class in it.polimi.ingsw.gc14.Model">Totems</a>&nbsp;totem)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Assigns the selected totem to the specified player during the totem choice phase.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#transitionToOptionalOrNextRound()" class="member-name-link">transitionToOptionalOrNextRound</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Transitions the game to the optional card phase or directly to the next round.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#method-summary" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="playerStanding">
<h3>playerStanding</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">playerStanding</span></div>
<div class="block">The final ranking of players at the end of the game.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="totemChoiceQueue">
<h3>totemChoiceQueue</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Queue.html" title="class or interface in java.util" class="external-link">Queue</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">totemChoiceQueue</span></div>
<div class="block">Queue containing the players who still have to choose their totem.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="disconnectedPlayers">
<h3>disconnectedPlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</span>&nbsp;<span class="element-name">disconnectedPlayers</span></div>
<div class="block">Map tracking the players who are currently disconnected.
Key: player; value: <code>true</code> if currently disconnected, <code>false</code> if reconnected.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="playersList">
<h3>playersList</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">playersList</span></div>
<div class="block">The list of players participating in the game.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="currentState">
<h3>currentState</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="GamePackage/CurrentState.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">CurrentState</a></span>&nbsp;<span class="element-name">currentState</span></div>
<div class="block">The current state of the game.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="slotMap">
<h3>slotMap</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/HashMap.html" title="class or interface in java.util" class="external-link">HashMap</a>&lt;<a href="Slot.html" title="class in it.polimi.ingsw.gc14.Model">Slot</a>,<wbr><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">slotMap</span></div>
<div class="block">The mapping between slots and the players assigned to them.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="nPlayers">
<h3>nPlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">nPlayers</span></div>
<div class="block">The configured number of players for this game.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="optionalCardQueue">
<h3>optionalCardQueue</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Queue.html" title="class or interface in java.util" class="external-link">Queue</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">optionalCardQueue</span></div>
<div class="block">The queue of players involved in optional card resolution.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="orderLogicCard">
<h3>orderLogicCard</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="OrderLogicCard.html" title="class in it.polimi.ingsw.gc14.Model">OrderLogicCard</a></span>&nbsp;<span class="element-name">orderLogicCard</span></div>
<div class="block">The order logic card associated with this game.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="board">
<h3>board</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="GamePackage/Board.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">Board</a></span>&nbsp;<span class="element-name">board</span></div>
<div class="block">The board associated with this game.</div>
</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(int)">
<h3>Game</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Game</span><wbr><span class="parameters">(int&nbsp;nPlayers)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div>
<div class="block">Creates a game with the specified number of players.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>nPlayers</code> - the configured number of players for the game.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if <code>nPlayers &lt; 0</code> or <code>nPlayers &gt; 5</code>.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>Game</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Game</span>()</div>
<div class="block">Creates a game with 0 configured players.</div>
</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getPlayerStanding()">
<h3>getPlayerStanding</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">getPlayerStanding</span>()</div>
<div class="block">Returns the final ranking of players.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the list of players ordered according to their final standing.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getPlayers()">
<h3>getPlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">getPlayers</span>()</div>
<div class="block">Returns the list of players participating in the game.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a copy of the list of players currently participating in the game.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getAvailableTotems()">
<h3>getAvailableTotems</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Totems.html" title="enum class in it.polimi.ingsw.gc14.Model">Totems</a>&gt;</span>&nbsp;<span class="element-name">getAvailableTotems</span>()</div>
<div class="block">Returns the list of totems that have not yet been assigned to any player.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the list of currently available totems.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="totemChoice(it.polimi.ingsw.gc14.Model.Player,it.polimi.ingsw.gc14.Model.Totems)">
<h3>totemChoice</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">totemChoice</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
<a href="Totems.html" title="enum class in it.polimi.ingsw.gc14.Model">Totems</a>&nbsp;totem)</span></div>
<div class="block">Assigns the selected totem to the specified player during the totem choice phase.
<p>The choice is accepted only if the game is currently in the
<a href="GamePackage/GameStages.html#TOTEM_CHOICE"><code>GameStages.TOTEM_CHOICE</code></a> stage, the player is the current one,
and the selected totem is still available.
<p>After a valid choice, the method advances to the next player in the queue.
If all players have completed the selection, the game moves to the slot choice phase.
Disconnected players are automatically assigned a random available totem.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player making the totem choice.</dd>
<dd><code>totem</code> - the selected totem.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the choice is applied successfully, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getDisconnectedPlayers()">
<h3>getDisconnectedPlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</span>&nbsp;<span class="element-name">getDisconnectedPlayers</span>()</div>
<div class="block">Returns an unmodifiable view of the disconnected-players map.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>map from player to disconnection status.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="disconnectedPlayer(it.polimi.ingsw.gc14.Model.Player)">
<h3>disconnectedPlayer</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">disconnectedPlayer</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</span></div>
<div class="block">Marks the specified player as disconnected and updates the game flow accordingly.
<p>If the player disconnects during the waiting phase, they are removed from
the player list and from the totem choice queue. If the disconnected player is
the current one, the game advances to the next suitable player or, during the
totem choice phase, handles the remaining selection flow automatically.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player who disconnected.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the disconnection is handled successfully,
<code>false</code> if the player was already marked as disconnected.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="reconnectPlayer(it.polimi.ingsw.gc14.Model.Player)">
<h3>reconnectPlayer</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">reconnectPlayer</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</span></div>
<div class="block">Marks the specified player as reconnected.
<p>If the player reconnects during the slot choice phase, they are removed
from the disconnected players map and reinserted into the order logic card
when necessary.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player who reconnected.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the reconnection is handled successfully,
<code>false</code> if the player was not previously marked as disconnected.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="clearDisconnected()">
<h3>clearDisconnected</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">clearDisconnected</span>()</div>
<div class="block">Clears the collection of disconnected players.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="getCurrentPlayerNumber()">
<h3>getCurrentPlayerNumber</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getCurrentPlayerNumber</span>()</div>
<div class="block">Returns the current number of players participating in the game.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the current number of players.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getSlotMap()">
<h3>getSlotMap</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/HashMap.html" title="class or interface in java.util" class="external-link">HashMap</a>&lt;<a href="Slot.html" title="class in it.polimi.ingsw.gc14.Model">Slot</a>,<wbr><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&gt;</span>&nbsp;<span class="element-name">getSlotMap</span>()</div>
<div class="block">Returns the map of slots assigned to players.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the map that associates each slot with the corresponding player.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getOrderLogicCard()">
<h3>getOrderLogicCard</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="OrderLogicCard.html" title="class in it.polimi.ingsw.gc14.Model">OrderLogicCard</a></span>&nbsp;<span class="element-name">getOrderLogicCard</span>()</div>
<div class="block">Returns the order logic card associated with this game.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the order logic card.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getBoard()">
<h3>getBoard</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="GamePackage/Board.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">Board</a></span>&nbsp;<span class="element-name">getBoard</span>()</div>
<div class="block">Returns the game board.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the board associated with the game.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getUpperListTribeCards()">
<h3>getUpperListTribeCards</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Cards/TribeCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">TribeCard</a>&gt;</span>&nbsp;<span class="element-name">getUpperListTribeCards</span>()</div>
<div class="block">Returns a copy of the upper tribe cards currently available on the board.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a new list containing the upper tribe cards currently on the board.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getLowerListTribeCards()">
<h3>getLowerListTribeCards</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Cards/TribeCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">TribeCard</a>&gt;</span>&nbsp;<span class="element-name">getLowerListTribeCards</span>()</div>
<div class="block">Returns a copy of the lower tribe cards currently available on the board.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a new list containing the lower tribe cards currently on the board.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getUpperListBuilding()">
<h3>getUpperListBuilding</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Cards/BuildingCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">BuildingCard</a>&gt;</span>&nbsp;<span class="element-name">getUpperListBuilding</span>()</div>
<div class="block">Returns a copy of the upper building cards currently available on the board.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a new list containing the upper building cards currently on the board.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getLowerListBuilding()">
<h3>getLowerListBuilding</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="Cards/BuildingCard.html" title="class in it.polimi.ingsw.gc14.Model.Cards">BuildingCard</a>&gt;</span>&nbsp;<span class="element-name">getLowerListBuilding</span>()</div>
<div class="block">Returns a copy of the lower building cards currently available on the board.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a new list containing the lower building cards currently on the board.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getCurrentState()">
<h3>getCurrentState</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="GamePackage/CurrentState.html" title="class in it.polimi.ingsw.gc14.Model.GamePackage">CurrentState</a></span>&nbsp;<span class="element-name">getCurrentState</span>()</div>
<div class="block">Returns the current state of the game.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the current state of the game.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getPlayerByUsername(java.lang.String)">
<h3>getPlayerByUsername</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a></span>&nbsp;<span class="element-name">getPlayerByUsername</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;username)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang" class="external-link">IndexOutOfBoundsException</a></span></div>
<div class="block">Returns the player with the specified username, if present.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>username</code> - the username of the player to search for.</dd>
<dt>Returns:</dt>
<dd>the player with the specified username, or <code>null</code> if no such player exists.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang" class="external-link">IndexOutOfBoundsException</a></code> - if an index access error occurs.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getNPlayers()">
<h3>getNPlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getNPlayers</span>()</div>
<div class="block">Returns the configured number of players for this game.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the configured number of players for this game.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="addPlayer(it.polimi.ingsw.gc14.Model.Player)">
<h3>addPlayer</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">addPlayer</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</span></div>
<div class="block">Attempts to add the specified player to the game.
The operation succeeds only if the configured number of players is not 0,
the current game stage is <code>WAITING</code>, and the player is not already present.
If the number of players reaches the configured maximum, the game is initialized.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player to add to the game.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the player is successfully added, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="init()">
<h3>init</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">init</span>()</div>
<div class="block">Initializes the game after all required players have been added.
The method creates the appropriate order logic card according to the number of players,
selects the first current player, and updates the game stage to <code>SLOT_CHOICE</code>.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="slotChoiceByIndex(it.polimi.ingsw.gc14.Model.Player,int)">
<h3>slotChoiceByIndex</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">slotChoiceByIndex</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;slotIndex)</span></div>
<div class="block">Attempts to assign the slot at the specified index to the specified player.
The operation succeeds only if the index is valid, the current game stage is <code>SLOT_CHOICE</code>,
the specified player is the current player, and the selected slot is not already assigned.
If the slot is successfully assigned, the next player setup is triggered.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player performing the slot choice.</dd>
<dd><code>slotIndex</code> - the index of the selected slot.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the slot choice succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="drawUpperTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)">
<h3>drawUpperTribeCardByIndex</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">drawUpperTribeCardByIndex</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</span></div>
<div class="block">Attempts to draw the upper tribe card at the specified index for the specified player.
The operation succeeds only if the index is valid, the game stage is <code>RESOLVING_ACTIONS</code>,
the specified player is the current player, at least one upper card draw is still available,
and the selected tribe card is not an event card.
If successful, the card is inserted into the player's collection, removed from the board,
and the number of remaining upper draws is decremented.
If both upper and lower draws become zero, the next player setup is triggered.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player performing the draw.</dd>
<dd><code>cardIndex</code> - the index of the upper tribe card to draw.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the draw succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="skipTurn(it.polimi.ingsw.gc14.Model.Player)">
<h3>skipTurn</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">skipTurn</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player)</span></div>
<div class="block">Skips the turn for the specified player when no drawable cards are available.
The operation succeeds only if the current game stage is <code>RESOLVING_ACTIONS</code>,
the specified player is the current player,
and the player can't draw tribe card (i.e. all remaining lower tribe cards are event cards).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player skipping the turn .</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the skip succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="drawLowerTribeCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)">
<h3>drawLowerTribeCardByIndex</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">drawLowerTribeCardByIndex</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</span></div>
<div class="block">Attempts to draw the lower tribe card at the specified index for the specified player.
The operation succeeds only if the index is valid, the game stage is <code>RESOLVING_ACTIONS</code>,
the specified player is the current player, at least one lower card draw is still available,
and the selected tribe card is not an event card.
If successful, the card is inserted into the player's collection, removed from the board,
and the number of remaining lower draws is decremented.
If both lower and upper draws become zero, the next player setup is triggered.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player performing the draw.</dd>
<dd><code>cardIndex</code> - the index of the lower tribe card to draw.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the draw succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="drawUpperBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)">
<h3>drawUpperBuildingCardByIndex</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">drawUpperBuildingCardByIndex</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</span></div>
<div class="block">Attempts to draw the upper building card at the specified index for the specified player.
The operation succeeds only if the index is valid, the game stage is <code>RESOLVING_ACTIONS</code>,
the specified player is the current player, at least one upper card draw is still available,
and the selected building card can be bought by the player.
If successful, the building card is removed from the board and the number of remaining upper draws is decremented.
If both upper and lower draws become zero, the next player setup is triggered.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player performing the draw.</dd>
<dd><code>cardIndex</code> - the index of the upper building card to draw.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the draw succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="drawLowerBuildingCardByIndex(it.polimi.ingsw.gc14.Model.Player,int)">
<h3>drawLowerBuildingCardByIndex</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">drawLowerBuildingCardByIndex</span><wbr><span class="parameters">(<a href="Player.html" title="class in it.polimi.ingsw.gc14.Model">Player</a>&nbsp;player,
int&nbsp;cardIndex)</span></div>
<div class="block">Attempts to draw the lower building card at the specified index for the specified player.
The operation succeeds only if the index is valid, the game stage is <code>RESOLVING_ACTIONS</code>,
the specified player is the current player, at least one lower card draw is still available,
and the selected building card can be bought by the player.
If successful, the building card is removed from the board and the number of remaining lower draws is decremented.
If both lower and upper draws become zero, the next player setup is triggered.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>player</code> - the player performing the draw.</dd>
<dd><code>cardIndex</code> - the index of the lower building card to draw.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the draw succeeds, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="nextPlayerSetup()">
<h3>nextPlayerSetup</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">nextPlayerSetup</span>()</div>
<div class="block">Prepares the next player and updates the game state according to the current game stage.
If the current stage is <code>SLOT_CHOICE</code>, the next player is taken from the order logic card.
If no player is available, the game stage is updated to <code>RESOLVING_ACTIONS</code>
and the first assigned slot is selected.
If the current stage is <code>RESOLVING_ACTIONS</code>, the current player is pushed back
into the order logic card, the current slot is freed, and the next assigned slot is selected.
If no assigned slots remain, the game stage is updated to <code>OPTIONAL_CARD_EFFECT</code>,
the optional card queue is built from players owning building cards with effect id equal to 12,
and the first player in that queue is selected.
If no player is available for optional card resolution, the game stage is updated to
<code>RESOLVING_EVENT</code>; then, if the round number is less than 10, the next round is prepared,
otherwise event resolution is performed, the game stage is updated to <code>ENDING</code>,
and the game is ended.
If the current stage is <code>OPTIONAL_CARD_EFFECT</code>, the next player is taken from the optional card queue.
If no player is available, the game stage is updated to <code>RESOLVING_EVENT</code>.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="transitionToOptionalOrNextRound()">
<h3>transitionToOptionalOrNextRound</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">transitionToOptionalOrNextRound</span>()</div>
<div class="block">Transitions the game to the optional card phase or directly to the next round.
<p>Builds a queue of non-disconnected players who own Building 12 (optional card effect).
If such players exist, the first one is set as the current player for their optional action.
Otherwise, if the round counter is below 10, the next round begins and the game stage
is set to <a href="GamePackage/GameStages.html#SLOT_CHOICE"><code>GameStages.SLOT_CHOICE</code></a>; if round 10 has been completed, the game ends.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="hasDrawableUp()">
<h3>hasDrawableUp</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">hasDrawableUp</span>()</div>
<div class="block">Checks whether there are any drawable upper tribe cards on the board,
i.e. upper tribe cards that are not event cards.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd><code>true</code> if at least one non-event upper tribe card is available, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="hasDrawableDown()">
<h3>hasDrawableDown</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">hasDrawableDown</span>()</div>
<div class="block">Checks whether there are any drawable lower tribe cards on the board,
i.e. lower tribe cards that are not event cards.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd><code>true</code> if at least one non-event lower tribe card is available, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="eventResolution()">
<h3>eventResolution</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">eventResolution</span>()</div>
<div class="block">Resolves all pending event cards if the current game stage is <code>RESOLVING_EVENT</code>.
All pending events are activated on the player list.
Event cards of type <code>SUSTENANCE</code> are resolved after all other pending events.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="nextRound()">
<h3>nextRound</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">nextRound</span>()</div>
<div class="block">Advances the game to the next round.
The method first resolves pending events.
If the current round is 10, the game stage is updated to <code>ENDING</code> and the game is ended.
Otherwise, the era is updated if the board changes era, and the round number is incremented.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="endGame()">
<h3>endGame</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">endGame</span>()</div>
<div class="block">Ends the game by applying all final building effects owned by each player
and updating the game stage to <code>ENDED</code>.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="setNPlayer(int)">
<h3>setNPlayer</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">setNPlayer</span><wbr><span class="parameters">(int&nbsp;nPlayers)</span></div>
<div class="block">Sets the configured number of players for this game.
The operation succeeds only if the current configured number of players is 0.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>nPlayers</code> - the new configured number of players.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the number of players is updated, <code>false</code> otherwise.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="endGameForfeit()">
<h3>endGameForfeit</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">endGameForfeit</span>()</div>
<div class="block">Ends the game by forfeit and determines the final player standing.
<p>The player who is still connected is declared the winner and placed
in the first position of the final ranking. The remaining players are
ordered by prestige value and, in case of a tie, by food value.</div>
</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</body>
</html>