share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
author mikade <redgrinner@gmail.com>
Sat, 02 May 2015 11:47:55 +0900
changeset 10918 1b878d1d32ce
parent 10872 0ad3c53992d2
child 11015 7a905f0070ce
permissions -rw-r--r--
fix techracer map 3 another small test map
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10044
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     1
local MUTANT_VERSION = "v0.9.5"
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     2
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     3
--[[                  ___                   ___
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     4
                    (   )                 (   )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     5
___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     6
(   )   '   (   )(   (   __) / .-, (   )   (   __)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     7
|  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     8
| |  | |  | | |  | | | | ___ .'`  || |  | || | ___
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
     9
| |  | |  | | |  | | | |(   / .'| || |  | || |(   )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    10
| |  | |  | | |  | | | | | | /  | || |  | || | | |
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    11
| |  | |  | | |  ; ' | ' | ; |  ; || |  | || ' | |
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    12
| |  | |  | ' `-'  / ' `-' ' `-'  || |  | |' `-' ;
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    13
(___)(___)(___'.__.'   `.__.`.__.'_(___)(___)`.__.
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    14
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    15
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    16
----  Recommended settings:
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    17
----    * one hedgehog per team
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    18
----    * 'Small' one-island map
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    19
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    20
--]]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    21
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    22
HedgewarsScriptLoad("/Scripts/Locale.lua")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    23
HedgewarsScriptLoad("/Scripts/Tracker.lua")
10857
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
    24
HedgewarsScriptLoad("/Scripts/Params.lua")
10044
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    25
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    26
--[[
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    27
    MUTANT SCRIPT
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    28
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    29
    To Do:  -Clean-up this fucking piece of code
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    30
            -Debug
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    31
            -Find a girlfriend
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    32
            -Fix Sheepluva's hat  +[p]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    33
            -Cookies
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    34
-----------------------]]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    35
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    36
local hhs = {}
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    37
local numhhs = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    38
local meh = false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    39
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    40
local gameOver=false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    41
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    42
local mutant = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    43
local mutant_base_health = 200
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    44
local mutant_base_disease = 25
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    45
local disease_timer = 2000
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    46
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    47
local kill_reward = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    48
local mt_hurt=false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    49
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    50
local killsCounter = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    51
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    52
local team_fire_punishment = 3
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    53
local mutant_kill_reward = 2
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    54
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    55
local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine}
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    56
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    57
local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport}
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    58
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    59
local disease=0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    60
local timer=0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    61
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    62
local winScore = 15
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    63
local hogsLimit = 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    64
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    65
local teams = {}
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    66
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    67
local circles = {}
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    68
local circleFrame = -1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    69
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    70
function showStartingInfo()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    71
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    72
	ruleSet = loc("RULES") .. ": " ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    73
	" |" .. --" |" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    74
	loc("The first player to kill someone becomes the Mutant.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    75
	loc("The Mutant has super-weapons and a lot of health.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    76
	loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    77
	" |" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    78
	loc("Normal players can only score points by killing the mutant.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    79
	" |" .. "" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    80
	loc("The player with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    81
	loc("The Bottom Feeder can score points by killing anyone.") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    82
	" |" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    83
	loc("POINTS") .. ": " ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    84
	" |" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    85
	loc("+2 for becoming a Mutant") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    86
	loc("+1 to a Mutant for killing anyone") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    87
	loc("+1 to a Bottom Feeder for killing anyone") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    88
	loc("-1 to anyone for a suicide") .. "|" ..
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    89
	loc("Other kills don't give you points.")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    90
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    91
	ShowMission(loc("Mutant"),
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    92
                loc("a Hedgewars tag game"),
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    93
                ruleSet, 0, 5000)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    94
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    95
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    96
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    97
function onGameInit()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    98
    TurnTime = 20000
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
    99
    WaterRise = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   100
    EnableGameFlags(gfResetWeps, gfPerHogAmmo)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   101
    HealthCaseProb=0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   102
    HealthCaseAmount=0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   103
    MinesTime=1000
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   104
    CaseFreq = 2
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   105
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   106
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   107
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   108
function limitHogs(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   109
    cnthhs = cnthhs + 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   110
        if cnthhs > 1 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   111
            hogLimitHit = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   112
            SetEffect(gear, heResurrectable, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   113
            --SetHealth(gear, 0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   114
            SetGearPosition(gear, -100,LAND_HEIGHT)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   115
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   116
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   117
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   118
function onGameStart()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   119
    trackTeams()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   120
    teamScan()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   121
    runOnHogs(saveStuff)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   122
    --local str = "/say " .. MUTANT_VERSION
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   123
    --ParseCommand(str)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   124
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   125
    hogLimitHit = false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   126
    for i=0 , TeamsCount - 1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   127
        cnthhs = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   128
        runOnHogsInTeam(limitHogs, teams[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   129
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   130
    if hogLimitHit then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   131
        AddCaption(loc("ONE HOG PER TEAM! KILLING EXCESS HEDGES"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   132
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   133
    showStartingInfo()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   134
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   135
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   136
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   137
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   138
function giveWeapons(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   139
    if gear == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   140
        AddAmmo(gear, amRope)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   141
        for i=1, #mt_weapons do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   142
            AddAmmo(gear, mt_weapons[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   143
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   144
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   145
    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   146
        for i=1, #hh_weapons do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   147
            AddAmmo(gear,hh_weapons[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   148
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   149
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   150
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   151
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   152
function onAmmoStoreInit()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   153
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   154
    SetAmmo(amSkip, 9, 0, 0, 0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   155
    SetAmmo(amRope,0,1,0,5)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   156
    SetAmmo(amSnowball,0,1,0,1)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   157
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   158
    for i=1, #hh_weapons do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   159
        SetAmmo(hh_weapons[i], 0, 0, 0, 1)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   160
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   161
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   162
    for i=1, #mt_weapons do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   163
        SetAmmo(mt_weapons[i], 0, 3, 0, 1)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   164
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   165
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   166
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   167
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   168
function drawCircles()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   169
    for i = 0, #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   170
        if circles[hhs[i]] ~= nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   171
            DeleteVisualGear(circles[hhs[i]])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   172
            circles[hhs[i]] = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   173
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   174
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   175
        if hhs[i] ~= CurrentHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   176
            if mutant == nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   177
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   178
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   179
            elseif CurrentHedgehog == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   180
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   181
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   182
            elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   183
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   184
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   185
            elseif hhs[i] == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   186
                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   187
                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   188
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   189
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   190
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   191
    circleFrame = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   192
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   193
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   194
function onNewTurn()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   195
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   196
    trackTeams()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   197
    killsCounter = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   198
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   199
    if mutant == nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   200
        AddCaption( loc("FIRST BLOOD MUTATES") )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   201
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   202
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   203
    checkScore()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   204
    giveWeapons(CurrentHedgehog)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   205
    drawCircles()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   206
    setAIHints()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   207
    kill_reward= numhhs*10
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   208
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   209
    if CurrentHedgehog == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   210
        mt_hurt=true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   211
        disease= mutant_base_disease - numhhs
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   212
    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   213
        mt_hurt=false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   214
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   215
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   216
    setGearValue(CurrentHedgehog, "Alive", true)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   217
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   218
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   219
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   220
function countBodies()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   221
        if killsCounter == 2 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   222
            AddCaption(loc("DOUBLE KILL"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   223
        elseif killsCounter == 3 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   224
            AddCaption(loc("MEGA KILL"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   225
            PlaySound(sndRegret)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   226
        elseif killsCounter == 4 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   227
            AddCaption(loc("ULTRA KILL"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   228
        elseif killsCounter == 5 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   229
            AddCaption(loc("MONSTER KILL"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   230
            PlaySound(sndIllGetYou)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   231
        elseif killsCounter == 6 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   232
            AddCaption(loc("LUDICROUS KILL"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   233
            PlaySound(sndNutter)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   234
        elseif killsCounter == 7 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   235
            AddCaption(loc("HOLY SHYTE!"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   236
            PlaySound(sndLaugh)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   237
        elseif killsCounter > 8 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   238
            AddCaption(loc("INSANITY"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   239
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   240
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   241
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   242
function onGameTick()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   243
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   244
    if circleFrame > -1 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   245
        for i = 0, #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   246
            if circles[hhs[i]] ~= nil and hhs[i]~= nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   247
                hhx, hhy = GetGearPosition(hhs[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   248
                X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   249
                SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   250
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   251
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   252
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   253
        circleFrame = circleFrame + 0.06
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   254
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   255
        if circleFrame >= 25 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   256
            for i = 0, #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   257
                if circles[hhs[i]] ~= nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   258
                    DeleteVisualGear(circles[hhs[i]])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   259
                    circles[hhs[i]] = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   260
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   261
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   262
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   263
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   264
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   265
    if TurnTimeLeft==0 and mt_hurt then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   266
        mt_hurt = false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   267
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   268
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   269
    if mt_hurt and mutant~=nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   270
        timer = timer + 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   271
            if timer > disease_timer then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   272
                timer = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   273
                SetHealth(mutant, GetHealth(mutant)-disease )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   274
                AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   275
                    if GetHealth(mutant)<=0 then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   276
                        SetHealth(mutant,0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   277
                        mt_hurt= false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   278
                        setGearValue(mutant,"SelfDestruct",true)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   279
                        TurnTimeLeft = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   280
                    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   281
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   282
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   283
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   284
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   285
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   286
function saveStuff(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   287
    setGearValue(gear,"Name",GetHogName(gear))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   288
    setGearValue(gear,"Hat",GetHogHat(gear))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   289
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   290
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   291
function armageddon(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   292
    SetState(gear, gstLoser)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   293
    SetEffect(gear, heResurrectable, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   294
    SetHealth(gear, 0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   295
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   296
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   297
function updateScore()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   298
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   299
    local showScore = ""
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   300
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   301
    for i=0, TeamsCount-1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   302
        if teams[i]~= nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   303
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   304
            local curr_score = getTeamValue(teams[i], "Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   305
            showScore = showScore .. teams[i] .. ": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   306
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   307
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   308
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   309
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   310
    ShowMission(loc("Score"),
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   311
                "-------",
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   312
                showScore, 0, 200)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   313
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   314
    HideMission()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   315
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   316
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   317
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   318
function checkScore()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   319
local showScore = ""
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   320
local lowest_score_team = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   321
local min_score=nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   322
local winTeam = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   323
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   324
local only_low_score = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   325
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   326
    for i=0, TeamsCount-1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   327
        if teams[i]~=nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   328
            local curr_score = getTeamValue(teams[i], "Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   329
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   330
            runOnHogsInTeam(removeFeeder, teams[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   331
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   332
            showScore = showScore .. teams[i] ..": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   333
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   334
            if curr_score >= winScore then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   335
                gameOver = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   336
                winTeam = teams[i]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   337
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   338
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   339
            if min_score==nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   340
                min_score= curr_score
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   341
                lowest_score_team = teams[i]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   342
            else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   343
                if curr_score <= min_score then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   344
                    if curr_score == min_score then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   345
                        if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   346
                            only_low_score = false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   347
                        else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   348
                            if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   349
                                lowest_score_team = teams[i]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   350
                            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   351
                            only_low_score = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   352
                        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   353
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   354
                    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   355
                        min_score= curr_score
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   356
                        lowest_score_team = teams[i]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   357
                        only_low_score = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   358
                    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   359
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   360
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   361
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   362
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   363
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   364
    if gameOver then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   365
        TurnTimeLeft = 0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   366
        for i=0, #teams do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   367
            if teams[i]~=winTeam then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   368
                runOnHogsInTeam(armageddon, teams[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   369
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   370
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   371
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   372
    ShowMission(    loc("WINNER IS ") .. winTeam,
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   373
                    "~~~~~~~~~~~~~~~~~~~~~~~~~",
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   374
                    showScore, 0, 200)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   375
    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   376
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   377
    if only_low_score then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   378
        runOnHogsInTeam(setFeeder, lowest_score_team)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   379
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   380
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   381
    if meh == false then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   382
		meh = true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   383
	else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   384
		ShowMission(    loc("Score"),
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   385
                    loc("-------"),
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   386
                    showScore, 0, 200)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   387
	end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   388
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   389
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   390
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   391
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   392
function backToNormal(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   393
    SetHogName(gear, getGearValue(gear,"Name"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   394
    SetHogHat(gear, 'NoHat')
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   395
    SetHogHat(gear, getGearValue(gear,"Hat"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   396
    setGearValue(mutant,"SelfDestruct",false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   397
    mt_hurt=false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   398
    mutant=nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   399
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   400
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   401
function setAIHints()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   402
    for i = 0, #hhs do
10872
0ad3c53992d2 Hints for bottom feeder, which were somehow lost
unc0rr
parents: 10857
diff changeset
   403
        if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant or getGearValue(CurrentHedgehog, "Feeder") then
10044
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   404
            SetGearAIHints(hhs[i], aihUsual)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   405
        else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   406
            SetGearAIHints(hhs[i], aihDoesntMatter)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   407
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   408
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   409
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   410
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   411
function removeFeeder(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   412
    if gear~=nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   413
        setGearValue(gear,"Feeder",false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   414
        if gear~= mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   415
            SetHogName(gear, getGearValue(gear,"Name") )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   416
            SetHogHat(gear, 'NoHat')
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   417
            SetHogHat(gear, getGearValue(gear,"Hat"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   418
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   419
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   420
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   421
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   422
function setFeeder(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   423
    if gear~= mutant and gear~= nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   424
        SetHogName(gear,"BOTTOM FEEDER")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   425
        SetHogHat(gear, 'poke_slowpoke')
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   426
        setGearValue(gear,"Feeder", true)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   427
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   428
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   429
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   430
function setMutantStuff(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   431
    mutant = gear
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   432
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   433
    SetHogName(gear,"MUTANT")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   434
    SetHogHat(gear,'WhySoSerious')
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   435
    SetHealth(gear, ( mutant_base_health + numhhs*25) )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   436
    SetEffect(gear, hePoisoned, 1)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   437
    setGearValue(mutant,"SelfDestruct",false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   438
    setGearValue(gear, "Feeder", false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   439
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   440
    AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED"))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   441
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   442
    TurnTimeLeft=0
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   443
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   444
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   445
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   446
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   447
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   448
    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   449
    PlaySound(sndSuddenDeath)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   450
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   451
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   452
function teamScan()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   453
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   454
        for i=0, TeamsCount-1 do --nil filling
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   455
        teams[i]=nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   456
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   457
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   458
        for i=0, #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   459
            for j=0, TeamsCount-1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   460
                if teams[j] ==nil and hhs[i]~=nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   461
                teams[j] = GetHogTeamName(hhs[i])
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   462
                setTeamValue(teams[j],"Score",0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   463
                setTeamValue(teams[j], "DeadHogs",0)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   464
                break
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   465
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   466
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   467
                if teams[j] == GetHogTeamName(hhs[i]) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   468
                    break
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   469
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   470
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   471
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   472
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   473
        ---***---
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   474
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   475
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   476
function set_Mutant_and_Score(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   477
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   478
local curr_team = GetHogTeamName(CurrentHedgehog)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   479
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   480
    if gear == CurrentHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   481
        if CurrentHedgehog == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   482
            PlaySound(sndHomerun)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   483
            if getGearValue(gear, "SelfDestruct")==false then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   484
                decreaseTeamValue(curr_team,"Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   485
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   486
            backToNormal(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   487
        else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   488
            decreaseTeamValue(curr_team,"Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   489
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   490
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   491
    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   492
            if gear == mutant then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   493
                    backToNormal(mutant)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   494
                    if curr_team ~=GetHogTeamName(gear) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   495
                            if  getGearValue(CurrentHedgehog, "Alive") then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   496
                            setMutantStuff(CurrentHedgehog)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   497
                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   498
                            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   499
                    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   500
                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   501
                    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   502
            else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   503
                if mutant==nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   504
                        if curr_team ~=GetHogTeamName(gear) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   505
                            if getGearValue(CurrentHedgehog, "Alive") then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   506
                                    setMutantStuff(CurrentHedgehog)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   507
                                    setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   508
                            else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   509
                                increaseTeamValue(curr_team,"Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   510
                            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   511
                        else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   512
                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   513
                        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   514
                else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   515
                    if curr_team ~=GetHogTeamName(gear) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   516
                        if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   517
                            SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   518
                            AddCaption("+" .. kill_reward .. loc(" HP") )
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   519
                            increaseTeamValue(curr_team,"Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   520
                        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   521
                        if getGearValue(CurrentHedgehog,"Feeder") then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   522
                            increaseTeamValue(curr_team,"Score")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   523
                        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   524
                    else
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   525
                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   526
                    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   527
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   528
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   529
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   530
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   531
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   532
function onGearResurrect(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   533
if not gameOver then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   534
    if GetGearType(gear) == gtHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   535
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   536
        increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   537
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   538
        if gear==CurrentHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   539
            setGearValue(CurrentHedgehog, "Alive", false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   540
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   541
        set_Mutant_and_Score(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   542
        if gear~=CurrentHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   543
            killsCounter = killsCounter + 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   544
            countBodies()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   545
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   546
        AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   547
        PlaySound(sndWhack)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   548
        updateScore()
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   549
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   550
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   551
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   552
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   553
function onGearAdd(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   554
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   555
    -- Catch hedgehogs for the tracker
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   556
    if GetGearType(gear) == gtHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   557
        trackGear(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   558
        hhs[numhhs] = gear
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   559
        numhhs = numhhs + 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   560
        SetEffect(gear, heResurrectable, 1)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   561
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   562
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   563
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   564
function checkEmptyTeam (teamName)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   565
    for i=0 , #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   566
        if hhs[i]~=nil then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   567
            if teamName == GetHogTeamName(hhs[i]) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   568
                return false
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   569
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   570
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   571
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   572
    return true
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   573
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   574
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   575
function onGearDelete(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   576
    -- Remove hogs that are gone
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   577
    if GetGearType(gear) == gtHedgehog then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   578
        numhhs = numhhs - 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   579
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   580
        local found
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   581
        for i=0, #hhs do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   582
            if hhs[i] == gear then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   583
                found = i
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   584
                break
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   585
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   586
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   587
        for i = found, #hhs - 1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   588
            hhs[i] = hhs[i + 1]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   589
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   590
        hhs[#hhs] = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   591
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   592
        local t_name = GetHogTeamName(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   593
        if checkEmptyTeam(t_name) then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   594
            for i = 0, TeamsCount - 1 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   595
                if teams[i] == t_name then
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   596
                    found = i
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   597
                    break
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   598
                end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   599
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   600
            for i = found, TeamsCount - 2 do
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   601
                teams[i] = teams[i + 1]
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   602
            end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   603
            teams[TeamsCount - 1] = nil
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   604
            TeamsCount = TeamsCount - 1
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   605
        end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   606
        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   607
        trackDeletion(gear)
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   608
    end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   609
end
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   610
10857
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
   611
function onParameters()
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
   612
    parseParams()
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
   613
    winScore = tonumber(params["winscore"]) or winScore
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
   614
end
6ef0fb6cd3bb Script parameter to adjust winning score for Mutant
unC0Rr
parents: 10044
diff changeset
   615
10044
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   616
--[[
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   617
S T A R R I N G
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   618
    prof - Coding, implementing and evangelism
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   619
    vos  - Initial idea and script improvements
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   620
    mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D
33e64afccd3b readd r3be36d2fdca6
koda
parents: 10017
diff changeset
   621
--]]