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
 
_kh.bf_calcDistance = function(x1, y1, x2, y2)
 
    return math.max(math.abs(x2 - x1), math.abs(y2 - y1));
 
end;
 

	
 
_kh.bf_calcDirection = function(x1, y1, x2, y2)
 
    -- 0 - close by, 1-8 - north to north-west clockwise, 9 - too far
 
    local dist = _kh.bf_calcDistance(x1,y1,x2,y2);
 
    if (dist == 0) then
 
        return 0;
 
    elseif (dist == 1) then
 
        if (x1 == x2 and y1 > y2) then
 
            return 1;
 
        elseif (x1 < x2 and y1 > y2) then
 
            return 2;
 
        elseif (x1 < x2 and y1 == y2) then
 
            return 3;
 
        elseif (x1 < x2 and y1 < y2) then
 
            return 4;
 
        elseif (x1 == x2 and y1 < y2) then
 
            return 5;
 
        elseif (x1 > x2 and y1 < y2) then
 
            return 6;
 
        elseif (x1 > x2 and y1 == y2) then
 
            return 7;
 
        elseif (x1 > x2 and y1 > y2) then
 
            return 8;
 
        end;
 
    else
 
        return 9;
 
    end;
 
end;
 

	
 
battlefield = function(tab)
 
    local make_turn = tab.make_turn;
 
    tab.check_walk = function(s)
 
        bf_north:enable();
 
        bf_northeast:enable();
 
        bf_east:enable();
 
        bf_southeast:enable();
 
        bf_south:enable();
 
        bf_southwest:enable();
 
        bf_west:enable();
 
        bf_northwest:enable();
 
        
 
        if (s.plY == 1) then
 
            bf_north:disable();
 
            bf_northeast:disable();
 
            bf_northwest:disable();
 
        elseif (s.plY == 5) then
 
            bf_south:disable();
 
            bf_southeast:disable();
 
            bf_southwest:disable();
 
        end;
 
        
 
        if (s.plX == 1) then
 
            bf_west:disable();
 
            bf_southwest:disable();
 
            bf_northwest:disable();
 
        elseif (s.plX == 5) then
 
            bf_east:disable();
 
            bf_southeast:disable();
 
            bf_northeast:disable();
 
        end;
 
    end;
 
    
 
    local entered = tab.entered;
 
    
 
    tab.entered = function(s)
 
        s:check_walk();
 
        if (type(entered) == 'function') then
 
            entered(s);
 
        else
 
            return entered;
 
        end;
 
    end;
 
    
 
    tab.make_turn = function(s)
 
        for i = 1, #s.obj do
 
            if (type(s.obj[i].make_turn) == 'function') then
 
                s.obj[i]:make_turn();
 
            end;
 
        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();
 
    end;
 
};
 

	
 
bf_northeast = obj {
 
    nam = "northeast",
 
    dsc = "{На северо-восток}",
 
    act = function(s)
 
        here().plX = here().plX + 1;
 
        here().plY = here().plY - 1;
 
        p("Вы идете на северо-восток.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_east = obj {
 
    nam = "east",
 
    dsc = "{На восток}",
 
    act = function(s)
 
        here().plX = here().plX + 1;
 
        p("Вы идете на восток.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_southeast = obj {
 
    nam = "southeast",
 
    dsc = "{На юго-восток}",
 
    act = function(s)
 
        here().plX = here().plX + 1;
 
        here().plY = here().plY + 1;
 
        p("Вы идете на юго-восток.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_south = obj {
 
    nam = "south",
 
    dsc = "{На юг}",
 
    act = function(s)
 
        here().plY = here().plY + 1;
 
        p("Вы идете на юг.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_southwest = obj {
 
    nam = "southwest",
 
    dsc = "{На юго-запад}",
 
    act = function(s)
 
        here().plX = here().plX - 1;
 
        here().plY = here().plY + 1;
 
        p("Вы идете на юго-запад.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_west = obj {
 
    nam = "west",
 
    dsc = "{На запад}",
 
    act = function(s)
 
        here().plX = here().plX - 1;
 
        p("Вы идете на запад.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_northwest = obj {
 
    nam = "northwest",
 
    dsc = "{На северо-запад}",
 
    act = function(s)
 
        here().plX = here().plX - 1;
 
        here().plY = here().plY - 1;
 
        p("Вы идете на северо-запад.");
 
        here():make_turn();
 
    end;
 
};
 

	
 
bf_wait = obj {
 
    nam = "wait",
 
    dsc = "{Ждать}",
 
    act = function(s)
 
        p("Вы ждете");
 
        here():make_turn();
 
    end;
 
};
 

	
 
combatant = function(tab)
 
    tab.canshoot = function(s)
 
        local dist = here().getDistance(here().plX, here().plY, s.x, s.y);
 
        return dist < 4 and not tab.ally;
 
    end;
 
    
 
    tab.onshoot = function(s)
 
        local dist = here().getDistance(here().plX, here().plY, s.x, s.y);
 
        
 
        if (rnd(4) > dist) then
 
            if (dist == 0) then
 
                tab.hp = tab.hp - 2;
 
            end;
 
            
 
            tab.hp = tab.hp - 1;
 
            if (tab.hp > 0) then
 
                p(tab.shootHit);
 
            else
 
                p(tab.shootKill);
 
            end;
 
        else
 
            p(tab.shootMiss);
 
        end;
 
        
 
        here():make_turn();
 
    end;
 
    
 
    tab.canhit = function(s)
 
        local dist = here().getDistance(here().plX, here().plY, s.x, s.y);
 
        return dist == 0 and not tab.ally;
 
    end;
 
    
 
    
 
    tab.onhit = function(s)
 
        local dist = here().getDistance(here().plX, here().plY, s.x, s.y);
 
        if (dist == 0) then
 
            tab.hp = tab.hp - 2;
 
            if (tab.hp > 0) then
 
                p(tab.wpnHit);
 
            else
 
                p(tab.wpnKill);
 
            end;
 
            
 
            here():make_turn();
 
        else
 
            p(tab.wpnFar);
 
        end;
 
    end;
 
    
 
    if (not tab.act) then
 
        tab.act = function(s)
 
            if tab.ally then
 
                return tab.nohit;
 
            end;
 
            
 
            local dist = here().getDistance(here().plX, here().plY, s.x, s.y);
 
            
 
            if (dist == 0) then
 
                tab.hp = tab.hp - 1;
 
                if (tab.hp > 0) then
 
                    p(tab.handHit);
 
                else
 
                    p(tab.handKill);
 
                end;
 
                
 
                here():make_turn();
 
            else
 
                p(tab.handFar);
 
            end;
 
        end;
 
    end;
 
    if (not tab.make_turn) then
 
        tab.make_turn = function(s)
 
        end;
 
    end;
 
    
 
    return obj(tab);
 
end;
 
\ No newline at end of file
items.lua
Show inline comments
 
item_pickaxe = obj {
 
	nam = "pickaxe";
 
	disp = "Кирка";
 
	dsc = [[
 
		Ваше внимание привлекает предмет, похожий на {кирку}^^
 
	]];
 
	tak = [[
 
		Вы решили забрать кирку с собой, на всякий случай
 
	]];
 
	inv = "Хорошая годная кирка. Сделанная из неизвестного металла она хорошо перенесла тысячелетия в соленой воде атлантического океана.";
 
	use = function(s, o)
 
		local canhit = false;
 
		if (type(o.canhit) == "function") then
 
			canhit = o.canhit(o);
 
		else
 
			canhit = o.canhit;
 
		end;
 
		
 
		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 = [[
 
		Это "карта" сервисных тоннелей Лсэрианотра. Вы видите следующие последовательности символов, подписанные на языке навьяров
 
		Nol      
 
		Tei      
 
		Vlye'Tei 
 
		Elt'Dyle 
 
		Tei'Elt	 
 
		Tei'Tei  
 
	]];
 
};
 
 
item_umbrella = obj {
 
	nam = "umbrella";
 
	disp = "Зонт";
 
	inv = [[Совершенно новый зонт производства "Винсент и сыновья". ]];
 
};
 
 
--[[
 
	Chapter 1
 
]]
 
item_lamp = obj {
 
	nam = "lamp";
 
	disp = "Лампа";
 
	dsc = "На столе стоит {керосиновая лампа}. ";
 
	tak = "Вы забираете лампу с собой. ";
 
	inv = function(s)
 
		if (pl.where.nolamp) then
 
			return "Здесь не стоит зажигать лампу. ";
 
		end;
 
		if (pl.has_light) then
 
			pl.has_light = false;
 
			return "Вы гасите свет. ";
 
		else
 
			pl.has_light = true;
 
			return "Вы зажигаете лампу. ";
 
		end;
 
	end;
 
};
 
 
item_toolbox = obj {
 
	nam = "toolbox";
 
	disp = "Ящик с инструментами";
 
	dsc = [[
 
		Вы видите {ящик} со всевозможными полезными и не очень инструментами - отвертками, ключами, молотками и т.д.^
 
	]];
 
	tak = function(s)
 
		if (not char_worker.bought) then
 
			return [[ Рабочий огрызается на вас: _"Руки прочь!"_ ]], false;
 
		else
 
			return [[Вы забираете ящик с собой]], true;
 
		end;
 
	end;
 
	inv = [[
 
		Ящик со всевозможными полезными и не очень инструментами - отвертками, ключами, молотками и т.д.
 
	]];
 
};
 
 
item_money = obj {
 
	nam = "money";
 
	disp = function(s)
 
		if (pl.money == 0) then
 
			return "Пустой кошелек";
 
		else
 
			return s.money_format();
 
		end;
 
	end;
 
	inv = function(s)
 
		if (pl.money == 0) then
 
			return "Кошелек пуст";
 
		else
 
			return [[Кошелек с монетами различного достоинства на сумму ]] .. s.money_format();
 
		end;
 
	end;
 
	money_format = function()
 
		if (pl.money % 100 / 10 ~= 1 and pl.money % 10 == 1) then
 
			return tostring(pl.money) .. " шиллинг";
 
		elseif (pl.money % 100 / 10 ~= 1 and (pl.money % 10 == 2 or pl.money % 10 == 3 or pl.money % 10 == 4)) then
 
			return tostring(pl.money) .. " шиллинга";
 
		else 
 
			return tostring(pl.money) .. " шиллингов";
 
		end;
 
	end;
 
};
 
 
item_note_1 = obj {
 
	nam = "note1";
 
	disp = "Записка";
 
	inv = [[
 
		Небольшой клочок бумаги с адресом Майкла Райта в Лондоне. 
 
	]];
 
};
 
 
item_charts = obj {
 
	nam = "charts";
 
	disp = "Документы отца";
 
	dsc = [[
 
		На столе лежат {схемы складов и верфей} Вестхейвен Трансоушен
 
	]];
 
	inv = [[
 
		Схемы нескольких строений, принадлежавших компании отца. На некоторых схемах есть места отмечены жирными крестиками.
 
		Схемы с крестиками обозначены как склад 18, док 2, склад 32
 
	]];
 
	use = function(s, o)
 
		if (o == char_wright_home) then
 
			remove(s, pl);
 
			put(s, item_wright_table);
 
			char_wright_home.documents = true;
 
			return [[
 
				Вы отдаете бумаги Джеку. Он кладет их на стол и принимается изучать.
 
			]];
 
		end;
 
	end;
 
	tak = function()
 
		pn("Лучше оставить бумаги Джеку. Возможно он что-нибудь найдет. ");
 
		return false;
 
	end;
 
};
 
 
item_bottle = obj {
 
	nam = "item_bottle";
 
	disp = "Бутылка с пойлом";
 
	inv = [[
 
		Бутылка дешевого пойла. Вас воротит от одного запаха этой дряни. 
 
	]];
 
	use = function(s, o)
 
		if (o == char_worker) then
 
			remove(s, pl);
 
			char_worker.bought = true;
 
			pr([[
 
				Вы подходите к рабочему и, аккуратно доставая бутылку, спрашиваете: ^
 
				-- Выпить хочешь? ^
 
				-- Ага, -- удивленно и обрадованно восклицает рабочий, протягивая руки. ^
 
				-- Меняю на твой ящик с инструментами. ^
 
				-- Идет, -- отвечает рабочий, выхватывая из ваших рук заветную бутылку.
 
			]]);
 
		end;
 
	end;
 
};
 
 
item_pump_broken = obj {
 
	nam = "item_pump_broken";
 
	disp = "Насос";
 
	inv = [[
 
		Старый ручной насос. Рычаг сломан, делая его использование невозможным. 
 
	]];
 
};
 
 
item_pump = obj {
 
	nam = "item_pump";
 
	disp = "Насос";
 
	inv = [[
 
		Старый ручной насос. 
 
	]];
 
};
 
 
item_pump_details = obj {
 
	nam = "item_pump_details";
 
	disp = "Детали насоса";
 
	inv = [[
 
		Запчасти для насоса. 
 
	]];
 
	use = function(s, o)
 
		if (o == item_pump_broken) then
 
			remove(s, pl);
 
			remove(item_pump_broken, pl);
 
			put(item_pump, pl);
 
			return [[
 
				Вы починили насос. 
 
			]];
journey_zayslanotrr.lua
Show inline comments
 
za_gate_foot = room {
 
    nam = "Вход в Заисланотр";
 
    handwheel_room = "za_gate";
 
    underwater = true;
 
    no_exit = [[
 
        Нет смысла покидать Левиафан здесь. 
 
    ]];
 
    view = [[
 
        Через иллюминаторы вы видите перед собой высокие металлические ворота Заисланотра. С обеих сторон от них стоят две смотровые башни, на вершинах которых горят красные огоньки. 
 
    ]];
 
};
 

	
 
za_gate = dlg {
 
    var {
 
        state = 0;
 
    };
 
    nam = "Левиафан, рубка";
 
    entered = function(s)
 
        if (s.state == 0) then
 
            s.state = 1;
 
            if (ArrayUtils.indexOf(pl.party, 'learr') ~= 0) then
 
                psub("learr");
 
                return [[
 
                    Как только Левиафан приближается к городу, массивные металлические ворота начинают закрываться. Огни на башнях окрашиваются красным, а по всему городу начинается какое-то волнение. В рубку поднимается Леарр. Она встает рядом с вами и, окидывая взглядом город, произносит: "Мы туда-не-идем. Они не-пускают-нас".
 
                ]];
 
            else
 
                psub("anna");
 
                return [[
 
                    Как только Левиафан приближается к городу, массивные металлические ворота начинают закрываться. Огни на башнях окрашиваются красным, а по всему городу начинается какое-то волнение. В рубку поднимается Анна. Она встает рядом с вами и, окидывая взглядом город, произносит: "Кажется, нам здесь не рады".
 
                ]];
 
            end;
 
        else
 
            psub("control");
 
        end;
 
    end;
 
    phr = {
 
        {tag="learr"};
 
        {"[Остановить субмарину]И что нам делать?", [[
 
            Леарр пожимает плечами: "Мы незаметными-пройти-должны. Сильнее-они так-как много-их".
 
        ]], code [[ psub("control"); ]]};
 
        {"[Продолжать движение]Попробуем преподать им урок", code = [[ walk("game_over_za_learr"); ]]};
 
        {tag="anna"};
 
        {"[Остановить субмарину]И что нам делать?", [[
 
            Анна пожимает плечами: "Понятия не имею".
 
        ]], code [[ psub("control"); ]]};
 
        {"[Продолжать движение]Попробуем преподать им урок", code = [[ walk("game_over_za_anna"); ]]};
 
        {tag="control"};
 
        {"[Проплыть над воротами]", code = [[
 
            if (ArrayUtils.indexOf(pl.party, 'learr') ~= 0) then
 
                walk("game_over_za_learr");
 
            else
 
                walk("game_over_za_anna");
 
            end;
 
        ]]};
 
        {"[Двигаться вдоль стен]", ""};
 
        {"[Отправиться в другое место]", code = [[
 
            walk("leviathan_wheelhouse");
 
        ]]};
 
        {"[Отойти от штурвала]"};
 
    };
 
};
 

	
 
za_plaetlarr_fight = battlefield {
 
    nam = "Заисланотр, улица";
 
    plX = 3;
 
    plY = 1;
 
    entered = function(s)
 
        --TODO prepend player associate - anna, learr, walter or jack
 
    end;
 
    obj = {
 
        'za_cmbt_phaetlarr',
 
        'za_cmbt_guard1',
 
        'za_cmbt_guard2',
 
        'za_cmbt_guard3',
 
        '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;
 

	
 
za_cmbt_guard1 = za_cmbt_guard("za_cmbt_guard1", 1, 4);
 
za_cmbt_guard2 = za_cmbt_guard("za_cmbt_guard2", 2, 4);
 
za_cmbt_guard3 = za_cmbt_guard("za_cmbt_guard3", 4, 4);
 
za_cmbt_guard4 = za_cmbt_guard("za_cmbt_guard4", 5, 4);
main.lua
Show inline comments
 
@@ -33,222 +33,223 @@ dofile "atlantis_ignis_on_fire.lua"
 
dofile "atlantis_looking_for_clues.lua"
 
dofile "atlantis_from_the_ashes.lua"
 
dofile "atlantis_iyhehevjiarr.lua"
 
dofile "atlantis_catching_the_tail.lua"
 
-- Часть 3
 
dofile "journey_venaedanotrr.lua"
 
dofile "journey_zayslanotrr.lua"
 
-- Часть 4
 
dofile "final_scene.lua";
 
dofile "final_battle.lua";
 
dofile "first_city_inner_rim.lua"
 
dofile "first_city_middle_rim.lua"
 
dofile "first_city_outer_rim.lua"
 
 
global {
 
	warehouse18_found = false;
 
	warehouse32_found = false;
 
	dock_found = false;
 
	leviathan_discovered = false;
 
	atlantis_found = false;
 
	temple_found = false;
 
	nearest_cities_found = false;
 
	iraaphaanotrr_temple_found = false;
 
	dypatreanotrr_temple_found = false;
 
    venaedanotrr_temple_found = false;
 
    zayslanotrr_temple_found = false;
 
    deep_temple_found = false;
 
    lseryanotrr_found = false;
 
	
 
	rel_phaetlarr = 0;
 
	rel_walter = 0;
 
	rel_learr = 0;
 
	rel_anna = 0;
 
	rel_jack = 0;
 
};
 
 
pl = player {
 
	nam = "player";
 
	disp = "Дэвид Дрейк";
 
	where = 'port';
 
	hitpoints = 10;
 
	obj = {'item_umbrella', 'item_charts', 'item_note_1', 'item_money', 
 
	};
 
	-- party array. Should be empty on start
 
	party = {--[["learr", "radcliffe", "phaetlarr", "wright"]]};
 
	companion = nil;
 
	money = 200;
 
	pay = function(s, c)
 
		if (s.money >= c) then
 
			s.money = s.money - c;
 
			return true;
 
		else
 
			return false;
 
		end;
 
	end;
 
};
 
 
intro = room {
 
	nam = "intro";
 
	hideinv = true;
 
	disp = "Вступление";
 
	dsc = [[
 
		ВНИМАНИЕ: Это специальная предварительная версия игры. Ни один фрагмент игры не является финальным. ^^
 
		ВНИМАНИЕ: Данная версия игры не предназначена для какого-либо распространения, исключая прямую передачу файлов автором. Вышеуказанное ограничение на распространение данной версии игры аннулируется в момент выхода полной версии. ^^
 
		Действие игры происходит в конце 19-го века. Вы играете за Дэвида Дрейка - единственного сына богатого и уважаемого владельца транспортной компании "Вестхейвен Трансоушен". ^
 
		Несколько лет назад, когда Дэвиду было 10 лет, Уильям таинственным образом бесследно пропал. Полицейское расследование вскоре зашло в тупик и было прекращено. Через несколько месяцев компания, оставшаяся без своего владельца, обанкротилась, ее имущество распродается. ^
 
		После исчезновения отца Дэвид жил в Вашингтоне с бабушкой. Он пошел по стопам отца и выучился на инженера-кораблестроителя. Несколько дней назад в доме, где он жил, был обнаружен тайник, хранящий секретные документы отца - карты, указывающие по-видимому на какие-то тайники Уильяма и записка с адресом и именем.^
 
		Одержимый идеей узнать больше, Дэвид отправляется в Лондон...
 
	]];
 
	obj = {
 
		vway("Начать игру", "{Начать игру}", 'aurora_borealis');
 
	}
 
};
 
 
demo_end = room {
 
	nam = "demo_end";
 
	hideinv = true;
 
 	dsc = [[
 
		Вы встаете за штурвал "Левиафана". Уверенным движением руки вы включаете насосы. Резервуары заполняются водой и субмарина опускается вниз. Еще одним движением вы включаете двигатели. "Левиафан" плавно сдвигается с места. Через несколько часов вы выходите в открытое море. Еще раз сверившись с картой, вы направляетесь к месту, отмеченному на ней. 
 
		
 
		*** Конец предварительной демонстрации ***
 
	]];
 
};
 
 
game.nam = "Пробуждение";
 
game.dsc = [[
 
	Действие игры происходит в конце 19-го века. Вы играете за Дэвида Дрейка, сына владельца крупной транспортной компании "Вестхейвен Трансоушен". Несколько лет назад Уильям Дрейк, отец главного героя бесследно пропадает. Компания вскоре разваливается. Поиски ни к чему не приводят. Когда казалось бы уже все потеряно, в доме Дрейков находят тайник с документами Уильяма. Несколько схем строений, принадлежащих компании и клочок бумаги с адресом некоего Майкла Райта в Лондоне. Естественно, Дэвид как можно скорее отправляется в Великобританию...
 
	Вам предстоит отыскать подводную лодку, посетить подводную станцию, построенную Уильямом, встретить древнюю расу подводных жителей, поучаствовать в событиях, описанных древними легендами этой расы и узнать, что стало с Уильямом Дрейком.
 
]];
 
 
game_act_phrases = {
 
	"Вы не знаете, что с этим делать. ";
 
	"Вам нет смысла это трогать. ";
 
	"Вам это ничем не поможет. ";
 
	"Это бессмыссленно. ";
 
	"Незачем это трогать. ";
 
};
 
 
game_use_phrases = {
 
	"Вам это ничем не поможет. ";
 
	"Это бессмыссленно. ";
 
	"Вы не знаете, как это сделать. "
 
};
 
 
game.act = function(s)
 
	return game_act_phrases[rnd(#game_act_phrases)];
 
end;
 
 
game.use = function(s)
 
	return game_use_phrases[rnd(#game_use_phrases)];
 
end;
 
game.inv = "INV: Если вы видите это сообщение - это баг. ";
 
 
require "dbg"
 
 
function init()
 
	---modules init
 
	leviathan_init();
 
	warehouse18_init();
 
	warehouse32_init();
 
	---game init
 
	pl.where = intro;
 
	---debug	
 
	--[[
 
	---IYH
 
	lifeon(char_learr);
 
	lifeon(char_wright);
 
	lifeon(char_radcliffe);
 
	lifeon(char_anna);
 
	lifeon(char_aikerjarr_lev);
 
	pl.party = {'learr', 'wright', 'radcliffe', 'anna'};
 
	atlantis_found = true;
 
	move(submarine_leviathan, "ctt_dyp_temple_entrance");
 
	--move(submarine_leviathan, "iyh_far_from_entrance_foot");
 
	pl.where = leviathan_wheelhouse;
 
	submarine_leviathan.battery = true; -- Состояние батареи 
 
	submarine_leviathan.battery_charge = 100; -- Уровень заряда батареи
 
	submarine_leviathan.circuit_breaks = 0; -- Разрывы цепи
 
	submarine_leviathan.valves_to_replace = 0; -- Количество клапанов, которые нужно заменить для полноценной работы
 
	submarine_leviathan.power_on = true; -- включена ли энергия
 
	submarine_leviathan.air_level = 432000; -- запас воздуха. Максимум - 5 дней(5 * 24 * 60 * 60 = 432000)
 
	submarine_leviathan.airpump = false;
 
	leviathan_airlock.has_light = true;
 
	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;
 
	atl_iyh_state = 7;
 
	--]]
 
	
 
	--- Chapter 1: Atlantis
 
	submarine_leviathan.battery = true; -- Состояние батареи 
 
	submarine_leviathan.battery_charge = 100; -- Уровень заряда батареи
 
	submarine_leviathan.circuit_breaks = 0; -- Разрывы цепи
 
	submarine_leviathan.valves_to_replace = 0; -- Количество клапанов, которые нужно заменить для полноценной работы
 
	submarine_leviathan.power_on = true; -- включена ли энергия
 
	submarine_leviathan.air_level = 432000; -- запас воздуха. Максимум - 5 дней(5 * 24 * 60 * 60 = 432000)
 
	submarine_leviathan.airpump = false;
 
	leviathan_airlock.has_light = true;
 
	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");
 
	-- put("char_wright", "leviathan_wardroom");
 
	-- pl.where = leviathan_airlock;
 
	-- pl.where = hotel_street;
 
	-- pl.where = warehouse_32_entry;
 
	-- dock_found = true;
 
end;
 
\ No newline at end of file
0 comments (0 inline, 0 general)