Changeset - ca3c0c1459c1
[Not reviewed]
default
0 1 0
silverwing - 7 years ago 2017-09-09 09:25:23

tweak: random tweaked
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
london_dice.lua
Show inline comments
 
@@ -63,49 +63,49 @@ dice_game = room {
 
            elseif s.player_pts >= 100 then
 
                walk(s.win);
 
            else
 
                walk(s.lose);
 
            end;
 
            return;
 
        end;
 
        s.state = 1;
 
        s.current_pts = 0;
 
        game.timer = s.make_enemy_turn;
 
        timer:set(2500);
 
        dg_roll:disable();
 
        dg_pass:disable();
 
    end;
 
    make_enemy_turn = function()
 
        local s = dice_game;
 
        local pl = rnd(6);
 
        pr [[Соперник бросает кости. ]];
 
        pr([[Результат броска: ]] .. tostring(pl) .. [[.^]]);
 
        if pl == 1 then
 
            pr [[Ваш соперник теряет ход. ]];
 
            s:player_turn();
 
        else
 
            s.current_pts = s.current_pts + pl;
 
            local r = rnd(20);
 
            local r = rnd(10);
 
            if r == 1 then
 
                s.enemy_pts = s.enemy_pts + s.current_pts;
 
                pr [[Соперник передает вам ход. ]];
 
                s:player_turn();
 
            elseif r == 2 then
 
                pr [[Соперник продолжает игру. ]];
 
            elseif s.enemy_pts > s.player_pts then
 
                if s.enemy_pts + s.current_pts >= 100 then
 
                    s.enemy_pts = s.enemy_pts + s.current_pts;
 
                    pr [[Соперник передает вам ход. ]];
 
                    s:player_turn();
 
                else
 
                    pr [[Соперник продолжает игру. ]];
 
                end;
 
            else
 
                if s.enemy_pts + s.current_pts >= s.player_pts then
 
                    s.enemy_pts = s.enemy_pts + s.current_pts;
 
                    pr [[Соперник передает вам ход. ]];
 
                    s:player_turn();
 
                else
 
                    pr [[Соперник продолжает игру. ]];
 
                end;
 
            end;
 
        end;
0 comments (0 inline, 0 general)