… | |
… | |
173 | |
173 | |
174 | if ((chance = adj_stealchance (who, op, (stats_value + skill->level * 10 - op->level * 3))) == -1) |
174 | if ((chance = adj_stealchance (who, op, (stats_value + skill->level * 10 - op->level * 3))) == -1) |
175 | return 0; |
175 | return 0; |
176 | else if (roll < chance) |
176 | else if (roll < chance) |
177 | { |
177 | { |
178 | tag_t tmp_count = tmp->count; |
|
|
179 | |
|
|
180 | pick_up (who, tmp); |
178 | pick_up (who, tmp); |
181 | /* need to see if the player actually stole this item - |
179 | /* need to see if the player actually stole this item - |
182 | * if it is in the players inv, assume it is. This prevents |
180 | * if it is in the players inv, assume it is. This prevents |
183 | * abuses where the player can not carry the item, so just |
181 | * abuses where the player can not carry the item, so just |
184 | * keeps stealing it over and over. |
182 | * keeps stealing it over and over. |
185 | */ |
183 | */ |
186 | if (was_destroyed (tmp, tmp_count) || tmp->env != op) |
184 | if (tmp->destroyed () || tmp->env != op) |
187 | { |
185 | { |
188 | /* for players, play_sound: steals item */ |
186 | /* for players, play_sound: steals item */ |
189 | success = tmp; |
187 | success = tmp; |
190 | CLEAR_FLAG (tmp, FLAG_INV_LOCKED); |
188 | CLEAR_FLAG (tmp, FLAG_INV_LOCKED); |
191 | |
189 | |
192 | /* Don't delete it from target player until we know |
190 | /* Don't delete it from target player until we know |
193 | * the thief has picked it up. can't just look at tmp->count, |
191 | * the thief has picked it up. can't just look at tmp->count, |
194 | * as it's possible that it got merged when picked up. |
192 | * as it's possible that it got merged when picked up. |
195 | */ |
193 | */ |
196 | if (op->type == PLAYER) |
194 | if (op->type == PLAYER) |
197 | esrv_del_item (op->contr, tmp_count); |
195 | esrv_del_item (op->contr, tmp->count); |
198 | } |
196 | } |
199 | break; |
197 | break; |
200 | } |
198 | } |
201 | } /* for loop looking for an item */ |
199 | } /* for loop looking for an item */ |
202 | |
200 | |
… | |
… | |
454 | } |
452 | } |
455 | return 0; |
453 | return 0; |
456 | } |
454 | } |
457 | |
455 | |
458 | /* patched this to take terrain into consideration */ |
456 | /* patched this to take terrain into consideration */ |
459 | |
|
|
460 | int |
457 | int |
461 | hide (object *op, object *skill) |
458 | hide (object *op, object *skill) |
462 | { |
459 | { |
463 | |
460 | |
464 | /* the preliminaries -- Can we really hide now? */ |
461 | /* the preliminaries -- Can we really hide now? */ |
… | |
… | |
1631 | |
1628 | |
1632 | static int |
1629 | static int |
1633 | do_throw (object *op, object *part, object *toss_item, int dir, object *skill) |
1630 | do_throw (object *op, object *part, object *toss_item, int dir, object *skill) |
1634 | { |
1631 | { |
1635 | object *throw_ob = toss_item, *left = NULL; |
1632 | object *throw_ob = toss_item, *left = NULL; |
1636 | tag_t left_tag; |
|
|
1637 | int eff_str = 0, maxc, str = op->stats.Str, dam = 0; |
1633 | int eff_str = 0, maxc, str = op->stats.Str, dam = 0; |
1638 | int pause_f, weight_f = 0, mflags; |
1634 | int pause_f, weight_f = 0, mflags; |
1639 | float str_factor = 1.0, load_factor = 1.0, item_factor = 1.0; |
1635 | float str_factor = 1.0, load_factor = 1.0, item_factor = 1.0; |
1640 | mapstruct *m; |
1636 | mapstruct *m; |
1641 | sint16 sx, sy; |
1637 | sint16 sx, sy; |
1642 | tag_t tag; |
|
|
1643 | |
1638 | |
1644 | if (throw_ob == NULL) |
1639 | if (throw_ob == NULL) |
1645 | { |
1640 | { |
1646 | if (op->type == PLAYER) |
1641 | if (op->type == PLAYER) |
1647 | { |
|
|
1648 | new_draw_info (NDI_UNIQUE, 0, op, "You have nothing to throw."); |
1642 | new_draw_info (NDI_UNIQUE, 0, op, "You have nothing to throw."); |
1649 | } |
1643 | |
1650 | return 0; |
1644 | return 0; |
1651 | } |
1645 | } |
1652 | if (QUERY_FLAG (throw_ob, FLAG_STARTEQUIP)) |
1646 | if (QUERY_FLAG (throw_ob, FLAG_STARTEQUIP)) |
1653 | { |
1647 | { |
1654 | if (op->type == PLAYER) |
1648 | if (op->type == PLAYER) |
1655 | { |
|
|
1656 | new_draw_info (NDI_UNIQUE, 0, op, "The gods won't let you throw that."); |
1649 | new_draw_info (NDI_UNIQUE, 0, op, "The gods won't let you throw that."); |
1657 | } |
1650 | |
1658 | return 0; |
1651 | return 0; |
1659 | } |
1652 | } |
1660 | |
1653 | |
1661 | /* Because throwing effectiveness must be reduced by the |
1654 | /* Because throwing effectiveness must be reduced by the |
1662 | * encumbrance of the thrower and weight of the object. THus, |
1655 | * encumbrance of the thrower and weight of the object. THus, |
… | |
… | |
1728 | } |
1721 | } |
1729 | return 0; |
1722 | return 0; |
1730 | } /* if object can't be thrown */ |
1723 | } /* if object can't be thrown */ |
1731 | |
1724 | |
1732 | left = throw_ob; /* these are throwing objects left to the player */ |
1725 | left = throw_ob; /* these are throwing objects left to the player */ |
1733 | left_tag = left->count; |
|
|
1734 | |
1726 | |
1735 | /* sometimes get_split_ob can't split an object (because op->nrof==0?) |
1727 | /* sometimes get_split_ob can't split an object (because op->nrof==0?) |
1736 | * and returns NULL. We must use 'left' then |
1728 | * and returns NULL. We must use 'left' then |
1737 | */ |
1729 | */ |
1738 | |
1730 | |
… | |
… | |
1743 | if (op->type == PLAYER) |
1735 | if (op->type == PLAYER) |
1744 | esrv_del_item (op->contr, left->count); |
1736 | esrv_del_item (op->contr, left->count); |
1745 | } |
1737 | } |
1746 | else if (op->type == PLAYER) |
1738 | else if (op->type == PLAYER) |
1747 | { |
1739 | { |
1748 | if (was_destroyed (left, left_tag)) |
1740 | if (left->destroyed ()) |
1749 | esrv_del_item (op->contr, left_tag); |
1741 | esrv_del_item (op->contr, left->count); |
1750 | else |
1742 | else |
1751 | esrv_update_item (UPD_NROF, op, left); |
1743 | esrv_update_item (UPD_NROF, op, left); |
1752 | } |
1744 | } |
1753 | |
1745 | |
1754 | /* special case: throwing powdery substances like dust, dirt */ |
1746 | /* special case: throwing powdery substances like dust, dirt */ |
… | |
… | |
1896 | LOG (llevDebug, " pause_f=%d \n", pause_f); |
1888 | LOG (llevDebug, " pause_f=%d \n", pause_f); |
1897 | LOG (llevDebug, " %s stats: wc=%d dam=%d dist=%d spd=%f break=%d\n", |
1889 | LOG (llevDebug, " %s stats: wc=%d dam=%d dist=%d spd=%f break=%d\n", |
1898 | throw_ob->name, throw_ob->stats.wc, throw_ob->stats.dam, throw_ob->last_sp, throw_ob->speed, throw_ob->stats.food); |
1890 | throw_ob->name, throw_ob->stats.wc, throw_ob->stats.dam, throw_ob->last_sp, throw_ob->speed, throw_ob->stats.food); |
1899 | LOG (llevDebug, "inserting tossitem (%d) into map\n", throw_ob->count); |
1891 | LOG (llevDebug, "inserting tossitem (%d) into map\n", throw_ob->count); |
1900 | #endif |
1892 | #endif |
1901 | tag = throw_ob->count; |
|
|
1902 | insert_ob_in_map (throw_ob, part->map, op, 0); |
1893 | insert_ob_in_map (throw_ob, part->map, op, 0); |
1903 | if (!was_destroyed (throw_ob, tag)) |
1894 | |
|
|
1895 | if (!throw_ob->destroyed ()) |
1904 | move_arrow (throw_ob); |
1896 | move_arrow (throw_ob); |
|
|
1897 | |
1905 | return 1; |
1898 | return 1; |
1906 | } |
1899 | } |
1907 | |
1900 | |
1908 | int |
1901 | int |
1909 | skill_throw (object *op, object *part, int dir, const char *params, object *skill) |
1902 | skill_throw (object *op, object *part, int dir, const char *params, object *skill) |