Changeset - d8e9f9dc841a
[Not reviewed]
default
0 4 0
Silverwing - 8 years ago 2016-10-02 18:35:36

Some combat additions
4 files changed with 55 insertions and 2 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -94,25 +94,24 @@ battlefield = function(tab)
 
    if (not tab.obj) then
 
        tab.obj = {};
 
    end;
 
    
 
    if (not tab.pic) then
 
        tab.pic = function(s)
 
            local v = "images/battle_bcg.png;images/player.png@" .. tostring(s.plX * 32 - 32) .. "," .. tostring(s.plY * 32 - 32);
 
            for i = 1, #s.obj do
 
                if (not(s.obj[i]:disabled()) and s.obj[i].pic and s.obj[i].x and s.obj[i].y) then
 
                    v = v .. ";" .. s.obj[i].pic .. "@" .. tostring(s.obj[i].x * 32 - 32) .. "," .. tostring(s.obj[i].y * 32 - 32);
 
                end;
 
            end;
 
            print(v);
 
            return v;
 
        end;
 
    end;
 
    
 
    table.insert(tab.obj, 'bf_north');
 
    table.insert(tab.obj, 'bf_northeast');
 
    table.insert(tab.obj, 'bf_east');
 
    table.insert(tab.obj, 'bf_southeast');
 
    table.insert(tab.obj, 'bf_south');
 
    table.insert(tab.obj, 'bf_southwest');
 
    table.insert(tab.obj, 'bf_west');
 
    table.insert(tab.obj, 'bf_northwest');
items.lua
Show inline comments
 
@@ -31,66 +31,118 @@ item_pickaxe = obj {
 
};
 
 
item_colt = obj {
 
	nam = "colt";
 
	bullets = 6;
 
	disp = function(s)
 
		return "Кольт (" .. tostring(s.bullets) .. " зарядов)";
 
	end;
 
	dsc = [[
 
		Ваш револьвер. Надежное оружие в хорошем состоянии. Оно еще не раз спасет вашу жизнь. У вас также есть небольшой запас патронов к нему.
 
	]];
 
	use = function(s, o)
 
        if (here().underwater) then
 
            return "Под водой это вам не поможет. ";
 
        end;
 
    
 
		if (s.bullets == 0) then
 
			return "Нужно перезарядиться, патроны кончились";
 
		end;
 
		
 
		local canshoot = false;
 
		if (type(o.canshoot) == "function") then
 
			canshoot = 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		
 
			end;
 
		elseif (o.noshootmsg) then
 
			return o.noshootmsg;
 
		else
 
			return "Я не буду этого делать!";
 
		end;
 
	end;
 
	inv = function(s)
 
		if (s.bullets > 0) then
 
			return [[
 
				Ваш револьвер. Надежное оружие в хорошем состоянии. Оно еще не раз спасет вашу жизнь. У вас также есть небольшой запас патронов к нему.
 
			]];
 
		else
 
			s.bullets = 6;
 
			return [[
 
				Вы перезаряжаете ваш револьвер и оружие снова готово к бою
 
			]];
 
		end;
 
	end;
 
};
 
 
item_harpoon = obj {
 
    nam = "item_harpoon";
 
    charge = 1;
 
    disp = function(s)
 
        if (s.charge == 0) then
 
            return "Гарпунное ружье (разряжено)";
 
        else
 
            return "Гарпунное ружье (заряжено)";
 
        end;
 
    end;
 
    dsc = [[
 
    
 
    ]];
 
    use = function(s, o)
 
        if (s.charge == 0) then
 
            return "Ружье не заряжено. ";
 
        end;
 
        
 
        local canshoot = false;
 
        if (type(o.canshoot) == "function") then
 
            canshoot = o.canshoot(o);
 
        else
 
            canshoot = o.canshoot;
 
        end;
 
        
 
        if (canshoot) then
 
            s.charge = s.charge - 1;
 
            p("Вы стреляете в "..o.disp2 .. ". ");
 
            if (o.onshoot) then
 
                return(o.onshoot(o));
 
            else
 
                return "";
 
            end;
 
        elseif (o.noshootmsg) then
 
            return o.noshootmsg;
 
        else
 
            return "Я не буду этого делать!";
 
        end;
 
    end;
 
    inv = function(s)
 
        if (s.charge > 0) then
 
            return [[
 
                Пневматическое ружье с Левиафана. Стреляет гарпунами. Также у вас есть несколько запасных гарпунов с собой.
 
            ]];
 
        else
 
            s.charge = 1;
 
            return [[
 
                Вы заряжаете ружье. 
 
            ]];
 
        end;
 
    end;
 
};
 
 
item_first_city_key = obj {
 
	nam = "first_city_key";
 
	disp = "Ключ от города";
 
	inv = [[
 
		Небольшой светящийся кубик со стороной около 2-х сантиметров. Он плавно меняет цвета: синий, зеленый, желтый, белый, красный, черный.
 
	]];
 
	use = function(s, o)
 
		if (o == char_first_city_guardian) then 
 
			objs("first_city_entrance"):enable("first_city_first_gate");
 
			first_city_entrance.open = true;
journey_zayslanotrr.lua
Show inline comments
 
@@ -87,24 +87,25 @@ za_cmbt_phaetlarr = combatant {
 
    hp = 10;
 
    make_turn = function(s)
 
        p("socking socks");
 
    end;
 
    dsc = function(s)
 
        return [[ Моя {тут}. ]];
 
    end;
 
};
 

	
 
za_cmbt_guard = function(nam, x, y) 
 
    return combatant {
 
        nam = nam;
 
        disp2 = "стражника";
 
        x = x;
 
        y = y;
 
        hp = 8;
 
        pic = "images/navjiarr_guard.png";
 
        shootHit = "Вы стреляете в стражника и попадаете в него. ";
 
        shootMiss = "Вы стреляете в стражника, но не попадаете в него. ";
 
        shootKill = "Вы стреляете в стражника и он падает замертво. ";
 
        handHit = "Вы ударяете стражника. ";
 
        handKill = "После вашего удара стражник падает. ";
 
        handFar = "Слишком далеко. ";
 
        dsc = function(s)
 
            return [[
main.lua
Show inline comments
 
@@ -213,24 +213,25 @@ function init()
 
	leviathan_life_support.has_light = true;
 
	
 
	pl.party = {'wright'};
 
	put(item_toolbox, pl);
 
	put(item_ducttape, pl);
 
	pl.where = "leviathan_airlock";
 
	atlantis_found = true;
 
	move(submarine_leviathan, "atl_aqua_leviathan_dock");
 
    submarine_leviathan:enable();   
 
    	   
 
    --ven_temple_l1.position = "66";   
 
    put(item_ven_tablet, pl);
 
    put(item_harpoon, pl);
 
    --ven_shark.position = "55";
 
	pl.where = "za_plaetlarr_fight";
 
    move(submarine_leviathan, "ven_center");
 
    --pl.where = "ven_chest_look";
 
    --move(ven_shark, "ven_temple_l1");
 
    
 
	--put(item_suit, pl);
 
	
 
	-- pl.where = warehouse_32;
 
	-- pl.where = w32_mgr;
 
	
 
	-- put(item_cogs, pl);
0 comments (0 inline, 0 general)