… | |
… | |
219 | /* make sure he's a player -- needed because of class change. */ |
219 | /* make sure he's a player -- needed because of class change. */ |
220 | ob->type = PLAYER; // we are paranoid |
220 | ob->type = PLAYER; // we are paranoid |
221 | ob->race = ob->arch->race; |
221 | ob->race = ob->arch->race; |
222 | |
222 | |
223 | ob->update_weight (); |
223 | ob->update_weight (); |
224 | link_player_skills (ob); |
224 | link_skills (); |
225 | |
225 | |
226 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
226 | CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); |
227 | |
227 | |
228 | assign (title, ob->arch->object::name); |
228 | assign (title, ob->arch->object::name); |
229 | |
229 | |
… | |
… | |
728 | else /* lock all 'normal items by default */ |
728 | else /* lock all 'normal items by default */ |
729 | SET_FLAG (op, FLAG_INV_LOCKED); |
729 | SET_FLAG (op, FLAG_INV_LOCKED); |
730 | } /* for loop of objects in player inv */ |
730 | } /* for loop of objects in player inv */ |
731 | |
731 | |
732 | /* Need to set up the skill pointers */ |
732 | /* Need to set up the skill pointers */ |
733 | link_player_skills (pl); |
733 | pl->contr->link_skills (); |
734 | } |
734 | } |
735 | |
735 | |
736 | void |
736 | void |
737 | get_party_password (object *op, partylist *party) |
737 | get_party_password (object *op, partylist *party) |
738 | { |
738 | { |
… | |
… | |
870 | ob->msg = 0; |
870 | ob->msg = 0; |
871 | |
871 | |
872 | start_info (ob); |
872 | start_info (ob); |
873 | CLEAR_FLAG (ob, FLAG_WIZ); |
873 | CLEAR_FLAG (ob, FLAG_WIZ); |
874 | give_initial_items (ob, ob->randomitems); |
874 | give_initial_items (ob, ob->randomitems); |
875 | link_player_skills (ob); |
|
|
876 | esrv_send_inventory (ob, ob); |
875 | esrv_send_inventory (ob, ob); |
877 | ob->update_stats (); |
876 | ob->update_stats (); |
878 | |
877 | |
879 | /* This moves the player to a different start map, if there |
878 | /* This moves the player to a different start map, if there |
880 | * is one for this race |
879 | * is one for this race |
… | |
… | |
1579 | } |
1578 | } |
1580 | |
1579 | |
1581 | /* this should not happen, but sometimes does */ |
1580 | /* this should not happen, but sometimes does */ |
1582 | if (arrow->nrof == 0) |
1581 | if (arrow->nrof == 0) |
1583 | { |
1582 | { |
|
|
1583 | LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ()); |
1584 | arrow->destroy (); |
1584 | arrow->destroy (); |
1585 | return 0; |
1585 | return 0; |
1586 | } |
1586 | } |
1587 | |
1587 | |
1588 | left = arrow; /* these are arrows left to the player */ |
1588 | left = arrow; /* these are arrows left to the player */ |
… | |
… | |
1793 | bool |
1793 | bool |
1794 | fire (object *op, int dir) |
1794 | fire (object *op, int dir) |
1795 | { |
1795 | { |
1796 | int spellcost = 0; |
1796 | int spellcost = 0; |
1797 | |
1797 | |
1798 | /* check for loss of invisiblity/hide */ |
|
|
1799 | if (action_makes_visible (op)) |
|
|
1800 | make_visible (op); |
|
|
1801 | |
|
|
1802 | player *pl = op->contr; |
1798 | player *pl = op->contr; |
1803 | |
1799 | |
1804 | if (pl->golem) |
1800 | if (pl->golem) |
1805 | { |
1801 | { |
1806 | control_golem (op->contr->golem, dir); |
1802 | control_golem (op->contr->golem, dir); |
… | |
… | |
1808 | } |
1804 | } |
1809 | |
1805 | |
1810 | object *ob = pl->ranged_ob; |
1806 | object *ob = pl->ranged_ob; |
1811 | |
1807 | |
1812 | if (!ob) |
1808 | if (!ob) |
1813 | return false; |
|
|
1814 | |
|
|
1815 | if (!op->change_weapon (ob)) |
|
|
1816 | return false; |
1809 | return false; |
1817 | |
1810 | |
1818 | if (op->speed_left > 0.f) |
1811 | if (op->speed_left > 0.f) |
1819 | --op->speed_left; |
1812 | --op->speed_left; |
1820 | else |
1813 | else |
1821 | return false; |
1814 | return false; |
|
|
1815 | |
|
|
1816 | if (!op->change_weapon (ob)) |
|
|
1817 | return false; |
|
|
1818 | |
|
|
1819 | /* check for loss of invisiblity/hide */ |
|
|
1820 | if (action_makes_visible (op)) |
|
|
1821 | make_visible (op); |
1822 | |
1822 | |
1823 | switch (ob->type) |
1823 | switch (ob->type) |
1824 | { |
1824 | { |
1825 | case BOW: |
1825 | case BOW: |
1826 | player_fire_bow (op, dir); |
1826 | player_fire_bow (op, dir); |
… | |
… | |
2071 | --op->speed_left; |
2071 | --op->speed_left; |
2072 | |
2072 | |
2073 | op->play_sound (sound_find ("push_player")); |
2073 | op->play_sound (sound_find ("push_player")); |
2074 | push_ob (mon, dir, op); |
2074 | push_ob (mon, dir, op); |
2075 | |
2075 | |
2076 | if (op->contr->tmp_invis || op->hide) |
2076 | if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN]) |
2077 | make_visible (op); |
2077 | make_visible (op); |
2078 | |
2078 | |
2079 | return true; |
2079 | return true; |
2080 | } |
2080 | } |
2081 | else |
2081 | else |
… | |
… | |
2103 | push_ob (mon, dir, op); |
2103 | push_ob (mon, dir, op); |
2104 | } |
2104 | } |
2105 | else |
2105 | else |
2106 | op->statusmsg ("You withhold your attack"); |
2106 | op->statusmsg ("You withhold your attack"); |
2107 | |
2107 | |
2108 | if (op->contr->tmp_invis || op->hide) |
2108 | if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN]) |
2109 | make_visible (op); |
2109 | make_visible (op); |
2110 | |
2110 | |
2111 | return true; |
2111 | return true; |
2112 | } |
2112 | } |
2113 | } |
2113 | } |
… | |
… | |
2171 | if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) |
2171 | if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) |
2172 | dir = absdir (dir + rndm (3) + rndm (3) - 2); |
2172 | dir = absdir (dir + rndm (3) + rndm (3) - 2); |
2173 | |
2173 | |
2174 | op->facing = dir; |
2174 | op->facing = dir; |
2175 | |
2175 | |
2176 | if (op->hide) |
2176 | if (op->flag [FLAG_HIDDEN]) |
2177 | do_hidden_move (op); |
2177 | do_hidden_move (op); |
2178 | |
2178 | |
2179 | bool retval; |
2179 | bool retval; |
2180 | |
2180 | |
2181 | if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir))) |
2181 | if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir))) |
… | |
… | |
2792 | * exp loss on the stone. |
2792 | * exp loss on the stone. |
2793 | */ |
2793 | */ |
2794 | tmp = arch_to_object (archetype::find ("gravestone")); |
2794 | tmp = arch_to_object (archetype::find ("gravestone")); |
2795 | tmp->name = format ("%s's gravestone", &op->name); |
2795 | tmp->name = format ("%s's gravestone", &op->name); |
2796 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2796 | tmp->name_pl = format ("%s's gravestones", &op->name); |
2797 | tmp->msg = format ("RIP\nHere rests the hero %s the %s,\nwho was killed\nby %s.\n", &op->name, op->contr->title, op->contr->killer_name ()); |
2797 | tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n", |
|
|
2798 | &op->name, op->contr->title, op->contr->killer_name ()); |
2798 | tmp->x = op->x, tmp->y = op->y; |
2799 | tmp->x = op->x, tmp->y = op->y; |
2799 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2800 | insert_ob_in_map (tmp, op->map, NULL, 0); |
2800 | |
2801 | |
2801 | /**************************************/ |
2802 | /**************************************/ |
2802 | /* */ |
2803 | /* */ |
… | |
… | |
2890 | if (will_kill_again & (1 << at)) |
2891 | if (will_kill_again & (1 << at)) |
2891 | force->resist[at] = 100; |
2892 | force->resist[at] = 100; |
2892 | |
2893 | |
2893 | insert_ob_in_ob (force, op); |
2894 | insert_ob_in_ob (force, op); |
2894 | op->update_stats (); |
2895 | op->update_stats (); |
2895 | |
|
|
2896 | } |
2896 | } |
2897 | |
2897 | |
2898 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2898 | new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); |
2899 | } |
2899 | } |
2900 | |
2900 | |
… | |
… | |
3001 | } |
3001 | } |
3002 | |
3002 | |
3003 | void |
3003 | void |
3004 | make_visible (object *op) |
3004 | make_visible (object *op) |
3005 | { |
3005 | { |
3006 | op->hide = 0; |
3006 | op->flag [FLAG_HIDDEN] = 0; |
3007 | op->invisible = 0; |
3007 | op->invisible = 0; |
3008 | |
3008 | |
3009 | if (op->type == PLAYER) |
3009 | if (op->type == PLAYER) |
3010 | { |
3010 | { |
3011 | op->contr->tmp_invis = 0; |
3011 | op->contr->tmp_invis = 0; |
… | |
… | |
3232 | |
3232 | |
3233 | if (op->contr && op->contr->tmp_invis == 0) |
3233 | if (op->contr && op->contr->tmp_invis == 0) |
3234 | return 0; |
3234 | return 0; |
3235 | |
3235 | |
3236 | /* If monsters, they should become visible */ |
3236 | /* If monsters, they should become visible */ |
3237 | if (op->hide || !op->contr || (op->contr && op->contr->tmp_invis)) |
3237 | if (op->flag [FLAG_HIDDEN] || !op->contr || (op->contr && op->contr->tmp_invis)) |
3238 | { |
3238 | { |
3239 | new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); |
3239 | new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->flag [FLAG_HIDDEN] ? "unhidden" : "visible"); |
3240 | return 1; |
3240 | return 1; |
3241 | } |
3241 | } |
3242 | } |
3242 | } |
3243 | |
3243 | |
3244 | return 0; |
3244 | return 0; |