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 | |
… | |
… | |
684 | { |
687 | { |
685 | object *item; |
688 | object *item; |
686 | |
689 | |
687 | if (!tr->item) |
690 | if (!tr->item) |
688 | continue; |
691 | continue; |
|
|
692 | |
689 | item = &tr->item->clone; |
693 | item = &tr->item->clone; |
690 | |
694 | |
691 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
695 | if (item->type == BOOK && item->invisible && strcmp (item->name, type) == 0) |
692 | return item->other_arch; |
696 | return item->other_arch; |
693 | } |
697 | } |
… | |
… | |
849 | 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); |
850 | return; |
854 | return; |
851 | } |
855 | } |
852 | |
856 | |
853 | if (!tr->item) |
857 | if (!tr->item) |
854 | { |
|
|
855 | LOG (llevError, "BUG: empty entry in %s's treasure list\n", &god->name); |
|
|
856 | continue; |
858 | continue; |
857 | } |
859 | |
858 | item = &tr->item->clone; |
860 | item = &tr->item->clone; |
859 | |
861 | |
860 | /* Grace limit */ |
862 | /* Grace limit */ |
861 | 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) |
862 | { |
864 | { |
… | |
… | |
1148 | /** |
1150 | /** |
1149 | * 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. |
1150 | * 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 |
1151 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1153 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1152 | */ |
1154 | */ |
1153 | |
|
|
1154 | int |
1155 | int |
1155 | tailor_god_spell (object *spellop, object *caster) |
1156 | tailor_god_spell (object *spellop, object *caster) |
1156 | { |
1157 | { |
1157 | object *god = find_god (determine_god (caster)); |
1158 | object *god = find_god (determine_god (caster)); |
1158 | int caster_is_spell = 0; |
1159 | int caster_is_spell = 0; |