Skip to content
Snippets Groups Projects
water.lua 7.56 KiB
Newer Older
  • Learn to ignore specific revisions
  • dg's avatar
    dg committed
    -- ToME - Tales of Maj'Eyal
    
    dg's avatar
    dg committed
    -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
    
    dg's avatar
    dg committed
    --
    -- 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
    
    
    dg's avatar
    dg committed
    newTalent{
    
    	name = "Glacial Vapour",
    
    dg's avatar
    dg committed
    	type = {"spell/water",1},
    
    dg's avatar
    dg committed
    	require = spells_req1,
    
    	random_ego = "attack",
    
    dg's avatar
    dg committed
    	cooldown = 8,
    
    	tactical = { ATTACKAREA = { COLD = 2 } },
    
    	requires_target = true,
    
    	target = function(self, t)
    		return {type="ball", range=self:getTalentRange(t), radius=self:getTalentRadius(t)}
    	end,
    
    dg's avatar
    dg committed
    	getDamage = function(self, t) return self:combatTalentSpellDamage(t, 4, 50) end,
    	getDuration = function(self, t) return self:getTalentLevel(t) + 2 end,
    
    dg's avatar
    dg committed
    	action = function(self, t)
    
    		local x, y = self:getTarget(tg)
    
    dg's avatar
    dg committed
    		if not x or not y then return nil end
    
    		local _ _, _, _, x, y = self:canProject(tg, x, y)
    
    dg's avatar
    dg committed
    		-- Add a lasting map effect
    		game.level.map:addEffect(self,
    
    dg's avatar
    dg committed
    			x, y, t.getDuration(self, t),
    
    			DamageType.COLD, t.getDamage(self, t),
    
    dg's avatar
    dg committed
    			5, nil,
    
    			{type="ice_vapour"},
    
    dg's avatar
    dg committed
    			nil, self:spellFriendlyFire()
    		)
    
    dg's avatar
    dg committed
    		game:playSoundNear(self, "talents/cloud")
    
    dg's avatar
    dg committed
    		return true
    	end,
    
    	info = function(self, t)
    
    dg's avatar
    dg committed
    		local damage = t.getDamage(self, t)
    		local duration = t.getDuration(self, t)
    
    		return ([[Glacial fumes rise from the ground doing %0.2f cold damage in a radius of 3 each turn for %d turns.
    
    dg's avatar
    dg committed
    		The damage will increase with your Spellpower.]]):
    
    		format(damDesc(self, DamageType.COLD, damage), duration)
    
    dg's avatar
    dg committed
    	end,
    }
    
    
    dg's avatar
    dg committed
    newTalent{
    
    dg's avatar
    dg committed
    	name = "Freeze",
    
    dg's avatar
    dg committed
    	type = {"spell/water", 2},
    	require = spells_req2,
    	points = 5,
    
    	random_ego = "attack",
    
    dg's avatar
    dg committed
    	mana = 14,
    
    dg's avatar
    dg committed
    	cooldown = function(self, t) return 7 + self:getTalentLevelRaw(t) end,
    
    	tactical = { ATTACK = { COLD = 1 }, DISABLE = { stun = 3 } },
    
    dg's avatar
    dg committed
    	reflectable = true,
    
    	requires_target = true,
    
    	getDamage = function(self, t) return self:combatTalentSpellDamage(t, 12, 180) * (5 + self:getTalentLevelRaw(t)) / 5 end,
    
    dg's avatar
    dg committed
    	action = function(self, t)
    
    dg's avatar
    dg committed
    		local tg = {type="hit", range=self:getTalentRange(t), talent=t}
    		local x, y = self:getTarget(tg)
    		if not x or not y then return nil end
    
    		local dam = self:spellCrit(t.getDamage(self, t))
    		self:project(tg, x, y, DamageType.COLD, dam, {type="freeze"})
    
    		self:project(tg, x, y, DamageType.FREEZE, {dur=2+math.ceil(self:getTalentLevelRaw(t)), hp=70 + dam * 1.5})
    
    dg's avatar
    dg committed
    		game:playSoundNear(self, "talents/water")
    
    dg's avatar
    dg committed
    		return true
    	end,
    	info = function(self, t)
    
    dg's avatar
    dg committed
    		local damage = t.getDamage(self, t)
    
    		return ([[Condenses ambient water on a target, freezing it for %d turns and damaging it for %0.2f.
    
    dg's avatar
    dg committed
    		The damage will increase with your Spellpower.]]):format(2+math.ceil(self:getTalentLevelRaw(t)), damDesc(self, DamageType.COLD, damage))
    
    dg's avatar
    dg committed
    	end,
    }
    
    
    dg's avatar
    dg committed
    newTalent{
    
    dg's avatar
    dg committed
    	name = "Tidal Wave",
    
    	type = {"spell/water",3},
    
    dg's avatar
    dg committed
    	require = spells_req3,
    
    	random_ego = "attack",
    
    	cooldown = 10,
    
    	tactical = { ESCAPE = { knockback = 2 }, ATTACKAREA = { COLD = 0.5, PHYSICAL = 0.5 }, DISABLE = { knockback = 1 } },
    
    	requires_target = true,
    
    	radius = function(self, t)
    		return 1 + 0.5 * t.getDuration(self, t)
    	end,
    	target = function(self, t)
    		return {type="ball", range=self:getTalentRange(t), radius=self:getTalentRadius(t)}
    	end,
    
    dg's avatar
    dg committed
    	getDamage = function(self, t) return self:combatTalentSpellDamage(t, 5, 90) end,
    
    	getDuration = function(self, t) return 3 + self:combatTalentSpellDamage(t, 5, 5) end,
    
    dg's avatar
    dg committed
    	action = function(self, t)
    
    dg's avatar
    dg committed
    		-- Add a lasting map effect
    		game.level.map:addEffect(self,
    
    dg's avatar
    dg committed
    			self.x, self.y, t.getDuration(self, t),
    
    			DamageType.WAVE, {dam=t.getDamage(self, t), x=self.x, y=self.y},
    
    dg's avatar
    dg committed
    			1,
    
    dg's avatar
    dg committed
    			5, nil,
    			engine.Entity.new{alpha=100, display='', color_br=30, color_bg=60, color_bb=200},
    			function(e)
    
    dg's avatar
    dg committed
    				e.radius = e.radius + 0.5
    				return true
    
    dg's avatar
    dg committed
    			end,
    			false
    		)
    
    dg's avatar
    dg committed
    		game:playSoundNear(self, "talents/tidalwave")
    
    dg's avatar
    dg committed
    		return true
    	end,
    
    	info = function(self, t)
    
    dg's avatar
    dg committed
    		local damage = t.getDamage(self, t)
    		local duration = t.getDuration(self, t)
    
    		local radius = self:getTalentRadius(t)
    		return ([[A wall of water rushes out from the caster with radius 1, increasing 1 per turn to a maximum eventual radius of %d, doing %0.2f cold damage and %0.2f physical damage as well as knocking back targets each turn for %d turns.
    
    dg's avatar
    dg committed
    		The damage and duration will increase with your Spellpower.]]):
    
    		format(radius, damDesc(self, DamageType.COLD, damage/2), damDesc(self, DamageType.PHYSICAL, damage/2), duration)
    
    dg's avatar
    dg committed
    	end,
    }
    
    newTalent{
    
    	name = "Shivgoroth Form",
    
    dg's avatar
    dg committed
    	type = {"spell/water",4},
    
    dg's avatar
    dg committed
    	require = spells_req4,
    
    	random_ego = "attack",
    
    	mana = 25,
    	cooldown = 20,
    
    	tactical = { BUFF = 3, ATTACKAREA = { COLD = 0.5, PHYSICAL = 0.5 }, DISABLE = { knockback = 1 } },
    	direct_hit = true,
    	range = 10,
    	requires_target = true,
    	getDuration = function(self, t) return 4 + math.ceil(self:getTalentLevel(t)) end,
    	getPower = function(self, t) return util.bound(50 + self:combatTalentSpellDamage(t, 50, 450), 0, 500) / 500 end,
    	action = function(self, t)
    		self:setEffect(self.EFF_SHIVGOROTH_FORM, t.getDuration(self, t), {power=t.getPower(self, t), lvl=self:getTalentLevelRaw(t)})
    		game:playSoundNear(self, "talents/tidalwave")
    		return true
    	end,
    	info = function(self, t)
    		local power = t.getPower(self, t)
    		local dur = t.getDuration(self, t)
    		return ([[You absorb latent cold around you, turning into an ice elemental - a shivgoroth - for %d turns.
    		While transformed you gain access to the Ice Storm talent level %d, %d%% resistance to cuts and stuns, %d%% cold resistance, you do not need to breath and all cold damage heals you for %d%% of the damage done.
    		The power will increase with your Spellpower.]]):
    		format(dur, self:getTalentLevelRaw(t), power * 100, power * 100 / 2, 50 + power * 100)
    	end,
    }
    
    newTalent{
    	name = "Ice Storm",
    	type = {"spell/other",1},
    	points = 5,
    	random_ego = "attack",
    	mana = 25,
    	cooldown = 20,
    
    	tactical = { ATTACKAREA = { COLD = 2, stun = 1 } },
    
    	requires_target = true,
    
    	target = function(self, t)
    		return {type="ball", range=self:getTalentRange(t), radius=self:getTalentRadius(t), selffire=false}
    	end,
    
    dg's avatar
    dg committed
    	getDamage = function(self, t) return self:combatTalentSpellDamage(t, 5, 90) end,
    	getDuration = function(self, t) return 5 + self:combatSpellpower(0.05) + self:getTalentLevel(t) end,
    
    dg's avatar
    dg committed
    	action = function(self, t)
    
    dg's avatar
    dg committed
    		-- Add a lasting map effect
    		game.level.map:addEffect(self,
    
    dg's avatar
    dg committed
    			self.x, self.y, t.getDuration(self, t),
    			DamageType.ICE, t.getDamage(self, t),
    			3,
    
    dg's avatar
    dg committed
    			5, nil,
    
    			{type="icestorm", only_one=true},
    
    dg's avatar
    dg committed
    			function(e)
    				e.x = e.src.x
    				e.y = e.src.y
    
    dg's avatar
    dg committed
    				return true
    
    dg's avatar
    dg committed
    			end,
    			false
    		)
    
    dg's avatar
    dg committed
    		game:playSoundNear(self, "talents/icestorm")
    
    dg's avatar
    dg committed
    		return true
    	end,
    
    	info = function(self, t)
    
    dg's avatar
    dg committed
    		local damage = t.getDamage(self, t)
    		local duration = t.getDuration(self, t)
    
    dg's avatar
    dg committed
    		return ([[A furious ice storm rages around the caster doing %0.2f cold damage in a radius of 3 each turn for %d turns.
    
    dg's avatar
    dg committed
    		It has 25%% chance to freeze damaged targets.
    
    dg's avatar
    dg committed
    		The damage and duration will increase with your Spellpower.]]):format(damDesc(self, DamageType.COLD, damage), duration)
    
    dg's avatar
    dg committed
    	end,
    }