… | |
… | |
31 | #include <global.h> |
31 | #include <global.h> |
32 | #include <living.h> |
32 | #include <living.h> |
33 | #include <object.h> |
33 | #include <object.h> |
34 | #include <spells.h> |
34 | #include <spells.h> |
35 | #include <sounds.h> |
35 | #include <sounds.h> |
36 | #ifndef __CEXTRACT__ |
|
|
37 | # include <sproto.h> |
36 | #include <sproto.h> |
38 | #endif |
|
|
39 | |
37 | |
40 | /** |
38 | /** |
41 | * Returns the id of specified god. |
39 | * Returns the id of specified god. |
42 | */ |
40 | */ |
43 | int |
41 | int |
… | |
… | |
241 | static int |
239 | static int |
242 | god_gives_present (object *op, object *god, treasure *tr) |
240 | god_gives_present (object *op, object *god, treasure *tr) |
243 | { |
241 | { |
244 | object *tmp; |
242 | object *tmp; |
245 | |
243 | |
|
|
244 | if (!tr->item) |
|
|
245 | return 0; |
|
|
246 | |
246 | if (follower_has_similar_item (op, &tr->item->clone)) |
247 | if (follower_has_similar_item (op, &tr->item->clone)) |
247 | return 0; |
248 | return 0; |
248 | |
249 | |
249 | tmp = arch_to_object (tr->item); |
250 | tmp = arch_to_object (tr->item); |
250 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
251 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
251 | tmp = insert_ob_in_ob (tmp, op); |
252 | tmp = insert_ob_in_ob (tmp, op); |
252 | if (op->type == PLAYER) |
253 | if (op->type == PLAYER) |
253 | esrv_send_item (op, tmp); |
254 | esrv_send_item (op, tmp); |
|
|
255 | |
254 | return 1; |
256 | return 1; |
255 | } |
257 | } |
256 | |
258 | |
257 | /** |
259 | /** |
258 | * Player prays at altar. |
260 | * Player prays at altar. |
… | |
… | |
396 | remove = 1; |
398 | remove = 1; |
397 | for (tr = god->randomitems->items; tr; tr = tr->next) |
399 | for (tr = god->randomitems->items; tr; tr = tr->next) |
398 | { |
400 | { |
399 | object *item; |
401 | object *item; |
400 | |
402 | |
401 | if (tr->item == NULL) |
403 | if (!tr->item) |
402 | continue; |
404 | continue; |
403 | item = &tr->item->clone; |
405 | item = &tr->item->clone; |
404 | |
406 | |
405 | /* Basically, see if the matching spell is granted by this god. */ |
407 | /* Basically, see if the matching spell is granted by this god. */ |
406 | |
408 | |
… | |
… | |
684 | { |
686 | { |
685 | object *item; |
687 | object *item; |
686 | |
688 | |
687 | if (!tr->item) |
689 | if (!tr->item) |
688 | continue; |
690 | continue; |
|
|
691 | |
689 | item = &tr->item->clone; |
692 | item = &tr->item->clone; |
690 | |
693 | |
691 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
694 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
692 | return item->other_arch; |
695 | return item->other_arch; |
693 | } |
696 | } |
… | |
… | |
849 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); |
852 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); |
850 | return; |
853 | return; |
851 | } |
854 | } |
852 | |
855 | |
853 | if (!tr->item) |
856 | if (!tr->item) |
854 | { |
|
|
855 | LOG (llevError, "BUG: empty entry in %s's treasure list\n", &god->name); |
|
|
856 | continue; |
857 | continue; |
857 | } |
858 | |
858 | item = &tr->item->clone; |
859 | item = &tr->item->clone; |
859 | |
860 | |
860 | /* Grace limit */ |
861 | /* Grace limit */ |
861 | if (item->type == BOOK && item->invisible && strcmp (item->name, "grace limit") == 0) |
862 | if (item->type == BOOK && item->invisible && strcmp (item->name, "grace limit") == 0) |
862 | { |
863 | { |
… | |
… | |
965 | for (i = 0; i < NUM_STATS; i++) |
966 | for (i = 0; i < NUM_STATS; i++) |
966 | if (get_attr_value (&depl->stats, i)) |
967 | if (get_attr_value (&depl->stats, i)) |
967 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
968 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
968 | |
969 | |
969 | depl->destroy (); |
970 | depl->destroy (); |
970 | fix_player (op); |
971 | op->update_stats (); |
971 | return; |
972 | return; |
972 | } |
973 | } |
973 | |
974 | |
974 | /* Voices */ |
975 | /* Voices */ |
975 | if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0) |
976 | if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0) |
… | |
… | |
1148 | /** |
1149 | /** |
1149 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1150 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1150 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1151 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1151 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1152 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1152 | */ |
1153 | */ |
1153 | |
|
|
1154 | int |
1154 | int |
1155 | tailor_god_spell (object *spellop, object *caster) |
1155 | tailor_god_spell (object *spellop, object *caster) |
1156 | { |
1156 | { |
1157 | object *god = find_god (determine_god (caster)); |
1157 | object *god = find_god (determine_god (caster)); |
1158 | int caster_is_spell = 0; |
1158 | int caster_is_spell = 0; |