changeset 13456 | 7a0a56c52fd2 |
parent 13451 | 7d69c5605a9d |
child 13685 | 09ea1faf97ca |
13455:38814954a248 | 13456:7a0a56c52fd2 |
---|---|
66 |
66 |
67 local probability = {1,2,5,10,20,50,200,500,1000000}; |
67 local probability = {1,2,5,10,20,50,200,500,1000000}; |
68 local atktot = 0 |
68 local atktot = 0 |
69 local utiltot = 0 |
69 local utiltot = 0 |
70 |
70 |
71 local someHog = nil -- just for looking up the weps |
71 local teleportConverted = false -- used for special handling of teleport when gfPlaceHog is active |
72 |
72 |
73 -- Script parameter stuff |
73 -- Script parameter stuff |
74 |
74 |
75 --[[ Loyal Highlander. |
75 --[[ Loyal Highlander. |
76 If true, killing hogs of your own clan doesn't give you their weapons. |
76 If true, killing hogs of your own clan doesn't give you their weapons. |
177 end |
177 end |
178 end |
178 end |
179 |
179 |
180 function ConvertValues(gear) |
180 function ConvertValues(gear) |
181 for w,c in pairs(wepArray) do |
181 for w,c in pairs(wepArray) do |
182 AddAmmo(gear, w, getGearValue(gear,w) ) |
182 -- Add hog ammo loadout, but don't touch teleport if in hog placement phase. |
183 -- If in hog placement phase, teleport will be touched later (see onNewTurn). |
|
184 if not (GetGameFlag(gfPlaceHog) and TotalRounds == -1 and (w == amTeleport)) then |
|
185 AddAmmo(gear, w, getGearValue(gear,w) ) |
|
186 end |
|
183 end |
187 end |
184 end |
188 end |
185 |
189 |
186 -- this is called when a hog dies |
190 -- this is called when a hog dies |
187 function TransferWeps(gear) |
191 function TransferWeps(gear) |
263 if i ~= amNothing then |
267 if i ~= amNothing then |
264 atkChoices[i] = 0 |
268 atkChoices[i] = 0 |
265 utilChoices[i] = 0 |
269 utilChoices[i] = 0 |
266 if i ~= 7 then |
270 if i ~= 7 then |
267 wepArray[i] = 0 |
271 wepArray[i] = 0 |
268 c = GetAmmoCount(someHog, i) |
272 c = GetAmmo(i) |
269 if c > 8 then |
273 if c > 8 then |
270 c = 9 |
274 c = 9 |
271 end |
275 end |
272 wepArray[i] = c |
276 wepArray[i] = c |
273 if c < 9 and c > 0 then |
277 if c < 9 and c > 0 then |
299 |
303 |
300 if currHog ~= lastHog then |
304 if currHog ~= lastHog then |
301 |
305 |
302 -- re-assign ammo to this guy, so that his entire ammo set will |
306 -- re-assign ammo to this guy, so that his entire ammo set will |
303 -- be visible during another player's turn |
307 -- be visible during another player's turn |
304 if lastHog ~= nil then |
308 if lastHog ~= nil and GetHealth(lastHog) then |
305 ConvertValues(lastHog) |
309 ConvertValues(lastHog) |
306 end |
310 end |
307 |
311 |
308 -- give the new hog what he is supposed to have, too |
312 -- give the new hog what he is supposed to have, too |
309 ConvertValues(CurrentHedgehog) |
313 ConvertValues(CurrentHedgehog) |
316 |
320 |
317 end |
321 end |
318 |
322 |
319 function onNewTurn() |
323 function onNewTurn() |
320 CheckForHogSwitch() |
324 CheckForHogSwitch() |
325 |
|
326 -- If hog placement phase is over, set the hog's actual teleport loadout |
|
327 if GetGameFlag(gfPlaceHog) and TotalRounds == 0 and not teleportConverted then |
|
328 runOnHogs(function(gear) |
|
329 AddAmmo(gear, amTeleport, getGearValue(gear, amTeleport)) |
|
330 end) |
|
331 -- This makes sure this code is only run once |
|
332 teleportConverted = true |
|
333 end |
|
321 end |
334 end |
322 |
335 |
323 function onGearAdd(gear) |
336 function onGearAdd(gear) |
324 |
337 |
325 if (GetGearType(gear) == gtHedgehog) then |
338 if (GetGearType(gear) == gtHedgehog) then |
326 trackGear(gear) |
339 trackGear(gear) |
327 if someHog == nil then |
|
328 someHog = gear |
|
329 end |
|
330 end |
340 end |
331 |
341 |
332 end |
342 end |
333 |
343 |
334 function onGearDelete(gear) |
344 function onGearDelete(gear) |