… | |
… | |
476 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
476 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
477 | { |
477 | { |
478 | if (!spell->other_arch) |
478 | if (!spell->other_arch) |
479 | return 0; |
479 | return 0; |
480 | |
480 | |
481 | mapxy pos (op->map, x, y);//TODO, should not pass x, y |
|
|
482 | |
|
|
483 | pos.move (dir ? dir : rndm (1, 8)); |
|
|
484 | |
|
|
485 | if (!pos.normalise ()) |
|
|
486 | return 0; |
|
|
487 | |
|
|
488 | object *tmp = spell->other_arch->instance (); |
481 | object *tmp = spell->other_arch->instance (); |
489 | |
482 | |
490 | if (!tmp) |
483 | if (!tmp) |
491 | return 0; |
484 | return 0; |
492 | |
|
|
493 | if (pos.ms ().blocks (tmp)) |
|
|
494 | { |
|
|
495 | new_draw_info (NDI_UNIQUE, 0, op, "You can't cast this spell on top of a wall!\n"); |
|
|
496 | tmp->destroy (); |
|
|
497 | return 0; |
|
|
498 | } |
|
|
499 | |
485 | |
500 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
486 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
501 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
487 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
502 | /* code in time.c uses food for some things, duration for others */ |
488 | /* code in time.c uses food for some things, duration for others */ |
503 | tmp->stats.food = tmp->duration; |
489 | tmp->stats.food = tmp->duration; |
504 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
490 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
505 | tmp->attacktype = spell->attacktype; |
491 | tmp->attacktype = spell->attacktype; |
506 | tmp->x = x; |
|
|
507 | tmp->y = y; |
|
|
508 | tmp->direction = dir; |
492 | tmp->direction = dir; |
509 | tmp->set_owner (op); |
493 | tmp->set_owner (op); |
510 | tmp->level = caster_level (caster, spell); |
494 | tmp->level = caster_level (caster, spell); |
511 | set_spell_skill (op, caster, spell, tmp); |
495 | set_spell_skill (op, caster, spell, tmp); |
512 | |
496 | |