diff --git a/game/engine/utils.lua b/game/engine/utils.lua index 7ad5d03170456d1dad9e825d5fca924b3c8ce937..97305ec9195754e9b819c1023dfdb6cb0c4f257f 100644 --- a/game/engine/utils.lua +++ b/game/engine/utils.lua @@ -297,3 +297,8 @@ function rng.mbonus(max, level, max_level) return val end + +function rng.table(t) + local id = rng.range(1, #t) + return t[id], id +end diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index ead116fad3af1dca98625d639e45d06928030c2c..dd4b50697dd0f6fb8eb734b419b8e5e25552cd56 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -86,6 +86,12 @@ function _M:act() -- Compute timed effects self:timedEffects() + -- Handle thunderstorm, even if the actor is stunned or incampacited it still works + if self:isTalentActive(self.T_THUNDERSTORM) then + local t = self:getTalentFromId(self.T_THUNDERSTORM) + t.do_storm(self, t) + end + -- Still enough energy to act ? if self.energy.value < game.energy_to_act then return false end diff --git a/game/modules/tome/data/talents/spells/air.lua b/game/modules/tome/data/talents/spells/air.lua index 45985923c69352d538195fc55ac08234a11cd681..674f043869c4ed5a413a5d2f6175757cc3c17ed9 100644 --- a/game/modules/tome/data/talents/spells/air.lua +++ b/game/modules/tome/data/talents/spells/air.lua @@ -56,3 +56,79 @@ newTalent{ The damage and duration will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.11) * self:getTalentLevel(t), self:getTalentLevel(t)) end, } + +newTalent{ + name = "Wings of Wind", + type = {"spell/air",3}, + require = spells_req3, + points = 5, + mode = "sustained", + sustain_mana = 100, + tactical = { + MOVEMENT = 10, + }, + activate = function(self, t) + return { + fly = self:addTemporaryValue("fly", math.floor(self:getTalentLevel(t))), + } + end, + deactivate = function(self, t, p) + self:removeTemporaryValue("fly", p.fly) + return true + end, + info = function(self, t) + return ([[Grants the caster a pair of wings made of pure wind, allowing her to fly up to %d height.]]): + format(math.floor(self:getTalentLevel(t))) + end, +} + +newTalent{ + name = "Thunderstorm", + type = {"spell/air", 4}, + require = spells_req4, + points = 5, + mode = "sustained", + sustain_mana = 250, + cooldown = 15, + tactical = { + ATTACKAREA = 10, + }, + range = 5, + do_storm = function(self, t) + 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)} + 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(20 + self:combatSpellpower(0.8) * self:getTalentLevel(t)), 3), {type="lightning"}) + end + end, + activate = function(self, t) + game.logSeen(self, "#0080FF#A furious lightning storm forms around %s!", self.name) + return { + drain = self:addTemporaryValue("mana_regen", -2), + } + end, + deactivate = function(self, t, p) + game.logSeen(self, "#0080FF#A furious lightning storm forms around %s!", self.name) + self:removeTemporaryValue("mana_regen", p.drain) + 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 powerfull spell will continuously drain mana while active. + The damage will increase with the Magic stat]]):format(self:getTalentLevel(t), 20 + self:combatSpellpower(0.8) * self:getTalentLevel(t)) + end, +} diff --git a/game/modules/tome/data/talents/spells/phantasm.lua b/game/modules/tome/data/talents/spells/phantasm.lua index 83e2e755eb684d27abd6897acb936fc9ffc45faf..0d12813a3f08014723b49df968fd1d4a497594a5 100644 --- a/game/modules/tome/data/talents/spells/phantasm.lua +++ b/game/modules/tome/data/talents/spells/phantasm.lua @@ -63,7 +63,7 @@ newTalent{ local power = 4 + self:combatSpellpower(0.1) * self:getTalentLevel(t) return { invisible = self:addTemporaryValue("invisible", power), - drain = self:addTemporaryValue("mana_regen", 5), + drain = self:addTemporaryValue("mana_regen", -5), } end, deactivate = function(self, t, p) diff --git a/ideas/spells.ods b/ideas/spells.ods index 8279b4933e879a4eb461636a55bfafe052a81904..abe9adb2d43cfe1efffcead3838162ca90aeca7a 100644 Binary files a/ideas/spells.ods and b/ideas/spells.ods differ