share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
author Wuzzy <almikes@aol.com>
Wed, 23 Nov 2016 14:08:43 +0100
changeset 12033 cfc2f087dccf
parent 11914 1d2e89be3eb6
child 12293 a5a7d0c6d3f3
permissions -rw-r--r--
HedgeEditor: Make landgun spawn in utility crates and sort list of ammo types to reflect the ammo menu ordering
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     1
--[[                  ___                   ___
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     2
                    (   )                 (   )
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     3
___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     4
(   )   '   (   )(   (   __) / .-, (   )   (   __)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     5
|  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     6
| |  | |  | | |  | | | | ___ .'`  || |  | || | ___
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     7
| |  | |  | | |  | | | |(   / .'| || |  | || |(   )
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     8
| |  | |  | | |  | | | | | | /  | || |  | || | | |
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
     9
| |  | |  | | |  ; ' | ' | ; |  ; || |  | || ' | |
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    10
| |  | |  | ' `-'  / ' `-' ' `-'  || |  | |' `-' ;
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    11
(___)(___)(___'.__.'   `.__.`.__.'_(___)(___)`.__.
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    12
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    13
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    14
----  Recommended settings:
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    15
----    * one hedgehog per team
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    16
----    * 'Small' one-island map
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    17
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    18
--]]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    19
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    20
HedgewarsScriptLoad("/Scripts/Locale.lua")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    21
HedgewarsScriptLoad("/Scripts/Tracker.lua")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    22
HedgewarsScriptLoad("/Scripts/Params.lua")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    23
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    24
--[[
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    25
    MUTANT SCRIPT
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    26
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    27
    To Do:  -Clean-up this fucking piece of code
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    28
            -Debug
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    29
            -Find a girlfriend
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    30
            -Fix Sheepluva's hat  +[p]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    31
            -Cookies
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    32
-----------------------]]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    33
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    34
local hhs = {}
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    35
local numhhs = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    36
local meh = false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    37
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    38
local gameOver=false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    39
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    40
local mutant = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    41
local mutant_base_health = 200
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    42
local mutant_base_disease = 25
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    43
local disease_timer = 2000
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    44
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    45
local kill_reward = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    46
local mt_hurt=false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    47
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    48
local killsCounter = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    49
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    50
local team_fire_punishment = 3
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    51
local mutant_kill_reward = 2
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    52
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    53
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine}
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    54
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    55
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport}
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    56
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    57
local disease=0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    58
local timer=0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    59
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    60
local winScore = 15
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    61
local hogsLimit = 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    62
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    63
local teams = {}
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    64
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    65
local circles = {}
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    66
local circleFrame = -1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    67
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    68
-- Variables for custom achievements
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    69
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    70
-- Most kills in 1 turn
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    71
local recordKills = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    72
local recordKillsHogName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    73
local recordKillsTeamName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    74
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    75
-- Most suicides
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    76
local recordSuicides = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    77
local recordSuicidesHogName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    78
local recordSuicidesTeamName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    79
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    80
-- Most skips
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    81
local recordSkips = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    82
local recordSkipsHogName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    83
local recordSkipsTeamName = nil
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
    84
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    85
-- Most crates collected 
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    86
local recordCrates = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    87
local recordCratesHogName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    88
local recordCratesTeamName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    89
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    90
-- Most deaths
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    91
local recordDeaths = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    92
local recordDeathsHogName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    93
local recordDeathsTeamName = nil
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    94
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    95
-- Total killed hedgehogs
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    96
local totalKills = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    97
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    98
-- Total damage
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
    99
local totalDamage = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   100
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   101
function rules()
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   102
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   103
	local ruleSet = loc("Rules: ") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   104
	loc("Hedgehogs will be revived after their death.") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   105
	string.format(loc("Mines explode after %d s."), div(MinesTime, 1000)) .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   106
	" |"..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   107
	loc("The first hedgehog to kill someone becomes the Mutant.") .. "|" ..
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   108
	loc("The Mutant has super-weapons and a lot of health.") .. "|" ..
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   109
	loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" ..
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   110
	" |" ..
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   111
	loc("Score points by killing other hedgehogs (see below).") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   112
	loc("The hedgehog with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   113
	string.format(loc("The first hedgehog which scores %d or more wins the game."), winScore) .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   114
        " |" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   115
	loc("Scoring: ") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   116
	loc("+2 for becoming the Mutant") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   117
	loc("+1 to the Mutant for killing anyone") .. "|" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   118
	loc("+1 to the Bottom Feeder for killing anyone") .. "|" ..
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   119
	loc("-1 to anyone for a suicide") .. "|" ..
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   120
	loc("Other kills don't give you points.")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   121
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   122
	return ruleSet
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   123
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   124
end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   125
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   126
function showStartingInfo()
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   127
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   128
	ShowMission(loc("Mutant"), loc("A Hedgewars tag game"), rules(), 1, 5000)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   129
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   130
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   131
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   132
function onGameInit()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   133
    TurnTime = 20000
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   134
    WaterRise = 0
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   135
    HealthDecrease = 0
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   136
    EnableGameFlags(gfResetWeps, gfPerHogAmmo)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   137
    HealthCaseProb=0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   138
    HealthCaseAmount=0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   139
    MinesTime=1000
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   140
    CaseFreq = 2
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   141
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   142
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   143
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   144
function limitHogs(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   145
    cnthhs = cnthhs + 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   146
        if cnthhs > 1 then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   147
            hogLimitHit = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   148
            SetEffect(gear, heResurrectable, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   149
            SetGearPosition(gear, -100,LAND_HEIGHT)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   150
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   151
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   152
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   153
function onGameStart()
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   154
    SendHealthStatsOff()
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   155
    trackTeams()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   156
    teamScan()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   157
    runOnHogs(saveStuff)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   158
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   159
    hogLimitHit = false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   160
    for i=0 , TeamsCount - 1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   161
        cnthhs = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   162
        runOnHogsInTeam(limitHogs, teams[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   163
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   164
    if hogLimitHit then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   165
        AddCaption(loc("Only one hog per team allowed! Excess hogs will be removed"), 0xFFFFFFFF, capgrpGameState)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   166
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   167
    showStartingInfo()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   168
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   169
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   170
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   171
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   172
function giveWeapons(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   173
    if gear == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   174
        AddAmmo(gear, amRope)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   175
        for i=1, #mt_weapons do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   176
            AddAmmo(gear, mt_weapons[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   177
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   178
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   179
    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   180
        for i=1, #hh_weapons do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   181
            AddAmmo(gear,hh_weapons[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   182
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   183
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   184
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   185
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   186
function onAmmoStoreInit()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   187
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   188
    SetAmmo(amSkip, 9, 0, 0, 0)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   189
    SetAmmo(amRope,0,1,0,5)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   190
    SetAmmo(amSnowball,0,1,0,1)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   191
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   192
    for i=1, #hh_weapons do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   193
        SetAmmo(hh_weapons[i], 0, 0, 0, 1)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   194
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   195
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   196
    for i=1, #mt_weapons do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   197
        SetAmmo(mt_weapons[i], 0, 3, 0, 1)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   198
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   199
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   200
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   201
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   202
function drawCircles()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   203
    for i = 0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   204
        if circles[hhs[i]] ~= nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   205
            DeleteVisualGear(circles[hhs[i]])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   206
            circles[hhs[i]] = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   207
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   208
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   209
        if hhs[i] ~= CurrentHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   210
            if mutant == nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   211
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   212
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   213
            elseif CurrentHedgehog == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   214
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   215
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   216
            elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   217
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   218
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   219
            elseif hhs[i] == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   220
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   221
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   222
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   223
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   224
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   225
    circleFrame = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   226
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   227
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   228
function onNewTurn()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   229
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   230
    trackTeams()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   231
    killsCounter = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   232
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   233
    if mutant == nil then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   234
        AddCaption( loc("First killer will mutate"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   235
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   236
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   237
    checkScore()
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   238
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   239
    for i=0, TeamsCount-1 do
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   240
        SendStat(siClanHealth, getTeamValue(teams[i], "Score"), teams[i])
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   241
    end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   242
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   243
    giveWeapons(CurrentHedgehog)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   244
    drawCircles()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   245
    setAIHints()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   246
    kill_reward= numhhs*10
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   247
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   248
    if CurrentHedgehog == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   249
        mt_hurt=true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   250
        disease= mutant_base_disease - numhhs
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   251
    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   252
        mt_hurt=false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   253
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   254
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   255
    setGearValue(CurrentHedgehog, "Alive", true)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   256
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   257
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   258
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   259
function countBodies()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   260
        if killsCounter == 2 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   261
            AddCaption(loc("Double kill!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   262
        elseif killsCounter == 3 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   263
            AddCaption(loc("Mega kill!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   264
            PlaySound(sndRegret)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   265
        elseif killsCounter == 4 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   266
            AddCaption(loc("Ultra kill!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   267
        elseif killsCounter == 5 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   268
            AddCaption(loc("Monster kill!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   269
            PlaySound(sndIllGetYou)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   270
        elseif killsCounter == 6 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   271
            AddCaption(loc("Ludicrous kill!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   272
            PlaySound(sndNutter)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   273
        elseif killsCounter == 7 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   274
            AddCaption(loc("Holy shit!"), 0xFFFFFFFF, capgrpGameState )
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   275
            PlaySound(sndLaugh)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   276
        elseif killsCounter > 8 then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   277
            AddCaption(loc("Insanity!"), 0xFFFFFFFF, capgrpGameState )
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   278
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   279
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   280
        if killsCounter > recordKills then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   281
            recordKills = killsCounter
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   282
            recordKillsHogName = getGearValue(CurrentHedgehog, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   283
            recordKillsTeamName = GetHogTeamName(CurrentHedgehog)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   284
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   285
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   286
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   287
function onGameTick()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   288
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   289
    if circleFrame > -1 then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   290
        for i = 0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   291
            if circles[hhs[i]] ~= nil and hhs[i]~= nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   292
                hhx, hhy = GetGearPosition(hhs[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   293
                X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   294
                SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   295
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   296
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   297
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   298
        circleFrame = circleFrame + 0.06
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   299
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   300
        if circleFrame >= 25 then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   301
            for i = 0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   302
                if circles[hhs[i]] ~= nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   303
                    DeleteVisualGear(circles[hhs[i]])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   304
                    circles[hhs[i]] = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   305
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   306
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   307
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   308
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   309
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   310
    if TurnTimeLeft==0 and mt_hurt then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   311
        mt_hurt = false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   312
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   313
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   314
    if mt_hurt and mutant~=nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   315
        timer = timer + 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   316
            if timer > disease_timer then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   317
                timer = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   318
                SetHealth(mutant, GetHealth(mutant)-disease )
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   319
                AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   320
                    if GetHealth(mutant)<=0 then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   321
                        SetHealth(mutant,0)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   322
                        mt_hurt= false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   323
                        setGearValue(mutant,"SelfDestruct",true)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   324
                        TurnTimeLeft = 0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   325
                    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   326
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   327
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   328
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   329
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   330
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   331
function saveStuff(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   332
    setGearValue(gear,"Name",GetHogName(gear))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   333
    setGearValue(gear,"Hat",GetHogHat(gear))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   334
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   335
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   336
function armageddon(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   337
    SetState(gear, gstLoser)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   338
    SetEffect(gear, heResurrectable, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   339
    SetHealth(gear, 0)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   340
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   341
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   342
function updateScore()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   343
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   344
    local showScore = ""
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   345
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   346
    for i=0, TeamsCount-1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   347
        if teams[i]~= nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   348
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   349
            local curr_score = getTeamValue(teams[i], "Score")
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   350
            showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|"
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   351
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   352
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   353
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   354
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   355
    ShowMission(loc("Mutant"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   356
                loc("Scores"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   357
                showScore, 4, 1)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   358
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   359
    HideMission()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   360
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   361
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   362
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   363
function checkScore()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   364
local showScore = ""
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   365
local lowest_score_team = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   366
local min_score=nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   367
local winTeam = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   368
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   369
local only_low_score = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   370
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   371
    for i=0, TeamsCount-1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   372
        if teams[i]~=nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   373
            local curr_score = getTeamValue(teams[i], "Score")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   374
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   375
            runOnHogsInTeam(removeFeeder, teams[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   376
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   377
            showScore = showScore .. string.format(loc("%s: %d (deaths: %d)"), teams[i], curr_score, getTeamValue(teams[i], "DeadHogs")) .. "|"
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   378
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   379
            if curr_score >= winScore then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   380
                gameOver = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   381
                winTeam = teams[i]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   382
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   383
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   384
            if min_score==nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   385
                min_score= curr_score
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   386
                lowest_score_team = teams[i]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   387
            else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   388
                if curr_score <= min_score then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   389
                    if curr_score == min_score then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   390
                        if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   391
                            only_low_score = false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   392
                        else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   393
                            if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   394
                                lowest_score_team = teams[i]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   395
                            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   396
                            only_low_score = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   397
                        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   398
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   399
                    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   400
                        min_score= curr_score
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   401
                        lowest_score_team = teams[i]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   402
                        only_low_score = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   403
                    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   404
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   405
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   406
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   407
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   408
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   409
    if gameOver then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   410
        SendStat(siGraphTitle, loc("Score graph"))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   411
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   412
        TurnTimeLeft = 0
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   413
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   414
        teamsSorted = {}
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   415
 
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   416
        for i=0, TeamsCount-1 do
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   417
            if teams[i]~=winTeam then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   418
                runOnHogsInTeam(armageddon, teams[i])
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   419
            end
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   420
            teamsSorted[i+1] = teams[i]
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   421
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   422
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   423
        -- Achievements stuff
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   424
        local achievements = 0
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   425
        --- Most kills per turn
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   426
        if recordKills >= 3 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   427
            SendStat(siMaxStepKills, string.format("%d %s (%s)", recordKills, recordKillsHogName, recordKillsTeamName))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   428
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   429
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   430
        --- Most crates collected
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   431
        if recordCrates >= 5 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   432
            SendStat(siCustomAchievement, string.format(loc("%s (%s) was the greediest hedgehog and collected %d crates."), recordCratesHogName, recordCratesTeamName, recordCrates))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   433
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   434
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   435
        --- Most suicides
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   436
        if recordSuicides >= 5 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   437
            SendStat(siCustomAchievement, string.format(loc("%s (%s) hate life and suicided %d times."), recordSuicidesHogName, recordSuicidesTeamName, recordSuicides))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   438
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   439
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   440
        --- Most deaths
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   441
        if recordDeaths >= 5 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   442
            SendStat(siCustomAchievement, string.format(loc("Poor %s (%s) died %d times."), recordDeathsHogName, recordDeathsTeamName, recordDeaths))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   443
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   444
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   445
        --- Most skips
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   446
        if recordSkips >= 3 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   447
            SendStat(siMaxTurnSkips, string.format("%d %s (%s)", recordSkips, recordSkipsHogName, recordSkipsTeamName))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   448
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   449
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   450
        --- Total damage 
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   451
        if totalDamage >= 900 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   452
            SendStat(siCustomAchievement, string.format(loc("%d damage was dealt in this game."), totalDamage))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   453
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   454
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   455
        --- Total kills
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   456
        if totalKills >= 20 or achievements <= 0 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   457
            SendStat(siKilledHHs, tostring(totalKills))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   458
            achievements = achievements + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   459
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   460
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   461
        -- Score and stats stuff
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   462
        table.sort(teamsSorted, function(team1, team2) return getTeamValue(team1, "Score") < getTeamValue(team2, "Score") end)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   463
        for i=TeamsCount, 1, -1 do
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   464
            SendStat(siPointType, loc("point(s)"))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   465
            SendStat(siPlayerKills, getTeamValue(teamsSorted[i], "Score"), teamsSorted[i])
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   466
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   467
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   468
        AddCaption(string.format(loc("%s wins!"), winTeam), 0xFFFFFFFF, capgrpGameState )
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   469
        SendStat(siGameResult, string.format("%s wins!", winTeam))
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   470
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   471
        ShowMission(    loc("Mutant"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   472
                        loc("Final result"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   473
                        string.format(loc("Winner: %s"), winTeam) .. "| |" .. loc("Scores:") .. " |" ..
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   474
                        showScore, 0, 15000)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   475
    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   476
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   477
    if only_low_score then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   478
        runOnHogsInTeam(setFeeder, lowest_score_team)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   479
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   480
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   481
    if meh == false then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   482
		meh = true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   483
	else
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   484
		ShowMission(    loc("Mutant"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   485
                    loc("Scores"),
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   486
                    showScore, 4, 1)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   487
		HideMission()
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   488
	end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   489
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   490
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   491
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   492
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   493
function backToNormal(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   494
    SetHogName(gear, getGearValue(gear,"Name"))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   495
    SetHogHat(gear, 'NoHat')
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   496
    SetHogHat(gear, getGearValue(gear,"Hat"))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   497
    setGearValue(mutant,"SelfDestruct",false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   498
    mt_hurt=false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   499
    mutant=nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   500
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   501
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   502
function setAIHints()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   503
    for i = 0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   504
        if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant or getGearValue(CurrentHedgehog, "Feeder") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   505
            SetGearAIHints(hhs[i], aihUsual)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   506
        else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   507
            SetGearAIHints(hhs[i], aihDoesntMatter)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   508
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   509
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   510
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   511
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   512
function removeFeeder(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   513
    if gear~=nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   514
        setGearValue(gear,"Feeder",false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   515
        if gear~= mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   516
            SetHogName(gear, getGearValue(gear,"Name") )
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   517
            SetHogHat(gear, 'NoHat')
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   518
            SetHogHat(gear, getGearValue(gear,"Hat"))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   519
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   520
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   521
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   522
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   523
function setFeeder(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   524
    if gear~= mutant and gear~= nil then
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   525
        SetHogName(gear, loc("Bottom Feeder"))
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   526
        SetHogHat(gear, 'poke_slowpoke')
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   527
        setGearValue(gear,"Feeder", true)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   528
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   529
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   530
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   531
function setMutantStuff(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   532
    mutant = gear
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   533
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   534
    SetHogName(gear, loc("Mutant"))
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   535
    SetHogHat(gear,'WhySoSerious')
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   536
    SetHealth(gear, ( mutant_base_health + numhhs*25) )
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   537
    SetEffect(gear, hePoisoned, 1)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   538
    setGearValue(mutant,"SelfDestruct",false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   539
    setGearValue(gear, "Feeder", false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   540
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   541
    AddCaption(string.format(loc("%s has mutated! +2 points"), getGearValue(gear, "Name")), GetClanColor(GetHogClan(gear)), capgrpMessage)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   542
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   543
    TurnTimeLeft=0
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   544
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   545
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   546
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   547
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   548
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   549
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   550
    PlaySound(sndSuddenDeath)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   551
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   552
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   553
function teamScan()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   554
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   555
        for i=0, TeamsCount-1 do --nil filling
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   556
        teams[i]=nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   557
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   558
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   559
        for i=0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   560
            for j=0, TeamsCount-1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   561
                if teams[j] ==nil and hhs[i]~=nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   562
                teams[j] = GetHogTeamName(hhs[i])
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   563
                setTeamValue(teams[j], "Score",0)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   564
                setTeamValue(teams[j], "Suicides",0)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   565
                setTeamValue(teams[j], "Skips",0)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   566
                setTeamValue(teams[j], "Crates",0)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   567
                setTeamValue(teams[j], "DeadHogs",0)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   568
                break
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   569
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   570
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   571
                if teams[j] == GetHogTeamName(hhs[i]) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   572
                    break
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   573
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   574
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   575
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   576
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   577
        ---***---
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   578
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   579
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   580
function set_Mutant_and_Score(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   581
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   582
local curr_team = GetHogTeamName(CurrentHedgehog)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   583
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   584
    if gear == CurrentHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   585
        if CurrentHedgehog == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   586
            PlaySound(sndHomerun)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   587
            if getGearValue(gear, "SelfDestruct")==false then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   588
                decreaseTeamValue(curr_team,"Score")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   589
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   590
            backToNormal(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   591
        else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   592
            decreaseTeamValue(curr_team,"Score")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   593
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   594
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   595
    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   596
            if gear == mutant then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   597
                    backToNormal(mutant)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   598
                    if curr_team ~=GetHogTeamName(gear) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   599
                            if  getGearValue(CurrentHedgehog, "Alive") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   600
                            setMutantStuff(CurrentHedgehog)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   601
                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   602
                            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   603
                    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   604
                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   605
                        increaseTeamValue(curr_team,"Suicides")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   606
                        if(getTeamValue(curr_team, "Suicides") > recordSuicides) then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   607
                            recordSuicides = getTeamValue(curr_team, "Suicides")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   608
                            recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   609
                            recordSuicidesTeamName = curr_team
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   610
                        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   611
                        AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   612
                    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   613
            else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   614
                if mutant==nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   615
                        if curr_team ~=GetHogTeamName(gear) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   616
                            if getGearValue(CurrentHedgehog, "Alive") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   617
                                    setMutantStuff(CurrentHedgehog)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   618
                                    setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   619
                            else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   620
                                increaseTeamValue(curr_team,"Score")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   621
                            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   622
                        else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   623
                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   624
                            increaseTeamValue(curr_team,"Suicides")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   625
                            if(getTeamValue(curr_team, "Suicides") > recordSuicides) then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   626
                                recordSuicides = getTeamValue(curr_team, "Suicides")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   627
                                recordSuicidesHogName = getGearValue(CurrentHedgehog, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   628
                                recordSuicidesTeamName = curr_team
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   629
                            end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   630
                            AddCaption(loc("-1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   631
                        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   632
                else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   633
                    if curr_team ~=GetHogTeamName(gear) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   634
                        if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   635
                            SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   636
                            AddCaption(loc("+1 point"), GetClanColor(GetHogClan(gear)), capgrpMessage)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   637
                            AddCaption(string.format(loc("+%d health"), kill_reward), GetClanColor(GetHogClan(gear)), capgrpMessage2)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   638
                            increaseTeamValue(curr_team,"Score")
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   639
                        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   640
                        if getGearValue(CurrentHedgehog,"Feeder") then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   641
                            increaseTeamValue(curr_team,"Score")
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   642
                            AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   643
                        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   644
                    else
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   645
                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   646
                        AddCaption(loc("+1 point"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage)
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   647
                    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   648
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   649
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   650
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   651
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   652
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   653
function onGearResurrect(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   654
if not gameOver then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   655
    if GetGearType(gear) == gtHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   656
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   657
        increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   658
        totalKills = totalKills + 1
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   659
        if(getTeamValue(GetHogTeamName(gear), "DeadHogs") > recordDeaths) then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   660
            recordDeaths = getTeamValue(GetHogTeamName(gear), "DeadHogs")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   661
            recordDeathsHogName = getGearValue(gear, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   662
            recordDeathsTeamName = GetHogTeamName(gear)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   663
        end
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   664
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   665
        if gear==CurrentHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   666
            setGearValue(CurrentHedgehog, "Alive", false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   667
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   668
        set_Mutant_and_Score(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   669
        if gear~=CurrentHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   670
            killsCounter = killsCounter + 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   671
            countBodies()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   672
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   673
        AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   674
        PlaySound(sndWhack)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   675
        updateScore()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   676
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   677
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   678
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   679
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   680
function onGearDamage(gear, damage)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   681
	if not gameOver and GetGearType(gear) == gtHedgehog then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   682
		totalDamage = totalDamage + damage
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   683
	end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   684
end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   685
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   686
function onHogAttack(ammoType)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   687
	-- Record skips for achievement
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   688
	if ammoType == amSkip then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   689
		local team = GetHogTeamName(CurrentHedgehog)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   690
		increaseTeamValue(team, "Skips")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   691
		if(getTeamValue(team, "Skips") > recordSkips) then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   692
			recordSkips = getTeamValue(team, "Skips")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   693
			recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   694
			recordSkipsTeamName = team
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   695
		end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   696
	end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   697
end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   698
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   699
function onGearAdd(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   700
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   701
    -- Catch hedgehogs for the tracker
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   702
    if GetGearType(gear) == gtHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   703
        trackGear(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   704
        hhs[numhhs] = gear
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   705
        numhhs = numhhs + 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   706
        SetEffect(gear, heResurrectable, 1)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   707
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   708
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   709
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   710
function checkEmptyTeam (teamName)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   711
    for i=0 , #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   712
        if hhs[i]~=nil then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   713
            if teamName == GetHogTeamName(hhs[i]) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   714
                return false
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   715
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   716
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   717
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   718
    return true
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   719
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   720
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   721
function onGearDelete(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   722
    -- Remove hogs that are gone
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   723
    if GetGearType(gear) == gtHedgehog then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   724
        numhhs = numhhs - 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   725
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   726
        local found
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   727
        for i=0, #hhs do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   728
            if hhs[i] == gear then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   729
                found = i
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   730
                break
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   731
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   732
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   733
        for i = found, #hhs - 1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   734
            hhs[i] = hhs[i + 1]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   735
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   736
        hhs[#hhs] = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   737
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   738
        local t_name = GetHogTeamName(gear)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   739
        if checkEmptyTeam(t_name) then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   740
            for i = 0, TeamsCount - 1 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   741
                if teams[i] == t_name then
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   742
                    found = i
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   743
                    break
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   744
                end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   745
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   746
            for i = found, TeamsCount - 2 do
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   747
                teams[i] = teams[i + 1]
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   748
            end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   749
            teams[TeamsCount - 1] = nil
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   750
            TeamsCount = TeamsCount - 1
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   751
        end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   752
        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   753
        trackDeletion(gear)
11914
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   754
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   755
        -- End game properly when only the winner remains
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   756
        if gameOver and numhhs == 1 then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   757
            EndGame()
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   758
        end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   759
    elseif GetGearType(gear) == gtCase then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   760
        -- Check if a crate has been collected
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   761
        if band(GetGearMessage(gear), gmDestroy) ~= 0 and CurrentHedgehog ~= nil then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   762
            -- Update crate collection achievement
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   763
            increaseTeamValue(GetHogTeamName(CurrentHedgehog), "Crates")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   764
            if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates") > recordCrates) then
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   765
                recordCrates = getTeamValue(GetHogTeamName(CurrentHedgehog), "Crates")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   766
                recordCratesHogName = getGearValue(CurrentHedgehog, "Name")
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   767
                recordCratesTeamName = GetHogTeamName(CurrentHedgehog)
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   768
            end
1d2e89be3eb6 Update Mutant script
Wuzzy <almikes@aol.com>
parents: 11241
diff changeset
   769
        end
11015
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   770
    end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   771
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   772
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   773
function onParameters()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   774
    parseParams()
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   775
    winScore = tonumber(params["winscore"]) or winScore
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   776
end
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   777
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   778
--[[
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   779
S T A R R I N G
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   780
    prof - Coding, implementing and evangelism
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   781
    vos  - Initial idea and script improvements
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   782
    mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D
7a905f0070ce CRLF purge
nemo
parents: 10872
diff changeset
   783
--]]