mirror of
https://github.com/correl/mage.git
synced 2025-04-11 09:11:12 -09:00
* AI: fixed game freezes for cards with different human/computer logic (#5023);
This commit is contained in:
parent
ea92b1f462
commit
238aa7abdc
1 changed files with 22 additions and 0 deletions
|
@ -95,6 +95,11 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
protected ComputerPlayer(UUID id) {
|
||||
super(id);
|
||||
human = false;
|
||||
userData = UserData.getDefaultUserDataView();
|
||||
userData.setAvatarId(64);
|
||||
userData.setGroupId(UserGroup.COMPUTER.getGroupId());
|
||||
userData.setFlagName("computer.png");
|
||||
pickedCards = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -2551,4 +2556,21 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
return this.getId().equals(obj.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHuman() {
|
||||
if (human) {
|
||||
log.error("computer must be not human", new Throwable());
|
||||
}
|
||||
return human;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(Player player) {
|
||||
super.restore(player);
|
||||
|
||||
// restore used in AI simulations
|
||||
// all human players converted to computer and analyse
|
||||
this.human = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue