Changeset - c8845b94420f
[Not reviewed]
default
0 4 2
Silverwing - 7 years ago 2016-12-10 12:44:14

Prison combat
6 files changed with 609 insertions and 2 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -68,7 +68,7 @@ battlefield = function(tab)
 
    tab.entered = function(s)
 
        s:check_walk();
 
        if (type(entered) == 'function') then
 
            entered(s);
 
            return entered(s);
 
        else
 
            return entered;
 
        end;
game_over.lua
Show inline comments
 
game_over_lse_prison = game_over("game_over_lse_prison", [[Фаэтларр рванулся к двери, расчитывая проскользнуть незаметно. К сожалению, дверь оказалась запертой и навьяру не оставалось ничего, кроме как попытаться убрать стражника, пока тот не позвал на помощь. К сожалению, Фаэтларр оказался недостаточно быстр. Дверь открылась и в помещение вбежали сразу несколько стражников. Фаэтларру не оставалось ничего, кроме как сдаться. Его запирают рядом с остальными членами экипажа. Вы понимаете, что теперь все действительно кончено. Вы проиграли. ]]);
 
 
game_over_phaetlarr_caught = game_over("game_over_phaetlarr_caught", [[Едва увидев Фаэтларра, стражники бросаются к нему, не давая никаких шансов на спасение. Через некоторое время, он оказывается в тюрьме, рядом с остальными членами экипажа. Вы понимаете, что теперь все действительно кончено. Вы проиграли. ]]);
 
 
game_over_phaetlarr_wrong_wire = game_over("game_over_phaetlarr_wrong_wire", [[Едва Фаэтларр обрезает провод, как свет в доке меняет цвет на красный, а со всех сторон доносятся громкие звуки сирены. Стражники среагировали моментально. Меткий бросок копья протыкает навьяра. Даже если он выжил, шансов спасти остальной экипаж у него не остается. ]]);
images/navjiarr_guard5.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/navjiarr_guard6.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
lseryanotrr_locations.lua
Show inline comments
 
@@ -481,3 +481,608 @@ lse_outer_4 = room {
 
    };
 
};
 

	
 
lse_prison_overseer_room = room {
 
    nam = "lse_prison_overseer_room";
 
    disp = "Лсэрианотр, тюрьма";
 
    dsc = "Фаэтларр находится в небольшой комнатке. ";
 
    obj = {
 
        'lse_prison_table',
 
        'lse_prison_guard'
 
    };
 
    way = {
 
        kh_vroom("В тоннель", "service_tunnels_1");
 
        kh_vroom("В дверь", function(s)
 
            if (lse_prison_guard.state == 1) then
 
                if (lse_prison_table.state == 1) then
 
                    return "lse_prison_fight_intro";
 
                else
 
                    pr [[Дверь заперта. ]];
 
                    return false; 
 
                end;
 
            else
 
                return "game_over_lse_prison";
 
            end;
 
        end);
 
    };
 
};
 

	
 
lse_prison_table = obj {
 
    var {
 
        state = 0;
 
    };
 
    nam = "lse_prison_table";
 
    dsc = "В центре комнаты установлен {стол} с несколькими индикаторами, кнопками и переключателями. ";
 
    act = function(s)
 
        if (lse_prison_guard == 1) then
 
            if (s.state == 1) then
 
                return [["Я уже все здесь сделал", - подумал Фаэтларр. ]];
 
            else
 
                lse_prison_table.state = 1;
 
                return [[Фаэтларр бегло взглянул на подписи к переключателям и щелкнув пару из них, отошел от стола. ]];
 
            end;
 
        else
 
            return "Стражник не позволит Фаэтларру сделать это. ";
 
        end;
 
    end;
 
};
 

	
 
lse_prison_guard = obj {
 
    var {
 
        state = 0;
 
    };
 
    nam = "lse_prison_guard";
 
    dsc = function(s)
 
        if (s.state == 0) then
 
            return "За столом сидит {стражник} и внимательно наблюдает за мигающими на столе индикаторами. "
 
        else
 
            return "На полу рядом со столом валяется стражник без сознания. ";
 
        end;
 
    end;
 
    act = [["Приложить бы его чем-нибудь, чтобы не мешался", - мелькнула мысль в голове Фаэтларра. ]];
 
    use = function(s, o)
 
        if (s.state == 0 and o == lse_item_toolbox) then
 
            s.state = 0;
 
            return [[Фаэтларр бьет стражника ящиком по голове, от чего тот падает на пол без чувств. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_prison_fight_intro = cutscene("lse_prison_fight_intro", "Лсэрианотр, тюрьма", function(s)
 
    pr [[Прошло не так много времени, с того момента, как Блэк запер вас здесь. Вы даже не успели как следует осмотреть камеру и обдумать возможные способы побега. Внезапно, двери камер открываются. Пользуясь моментом, вы выбегаете наружу. Да, вам придется в одиночку и без оружия противостоять отряду вооруженных копьями навьяров-охранников, однако это лучше, чем оставаться взаперти. ]]
 
    if (#player_drake.party > 1) then
 
        pr [[На помощь вам из других камер выходят ваши спутники. ]];
 
    end;
 
    pr [[Дверь в конце коридора открывается и в нее вбегает Фаэтларр. К вашему удивлению, вы замечаете у него свой револьвер. ]];
 
end, "lse_prison_fight");
 

	
 
lse_prison_fight = battlefield {
 
    nam = "lse_prison_fight";
 
    disp = "Лсэрианотр, тюрьма";
 
    hideinv = true;
 
    lose = "game_over_lse_prison_fight";
 
    win = "lse_prison_fight_victory";
 
    plX = 3;
 
    plY = 1;
 
    entered = function(s)
 
        move(player_drake, here());
 
        remove(player_phaetlarr);
 
        pl = player_drake;
 
    end;
 
    obj = {
 
        --'lse_cmbt_learr',
 
        'lse_cmbt_phaetlarr',
 
        --'lse_cmbt_wright',
 
        --'lse_cmbt_radcliffe',
 
        --'lse_cmbt_anna',
 
        
 
        'lse_cmbt_guard1',
 
        'lse_cmbt_guard2',
 
        'lse_cmbt_guard3',
 
        'lse_cmbt_guard4',
 
        'lse_cmbt_guard5',
 
        'lse_cmbt_guard6'
 
    };
 
};
 

	
 
lse_cmbt_learr = combatant {
 
    nam = "lse_cmbt_learr";
 
    disp2 = "Леарр";
 
    disp3 = "Леарр";
 
    x = 1;
 
    y = 2;
 
    pic = "images/learr.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    hp = 10;
 
    hasSpear = false;
 
    make_turn = function(s)
 
        local enemies = {  };
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                table.insert(enemies, obj);
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
        end);
 
        local enemy = enemies[1];
 
        local dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
        -- AI Order:
 
        -- If has spear and enemy is far   - throw spear
 
        -- If has spear and enemy is close - hit with spear
 
        -- if spear is nearer than any enemy - walk towards spear
 
        -- walk towards nearest enemy
 
        -- If enemy close and enemy has spear - take spear from enemy
 
        -- If enemy close and enemy doesn't have spear - hit with claws
 
        
 
        if (s.hasSpear and dist == 1) then
 
            if (rnd(4) > 1) then
 
                pn("Леарр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Леарр бьет " .. enemy.disp2 .. " копьем, но промахивается. "); 
 
            end;
 
        elseif (s.hasSpear and dist == 0) then
 
            enemy.hp = enemy.hp - 2;
 
            pn("Леарр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
        elseif dist == 0 then
 
            enemy.hp = enemy.hp - 1;
 
            pn("Леарр бьет " .. enemy.disp2 .. " и попадает. ");
 
        else
 
            if (enemy.x > s.x) then
 
                s.x = s.x + 1;
 
            elseif (enemy.x < s.x) then
 
                s.x = s.x - 1;
 
            end;
 
            
 
            if (enemy.y > s.y) then
 
                s.y = s.y + 1;
 
            elseif (enemy.y < s.y) then
 
                s.y = s.y - 1;
 
            end;
 
            
 
            pn("Леарр идет к " .. enemy.disp3 .. ". ");
 
        end;
 
    end;
 
    dsc = function(s)
 
        if (s.hp > 0) then
 
            return [[ {Леарр} готова к бою. ]];
 
        else
 
            return [[ {Леарр} без сознания. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_cmbt_phaetlarr = combatant {
 
    nam = "lse_cmbt_phaetlarr";
 
    disp2 = "Фаэтларра";
 
    disp3 = "Фаэтларру";
 
    x = 3;
 
    y = 5;
 
    pic = "images/phaetlarr.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    hp = 10;
 
    hasSpear = false;
 
    make_turn = function(s)
 
        local enemies = {  };
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                table.insert(enemies, obj);
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
        end);
 
        local enemy = enemies[1];
 
        local dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
        -- AI Order:
 
        -- If has spear and enemy is far   - throw spear
 
        -- If has spear and enemy is close - hit with spear
 
        -- if spear is nearer than any enemy - walk towards spear
 
        -- walk towards nearest enemy
 
        -- If enemy close and enemy has spear - take spear from enemy
 
        -- If enemy close and enemy doesn't have spear - hit with claws
 
        
 
        if (s.hasSpear and dist == 1) then
 
            if (rnd(4) > 1) then
 
                pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем, но промахивается. "); 
 
            end;
 
        elseif (s.hasSpear and dist == 0) then
 
            enemy.hp = enemy.hp - 2;
 
            pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
        elseif (s.hasSpear and dist < 4) then
 
            s.hasSpear = false;
 
            if (rnd(4) > dist) then
 
                enemy.hp = enemy.hp - 2;
 
                pn("Фаэтларр бросает копье в " .. enemy.disp2 .. " и попадает. ");
 
            else
 
                
 
                pn("Фаэтларр бросает копье в " .. enemy.disp2 .. ", но промахивается. ");
 
            end;
 
        elseif dist == 0 then
 
            if (enemy.hasSpear) then
 
                enemy.hasSpear = false;
 
                s.hasSpear = true;
 
                pn("Фаэтларр забирает копье у " .. enemy.disp2 .. ". ");
 
            else
 
                enemy.hp = enemy.hp - 1;
 
                pn("Фаэтларр бьет " .. enemy.disp2 .. " и попадает. ");
 
            end;
 
        else
 
            if (enemy.x > s.x) then
 
                s.x = s.x + 1;
 
            elseif (enemy.x < s.x) then
 
                s.x = s.x - 1;
 
            end;
 
            
 
            if (enemy.y > s.y) then
 
                s.y = s.y + 1;
 
            elseif (enemy.y < s.y) then
 
                s.y = s.y - 1;
 
            end;
 
            
 
            pn("Фаэтларр идет к " .. enemy.disp3 .. ". ");
 
        end;
 
    end;
 
    dsc = function(s)
 
        if (s.hp > 0) then
 
            return [[ {Фаэтларр} готов к бою. ]];
 
        else
 
            return [[ {Фаэтларр} без сознания. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_cmbt_wright = combatant {
 
    nam = "lse_cmbt_wright";
 
    disp2 = "Джека";
 
    disp3 = "Джеку";
 
    x = 5;
 
    y = 2;
 
    pic = "images/jack.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    hp = 10;
 
    hasHarpoon = false;
 
    make_turn = function(s)
 
        local enemies = {  };
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                table.insert(enemies, obj);
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
        end);
 
        local enemy = enemies[1];
 
        local dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
        -- AI Order:
 
        -- If has harpoon and enemy is far - shoot
 
        -- If has harpoon and enemy is close - hit with harpoon
 
        -- walk towards nearest enemy
 
        
 
        if (s.hasHarpoon and dist == 1) then
 
            if (rnd(4) > 1) then
 
                pn("Райт бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Райт бьет " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (s.hasHarpoon and dist == 0) then
 
            enemy.hp = enemy.hp - 2;
 
            pn("Райт бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
        elseif (s.hasHarpoon and dist < 4) then
 
            s.hasHarpoon = false;
 
            if (rnd(4) > dist) then
 
                pn("Райт стреляет в " .. enemy.disp2 .. " гарпуном и попадает. ");    
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Райт стреляет в " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (not s.hasHarpoon) then
 
            s.hasHarpoon = true;
 
            pn("Райт перезаряжает ружье. ");
 
        else
 
            if (enemy.x > s.x) then
 
                s.x = s.x + 1;
 
            elseif (enemy.x < s.x) then
 
                s.x = s.x - 1;
 
            end;
 
            
 
            if (enemy.y > s.y) then
 
                s.y = s.y + 1;
 
            elseif (enemy.y < s.y) then
 
                s.y = s.y - 1;
 
            end;
 
            
 
            pn("Райт идет к " .. enemy.disp3 .. ". ");
 
        end;
 
    end;
 
    dsc = function(s)
 
        if (s.hp > 0) then
 
            return [[ {Райт} готов к бою. ]];
 
        else
 
            return [[ {Райт} без сознания. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_cmbt_radcliffe = combatant {
 
    nam = "lse_cmbt_radcliffe";
 
    disp2 = "Уолтера";
 
    disp3 = "Уолтеру";
 
    x = 5;
 
    y = 4;
 
    pic = "images/walter.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    hp = 10;
 
    hasHarpoon = false;
 
    make_turn = function(s)
 
        local enemies = {  };
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                table.insert(enemies, obj);
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
        end);
 
        local enemy = enemies[1];
 
        local dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
        -- AI Order:
 
        -- If has harpoon and enemy is far - shoot
 
        -- If has harpoon and enemy is close - hit with harpoon
 
        -- walk towards nearest enemy
 
        
 
        if (s.hasHarpoon and dist == 1) then
 
            if (rnd(4) > 1) then
 
                pn("Рэдклифф бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Рэдклифф бьет " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (s.hasHarpoon and dist == 0) then
 
            enemy.hp = enemy.hp - 2;
 
            pn("Рэдклифф бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
        elseif (s.hasHarpoon and dist < 4) then
 
            s.hasHarpoon = false;
 
            if (rnd(4) > dist) then
 
                pn("Рэдклифф стреляет в " .. enemy.disp2 .. " гарпуном и попадает. ");    
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Рэдклифф стреляет в " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (not s.hasHarpoon) then
 
            s.hasHarpoon = true;
 
            pn("Рэдклифф перезаряжает ружье. ");
 
        else
 
            if (enemy.x > s.x) then
 
                s.x = s.x + 1;
 
            elseif (enemy.x < s.x) then
 
                s.x = s.x - 1;
 
            end;
 
            
 
            if (enemy.y > s.y) then
 
                s.y = s.y + 1;
 
            elseif (enemy.y < s.y) then
 
                s.y = s.y - 1;
 
            end;
 
            
 
            pn("Рэдклифф идет к " .. enemy.disp3 .. ". ");
 
        end;
 
    end;
 
    dsc = function(s)
 
        if (s.hp > 0) then
 
            return [[ {Рэдклифф} готов к бою. ]];
 
        else
 
            return [[ {Рэдклифф} без сознания. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_cmbt_anna = combatant {
 
    nam = "lse_cmbt_anna";
 
    disp2 = "Анну";
 
    disp3 = "Анне";
 
    x = 1;
 
    y = 4;
 
    pic = "images/anna.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    hp = 10;
 
    hasHarpoon = false;
 
    make_turn = function(s)
 
        local enemies = {  };
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                table.insert(enemies, obj);
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
        end);
 
        
 
        local pldist = here().getDistance(s.x, s.y, pl.x, pl.y);
 
        
 
        local enemy = enemies[1];
 
        local dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
        -- AI Order:
 
        -- If has harpoon and enemy is far - shoot
 
        -- If has harpoon and enemy is close - hit with harpoon
 
        -- walk towards nearest enemy
 
        
 
        if (s.hasHarpoon and dist == 1) then
 
            if (rnd(4) > 1) then
 
                pn("Анна бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Анна бьет " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (s.hasHarpoon and dist == 0) then
 
            enemy.hp = enemy.hp - 2;
 
            pn("Анна бьет " .. enemy.disp2 .. " гарпуном и попадает. ");
 
        elseif (s.hasHarpoon and dist < 4) then
 
            s.hasHarpoon = false;
 
            if (rnd(4) > dist) then
 
                pn("Анна стреляет в " .. enemy.disp2 .. " гарпуном и попадает. ");    
 
                enemy.hp = enemy.hp - 2;
 
            else
 
                pn("Анна стреляет в " .. enemy.disp2 .. " гарпуном, но промахивается. "); 
 
            end;
 
        elseif (not s.hasHarpoon) then
 
            s.hasHarpoon = true;
 
            pn("Анна перезаряжает ружье. ");
 
        elseif (pldist > 0) then
 
            if (pl.x > s.x) then
 
                s.x = s.x + 1;
 
            elseif (pl.x < s.x) then
 
                s.x = s.x - 1;
 
            end;
 
            
 
            if (pl.y > s.y) then
 
                s.y = s.y + 1;
 
            elseif (pl.y < s.y) then
 
                s.y = s.y - 1;
 
            end;
 
            
 
            pn("Анна идет к вам. ");
 
        else
 
            pn("Анна ждет ваших действий. ");
 
        end;
 
    end;
 
    dsc = function(s)
 
        if (s.hp > 0) then
 
            return [[ {Анна} готова к бою. ]];
 
        else
 
            return [[ {Анна} без сознания. ]];
 
        end;
 
    end;
 
};
 

	
 
lse_cmbt_guard = function(nam, index, x, y, spear) 
 
    return combatant {
 
        nam = nam;
 
        disp2 = "стражника " .. tostring(index);
 
        disp3 = "стражника " .. tostring(index);
 
        x = x;
 
        y = y;
 
        hp = 4;
 
        pic = "images/navjiarr_guard".. index ..".png";
 
        shootHit = "Вы стреляете в стражника и попадаете в него. ";
 
        shootMiss = "Вы стреляете в стражника, но не попадаете в него. ";
 
        shootKill = "Вы стреляете в стражника и он падает замертво. ";
 
        handHit = "Вы ударяете стражника. ";
 
        handKill = "После вашего удара стражник падает. ";
 
        handFar = "Слишком далеко. ";
 
        hasSpear = spear;
 
        enemy = true;
 
        dsc = function(s)
 
            if (s.hp > 0) then
 
                if (s.hasSpear) then
 
                    return "{Стражник " .. tostring(index).. "} вооружен копьем готов к бою. ";
 
                else
 
                    return "{Стражник " .. tostring(index).. "} готов к бою. ";
 
                end;
 
            else
 
                return false;
 
            end;
 
        end;
 
        make_turn = function(s)
 
            local enemies = {  };
 
            for item=1,#here().obj do
 
                local obj = here().obj[item];
 
                if (obj.ally and obj.hp > 0) then
 
                    table.insert(enemies, obj);
 
                end;
 
            end;
 
            table.sort(enemies, function(a, b)
 
                return (here().getDistance(s.x, s.y, b.x, b.y) > here().getDistance(s.x, s.y, a.x, a.y));
 
            end);
 
            local enemy = enemies[1];
 
            local dist = 9000;
 
            if (not enemy) then
 
                enemy = pl;
 
                dist = here().getDistance(s.x, s.y, here().plX, here().plY);
 
            else
 
                dist = here().getDistance(s.x, s.y, enemy.x, enemy.y);
 
            end;
 
            
 
            if (dist > here().getDistance(s.x, s.y, here().plX, here().plY)) then
 
                enemy = pl;
 
            end;
 
            -- AI Order:
 
            -- If has spear and enemy is far   - throw spear
 
            -- If has spear and enemy is close - hit with spear
 
            -- if spear is nearer than any enemy - walk towards spear
 
            -- walk towards nearest enemy
 
            -- If enemy close and enemy has spear - take spear from enemy
 
            -- If enemy close and enemy doesn't have spear - hit with claws
 
            
 
            if (s.hasSpear and dist == 1) then
 
                if (rnd(4) > 1) then
 
                    pn("Стражник ".. tostring(index).. " бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
                    enemy.hp = enemy.hp - 2;
 
                else
 
                    pn("Стражник ".. tostring(index).. " бьет " .. enemy.disp2 .. " копьем, но промахивается. "); 
 
                end;
 
            elseif (s.hasSpear and dist == 0) then
 
                enemy.hp = enemy.hp - 2;
 
                pn("Стражник ".. tostring(index).. " бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
            elseif dist == 0 then
 
                enemy.hp = enemy.hp - 1;
 
                pn("Стражник ".. tostring(index).. " бьет " .. enemy.disp2 .. " и попадает. ");
 
            else
 
                if (enemy.x > s.x) then
 
                    s.x = s.x + 1;
 
                elseif (enemy.x < s.x) then
 
                    s.x = s.x - 1;
 
                end;
 
                
 
                if (enemy.y > s.y) then
 
                    s.y = s.y + 1;
 
                elseif (enemy.y < s.y) then
 
                    s.y = s.y - 1;
 
                end;
 
                
 
                pn("Стражник ".. tostring(index).. " идет к " .. enemy.disp3 .. ". ");
 
            end;
 
        end;
 
    };
 
end;
 

	
 
lse_cmbt_guard1 = lse_cmbt_guard("lse_cmbt_guard1", 1, 2, 2, false);
 
lse_cmbt_guard2 = lse_cmbt_guard("lse_cmbt_guard2", 2, 2, 3, true);
 
lse_cmbt_guard3 = lse_cmbt_guard("lse_cmbt_guard3", 3, 2, 4, false);
 
lse_cmbt_guard4 = lse_cmbt_guard("lse_cmbt_guard4", 4, 4, 2, false);
 
lse_cmbt_guard5 = lse_cmbt_guard("lse_cmbt_guard5", 5, 4, 3, true);
 
lse_cmbt_guard6 = lse_cmbt_guard("lse_cmbt_guard6", 6, 4, 4, false);
 
\ No newline at end of file
main.lua
Show inline comments
 
@@ -244,7 +244,7 @@ function init()
 
    put(item_colt, pl);
 
    --ven_shark.position = "55";
 
	--pl.where = "za_plaetlarr_fight";
 
    pl.where = "lse_sub_1";
 
    pl.where = "lse_prison_fight_intro";
 
    move(submarine_leviathan, "za_temple_back_entrance_foot");
 
    char_anna.follow = true;
 
    --pl.where = "ven_chest_look";
0 comments (0 inline, 0 general)