share/hedgewars/Data/Maps/Basketball/map.lua
author smxx
Tue, 16 Mar 2010 19:28:15 +0000
changeset 3003 0afdba08a858
parent 3000 2b9405b6dc5d
child 3004 e9b3613cc3fb
permissions -rw-r--r--
Engine: * Avoid Homerun event if permanent low gravity is enabled * Added CurrentHedgehog to script globals (contains uid) Maps: * Rewrote Basketball scoring message (didn't count right anyway)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     1
-- Hedgewars - Basketball for 2 Players
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     2
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     3
local caption = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     4
	["en"] = "Hedgewars-Basketball",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     5
	["de"] = "Hedgewars-Basketball"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     6
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     7
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     8
local subcaption = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     9
	["en"] = "Not So Friendly Match",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    10
	["de"] = "Kein-so-Freundschaftsspiel"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    11
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    12
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    13
local goal = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    14
	["en"] = "Bat your opponents through the|baskets and out of the map!",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    15
	["de"] = "Schlage deine Widersacher durch|die Körbe und aus der Karte hinaus!"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    16
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    17
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    18
local scored = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    19
	["en"] = " scored a point!",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    20
	["de"] = " erhält einen Punkt!"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    21
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    22
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    23
local failed = {
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    24
	["en"] = " scored a penalty!",
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    25
	["de"] = " erhält eine Strafe!"
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    26
	}
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    27
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    28
	local sscore = {
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    29
	["en"] = "Score",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    30
	["de"] = "Punktestand"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    31
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    32
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    33
local team = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    34
	["en"] = "Team"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    35
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    36
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    37
local drowning = {
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    38
	["en"] = "is out and",
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    39
	["de"] = "ist draußen und"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    40
	}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    41
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    42
local function loc(text)
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    43
	if text == nil then return "**missing**"
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    44
	elseif text[L] == nil then return text["en"]
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    45
	else return text[L]
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    46
	end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    47
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    48
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    49
---------------------------------------------------------------
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    50
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    51
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    52
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    53
function onGameInit()
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    54
	GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfLowGravity
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    55
	TurnTime = 20000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    56
	CaseFreq = 0
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    57
	LandAdds = 0
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    58
	Explosives = 0
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    59
	Delay = 500
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    60
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    61
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    62
function onGameStart()
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    63
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    64
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    65
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    66
function onGameTick()
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    67
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    68
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    69
function onAmmoStoreInit()
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    70
	SetAmmo(amBaseballBat, 9, 0, 0)
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    71
	SetAmmo(amSkip, 9, 0, 0)
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    72
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    73
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    74
function onGearAdd(gear)
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    75
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    76
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    77
function onGearDelete(gear)
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    78
	if (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    79
		local clan = GetHogClan(CurrentHedgehog)
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    80
		local s = GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " "
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    81
		if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    82
			score[clan] = score[clan] + 1
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    83
			s = s .. loc(scored)
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    84
		else
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    85
			score[clan] = score[clan] - 1
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    86
			s = s .. loc(failed)
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    87
		end
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    88
		s = s .. "| |" .. loc(sscore) .. ": " .. score[0]
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    89
		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    90
		ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    91
	end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    92
end