… | |
… | |
93 | * or not. |
93 | * or not. |
94 | * op is the target (person being pilfered) |
94 | * op is the target (person being pilfered) |
95 | * who is the person doing the stealing. |
95 | * who is the person doing the stealing. |
96 | * skill is the skill object (stealing). |
96 | * skill is the skill object (stealing). |
97 | */ |
97 | */ |
98 | |
|
|
99 | static int |
98 | static int |
100 | attempt_steal (object *op, object *who, object *skill) |
99 | attempt_steal (object *op, object *who, object *skill) |
101 | { |
100 | { |
102 | object *success = NULL, *tmp = NULL, *next; |
101 | object *success = NULL, *tmp = NULL, *next; |
103 | int roll = 0, chance = 0, stats_value; |
102 | int roll = 0, chance = 0, stats_value; |
… | |
… | |
121 | else /* help npc to detect thief next time by raising its wisdom */ |
120 | else /* help npc to detect thief next time by raising its wisdom */ |
122 | op->stats.Wis += (op->stats.Int / 5) + 1; |
121 | op->stats.Wis += (op->stats.Int / 5) + 1; |
123 | if (op->stats.Wis > MAX_STAT) |
122 | if (op->stats.Wis > MAX_STAT) |
124 | op->stats.Wis = MAX_STAT; |
123 | op->stats.Wis = MAX_STAT; |
125 | } |
124 | } |
|
|
125 | |
126 | if (op->type == PLAYER && QUERY_FLAG (op, FLAG_WIZ)) |
126 | if (op->type == PLAYER && QUERY_FLAG (op, FLAG_WIZ)) |
127 | { |
127 | { |
128 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); |
128 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); |
129 | return 0; |
129 | return 0; |
130 | } |
130 | } |
131 | #ifdef PROHIBIT_PLAYERKILL |
131 | |
|
|
132 | // only allow stealing between hostile players (TODO: probably should change) |
132 | if (op->type == PLAYER && who->type == PLAYER && (who->contr->peaceful || op->contr->peaceful)) |
133 | if (op->type == PLAYER && who->type == PLAYER && (who->contr->peaceful || op->contr->peaceful)) |
133 | { |
134 | { |
134 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); |
135 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); |
135 | return 0; |
136 | return 0; |
136 | } |
137 | } |
137 | #else |
|
|
138 | if (op->type == PLAYER && who->type == PLAYER && settings.no_player_stealing) |
|
|
139 | { |
|
|
140 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); |
|
|
141 | return 0; |
|
|
142 | } |
|
|
143 | #endif |
|
|
144 | |
|
|
145 | |
138 | |
146 | /* Ok then, go thru their inventory, stealing */ |
139 | /* Ok then, go thru their inventory, stealing */ |
147 | for (tmp = op->inv; tmp != NULL; tmp = next) |
140 | for (tmp = op->inv; tmp; tmp = next) |
148 | { |
141 | { |
149 | next = tmp->below; |
142 | next = tmp->below; |
150 | |
143 | |
151 | /* you can't steal worn items, starting items, wiz stuff, |
144 | /* you can't steal worn items, starting items, wiz stuff, |
152 | * innate abilities, or items w/o a type. Generally |
145 | * innate abilities, or items w/o a type. Generally |
… | |
… | |
156 | * future possible problems. -b.t. |
149 | * future possible problems. -b.t. |
157 | * Flesh items generated w/ fix_flesh_item should have FLAG_NO_STEAL |
150 | * Flesh items generated w/ fix_flesh_item should have FLAG_NO_STEAL |
158 | * already -b.t. |
151 | * already -b.t. |
159 | */ |
152 | */ |
160 | |
153 | |
161 | if (QUERY_FLAG (tmp, FLAG_WAS_WIZ) || QUERY_FLAG (tmp, FLAG_APPLIED) |
154 | if (QUERY_FLAG (tmp, FLAG_APPLIED) |
162 | || !(tmp->type) |
155 | || !tmp->type |
163 | || tmp->type == SPELL |
156 | || tmp->type == SPELL |
164 | || QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_STEAL) || tmp->invisible) |
157 | || QUERY_FLAG (tmp, FLAG_STARTEQUIP) |
|
|
158 | || QUERY_FLAG (tmp, FLAG_NO_STEAL) |
|
|
159 | || tmp->invisible) |
165 | continue; |
160 | continue; |
166 | |
161 | |
167 | /* Okay, try stealing this item. Dependent on dexterity of thief, |
162 | /* Okay, try stealing this item. Dependent on dexterity of thief, |
168 | * skill level, see the adj_stealroll fctn for more detail. |
163 | * skill level, see the adj_stealroll fctn for more detail. |
169 | */ |
164 | */ |