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

Objects with activates now spend their turns after being activated

git-svn-id: http://svn.net-core.org/repos/t-engine4@3005 51575b47-30f0-44d4-a5cc-537603b46e54
parent f3b952c5
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 29 deletions
......@@ -85,9 +85,12 @@ function _M:use(who, typ, inven, item)
if not typ and #types == 1 then typ = types[1] end
if typ == "use" then
who:useEnergy(game.energy_to_act * (inven.use_speed or 1))
if self.use_sound then game:playSoundNear(who, self.use_sound) end
return self:useObject(who, inven, item)
local ret = {self:useObject(who, inven, item)}
if ret[1] then
if self.use_sound then game:playSoundNear(who, self.use_sound) end
who:useEnergy(game.energy_to_act * (inven.use_speed or 1))
end
return unpack(ret)
end
end
......
......@@ -738,7 +738,8 @@ function _M:playerUseItem(object, item, inven)
return true
end
local ret, id = o:use(self, nil, inven, item)
local used, ret, id = o:use(self, nil, inven, item)
if not used then return end
if id then
o:identify(true)
end
......
......@@ -579,6 +579,7 @@ newEntity{ base = "BASE_AMULET",
game.zone:addEntity(game.level, vampire, "actor", x, y)
game:playSoundNear(who, "talents/spell_generic")
return true
end },
}
......@@ -799,6 +800,7 @@ newEntity{ base = "BASE_GEM", define_as = "CRYSTAL_FOCUS",
who.changed = true
game.logPlayer(who, "You fix the crystal on the %s and create the %s.", oldname, o:getName{do_color=true})
return true
end)
end },
}
......@@ -839,6 +841,7 @@ newEntity{ base = "BASE_WAND", define_as = "ROD_OF_ANNULMENT",
end
target.changed = true
end, nil, {type="flame"})
return true
end
},
}
......
......@@ -50,6 +50,7 @@ newEntity{
if wait() then
who:project(tg, x, y, engine.DamageType.DIG, 1)
end
return true
end},
egos = "/data/general/objects/egos/digger.lua", egos_chance = resolvers.mbonus(10, 5),
......
......@@ -114,7 +114,7 @@ newEntity{
who:teleportRandom(who.x, who.y, 200)
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......
......@@ -46,7 +46,7 @@ newEntity{
local power = 100 + who:getMag(120)
who:setEffect(who.EFF_DAMAGE_SHIELD, 10, {power=power})
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......
......@@ -39,7 +39,7 @@ newEntity{
who:teleportRandom(who.x, who.y, 10 + who:getMag(5))
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......
......@@ -201,7 +201,7 @@ newEntity{
who:teleportRandom(who.x, who.y, 200)
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......
......@@ -50,7 +50,7 @@ newEntity{
actor = 1,
})
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -63,7 +63,7 @@ newEntity{
use_power = { name = "light the area", power = 3, use = function(self, who)
who:project({type="ball", range=0, selffire=true, radius=15}, who.x, who.y, engine.DamageType.LITE, 1)
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -90,7 +90,7 @@ newEntity{
who:attr("can_disarm", -1)
end)
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -105,7 +105,7 @@ newEntity{
who:teleportRandom(who.x, who.y, 100)
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -125,7 +125,7 @@ newEntity{
game.level.map:particleEmitter(who.x, who.y, math.max(math.abs(x-who.x), math.abs(y-who.y)), "lightning", {tx=x-who.x, ty=y-who.y})
game:playSoundNear(who, "talents/lightning")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -143,7 +143,7 @@ newEntity{
who:project(tg, x, y, engine.DamageType.FIRE, dam, {type="flame"})
game:playSoundNear(who, "talents/fire")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -169,7 +169,7 @@ newEntity{
who:project(tg, x, y, elem[1], rng.avg(dam / 2, dam, 3), {type=elem[2]})
game:playSoundNear(who, "talents/fire")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -187,6 +187,6 @@ newEntity{
who:project(tg, x, y, engine.DamageType.HEAL, dam)
game:playSoundNear(who, "talents/heal")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -52,6 +52,7 @@ Light around it seems to dim and you can feel its tremendous power simply by tou
use_power = { name = "absorb energies", power = 1000,
use = function(self, who)
game.logPlayer(who, "This power seems too much to wield, you fear it might absorb YOU.")
return true
end
},
......@@ -92,6 +93,7 @@ If used near a portal it could probably activate it.]],
else
game.logPlayer(who, "There is no portal to activate here.")
end
return true
end
},
......@@ -136,6 +138,7 @@ If used near a portal it could probably activate it.]],
else
game.logPlayer(who, "There is no portal to activate here.")
end
return true
end
},
......@@ -170,7 +173,7 @@ newEntity{ define_as = "ORB_UNDEATH",
max_power = 1, power_regen = 1,
use_power = { name = "use the orb", power = 1,
use = function(self, who) who:useCommandOrb(self) end
use = function(self, who) who:useCommandOrb(self) return true end
},
carrier = {
......@@ -199,7 +202,7 @@ newEntity{ define_as = "ORB_DRAGON",
max_power = 1, power_regen = 1,
use_power = { name = "use the orb", power = 1,
use = function(self, who) who:useCommandOrb(self) end
use = function(self, who) who:useCommandOrb(self) return true end
},
carrier = {
......@@ -228,7 +231,7 @@ newEntity{ define_as = "ORB_ELEMENTS",
max_power = 1, power_regen = 1,
use_power = { name = "use the orb", power = 1,
use = function(self, who) who:useCommandOrb(self) end
use = function(self, who) who:useCommandOrb(self) return true end
},
carrier = {
......@@ -257,7 +260,7 @@ newEntity{ define_as = "ORB_DESTRUCTION",
max_power = 1, power_regen = 1,
use_power = { name = "use the orb", power = 1,
use = function(self, who) who:useCommandOrb(self) end
use = function(self, who) who:useCommandOrb(self) return true end
},
carrier = {
......@@ -289,6 +292,7 @@ newEntity{ define_as = "ORB_SCRYING",
local Chat = require("engine.Chat")
local chat = Chat.new("elisa-orb-scrying", {name="Elisa the Scryer"}, who, {version="elisa"})
chat:invoke()
return true
end
},
......@@ -316,6 +320,7 @@ You have heard of such items before, they are very useful to adventurers, allowi
else
game.logPlayer(who, "The rod emits a strange noise, glows briefly and returns to normal.")
end
return true
end
},
}
......@@ -50,7 +50,7 @@ newEntity{
power_source = {nature=true},
use_simple = { name="inscribe your skin with the infusion.", use = function(self, who, inven, item)
if who:setInscription(nil, self.inscription_talent, self.inscription_data, true, true, {obj=self, inven=inven, item=item}) then
return "destroy", true
return true, "destroy", true
end
end}
}
......@@ -72,7 +72,7 @@ newEntity{
power_source = {arcane=true},
use_simple = { name="inscribe your skin with the rune.", use = function(self, who, inven, item)
if who:setInscription(nil, self.inscription_talent, self.inscription_data, true, true, {obj=self, inven=inven, item=item}) then
return "destroy", true
return true, "destroy", true
end
end}
}
......@@ -94,7 +94,7 @@ newEntity{
power_source = {arcane=true},
use_simple = { name="inscribe your skin with the taint.", use = function(self, who, inven, item)
if who:setInscription(nil, self.inscription_talent, self.inscription_data, true, true, {obj=self, inven=inven, item=item}) then
return "destroy", true
return true, "destroy", true
end
end}
}
......
......@@ -50,7 +50,7 @@ newEntity{ base = "BASE_SCROLL", define_as = "JEWELER_SUMMON", subtype="tome", n
max_power = 1, power_regen = 1,
use_power = { name = "summon Limmir the jeweler at the center of the lake of the moon", power = 1,
use = function(self, who) who:hasQuest("master-jeweler"):summon_limmir(who) end
use = function(self, who) who:hasQuest("master-jeweler"):summon_limmir(who) return true end
},
}
......
......@@ -107,6 +107,7 @@ newEntity{ base = "BASE_STAFF",
end
end
game.logSeen(who, "%s is cured of diseases!", who.name:capitalize())
return true
end
},
}
......@@ -142,6 +143,7 @@ newEntity{ base = "BASE_RING",
false
)
game.logSeen(who, "%s brandishes the %s, calling forth the might of the oceans!", who.name:capitalize(), self:getName())
return true
end
},
wielder = {
......@@ -219,6 +221,7 @@ newEntity{ base = "BASE_AMULET",
who:project({type="ball", range=0, selffire=false, radius=3}, who.x, who.y, engine.DamageType.DIG, 1)
who:project({type="ball", range=0, selffire=false, radius=3}, who.x, who.y, engine.DamageType.PHYSICAL, 100 + who:getMag() * 2)
game.logSeen(who, "%s uses the %s!", who.name:capitalize(), self:getName())
return true
end
},
}
......@@ -305,6 +308,7 @@ newEntity{ base = "BASE_LITE",
use = function(self, who)
who:project({type="ball", range=0, radius=20}, who.x, who.y, engine.DamageType.LITE, 100)
game.logSeen(who, "%s brandishes the %s and banishes all shadows!", who.name:capitalize(), self:getName())
return true
end
},
wielder = {
......@@ -330,6 +334,7 @@ This star is the culmination of their craft. Light radiates from its ever-shifti
use = function(self, who)
who:magicMap(20)
game.logSeen(who, "%s brandishes the %s which radiates in all directions!", who.name:capitalize(), self:getName())
return true
end
},
wielder = {
......@@ -381,7 +386,7 @@ newEntity{
else
game.logPlayer(who, "The Blood of Life seems to have no effect on you.")
end
return "destroy", true
return true, "destroy", true
end},
}
......@@ -567,6 +572,7 @@ newEntity{ base = "BASE_LEATHER_BOOT",
use_power = { name = "boost speed", power = 50,
use = function(self, who)
who:setEffect(who.EFF_SPEED, 8, {power=0.20 + who:getCun() / 80})
return true
end
},
}
......@@ -700,6 +706,7 @@ newEntity{
game.level.map:particleEmitter(x, y, 1, "slime")
game:playSoundNear(who, "talents/slime")
return true
end
end },
}
......@@ -1324,6 +1331,7 @@ newEntity{ base = "BASE_GEM",
game.logPlayer(who, "The fusing fails!")
end
end)
return true
end },
}
......@@ -1372,6 +1380,7 @@ newEntity{ base = "BASE_WAND",
local x, y = who:getTarget(tg)
if not x or not y then return nil end
who:project(tg, x, y, engine.DamageType.FIRE, 80 + who:getMag() * 1.2, {type="flame"})
return true
end
},
}
......
......@@ -36,6 +36,7 @@ newEntity{ base = "BASE_WAND",
local x, y = who:getTarget(tg)
if not x or not y then return nil end
who:project(tg, x, y, engine.DamageType.SPYDRIC_POISON, {dam=200 + who:getMag() * 4, dur=6}, {type="slime"})
return true
end
},
}
......@@ -59,6 +59,7 @@ newEntity{ define_as = "ORB_KNOWLEDGE",
end
end
end
return true
end
},
......@@ -116,7 +117,7 @@ newEntity{ define_as = "ARENA_BOOTS_PHAS", name = "a pair of leather boots of ph
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game:playSoundNear(who, "talents/teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......
......@@ -46,6 +46,6 @@ newEntity{ base = "BASE_LEATHER_BOOT",
who:teleportRandom(who.x, who.y, 10 + who:getMag(5))
game.level.map:particleEmitter(who.x, who.y, 1, "teleport")
game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
return nil, true
return true, nil, true
end}
}
......@@ -67,6 +67,7 @@ The Sorcerers seem to have awakened its power.
game.logPlayer(who, "You brandish the staff, draining your foe.")
who:setEffect(who.EFF_POWER_OVERLOAD, 7, {power=30})
target:takeHit(target.life * 0.3, who)
return true
end
},
}
......
......@@ -48,6 +48,7 @@ newEntity{ define_as = "ORB_KNOWLEDGE",
end
end
end
return true
end
},
......
......@@ -25,6 +25,7 @@ newEntity{ base = "BASE_SCROLL", define_as = "NOTE_FROM_LAST_HOPE",
use_simple = { name="open the seal and read the message", use = function(self, who)
game:registerDialog(require("engine.dialogs.ShowText").new(self:getName{do_color=true}, "message-last-hope", {playername=who.name}, game.w * 0.6))
return true
end}
}
......
......@@ -57,7 +57,7 @@ newEntity{
game:setAllowedBuild("wilder_wyrmic", true)
return "destroy", true
return true, "destroy", true
end}
}
......@@ -84,6 +84,6 @@ newEntity{
who:incStat("con", con) if con >= 0 then con="+"..con end
game.logPlayer(who, "#00FF00#Your stats have changed! (Str %s, Dex %s, Mag %s, Wil %s, Cun %s, Con %s)", str, dex, mag, wil, cun, con)
return "destroy", true
return true, "destroy", true
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