… | |
… | |
555 | } |
555 | } |
556 | return cast_spell (op, caster, dir, newspell, NULL); |
556 | return cast_spell (op, caster, dir, newspell, NULL); |
557 | } |
557 | } |
558 | return 1; |
558 | return 1; |
559 | } |
559 | } |
560 | |
|
|
561 | |
560 | |
562 | int |
561 | int |
563 | perceive_self (object *op) |
562 | perceive_self (object *op) |
564 | { |
563 | { |
565 | char *cp = describe_item (op, op), buf[MAX_BUF]; |
564 | char *cp = describe_item (op, op), buf[MAX_BUF]; |
… | |
… | |
641 | char portal_name[1024], portal_message[1024]; |
640 | char portal_name[1024], portal_message[1024]; |
642 | sint16 exitx, exity; |
641 | sint16 exitx, exity; |
643 | maptile *exitmap; |
642 | maptile *exitmap; |
644 | int op_level; |
643 | int op_level; |
645 | |
644 | |
646 | |
|
|
647 | /* Check to see if the map the player is currently on is a per player unique |
645 | /* Check to see if the map the player is currently on is a per player unique |
648 | * map. This can be determined in that per player unique maps have the |
646 | * map. This can be determined in that per player unique maps have the |
649 | * full pathname listed. |
647 | * full pathname listed. |
650 | */ |
648 | */ |
651 | if (!strncmp (op->map->path, settings.localdir, strlen (settings.localdir)) && settings.create_home_portals != TRUE) |
649 | if (!strncmp (op->map->path, settings.localdir, strlen (settings.localdir)) && settings.create_home_portals != TRUE) |
… | |
… | |
876 | force->destroy (); |
874 | force->destroy (); |
877 | |
875 | |
878 | return 1; |
876 | return 1; |
879 | } |
877 | } |
880 | |
878 | |
881 | |
|
|
882 | /* This creates magic walls. Really, it can create most any object, |
879 | /* This creates magic walls. Really, it can create most any object, |
883 | * within some reason. |
880 | * within some reason. |
884 | */ |
881 | */ |
885 | |
|
|
886 | int |
882 | int |
887 | magic_wall (object *op, object *caster, int dir, object *spell_ob) |
883 | magic_wall (object *op, object *caster, int dir, object *spell_ob) |
888 | { |
884 | { |
889 | object *tmp, *tmp2; |
885 | object *tmp, *tmp2; |
890 | int i, posblocked, negblocked, maxrange; |
886 | int i, posblocked, negblocked, maxrange; |
… | |
… | |
902 | else |
898 | else |
903 | { |
899 | { |
904 | x = op->x + freearr_x[dir]; |
900 | x = op->x + freearr_x[dir]; |
905 | y = op->y + freearr_y[dir]; |
901 | y = op->y + freearr_y[dir]; |
906 | } |
902 | } |
|
|
903 | |
907 | m = op->map; |
904 | m = op->map; |
908 | |
905 | |
909 | if ((spell_ob->move_block || x != op->x || y != op->y) && |
906 | if ((spell_ob->move_block || x != op->x || y != op->y) && |
910 | (get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE) || |
907 | (get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE) || |
911 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) == spell_ob->move_block))) |
908 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) == spell_ob->move_block))) |
912 | { |
909 | { |
913 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
910 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
914 | return 0; |
911 | return 0; |
915 | } |
912 | } |
|
|
913 | |
916 | if (spell_ob->other_arch) |
914 | if (spell_ob->other_arch) |
917 | { |
|
|
918 | tmp = arch_to_object (spell_ob->other_arch); |
915 | tmp = arch_to_object (spell_ob->other_arch); |
919 | } |
|
|
920 | else if (spell_ob->race) |
916 | else if (spell_ob->race) |
921 | { |
917 | { |
922 | char buf1[MAX_BUF]; |
918 | char buf1[MAX_BUF]; |
923 | |
919 | |
924 | sprintf (buf1, spell_ob->race, dir); |
920 | sprintf (buf1, spell_ob->race, dir); |
… | |
… | |
946 | } |
942 | } |
947 | else if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
943 | else if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
948 | { |
944 | { |
949 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
945 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
950 | tmp->stats.maxhp = tmp->stats.hp; |
946 | tmp->stats.maxhp = tmp->stats.hp; |
951 | tmp->set_owner (op); |
|
|
952 | set_spell_skill (op, caster, spell_ob, tmp); |
|
|
953 | } |
947 | } |
|
|
948 | |
954 | if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) |
949 | if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) |
955 | { |
950 | { |
956 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
951 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
957 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
952 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
958 | } |
953 | } |
|
|
954 | |
959 | if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN)) |
955 | if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN)) |
960 | { |
956 | { |
961 | tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
957 | tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); |
962 | tmp->stats.maxhp = tmp->stats.hp; |
958 | tmp->stats.maxhp = tmp->stats.hp; |
963 | SET_FLAG (tmp, FLAG_TEAR_DOWN); |
959 | SET_FLAG (tmp, FLAG_TEAR_DOWN); |
964 | SET_FLAG (tmp, FLAG_ALIVE); |
960 | SET_FLAG (tmp, FLAG_ALIVE); |
965 | } |
961 | } |
966 | |
962 | |
967 | /* This can't really hurt - if the object doesn't kill anything, |
963 | /* This can't really hurt - if the object doesn't kill anything, |
968 | * these fields just won't be used. |
964 | * these fields just won't be used. Do not set the owner for |
|
|
965 | * earthwalls, though, so they survive restarts. |
969 | */ |
966 | */ |
|
|
967 | if (tmp->type != EARTHWALL) //TODO |
970 | tmp->set_owner (op); |
968 | tmp->set_owner (op); |
|
|
969 | |
971 | set_spell_skill (op, caster, spell_ob, tmp); |
970 | set_spell_skill (op, caster, spell_ob, tmp); |
972 | tmp->x = x; |
971 | tmp->x = x; |
973 | tmp->y = y; |
972 | tmp->y = y; |
974 | tmp->level = caster_level (caster, spell_ob) / 2; |
973 | tmp->level = caster_level (caster, spell_ob) / 2; |
975 | |
974 | |
… | |
… | |
977 | if ((tmp = insert_ob_in_map (tmp, m, op, 0)) == NULL) |
976 | if ((tmp = insert_ob_in_map (tmp, m, op, 0)) == NULL) |
978 | { |
977 | { |
979 | new_draw_info_format (NDI_UNIQUE, 0, op, "Something destroys your %s", name); |
978 | new_draw_info_format (NDI_UNIQUE, 0, op, "Something destroys your %s", name); |
980 | return 0; |
979 | return 0; |
981 | } |
980 | } |
|
|
981 | |
982 | /* If this is a spellcasting wall, need to insert the spell object */ |
982 | /* If this is a spellcasting wall, need to insert the spell object */ |
983 | if (tmp->other_arch && tmp->other_arch->clone.type == SPELL) |
983 | if (tmp->other_arch && tmp->other_arch->clone.type == SPELL) |
984 | insert_ob_in_ob (arch_to_object (tmp->other_arch), tmp); |
984 | insert_ob_in_ob (arch_to_object (tmp->other_arch), tmp); |
985 | |
985 | |
986 | /* This code causes the wall to extend some distance in |
986 | /* This code causes the wall to extend some distance in |