11015
|
1 |
-------------------------------------------
|
|
2 |
-- FRENZY
|
|
3 |
-- a hedgewars mode inspired by Hysteria
|
|
4 |
-------------------------------------------
|
|
5 |
|
|
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua")
|
|
7 |
|
|
8 |
local cTimer = 0
|
|
9 |
local cn = 0
|
|
10 |
|
12342
|
11 |
local frenzyAmmos = {
|
|
12 |
amBazooka,
|
|
13 |
amGrenade,
|
|
14 |
amMolotov,
|
|
15 |
amShotgun,
|
|
16 |
amFirePunch,
|
|
17 |
amMine,
|
|
18 |
amJetpack,
|
|
19 |
amBlowTorch,
|
|
20 |
amTeleport,
|
|
21 |
amLowGravity
|
|
22 |
}
|
11015
|
23 |
|
|
24 |
function showStartingInfo()
|
|
25 |
|
|
26 |
ruleSet = "" ..
|
12342
|
27 |
loc("RULES:") .. " |" ..
|
11015
|
28 |
loc("Each turn is only ONE SECOND!") .. "|" ..
|
|
29 |
loc("Use your ready time to think.") .. "|" ..
|
12342
|
30 |
loc("Slot keys save time! (F1-F10 by default)") .. "| |"
|
|
31 |
for i=1, #frenzyAmmos do
|
|
32 |
ruleSet = ruleSet .. string.format(loc("Slot %d: %s"), i, GetAmmoName(frenzyAmmos[i])) .. "|"
|
|
33 |
end
|
11015
|
34 |
|
|
35 |
ShowMission(loc("FRENZY"),
|
12342
|
36 |
loc("A frenetic Hedgewars mini-game"),
|
11015
|
37 |
ruleSet, 0, 4000)
|
|
38 |
|
|
39 |
end
|
|
40 |
|
|
41 |
function onGameInit()
|
|
42 |
|
|
43 |
if TurnTime > 10001 then
|
|
44 |
Ready = 8000
|
|
45 |
else
|
|
46 |
Ready = TurnTime
|
|
47 |
end
|
|
48 |
|
|
49 |
TurnTime = 1000
|
|
50 |
|
|
51 |
--These are the official settings, but I think I prefer allowing customization in this regard
|
|
52 |
--MinesNum = 8
|
|
53 |
--MinesTime = 3000
|
|
54 |
--MinesDudPercent = 30
|
|
55 |
--Explosives = 0
|
|
56 |
|
|
57 |
--Supposedly official settings
|
|
58 |
HealthCaseProb = 0
|
|
59 |
CrateFreq = 0
|
|
60 |
|
|
61 |
--Approximation of Official Settings
|
|
62 |
--SuddenDeathTurns = 10
|
|
63 |
--WaterRise = 47
|
|
64 |
--HealthDecrease = 0
|
|
65 |
|
|
66 |
end
|
|
67 |
|
|
68 |
function onGameStart()
|
|
69 |
showStartingInfo()
|
|
70 |
end
|
|
71 |
|
|
72 |
function onSlot(sln)
|
|
73 |
cTimer = 8
|
|
74 |
cn = sln
|
|
75 |
end
|
|
76 |
|
|
77 |
function onGameTick()
|
|
78 |
if cTimer ~= 0 then
|
|
79 |
cTimer = cTimer -1
|
|
80 |
if cTimer == 1 then
|
|
81 |
ChangeWep(cn)
|
|
82 |
cn = 0
|
|
83 |
cTimer = 0
|
|
84 |
end
|
|
85 |
end
|
|
86 |
end
|
|
87 |
|
12342
|
88 |
-- Keyboard slot shortcuts
|
11015
|
89 |
function ChangeWep(s)
|
|
90 |
|
12342
|
91 |
if s >= 0 and s <= 9 then
|
|
92 |
SetWeapon(frenzyAmmos[s+1])
|
11015
|
93 |
end
|
|
94 |
|
|
95 |
end
|
|
96 |
|
12342
|
97 |
function onAmmoStoreInit()
|
|
98 |
-- Add frenzy ammos
|
|
99 |
for i=1, #frenzyAmmos do
|
|
100 |
SetAmmo(frenzyAmmos[i], 9, 0, 0, 0)
|
11015
|
101 |
end
|
12342
|
102 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
11015
|
103 |
end
|