Changeset - fdd1761f4692
[Not reviewed]
default
0 2 42
Silverwing - 6 years ago 2019-01-08 23:46:08

final battle and deep tample battle graphics
44 files changed with 37 insertions and 0 deletions:
images/fb_pylon.png
bin+new file
0 comments (0 inline, 0 general)
images/deep_temple_bg.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_1.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_2.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_3.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_4.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_5.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_6.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_7.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_leviathan_8.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_1_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_1_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_1_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_1_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_2_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_2_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_2_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_2_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_3_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_3_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_3_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_3_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_4_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_4_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_4_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_4_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_5_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_5_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_5_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_5_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_6_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_6_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_6_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_6_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_7_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_7_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_7_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_7_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_8_healthy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_8_heavy.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_8_light.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/dt_tentacle_8_medium.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/fb_drake.png
Show inline comments
 
binary diff not shown
Show images
images/fb_pylon.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
journey_temple.lua
Show inline comments
 
@@ -637,735 +637,772 @@ dt_terminal_room = room {
 
        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 [[ Через несколько мгновений дисплей гаснет. ]];
 
            end;
 
        end;
 
    end;
 
};
 

	
 
dt_term1 = obj {
 
    nam = "dt_term1";
 
    dsc = "{Нажать фиолетовую кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 1) ~= 0 or not dt_wires_room.connections[1]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[1]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_term2 = obj {
 
    nam = "dt_term2";
 
    dsc = "{Нажать синюю кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 2) ~= 0 or not dt_wires_room.connections[2]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[2]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_term3 = obj {
 
    nam = "dt_term3";
 
    dsc = "{Нажать зеленую кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 3) ~= 0 or not dt_wires_room.connections[3]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[3]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_term4 = obj {
 
    nam = "dt_term4";
 
    dsc = "{Нажать желтую кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 4) ~= 0 or not dt_wires_room.connections[4]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[4]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_term5 = obj {
 
    nam = "dt_term5";
 
    dsc = "{Нажать оранжевую кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 5) ~= 0 or not dt_wires_room.connections[5]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[5]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_term6 = obj {
 
    nam = "dt_term6";
 
    dsc = "{Нажать красную кнопку}^";
 
    act = function(s)
 
        if (ArrayUtils.indexOf(dt_buttons, 6) ~= 0 or not dt_wires_room.connections[6]) then
 
            return "Вы нажимаете на кнопку, но ничего не происходит. ";
 
        else
 
            table.insert(dt_terminal_room.code, dt_wires_room.connections[6]);
 
            pr "Вы нажимаете на кнопку, и на экране зажигается соответствующая ей цветная полоса. ";
 
            dt_terminal_room:check();
 
        end;
 
    end;
 
};
 

	
 
dt_wire_colors = {
 
    "фиолетовый",
 
    "синий",
 
    "зеленый",
 
    "желтый",
 
    "оранжевый",
 
    "красный"
 
};
 

	
 
dt_wires_room = dlg {
 
    var {
 
        connections = {
 
            1,
 
            2,
 
            3,
 
            4,
 
            5,
 
            6
 
        };
 
        selected = nil;
 
    };
 
    not_follow = true;
 
    nam = "dt_wires_room";
 
    disp = "У входа в храм, панель";
 
    dsc = [[
 
        Перед вами открытая панель, за которой находятся шесть проводов, подключенные к своим разъемам. Провода отличаются цветами. 
 
    ]]; 
 
    choose_socket = function(s)
 
        pon("s0", "s1", "s2", "s3", "s4", "s5");
 
        for conn = 1, 6 do
 
            if (dt_wires_room.connections[conn] == 1) then
 
                poff("s0");
 
            elseif (dt_wires_room.connections[conn] == 2) then
 
                poff("s1");
 
            elseif (dt_wires_room.connections[conn] == 3) then
 
                poff("s2");
 
            elseif (dt_wires_room.connections[conn] == 4) then
 
                poff("s3");
 
            elseif (dt_wires_room.connections[conn] == 5) then
 
                poff("s4");
 
            elseif (dt_wires_room.connections[conn] == 6) then
 
                poff("s5");
 
            end;
 
        end;
 
        psub("socket");
 
    end;
 
    phr = { 
 
        {tag="wire"};
 
        {
 
            tag = "w0", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[1] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[1]] .. " разъем";
 
                    return "Отсоединить фиолетовый провод (".. connect .. ")";
 
                else
 
                    return "Выбрать фиолетовый провод (".. connect .. ")";
 
                end;
 
                
 
            end, function(s)
 
                if (dt_wires_room.connections[1] ~= nil) then
 
                    dt_wires_room.connections[1] = nil;
 
                    return "Вы отсоединяете провод";
 
                else
 
                    dt_wires_room.selected = 1;
 
                    dt_wires_room:choose_socket();
 
                    return "Куда подключить?";
 
                end;
 
            end
 
        };
 
        {
 
            tag = "w1", always = true, 
 
            function(s)
 
                local connect = "не подключен";
 
                if (dt_wires_room.connections[2] ~= nil) then
 
                    connect = dt_wire_colors[dt_wires_room.connections[2]] .. " разъем";
 
                    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 };
 
        };
 
    };
 

	
 
    positions = {
 
        {80, 0},
 
        {160, 0},
 
        {160, 80},
 
        {160, 160},
 
        {80, 160},
 
        {0, 160},
 
        {0, 80},
 
        {0, 0}
 
    };
 

	
 
    nam = "dt_fight";
 
    pic = function(s)
 
        local pic = 'images/deep_temple_bg.png';
 

	
 
        for i = 1, #s.tentacles do
 
            if s.tentacles[i].away == 0 then
 
                local pos = s.positions[s.tentacles[i].dir + 1];
 
                local status;
 
                if (s.tentacles[i].hp <= 70) then
 
                    status = 'heavy';
 
                elseif (s.tentacles[i].hp <= 140) then
 
                    status = 'medium';
 
                elseif (s.tentacles[i].hp < 200) then
 
                    status = 'light';
 
                else
 
                    status = 'healthy';
 
                end;
 
                pic = pic .. ';images/dt_tentacle_' .. tostring(s.tentacles[i].dir + 1) .. '_' .. status .. '.png@' .. pos[1] .. ',' .. pos[2];
 
            end;
 
        end;
 

	
 
        pic = pic .. ';images/dt_leviathan_' .. tostring(s.dir + 1) .. '.png@80,80'
 

	
 
        return pic;
 
    end;
 
    disp = "Левиафан, рубка";
 
    not_follow = true;
 
    nosave = true;
 
    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
 
                        --TODO hit leviathan or hide up
 
                        if (rnd(8) > 1) then
 
                            submarine_leviathan.hull_integrity = submarine_leviathan.hull_integrity - 5;
 
                            pr [[Кракен ударяет Левиафан щупальцем. ]];
 
                        else
 
                            s.tentacles[i].away = 1;
 
                            pr [[Кракен отдергивает одно из щупалец. ]];
 
                        end;
 
                    end;
 
                else
 
                    dcnt = dcnt + 1;
 
                end;
 
            end;
 
        end;
 
        if (dcnt > 2) then
 
            walk("dt_kraken_victory");
 
        end;
 
        
 
        dt_f_rotate_ccw45:enable();
 
        dt_f_rotate_cw45:enable();
 
        dt_f_sonic:enable();
 
        if (submarine_leviathan.torpedoes == 0) then
 
            dt_f_torpedo:disable();
 
        else
 
            dt_f_torpedo:enable();
 
        end;
 
        if (submarine_leviathan.torpedoes == 2) then
 
            dt_f_recharge:disable();
 
        else
 
            dt_f_recharge:enable();
 
        end;
 
        if (s.rotation < 45) then
 
            dt_f_rotate_ccw45:disable();
 
            dt_f_rotate_cw45:disable();
 
        end;
 
        if (s.has_shot) then
 
            dt_f_torpedo:disable();
 
            dt_f_sonic:disable();
 
        end;
 
        
 
        if (submarine_leviathan.hull_integrity <= 0) then
 
            walk("game_over_kraken");
 
        end;
 
    end;
 
    obj = {
 
        "dt_f_rotate_ccw45",
 
        "dt_f_rotate_cw45",
 
        "dt_f_torpedo",
 
        "dt_f_sonic",
 
        "dt_f_recharge",
 
        "dt_f_wait"
 
    };
 
};
 

	
 
dt_f_rotate_ccw45 = obj {
 
    nam = "dt_f_rotate_ccw45";
 
    dsc = "{Повернуть на 45 градусов против часовой стрелки}^";
 
    act = function(s)
 
        dt_fight.dir = dt_fight.dir - 1;
 
        if (dt_fight.dir < 0) then
 
            dt_fight.dir = dt_fight.dir + 8;
 
        end;
 
        dt_fight.rotation = dt_fight.rotation - 45;
 
        pr "Субмарина поворачивает против часовой стрелки. ";
 
        dt_fight:maketurn();
 
    end;
 
};
 

	
 
dt_f_rotate_cw45 = obj {
 
    nam = "dt_f_rotate_cw45";
 
    dsc = "{Повернуть на 45 градусов по часовой стрелке}^";
 
    act = function(s)
 
        dt_fight.dir = dt_fight.dir + 1;
 
        if (dt_fight.dir > 7) then
 
            dt_fight.dir = dt_fight.dir - 8;
 
        end;
 
        dt_fight.rotation = dt_fight.rotation - 45;
 
        pr  "Субмарина поворачивает по часовой стрелке. ";
 
        dt_fight:maketurn();
 
    end;
 
};
 

	
 
dt_f_torpedo = obj {
 
    nam = "dt_f_torpedo";
 
    dsc = "{Выстрелить торпедой}^";
 
    act = function(s)
 
        pr "Вы выпускаете торпеду. ";
 
        dt_fight.has_shot = true;
 
        submarine_leviathan.torpedoes = submarine_leviathan.torpedoes - 1;
 
        for i=1, #dt_fight.tentacles do
 
            if dt_fight.tentacles[i].dir == dt_fight.dir and dt_fight.tentacles[i].hp > 0 and dt_fight.tentacles[i].away == 0 then
 
                dt_fight.tentacles[i].hp = dt_fight.tentacles[i].hp - 70;
 
                dt_fight.tentacles[i].away = 2;
 
                if (dt_fight.tentacles[i].hp > 0) then
 
                    pr "Торпеда попадает в одно из щупалец, нанеся ему существенный урон. Кракен резко отдергивает его. ";
 
                else
 
                    pr "Щупальце отрывает взрывом. Кракен бьется в конвульсиях. ";
 
                end;
 
            end;
 
        end;    
 
        dt_fight:maketurn();
 
    end;
 
};
 

	
 
dt_f_sonic = obj {
 
    nam = "dt_f_sonic";
 
    dsc = "{Выстрелить из звуковой пушки}^";
 
    act = function(s)
 
        dt_fight.has_shot = true;
 
        pr [[Вы стреляете из звуковой пушки. ]];
 
        local fr = dt_fight.dir + 1;
 
        local fl = dt_fight.dir - 1;
 
        if (fr > 7) then
 
            fr = fr - 8;
 
        end;
 
        if (fl < 0) then
 
            fl = fl + 8;
 
        end;
 
        local hit = false;
 
        for i=1, #dt_fight.tentacles do
 
            if (dt_fight.tentacles[i].dir == dt_fight.dir or dt_fight.tentacles[i].dir == fr or dt_fight.tentacles[i].dir == fl) and dt_fight.tentacles[i].hp > 0 and dt_fight.tentacles[i].away == 0 then
 
                hit = true;
 
                dt_fight.tentacles[i].hp = dt_fight.tentacles[i].hp - 20;
 
                dt_fight.tentacles[i].away = 3;
 
                if (dt_fight.tentacles[i].hp <= 0) then
 
                    pr "Одно из щупалец выведено из строя. ";
 
                end;
 
            end;
 
        end;    
 
        if (hit) then
 
            pr [[
 
                Кракен резко отдергивает щупальца, попавшие в область действия звуковой пушки. 
 
            ]];
 
        end;
 
        dt_fight:maketurn();
 
    end;
 
};
 

	
 
dt_f_recharge = obj {
 
    nam = "dt_f_recharge";
 
    dsc = "{Перезарядить торпедные аппараты}^";
 
    act = function(s)
 
        submarine_leviathan.torpedoes = 2;
 
        if (ArrayUtils.indexOf(pl.party, 'wright') ~= 0 or ArrayUtils.indexOf(pl.party, 'radcliffe') ~= 0) then
 
            pr "Вы отдаете по телефону приказ перезарядить торпедные аппараты. ";
 
            dt_fight:maketurn();
 
        else
 
            pr "Вы спускаетесь вниз, чтобы перезарядить торпедные аппараты. ";
 
            dt_fight.has_shot = true;
 
            dt_fight:maketurn();
 
            dt_fight.has_shot = true;
 
            dt_fight:maketurn();
 
            pr "Вы возвращаетесь в рубку, чтобы продолжить бой. "
 
        end;
 
    end;
 
};
 

	
 

	
 
dt_f_wait = obj {
 
    nam = "dt_f_wait";
 
    dsc = "{Ждать}^";
 
    act = function(s)
 
        pr "";
 
        dt_fight.has_shot = true;
 
        dt_fight.rotation = 0;
 
        dt_fight:maketurn();
 
    end;
 
};
 

	
 
dt_kraken_victory = cutscene("dt_kraken_victory", "Левиафан, рубка", [[
 
    После очередного выстрела Левиафана, кракен исчезает в глубинах, оставив вас в покое. 
 
]], "leviathan_wheelhouse");
 
\ No newline at end of file
0 comments (0 inline, 0 general)