Skip to content
Snippets Groups Projects
Commit 14b79598 authored by Hachem_Muche's avatar Hachem_Muche
Browse files

Object usable power descriptions can take the user's stats into account to...

Object usable power descriptions can take the user's stats into account to provide more information on their effects.
Updated on use descriptions of charms and several artifacts.
The talent cooldown for on use powers can be any talent (not limited to T_GLOBAL_CD as for charms).
parent 9c865a05
No related branches found
No related tags found
No related merge requests found
......@@ -1759,21 +1759,24 @@ function _M:getTextualDesc(compare_with, use_actor)
return desc
end
-- get the textual description of the object's usable power
function _M:getUseDesc(use_actor)
use_actor = use_actor or game.player
local ret = tstring{}
local reduce = 100 - util.bound(use_actor:attr("use_object_cooldown_reduce") or 0, 0, 100)
local usepower = function(power) return math.ceil(power * reduce / 100) end
if self.use_power and not self.use_power.hidden then
local desc = util.getval(self.use_power.name, self, use_actor)
if self.show_charges then
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, with %d charges out of %d."):format(util.getval(self.use_power.name, self), math.floor(self.power / usepower(self.use_power.power)), math.floor(self.max_power / usepower(self.use_power.power))), {"color","LAST"}}
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, with %d charges out of %d."):format(desc, math.floor(self.power / usepower(self.use_power.power)), math.floor(self.max_power / usepower(self.use_power.power))), {"color","LAST"}} --I5
elseif self.talent_cooldown then
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, placing all other charms into a %d cooldown."):format(util.getval(self.use_power.name, self):format(self:getCharmPower(game.player)), usepower(self.use_power.power)), {"color","LAST"}}
local t_name = self.talent_cooldown == "T_GLOBAL_CD" and "all charms" or "Talent "..use_actor:getTalentDisplayName(use_actor:getTalentFromId(self.talent_cooldown))
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, putting %s on cooldown for %d turns."):format(desc:format(self:getCharmPower(game.player)), t_name, usepower(self.use_power.power)), {"color","LAST"}}
else
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, costing %d power out of %d/%d."):format(util.getval(self.use_power.name, self), usepower(self.use_power.power), self.power, self.max_power), {"color","LAST"}}
ret = tstring{{"color","YELLOW"}, ("It can be used to %s, costing %d power out of %d/%d."):format(desc, usepower(self.use_power.power), self.power, self.max_power), {"color","LAST"}}
end
elseif self.use_simple then
ret = tstring{{"color","YELLOW"}, ("It can be used to %s."):format(self.use_simple.name), {"color","LAST"}}
ret = tstring{{"color","YELLOW"}, ("It can be used to %s."):format(util.getval(self.use_simple.name, self, use_actor)), {"color","LAST"}}
elseif self.use_talent then
local t = use_actor:getTalentFromId(self.use_talent.id)
if t then
......
......@@ -105,9 +105,13 @@ newEntity{
level_range = {15, 50},
rarity = 8,
charm_power_def = {add=45, max=400, floor=true},
resolvers.charm(function(self) return ("fire a blast of psionic energies in a beam (dam %d-%d)"):format(self:getCharmPower(who)/2, self:getCharmPower(who)) end, 6, function(self, who)
local tg = {type="beam", range=6 + who:getWil(4)}
charm_power_def = {add=45, max=400, floor=true,
range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
resolvers.charm(
function(self, who) return ("fire a blast of psionic energies in a range %d beam (dam %d-%d)"):format(self.charm_power_def:range(who), self:getCharmPower(who)/2, self:getCharmPower(who)) end,
6,
function(self, who)
local tg = {type="beam", range=self.charm_power_def:range(who)}
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local dam = self:getCharmPower(who)
......
......@@ -32,9 +32,13 @@ newEntity{
level_range = {1, 50},
rarity = 8,
charm_power_def = {add=1, max=5, floor=true},
resolvers.charm("remove up to %d poisons or diseases from the target", 10, function(self, who)
local tg = {default_target=who, type="hit", nowarning=true, range=6 + who:getWil(4), first_target="friend"}
charm_power_def = {add=1, max=5, floor=true,
range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
resolvers.charm(
function(self, who) return ("remove up to %d poisons or diseases from a target within range %d (Willpower)"):format(self:getCharmPower(who), self.charm_power_def:range(who)) end,
10,
function(self, who)
local tg = {default_target=who, type="hit", nowarning=true, range=self.charm_power_def:range(who), first_target="friend"}
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local nb = self:getCharmPower(who)
......@@ -87,9 +91,13 @@ newEntity{
level_range = {25, 50},
rarity = 20,
charm_power_def = {add=50, max=250, floor=true},
resolvers.charm("heal the target for %d", 20, function(self, who)
local tg = {default_target=who, type="hit", nowarning=true, range=6 + who:getWil(4), first_target="friend"}
charm_power_def = {add=50, max=250, floor=true,
range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
resolvers.charm(
function(self, who) return ("heal a target within range %d (Willpower) for %d"):format(self.charm_power_def:range(who), self:getCharmPower(who)) end,
20,
function(self, who)
local tg = {default_target=who, type="hit", nowarning=true, range=self.charm_power_def:range(who), first_target="friend"}
local x, y = who:getTarget(tg)
if not x or not y then return nil end
local dam = self:getCharmPower(who)
......
......@@ -52,9 +52,13 @@ newEntity{
level_range = {1, 50},
rarity = 14,
charm_power_def = {add=resolvers.genericlast(function(e) return e.material_level * 8 end), max=100, floor=true},
resolvers.charm("try to disarm traps in a line (disarm power %d)", 15, function(self, who)
local tg = {type="beam", range=2 + who:getMag(2)}
charm_power_def = {add=resolvers.genericlast(function(e) return e.material_level * 8 end), max=100, floor=true,
range = function(self, who) return who:combatStatScale("mag", 2, 4) end},
resolvers.charm(
function(self, who) return ("disarm traps (%d disarm power, Magic) along a range %d line"):format( self:getCharmPower(who), self.charm_power_def:range(who)) end,
15,
function(self, who)
local tg = {type="beam", range = self.charm_power_def:range(who)}
local x, y = who:getTarget(tg)
if not x or not y then return nil end
who:project(tg, x, y, function(px, py)
......
......@@ -390,14 +390,18 @@ newEntity{ base = "BASE_LONGSWORD", define_as = "SWORD_DAWN",
lite=2,
},
max_power = 35, power_regen = 1,
use_power = { name = "invoke dawn", power = 35,
use_power = {
-- name = "invoke dawn",
name = function(self, who) return ("invoke dawn, inflicting %0.2f light damage in radius %d (based on Magic) and lighting the area within radius %d"):format(engine.interface.ActorTalents.damDesc(who, engine.DamageType.LIGHT, self.use_power.damage(who)), self.use_power.radius, self.use_power.radius*2) end,
power = 35,
radius = 5,
damage = function(who) return 75 + who:getMag()*2 end,
use = function(self, who)
local radius = 4
local dam = (75 + who:getMag()*2)
local blast = {type="ball", range=0, radius=5, selffire=false}
local dam = self.use_power.damage(who)
local blast = {type="ball", range=0, radius=self.use_power.radius, selffire=false}
who:project(blast, who.x, who.y, engine.DamageType.LIGHT, dam)
game.level.map:particleEmitter(who.x, who.y, blast.radius, "sunburst", {radius=blast.radius})
who:project({type="ball", range=0, radius=10}, who.x, who.y, engine.DamageType.LITE, 100)
who:project({type="ball", range=0, radius=self.use_power.radius*2}, who.x, who.y, engine.DamageType.LITE, dam/2)
game:playSoundNear(self, "talents/fireflash")
game.logSeen(who, "%s raises %s and sends out a burst of light!", who.name:capitalize(), self:getName())
return {id=true, used=true}
......
......@@ -150,13 +150,18 @@ newEntity{ base = "BASE_AMULET",
spellsurge_on_crit = 15,
},
max_power = 60, power_regen = 1,
use_power = { name = "unleash a destructive wail", power = 60,
use_power = { name = function(self, who)
return ("unleash a destructive wail dealing %0.2f physical damage (based on Magic) in a radius of %d"):format(engine.interface.ActorTalents.damDesc(who, engine.DamageType.PHYSICAL, self.use_power.damage(who)), self.use_power.radius)
end,
power = 60,
radius = 3,
damage = function(who) return 250 + who:getMag() * 3 end,
use = function(self, who)
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.DIG, 1)
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.DIG, 1)
who:project({type="ball", range=0, selffire=false, radius=3}, who.x, who.y, engine.DamageType.PHYSICAL, 250 + who:getMag() * 3)
who:project({type="ball", range=0, selffire=false, radius=3}, who.x, who.y, engine.DamageType.PHYSICAL, self.use_power.damage(who))
game.logSeen(who, "%s uses the %s!", who.name:capitalize(), self:getName())
return {id=true, used=true}
end
......@@ -565,16 +570,19 @@ newEntity{ base = "BASE_ROD",
level_range = {25, 35},
elec_proof = true,
add_name = false,
material_level = 3,
max_power = 75, power_regen = 1,
use_power = { name = "shoot a cone of fire", power = 50,
use_power = { power = 50,
damage = function(who) return 300 + who:getMag() * 2 end,
radius = 5,
name = function(self, who)
return ("shoot a cone of flames (radius %d) for %0.2f fire damage(based on Magic)"):format(self.use_power.radius, engine.interface.ActorTalents.damDesc(who, engine.DamageType.FIRE, self.use_power.damage(who)))
end,
use = function(self, who)
local tg = {type="cone", range=0, radius=5}
local x, y = who:getTarget(tg)
if not x or not y then return nil end
who:project(tg, x, y, engine.DamageType.FIRE, 300 + who:getMag() * 2, {type="flame"})
who:project(tg, x, y, engine.DamageType.FIRE, self.use_power.damage(who), {type="flame"})
return {id=true, used=true}
end
},
......
......@@ -40,12 +40,18 @@ newEntity{ base = "BASE_ROD",
elec_proof = true,
max_power = 75, power_regen = 1,
use_power = { name = "shoot a bolt of spydric poison", power = 25,
use_power = { power = 25,
name = function(self, who) return ("shoot a bolt of spydric poison out to range %d, dealing %0.2f nature damage over %d turns while rendering the target unable to move"):
format(self.use_power.range, engine.interface.ActorTalents.damDesc(who, engine.DamageType.NATURE, self.use_power.damage(who)), self.use_power.duration) end,
damage = function(who) return 200 + who:getMag() * 4 end,
duration = 6,
range = 12,
use = function(self, who)
local tg = {type="bolt", range=12, talent=t}
local tg = {type="bolt", range=self.use_power.range}
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"})
who:project(tg, x, y, engine.DamageType.SPYDRIC_POISON, {dam=self.use_power.damage(who), dur=self.use_power.duration}, {type="slime"})
return {id=true, used=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