… | |
… | |
107 | ob->race = ob->arch->race; |
107 | ob->race = ob->arch->race; |
108 | |
108 | |
109 | ob->update_weight (); |
109 | ob->update_weight (); |
110 | link_skills (); |
110 | link_skills (); |
111 | |
111 | |
112 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
|
|
113 | |
|
|
114 | assign (title, ob->arch->object::name); |
112 | assign (title, ob->arch->object::name); |
115 | |
113 | |
116 | /* if it's a dragon player, set the correct title here */ |
114 | /* if it's a dragon player, set the correct title here */ |
117 | if (is_dragon_pl (ob)) |
115 | if (is_dragon_pl (ob)) |
118 | { |
116 | { |
… | |
… | |
310 | player * |
308 | player * |
311 | player::create () |
309 | player::create () |
312 | { |
310 | { |
313 | player *pl = new player; |
311 | player *pl = new player; |
314 | |
312 | |
315 | pl->set_object (arch_to_object (get_player_archetype (0))); |
313 | pl->set_object (get_player_archetype (0)->instance ()); |
316 | |
314 | |
317 | pl->ob->roll_stats (); |
315 | pl->ob->roll_stats (); |
318 | pl->ob->stats.wc = 2; |
316 | pl->ob->stats.wc = 2; |
319 | pl->ob->run_away = 25; /* Then we panick... */ |
317 | pl->ob->run_away = 25; /* Then we panick... */ |
320 | |
318 | |
… | |
… | |
637 | send_query (op->contr->ns, CS_QUERY_HIDEINPUT, "What is the password?\n:"); |
635 | send_query (op->contr->ns, CS_QUERY_HIDEINPUT, "What is the password?\n:"); |
638 | } |
636 | } |
639 | |
637 | |
640 | /* This rolls four 1-6 rolls and sums the best 3 of the 4. */ |
638 | /* This rolls four 1-6 rolls and sums the best 3 of the 4. */ |
641 | static int |
639 | static int |
642 | roll_stat (void) |
640 | roll_stat () |
643 | { |
641 | { |
644 | int a[4], i, j, k; |
642 | int a[4], i, j, k; |
645 | |
643 | |
646 | for (i = 0; i < 4; i++) |
644 | for (i = 0; i < 4; i++) |
647 | a[i] = (int) rndm (6) + 1; |
645 | a[i] = (int) rndm (6) + 1; |
… | |
… | |
867 | if (op->move_type & MOVE_FLYING) |
865 | if (op->move_type & MOVE_FLYING) |
868 | return 1; |
866 | return 1; |
869 | |
867 | |
870 | next = op->below; |
868 | next = op->below; |
871 | |
869 | |
872 | int cnt = MAX_ITEM_PER_DROP; |
870 | int cnt = MAX_ITEM_PER_ACTION; |
873 | #define CHK_PICK_PICKUP do { pick_up (op, tmp); cnt--; } while (0) |
871 | #define CHK_PICK_PICKUP do { pick_up (op, tmp); cnt--; } while (0) |
874 | |
872 | |
875 | /* loop while there are items on the floor that are not marked as |
873 | /* loop while there are items on the floor that are not marked as |
876 | * destroyed */ |
874 | * destroyed */ |
877 | while (next && !next->destroyed ()) |
875 | while (next && !next->destroyed ()) |
… | |
… | |
1002 | continue; |
1000 | continue; |
1003 | } |
1001 | } |
1004 | |
1002 | |
1005 | /* wands/staves/rods/horns */ |
1003 | /* wands/staves/rods/horns */ |
1006 | if (op->contr->mode & PU_MAGIC_DEVICE) |
1004 | if (op->contr->mode & PU_MAGIC_DEVICE) |
1007 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) |
1005 | if (tmp->type == WAND |
|
|
1006 | || tmp->type == ROD |
|
|
1007 | || tmp->type == HORN |
|
|
1008 | || tmp->type == POWER_CRYSTAL) |
1008 | { |
1009 | { |
1009 | CHK_PICK_PICKUP; |
1010 | CHK_PICK_PICKUP; |
1010 | continue; |
1011 | continue; |
1011 | } |
1012 | } |
1012 | |
1013 | |
1013 | /* pick up all magical items */ |
1014 | /* pick up all magical items */ |
1014 | if (op->contr->mode & PU_MAGICAL) |
1015 | if (op->contr->mode & PU_MAGICAL) |
1015 | if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) |
1016 | if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) |
|
|
1017 | && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) |
1016 | { |
1018 | { |
1017 | CHK_PICK_PICKUP; |
1019 | CHK_PICK_PICKUP; |
1018 | continue; |
1020 | continue; |
1019 | } |
1021 | } |
1020 | |
1022 | |
… | |
… | |
1027 | } |
1029 | } |
1028 | } |
1030 | } |
1029 | |
1031 | |
1030 | /* rings & amulets - talismans seems to be typed AMULET */ |
1032 | /* rings & amulets - talismans seems to be typed AMULET */ |
1031 | if (op->contr->mode & PU_JEWELS) |
1033 | if (op->contr->mode & PU_JEWELS) |
1032 | if (tmp->type == RING || tmp->type == AMULET) |
1034 | if (tmp->type == RING |
|
|
1035 | || tmp->type == AMULET |
|
|
1036 | || tmp->type == GIRDLE |
|
|
1037 | || tmp->type == SKILL_TOOL) |
1033 | { |
1038 | { |
1034 | CHK_PICK_PICKUP; |
1039 | CHK_PICK_PICKUP; |
1035 | continue; |
1040 | continue; |
1036 | } |
1041 | } |
1037 | |
1042 | |
… | |
… | |
1086 | CHK_PICK_PICKUP; |
1091 | CHK_PICK_PICKUP; |
1087 | continue; |
1092 | continue; |
1088 | } |
1093 | } |
1089 | |
1094 | |
1090 | if (op->contr->mode & PU_GLOVES) |
1095 | if (op->contr->mode & PU_GLOVES) |
1091 | if (tmp->type == GLOVES) |
1096 | if (tmp->type == GLOVES || tmp->type == BRACERS) |
1092 | { |
1097 | { |
1093 | CHK_PICK_PICKUP; |
1098 | CHK_PICK_PICKUP; |
1094 | continue; |
1099 | continue; |
1095 | } |
1100 | } |
1096 | |
1101 | |
… | |
… | |
2470 | if (op_on_battleground (op, &x, &y)) |
2475 | if (op_on_battleground (op, &x, &y)) |
2471 | { |
2476 | { |
2472 | deathtab << "You almost died in combat, but local medics have saved your life...\r"; |
2477 | deathtab << "You almost died in combat, but local medics have saved your life...\r"; |
2473 | |
2478 | |
2474 | /* create a bodypart-trophy to make the winner happy */ |
2479 | /* create a bodypart-trophy to make the winner happy */ |
2475 | if (object *tmp = arch_to_object (archetype::find (shstr_finger))) |
2480 | object *tmp = archetype::find (shstr_finger)->instance (); |
2476 | { |
2481 | |
2477 | tmp->name = format ("%s's finger" , &op->name); |
2482 | tmp->name = format ("%s's finger" , &op->name); |
2478 | tmp->name_pl = format ("%s's fingers", &op->name); |
2483 | tmp->name_pl = format ("%s's fingers", &op->name); |
2479 | tmp->msg = format ( |
2484 | tmp->msg = format ( |
2480 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2485 | "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", |
2481 | &op->name, op->contr->title, |
2486 | &op->name, op->contr->title, |
2482 | (int)op->level, |
2487 | (int)op->level, |
2483 | op->contr->killer_name () |
2488 | op->contr->killer_name () |
2484 | ); |
2489 | ); |
2485 | tmp->value = 0, tmp->type = 0; |
2490 | tmp->value = 0, tmp->type = 0; |
2486 | tmp->materialname = "organics"; |
2491 | tmp->material = name_to_material (shstr_organic); |
2487 | tmp->insert_at (op, tmp); |
2492 | tmp->insert_at (op, tmp); |
2488 | } |
|
|
2489 | |
2493 | |
2490 | /* teleport defeated player to new destination */ |
2494 | /* teleport defeated player to new destination */ |
2491 | transfer_ob (op, x, y, 0, NULL); |
2495 | transfer_ob (op, x, y, 0, NULL); |
2492 | op->contr->braced = 0; |
2496 | op->contr->braced = 0; |
2493 | |
2497 | |
… | |
… | |
2561 | object *dep; |
2565 | object *dep; |
2562 | |
2566 | |
2563 | dep = present_arch_in_ob (deparch, op); |
2567 | dep = present_arch_in_ob (deparch, op); |
2564 | if (!dep) |
2568 | if (!dep) |
2565 | { |
2569 | { |
2566 | dep = arch_to_object (deparch); |
2570 | dep = deparch->instance (); |
2567 | insert_ob_in_ob (dep, op); |
2571 | insert_ob_in_ob (dep, op); |
2568 | } |
2572 | } |
2569 | lose_this_stat = 1; |
2573 | lose_this_stat = 1; |
2570 | if (settings.balanced_stat_loss) |
2574 | if (settings.balanced_stat_loss) |
2571 | { |
2575 | { |
… | |
… | |
2637 | #endif |
2641 | #endif |
2638 | |
2642 | |
2639 | /* Put a gravestone up where the character 'almost' died. List the |
2643 | /* Put a gravestone up where the character 'almost' died. List the |
2640 | * exp loss on the stone. |
2644 | * exp loss on the stone. |
2641 | */ |
2645 | */ |
2642 | tmp = arch_to_object (archetype::find (shstr_gravestone)); |
2646 | tmp = archetype::find (shstr_gravestone)->instance (); |
2643 | tmp->name = format ("%s's gravestone", &op->name); |
2647 | tmp->name = format ("%s's gravestone", &op->name); |
2644 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2648 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2645 | tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n", |
2649 | tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n", |
2646 | &op->name, op->contr->title, op->contr->killer_name ()); |
2650 | &op->name, op->contr->title, op->contr->killer_name ()); |
2647 | tmp->x = op->x, tmp->y = op->y; |
2651 | tmp->x = op->x, tmp->y = op->y; |
… | |
… | |
2743 | * fix_weight(): Check recursively the weight of all players, and fix |
2747 | * fix_weight(): Check recursively the weight of all players, and fix |
2744 | * what needs to be fixed. Refresh windows and fix speed if anything |
2748 | * what needs to be fixed. Refresh windows and fix speed if anything |
2745 | * was changed. |
2749 | * was changed. |
2746 | */ |
2750 | */ |
2747 | void |
2751 | void |
2748 | fix_weight (void) |
2752 | fix_weight () |
2749 | { |
2753 | { |
2750 | for_all_players (pl) |
2754 | for_all_players (pl) |
2751 | { |
2755 | { |
2752 | sint32 old = pl->ob->carrying; |
2756 | sint32 old = pl->ob->carrying; |
2753 | |
2757 | |
… | |
… | |
2760 | } |
2764 | } |
2761 | } |
2765 | } |
2762 | } |
2766 | } |
2763 | |
2767 | |
2764 | void |
2768 | void |
2765 | fix_luck (void) |
2769 | fix_luck () |
2766 | { |
2770 | { |
2767 | for_all_players (pl) |
2771 | for_all_players (pl) |
2768 | if (!pl->ob->contr->ns->state) |
2772 | if (!pl->ob->contr->ns->state) |
2769 | pl->ob->change_luck (0); |
2773 | pl->ob->change_luck (0); |
2770 | } |
2774 | } |
… | |
… | |
3220 | new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, item->msg); |
3224 | new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, item->msg); |
3221 | } |
3225 | } |
3222 | else |
3226 | else |
3223 | { |
3227 | { |
3224 | /* generate misc. treasure */ |
3228 | /* generate misc. treasure */ |
3225 | tmp = arch_to_object (tr->item); |
3229 | tmp = tr->item->instance (); |
3226 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3230 | new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); |
3227 | who->insert (tmp); |
3231 | who->insert (tmp); |
3228 | } |
3232 | } |
3229 | } |
3233 | } |
3230 | |
3234 | |