I use condition of objects. 0 is perfect 100 is broken.
I calculate based off how much damage an object has to determine if it's
hitting as hard or protecting as well:
if (obj->condition) {
damage_mod = (int)(damage_mod*(100-obj->condition)*.01);
}
I've set up many places where I calculate a range based on 'x'.
hitp += number_range((int)(0-hitp*.1), (int)(hitp*.1));
Here, mobs are give +/- 10% of their hit points for a little randomness.
Things like that, mostly.
> -----Original Message-----
> From: Eljon Curry [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 14, 2004 11:32 PM
> To: Jason Gauthier; [email protected]
> Subject: RE: Question on Calucations of percentages
>
> I'm interested to know what uses you've used it for. Please
> elaborate.
>
> Arkham
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
> Of Jason Gauthier
> Sent: Wednesday, January 14, 2004 11:00 PM
> To: Michael Barton; Eljon Curry; [email protected]
> Subject: RE: Question on Calucations of percentages
>
>
> When Diku was originally developed memory and CPU were very
> hard pressed.
> So I beleive everything that could be done wsa done to make
> the code as efficient as possible.
>
> This is why I would guess.. Since, I've used floats many times :)
>
> Jason
> > -----Original Message-----
> > From: Michael Barton [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 14, 2004 9:25 PM
> > To: Eljon Curry; [email protected]
> > Subject: Re: Question on Calucations of percentages
> >
> > Ever notice there are no floating-point operations
> whatsoever in stock
> > ROM?
> > Is there some hardware floating around without any FPU that
> they were
> > worried about supporting? Or was it just a speed issue?
> >
> > ----- Original Message -----
> > From: "Eljon Curry" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Wednesday, January 14, 2004 6:14 PM
> > Subject: RE: Question on Calucations of percentages
> >
> >
> > > Ehhh...
> > >
> > > 0.20 X 670 Since 20% is .2 of the number.
> > >
> > > Arkham
> > >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
> > Of Cyhawk
> > > Sent: Wednesday, January 14, 2004 7:00 PM
> > > To: [email protected]
> > > Subject: Question on Calucations of percentages
> > >
> > >
> > > Ok ive looked all over for this in man files, cprogramming sites,
> > > everywhere..
> > > How do i figure out the precentage of a number.
> > >
> > > like 20% of 670
> > >
> > > As always any help is appreciated =)
> > >
> > > -Thri
> > >
> > >
> > > (My only other option is writing a switch statement, which
> > im almost sure
> > > is unnessecary ;)
> > >
> > >
> > > --
> > > ROM mailing list
> > > [email protected]
> > > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> > >
> > >
> > >
> > > --
> > > ROM mailing list
> > > [email protected]
> > > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
>