share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 12320 a85212a8d0e0
parent 12309 6b34067a6344
child 12321 1be56fa243c8
equal deleted inserted replaced
12319:09b0a709c4bb 12320:a85212a8d0e0
   116 local wepArray = {}
   116 local wepArray = {}
   117 
   117 
   118 local atkChoices = {}
   118 local atkChoices = {}
   119 local utilChoices = {}
   119 local utilChoices = {}
   120 
   120 
       
   121 local currHog
       
   122 local lastHog
   121 local started = false
   123 local started = false
   122 local switchStage = 0
   124 local switchStage = 0
   123 
   125 
   124 local lastWep = amNothing
   126 local lastWep = amNothing
   125 local shotsFired = 0
   127 local shotsFired = 0
   126 
   128 
   127 local probability = {1,2,5,10,20,50,200,500,1000000};
   129 local probability = {1,2,5,10,20,50,200,500,1000000};
   128 local atktot = 0
   130 local atktot = 0
   129 local utiltot = 0
   131 local utiltot = 0
   130 
   132 
   131 local lastHog = nil
       
   132 local someHog = nil -- just for looking up the weps
   133 local someHog = nil -- just for looking up the weps
   133 
   134 
   134 local mode = nil
   135 local mode = nil
   135 
   136 
   136 function onParameters()
   137 function onParameters()
   308 
   309 
   309 	runOnGears(StartingSetUp)
   310 	runOnGears(StartingSetUp)
   310 	runOnGears(ConvertValues)
   311 	runOnGears(ConvertValues)
   311 end
   312 end
   312 
   313 
   313 function AssignHogAmmo()
   314 function CheckForHogSwitch()
       
   315 
   314 	if (CurrentHedgehog ~= nil) then
   316 	if (CurrentHedgehog ~= nil) then
   315 		-- Re-assign ammo to this guy, so that his entire ammo set will
   317 
   316 		-- be visible during another player's turn
   318 		currHog = CurrentHedgehog
   317 		if lastHog ~= nil then
   319 
   318 			ConvertValues(lastHog)
   320 		if currHog ~= lastHog then
       
   321 
       
   322 			-- re-assign ammo to this guy, so that his entire ammo set will
       
   323 			-- be visible during another player's turn
       
   324 			if lastHog ~= nil then
       
   325 				ConvertValues(lastHog)
       
   326 			end
       
   327 
       
   328 			-- give the new hog what he is supposed to have, too
       
   329 			ConvertValues(CurrentHedgehog)
       
   330 
   319 		end
   331 		end
   320 
   332 
   321 		-- Give the new hog what he is supposed to have, too
   333 		lastHog = currHog
   322 		ConvertValues(CurrentHedgehog)
   334 
   323 
   335 	end
   324 		lastHog = CurrentHedgehog
   336 
   325 	end
       
   326 end
   337 end
   327 
   338 
   328 function onNewTurn()
   339 function onNewTurn()
   329 	AssignHogAmmo()
   340 	CheckForHogSwitch()
   330 end
   341 end
   331 
   342 
   332 --function onGameTick20()
   343 --function onGameTick20()
   333 --CheckForHogSwitch()
   344 --CheckForHogSwitch()
   334 -- if we use gfPerHogAmmo is this even needed? Err, well, weapons reset, so... yes?
   345 -- if we use gfPerHogAmmo is this even needed? Err, well, weapons reset, so... yes?