1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_gods_c = |
|
|
4 | * "$Id: gods.C,v 1.6 2006/09/10 15:59:57 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | |
24 | |
31 | /* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and |
25 | /* Oct 3, 1995 - Code laid down for initial gods, priest alignment, and |
32 | * monster race initialization. b.t. |
26 | * monster race initialization. b.t. |
… | |
… | |
207 | if (tmp->nrof > 1) |
201 | if (tmp->nrof > 1) |
208 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s crumble to dust!", query_short_name (tmp)); |
202 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s crumble to dust!", query_short_name (tmp)); |
209 | else |
203 | else |
210 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s crumbles to dust!", query_short_name (tmp)); |
204 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s crumbles to dust!", query_short_name (tmp)); |
211 | |
205 | |
212 | remove_ob (tmp); /* remove obj from players inv. */ |
206 | tmp->remove (); /* remove obj from players inv. */ |
213 | esrv_del_item (op->contr, tmp->count); /* notify client */ |
207 | esrv_del_item (op->contr, tmp->count); /* notify client */ |
214 | free_object (tmp); /* free object */ |
208 | tmp->destroy (); /* free object */ |
215 | } |
209 | } |
|
|
210 | |
216 | if (tmp->inv) |
211 | if (tmp->inv) |
217 | follower_remove_similar_item (tmp, item); |
212 | follower_remove_similar_item (tmp, item); |
218 | } |
213 | } |
219 | } |
214 | } |
220 | } |
215 | } |
… | |
… | |
420 | /* just do the work of removing the spell ourselves - we already |
415 | /* just do the work of removing the spell ourselves - we already |
421 | * know that the player knows the spell |
416 | * know that the player knows the spell |
422 | */ |
417 | */ |
423 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &tmp->name); |
418 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &tmp->name); |
424 | player_unready_range_ob (op->contr, tmp); |
419 | player_unready_range_ob (op->contr, tmp); |
425 | remove_ob (tmp); |
420 | tmp->destroy (); |
426 | free_object (tmp); |
|
|
427 | } |
421 | } |
428 | |
422 | |
429 | } |
423 | } |
430 | } |
424 | } |
431 | |
425 | |
… | |
… | |
448 | |
442 | |
449 | /* take away any special god-characteristic items. */ |
443 | /* take away any special god-characteristic items. */ |
450 | for (item = op->inv; item != NULL; item = next) |
444 | for (item = op->inv; item != NULL; item = next) |
451 | { |
445 | { |
452 | next = item->below; |
446 | next = item->below; |
453 | /* remove all invisible startequip items which are |
447 | // remove all invisible startequip items which are not skill, exp or force |
454 | * not skill, exp or force |
|
|
455 | */ |
|
|
456 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
448 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
457 | (item->type != SKILL) && (item->type != EXPERIENCE) && (item->type != FORCE)) |
449 | (item->type != SKILL) && (item->type != FORCE)) |
458 | { |
450 | { |
459 | |
451 | |
460 | if (item->type == SPELL) |
452 | if (item->type == SPELL) |
461 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
453 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
|
|
454 | |
462 | player_unready_range_ob (op->contr, item); |
455 | player_unready_range_ob (op->contr, item); |
463 | remove_ob (item); |
456 | item->destroy (); |
464 | free_object (item); |
|
|
465 | } |
457 | } |
466 | } |
458 | } |
467 | |
459 | |
468 | /* remove any godgiven items from the old god */ |
460 | /* remove any godgiven items from the old god */ |
469 | if (old_god) |
461 | if (old_god) |
… | |
… | |
875 | /* Follower lacks the required grace for the following |
867 | /* Follower lacks the required grace for the following |
876 | * treasure list items. */ |
868 | * treasure list items. */ |
877 | |
869 | |
878 | tmp = get_archetype (HOLY_POSSESSION); |
870 | tmp = get_archetype (HOLY_POSSESSION); |
879 | cast_change_ability (op, op, tmp, 0, 1); |
871 | cast_change_ability (op, op, tmp, 0, 1); |
880 | free_object (tmp); |
872 | tmp->destroy (); |
881 | return; |
873 | return; |
882 | } |
874 | } |
883 | continue; |
875 | continue; |
884 | } |
876 | } |
885 | |
877 | |
… | |
… | |
924 | int success; |
916 | int success; |
925 | |
917 | |
926 | tmp = get_archetype_by_object_name (item->slaying); |
918 | tmp = get_archetype_by_object_name (item->slaying); |
927 | |
919 | |
928 | success = cast_heal (op, op, tmp, 0); |
920 | success = cast_heal (op, op, tmp, 0); |
929 | free_object (tmp); |
921 | tmp->destroy (); |
930 | if (success) |
922 | if (success) |
931 | return; |
923 | return; |
932 | else |
924 | else |
933 | continue; |
925 | continue; |
934 | } |
926 | } |
… | |
… | |
956 | { |
948 | { |
957 | object *depl; |
949 | object *depl; |
958 | archetype *at; |
950 | archetype *at; |
959 | int i; |
951 | int i; |
960 | |
952 | |
961 | if ((at = find_archetype (ARCH_DEPLETION)) == NULL) |
953 | if ((at = archetype::find (ARCH_DEPLETION)) == NULL) |
962 | { |
954 | { |
963 | LOG (llevError, "Could not find archetype depletion.\n"); |
955 | LOG (llevError, "Could not find archetype depletion.\n"); |
964 | continue; |
956 | continue; |
965 | } |
957 | } |
966 | depl = present_arch_in_ob (at, op); |
958 | depl = present_arch_in_ob (at, op); |
|
|
959 | |
967 | if (depl == NULL) |
960 | if (depl == NULL) |
968 | continue; |
961 | continue; |
|
|
962 | |
969 | new_draw_info (NDI_UNIQUE, 0, op, "Shimmering light surrounds and restores you!"); |
963 | new_draw_info (NDI_UNIQUE, 0, op, "Shimmering light surrounds and restores you!"); |
|
|
964 | |
970 | for (i = 0; i < NUM_STATS; i++) |
965 | for (i = 0; i < NUM_STATS; i++) |
971 | if (get_attr_value (&depl->stats, i)) |
966 | if (get_attr_value (&depl->stats, i)) |
972 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
967 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
973 | remove_ob (depl); |
968 | |
974 | free_object (depl); |
969 | depl->destroy (); |
975 | fix_player (op); |
970 | fix_player (op); |
976 | return; |
971 | return; |
977 | } |
972 | } |
978 | |
973 | |
979 | /* Voices */ |
974 | /* Voices */ |
… | |
… | |
1167 | |
1162 | |
1168 | /* if caster is a rune or the like, it doesn't worship anything. However, |
1163 | /* if caster is a rune or the like, it doesn't worship anything. However, |
1169 | * if this object is owned by someone, then the god that they worship |
1164 | * if this object is owned by someone, then the god that they worship |
1170 | * is relevant, so use that. |
1165 | * is relevant, so use that. |
1171 | */ |
1166 | */ |
1172 | if (!god && get_owner (caster)) |
1167 | if (!god && caster->owner) |
1173 | god = find_god (determine_god (get_owner (caster))); |
1168 | god = find_god (determine_god (caster->owner)); |
1174 | |
1169 | |
1175 | if (!god || (spellop->attacktype & AT_HOLYWORD && !god->race)) |
1170 | if (!god || (spellop->attacktype & AT_HOLYWORD && !god->race)) |
1176 | { |
1171 | { |
1177 | if (!caster_is_spell) |
1172 | if (!caster_is_spell) |
1178 | new_draw_info (NDI_UNIQUE, 0, caster, "This prayer is useless unless you worship an appropriate god"); |
1173 | new_draw_info (NDI_UNIQUE, 0, caster, "This prayer is useless unless you worship an appropriate god"); |
1179 | else |
1174 | else |
1180 | LOG (llevError, "BUG: tailor_god_spell(): no god\n"); |
1175 | LOG (llevError, "BUG: tailor_god_spell(): no god\n"); |
1181 | free_object (spellop); |
1176 | |
|
|
1177 | spellop->destroy (); |
1182 | return 0; |
1178 | return 0; |
1183 | } |
1179 | } |
1184 | |
1180 | |
1185 | /* either holy word or godpower attacks will set the slaying field */ |
1181 | /* either holy word or godpower attacks will set the slaying field */ |
1186 | if (spellop->attacktype & AT_HOLYWORD || spellop->attacktype & AT_GODPOWER) |
1182 | if (spellop->attacktype & AT_HOLYWORD || spellop->attacktype & AT_GODPOWER) |