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.22 by root, Mon Apr 16 06:23:42 2007 UTC vs.
Revision 1.23 by root, Tue May 1 05:48:20 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
7 * 7 *
730 tmp->destroy (); 730 tmp->destroy ();
731 tmp = next; 731 tmp = next;
732 } 732 }
733} 733}
734 734
735/** 735/**
736 *"Danger" level, will determine how bad the backfire 736 *"Danger" level, will determine how bad the backfire
737 * could be if the user fails to concoct a recipe properly. Factors include 737 * could be if the user fails to concoct a recipe properly. Factors include
738 * the number of ingredients, the length of the name of each ingredient, 738 * the number of ingredients, the length of the name of each ingredient,
739 * the user's effective level, the user's Int and the enchantment on the 739 * the user's effective level, the user's Int and the enchantment on the
740 * mixing device (aka "cauldron"). Higher values of 'danger' indicate more 740 * mixing device (aka "cauldron"). Higher values of 'danger' indicate more
741 * danger. Note that we assume that we have had the caster ready the alchemy 741 * danger. Note that we assume that we have had the caster ready the alchemy
742 * skill *before* this routine is called. (no longer auto-readies that skill) 742 * skill *before* this routine is called. (no longer auto-readies that skill)
743 * -b.t. 743 * -b.t.
744 */ 744 */
745
746int 745int
747calc_alch_danger (object *caster, object *cauldron, recipe *rp) 746calc_alch_danger (object *caster, object *cauldron, recipe *rp)
748{ 747{
749 object *item; 748 object *item;
750 char name[MAX_BUF]; 749 char name[MAX_BUF];
751 int danger = 0, nrofi = 0; 750 int danger = 0, nrofi = 0;
752 751
753 /* Knowing alchemy skill reduces yer risk */ 752 /* Knowing alchemy skill reduces yer risk */
754 danger -= caster->chosen_skill ? caster->chosen_skill->level : caster->level; 753 danger -= caster->chosen_skill ? caster->chosen_skill->level : caster->level;
754
755 if (!caster->chosen_skill)
756 LOG (llevError | logBacktrace, "calc_alch_danger called without a chosen skill, caster %s, cauldron %s\n",
757 caster->debug_desc (), cauldron->debug_desc ());
755 758
756 /* better cauldrons reduce risk */ 759 /* better cauldrons reduce risk */
757 danger -= cauldron->magic; 760 danger -= cauldron->magic;
758 761
759 /* Higher Int, lower the risk */ 762 /* Higher Int, lower the risk */
769 if (item->title) 772 if (item->title)
770 sprintf (name, "%s %s", &item->name, &item->title); 773 sprintf (name, "%s %s", &item->name, &item->title);
771 danger += (strtoint (name) / 1000) + 3; 774 danger += (strtoint (name) / 1000) + 3;
772 nrofi++; 775 nrofi++;
773 } 776 }
777
774 if (rp == NULL) 778 if (rp == NULL)
775 danger += 110; 779 danger += 110;
776 else 780 else
777 danger += rp->diff * 3; 781 danger += rp->diff * 3;
778 782
787#endif 791#endif
788 792
789 return danger; 793 return danger;
790} 794}
791 795
792/** 796/**
793 * Determines if ingredients in a container match the 797 * Determines if ingredients in a container match the
794 * proper ingredients for a recipe. 798 * proper ingredients for a recipe.
795 * 799 *
796 * rp is the recipe to check 800 * rp is the recipe to check
797 * cauldron is the container that holds the ingredients 801 * cauldron is the container that holds the ingredients

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines