share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
changeset 12986 1c38d4370943
parent 12985 add647b0036e
child 12987 ba99ecc53cf0
equal deleted inserted replaced
12985:add647b0036e 12986:1c38d4370943
  1145 function onKingDeath(KingHog)
  1145 function onKingDeath(KingHog)
  1146   local team = getHogInfo(KingHog, 'team')
  1146   local team = getHogInfo(KingHog, 'team')
  1147   local msgColor = getHogInfo(KingHog, 'clanColor')
  1147   local msgColor = getHogInfo(KingHog, 'clanColor')
  1148 
  1148 
  1149   AddCaption(string.format(loc("The king of %s has died!"), team), 0xFFFFFFFF, capgrpGameState)
  1149   AddCaption(string.format(loc("The king of %s has died!"), team), 0xFFFFFFFF, capgrpGameState)
  1150   PlaySound(sndByeBye)
  1150 
  1151   DismissTeam(team)
  1151   -- Kill the rest of the team normally, just like the official King Mode game modifier
  1152 
  1152   for hog, val in pairs(hogInfo) do
  1153   -- for hog, val in pairs(hogInfo) do
  1153     if getHogInfo(hog, 'team') == team then
  1154   --   if getHogInfo(hog, 'team') == team then
  1154       hp = GetHealth(hog)
  1155   --     hp = GetHealth(hog)
  1155       if hp ~= nil and hp > 0 then
  1156   --     if hp ~= nil and hp > 0 then
  1156         SetState(KingHog, gstHHDeath)
  1157   --       SetState(KingHog, gstHHDeath)
  1157         SetHealth(hog, 0)
  1158   --       SetHealth(hog, 0)
  1158         SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
  1159   --       SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
  1159       end
  1160   --     end
  1160     end
  1161   --   end
  1161   end
  1162   -- end
  1162 
       
  1163   -- We don't use DismissTeam, it causes a lot of problems and nasty side-effects.
       
  1164 
  1163 end
  1165 end
  1164 
  1166 
  1165 function onPointsKill(gear)
  1167 function onPointsKill(gear)
  1166   local deathVar = getHogInfo(gear, 'variant')
  1168   local deathVar = getHogInfo(gear, 'variant')
  1167   local killVar = getHogInfo(CurHog, 'variant')
  1169   local killVar = getHogInfo(CurHog, 'variant')
  1652     txt = txt .. loc("Specials: Kings and air generals drop helpers, not weapons").."|"
  1654     txt = txt .. loc("Specials: Kings and air generals drop helpers, not weapons").."|"
  1653     icon = 1 -- Target
  1655     icon = 1 -- Target
  1654   elseif mode == 'king' then
  1656   elseif mode == 'king' then
  1655     txt = txt .. " |"
  1657     txt = txt .. " |"
  1656     txt = txt .. loc("--- King Mode ---").."|"
  1658     txt = txt .. loc("--- King Mode ---").."|"
  1657     txt = txt .. loc("Protect the King: When the king dies, the team is vaporized").."|"
  1659     txt = txt .. loc("Protect the King: When the king dies, so does the team").."|"
  1658     txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|"
  1660     txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|"
  1659     icon = 0 -- Golden Crown
  1661     icon = 0 -- Golden Crown
  1660   elseif mode == 'points' then
  1662   elseif mode == 'points' then
  1661     txt = txt .. " |"
  1663     txt = txt .. " |"
  1662     txt = txt .. loc("--- Points Mode ---").."|"
  1664     txt = txt .. loc("--- Points Mode ---").."|"