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

see the threads

git-svn-id: http://svn.net-core.org/repos/t-engine4@2389 51575b47-30f0-44d4-a5cc-537603b46e54
parent 759ddbf7
No related branches found
No related tags found
No related merge requests found
-- 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
local function select(id)
if id == 1 or id == 2 then
game:chronoRestore("see_threads_"..id, true)
end
if game._chronoworlds then
game._chronoworlds.see_threads_1 = nil
game._chronoworlds.see_threads_2 = nil
game._chronoworlds.see_threads_3 = nil
game._chronoworlds.see_threads_base = nil
end
game.logPlayer(game.player, "#LIGHT_BLUE#You select the timeline and re-arrange the universe to your liking!")
end
newChat{ id="welcome",
text = [[You have lived ]]..turns..[[ in three different timelines, which do you choose to be the real timeline?]],
answers = {
{"The first.", action=function(npc, player) select(1) end},
{"The second.", action=function(npc, player) select(2) end},
{"The third.", action=function(npc, player) select(3) end},
}
}
return "welcome"
......@@ -52,10 +52,10 @@
return true
end
end
-- Annoy them!
if target ~= self and target:reactionToward(self) < 0 then target:setTarget(self) end
game.level.map:remove(self.x, self.y, Map.ACTOR)
game.level.map:remove(target.x, target.y, Map.ACTOR)
game.level.map(self.x, self.y, Map.ACTOR, target)
......@@ -63,8 +63,8 @@
self.x, self.y, target.x, target.y = target.x, target.y, self.x, self.y
game.level.map:particleEmitter(target.x, target.y, 1, "teleport")
game.level.map:particleEmitter(self.x, self.y, 1, "teleport")
if target ~= self then
target:setEffect(target.EFF_CONTINUUM_DESTABILIZATION, 100, {power=self:combatSpellpower(0.3)})
end
......@@ -174,7 +174,7 @@ newTalent{
game.logPlayer(self, "%s resists!", target.name:capitalize())
return true
end
local m = target:clone{
no_drops = true,
faction = self.faction,
......@@ -198,13 +198,13 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "shadow")
-- force target to attack double
local a = game.level.map(tx, ty, Map.ACTOR)
if a and self:reactionToward(a) < 0 then
a:setTarget(m)
end
game:playSoundNear(self, "talents/spell_generic")
return true
end,
......@@ -229,59 +229,17 @@ newTalent{
type = {"chronomancy/timeline-threading", 4},
require = chrono_req_high4,
points = 5,
mode = "sustained",
sustain_mana = 170,
cooldown = 15,
tactical = {
ATTACKAREA = 10,
},
range = 5,
do_storm = function(self, t)
if self:getMana() <= 0 then
local old = self.energy.value
self.energy.value = 100000
self:useTalent(self.T_THUNDERSTORM)
self.energy.value = old
return
end
local tgts = {}
local grids = core.fov.circle_grids(self.x, self.y, 5, true)
for x, yy in pairs(grids) do for y, _ in pairs(grids[x]) do
local a = game.level.map(x, y, Map.ACTOR)
if a and self:reactionToward(a) < 0 then
tgts[#tgts+1] = a
end
end end
-- Randomly take targets
local tg = {type="hit", range=self:getTalentRange(t), talent=t}
for i = 1, math.floor(self:getTalentLevel(t)) do
if #tgts <= 0 then break end
local a, id = rng.table(tgts)
table.remove(tgts, id)
self:project(tg, a.x, a.y, DamageType.LIGHTNING, rng.avg(1, self:spellCrit(self:combatTalentSpellDamage(t, 15, 80)), 3))
game.level.map:particleEmitter(self.x, self.y, math.max(math.abs(a.x-self.x), math.abs(a.y-self.y)), "lightning", {tx=a.x-self.x, ty=a.y-self.y})
game:playSoundNear(self, "talents/lightning")
end
end,
activate = function(self, t)
game:playSoundNear(self, "talents/thunderstorm")
game.logSeen(self, "#0080FF#A furious lightning storm forms around %s!", self.name)
return {
drain = self:addTemporaryValue("mana_regen", -3 * self:getTalentLevelRaw(t)),
}
end,
deactivate = function(self, t, p)
game.logSeen(self, "#0080FF#The furious lightning storm around %s calms down and disappears.", self.name)
self:removeTemporaryValue("mana_regen", p.drain)
paradox = 100,
cooldown = 100,
no_npc_use = true,
action = function(self, t)
self:setEffect(self.EFF_SEE_THREADS, 10, {})
return true
end,
info = function(self, t)
return ([[Conjures a furious, raging lightning storm with a radius of 5 that follows you as long as this spell is active.
Each turn a random lightning bolt will hit up to %d of your foes for 1 to %0.2f damage.
This powerful spell will continuously drain mana while active.
The damage will increase with the Magic stat]]):format(self:getTalentLevel(t), self:combatTalentSpellDamage(t, 15, 80))
local percent = t.getPercent(self, t)
return ([[Casting this spell sends you back to the moment you entered the current dungeon level.
Traveling through time carries with it inherent penalties and doing so will permanently reduce your hit points by %d%%.]])
:format(percent)
end,
}
......@@ -20,6 +20,7 @@
local Stats = require "engine.interface.ActorStats"
local Particles = require "engine.Particles"
local Entity = require "engine.Entity"
local Chat = require "engine.Chat"
newEffect{
name = "CUT",
......@@ -3082,3 +3083,50 @@ newEffect{
end)
end,
}
newEffect{
name = "SEE_THREADS",
desc = "See the Threads",
long_desc = function(self, eff) return ("You walk three different timelines, choosing the one you prefer at the end (current timeline: %d)."):format(eff.thread) end,
type = "magical",
status = "beneficial",
parameters = { power=10 },
activate = function(self, eff)
eff.thread = 1
eff.max_dur = eff.dur
game:onTickEnd(function()
game:chronoClone("see_threads_base")
end)
end,
deactivate = function(self, eff)
game:onTickEnd(function()
if eff.thread < 3 then
local worlds = game._chronoworlds
-- Clone but not the subworlds
game._chronoworlds = nil
local clone = game:chronoClone()
-- Restore the base world and resave it
game._chronoworlds = worlds
game:chronoRestore("see_threads_base", true)
-- Setup next thread
local eff = game.player:hasEffect(game.player.EFF_SEE_THREADS)
eff.thread = eff.thread + 1
game.logPlayer(game.player, "#LIGHT_BLUE#You unfold the space time continuum to the start of the time threads!")
game._chronoworlds = worlds
game:chronoClone("see_threads_base")
-- Add the previous thread
game._chronoworlds["see_threads_"..(eff.thread-1)] = clone
return
else
game._chronoworlds.see_threads_base = nil
local chat = Chat.new("chronomancy-see-threads", {name="See the Threads"}, self, {turns=eff.max_dur})
chat:invoke()
end
end)
end,
}
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