… | |
… | |
217 | { |
217 | { |
218 | for (i = 0; i < NUM_STATS; i++) |
218 | for (i = 0; i < NUM_STATS; i++) |
219 | if (depl->stats.stat (i)) |
219 | if (depl->stats.stat (i)) |
220 | op->statusmsg (restore_msg[i]); |
220 | op->statusmsg (restore_msg[i]); |
221 | |
221 | |
222 | depl->destroy (); |
222 | depl->destroy (true); |
223 | op->update_stats (); |
223 | op->update_stats (); |
224 | } |
224 | } |
225 | else |
225 | else |
226 | op->statusmsg ("Your potion had no effect."); |
226 | op->statusmsg ("Your potion had no effect."); |
227 | |
227 | |
… | |
… | |
956 | price_in = nr * need * item->value; |
956 | price_in = nr * need * item->value; |
957 | } |
957 | } |
958 | else |
958 | else |
959 | { |
959 | { |
960 | price_in = item->value; |
960 | price_in = item->value; |
961 | item->destroy (); |
961 | item->destroy (true); |
962 | } |
962 | } |
963 | } |
963 | } |
964 | |
964 | |
965 | if (converter->inv) |
965 | if (converter->inv) |
966 | { |
966 | { |
… | |
… | |
1306 | ns->play_sound (sign->sound); |
1306 | ns->play_sound (sign->sound); |
1307 | else if (autoapply) |
1307 | else if (autoapply) |
1308 | ns->play_sound (sound_find ("msg_voice")); |
1308 | ns->play_sound (sound_find ("msg_voice")); |
1309 | |
1309 | |
1310 | if (ns->can_msg) |
1310 | if (ns->can_msg) |
1311 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n\n\n%s", &sign->name, &sign->msg)); |
1311 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg)); |
1312 | else |
1312 | else |
1313 | { |
1313 | { |
1314 | readable_message_type *msgType = get_readable_message_type (sign); |
1314 | readable_message_type *msgType = get_readable_message_type (sign); |
1315 | const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); |
1315 | const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); |
1316 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
1316 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
… | |
… | |
1627 | readable_message_type *msgType = get_readable_message_type (tmp); |
1627 | readable_message_type *msgType = get_readable_message_type (tmp); |
1628 | |
1628 | |
1629 | if (player *pl = op->contr) |
1629 | if (player *pl = op->contr) |
1630 | if (client *ns = pl->ns) |
1630 | if (client *ns = pl->ns) |
1631 | if (ns->can_msg) |
1631 | if (ns->can_msg) |
1632 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1632 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1633 | else |
1633 | else |
1634 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
1634 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
1635 | msgType->message_type, msgType->message_subtype, |
1635 | msgType->message_type, msgType->message_subtype, |
1636 | "You open the %s and start reading.\n%s", (char *)"%s\n%s", |
1636 | "You open the %s and start reading.\n%s", (char *)"%s\n%s", |
1637 | long_desc (tmp, op), &tmp->msg); |
1637 | long_desc (tmp, op), &tmp->msg); |
… | |
… | |
1740 | } |
1740 | } |
1741 | |
1741 | |
1742 | op->failmsg (format ("You lose knowledge of %s.", spell)); |
1742 | op->failmsg (format ("You lose knowledge of %s.", spell)); |
1743 | player_unready_range_ob (op->contr, spob); |
1743 | player_unready_range_ob (op->contr, spob); |
1744 | esrv_remove_spell (op->contr, spob); |
1744 | esrv_remove_spell (op->contr, spob); |
1745 | spob->destroy (); |
1745 | spob->destroy (true); |
1746 | } |
1746 | } |
1747 | |
1747 | |
1748 | /** |
1748 | /** |
1749 | * Handles player applying a spellbook. |
1749 | * Handles player applying a spellbook. |
1750 | * Checks whether player has knowledge of required skill, doesn't already know the spell, |
1750 | * Checks whether player has knowledge of required skill, doesn't already know the spell, |
… | |
… | |
1965 | if (op->destroyed () || tmp->destroyed ()) |
1965 | if (op->destroyed () || tmp->destroyed ()) |
1966 | break; |
1966 | break; |
1967 | } |
1967 | } |
1968 | |
1968 | |
1969 | if (!tmp->destroyed () && !tmp->inv) |
1969 | if (!tmp->destroyed () && !tmp->inv) |
1970 | tmp->decrease (); |
1970 | tmp->decrease (true); |
1971 | } |
1971 | } |
1972 | |
1972 | |
1973 | /** |
1973 | /** |
1974 | * op eats food. |
1974 | * op eats food. |
1975 | * If player, takes care of messages and dragon special food. |
1975 | * If player, takes care of messages and dragon special food. |
… | |
… | |
2261 | LOG (llevDebug, "Trying to poison player/monster for %d hp\n", poison->stats.hp); |
2261 | LOG (llevDebug, "Trying to poison player/monster for %d hp\n", poison->stats.hp); |
2262 | hit_player (op, poison->stats.hp, tmp, AT_POISON, 1); |
2262 | hit_player (op, poison->stats.hp, tmp, AT_POISON, 1); |
2263 | } |
2263 | } |
2264 | |
2264 | |
2265 | op->stats.food -= op->stats.food / 4; |
2265 | op->stats.food -= op->stats.food / 4; |
2266 | poison->destroy (); |
2266 | poison->destroy (true); |
2267 | } |
2267 | } |
2268 | |
2268 | |
2269 | /** |
2269 | /** |
2270 | * This function return true if the exit is not a 2 ways one or it is 2 ways, valid exit. |
2270 | * This function return true if the exit is not a 2 ways one or it is 2 ways, valid exit. |
2271 | * A valid 2 way exit means: |
2271 | * A valid 2 way exit means: |
… | |
… | |
2762 | CLEAR_FLAG (tmp2, FLAG_APPLIED); |
2762 | CLEAR_FLAG (tmp2, FLAG_APPLIED); |
2763 | |
2763 | |
2764 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
2764 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
2765 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
2765 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
2766 | |
2766 | |
2767 | op->destroy (); |
2767 | op->destroy (true); |
2768 | who->insert (tmp2); |
2768 | who->insert (tmp2); |
2769 | who->update_stats (); |
2769 | who->update_stats (); |
2770 | |
2770 | |
2771 | if (who->contr) |
2771 | if (who->contr) |
2772 | { |
2772 | { |
… | |
… | |
3294 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
3294 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
3295 | |
3295 | |
3296 | who->insert (tmp2); |
3296 | who->insert (tmp2); |
3297 | |
3297 | |
3298 | /* Remove the old lantern */ |
3298 | /* Remove the old lantern */ |
3299 | op->destroy (); |
3299 | op->destroy (true); |
3300 | |
3300 | |
3301 | /* insert the portion that was split off */ |
3301 | /* insert the portion that was split off */ |
3302 | if (tmp) |
3302 | if (tmp) |
3303 | who->insert (tmp); |
3303 | who->insert (tmp); |
3304 | |
3304 | |
… | |
… | |
3546 | if (tmp == NULL) |
3546 | if (tmp == NULL) |
3547 | return 0; |
3547 | return 0; |
3548 | |
3548 | |
3549 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
3549 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
3550 | { |
3550 | { |
3551 | tmp->destroy (); |
3551 | tmp->destroy (true); |
3552 | tmp = NULL; |
3552 | tmp = NULL; |
3553 | } |
3553 | } |
3554 | } |
3554 | } |
3555 | while (!tmp); |
3555 | while (!tmp); |
3556 | |
3556 | |
… | |
… | |
3572 | /* If we generated an object and put it in this object inventory, |
3572 | /* If we generated an object and put it in this object inventory, |
3573 | * move it to the parent object as the current object is about |
3573 | * move it to the parent object as the current object is about |
3574 | * to disappear. An example of this item is the random_* stuff |
3574 | * to disappear. An example of this item is the random_* stuff |
3575 | * that is put inside other objects. |
3575 | * that is put inside other objects. |
3576 | */ |
3576 | */ |
3577 | for (tmp = op->inv; tmp; tmp = tmp2) |
|
|
3578 | { |
|
|
3579 | tmp2 = tmp->below; |
|
|
3580 | tmp->remove (); |
|
|
3581 | |
|
|
3582 | if (op->env) |
3577 | if (op->env) |
3583 | insert_ob_in_ob (tmp, op->env); |
3578 | while (op->inv) |
3584 | else |
3579 | op->env->insert (op->inv); |
3585 | tmp->destroy (); |
|
|
3586 | } |
|
|
3587 | |
3580 | |
3588 | op->destroy (); |
3581 | op->destroy (true); |
3589 | break; |
3582 | break; |
3590 | } |
3583 | } |
3591 | |
3584 | |
3592 | return !!tmp; |
3585 | return !!tmp; |
3593 | } |
3586 | } |
… | |
… | |
3734 | SET_FLAG (force, FLAG_APPLIED); |
3727 | SET_FLAG (force, FLAG_APPLIED); |
3735 | change_abil (who, force); |
3728 | change_abil (who, force); |
3736 | insert_ob_in_ob (force, who); |
3729 | insert_ob_in_ob (force, who); |
3737 | } |
3730 | } |
3738 | else |
3731 | else |
3739 | force->destroy (); |
3732 | force->destroy (true); |
3740 | |
3733 | |
3741 | /* check for hp, sp change */ |
3734 | /* check for hp, sp change */ |
3742 | if (food->stats.hp != 0) |
3735 | if (food->stats.hp != 0) |
3743 | { |
3736 | { |
3744 | if (QUERY_FLAG (food, FLAG_CURSED)) |
3737 | if (QUERY_FLAG (food, FLAG_CURSED)) |
… | |
… | |
3846 | object *tmp; |
3839 | object *tmp; |
3847 | |
3840 | |
3848 | op->failmsg ("Your spell warps!"); |
3841 | op->failmsg ("Your spell warps!"); |
3849 | tmp = get_archetype (SPELL_WONDER); |
3842 | tmp = get_archetype (SPELL_WONDER); |
3850 | cast_wonder (op, op, 0, tmp); |
3843 | cast_wonder (op, op, 0, tmp); |
3851 | tmp->destroy (); |
3844 | tmp->destroy (true); |
3852 | } |
3845 | } |
3853 | else if (failure <= -15 && failure > -35) |
3846 | else if (failure <= -15 && failure > -35) |
3854 | { /* drain mana */ |
3847 | { /* drain mana */ |
3855 | op->failmsg ("Your mana is drained!"); |
3848 | op->failmsg ("Your mana is drained!"); |
3856 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
3849 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
… | |
… | |
3877 | else if (failure <= -80) |
3870 | else if (failure <= -80) |
3878 | { /* blast the immediate area */ |
3871 | { /* blast the immediate area */ |
3879 | object *tmp = get_archetype (LOOSE_MANA); |
3872 | object *tmp = get_archetype (LOOSE_MANA); |
3880 | cast_magic_storm (op, tmp, power); |
3873 | cast_magic_storm (op, tmp, power); |
3881 | op->failmsg ("You unleash uncontrolled mana!"); |
3874 | op->failmsg ("You unleash uncontrolled mana!"); |
3882 | tmp->destroy (); |
3875 | tmp->destroy (true); |
3883 | } |
3876 | } |
3884 | } |
3877 | } |
3885 | } |
3878 | } |
3886 | |
3879 | |
3887 | void |
3880 | void |