share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 12703 6726d5edfdfb
parent 12340 f706ca71aa86
child 12704 c4ea9f8fb483
equal deleted inserted replaced
12702:0dfb49261cab 12703:6726d5edfdfb
     1 --------------------------------
     1 --------------------------------
     2 -- HIGHLANDER / HOGS OF WAR
     2 -- HIGHLANDER / HOGS OF WAR
     3 -- version 0.4b+
       
     4 -- by mikade
     3 -- by mikade
     5 --------------------------------
     4 --------------------------------
       
     5 
       
     6 -- Ancient changelog:
     6 
     7 
     7 -----------
     8 -----------
     8 --0.1
     9 --0.1
     9 -----------
    10 -----------
    10 
    11 
   130 local atktot = 0
   131 local atktot = 0
   131 local utiltot = 0
   132 local utiltot = 0
   132 
   133 
   133 local someHog = nil -- just for looking up the weps
   134 local someHog = nil -- just for looking up the weps
   134 
   135 
       
   136 -- Script parameter stuff
   135 local mode = nil
   137 local mode = nil
       
   138 
       
   139 -- If true, killing hogs of your own clan doesn't give you their weapons.
       
   140 -- Otherwise, killing any hog gives you their weapons.
       
   141 local loyal = false
   136 
   142 
   137 function onParameters()
   143 function onParameters()
   138     parseParams()
   144     parseParams()
   139     mode = params["mode"]
   145     mode = params["mode"]
       
   146     loyal = params["loyal"] == "true"
   140 end
   147 end
   141 
   148 
   142 function CheckForWeaponSwap()
   149 function CheckForWeaponSwap()
   143 	if GetCurAmmoType() ~= lastWep then
   150 	if GetCurAmmoType() ~= lastWep then
   144 		shotsFired = 0
   151 		shotsFired = 0
   215 end
   222 end
   216 
   223 
   217 -- this is called when a hog dies
   224 -- this is called when a hog dies
   218 function TransferWeps(gear)
   225 function TransferWeps(gear)
   219 
   226 
   220 	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then
   227 	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear and (not loyal or (GetHogClan(CurrentHedgehog) ~= GetHogClan(gear))) then
   221 
   228 
   222         local x,y,color
   229         local x,y,color
   223         local vgear
   230         local vgear
   224         local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint
   231         local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint
   225         local dspl = IsHogLocal(CurrentHedgehog)
   232         local dspl = IsHogLocal(CurrentHedgehog)
   271 
   278 
   272 function onGameInit()
   279 function onGameInit()
   273 	EnableGameFlags(gfInfAttack, gfRandomOrder, gfPerHogAmmo)
   280 	EnableGameFlags(gfInfAttack, gfRandomOrder, gfPerHogAmmo)
   274 	DisableGameFlags(gfResetWeps, gfSharedAmmo)
   281 	DisableGameFlags(gfResetWeps, gfSharedAmmo)
   275 	HealthCaseProb = 100
   282 	HealthCaseProb = 100
   276 	Goals = loc("Highlander: Eliminate enemy hogs to take their weapons") .. "|" ..
   283 	if loyal then
   277 	loc("Replenishment: Weapons are restocked on turn start of a new hog")
   284 		Goals = loc("Loyal Highlander: Eliminate enemy hogs to take their weapons") .. "|"
       
   285 	else
       
   286 		Goals = loc("Highlander: Eliminate hogs to take their weapons") .. "|"
       
   287 	end
       
   288 	Goals = Goals .. loc("Replenishment: Weapons are restocked on turn start of a new hog")
   278 end
   289 end
   279 
   290 
   280 function onGameStart()
   291 function onGameStart()
   281     utilChoices[amSkip] = 0
   292     utilChoices[amSkip] = 0
   282     local c = 0
   293     local c = 0