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 56 insertions and 3 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -82,49 +82,48 @@ battlefield = function(tab)
 
        end;
 
        
 
        if (make_turn) then
 
            make_turn(s);
 
        end;
 
        
 
        s:check_walk();
 
    end;
 
    
 
    tab.getDistance = _kh.bf_calcDistance;
 
    tab.getDirection = _kh.bf_calcDirection;
 
    
 
    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');
 
    table.insert(tab.obj, 'bf_wait');
 

	
 
    return room(tab);
 
end;
 

	
 
bf_north = obj {
 
    nam = "north",
 
    dsc = "{На север}",
 
    act = function(s)
 
        here().plY = here().plY - 1;
 
        p("Вы идете на север");
 
        here():make_turn();
items.lua
Show inline comments
 
@@ -19,90 +19,142 @@ item_pickaxe = obj {
 
		if (canhit) then
 
			if (o.onhit) then
 
				return(o.onhit(o));
 
			else
 
				return "";
 
			end;
 
		elseif (o.nohitmsg) then
 
			return o.nohitmsg;
 
		else
 
			return "Я не буду этого делать!";
 
		end;
 
	end;
 
};
 
 
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;
 
			return [[
 
				Как только кубик попадает в поле зрения стража, его плавник гаснет и ворота начинают медленно открываться. 
 
				Через несколько минут они застывают в открытом состоянии. Теперь ничто не мешает вашему проходу.
 
			]];
 
		end;
 
	end
 
};
 
 
item_service_info = obj {
 
	nam = "service_info";
 
	disp = "Схема города";
 
	inv = [[
journey_zayslanotrr.lua
Show inline comments
 
@@ -75,48 +75,49 @@ za_plaetlarr_fight = battlefield {
 
        'za_cmbt_guard4'
 
    };
 
};
 
 
 
za_cmbt_phaetlarr = combatant {
 
    nam = "za_cmbt_phaetlarr";
 
    x = 3;
 
    y = 5;
 
    pic = "images/phaetlarr.png";
 
    ally = "Я не буду атаковать союзника.";
 
    nohit = "Я не буду атаковать союзника.";
 
    noshoot = "Я не буду атаковать союзника.";
 
    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 [[
 
                Моя {здеся}.
 
            ]];
 
        end;
 
        make_turn = function(s)
 
            if (s.hp <= 0) then
 
                s:disable();
 
            end;
 
            p("staring madly");
 
        end;
 
    };
 
end;
 

	
main.lua
Show inline comments
 
@@ -201,48 +201,49 @@ function init()
 
	leviathan_wardroom.has_light = true;
 
	leviathan_wheelhouse.has_light = true;
 
	leviathan_corridor.has_light = true;
 
	leviathan_cabin_1.has_light = true;
 
	leviathan_cabin_2.has_light = true;
 
	leviathan_cabin_3.has_light = true;
 
	leviathan_cabin_4.has_light = true;
 
	leviathan_cabin_5.has_light = true;
 
	leviathan_captains_cabin.has_light = true;
 
	leviathan_cargo_hold.has_light = true;
 
	leviathan_engines.has_light = true;
 
	leviathan_lower_deck.has_light = true;
 
	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);
 
	-- put(item_pump_details, pl);
 
	-- put(item_electrodes, pl);
 
	--put(item_lamp, pl);
 
	-- pl.where = aurora_borealis;
 
	-- move(submarine_leviathan, first_city_entrance);
 
	-- move(submarine_leviathan, first_city_outer_east);
 
	-- walk(final_scene);
 
	-- walk(leviathan_wardroom);
 
	-- walk(leviathan_wardroom);
 
	-- put("char_learr", "leviathan_wardroom");
 
	-- put("char_phaetlarr", "leviathan_engines");
 
	-- put("char_radcliffe", "leviathan_engines");
0 comments (0 inline, 0 general)