Changeset - 5dfd4e336063
[Not reviewed]
default
0 4 0
Silverwing - 7 years ago 2017-01-08 14:07:56

Minor changes
4 files changed with 101 insertions and 14 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -288,6 +288,14 @@ battlefield = function(tab)
 
    tab.getShootDistance = _kh.bf_calcShootDistance;
 
    tab.getDirection = _kh.bf_calcDirection;
 
    
 
    if not tab.wall then
 
        tab.wall = "images/battle_wall.png";
 
    end;
 

	
 
    if not tab.obstacle then
 
        tab.obstacle = "images/battle_obstacle.png";
 
    end;
 

	
 
    if (not tab.obj) then
 
        tab.obj = {};
 
    end;
 
@@ -304,9 +312,9 @@ battlefield = function(tab)
 
            for i = 1, 7 do
 
                for j = 1, 7 do
 
                    if (tab.map[i][j] == 2) then
 
                        v = v.. ";images/battle_wall.png@" .. tostring(j * 32 - 32) .. "," .. tostring(i * 32 - 32);
 
                        v = v.. ";" .. tab.wall .. "@" .. tostring(j * 32 - 32) .. "," .. tostring(i * 32 - 32);
 
                    elseif (tab.map[i][j] == 1) then
 
                        v = v.. ";images/battle_obstacle.png@" .. tostring(j * 32 - 32) .. "," .. tostring(i * 32 - 32);
 
                        v = v.. ";" .. tab.obstacle .. "@" .. tostring(j * 32 - 32) .. "," .. tostring(i * 32 - 32);
 
                    end;
 
                end;
 
            end;
journey_zayslanotrr.lua
Show inline comments
 
@@ -1166,9 +1166,7 @@ za_deadend_7 = za_deadend {
 
    };
 
};
 

	
 
za_phaetlarr_fight_intro = cutscene("za_phaetlarr_fight_intro_a", "Заисланотр, улица",[[
 
    Конвой замечает вас и переходит в атаку. Внезапно пленник выхватывает копье у одного из стражников и бросается в бой. 
 
]], za_plaetlarr_fight );
 
za_phaetlarr_fight_intro = cutscene("za_phaetlarr_fight_intro_a", "Заисланотр, улица",[[Конвой замечает вас и переходит в атаку. Внезапно пленник выхватывает копье у одного из стражников и бросается в бой. ]], "za_plaetlarr_fight");
 

	
 
za_plaetlarr_victory = cutscene("za_phaetlarr_victory", "Заисланотр, улица", function(s)
 
    if (char_learr.follow) then
 
@@ -1196,8 +1194,18 @@ end, "za_phaetlarr_dlg");
 

	
 
za_plaetlarr_fight = battlefield {
 
    nam = "Заисланотр, улица";
 
    plX = 3;
 
    plX = 4;
 
    plY = 1;
 
    map = {
 
        {2,0,0,0,0,0,2};
 
        {2,0,0,0,0,0,2};
 
        {2,1,0,0,0,0,2};
 
        {2,0,0,0,0,1,2};
 
        {2,0,0,0,0,0,2};
 
        {2,0,0,0,0,0,2};
 
        {2,0,0,0,0,0,2};
 
    };
 
    obstacle = "images/stones.png";
 
    lose = "game_over_za_fight";
 
    win = "za_plaetlarr_victory";
 
    underwater = true;
 
@@ -1230,8 +1238,8 @@ za_cmbt_phaetlarr = combatant {
 
    nam = "za_cmbt_phaetlarr";
 
    disp2 = "Фаэтларра";
 
    disp3 = "Фаэтларру";
 
    x = 3;
 
    y = 4;
 
    x = 4;
 
    y = 6;
 
    pic = "images/phaetlarr.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
@@ -1243,6 +1251,78 @@ za_cmbt_phaetlarr = combatant {
 
        for item=1,#here().obj do
 
            local obj = here().obj[item];
 
            if (obj.enemy and obj.hp > 0) then
 
                local p = here():getWalkDistance(s.x, s.y, obj.x, obj.y);
 
                if (p) then
 
                    table.insert(enemies, {
 
                        o = obj,
 
                        p = p
 
                    });
 
                end;
 
            end;
 
        end;
 
        if (#enemies == 0) then
 
            pn("Фаэтларр ждет. ");
 
            return;
 
        end;
 
        table.sort(enemies, function(a, b)
 
            return (a.p.l < b.p.l);
 
        end);
 
        local enemy = enemies[1].o;
 
        local path = enemies[1].p;
 
        -- 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 then
 
            here():canShoot(s.x, s.y, enemy.x, enemy.y);
 

	
 
            if (math.abs(s.x - enemy.x) + math.abs(s.y - enemy.y) <= 2 and here():canShoot(s.x,s.y, enemy.x, enemy.y)) then
 
                --50%
 
                if (rnd(2) > 1) then
 
                    enemy.hp = enemy.hp - 2;
 
                    pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
                else
 
                    pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем, но промахивается. ");
 
                end;
 
            elseif  (math.abs(s.x - enemy.x) == 1 and math.abs(s.y - enemy.y) == 1) then
 
                --75%
 
                if (rnd(4) > 1) then
 
                    enemy.hp = enemy.hp - 2;
 
                    pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
                else
 
                    pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем, но промахивается. ");
 
                end;
 
            else
 
                --100%
 
                enemy.hp = enemy.hp - 2;
 
                pn("Фаэтларр бьет " .. enemy.disp2 .. " копьем и попадает. ");
 
            end;
 
            return;
 
        else
 
            if (math.abs(s.x - enemy.x) == 1 and s.y == enemy.y or
 
                s.x == enemy.x and math.abs(s.y - enemy.y) == 1) then
 
                enemy.hp = enemy.hp - 1;
 
                pn("Фаэтларр бьет " .. enemy.disp2 .. " и попадает. ");
 
                return;
 
            end;
 
        end;
 
        
 
        s.x = path.p[2][1];
 
        s.y = path.p[2][2];
 
        pn("Фаэтларр идет к " .. enemy.disp3 .. ". ");
 

	
 
        if (true) then
 
            return;
 
        end;
 

	
 
        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;
 
@@ -1319,7 +1399,7 @@ za_cmbt_learr = combatant {
 
    nam = "za_cmbt_learr";
 
    disp2 = "Леарр";
 
    disp3 = "Леарр";
 
    x = 4;
 
    x = 5;
 
    y = 1;
 
    pic = "images/learr.png";
 
    ally = "Я не буду атаковать союзника.";
 
@@ -1393,7 +1473,7 @@ za_cmbt_wright = combatant {
 
    nam = "za_cmbt_wright";
 
    disp2 = "Райта";
 
    disp3 = "Райту";
 
    x = 4;
 
    x = 5;
 
    y = 1;
 
    pic = "images/jack.png";
 
    ally = "Я не буду атаковать союзника.";
 
@@ -1472,7 +1552,7 @@ za_cmbt_radcliffe = combatant {
 
    nam = "za_cmbt_radcliffe";
 
    disp2 = "Рэклиффа";
 
    disp3 = "Рэдклиффу";
 
    x = 4;
 
    x = 5;
 
    y = 1;
 
    pic = "images/walter.png";
 
    ally = "Я не буду атаковать союзника.";
 
@@ -1551,7 +1631,7 @@ za_cmbt_anna = combatant {
 
    nam = "za_cmbt_anna";
 
    disp2 = "Анну";
 
    disp3 = "Анне";
 
    x = 4;
 
    x = 5;
 
    y = 1;
 
    pic = "images/anna.png";
 
    ally = "Я не буду атаковать союзника.";
lseryanotrr_locations.lua
Show inline comments
 
@@ -577,7 +577,6 @@ lse_prison_fight = battlefield {
 
        pl = player_drake;
 
    end;
 
    make_turn = function(s)
 
        print("pev", here().plX, here().plY);
 
        if (not have(item_colt, pl) and here().plX == 2 and here().plY == 6) then
 
            p([[Вы подбираете револьвер, брошенный Фаэтларром. ]]);
 
            take(item_colt);
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_prison_fight_intro";
 
    pl.where = "za_phaetlarr_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)