Files @ 16044f7fdf9f
Branch filter:

Location: games/Awakening/travel.lua

Silverwing
0.10.5
--[[
Кучер, который будет за деньги возить вас по локациям первой части
]]
char_coachman = obj {
	nam = "coachman";
	disp = "экипаж";
	dsc = [[Неподалеку от вас стоит небольшая двухколесная {повозка} с впряженной лошадью. ]];
	act = function(s)
		walkin "coachman_dlg";
	end;
	used = function(s, o)
		walkin "coachman_dlg";
	end;
};

coachman_responses_ok = {
    [[Кэбмен приглашает вас: "Садитесь!". ]],
    [[Вы садитесь в повозку и благополучно добираетесь до цели. ]],
    [[Вы оплачиваете проезд и садитесь в повозку. ]],
};

coachman_responses_fail = {
    [[Кэбмен разочарованно протянул: "Бесплатно я никого не вожу". ]];
    [[Кэбмен разочарованно протянул: "Нет денег -- нет поездки". ]];
    [[Кэбмен разочарованно протянул: "Сначала оплатите проезд". ]];
    [[Кэбмен разочарованно протянул: "Возвращайтесь, когда накопите денег". ]];
};

coachman_dlg = dlg {
	nam = "coachman_dlg";
	disp = "Кэбмен";
	dsc = [[Вы подходите к повозке и кэбмен спрашивает вас: _"Куда поедем?"_]];
	hideinv = true;
	entered = function(s)
		poff(1, 2, 3, 4, 5, 6);
        if (where(char_coachman) ~= port_street) then
			pon(6);
		end;
		if (where(char_coachman) ~= hotel_street) then
			pon(1);
		end;
		if (where(char_coachman) ~= wright_house) then
			pon(2);
		end;
		if (where(char_coachman) ~= dock_2 and dock_found) then
			pon(5);
		end;
		if (where(char_coachman) ~= warehouse_18_entry and warehouse18_found) then
			pon(3);
		end;
		if (where(char_coachman) ~= warehouse_32_entry and warehouse32_found) then
			pon(4);
		end;
	end;
	phr = {
		{1, always = true, "В гостиницу (5 монет). ",
			function (s)
				if (pl:pay(5)) then
					walk 'hotel_street';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{2, always = true, "К Райту (5 монет). ", 
			function (s)
				if (pl:pay(5)) then
					walk 'wright_house';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{3, always = true, "На склад 18 (5 монет). ", 
			function (s)
				if (pl:pay(5)) then
					walk 'warehouse_18_entry';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{4,	always = true, "На склад 32 (5 монет). ", 
			function (s)
				if (pl:pay(5)) then
					walk 'warehouse_32_entry';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{5, always = true, "К доку 2 (5 монет). ", 
			function (s)
				if (pl:pay(5)) then
					walk 'dock_2';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{6, always = true, "В порт (5 монет). ",
			function (s)
				if (pl:pay(5)) then
					walk 'port_street';
					return coachman_responses_ok[rnd(#coachman_responses_ok)];
				else
					back();
					return coachman_responses_fail[rnd(#coachman_responses_fail)];
				end;
			end
		},
		{255, always = true, "Я передумал. ", function(s) 
			back()
		end}
	};
};