mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
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:
parent
49b90820e0
commit
0505f5159e
12 changed files with 534 additions and 32 deletions
|
|
@ -845,6 +845,10 @@ public abstract class GameImpl implements Game {
|
|||
// concede for itself
|
||||
// stop current player dialog and execute concede
|
||||
currentPriorityPlayer.signalPlayerConcede(true);
|
||||
} else if (currentPriorityPlayer.getTurnControlledBy().equals(playerId)) {
|
||||
// concede for itself while controlling another player
|
||||
// stop current player dialog and execute concede
|
||||
currentPriorityPlayer.signalPlayerConcede(true);
|
||||
} else {
|
||||
// concede for another player
|
||||
// allow current player to continue and check concede on any next priority
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5372,11 +5372,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHistory() {
|
||||
return "no available";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDesignation(DesignationType designationName) {
|
||||
for (Designation designation : designations) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue