Skip to content
Snippets Groups Projects
Commit af6ef492 authored by dg's avatar dg
Browse files

Adventure mode resurrection changed, the player is now taken to an other plane...

Adventure mode resurrection changed, the player is now taken to an other plane where she/he can rest and then go back


git-svn-id: http://svn.net-core.org/repos/t-engine4@2540 51575b47-30f0-44d4-a5cc-537603b46e54
parent b7962565
No related branches found
No related tags found
No related merge requests found
Showing
with 326 additions and 13 deletions
...@@ -195,9 +195,10 @@ end ...@@ -195,9 +195,10 @@ end
function _M:findSuitablePlayer(type) function _M:findSuitablePlayer(type)
for i, actor in ipairs(self.m_list) do for i, actor in ipairs(self.m_list) do
local def = self.members[actor] local def = self.members[actor]
if def.control == "full" and (not type or def.type == type) and not actor.dead then if def.control == "full" and (not type or def.type == type) and not actor.dead and game.level:hasEntity(actor) then
self:setPlayer(actor) if self:setPlayer(actor, true) then
return true return true
end
end end
end end
return false return false
......
...@@ -243,6 +243,7 @@ function _M:updateMainShader() ...@@ -243,6 +243,7 @@ function _M:updateMainShader()
elseif self:attr("invisible") then game.fbo_shader:setUniform("colorize", {0.4,0.5,0.7}) elseif self:attr("invisible") then game.fbo_shader:setUniform("colorize", {0.4,0.5,0.7})
elseif self:attr("unstoppable") then game.fbo_shader:setUniform("colorize", {1,0.2,0}) elseif self:attr("unstoppable") then game.fbo_shader:setUniform("colorize", {1,0.2,0})
elseif self:attr("lightning_speed") then game.fbo_shader:setUniform("colorize", {0.2,0.3,1}) elseif self:attr("lightning_speed") then game.fbo_shader:setUniform("colorize", {0.2,0.3,1})
elseif game.level and game.level.data.is_eidolon_plane then game.fbo_shader:setUniform("colorize", {1,1,1})
-- elseif game:hasDialogUp() then game.fbo_shader:setUniform("colorize", {0.9,0.9,0.9}) -- elseif game:hasDialogUp() then game.fbo_shader:setUniform("colorize", {0.9,0.9,0.9})
else game.fbo_shader:setUniform("colorize", {0,0,0}) -- Disable else game.fbo_shader:setUniform("colorize", {0,0,0}) -- Disable
end end
......
...@@ -48,7 +48,10 @@ function _M:onPartyDeath(src) ...@@ -48,7 +48,10 @@ function _M:onPartyDeath(src)
game.player.killedBy = src game.player.killedBy = src
game.player.died_times[#game.player.died_times+1] = {name=src.name, level=game.player.level, turn=game.turn} game.player.died_times[#game.player.died_times+1] = {name=src.name, level=game.player.level, turn=game.turn}
game.player:registerDeath(game.player.killedBy) game.player:registerDeath(game.player.killedBy)
game:registerDialog(require("mod.dialogs."..(game.player.death_dialog or "DeathDialog")).new(game.player)) local dialog = require("mod.dialogs."..(game.player.death_dialog or "DeathDialog")).new(game.player)
if not dialog.dont_show then
game:registerDialog(dialog)
end
game.player:saveUUID() game.player:saveUUID()
end end
end end
...@@ -43,6 +43,11 @@ newAchievement{ ...@@ -43,6 +43,11 @@ newAchievement{
desc = [[Has returned from the dead.]], desc = [[Has returned from the dead.]],
} }
newAchievement{
name = "Utterly Destroyed", id = "EIDOLON_DEATH",
desc = [[Died on the Eidolon Plane.]],
}
newAchievement{ newAchievement{
name = "Emancipation", id = "EMANCIPATION", name = "Emancipation", id = "EMANCIPATION",
desc = [[Have the golem kill a boss while its master is already dead.]], desc = [[Have the golem kill a boss while its master is already dead.]],
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
newChat{ id="welcome",
text = [[#LIGHT_GREEN#*Before you stands an humanoid shape filled with 'nothing'. It seems to stare at you.*#WHITE#
I have brought you here on the instant of your death. I am the Eidolon.
I have deemed you worthy of my 'interrest', I will watch your future steps with interrest
You may rest here, when you are ready I will send you back to the material plane.
But do not abuse my help, I am not your servant, someday I might just let you die.
As for your probable many questions, they will stay unanswered, I may help, but I am not here to explain why.]],
answers = {
{"Thank you, I will rest for a while."},
{"Thank you, I am ready to go back!", action=function() game.level.data.eidolon_exit() end},
}
}
return "welcome"
...@@ -265,7 +265,7 @@ newEntity{ define_as = "ORB_DESTRUCTION", ...@@ -265,7 +265,7 @@ newEntity{ define_as = "ORB_DESTRUCTION",
-- Scrying -- Scrying
newEntity{ define_as = "ORB_SCRYING", newEntity{ define_as = "ORB_SCRYING",
power_source = {unknown=true}, power_source = {unknown=true},
unique = true, quest=true, unique = true, quest=true, no_unique_lore=true,
type = "jewelry", subtype="orb", type = "jewelry", subtype="orb",
unided_name = "orb of scrying", unided_name = "orb of scrying",
name = "Orb of Scrying", name = "Orb of Scrying",
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
load("/data/general/grids/void.lua")
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
newEntity{ define_as = "EIDOLON",
type = "unknown", subtype = "unknown",
name = "The Eidolon",
display = "@", color=colors.GREY,
desc = [[Void seems more... alive, this creature stares at you with interrest.]],
faction = "neutral",
blood_color = colors.DARK,
level_range = {200, nil}, exp_worth = 0,
rank = 5,
never_move = 1,
invulnerable = 1,
never_angry = 1,
can_talk = "eidolon-plane",
}
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
load("/data/general/objects/objects.lua")
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
load("/data/general/traps/natural_forest.lua")
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return {
name = "Eidolon Plane",
level_range = {1, 1},
level_scheme = "player",
max_level = 1,
width = 10, height = 10,
all_remembered = true,
all_lited = true,
no_worldport = true,
is_eidolon_plane = true,
ambient_music = "Anne_van_Schothorst_-_Passed_Tense.ogg",
generator = {
map = {
class = "engine.generator.map.Forest",
noise = "fbm_perlin",
floor = "VOID",
wall = "VOID",
up = "VOID",
down = "VOID",
},
actor = {
class = "engine.generator.actor.Random",
nb_npc = {0, 0},
guardian = "EIDOLON",
},
},
post_process = function(level)
if level.level == 1 then
local Map = require "engine.Map"
level.background_particle = require("engine.Particles").new("starfield", 1, {width=Map.viewport.width, height=Map.viewport.height})
end
game.state:makeWeather(level, 6, {max_nb=1, chance=200, dir=120, speed={0.1, 0.9}, r=0.2, g=0.2, b=0.2, alpha={0.2, 0.4}, particle_name="weather/grey_cloud_%02d"})
-- Can drop anything on the eidolon plane
for x = 0, level.map.w - 1 do for y = 0, level.map.h - 1 do
level.map.attrs(x, y, "on_drop", function(...) game.level.data.process_drops(...) end)
end end
end,
background = function(level, x, y, nb_keyframes)
if level.level ~= 1 then return end
local Map = require "engine.Map"
for i = 1, nb_keyframes do
level.background_particle:update()
level.background_particle.ps:update()
end
level.background_particle.ps:toScreen(x, y, true, 1)
end,
-- Handle drops
process_drops = function(who, dx, dy, idx, o)
local map = game.level.map
map:removeObject(dx, dy, idx)
game.logPlayer(who, "The Eidolon Plane seems to not physicaly exists in the same way the normal world does, you can not seem to drop anything here. %s comes back into your backpack.", o:getName{do_color=true})
who:addObject(who.INVEN_INVEN, o)
end,
eidolon_exit = function()
game:onTickEnd(function()
local oldzone = game.zone
local oldlevel = game.level
local zone = game.level.source_zone
local level = game.level.source_level
local acts = {}
for act, _ in pairs(game.party.members) do
if not act.dead then
acts[#acts+1] = act
if oldlevel:hasEntity(act) then oldlevel:removeEntity(act) end
end
end
game.zone = zone
game.level = level
game.zone_name_s = nil
for _, act in ipairs(acts) do
local x, y = util.findFreeGrid(oldlevel.data.eidolon_exit_x or 1, oldlevel.data.eidolon_exit_y or 1, 20, true, {[engine.Map.ACTOR]=true})
if x then
level:addEntity(act)
act:move(x, y, true)
act.changed = true
game.level.map:particleEmitter(x, y, 1, "teleport")
end
end
game.logPlayer(game.player, "#LIGHT_RED#You are sent back to the material plane!")
game.player:updateMainShader()
end)
end,
}
...@@ -106,8 +106,46 @@ function _M:resurrectBasic(actor) ...@@ -106,8 +106,46 @@ function _M:resurrectBasic(actor)
actor.energy.value = game.energy_to_act actor.energy.value = game.energy_to_act
actor.changed = true actor.changed = true
game.paused = true game.paused = true
end
--- Send the party to the Eidolon Plane
function _M:eidolonPlane()
game:onTickEnd(function()
local oldzone = game.zone
local oldlevel = game.level
local zone = engine.Zone.new("eidolon-plane")
local level = zone:getLevel(game, 1, 0)
level.data.eidolon_exit_x = self.actor.x
level.data.eidolon_exit_y = self.actor.y
local acts = {}
for act, _ in pairs(game.party.members) do
if not act.dead then
acts[#acts+1] = act
if oldlevel:hasEntity(act) then oldlevel:removeEntity(act) end
end
end
world:gainAchievement("UNSTOPPABLE", actor) level.source_zone = oldzone
level.source_level = oldlevel
game.zone = zone
game.level = level
game.zone_name_s = nil
for _, act in ipairs(acts) do
local x, y = util.findFreeGrid(5, 5, 20, true, {[Map.ACTOR]=true})
if x then
level:addEntity(act)
act:move(x, y, true)
act.changed = true
game.level.map:particleEmitter(x, y, 1, "teleport")
end
end
game.log("#LIGHT_RED#As you are on the brink of death you seem to be yanked to an other plane.")
game.player:updateMainShader()
end)
return true
end end
function _M:use(item) function _M:use(item)
...@@ -139,18 +177,22 @@ function _M:use(item) ...@@ -139,18 +177,22 @@ function _M:use(item)
self:cleanActor(self.actor) self:cleanActor(self.actor)
self:restoreResources(self.actor) self:restoreResources(self.actor)
self:resurrectBasic(self.actor) self:resurrectBasic(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
elseif act == "easy_mode" then elseif act == "easy_mode" then
self.actor:attr("easy_mode_lifes", -1) self.actor:attr("easy_mode_lifes", -1)
game.logPlayer(self.actor, "#LIGHT_RED#You resurrect!")
self.actor.x = self.actor.entered_level.x
self.actor.y = self.actor.entered_level.y
self:cleanActor(self.actor) self:cleanActor(self.actor)
self:resurrectBasic(self.actor) self:resurrectBasic(self.actor)
for uid, e in pairs(game.level.entities) do for uid, e in pairs(game.level.entities) do
self:restoreResources(e) if not game.party:hasMember(e) then
self:restoreResources(e)
else
e.life = math.max(e.life, 1)
e.changed = true
end
end end
self:eidolonPlane()
game.log("#LIGHT_RED#You have %s left.", self.actor:attr("easy_mode_lifes") and (self.actor:attr("easy_mode_lifes").." life(s)" or "no more lifes"))
elseif act == "skeleton" then elseif act == "skeleton" then
self.actor:attr("re-assembled", 1) self.actor:attr("re-assembled", 1)
game.logPlayer(self.actor, "#YELLOW#Your bones magically come back together. You are once more able to dish out pain to your foes!") game.logPlayer(self.actor, "#YELLOW#Your bones magically come back together. You are once more able to dish out pain to your foes!")
...@@ -158,6 +200,7 @@ function _M:use(item) ...@@ -158,6 +200,7 @@ function _M:use(item)
self:cleanActor(self.actor) self:cleanActor(self.actor)
self:restoreResources(self.actor) self:restoreResources(self.actor)
self:resurrectBasic(self.actor) self:resurrectBasic(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
elseif act:find("^consume") then elseif act:find("^consume") then
local inven, item, o = item.inven, item.item, item.object local inven, item, o = item.inven, item.item, item.object
self.actor:removeObject(inven, item) self.actor:removeObject(inven, item)
...@@ -166,15 +209,33 @@ function _M:use(item) ...@@ -166,15 +209,33 @@ function _M:use(item)
self:cleanActor(self.actor) self:cleanActor(self.actor)
self:restoreResources(self.actor) self:restoreResources(self.actor)
self:resurrectBasic(self.actor) self:resurrectBasic(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
end end
end end
function _M:generateList() function _M:generateList()
local list = {} local list = {}
local allow_res = true
-- Pause the game
game:onTickEnd(function()
game.paused = true
game.player.energy.value = game.energy_to_act
end)
if game.zone.is_eidolon_plane then
game.logPlayer(self, "You managed to die on the eidolon plane! DIE!")
game:onTickEnd(function() world:gainAchievement("EIDOLON_DEATH", self.actor) end)
allow_res = false
end
if config.settings.cheat then list[#list+1] = {name="Resurrect by cheating", action="cheat"} end if config.settings.cheat then list[#list+1] = {name="Resurrect by cheating", action="cheat"} end
if not self.actor.no_resurrect then if not self.actor.no_resurrect and allow_res then
if self.actor:attr("easy_mode_lifes") then list[#list+1] = {name=("Resurrect (%d left)"):format(self.actor.easy_mode_lifes), action="easy_mode"} end if self.actor:attr("easy_mode_lifes") then
self:use{action="easy_mode"}
self.dont_show = true
return
end
if self.actor:attr("blood_life") and not self.actor:attr("undead") then list[#list+1] = {name="Resurrect with the Blood of Life", action="blood_life"} end if self.actor:attr("blood_life") and not self.actor:attr("undead") then list[#list+1] = {name="Resurrect with the Blood of Life", action="blood_life"} end
if self.actor:getTalentLevelRaw(self.actor.T_SKELETON_REASSEMBLE) >= 5 and not self.actor:attr("re-assembled") then list[#list+1] = {name="Re-assemble your bones and resurrect (Skeleton ability)", action="skeleton"} end if self.actor:getTalentLevelRaw(self.actor.T_SKELETON_REASSEMBLE) >= 5 and not self.actor:attr("re-assembled") then list[#list+1] = {name="Re-assemble your bones and resurrect (Skeleton ability)", action="skeleton"} end
......
No preview for this file type
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