219 AddEvent(CheckDensePit, {}, DoDensePit, {}, 0) |
220 AddEvent(CheckDensePit, {}, DoDensePit, {}, 0) |
220 AddEvent(CheckTookGirder1, {}, DoTookGirder1, {}, 0) |
221 AddEvent(CheckTookGirder1, {}, DoTookGirder1, {}, 0) |
221 AddEvent(CheckTookGirder2, {}, DoTookGirder2, {}, 0) |
222 AddEvent(CheckTookGirder2, {}, DoTookGirder2, {}, 0) |
222 SetGearMessage(leaks, 0) |
223 SetGearMessage(leaks, 0) |
223 SetGearMessage(dense, 0) |
224 SetGearMessage(dense, 0) |
224 TurnTimeLeft = 0 |
225 EndTurn(0) |
225 ShowMission(loc("The Journey Back"), loc("The Savior"), loc("Get Dense Cloud out of the pit!"), 1, 5000) |
226 ShowMission(loc("The Journey Back"), loc("The Savior"), loc("Get Dense Cloud out of the pit!"), 1, 5000) |
226 end |
227 end |
227 |
228 |
228 function SkipPastFlowerAnim() |
229 function SkipPastFlowerAnim() |
229 AnimSetGearPosition(dense, 2656, 1842) |
230 AnimSetGearPosition(dense, 2656, 1842) |
238 AddAmmo(cannibals[5], amDEagle, 0) |
239 AddAmmo(cannibals[5], amDEagle, 0) |
239 HideHedge(cannibals[5]) |
240 HideHedge(cannibals[5]) |
240 AddEvent(CheckTookFire, {}, DoTookFire, {}, 0) |
241 AddEvent(CheckTookFire, {}, DoTookFire, {}, 0) |
241 SetGearMessage(leaks, 0) |
242 SetGearMessage(leaks, 0) |
242 SetGearMessage(dense, 0) |
243 SetGearMessage(dense, 0) |
243 TurnTimeLeft = 0 |
244 EndTurn(true) |
244 ShowMission(loc("The Journey Back"), loc("They never learn"), loc("Free Dense Cloud and continue the mission!"), 1, 5000) |
245 ShowMission(loc("The Journey Back"), loc("They never learn"), loc("Free Dense Cloud and continue the mission!"), 1, 5000) |
245 end |
246 end |
246 |
247 |
247 function SkipOutPitAnim() |
248 function SkipOutPitAnim() |
248 AnimSetGearPosition(dense, unpack(midDensePosDuo)) |
249 AnimSetGearPosition(dense, unpack(midDensePosDuo)) |
567 outPitAnim = outPitAnimRL |
568 outPitAnim = outPitAnimRL |
568 end |
569 end |
569 |
570 |
570 function KillPrincess() |
571 function KillPrincess() |
571 DismissTeam(loc("Cannibal Sentry")) |
572 DismissTeam(loc("Cannibal Sentry")) |
572 TurnTimeLeft = 0 |
573 EndTurn(true) |
573 end |
574 end |
574 --/////////////////////////////Misc Functions//////////////////////// |
575 --/////////////////////////////Misc Functions//////////////////////// |
575 |
576 |
576 function HideHedge(hedge) |
577 function HideHedge(hedge) |
577 if hedgeHidden[hedge] ~= true then |
578 if hedgeHidden[hedge] ~= true then |
792 return (GetX(dense) < startEventXDuo and StoppedGear(dense)) |
793 return (GetX(dense) < startEventXDuo and StoppedGear(dense)) |
793 or (GetX(leaks) < startEventXDuo and StoppedGear(leaks)) |
794 or (GetX(leaks) < startEventXDuo and StoppedGear(leaks)) |
794 end |
795 end |
795 |
796 |
796 function DoPastFlower() |
797 function DoPastFlower() |
797 TurnTimeLeft = 0 |
798 EndTurn(true) |
798 RestoreHedge(cyborg) |
799 RestoreHedge(cyborg) |
799 AnimWait(cyborg, 1) |
800 AnimWait(cyborg, 1) |
800 AddFunction({func = AddAnim, args = {pastFlowerAnim}}) |
801 AddFunction({func = AddAnim, args = {pastFlowerAnim}}) |
801 AddFunction({func = AddFunction, args = {{func = AfterPastFlowerAnim, args = {}}}}) |
802 AddFunction({func = AddFunction, args = {{func = AfterPastFlowerAnim, args = {}}}}) |
802 end |
803 end |
841 function CheckOnBridge() |
842 function CheckOnBridge() |
842 return leaksDead == false and GetX(leaks) < 1651 and StoppedGear(leaks) |
843 return leaksDead == false and GetX(leaks) < 1651 and StoppedGear(leaks) |
843 end |
844 end |
844 |
845 |
845 function DoOnBridge() |
846 function DoOnBridge() |
846 TurnTimeLeft = 0 |
847 EndTurn(true) |
847 RestoreHedge(cyborg) |
848 RestoreHedge(cyborg) |
848 RestoreHedge(princess) |
849 RestoreHedge(princess) |
849 AnimWait(cyborg, 1) |
850 AnimWait(cyborg, 1) |
850 AddFunction({func = AddAnim, args = {midAnim}}) |
851 AddFunction({func = AddAnim, args = {midAnim}}) |
851 AddFunction({func = AddFunction, args = {{func = AfterMidAnimAlone, args = {}}}}) |
852 AddFunction({func = AddFunction, args = {{func = AfterMidAnimAlone, args = {}}}}) |
872 function CheckTookSniper() |
873 function CheckTookSniper() |
873 return sniperTaken and StoppedGear(leaks) |
874 return sniperTaken and StoppedGear(leaks) |
874 end |
875 end |
875 |
876 |
876 function DoTookSniper() |
877 function DoTookSniper() |
877 TurnTimeLeft = 0 |
878 EndTurn(true) |
878 RestoreHedge(cyborg) |
879 RestoreHedge(cyborg) |
879 RestoreHedge(princess) |
880 RestoreHedge(princess) |
880 AnimWait(cyborg, 1) |
881 AnimWait(cyborg, 1) |
881 AddFunction({func = AddAnim, args = {endAnim}}) |
882 AddFunction({func = AddAnim, args = {endAnim}}) |
882 AddFunction({func = AddFunction, args = {{func = AfterEndAnimAlone, args = {}}}}) |
883 AddFunction({func = AddFunction, args = {{func = AfterEndAnimAlone, args = {}}}}) |
885 function CheckTookSniper2() |
886 function CheckTookSniper2() |
886 return sniperTaken and StoppedGear(leaks) and StoppedGear(dense) |
887 return sniperTaken and StoppedGear(leaks) and StoppedGear(dense) |
887 end |
888 end |
888 |
889 |
889 function DoTookSniper2() |
890 function DoTookSniper2() |
890 TurnTimeLeft = 0 |
891 EndTurn(true) |
891 RestoreHedge(cyborg) |
892 RestoreHedge(cyborg) |
892 RestoreHedge(princess) |
893 RestoreHedge(princess) |
893 AnimWait(cyborg, 1) |
894 AnimWait(cyborg, 1) |
894 AddFunction({func = AddAnim, args = {endAnim}}) |
895 AddFunction({func = AddAnim, args = {endAnim}}) |
895 AddFunction({func = AddFunction, args = {{func = AfterEndAnimDuo, args = {}}}}) |
896 AddFunction({func = AddFunction, args = {{func = AfterEndAnimDuo, args = {}}}}) |
907 function CheckWon() |
908 function CheckWon() |
908 return cyborgDead and not princessDead |
909 return cyborgDead and not princessDead |
909 end |
910 end |
910 |
911 |
911 function DoWon() |
912 function DoWon() |
|
913 victory = true |
912 if progress and progress<3 then |
914 if progress and progress<3 then |
913 SaveCampaignVar("Progress", "3") |
915 SaveCampaignVar("Progress", "3") |
914 end |
916 end |
915 AddAnim(winAnim) |
917 AddAnim(winAnim) |
916 AddFunction({func = FinishWon, args = {}}) |
918 AddFunction({func = FinishWon, args = {}}) |
918 |
920 |
919 function FinishWon() |
921 function FinishWon() |
920 SwitchHog(leaks) |
922 SwitchHog(leaks) |
921 DismissTeam(loc("Cannibal Sentry")) |
923 DismissTeam(loc("Cannibal Sentry")) |
922 DismissTeam(loc("011101001")) |
924 DismissTeam(loc("011101001")) |
923 TurnTimeLeft = 0 |
925 EndTurn(true) |
924 end |
926 end |
925 |
927 |
926 function CheckFailedCourse() |
928 function CheckFailedCourse() |
927 return TurnsLeft == 0 |
929 return TurnsLeft == 0 |
928 end |
930 end |
929 |
931 |
930 function DoFailedCourse() |
932 function DoFailedCourse() |
931 TurnTimeLeft = 0 |
933 EndTurn(true) |
932 RestoreHedge(cyborg) |
934 RestoreHedge(cyborg) |
933 RestoreHedge(princess) |
935 RestoreHedge(princess) |
934 AnimWait(cyborg, 1) |
936 AnimWait(cyborg, 1) |
935 AddFunction({func = AddAnim, args = {failAnim}}) |
937 AddFunction({func = AddAnim, args = {failAnim}}) |
936 AddFunction({func = AddFunction, args = {{func = AfterMidFailAnim, args = {}}}}) |
938 AddFunction({func = AddFunction, args = {{func = AfterMidFailAnim, args = {}}}}) |
1005 blowTaken = true |
1007 blowTaken = true |
1006 elseif gear == fireCrate then |
1008 elseif gear == fireCrate then |
1007 fireTaken = true |
1009 fireTaken = true |
1008 elseif gear == gravityCrate then |
1010 elseif gear == gravityCrate then |
1009 gravityTaken = true |
1011 gravityTaken = true |
1010 elseif gear == leaks then |
1012 elseif gear == leaks and not victory then |
1011 leaksDead = true |
1013 leaksDead = true |
1012 elseif gear == dense then |
1014 elseif gear == dense and not victory then |
1013 denseDead = true |
1015 denseDead = true |
1014 elseif gear == cyborg then |
1016 elseif gear == cyborg then |
1015 cyborgDead = true |
1017 cyborgDead = true |
1016 elseif gear == princess then |
1018 elseif gear == princess and not victory then |
1017 princessDead = true |
1019 princessDead = true |
1018 elseif gear == girderCrate then |
1020 elseif gear == girderCrate then |
1019 girderTaken = true |
1021 girderTaken = true |
1020 elseif gear == girderCrate1 then |
1022 elseif gear == girderCrate1 then |
1021 girder1Taken = true |
1023 girder1Taken = true |
1044 SetAmmo(amDEagle, 9, 0, 0, 0) |
1046 SetAmmo(amDEagle, 9, 0, 0, 0) |
1045 SetAmmo(amRope, 0, 0, 0, 1) |
1047 SetAmmo(amRope, 0, 0, 0, 1) |
1046 SetAmmo(amSniperRifle, 0, 0, 0, 1) |
1048 SetAmmo(amSniperRifle, 0, 0, 0, 1) |
1047 SetAmmo(amDynamite, 0, 0, 0, 1) |
1049 SetAmmo(amDynamite, 0, 0, 0, 1) |
1048 SetAmmo(amPickHammer, 0, 0, 0, 1) |
1050 SetAmmo(amPickHammer, 0, 0, 0, 1) |
|
1051 SetAmmo(amTeleport, 9, 0, 0, 1) |
1049 end |
1052 end |
1050 |
1053 |
1051 function onNewTurn() |
1054 function onNewTurn() |
1052 if AnimInProgress() then |
1055 if AnimInProgress() then |
1053 TurnTimeLeft = -1 |
1056 TurnTimeLeft = -1 |
|
1057 elseif victory then |
|
1058 EndTurn(true) |
1054 elseif stage == endStage and CurrentHedgehog ~= leaks then |
1059 elseif stage == endStage and CurrentHedgehog ~= leaks then |
1055 AnimSwitchHog(leaks) |
1060 AnimSwitchHog(leaks) |
1056 SetGearMessage(leaks, 0) |
1061 SetGearMessage(leaks, 0) |
1057 TurnTimeLeft = -1 |
1062 TurnTimeLeft = -1 |
1058 elseif GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then |
1063 elseif GetHogTeamName(CurrentHedgehog) ~= loc("Natives") then |