share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua
author Wuzzy <almikes@aol.com>
Tue, 11 Apr 2017 02:44:59 +0200
changeset 12224 d62d6f8ebef1
parent 11968 1de4d6b35748
child 12586 7510fe66bfbb
permissions -rw-r--r--
Disable Sudden Death consistently in all missions which don't require it
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7889
diff changeset
     1
HedgewarsScriptLoad("/Scripts/Locale.lua")
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     2
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     3
local hhs = {}
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     4
local missionWon = nil
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     5
local endTimer = 1000
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     6
local hogsKilled = 0
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
     7
local finishTime
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     8
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
     9
local HogData =	{
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    10
					{"Bufon", 			"ShaggyYeti",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    11
					{"burp", 			"lambda",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    12
					{"Blue", 			"cap_blue",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    13
					{"bender", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    14
					{"Castell",			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    15
					{"cekoto", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    16
					{"CheezeMonkey",	"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    17
					{"claymore", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    18
					{"CIA-144", 		"cyborg1",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    19
					{"doomy ", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    20
					{"Falkenauge", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    21
					{"FadeOne", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    22
					{"hayaa", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    23
					{"Hermes", 			"laurel",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    24
					{"HedgeKing",		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    25
					{"Izack1535", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    26
					{"Kiofspa", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    27
					{"Komplex", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    28
					{"koda", 			"poke_mudkip",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    29
					{"Lalo", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    30
					{"Logan", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    31
					{"lollkiller", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    32
					{"Luelle", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    33
					{"mikade", 			"Skull",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    34
					{"Mushi", 			"sm_daisy",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    35
					{"Naboo", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    36
					{"nemo", 			"bb_bub",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    37
					{"practice", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    38
					{"Prof. Panic",  	"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    39
					{"Randy",			"zoo_Sheep",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    40
					{"rhino", 			"NinjaTriangle",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    41
					{"Radissthor",  	"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    42
					{"Sami",			"sm_peach",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    43
					{"soreau", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    44
					{"sdw195", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    45
					{"sphrix", 			"TeamTopHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    46
					{"sheepluva",		"zoo_Sheep",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    47
					{"Smaxx", 			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    48
					{"shadowzero", 		"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    49
					{"Star and Moon",	"SparkleSuperFun",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    50
					{"The 24",			"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    51
					{"TLD",				"NoHat",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    52
					{"Tiyuri", 			"sf_ryu",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    53
					{"unC0Rr", 			"cyborg1",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    54
					{"Waldsau", 		"cyborg1",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    55
					{"wolfmarc", 		"knight",false},
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    56
					{"Xeli", 			"android",false}
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    57
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    58
				}
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    59
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    60
function GenericEnd()
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    61
	EndGame()
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    62
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    63
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    64
function GameOverMan()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    65
	missionWon = false
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    66
	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    67
	SendStat(siGameResult, loc("Challenge over!"))
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    68
	local score = math.ceil((hogsKilled / 16)*6000)
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    69
	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    70
	SendStat(siPointType, "points")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    71
	SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    72
	PlaySound(sndHellish)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    73
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    74
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    75
function GG()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    76
	missionWon = true
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    77
	local completeTime = (TurnTime - finishTime) / 1000
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    78
	ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    79
	PlaySound(sndHomerun)
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    80
	SendStat(siGameResult, loc("Challenge completed!"))
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    81
	local hogScore = math.ceil((hogsKilled / 16)*6000)
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    82
	local timeScore = math.ceil((finishTime/TurnTime)*6000)
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    83
	local score = hogScore + timeScore
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    84
	SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    85
	SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    86
	SendStat(siPointType, "points")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
    87
	SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    88
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    89
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    90
function AssignCharacter(p)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    91
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    92
	done = false
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    93
	sanityCheck = 0
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    94
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    95
	while(done == false) do
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    96
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    97
		i = 1+ GetRandom(#HogData)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    98
		if HogData[i][3] == false then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
    99
			HogData[i][3] = true
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   100
			done = true
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   101
			SetHogName(hhs[p], HogData[i][1])
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   102
			SetHogHat(hhs[p], HogData[i][2])
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   103
		elseif HogData[i][3] == true then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   104
			sanityCheck = sanityCheck +1
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   105
			if sanityCheck == 100 then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   106
				done = true
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   107
				SetHogName(hhs[p], "Newbie")
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   108
				SetHogHat(hhs[p], "NoHat")
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   109
			end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   110
		end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   111
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   112
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   113
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   114
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   115
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   116
function onGameInit()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   117
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   118
	--Seed = 1
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   119
	GameFlags = gfBorder + gfSolidLand
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   120
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   121
	TurnTime = 180 * 1000
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   122
	Delay = 500
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   123
	Map = "Ropes"
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   124
	Theme = "Eyes"
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   125
12224
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 11968
diff changeset
   126
	-- Disable Sudden Death
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 11968
diff changeset
   127
	WaterRise = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 11968
diff changeset
   128
	HealthDecrease = 0
d62d6f8ebef1 Disable Sudden Death consistently in all missions which don't require it
Wuzzy <almikes@aol.com>
parents: 11968
diff changeset
   129
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   130
	CaseFreq = 0
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   131
	MinesNum = 0
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   132
	Explosives = 0
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   133
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   134
	AddTeam(loc("Wannabe Shoppsta"), 0x11F12B, "Simple", "Island", "Default", "cm_shoppa")
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   135
	hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   136
	SetGearPosition(player, 1380, 1500)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   137
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   138
	AddTeam(loc("Unsuspecting Louts"), 0xDD0000, "Simple", "Island", "Default", "cm_face")
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   139
	for i = 1, 8 do
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   140
		hhs[i] = AddHog("generic", 0, 1, "NoHat")
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   141
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   142
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   143
	AddTeam(loc("Unlucky Sods"), 0xDD0000, "Simple", "Island", "Default", "cm_balrog")
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   144
	for i = 9, 16 do
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   145
		hhs[i] = AddHog("generic", 0, 1, "NoHat")
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   146
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   147
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   148
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   149
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   150
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   151
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   152
function onGameStart()
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   153
	SendHealthStatsOff()
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   154
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   155
	ShowMission     (
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   156
                        loc("Rope-knocking Challenge"),
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   157
                        loc("Challenge"),
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   158
                        loc("Use the rope to knock your enemies to their doom.") .. "|" ..
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   159
                        loc("Finish this challenge as fast as possible to earn bonus points."),
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   160
                        -amRope, 4000)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   161
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   162
	PlaceGirder(46,1783, 0)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   163
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   164
	SetGearPosition(hhs[0], 2419, 1769)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   165
	SetGearPosition(hhs[1], 3350, 570)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   166
	SetGearPosition(hhs[2], 3039, 1300)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   167
	SetGearPosition(hhs[3], 2909, 430)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   168
	SetGearPosition(hhs[4], 2150, 879)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   169
	SetGearPosition(hhs[5], 1735, 1136)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   170
	SetGearPosition(hhs[6], 1563, 553)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   171
	SetGearPosition(hhs[7], 679, 859)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   172
	SetGearPosition(hhs[8], 1034, 251)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   173
	SetGearPosition(hhs[9], 255, 67)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   174
	SetGearPosition(hhs[10], 2671, 7)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   175
	SetGearPosition(hhs[11], 2929, 244)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   176
	SetGearPosition(hhs[12], 1946, 221)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   177
	SetGearPosition(hhs[13], 3849, 1067)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   178
	SetGearPosition(hhs[14], 3360, 659)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   179
	SetGearPosition(hhs[15], 3885, 285)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   180
	SetGearPosition(hhs[16], 935, 1160)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   181
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   182
	for i = 1, 16 do
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   183
		AssignCharacter(i)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   184
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   185
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   186
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   187
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   188
function onGameTick()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   189
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   190
	if (TurnTimeLeft == 1) and (missionWon == nil) then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   191
		GameOverMan()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   192
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   193
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   194
	if missionWon ~= nil then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   195
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   196
		endTimer = endTimer - 1
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   197
		if endTimer == 1 then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   198
			GenericEnd()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   199
		end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   200
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   201
		if missionWon == true then
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   202
			AddCaption(loc("Victory!"), 0xFFFFFFFF,capgrpGameState)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   203
		else
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   204
			AddCaption(loc("Challenge over!"), 0xFFFFFFFF,capgrpGameState)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   205
		end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   206
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   207
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   208
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   209
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   210
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   211
function onGearDamage(gear, damage)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   212
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   213
	if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog then
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   214
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   215
		AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   216
		DeleteGear(gear)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   217
		PlaySound(sndExplosion)
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   218
		AddCaption(string.format(knockTaunt(), GetHogName(gear)), 0xFFFFFFFF, capgrpMessage)
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   219
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   220
		hogsKilled = hogsKilled +1
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   221
		if hogsKilled == 15 then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   222
			PlaySound(sndRideOfTheValkyries)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   223
		elseif hogsKilled == 16 then
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   224
			finishTime = TurnTimeLeft
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   225
			GG()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   226
		end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   227
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   228
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   229
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   230
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   231
11687
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   232
function knockTaunt()
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   233
	local r = math.random(0,23)
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   234
	local taunt
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   235
	if r == 0 then taunt =		loc("%s has been knocked out.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   236
	elseif r == 1 then taunt =	loc("%s hit the ground.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   237
	elseif r == 2 then taunt =	loc("%s splatted.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   238
	elseif r == 3 then taunt =	loc("%s was smashed.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   239
	elseif r == 4 then taunt =	loc("%s felt unstable.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   240
	elseif r == 5 then taunt =	loc("%s exploded.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   241
	elseif r == 6 then taunt =	loc("%s fell from a high cliff.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   242
	elseif r == 7 then taunt =	loc("%s goes the way of the lemming.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   243
	elseif r == 8 then taunt =	loc("%s was knocked away.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   244
	elseif r == 9 then taunt =	loc("%s was really unlucky.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   245
	elseif r == 10 then taunt =	loc("%s felt victim to rope-knocking.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   246
	elseif r == 11 then taunt =	loc("%s had no chance.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   247
	elseif r == 12 then taunt =	loc("%s was a good target.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   248
	elseif r == 13 then taunt =	loc("%s spawned at a really bad position.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   249
	elseif r == 14 then taunt =	loc("%s was doomed from the beginning.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   250
	elseif r == 15 then taunt =	loc("%s has fallen victim to gravity.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   251
	elseif r == 16 then taunt =	loc("%s hates Newton.")		-- Isaac Newton
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   252
	elseif r == 17 then taunt =	loc("%s had it coming.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   253
	elseif r == 18 then taunt =	loc("%s is eliminated!")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   254
	elseif r == 19 then taunt =	loc("%s fell too fast.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   255
	elseif r == 20 then taunt =	loc("%s flew like a rock.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   256
	elseif r == 21 then taunt =	loc("%s stumpled.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   257
	elseif r == 22 then taunt =	loc("%s was shoved away.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   258
	elseif r == 23 then taunt =	loc("%s didn't expect that.")
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   259
	end
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   260
	return taunt
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   261
end
594016813e06 Update Rope-Knocking Challenge
Wuzzy <almikes@aol.com>
parents: 10290
diff changeset
   262
7889
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   263
function onGearDelete(gear)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   264
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   265
	if (gear == hhs[0]) and (missionWon == nil) then
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   266
		GameOverMan()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   267
	end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   268
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   269
end
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   270
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   271
function onAmmoStoreInit()
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   272
	SetAmmo(amRope, 9, 0, 0, 0)
57b117d441b9 consistent line endings
nemo
parents: 7095
diff changeset
   273
end
11689
c0ad9cf7db65 preselect weapons
sheepluva
parents: 11687
diff changeset
   274
c0ad9cf7db65 preselect weapons
sheepluva
parents: 11687
diff changeset
   275
function onNewTurn()
c0ad9cf7db65 preselect weapons
sheepluva
parents: 11687
diff changeset
   276
 	SetWeapon(amRope)
c0ad9cf7db65 preselect weapons
sheepluva
parents: 11687
diff changeset
   277
end