ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/alchemy.C
(Generate patch)

Comparing deliantra/server/server/alchemy.C (file contents):
Revision 1.10 by root, Mon Dec 11 02:54:57 2006 UTC vs.
Revision 1.15 by root, Tue Dec 26 20:04:09 2006 UTC

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
194 192
195 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);
196 if (attempt_shadow_alchemy && value_item > value_ingredients) 194 if (attempt_shadow_alchemy && value_item > value_ingredients)
197 { 195 {
198#ifdef ALCHEMY_DEBUG 196#ifdef ALCHEMY_DEBUG
199# ifndef WIN32
200 LOG (llevDebug, 197 LOG (llevDebug,
201 "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",
202 value_ingredients, value_item); 199 value_ingredients, value_item);
203# else
204 LOG (llevDebug,
205 "Forcing failure for shadow alchemy recipe because price of ingredients (%I64d) is less than price of result (%I64d).\n",
206 value_ingredients, value_item);
207# endif
208#endif 200#endif
209 } 201 }
210 /* roll the dice */ 202 /* roll the dice */
211 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)
212 { 204 {
601 object *tmp; 593 object *tmp;
602 594
603 remove_contents (cauldron->inv, NULL); 595 remove_contents (cauldron->inv, NULL);
604 switch (rndm (0, 2)) 596 switch (rndm (0, 2))
605 { 597 {
606 case 0: 598 case 0:
607 tmp = get_archetype ("bomb"); 599 tmp = get_archetype ("bomb");
608 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW); 600 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW);
609 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW); 601 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW);
610 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);
611 break; 603 break;
612 604
613 default: 605 default:
614 tmp = get_archetype ("fireball"); 606 tmp = get_archetype ("fireball");
615 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;
616 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;
617 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);
618 break; 610 break;
619 } 611 }
620 tmp->x = cauldron->x, tmp->y = cauldron->y; 612
621 insert_ob_in_map (tmp, op->map, NULL, 0); 613 op->insert_at (cauldron);
622 return; 614 return;
623 615
624 } 616 }
625 else if (level < 60) 617 else if (level < 60)
626 { /* CREATE MONSTER */ 618 { /* CREATE MONSTER */
632 { /* MAJOR FIRE */ 624 { /* MAJOR FIRE */
633 object *fb = get_archetype (SP_MED_FIREBALL); 625 object *fb = get_archetype (SP_MED_FIREBALL);
634 626
635 remove_contents (cauldron->inv, NULL); 627 remove_contents (cauldron->inv, NULL);
636 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);
637 free_object (fb); 629 fb->destroy ();
638 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);
639 return; 631 return;
640 632
641 } 633 }
642 else if (level < 100) 634 else if (level < 100)
710 return; 702 return;
711 } 703 }
712} 704}
713 705
714 706
715/** 707/*
716 * All but object "save_item" are elimentated from 708 * All but object "save_item" are elimentated from
717 * 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
718 * 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).
719 */ 711 */
720 712
724 object *next, *tmp = first_ob; 716 object *next, *tmp = first_ob;
725 717
726 while (tmp) 718 while (tmp)
727 { 719 {
728 next = tmp->below; 720 next = tmp->below;
721
729 if (tmp == save_item) 722 if (tmp == save_item)
730 { 723 {
731 if (!(tmp = next)) 724 if (!(tmp = next))
732 break; 725 break;
733 else 726 else
734 next = next->below; 727 next = next->below;
735 } 728 }
729
736 if (tmp->inv) 730 if (tmp->inv)
737 remove_contents (tmp->inv, NULL); 731 remove_contents (tmp->inv, NULL);
738 remove_ob (tmp); 732
739 free_object (tmp); 733 tmp->destroy ();
740 tmp = next; 734 tmp = next;
741 } 735 }
742} 736}
743 737
744/** 738/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines