… | |
… | |
2522 | */ |
2522 | */ |
2523 | void |
2523 | void |
2524 | kill_player (object *op) |
2524 | kill_player (object *op) |
2525 | { |
2525 | { |
2526 | int x, y; |
2526 | int x, y; |
2527 | char buf[MAX_BUF]; |
|
|
2528 | maptile *map; /* this is for resurrection */ |
2527 | maptile *map; /* this is for resurrection */ |
2529 | int will_kill_again; |
2528 | int will_kill_again; |
2530 | archetype *at; |
2529 | archetype *at; |
2531 | object *tmp; |
2530 | object *tmp; |
2532 | |
2531 | |
2533 | if (save_life (op)) |
2532 | if (save_life (op)) |
2534 | return; |
2533 | return; |
2535 | |
2534 | |
|
|
2535 | dynbuf_text deathtab; |
|
|
2536 | |
2536 | /* restore player */ |
2537 | /* restore player */ |
2537 | at = archetype::find ("poisoning"); |
2538 | at = archetype::find ("poisoning"); |
2538 | if (object *tmp = present_arch_in_ob (at, op)) |
2539 | if (object *tmp = present_arch_in_ob (at, op)) |
2539 | { |
2540 | { |
2540 | tmp->destroy (); |
2541 | tmp->destroy (); |
2541 | new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); |
2542 | deathtab << "Your body feels cleansed...\r"; |
2542 | } |
2543 | } |
2543 | |
2544 | |
2544 | at = archetype::find ("confusion"); |
2545 | at = archetype::find ("confusion"); |
2545 | if (object *tmp = present_arch_in_ob (at, op)) |
2546 | if (object *tmp = present_arch_in_ob (at, op)) |
2546 | { |
2547 | { |
2547 | tmp->destroy (); |
2548 | tmp->destroy (); |
2548 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2549 | deathtab << "Your mind feels clearer...\r"; |
2549 | } |
2550 | } |
2550 | |
2551 | |
2551 | cure_disease (op, 0, 0); /* remove any disease */ |
2552 | cure_disease (op, 0, 0); /* remove any disease */ |
2552 | |
2553 | |
2553 | max_it (op->stats.hp , op->stats.maxhp); |
2554 | max_it (op->stats.hp , op->stats.maxhp); |
… | |
… | |
2573 | * in cities ONLY!!! It is very important that this doesn't get abused. |
2574 | * in cities ONLY!!! It is very important that this doesn't get abused. |
2574 | * Look at op_on_battleground() for more info --AndreasV |
2575 | * Look at op_on_battleground() for more info --AndreasV |
2575 | */ |
2576 | */ |
2576 | if (op_on_battleground (op, &x, &y)) |
2577 | if (op_on_battleground (op, &x, &y)) |
2577 | { |
2578 | { |
2578 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You have been defeated in combat!"); |
2579 | deathtab << "You almost died in combat, but local medics have saved your life...\r"; |
2579 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Local medics have saved your life..."); |
|
|
2580 | |
2580 | |
2581 | /* create a bodypart-trophy to make the winner happy */ |
2581 | /* create a bodypart-trophy to make the winner happy */ |
2582 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2582 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2583 | { |
2583 | { |
2584 | tmp->name = format ("%s's finger" , &op->name); |
2584 | tmp->name = format ("%s's finger" , &op->name); |
… | |
… | |
2595 | } |
2595 | } |
2596 | |
2596 | |
2597 | /* teleport defeated player to new destination */ |
2597 | /* teleport defeated player to new destination */ |
2598 | transfer_ob (op, x, y, 0, NULL); |
2598 | transfer_ob (op, x, y, 0, NULL); |
2599 | op->contr->braced = 0; |
2599 | op->contr->braced = 0; |
|
|
2600 | |
|
|
2601 | op->contr->infobox (MSG_CHANNEL ("death"), deathtab); |
2600 | return; |
2602 | return; |
2601 | } |
2603 | } |
|
|
2604 | |
|
|
2605 | deathtab << "You were killed by " << op->contr->killer_name () << ".\n\n"; |
|
|
2606 | deathtab << "T<YOU HAVE DIED>\n\n"; |
2602 | |
2607 | |
2603 | INVOKE_PLAYER (DEATH, op->contr); |
2608 | INVOKE_PLAYER (DEATH, op->contr); |
2604 | |
2609 | |
2605 | command_kill_pets (op, 0); |
2610 | command_kill_pets (op, 0); |
2606 | |
2611 | |
… | |
… | |
2728 | /* determine_god() seems to not work sometimes... why is this? |
2733 | /* determine_god() seems to not work sometimes... why is this? |
2729 | Should I be using something else? GD */ |
2734 | Should I be using something else? GD */ |
2730 | shstr_tmp god = determine_god (op); |
2735 | shstr_tmp god = determine_god (op); |
2731 | |
2736 | |
2732 | if (god != shstr_none) |
2737 | if (god != shstr_none) |
2733 | new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", &god); |
2738 | deathtab << "For a brief moment you feel the holy presence of " << god << " protecting you.\r"; |
2734 | else |
2739 | else |
2735 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); |
2740 | deathtab << "For a brief moment you feel a holy presence protecting you.\r"; |
2736 | } |
2741 | } |
2737 | #else |
2742 | #else |
2738 | new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you from losing yourself completely."); |
2743 | deathtab << "For a brief moment you feel a holy presence protecting you from losing yourself completely."; |
2739 | #endif |
2744 | #endif |
2740 | |
2745 | |
2741 | /* Put a gravestone up where the character 'almost' died. List the |
2746 | /* Put a gravestone up where the character 'almost' died. List the |
2742 | * exp loss on the stone. |
2747 | * exp loss on the stone. |
2743 | */ |
2748 | */ |
… | |
… | |
2801 | |
2806 | |
2802 | insert_ob_in_ob (force, op); |
2807 | insert_ob_in_ob (force, op); |
2803 | op->update_stats (); |
2808 | op->update_stats (); |
2804 | } |
2809 | } |
2805 | |
2810 | |
2806 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2811 | op->contr->infobox (MSG_CHANNEL ("death"), deathtab); |
2807 | } |
2812 | } |
2808 | |
2813 | |
2809 | void |
2814 | void |
2810 | loot_object (object *op) |
2815 | loot_object (object *op) |
2811 | { /* Grab and destroy some treasure */ |
2816 | { /* Grab and destroy some treasure */ |