Changeset - 12dc77d6f1ec
[Not reviewed]
default
0 2 0
silverwing - 4 years ago 2019-11-24 12:01:34

Improve battle messaging
2 files changed with 21 insertions and 7 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -526,17 +526,26 @@ bf_wait = obj {
 
    end;
 
};
 

	
 
combatant = function(tab)
 
    if (tab.canshoot == nil) then
 
        tab.canshoot = function(s)
 
            if not here():canShoot(here().plX, here().plY, s.x, s.y) then
 
                return false, 'Вы не попадете в цель отсюда!';
 
            end;
 
            local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY));
 
            return dist < 6 and not tab.ally;
 

	
 
            if tab.ally then
 
                return false, nil;
 
            elseif dist >= 6 then
 
                return false, 'Цель слишком далеко!';
 
            end;
 
            return true;
 
        end;
 
    end;
 
    
 

	
 
    if (tab.onthrust == nil) then
 
        tab.onthrust = function(s)
 
            local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY));
 
            if (rnd(4) > dist - 2) then
 
                tab.hp = tab.hp - 2;
 
                if (tab.hp > 0) then
items.lua
Show inline comments
 
@@ -407,13 +407,13 @@ item_spear = obj {
 
            else
 
                return "";
 
            end;
 
        elseif (o.nohitmsg) then
 
            return o.nohitmsg;
 
        else
 
            return "Я не буду этого делать!";
 
            return "Фаэтларр не станет этого делать!";
 
        end;
 
    end;
 
};
 
 
item_colt = obj {
 
    var {
 
@@ -433,31 +433,33 @@ item_colt = obj {
 
		if (s.bullets == 0) then
 
			return "Нужно перезарядиться, патроны кончились";
 
		end;
 
		
 
		local canshoot = false;
 
		if (type(o.canshoot) == "function") then
 
			canshoot = o.canshoot(o);
 
			canshoot, noshootmsg = o.canshoot(o);
 
		else
 
			canshoot = o.canshoot;
 
		end;
 
		
 
		if (canshoot) then
 
			s.bullets = s.bullets - 1;
 
			p("Вы стреляете в "..o.disp2 .. ". ");
 
			if (o.onshoot) then
 
				return(o.onshoot(o));
 
			else
 
				return "";
 
			end;
 
        elseif noshootmsg then
 
            return noshootmsg;
 
		elseif o.noshootsilent then
 
			return
 
		elseif o.noshootmsg then
 
			return o.noshootmsg;
 
		else
 
			return "Я не буду этого делать!";
 
			return "Не стоит этого делать!";
 
		end;
 
	end;
 
	inv = function(s)
 
		if (s.bullets == 6) then
 
			return [[Ваш револьвер. Надежное оружие в хорошем состоянии. Оно еще не раз спасет вашу жизнь. У вас также есть небольшой запас патронов к нему. ]];
 
		else
 
@@ -484,13 +486,14 @@ item_harpoon = obj {
 
    end;
 
    dsc = [[К стене прислонено {гарпунное ружье}. ]];
 
    tak = "Вы забираете ружье. ";
 
    use = function(s, o)
 
        local canshoot = false;
 
        if (type(o.canshoot) == "function") then
 
            canshoot = o:canshoot();
 
            canshoot, noshootmsg = o:canshoot();
 
            print(canshoot, noshootmsg);
 
        else
 
            canshoot = o.canshoot;
 
        end;
 
        
 
        local canthrust = false;
 
        if (type(o.canthrust) == "function") then
 
@@ -515,18 +518,20 @@ item_harpoon = obj {
 
            p("Вы стреляете в "..o.disp2 .. ". ");
 
            if (o.onshoot) then
 
                return(o.onshoot(o));
 
            else
 
                return "";
 
            end;
 
        elseif noshootmsg then
 
            return noshootmsg;
 
		elseif o.noshootsilent then
 
			return
 
        elseif (o.noshootmsg) then
 
            return o.noshootmsg;
 
        else
 
            return "Я не буду этого делать!";
 
            return "Не стоит этого делать!";
 
        end;
 
    end;
 
    inv = function(s)
 
        if (s.charge > 0) then
 
            return [[Пневматическое ружье с Левиафана. Стреляет гарпунами. Также у вас есть несколько запасных гарпунов с собой. ]];
 
        else
0 comments (0 inline, 0 general)