… | |
… | |
94 | * around. :) |
94 | * around. :) |
95 | * -b.t. |
95 | * -b.t. |
96 | */ |
96 | */ |
97 | |
97 | |
98 | void |
98 | void |
99 | attempt_do_alchemy (object *caster, object *cauldron) |
99 | attempt_do_alchemy (object *caster, object *cauldron, object *skill) |
100 | { |
100 | { |
101 | recipelist *fl; |
101 | recipelist *fl; |
102 | recipe *rp = NULL; |
102 | recipe *rp = NULL; |
103 | float success_chance; |
103 | float success_chance; |
104 | int numb, ability = 1; |
104 | int numb, ability = 1; |
… | |
… | |
140 | return; |
140 | return; |
141 | } /* End of WIZ alchemy */ |
141 | } /* End of WIZ alchemy */ |
142 | |
142 | |
143 | /* find the recipe */ |
143 | /* find the recipe */ |
144 | rp = find_recipe (fl, formula, cauldron->inv); |
144 | rp = find_recipe (fl, formula, cauldron->inv); |
145 | if (rp) |
145 | if (rp |
|
|
146 | && rp->skill == skill->skill |
|
|
147 | && (!rp->cauldron |
|
|
148 | || rp->cauldron == cauldron->arch->archname)) |
146 | { |
149 | { |
147 | uint64 value_ingredients; |
150 | uint64 value_ingredients; |
148 | uint64 value_item; |
151 | uint64 value_item; |
149 | object *tmp; |
152 | object *tmp; |
150 | int attempt_shadow_alchemy; |
153 | int attempt_shadow_alchemy; |
151 | |
154 | |
152 | ave_chance = fl->total_chance / (float) fl->number; |
155 | ave_chance = fl->total_chance / (float) fl->number; |
153 | /* the caster gets an increase in ability based on thier skill lvl */ |
156 | |
154 | if (rp->skill) |
|
|
155 | { |
|
|
156 | skop = find_skill_by_name (caster, rp->skill); |
|
|
157 | if (!skop) |
|
|
158 | new_draw_info (NDI_UNIQUE, 0, caster, "You do not have the proper skill for this recipe"); |
|
|
159 | else |
|
|
160 | ability += (int) (skop->level * ((4.0 + cauldron->magic) / 4.0)); |
157 | ability += (int) (skill->level * ((4.0 + cauldron->magic) / 4.0)); |
161 | } |
|
|
162 | else |
|
|
163 | { |
|
|
164 | LOG (llevDebug, "Recipe %s has NULL skill!\n", &rp->title); |
|
|
165 | return; |
|
|
166 | } |
|
|
167 | |
|
|
168 | if (!rp->cauldron) |
|
|
169 | { |
|
|
170 | LOG (llevDebug, "Recipe %s has NULL cauldron!\n", &rp->title); |
|
|
171 | return; |
|
|
172 | } |
|
|
173 | |
158 | |
174 | /* determine value of ingredients */ |
159 | /* determine value of ingredients */ |
175 | value_ingredients = 0; |
160 | value_ingredients = 0; |
176 | for (tmp = cauldron->inv; tmp != NULL; tmp = tmp->below) |
161 | for (tmp = cauldron->inv; tmp != NULL; tmp = tmp->below) |
177 | value_ingredients += query_cost (tmp, NULL, F_TRUE); |
162 | value_ingredients += query_cost (tmp, NULL, F_TRUE); |
… | |
… | |
289 | object *item = NULL, *skop; |
274 | object *item = NULL, *skop; |
290 | |
275 | |
291 | /* this should be passed to this fctn, not effiecent cpu use this way */ |
276 | /* this should be passed to this fctn, not effiecent cpu use this way */ |
292 | int batches = abs (nbatches); |
277 | int batches = abs (nbatches); |
293 | |
278 | |
294 | |
|
|
295 | /* is the cauldron the right type? */ |
279 | /* is the cauldron the right type? */ |
296 | if (rp->cauldron != cauldron->arch->archname) |
280 | if (rp->cauldron && rp->cauldron != cauldron->arch->archname) |
297 | { |
|
|
298 | new_draw_info (NDI_UNIQUE, 0, caster, "You are not using the proper" " facilities for this formula."); |
|
|
299 | return 0; |
281 | return 0; |
300 | } |
|
|
301 | |
282 | |
302 | skop = find_skill_by_name (caster, rp->skill); |
283 | skop = find_skill_by_name (caster, rp->skill); |
303 | /* does the caster have the skill? */ |
284 | /* does the caster have the skill? */ |
304 | if (!skop) |
285 | if (!skop) |
305 | return 0; |
286 | return 0; |