… | |
… | |
1571 | |
1571 | |
1572 | readable_message_type *msgType = get_readable_message_type (tmp); |
1572 | readable_message_type *msgType = get_readable_message_type (tmp); |
1573 | |
1573 | |
1574 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
1574 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
1575 | msgType->message_type, msgType->message_subtype, |
1575 | msgType->message_type, msgType->message_subtype, |
1576 | "You open the %s and start reading.\n%s", "%s\n%s", long_desc (tmp, op), &tmp->msg); |
1576 | "You open the %s and start reading.\n%s", (char *)"%s\n%s", |
|
|
1577 | long_desc (tmp, op), &tmp->msg); |
1577 | |
1578 | |
1578 | /* gain xp from reading */ |
1579 | /* gain xp from reading */ |
1579 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1580 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1580 | { /* only if not read before */ |
1581 | { /* only if not read before */ |
1581 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
1582 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
… | |
… | |
1737 | return; |
1738 | return; |
1738 | } |
1739 | } |
1739 | |
1740 | |
1740 | if (skop->level < int (sqrtf (spell->level) * 1.5f)) |
1741 | if (skop->level < int (sqrtf (spell->level) * 1.5f)) |
1741 | { |
1742 | { |
1742 | new_draw_info (NDI_UNIQUE, 0, op, "It is too hard to read at your level: You are unable to decipher the strange symbols."); |
1743 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to decipher the strange symbols. [Your literacy level is too low]"); |
1743 | return; |
1744 | return; |
1744 | } |
1745 | } |
1745 | |
1746 | |
1746 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); |
1747 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); |
1747 | |
1748 | |
… | |
… | |
1770 | { |
1771 | { |
1771 | spell_skill = find_skill_by_name (op, spell->skill); |
1772 | spell_skill = find_skill_by_name (op, spell->skill); |
1772 | |
1773 | |
1773 | if (!spell_skill) |
1774 | if (!spell_skill) |
1774 | { |
1775 | { |
1775 | new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use this spell", &spell->skill); |
1776 | new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use this spell.", &spell->skill); |
1776 | return; |
1777 | return; |
1777 | } |
1778 | } |
1778 | |
1779 | |
1779 | if (spell_skill->level < spell->level) |
1780 | if (spell_skill->level < spell->level) |
1780 | { |
1781 | { |
… | |
… | |
1814 | else |
1815 | else |
1815 | { |
1816 | { |
1816 | play_sound_player_only (op->contr, SOUND_FUMBLE_SPELL, 0, 0); |
1817 | play_sound_player_only (op->contr, SOUND_FUMBLE_SPELL, 0, 0); |
1817 | new_draw_info (NDI_UNIQUE, 0, op, "You fail to learn the spell.\n"); |
1818 | new_draw_info (NDI_UNIQUE, 0, op, "You fail to learn the spell.\n"); |
1818 | } |
1819 | } |
|
|
1820 | |
1819 | decrease_ob (tmp); |
1821 | decrease_ob (tmp); |
1820 | } |
1822 | } |
1821 | |
1823 | |
1822 | /** |
1824 | /** |
1823 | * Handles applying a spell scroll. |
1825 | * Handles applying a spell scroll. |
… | |
… | |
2078 | /* doubled chance for resistance of ability-focus */ |
2080 | /* doubled chance for resistance of ability-focus */ |
2079 | if (i == abil->stats.exp) |
2081 | if (i == abil->stats.exp) |
2080 | chance = MIN (100., chance * 2.); |
2082 | chance = MIN (100., chance * 2.); |
2081 | |
2083 | |
2082 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2084 | /* now make the throw and save all winners (Don't insert luck bonus here!) */ |
2083 | if (rndm (10000) < (int) (chance * 100)) |
2085 | if (rndm (10000) < (unsigned int) (chance * 100)) |
2084 | { |
2086 | { |
2085 | atnr_winner[winners] = i; |
2087 | atnr_winner[winners] = i; |
2086 | winners++; |
2088 | winners++; |
2087 | } |
2089 | } |
2088 | |
2090 | |
… | |
… | |
2498 | } |
2500 | } |
2499 | |
2501 | |
2500 | case MENU: |
2502 | case MENU: |
2501 | if (op->type == PLAYER) |
2503 | if (op->type == PLAYER) |
2502 | { |
2504 | { |
2503 | shop_listing (op); |
2505 | shop_listing (tmp, op); |
2504 | return 1; |
2506 | return 1; |
2505 | } |
2507 | } |
2506 | else |
2508 | else |
2507 | { |
2509 | { |
2508 | return 0; |
2510 | return 0; |
… | |
… | |
2635 | return RESULT_INT (0); |
2637 | return RESULT_INT (0); |
2636 | |
2638 | |
2637 | object *tmp2; |
2639 | object *tmp2; |
2638 | |
2640 | |
2639 | CLEAR_FLAG (op, FLAG_APPLIED); |
2641 | CLEAR_FLAG (op, FLAG_APPLIED); |
|
|
2642 | |
2640 | switch (op->type) |
2643 | switch (op->type) |
2641 | { |
2644 | { |
2642 | case WEAPON: |
2645 | case WEAPON: |
2643 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unwield %s.", query_name (op)); |
2646 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unwield %s.", query_name (op)); |
2644 | |
2647 | |
… | |
… | |
2649 | break; |
2652 | break; |
2650 | |
2653 | |
2651 | case SKILL: /* allows objects to impart skills */ |
2654 | case SKILL: /* allows objects to impart skills */ |
2652 | case SKILL_TOOL: |
2655 | case SKILL_TOOL: |
2653 | if (op != who->chosen_skill) |
2656 | if (op != who->chosen_skill) |
2654 | { |
|
|
2655 | LOG (llevError, "BUG: apply_special(): applied skill is not a chosen skill\n"); |
2657 | LOG (llevError, "BUG: apply_special(): applied skill is not a chosen skill\n"); |
2656 | } |
2658 | |
2657 | if (who->type == PLAYER) |
2659 | if (who->type == PLAYER) |
2658 | { |
2660 | { |
2659 | if (who->contr->shoottype == range_skill) |
2661 | if (who->contr->ranged_ob == op) |
2660 | who->contr->shoottype = range_none; |
2662 | { |
|
|
2663 | who->contr->ranged_skill = 0; |
|
|
2664 | who->contr->ranged_ob = 0; |
|
|
2665 | } |
|
|
2666 | |
2661 | if (!op->invisible) |
2667 | if (!op->invisible) |
2662 | { |
|
|
2663 | new_draw_info_format (NDI_UNIQUE, 0, who, "You stop using the %s.", query_name (op)); |
2668 | new_draw_info_format (NDI_UNIQUE, 0, who, "You stop using the %s.", query_name (op)); |
2664 | } |
|
|
2665 | else |
2669 | else |
2666 | { |
|
|
2667 | new_draw_info_format (NDI_UNIQUE, 0, who, "You can no longer use the skill: %s.", &op->skill); |
2670 | new_draw_info_format (NDI_UNIQUE, 0, who, "You can no longer use the skill: %s.", &op->skill); |
2668 | } |
2671 | } |
2669 | } |
2672 | |
2670 | (void) change_abil (who, op); |
2673 | change_abil (who, op); |
2671 | who->chosen_skill = NULL; |
2674 | who->chosen_skill = 0; |
2672 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
2675 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
2673 | break; |
2676 | break; |
2674 | |
2677 | |
2675 | case ARMOUR: |
2678 | case ARMOUR: |
2676 | case HELMET: |
2679 | case HELMET: |
… | |
… | |
2715 | } |
2718 | } |
2716 | if (who->type == PLAYER) |
2719 | if (who->type == PLAYER) |
2717 | esrv_send_item (who, tmp2); |
2720 | esrv_send_item (who, tmp2); |
2718 | return 1; /* otherwise, an attempt to drop causes problems */ |
2721 | return 1; /* otherwise, an attempt to drop causes problems */ |
2719 | break; |
2722 | break; |
|
|
2723 | |
2720 | case BOW: |
2724 | case BOW: |
2721 | case WAND: |
2725 | case WAND: |
2722 | case ROD: |
2726 | case ROD: |
2723 | case HORN: |
2727 | case HORN: |
2724 | clear_skill (who); |
2728 | clear_skill (who); |
2725 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
|
|
2726 | if (who->type == PLAYER) |
2729 | if (who->type == PLAYER) |
2727 | { |
2730 | { |
2728 | who->contr->shoottype = range_none; |
2731 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
|
|
2732 | |
|
|
2733 | who->contr->ranged_skill = 0; |
|
|
2734 | who->contr->ranged_ob = 0; |
2729 | } |
2735 | } |
2730 | else |
2736 | else |
2731 | { |
2737 | { |
2732 | if (op->type == BOW) |
2738 | if (op->type == BOW) |
2733 | CLEAR_FLAG (who, FLAG_READY_BOW); |
2739 | CLEAR_FLAG (who, FLAG_READY_BOW); |
2734 | else |
2740 | else |
2735 | CLEAR_FLAG (who, FLAG_READY_RANGE); |
2741 | CLEAR_FLAG (who, FLAG_READY_RANGE); |
2736 | } |
2742 | } |
|
|
2743 | |
2737 | break; |
2744 | break; |
2738 | |
2745 | |
2739 | case BUILDER: |
2746 | case BUILDER: |
|
|
2747 | if (who->type == PLAYER) |
|
|
2748 | { |
2740 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
2749 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
2741 | who->contr->shoottype = range_none; |
2750 | |
2742 | who->contr->ranges[range_builder] = NULL; |
2751 | who->contr->ranged_skill = 0; |
|
|
2752 | who->contr->ranged_ob = 0; |
|
|
2753 | } |
2743 | break; |
2754 | break; |
2744 | |
2755 | |
2745 | default: |
2756 | default: |
2746 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unapply %s.", query_name (op)); |
2757 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unapply %s.", query_name (op)); |
2747 | break; |
2758 | break; |
… | |
… | |
2931 | ws = tmp; |
2942 | ws = tmp; |
2932 | } |
2943 | } |
2933 | } |
2944 | } |
2934 | } |
2945 | } |
2935 | |
2946 | |
2936 | |
|
|
2937 | for (i = 0; i < NUM_BODY_LOCATIONS; i++) |
2947 | for (i = 0; i < NUM_BODY_LOCATIONS; i++) |
2938 | { |
2948 | { |
2939 | if (op->body_info[i]) |
2949 | if (op->body_info[i]) |
2940 | { |
2950 | { |
2941 | /* Item uses more slots than we have */ |
2951 | /* Item uses more slots than we have */ |
… | |
… | |
3020 | * and weapons all use the same slot. Similar for horn/rod/wand - they |
3030 | * and weapons all use the same slot. Similar for horn/rod/wand - they |
3021 | * all use the same location. |
3031 | * all use the same location. |
3022 | */ |
3032 | */ |
3023 | if (op->type == WEAPON && !QUERY_FLAG (who, FLAG_USE_WEAPON)) |
3033 | if (op->type == WEAPON && !QUERY_FLAG (who, FLAG_USE_WEAPON)) |
3024 | retval |= CAN_APPLY_RESTRICTION; |
3034 | retval |= CAN_APPLY_RESTRICTION; |
|
|
3035 | |
3025 | if (op->type == SHIELD && !QUERY_FLAG (who, FLAG_USE_SHIELD)) |
3036 | if (op->type == SHIELD && !QUERY_FLAG (who, FLAG_USE_SHIELD)) |
3026 | retval |= CAN_APPLY_RESTRICTION; |
3037 | retval |= CAN_APPLY_RESTRICTION; |
3027 | |
|
|
3028 | |
3038 | |
3029 | if (who->type != PLAYER) |
3039 | if (who->type != PLAYER) |
3030 | { |
3040 | { |
3031 | if ((op->type == WAND || op->type == HORN || op->type == ROD) && !QUERY_FLAG (who, FLAG_USE_RANGE)) |
3041 | if ((op->type == WAND || op->type == HORN || op->type == ROD) && !QUERY_FLAG (who, FLAG_USE_RANGE)) |
3032 | retval |= CAN_APPLY_RESTRICTION; |
3042 | retval |= CAN_APPLY_RESTRICTION; |
… | |
… | |
3035 | if (op->type == RING && !QUERY_FLAG (who, FLAG_USE_RING)) |
3045 | if (op->type == RING && !QUERY_FLAG (who, FLAG_USE_RING)) |
3036 | retval |= CAN_APPLY_RESTRICTION; |
3046 | retval |= CAN_APPLY_RESTRICTION; |
3037 | if (op->type == BOW && !QUERY_FLAG (who, FLAG_USE_BOW)) |
3047 | if (op->type == BOW && !QUERY_FLAG (who, FLAG_USE_BOW)) |
3038 | retval |= CAN_APPLY_RESTRICTION; |
3048 | retval |= CAN_APPLY_RESTRICTION; |
3039 | } |
3049 | } |
|
|
3050 | |
3040 | return retval; |
3051 | return retval; |
3041 | } |
3052 | } |
3042 | |
|
|
3043 | |
|
|
3044 | |
3053 | |
3045 | /** |
3054 | /** |
3046 | * who is the object using the object. It can be a monster. |
3055 | * who is the object using the object. It can be a monster. |
3047 | * op is the object they are using. op is an equipment type item, |
3056 | * op is the object they are using. op is an equipment type item, |
3048 | * eg, one which you put on and keep on for a while, and not something |
3057 | * eg, one which you put on and keep on for a while, and not something |
… | |
… | |
3143 | { |
3152 | { |
3144 | new_draw_info_format (NDI_UNIQUE, 0, who, "You need the %s skill to use this item!", &op->skill); |
3153 | new_draw_info_format (NDI_UNIQUE, 0, who, "You need the %s skill to use this item!", &op->skill); |
3145 | return 1; |
3154 | return 1; |
3146 | } |
3155 | } |
3147 | else |
3156 | else |
3148 | { |
|
|
3149 | /* While experience will be credited properly, we want to change the |
3157 | /* While experience will be credited properly, we want to change the |
3150 | * skill so that the dam and wc get updated |
3158 | * skill so that the dam and wc get updated |
3151 | */ |
3159 | */ |
3152 | change_skill (who, skop, 0); |
3160 | change_skill (who, skop, 0); |
3153 | } |
|
|
3154 | } |
3161 | } |
3155 | |
3162 | |
3156 | if (who->type == PLAYER && op->item_power && (op->item_power + who->contr->item_power) > (settings.item_power_factor * who->level)) |
3163 | if (who->type == PLAYER && op->item_power && (op->item_power + who->contr->item_power) > (settings.item_power_factor * who->level)) |
3157 | { |
3164 | { |
3158 | new_draw_info (NDI_UNIQUE, 0, who, "Equipping that combined with other items would consume your soul!"); |
3165 | new_draw_info (NDI_UNIQUE, 0, who, |
|
|
3166 | "Equipping that combined with other items would consume your soul! " |
|
|
3167 | "[use the skills command to check your available item power]"); |
3159 | return 1; |
3168 | return 1; |
3160 | } |
3169 | } |
3161 | |
3170 | |
3162 | |
3171 | |
3163 | /* Ok. We are now at the state where we can apply the new object. |
3172 | /* Ok. We are now at the state where we can apply the new object. |
3164 | * Note that we don't have the checks for can_use_... |
3173 | * Note that we don't have the checks for can_use_... |
3165 | * below - that is already taken care of by can_apply_object. |
3174 | * below - that is already taken care of by can_apply_object. |
3166 | */ |
3175 | */ |
3167 | |
|
|
3168 | |
3176 | |
3169 | if (op->nrof > 1) |
3177 | if (op->nrof > 1) |
3170 | tmp = get_split_ob (op, op->nrof - 1); |
3178 | tmp = get_split_ob (op, op->nrof - 1); |
3171 | else |
3179 | else |
3172 | tmp = NULL; |
3180 | tmp = NULL; |
… | |
… | |
3202 | |
3210 | |
3203 | SET_FLAG (op, FLAG_APPLIED); |
3211 | SET_FLAG (op, FLAG_APPLIED); |
3204 | |
3212 | |
3205 | if (skop) |
3213 | if (skop) |
3206 | change_skill (who, skop, 1); |
3214 | change_skill (who, skop, 1); |
|
|
3215 | |
3207 | if (!QUERY_FLAG (who, FLAG_READY_WEAPON)) |
3216 | if (!QUERY_FLAG (who, FLAG_READY_WEAPON)) |
3208 | SET_FLAG (who, FLAG_READY_WEAPON); |
3217 | SET_FLAG (who, FLAG_READY_WEAPON); |
3209 | |
3218 | |
3210 | new_draw_info_format (NDI_UNIQUE, 0, who, "You wield %s.", query_name (op)); |
3219 | new_draw_info_format (NDI_UNIQUE, 0, who, "You wield %s.", query_name (op)); |
3211 | |
3220 | |
3212 | (void) change_abil (who, op); |
3221 | change_abil (who, op); |
3213 | break; |
3222 | break; |
3214 | |
3223 | |
3215 | case ARMOUR: |
3224 | case ARMOUR: |
3216 | case HELMET: |
3225 | case HELMET: |
3217 | case SHIELD: |
3226 | case SHIELD: |
… | |
… | |
3222 | case CLOAK: |
3231 | case CLOAK: |
3223 | case RING: |
3232 | case RING: |
3224 | case AMULET: |
3233 | case AMULET: |
3225 | SET_FLAG (op, FLAG_APPLIED); |
3234 | SET_FLAG (op, FLAG_APPLIED); |
3226 | new_draw_info_format (NDI_UNIQUE, 0, who, "You wear %s.", query_name (op)); |
3235 | new_draw_info_format (NDI_UNIQUE, 0, who, "You wear %s.", query_name (op)); |
3227 | (void) change_abil (who, op); |
3236 | change_abil (who, op); |
3228 | break; |
3237 | break; |
|
|
3238 | |
3229 | case LAMP: |
3239 | case LAMP: |
3230 | if (op->stats.food < 1) |
3240 | if (op->stats.food < 1) |
3231 | { |
3241 | { |
3232 | new_draw_info_format (NDI_UNIQUE, 0, who, "Your %s is out of" " fuel!", &op->name); |
3242 | new_draw_info_format (NDI_UNIQUE, 0, who, "Your %s is out of" " fuel!", &op->name); |
3233 | return 1; |
3243 | return 1; |
3234 | } |
3244 | } |
|
|
3245 | |
3235 | new_draw_info_format (NDI_UNIQUE, 0, who, "You turn on your %s.", &op->name); |
3246 | new_draw_info_format (NDI_UNIQUE, 0, who, "You turn on your %s.", &op->name); |
3236 | tmp2 = arch_to_object (op->other_arch); |
3247 | tmp2 = arch_to_object (op->other_arch); |
3237 | tmp2->stats.food = op->stats.food; |
3248 | tmp2->stats.food = op->stats.food; |
3238 | SET_FLAG (tmp2, FLAG_APPLIED); |
3249 | SET_FLAG (tmp2, FLAG_APPLIED); |
|
|
3250 | |
3239 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
3251 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
3240 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
3252 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
|
|
3253 | |
3241 | insert_ob_in_ob (tmp2, who); |
3254 | insert_ob_in_ob (tmp2, who); |
3242 | |
3255 | |
3243 | /* Remove the old lantern */ |
3256 | /* Remove the old lantern */ |
3244 | if (who->type == PLAYER) |
3257 | if (who->type == PLAYER) |
3245 | esrv_del_item (who->contr, op->count); |
3258 | esrv_del_item (who->contr, op->count); |
3246 | |
3259 | |
3247 | op->destroy (); |
3260 | op->destroy (); |
3248 | |
3261 | |
3249 | /* insert the portion that was split off */ |
3262 | /* insert the portion that was split off */ |
3250 | if (tmp != NULL) |
3263 | if (tmp) |
3251 | { |
3264 | { |
3252 | (void) insert_ob_in_ob (tmp, who); |
3265 | insert_ob_in_ob (tmp, who); |
3253 | if (who->type == PLAYER) |
3266 | if (who->type == PLAYER) |
3254 | esrv_send_item (who, tmp); |
3267 | esrv_send_item (who, tmp); |
3255 | } |
3268 | } |
|
|
3269 | |
3256 | who->update_stats (); |
3270 | who->update_stats (); |
|
|
3271 | |
3257 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3272 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3258 | { |
3273 | { |
3259 | if (who->type == PLAYER) |
3274 | if (who->type == PLAYER) |
3260 | { |
3275 | { |
3261 | new_draw_info (NDI_UNIQUE, 0, who, "Oops, it feels deadly cold!"); |
3276 | new_draw_info (NDI_UNIQUE, 0, who, "Oops, it feels deadly cold!"); |
3262 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3277 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3263 | } |
3278 | } |
3264 | } |
3279 | } |
|
|
3280 | |
3265 | if (who->type == PLAYER) |
3281 | if (who->type == PLAYER) |
3266 | esrv_send_item (who, tmp2); |
3282 | esrv_send_item (who, tmp2); |
|
|
3283 | |
3267 | return 0; |
3284 | return 0; |
3268 | break; |
|
|
3269 | |
3285 | |
3270 | /* this part is needed for skill-tools */ |
3286 | /* this part is needed for skill-tools */ |
3271 | case SKILL: |
3287 | case SKILL: |
3272 | case SKILL_TOOL: |
3288 | case SKILL_TOOL: |
3273 | if (who->chosen_skill) |
3289 | if (who->chosen_skill) |
3274 | { |
3290 | { |
3275 | LOG (llevError, "BUG: apply_special(): can't apply two skills\n"); |
3291 | LOG (llevError, "BUG: apply_special(): can't apply two skills\n"); |
3276 | return 1; |
3292 | return 1; |
3277 | } |
3293 | } |
|
|
3294 | |
3278 | if (who->type == PLAYER) |
3295 | if (who->type == PLAYER) |
3279 | { |
3296 | { |
3280 | who->contr->shoottype = range_skill; |
|
|
3281 | who->contr->ranges[range_skill] = op; |
3297 | who->contr->ranged_skill = who; |
|
|
3298 | who->contr->ranged_ob = op; |
|
|
3299 | |
3282 | if (!op->invisible) |
3300 | if (!op->invisible) |
3283 | { |
3301 | { |
3284 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); |
3302 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); |
3285 | new_draw_info_format (NDI_UNIQUE, 0, who, "You can now use the skill: %s.", &op->skill); |
3303 | new_draw_info_format (NDI_UNIQUE, 0, who, "You can now use the skill: %s.", &op->skill); |
3286 | } |
3304 | } |
3287 | else |
3305 | else |
3288 | { |
|
|
3289 | new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", op->skill ? &op->skill : &op->name); |
3306 | new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", op->skill ? &op->skill : &op->name); |
3290 | } |
3307 | } |
3291 | } |
3308 | |
3292 | SET_FLAG (op, FLAG_APPLIED); |
3309 | SET_FLAG (op, FLAG_APPLIED); |
3293 | (void) change_abil (who, op); |
3310 | change_abil (who, op); |
3294 | who->chosen_skill = op; |
3311 | who->chosen_skill = op; |
3295 | SET_FLAG (who, FLAG_READY_SKILL); |
3312 | SET_FLAG (who, FLAG_READY_SKILL); |
3296 | break; |
3313 | break; |
3297 | |
3314 | |
3298 | case BOW: |
3315 | case BOW: |
3299 | if (!check_weapon_power (who, op->last_eat)) |
3316 | if (!check_weapon_power (who, op->last_eat)) |
3300 | { |
3317 | { |
3301 | new_draw_info (NDI_UNIQUE, 0, who, "That item is too powerful for you to use."); |
3318 | new_draw_info (NDI_UNIQUE, 0, who, "That item is too powerful for you to use."); |
3302 | new_draw_info (NDI_UNIQUE, 0, who, "It would consume your soul!."); |
3319 | new_draw_info (NDI_UNIQUE, 0, who, "It would consume your soul!."); |
|
|
3320 | |
3303 | if (tmp != NULL) |
3321 | if (tmp) |
3304 | (void) insert_ob_in_ob (tmp, who); |
3322 | insert_ob_in_ob (tmp, who); |
|
|
3323 | |
3305 | return 1; |
3324 | return 1; |
3306 | } |
3325 | } |
|
|
3326 | |
3307 | if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) |
3327 | if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) |
3308 | { |
3328 | { |
3309 | new_draw_info (NDI_UNIQUE, 0, who, "The weapon does not recognize you as its owner."); |
3329 | new_draw_info (NDI_UNIQUE, 0, who, "The weapon does not recognize you as its owner."); |
3310 | if (tmp != NULL) |
3330 | if (tmp != NULL) |
3311 | (void) insert_ob_in_ob (tmp, who); |
3331 | insert_ob_in_ob (tmp, who); |
|
|
3332 | |
3312 | return 1; |
3333 | return 1; |
3313 | } |
3334 | } |
|
|
3335 | |
3314 | /*FALLTHROUGH*/ case WAND: |
3336 | /*FALLTHROUGH*/ |
|
|
3337 | case WAND: |
3315 | case ROD: |
3338 | case ROD: |
3316 | case HORN: |
3339 | case HORN: |
3317 | /* check for skill, alter player status */ |
3340 | /* check for skill, alter player status */ |
3318 | SET_FLAG (op, FLAG_APPLIED); |
3341 | SET_FLAG (op, FLAG_APPLIED); |
3319 | if (skop) |
3342 | if (skop) |
3320 | change_skill (who, skop, 0); |
3343 | change_skill (who, skop, 0); |
3321 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); |
|
|
3322 | |
3344 | |
3323 | if (who->type == PLAYER) |
3345 | if (who->type == PLAYER) |
3324 | { |
3346 | { |
|
|
3347 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); |
|
|
3348 | |
3325 | if (op->type == BOW) |
3349 | if (op->type == BOW) |
3326 | { |
3350 | { |
3327 | (void) change_abil (who, op); |
3351 | change_abil (who, op); |
3328 | new_draw_info_format (NDI_UNIQUE, 0, who, |
3352 | new_draw_info_format (NDI_UNIQUE, 0, who, |
3329 | "You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op)); |
3353 | "You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op)); |
3330 | who->contr->shoottype = range_bow; |
|
|
3331 | } |
3354 | } |
3332 | else |
3355 | |
3333 | { |
3356 | who->contr->ranged_skill = find_skill_by_name (who, op->skill);//TODO |
3334 | who->contr->shoottype = range_misc; |
3357 | who->contr->ranged_ob = op; |
3335 | } |
|
|
3336 | } |
3358 | } |
3337 | else |
3359 | else |
3338 | { |
3360 | { |
3339 | if (op->type == BOW) |
3361 | if (op->type == BOW) |
3340 | SET_FLAG (who, FLAG_READY_BOW); |
3362 | SET_FLAG (who, FLAG_READY_BOW); |
3341 | else |
3363 | else |
3342 | SET_FLAG (who, FLAG_READY_RANGE); |
3364 | SET_FLAG (who, FLAG_READY_RANGE); |
3343 | } |
3365 | } |
|
|
3366 | |
3344 | break; |
3367 | break; |
3345 | |
3368 | |
3346 | case BUILDER: |
3369 | case BUILDER: |
3347 | if (who->contr->ranges[range_builder]) |
3370 | if (who->type == PLAYER) |
|
|
3371 | { |
|
|
3372 | if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER) |
3348 | unapply_special (who, who->contr->ranges[range_builder], 0); |
3373 | unapply_special (who, who->contr->ranged_ob, 0); |
3349 | who->contr->shoottype = range_builder; |
3374 | |
3350 | who->contr->ranges[range_builder] = op; |
|
|
3351 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready your %s.", query_name (op)); |
3375 | new_draw_info_format (NDI_UNIQUE, 0, who, "You ready your %s.", query_name (op)); |
|
|
3376 | |
|
|
3377 | who->contr->ranged_skill = who; |
|
|
3378 | who->contr->ranged_ob = op; |
|
|
3379 | } |
3352 | break; |
3380 | break; |
3353 | |
3381 | |
3354 | default: |
3382 | default: |
3355 | new_draw_info_format (NDI_UNIQUE, 0, who, "You apply %s.", query_name (op)); |
3383 | new_draw_info_format (NDI_UNIQUE, 0, who, "You apply %s.", query_name (op)); |
3356 | } /* end of switch op->type */ |
3384 | } /* end of switch op->type */ |
… | |
… | |
3375 | { |
3403 | { |
3376 | new_draw_info (NDI_UNIQUE, 0, who, "Oops, it feels deadly cold!"); |
3404 | new_draw_info (NDI_UNIQUE, 0, who, "Oops, it feels deadly cold!"); |
3377 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3405 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3378 | } |
3406 | } |
3379 | } |
3407 | } |
|
|
3408 | |
3380 | if (who->type == PLAYER) |
3409 | if (who->type == PLAYER) |
3381 | { |
3410 | { |
3382 | /* if multiple objects were applied, update both slots */ |
3411 | /* if multiple objects were applied, update both slots */ |
3383 | if (tmp) |
3412 | if (tmp) |
3384 | esrv_send_item (who, tmp); |
3413 | esrv_send_item (who, tmp); |
|
|
3414 | |
3385 | esrv_send_item (who, op); |
3415 | esrv_send_item (who, op); |
3386 | } |
3416 | } |
|
|
3417 | |
3387 | return 0; |
3418 | return 0; |
3388 | } |
3419 | } |
3389 | |
|
|
3390 | |
3420 | |
3391 | int |
3421 | int |
3392 | monster_apply_special (object *who, object *op, int aflags) |
3422 | monster_apply_special (object *who, object *op, int aflags) |
3393 | { |
3423 | { |
3394 | if (QUERY_FLAG (op, FLAG_UNPAID) && !QUERY_FLAG (op, FLAG_APPLIED)) |
3424 | if (QUERY_FLAG (op, FLAG_UNPAID) && !QUERY_FLAG (op, FLAG_APPLIED)) |