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

sounds

git-svn-id: http://svn.net-core.org/repos/t-engine4@508 51575b47-30f0-44d4-a5cc-537603b46e54
parent 936a495d
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 28 deletions
......@@ -49,7 +49,7 @@ function _M:playSound(name)
self.loaded_sounds[name] = def
s = self.loaded_sounds[name]
end
if not s then return end
if not s or not s.file then return end
local chan = s.file:play(s.loop, s.timed)
if chan and s.fadeout then core.sound.channelFadeOut(chan, s.fadeout) end
end
......@@ -732,3 +732,9 @@ function _M:setAllowedBuild(what, notify)
return true
end
function _M:playSoundNear(who, ...)
if who and self.level.map.seens(who.x, who.y) then
self:playSound(...)
end
end
......@@ -64,7 +64,7 @@ function _M:use(who, typ)
if typ == "use" then
who:useEnergy()
if self.use_sound then game:playSound(self.use_sound) end
if self.use_sound then game:playSoundNear(who, self.use_sound) end
return self:useObject(who)
end
end
......
......@@ -123,8 +123,8 @@ function _M:attackTarget(target, damtype, mult, noenergy)
self.did_energy = true
end
if sound then game:playSound(sound)
elseif sound_miss then game:playSound(sound_miss) end
if sound then game:playSoundNear(self, sound)
elseif sound_miss then game:playSoundNear(self, sound_miss) end
-- Cancel stealth!
self:breakStealth()
......
File added
return {
file = "talents/ice.wav",
volume = 50,
volume = 70,
fadeout = 700,
}
File added
......@@ -135,6 +135,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.ICE, 10 + self:getStr() * 0.3 * self:getTalentLevel(t), {type="freeze"})
game:playSoundNear(self, "talents/breath")
return true
end,
info = function(self, t)
......
......@@ -115,6 +115,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.FIREBURN, 10 + self:getStr() * 0.3 * self:getTalentLevel(t), {type="flame"})
game:playSoundNear(self, "talents/breath")
return true
end,
info = function(self, t)
......
......@@ -123,6 +123,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.SAND, {dur=2+self:getTalentLevelRaw(t), dam=10 + self:getStr() * 0.3 * self:getTalentLevel(t)}, {type="flame"})
game:playSoundNear(self, "talents/breath")
return true
end,
info = function(self, t)
......
......@@ -37,7 +37,7 @@ newTalent{
self.combat_apr = self.combat_apr + 1000
self:attackTarget(target, DamageType.POISON, 1.5 + self:getTalentLevel(t) / 4, true)
self.combat_apr = self.combat_apr - 1000
game:playSound("talents/slime")
game:playSoundNear(self, "talents/slime")
return true
end,
info = function(self, t)
......@@ -59,7 +59,7 @@ newTalent{
DEFEND = 10,
},
activate = function(self, t)
game:playSound("talents/slime")
game:playSoundNear(self, "talents/slime")
local power = 10 + 5 * self:getTalentLevel(t)
return {
onhit = self:addTemporaryValue("on_melee_hit", {[DamageType.ACID]=power}),
......@@ -90,7 +90,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.SLIME, 20 + (self:getDex() * self:getTalentLevel(t)) * 0.3, {type="slime"})
game:playSound("talents/slime")
game:playSoundNear(self, "talents/slime")
return true
end,
info = function(self, t)
......@@ -122,7 +122,7 @@ newTalent{
-- Stunned!
self:setEffect(self.EFF_STUNNED, util.bound(5 - self:getTalentLevel(t) / 2, 2, 7), {})
game:playSound("talents/slime")
game:playSoundNear(self, "talents/slime")
return true
end,
info = function(self, t)
......
......@@ -30,6 +30,7 @@ newTalent{
local tx, ty, target = self:getTarget(tg)
if not tx or not ty or not target or not target.summoner or not target.summoner == self then return nil end
target:setEffect(target.EFF_ALL_STAT, 5, {power=2+math.floor(self:getTalentLevel(t) * 2)})
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -71,6 +72,7 @@ newTalent{
game.logPlayer("You may not detonate this summon.")
return nil
end
game:playSoundNear(self, "talents/fireflash")
return true
end,
info = function(self, t)
......@@ -118,6 +120,7 @@ newTalent{
game.level.map(target.x, target.y, Map.ACTOR, self)
self.x, self.y, target.x, target.y = target.x, target.y, self.x, self.y
game:playSoundNear(self, "talents/teleport")
return true
end,
info = function(self, t)
......
......@@ -29,6 +29,7 @@ newTalent{ short_name = "FIRE_IMP_BOLT",
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.FIRE, self:spellCrit(8 + self:combatSpellpower(0.2) * self:getTalentLevel(t)), {type="flame"})
game:playSoundNear(self, "talents/fire")
return true
end,
info = function(self, t)
......@@ -54,6 +55,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.ACID, 30 + self:getWil(50) * self:getTalentLevel(t), {type="acid"})
game:playSoundNear(self, "talents/breath")
return true
end,
info = function(self, t)
......@@ -79,6 +81,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.LIGHTNING, rng.range(1, 30 + self:getWil(80) * self:getTalentLevel(t)), {type="lightning"})
game:playSoundNear(self, "talents/lightning")
return true
end,
info = function(self, t)
......@@ -104,6 +107,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.POISON, 30 + self:getWil(70) * self:getTalentLevel(t), {type="slime"})
game:playSoundNear(self, "talents/breath")
return true
end,
info = function(self, t)
......@@ -168,6 +172,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -234,6 +239,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -301,6 +307,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -367,6 +374,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......
......@@ -68,6 +68,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -130,6 +131,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -198,6 +200,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -266,6 +269,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......
......@@ -177,6 +177,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -241,6 +242,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -305,6 +307,7 @@ newTalent{
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -358,6 +361,7 @@ newTalent{
game.level.map:moveViewSurround(self.summoner.x, self.summoner.y, 8, 8)
end
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......
......@@ -34,7 +34,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.LIGHTNING, rng.avg(1, self:spellCrit(20 + self:combatSpellpower(0.8) * self:getTalentLevel(t)), 3), {type="lightning"})
game:playSound("talents/lightning")
game:playSoundNear(self, "talents/lightning")
return true
end,
info = function(self, t)
......@@ -87,7 +87,7 @@ newTalent{
end
fork(fx, fy)
game:playSound("talents/lightning")
game:playSoundNear(self, "talents/lightning")
return true
end,
......@@ -165,11 +165,11 @@ newTalent{
table.remove(tgts, id)
self:project(tg, a.x, a.y, DamageType.LIGHTNING, rng.avg(1, self:spellCrit(20 + self:combatSpellpower(0.2) * self:getTalentLevel(t)), 3), {type="lightning"})
game:playSound("talents/lightning")
game:playSoundNear(self, "talents/lightning")
end
end,
activate = function(self, t)
game:playSound("talents/thunderstorm")
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)),
......
......@@ -35,7 +35,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.ARCANE, self:spellCrit(20 + self:combatSpellpower(0.5) * self:getTalentLevel(t)), {type="manathrust"})
game:playSound("talents/arcane")
game:playSoundNear(self, "talents/arcane")
return true
end,
info = function(self, t)
......@@ -58,7 +58,7 @@ newTalent{
action = function(self, t)
if not self:hasEffect(self.EFF_MANAFLOW) then
self:setEffect(self.EFF_MANAFLOW, 10, {power=5+self:combatSpellpower(0.06) * self:getTalentLevel(t)})
game:playSound("talents/arcane")
game:playSoundNear(self, "talents/arcane")
end
return true
end,
......@@ -98,7 +98,7 @@ newTalent{
activate = function(self, t)
local power = math.max(0.8, 3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280)
self.disruption_shield_absorb = 0
game:playSound("talents/arcane")
game:playSoundNear(self, "talents/arcane")
return {
shield = self:addTemporaryValue("disruption_shield", power),
}
......
......@@ -52,7 +52,7 @@ newTalent{
target:teleportRandom(x, y, 10 + self:combatSpellpower(0.1))
game.level.map:particleEmitter(target.x, target.y, 1, "teleport")
end
game:playSound("talents/teleport")
game:playSoundNear(self, "talents/teleport")
return true
end,
info = function(self, t)
......@@ -98,7 +98,7 @@ newTalent{
target:teleportRandom(x, y, 100 + self:combatSpellpower(0.1))
game.level.map:particleEmitter(target.x, target.y, 1, "teleport")
end
game:playSound("talents/teleport")
game:playSoundNear(self, "talents/teleport")
return true
end,
info = function(self, t)
......@@ -129,7 +129,7 @@ newTalent{
local power = 50 + self:combatSpellpower(0.4) * self:getTalentLevel(t)
local chance = 20 + self:getTalentLevel(t) * 5
self:setEffect(self.EFF_DISPLACEMENT_SHIELD, dur, {power=power, target=target, chance=chance})
game:playSound("talents/teleport")
game:playSoundNear(self, "talents/teleport")
return true
end,
info = function(self, t)
......@@ -152,7 +152,7 @@ newTalent{
MOVEMENT = 20,
},
activate = function(self, t)
game:playSound("talents/teleport")
game:playSoundNear(self, "talents/teleport")
local power = math.floor(4 + self:combatSpellpower(0.06) * self:getTalentLevel(t))
return {
prob_travel = self:addTemporaryValue("prob_travel", power),
......
......@@ -35,7 +35,7 @@ newTalent{
object = (self:getTalentLevel(t) >= 2) and 1 or 0,
trap = (self:getTalentLevel(t) >= 5) and 1 or 0,
})
game:playSound("talents/spell_generic")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -81,7 +81,7 @@ newTalent{
game.logPlayer(who, "You identify everything around you.")
end
game:playSound("talents/spell_generic")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -100,7 +100,7 @@ newTalent{
cooldown = 20,
action = function(self, t)
self:magicMap(10 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
game:playSound("talents/spell_generic")
game:playSoundNear(self, "talents/spell_generic")
return true
end,
info = function(self, t)
......@@ -119,7 +119,7 @@ newTalent{
activate = function(self, t)
-- There is an implicit +10, as it is the default radius
local rad = self:combatSpellpower(0.1) * self:getTalentLevel(t)
game:playSound("talents/spell_generic")
game:playSoundNear(self, "talents/spell_generic")
return {
esp = self:addTemporaryValue("esp", {range=rad, all=1}),
}
......
......@@ -31,7 +31,7 @@ newTalent{
DEFEND = 10,
},
activate = function(self, t)
game:playSound("talents/earth")
game:playSoundNear(self, "talents/earth")
local power = 4 + self:combatSpellpower(0.03) * self:getTalentLevel(t)
return {
armor = self:addTemporaryValue("combat_armor", power),
......@@ -62,7 +62,7 @@ newTalent{
for i = 1, self:getTalentLevelRaw(t) do
self:project(tg, x, y, DamageType.DIG, 1)
end
game:playSound("talents/earth")
game:playSoundNear(self, "talents/earth")
return true
end,
info = function(self, t)
......@@ -87,7 +87,7 @@ newTalent{
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.SPELLKNOCKBACK, self:spellCrit(8 + self:combatSpellpower(0.15) * self:getTalentLevel(t)))
game:playSound("talents/earth")
game:playSoundNear(self, "talents/earth")
return true
end,
info = function(self, t)
......@@ -147,7 +147,7 @@ newTalent{
end
end end end
game:playSound("talents/earth")
game:playSoundNear(self, "talents/earth")
return true
end,
info = function(self, t)
......
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