1
0
Fork 0

Let the Innocents always win when the round ends because of time

This commit is contained in:
Moritz Ruth 2020-06-19 17:53:04 +02:00
parent 2d67cdb3dd
commit f6aa4e97d8
No known key found for this signature in database
GPG key ID: AFD57E23E753841B
2 changed files with 3 additions and 7 deletions

View file

@ -46,7 +46,7 @@ object GameManager {
packetListeners.forEach { ProtocolLibrary.getProtocolManager().addPacketListener(it) } packetListeners.forEach { ProtocolLibrary.getProtocolManager().addPacketListener(it) }
} }
fun letRoleWin(role: Role?) { fun letRoleWin(role: Role) {
ensurePhase(GamePhase.COMBAT) ensurePhase(GamePhase.COMBAT)
GameMessenger.win(role) GameMessenger.win(role)
phase = GamePhase.OVER phase = GamePhase.OVER
@ -165,11 +165,7 @@ object GameManager {
GameMessenger.combatPhaseStarted() GameMessenger.combatPhaseStarted()
Timers.startCombatPhaseTimer { Timers.startCombatPhaseTimer {
if (PlayerManager.getStillLivingRoles().contains(Role.INNOCENT)) { letRoleWin(Role.INNOCENT)
letRoleWin(Role.INNOCENT)
} else {
letRoleWin(null)
}
} }
} }

View file

@ -22,7 +22,7 @@ object PlayerManager {
private fun getAvailablePlayers() = plugin.server.onlinePlayers.filter { it.gameMode === GameMode.SURVIVAL } private fun getAvailablePlayers() = plugin.server.onlinePlayers.filter { it.gameMode === GameMode.SURVIVAL }
private fun getStillLivingRoleGroups() = getStillLivingRoles().map { it.group }.toSet() private fun getStillLivingRoleGroups() = getStillLivingRoles().map { it.group }.toSet()
fun getStillLivingRoles() = tttPlayers.filter { private fun getStillLivingRoles() = tttPlayers.filter {
it.alive || SecondChance.getInstance(it)?.preventRoundEnd == true it.alive || SecondChance.getInstance(it)?.preventRoundEnd == true
}.map { it.role }.toSet() }.map { it.role }.toSet()