share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
changeset 11909 1d2e89be3eb6
parent 11237 4b833bb1621c
child 12288 a5a7d0c6d3f3
equal deleted inserted replaced
11908:a267482ad461 11909:1d2e89be3eb6
     1 local MUTANT_VERSION = "v0.9.5"
       
     2 
       
     3 --[[                  ___                   ___
     1 --[[                  ___                   ___
     4                     (   )                 (   )
     2                     (   )                 (   )
     5 ___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
     3 ___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
     6 (   )   '   (   )(   (   __) / .-, (   )   (   __)
     4 (   )   '   (   )(   (   __) / .-, (   )   (   __)
     7 |  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
     5 |  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
    65 local teams = {}
    63 local teams = {}
    66 
    64 
    67 local circles = {}
    65 local circles = {}
    68 local circleFrame = -1
    66 local circleFrame = -1
    69 
    67 
    70 function showStartingInfo()
    68 -- Variables for custom achievements
    71 
    69 
    72 	ruleSet = loc("RULES") .. ": " ..
    70 -- Most kills in 1 turn
    73 	" |" .. --" |" ..
    71 local recordKills = 0
    74 	loc("The first player to kill someone becomes the Mutant.") .. "|" ..
    72 local recordKillsHogName = nil
       
    73 local recordKillsTeamName = nil
       
    74 
       
    75 -- Most suicides
       
    76 local recordSuicides = 0
       
    77 local recordSuicidesHogName = nil
       
    78 local recordSuicidesTeamName = nil
       
    79 
       
    80 -- Most skips
       
    81 local recordSkips = 0
       
    82 local recordSkipsHogName = nil
       
    83 local recordSkipsTeamName = nil
       
    84 
       
    85 -- Most crates collected 
       
    86 local recordCrates = 0
       
    87 local recordCratesHogName = nil
       
    88 local recordCratesTeamName = nil
       
    89 
       
    90 -- Most deaths
       
    91 local recordDeaths = 0
       
    92 local recordDeathsHogName = nil
       
    93 local recordDeathsTeamName = nil
       
    94 
       
    95 -- Total killed hedgehogs
       
    96 local totalKills = 0
       
    97 
       
    98 -- Total damage
       
    99 local totalDamage = 0
       
   100 
       
   101 function rules()
       
   102 
       
   103 	local ruleSet = loc("Rules: ") .. "|" ..
       
   104 	loc("Hedgehogs will be revived after their death.") .. "|" ..
       
   105 	string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" ..
       
   106 	" |"..
       
   107 	loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" ..
    75 	loc("The Mutant has super-weapons and a lot of health.") .. "|" ..
   108 	loc("The Mutant has super-weapons and a lot of health.") .. "|" ..
    76 	loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" ..
   109 	loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" ..
    77 	" |" ..
   110 	" |" ..
    78 	loc("Normal players can only score points by killing the mutant.") .. "|" ..
   111 	loc("Score points by killing other hedgehogs (see below).") .. "|" ..
    79 	" |" .. "" ..
   112 	loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
    80 	loc("The player with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
   113 	string.format(loc("The first hedgehog which scores %d or more wins the game."), winScore) .. "|" ..
    81 	loc("The Bottom Feeder can score points by killing anyone.") .. "|" ..
   114         " |" ..
    82 	" |" ..
   115 	loc("Scoring: ") .. "|" ..
    83 	loc("POINTS") .. ": " ..
   116 	loc("+2 for becoming the Mutant") .. "|" ..
    84 	" |" ..
   117 	loc("+1 to the Mutant for killing anyone") .. "|" ..
    85 	loc("+2 for becoming a Mutant") .. "|" ..
   118 	loc("+1 to the Bottom Feeder for killing anyone") .. "|" ..
    86 	loc("+1 to a Mutant for killing anyone") .. "|" ..
       
    87 	loc("+1 to a Bottom Feeder for killing anyone") .. "|" ..
       
    88 	loc("-1 to anyone for a suicide") .. "|" ..
   119 	loc("-1 to anyone for a suicide") .. "|" ..
    89 	loc("Other kills don't give you points.")
   120 	loc("Other kills don't give you points.")
    90 
   121 
    91 	ShowMission(loc("Mutant"),
   122 	return ruleSet
    92                 loc("a Hedgewars tag game"),
   123 
    93                 ruleSet, 0, 5000)
   124 end
       
   125 
       
   126 function showStartingInfo()
       
   127 
       
   128 	ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000)
    94 
   129 
    95 end
   130 end
    96 
   131 
    97 function onGameInit()
   132 function onGameInit()
    98     TurnTime = 20000
   133     TurnTime = 20000
    99     WaterRise = 0
   134     WaterRise = 0
       
   135     HealthDecrease = 0
   100     EnableGameFlags(gfResetWeps, gfPerHogAmmo)
   136     EnableGameFlags(gfResetWeps, gfPerHogAmmo)
   101     HealthCaseProb=0
   137     HealthCaseProb=0
   102     HealthCaseAmount=0
   138     HealthCaseAmount=0
   103     MinesTime=1000
   139     MinesTime=1000
   104     CaseFreq = 2
   140     CaseFreq = 2
   108 function limitHogs(gear)
   144 function limitHogs(gear)
   109     cnthhs = cnthhs + 1
   145     cnthhs = cnthhs + 1
   110         if cnthhs > 1 then
   146         if cnthhs > 1 then
   111             hogLimitHit = true
   147             hogLimitHit = true
   112             SetEffect(gear, heResurrectable, false)
   148             SetEffect(gear, heResurrectable, false)
   113             --SetHealth(gear, 0)
       
   114             SetGearPosition(gear, -100,LAND_HEIGHT)
   149             SetGearPosition(gear, -100,LAND_HEIGHT)
   115         end
   150         end
   116 end
   151 end
   117 
   152 
   118 function onGameStart()
   153 function onGameStart()
       
   154     SendHealthStatsOff()
   119     trackTeams()
   155     trackTeams()
   120     teamScan()
   156     teamScan()
   121     runOnHogs(saveStuff)
   157     runOnHogs(saveStuff)
   122     --local str = "/say " .. MUTANT_VERSION
       
   123     --ParseCommand(str)
       
   124 
   158 
   125     hogLimitHit = false
   159     hogLimitHit = false
   126     for i=0 , TeamsCount - 1 do
   160     for i=0 , TeamsCount - 1 do
   127         cnthhs = 0
   161         cnthhs = 0
   128         runOnHogsInTeam(limitHogs, teams[i])
   162         runOnHogsInTeam(limitHogs, teams[i])
   129     end
   163     end
   130     if hogLimitHit then
   164     if hogLimitHit then
   131         AddCaption(loc("ONE HOG PER TEAM! KILLING EXCESS HEDGES"))
   165         AddCaption(loc("Only one hog per team allowed! Excess hogs will be removed"), 0xFFFFFFFF, capgrpGameState)
   132     end
   166     end
   133     showStartingInfo()
   167     showStartingInfo()
   134 end
   168 end
   135 
   169 
   136 
   170 
   195 
   229 
   196     trackTeams()
   230     trackTeams()
   197     killsCounter = 0
   231     killsCounter = 0
   198 
   232 
   199     if mutant == nil then
   233     if mutant == nil then
   200         AddCaption( loc("FIRST BLOOD MUTATES") )
   234         AddCaption( loc("First killer will mutate"), 0xFFFFFFFF, capgrpGameState )
   201     end
   235     end
   202 
   236 
   203     checkScore()
   237     checkScore()
       
   238 
       
   239     for i=0, TeamsCount-1 do
       
   240         SendStat(siClanHealth, getTeamValue(teams[i], "Score"), teams[i])
       
   241     end
       
   242 
   204     giveWeapons(CurrentHedgehog)
   243     giveWeapons(CurrentHedgehog)
   205     drawCircles()
   244     drawCircles()
   206     setAIHints()
   245     setAIHints()
   207     kill_reward= numhhs*10
   246     kill_reward= numhhs*10
   208 
   247 
   217 
   256 
   218 end
   257 end
   219 
   258 
   220 function countBodies()
   259 function countBodies()
   221         if killsCounter == 2 then
   260         if killsCounter == 2 then
   222             AddCaption(loc("DOUBLE KILL"))
   261             AddCaption(loc("Double kill!"), 0xFFFFFFFF, capgrpGameState )
   223         elseif killsCounter == 3 then
   262         elseif killsCounter == 3 then
   224             AddCaption(loc("MEGA KILL"))
   263             AddCaption(loc("Mega kill!"), 0xFFFFFFFF, capgrpGameState )
   225             PlaySound(sndRegret)
   264             PlaySound(sndRegret)
   226         elseif killsCounter == 4 then
   265         elseif killsCounter == 4 then
   227             AddCaption(loc("ULTRA KILL"))
   266             AddCaption(loc("Ultra kill!"), 0xFFFFFFFF, capgrpGameState )
   228         elseif killsCounter == 5 then
   267         elseif killsCounter == 5 then
   229             AddCaption(loc("MONSTER KILL"))
   268             AddCaption(loc("Monster kill!"), 0xFFFFFFFF, capgrpGameState )
   230             PlaySound(sndIllGetYou)
   269             PlaySound(sndIllGetYou)
   231         elseif killsCounter == 6 then
   270         elseif killsCounter == 6 then
   232             AddCaption(loc("LUDICROUS KILL"))
   271             AddCaption(loc("Ludicrous kill!"), 0xFFFFFFFF, capgrpGameState )
   233             PlaySound(sndNutter)
   272             PlaySound(sndNutter)
   234         elseif killsCounter == 7 then
   273         elseif killsCounter == 7 then
   235             AddCaption(loc("HOLY SHYTE!"))
   274             AddCaption(loc("Holy shit!"), 0xFFFFFFFF, capgrpGameState )
   236             PlaySound(sndLaugh)
   275             PlaySound(sndLaugh)
   237         elseif killsCounter > 8 then
   276         elseif killsCounter > 8 then
   238             AddCaption(loc("INSANITY"))
   277             AddCaption(loc("Insanity!"), 0xFFFFFFFF, capgrpGameState )
       
   278         end
       
   279 
       
   280         if killsCounter > recordKills then
       
   281             recordKills = killsCounter
       
   282             recordKillsHogName = getGearValue(CurrentHedgehog, "Name")
       
   283             recordKillsTeamName = GetHogTeamName(CurrentHedgehog)
   239         end
   284         end
   240 end
   285 end
   241 
   286 
   242 function onGameTick()
   287 function onGameTick()
   243 
   288 
   300 
   345 
   301     for i=0, TeamsCount-1 do
   346     for i=0, TeamsCount-1 do
   302         if teams[i]~= nil then
   347         if teams[i]~= nil then
   303 
   348 
   304             local curr_score = getTeamValue(teams[i], "Score")
   349             local curr_score = getTeamValue(teams[i], "Score")
   305             showScore = showScore .. teams[i] .. ": " .. curr_score .. " (" .. loc("deaths") .. ": " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
   350             showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|"
   306 
   351 
   307         end
   352         end
   308     end
   353     end
   309 
   354 
   310     ShowMission(loc("Score"),
   355     ShowMission(loc("Mutant"),
   311                 "-------",
   356                 loc("Scores"),
   312                 showScore, 0, 200)
   357                 showScore, 4, 1)
   313 
   358 
   314     HideMission()
   359     HideMission()
   315 
   360 
   316 end
   361 end
   317 
   362 
   327         if teams[i]~=nil then
   372         if teams[i]~=nil then
   328             local curr_score = getTeamValue(teams[i], "Score")
   373             local curr_score = getTeamValue(teams[i], "Score")
   329 
   374 
   330             runOnHogsInTeam(removeFeeder, teams[i])
   375             runOnHogsInTeam(removeFeeder, teams[i])
   331 
   376 
   332             showScore = showScore .. teams[i] ..": " .. curr_score .. " (" .. loc("deaths") .. ": " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
   377             showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|"
   333 
   378 
   334             if curr_score >= winScore then
   379             if curr_score >= winScore then
   335                 gameOver = true
   380                 gameOver = true
   336                 winTeam = teams[i]
   381                 winTeam = teams[i]
   337             end
   382             end
   360             end
   405             end
   361         end
   406         end
   362     end
   407     end
   363 
   408 
   364     if gameOver then
   409     if gameOver then
       
   410         SendStat(siGraphTitle, loc("Score graph"))
       
   411 
   365         TurnTimeLeft = 0
   412         TurnTimeLeft = 0
   366         for i=0, #teams do
   413 
       
   414         teamsSorted = {}
       
   415  
       
   416         for i=0, TeamsCount-1 do
   367             if teams[i]~=winTeam then
   417             if teams[i]~=winTeam then
   368                 runOnHogsInTeam(armageddon, teams[i])
   418                 runOnHogsInTeam(armageddon, teams[i])
   369             end
   419             end
   370         end
   420             teamsSorted[i+1] = teams[i]
   371 
   421         end
   372     ShowMission(    loc("WINNER IS ") .. winTeam,
   422 
   373                     "~~~~~~~~~~~~~~~~~~~~~~~~~",
   423         -- Achievements stuff
   374                     showScore, 0, 200)
   424         local achievements = 0
       
   425         --- Most kills per turn
       
   426         if recordKills >= 3 then
       
   427             SendStat(siMaxStepKills, string.format("%d %s (%s)", recordKills, recordKillsHogName, recordKillsTeamName))
       
   428             achievements = achievements + 1
       
   429         end
       
   430         --- Most crates collected
       
   431         if recordCrates >= 5 then
       
   432             SendStat(siCustomAchievement, string.format(loc("%s (%s) was the greediest hedgehog and collected %d crates."), recordCratesHogName, recordCratesTeamName, recordCrates))
       
   433             achievements = achievements + 1
       
   434         end
       
   435         --- Most suicides
       
   436         if recordSuicides >= 5 then
       
   437             SendStat(siCustomAchievement, string.format(loc("%s (%s) hate life and suicided %d times."), recordSuicidesHogName, recordSuicidesTeamName, recordSuicides))
       
   438             achievements = achievements + 1
       
   439         end
       
   440         --- Most deaths
       
   441         if recordDeaths >= 5 then
       
   442             SendStat(siCustomAchievement, string.format(loc("Poor %s (%s) died %d times."), recordDeathsHogName, recordDeathsTeamName, recordDeaths))
       
   443             achievements = achievements + 1
       
   444         end
       
   445         --- Most skips
       
   446         if recordSkips >= 3 then
       
   447             SendStat(siMaxTurnSkips, string.format("%d %s (%s)", recordSkips, recordSkipsHogName, recordSkipsTeamName))
       
   448             achievements = achievements + 1
       
   449         end
       
   450         --- Total damage 
       
   451         if totalDamage >= 900 then
       
   452             SendStat(siCustomAchievement, string.format(loc("%d damage was dealt in this game."), totalDamage))
       
   453             achievements = achievements + 1
       
   454         end
       
   455         --- Total kills
       
   456         if totalKills >= 20 or achievements <= 0 then
       
   457             SendStat(siKilledHHs, tostring(totalKills))
       
   458             achievements = achievements + 1
       
   459         end
       
   460 
       
   461         -- Score and stats stuff
       
   462         table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") < getTeamValue(team2, "Score") end)
       
   463         for i=TeamsCount, 1, -1 do
       
   464             SendStat(siPointType, loc("point(s)"))
       
   465             SendStat(siPlayerKills, getTeamValue(teamsSorted[i], "Score"), teamsSorted[i])
       
   466         end
       
   467 
       
   468         AddCaption(string.format(loc("%s wins!"), winTeam), 0xFFFFFFFF, capgrpGameState )
       
   469         SendStat(siGameResult, string.format("%s wins!", winTeam))
       
   470 
       
   471         ShowMission(    loc("Mutant"),
       
   472                         loc("Final result"),
       
   473                         string.format(loc("Winner: %s"), winTeam) .. "| |" .. loc("Scores:") .. " |" ..
       
   474                         showScore, 0, 15000)
   375     else
   475     else
   376 
   476 
   377     if only_low_score then
   477     if only_low_score then
   378         runOnHogsInTeam(setFeeder, lowest_score_team)
   478         runOnHogsInTeam(setFeeder, lowest_score_team)
   379     end
   479     end
   380 
   480 
   381     if meh == false then
   481     if meh == false then
   382 		meh = true
   482 		meh = true
   383 	else
   483 	else
   384 		ShowMission(    loc("Score"),
   484 		ShowMission(    loc("Mutant"),
   385                     loc("-------"),
   485                     loc("Scores"),
   386                     showScore, 0, 200)
   486                     showScore, 4, 1)
       
   487 		HideMission()
   387 	end
   488 	end
   388 
   489 
   389     end
   490     end
   390 end
   491 end
   391 
   492 
   419     end
   520     end
   420 end
   521 end
   421 
   522 
   422 function setFeeder(gear)
   523 function setFeeder(gear)
   423     if gear~= mutant and gear~= nil then
   524     if gear~= mutant and gear~= nil then
   424         SetHogName(gear, loc("BOTTOM FEEDER"))
   525         SetHogName(gear, loc("Bottom Feeder"))
   425         SetHogHat(gear, 'poke_slowpoke')
   526         SetHogHat(gear, 'poke_slowpoke')
   426         setGearValue(gear,"Feeder", true)
   527         setGearValue(gear,"Feeder", true)
   427     end
   528     end
   428 end
   529 end
   429 
   530 
   430 function setMutantStuff(gear)
   531 function setMutantStuff(gear)
   431     mutant = gear
   532     mutant = gear
   432 
   533 
   433     SetHogName(gear, loc("MUTANT"))
   534     SetHogName(gear, loc("Mutant"))
   434     SetHogHat(gear,'WhySoSerious')
   535     SetHogHat(gear,'WhySoSerious')
   435     SetHealth(gear, ( mutant_base_health + numhhs*25) )
   536     SetHealth(gear, ( mutant_base_health + numhhs*25) )
   436     SetEffect(gear, hePoisoned, 1)
   537     SetEffect(gear, hePoisoned, 1)
   437     setGearValue(mutant,"SelfDestruct",false)
   538     setGearValue(mutant,"SelfDestruct",false)
   438     setGearValue(gear, "Feeder", false)
   539     setGearValue(gear, "Feeder", false)
   439 
   540 
   440     AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED"))
   541     AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage)
   441 
   542 
   442     TurnTimeLeft=0
   543     TurnTimeLeft=0
   443 
   544 
   444     AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   545     AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   445     AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   546     AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   457 
   558 
   458         for i=0, #hhs do
   559         for i=0, #hhs do
   459             for j=0, TeamsCount-1 do
   560             for j=0, TeamsCount-1 do
   460                 if teams[j] ==nil and hhs[i]~=nil then
   561                 if teams[j] ==nil and hhs[i]~=nil then
   461                 teams[j] = GetHogTeamName(hhs[i])
   562                 teams[j] = GetHogTeamName(hhs[i])
   462                 setTeamValue(teams[j],"Score",0)
   563                 setTeamValue(teams[j], "Score",0)
       
   564                 setTeamValue(teams[j], "Suicides",0)
       
   565                 setTeamValue(teams[j], "Skips",0)
       
   566                 setTeamValue(teams[j], "Crates",0)
   463                 setTeamValue(teams[j], "DeadHogs",0)
   567                 setTeamValue(teams[j], "DeadHogs",0)
   464                 break
   568                 break
   465                 end
   569                 end
   466 
   570 
   467                 if teams[j] == GetHogTeamName(hhs[i]) then
   571                 if teams[j] == GetHogTeamName(hhs[i]) then
   496                             setMutantStuff(CurrentHedgehog)
   600                             setMutantStuff(CurrentHedgehog)
   497                             setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
   601                             setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
   498                             end
   602                             end
   499                     else
   603                     else
   500                         setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
   604                         setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
       
   605                         increaseTeamValue(curr_team,"Suicides")
       
   606                         if(getTeamValue(curr_team, "Suicides") > recordSuicides) then
       
   607                             recordSuicides = getTeamValue(curr_team, "Suicides")
       
   608                             recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name")
       
   609                             recordSuicidesTeamName = curr_team
       
   610                         end
       
   611                         AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
   501                     end
   612                     end
   502             else
   613             else
   503                 if mutant==nil then
   614                 if mutant==nil then
   504                         if curr_team ~=GetHogTeamName(gear) then
   615                         if curr_team ~=GetHogTeamName(gear) then
   505                             if getGearValue(CurrentHedgehog, "Alive") then
   616                             if getGearValue(CurrentHedgehog, "Alive") then
   508                             else
   619                             else
   509                                 increaseTeamValue(curr_team,"Score")
   620                                 increaseTeamValue(curr_team,"Score")
   510                             end
   621                             end
   511                         else
   622                         else
   512                             setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
   623                             setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
       
   624                             increaseTeamValue(curr_team,"Suicides")
       
   625                             if(getTeamValue(curr_team, "Suicides") > recordSuicides) then
       
   626                                 recordSuicides = getTeamValue(curr_team, "Suicides")
       
   627                                 recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name")
       
   628                                 recordSuicidesTeamName = curr_team
       
   629                             end
       
   630                             AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
   513                         end
   631                         end
   514                 else
   632                 else
   515                     if curr_team ~=GetHogTeamName(gear) then
   633                     if curr_team ~=GetHogTeamName(gear) then
   516                         if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
   634                         if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
   517                             SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
   635                             SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
   518                             AddCaption("+" .. kill_reward .. loc(" HP") )
   636                             AddCaption(loc("+1 point"), GetClanColor(GetHogClan(gear)), capgrpMessage)
       
   637                             AddCaption(string.format(loc("+%d health"), kill_reward), GetClanColor(GetHogClan(gear)), capgrpMessage2)
   519                             increaseTeamValue(curr_team,"Score")
   638                             increaseTeamValue(curr_team,"Score")
   520                         end
   639                         end
   521                         if getGearValue(CurrentHedgehog,"Feeder") then
   640                         if getGearValue(CurrentHedgehog,"Feeder") then
   522                             increaseTeamValue(curr_team,"Score")
   641                             increaseTeamValue(curr_team,"Score")
       
   642                             AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
   523                         end
   643                         end
   524                     else
   644                     else
   525                         setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
   645                         setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
       
   646                         AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
   526                     end
   647                     end
   527                 end
   648                 end
   528             end
   649             end
   529     end
   650     end
   530 end
   651 end
   532 function onGearResurrect(gear)
   653 function onGearResurrect(gear)
   533 if not gameOver then
   654 if not gameOver then
   534     if GetGearType(gear) == gtHedgehog then
   655     if GetGearType(gear) == gtHedgehog then
   535 
   656 
   536         increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
   657         increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
       
   658         totalKills = totalKills + 1
       
   659         if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then
       
   660             recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs")
       
   661             recordDeathsHogName = getGearValue(gear, "Name")
       
   662             recordDeathsTeamName = GetHogTeamName(gear)
       
   663         end
   537 
   664 
   538         if gear==CurrentHedgehog then
   665         if gear==CurrentHedgehog then
   539             setGearValue(CurrentHedgehog, "Alive", false)
   666             setGearValue(CurrentHedgehog, "Alive", false)
   540         end
   667         end
   541         set_Mutant_and_Score(gear)
   668         set_Mutant_and_Score(gear)
   546         AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   673         AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
   547         PlaySound(sndWhack)
   674         PlaySound(sndWhack)
   548         updateScore()
   675         updateScore()
   549     end
   676     end
   550 end
   677 end
       
   678 end
       
   679 
       
   680 function onGearDamage(gear, damage)
       
   681 	if not gameOver and GetGearType(gear) == gtHedgehog then
       
   682 		totalDamage = totalDamage + damage
       
   683 	end
       
   684 end
       
   685 
       
   686 function onHogAttack(ammoType)
       
   687 	-- Record skips for achievement
       
   688 	if ammoType == amSkip then
       
   689 		local team = GetHogTeamName(CurrentHedgehog)
       
   690 		increaseTeamValue(team, "Skips")
       
   691 		if(getTeamValue(team, "Skips") > recordSkips) then
       
   692 			recordSkips = getTeamValue(team, "Skips")
       
   693 			recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
       
   694 			recordSkipsTeamName = team
       
   695 		end
       
   696 	end
   551 end
   697 end
   552 
   698 
   553 function onGearAdd(gear)
   699 function onGearAdd(gear)
   554 
   700 
   555     -- Catch hedgehogs for the tracker
   701     -- Catch hedgehogs for the tracker
   603             teams[TeamsCount - 1] = nil
   749             teams[TeamsCount - 1] = nil
   604             TeamsCount = TeamsCount - 1
   750             TeamsCount = TeamsCount - 1
   605         end
   751         end
   606         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   752         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   607         trackDeletion(gear)
   753         trackDeletion(gear)
       
   754 
       
   755         -- End game properly when only the winner remains
       
   756         if gameOver and numhhs == 1 then
       
   757             EndGame()
       
   758         end
       
   759     elseif GetGearType(gear) == gtCase then
       
   760         -- Check if a crate has been collected
       
   761         if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then
       
   762             -- Update crate collection achievement
       
   763             increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates")
       
   764             if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then
       
   765                 recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates")
       
   766                 recordCratesHogName = getGearValue(CurrentHedgehog, "Name")
       
   767                 recordCratesTeamName = GetHogTeamName(CurrentHedgehog)
       
   768             end
       
   769         end
   608     end
   770     end
   609 end
   771 end
   610 
   772 
   611 function onParameters()
   773 function onParameters()
   612     parseParams()
   774     parseParams()