Changeset - 17800a282d09
[Not reviewed]
default
0 1 0
Silverwing - 4 years ago 2020-05-05 12:39:30

fix: kraken battle multiple fixes
1 file changed with 29 insertions and 12 deletions:
0 comments (0 inline, 0 general)
journey_temple.lua
Show inline comments
 
@@ -1037,7 +1037,7 @@ dt_fight = room {
 
            {hp=200, dir=4, away = 0 };
 
        };
 
    };
 

	
 
    hideinv = true;
 
    positions = {
 
        {80, 0},
 
        {160, 0},
 
@@ -1131,7 +1131,17 @@ dt_fight = room {
 
        if (bl < 0) then
 
            bl = bl + 8;
 
        end;
 
        pr [[Щупальца кракена тянутся к Левиафану. ]];
 
        local cnt = 0;
 
        for i = 1, #s.tentacles do 
 
            if (s.tentacles[i].hp > 0 and s.tentacles[i].away == 0) then
 
                cnt = cnt + 1;
 
            end;
 
        end;
 
        if cnt > 0 then
 
            pr [[Щупальца кракена тянутся к Левиафану. ]];
 
        else
 
            pr [[Кракен выжидает момента для нападения. ]];
 
        end;
 
        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]) .. [[ находится прямо перед субмариной. ]]);
 
@@ -1173,7 +1183,7 @@ dt_fight = room {
 
            end;
 
        end;
 
    end;
 
    maketurn = function(s)
 
    maketurn = function(s, anydir)
 
        local dcnt = 0;
 
        if (s.has_shot) then
 
            local f = s.dir;
 
@@ -1212,13 +1222,16 @@ dt_fight = room {
 
                    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 = {};
 
                            local dirs = {fl, f, fr};
 
                            if anydir then
 
                                dirs = {};
 
                            end;
 
                            for j = 1, #s.tentacles do 
 
                                if (s.tentacles[j].hp > 0 and s.tentacles[j].away == 0) then
 
                                if (s.tentacles[j].hp > 0 and s.tentacles[j].away == 0 and j ~= i) then
 
                                    table.insert(dirs, s.tentacles[j].dir);
 
                                end;
 
                            end;
 
                            
 
                            local newdir;
 
                            repeat 
 
                                newdir = rnd(8) - 1;
 
@@ -1231,6 +1244,8 @@ dt_fight = room {
 
                                pr [[Раненое щупальце ]];
 
                            elseif (s.tentacles[i].hp < 200) then
 
                                pr [[Легко раненое щупальце ]];
 
                            else
 
                                pr [[Щупальце ]];
 
                            end;
 
                            if (newdir == f) then
 
                                pr [[подтягивается спереди. ]];
 
@@ -1253,7 +1268,7 @@ dt_fight = room {
 
                    else
 
                        --TODO hit leviathan or hide up
 
                        if (rnd(8) > 1) then
 
                            submarine_leviathan.hull_integrity = submarine_leviathan.hull_integrity - 5;
 
                            submarine_leviathan.hull_integrity = submarine_leviathan.hull_integrity - 4;
 
                            pr [[Кракен ударяет Левиафан щупальцем. ]];
 
                        else
 
                            s.tentacles[i].away = 1;
 
@@ -1265,8 +1280,12 @@ dt_fight = room {
 
                end;
 
            end;
 
        end;
 
        if (dcnt > 2) then
 
        if submarine_leviathan.hull_integrity <= 0 then
 
            walk("game_over_kraken");
 
            return;
 
        elseif (dcnt > 2) then
 
            walk("dt_kraken_victory");
 
            return;
 
        end;
 
        
 
        dt_f_rotate_ccw45:enable();
 
@@ -1291,9 +1310,7 @@ dt_fight = room {
 
            dt_f_sonic:disable();
 
        end;
 

	
 
        if submarine_leviathan.hull_integrity <= 0 then
 
            walk("game_over_kraken");
 
        elseif submarine_leviathan.hull_integrity <= 25 then
 
        if submarine_leviathan.hull_integrity <= 25 then
 
            pr [[Левиафан серьезно поврежден, целостность внешней обшивки нарушена. ]];
 
        elseif submarine_leviathan.hull_integrity <= 50 then
 
            pr [[Левиафан серьезно поврежден. ]];
 
@@ -1421,7 +1438,7 @@ dt_f_wait = obj {
 
    act = function(s)
 
        dt_fight.has_shot = true;
 
        dt_fight.rotation = 0;
 
        dt_fight:maketurn();
 
        dt_fight:maketurn(true);
 
        return true;
 
    end;
 
};
0 comments (0 inline, 0 general)