Commit 93e8d735b4d79ba0a3990c4b7e42196b08c4e161

Authored by DarkGod
2 parents 4b3ef19d 452ca2a9

Merge branch 'StandardizingCharmPowers' into 'master'

Standardizing charm powers

Makes the on use description for tools, amulets, mindstars and staves more consistent and standardizes use_power definitions.

Fixes a couple of typos and prepares npc objects use.
... ... @@ -300,7 +300,7 @@ newEntity{
300 300 end,
301 301 20,
302 302 function(self, who)
303   - local tg = {type="hit", range=10,}
  303 + local tg = {type="hit", range=self.use_power.range,}
304 304 local x, y, target = who:getTarget(tg)
305 305 if not x or not y then return nil end
306 306 if target then
... ... @@ -317,7 +317,8 @@ newEntity{
317 317 return {id=true, used=true}
318 318 end,
319 319 "T_GLOBAL_CD",
320   - {damage = function(self, who) return self:getCharmPower(who) + (who:combatMindpower() * (1 + self.material_level/5)) end}
  320 + {damage = function(self, who) return self:getCharmPower(who) + (who:combatMindpower() * (1 + self.material_level/5)) end,
  321 + range = 10,}
321 322 ),
322 323 }
323 324
... ...
... ... @@ -236,7 +236,7 @@ newEntity{
236 236 local range = self.use_power.range(self)
237 237 local dam = who:damDesc(damtype, self.use_power.damage(self, who))
238 238 local damrange = self.use_power.damrange(self, who)
239   - return ("project a bolt from the staff (to range %d) dealing %0.2f - %0.2f %s damage"):format(range, dam, dam*damrange, damtype.name)
  239 + return ("project a bolt from the staff (to range %d) dealing %0.2f to %0.2f %s damage"):format(range, dam, dam*damrange, damtype.name)
240 240 end,
241 241 5,
242 242 function(self, who)
... ... @@ -340,7 +340,7 @@ newEntity{
340 340 local radius = self.use_power.radius(self)
341 341 local dam = who:damDesc(damtype, self.use_power.damage(self, who))
342 342 local damrange = self.use_power.damrange(self, who)
343   - return ("unleash an elemental blastwave, dealing %0.2f - %0.2f %s damage in a radius %d around the user"):format(dam, dam*damrange, damtype.name, radius)
  343 + return ("unleash an elemental blastwave, dealing %0.2f to %0.2f %s damage in a radius %d around the user"):format(dam, dam*damrange, damtype.name, radius)
344 344 end,
345 345 10,
346 346 function(self, who)
... ... @@ -456,7 +456,7 @@ newEntity{
456 456 local radius = self.use_power.radius(self)
457 457 local dam = who:damDesc(damtype, self.use_power.damage(self, who))
458 458 local damrange = self.use_power.damrange(self, who)
459   - return ("conjure elemental energy in a radius %d cone, dealing %0.2f - %0.2f %s damage"):format( radius, dam, dam*damrange, damtype.name)
  459 + return ("conjure elemental energy in a radius %d cone, dealing %0.2f to %0.2f %s damage"):format( radius, dam, dam*damrange, damtype.name)
460 460 end,
461 461 8,
462 462 function(self, who)
... ...
... ... @@ -105,18 +105,24 @@ newEntity{
105 105 level_range = {15, 50},
106 106 rarity = 8,
107 107
108   - charm_power_def = {add=45, max=400, floor=true,
109   - range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
  108 + charm_power_def = {add=45, max=400, floor=true},
110 109 resolvers.charm(
111   - 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,
  110 + function(self, who)
  111 + local dam = who:damDesc(engine.DamageType.MIND, self.use_power.damage(self, who))
  112 + return ("fire a blast of psionic energies in a range %d (based on Willpower) beam dealing %0.2f to %0.2f mind damage"):format(self.use_power.range(self, who), dam/2, dam)
  113 + end,
112 114 6,
113 115 function(self, who)
114   - local tg = {type="beam", range=self.charm_power_def:range(who)}
115   - local x, y = who:getTarget(tg)
116   - if not x or not y then return nil end
117   - local dam = self:getCharmPower(who)
118   - who:project(tg, x, y, engine.DamageType.MIND, rng.avg(dam / 2, dam, 3), {type="mind"})
119   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
120   - return {id=true, used=true}
121   - end),
  116 + local tg = {type="beam", range=self.use_power.range(self, who)}
  117 + local x, y = who:getTarget(tg)
  118 + if not x or not y then return nil end
  119 + local dam = self:getCharmPower(who)
  120 + who:project(tg, x, y, engine.DamageType.MIND, rng.avg(dam / 2, dam, 3), {type="mind"})
  121 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
  122 + return {id=true, used=true}
  123 + end,
  124 + "T_GLOBAL_CD",
  125 + {range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end,
  126 + damage = function(self, who) return self:getCharmPower(who) end}
  127 + )
122 128 }
... ...
... ... @@ -32,16 +32,15 @@ newEntity{
32 32 level_range = {1, 50},
33 33 rarity = 8,
34 34
35   - charm_power_def = {add=1, max=5, floor=true,
36   - range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
  35 + charm_power_def = {add=1, max=5, floor=true},
37 36 resolvers.charm(
38   - 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,
  37 + function(self, who) return ("remove up to %d poisons or diseases from a target within range %d (based on Willpower)"):format(self.use_power.cures(self, who), self.use_power.range(self, who)) end,
39 38 10,
40 39 function(self, who)
41   - local tg = {default_target=who, type="hit", nowarning=true, range=self.charm_power_def:range(who), first_target="friend"}
  40 + local tg = {default_target=who, type="hit", nowarning=true, range=self.use_power.range(self, who), first_target="friend"}
42 41 local x, y = who:getTarget(tg)
43 42 if not x or not y then return nil end
44   - local nb = self:getCharmPower(who)
  43 + local nb = self.use_power.cures(self, who)
45 44 who:project(tg, x, y, function(px, py)
46 45 local target = game.level.map(px, py, engine.Map.ACTOR)
47 46 if not target then return end
... ... @@ -65,9 +64,13 @@ newEntity{
65 64 end
66 65 end)
67 66 game:playSoundNear(who, "talents/heal")
68   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
  67 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
69 68 return {id=true, used=true}
70   - end),
  69 + end,
  70 + "T_GLOBAL_CD",
  71 + {range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end,
  72 + cures = function(self, who) return self:getCharmPower(who) end}
  73 + ),
71 74 }
72 75
73 76 newEntity{
... ... @@ -80,7 +83,7 @@ newEntity{
80 83 resolvers.charm(function(self) return ("harden the skin for 7 turns increasing armour by %d and armour hardiness by %d%%%%"):format(self:getCharmPower(who), 20 + self.material_level * 10) end, 20, function(self, who)
81 84 who:setEffect(who.EFF_THORNY_SKIN, 7, {ac=self:getCharmPower(who), hard=20 + self.material_level * 10})
82 85 game:playSoundNear(who, "talents/heal")
83   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
  86 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
84 87 return {id=true, used=true}
85 88 end),
86 89 }
... ... @@ -91,19 +94,22 @@ newEntity{
91 94 level_range = {25, 50},
92 95 rarity = 20,
93 96
94   - charm_power_def = {add=50, max=250, floor=true,
95   - range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end},
  97 + charm_power_def = {add=50, max=250, floor=true},
96 98 resolvers.charm(
97   - function(self, who) return ("heal a target within range %d (Willpower) for %d"):format(self.charm_power_def:range(who), self:getCharmPower(who)) end,
  99 + function(self, who) return ("heal a target within range %d (based on Willpower) for %d"):format(self.use_power.range(self, who), self.use_power.damage(self, who)) end,
98 100 20,
99 101 function(self, who)
100   - local tg = {default_target=who, type="hit", nowarning=true, range=self.charm_power_def:range(who), first_target="friend"}
101   - local x, y = who:getTarget(tg)
102   - if not x or not y then return nil end
103   - local dam = self:getCharmPower(who)
104   - who:project(tg, x, y, engine.DamageType.HEAL, dam)
105   - game:playSoundNear(who, "talents/heal")
106   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
107   - return {id=true, used=true}
108   - end),
  102 + local tg = {default_target=who, type="hit", nowarning=true, range=self.use_power.range(self, who), first_target="friend"}
  103 + local x, y = who:getTarget(tg)
  104 + if not x or not y then return nil end
  105 + local dam = self.use_power.damage(self, who)
  106 + who:project(tg, x, y, engine.DamageType.HEAL, dam)
  107 + game:playSoundNear(who, "talents/heal")
  108 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
  109 + return {id=true, used=true}
  110 + end,
  111 + "T_GLOBAL_CD",
  112 + {range = function(self, who) return math.floor(who:combatStatScale("wil", 6, 10)) end,
  113 + damage = function(self, who) return self:getCharmPower(who) end}
  114 + )
109 115 }
... ...
... ... @@ -85,18 +85,28 @@ newEntity{
85 85 rarity = 10,
86 86
87 87 charm_power_def = {add=25, max=400, floor=true},
88   - resolvers.charm("creates a wall of flames lasting for 4 turns (dam %d overall)", 6, function(self, who)
89   - local tg = {type="wall", range=5, halflength=3, halfmax_spots=3+1}
90   - local x, y = who:getTarget(tg)
91   - if not x or not y then return nil end
92   - local dam = self:getCharmPower(who)
93   - who:project(tg, x, y, function(px, py)
94   - game.level.map:addEffect(who, px, py, 4, engine.DamageType.FIRE, dam / 4, 0, 5, nil, {type="inferno"}, nil, true)
95   - end)
96   - game:playSoundNear(who, "talents/fire")
97   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
98   - return {id=true, used=true}
99   - end),
  88 + resolvers.charm(
  89 + function(self, who)
  90 + return ("create a wall of flames at up to %d distance that deals %0.2f fire damage each turn for 4 turns"):format(self.use_power.range, who:damDesc(engine.DamageType.FIRE, self.use_power.damage(self, who)/4))
  91 + end,
  92 + 6,
  93 + function(self, who)
  94 + local tg = {type="wall", range=self.use_power.range, halflength=3, halfmax_spots=3+1}
  95 + local x, y = who:getTarget(tg)
  96 + if not x or not y then return nil end
  97 + local dam = self.use_power.damage(self, who)
  98 + who:project(tg, x, y, function(px, py)
  99 + game.level.map:addEffect(who, px, py, 4, engine.DamageType.FIRE, dam / 4, 0, 5, nil, {type="inferno"}, nil, true)
  100 + end)
  101 + game:playSoundNear(who, "talents/fire")
  102 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
  103 + return {id=true, used=true}
  104 + end,
  105 + "T_GLOBAL_CD",
  106 + {range = 5,
  107 + damage = function(self, who) return self:getCharmPower(who) end
  108 + }
  109 + )
100 110 }
101 111
102 112 newEntity{
... ... @@ -106,22 +116,30 @@ newEntity{
106 116 rarity = 6,
107 117
108 118 charm_power_def = {add=25, max=600, floor=true},
109   - resolvers.charm(function(self) return ("fire a bolt of a random element (dam %d-%d)"):format(self:getCharmPower(who)/2, self:getCharmPower(who)) end, 10, function(self, who)
110   - local tg = {type="bolt", range=8}
111   - local x, y = who:getTarget(tg)
112   - if not x or not y then return nil end
113   - local dam = self:getCharmPower(who)
114   - local elem = rng.table{
115   - {engine.DamageType.FIRE, "flame"},
116   - {engine.DamageType.COLD, "freeze"},
117   - {engine.DamageType.LIGHTNING, "lightning_explosion"},
118   - {engine.DamageType.ACID, "acid"},
119   - {engine.DamageType.NATURE, "slime"},
120   - {engine.DamageType.BLIGHT, "slime"},
121   - }
122   - who:project(tg, x, y, elem[1], rng.avg(dam / 2, dam, 3), {type=elem[2]})
123   - game:playSoundNear(who, "talents/fire")
124   - game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
125   - return {id=true, used=true}
126   - end),
  119 + resolvers.charm(function(self, who)
  120 + local dam = self.use_power.damage(self, who)
  121 + return ("fire a bolt of a random element out to range %d, dealing %0.2f to %0.2f base damage"):format(self.use_power.range, dam/2, dam) end,
  122 + 10,
  123 + function(self, who)
  124 + local tg = {type="bolt", range=self.use_power.range}
  125 + local x, y = who:getTarget(tg)
  126 + if not x or not y then return nil end
  127 + local dam = self.use_power.damage(self, who)
  128 + local elem = rng.table{
  129 + {engine.DamageType.FIRE, "flame"},
  130 + {engine.DamageType.COLD, "freeze"},
  131 + {engine.DamageType.LIGHTNING, "lightning_explosion"},
  132 + {engine.DamageType.ACID, "acid"},
  133 + {engine.DamageType.NATURE, "slime"},
  134 + {engine.DamageType.BLIGHT, "slime"},
  135 + }
  136 + who:project(tg, x, y, elem[1], rng.avg(dam / 2, dam, 3), {type=elem[2]})
  137 + game:playSoundNear(who, "talents/fire")
  138 + game.logSeen(who, "%s uses %s %s!", who.name:capitalize(), who:his_her(), self:getName{no_add_name=true})
  139 + return {id=true, used=true}
  140 + end,
  141 + "T_GLOBAL_CD",
  142 + {range = 8,
  143 + damage = function(self, who) return self:getCharmPower(who) end}
  144 + )
127 145 }
... ...