share/hedgewars/Data/Maps/Knockball/map.lua
author smxx
Wed, 17 Mar 2010 22:56:23 +0000
changeset 3013 dfc1f16aeb53
parent 3004 e9b3613cc3fb
child 3058 2ebc20485344
permissions -rw-r--r--
General: * Updated Spanish translation by Palewolf Maps: * Updated Knockball to use less strings and placeholders
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     1
-- Hedgewars - Knockball for 2+ Players
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     2
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     3
local caption = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     4
	["en"] = "Hedgewars-Knockball",
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
     5
	["de"] = "Hedgewars-Knockball",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
     6
	["es"] = "Hedgewars-Knockball"
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     7
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     8
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     9
local subcaption = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    10
	["en"] = "Not So Friendly Match",
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    11
	["de"] = "Kein-so-Freundschaftsspiel",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    12
	["es"] = "Partido no-tan-amistoso"
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    13
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    14
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    15
local goal = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    16
	["en"] = "Bat balls at your enemies and|push them into the sea!",
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    17
	["de"] = "Schlage Bälle auf deine Widersacher|und lass sie ins Meer fallen!",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    18
	["es"] = "¡Batea pelotas hacia tus enemigos|y hazlos caer al agua!"
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    19
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    20
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    21
local scored = {
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    22
	["en"] = "%s is out and Team %d|scored a point!| |Score:",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    23
	["de"] = "%s ist draußen und Team %d|erhält einen Punkt!| |Punktestand:",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    24
	["es"] = "¡%s cayó y Equipo %d|anotó un tanto!| |Puntuación:"
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    25
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    26
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    27
local failed = {
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    28
	["en"] = "%s is out and Team %d|scored a penalty!| |Score:",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    29
	["de"] = "%s ist draußen und Team %d|erhält eine Strafe!| |Punktestand:",
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    30
	["es"] = "¡%s cayó y Equipo %d|anotó una falta!| |Puntuación:"
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    31
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    32
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    33
local function loc(text)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    34
	if text == nil then return "**missing**"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    35
	elseif text[L] == nil then return text["en"]
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    36
	else return text[L]
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    37
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    38
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    39
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    40
---------------------------------------------------------------
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    41
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    42
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    43
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    44
local ball = nil
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    45
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    46
function onGameInit()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    47
	GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    48
	TurnTime = 20000
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    49
	CaseFreq = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    50
	LandAdds = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    51
	Explosives = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    52
	Delay = 500
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    53
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    54
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    55
function onGameStart()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    56
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    57
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    58
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    59
function onGameTick()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    60
	if ball ~= nil then FollowGear(ball) end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    61
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    62
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    63
function onAmmoStoreInit()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    64
	SetAmmo(amBaseballBat, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    65
	SetAmmo(amSkip, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    66
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    67
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    68
function onGearAdd(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    69
	if GetGearType(gear) == gtShover then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    70
		ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    71
		if ball ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    72
			CopyPV2(gear, ball)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    73
			SetState(ball, 0x200) -- temporary - might change!
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    74
			SetTag(ball, 8) -- baseball skin
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    75
		end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    76
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    77
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    78
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    79
function onGearDelete(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    80
	if gear == ball then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    81
		ball = nil
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    82
	elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    83
		local clan = GetHogClan(CurrentHedgehog)
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    84
		local s
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    85
		if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    86
			score[clan] = score[clan] + 1
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    87
			s = string.format(loc(scored), GetHogName(gear), clan + 1)
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    88
		else
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    89
			score[clan] = score[clan] - 1
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    90
			s = string.format(loc(failed), GetHogName(gear), clan + 1)
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    91
		end
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    92
		s = s .. " " .. score[0]
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    93
		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    94
		ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    95
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    96
end