diff --git a/game/engine/interface/ActorTalents.lua b/game/engine/interface/ActorTalents.lua index 81501bc2eb37d42f28a05635998c4d6e891fed2c..58ed6794677455c258369ffaa5917052842af807 100644 --- a/game/engine/interface/ActorTalents.lua +++ b/game/engine/interface/ActorTalents.lua @@ -8,16 +8,16 @@ _M.talents_types_def = {} --- Defines actor talents -- Static! -function _M:loadDefinition(file) +function _M:loadDefinition(file, env) local f, err = loadfile(file) if not f and err then error(err) end - setfenv(f, setmetatable({ + setfenv(f, setmetatable(env or { DamageType = require("engine.DamageType"), Talents = self, Map = require("engine.Map"), newTalent = function(t) self:newTalent(t) end, newTalentType = function(t) self:newTalentType(t) end, - load = function(f) self:loadDefinition(f) end + load = function(f) self:loadDefinition(f, getfenv(2)) end }, {__index=_G})) f() end diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index c3024a2c9cecd2522840d37a296cb81c55d935a4..ead116fad3af1dca98625d639e45d06928030c2c 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -97,7 +97,7 @@ function _M:move(x, y, force) if force or self:enoughEnergy() then -- Should we prob travel through walls ? if not force and self:attr("prob_travel") and game.level.map:checkEntity(x, y, Map.TERRAIN, "block_move", self) then - moved = self:probabilityTravel(x, y) + moved = self:probabilityTravel(x, y, self:attr("prob_travel")) -- Never move but tries to attack ? ok elseif not force and self:attr("never_move") then -- A bit weird, but this simple asks the collision code to detect an attack @@ -112,14 +112,15 @@ function _M:move(x, y, force) end --- Blink through walls -function _M:probabilityTravel(x, y) +function _M:probabilityTravel(x, y, dist) local dirx, diry = x - self.x, y - self.y local tx, ty = x, y - while game.level.map:checkEntity(x, y, Map.TERRAIN, "block_move", self) do + while game.level.map:isBound(tx, ty) and game.level.map:checkAllEntities(tx, ty, "block_move", self) and dist > 0 do tx = tx + dirx ty = ty + diry + dist = dist - 1 end - if game.level.map:isBound(x, y) then + if game.level.map:isBound(tx, ty) and not game.level.map:checkAllEntities(tx, ty, "block_move", self) then return engine.Actor.move(self, tx, ty, false) end return true diff --git a/game/modules/tome/data/birth/classes.lua b/game/modules/tome/data/birth/classes.lua index c97c1b7d19c43f1bc443e63762e78836259b05fd..b99dfad644a0ac09d58fe5d525cd920c91e7e105 100644 --- a/game/modules/tome/data/birth/classes.lua +++ b/game/modules/tome/data/birth/classes.lua @@ -130,7 +130,7 @@ newBirthDescriptor{ ["spell/earth"]={true, 0.3}, ["spell/water"]={true, 0.3}, ["spell/air"]={true, 0.3}, - ["spell/mind"]={true, 0.3}, + ["spell/phantasm"]={true, 0.3}, ["spell/temporal"]={true, 0.3}, ["spell/meta"]={true, 0.3}, ["spell/divination"]={true, 0.3}, diff --git a/game/modules/tome/data/talents/spells/conveyance.lua b/game/modules/tome/data/talents/spells/conveyance.lua index ed1b86b14f0b5f79424e6d8e98c133bb30505226..162649ec6bf1dba6d9a403b0a2ba6c3ec662d5ff 100644 --- a/game/modules/tome/data/talents/spells/conveyance.lua +++ b/game/modules/tome/data/talents/spells/conveyance.lua @@ -115,22 +115,24 @@ newTalent{ type = {"spell/conveyance",4}, mode = "sustained", require = spells_req4, - points = 1, - points = 2, + points = 5, cooldown = 40, - sustain_mana = 100, + sustain_mana = 200, tactical = { MOVEMENT = 20, }, activate = function(self, t) - self:attr("prob_travel", 1) - return true + local power = math.floor(4 + self:combatSpellpower(0.06) * self:getTalentLevel(t)) + return { + prob_travel = self:addTemporaryValue("prob_travel", power), + } end, - deactivate = function(self, t) - self:attr("prob_travel", -1) + deactivate = function(self, t, p) + self:removeTemporaryValue("prob_travel", p.prob_travel) return true end, info = function(self, t) - return ([[When you hit a solid surface this spell tears down the laws of probability to make you instantly appear on the other side.]]) + return ([[When you hit a solid surface this spell tears down the laws of probability to make you instantly appear on the other side. + Works up to %d grids.]]):format(math.floor(4 + self:combatSpellpower(0.06) * self:getTalentLevel(t))) end, } diff --git a/game/modules/tome/data/talents/spells/earth.lua b/game/modules/tome/data/talents/spells/earth.lua index b8929d22db8a14c5faaf9f5e99dbf8064e1bef3f..ab6189d2ff34fdeab1e3dc4c9401bad89a113896 100644 --- a/game/modules/tome/data/talents/spells/earth.lua +++ b/game/modules/tome/data/talents/spells/earth.lua @@ -7,7 +7,7 @@ newTalent{ require = spells_req1, points = 5, sustain_mana = 45, --- cooldown = 10, + cooldown = 10, tactical = { DEFEND = 10, }, diff --git a/game/modules/tome/data/talents/spells/fire.lua b/game/modules/tome/data/talents/spells/fire.lua index 04e6a5e3147dde0e4fa37d2ba9f9e853f801ad72..a360221254509b6f9ca29d54205bb8be0c7a3b60 100644 --- a/game/modules/tome/data/talents/spells/fire.lua +++ b/game/modules/tome/data/talents/spells/fire.lua @@ -23,32 +23,10 @@ newTalent{ } newTalent{ - name = "Globe of Light", + name = "Fireflash", type = {"spell/fire",2}, require = spells_req2, points = 5, - mana = 5, - cooldown = 14, - action = function(self, t) - local tg = {type="ball", range=0, friendlyfire=false, radius=5 + self:getTalentLevel(t)} - self:project(tg, self.x, self.y, DamageType.LIGHT, 1) - if self:getTalentLevel(t) >= 3 then - self:project(tg, self.x, self.y, DamageType.BLIND, 3 + self:getTalentLevel(t)) - end - return true - end, - info = function(self, t) - return ([[Creates a globe of pure light with a radius of %d that illuminates the area. - At level 3 it also blinds all who sees it (except the caster). - The radius will increase with the Magic stat]]):format(5 + self:getTalentLevel(t)) - end, -} - -newTalent{ - name = "Fireflash", - type = {"spell/fire",3}, - require = spells_req3, - points = 5, mana = 40, cooldown = 8, tactical = { diff --git a/game/modules/tome/data/talents/spells/phantasm.lua b/game/modules/tome/data/talents/spells/phantasm.lua index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7ffe4ddc37c1977580faf1a2799c370a9a1fee60 100644 --- a/game/modules/tome/data/talents/spells/phantasm.lua +++ b/game/modules/tome/data/talents/spells/phantasm.lua @@ -0,0 +1,77 @@ +newTalent{ + name = "Illuminate", + type = {"spell/phantasm",1}, + require = spells_req1, + points = 5, + mana = 5, + cooldown = 14, + action = function(self, t) + local tg = {type="ball", range=0, friendlyfire=false, radius=5 + self:getTalentLevel(t)} + self:project(tg, self.x, self.y, DamageType.LIGHT, 1) + if self:getTalentLevel(t) >= 3 then + self:project(tg, self.x, self.y, DamageType.BLIND, 3 + self:getTalentLevel(t)) + end + return true + end, + info = function(self, t) + return ([[Creates a globe of pure light with a radius of %d that illuminates the area. + At level 3 it also blinds all who sees it (except the caster). + The radius will increase with the Magic stat]]):format(5 + self:getTalentLevel(t)) + end, +} + +newTalent{ + name = "Blur Sight", + type = {"spell/phantasm", 2}, + mode = "sustained", + require = spells_req2, + points = 5, + sustain_mana = 60, + cooldown = 10, + tactical = { + DEFEND = 10, + }, + activate = function(self, t) + local power = 4 + self:combatSpellpower(0.1) * self:getTalentLevel(t) + return { + def = self:addTemporaryValue("combat_def", power), + } + end, + deactivate = function(self, t, p) + self:removeTemporaryValue("combat_def", p.def) + return true + end, + info = function(self, t) + return ([[The caster image blurs, making her harder to hit, granting %d bonus to defense. + The bonus will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.1) * self:getTalentLevel(t)) + end, +} + + +newTalent{ + name = "Invisibility", + type = {"spell/phantasm", 4}, + mode = "sustained", + require = spells_req4, + points = 5, + sustain_mana = 200, + cooldown = 30, + tactical = { + DEFEND = 10, + }, + activate = function(self, t) + local power = 4 + self:combatSpellpower(0.1) * self:getTalentLevel(t) + return { + invisible = self:addTemporaryValue("invisible", power), + } + end, + deactivate = function(self, t, p) + self:removeTemporaryValue("invisible", p.invisible) + return true + end, + info = function(self, t) + return ([[The caster fades from sight, granting %d bonus to invisibility. + The bonus will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.1) * self:getTalentLevel(t)) + end, +} + diff --git a/ideas/spells.ods b/ideas/spells.ods index cc4e805cc25dbfea3d042b446556266f2ea2412e..acfd34e1a2a8420d8aae10f6f2309c05199b2628 100644 Binary files a/ideas/spells.ods and b/ideas/spells.ods differ