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.63 by root, Sun Jan 29 02:47:05 2017 UTC vs.
Revision 1.67 by root, Tue May 10 11:02:56 2022 UTC

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 (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
63 64
64/** Returns a random selection from cauldron_effect[] */ 65/** Returns a random selection from cauldron_effect[] */
65static const char * 66static const char *
66cauldron_sound () 67cauldron_sound ()
67{ 68{
68 return cauldron_effect [rndm (array_length (cauldron_effect))]; 69 return cauldron_effect [rndm (ecb_array_length (cauldron_effect))];
69} 70}
70 71
71/** 72/**
72 * Recipe value of the entire contents of a container. 73 * Recipe value of the entire contents of a container.
73 * This appears to just generate a hash value, which I guess for now works 74 * This appears to just generate a hash value, which I guess for now works
824 recipelist *fl; 825 recipelist *fl;
825 recipe *rp = NULL; 826 recipe *rp = NULL;
826 float success_chance; 827 float success_chance;
827 int numb, ability = 1; 828 int numb, ability = 1;
828 int formula = 0; 829 int formula = 0;
829 float ave_chance;
830 object *item; 830 object *item;
831 831
832 if (caster->type != PLAYER) 832 if (caster->type != PLAYER)
833 return; /* only players for now */ 833 return; /* only players for now */
834 834
873 uint64 value_ingredients; 873 uint64 value_ingredients;
874 uint64 value_item; 874 uint64 value_item;
875 object *tmp; 875 object *tmp;
876 int attempt_shadow_alchemy; 876 int attempt_shadow_alchemy;
877 877
878 ave_chance = fl->total_chance / (float)fl->number; 878 //ave_chance = fl->total_chance / (float)fl->number;
879 879
880 ability += skill->level * ((4.0 + cauldron->magic) / 4.0); 880 ability += skill->level * ((4.0 + cauldron->magic) / 4.0);
881 881
882 /* determine value of ingredients */ 882 /* determine value of ingredients */
883 value_ingredients = 0; 883 value_ingredients = 0;
888 888
889 /* create the object **FIRST**, then decide whether to keep it. */ 889 /* create the object **FIRST**, then decide whether to keep it. */
890 if ((item = attempt_recipe (caster, cauldron, ability, rp, formula / rp->index)) != NULL) 890 if ((item = attempt_recipe (caster, cauldron, ability, rp, formula / rp->index)) != NULL)
891 { 891 {
892 /* compute base chance of recipe success */ 892 /* compute base chance of recipe success */
893 //TODO: (marc) diff is documenmted as percentage difficulty, not as divisor.
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 ave_chance = 1;
896 895
897#ifdef ALCHEMY_DEBUG 896#ifdef ALCHEMY_DEBUG
898 LOG (llevDebug, "percent success chance = %f ab%d / diff%d*lev%d\n", success_chance, ability, rp->diff, item->level); 897 LOG (llevDebug, "percent success chance = %f ab%d / diff%d*lev%d\n", success_chance, ability, rp->diff, item->level);
899#endif 898#endif
900 899

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines