… | |
… | |
212 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
212 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
213 | return 0; |
213 | return 0; |
214 | } |
214 | } |
215 | } |
215 | } |
216 | |
216 | |
|
|
217 | /* |
|
|
218 | * Return the effective casting level of the spell. |
|
|
219 | */ |
|
|
220 | static int |
|
|
221 | SP_casting_level (object *caster, object *spell) |
|
|
222 | { |
|
|
223 | int level = caster_level (caster, spell); |
|
|
224 | return max (0, level - min_casting_level (caster, spell)); |
|
|
225 | } |
|
|
226 | |
217 | /* SP_level_dam_adjust: Returns adjusted damage based on the caster. |
227 | /* SP_level_dam_adjust: Returns adjusted damage based on the caster. |
218 | * spob is the spell we are adjusting. |
228 | * spob is the spell we are adjusting. |
219 | */ |
229 | */ |
220 | int |
230 | int |
221 | SP_level_dam_adjust (object *caster, object *spob) |
231 | SP_level_dam_adjust (object *caster, object *spob) |
222 | { |
232 | { |
223 | if (!spob->dam_modifier) |
233 | if (!spob->dam_modifier) |
224 | return 0; |
234 | return 0; |
225 | |
235 | |
226 | int level = caster_level (caster, spob); |
|
|
227 | return max (0, level - min_casting_level (caster, spob)) / spob->dam_modifier; |
236 | return SP_casting_level (caster, spob) / spob->dam_modifier; |
228 | } |
237 | } |
229 | |
238 | |
230 | /* Adjust the strength of the spell based on level. |
239 | /* Adjust the strength of the spell based on level. |
231 | * This is basically the same as SP_level_dam_adjust above, |
240 | * This is basically the same as SP_level_dam_adjust above, |
232 | * but instead looks at the level_modifier value. |
241 | * but instead looks at the level_modifier value. |
… | |
… | |
235 | SP_level_duration_adjust (object *caster, object *spob) |
244 | SP_level_duration_adjust (object *caster, object *spob) |
236 | { |
245 | { |
237 | if (!spob->duration_modifier) |
246 | if (!spob->duration_modifier) |
238 | return 0; |
247 | return 0; |
239 | |
248 | |
240 | int level = caster_level (caster, spob); |
|
|
241 | return max (0, level - min_casting_level (caster, spob)) / spob->duration_modifier; |
249 | return SP_casting_level (caster, spob) / spob->duration_modifier; |
242 | } |
250 | } |
243 | |
251 | |
244 | /* Adjust the strength of the spell based on level. |
252 | /* Adjust the strength of the spell based on level. |
245 | * This is basically the same as SP_level_dam_adjust above, |
253 | * This is basically the same as SP_level_dam_adjust above, |
246 | * but instead looks at the level_modifier value. |
254 | * but instead looks at the level_modifier value. |
… | |
… | |
250 | { |
258 | { |
251 | if (!spob->range_modifier) |
259 | if (!spob->range_modifier) |
252 | return 0; |
260 | return 0; |
253 | |
261 | |
254 | int level = caster_level (caster, spob); |
262 | int level = caster_level (caster, spob); |
255 | return (level - min_casting_level (caster, spob)) / spob->range_modifier; |
263 | return SP_casting_level (caster, spob) / spob->range_modifier; |
256 | } |
264 | } |
257 | |
265 | |
258 | /* Checks to see if player knows the spell. If the name is the same |
266 | /* Checks to see if player knows the spell. If the name is the same |
259 | * as an existing spell, we presume they know it. |
267 | * as an existing spell, we presume they know it. |
260 | * returns 1 if they know the spell, 0 if they don't. |
268 | * returns 1 if they know the spell, 0 if they don't. |