share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 10096 51d6b80ba43c
parent 10088 6d4cd54dd343
child 10219 bbeb1e9aaa65
equal deleted inserted replaced
10095:003fc694c0c3 10096:51d6b80ba43c
   155 function StartingSetUp(gear)
   155 function StartingSetUp(gear)
   156     for i = 1,maxWep do
   156     for i = 1,maxWep do
   157         setGearValue(gear,i,0)
   157         setGearValue(gear,i,0)
   158     end
   158     end
   159     for w,c in pairs(wepArray) do
   159     for w,c in pairs(wepArray) do
   160         if c == 9 then
   160         if c == 9 and (atkWeps[w] or utilWeps[w])  then
   161             setGearValue(gear,w,1)
   161             setGearValue(gear,w,1)
   162         end
   162         end
   163 	end
   163 	end
   164 
   164 
   165 	setGearValue(gear,amSkip,100)
   165 	setGearValue(gear,amSkip,100)
   166    
   166    
   167     local r = 0
   167     local r = 0
   168     if atktot > 0 then
   168     if atktot > 0 then
   169         r = GetRandom(atktot)+1
   169         r = GetRandom(atktot)+1
   170         for w,c in pairs(atkChoices) do
   170         for i = 1,maxWep do
       
   171         --for w,c in pairs(atkChoices) do
   171             --WriteLnToConsole('     c: '..c..' w:'..w..' r:'..r)
   172             --WriteLnToConsole('     c: '..c..' w:'..w..' r:'..r)
   172             if c >= r then
   173             if atkChoices[i] >= r then
   173                 setGearValue(gear,w,1)
   174                 setGearValue(gear,i,1)
   174                 break
   175                 break
   175             end
   176             end
   176         end
   177         end
   177     end
   178     end
   178     if utiltot > 0 then
   179     if utiltot > 0 then
   179         r = GetRandom(utiltot)+1
   180         r = GetRandom(utiltot)+1
   180         for w,c in pairs(utilChoices) do
   181         for i = 1,maxWep do
       
   182        -- for w,c in pairs(utilChoices) do
   181             --WriteLnToConsole('util c: '..c..' w:'..w..' r:'..r)
   183             --WriteLnToConsole('util c: '..c..' w:'..w..' r:'..r)
   182             if c >= r then
   184             if utilChoices[i] >= r then
   183                 setGearValue(gear,w,1)
   185                 setGearValue(gear,i,1)
   184                 break
   186                 break
   185             end
   187             end
   186         end
   188         end
   187     end
   189     end
   188 end
   190 end
   208 
   210 
   209 	if CurrentHedgehog ~= nil then
   211 	if CurrentHedgehog ~= nil then
   210 
   212 
   211         for w,c in pairs(wepArray) do
   213         for w,c in pairs(wepArray) do
   212 			val = getGearValue(gear,w)
   214 			val = getGearValue(gear,w)
   213 			if val ~= 0 then
   215 			if val ~= 0 and wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0  then
   214 				setGearValue(CurrentHedgehog, w, val)
   216 				setGearValue(CurrentHedgehog, w, val)
   215 
   217 
   216 				-- if you are using multi-shot weapon, gimme one more
   218 				-- if you are using multi-shot weapon, gimme one more
   217 				if (GetCurAmmoType() == w) and (shotsFired ~= 0) then
   219 				if (GetCurAmmoType() == w) and (shotsFired ~= 0) then
   218 					AddAmmo(CurrentHedgehog, w, val+1)
   220 					AddAmmo(CurrentHedgehog, w, val+1)