… | |
… | |
263 | sp = 1; |
263 | sp = 1; |
264 | grace = (int) (spell->stats.grace * PATH_SP_MULT (caster, spell)); |
264 | grace = (int) (spell->stats.grace * PATH_SP_MULT (caster, spell)); |
265 | if (spell->stats.grace && !grace) |
265 | if (spell->stats.grace && !grace) |
266 | grace = 1; |
266 | grace = 1; |
267 | } |
267 | } |
|
|
268 | |
268 | if (flags == SPELL_HIGHEST) |
269 | if (flags == SPELL_HIGHEST) |
269 | return MAX (sp, grace); |
270 | return MAX (sp, grace); |
270 | else if (flags == SPELL_GRACE) |
271 | else if (flags == SPELL_GRACE) |
271 | return grace; |
272 | return grace; |
272 | else if (flags == SPELL_MANA) |
273 | else if (flags == SPELL_MANA) |
… | |
… | |
276 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
277 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
277 | return 0; |
278 | return 0; |
278 | } |
279 | } |
279 | } |
280 | } |
280 | |
281 | |
281 | |
|
|
282 | /* SP_level_dam_adjust: Returns adjusted damage based on the caster. |
282 | /* SP_level_dam_adjust: Returns adjusted damage based on the caster. |
283 | * spob is the spell we are adjusting. |
283 | * spob is the spell we are adjusting. |
284 | */ |
284 | */ |
285 | int |
285 | int |
286 | SP_level_dam_adjust (object *caster, object *spob) |
286 | SP_level_dam_adjust (object *caster, object *spob) |
287 | { |
287 | { |
|
|
288 | if (!spob->dam_modifier) |
|
|
289 | return 0; |
|
|
290 | |
288 | int level = caster_level (caster, spob); |
291 | int level = caster_level (caster, spob); |
289 | int adj = level - min_casting_level (caster, spob); |
292 | return max (0, level - min_casting_level (caster, spob)) / spob->dam_modifier; |
290 | |
|
|
291 | if (adj < 0) |
|
|
292 | adj = 0; |
|
|
293 | if (spob->dam_modifier) |
|
|
294 | adj /= spob->dam_modifier; |
|
|
295 | else |
|
|
296 | adj = 0; |
|
|
297 | return adj; |
|
|
298 | } |
293 | } |
299 | |
294 | |
300 | /* Adjust the strength of the spell based on level. |
295 | /* Adjust the strength of the spell based on level. |
301 | * This is basically the same as SP_level_dam_adjust above, |
296 | * This is basically the same as SP_level_dam_adjust above, |
302 | * but instead looks at the level_modifier value. |
297 | * but instead looks at the level_modifier value. |
303 | */ |
298 | */ |
304 | int |
299 | int |
305 | SP_level_duration_adjust (object *caster, object *spob) |
300 | SP_level_duration_adjust (object *caster, object *spob) |
306 | { |
301 | { |
|
|
302 | if (!spob->duration_modifier) |
|
|
303 | return 0; |
|
|
304 | |
307 | int level = caster_level (caster, spob); |
305 | int level = caster_level (caster, spob); |
308 | int adj = level - min_casting_level (caster, spob); |
306 | return max (0, level - min_casting_level (caster, spob)) / spob->duration_modifier; |
309 | |
|
|
310 | if (adj < 0) |
|
|
311 | adj = 0; |
|
|
312 | if (spob->duration_modifier) |
|
|
313 | adj /= spob->duration_modifier; |
|
|
314 | else |
|
|
315 | adj = 0; |
|
|
316 | |
|
|
317 | return adj; |
|
|
318 | } |
307 | } |
319 | |
308 | |
320 | /* Adjust the strength of the spell based on level. |
309 | /* Adjust the strength of the spell based on level. |
321 | * This is basically the same as SP_level_dam_adjust above, |
310 | * This is basically the same as SP_level_dam_adjust above, |
322 | * but instead looks at the level_modifier value. |
311 | * but instead looks at the level_modifier value. |
323 | */ |
312 | */ |
324 | int |
313 | int |
325 | SP_level_range_adjust (object *caster, object *spob) |
314 | SP_level_range_adjust (object *caster, object *spob) |
326 | { |
315 | { |
|
|
316 | if (!spob->range_modifier) |
|
|
317 | return 0; |
|
|
318 | |
327 | int level = caster_level (caster, spob); |
319 | int level = caster_level (caster, spob); |
328 | int adj = level - min_casting_level (caster, spob); |
320 | return (level - min_casting_level (caster, spob)) / spob->range_modifier; |
329 | |
|
|
330 | if (adj < 0) |
|
|
331 | adj = 0; |
|
|
332 | if (spob->range_modifier) |
|
|
333 | adj /= spob->range_modifier; |
|
|
334 | else |
|
|
335 | adj = 0; |
|
|
336 | |
|
|
337 | return adj; |
|
|
338 | } |
321 | } |
339 | |
322 | |
340 | /* Checks to see if player knows the spell. If the name is the same |
323 | /* Checks to see if player knows the spell. If the name is the same |
341 | * as an existing spell, we presume they know it. |
324 | * as an existing spell, we presume they know it. |
342 | * returns 1 if they know the spell, 0 if they don't. |
325 | * returns 1 if they know the spell, 0 if they don't. |