share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua
changeset 7413 dbf6e803d5bc
child 7415 1a6a6db3fa96
equal deleted inserted replaced
7411:efc75c2d3be9 7413:dbf6e803d5bc
       
     1 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     2 loadfile(GetDataPath() .. "Scripts/Animate.lua")()
       
     3 
       
     4 -----------------------------Map--------------------------------------
       
     5 local map = 
       
     6 {
       
     7 	"\0\91\4\253\131\0\88\0\46\0\0\91\0\49\131\15\196\0\53\0\15\196\0\53\131\15\196\4\250\0\255\242\7\179\131\1\128\7\214\0",
       
     8 	"\1\113\7\207\131\3\182\7\157\0\3\175\7\143\131\6\58\7\200\0\6\76\7\193\131\6\188\7\129\0\6\188\7\129\131\6\248\6\216\0",
       
     9 	"\6\248\6\216\131\7\52\8\14\0\10\206\8\0\131\11\203\6\65\0\11\203\6\65\131\12\18\7\66\0\12\18\7\69\131\16\0\7\69\0",
       
    10 	"\0\109\1\1\131\2\111\0\49\0\2\111\0\49\131\3\133\1\18\0\3\140\1\18\131\4\162\0\165\0\4\162\0\165\131\5\135\1\29\0",
       
    11 	"\5\145\1\22\131\8\84\0\232\0\8\84\0\232\131\9\26\0\70\0\9\26\0\70\131\10\5\1\4\0\10\48\0\243\131\10\2\1\8\0",
       
    12 	"\10\58\0\243\131\10\118\1\15\0\10\118\1\15\131\10\234\1\173\0\11\10\1\177\131\12\11\1\22\0\12\39\1\40\131\12\243\2\9\0",
       
    13 	"\12\243\2\9\131\13\106\0\165\0\13\131\0\176\131\15\186\1\78\0\1\244\0\81\136\0\120\0\84\0\1\99\0\123\137\0\130\0\215\0",
       
    14 	"\0\158\0\130\143\0\158\0\130\0\2\216\0\88\138\4\165\0\102\0\4\91\0\127\142\3\129\0\197\0\3\69\0\134\142\3\69\0\134\0",
       
    15 	"\4\215\0\120\143\8\88\0\134\0\8\187\0\84\139\8\187\0\84\0\8\239\0\70\135\8\239\0\70\0\8\60\0\187\138\5\99\0\222\0",
       
    16 	"\5\61\0\197\138\5\61\0\197\0\9\99\0\81\137\10\23\0\218\0\9\187\0\77\137\11\31\1\117\0\10\30\0\88\137\15\161\0\109\0",
       
    17 	"\15\126\0\225\144\13\177\0\116\0\15\150\0\144\139\15\157\1\26\0\10\202\0\169\152\12\246\0\169\0\10\72\0\144\145\11\122\1\36\0",
       
    18 	"\11\17\1\121\141\11\17\1\121\0\12\229\1\194\138\12\229\1\194\0\12\208\1\85\150\12\208\1\85\0\12\148\1\15\147\12\148\1\15\0",
       
    19 	"\13\145\0\208\147\13\145\0\208\0\6\238\7\45\135\7\10\7\238\0\6\220\7\150\135\6\206\7\242\0\6\174\7\175\135\6\135\8\7\0",
       
    20 	"\6\118\7\214\135\6\62\7\238\0\6\30\7\245\140\3\217\7\210\0\3\161\7\221\138\255\252\7\231\0\15\242\7\165\148\11\115\7\175\0",
       
    21 	"\11\196\6\164\138\11\10\8\4\0\11\210\7\31\141\11\210\7\31\0\14\216\2\72\166\14\216\2\72\0\14\213\4\4\166\14\213\4\4\0",
       
    22 	"\13\216\1\159\148\13\216\1\159\0\13\159\2\143\148\13\159\2\143\0\13\230\3\69\145\13\230\3\69\0\13\163\4\11\145\13\166\4\11\0",
       
    23 	"\13\237\4\208\145\13\237\4\208\0\14\195\5\61\145\14\195\5\61\0\13\78\1\254\136\13\78\1\254\0\12\239\2\93\136\12\239\2\93\0",
       
    24 	"\12\250\2\227\136\12\250\2\227\0\13\71\3\59\136\13\71\3\59\0\13\1\3\168\136\13\1\3\168\0\12\243\4\32\136\12\246\4\32\0",
       
    25 	"\13\40\4\130\136\13\43\4\134\0\13\92\4\243\136\13\92\4\243\0\13\142\5\135\136\13\142\5\135\0\14\33\5\106\136\14\33\5\106\0",
       
    26 	"\14\111\5\208\136\14\121\5\216\0\15\13\5\237\136\15\13\5\237\0\15\73\5\128\136\15\73\5\128\0\15\84\4\243\136\15\84\4\243\0",
       
    27 	"\14\199\6\33\133\14\199\6\33\0\14\97\6\44\133\14\83\6\44\0\14\9\5\240\133\14\9\5\240\0\13\226\5\163\133\13\226\5\163\0",
       
    28 	"\13\170\5\233\133\13\170\5\233\0\13\71\5\205\133\13\71\5\205\0\13\61\5\117\133\13\61\5\117\0\13\22\5\40\133\13\22\5\40\0",
       
    29 	"\12\253\4\211\133\12\253\4\211\0\12\197\4\169\133\12\197\4\169\0\12\204\4\106\133\12\204\4\106\0\12\162\4\46\133\12\162\4\42\0",
       
    30 	"\12\194\3\200\133\12\194\3\196\0\12\201\3\84\133\12\201\3\84\0\12\253\3\62\133\12\253\3\62\0\12\169\2\241\133\12\169\2\241\0",
       
    31 	"\12\187\2\167\133\12\187\2\167\0\12\158\2\93\133\12\158\2\93\0\12\162\2\9\133\12\162\2\9\0\12\123\1\205\132\12\123\1\205\0",
       
    32 	"\12\84\1\251\132\12\84\1\251\0\12\91\2\55\132\12\95\2\55\0\12\63\2\139\132\12\63\2\139\0\12\120\2\164\132\12\120\2\164\0",
       
    33 	"\12\81\2\206\132\12\81\2\206\0\12\106\3\17\132\12\109\3\20\0\12\137\3\73\132\12\137\3\73\0\12\84\3\122\132\12\84\3\122\0",
       
    34 	"\12\137\3\150\132\12\137\3\150\0\12\95\3\217\132\12\95\3\217\0\12\134\3\231\132\12\134\3\231\0\12\106\4\63\132\12\106\4\63\0",
       
    35 	"\12\137\4\120\132\12\141\4\120\0\12\88\4\179\132\12\88\4\183\0\12\134\4\190\132\12\134\4\190\0\12\158\4\232\132\12\165\4\232\0",
       
    36 	"\12\215\5\15\132\12\215\5\15\0\12\91\4\243\130\12\91\4\243\0\12\144\5\26\130\12\144\5\26\0\12\176\5\54\130\12\176\5\54\0",
       
    37 	"\12\225\5\82\130\12\225\5\82\0\13\4\5\117\130\13\1\5\117\0\12\239\5\166\130\12\239\5\166\0\13\8\5\184\130\13\11\5\184\0",
       
    38 	"\13\8\5\226\130\13\8\5\226\0\13\54\6\12\130\13\57\6\12\0\13\106\6\2\130\13\106\5\254\0\13\138\6\12\130\13\138\6\12\0",
       
    39 	"\13\184\6\30\130\13\187\6\30\0\13\223\5\254\130\13\223\5\254\0\13\149\6\69\130\13\145\6\69\0\13\128\6\33\130\13\128\6\33\0",
       
    40 	"\13\85\6\40\130\13\85\6\40\0\12\232\6\2\130\12\232\6\2\0\12\204\5\205\130\12\204\5\201\0\12\183\5\159\130\12\183\5\156\0",
       
    41 	"\12\211\5\128\130\12\211\5\128\0\12\165\5\103\130\12\165\5\103\0\12\123\5\64\130\12\120\5\64\0\12\81\5\71\130\12\81\5\71\0",
       
    42 	"\12\84\5\18\130\12\84\5\18\0\12\39\4\243\130\12\39\4\243\0\12\35\4\194\130\12\35\4\194\0\12\63\4\127\130\12\63\4\127\0",
       
    43 	"\12\91\4\106\130\12\91\4\106\0\12\53\4\60\130\12\53\4\60\0\12\74\4\25\130\12\84\4\21\0\12\120\4\4\130\12\120\4\4\0",
       
    44 	"\12\42\3\231\130\12\42\3\231\0\12\39\3\189\130\12\42\3\186\0\12\60\3\175\130\12\60\3\175\0\12\39\3\133\130\12\39\3\133\0",
       
    45 	"\12\70\3\73\130\12\70\3\73\0\12\25\3\77\130\12\25\3\77\0\12\42\3\13\130\12\46\3\13\0\12\81\3\31\130\12\81\3\31\0",
       
    46 	"\12\32\2\213\130\12\32\2\213\0\12\14\2\178\130\12\14\2\178\0\12\42\2\181\130\12\46\2\181\0\12\14\2\128\130\12\14\2\128\0",
       
    47 	"\12\39\2\100\130\12\42\2\100\0\12\74\2\104\130\12\77\2\104\0\12\106\2\135\130\12\109\2\135\0\12\39\2\72\130\12\39\2\69\0",
       
    48 	"\12\35\2\37\130\12\35\2\37\0\12\32\2\2\130\12\32\2\2\0\12\28\1\226\130\12\28\1\223\0\12\63\1\208\130\12\63\1\208\0",
       
    49 	"\12\84\1\173\130\12\84\1\170\0\12\63\1\159\130\12\60\1\159\0\12\39\1\113\130\12\39\1\113\0\12\14\1\96\130\12\11\1\96\0",
       
    50 	"\11\228\1\131\130\11\228\1\135\0\12\7\1\149\130\12\7\1\149\0\12\21\1\177\130\12\25\1\177\0\11\242\1\201\130\11\242\1\201\0",
       
    51 	"\13\226\6\58\130\13\226\6\58\0\14\16\6\40\130\14\16\6\40\0\13\208\6\86\130\13\208\6\86\0\13\247\6\111\130\13\247\6\114\0",
       
    52 	"\13\184\6\121\130\13\184\6\121\0\13\198\6\146\130\13\201\6\146\0\13\244\6\139\130\13\244\6\139\0\13\223\6\185\130\13\223\6\185\0",
       
    53 	"\13\173\6\199\130\13\173\6\199\0\13\159\6\171\130\13\159\6\171\0\13\138\6\220\130\13\138\6\220\0\13\184\6\238\130\13\184\6\238\0",
       
    54 	"\13\208\6\223\130\13\208\6\223\0\13\216\7\10\130\13\216\7\10\0\13\184\7\10\130\13\180\7\10\0\13\142\7\38\130\13\142\7\41\0",
       
    55 	"\13\128\7\6\130\13\128\7\6\0\13\85\7\34\130\13\89\7\34\0\13\89\7\3\130\13\89\7\3\0\13\117\6\220\130\13\121\6\220\0",
       
    56 	"\13\75\6\195\130\13\75\6\195\0\13\110\6\164\130\13\110\6\164\0\13\156\6\125\130\13\156\6\125\0\13\106\6\135\130\13\106\6\135\0",
       
    57 	"\13\103\6\100\130\13\103\6\100\0\13\64\6\143\130\13\64\6\143\0\13\47\6\104\130\13\47\6\104\0\13\71\6\79\130\13\71\6\79\0",
       
    58 	"\13\40\6\65\130\13\36\6\65\0\13\8\6\44\130\13\1\6\44\0\13\8\6\76\130\13\8\6\76\0\13\1\6\132\130\13\1\6\132\0",
       
    59 	"\13\33\6\135\130\13\33\6\135\0\13\26\6\178\130\13\22\6\178\0\13\47\6\202\130\13\50\6\202\0\13\54\6\245\130\13\54\6\245\0",
       
    60 	"\13\22\7\3\130\13\22\7\3\0\13\43\7\27\130\13\43\7\27\0\12\253\6\248\130\12\250\6\248\0\12\253\6\220\130\12\253\6\220\0",
       
    61 	"\12\215\6\174\130\12\225\6\174\0\12\253\6\174\130\12\253\6\174\0\12\215\6\121\130\12\215\6\121\0\12\229\6\76\130\12\229\6\76\0",
       
    62 	"\12\201\6\51\130\12\201\6\51\0\12\190\6\19\130\12\190\6\19\0\12\151\5\223\130\12\151\5\223\0\12\148\5\194\130\12\151\5\194\0",
       
    63 	"\12\155\5\159\130\12\155\5\156\0\12\144\5\121\130\12\144\5\121\0\12\95\5\110\130\12\95\5\110\0\12\102\5\156\130\12\102\5\159\0",
       
    64 	"\12\99\5\216\130\12\106\5\219\0\12\148\6\40\130\12\148\6\40\0\12\127\6\19\130\12\127\6\19\0\12\176\6\104\130\12\176\6\104\0",
       
    65 	"\12\141\6\72\130\12\141\6\72\0\12\162\6\139\130\12\162\6\143\0\12\172\6\181\130\12\172\6\181\0\12\204\6\216\130\12\208\6\216\0",
       
    66 	"\12\201\7\3\130\12\201\7\3\0\12\236\7\24\130\12\236\7\24\0\12\120\6\146\130\12\120\6\146\0\12\123\6\104\130\12\123\6\104\0",
       
    67 	"\12\123\6\185\130\12\123\6\185\0\12\162\6\227\130\12\162\6\227\0\12\134\6\241\130\12\134\6\241\0\12\155\7\10\130\12\155\7\10\0",
       
    68 	"\12\190\7\41\130\12\190\7\41\0\11\228\1\96\129\11\228\1\96\0\11\200\1\121\129\11\200\1\121\0\11\193\1\156\129\11\196\1\156\0",
       
    69 	"\11\221\1\170\129\11\221\1\170\0\11\217\1\208\129\11\217\1\208\0\11\245\1\230\129\11\245\1\230\0\11\245\2\16\129\11\245\2\16\0",
       
    70 	"\12\14\2\62\129\12\18\2\62\0\11\242\2\93\129\11\242\2\93\0\11\235\2\178\129\11\235\2\178\0\11\231\2\238\129\11\235\2\238\0",
       
    71 	"\12\4\2\252\129\12\4\2\252\0\11\252\3\34\129\11\252\3\34\0\11\235\3\87\129\11\238\3\87\0\12\11\3\119\129\12\11\3\119\0",
       
    72 	"\12\4\3\168\129\12\4\3\168\0\11\245\3\200\129\11\245\3\200\0\11\252\3\238\129\11\252\3\242\0\12\11\4\7\129\12\11\4\7\0",
       
    73 	"\11\245\4\60\129\11\238\4\60\0\11\224\4\74\129\11\221\4\74\0\11\210\4\137\129\11\210\4\137\0\11\228\4\151\129\11\231\4\151\0",
       
    74 	"\11\242\4\130\129\11\242\4\130\0\12\4\4\113\129\12\7\4\113\0\12\28\4\102\129\12\28\4\102\0\12\11\4\141\129\12\11\4\141\0",
       
    75 	"\11\249\4\162\129\11\249\4\162\0\11\221\4\116\129\11\221\4\116\0\11\214\4\106\129\11\217\4\102\0\12\4\4\211\129\12\4\4\211\0",
       
    76 	"\11\249\5\8\129\11\252\5\8\0\12\39\5\11\129\12\42\5\11\0\12\56\5\50\129\12\60\5\47\0\12\46\5\96\129\12\49\5\96\0",
       
    77 	"\12\70\5\113\129\12\70\5\113\0\12\56\5\166\129\12\63\5\166\0\12\70\5\145\129\12\74\5\145\0\12\70\5\194\129\12\77\5\194\0",
       
    78 	"\12\70\5\237\129\12\74\5\237\0\12\106\5\240\129\12\109\5\240\0\12\99\6\33\129\12\99\6\33\0\12\88\6\72\129\12\88\6\72\0",
       
    79 	"\12\91\6\107\129\12\95\6\107\0\12\77\6\146\129\12\81\6\146\0\12\88\6\181\129\12\91\6\181\0\12\91\6\220\129\12\99\6\220\0",
       
    80 	"\12\113\7\10\129\12\116\7\10\0\8\116\4\18\179\8\116\4\18\0\9\205\3\73\156\9\205\3\73\0\10\83\2\146\144\10\83\2\146\0",
       
    81 	"\10\153\2\44\136\10\153\2\44\0\10\181\1\240\132\10\181\1\240\0\10\199\1\205\131\10\199\1\205\0\10\209\1\184\129\10\209\1\184\0",
       
    82 	"\8\42\2\167\150\8\42\2\167\0\8\53\1\240\141\8\53\1\237\0\8\67\1\135\134\8\67\1\135\0\11\224\5\8\129\11\224\5\8\0",
       
    83 	"\11\200\5\8\129\11\200\5\8\0\11\182\5\8\129\11\182\5\8\0\11\154\5\4\129\11\154\5\4\0\11\129\5\8\129\11\129\5\8\0",
       
    84 	"\11\119\3\84\129\11\119\3\84\0\11\140\3\87\129\11\140\3\87\0\11\165\3\87\129\11\165\3\87\0\11\182\3\87\129\11\182\3\87\0",
       
    85 	"\11\203\3\87\129\11\203\3\87\0\9\33\6\223\132\9\33\8\11\0\9\33\6\188\129\9\33\6\188\0\0\123\1\26\136\0\211\2\223\0",
       
    86 	"\0\211\2\223\136\0\120\3\84\0\0\130\3\101\136\0\211\4\53\0\0\204\4\53\136\0\120\4\151\0\0\130\3\193\136\0\127\4\63\0",
       
    87 	"\0\130\3\31\136\0\130\1\201\0\0\91\4\253\130\0\91\6\76\0\7\94\3\136\138\7\94\3\136\0\7\24\3\77\135\7\24\3\77\0",
       
    88 	"\6\238\3\24\132\6\241\3\24\0\6\223\2\238\131\6\223\2\238\0\6\220\2\209\129\6\220\2\209\0\7\87\4\14\133\7\87\4\14\0",
       
    89 	"\7\38\4\0\131\7\38\4\0\0\7\6\3\242\130\7\6\3\242\0\6\241\3\228\129\6\241\3\228\0\6\227\3\217\128\6\227\3\217\0",
       
    90 	"\0\109\4\197\135\0\162\5\99\0\0\144\5\121\135\0\123\6\9\0\0\127\5\92\135\0\127\5\92\0\0\127\5\54\135\0\127\5\54\0",
       
    91 	"\0\134\6\23\132\0\236\6\97\0\0\236\6\97\132\1\106\6\135\0\1\117\6\135\132\1\177\6\143\0\2\234\7\80\130\3\69\7\80\0",
       
    92 	"\3\69\7\80\130\3\84\7\101\0\3\84\7\101\130\3\87\7\129\0\3\87\7\129\130\3\84\7\150\0\0\183\5\103\130\1\92\5\159\0",
       
    93 	"\1\11\5\138\130\0\253\5\180\0\0\253\5\180\130\0\158\5\166\0\0\239\4\60\131\1\166\4\95\0\2\104\3\133\131\3\84\3\129\0",
       
    94 	"\4\162\2\181\131\4\162\3\147\0\3\115\2\26\131\4\74\2\30\0\2\23\1\54\131\2\230\1\54\0\0\204\2\5\131\1\194\2\5\0",
       
    95 	"\4\74\2\33\131\5\226\1\223\0\0\225\5\121\197\1\135\5\163\0\0\204\5\173\197\1\1\5\173\0\0\179\5\152\131\1\57\5\163\0",
       
    96 	"\1\57\5\159\131\1\106\5\219\0\0\165\5\226\130\0\253\5\230\0\0\253\5\230\130\1\8\5\159\0\1\254\6\86\131\1\254\6\86\0",
       
    97 	"\1\254\6\33\131\1\254\6\33\0\1\254\5\230\131\1\254\5\230\0\1\254\5\170\131\1\254\5\170\0\1\254\5\113\131\1\254\5\113\0",
       
    98 	"\1\251\6\5\129\1\251\6\5\0\1\254\5\201\129\1\254\5\201\0\1\254\5\138\129\1\254\5\138\0\1\254\6\58\129\1\254\6\58\0",
       
    99 	"\1\254\5\78\129\1\254\5\78\0\2\2\5\40\131\2\2\5\40\0\2\2\4\246\131\2\2\4\246\0\1\237\4\204\131\1\237\4\204\0",
       
   100 	"\2\40\4\190\131\2\40\4\190\0\6\160\7\52\223\7\27\7\126\0\1\219\4\172\204\1\219\4\172\0\2\37\4\183\197\2\37\4\183\0",
       
   101 	"\3\98\3\122\131\3\126\3\84\0\3\126\3\84\131\3\126\3\52\0\3\126\3\41\131\3\80\3\24\0\3\80\3\24\131\3\112\2\248\0",
       
   102 	"\3\112\2\248\131\3\98\2\188\0",
       
   103 }
       
   104 
       
   105 
       
   106 -----------------------------Constants---------------------------------
       
   107 choiceAccepted = 1
       
   108 choiceRefused = 2
       
   109 choiceAttacked = 3
       
   110 
       
   111 choiceEliminate = 1
       
   112 choiceSpare = 2
       
   113 
       
   114 leaksNum = 1
       
   115 denseNum = 2
       
   116 waterNum = 3
       
   117 buffaloNum = 4
       
   118 chiefNum = 5
       
   119 princessNum = 6
       
   120 wiseNum = 7
       
   121 
       
   122 nativeNames = {loc("Leaks A Lot"), loc("Dense Cloud"), loc("Fiery Water"), 
       
   123                loc("Raging Buffalo"), loc("Righteous Beard"), loc("Fell From Heaven"),
       
   124                loc("Wise Oak")}
       
   125 
       
   126 nativeUnNames = {loc("Zork"), loc("Steve"), loc("Jack"),
       
   127                  loc("Lee"), loc("Elmo"), loc("Rachel"),
       
   128                  loc("Muriel")}
       
   129 
       
   130 nativeHats = {"Rambo", "RobinHood", "pirate_jack", "zoo_Bunny", "IndianChief",
       
   131               "tiara", "AkuAku"}
       
   132 
       
   133 nativePos = {257, 1950}
       
   134 
       
   135 cyborgNames = {"Syntax Errol", "Segmentation Paul", "Unexpected Igor", "Jeremiah"}
       
   136 cyborgPos = {745, 1847}
       
   137 cyborgsPos = {{2937, 831}, {2945, 1264}, {2335, 1701}, {448, 484}}
       
   138 cyborgsDir = {"Left", "Left", "Left", "Right"}
       
   139 
       
   140 cratePos = {
       
   141             {788, 1919, amGirder, 2}, {412, 1615, amGirder, 1},
       
   142             {209, 1474, amSniperRifle, 1}, {1178, 637, amDEagle, 1},
       
   143             {633, 268, amDEagle, 1}, {3016, 1545, amDEagle, 1},
       
   144             {249, 1377, amRope, 2}, {330, 1018, amGirder, 1},
       
   145             {888, 647, amRope, 2}, {2116, 337, amRope, 2},
       
   146             {1779, 948, amRope, 2}, {3090, 1066, amRope, 2},
       
   147             {947, 480, amBazooka, 3}, {1097, 480, amMortar, 3},
       
   148             {1139, 451, amSnowball, 3}, {1207, 468, amShotgun, 3},
       
   149             {1024, 393, amSniperRifle, 2}, {998, 391, amDynamite, 2}
       
   150            }
       
   151 reactions = {"Yeah, take that!", "Bullseye", "Die, die, die!"}
       
   152 
       
   153 secondPos = {{1010, 510}, {1067, 510}}
       
   154 -----------------------------Variables---------------------------------
       
   155 natives = {}
       
   156 native = nil
       
   157 
       
   158 cyborgs = {}
       
   159 cyborg = {}
       
   160 cyborgsLeft = 0
       
   161 
       
   162 gearDead = {}
       
   163 hedgeHidden = {}
       
   164 
       
   165 startAnim = {}
       
   166 killAnim = {}
       
   167 killedAnim = {}
       
   168 
       
   169 freshDead = nil
       
   170 retry = false
       
   171 crates = {}
       
   172 cratesNum = 0
       
   173 jetCrate = nil
       
   174 -----------------------------Animations--------------------------------
       
   175 function EmitDenseClouds(dir)
       
   176   local dif
       
   177   if dir == "Left" then
       
   178     dif = 10
       
   179   else
       
   180     dif = -10
       
   181   end
       
   182   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   183   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   184   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   185   AnimInsertStepNext({func = AnimWait, args = {native, 800}})
       
   186   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   187   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   188   AnimInsertStepNext({func = AnimWait, args = {native, 800}})
       
   189   AnimInsertStepNext({func = AnimVisualGear, args = {native, GetX(native) + dif, GetY(native) + dif, vgtSteam, 0, true}, swh = false})
       
   190 end
       
   191 
       
   192 function AnimationSetup()
       
   193   startAnim = {}
       
   194   local m = m5DeployedNum
       
   195   table.insert(startAnim, {func = AnimWait, args = {native, 3000}})
       
   196   table.insert(startAnim, {func = AnimCaption, args = {native, "With the rest of the tribe gone, it was up to " .. nativeNames[m5DeployedNum] .. " to save the village.", 5000}})
       
   197   table.insert(startAnim, {func = AnimCaption, args = {native, "But it proved to be no easy task!", 2000}})
       
   198   for i = 1, 4 do
       
   199     table.insert(startAnim, {func = FollowGear, swh = false, args = {cyborgs[i]}})
       
   200     table.insert(startAnim, {func = AnimWait, args = {native, 1000}})
       
   201   end
       
   202   table.insert(startAnim, {func = FollowGear, swh = false, args = {native}})
       
   203   if m == leaksNum then
       
   204     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   205     table.insert(startAnim, {func = AnimSay, args = {native, "What a strange cave!", SAY_THINK, 0}})
       
   206     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   207     table.insert(startAnim, {func = AnimSay, args = {native, "Now how do I get on the other side?!", SAY_THINK, 5500}})
       
   208   elseif m == denseNum then
       
   209     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   210     table.insert(startAnim, {func = AnimSay, args = {native, "Dude, what's this place?!", SAY_THINK, 0}})
       
   211     table.insert(startAnim, {func = AnimCustomFunction, args = {native, EmitDenseClouds, {"Right"}}})
       
   212     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   213     table.insert(startAnim, {func = AnimSay, args = {native, "And where's all the weed?", SAY_THINK, 4000}})
       
   214   elseif m == waterNum then
       
   215     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   216     table.insert(startAnim, {func = AnimSay, args = {native, "Is this place in my head?", SAY_THINK, 0}})
       
   217     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   218     table.insert(startAnim, {func = AnimSay, args = {native, "I shouldn't have drunk that last pint.", SAY_THINK, 6000}})
       
   219   elseif m == buffaloNum then
       
   220     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   221     table.insert(startAnim, {func = AnimSay, args = {native, "Where did that alien run?", SAY_THINK, 0}})
       
   222     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   223     table.insert(startAnim, {func = AnimSay, args = {native, "When I find it...", SAY_THINK, 3000}})
       
   224   elseif m == princessNum then
       
   225     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   226     table.insert(startAnim, {func = AnimSay, args = {native, "A woman shouldn't do this kind of thing!", SAY_THINK, 0}})
       
   227     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   228     table.insert(startAnim, {func = AnimSay, args = {native, "I could be eating snails right now.", SAY_THINK, 5500}})
       
   229   elseif m == chiefNum then
       
   230     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   231     table.insert(startAnim, {func = AnimSay, args = {native, "What is this place?", SAY_THINK, 0}})
       
   232     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   233     table.insert(startAnim, {func = AnimSay, args = {native, "It doesn't matter. I won't let that alien hurt my daughter!", SAY_THINK, 8500}})
       
   234   elseif m == wiseNum then
       
   235     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 50, 0}})
       
   236     table.insert(startAnim, {func = AnimSay, args = {native, "Every single time!", SAY_THINK, 0}})
       
   237     table.insert(startAnim, {func = AnimMove, args = {native, "Right", nativePos[1] + 200, 0}})
       
   238     table.insert(startAnim, {func = AnimSay, args = {native, "How come in a village full of warriors, it's up to me to save it?", SAY_THINK, 8500}})
       
   239   end
       
   240 
       
   241   table.insert(startAnim, {func = AnimCustomFunction, args = {native, RestoreHedge, {cyborg, unpack(cyborgPos)}}})
       
   242   table.insert(startAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
       
   243   table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}})
       
   244   table.insert(startAnim, {func = AnimSay, args = {cyborg, "Greetings, " .. nativeUnNames[m] .. "!", SAY_SAY, 2500}})
       
   245   table.insert(startAnim, {func = AnimSay, args = {cyborg, "As you can see, there is no way to get on the other side!", SAY_SAY, 7000}})
       
   246   table.insert(startAnim, {func = AnimSay, args = {cyborg, "I wish to help you, " .. nativeUnNames[m] .. "!", SAY_SAY, 4000}})
       
   247   table.insert(startAnim, {func = AnimSay, args = {cyborg, "Beware, though! If you are slow, you die!", SAY_SAY, 7000}})
       
   248   table.insert(startAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
       
   249   table.insert(startAnim, {func = AnimSwitchHog, args = {native}})
       
   250   table.insert(startAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
       
   251   table.insert(startAnim, {func = AnimSay, args = {native, "Talk about mixed signals...", SAY_SAY, 4000}})
       
   252   AddSkipFunction(startAnim, SkipStartAnim, {})
       
   253 end
       
   254 
       
   255 function SetupKillAnim()
       
   256   table.insert(killAnim, {func = AnimSay, args = {native, "Well, that was a waste of time.", SAY_THINK, 5000}})
       
   257   table.insert(killAnim, {func = AnimCustomFunction, args = {native, RestoreHedge, {cyborg, unpack(cyborgPos)}}})
       
   258   table.insert(killAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(cyborgPos)}})
       
   259   table.insert(killAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
       
   260   table.insert(killAnim, {func = AnimSay, args = {cyborg, "You bear impressive skills, " .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
       
   261   table.insert(killAnim, {func = AnimSay, args = {cyborg, "However, my mates don't agree with me on leting you go...", SAY_SHOUT, 7000}})
       
   262   table.insert(killAnim, {func = AnimSay, args = {cyborg, "I guess you'll have to kill them.", SAY_SHOUT, 4000}})
       
   263   table.insert(killAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
       
   264   table.insert(killAnim, {func = AnimSwitchHog, args = {native}})
       
   265   table.insert(killAnim, {func = AnimWait, args = {native, 1}})
       
   266   table.insert(killAnim, {func = AnimCustomFunction, args = {native, HideHedge, {cyborg}}})
       
   267   AddSkipFunction(killAnim, SkipKillAnim, {})
       
   268 end
       
   269 
       
   270 function SetupKilledAnim()
       
   271   table.insert(killedAnim, {func = AnimWait, args = {cyborg, 3000}})
       
   272   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {cyborg, unpack(secondPos[2])}})
       
   273   table.insert(killedAnim, {func = AnimOutOfNowhere, args = {native, unpack(secondPos[1])}})
       
   274   table.insert(killedAnim, {func = AnimCustomFunction, args = {cyborg, CondNeedToTurn, {cyborg, native}}})
       
   275   table.insert(killedAnim, {func = AnimSay, args = {cyborg, "Nice work, " .. nativeUnNames[m5DeployedNum] .. "!", SAY_SHOUT, 4000}})
       
   276   table.insert(killedAnim, {func = AnimSay, args = {cyborg, "As a reward for your performance, here's some new technology!", SAY_SHOUT, 8000}})
       
   277   table.insert(killedAnim, {func = AnimSay, args = {cyborg, "Use it wisely!", SAY_SHOUT, 8000}})
       
   278   table.insert(killedAnim, {func = AnimDisappear, args = {cyborg, unpack(secondPos[2])}})
       
   279   table.insert(killedAnim, {func = AnimSwitchHog, args = {native}})
       
   280   AddSkipFunction(killedAnim, SkipKilledAnim, {})
       
   281 end
       
   282 --------------------------Anim skip functions--------------------------
       
   283 function SkipStartAnim()
       
   284   AnimSwitchHog(native)
       
   285   AnimWait(native, 1)
       
   286   AddFunction({func = HideHedge, args = {cyborg}})
       
   287 end
       
   288 
       
   289 function AfterStartAnim()
       
   290   SetGearMessage(native, 0)
       
   291   cratesNum = 0
       
   292   for i = 1, 6 do
       
   293     crates[i] = SpawnAmmoCrate(unpack(cratePos[i]))
       
   294     cratesNum = cratesNum + 1
       
   295   end
       
   296   FollowGear(native)
       
   297   AddNewEvent(CheckGearsDead, {{crates[1], crates[2]}}, PutCrates, {2}, 0) 
       
   298   TurnTimeLeft = TurnTime
       
   299   ShowMission("Dragon's Lair", "Obstacle course", "In order to get to the other side, you need to collect the crates first.|" ..
       
   300                                                   "As the ammo is sparse, you might want to reuse ropes while mid-air.|" ..
       
   301                                                   "If you wish to restart the course, press [Precise]!|" ..
       
   302                                                   "The enemy can't move but it might be a good idea to stay out of sight!|" ..
       
   303                                                   "You have " .. SuddenDeathTurns .. " turns until Sudden Death! Better hurry!", 1, 20000)
       
   304 end
       
   305 
       
   306 function SkipKillAnim()
       
   307   AnimSwitchHog(native)
       
   308   AnimWait(native, 1)
       
   309   AddFunction({func = HideHedge, args = {cyborg}})
       
   310 end
       
   311 
       
   312 function AfterKillAnim()
       
   313   PutWeaponCrates()
       
   314   TurnTimeLeft = TurnTime
       
   315   AddEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
       
   316   ShowMission("Dragon's Lair", "The Slaughter", "Kill the aliens!", 1, 2000)
       
   317 end
       
   318 
       
   319 function SkipKilledAnim()
       
   320   AnimSwitchHog(native)
       
   321   AnimWait(native, 1)
       
   322 end
       
   323 
       
   324 function AfterKilledAnim()
       
   325   HideHedge(cyborg)
       
   326   TurnTimeLeft = TurnTime
       
   327   SetGearMessage(native, 0)
       
   328   AddAmmo(native, amPortalGun, 100)
       
   329   SpawnUtilityCrate(2259, 755, amTeleport, 2)
       
   330   SpawnHealthCrate(secondPos[1][1] + 30, secondPos[1][2])
       
   331   ShowMission("Dragon's Lair", "The what?!", "Use the portal gun to get to the next crate, then use the new gun to get to the final destination!|"..
       
   332                                              "Portal hint: one goes to the destination, and one is the entrance.|"..
       
   333                                              "Teleport hint: just use the mouse to select the destination!", 1, 0)
       
   334 end
       
   335 -----------------------------Events------------------------------------
       
   336 
       
   337 function CheckCyborgsDead()
       
   338   return cyborgsLeft == 0
       
   339 end
       
   340 
       
   341 function NullifyAmmo()
       
   342   AddAmmo(native, amRope, 0)
       
   343   AddAmmo(native, amGirder, 0)
       
   344   AddAmmo(native, amLowGravity, 0)
       
   345   AddAmmo(native, amBazooka, 0)
       
   346   AddAmmo(native, amSniperRifle, 0)
       
   347   AddAmmo(native, amDEagle, 0)
       
   348   AddAmmo(native, amDynamite, 0)
       
   349   AddAmmo(native, amFirePunch, 0)
       
   350   AddAmmo(native, amBaseballBat, 0)
       
   351   AddAmmo(native, amMortar, 0)
       
   352   AddAmmo(native, amSnowball, 0)
       
   353   AddAmmo(native, amShotgun, 0)
       
   354 end
       
   355 
       
   356 function DoCyborgsDead()
       
   357   NullifyAmmo()
       
   358   RestoreHedge(cyborg)
       
   359   SetGearPosition(cyborg, unpack(secondPos[2]))
       
   360   SetGearPosition(native, unpack(secondPos[1]))
       
   361   SetupKilledAnim()
       
   362   AddAnim(killedAnim)
       
   363   AddFunction({func = AfterKilledAnim, args = {}})
       
   364 end
       
   365 
       
   366 
       
   367 function PutWeaponCrates()
       
   368   for i = 1, 6 do
       
   369     cratesNum = cratesNum + 1
       
   370     crates[cratesNum] = SpawnAmmoCrate(unpack(cratePos[cratesNum]))
       
   371   end
       
   372   FollowGear(native)
       
   373 end
       
   374 
       
   375 function DoCratesTaken()
       
   376   SetupKillAnim()
       
   377   AddAnim(killAnim)
       
   378   AddFunction({func = AfterKillAnim, args = {}})
       
   379 end
       
   380 
       
   381 function PutCrates(index)
       
   382   if index <= 7 then
       
   383     cratesNum = cratesNum + 1
       
   384     crates[cratesNum] = SpawnUtilityCrate(unpack(cratePos[cratesNum]))
       
   385     AddNewEvent(CheckGearDead, {crates[cratesNum]}, PutCrates, {index + 1}, 0)
       
   386     FollowGear(native)
       
   387   else
       
   388     AddEvent(StoppedGear, {native}, DoCratesTaken, {}, 0)
       
   389   end
       
   390   if index == 4 then
       
   391     AnimSay(native, "I'm a ninja.", SAY_THINK, 0)
       
   392   end
       
   393 end
       
   394 
       
   395 function CheckMissionFinished()
       
   396   return gearDead[jetCrate] == true
       
   397 end
       
   398 
       
   399 function DoMissionFinished()
       
   400   AddCaption("Salvation was one step closer now...")
       
   401   SaveCampaignVar("Progress", "6")
       
   402   ParseCommand("teamgone " .. loc("011101001"))
       
   403   TurnTimeLeft = 0
       
   404 end
       
   405 
       
   406 function DoRetry()
       
   407   SetGearPosition(native, unpack(nativePos))
       
   408   for i = 1, cratesNum do
       
   409     if gearDead[crates[i]] ~= true then
       
   410       DeleteGear(crates[i])
       
   411       gearDead[crates[i]] = false
       
   412     end
       
   413   end
       
   414   SetupEvents()
       
   415   AddFunction({func = AfterStartAnim, args = {}})
       
   416   retry = false
       
   417 end
       
   418 
       
   419 
       
   420 function CheckGearsDead(gearList)
       
   421   for i = 1, # gearList do
       
   422     if gearDead[gearList[i]] ~= true then
       
   423       return false
       
   424     end
       
   425   end
       
   426   return true
       
   427 end
       
   428 
       
   429 
       
   430 function CheckGearDead(gear)
       
   431   return gearDead[gear] and retry == false
       
   432 end
       
   433 
       
   434 function EndMission()
       
   435   ParseCommand("teamgone " .. loc("Natives"))
       
   436   ParseCommand("teamgone " .. loc("011101001"))
       
   437   TurnTimeLeft = 0
       
   438 end
       
   439 
       
   440 function CheckFreshDead()
       
   441   return freshDead ~= nil
       
   442 end
       
   443 
       
   444 function CyborgDeadReact()
       
   445   freshDead = nil
       
   446   if cyborgsLeft == 0 then
       
   447     return
       
   448   end
       
   449   AnimSay(native, reactions[cyborgsLeft])
       
   450 end
       
   451 -----------------------------Misc--------------------------------------
       
   452 function HideHedge(hedge)
       
   453   if hedgeHidden[hedge] ~= true then
       
   454     HideHog(hedge)
       
   455     hedgeHidden[hedge] = true
       
   456   end
       
   457 end
       
   458 
       
   459 function RestoreHedge(hedge)
       
   460   if hedgeHidden[hedge] == true then
       
   461     RestoreHog(hedge)
       
   462     hedgeHidden[hedge] = false
       
   463   end
       
   464 end
       
   465 
       
   466 function GetVariables()
       
   467   m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
       
   468   m4DenseDead = tonumber(GetCampaignVar("M4DenseDead"))
       
   469   m5DenseDead = tonumber(GetCampaignVar("M5DenseDead"))
       
   470   m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead"))
       
   471   m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead"))
       
   472   m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
       
   473   m5BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
       
   474   m4WaterDead = tonumber(GetCampaignVar("M4WaterDead"))
       
   475   m5WaterDead = tonumber(GetCampaignVar("M5WaterDead"))
       
   476   m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead"))
       
   477   m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead"))
       
   478   m5WiseDead = tonumber(GetCampaignVar("M5WiseDead"))
       
   479   m5PrincessDead = tonumber(GetCampaignVar("M5PrincessDead"))
       
   480   m2Choice = tonumber(GetCampaignVar("M2Choice"))
       
   481   m5Choice = tonumber(GetCampaignVar("M5Choice"))
       
   482   m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum"))
       
   483 end
       
   484 
       
   485 function SetupPlace()
       
   486   for i = 1, 7 do
       
   487     if i ~= m5DeployedNum then 
       
   488       DeleteGear(natives[i])
       
   489     else
       
   490       native = natives[i]
       
   491     end
       
   492   end
       
   493   HideHedge(cyborg)
       
   494   jetCrate = SpawnUtilityCrate(3915, 1723, amJetpack)
       
   495 end
       
   496 
       
   497 function SetupEvents()
       
   498   AddNewEvent(CheckMissionFinished, {}, DoMissionFinished, {}, 0)
       
   499   AddNewEvent(CheckGearDead, {native}, EndMission, {}, 0)
       
   500   AddNewEvent(CheckFreshDead, {}, CyborgDeadReact, {}, 1)
       
   501 end
       
   502 
       
   503 function SetupAmmo()
       
   504   AddAmmo(cyborgs[1], amBazooka, 100)
       
   505 --  AddAmmo(cyborgs[1], amSniperRifle, 100)
       
   506   AddAmmo(cyborgs[1], amShotgun, 100)
       
   507   AddAmmo(cyborgs[1], amSwitch, 100)
       
   508 end
       
   509 
       
   510 function AddHogs()
       
   511 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
       
   512   for i = 1, 7 do
       
   513     natives[i] = AddHog(nativeNames[i], 0, 100, nativeHats[i])
       
   514     gearDead[natives[i]] = false
       
   515   end
       
   516 
       
   517   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
       
   518   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
       
   519   gearDead[cyborg] = false
       
   520 
       
   521   AddTeam(loc("011101000"), 14483455, "ring", "UFO", "Robot", "cm_star")
       
   522   for i = 1, 4 do
       
   523     cyborgs[i] = AddHog(cyborgNames[i], 2, 100, "cyborg2")
       
   524     gearDead[cyborgs[i]] = false
       
   525   end
       
   526   cyborgsLeft = 4
       
   527 
       
   528   for i = 1, 7 do
       
   529     SetGearPosition(natives[i], unpack(nativePos))
       
   530   end
       
   531 
       
   532   SetGearPosition(cyborg, unpack(cyborgPos))
       
   533 
       
   534   for i = 1, 4 do
       
   535     SetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
       
   536     AnimTurn(cyborgs[i], cyborgsDir[i])
       
   537   end
       
   538 
       
   539 end
       
   540 
       
   541 function CondNeedToTurn(hog1, hog2)
       
   542   xl, xd = GetX(hog1), GetX(hog2)
       
   543   if xl > xd then
       
   544     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
       
   545     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
       
   546   elseif xl < xd then
       
   547     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
       
   548     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}})
       
   549   end
       
   550 end
       
   551 
       
   552 -----------------------------Main Functions----------------------------
       
   553 
       
   554 function onGameInit()
       
   555 	Seed = 0
       
   556 	GameFlags = gfSolidLand + gfDisableLandObjects + gfDisableWind + gfDisableGirders
       
   557 	TurnTime = 60000 
       
   558 	CaseFreq = 0
       
   559 	MinesNum = 20
       
   560 	MinesTime = 3000
       
   561 	Explosives = 6
       
   562 	Delay = 10 
       
   563   MapGen = 2
       
   564 	Theme = "City"
       
   565   SuddenDeathTurns = 25
       
   566 
       
   567 	for i = 1, #map do
       
   568 		ParseCommand('draw ' .. map[i])
       
   569 	end
       
   570 
       
   571   AddHogs()
       
   572   AnimInit()
       
   573 end
       
   574 
       
   575 function onGameStart()
       
   576   GetVariables()
       
   577   SetupAmmo()
       
   578   SetupPlace()
       
   579   AnimationSetup()
       
   580   SetupEvents()
       
   581   AddAnim(startAnim)
       
   582   AddFunction({func = AfterStartAnim, args = {}})
       
   583   ShowMission("Dragon's lair", "Y Chwiliad", "Find your tribe!|Cross the lake!", 1, 0)
       
   584 end
       
   585 
       
   586 function onGameTick()
       
   587   AnimUnWait()
       
   588   if ShowAnimation() == false then
       
   589     return
       
   590   end
       
   591   ExecuteAfterAnimations()
       
   592   CheckEvents()
       
   593 end
       
   594 
       
   595 function onGearDelete(gear)
       
   596   gearDead[gear] = true
       
   597   if GetGearType(gear) == gtHedgehog then
       
   598     if GetHogTeamName(gear) == loc("011101000") then
       
   599       freshDead = GetHogName(gear)
       
   600       cyborgsLeft = cyborgsLeft - 1
       
   601     end
       
   602   end
       
   603 end
       
   604 
       
   605 function onGearAdd(gear)
       
   606 end
       
   607 
       
   608 function onAmmoStoreInit()
       
   609   SetAmmo(amFirePunch, 3, 0, 0, 0)
       
   610   SetAmmo(amBaseballBat, 2, 0, 0, 0)
       
   611   SetAmmo(amGirder, 0, 0, 0, 2)
       
   612   SetAmmo(amLowGravity, 0, 0, 0, 1)
       
   613   SetAmmo(amSkip, 9, 0, 0, 0)
       
   614 end
       
   615 
       
   616 function onNewTurn()
       
   617   if AnimInProgress() then
       
   618     TurnTimeLeft = -1
       
   619     return
       
   620   end
       
   621   if GetHogTeamName(CurrentHedgehog) == loc("011101000") then
       
   622     SetInputMask(band(0xFFFFFFFF, bnot(gmLeft + gmRight + gmLJump + gmHJump)))
       
   623     for i = 1, 4 do
       
   624       if gearDead[CurrentHedgehog] ~= true and gearDead[native] ~= true then
       
   625         if gearDead[cyborgs[i]] ~= true and GetX(cyborgs[i]) < GetX(native) then
       
   626           HogTurnLeft(cyborgs[i], false)
       
   627         else
       
   628           HogTurnLeft(cyborgs[i], true)
       
   629         end
       
   630       end
       
   631     end
       
   632     TurnTimeLeft = 30000
       
   633   elseif GetHogTeamName(CurrentHedgehog) == loc("011101001") then
       
   634     TurnTimeLeft = 0
       
   635   else
       
   636     SetInputMask(0xFFFFFFFF)
       
   637     AddCaption("Turns until Sudden Death: " .. SuddenDeathTurns - TotalRounds)
       
   638     if retry == true then
       
   639       DoRetry()
       
   640     end
       
   641   end
       
   642 end
       
   643 
       
   644 function onGearDamage(gear, damage)
       
   645 end
       
   646 
       
   647 function onPrecise()
       
   648   if GameTime > 2500 and AnimInProgress() then
       
   649     SetAnimSkip(true)
       
   650   end
       
   651   if AnimInProgress() == false then
       
   652     retry = true
       
   653   end
       
   654 end