322 return sm.gameTurns >= goal.turns |
322 return sm.gameTurns >= goal.turns |
323 elseif goal.type == "rounds" then |
323 elseif goal.type == "rounds" then |
324 return (TotalRounds) >= goal.rounds |
324 return (TotalRounds) >= goal.rounds |
325 elseif goal.type == "inZone" then |
325 elseif goal.type == "inZone" then |
326 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
326 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
327 return "fail", criticalGearFailText(goal.id) |
327 return "fail", _G.sm.criticalGearFailText(goal.id) |
328 end |
328 end |
329 local gX, gY = GetGearPosition(_G.sm.goalGears[goal.id]) |
329 local gX, gY = GetGearPosition(_G.sm.goalGears[goal.id]) |
330 -- 4 sub-goals, each optional |
330 -- 4 sub-goals, each optional |
331 local g1 = (not goal.xMin) or gX >= goal.xMin |
331 local g1 = (not goal.xMin) or gX >= goal.xMin |
332 local g2 = (not goal.xMax) or gX <= goal.xMax |
332 local g2 = (not goal.xMax) or gX <= goal.xMax |
336 elseif goal.type == "distGearPos" or goal.type == "distGearGear" then |
336 elseif goal.type == "distGearPos" or goal.type == "distGearGear" then |
337 local gX, gY, tX, tY |
337 local gX, gY, tX, tY |
338 if goal.type == "distGearPos" then |
338 if goal.type == "distGearPos" then |
339 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
339 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
340 -- Fail if gear was destroyed |
340 -- Fail if gear was destroyed |
341 return "fail", criticalGearFailText(goal.id) |
341 return "fail", _G.sm.criticalGearFailText(goal.id) |
342 end |
342 end |
343 gX, gY = GetGearPosition(_G.sm.goalGears[goal.id]) |
343 gX, gY = GetGearPosition(_G.sm.goalGears[goal.id]) |
344 tX, tY = goal.x, goal.y |
344 tX, tY = goal.x, goal.y |
345 elseif goal.type == "distGearGear" then |
345 elseif goal.type == "distGearGear" then |
346 -- Fail if one of the gears was destroyed |
346 -- Fail if one of the gears was destroyed |
347 if getGearValue(_G.sm.goalGears[goal.id1], "sm_destroyed") then |
347 if getGearValue(_G.sm.goalGears[goal.id1], "sm_destroyed") then |
348 return "fail", criticalGearFailText(goal.id1) |
348 return "fail", _G.sm.criticalGearFailText(goal.id1) |
349 elseif getGearValue(_G.sm.goalGears[goal.id2], "sm_destroyed") then |
349 elseif getGearValue(_G.sm.goalGears[goal.id2], "sm_destroyed") then |
350 return "fail", criticalGearFailText(goal.id2) |
350 return "fail", _G.sm.criticalGearFailText(goal.id2) |
351 end |
351 end |
352 gX, gY = GetGearPosition(_G.sm.goalGears[goal.id1]) |
352 gX, gY = GetGearPosition(_G.sm.goalGears[goal.id1]) |
353 tX, tY = GetGearPosition(_G.sm.goalGears[goal.id2]) |
353 tX, tY = GetGearPosition(_G.sm.goalGears[goal.id2]) |
354 end |
354 end |
355 |
355 |
385 return tookEnoughDamage |
385 return tookEnoughDamage |
386 elseif goal.type == "drown" then |
386 elseif goal.type == "drown" then |
387 local drowned = getGearValue(_G.sm.goalGears[goal.id], "sm_drowned") |
387 local drowned = getGearValue(_G.sm.goalGears[goal.id], "sm_drowned") |
388 -- Fail if gear was destroyed by something other than drowning |
388 -- Fail if gear was destroyed by something other than drowning |
389 if not drowned and getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
389 if not drowned and getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
390 return "fail", criticalGearFailText(goal.id) |
390 return "fail", _G.sm.criticalGearFailText(goal.id) |
391 end |
391 end |
392 return drowned |
392 return drowned |
393 elseif goal.type == "poison" then |
393 elseif goal.type == "poison" then |
394 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
394 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
395 return "fail", criticalGearFailText(goal.id) |
395 return "fail", _G.sm.criticalGearFailText(goal.id) |
396 end |
396 end |
397 return GetEffect(_G.sm.goalGears[goal.id], hePoisoned) >= 1 |
397 return GetEffect(_G.sm.goalGears[goal.id], hePoisoned) >= 1 |
398 elseif goal.type == "freeze" then |
398 elseif goal.type == "freeze" then |
399 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
399 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
400 return "fail", criticalGearFailText(goal.id) |
400 return "fail", _G.sm.criticalGearFailText(goal.id) |
401 end |
401 end |
402 return GetEffect(_G.sm.goalGears[goal.id], heFrozen) >= 256 |
402 return GetEffect(_G.sm.goalGears[goal.id], heFrozen) >= 256 |
403 elseif goal.type == "cure" then |
403 elseif goal.type == "cure" then |
404 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
404 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
405 return "fail", criticalGearFailText(goal.id) |
405 return "fail", _G.sm.criticalGearFailText(goal.id) |
406 end |
406 end |
407 return GetEffect(_G.sm.goalGears[goal.id], hePoisoned) == 0 |
407 return GetEffect(_G.sm.goalGears[goal.id], hePoisoned) == 0 |
408 elseif goal.type == "melt" then |
408 elseif goal.type == "melt" then |
409 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
409 if getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
410 return "fail", criticalGearFailText(goal.id) |
410 return "fail", _G.sm.criticalGearFailText(goal.id) |
411 end |
411 end |
412 return GetEffect(_G.sm.goalGears[goal.id], heFrozen) == 0 |
412 return GetEffect(_G.sm.goalGears[goal.id], heFrozen) == 0 |
413 elseif goal.type == "waterSkip" then |
413 elseif goal.type == "waterSkip" then |
414 local skips = goal.skips or 1 |
414 local skips = goal.skips or 1 |
415 local hasEnoughSkips = getGearValue(_G.sm.goalGears[goal.id], "sm_waterSkips") >= skips |
415 local hasEnoughSkips = getGearValue(_G.sm.goalGears[goal.id], "sm_waterSkips") >= skips |
416 -- Fail if gear was destroyed before it got the required number of skips |
416 -- Fail if gear was destroyed before it got the required number of skips |
417 if not hasEnoughSkips and getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
417 if not hasEnoughSkips and getGearValue(_G.sm.goalGears[goal.id], "sm_destroyed") then |
418 return "fail", criticalGearFailText(goal.id) |
418 return "fail", _G.sm.criticalGearFailText(goal.id) |
419 end |
419 end |
420 return hasEnoughSkips |
420 return hasEnoughSkips |
421 elseif goal.type == "teamDefeat" then |
421 elseif goal.type == "teamDefeat" then |
422 return #teamHogs[goal.teamName] == 0 |
422 return #teamHogs[goal.teamName] == 0 |
423 else |
423 else |