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

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.33 by root, Thu Jan 18 19:42:09 2007 UTC vs.
Revision 1.34 by root, Sat Jan 20 22:09:51 2007 UTC

716 case 16: 716 case 16:
717 case 17: 717 case 17:
718 case 18: 718 case 18:
719 case 19: 719 case 19:
720 { 720 {
721 int b = 5 + FABS (bonus), val, resist = RANDOM () % num_resist_table; 721 int b = 5 + abs (bonus), val, resist = rndm (num_resist_table);
722 722
723 /* Roughly generate a bonus between 100 and 35 (depending on the bonus) */ 723 /* Roughly generate a bonus between 100 and 35 (depending on the bonus) */
724 val = 10 + RANDOM () % b + RANDOM () % b + RANDOM () % b + RANDOM () % b; 724 val = 10 + rndm (b) + rndm (b) + rndm (b) + rndm (b);
725 725
726 /* Cursed items need to have higher negative values to equal out with 726 /* Cursed items need to have higher negative values to equal out with
727 * positive values for how protections work out. Put another 727 * positive values for how protections work out. Put another
728 * little random element in since that they don't always end up with 728 * little random element in since that they don't always end up with
729 * even values. 729 * even values.
731 if (bonus < 0) 731 if (bonus < 0)
732 val = 2 * -val - RANDOM () % b; 732 val = 2 * -val - RANDOM () % b;
733 if (val > 35) 733 if (val > 35)
734 val = 35; /* Upper limit */ 734 val = 35; /* Upper limit */
735 b = 0; 735 b = 0;
736
736 while (op->resist[resist_table[resist]] != 0 && b < 4) 737 while (op->resist[resist_table[resist]] != 0 && b < 4)
737 {
738 resist = RANDOM () % num_resist_table; 738 resist = rndm (num_resist_table);
739 } 739
740 if (b == 4) 740 if (b == 4)
741 return; /* Not able to find a free resistance */ 741 return; /* Not able to find a free resistance */
742
742 op->resist[resist_table[resist]] = val; 743 op->resist[resist_table[resist]] = val;
743 /* We should probably do something more clever here to adjust value 744 /* We should probably do something more clever here to adjust value
744 * based on how good a resistance we gave. 745 * based on how good a resistance we gave.
745 */ 746 */
746 break; 747 break;
774 case 22: 775 case 22:
775 op->stats.exp += bonus; /* Speed! */ 776 op->stats.exp += bonus; /* Speed! */
776 op->value = (op->value * 2) / 3; 777 op->value = (op->value * 2) / 3;
777 break; 778 break;
778 } 779 }
780
779 if (bonus > 0) 781 if (bonus > 0)
780 op->value *= 2 * bonus; 782 op->value *= 2 * bonus;
781 else 783 else
782 op->value = -(op->value * 2 * bonus) / 3; 784 op->value = -(op->value * 2 * bonus) / 3;
783} 785}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines