… | |
… | |
149 | } |
149 | } |
150 | |
150 | |
151 | /* pretty basic function - basically just takes |
151 | /* pretty basic function - basically just takes |
152 | * an object, sets the x,y, and calls insert_ob_in_map |
152 | * an object, sets the x,y, and calls insert_ob_in_map |
153 | */ |
153 | */ |
154 | |
|
|
155 | void |
154 | void |
156 | spell_effect (object *spob, int x, int y, maptile *map, object *originator) |
155 | spell_effect (object *spob, int x, int y, maptile *map, object *originator) |
157 | { |
156 | { |
158 | |
|
|
159 | if (spob->other_arch != NULL) |
157 | if (spob->other_arch) |
160 | { |
158 | map->insert (arch_to_object (spob->other_arch), x, y, originator); |
161 | object *effect = arch_to_object (spob->other_arch); |
|
|
162 | |
|
|
163 | effect->x = x; |
|
|
164 | effect->y = y; |
|
|
165 | |
|
|
166 | insert_ob_in_map (effect, map, originator, 0); |
|
|
167 | } |
|
|
168 | } |
159 | } |
169 | |
160 | |
170 | /* |
161 | /* |
171 | * This function takes a caster and spell and presents the |
162 | * This function takes a caster and spell and presents the |
172 | * effective level the caster needs to be to cast the spell. |
163 | * effective level the caster needs to be to cast the spell. |
… | |
… | |
469 | { |
460 | { |
470 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
461 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
471 | new_draw_info (NDI_UNIQUE, 0, op, "You cast it at your feet."); |
462 | new_draw_info (NDI_UNIQUE, 0, op, "You cast it at your feet."); |
472 | dir = 0; |
463 | dir = 0; |
473 | } |
464 | } |
474 | new_op->x = op->x + freearr_x[dir]; |
465 | |
475 | new_op->y = op->y + freearr_y[dir]; |
466 | op->map->insert (new_op, |
476 | if (dir == 0) |
467 | op->x + freearr_x[dir], op->y + freearr_y[dir], |
477 | insert_ob_in_map (new_op, op->map, op, INS_BELOW_ORIGINATOR); |
468 | op, |
478 | else |
469 | dir ? 0 : INS_BELOW_ORIGINATOR); |
479 | insert_ob_in_map (new_op, op->map, op, 0); |
470 | |
480 | return dir; |
471 | return dir; |
481 | } |
472 | } |
482 | |
473 | |
483 | /* Returns true if it is ok to put spell *op on the space/may provided. |
474 | /* Returns true if it is ok to put spell *op on the space/may provided. |
484 | * immune_stop is basically the attacktype of the spell (why |
475 | * immune_stop is basically the attacktype of the spell (why |
… | |
… | |
617 | return 0; |
608 | return 0; |
618 | } |
609 | } |
619 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
610 | if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) |
620 | SET_ANIMATION (tmp, dir); |
611 | SET_ANIMATION (tmp, dir); |
621 | |
612 | |
622 | if ((tmp = insert_ob_in_map (tmp, m, op, 0)) == NULL) |
613 | if ((tmp = insert_ob_in_map (tmp, m, op, 0))) |
623 | return 1; |
|
|
624 | |
|
|
625 | move_spell_effect (tmp); |
614 | move_spell_effect (tmp); |
626 | |
615 | |
627 | return 1; |
616 | return 1; |
628 | } |
617 | } |
629 | |
|
|
630 | |
|
|
631 | |
618 | |
632 | /***************************************************************************** |
619 | /***************************************************************************** |
633 | * |
620 | * |
634 | * Code related to rods - perhaps better located in another file? |
621 | * Code related to rods - perhaps better located in another file? |
635 | * |
622 | * |
636 | ****************************************************************************/ |
623 | ****************************************************************************/ |
637 | |
|
|
638 | void |
624 | void |
639 | regenerate_rod (object *rod) |
625 | regenerate_rod (object *rod) |
640 | { |
626 | { |
641 | if (rod->stats.hp < rod->stats.maxhp) |
627 | if (rod->stats.hp < rod->stats.maxhp) |
642 | { |
628 | { |
… | |
… | |
806 | create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0); |
792 | create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0); |
807 | |
793 | |
808 | insert_ob_in_map (head, op->map, op, 0); |
794 | insert_ob_in_map (head, op->map, op, 0); |
809 | |
795 | |
810 | /* thought it'd be cool to insert a burnout, too. */ |
796 | /* thought it'd be cool to insert a burnout, too. */ |
811 | tmp = get_archetype ("burnout"); |
797 | op->map->insert (get_archetype ("burnout"), op->x + freearr_x[dir], op->y + freearr_y[dir], op); |
812 | tmp->map = op->map; |
|
|
813 | tmp->x = op->x + freearr_x[dir]; |
|
|
814 | tmp->y = op->y + freearr_y[dir]; |
|
|
815 | insert_ob_in_map (tmp, op->map, op, 0); |
|
|
816 | } |
798 | } |
817 | } |
799 | } |
818 | |
800 | |
819 | /* peterm: function which summons hostile monsters and |
801 | /* peterm: function which summons hostile monsters and |
820 | * places them in nearby squares. |
802 | * places them in nearby squares. |
… | |
… | |
1020 | else |
1002 | else |
1021 | { |
1003 | { |
1022 | new_draw_info (NDI_UNIQUE, 0, op, "You lose control of the mana! The uncontrolled magic blasts you!"); |
1004 | new_draw_info (NDI_UNIQUE, 0, op, "You lose control of the mana! The uncontrolled magic blasts you!"); |
1023 | tmp = get_archetype (LOOSE_MANA); |
1005 | tmp = get_archetype (LOOSE_MANA); |
1024 | tmp->level = skill->level; |
1006 | tmp->level = skill->level; |
1025 | tmp->x = op->x; |
|
|
1026 | tmp->y = op->y; |
|
|
1027 | |
1007 | |
1028 | /* increase the area of destruction a little for more powerful spells */ |
1008 | /* increase the area of destruction a little for more powerful spells */ |
1029 | tmp->range += isqrt (power); |
1009 | tmp->range += isqrt (power); |
1030 | |
1010 | |
1031 | if (power > 25) |
1011 | if (power > 25) |
1032 | tmp->stats.dam = 25 + isqrt (power); |
1012 | tmp->stats.dam = 25 + isqrt (power); |
1033 | else |
1013 | else |
1034 | tmp->stats.dam = power; /* nasty recoils! */ |
1014 | tmp->stats.dam = power; /* nasty recoils! */ |
1035 | |
1015 | |
1036 | tmp->stats.maxhp = tmp->count; |
1016 | tmp->stats.maxhp = tmp->count; |
1037 | insert_ob_in_map (tmp, op->map, NULL, 0); |
1017 | |
|
|
1018 | tmp->insert_at (op); |
1038 | } |
1019 | } |
1039 | } |
1020 | } |
1040 | } |
1021 | } |
1041 | |
1022 | |
1042 | int |
1023 | int |