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.9 by root, Fri Sep 15 23:11: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 {
213 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
214 return; 210 return;
215 } 211 }
216 } 212 }
217 } 213 }
218 } 214 }
215
219 /* if we get here, we failed!! */ 216 /* if we get here, we failed!! */
220 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));
221} 218}
222 219
223/** 220/**
596 object *tmp; 593 object *tmp;
597 594
598 remove_contents (cauldron->inv, NULL); 595 remove_contents (cauldron->inv, NULL);
599 switch (rndm (0, 2)) 596 switch (rndm (0, 2))
600 { 597 {
601 case 0: 598 case 0:
602 tmp = get_archetype ("bomb"); 599 tmp = get_archetype ("bomb");
603 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW); 600 tmp->stats.dam = random_roll (1, level, op, PREFER_LOW);
604 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW); 601 tmp->stats.hp = random_roll (1, level, op, PREFER_LOW);
605 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);
606 break; 603 break;
607 604
608 default: 605 default:
609 tmp = get_archetype ("fireball"); 606 tmp = get_archetype ("fireball");
610 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;
611 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;
612 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);
613 break; 610 break;
614 } 611 }
615 tmp->x = cauldron->x, tmp->y = cauldron->y; 612
616 insert_ob_in_map (tmp, op->map, NULL, 0); 613 op->insert_at (cauldron);
617 return; 614 return;
618 615
619 } 616 }
620 else if (level < 60) 617 else if (level < 60)
621 { /* CREATE MONSTER */ 618 { /* CREATE MONSTER */
627 { /* MAJOR FIRE */ 624 { /* MAJOR FIRE */
628 object *fb = get_archetype (SP_MED_FIREBALL); 625 object *fb = get_archetype (SP_MED_FIREBALL);
629 626
630 remove_contents (cauldron->inv, NULL); 627 remove_contents (cauldron->inv, NULL);
631 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);
632 free_object (fb); 629 fb->destroy ();
633 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);
634 return; 631 return;
635 632
636 } 633 }
637 else if (level < 100) 634 else if (level < 100)
705 return; 702 return;
706 } 703 }
707} 704}
708 705
709 706
710/** 707/*
711 * All but object "save_item" are elimentated from 708 * All but object "save_item" are elimentated from
712 * 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
713 * 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).
714 */ 711 */
715 712
719 object *next, *tmp = first_ob; 716 object *next, *tmp = first_ob;
720 717
721 while (tmp) 718 while (tmp)
722 { 719 {
723 next = tmp->below; 720 next = tmp->below;
721
724 if (tmp == save_item) 722 if (tmp == save_item)
725 { 723 {
726 if (!(tmp = next)) 724 if (!(tmp = next))
727 break; 725 break;
728 else 726 else
729 next = next->below; 727 next = next->below;
730 } 728 }
729
731 if (tmp->inv) 730 if (tmp->inv)
732 remove_contents (tmp->inv, NULL); 731 remove_contents (tmp->inv, NULL);
733 remove_ob (tmp); 732
734 free_object (tmp); 733 tmp->destroy ();
735 tmp = next; 734 tmp = next;
736 } 735 }
737} 736}
738 737
739/** 738/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines