1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
|
|
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | |
7 | * |
7 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
8 | 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 |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. |
11 | * (at your option) any later version. |
11 | |
12 | * |
12 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
16 | |
17 | * |
17 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
21 | * |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | |
25 | |
25 | /* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and |
26 | /* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and |
26 | * monster race initialization. b.t. |
27 | * monster race initialization. b.t. |
27 | */ |
28 | */ |
… | |
… | |
31 | #include <global.h> |
32 | #include <global.h> |
32 | #include <living.h> |
33 | #include <living.h> |
33 | #include <object.h> |
34 | #include <object.h> |
34 | #include <spells.h> |
35 | #include <spells.h> |
35 | #include <sounds.h> |
36 | #include <sounds.h> |
36 | #ifndef __CEXTRACT__ |
|
|
37 | # include <sproto.h> |
37 | #include <sproto.h> |
38 | #endif |
|
|
39 | |
38 | |
40 | /** |
39 | /** |
41 | * Returns the id of specified god. |
40 | * Returns the id of specified god. |
42 | */ |
41 | */ |
43 | int |
42 | int |
… | |
… | |
241 | static int |
240 | static int |
242 | god_gives_present (object *op, object *god, treasure *tr) |
241 | god_gives_present (object *op, object *god, treasure *tr) |
243 | { |
242 | { |
244 | object *tmp; |
243 | object *tmp; |
245 | |
244 | |
|
|
245 | if (!tr->item) |
|
|
246 | return 0; |
|
|
247 | |
246 | if (follower_has_similar_item (op, &tr->item->clone)) |
248 | if (follower_has_similar_item (op, &tr->item->clone)) |
247 | return 0; |
249 | return 0; |
248 | |
250 | |
249 | tmp = arch_to_object (tr->item); |
251 | 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)); |
252 | 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); |
253 | tmp = insert_ob_in_ob (tmp, op); |
252 | if (op->type == PLAYER) |
254 | if (op->type == PLAYER) |
253 | esrv_send_item (op, tmp); |
255 | esrv_send_item (op, tmp); |
|
|
256 | |
254 | return 1; |
257 | return 1; |
255 | } |
258 | } |
256 | |
259 | |
257 | /** |
260 | /** |
258 | * Player prays at altar. |
261 | * Player prays at altar. |
… | |
… | |
396 | remove = 1; |
399 | remove = 1; |
397 | for (tr = god->randomitems->items; tr; tr = tr->next) |
400 | for (tr = god->randomitems->items; tr; tr = tr->next) |
398 | { |
401 | { |
399 | object *item; |
402 | object *item; |
400 | |
403 | |
401 | if (tr->item == NULL) |
404 | if (!tr->item) |
402 | continue; |
405 | continue; |
403 | item = &tr->item->clone; |
406 | item = &tr->item->clone; |
404 | |
407 | |
405 | /* Basically, see if the matching spell is granted by this god. */ |
408 | /* Basically, see if the matching spell is granted by this god. */ |
406 | |
409 | |
… | |
… | |
442 | |
445 | |
443 | /* take away any special god-characteristic items. */ |
446 | /* take away any special god-characteristic items. */ |
444 | for (item = op->inv; item != NULL; item = next) |
447 | for (item = op->inv; item != NULL; item = next) |
445 | { |
448 | { |
446 | next = item->below; |
449 | next = item->below; |
447 | /* remove all invisible startequip items which are |
450 | // remove all invisible startequip items which are not skill, exp or force |
448 | * not skill, exp or force |
|
|
449 | */ |
|
|
450 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
451 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
451 | (item->type != SKILL) && (item->type != EXPERIENCE) && (item->type != FORCE)) |
452 | (item->type != SKILL) && (item->type != FORCE)) |
452 | { |
453 | { |
453 | |
454 | |
454 | if (item->type == SPELL) |
455 | if (item->type == SPELL) |
455 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
456 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
456 | |
457 | |
… | |
… | |
686 | { |
687 | { |
687 | object *item; |
688 | object *item; |
688 | |
689 | |
689 | if (!tr->item) |
690 | if (!tr->item) |
690 | continue; |
691 | continue; |
|
|
692 | |
691 | item = &tr->item->clone; |
693 | item = &tr->item->clone; |
692 | |
694 | |
693 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
695 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
694 | return item->other_arch; |
696 | return item->other_arch; |
695 | } |
697 | } |
… | |
… | |
851 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); |
853 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); |
852 | return; |
854 | return; |
853 | } |
855 | } |
854 | |
856 | |
855 | if (!tr->item) |
857 | if (!tr->item) |
856 | { |
|
|
857 | LOG (llevError, "BUG: empty entry in %s's treasure list\n", &god->name); |
|
|
858 | continue; |
858 | continue; |
859 | } |
859 | |
860 | item = &tr->item->clone; |
860 | item = &tr->item->clone; |
861 | |
861 | |
862 | /* Grace limit */ |
862 | /* Grace limit */ |
863 | if (item->type == BOOK && item->invisible && strcmp (item->name, "grace limit") == 0) |
863 | if (item->type == BOOK && item->invisible && strcmp (item->name, "grace limit") == 0) |
864 | { |
864 | { |
… | |
… | |
967 | for (i = 0; i < NUM_STATS; i++) |
967 | for (i = 0; i < NUM_STATS; i++) |
968 | if (get_attr_value (&depl->stats, i)) |
968 | if (get_attr_value (&depl->stats, i)) |
969 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
969 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
970 | |
970 | |
971 | depl->destroy (); |
971 | depl->destroy (); |
972 | fix_player (op); |
972 | op->update_stats (); |
973 | return; |
973 | return; |
974 | } |
974 | } |
975 | |
975 | |
976 | /* Voices */ |
976 | /* Voices */ |
977 | if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0) |
977 | if (item->type == BOOK && item->invisible && strcmp (item->name, "voice_behind") == 0) |
… | |
… | |
1150 | /** |
1150 | /** |
1151 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1151 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1152 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1152 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1153 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1153 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1154 | */ |
1154 | */ |
1155 | |
|
|
1156 | int |
1155 | int |
1157 | tailor_god_spell (object *spellop, object *caster) |
1156 | tailor_god_spell (object *spellop, object *caster) |
1158 | { |
1157 | { |
1159 | object *god = find_god (determine_god (caster)); |
1158 | object *god = find_god (determine_god (caster)); |
1160 | int caster_is_spell = 0; |
1159 | int caster_is_spell = 0; |
… | |
… | |
1164 | |
1163 | |
1165 | /* if caster is a rune or the like, it doesn't worship anything. However, |
1164 | /* if caster is a rune or the like, it doesn't worship anything. However, |
1166 | * if this object is owned by someone, then the god that they worship |
1165 | * if this object is owned by someone, then the god that they worship |
1167 | * is relevant, so use that. |
1166 | * is relevant, so use that. |
1168 | */ |
1167 | */ |
1169 | if (!god && get_owner (caster)) |
1168 | if (!god && caster->owner) |
1170 | god = find_god (determine_god (get_owner (caster))); |
1169 | god = find_god (determine_god (caster->owner)); |
1171 | |
1170 | |
1172 | if (!god || (spellop->attacktype & AT_HOLYWORD && !god->race)) |
1171 | if (!god || (spellop->attacktype & AT_HOLYWORD && !god->race)) |
1173 | { |
1172 | { |
1174 | if (!caster_is_spell) |
1173 | if (!caster_is_spell) |
1175 | new_draw_info (NDI_UNIQUE, 0, caster, "This prayer is useless unless you worship an appropriate god"); |
1174 | new_draw_info (NDI_UNIQUE, 0, caster, "This prayer is useless unless you worship an appropriate god"); |