1 | /* |
1 | /* |
2 | * static char *rcsid_player_c = |
2 | * static char *rcsid_player_c = |
3 | * "$Id: player.c,v 1.1.1.2 2006/02/22 18:03:23 elmex Exp $"; |
3 | * "$Id: player.c,v 1.21 2006/08/11 23:04:50 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
37 | #include <living.h> |
37 | #include <living.h> |
38 | #include <object.h> |
38 | #include <object.h> |
39 | #include <spells.h> |
39 | #include <spells.h> |
40 | #include <skills.h> |
40 | #include <skills.h> |
41 | #include <newclient.h> |
41 | #include <newclient.h> |
|
|
42 | |
|
|
43 | #ifdef COZY_SERVER |
|
|
44 | extern int same_party (partylist *a, partylist *b); |
|
|
45 | #endif |
42 | |
46 | |
43 | player *find_player(const char *plname) |
47 | player *find_player(const char *plname) |
44 | { |
48 | { |
45 | player *pl; |
49 | player *pl; |
46 | for(pl=first_player;pl!=NULL;pl=pl->next) |
50 | for(pl=first_player;pl!=NULL;pl=pl->next) |
… | |
… | |
145 | continue; |
149 | continue; |
146 | if ( *buf =='%'){ /* send one news */ |
150 | if ( *buf =='%'){ /* send one news */ |
147 | if (size>0) |
151 | if (size>0) |
148 | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
152 | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
149 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
153 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
150 | "!! informations: %s\n%s", |
154 | "INFORMATION: %s\n%s", |
151 | "%s\n%s", |
155 | "%s\n%s", |
152 | subject, news); /*send previously read news*/ |
156 | subject, news); /*send previously read news*/ |
153 | strcpy(subject,buf+1); |
157 | strcpy(subject,buf+1); |
154 | strip_endline(subject); |
158 | strip_endline(subject); |
155 | size=0; |
159 | size=0; |
… | |
… | |
166 | } |
170 | } |
167 | } |
171 | } |
168 | |
172 | |
169 | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
173 | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
170 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
174 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
171 | "!! informations: %s\n%s\n", |
175 | "INFORMATION: %s\n%s\n", |
172 | "%s\n%s", |
176 | "%s\n%s", |
173 | subject, news); |
177 | subject, news); |
174 | close_and_delete(fp, comp); |
178 | close_and_delete(fp, comp); |
175 | } |
179 | } |
176 | |
180 | |
… | |
… | |
224 | } |
228 | } |
225 | |
229 | |
226 | /* Clears basically the entire player structure except |
230 | /* Clears basically the entire player structure except |
227 | * for next and socket. |
231 | * for next and socket. |
228 | */ |
232 | */ |
229 | memset((void*)((char*)p + offsetof(player, maplevel)), 0, |
233 | memset((void*)((char*)p + offsetof(player, ob)), 0, |
230 | sizeof(player) - offsetof(player, maplevel)); |
234 | sizeof(player) - offsetof(player, ob)); |
231 | |
235 | |
232 | /* There are some elements we want initialized to non zero value - |
236 | /* There are some elements we want initialized to non zero value - |
233 | * we deal with that below this point. |
237 | * we deal with that below this point. |
234 | */ |
238 | */ |
235 | p->party=NULL; |
239 | p->party=NULL; |
… | |
… | |
249 | op->speed_left=0.5; |
253 | op->speed_left=0.5; |
250 | op->speed=1.0; |
254 | op->speed=1.0; |
251 | op->direction=5; /* So player faces south */ |
255 | op->direction=5; /* So player faces south */ |
252 | op->stats.wc=2; |
256 | op->stats.wc=2; |
253 | op->run_away = 25; /* Then we panick... */ |
257 | op->run_away = 25; /* Then we panick... */ |
|
|
258 | p->socket.monitor_spells = 0; /* Needed because esrv_update_spells( ) gets called by roll_stats */ |
254 | |
259 | |
255 | roll_stats(op); |
260 | roll_stats(op); |
256 | p->state=ST_ROLL_STAT; |
261 | p->state=ST_ROLL_STAT; |
257 | clear_los(op); |
262 | clear_los(op); |
258 | |
263 | |
259 | p->gen_sp_armour=10; |
264 | p->gen_sp_armour=10; |
260 | p->last_speed= -1; |
265 | p->last_speed= -1; |
261 | p->shoottype=range_none; |
266 | p->shoottype=range_none; |
262 | p->bowtype=bow_normal; |
267 | p->bowtype=bow_normal; |
263 | p->petmode=pet_normal; |
268 | p->petmode=pet_normal; |
264 | p->listening=9; |
269 | p->listening=10; |
|
|
270 | p->usekeys=containers; |
265 | p->last_weapon_sp= -1; |
271 | p->last_weapon_sp= -1; |
266 | p->peaceful=1; /* default peaceful */ |
272 | p->peaceful=1; /* default peaceful */ |
267 | p->do_los=1; |
273 | p->do_los=1; |
268 | p->explore=0; |
274 | p->explore=0; |
269 | p->no_shout=0; /* default can shout */ |
275 | p->no_shout=0; /* default can shout */ |
… | |
… | |
311 | |
317 | |
312 | int add_player(NewSocket *ns) { |
318 | int add_player(NewSocket *ns) { |
313 | player *p; |
319 | player *p; |
314 | |
320 | |
315 | p=get_player(NULL); |
321 | p=get_player(NULL); |
316 | memcpy(&p->socket, ns, sizeof(NewSocket)); |
322 | p->socket = *ns; |
317 | p->socket.faces_sent = malloc(p->socket.faces_sent_len*sizeof(*p->socket.faces_sent)); |
323 | p->socket.faces_sent = malloc(p->socket.faces_sent_len*sizeof(*p->socket.faces_sent)); |
318 | if(p->socket.faces_sent == NULL) |
324 | if(p->socket.faces_sent == NULL) |
319 | fatal(OUT_OF_MEMORY); |
325 | fatal(OUT_OF_MEMORY); |
320 | memcpy(p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len*sizeof(*p->socket.faces_sent)); |
326 | memcpy(p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len*sizeof(*p->socket.faces_sent)); |
321 | /* Needed because the socket we just copied over needs to be cleared. |
327 | /* Needed because the socket we just copied over needs to be cleared. |
… | |
… | |
396 | op=ol->ob; |
402 | op=ol->ob; |
397 | lastdist=rv.distance; |
403 | lastdist=rv.distance; |
398 | } |
404 | } |
399 | } |
405 | } |
400 | for (pl=first_player; pl != NULL; pl=pl->next) { |
406 | for (pl=first_player; pl != NULL; pl=pl->next) { |
401 | if (on_same_map(mon, pl->ob)&& can_detect_enemy(mon, pl->ob,&rv)) { |
407 | if (can_detect_enemy(mon, pl->ob,&rv)) { |
402 | |
408 | |
403 | if(lastdist>rv.distance) { |
409 | if(lastdist>rv.distance) { |
404 | op=pl->ob; |
410 | op=pl->ob; |
405 | lastdist=rv.distance; |
411 | lastdist=rv.distance; |
406 | } |
412 | } |
… | |
… | |
483 | |
489 | |
484 | mflags = get_map_flags(m, &m, x, y, &x, &y); |
490 | mflags = get_map_flags(m, &m, x, y, &x, &y); |
485 | blocked = (mflags & P_OUT_OF_MAP) ? MOVE_ALL : GET_MAP_MOVE_BLOCK(m, x, y); |
491 | blocked = (mflags & P_OUT_OF_MAP) ? MOVE_ALL : GET_MAP_MOVE_BLOCK(m, x, y); |
486 | |
492 | |
487 | /* Space is blocked - try changing direction a little */ |
493 | /* Space is blocked - try changing direction a little */ |
488 | if ((mflags & P_OUT_OF_MAP) || ((OB_TYPE_MOVE_BLOCK(mon, blocked)) |
494 | if ((mflags & P_OUT_OF_MAP) || ((OB_TYPE_MOVE_BLOCK(mon, blocked) || (mflags&P_BLOCKSVIEW)) |
489 | && (m == mon->map && blocked_link(mon, m, x, y)))) { |
495 | && (m == mon->map && blocked_link(mon, m, x, y)))) { |
490 | /* recalculate direction from last good location. Possible |
496 | /* recalculate direction from last good location. Possible |
491 | * we were not traversing ideal location before. |
497 | * we were not traversing ideal location before. |
492 | */ |
498 | */ |
493 | get_rangevector_from_mapcoord(lastmap, lastx, lasty, pl, &rv, 0); |
499 | get_rangevector_from_mapcoord(lastmap, lastx, lasty, pl, &rv, 0); |
… | |
… | |
527 | m = lastmap; |
533 | m = lastmap; |
528 | mflags = get_map_flags(m, &m, x, y, &x, &y); |
534 | mflags = get_map_flags(m, &m, x, y, &x, &y); |
529 | if (mflags & P_OUT_OF_MAP) continue; |
535 | if (mflags & P_OUT_OF_MAP) continue; |
530 | blocked = GET_MAP_MOVE_BLOCK(m, x, y); |
536 | blocked = GET_MAP_MOVE_BLOCK(m, x, y); |
531 | if (OB_TYPE_MOVE_BLOCK(mon, blocked)) continue; |
537 | if (OB_TYPE_MOVE_BLOCK(mon, blocked)) continue; |
|
|
538 | if (mflags & P_BLOCKSVIEW) continue; |
532 | |
539 | |
533 | if (m == mon->map && blocked_link(mon, m, x, y)) break; |
540 | if (m == mon->map && blocked_link(mon, m, x, y)) break; |
534 | } |
541 | } |
535 | /* go through entire loop without finding a valid |
542 | /* go through entire loop without finding a valid |
536 | * sidestep to take - thus, no valid path. |
543 | * sidestep to take - thus, no valid path. |
… | |
… | |
945 | } |
952 | } |
946 | return 0; |
953 | return 0; |
947 | } |
954 | } |
948 | |
955 | |
949 | /* This function takes the key that is passed, and does the |
956 | /* This function takes the key that is passed, and does the |
950 | * appropriate action with it (change class, or other things. |
957 | * appropriate action with it (change race, or other things). |
|
|
958 | * The function name is for historical reasons - now we have |
|
|
959 | * separate race and class; this actually changes the RACE, |
|
|
960 | * not the class. |
951 | */ |
961 | */ |
952 | |
962 | |
953 | int key_change_class(object *op, char key) |
963 | int key_change_class(object *op, char key) |
954 | { |
964 | { |
955 | int tmp_loop; |
965 | int tmp_loop; |
956 | |
966 | |
957 | if(key=='q'||key=='Q') { |
967 | if(key=='q'||key=='Q') { |
958 | remove_ob(op); |
968 | remove_ob(op); |
959 | play_again(op); |
969 | play_again(op); |
960 | return 0; |
970 | return 0; |
… | |
… | |
991 | CLEAR_FLAG(op, FLAG_WIZ); |
1001 | CLEAR_FLAG(op, FLAG_WIZ); |
992 | give_initial_items(op,op->randomitems); |
1002 | give_initial_items(op,op->randomitems); |
993 | link_player_skills(op); |
1003 | link_player_skills(op); |
994 | esrv_send_inventory(op, op); |
1004 | esrv_send_inventory(op, op); |
995 | fix_player(op); |
1005 | fix_player(op); |
|
|
1006 | |
|
|
1007 | /* This moves the player to a different start map, if there |
|
|
1008 | * is one for this race |
|
|
1009 | */ |
|
|
1010 | if(*first_map_ext_path) { |
|
|
1011 | object *tmp; |
|
|
1012 | mapstruct *oldmap = op->map; |
|
|
1013 | char mapname[MAX_BUF]; |
|
|
1014 | snprintf(mapname, MAX_BUF-1, "%s/%s", |
|
|
1015 | first_map_ext_path, op->arch->name); |
|
|
1016 | tmp=get_object(); |
|
|
1017 | EXIT_PATH(tmp) = add_string(mapname); |
|
|
1018 | EXIT_X(tmp) = op->x; |
|
|
1019 | EXIT_Y(tmp) = op->y; |
|
|
1020 | enter_exit(op,tmp); /* we don't really care if it succeeded; |
|
|
1021 | * if the map isn't there, then stay on the |
|
|
1022 | * default initial map */ |
|
|
1023 | free_object(tmp); |
|
|
1024 | } else { |
|
|
1025 | LOG(llevDebug,"first_map_ext_path not set\n"); |
|
|
1026 | } |
996 | return 0; |
1027 | return 0; |
997 | } |
1028 | } |
998 | |
1029 | |
999 | /* Following actually changes the class - this is the default command |
1030 | /* Following actually changes the race - this is the default command |
1000 | * if we don't match with one of the options above. |
1031 | * if we don't match with one of the options above. |
1001 | */ |
1032 | */ |
1002 | |
1033 | |
1003 | tmp_loop = 0; |
1034 | tmp_loop = 0; |
1004 | while(!tmp_loop) { |
1035 | while(!tmp_loop) { |
… | |
… | |
1019 | insert_ob_in_map (op, op->map, op,0); |
1050 | insert_ob_in_map (op, op->map, op,0); |
1020 | strncpy(op->contr->title, op->arch->clone.name, sizeof(op->contr->title)-1); |
1051 | strncpy(op->contr->title, op->arch->clone.name, sizeof(op->contr->title)-1); |
1021 | op->contr->title[sizeof(op->contr->title)-1] = '\0'; |
1052 | op->contr->title[sizeof(op->contr->title)-1] = '\0'; |
1022 | add_statbonus(op); |
1053 | add_statbonus(op); |
1023 | tmp_loop=allowed_class(op); |
1054 | tmp_loop=allowed_class(op); |
|
|
1055 | |
|
|
1056 | if (!strncmp (op->msg, "Edit me", 7)) tmp_loop = 0; // pippijn fucked it up //D//TODO |
1024 | } |
1057 | } |
1025 | update_object(op,UP_OBJ_FACE); |
1058 | update_object(op,UP_OBJ_FACE); |
1026 | esrv_update_item(UPD_FACE,op,op); |
1059 | esrv_update_item(UPD_FACE,op,op); |
1027 | fix_player(op); |
1060 | fix_player(op); |
1028 | op->stats.hp=op->stats.maxhp; |
1061 | op->stats.hp=op->stats.maxhp; |
… | |
… | |
2059 | |
2092 | |
2060 | /* If the creature is a pet, push it even if the player is not |
2093 | /* If the creature is a pet, push it even if the player is not |
2061 | * peaceful. Our assumption is the creature is a pet if the |
2094 | * peaceful. Our assumption is the creature is a pet if the |
2062 | * player owns it and it is either friendly or unagressive. |
2095 | * player owns it and it is either friendly or unagressive. |
2063 | */ |
2096 | */ |
2064 | if ((op->type==PLAYER) && get_owner(mon)==op && |
2097 | if ((op->type==PLAYER) |
|
|
2098 | #if COZY_SERVER |
|
|
2099 | && |
|
|
2100 | ( |
|
|
2101 | (get_owner(mon) && get_owner(mon)->contr |
|
|
2102 | && same_party (get_owner(mon)->contr->party, op->contr->party)) |
|
|
2103 | || get_owner(mon) == op |
|
|
2104 | ) |
|
|
2105 | #else |
|
|
2106 | && get_owner(mon)==op |
|
|
2107 | #endif |
2065 | (QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY))) |
2108 | && (QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY))) |
2066 | { |
2109 | { |
2067 | /* If we're braced, we don't want to switch places with it */ |
2110 | /* If we're braced, we don't want to switch places with it */ |
2068 | if (op->contr->braced) return; |
2111 | if (op->contr->braced) return; |
2069 | play_sound_map(tpl->map, tpl->x, tpl->y, SOUND_PUSH_PLAYER); |
2112 | play_sound_map(tpl->map, tpl->x, tpl->y, SOUND_PUSH_PLAYER); |
2070 | (void) push_ob(mon,dir,op); |
2113 | (void) push_ob(mon,dir,op); |
… | |
… | |
2077 | * someone, but put it inside this loop so that you won't |
2120 | * someone, but put it inside this loop so that you won't |
2078 | * attack them either. |
2121 | * attack them either. |
2079 | */ |
2122 | */ |
2080 | if ((mon->type==PLAYER || mon->enemy != op) && |
2123 | if ((mon->type==PLAYER || mon->enemy != op) && |
2081 | (mon->type==PLAYER || QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY)) && |
2124 | (mon->type==PLAYER || QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY)) && |
2082 | (op->contr->peaceful && !on_battleground)) { |
2125 | ( |
|
|
2126 | #ifdef PROHIBIT_PLAYERKILL |
|
|
2127 | (op->contr->peaceful || (mon->type == PLAYER && mon->contr->peaceful)) && |
|
|
2128 | #else |
|
|
2129 | op->contr->peaceful && |
|
|
2130 | #endif |
|
|
2131 | !on_battleground |
|
|
2132 | )) { |
2083 | if (!op->contr->braced) { |
2133 | if (!op->contr->braced) { |
2084 | play_sound_map(tpl->map, tpl->x, tpl->y, SOUND_PUSH_PLAYER); |
2134 | play_sound_map(tpl->map, tpl->x, tpl->y, SOUND_PUSH_PLAYER); |
2085 | (void) push_ob(mon,dir,op); |
2135 | (void) push_ob(mon,dir,op); |
2086 | } else { |
2136 | } else { |
2087 | new_draw_info(0, 0,op,"You withhold your attack"); |
2137 | new_draw_info(0, 0,op,"You withhold your attack"); |
… | |
… | |
2215 | */ |
2265 | */ |
2216 | int handle_newcs_player(object *op) |
2266 | int handle_newcs_player(object *op) |
2217 | { |
2267 | { |
2218 | if (op->contr->hidden) { |
2268 | if (op->contr->hidden) { |
2219 | op->invisible = 1000; |
2269 | op->invisible = 1000; |
2220 | /* the socket code flasehs the player visible/invisible |
2270 | /* the socket code flashes the player visible/invisible |
2221 | * depending on the value if invisible, so we need to |
2271 | * depending on the value of invisible, so we need to |
2222 | * alternate it here for it to work correctly. |
2272 | * alternate it here for it to work correctly. |
2223 | */ |
2273 | */ |
2224 | if (pticks & 2) op->invisible--; |
2274 | if (pticks & 2) op->invisible--; |
2225 | } |
2275 | } |
2226 | else if(op->invisible&&!(QUERY_FLAG(op,FLAG_MAKE_INVIS))) { |
2276 | else if(op->invisible&&!(QUERY_FLAG(op,FLAG_MAKE_INVIS))) { |
… | |
… | |
2494 | } |
2544 | } |
2495 | } |
2545 | } |
2496 | |
2546 | |
2497 | /* Digestion */ |
2547 | /* Digestion */ |
2498 | if(--op->last_eat<0) { |
2548 | if(--op->last_eat<0) { |
|
|
2549 | #ifdef COZY_SERVER |
|
|
2550 | int dg = op->contr->digestion>=0 && op->contr->digestion<2 ? 2 : op->contr->digestion; |
|
|
2551 | int bonus=dg>0?dg:0, |
|
|
2552 | penalty=dg<0?-dg:0; |
|
|
2553 | #else |
2499 | int bonus=op->contr->digestion>0?op->contr->digestion:0, |
2554 | int bonus=op->contr->digestion>0?op->contr->digestion:0, |
2500 | penalty=op->contr->digestion<0?-op->contr->digestion:0; |
2555 | penalty=op->contr->digestion<0?-op->contr->digestion:0; |
|
|
2556 | #endif |
|
|
2557 | |
2501 | if(op->contr->gen_hp > 0) |
2558 | if(op->contr->gen_hp > 0) |
2502 | op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); |
2559 | op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); |
2503 | else |
2560 | else |
2504 | op->last_eat=25*(1+bonus)/(penalty +1); |
2561 | op->last_eat=25*(1+bonus)/(penalty +1); |
2505 | /* dms do not consume food */ |
2562 | /* dms do not consume food */ |
… | |
… | |
2618 | |
2675 | |
2619 | /* Lauwenmark: Handle for plugin death event */ |
2676 | /* Lauwenmark: Handle for plugin death event */ |
2620 | if (execute_event(op, EVENT_DEATH,NULL,NULL,NULL,SCRIPT_FIX_ALL) != 0) |
2677 | if (execute_event(op, EVENT_DEATH,NULL,NULL,NULL,SCRIPT_FIX_ALL) != 0) |
2621 | return; |
2678 | return; |
2622 | |
2679 | |
|
|
2680 | command_kill_pets (op, 0); |
|
|
2681 | |
2623 | /* Lauwenmark: Handle for the global death event */ |
2682 | /* Lauwenmark: Handle for the global death event */ |
2624 | execute_global_event(EVENT_PLAYER_DEATH, op); |
2683 | execute_global_event(EVENT_PLAYER_DEATH, op); |
2625 | if(op->stats.food<0) { |
2684 | if(op->stats.food<0) { |
2626 | if (op->contr->explore) { |
2685 | if (op->contr->explore) { |
2627 | new_draw_info(NDI_UNIQUE, 0,op,"You would have starved, but you are"); |
2686 | new_draw_info(NDI_UNIQUE, 0,op,"You would have starved, but you are"); |
… | |
… | |
2655 | |
2714 | |
2656 | /* Basically two ways to go - remove a stat permanently, or just |
2715 | /* Basically two ways to go - remove a stat permanently, or just |
2657 | * make it depletion. This bunch of code deals with that aspect |
2716 | * make it depletion. This bunch of code deals with that aspect |
2658 | * of death. |
2717 | * of death. |
2659 | */ |
2718 | */ |
2660 | |
2719 | #ifndef COZY_SERVER |
2661 | if (settings.balanced_stat_loss) { |
2720 | if (settings.balanced_stat_loss) { |
2662 | /* If stat loss is permanent, lose one stat only. */ |
2721 | /* If stat loss is permanent, lose one stat only. */ |
2663 | /* Lower level chars don't lose as many stats because they suffer |
2722 | /* Lower level chars don't lose as many stats because they suffer |
2664 | more if they do. */ |
2723 | more if they do. */ |
2665 | /* Higher level characters can afford things such as potions of |
2724 | /* Higher level characters can afford things such as potions of |
… | |
… | |
2674 | num_stats_lose = 1; |
2733 | num_stats_lose = 1; |
2675 | } |
2734 | } |
2676 | lost_a_stat = 0; |
2735 | lost_a_stat = 0; |
2677 | |
2736 | |
2678 | for (z=0; z<num_stats_lose; z++) { |
2737 | for (z=0; z<num_stats_lose; z++) { |
|
|
2738 | i = RANDOM() % NUM_STATS; |
|
|
2739 | |
2679 | if (settings.stat_loss_on_death) { |
2740 | if (settings.stat_loss_on_death) { |
2680 | /* Pick a random stat and take a point off it. Tell the player |
2741 | /* Pick a random stat and take a point off it. Tell the player |
2681 | * what he lost. |
2742 | * what he lost. |
2682 | */ |
2743 | */ |
2683 | i = RANDOM() % 7; |
|
|
2684 | change_attr_value(&(op->stats), i,-1); |
2744 | change_attr_value(&(op->stats), i,-1); |
2685 | check_stat_bounds(&(op->stats)); |
2745 | check_stat_bounds(&(op->stats)); |
2686 | change_attr_value(&(op->contr->orig_stats), i,-1); |
2746 | change_attr_value(&(op->contr->orig_stats), i,-1); |
2687 | check_stat_bounds(&(op->contr->orig_stats)); |
2747 | check_stat_bounds(&(op->contr->orig_stats)); |
2688 | new_draw_info(NDI_UNIQUE, 0,op, lose_msg[i]); |
2748 | new_draw_info(NDI_UNIQUE, 0,op, lose_msg[i]); |
… | |
… | |
2690 | } else { |
2750 | } else { |
2691 | /* deplete a stat */ |
2751 | /* deplete a stat */ |
2692 | archetype *deparch=find_archetype("depletion"); |
2752 | archetype *deparch=find_archetype("depletion"); |
2693 | object *dep; |
2753 | object *dep; |
2694 | |
2754 | |
2695 | i = RANDOM() % 7; |
|
|
2696 | dep = present_arch_in_ob(deparch,op); |
2755 | dep = present_arch_in_ob(deparch,op); |
2697 | if(!dep) { |
2756 | if(!dep) { |
2698 | dep = arch_to_object(deparch); |
2757 | dep = arch_to_object(deparch); |
2699 | insert_ob_in_ob(dep, op); |
2758 | insert_ob_in_ob(dep, op); |
2700 | } |
2759 | } |
… | |
… | |
2756 | " you.", god); |
2815 | " you.", god); |
2757 | else |
2816 | else |
2758 | new_draw_info(NDI_UNIQUE, 0, op, "For a brief moment you" |
2817 | new_draw_info(NDI_UNIQUE, 0, op, "For a brief moment you" |
2759 | " feel a holy presence protecting you."); |
2818 | " feel a holy presence protecting you."); |
2760 | } |
2819 | } |
|
|
2820 | #endif |
|
|
2821 | new_draw_info(NDI_UNIQUE, 0, op, "For a brief moment you" |
|
|
2822 | " feel a holy presence protecting you from losing yourself completely."); |
2761 | |
2823 | |
2762 | /* Put a gravestone up where the character 'almost' died. List the |
2824 | /* Put a gravestone up where the character 'almost' died. List the |
2763 | * exp loss on the stone. |
2825 | * exp loss on the stone. |
2764 | */ |
2826 | */ |
2765 | tmp=arch_to_object(find_archetype("gravestone")); |
2827 | tmp=arch_to_object(find_archetype("gravestone")); |