share/hedgewars/Data/Scripts/Multiplayer/Frenzy.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 12 Mar 2018 02:09:21 +0100
changeset 13169 6869d27a2f3f
parent 12337 75b41f029aaa
child 14434 04231f066ada
permissions -rw-r--r--
ACF7: Add one pick hammer in crate Players often reported to screw up with the pick hammer, which is quite annoying. With one pick hammer more, this mission should be slightly less annoying.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     1
-------------------------------------------
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     2
-- FRENZY
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     3
-- a hedgewars mode inspired by Hysteria
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     4
-------------------------------------------
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     5
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     6
HedgewarsScriptLoad("/Scripts/Locale.lua")
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     7
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     8
local cTimer = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
     9
local cn = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    10
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    11
local frenzyAmmos = {
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    12
	amBazooka,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    13
	amGrenade,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    14
	amMolotov,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    15
	amShotgun,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    16
	amFirePunch,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    17
	amMine,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    18
	amJetpack,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    19
	amBlowTorch,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    20
	amTeleport,
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    21
	amLowGravity
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    22
}
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    23
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    24
function showStartingInfo()
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    25
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    26
	ruleSet = "" ..
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    27
	loc("RULES:") .. " |" ..
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    28
	loc("Each turn is only ONE SECOND!") .. "|" ..
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    29
	loc("Use your ready time to think.") .. "|" ..
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    30
	loc("Slot keys save time! (F1-F10 by default)") .. "| |"
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    31
	for i=1, #frenzyAmmos do
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    32
		ruleSet = ruleSet .. string.format(loc("Slot %d: %s"), i, GetAmmoName(frenzyAmmos[i])) .. "|"
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    33
	end
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    34
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    35
	ShowMission(loc("FRENZY"),
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    36
                loc("A frenetic Hedgewars mini-game"),
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    37
                ruleSet, 0, 4000)
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    38
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    39
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    40
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    41
function onGameInit()
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    42
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    43
	if TurnTime > 10001 then
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    44
		Ready = 8000
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    45
	else
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    46
		Ready = TurnTime
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    47
	end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    48
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    49
	TurnTime = 1000
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    50
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    51
	--These are the official settings, but I think I prefer allowing customization in this regard
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    52
	--MinesNum = 8
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    53
	--MinesTime = 3000
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    54
	--MinesDudPercent = 30
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    55
	--Explosives = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    56
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    57
	--Supposedly official settings
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    58
	HealthCaseProb = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    59
	CrateFreq = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    60
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    61
	--Approximation of Official Settings
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    62
	--SuddenDeathTurns = 10
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    63
	--WaterRise = 47
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    64
	--HealthDecrease = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    65
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    66
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    67
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    68
function onGameStart()
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    69
	showStartingInfo()
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    70
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    71
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    72
function onSlot(sln)
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    73
	cTimer = 8
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    74
	cn = sln
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    75
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    76
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    77
function onGameTick()
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    78
	if cTimer ~= 0 then
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    79
		cTimer = cTimer -1
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    80
		if cTimer == 1 then
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    81
			ChangeWep(cn)
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    82
			cn = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    83
			cTimer = 0
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    84
		end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    85
	end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    86
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    87
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    88
-- Keyboard slot shortcuts
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    89
function ChangeWep(s)
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    90
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    91
	if s >= 0 and s <= 9 then
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    92
		SetWeapon(frenzyAmmos[s+1])
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    93
	end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    94
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    95
end
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
    96
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    97
function onAmmoStoreInit()
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    98
	-- Add frenzy ammos
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
    99
	for i=1, #frenzyAmmos do
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
   100
		SetAmmo(frenzyAmmos[i], 9, 0, 0, 0)
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
   101
	end
12337
75b41f029aaa Refactor Frenzy script
Wuzzy <almikes@aol.com>
parents: 11015
diff changeset
   102
	SetAmmo(amSkip, 9, 0, 0, 0)
11015
7a905f0070ce CRLF purge
nemo
parents: 10289
diff changeset
   103
end