… | |
… | |
101 | { |
101 | { |
102 | object *success = NULL, *tmp = NULL, *next; |
102 | object *success = NULL, *tmp = NULL, *next; |
103 | int roll = 0, chance = 0, stats_value; |
103 | int roll = 0, chance = 0, stats_value; |
104 | rv_vector rv; |
104 | rv_vector rv; |
105 | |
105 | |
106 | stats_value = ((who->stats.Dex + who->stats.Int) * 3) / 2; |
106 | stats_value = (who->stats.Dex + who->stats.Int) * 3 / 2; |
107 | |
107 | |
108 | /* if the victim is aware of a thief in the area (FLAG_NO_STEAL set on them) |
108 | /* if the victim is aware of a thief in the area (FLAG_NO_STEAL set on them) |
109 | * they will try to prevent stealing if they can. Only unseen theives will |
109 | * they will try to prevent stealing if they can. Only unseen theives will |
110 | * have much chance of success. |
110 | * have much chance of success. |
111 | */ |
111 | */ |
112 | if (op->type != PLAYER && QUERY_FLAG (op, FLAG_NO_STEAL)) |
112 | if (!op->is_player () && op->flag [FLAG_NO_STEAL]) |
113 | { |
113 | { |
114 | if (can_detect_enemy (op, who, &rv)) |
114 | if (can_detect_enemy (op, who, &rv)) |
115 | { |
115 | { |
116 | npc_call_help (op); |
116 | npc_call_help (op); |
117 | CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); |
117 | CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); |
118 | new_draw_info (NDI_UNIQUE, 0, who, "Your attempt is prevented!"); |
118 | new_draw_info (NDI_UNIQUE, 0, who, "Your attempt is prevented!"); |
119 | return 0; |
119 | return 0; |
120 | } |
120 | } |
121 | else /* help npc to detect thief next time by raising its wisdom */ |
121 | else /* help npc to detect thief next time by raising its wisdom */ |
122 | op->stats.Wis += (op->stats.Int / 5) + 1; |
122 | op->stats.Wis += (op->stats.Int / 5) + 1; |
|
|
123 | |
123 | if (op->stats.Wis > MAX_STAT) |
124 | if (op->stats.Wis > MAX_STAT) |
124 | op->stats.Wis = MAX_STAT; |
125 | op->stats.Wis = MAX_STAT; |
125 | } |
126 | } |
126 | |
127 | |
127 | if (op->type == PLAYER && QUERY_FLAG (op, FLAG_WIZ)) |
128 | if (op->is_player () && op->flag [FLAG_WIZ]) |
128 | { |
129 | { |
129 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); |
130 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); |
130 | return 0; |
131 | return 0; |
131 | } |
132 | } |
132 | |
133 | |
133 | // only allow stealing between hostile players (TODO: probably should change) |
134 | // only allow stealing between hostile players (TODO: probably should change) |
134 | if (op->type == PLAYER && who->type == PLAYER && (who->contr->peaceful || op->contr->peaceful)) |
135 | if (op->is_player () && who->is_player () && (who->contr->peaceful || op->contr->peaceful)) |
135 | { |
136 | { |
136 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); |
137 | new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); |
137 | return 0; |
138 | return 0; |
138 | } |
139 | } |
139 | |
140 | |