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