equal
deleted
inserted
replaced
484 _G.sm.checkRegularVictory = function() |
484 _G.sm.checkRegularVictory = function() |
485 local victory = true |
485 local victory = true |
486 for t=0, TeamsCount-1 do |
486 for t=0, TeamsCount-1 do |
487 local team = GetTeamName(t) |
487 local team = GetTeamName(t) |
488 local defeat = _G.sm.checkGoal({type="teamDefeat", teamName=team}) |
488 local defeat = _G.sm.checkGoal({type="teamDefeat", teamName=team}) |
|
489 if not defeat then |
|
490 -- Deep check, also look at damage of all hogs |
|
491 local dead = 0 |
|
492 for h=1, #teamHogs[team] do |
|
493 local _,_,_,_,_,_,_,_,_,_,_,Damage = GetGearValues(teamHogs[team][h]) |
|
494 if Damage >= GetHealth(teamHogs[team][h]) then |
|
495 dead = dead + 1 |
|
496 end |
|
497 end |
|
498 if dead >= #teamHogs[team] then |
|
499 defeat = true |
|
500 end |
|
501 end |
489 if (defeat == true) and (GetTeamClan(team) == _G.sm.playerClan) then |
502 if (defeat == true) and (GetTeamClan(team) == _G.sm.playerClan) then |
490 victory = false |
503 victory = false |
491 break |
504 break |
492 elseif (defeat == false) and (GetTeamClan(team) ~= _G.sm.playerClan) then |
505 elseif (defeat == false) and (GetTeamClan(team) ~= _G.sm.playerClan) then |
493 victory = false |
506 victory = false |
502 -- Checks goals and non goals and wins or loses mission |
515 -- Checks goals and non goals and wins or loses mission |
503 _G.sm.checkWinOrFail = function() |
516 _G.sm.checkWinOrFail = function() |
504 if errord then |
517 if errord then |
505 return |
518 return |
506 end |
519 end |
507 _G.sm.checkRegularVictory() |
|
508 local nonGoalStatus, nonGoalFailText = _G.sm.checkNonGoals() |
520 local nonGoalStatus, nonGoalFailText = _G.sm.checkNonGoals() |
509 local goalStatus, goalFailText = _G.sm.checkGoals() |
521 local goalStatus, goalFailText = _G.sm.checkGoals() |
510 if nonGoalStatus == true then |
522 if nonGoalStatus == true then |
511 _G.sm.lose(nonGoalFailText) |
523 _G.sm.lose(nonGoalFailText) |
512 elseif goalStatus == "fail" then |
524 elseif goalStatus == "fail" then |
683 SetWind(params.wind) |
695 SetWind(params.wind) |
684 end |
696 end |
685 _G.sm.gameStarted = true |
697 _G.sm.gameStarted = true |
686 |
698 |
687 if params.customGoalCheck == "turnStart" then |
699 if params.customGoalCheck == "turnStart" then |
|
700 _G.sm.checkRegularVictory() |
688 _G.sm.checkWinOrFail() |
701 _G.sm.checkWinOrFail() |
689 end |
702 end |
690 end |
703 end |
691 |
704 |
692 _G.onEndTurn = function() |
705 _G.onEndTurn = function() |
693 _G.sm.gameTurns = _G.sm.gameTurns + 1 |
706 _G.sm.gameTurns = _G.sm.gameTurns + 1 |
694 |
707 |
695 if params.customGoalCheck == "turnEnd" then |
708 if params.customGoalCheck == "turnEnd" then |
|
709 _G.sm.checkRegularVictory() |
696 _G.sm.checkWinOrFail() |
710 _G.sm.checkWinOrFail() |
697 end |
711 end |
698 end |
712 end |
699 |
713 |
700 _G.onAmmoStoreInit = function() |
714 _G.onAmmoStoreInit = function() |