… | |
… | |
183 | |
183 | |
184 | if (ob->map) |
184 | if (ob->map) |
185 | maplevel = ob->map->path; |
185 | maplevel = ob->map->path; |
186 | |
186 | |
187 | ob->remove (); |
187 | ob->remove (); |
|
|
188 | ob->enemy = 0; // sometimes keeps an extra refcount on itself |
188 | ob->map = 0; |
189 | ob->map = 0; |
189 | party = 0; |
190 | party = 0; |
190 | |
191 | |
191 | combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this |
192 | combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this |
192 | |
193 | |
… | |
… | |
1963 | |
1964 | |
1964 | if (door->type == DOOR) |
1965 | if (door->type == DOOR) |
1965 | hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */ |
1966 | hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */ |
1966 | else if (door->type == LOCKED_DOOR) |
1967 | else if (door->type == LOCKED_DOOR) |
1967 | { |
1968 | { |
1968 | new_draw_info_format (NDI_UNIQUE, NDI_BROWN, op, "You open the door with the %s", query_short_name (key)); |
1969 | op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN); |
1969 | remove_door2 (door); /* remove door without violence ;-) */ |
1970 | remove_door2 (door); /* remove door without violence ;-) */ |
1970 | } |
1971 | } |
1971 | |
1972 | |
1972 | /* Do this after we print the message */ |
1973 | /* Do this after we print the message */ |
1973 | decrease_ob (key); /* Use up one of the keys */ |
1974 | decrease_ob (key); /* Use up one of the keys */ |
… | |
… | |
1978 | return 1; /* Nothing more to do below */ |
1979 | return 1; /* Nothing more to do below */ |
1979 | } |
1980 | } |
1980 | else if (door->type == LOCKED_DOOR) |
1981 | else if (door->type == LOCKED_DOOR) |
1981 | { |
1982 | { |
1982 | /* Might as well return now - no other way to open this */ |
1983 | /* Might as well return now - no other way to open this */ |
1983 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, door->msg); |
1984 | op->failmsg (door->msg ? &door->msg : "Hmm, you miss the certain something to open this door..."); |
1984 | return 1; |
1985 | return 1; |
1985 | } |
1986 | } |
1986 | |
1987 | |
1987 | return 0; |
1988 | return 0; |
1988 | } |
1989 | } |
… | |
… | |
2108 | { |
2109 | { |
2109 | op->play_sound (sound_find ("push_player")); |
2110 | op->play_sound (sound_find ("push_player")); |
2110 | push_ob (mon, dir, op); |
2111 | push_ob (mon, dir, op); |
2111 | } |
2112 | } |
2112 | else |
2113 | else |
2113 | new_draw_info (0, 0, op, "You withhold your attack"); |
2114 | op->statusmsg ("You withhold your attack"); |
2114 | |
2115 | |
2115 | if (op->contr->tmp_invis || op->hide) |
2116 | if (op->contr->tmp_invis || op->hide) |
2116 | make_visible (op); |
2117 | make_visible (op); |
2117 | |
2118 | |
2118 | return true; |
2119 | return true; |
… | |
… | |
2593 | * file. |
2594 | * file. |
2594 | */ |
2595 | */ |
2595 | void |
2596 | void |
2596 | kill_player (object *op) |
2597 | kill_player (object *op) |
2597 | { |
2598 | { |
|
|
2599 | int x, y; |
2598 | char buf[MAX_BUF]; |
2600 | char buf[MAX_BUF]; |
2599 | int x, y; |
|
|
2600 | |
|
|
2601 | //int i; |
|
|
2602 | maptile *map; /* this is for resurrection */ |
2601 | maptile *map; /* this is for resurrection */ |
2603 | |
|
|
2604 | /* int z; |
|
|
2605 | int num_stats_lose; |
|
|
2606 | int lost_a_stat; |
|
|
2607 | int lose_this_stat; |
|
|
2608 | int this_stat; */ |
|
|
2609 | int will_kill_again; |
2602 | int will_kill_again; |
2610 | archetype *at; |
2603 | archetype *at; |
2611 | object *tmp; |
2604 | object *tmp; |
2612 | |
2605 | |
2613 | if (save_life (op)) |
2606 | if (save_life (op)) |
… | |
… | |
2635 | { |
2628 | { |
2636 | tmp->destroy (); |
2629 | tmp->destroy (); |
2637 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2630 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2638 | } |
2631 | } |
2639 | |
2632 | |
2640 | cure_disease (op, 0); /* remove any disease */ |
2633 | cure_disease (op, 0, 0); /* remove any disease */ |
2641 | op->stats.hp = op->stats.maxhp; |
2634 | op->stats.hp = op->stats.maxhp; |
2642 | if (op->stats.food <= 0) |
2635 | if (op->stats.food <= 0) |
2643 | op->stats.food = 999; |
2636 | op->stats.food = 999; |
2644 | |
2637 | |
2645 | /* create a bodypart-trophy to make the winner happy */ |
2638 | /* create a bodypart-trophy to make the winner happy */ |
2646 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2639 | if (object *tmp = arch_to_object (archetype::find ("finger"))) |
2647 | { |
2640 | { |
2648 | sprintf (buf, "%s's finger", &op->name); |
2641 | tmp->name = format ("%s's finger" , &op->name); |
2649 | tmp->name = buf; |
2642 | tmp->name_pl = format ("%s's fingers", &op->name); |
2650 | sprintf (buf, " This finger has been cut off %s\n" |
2643 | tmp->msg = format ( |
2651 | " the %s, when he was defeated at\n level %d by %s.\n", |
2644 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2652 | &op->name, op->contr->title, (int) (op->level), op->contr->killer); |
2645 | &op->name, op->contr->title, (int) (op->level), op->contr->killer |
2653 | tmp->msg = buf; |
2646 | ); |
2654 | tmp->value = 0, tmp->type = 0; |
2647 | tmp->value = 0, tmp->type = 0; |
2655 | tmp->materialname = "organics"; |
2648 | tmp->materialname = "organics"; |
2656 | tmp->insert_at (op, tmp); |
2649 | tmp->insert_at (op, tmp); |
2657 | } |
2650 | } |
2658 | |
2651 | |
… | |
… | |
2665 | INVOKE_PLAYER (DEATH, op->contr); |
2658 | INVOKE_PLAYER (DEATH, op->contr); |
2666 | |
2659 | |
2667 | command_kill_pets (op, 0); |
2660 | command_kill_pets (op, 0); |
2668 | |
2661 | |
2669 | if (op->stats.food < 0) |
2662 | if (op->stats.food < 0) |
2670 | { |
|
|
2671 | sprintf (buf, "%s starved to death.", &op->name); |
|
|
2672 | strcpy (op->contr->killer, "starvation"); |
2663 | strcpy (op->contr->killer, "starvation"); |
2673 | } |
|
|
2674 | else |
|
|
2675 | sprintf (buf, "%s died.", &op->name); |
|
|
2676 | |
2664 | |
2677 | op->contr->play_sound (sound_find ("player_dies")); |
2665 | op->contr->play_sound (sound_find ("player_dies")); |
2678 | |
2666 | |
2679 | /* save the map location for corpse, gravestone */ |
2667 | /* save the map location for corpse, gravestone */ |
2680 | x = op->x; |
2668 | x = op->x; |
… | |
… | |
2845 | { |
2833 | { |
2846 | tmp->destroy (); |
2834 | tmp->destroy (); |
2847 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2835 | new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); |
2848 | } |
2836 | } |
2849 | |
2837 | |
2850 | cure_disease (op, 0); /* remove any disease */ |
2838 | cure_disease (op, 0, 0); /* remove any disease */ |
2851 | |
2839 | |
2852 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2840 | /*add_exp(op, (op->stats.exp * -0.20)); */ |
2853 | apply_death_exp_penalty (op); |
2841 | apply_death_exp_penalty (op); |
2854 | if (op->stats.food < 100) |
2842 | if (op->stats.food < 100) |
2855 | op->stats.food = 900; |
2843 | op->stats.food = 900; |
… | |
… | |
3495 | if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy)) |
3483 | if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy)) |
3496 | return 0; |
3484 | return 0; |
3497 | |
3485 | |
3498 | return 100 - blocked_los [x][y]; |
3486 | return 100 - blocked_los [x][y]; |
3499 | } |
3487 | } |
|
|
3488 | |
|
|
3489 | void |
|
|
3490 | player::infobox (const char *title, const char *msg, int color) |
|
|
3491 | { |
|
|
3492 | send_msg (color | NDI_DEF | NDI_REPLY | NDI_CLEAR, title, msg); |
|
|
3493 | } |
|
|
3494 | |
|
|
3495 | void |
|
|
3496 | player::statusmsg (const char *msg, int color) |
|
|
3497 | { |
|
|
3498 | send_msg (color | NDI_REPLY, INFO_CHANNEL, msg); |
|
|
3499 | } |
|
|
3500 | |
|
|
3501 | void |
|
|
3502 | player::failmsg (const char *msg, int color) |
|
|
3503 | { |
|
|
3504 | play_sound (sound_find ("generic_failure")); |
|
|
3505 | statusmsg (msg, color); |
|
|
3506 | } |
|
|
3507 | |