share/hedgewars/Data/Maps/Knockball/map.lua
author smxx
Tue, 30 Mar 2010 23:13:12 +0000
changeset 3197 e1fa864fd6ca
parent 3058 2ebc20485344
child 3223 f0e590790f3b
permissions -rw-r--r--
Maps: * Disable Sudden Death on mission maps
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
3197
smxx
parents: 3058
diff changeset
    53
	SuddenDeathTurns = 99999 -- "disable" sudden death
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    54
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    55
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    56
function onGameStart()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    57
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    58
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    59
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    60
function onGameTick()
3058
2ebc20485344 Engine:
smxx
parents: 3013
diff changeset
    61
	if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    62
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    63
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    64
function onAmmoStoreInit()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    65
	SetAmmo(amBaseballBat, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    66
	SetAmmo(amSkip, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    67
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    68
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    69
function onGearAdd(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    70
	if GetGearType(gear) == gtShover then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    71
		ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    72
		if ball ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    73
			CopyPV2(gear, ball)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    74
			SetState(ball, 0x200) -- temporary - might change!
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    75
			SetTag(ball, 8) -- baseball skin
3058
2ebc20485344 Engine:
smxx
parents: 3013
diff changeset
    76
			FollowGear(ball)
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    77
		end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    78
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    79
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    80
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    81
function onGearDelete(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    82
	if gear == ball then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    83
		ball = nil
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    84
	elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    85
		local clan = GetHogClan(CurrentHedgehog)
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    86
		local s
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    87
		if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    88
			score[clan] = score[clan] + 1
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    89
			s = string.format(loc(scored), GetHogName(gear), clan + 1)
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    90
		else
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    91
			score[clan] = score[clan] - 1
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    92
			s = string.format(loc(failed), GetHogName(gear), clan + 1)
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    93
		end
3013
dfc1f16aeb53 General:
smxx
parents: 3004
diff changeset
    94
		s = s .. " " .. score[0]
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    95
		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    96
		ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    97
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    98
end