1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
36 | */ |
36 | */ |
37 | object * |
37 | object * |
38 | find_random_spell_in_ob (object *ob, const char *skill) |
38 | find_random_spell_in_ob (object *ob, const char *skill) |
39 | { |
39 | { |
40 | int k = 0, s; |
40 | int k = 0, s; |
41 | object *tmp; |
|
|
42 | |
41 | |
43 | for (tmp = ob->inv; tmp; tmp = tmp->below) |
42 | for (object *tmp = ob->inv; tmp; tmp = tmp->below) |
44 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
43 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
45 | k++; |
44 | k++; |
46 | |
45 | |
47 | /* No spells, no need to progess further */ |
46 | /* No spells, no need to progess further */ |
48 | if (!k) |
47 | if (!k) |
49 | return NULL; |
48 | return NULL; |
50 | |
49 | |
51 | s = RANDOM () % k; |
50 | s = RANDOM () % k; |
52 | |
51 | |
53 | for (tmp = ob->inv; tmp; tmp = tmp->below) |
52 | for (object *tmp = ob->inv; tmp; tmp = tmp->below) |
54 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
53 | if (tmp->type == SPELL && (!skill || tmp->skill == skill)) |
55 | { |
|
|
56 | if (!s) |
54 | if (!s) |
57 | return tmp; |
55 | return tmp; |
58 | else |
56 | else |
59 | s--; |
57 | s--; |
60 | } |
58 | |
61 | /* Should never get here, but just in case */ |
59 | /* Should never get here, but just in case */ |
62 | return NULL; |
60 | return 0; |
63 | } |
61 | } |
64 | |
62 | |
65 | /* Relatively simple function that gets used a lot. |
63 | /* Relatively simple function that gets used a lot. |
66 | * Basically, it sets up the skill pointer for the spell being |
64 | * Basically, it sets up the skill pointer for the spell being |
67 | * cast. If op is really casting the spell, then the skill |
65 | * cast. If op is really casting the spell, then the skill |
… | |
… | |
104 | { |
102 | { |
105 | if (caster->path_denied & spell->path_attuned) |
103 | if (caster->path_denied & spell->path_attuned) |
106 | return 1; |
104 | return 1; |
107 | |
105 | |
108 | int new_level = spell->level |
106 | int new_level = spell->level |
109 | + (caster->path_repelled & spell->path_attuned ? +8 : 0) |
107 | + (caster->path_repelled & spell->path_attuned ? +ATTUNE_REPELL : 0) |
110 | + (caster->path_attuned & spell->path_attuned ? -8 : 0); |
108 | + (caster->path_attuned & spell->path_attuned ? -ATTUNE_REPELL : 0); |
111 | |
109 | |
112 | return max (1, new_level); |
110 | return max (1, new_level); |
113 | } |
111 | } |
114 | |
112 | |
115 | /* This function returns the effective level the spell |
113 | /* This function returns the effective level the spell |
116 | * is being cast at. |
114 | * is being cast at. |
117 | * Note that I changed the repelled/attuned bonus to 2 from 5. |
|
|
118 | * This is because the new code compares casting_level against |
|
|
119 | * min_caster_level, so the difference is effectively 4 |
|
|
120 | */ |
115 | */ |
121 | int |
116 | int |
122 | caster_level (object *caster, object *spell) |
117 | casting_level (object *caster, object *spell) |
123 | { |
118 | { |
124 | int level = caster->level; |
119 | int level = caster->level; |
125 | |
120 | |
126 | /* if a rod is fired by a player, take the use_magic_item skill in consideration. */ |
121 | /* if a rod is fired by a player, take the use_magic_item skill in consideration. */ |
127 | if (caster->type == ROD && caster->env && caster->env->type == PLAYER) |
122 | if (caster->type == ROD && caster->env && caster->env->type == PLAYER) |
… | |
… | |
129 | object *skill = find_skill_by_number (caster->env, SK_USE_MAGIC_ITEM); |
124 | object *skill = find_skill_by_number (caster->env, SK_USE_MAGIC_ITEM); |
130 | int sk_level = skill ? skill->level : 1; |
125 | int sk_level = skill ? skill->level : 1; |
131 | |
126 | |
132 | level = min (level, sk_level + level / 10 + 1); |
127 | level = min (level, sk_level + level / 10 + 1); |
133 | } |
128 | } |
134 | else if (caster->type == PLAYER && spell->skill) /* If this is a player, try to find the matching skill */ |
129 | else if (caster->type == PLAYER) /* If this is a player, try to find the matching skill */ |
135 | for (int i = 0; i < NUM_SKILLS; i++) |
130 | if (object *skill = caster->contr->find_skill (spell->skill)) |
136 | if (caster->contr->last_skill_ob[i] && caster->contr->last_skill_ob[i]->skill == spell->skill) |
131 | level = skill->level; |
137 | { |
132 | |
138 | level = caster->contr->last_skill_ob[i]->level; |
133 | // now scale the effective level from the startinglevel..100 range to 1..100 |
139 | break; |
134 | if (level < 100) |
140 | } |
135 | level = lerp (level, (int)spell->level, 100, 1, 100); |
141 | |
136 | |
142 | /* Got valid caster level. Now adjust for attunement */ |
137 | /* Got valid caster level. Now adjust for attunement */ |
|
|
138 | // attuned only increases up to 2 times the original level */ |
|
|
139 | if (caster->path_attuned & spell->path_attuned) |
|
|
140 | level = min (level * 2, level + ATTUNE_REPELL); |
|
|
141 | |
|
|
142 | // repell has no such quarrels |
143 | level += caster->path_repelled & spell->path_attuned ? -8 : 0; |
143 | if (caster->path_repelled & spell->path_attuned) |
144 | level += caster->path_attuned & spell->path_attuned ? +8 : 0; |
144 | level -= ATTUNE_REPELL; |
145 | |
145 | |
146 | /* Always make this at least 1. If this is zero, we get divide by zero |
146 | /* Always make this at least 1. If this is zero, we get divide by zero |
147 | * errors in various places. |
147 | * errors in various places. |
148 | */ |
148 | */ |
149 | return max (level, 1); |
149 | return max (level, 1); |
… | |
… | |
158 | * caster is what is casting the spell, can be op. |
158 | * caster is what is casting the spell, can be op. |
159 | * spell is the spell object. |
159 | * spell is the spell object. |
160 | * Note that it is now possible for a spell to cost both grace and |
160 | * Note that it is now possible for a spell to cost both grace and |
161 | * mana. In that case, we return which ever value is higher. |
161 | * mana. In that case, we return which ever value is higher. |
162 | */ |
162 | */ |
163 | |
|
|
164 | sint16 |
163 | sint16 |
165 | SP_level_spellpoint_cost (object *caster, object *spell, int flags) |
164 | SP_level_spellpoint_cost (object *caster, object *spell, int flags) |
166 | { |
165 | { |
167 | int sp, grace, level = caster_level (caster, spell); |
166 | int sp, grace, level = casting_level (caster, spell); |
168 | |
167 | |
169 | if (settings.spellpoint_level_depend == TRUE) |
168 | if (settings.spellpoint_level_depend == TRUE) |
170 | { |
169 | { |
171 | if (spell->stats.sp && spell->stats.maxsp) |
170 | if (spell->stats.sp && spell->stats.maxsp) |
172 | { |
171 | { |
… | |
… | |
212 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
211 | LOG (llevError, "SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags); |
213 | return 0; |
212 | return 0; |
214 | } |
213 | } |
215 | } |
214 | } |
216 | |
215 | |
|
|
216 | /* |
|
|
217 | * Return the effective casting level of the spell. |
|
|
218 | * To make spells independent of their starting level, this function |
|
|
219 | * scales the range spellstartlevel .. 100 into the range 1..100 |
|
|
220 | */ |
|
|
221 | static int |
|
|
222 | SP_casting_level (object *caster, object *spell) |
|
|
223 | { |
|
|
224 | return 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. |
… | |
… | |
249 | SP_level_range_adjust (object *caster, object *spob) |
257 | SP_level_range_adjust (object *caster, object *spob) |
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); |
|
|
255 | return (level - min_casting_level (caster, spob)) / spob->range_modifier; |
262 | return SP_casting_level (caster, spob) / spob->range_modifier; |
256 | } |
263 | } |
257 | |
264 | |
258 | /* Checks to see if player knows the spell. If the name is the same |
265 | /* Checks to see if player knows the spell. If the name is the same |
259 | * as an existing spell, we presume they know it. |
266 | * as an existing spell, we presume they know it. |
260 | * returns 1 if they know the spell, 0 if they don't. |
267 | * returns 1 if they know the spell, 0 if they don't. |
261 | */ |
268 | */ |
262 | object * |
269 | object * |
263 | check_spell_known (object *op, const char *name) |
270 | check_spell_known (object *op, const char *name) |
264 | { |
271 | { |
265 | object *spop; |
272 | object *spop; |
|
|
273 | shstr_cmp name_ (name); |
266 | |
274 | |
267 | for (spop = op->inv; spop; spop = spop->below) |
275 | for (spop = op->inv; spop; spop = spop->below) |
268 | if (spop->type == SPELL && !strcmp (spop->name, name)) |
276 | if (spop->type == SPELL && spop->name == name) |
269 | return spop; |
277 | return spop; |
270 | |
278 | |
271 | return NULL; |
279 | return 0; |
272 | } |
280 | } |
273 | |
281 | |
274 | |
282 | |
275 | /* |
283 | /* |
276 | * Look at object 'op' and see if they know the spell |
284 | * Look at object 'op' and see if they know the spell |
… | |
… | |
334 | * eg, updated for tiled maps. |
342 | * eg, updated for tiled maps. |
335 | */ |
343 | */ |
336 | int |
344 | int |
337 | reflwall (maptile *m, int x, int y, object *sp_op) |
345 | reflwall (maptile *m, int x, int y, object *sp_op) |
338 | { |
346 | { |
339 | object *op; |
|
|
340 | |
|
|
341 | if (OUT_OF_REAL_MAP (m, x, y)) |
347 | if (OUT_OF_REAL_MAP (m, x, y)) |
342 | return 0; |
348 | return 0; |
|
|
349 | |
343 | for (op = GET_MAP_OB (m, x, y); op != NULL; op = op->above) |
350 | for (object *op = GET_MAP_OB (m, x, y); op; op = op->above) |
344 | if (QUERY_FLAG (op, FLAG_REFL_SPELL) |
351 | if (QUERY_FLAG (op, FLAG_REFL_SPELL) |
345 | && (!QUERY_FLAG (op, FLAG_ALIVE) |
352 | && (!QUERY_FLAG (op, FLAG_ALIVE) |
346 | || (rndm (0, 99)) < 90 - (sp_op->level / 10))) |
353 | || (rndm (0, 99)) < 90 - (sp_op->level / 10))) |
347 | return 1; |
354 | return 1; |
348 | |
355 | |
… | |
… | |
393 | { |
400 | { |
394 | if (!xy_normalise (m, x, y)) |
401 | if (!xy_normalise (m, x, y)) |
395 | return 0; |
402 | return 0; |
396 | |
403 | |
397 | mapspace &ms = m->at (x, y); |
404 | mapspace &ms = m->at (x, y); |
|
|
405 | ms.update (); |
398 | |
406 | |
399 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
407 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
400 | return 0; |
408 | return 0; |
401 | |
409 | |
402 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
410 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
… | |
… | |
472 | * returns 0 on failure, 1 on success. |
480 | * returns 0 on failure, 1 on success. |
473 | */ |
481 | */ |
474 | int |
482 | int |
475 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
483 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
476 | { |
484 | { |
477 | object *tmp; |
|
|
478 | int mflags; |
|
|
479 | maptile *m; |
|
|
480 | |
|
|
481 | if (spell->other_arch == NULL) |
485 | if (!spell->other_arch) |
482 | return 0; |
486 | return 0; |
483 | |
487 | |
484 | m = op->map; |
488 | object *tmp = spell->other_arch->instance (); |
485 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
|
|
486 | if (mflags & P_OUT_OF_MAP) |
|
|
487 | { |
|
|
488 | return 0; |
|
|
489 | } |
|
|
490 | |
489 | |
491 | tmp = arch_to_object (spell->other_arch); |
490 | if (!tmp) |
492 | |
|
|
493 | if (tmp == NULL) |
|
|
494 | return 0; |
491 | return 0; |
495 | |
|
|
496 | if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, x, y))) |
|
|
497 | { |
|
|
498 | new_draw_info (NDI_UNIQUE, 0, op, "You can't cast the spell on top of a wall!\n"); |
|
|
499 | tmp->destroy (); |
|
|
500 | return 0; |
|
|
501 | } |
|
|
502 | |
492 | |
503 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
493 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
504 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
494 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
505 | /* code in time.c uses food for some things, duration for others */ |
495 | /* code in time.c uses food for some things, duration for others */ |
506 | tmp->stats.food = tmp->duration; |
496 | tmp->stats.food = tmp->duration; |
507 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
497 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
508 | tmp->attacktype = spell->attacktype; |
498 | tmp->attacktype = spell->attacktype; |
509 | tmp->x = x; |
|
|
510 | tmp->y = y; |
|
|
511 | tmp->direction = dir; |
499 | tmp->direction = dir; |
512 | if (op->owner != NULL) |
|
|
513 | tmp->set_owner (op); |
500 | tmp->set_owner (op); |
514 | else |
|
|
515 | tmp->set_owner (op); |
|
|
516 | tmp->level = caster_level (caster, spell); |
501 | tmp->level = casting_level (caster, spell); |
517 | set_spell_skill (op, caster, spell, tmp); |
502 | set_spell_skill (op, caster, spell, tmp); |
518 | |
503 | |
519 | /* needed for AT_HOLYWORD,AT_GODPOWER stuff */ |
504 | /* needed for AT_HOLYWORD,AT_GODPOWER stuff */ |
520 | if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) |
505 | if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) |
521 | { |
|
|
522 | if (!tailor_god_spell (tmp, op)) |
506 | if (!tailor_god_spell (tmp, op)) |
523 | return 0; |
507 | return 0; |
524 | } |
508 | |
525 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
509 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
526 | SET_ANIMATION (tmp, dir); |
510 | SET_ANIMATION (tmp, dir); |
527 | |
511 | |
528 | if ((tmp = insert_ob_in_map (tmp, m, op, 0))) |
512 | if ((tmp = op->map->insert (tmp, x, y, op))) |
529 | move_spell_effect (tmp); |
513 | move_spell_effect (tmp); |
530 | |
514 | |
531 | return 1; |
515 | return 1; |
532 | } |
516 | } |
533 | |
517 | |
… | |
… | |
588 | if (!tmp) |
572 | if (!tmp) |
589 | tmp = op->ms ().player (); |
573 | tmp = op->ms ().player (); |
590 | |
574 | |
591 | return tmp; |
575 | return tmp; |
592 | } |
576 | } |
593 | |
|
|
594 | |
|
|
595 | |
577 | |
596 | /* raytrace: |
578 | /* raytrace: |
597 | * spell_find_dir(map, x, y, exclude) will search first the center square |
579 | * spell_find_dir(map, x, y, exclude) will search first the center square |
598 | * then some close squares in the given map at the given coordinates for |
580 | * then some close squares in the given map at the given coordinates for |
599 | * live objects. |
581 | * live objects. |
… | |
… | |
602 | * monsters/generators only. If not, the spell will hunt players only. |
584 | * monsters/generators only. If not, the spell will hunt players only. |
603 | * It returns the direction toward the first/closest live object if it finds |
585 | * It returns the direction toward the first/closest live object if it finds |
604 | * any, otherwise -1. |
586 | * any, otherwise -1. |
605 | * note that exclude can be NULL, in which case all bets are off. |
587 | * note that exclude can be NULL, in which case all bets are off. |
606 | */ |
588 | */ |
607 | |
|
|
608 | int |
589 | int |
609 | spell_find_dir (maptile *m, int x, int y, object *exclude) |
590 | spell_find_dir (maptile *m, int x, int y, object *exclude) |
610 | { |
591 | { |
611 | int i, max = SIZEOFFREE; |
592 | int i, max = SIZEOFFREE; |
612 | sint16 nx, ny; |
593 | sint16 nx, ny; |
… | |
… | |
996 | * need to have the right skill pointer passed, so we need to |
977 | * need to have the right skill pointer passed, so we need to |
997 | * at least process that code. |
978 | * at least process that code. |
998 | */ |
979 | */ |
999 | if (op->type == PLAYER && op == caster) |
980 | if (op->type == PLAYER && op == caster) |
1000 | { |
981 | { |
1001 | cast_level = caster_level (caster, spell_ob); |
|
|
1002 | |
|
|
1003 | if (spell_ob->skill) |
982 | if (spell_ob->skill) |
1004 | { |
983 | { |
1005 | skill = find_skill_by_name (op, spell_ob->skill); |
984 | skill = find_skill_by_name (op, spell_ob->skill); |
1006 | |
985 | |
1007 | if (!skill) |
986 | if (!skill) |
1008 | { |
987 | { |
1009 | op->failmsg (format ("You need the skill %s to cast %s! " |
988 | op->failmsg (format ("You need the skill %s to cast %s! " |
1010 | "H<You either need to learn the skill via a skill scroll " |
989 | "H<You either need to learn the skill via a skill scroll " |
1011 | "or you need to wear a talisman or holy symbol.>", |
990 | "or you need to wear a talisman or holy symbol.>", |
1012 | &spell_ob->skill, &spell_ob->name)); |
991 | &spell_ob->skill, &spell_ob->name)); |
1013 | return 0; |
992 | return 0; |
1014 | } |
993 | } |
1015 | |
994 | |
|
|
995 | const char *msg = ""; |
|
|
996 | |
|
|
997 | int caster_level = skill->level; |
|
|
998 | |
|
|
999 | if (op->path_attuned & spell_ob->path_attuned) |
|
|
1000 | { |
|
|
1001 | caster_level += ATTUNE_REPELL; |
|
|
1002 | msg = " (attuned)"; |
|
|
1003 | } |
|
|
1004 | |
|
|
1005 | if (op->path_repelled & spell_ob->path_attuned) |
|
|
1006 | { |
|
|
1007 | caster_level = ATTUNE_REPELL; // negative is ok |
|
|
1008 | msg = " (repelled)"; |
|
|
1009 | } |
|
|
1010 | |
1016 | int casting_level = min_casting_level (op, spell_ob); |
1011 | int casting_level = min_casting_level (op, spell_ob); |
1017 | |
1012 | |
1018 | if (casting_level > cast_level && !QUERY_FLAG (op, FLAG_WIZ)) |
1013 | if (casting_level > caster_level) |
1019 | { |
1014 | { |
1020 | op->failmsg (format ("You lack enough skill to cast that spell! " |
1015 | op->failmsg (format ("You lack enough skill to cast that spell! " |
1021 | "H<Your cast level is %d, but level %d is required. Maybe you are repelled?>", |
1016 | "H<Your effective cast level is %d%s, but level %d is required.>", |
1022 | cast_level, casting_level)); |
1017 | caster_level, msg, casting_level)); |
|
|
1018 | if (!op->is_wiz ()) |
1023 | return 0; |
1019 | return 0; |
1024 | } |
1020 | } |
1025 | } |
1021 | } |
1026 | |
1022 | |
1027 | /* If the caster is the wiz, they don't ever fail, and don't have |
1023 | /* If the caster is the wiz, they don't ever fail, and don't have |
1028 | * to have sufficient grace/mana. |
1024 | * to have sufficient grace/mana. |
… | |
… | |
1203 | case SP_SMITE: |
1199 | case SP_SMITE: |
1204 | success = cast_smite_spell (op, caster, dir, spell_ob); |
1200 | success = cast_smite_spell (op, caster, dir, spell_ob); |
1205 | break; |
1201 | break; |
1206 | |
1202 | |
1207 | case SP_MAGIC_MISSILE: |
1203 | case SP_MAGIC_MISSILE: |
1208 | success = fire_arch_from_position (op, caster, op->x + freearr_x[dir], op->y + freearr_y[dir], dir, spell_ob); |
1204 | success = fire_arch_from_position (op, caster, op->x, op->y, dir, spell_ob); |
1209 | break; |
1205 | break; |
1210 | |
1206 | |
1211 | case SP_SUMMON_GOLEM: |
1207 | case SP_SUMMON_GOLEM: |
1212 | success = summon_golem (op, caster, dir, spell_ob); |
1208 | success = summon_golem (op, caster, dir, spell_ob); |
1213 | break; |
1209 | break; |
… | |
… | |
1324 | { |
1320 | { |
1325 | op->failmsg (format ("You lack the proper attunement to cast %s!", &spell_ob->name)); |
1321 | op->failmsg (format ("You lack the proper attunement to cast %s!", &spell_ob->name)); |
1326 | success = 0; |
1322 | success = 0; |
1327 | } |
1323 | } |
1328 | else |
1324 | else |
1329 | success = fire_arch_from_position (op, caster, op->x + freearr_x[dir], op->y + freearr_y[dir], dir, spell_ob); |
1325 | success = fire_arch_from_position (op, caster, op->x, op->y, dir, spell_ob); |
1330 | break; |
1326 | break; |
1331 | |
1327 | |
1332 | case SP_SWARM: |
1328 | case SP_SWARM: |
1333 | success = fire_swarm (op, caster, spell_ob, dir); |
1329 | success = fire_swarm (op, caster, spell_ob, dir); |
1334 | break; |
1330 | break; |
… | |
… | |
1460 | check_bullet (op); |
1456 | check_bullet (op); |
1461 | return; |
1457 | return; |
1462 | } |
1458 | } |
1463 | } |
1459 | } |
1464 | |
1460 | |
1465 | /* This is called by move_apply. Basically, if someone |
1461 | /* This is called by move_apply. Basically, if someone |
1466 | * moves onto a spell effect and the walk_on or fly_on flags |
1462 | * moves onto a spell effect and the walk_on or fly_on flags |
1467 | * are set, this is called. This should only be called for |
1463 | * are set, this is called. This should only be called for |
1468 | * objects of the appropraite type. |
1464 | * objects of the appropriate type. |
1469 | */ |
1465 | */ |
1470 | void |
1466 | void |
1471 | apply_spell_effect (object *spell, object *victim) |
1467 | apply_spell_effect (object *spell, object *victim) |
1472 | { |
1468 | { |
1473 | switch (spell->subtype) |
1469 | switch (spell->subtype) |