1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
36 | #include <sproto.h> |
36 | #include <sproto.h> |
37 | |
37 | |
38 | /** |
38 | /** |
39 | * Returns the id of specified god. |
39 | * Returns the id of specified god. |
40 | */ |
40 | */ |
41 | int |
41 | static int |
42 | lookup_god_by_name (shstr_cmp name) |
42 | lookup_god_by_name (shstr_cmp name) |
43 | { |
43 | { |
44 | if (name) |
44 | if (name) |
45 | for (godlink *gl = first_god; gl; gl = gl->next) |
45 | for (godlink *gl = first_god; gl; gl = gl->next) |
46 | if (gl->name == name) |
46 | if (gl->name == name) |
… | |
… | |
214 | return 0; |
214 | return 0; |
215 | |
215 | |
216 | if (follower_has_similar_item (op, tr->item)) |
216 | if (follower_has_similar_item (op, tr->item)) |
217 | return 0; |
217 | return 0; |
218 | |
218 | |
219 | object *tmp = arch_to_object (tr->item); |
219 | object *tmp = tr->item->instance (); |
220 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
220 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
221 | op->insert (tmp); |
221 | op->insert (tmp); |
222 | |
222 | |
223 | return 1; |
223 | return 1; |
224 | } |
224 | } |
… | |
… | |
282 | } |
282 | } |
283 | |
283 | |
284 | /** |
284 | /** |
285 | * Unapplies up to number worth of items of type |
285 | * Unapplies up to number worth of items of type |
286 | */ |
286 | */ |
287 | void |
287 | static void |
288 | stop_using_item (object *op, int type, int number) |
288 | stop_using_item (object *op, int type, int number) |
289 | { |
289 | { |
290 | object *tmp; |
290 | object *tmp; |
291 | |
291 | |
292 | for (tmp = op->inv; tmp && number; tmp = tmp->below) |
292 | for (tmp = op->inv; tmp && number; tmp = tmp->below) |
… | |
… | |
378 | { |
378 | { |
379 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
379 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
380 | esrv_remove_spell (op->contr, item); |
380 | esrv_remove_spell (op->contr, item); |
381 | } |
381 | } |
382 | |
382 | |
383 | player_unready_range_ob (op->contr, item); |
|
|
384 | item->destroy (); |
383 | item->destroy (); |
385 | } |
384 | } |
386 | } |
385 | } |
387 | |
386 | |
388 | /* remove any godgiven items from the old god */ |
387 | /* remove any godgiven items from the old god */ |
… | |
… | |
509 | stop_using_item (op, GLOVES, 1); |
508 | stop_using_item (op, GLOVES, 1); |
510 | stop_using_item (op, SHIELD, 1); |
509 | stop_using_item (op, SHIELD, 1); |
511 | } |
510 | } |
512 | |
511 | |
513 | SET_FLAG (skop, FLAG_APPLIED); |
512 | SET_FLAG (skop, FLAG_APPLIED); |
514 | (void) change_abil (op, skop); |
513 | change_abil (op, skop); |
515 | |
514 | |
516 | /* return to previous skill status */ |
515 | /* return to previous skill status */ |
517 | if (!sk_applied) |
516 | if (!sk_applied) |
518 | CLEAR_FLAG (skop, FLAG_APPLIED); |
517 | CLEAR_FLAG (skop, FLAG_APPLIED); |
519 | |
518 | |
… | |
… | |
887 | { |
886 | { |
888 | object *depl; |
887 | object *depl; |
889 | archetype *at; |
888 | archetype *at; |
890 | int i; |
889 | int i; |
891 | |
890 | |
892 | if ((at = archetype::find (ARCH_DEPLETION)) == NULL) |
891 | if ((at = archetype::find (shstr_depletion)) == NULL) |
893 | { |
892 | { |
894 | LOG (llevError, "Could not find archetype depletion.\n"); |
893 | LOG (llevError, "Could not find archetype depletion.\n"); |
895 | continue; |
894 | continue; |
896 | } |
895 | } |
897 | |
896 | |
… | |
… | |
1063 | } |
1062 | } |
1064 | } |
1063 | } |
1065 | } |
1064 | } |
1066 | |
1065 | |
1067 | /** |
1066 | /** |
1068 | * Returns priest's god's id. |
|
|
1069 | * Straight calls lookup_god_by_name |
|
|
1070 | */ |
|
|
1071 | int |
|
|
1072 | get_god (object *priest) |
|
|
1073 | { |
|
|
1074 | return lookup_god_by_name (determine_god (priest)); |
|
|
1075 | } |
|
|
1076 | |
|
|
1077 | /** |
|
|
1078 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1067 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1079 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1068 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1080 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1069 | * the spell attacktype contains AT_HOLYWORD. -b.t. |
1081 | */ |
1070 | */ |
1082 | int |
1071 | int |