# HG changeset patch # User Wuzzy # Date 1519259716 -3600 # Node ID 5ceb8b0632c481c87a38a38ab35c60d3fea175af # Parent 2d0f3e12fcad26efe73a4ac515a489a704ca48ef SimpleMission: Check regular victory at turn and or start diff -r 2d0f3e12fcad -r 5ceb8b0632c4 share/hedgewars/Data/Scripts/SimpleMission.lua --- a/share/hedgewars/Data/Scripts/SimpleMission.lua Thu Feb 22 01:03:40 2018 +0100 +++ b/share/hedgewars/Data/Scripts/SimpleMission.lua Thu Feb 22 01:35:16 2018 +0100 @@ -486,6 +486,19 @@ for t=0, TeamsCount-1 do local team = GetTeamName(t) local defeat = _G.sm.checkGoal({type="teamDefeat", teamName=team}) + if not defeat then + -- Deep check, also look at damage of all hogs + local dead = 0 + for h=1, #teamHogs[team] do + local _,_,_,_,_,_,_,_,_,_,_,Damage = GetGearValues(teamHogs[team][h]) + if Damage >= GetHealth(teamHogs[team][h]) then + dead = dead + 1 + end + end + if dead >= #teamHogs[team] then + defeat = true + end + end if (defeat == true) and (GetTeamClan(team) == _G.sm.playerClan) then victory = false break @@ -504,7 +517,6 @@ if errord then return end - _G.sm.checkRegularVictory() local nonGoalStatus, nonGoalFailText = _G.sm.checkNonGoals() local goalStatus, goalFailText = _G.sm.checkGoals() if nonGoalStatus == true then @@ -685,6 +697,7 @@ _G.sm.gameStarted = true if params.customGoalCheck == "turnStart" then + _G.sm.checkRegularVictory() _G.sm.checkWinOrFail() end end @@ -693,6 +706,7 @@ _G.sm.gameTurns = _G.sm.gameTurns + 1 if params.customGoalCheck == "turnEnd" then + _G.sm.checkRegularVictory() _G.sm.checkWinOrFail() end end