2 -- FRENZY |
2 -- FRENZY |
3 -- a hedgewars mode inspired by Hysteria |
3 -- a hedgewars mode inspired by Hysteria |
4 ------------------------------------------- |
4 ------------------------------------------- |
5 |
5 |
6 HedgewarsScriptLoad("/Scripts/Locale.lua") |
6 HedgewarsScriptLoad("/Scripts/Locale.lua") |
7 HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
8 |
7 |
9 local cTimer = 0 |
8 local cTimer = 0 |
10 local cn = 0 |
9 local cn = 0 |
11 |
10 |
12 function initialSetup(gear) |
11 local frenzyAmmos = { |
13 SetHealth(gear, 75) -- official is 80, but that assumes bazookas/grenades that do 50 damage |
12 amBazooka, |
14 end |
13 amGrenade, |
|
14 amMolotov, |
|
15 amShotgun, |
|
16 amFirePunch, |
|
17 amMine, |
|
18 amJetpack, |
|
19 amBlowTorch, |
|
20 amTeleport, |
|
21 amLowGravity |
|
22 } |
15 |
23 |
16 function showStartingInfo() |
24 function showStartingInfo() |
17 |
25 |
18 ruleSet = "" .. |
26 ruleSet = "" .. |
19 loc("RULES") .. ": " .. "|" .. |
27 loc("RULES:") .. " |" .. |
20 loc("Each turn is only ONE SECOND!") .. "|" .. |
28 loc("Each turn is only ONE SECOND!") .. "|" .. |
21 loc("Use your ready time to think.") .. "|" .. |
29 loc("Use your ready time to think.") .. "|" .. |
22 loc("Slot keys save time! (F1-F10 by default)") .. "|" .. |
30 loc("Slot keys save time! (F1-F10 by default)") .. "| |" |
23 " |" .. |
31 for i=1, #frenzyAmmos do |
24 loc("SLOTS") .. ": " .. "|" .. |
32 ruleSet = ruleSet .. string.format(loc("Slot %d: %s"), i, GetAmmoName(frenzyAmmos[i])) .. "|" |
25 loc("Slot") .. " 1 - " .. loc("Bazooka") .. "|" .. |
33 end |
26 loc("Slot") .. " 2 - " .. loc("Grenade") .. "|" .. |
|
27 loc("Slot") .. " 3 - " .. loc("Shotgun") .. "|" .. |
|
28 loc("Slot") .. " 4 - " .. loc("Shoryuken") .. "|" .. |
|
29 loc("Slot") .. " 5 - " .. loc("Mine") .. "|" .. |
|
30 loc("Slot") .. " 6 - " .. loc("Teleport") .. "|" .. |
|
31 loc("Slot") .. " 7 - " .. loc("Blowtorch") .. "|" .. |
|
32 loc("Slot") .. " 8 - " .. loc("Flying Saucer") .. "|" .. |
|
33 loc("Slot") .. " 9 - " .. loc("Molotov") .. "|" .. |
|
34 loc("Slot") .. " 10 - " .. loc("Low Gravity") |
|
35 |
34 |
36 ShowMission(loc("FRENZY"), |
35 ShowMission(loc("FRENZY"), |
37 loc("a frenetic Hedgewars mini-game"), |
36 loc("A frenetic Hedgewars mini-game"), |
38 ruleSet, 0, 4000) |
37 ruleSet, 0, 4000) |
39 |
38 |
40 end |
39 end |
41 |
40 |
42 function onGameInit() |
41 function onGameInit() |
85 cTimer = 0 |
83 cTimer = 0 |
86 end |
84 end |
87 end |
85 end |
88 end |
86 end |
89 |
87 |
|
88 -- Keyboard slot shortcuts |
90 function ChangeWep(s) |
89 function ChangeWep(s) |
91 |
90 |
92 if s == 0 then |
91 if s >= 0 and s <= 9 then |
93 SetWeapon(amBazooka) |
92 SetWeapon(frenzyAmmos[s+1]) |
94 elseif s == 1 then |
|
95 SetWeapon(amGrenade) |
|
96 elseif s == 2 then |
|
97 SetWeapon(amShotgun) |
|
98 elseif s == 3 then |
|
99 SetWeapon(amFirePunch) |
|
100 elseif s == 4 then |
|
101 SetWeapon(amMine) |
|
102 elseif s == 5 then |
|
103 SetWeapon(amTeleport) |
|
104 elseif s == 6 then |
|
105 SetWeapon(amBlowTorch) |
|
106 elseif s == 7 then |
|
107 SetWeapon(amJetpack) |
|
108 elseif s == 8 then |
|
109 SetWeapon(amMolotov) |
|
110 elseif s == 9 then |
|
111 SetWeapon(amLowGravity) |
|
112 end |
93 end |
113 |
94 |
114 end |
95 end |
115 |
96 |
116 function onGearAdd(gear) |
97 function onAmmoStoreInit() |
117 if GetGearType(gear) == gtHedgehog then |
98 -- Add frenzy ammos |
118 trackGear(gear) |
99 for i=1, #frenzyAmmos do |
|
100 SetAmmo(frenzyAmmos[i], 9, 0, 0, 0) |
119 end |
101 end |
|
102 SetAmmo(amSkip, 9, 0, 0, 0) |
120 end |
103 end |
121 |
|
122 function onGearDelete(gear) |
|
123 if GetGearType(gear) == gtHedgehog then |
|
124 trackDeletion(gear) |
|
125 end |
|
126 end |
|
127 |
|
128 function onAmmoStoreInit() |
|
129 SetAmmo(amBazooka, 9, 0, 0, 0) |
|
130 SetAmmo(amGrenade, 9, 0, 0, 0) |
|
131 SetAmmo(amMolotov, 9, 0, 0, 0) |
|
132 SetAmmo(amShotgun, 9, 0, 0, 0) |
|
133 --SetAmmo(amFlamethrower, 9, 0, 0, 0) -- this was suggested on hw.org but it's not present on base |
|
134 SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
135 SetAmmo(amMine, 9, 0, 0, 0) |
|
136 --SetAmmo(amCake, 1, 0, 2, 0) -- maybe it's beefcake? |
|
137 SetAmmo(amJetpack, 9, 0, 0, 0) |
|
138 SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
139 SetAmmo(amTeleport, 9, 0, 0, 0) |
|
140 SetAmmo(amLowGravity, 9, 0, 0, 0) |
|
141 --SetAmmo(amSkipGo, 9, 0, 0, 0) -- not needed with 1s turn time |
|
142 end |
|