Re: percentile

From: Daniel Koepke (dkoepke@california.com)
Date: 02/08/97


On Sat, 8 Feb 1997, Mark Crichton wrote:

> (int) percent = ( (float) GET_HIT(victim) / (float) dam) * 100.0;
> 
> Should do what he wants, although I don't know how much stuff will get lost in
> all the casting (IMHO, it's an ugly way to do it...)  Any math experts out 
> there come up with a better way and keep it all int based?

The whole method is shot, no matter how you convert.  If it's
supposed to be a percentile value, returning 1200 is undesirable.
A more desirable result would be to mutliply the damage by 100
and divide it by the current hitpoints of the player.  This gives
a representation of how much "dam" uses of their hitpoints, I
believe.

  int percent = (dam * 100) / GET_HIT(victim);

That should give the desired result.


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST