Turn under control reworked:

- game: added support when a human is take control over a computer player (related to #12878);
 - game: fixed game freezes while controlling player leaves/disconnect on active priority/choose of another player;
This commit is contained in:
Oleg Agafonov 2025-01-10 20:18:00 +04:00
parent 49b90820e0
commit 0505f5159e
12 changed files with 534 additions and 32 deletions

View file

@ -46,7 +46,15 @@ import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author BetaSteward_at_googlemail.com
* Warning, if you add new choose dialogs then must implement it for:
* - PlayerImpl (only if it use another default dialogs inside)
* - HumanPlayer (support client-server in human games)
* - ComputerPlayer (support AI in computer games)
* - StubPlayer (temp)
* - ComputerPlayerControllableProxy (support control of one player type over another player type)
* - TestPlayer (support unit tests)
*
* @author BetaSteward_at_googlemail.com, JayDi85
*/
public interface Player extends MageItem, Copyable<Player> {
@ -1212,8 +1220,6 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean addTargets(Ability ability, Game game);
String getHistory();
boolean hasDesignation(DesignationType designationName);
void addDesignation(Designation designation);
@ -1253,4 +1259,8 @@ public interface Player extends MageItem, Copyable<Player> {
* so that's method helps to find real player that used by a game (in most use cases it's a PlayerImpl)
*/
Player getRealPlayer();
default Player prepareControllableProxy(Player playerUnderControl) {
return this;
}
}