… | |
… | |
23 | |
23 | |
24 | /* March 96 - Laid down original code. -b.t. thomas@astro.psu.edu */ |
24 | /* March 96 - Laid down original code. -b.t. thomas@astro.psu.edu */ |
25 | |
25 | |
26 | #include <global.h> |
26 | #include <global.h> |
27 | #include <object.h> |
27 | #include <object.h> |
28 | #ifndef __CEXTRACT__ |
|
|
29 | # include <sproto.h> |
28 | #include <sproto.h> |
30 | #endif |
|
|
31 | #include <skills.h> |
29 | #include <skills.h> |
32 | #include <spells.h> |
30 | #include <spells.h> |
33 | |
31 | |
34 | /** define this for some helpful debuging information */ |
32 | /** define this for some helpful debuging information */ |
35 | #if 0 |
33 | #if 0 |
… | |
… | |
155 | /* the caster gets an increase in ability based on thier skill lvl */ |
153 | /* the caster gets an increase in ability based on thier skill lvl */ |
156 | if (rp->skill) |
154 | if (rp->skill) |
157 | { |
155 | { |
158 | skop = find_skill_by_name (caster, rp->skill); |
156 | skop = find_skill_by_name (caster, rp->skill); |
159 | if (!skop) |
157 | if (!skop) |
160 | { |
|
|
161 | new_draw_info (NDI_UNIQUE, 0, caster, "You do not have the proper skill for this recipe"); |
158 | new_draw_info (NDI_UNIQUE, 0, caster, "You do not have the proper skill for this recipe"); |
162 | } |
|
|
163 | else |
159 | else |
164 | { |
|
|
165 | ability += (int) (skop->level * ((4.0 + cauldron->magic) / 4.0)); |
160 | ability += (int) (skop->level * ((4.0 + cauldron->magic) / 4.0)); |
166 | } |
|
|
167 | } |
161 | } |
168 | else |
162 | else |
169 | { |
163 | { |
170 | LOG (llevDebug, "Recipe %s has NULL skill!\n", &rp->title); |
164 | LOG (llevDebug, "Recipe %s has NULL skill!\n", &rp->title); |
171 | return; |
165 | return; |
172 | } |
166 | } |
173 | |
167 | |
174 | if (rp->cauldron) |
168 | if (!rp->cauldron) |
175 | { |
169 | { |
176 | LOG (llevDebug, "Recipe %s has NULL cauldron!\n", &rp->title); |
170 | LOG (llevDebug, "Recipe %s has NULL cauldron!\n", &rp->title); |
177 | return; |
171 | return; |
178 | } |
172 | } |
179 | |
173 | |
… | |
… | |
198 | |
192 | |
199 | value_item = query_cost (item, NULL, F_TRUE | F_IDENTIFIED | F_NOT_CURSED); |
193 | value_item = query_cost (item, NULL, F_TRUE | F_IDENTIFIED | F_NOT_CURSED); |
200 | if (attempt_shadow_alchemy && value_item > value_ingredients) |
194 | if (attempt_shadow_alchemy && value_item > value_ingredients) |
201 | { |
195 | { |
202 | #ifdef ALCHEMY_DEBUG |
196 | #ifdef ALCHEMY_DEBUG |
203 | # ifndef WIN32 |
|
|
204 | LOG (llevDebug, |
197 | LOG (llevDebug, |
205 | "Forcing failure for shadow alchemy recipe because price of ingredients (%llu) is less than price of result (%llu).\n", |
198 | "Forcing failure for shadow alchemy recipe because price of ingredients (%llu) is less than price of result (%llu).\n", |
206 | value_ingredients, value_item); |
199 | value_ingredients, value_item); |
207 | # else |
|
|
208 | LOG (llevDebug, |
|
|
209 | "Forcing failure for shadow alchemy recipe because price of ingredients (%I64d) is less than price of result (%I64d).\n", |
|
|
210 | value_ingredients, value_item); |
|
|
211 | # endif |
|
|
212 | #endif |
200 | #endif |
213 | } |
201 | } |
214 | /* roll the dice */ |
202 | /* roll the dice */ |
215 | else if ((float) (random_roll (0, 101, caster, PREFER_LOW)) <= 100.0 * success_chance) |
203 | else if ((float) (random_roll (0, 101, caster, PREFER_LOW)) <= 100.0 * success_chance) |
216 | { |
204 | { |
217 | change_exp (caster, rp->exp, rp->skill, SK_EXP_NONE); |
205 | change_exp (caster, rp->exp, rp->skill, SK_EXP_NONE); |
|
|
206 | |
|
|
207 | // let alchemy consume some time, so that exploits are less easy |
|
|
208 | caster->speed_left -= 1.0; |
|
|
209 | |
218 | return; |
210 | return; |
219 | } |
211 | } |
220 | } |
212 | } |
221 | } |
213 | } |
222 | } |
214 | } |
|
|
215 | |
223 | /* if we get here, we failed!! */ |
216 | /* if we get here, we failed!! */ |
224 | alchemy_failure_effect (caster, cauldron, rp, calc_alch_danger (caster, cauldron, rp)); |
217 | alchemy_failure_effect (caster, cauldron, rp, calc_alch_danger (caster, cauldron, rp)); |
225 | } |
218 | } |
226 | |
219 | |
227 | /**
|
220 | /**
|
… | |
… | |
600 | object *tmp; |
593 | object *tmp; |
601 | |
594 | |
602 | remove_contents (cauldron->inv, NULL); |
595 | remove_contents (cauldron->inv, NULL); |
603 | switch (rndm (0, 2)) |
596 | switch (rndm (0, 2)) |
604 | { |
597 | { |
605 | case 0: |
598 | case 0: |
606 | tmp = get_archetype ("bomb"); |
599 | tmp = get_archetype ("bomb"); |
607 | tmp->stats.dam = random_roll (1, level, op, PREFER_LOW); |
600 | tmp->stats.dam = random_roll (1, level, op, PREFER_LOW); |
608 | tmp->stats.hp = random_roll (1, level, op, PREFER_LOW); |
601 | tmp->stats.hp = random_roll (1, level, op, PREFER_LOW); |
609 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s creates a bomb!", &cauldron->name); |
602 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s creates a bomb!", &cauldron->name); |
610 | break; |
603 | break; |
611 | |
604 | |
612 | default: |
605 | default: |
613 | tmp = get_archetype ("fireball"); |
606 | tmp = get_archetype ("fireball"); |
614 | tmp->stats.dam = random_roll (1, level, op, PREFER_LOW) / 5 + 1; |
607 | tmp->stats.dam = random_roll (1, level, op, PREFER_LOW) / 5 + 1; |
615 | tmp->stats.hp = random_roll (1, level, op, PREFER_LOW) / 10 + 2; |
608 | tmp->stats.hp = random_roll (1, level, op, PREFER_LOW) / 10 + 2; |
616 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name); |
609 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name); |
617 | break; |
610 | break; |
618 | } |
611 | } |
619 | tmp->x = cauldron->x, tmp->y = cauldron->y; |
612 | |
620 | insert_ob_in_map (tmp, op->map, NULL, 0); |
613 | op->insert_at (cauldron); |
621 | return; |
614 | return; |
622 | |
615 | |
623 | } |
616 | } |
624 | else if (level < 60) |
617 | else if (level < 60) |
625 | { /* CREATE MONSTER */ |
618 | { /* CREATE MONSTER */ |
… | |
… | |
631 | { /* MAJOR FIRE */ |
624 | { /* MAJOR FIRE */ |
632 | object *fb = get_archetype (SP_MED_FIREBALL); |
625 | object *fb = get_archetype (SP_MED_FIREBALL); |
633 | |
626 | |
634 | remove_contents (cauldron->inv, NULL); |
627 | remove_contents (cauldron->inv, NULL); |
635 | fire_arch_from_position (cauldron, cauldron, cauldron->x, cauldron->y, 0, fb); |
628 | fire_arch_from_position (cauldron, cauldron, cauldron->x, cauldron->y, 0, fb); |
636 | free_object (fb); |
629 | fb->destroy (); |
637 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name); |
630 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s erupts in flame!", &cauldron->name); |
638 | return; |
631 | return; |
639 | |
632 | |
640 | } |
633 | } |
641 | else if (level < 100) |
634 | else if (level < 100) |
… | |
… | |
709 | return; |
702 | return; |
710 | } |
703 | } |
711 | } |
704 | } |
712 | |
705 | |
713 | |
706 | |
714 | /**
|
707 | /* |
715 | * All but object "save_item" are elimentated from |
708 | * All but object "save_item" are elimentated from |
716 | * the container list. Note we have to becareful to remove the inventories |
709 | * the container list. Note we have to becareful to remove the inventories |
717 | * of objects in the cauldron inventory (ex icecube has stuff in it). |
710 | * of objects in the cauldron inventory (ex icecube has stuff in it). |
718 | */ |
711 | */ |
719 | |
712 | |
… | |
… | |
723 | object *next, *tmp = first_ob; |
716 | object *next, *tmp = first_ob; |
724 | |
717 | |
725 | while (tmp) |
718 | while (tmp) |
726 | { |
719 | { |
727 | next = tmp->below; |
720 | next = tmp->below; |
|
|
721 | |
728 | if (tmp == save_item) |
722 | if (tmp == save_item) |
729 | { |
723 | { |
730 | if (!(tmp = next)) |
724 | if (!(tmp = next)) |
731 | break; |
725 | break; |
732 | else |
726 | else |
733 | next = next->below; |
727 | next = next->below; |
734 | } |
728 | } |
|
|
729 | |
735 | if (tmp->inv) |
730 | if (tmp->inv) |
736 | remove_contents (tmp->inv, NULL); |
731 | remove_contents (tmp->inv, NULL); |
737 | remove_ob (tmp); |
732 | |
738 | free_object (tmp); |
733 | tmp->destroy (); |
739 | tmp = next; |
734 | tmp = next; |
740 | } |
735 | } |
741 | } |
736 | } |
742 | |
737 | |
743 | /**
|
738 | /**
|