Changeset - a42792d011d8
[Not reviewed]
default
0 1 0
Silverwing - 6 years ago 2019-01-04 13:46:36

chapter 2: kraken fight
1 file changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
journey_temple.lua
Show inline comments
 
@@ -246,385 +246,391 @@ dt_labyrinth_map = {
 
        where = dt_labyrinth_foot
 
    };
 
    ["34"] = {
 
        dsc = [[Вы находитесь в лабиринте ущелий и впадин. Где-то здесь скрыт древний навьярский храм. ]],
 
        e = "31",
 
        w = "35",
 
        where = dt_labyrinth_foot
 
    };
 
    ["35"] = {
 
        dsc = [[Вы находитесь в лабиринте ущелий и впадин. Где-то здесь скрыт древний навьярский храм. ]],
 
        e = "34",
 
        sw = "16",
 
        where = dt_labyrinth_foot
 
    };
 
};
 

	
 
dt_labyrinth = room {
 
    var {
 
        location = "01";
 
    };
 
    no_exit = [[Нет смысла покидать Левиафан здесь. ]];
 
    nam = "Штурвал Левиафана";
 
    not_follow = true;
 
    dsc = function(s)
 
        return dt_labyrinth_map[dt_labyrinth.location].dsc;
 
    end;
 
    entered = function(s)
 
        s:update();
 
    end;
 
    update = function(s)
 
        dt_north:disable();
 
        dt_north_east:disable();
 
        dt_east:disable();
 
        dt_south_east:disable();
 
        dt_south:disable();
 
        dt_south_west:disable();
 
        dt_west:disable();
 
        dt_north_west:disable();
 
        if (dt_labyrinth_map[dt_labyrinth.location].n) then
 
            dt_north:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].ne) then
 
            dt_north_east:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].e) then
 
            dt_east:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].se) then
 
            dt_south_east:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].s) then
 
            dt_south:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].sw) then
 
            dt_south_west:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].w) then
 
            dt_west:enable();
 
        end;
 
        if (dt_labyrinth_map[dt_labyrinth.location].nw) then
 
            dt_north_west:enable();
 
        end;
 
        move(submarine_leviathan, dt_labyrinth_map[dt_labyrinth.location].where);
 
    end;
 
    way = {
 
        kh_vroom("Отойти от штурвала", "leviathan_wheelhouse");
 
    };
 
    obj = {
 
        "dt_north",
 
        "dt_north_east",
 
        "dt_east",
 
        "dt_south_east",
 
        "dt_south",
 
        "dt_south_west",
 
        "dt_west",
 
        "dt_north_west"
 
    };
 
};
 

	
 
dt_north = obj {
 
    nam = "dt_north";
 
    dsc = "{На север}^";
 
    act = function(s)
 
        pr [[Вы движетесь на север. ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].n;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_north_east = obj {
 
    nam = "dt_north_east";
 
    dsc = "{На северо-восток}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на северо-восток.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].ne;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_east = obj {
 
    nam = "dt_east";
 
    dsc = "{На восток}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на восток.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].e;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_south_east = obj {
 
    nam = "dt_south_east";
 
    dsc = "{На юго-восток}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на юго-восток.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].se;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_south = obj {
 
    nam = "dt_south";
 
    dsc = "{На юг}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на юг.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].s;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_south_west = obj {
 
    nam = "dt_south_west";
 
    dsc = "{На юго-запад}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на юго-запад.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].sw;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_west = obj {
 
    nam = "dt_west";
 
    dsc = "{На запад}^";
 
    act = function(s)
 
        pr [[
 
            Вы движетесь на запад.
 
        ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].w;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_north_west = obj {
 
    nam = "dt_north_west";
 
    dsc = "{На северо-запад}^";
 
    act = function(s)
 
        pr [[Вы движетесь на северо-запад. ]];
 
        dt_labyrinth.location = dt_labyrinth_map[dt_labyrinth.location].nw;
 
        dt_labyrinth:update();
 
        pr(dt_labyrinth_map[dt_labyrinth.location].dsc);
 
    end;
 
};
 

	
 
dt_temple_ravine = room {
 
    nam = "dt_temple_ravine";
 
    handwheel_room = "dt_labyrinth";
 
    disp = "Ущелье";
 
    dsc = function(s)
 
        if dt_temple_bridge1.state == 2 then
 
            return [[Вы стоите на дне расщелины. К северо-востоку от вас находится глубокое ущелье, из которого прямо сейчас поднимается громадное морское чудовище. ]];
 
        else
 
            return [[Вы стоите на дне расщелины. К северо-востоку от вас находится глубокое ущелье. Через ущелье переброшен узкий каменный мостик, на другом конце которого вы видите в скале прямоугольное отверстие явно искусственного происхождения. Из отверстия исходит яркий свет. ]];
 
        end;
 
    end;
 
    view = [[Вы находитесь в лабиринте ущелий и впадин. на северо-востоке вы видите глубокую расщелину, простирающуюся с северо-запада на юго-восток. над расщелиной висит узкий каменный мостик. Из отверстия в скале напротив него исходит яркий свет. ]];
 
    way = {
 
        kh_vroom("В Левиафан", "leviathan_airlock");
 
        kh_vroom("В Левиафан", function(s)
 
            if dt_temple_bridge1.state == 2 then
 
                return 'dt_fight_intro';
 
            else
 
                return "leviathan_airlock";
 
            end;
 
        end);
 
        kh_vroom("На мост", "dt_temple_bridge1");
 
    };
 
};
 

	
 
dt_temple_bridge1 = room {
 
    var {
 
        state = 0;
 
    };
 
    nam = "dt_temple_bridge1";
 
    disp = "Мост над пропастью";
 
    dsc = function(s)
 
        if s.state == 2 then
 
            return [[Часть моста, ведущая к храму разрушена, а из бездны поднимается громадное чудище из древних легенд -- кракен. ]];
 
        else
 
            return [[Вы ступаете на хлипкий мостик. Камни ходят ходуном под вашими ногами, и кажется, что слабая конструкция вот вот рухнет, увлекая вас за собой в бездну. ]];
 
        end;
 
    end;
 
    entered = function(s)
 
        char_radcliffe:accompany(false);
 
        char_wright:accompany(false);
 
        char_anna:accompany(false);
 
        if (s.state == 0) then
 
            s.state = 1;
 
            if (char_learr.follow) then
 
                pr [[Леарр с сомнением смотрит на шаткую постройку и по ее головным плавникам бегут цветные полосы: "Не думаю, что мост выдержит нас обоих, я поплыву сверху". ]];
 
            end;
 
            if (char_phaetlarr.follow) then
 
                pr [[Фаэтларр осматривает мост и по его головным плавникам бегут цветные полосы: "Я бы не рискнул пойти по нему, но у тебя, хевьяр, кажется нет выбора", - навьяр смотрит на вас со странной ухмылкой. ]];
 
            end;
 
            if (char_radcliffe.follow) then
 
                pr [[В динамиках раздается голос Уолтера Рэдклиффа: "Я не думаю, что мост выдержит нас обоих. Если тебе нужен помощник, то навьяр здесь будет полезнее. К тому же, это их святилище". ]];
 
            end;
 
            if (char_wright.follow) then
 
                pr [[В динамиках раздается голос Джека Райта: "Нам точно стоит идти здесь? Мост не выглядит надежным. Думаю, тебе стоит взять навьяра, если тебе нужен спутник". ]];
 
            end;
 
            if (char_anna.follow) then
 
                pr [[В динамиках раздается голос Анны Рэдклифф: "Думаю, мост без проблем выдержит одного из нас. Удачи. Мне кажется, тебе лучше было бы идти с навьяром". ]];
 
            end;
 
        end;
 
        if have(item_naethvjirr_key) then
 
            s.state = 2;
 
            path('Дальше по мосту'):disable();
 
            path('На мост', dt_temple_ravine): disable();
 
            pr [[Мост позади вас рушится, а из глубины на поверхность поднимается громадная туша кракена. ]];
 
        end;
 
    end;
 
    way = {
 
        kh_vroom("В ущелье", "dt_temple_ravine");
 
        kh_vroom("Дальше по мосту", "dt_temple_bridge2");
 
    };
 
};
 

	
 
dt_temple_bridge2 = room {
 
    var {
 
        state = 0;
 
    };
 
    nam = "dt_temple_bridge2";
 
    disp = "Мост над пропастью";
 
    dsc = [[Вы почти дошли до проема в скале. Вам кажется, что внизу, в бездне движется что-то огромное. ]];
 
    entered = function(s)
 
        if (s.state == 0) then
 
            s.state = 1;
 
            if (char_learr.follow) then
 
                pr [[По головным плавникам Леарр бегут цветные полосы: "Что это? Там, внизу". ]];
 
            end;
 
            if (char_phaetlarr.follow) then
 
                pr [[По головным плавникам Фаэтларра бегут цветные полосы: "Ты видишь это, хевьяр?". ]];
 
            end;
 
        end;
 

	
 
        if have(item_naethvjirr_key) then
 
            pr [[Мост под вами содрогается, глянув вниз, вы замечаете какое-то движение в глубине. Что бы это ни было, оно движется наверх. ]];
 
        end;
 
    end;
 
    way = {
 
        kh_vroom("К ущелью", "dt_temple_bridge1");
 
        kh_vroom("В проем", "dt_temple_entrance");
 
    };
 
};
 

	
 
dt_temple_entrance = room {
 
    var {
 
        state = 0;
 
        open = false;
 
    };
 
    nam = "dt_temple_entrance";
 
    disp = "У входа в храм";
 
    dsc = function(s)
 
        if (dt_temple_entrance.open) then
 
            return [[
 
                Вы находитесь в небольшом помещении, ярко освещенном лампами в виде длинных трубок. Стены вокруг покрыты навьярскими письменами. Дверь во внутреннее помещение храма открыта. 
 
            ]];
 
        else
 
            return [[
 
                Вы находитесь в небольшом помещении, ярко освещенном лампами в виде длинных трубок. Стены вокруг покрыты навьярскими письменами. Тяжелая дверь во внутреннее помещение храма заблокирована.
 
            ]];
 
        end;
 
    end;
 
    entered = function(s)
 
        if (s.state == 0) then
 
            s.state = 1;
 
            if (char_learr.follow) then
 
                pr [[
 
                    Леарр с интересом рассматривает древние письмена. По ее головным плавникам бегут цветные полосы: "Потрясающе! Это слова наших предков. Тех, кто видел Лсэрианотр собственными глазами, а может даже и самих создателей Спящего в Глубинах!".
 
                ]];
 
            end;
 
            if (char_phaetlarr.follow) then
 
                pr [[
 
                    Фаэтларр бегло осматривает письмена: "Кажется, Дрейк кое-что упустил. Хорошо, что мы здесь хевьяр".
 
                ]];
 
            end;
 
        end;
 
    end;
 
    obj = {
 
        "dt_terminal",
 
        "dt_wires"
 
        
 
    };
 
    way = {
 
        kh_vroom("К ущелью", "dt_temple_bridge2");
 
        kh_vroom("В храм", function(s)
 
            if (dt_temple_entrance.open) then
 
                return "dt_temple";
 
            else
 
                pr [[Дверь заперта. ]];
 
                return false;
 
            end;
 
        end);
 
    };
 
};
 

	
 
dt_terminal = obj {
 
    nam = "dt_terminal";
 
    dsc = [[Рядом с дверью расположен небольшой {пульт} с шестью кнопками и светящимся экраном. ]];
 
    act = function(s)
 
        walkin("dt_terminal_room");
 
    end;
 
};
 

	
 
dt_wires = obj {
 
    nam = "dt_wires";
 
    dsc = [[Под пультом вы видите открытую {панель} с какими-то проводами. ]];
 
    act = function(s)
 
        walkin("dt_wires_room");
 
    end;
 
};
 

	
 
dt_terminal_room = room {
 
    var {
 
        code = {};
 
    };
 
    not_follow = true;
 
    nam = "dt_terminal_room";
 
    disp = "У входа в храм, пульт";
 
    forcedsc = true;
 
    dsc = function(s)
 
        local r = "";
 
        if (#s.code == 0) then
 
            r = "Вы стоите перед небольшим пультом. На экране пусто. ";
 
        else
 
            r = "Вы стоите перед небольшим пультом. На экране вы видите следующую последовательность цветов: ";
 
            for i = 1, #s.code - 1 do
 
                r = r .. dt_wire_colors[s.code[i]] .. ", ";
 
            end;
 
            r = r .. dt_wire_colors[s.code[#s.code]] .. ". ";
 
        end;
 
        r = r .. "Под экраном расположены шесть кнопок. "
 
        return r;
 
    end;
 
    way = {
 
        kh_vroom("Отойти от терминала", "dt_temple_entrance");
 
    };
 
    obj = {
 
        "dt_term1",
 
        "dt_term2",
 
        "dt_term3",
 
        "dt_term4",
 
        "dt_term5",
 
        "dt_term6"
 
    };
 
    check = function(s)
 
        if (#s.code == 4) then
 
            local test = true;
 
            for i = 1, #s.code do
 
                test = test and (s.code[i] == dt_code[i]);
 
            end;
 
            s.code = {};
 
            if (test) then
 
                dt_temple_entrance.open = true;
 
                pr [[ Через несколько мгновений дисплей гаснет. Дверь открывается почти бесшумно, открывая вам доступ к внутреннему залу древнего святилища. ]];
 
            else
 
                pr [[ Через несколько мгновений дисплей гаснет. ]];
 
@@ -796,384 +802,386 @@ dt_wires_room = dlg {
 
                    return "Отсоединить синий провод (".. connect .. ")";
 
                else
 
                    return "Выбрать синий провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[2] ~= nil) then
 
                    dt_wires_room.connections[2] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 2;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "w2", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[3] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[3]] .. " разъем";
 
                    return "Отсоединить зеленый провод (".. connect .. ")";
 
                else
 
                    return "Выбрать зеленый провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[3] ~= nil) then
 
                    dt_wires_room.connections[3] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 3;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "w3", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[4] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[4]] .. " разъем";
 
                    return "Отсоединить желтый провод (".. connect .. ")";
 
                else
 
                    return "Выбрать желтый провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[4] ~= nil) then
 
                    dt_wires_room.connections[4] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 4;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "w4", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[5] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[5]] .. " разъем";
 
                    return "Отсоединить оранжевый провод (".. connect .. ")";
 
                else
 
                    return "Выбрать оранжевый провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[5] ~= nil) then
 
                    dt_wires_room.connections[5] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 5;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "w5", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[6] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[6]] .. " разъем";
 
                    return "Отсоединить красный провод (".. connect .. ")";
 
                else
 
                    return "Выбрать красный провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[6] ~= nil) then
 
                    dt_wires_room.connections[6] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 6;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "leave", always = true, "Отойти от панели", code = [[ walk("dt_temple_entrance"); ]]
 
        };
 
        {tag="socket"};
 
        {
 
            tag = "s0", always = true,
 
            "В фиолетовый разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 1;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
        {
 
            tag = "s1", always = true,
 
            "В синий разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 2;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
        {
 
            tag = "s2", always = true,
 
            "В зеленый разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 3;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
        {
 
            tag = "s3", always = true,
 
            "В желтый разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 4;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
        {
 
            tag = "s4", always = true,
 
            "В оранжевый разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 5;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
        {
 
            tag = "s5", always = true,
 
            "В красный разъем", function(s)
 
                dt_wires_room.connections[dt_wires_room.selected] = 6;
 
                psub("wire");
 
                return "Провод подключен";
 
            end
 
        };
 
    };   
 
};
 

	
 
dt_temple = room {
 
    var {
 
        state = 0;
 
    };
 
    nam = "dt_temple";
 
    disp = "Древний храм";
 
    dsc = [[Вы находитесь в огромном зале, высеченном в скале древними навьярами. ]];
 
    obj = {
 
        "dt_walls",
 
        "dt_pedestal",
 
        "dt_screens",
 
        "item_naethvjirr_key"
 
    };
 
    way = {
 
        kh_vroom("Выйти", "dt_temple_entrance");
 
    };
 
};
 

	
 
dt_walls = obj {
 
    nam = "dt_walls";
 
    dsc = [[Стены зала, освещенные такими же лампами, как и внешнее помещение, украшены множеством предостерегающих рисунков и символов. ]];
 
};
 

	
 
dt_pedestal = obj {
 
    nam = "dt_pedestal";
 
    dsc = [[В центре зала установлен массивный металлический пьедестал. ]];
 
};
 

	
 
dt_screens = obj {
 
    nam = "dt_screens";
 
    dsc = [[Вокруг пьедестала расположено множество экранов, на которых цветными полосами навьярского языка горят предупреждения об опасности использования предмета, хранящегося в этом зале. ]];
 
}
 

	
 
dt_fight_intro = cutscene('Левиафан', 'Левиафан', [[оказавшись внутри Левиафана, вы со всех ног бросаетесь в рубку, чтобы увести корабль подальше от опасности, но не тут то было. громадная туша нависла над Левиафаном, преграждая своими щупальцами пути отхода. ]], 'dt_fight');
 

	
 
dt_fight = room {
 
    var {
 
        state = 0;
 
        has_shot = false;
 
        rotation = 90;
 
        dir = 0;
 
        tentacles = {
 
            {hp=200, dir=0, away = 0 };
 
            {hp=200, dir=1, away = 0 };
 
            {hp=200, dir=2, away = 0 };
 
            {hp=200, dir=3, away = 0 };
 
            {hp=200, dir=4, away = 0 };
 
        };
 
    };
 
    nam = "dt_fight";
 
    disp = "Левиафан, рубка";
 
    forcedsc = true;
 
    entered = function(s)
 
        s:maketurn();
 
        if (s.state == 0) then
 
            s.state = 1;
 
            local dirs = {0,1,2,3,4,5,6,7};
 
            for i = 1, #s.tentacles do
 
                local cd = rnd(#dirs);
 
                s.tentacles[i].dir = dirs[cd];
 
                table.remove(dirs, cd);
 
            end;
 
        end;
 
    end;
 
    eval_tentacle = function(s, tentacle)
 
        if (tentacle.hp <= 70) then
 
            return [[Серьезно раненое щупальце ]];
 
        elseif (tentacle.hp <= 140) then
 
            return [[Раненое щупальце ]];
 
        elseif (tentacle.hp < 200) then
 
            return [[Легко раненое щупальце ]];
 
        else
 
            return [[Щупальце ]];
 
        end;
 
    end;
 
    dsc = function(s)
 
        local fr = s.dir + 1;
 
        local r = s.dir + 2;
 
        local br = s.dir + 3;
 
        local b = s.dir + 4;
 
        local fl = s.dir - 1;
 
        local l = s.dir - 2;
 
        local bl = s.dir - 3;
 
        if (fr > 7) then
 
            fr = fr - 8;
 
        end;
 
        if (r > 7) then
 
            r = r - 8;
 
        end;
 
        if (br > 7) then
 
            br = br - 8;
 
        end;
 
        if (b > 7) then
 
            b = b - 8;
 
        end;
 
        if (fl < 0) then
 
            fl = fl + 8;
 
        end;
 
        if (l < 0) then
 
            l = l + 8;
 
        end;
 
        if (bl < 0) then
 
            bl = bl + 8;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            pr(s.tentacles[i].hp .. " ");
 
        end;
 
        pr("^");
 
        pr [[Щупальца кракена тянутся к Левиафану. ]];
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == s.dir and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится прямо перед субмариной. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == fr and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится спереди и справа от субмарины. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == fl and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится спереди и слева от субмарины. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == r and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится справа по борту. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == l and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится слева по борту. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == b and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится сзади. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == bl and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится сзади и слева. ]]);
 
            end;
 
        end;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].dir == br and s.tentacles[i].away == 0) then
 
                pr(s:eval_tentacle(s.tentacles[i]) .. [[ находится сзади и справа. ]]);
 
            end;
 
        end;
 
    end;
 
    maketurn = function(s)
 
        local dcnt = 0;
 
        if (s.has_shot) then
 
            local fr = s.dir + 1;
 
            local r = s.dir + 2;
 
            local br = s.dir + 3;
 
            local b = s.dir + 4;
 
            local fl = s.dir - 1;
 
            local l = s.dir - 2;
 
            local bl = s.dir - 3;
 
            if (fr > 7) then
 
                fr = fr - 8;
 
            end;
 
            if (r > 7) then
 
                r = r - 8;
 
            end;
 
            if (br > 7) then
 
                br = br - 8;
 
            end;
 
            if (b > 7) then
 
                b = b - 8;
 
            end;
 
            if (fl < 0) then
 
                fl = fl + 8;
 
            end;
 
            if (l < 0) then
 
                l = l + 8;
 
            end;
 
            if (bl < 0) then
 
                bl = bl + 8;
 
            end;
 
            s.has_shot = false;
 
            s.rotation = 90;
 
            for i = 1, #s.tentacles do 
 
                if (s.tentacles[i].hp > 0) then
 
                    if (s.tentacles[i].away > 0) then
 
                        s.tentacles[i].away = s.tentacles[i].away - 1;
 
                        if (s.tentacles[i].away == 0) then
 
                            --TODO show up somewhere
 
                            local dirs = {};
 
                            for j = 1, #s.tentacles do 
 
                                if (s.tentacles[j].hp > 0 and s.tentacles[j].away == 0) then
 
                                    table.insert(dirs, s.tentacles[j].dir);
 
                                end;
 
                            end;
 
                            local newdir;
 
                            repeat 
 
                                newdir = rnd(8) - 1;
 
                            until ArrayUtils.indexOf(dirs, newdir) == 0;
 
                            s.tentacles[i].dir = newdir;
 
                            
 
                            if (s.tentacles[i].hp <= 70) then
 
                                pr [[Серьезно раненое щупальце ]];
 
                            elseif (s.tentacles[i].hp <= 140) then
 
                                pr [[Раненое щупальце ]];
 
                            elseif (s.tentacles[i].hp < 200) then
 
                                pr [[Легко раненое щупальце ]];
 
                            end;
 
                            if (newdir == f) then
 
                                pr [[подтягивается спереди. ]];
 
                            elseif (newdir == fr) then
 
                                pr [[подтягивается спереди справа. ]];
 
                            elseif (newdir == fl) then
 
                                pr [[подтягивается спереди слева. ]];
 
                            elseif (newdir == r) then
 
                                pr [[подтягивается справа. ]];
 
                            elseif (newdir == l) then
 
                                pr [[подтягивается слева. ]];
 
                            elseif (newdir == br) then
 
                                pr [[подтягивается сзади справа. ]];
 
                            elseif (newdir == bl) then
 
                                pr [[подтягивается сзади слева. ]];
 
                            elseif (newdir == b) then
 
                                pr [[подтягивается сзади. ]];
 
                            end;
 
                        end;
 
                    else
0 comments (0 inline, 0 general)