From 5fb8338723e09c33c9bd0591e9eb90fe2db1e596 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 10 Dec 2012 12:13:07 +0000 Subject: [PATCH] tset git-svn-id: http://svn.net-core.org/repos/t-engine4@6034 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/FortressPC.lua | 15 +++++-- .../chats/shertul-fortress-command-orb.lua | 2 +- .../tome/data/quests/shertul-fortress.lua | 40 ++++++++++++++----- game/modules/tome/data/talents/misc/misc.lua | 1 + game/modules/tome/data/wda/eyal.lua | 2 +- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/game/modules/tome/class/FortressPC.lua b/game/modules/tome/class/FortressPC.lua index 2cf7a035b8..d2e520123a 100644 --- a/game/modules/tome/class/FortressPC.lua +++ b/game/modules/tome/class/FortressPC.lua @@ -31,6 +31,7 @@ function _M:init(t, no_default) self.name = "Yiilkgur, the Sher'Tul Fortress" self.is_fortress = true + self.no_worldmap_encounter = true self.allow_talents_worldmap = true self.faction = game:getPlayer(true).faction self.no_inventory_access = true @@ -226,15 +227,23 @@ function _M:moveEngineMove(x, y, force) return true end +function _M:takeControl(from) + game.party:addMember(self, {temporary_level=1, control="full"}) + game.party:setPlayer(self, true) + game.level.map:remove(from.x, from.y, engine.Map.ACTOR) +end + --- Checks if something bumps in us -- If it happens the method attack is called on the target with the attacker as parameter. -- Do not touch! function _M:block_move(x, y, e, act) if act and e == game.player then Dialog:yesnoPopup(self.name, "Do you wish to teleport to the fortress?", function(ret) if ret then - game.party:addMember(self, {temporary_level=1, control="full"}) - game.party:setPlayer(self, true) - game.level.map:remove(e.x, e.y, engine.Map.ACTOR) + if not game.zone.wilderness then + Dialog:simplePopup(self.name, "The teleport fizzles!") + return + end + self:takeControl(e) end end) end return false diff --git a/game/modules/tome/data/chats/shertul-fortress-command-orb.lua b/game/modules/tome/data/chats/shertul-fortress-command-orb.lua index 379baac662..8d96ec2927 100644 --- a/game/modules/tome/data/chats/shertul-fortress-command-orb.lua +++ b/game/modules/tome/data/chats/shertul-fortress-command-orb.lua @@ -28,7 +28,7 @@ newChat{ id="welcome", #{italic}#"Rokzan krilt copru."#{normal}#]] or [[#WHITE#*#{italic}#"Insert control rod."#{normal}#]]), answers = { {"[Examine the orb]", jump="examine", cond=has_rod}, --- {"[Fly the fortress]", action=function(npc, player) player:hasQuest("shertul-fortress"):fly() end}, + {"[Fly the fortress -- #LIGHT_RED#FOR TESTING ONLY#LAST#]", action=function(npc, player) player:hasQuest("shertul-fortress"):fly() end, cond=function() return config.settings.cheat end}, {"[Begin the Lichform ceremory]", cond=function(npc, player) local q = player:hasQuest("lichform") return q and q:check_lichform(player) end, action=function(npc, player) player:setQuestStatus("lichform", engine.Quest.COMPLETED) end}, {"[Leave the orb alone]"}, } diff --git a/game/modules/tome/data/quests/shertul-fortress.lua b/game/modules/tome/data/quests/shertul-fortress.lua index e6b41b0036..70d18ba1a7 100644 --- a/game/modules/tome/data/quests/shertul-fortress.lua +++ b/game/modules/tome/data/quests/shertul-fortress.lua @@ -177,15 +177,33 @@ upgrade_transmo_gems = function(self) end fly = function(self) - game.player:learnLore("shertul-fortress-takeoff") - - local f = require("mod.class.FortressPC").new{} - game:changeLevel(1, "wilderness", {direct_switch=true}) - game.party:addMember(f, {temporary_level=1, control="full"}) - f.x = game.player.x - f.y = game.player.y - game.party:setPlayer(f, true) - game.level:addEntity(f) - game.level.map:remove(f.x, f.y, engine.Map.ACTOR) - f:move(f.x, f.y, true) + if self:isStatus(self.COMPLETED, "flying") then + game:changeLevel(1, "wilderness", {direct_switch=true}) + + local f = nil + for uid, e in pairs(game.level.entities) do + if e.is_fortress then f = e break end + end + + if not f then + game.log("The fortress is not found!") + return + end + + f:takeControl(game.player) + else + game.player:learnLore("shertul-fortress-takeoff") + + local f = require("mod.class.FortressPC").new{} + game:changeLevel(1, "wilderness", {direct_switch=true}) + game.party:addMember(f, {temporary_level=1, control="full"}) + f.x = game.player.x + f.y = game.player.y + game.party:setPlayer(f, true) + game.level:addEntity(f) + game.level.map:remove(f.x, f.y, engine.Map.ACTOR) + f:move(f.x, f.y, true) + + game.player:setQuestStatus("shertul-fortress", self.COMPLETED, "flying") + end end diff --git a/game/modules/tome/data/talents/misc/misc.lua b/game/modules/tome/data/talents/misc/misc.lua index 728fd4c2b0..bc0e90aa66 100644 --- a/game/modules/tome/data/talents/misc/misc.lua +++ b/game/modules/tome/data/talents/misc/misc.lua @@ -314,6 +314,7 @@ newTalent{ no_npc_use = true, no_unlearn_last = true, action = function(self, t) + if game.level.map:checkAllEntities(self.x, self.y, "block_move") then game.log("You can not teleport there.") return true end game.party:removeMember(self, true) game.party:findSuitablePlayer() game.player:move(self.x, self.y, true) diff --git a/game/modules/tome/data/wda/eyal.lua b/game/modules/tome/data/wda/eyal.lua index cdab817734..798eb4352f 100644 --- a/game/modules/tome/data/wda/eyal.lua +++ b/game/modules/tome/data/wda/eyal.lua @@ -97,7 +97,7 @@ elseif zone == "Far East" then -- Spawn random encounters local g = game.level.map(game.player.x, game.player.y, Map.TERRAIN) - if g and g.can_encounter then + if g and g.can_encounter and not game.player.no_worldmap_encounter then local type = encounter_chance(game.player) if type then game.level:setEntitiesList("fareast_encounters_rng", game.zone:computeRarities("fareast_encounters_rng", game.level:getEntitiesList("fareast_encounters"), game.level, nil)) -- GitLab