Skip to content
Snippets Groups Projects
Commit de674f5b authored by DarkGod's avatar DarkGod
Browse files

Fortress exploratory farportal only uses energy if you actually can go through...

Fortress exploratory farportal only uses energy if you actually can go through (as in when not controlling a party member)
parent 6a0f8ce1
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -783,7 +783,7 @@ end
-- This helps ensuring uniqueness of uniques
function _M:added()
if self.unique then
local ustr = tstring(self.unique)
local ustr = tostring(self.unique)
game.uniques[self.__CLASSNAME.."/"..ustr] = (game.uniques[self.__CLASSNAME.."/"..ustr] or 0) + 1
print("Added unique", self.__CLASSNAME.."/"..ustr, "::", game.uniques[self.__CLASSNAME.."/"..ustr])
end
......
......@@ -787,25 +787,31 @@ function _M:noStairsTime()
return nb * 10
end
function _M:changeLevel(lev, zone, params)
function _M:changeLevelCheck(lev, zone, params)
params = params or {}
if not params.direct_switch and (self:getPlayer(true).last_kill_turn and self:getPlayer(true).last_kill_turn >= self.turn - self:noStairsTime()) then
local left = math.ceil((10 + self:getPlayer(true).last_kill_turn - self.turn + self:noStairsTime()) / 10)
self.logPlayer(self.player, "#LIGHT_RED#You may not change level so soon after a kill (%d game turns left to wait)!", left)
return
return false
end
if not self.player.can_change_level then
self.logPlayer(self.player, "#LIGHT_RED#You may not change level without your own body!")
return
return false
end
if zone and not self.player.can_change_zone then
self.logPlayer(self.player, "#LIGHT_RED#You may not leave the zone with this character!")
return
return false
end
if self.player:hasEffect(self.player.EFF_PARADOX_CLONE) or self.player:hasEffect(self.player.EFF_IMMINENT_PARADOX_CLONE) then
self.logPlayer(self.player, "#LIGHT_RED#You cannot escape your fate by leaving the level!")
return
return false
end
return true
end
function _M:changeLevel(lev, zone, params)
params = params or {}
if not self:changeLevelCheck(lev, zone, params) then return end
-- Transmo!
local p = self:getPlayer(true)
......
......@@ -148,6 +148,7 @@ It should automatically create a portal back, but it might not be near your arri
if not q:exploratory_energy(true) then Dialog:simplePopup("Exploratory Farportal", "The fortress does not have enough energy to power a trip through the portal.") return end
Dialog:yesnoPopup("Exploratory Farportal", "Do you want to travel in the farportal? You cannot know where you will end up.", function(ret) if ret then
if not game:changeLevelCheck(1, {}, {direct_switch=true}) then return end
if self:checkSpecialLocation(who, q) then return end
local zone, boss = game.state:createRandomZone()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment