share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/united.lua
changeset 9306 c9978ada9a3d
parent 8944 ed2509832311
child 10290 42efccba0711
equal deleted inserted replaced
9305:8e5140875ab5 9306:c9978ada9a3d
       
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     2 HedgewarsScriptLoad("/Scripts/Animate.lua")
       
     3 
       
     4 -----------------------------Constants---------------------------------
       
     5 choiceAccept = 1
       
     6 choiceRefuse = 2
       
     7 choiceAttack = 3
       
     8 
       
     9 leaksPos = {2067, 509}
       
    10 densePos = {1882, 503}
       
    11 waterPos = {3100, 930}
       
    12 buffaloPos = {2609, 494}
       
    13 chiefPos = {2538, 617}
       
    14 cannibalPos = {{2219, 1339}, {2322, 1357}, {805, 784}, {3876, 1048},
       
    15               {1101, 916}, {2854, 1408}, {1974, 486}, {1103, 961}}
       
    16 
       
    17 HogNames = {loc("Olive"), loc("Brain Stu"), loc("Brainila"), loc("Salivaslurper"),
       
    18             loc("Spleenlover"), loc("Thighlicker"), loc("NomNom"), loc("Mindy")}
       
    19 
       
    20 natives = {}
       
    21 -----------------------------Variables---------------------------------
       
    22 cannibals = {}
       
    23 cannibalDead = {}
       
    24 cannibalHidden = {}
       
    25 cratesSpawned = {}
       
    26 healthCratesSpawned = {}
       
    27 
       
    28 sdrmv = 0
       
    29 denseDead = false
       
    30 leaksDead = false
       
    31 waterDead = false
       
    32 buffaloDead = false
       
    33 chiefDead = false
       
    34 nativesDead = {}
       
    35 
       
    36 m2Choice = 0
       
    37 m2DenseDead = 0
       
    38 
       
    39 startAnim = {}
       
    40 wave2Anim = {}
       
    41 finalAnim = {}
       
    42 --------------------------Anim skip functions--------------------------
       
    43 function AfterHogDeadAnim()
       
    44   freshDead = nil
       
    45   TurnTimeLeft = TurnTime
       
    46 end
       
    47 
       
    48 function AfterStartAnim()
       
    49   local goal = loc("Defeat the cannibals!|")
       
    50   local chiefgoal = loc("Try to protect the chief! You won't lose if he dies, but it is advised that he survives.")
       
    51   TurnTimeLeft = TurnTime
       
    52   ShowMission(loc("United We Stand"), loc("Invasion"), goal .. chiefgoal, 1, 6000)
       
    53 end
       
    54 
       
    55 function SkipStartAnim()
       
    56   AnimSetGearPosition(water, 2467, 754)
       
    57   if cratesSpawned[1] ~= true then
       
    58     SpawnCrates(1)
       
    59   end
       
    60   if healthCratesSpawned[1] ~= true then
       
    61     SpawnHealthCrates(1)
       
    62   end
       
    63   if cannibalHidden[1] == true then
       
    64     RestoreWave(1)
       
    65   end
       
    66   AnimSwitchHog(leaks)
       
    67 end
       
    68 
       
    69 function SkipWave2Anim()
       
    70   if cratesSpawned[2] ~= true then
       
    71     SpawnCrates(2)
       
    72   end
       
    73   if healthCratesSpawned[2] ~= true then
       
    74     SpawnHealthCrates(2)
       
    75   end
       
    76   if cannibalHidden[5] == true then
       
    77     RestoreWave(2)
       
    78   end
       
    79   AnimSwitchHog(cannibals[5])
       
    80 end
       
    81 
       
    82 function AfterWave2Anim()
       
    83   TurnTimeLeft = 0
       
    84 end
       
    85 
       
    86 function AfterFinalAnim()
       
    87   if leaksDead == true then
       
    88     SaveCampaignVar("M4LeaksDead", "1")
       
    89   else
       
    90     SaveCampaignVar("M4LeaksDead", "0")
       
    91   end
       
    92   if chiefDead == true then
       
    93     SaveCampaignVar("M4ChiefDead", "1")
       
    94   else
       
    95     SaveCampaignVar("M4ChiefDead", "0")
       
    96   end
       
    97   if buffaloDead == true then
       
    98     SaveCampaignVar("M4BuffaloDead", "1")
       
    99   else
       
   100     SaveCampaignVar("M4BuffaloDead", "0")
       
   101   end
       
   102   if waterDead == true then
       
   103     SaveCampaignVar("M4WaterDead", "1")
       
   104   else
       
   105     SaveCampaignVar("M4WaterDead", "0")
       
   106   end
       
   107   if denseDead == true then
       
   108     SaveCampaignVar("M4DenseDead", "1")
       
   109   else
       
   110     SaveCampaignVar("M4DenseDead", "0")
       
   111   end
       
   112   if progress and progress<4 then
       
   113     SaveCampaignVar("Progress", "4")
       
   114   end
       
   115   ParseCommand("teamgone " .. loc("011101001"))
       
   116   TurnTimeLeft = 0
       
   117 end
       
   118 -----------------------------Animations--------------------------------
       
   119 function Wave2Reaction()
       
   120   local i = 1
       
   121   local gearr = nil
       
   122   while nativesDead[i] == true do
       
   123     i = i + 1
       
   124   end
       
   125   gearr = natives[i]
       
   126   if denseDead ~= true and band(GetState(dense), gstDrowning) == 0 then
       
   127     AnimInsertStepNext({func = AnimSay, args = {dense, loc("I'm so scared!"), SAY_SAY, 3000}})
       
   128     AnimInsertStepNext({func = AnimCustomFunction, args = {dense, EmitDenseClouds, {"Left"}}})
       
   129     AnimInsertStepNext({func = AnimTurn, args = {dense, "Left"}})
       
   130   end
       
   131   AnimInsertStepNext({func = AnimSay, args = {gearr, loc("There's more of them? When did they become so hungry?"), SAY_SHOUT, 8000}}) 
       
   132 end
       
   133 
       
   134 function EmitDenseClouds(dir)
       
   135   local dif
       
   136   if dir == "Left" then
       
   137     dif = 10
       
   138   else
       
   139     dif = -10
       
   140   end
       
   141   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   142   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   143   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   144   AnimInsertStepNext({func = AnimWait, args = {dense, 800}})
       
   145   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   146   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   147   AnimInsertStepNext({func = AnimWait, args = {dense, 800}})
       
   148   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false})
       
   149 end
       
   150 
       
   151 function AnimationSetup()
       
   152   table.insert(startAnim, {func = AnimWait, args = {leaks, 4000}})
       
   153   table.insert(startAnim, {func = AnimCaption, args = {leaks, loc("Back in the village, after telling the villagers about the threat..."), 5000}})
       
   154   table.insert(startAnim, {func = AnimCaption, args = {leaks, loc("Their buildings were very primitive back then, even for an uncivilised island."), 7000}})
       
   155   table.insert(startAnim, {func = AnimSay, args = {chief, loc("Young one, you are telling us that they can instantly change location without a shaman?"), SAY_SAY, 8000}})
       
   156   table.insert(startAnim, {func = AnimSay, args = {chief, loc("That is, indeed, very weird..."), SAY_SAY, 3500}})
       
   157   table.insert(startAnim, {func = AnimSay, args = {buffalo, loc("If they try coming here, they can have a taste of my delicious knuckles!"), SAY_SHOUT, 8000}})
       
   158   table.insert(startAnim, {func = AnimSay, args = {buffalo, loc("Haha!"), SAY_SHOUT, 2000}})
       
   159   if denseDead == false then
       
   160     table.insert(startAnim, {func = AnimSay, args = {dense, loc("I'm not sure about that!"), SAY_SAY, 3400}})
       
   161     table.insert(startAnim, {func = AnimSay, args = {dense, loc("They have weapons we've never seen before!"), SAY_SAY, 5000}})
       
   162     table.insert(startAnim, {func = AnimSay, args = {dense, loc("Luckily, I've managed to snatch some of them."), SAY_SAY, 5000}})
       
   163     table.insert(startAnim, {func = AnimCustomFunction, args = {dense, SpawnCrates, {1}}})
       
   164     table.insert(startAnim, {func = AnimSay, args = {dense, loc("Oops...I dropped them."), SAY_SAY, 3000}})
       
   165   else
       
   166     table.insert(startAnim, {func = AnimSay, args = {leaks, loc("I'm not sure about that!"), SAY_SAY, 3400}})
       
   167     table.insert(startAnim, {func = AnimSay, args = {leaks, loc("They have weapons we've never seen before!"), SAY_SAY, 5000}})
       
   168     table.insert(startAnim, {func = AnimCustomFunction, args = {leaks, SpawnCrates, {1}}})
       
   169     table.insert(startAnim, {func = AnimWait, args = {leaks, 1000}})
       
   170     table.insert(startAnim, {func = AnimSay, args = {leaks, loc("They keep appearing like this. It's weird!"), SAY_SAY, 5000}})
       
   171   end
       
   172   table.insert(startAnim, {func = AnimSay, args = {chief, loc("Did anyone follow you?"), SAY_SAY, 3000}})
       
   173   table.insert(startAnim, {func = AnimSay, args = {leaks, loc("No, we made sure of that!"), SAY_SAY, 3500}})
       
   174   table.insert(startAnim, {func = AnimCustomFunction, args = {leaks, SpawnHealthCrates, {1}}})
       
   175   table.insert(startAnim, {func = AnimWait, args = {leaks, 1000}})
       
   176   table.insert(startAnim, {func = AnimSay, args = {chief, loc("First aid kits?!"), SAY_SAY, 3000}})
       
   177   table.insert(startAnim, {func = AnimSay, args = {leaks, loc("I've seen this before. They just appear out of thin air."), SAY_SAY, 7000}})
       
   178   table.insert(startAnim, {func = AnimMove, args = {water, "Left", 3000, 0}})
       
   179   table.insert(startAnim, {func = AnimJump, args = {water, "long"}})
       
   180   table.insert(startAnim, {func = AnimMove, args = {water, "Left", 2655, 0}})
       
   181   table.insert(startAnim, {func = AnimTurn, args = {water, "Right"}})
       
   182   table.insert(startAnim, {func = AnimJump, args = {water, "back"}})
       
   183   table.insert(startAnim, {func = AnimJump, args = {water, "back"}})
       
   184   table.insert(startAnim, {func = AnimTurn, args = {water, "Left"}})
       
   185   table.insert(startAnim, {func = AnimMove, args = {water, "Left", 2467, 754}})
       
   186   table.insert(startAnim, {func = AnimSay, args = {water, loc("Hey guys!"), SAY_SAY, 2500}})
       
   187   table.insert(startAnim, {func = AnimSay, args = {chief, loc("..."), SAY_THINK, 1500}})
       
   188   table.insert(startAnim, {func = AnimSay, args = {chief, loc("Where have you been?"), SAY_SAY, 4000}})
       
   189   table.insert(startAnim, {func = AnimSay, args = {water, loc("Just on a walk."), SAY_SAY, 3000}})
       
   190   table.insert(startAnim, {func = AnimSay, args = {chief, loc("You have chosen the perfect moment to leave."), SAY_SAY, 6000}})
       
   191   table.insert(startAnim, {func = AnimCustomFunction, args = {chief, RestoreWave, {1}}})
       
   192   for i = 1, 4 do
       
   193     table.insert(startAnim, {func = AnimOutOfNowhere, args = {cannibals[i], unpack(cannibalPos[i])}})
       
   194   end
       
   195   table.insert(startAnim, {func = AnimWait, args = {chief, 1500}})
       
   196   table.insert(startAnim, {func = AnimSay, args = {leaks, loc("HOW DO THEY KNOW WHERE WE ARE???"), SAY_SHOUT, 5000}})
       
   197   table.insert(startAnim, {func = AnimSay, args = {chief, loc("We have to protect the village!"), SAY_SAY, 5000}})
       
   198   table.insert(startAnim, {func = AnimSwitchHog, args = {leaks}})
       
   199   AddSkipFunction(startAnim, SkipStartAnim, {})
       
   200 
       
   201   table.insert(wave2Anim, {func = AnimCustomFunction, args = {leaks, RestoreWave, {2}}, swh = false})
       
   202   for i = 5, 8 do
       
   203     table.insert(wave2Anim, {func = AnimOutOfNowhere, args = {cannibals[i], unpack(cannibalPos[i])}})
       
   204   end
       
   205   table.insert(wave2Anim, {func = AnimCustomFunction, args = {leaks, Wave2Reaction, {}}, swh = false})
       
   206   table.insert(wave2Anim, {func = AnimCustomFunction, args = {leaks, SpawnCrates, {2}}, swh = false})
       
   207   table.insert(wave2Anim, {func = AnimCustomFunction, args = {leaks, SpawnHealthCrates, {2}}, swh = false})
       
   208   table.insert(wave2Anim, {func = AnimSwitchHog, args = {cannibals[5]}})
       
   209   AddSkipFunction(wave2Anim, SkipWave2Anim, {})
       
   210 end
       
   211 
       
   212 function SetupHogDeadAnim(gear)
       
   213   hogDeadAnim = {}
       
   214   if nativesNum == 0 then
       
   215     return
       
   216   end
       
   217   local hogDeadStrings = {loc("They killed ") .. gear ..loc("! You bastards!"), 
       
   218                           gear .. loc("! Why?!"), 
       
   219                           loc("That was just mean!"), 
       
   220                           loc("Oh no, not ") .. gear .. "!"}
       
   221   table.insert(hogDeadAnim, {func = AnimSay, args = {CurrentHedgehog, hogDeadStrings[nativesNum], SAY_SHOUT, 4000}})
       
   222 end
       
   223 
       
   224 function SetupFinalAnim()
       
   225   local found = 0
       
   226   local hogs = {}
       
   227   local i = 1
       
   228   if nativesNum >= 2 then
       
   229     while found < 2 do
       
   230       if  nativesDead[i] ~= true then
       
   231         found = found + 1
       
   232         hogs[found] = natives[i]
       
   233       end
       
   234       i = i + 1
       
   235     end
       
   236     if chiefDead ~= true then
       
   237       hogs[2] = chief
       
   238     end
       
   239     table.insert(finalAnim, {func = AnimCustomFunction, args = {hogs[1], CondNeedToTurn, {hogs[1], hogs[2]}}})
       
   240     table.insert(finalAnim, {func = AnimSay, args = {hogs[1], loc("We can't hold them up much longer!"), SAY_SAY, 5000}})
       
   241     table.insert(finalAnim, {func = AnimSay, args = {hogs[1], loc("We need to move!"), SAY_SAY, 3000}})
       
   242     table.insert(finalAnim, {func = AnimSay, args = {hogs[2], loc("But where can we go?"), SAY_SAY, 3000}})
       
   243     table.insert(finalAnim, {func = AnimSay, args = {hogs[1], loc("To the caves..."), SAY_SAY, 2500}})
       
   244     table.insert(finalAnim, {func = AnimSay, args = {hogs[2], loc("Good idea, they'll never find us there!"), SAY_SAY, 5000}})
       
   245   else
       
   246     for i = 1, 5 do
       
   247       if nativesDead[i] ~= true then
       
   248         hogs[1] = natives[i]
       
   249       end
       
   250     end
       
   251     table.insert(finalAnim, {func = AnimSay, args = {hogs[1], loc("I need to move the tribe!"), SAY_THINK, 4000}})
       
   252     table.insert(finalAnim, {func = AnimSay, args = {hogs[1], loc("The caves are well hidden, they won't find us there!"), SAY_THINK, 7000}})
       
   253   end
       
   254 end
       
   255 -----------------------------Misc--------------------------------------
       
   256 function RestoreWave(index)
       
   257   for i = (index - 1) * 4 + 1, index * 4 do
       
   258     RestoreHog(cannibals[i])
       
   259     cannibalHidden[i] = false
       
   260   end
       
   261 end
       
   262 
       
   263 function GetVariables()
       
   264   m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
       
   265   if m2DenseDead == 1 then
       
   266     denseDead = true
       
   267   end
       
   268   m2Choice = tonumber(GetCampaignVar("M2Choice"))
       
   269 end
       
   270 
       
   271 function SetupPlace()
       
   272   if m2DenseDead == 1 then
       
   273     sdrmv = 1
       
   274     DeleteGear(dense)
       
   275   end
       
   276   for i = 1, 8 do
       
   277     HideHog(cannibals[i])
       
   278     cannibalHidden[i] = true
       
   279   end
       
   280   HideHog(cyborg)
       
   281 end
       
   282 
       
   283 function SetupEvents()
       
   284   AddEvent(CheckWaveDead, {1}, DoWaveDead, {1}, 0)
       
   285   AddEvent(CheckWaveDead, {2}, DoWaveDead, {2}, 0)
       
   286 end
       
   287 
       
   288 function SetupAmmo()
       
   289   AddAmmo(cannibals[1], amGrenade, 4)
       
   290   AddAmmo(cannibals[1], amBazooka, 4)
       
   291   AddAmmo(cannibals[1], amShotgun, 4)
       
   292   AddAmmo(cannibals[1], amMine, 2)
       
   293   AddAmmo(cannibals[5], amGrenade, 4)
       
   294   AddAmmo(cannibals[5], amBazooka, 4)
       
   295   AddAmmo(cannibals[5], amShotgun, 4)
       
   296   AddAmmo(cannibals[5], amMine, 2)
       
   297   AddAmmo(cannibals[5], amMolotov, 2)
       
   298   AddAmmo(cannibals[5], amFlamethrower, 3)
       
   299 end
       
   300 
       
   301 function AddHogs()
       
   302 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
       
   303 	leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
       
   304   dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
       
   305   water = AddHog(loc("Fiery Water"), 0, 100, "pirate_jack")
       
   306   buffalo = AddHog(loc("Raging Buffalo"), 0, 100, "zoo_Bunny")
       
   307   chief = AddHog(loc("Righteous Beard"), 0, 100, "IndianChief")
       
   308   natives = {leaks, dense, water, buffalo, chief}
       
   309   nativesNum = 5
       
   310 
       
   311   AddTeam(loc("Light Cannfantry"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
       
   312   for i = 1, 4 do
       
   313     cannibals[i] = AddHog(HogNames[i], 2, 40, "Zombi")
       
   314   end
       
   315 
       
   316   AddTeam(loc("Heavy Cannfantry"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
       
   317   for i = 5, 8 do
       
   318     cannibals[i] = AddHog(HogNames[i], 2, 55, "vampirichog")
       
   319   end
       
   320 
       
   321   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
       
   322   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
       
   323 
       
   324   AnimSetGearPosition(leaks,   unpack(leaksPos))
       
   325   AnimSetGearPosition(dense,   unpack(densePos))
       
   326   AnimSetGearPosition(water,   unpack(waterPos))
       
   327   HogTurnLeft(water, true)
       
   328   AnimSetGearPosition(buffalo, unpack(buffaloPos))
       
   329   HogTurnLeft(buffalo, true)
       
   330   AnimSetGearPosition(chief,   unpack(chiefPos))
       
   331   HogTurnLeft(chief, true)
       
   332   AnimSetGearPosition(cyborg, 0, 0)
       
   333   for i = 1, 8 do
       
   334     AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
       
   335   end
       
   336 end
       
   337 
       
   338 function CondNeedToTurn(hog1, hog2)
       
   339   xl, xd = GetX(hog1), GetX(hog2)
       
   340   if xl > xd then
       
   341     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
       
   342     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
       
   343   elseif xl < xd then
       
   344     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
       
   345     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}})
       
   346   end
       
   347 end
       
   348 
       
   349 function SpawnHealthCrates(index)
       
   350   SetHealth(SpawnHealthCrate(0, 0), 25)
       
   351   SetHealth(SpawnHealthCrate(0, 0), 25)
       
   352   SetHealth(SpawnHealthCrate(0, 0), 25)
       
   353   healthCratesSpawned[index] = true
       
   354 end
       
   355 
       
   356 function SpawnCrates(index)
       
   357   if index == 1 then
       
   358     SpawnAmmoCrate(1943, 408, amBazooka)
       
   359     SpawnAmmoCrate(1981, 464, amGrenade)
       
   360     SpawnAmmoCrate(1957, 459, amShotgun)
       
   361     SpawnAmmoCrate(1902, 450, amDynamite)
       
   362     SpawnUtilityCrate(1982, 405, amPickHammer)
       
   363     SpawnUtilityCrate(2028, 455, amRope)
       
   364     SpawnUtilityCrate(2025, 464, amTeleport)
       
   365   else
       
   366     SpawnUtilityCrate(1982, 405, amBlowTorch)
       
   367     SpawnAmmoCrate(2171, 428, amMolotov)
       
   368     SpawnAmmoCrate(2364, 346, amFlamethrower)
       
   369     SpawnAmmoCrate(2521, 303, amBazooka)
       
   370     SpawnAmmoCrate(2223, 967, amGrenade)
       
   371     SpawnAmmoCrate(1437, 371, amShotgun)
       
   372  end
       
   373   cratesSpawned[index] = true
       
   374 end
       
   375 
       
   376 -----------------------------Events------------------------------------
       
   377 
       
   378 function CheckWaveDead(index)
       
   379   for i = (index - 1) * 4 + 1, index * 4 do
       
   380     if cannibalDead[i] ~= true then
       
   381       return false
       
   382     end
       
   383   end
       
   384   return true
       
   385 end
       
   386 
       
   387 function DoWaveDead(index)
       
   388   SetGearMessage(CurrentHedgehog, 0)
       
   389   SetState(CurrentHedgehog, 0)
       
   390   if index == 1 then
       
   391     AddAnim(wave2Anim)
       
   392     AddFunction({func = AfterWave2Anim, args = {}})
       
   393   elseif index == 2 then
       
   394     SetupFinalAnim()
       
   395     AddAnim(finalAnim)
       
   396     AddFunction({func = AfterFinalAnim, args = {}})
       
   397   end
       
   398 end
       
   399 
       
   400 
       
   401 -----------------------------Main Functions----------------------------
       
   402 
       
   403 function onGameInit()
       
   404 	Seed = 1
       
   405 	GameFlags = 0
       
   406 	TurnTime = 60000 
       
   407 	CaseFreq = 0
       
   408 	MinesNum = 0
       
   409 	MinesTime = 3000
       
   410 	Explosives = 2
       
   411 	Delay = 10 
       
   412   Map = "Hogville"
       
   413 	Theme = "Nature"
       
   414   SuddenDeathTurns = 3000
       
   415 
       
   416   AddHogs()
       
   417   AnimInit()
       
   418 end
       
   419 
       
   420 function onGameStart()
       
   421   progress = tonumber(GetCampaignVar("Progress"))
       
   422   GetVariables()
       
   423   SetupAmmo()
       
   424   SetupPlace()
       
   425   AnimationSetup()
       
   426   SetupEvents()
       
   427   AddAnim(startAnim)
       
   428   AddFunction({func = AfterStartAnim, args = {}})
       
   429 end
       
   430 
       
   431 function onGameTick()
       
   432   AnimUnWait()
       
   433   if ShowAnimation() == false then
       
   434     return
       
   435   end
       
   436   ExecuteAfterAnimations()
       
   437   CheckEvents()
       
   438 end
       
   439 
       
   440 function onGearDelete(gear)
       
   441   if gear == dense then
       
   442     denseDead = true
       
   443     nativesNum = nativesNum - 1
       
   444     nativesDead[2] = true
       
   445     if sdrmv == 1 then
       
   446       freshDead = nil
       
   447     else
       
   448       freshDead = loc("Dense Cloud")
       
   449     end
       
   450   elseif gear == leaks then
       
   451     leaksDead = true
       
   452     nativesNum = nativesNum - 1
       
   453     nativesDead[1] = true
       
   454     freshDead = loc("Leaks A Lot")
       
   455   elseif gear == chief then
       
   456     chiefDead = true
       
   457     nativesNum = nativesNum - 1
       
   458     nativesDead[5] = true
       
   459     freshDead = loc("Righteous Beard")
       
   460   elseif gear == water then
       
   461     waterDead = true
       
   462     nativesNum = nativesNum - 1
       
   463     nativesDead[3] = true
       
   464     freshDead = loc("Fiery Water")
       
   465   elseif gear == buffalo then
       
   466     buffaloDead = true
       
   467     nativesNum = nativesNum - 1
       
   468     nativesDead[4] = true
       
   469     freshDead = loc("Raging Buffalo")
       
   470   else
       
   471     for i = 1, 8 do
       
   472       if gear == cannibals[i] then
       
   473         cannibalDead[i] = true
       
   474       end
       
   475     end
       
   476   end
       
   477 end
       
   478 
       
   479 function onAmmoStoreInit()
       
   480   SetAmmo(amDEagle, 9, 0, 0, 0)
       
   481   SetAmmo(amSniperRifle, 4, 0, 0, 0)
       
   482   SetAmmo(amFirePunch, 9, 0, 0, 0)
       
   483   SetAmmo(amWhip, 9, 0, 0, 0)
       
   484   SetAmmo(amBaseballBat, 9, 0, 0, 0)
       
   485   SetAmmo(amHammer, 9, 0, 0, 0)
       
   486   SetAmmo(amLandGun, 9, 0, 0, 0)
       
   487   SetAmmo(amSnowball, 8, 0, 0, 0)
       
   488   SetAmmo(amGirder, 4, 0, 0, 2)
       
   489   SetAmmo(amParachute, 4, 0, 0, 2)
       
   490   SetAmmo(amSwitch, 8, 0, 0, 2)
       
   491   SetAmmo(amSkip, 8, 0, 0, 0)
       
   492   SetAmmo(amRope, 5, 0, 0, 3)
       
   493   SetAmmo(amBlowTorch, 3, 0, 0, 3)
       
   494   SetAmmo(amPickHammer, 0, 0, 0, 3)
       
   495   SetAmmo(amLowGravity, 0, 0, 0, 2)
       
   496   SetAmmo(amDynamite, 0, 0, 0, 3)
       
   497   SetAmmo(amBazooka, 0, 0, 0, 4)
       
   498   SetAmmo(amGrenade, 0, 0, 0, 5)
       
   499   SetAmmo(amMine, 0, 0, 0, 2)
       
   500   SetAmmo(amMolotov, 0, 0, 0, 3)
       
   501   SetAmmo(amFlamethrower, 0, 0, 0, 3)
       
   502   SetAmmo(amShotgun, 0, 0, 0, 3)
       
   503   SetAmmo(amTeleport, 0, 0, 0, 2)
       
   504   SetAmmo(amFlamethrower, 0, 0, 0, 3)
       
   505 end
       
   506 
       
   507 function onNewTurn()
       
   508   if AnimInProgress() then
       
   509     TurnTimeLeft = -1
       
   510     return
       
   511   end
       
   512   if freshDead ~= nil and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
       
   513     SetupHogDeadAnim(freshDead)
       
   514     AddAnim(hogDeadAnim)
       
   515     AddFunction({func = AfterHogDeadAnim, args = {}})
       
   516   end
       
   517 end
       
   518 
       
   519 function onPrecise()
       
   520   if GameTime > 2500 then
       
   521     SetAnimSkip(true)
       
   522   end
       
   523 end
       
   524