738 end |
738 end |
739 else |
739 else |
740 statusText = loc("Status Update") |
740 statusText = loc("Status Update") |
741 scoreText = loc("Team scores:") |
741 scoreText = loc("Team scores:") |
742 end |
742 end |
|
743 local displayTime |
|
744 if roundNumber >= roundLimit then |
|
745 displayTime = 20000 |
|
746 else |
|
747 displayTime = 1 |
|
748 end |
743 ShowMission( loc("Space Invasion"), |
749 ShowMission( loc("Space Invasion"), |
744 statusText, |
750 statusText, |
745 string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| " .. "|" .. |
751 string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| " .. "|" .. |
746 scoreText .. " |" ..entireC, 4, 1) |
752 scoreText .. " |" ..entireC, 4, displayTime) |
747 |
753 |
748 if roundNumber >= roundLimit then |
754 if roundNumber >= roundLimit then |
749 local winnerTeam = teamStats[1].name |
755 local winnerTeam = teamStats[1].name |
750 local victorySoundPlayed = false |
|
751 for i = 0, (numhhs-1) do |
756 for i = 0, (numhhs-1) do |
752 if GetHogTeamName(hhs[i]) == winnerTeam then |
757 if GetHogTeamName(hhs[i]) == winnerTeam then |
753 if not victorySoundPlayer then |
|
754 PlaySound(sndVictory, hhs[i]) |
|
755 victorySoundPlayed = true |
|
756 end |
|
757 SetState(hhs[i], bor(GetState(hhs[i]), gstWinner)) |
758 SetState(hhs[i], bor(GetState(hhs[i]), gstWinner)) |
758 end |
759 end |
759 end |
760 end |
760 AddCaption(string.format("%s wins!", winnerTeam)) |
761 AddCaption(string.format("%s wins!", winnerTeam)) |
761 SendStat(siGameResult, string.format("%s wins!", winnerTeam)) |
762 SendStat(siGameResult, string.format("%s wins!", winnerTeam)) |
896 bestScore = teamScore[i] |
897 bestScore = teamScore[i] |
897 bestClan = teamClan[i] |
898 bestClan = teamClan[i] |
898 end |
899 end |
899 end |
900 end |
900 |
901 |
|
902 -- Kill off all the losers |
|
903 for i = 0, (numhhs-1) do |
|
904 if GetHogClan(hhs[i]) ~= bestClan then |
|
905 SetEffect(hhs[i], heResurrectable, 0) |
|
906 SetHealth(hhs[i],0) |
|
907 end |
|
908 end |
|
909 |
|
910 -- Game over |
901 gameOver = true |
911 gameOver = true |
902 EndTurn(true) |
912 EndTurn(true) |
903 TimeLeft = 0 |
913 TimeLeft = 0 |
904 SendStat(siGraphTitle, "Score graph") |
914 SendStat(siGraphTitle, "Score graph") |
905 EndGame() |
|
906 end |
915 end |
907 end |
916 end |
908 |
917 |
909 -- gaudy racer |
918 -- gaudy racer |
910 function CheckForNewRound() |
919 function CheckForNewRound() |
1226 wepCount = 3 |
1235 wepCount = 3 |
1227 |
1236 |
1228 end |
1237 end |
1229 |
1238 |
1230 function onGameStart() |
1239 function onGameStart() |
|
1240 SendGameResultOff() |
|
1241 SendRankingStatsOff() |
|
1242 SendAchievementsStatsOff() |
1231 SendHealthStatsOff() |
1243 SendHealthStatsOff() |
1232 |
1244 |
1233 ShowMission ( |
1245 ShowMission ( |
1234 loc("SPACE INVASION"), |
1246 loc("SPACE INVASION"), |
1235 loc("A Hedgewars mini-game"), |
1247 loc("A Hedgewars mini-game"), |