1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
340 | { |
340 | { |
341 | remove_contents (cauldron->inv, item); |
341 | remove_contents (cauldron->inv, item); |
342 | /* Recalc carrying of the cauldron, in case recipe did not conserve mass */ |
342 | /* Recalc carrying of the cauldron, in case recipe did not conserve mass */ |
343 | cauldron->update_weight (); |
343 | cauldron->update_weight (); |
344 | /* adj lvl, nrof on caster level */ |
344 | /* adj lvl, nrof on caster level */ |
345 | adjust_product (item, ability, rp->yield ? (rp->yield * batches) : batches); |
345 | adjust_product (item, ability, rp->yield ? rp->yield * batches : batches); |
|
|
346 | |
346 | if (!item->env && (item = insert_ob_in_ob (item, cauldron)) == NULL) |
347 | if (!item->env && (item = insert_ob_in_ob (item, cauldron)) == NULL) |
347 | { |
348 | { |
348 | new_draw_info (NDI_UNIQUE, 0, caster, "Nothing happened."); |
349 | new_draw_info (NDI_UNIQUE, 0, caster, "Nothing happened."); |
349 | /* new_draw_info_format(NDI_UNIQUE, 0,caster, |
350 | /* new_draw_info_format(NDI_UNIQUE, 0,caster, |
350 | "Your spell causes the %s to explode!",&cauldron->name); */ |
351 | "Your spell causes the %s to explode!",&cauldron->name); */ |
… | |
… | |
888 | |
889 | |
889 | /* create the object **FIRST**, then decide whether to keep it. */ |
890 | /* create the object **FIRST**, then decide whether to keep it. */ |
890 | if ((item = attempt_recipe (caster, cauldron, ability, rp, formula / rp->index)) != NULL) |
891 | if ((item = attempt_recipe (caster, cauldron, ability, rp, formula / rp->index)) != NULL) |
891 | { |
892 | { |
892 | /* compute base chance of recipe success */ |
893 | /* compute base chance of recipe success */ |
893 | success_chance = ((float) ability / (float) (rp->diff * (item->level + 2))); |
894 | success_chance = ((float)ability / (float)(rp->diff * (item->level + 2))); |
894 | if (ave_chance == 0) |
895 | if (ave_chance == 0) |
895 | ave_chance = 1; |
896 | ave_chance = 1; |
896 | |
897 | |
897 | #ifdef ALCHEMY_DEBUG |
898 | #ifdef ALCHEMY_DEBUG |
898 | LOG (llevDebug, "percent success chance = %f ab%d / diff%d*lev%d\n", success_chance, ability, rp->diff, item->level); |
899 | LOG (llevDebug, "percent success chance = %f ab%d / diff%d*lev%d\n", success_chance, ability, rp->diff, item->level); |