… | |
… | |
122 | continue; |
122 | continue; |
123 | |
123 | |
124 | if (*buf == '%') |
124 | if (*buf == '%') |
125 | { /* send one news */ |
125 | { /* send one news */ |
126 | if (size > 0) |
126 | if (size > 0) |
127 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */ |
127 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, |
|
|
128 | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
|
|
129 | "INFORMATION: %s\n%s", (char *)"%s\n%s", |
|
|
130 | subject, news); /*send previously read news */ |
128 | |
131 | |
129 | strcpy (subject, buf + 1); |
132 | strcpy (subject, buf + 1); |
130 | strip_endline (subject); |
133 | strip_endline (subject); |
131 | size = 0; |
134 | size = 0; |
132 | news[0] = '\0'; |
135 | news[0] = '\0'; |
… | |
… | |
216 | /* make sure he's a player -- needed because of class change. */ |
219 | /* make sure he's a player -- needed because of class change. */ |
217 | ob->type = PLAYER; // we are paranoid |
220 | ob->type = PLAYER; // we are paranoid |
218 | ob->race = ob->arch->race; |
221 | ob->race = ob->arch->race; |
219 | |
222 | |
220 | ob->update_weight (); |
223 | ob->update_weight (); |
221 | link_player_skills (ob); |
224 | link_skills (); |
222 | |
225 | |
223 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
226 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
224 | |
227 | |
225 | assign (title, ob->arch->object::name); |
228 | assign (title, ob->arch->object::name); |
226 | |
229 | |
… | |
… | |
321 | combat_ob = op; |
324 | combat_ob = op; |
322 | break; |
325 | break; |
323 | } |
326 | } |
324 | |
327 | |
325 | ob->change_weapon (combat_ob ? combat_ob : ranged_ob); |
328 | ob->change_weapon (combat_ob ? combat_ob : ranged_ob); |
326 | ob->deactivate (); // change_Weapon activates, fix this better |
329 | ob->deactivate (); // change_weapon activates, fix this better |
327 | } |
330 | } |
328 | |
331 | |
329 | void |
332 | void |
330 | player::set_observe (object *op) |
333 | player::set_observe (object *op) |
331 | { |
334 | { |
… | |
… | |
345 | savebed_map = first_map_path; /* Init. respawn position */ |
348 | savebed_map = first_map_path; /* Init. respawn position */ |
346 | |
349 | |
347 | gen_sp_armour = 10; |
350 | gen_sp_armour = 10; |
348 | bowtype = bow_normal; |
351 | bowtype = bow_normal; |
349 | petmode = pet_normal; |
352 | petmode = pet_normal; |
350 | listening = 10; |
|
|
351 | usekeys = containers; |
353 | usekeys = containers; |
352 | peaceful = 1; /* default peaceful */ |
354 | peaceful = 1; /* default peaceful */ |
353 | do_los = 1; |
355 | do_los = 1; |
354 | |
356 | |
355 | weapon_sp = 1.0f; |
357 | weapon_sp = 1.0f; |
… | |
… | |
364 | attachable::do_destroy (); |
366 | attachable::do_destroy (); |
365 | |
367 | |
366 | if (ob) |
368 | if (ob) |
367 | { |
369 | { |
368 | ob->destroy_inv (false); |
370 | ob->destroy_inv (false); |
369 | ob->destroy (); |
371 | ob->destroy (true); |
370 | } |
372 | } |
371 | |
373 | |
372 | ob = observe = 0; |
374 | ob = observe = 0; |
373 | } |
375 | } |
374 | |
376 | |
… | |
… | |
666 | || op->type == CLOAK || op->type == HELMET |
668 | || op->type == CLOAK || op->type == HELMET |
667 | || op->type == SHIELD || op->type == GLOVES |
669 | || op->type == SHIELD || op->type == GLOVES |
668 | || op->type == BRACERS || op->type == GIRDLE)) |
670 | || op->type == BRACERS || op->type == GIRDLE)) |
669 | || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
671 | || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
670 | { |
672 | { |
671 | op->destroy (); |
673 | op->destroy (true); |
672 | continue; |
674 | continue; |
673 | } |
675 | } |
674 | } |
676 | } |
675 | |
677 | |
676 | /* This really needs to be better - we should really give |
678 | /* This really needs to be better - we should really give |
… | |
… | |
687 | if (tmp->type == op->type && tmp->name == op->name) |
689 | if (tmp->type == op->type && tmp->name == op->name) |
688 | break; |
690 | break; |
689 | |
691 | |
690 | if (tmp) |
692 | if (tmp) |
691 | { |
693 | { |
692 | op->destroy (); |
694 | op->destroy (true); |
693 | LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); |
695 | LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); |
694 | continue; |
696 | continue; |
695 | } |
697 | } |
696 | |
698 | |
697 | if (op->nrof > 1) |
699 | if (op->nrof > 1) |
… | |
… | |
712 | CLEAR_FLAG (op, FLAG_DAMNED); |
714 | CLEAR_FLAG (op, FLAG_DAMNED); |
713 | } |
715 | } |
714 | |
716 | |
715 | if (op->type == SPELL) |
717 | if (op->type == SPELL) |
716 | { |
718 | { |
717 | op->destroy (); |
719 | op->destroy (true); |
718 | continue; |
720 | continue; |
719 | } |
721 | } |
720 | else if (op->type == SKILL) |
722 | else if (op->type == SKILL) |
721 | { |
723 | { |
722 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
724 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
… | |
… | |
726 | else /* lock all 'normal items by default */ |
728 | else /* lock all 'normal items by default */ |
727 | SET_FLAG (op, FLAG_INV_LOCKED); |
729 | SET_FLAG (op, FLAG_INV_LOCKED); |
728 | } /* for loop of objects in player inv */ |
730 | } /* for loop of objects in player inv */ |
729 | |
731 | |
730 | /* Need to set up the skill pointers */ |
732 | /* Need to set up the skill pointers */ |
731 | link_player_skills (pl); |
733 | pl->contr->link_skills (); |
732 | } |
734 | } |
733 | |
735 | |
734 | void |
736 | void |
735 | get_party_password (object *op, partylist *party) |
737 | get_party_password (object *op, partylist *party) |
736 | { |
738 | { |
… | |
… | |
865 | ob->contr->ns->state = ST_PLAYING; |
867 | ob->contr->ns->state = ST_PLAYING; |
866 | |
868 | |
867 | if (ob->msg) |
869 | if (ob->msg) |
868 | ob->msg = 0; |
870 | ob->msg = 0; |
869 | |
871 | |
870 | /* We create this now because some of the unique maps will need it |
|
|
871 | * to save here. |
|
|
872 | */ |
|
|
873 | { |
|
|
874 | char buf[MAX_BUF]; |
|
|
875 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &ob->name); |
|
|
876 | make_path_to_file (buf); |
|
|
877 | } |
|
|
878 | |
|
|
879 | start_info (ob); |
872 | start_info (ob); |
880 | CLEAR_FLAG (ob, FLAG_WIZ); |
873 | CLEAR_FLAG (ob, FLAG_WIZ); |
881 | give_initial_items (ob, ob->randomitems); |
874 | give_initial_items (ob, ob->randomitems); |
882 | link_player_skills (ob); |
|
|
883 | esrv_send_inventory (ob, ob); |
875 | esrv_send_inventory (ob, ob); |
884 | ob->update_stats (); |
876 | ob->update_stats (); |
885 | |
877 | |
886 | /* This moves the player to a different start map, if there |
878 | /* This moves the player to a different start map, if there |
887 | * is one for this race |
879 | * is one for this race |
888 | */ |
880 | */ |
889 | if (*first_map_ext_path) |
881 | if (*first_map_ext_path) |
890 | { |
882 | ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y); |
891 | object *tmp; |
|
|
892 | char mapname[MAX_BUF]; |
|
|
893 | |
|
|
894 | snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &ob->arch->archname); |
|
|
895 | tmp = object::create (); |
|
|
896 | EXIT_PATH (tmp) = mapname; |
|
|
897 | EXIT_X (tmp) = ob->x; |
|
|
898 | EXIT_Y (tmp) = ob->y; |
|
|
899 | ob->enter_exit (tmp); /* we don't really care if it succeeded; |
|
|
900 | * if the map isn't there, then stay on the |
|
|
901 | * default initial map */ |
|
|
902 | tmp->destroy (); |
|
|
903 | } |
|
|
904 | else |
883 | else |
905 | LOG (llevDebug, "first_map_ext_path not set\n"); |
884 | LOG (llevDebug, "first_map_ext_path not set\n"); |
906 | } |
885 | } |
907 | |
886 | |
908 | void |
887 | void |
… | |
… | |
1327 | if (op->contr->mode & PU_RATIO) |
1306 | if (op->contr->mode & PU_RATIO) |
1328 | { |
1307 | { |
1329 | /* use value density to decide what else to grab */ |
1308 | /* use value density to decide what else to grab */ |
1330 | /* >=7 was >= op->contr->mode */ |
1309 | /* >=7 was >= op->contr->mode */ |
1331 | /* >=7 is the old standard setting. Now we take the last 4 bits |
1310 | /* >=7 is the old standard setting. Now we take the last 4 bits |
1332 | * and multiply them by 5, giving 0..15*5== 5..75 */ |
1311 | */ |
1333 | wvratio = (op->contr->mode & PU_RATIO) * 5; |
1312 | wvratio = op->contr->mode & PU_RATIO; |
1334 | if ((query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1))) >= (unsigned int) wvratio) |
1313 | if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100) |
1335 | { |
1314 | { |
1336 | CHK_PICK_PICKUP; |
1315 | CHK_PICK_PICKUP; |
1337 | #if 0 |
1316 | #if 0 |
1338 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
1317 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
1339 | if (tmp->name != NULL) |
1318 | if (tmp->name != NULL) |
… | |
… | |
1443 | betterby = 1 + arrow->magic + arrow->stats.dam; |
1422 | betterby = 1 + arrow->magic + arrow->stats.dam; |
1444 | } |
1423 | } |
1445 | } |
1424 | } |
1446 | } |
1425 | } |
1447 | } |
1426 | } |
|
|
1427 | |
1448 | if (tmp == NULL && arrow == NULL) |
1428 | if (tmp == NULL && arrow == NULL) |
1449 | return find_arrow (op, type); |
1429 | return find_arrow (op, type); |
1450 | |
1430 | |
1451 | *better = betterby; |
1431 | *better = betterby; |
1452 | return tmp; |
1432 | return tmp; |
… | |
… | |
1598 | } |
1578 | } |
1599 | |
1579 | |
1600 | /* this should not happen, but sometimes does */ |
1580 | /* this should not happen, but sometimes does */ |
1601 | if (arrow->nrof == 0) |
1581 | if (arrow->nrof == 0) |
1602 | { |
1582 | { |
|
|
1583 | LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ()); |
1603 | arrow->destroy (); |
1584 | arrow->destroy (true); |
1604 | return 0; |
1585 | return 0; |
1605 | } |
1586 | } |
1606 | |
1587 | |
1607 | left = arrow; /* these are arrows left to the player */ |
1588 | left = arrow; /* these are arrows left to the player */ |
1608 | arrow = arrow->split (); |
1589 | arrow = arrow->split (); |
… | |
… | |
2272 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2253 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2273 | { |
2254 | { |
2274 | op->play_sound (sound_find ("ob_evaporate")); |
2255 | op->play_sound (sound_find ("ob_evaporate")); |
2275 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2256 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2276 | |
2257 | |
2277 | tmp->destroy (); |
2258 | tmp->destroy (true); |
2278 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2259 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2279 | |
2260 | |
2280 | if (op->stats.hp < 0) |
2261 | if (op->stats.hp < 0) |
2281 | op->stats.hp = op->stats.maxhp; |
2262 | op->stats.hp = op->stats.maxhp; |
2282 | |
2263 | |
… | |
… | |
2331 | const char * |
2312 | const char * |
2332 | gravestone_text (object *op) |
2313 | gravestone_text (object *op) |
2333 | { |
2314 | { |
2334 | static dynbuf_text buf; |
2315 | static dynbuf_text buf; |
2335 | |
2316 | |
2336 | buf << "---- R.I.P. ----\n\n"; |
2317 | buf << "---- R.I.P. ----\n\n" |
2337 | op->name; |
2318 | << op->name; |
2338 | |
2319 | |
2339 | if (op->type == PLAYER) |
2320 | if (op->type == PLAYER) |
2340 | buf << " the " << op->contr->title; |
2321 | buf << " the " << op->contr->title; |
2341 | |
2322 | |
2342 | buf << "\n\n"; |
2323 | buf << "\n\n"; |
… | |
… | |
2544 | op->stats.food--; |
2525 | op->stats.food--; |
2545 | } |
2526 | } |
2546 | |
2527 | |
2547 | if (op->stats.food < 0 && op->stats.hp >= 0) |
2528 | if (op->stats.food < 0 && op->stats.hp >= 0) |
2548 | { |
2529 | { |
2549 | object *tmp, *flesh = 0; |
2530 | object *flesh = 0; |
2550 | |
2531 | |
2551 | for (tmp = op->inv; tmp; tmp = tmp->below) |
2532 | for_inv_removable (op, tmp) |
2552 | { |
2533 | { |
2553 | if (!QUERY_FLAG (tmp, FLAG_UNPAID)) |
2534 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
|
|
2535 | continue; |
|
|
2536 | |
|
|
2537 | if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) |
2554 | { |
2538 | { |
2555 | if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) |
2539 | op->statusmsg ("You blindly grab for a bite of food. " |
2556 | { |
2540 | "H<To prevent you from starving, you ate some random item from your backpack.>"); |
2557 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
|
|
2558 | manual_apply (op, tmp, 0); |
2541 | manual_apply (op, tmp, 0); |
|
|
2542 | |
2559 | if (op->stats.food >= 0 || op->stats.hp < 0) |
2543 | if (op->stats.food >= 0 || op->stats.hp < 0) |
2560 | break; |
2544 | break; |
2561 | } |
2545 | } |
2562 | else if (tmp->type == FLESH) |
2546 | else if (tmp->type == FLESH) |
2563 | flesh = tmp; |
2547 | flesh = tmp; |
2564 | } /* End if paid for object */ |
2548 | } |
2565 | } /* end of for loop */ |
|
|
2566 | |
2549 | |
2567 | /* If player is still starving, it means they don't have any food, so |
2550 | /* If player is still starving, it means they don't have any food, so |
2568 | * eat flesh instead. |
2551 | * eat flesh instead. |
2569 | */ |
2552 | */ |
2570 | if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) |
2553 | if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) |
2571 | { |
2554 | { |
2572 | new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); |
2555 | op->statusmsg ("You blindly grab for a bite of food. " |
|
|
2556 | "H<To prevent you from starving, you ate some random item from your backpack.>"); |
2573 | manual_apply (op, flesh, 0); |
2557 | manual_apply (op, flesh, 0); |
2574 | } |
2558 | } |
2575 | } |
|
|
2576 | |
2559 | |
2577 | if (op->stats.food < 0 && op->stats.hp >= -op->stats.food) |
2560 | // If player is still starving, alert him! |
|
|
2561 | if (op->stats.food < 0) |
|
|
2562 | op->failmsg ("You are starving! " |
|
|
2563 | "H<Eat some food to increase your food and prevent you from an untimely death.>"); |
2578 | { |
2564 | } |
|
|
2565 | |
|
|
2566 | if (op->stats.food < 0) |
|
|
2567 | { |
2579 | op->stats.hp += op->stats.food; |
2568 | op->stats.hp += op->stats.food; |
2580 | op->stats.food = 0; |
2569 | op->stats.food = 0; |
|
|
2570 | |
|
|
2571 | if (op->stats.hp < 0) |
|
|
2572 | { |
|
|
2573 | op->contr->killer = archetype::get ("killer_starvation"); |
|
|
2574 | op->contr->killer->destroy (true); |
2581 | } |
2575 | } |
|
|
2576 | } |
2582 | |
2577 | |
|
|
2578 | /* killer should be set here already */ |
2583 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2579 | if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) |
2584 | kill_player (op); |
2580 | kill_player (op); |
2585 | } |
2581 | } |
2586 | } |
2582 | } |
2587 | |
2583 | |
… | |
… | |
2614 | |
2610 | |
2615 | /* restore player */ |
2611 | /* restore player */ |
2616 | at = archetype::find ("poisoning"); |
2612 | at = archetype::find ("poisoning"); |
2617 | if (object *tmp = present_arch_in_ob (at, op)) |
2613 | if (object *tmp = present_arch_in_ob (at, op)) |
2618 | { |
2614 | { |
2619 | tmp->destroy (); |
2615 | tmp->destroy (true); |
2620 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2616 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2621 | } |
2617 | } |
2622 | |
2618 | |
2623 | at = archetype::find ("confusion"); |
2619 | at = archetype::find ("confusion"); |
2624 | if (object *tmp = present_arch_in_ob (at, op)) |
2620 | if (object *tmp = present_arch_in_ob (at, op)) |
2625 | { |
2621 | { |
2626 | tmp->destroy (); |
2622 | tmp->destroy (true); |
2627 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2623 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2628 | } |
2624 | } |
2629 | |
2625 | |
2630 | cure_disease (op, 0, 0); /* remove any disease */ |
2626 | cure_disease (op, 0, 0); /* remove any disease */ |
2631 | op->stats.hp = op->stats.maxhp; |
2627 | op->stats.hp = op->stats.maxhp; |
… | |
… | |
2655 | } |
2651 | } |
2656 | |
2652 | |
2657 | INVOKE_PLAYER (DEATH, op->contr); |
2653 | INVOKE_PLAYER (DEATH, op->contr); |
2658 | |
2654 | |
2659 | command_kill_pets (op, 0); |
2655 | command_kill_pets (op, 0); |
2660 | |
|
|
2661 | if (op->stats.food < 0) |
|
|
2662 | { |
|
|
2663 | op->contr->killer = archetype::get ("killer_starvation"); |
|
|
2664 | op->contr->killer->destroy (); |
|
|
2665 | } |
|
|
2666 | |
2656 | |
2667 | op->contr->play_sound (sound_find ("player_dies")); |
2657 | op->contr->play_sound (sound_find ("player_dies")); |
2668 | |
2658 | |
2669 | /* save the map location for corpse, gravestone */ |
2659 | /* save the map location for corpse, gravestone */ |
2670 | x = op->x; |
2660 | x = op->x; |
… | |
… | |
2779 | lost_a_stat = 1; |
2769 | lost_a_stat = 1; |
2780 | } |
2770 | } |
2781 | } |
2771 | } |
2782 | } |
2772 | } |
2783 | } |
2773 | } |
|
|
2774 | |
2784 | /* If no stat lost, tell the player. */ |
2775 | /* If no stat lost, tell the player. */ |
2785 | if (!lost_a_stat) |
2776 | if (!lost_a_stat) |
2786 | { |
2777 | { |
2787 | /* determine_god() seems to not work sometimes... why is this? |
2778 | /* determine_god() seems to not work sometimes... why is this? |
2788 | Should I be using something else? GD */ |
2779 | Should I be using something else? GD */ |
… | |
… | |
2792 | new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god); |
2783 | new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god); |
2793 | else |
2784 | else |
2794 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); |
2785 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); |
2795 | } |
2786 | } |
2796 | #else |
2787 | #else |
2797 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely."); |
2788 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you from losing yourself completely."); |
2798 | #endif |
2789 | #endif |
2799 | |
2790 | |
2800 | /* Put a gravestone up where the character 'almost' died. List the |
2791 | /* Put a gravestone up where the character 'almost' died. List the |
2801 | * exp loss on the stone. |
2792 | * exp loss on the stone. |
2802 | */ |
2793 | */ |
2803 | tmp = arch_to_object (archetype::find ("gravestone")); |
2794 | tmp = arch_to_object (archetype::find ("gravestone")); |
2804 | sprintf (buf, "%s's gravestone", &op->name); |
2795 | tmp->name = format ("%s's gravestone", &op->name); |
2805 | tmp->name = buf; |
2796 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2806 | sprintf (buf, "%s's gravestones", &op->name); |
2797 | tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n", |
2807 | tmp->name_pl = buf; |
2798 | &op->name, op->contr->title, op->contr->killer_name ()); |
2808 | sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer_name ()); |
|
|
2809 | tmp->msg = buf; |
|
|
2810 | tmp->x = op->x, tmp->y = op->y; |
2799 | tmp->x = op->x, tmp->y = op->y; |
2811 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2800 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2812 | |
2801 | |
2813 | /**************************************/ |
2802 | /**************************************/ |
2814 | /* */ |
2803 | /* */ |
… | |
… | |
2823 | at = archetype::find ("poisoning"); |
2812 | at = archetype::find ("poisoning"); |
2824 | tmp = present_arch_in_ob (at, op); |
2813 | tmp = present_arch_in_ob (at, op); |
2825 | |
2814 | |
2826 | if (tmp) |
2815 | if (tmp) |
2827 | { |
2816 | { |
2828 | tmp->destroy (); |
2817 | tmp->destroy (true); |
2829 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2818 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2830 | } |
2819 | } |
2831 | |
2820 | |
2832 | at = archetype::find ("confusion"); |
2821 | at = archetype::find ("confusion"); |
2833 | tmp = present_arch_in_ob (at, op); |
2822 | tmp = present_arch_in_ob (at, op); |
2834 | if (tmp) |
2823 | if (tmp) |
2835 | { |
2824 | { |
2836 | tmp->destroy (); |
2825 | tmp->destroy (true); |
2837 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2826 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2838 | } |
2827 | } |
2839 | |
2828 | |
2840 | cure_disease (op, 0, 0); /* remove any disease */ |
2829 | cure_disease (op, 0, 0); /* remove any disease */ |
|
|
2830 | |
|
|
2831 | // remove all spell effects that are active |
|
|
2832 | // to avoid long-term effects such as word-of-recall |
|
|
2833 | for (object *item = op->inv; item; ) |
|
|
2834 | { |
|
|
2835 | object *next = item->below; |
|
|
2836 | |
|
|
2837 | if (item->type == SPELL_EFFECT && item->active) |
|
|
2838 | item->destroy (true); |
|
|
2839 | |
|
|
2840 | item = next; |
|
|
2841 | } |
2841 | |
2842 | |
2842 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2843 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2843 | apply_death_exp_penalty (op); |
2844 | apply_death_exp_penalty (op); |
|
|
2845 | |
2844 | if (op->stats.food < 100) |
2846 | if (op->stats.food < 100) |
2845 | op->stats.food = 900; |
2847 | op->stats.food = 900; |
|
|
2848 | |
2846 | op->stats.hp = op->stats.maxhp; |
2849 | op->stats.hp = op->stats.maxhp; |
2847 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2850 | op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); |
2848 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2851 | op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); |
2849 | |
2852 | |
2850 | /* |
2853 | /* |
… | |
… | |
2888 | if (will_kill_again & (1 << at)) |
2891 | if (will_kill_again & (1 << at)) |
2889 | force->resist[at] = 100; |
2892 | force->resist[at] = 100; |
2890 | |
2893 | |
2891 | insert_ob_in_ob (force, op); |
2894 | insert_ob_in_ob (force, op); |
2892 | op->update_stats (); |
2895 | op->update_stats (); |
2893 | |
|
|
2894 | } |
2896 | } |
2895 | |
2897 | |
2896 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2898 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2897 | } |
2899 | } |
2898 | |
2900 | |
… | |
… | |
2922 | { |
2924 | { |
2923 | tmp->decrease (rndm (1, tmp->nrof - 1)); |
2925 | tmp->decrease (rndm (1, tmp->nrof - 1)); |
2924 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2926 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2925 | } |
2927 | } |
2926 | else |
2928 | else |
2927 | tmp->destroy (); |
2929 | tmp->destroy (true); |
2928 | } |
2930 | } |
2929 | else |
2931 | else |
2930 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2932 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2931 | } |
2933 | } |
2932 | } |
2934 | } |
… | |
… | |
2993 | if (op->type == PLAYER) |
2995 | if (op->type == PLAYER) |
2994 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); |
2996 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); |
2995 | |
2997 | |
2996 | cast_spell (op, throw_ob, dir, spob, NULL); |
2998 | cast_spell (op, throw_ob, dir, spob, NULL); |
2997 | |
2999 | |
2998 | throw_ob->destroy (); |
3000 | throw_ob->destroy (true); |
2999 | } |
3001 | } |
3000 | |
3002 | |
3001 | void |
3003 | void |
3002 | make_visible (object *op) |
3004 | make_visible (object *op) |
3003 | { |
3005 | { |