share/hedgewars/Data/Maps/TrophyRace/map.lua
author Henek
Sun, 07 Nov 2010 19:24:37 +0300
changeset 4168 49ad7bea4a33
parent 4162 923db448ad16
child 4171 7bbd7ab84454
permissions -rw-r--r--
renaming gtAmmo_Bomb and gtAmmo_Grenade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     1
-- Hedgewars - Roperace for 2+ Players
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     2
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     3
local caption = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     4
	["en"] = "TrophyRace",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
     5
	["sv"] = "TrophyRace",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     6
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     7
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     8
local goal = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     9
	["en"] = "Use your rope to get from start to finish as fast as you can!",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    10
	["sv"] = "Använd ditt rep för att ta dig från start till mål så fort som möjligt!",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    11
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    12
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    13
local done = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    14
	["en"] = "You've reached the goal!| |Time: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    15
	["sv"] = "Du har nått målet!| |Tid: ",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    16
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    17
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    18
local eliminated = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    19
	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    20
	["sv"] = "Eliminerar sämsta igelkott den här rundan...| |%s är UTE!",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    21
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    22
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    23
local newbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    24
	["en"] = "NEW fastest lap: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    25
	["sv"] = "NYTT snabbast varv: ",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    26
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    27
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    28
local oldbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    29
	["en"] = "Fastest lap: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    30
	["sv"] = "Snabbast varv: ",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    31
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    32
local bestclantimes = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    33
	["en"] = "Best laps per team: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    34
	["sv"] = "Bästa varv per lag: ",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    35
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    36
local clantime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    37
	["en"] = "Team %d: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    38
	["sv"] = "Lag %d: ",
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    39
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    40
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    41
	local function loc(text)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    42
	if text == nil then return "**missing**"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    43
	elseif text[L] == nil then return text["en"]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    44
	else return text[L]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    45
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    46
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    47
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    48
---------------------------------------------------------------
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    49
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    50
-- store number of hedgehogs
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    51
local numhhs = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    52
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    53
-- store hedgehog gears
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    54
local hhs = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    55
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    56
-- store best time per team
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    57
local clantimes = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    58
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    59
-- store best times
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    60
local times = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    61
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    62
-- in milisseconds
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    63
local maxtime = 99000
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    64
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    65
-- define start area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    66
local start_area = {1606, 498, 356, 80}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    67
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    68
-- define goal area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    69
local goal_area = {2030, 300, 56, 280}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    70
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    71
-- last active hog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    72
local lasthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    73
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    74
-- active hog reached the goal?
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    75
local reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    76
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    77
-- hog with best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    78
local besthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    79
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    80
-- hog with worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    81
local worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    82
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    83
-- best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    84
local besttime = maxtime + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    85
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    86
-- worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    87
local worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    88
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    89
function onGameInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    90
	GameFlags = gfSolidLand + gfInvulnerable
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    91
	TurnTime = maxtime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    92
	CaseFreq = 0
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    93
	MinesNum = 0
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    94
	Explosives = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    95
	Delay = 500
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    96
	SuddenDeathTurns = 99999 -- "disable" sudden death
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    97
	Theme = 'Olympics'
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    98
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    99
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   100
function onGameStart()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   101
	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   102
	started = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   103
	p=1820
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   104
	for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   105
	p = p + 50	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   106
	SetGearPosition(hhs[i], p, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   107
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   108
	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   109
	for i=0, ClansCount-1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   110
		clantimes[i] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   111
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   112
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   113
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   114
function onAmmoStoreInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   115
	SetAmmo(amRope, 9, 2, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   116
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   117
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   118
function onGameTick()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   119
	if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   120
		SetHealth(CurrentHedgehog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   121
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   122
		AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   123
		worsttime = 99999
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   124
		worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   125
	elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   126
		if lasthog ~= nil then 
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   127
		SetGearPosition(lasthog, p , 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   128
		end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   129
		reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   130
		SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   131
	elseif CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   132
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   133
		if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   134
			reached = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   135
			local ttime = maxtime - TurnTimeLeft
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   136
			--give it a sound;)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   137
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   138
				PlaySound (sndHomerun)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   139
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   140
				PlaySound (sndHellish)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   141
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   142
			for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   143
				if hhs[i] == CurrentHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   144
					times[numhhs] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   145
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   146
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   147
				
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   148
			local hscore = "| |"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   149
			local clan = GetHogClan(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   150
			if ttime < clantimes[clan] or clantimes[clan] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   151
				clantimes[clan] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   152
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   153
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   154
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   155
				besttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   156
				besthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   157
				hscore = hscore .. loc(newbesttime)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   158
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   159
				hscore = hscore .. loc(oldbesttime)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   160
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   161
			if ttime > worsttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   162
				worsttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   163
				worsthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   164
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   165
			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   166
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   167
			if clan == ClansCount -1 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   168
				-- Time for elimination - worst hog is out and the worst hog vars are reset.
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   169
				SetHealth(worsthog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   170
				--Place a grenade to make inactive slowest hog active
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   171
				x, y = GetGearPosition(worsthog)
4168
49ad7bea4a33 renaming gtAmmo_Bomb and gtAmmo_Grenade
Henek
parents: 4162
diff changeset
   172
				AddGear(x, y, gtShell, 0, 0, 0, 0)
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   173
				worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   174
				worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   175
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   176
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   177
			for i=0, ClansCount -1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   178
				local tt = "" .. (clantimes[i] / 1000) .. " s"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   179
				if clantimes[i] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   180
					tt = "--"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   181
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   182
				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   183
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   184
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   185
			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   186
			TurnTimeLeft = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   187
		end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   188
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   189
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   190
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   191
function onGearAdd(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   192
	if GetGearType(gear) == gtHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   193
		hhs[numhhs] = gear
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   194
		times[numhhs] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   195
		numhhs = numhhs + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   196
	elseif GetGearType(gear) == gtRope then -- rope is shot
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   197
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   198
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   199
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   200
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   201
function onGearDelete(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   202
	if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   203
		--TurnTimeLeft = 0 -- end turn or not? hm...
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   204
		lasthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   205
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   206
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   207
end