… | |
… | |
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 (true); |
222 | depl->destroy (); |
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 (true); |
961 | item->destroy (); |
962 | } |
962 | } |
963 | } |
963 | } |
964 | |
964 | |
965 | if (converter->inv) |
965 | if (converter->inv) |
966 | { |
966 | { |
… | |
… | |
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 (true); |
1745 | spob->destroy (); |
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, |
… | |
… | |
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 (true); |
2266 | poison->destroy (); |
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 (true); |
2767 | op->destroy (); |
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 (true); |
3299 | op->destroy (); |
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 (true); |
3551 | tmp->destroy (); |
3552 | tmp = NULL; |
3552 | tmp = NULL; |
3553 | } |
3553 | } |
3554 | } |
3554 | } |
3555 | while (!tmp); |
3555 | while (!tmp); |
3556 | |
3556 | |
… | |
… | |
3576 | */ |
3576 | */ |
3577 | if (op->env) |
3577 | if (op->env) |
3578 | while (op->inv) |
3578 | while (op->inv) |
3579 | op->env->insert (op->inv); |
3579 | op->env->insert (op->inv); |
3580 | |
3580 | |
3581 | op->destroy (true); |
3581 | op->destroy (); |
3582 | break; |
3582 | break; |
3583 | } |
3583 | } |
3584 | |
3584 | |
3585 | return !!tmp; |
3585 | return !!tmp; |
3586 | } |
3586 | } |
… | |
… | |
3727 | SET_FLAG (force, FLAG_APPLIED); |
3727 | SET_FLAG (force, FLAG_APPLIED); |
3728 | change_abil (who, force); |
3728 | change_abil (who, force); |
3729 | insert_ob_in_ob (force, who); |
3729 | insert_ob_in_ob (force, who); |
3730 | } |
3730 | } |
3731 | else |
3731 | else |
3732 | force->destroy (true); |
3732 | force->destroy (); |
3733 | |
3733 | |
3734 | /* check for hp, sp change */ |
3734 | /* check for hp, sp change */ |
3735 | if (food->stats.hp != 0) |
3735 | if (food->stats.hp != 0) |
3736 | { |
3736 | { |
3737 | if (QUERY_FLAG (food, FLAG_CURSED)) |
3737 | if (QUERY_FLAG (food, FLAG_CURSED)) |
… | |
… | |
3839 | object *tmp; |
3839 | object *tmp; |
3840 | |
3840 | |
3841 | op->failmsg ("Your spell warps!"); |
3841 | op->failmsg ("Your spell warps!"); |
3842 | tmp = get_archetype (SPELL_WONDER); |
3842 | tmp = get_archetype (SPELL_WONDER); |
3843 | cast_wonder (op, op, 0, tmp); |
3843 | cast_wonder (op, op, 0, tmp); |
3844 | tmp->destroy (true); |
3844 | tmp->destroy (); |
3845 | } |
3845 | } |
3846 | else if (failure <= -15 && failure > -35) |
3846 | else if (failure <= -15 && failure > -35) |
3847 | { /* drain mana */ |
3847 | { /* drain mana */ |
3848 | op->failmsg ("Your mana is drained!"); |
3848 | op->failmsg ("Your mana is drained!"); |
3849 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
3849 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
… | |
… | |
3870 | else if (failure <= -80) |
3870 | else if (failure <= -80) |
3871 | { /* blast the immediate area */ |
3871 | { /* blast the immediate area */ |
3872 | object *tmp = get_archetype (LOOSE_MANA); |
3872 | object *tmp = get_archetype (LOOSE_MANA); |
3873 | cast_magic_storm (op, tmp, power); |
3873 | cast_magic_storm (op, tmp, power); |
3874 | op->failmsg ("You unleash uncontrolled mana!"); |
3874 | op->failmsg ("You unleash uncontrolled mana!"); |
3875 | tmp->destroy (true); |
3875 | tmp->destroy (); |
3876 | } |
3876 | } |
3877 | } |
3877 | } |
3878 | } |
3878 | } |
3879 | |
3879 | |
3880 | void |
3880 | void |