ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_util.C
(Generate patch)

Comparing deliantra/server/server/spell_util.C (file contents):
Revision 1.75 by root, Mon Jul 14 00:04:57 2008 UTC vs.
Revision 1.77 by root, Sun Sep 28 15:49:08 2008 UTC

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 */
220static int
221SP_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 */
220int 230int
221SP_level_dam_adjust (object *caster, object *spob) 231SP_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.
235SP_level_duration_adjust (object *caster, object *spob) 244SP_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.
1435 check_bullet (op); 1443 check_bullet (op);
1436 return; 1444 return;
1437 } 1445 }
1438} 1446}
1439 1447
1440/* This is called by move_apply. Basically, if someone 1448/* This is called by move_apply. Basically, if someone
1441 * moves onto a spell effect and the walk_on or fly_on flags 1449 * moves onto a spell effect and the walk_on or fly_on flags
1442 * are set, this is called. This should only be called for 1450 * are set, this is called. This should only be called for
1443 * objects of the appropraite type. 1451 * objects of the appropriate type.
1444 */ 1452 */
1445void 1453void
1446apply_spell_effect (object *spell, object *victim) 1454apply_spell_effect (object *spell, object *victim)
1447{ 1455{
1448 switch (spell->subtype) 1456 switch (spell->subtype)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines