Changeset - c702bda21be3
[Not reviewed]
default
0 1 0
silverwing - 4 years ago 2019-11-24 06:14:34

Aedhyarr will shoot the player
1 file changed with 20 insertions and 45 deletions:
0 comments (0 inline, 0 general)
lse_final_battle.lua
Show inline comments
 
@@ -743,52 +743,27 @@ lse_aedhyarr = combatant {
 
        if here() ~= lse_final_battle then
 
            return
 
        end;
 

	
 
        -- Аэдхиарр будет пытаться всеми силами париблизиться к игроку на расстояние выстрела и не будет отступать. 
 
        local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY));
 
        if (dist < 6) then
 
            if (dist < 4) then
 
                -- try to run away
 
                local x = s.x;
 
                local y = s.y;
 
                if (math.abs(x - pl.x) > math.abs(y - pl.y)) then
 
                    if (x > pl.x) then
 
                        x = x + 1;
 
                    else
 
                        x = x - 1;
 
                    end;
 
                elseif (math.abs(x - pl.x) < math.abs(y - pl.y)) then
 
                    if (y > pl.y) then
 
                        y = y + 1;
 
                    else
 
                        y = y - 1;
 
                    end;
 
                else
 
                    if (rnd(2) > 1) then
 
                        if (here():isPassable(x, y + 1)) then
 
                            y = y + 1;
 
                        else
 
                            x = x + 1;
 
                        end;
 
                    else
 
                        if (here():isPassable(x + 1, y)) then
 
                            x = x + 1;
 
                        else
 
                            y = y + 1;
 
                        end;
 
                    end;
 
                end;
 
                if (here():isPassable(x, y)) then
 
                    s.x = x;
 
                    s.y = y;
 
                    p("Уильям Дрейк отступает. ");
 
                else
 
                    p("Уильям Дрейк ждет. ");
 
                end;
 
        if (dist < 4 and here():canShoot(s.x, s.y, here().plX, here().plY)) then
 
            -- shoot
 
            if (rnd(2) > dist - 2) then
 
                pl.hp = pl.hp - 1;
 
                p("Аэдхиарр стреляет в вас и попадает. ");
 
            else
 
                p("Уильям Дрейк ждет. ");
 
                p("Аэдхиарр стреляет в вас, но промахивается. ");
 
            end;
 
        else 
 
            p("Уильям Дрейк ждет. ");
 
        else
 
            local path = here():getWalkDistance(s.x, s.y, pl.x, pl.y);
 

	
 
            if path then
 
                s.x = path.p[2][1];
 
                s.y = path.p[2][2];
 

	
 
                p("Аэдхиарр приближается к вам. ");
 
            else
 
                p("Аэдхиарр ждет. ");
 
            end;
 
        end;
 
end;
 
};
 
@@ -820,10 +795,10 @@ final_battle_over_2 = room {
 
    disp = 'Лсэрианотр, зал Наэтвьирра';
 
    dsc = [[Центральный зал ярко освещен исходящим из стен светом. По периметру зала установлены массивные металлические шкафы. По полу протянуты толстые провода, соединяющие их со статуей в центре зала. Металлическая статуя изображает навьяра, сидящего на троне. Рядом с троном стоят два пилона, высотой около метра. ]];
 
    entered = function(s) 
 
        s:lifeon();
 
        lifeon(s);
 
    end;
 
    left = function(s)
 
        s:lifeoff();
 
        lifeoff(s);
 
    end;
 
    life = function(s)
 
        s.frames = s.frames - 1;
0 comments (0 inline, 0 general)