Take subplot outcomes into account in battle records
authorTheSaminator <TheSaminator@users.noreply.github.com>
Wed, 8 Jun 2022 15:52:12 +0000 (11:52 -0400)
committerTheSaminator <TheSaminator@users.noreply.github.com>
Wed, 8 Jun 2022 15:52:12 +0000 (11:52 -0400)
src/jsMain/kotlin/starshipfights/game/popup.kt
src/jvmMain/kotlin/starshipfights/data/admiralty/battle_records.kt
src/jvmMain/kotlin/starshipfights/game/server_game.kt
src/jvmMain/kotlin/starshipfights/info/views_user.kt

index 9ed0a7c8dcc4823438a5daa6dbad86fbef894d49..09172fba4764d315ae9ebfcc30a7bd0aba560992 100644 (file)
@@ -503,7 +503,7 @@ sealed class Popup<out T> {
                                style = "text-align:center"
                                
                                strong(classes = "heading") {
-                                       +victoryTitle(mySide, winner, subplotStatuses)
+                                       +"${victoryTitle(mySide, winner, subplotStatuses)}!"
                                }
                        }
                        p {
index bf7ce749fdc89ffbf4196afc04456bec87228ef5..e90c09d47f6904725639f35e4fb62df3e4da95af 100644 (file)
@@ -28,6 +28,9 @@ data class BattleRecord(
        val hostAdmiral: Id<Admiral>,
        val guestAdmiral: Id<Admiral>,
        
+       val hostEndingMessage: String,
+       val guestEndingMessage: String,
+       
        val winner: GlobalSide?,
        val winMessage: String,
 ) : DataDocument<BattleRecord> {
index 82752cbeb466a710e5f139a5d7fd2b0100e5dff0..4be90be2122e58be7ccfe8c01fc172a8fc89808e 100644 (file)
@@ -229,6 +229,9 @@ private suspend fun onGameEnd(gameState: GameState, gameEnd: GameEvent.GameEnd,
                hostAdmiral = hostAdmiralId,
                guestAdmiral = guestAdmiralId,
                
+               hostEndingMessage = victoryTitle(GlobalSide.HOST, gameEnd.winner, gameEnd.subplotOutcomes),
+               guestEndingMessage = victoryTitle(GlobalSide.GUEST, gameEnd.winner, gameEnd.subplotOutcomes),
+               
                winner = gameEnd.winner,
                winMessage = gameEnd.message
        )
index d943a4b1b9cff7d1c4c8c85a5705a768b11906cc..b032b602e8e9d92d41839fe7258d21db7d8ff23e 100644 (file)
@@ -633,10 +633,10 @@ suspend fun ApplicationCall.admiralPage(): HTML.() -> Unit {
                                                                }
                                                }
                                                td {
-                                                       +when (record.winner) {
-                                                               null -> "Stalemate"
-                                                               recordRoles[record.id] -> "Victory"
-                                                               else -> "Defeat"
+                                                       +when (recordRoles[record.id]) {
+                                                               GlobalSide.HOST -> record.hostEndingMessage
+                                                               GlobalSide.GUEST -> record.guestEndingMessage
+                                                               else -> "N/A"
                                                        }
                                                }
                                        }