share/hedgewars/Data/Scripts/Multiplayer/Frenzy.lua
changeset 9087 52a8ee2e8324
child 10017 de822cd3df3a
equal deleted inserted replaced
9085:092051fda7e1 9087:52a8ee2e8324
       
     1 -------------------------------------------
       
     2 -- FRENZY
       
     3 -- a hedgewars mode inspired by Hysteria
       
     4 -------------------------------------------
       
     5 
       
     6 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     7 HedgewarsScriptLoad("/Scripts/Tracker.lua")
       
     8 
       
     9 local cTimer = 0
       
    10 local cn = 0
       
    11 
       
    12 function initialSetup(gear)
       
    13 	SetHealth(gear, 75) -- official is 80, but that assumes bazookas/grenades that do 50 damage
       
    14 end
       
    15 
       
    16 function showStartingInfo()
       
    17 
       
    18 	ruleSet = "" ..
       
    19 	loc("RULES") .. ": " .. "|" ..
       
    20 	loc("Each turn is only ONE SECOND!") .. "|" ..
       
    21 	loc("Use your ready time to think.") .. "|" ..
       
    22 	loc("Slot keys save time! (F1-F10 by default)") .. "|" ..
       
    23 	" |" ..
       
    24 	loc("SLOTS") .. ": " .. "|" ..
       
    25 	loc("Slot") .. " 1 - " .. loc("Bazooka") .. "|" ..
       
    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 
       
    36 	ShowMission(loc("FRENZY"),
       
    37                 loc("a frenetic Hedgewars mini-game"),
       
    38                 ruleSet, 0, 4000)
       
    39 
       
    40 end
       
    41 
       
    42 function onGameInit()
       
    43 
       
    44 	if TurnTime > 10001 then
       
    45 		Ready = 8000
       
    46 	else
       
    47 		Ready = TurnTime
       
    48 	end
       
    49 
       
    50 	TurnTime = 1000
       
    51 
       
    52 	--These are the official settings, but I think I prefer allowing customization in this regard
       
    53 	--MinesNum = 8
       
    54 	--MinesTime = 3000
       
    55 	--MinesDudPercent = 30
       
    56 	--Explosives = 0
       
    57 
       
    58 	--Supposedly official settings
       
    59 	HealthCaseProb = 0
       
    60 	CrateFreq = 0
       
    61 
       
    62 	--Approximation of Official Settings
       
    63 	--SuddenDeathTurns = 10
       
    64 	--WaterRise = 47
       
    65 	--HealthDecrease = 0
       
    66 
       
    67 end
       
    68 
       
    69 function onGameStart()
       
    70 	showStartingInfo()
       
    71 	runOnHogs(initialSetup)
       
    72 end
       
    73 
       
    74 function onSlot(sln)
       
    75 	cTimer = 8
       
    76 	cn = sln
       
    77 end
       
    78 
       
    79 function onGameTick()
       
    80 	if cTimer ~= 0 then
       
    81 		cTimer = cTimer -1
       
    82 		if cTimer == 1 then
       
    83 			ChangeWep(cn)
       
    84 			cn = 0
       
    85 			cTimer = 0
       
    86 		end
       
    87 	end
       
    88 end
       
    89 
       
    90 function ChangeWep(s)
       
    91 
       
    92 	if s == 0 then
       
    93 		ParseCommand("setweap " .. string.char(amBazooka))
       
    94 	elseif s == 1 then
       
    95 		ParseCommand("setweap " .. string.char(amGrenade))
       
    96 	elseif s == 2 then
       
    97 		ParseCommand("setweap " .. string.char(amShotgun))
       
    98 	elseif s == 3 then
       
    99 		ParseCommand("setweap " .. string.char(amFirePunch))
       
   100 	elseif s == 4 then
       
   101 		ParseCommand("setweap " .. string.char(amMine))
       
   102 	elseif s == 5 then
       
   103 		ParseCommand("setweap " .. string.char(amTeleport))
       
   104 	elseif s == 6 then
       
   105 		ParseCommand("setweap " .. string.char(amBlowTorch))
       
   106 	elseif s == 7 then
       
   107 		ParseCommand("setweap " .. string.char(amJetpack))
       
   108 	elseif s == 8 then
       
   109 		ParseCommand("setweap " .. string.char(amMolotov))
       
   110 	elseif s == 9 then
       
   111 		ParseCommand("setweap " .. string.char(amLowGravity))
       
   112 	end
       
   113 
       
   114 end
       
   115 
       
   116 function onGearAdd(gear)
       
   117 	if GetGearType(gear) == gtHedgehog then
       
   118 		trackGear(gear)
       
   119 	end
       
   120 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