Re: percent instead of damage

From: Johan Dustler (Johan.Dustler@epk.ericsson.se)
Date: 02/07/97


> From: Brian Williams - Nashak <bmw@efn.org>
> 
> Okay, for damage messages, I changed it so that instead
> of like hitting someone hard, when you barely hurt them,
> although you do like 10 damage, it could still tickle them
> if they have 10 million hp, so it will say the messages
> depending on the percent of damage you do to the victim,
> now my problem is, the 10th message should only show up if you
> do 50% of their life damage, but for me, it is showing up
> like up to 20 times.. depending on what your damage is
> like a 80 hp mob, if you do 2 damage you nearly slay it, etc
> also on a 10k mob, you'd nearly slay it like 5 times at 6d6,
> but with 1d2 you would nearly slay it about 20 times..
> here is what I did to the fight_message
>   /* added */
>   int percent = GET_HIT(victim) / 100;
> 
>   /* changed the old one */
>   if (dam == 0)			msgnum = 0;
>   else if (dam <= 2*percent)    msgnum = 1;
>   else if (dam <= 4*percent)    msgnum = 2;
>   else if (dam <= 6*percent)    msgnum = 3;
>   else if (dam <= 9*percent)    msgnum = 4;
>   else if (dam <= 14*percent)   msgnum = 5;
>   else if (dam <= 19*percent)   msgnum = 6;
>   else if (dam <= 26*percent)   msgnum = 7;
>   else if (dam <= 35*percent)   msgnum = 8;
>   else if (dam <= 49*percent)   msgnum = 9;
>   else                          msgnum = 10;
> 
> I do have 10 messages, so I know that isn't the problem =) Thanks
> in advance for any help

With that calculation percent will always be 0 if the mob has
less than 100 hp.

Instead calculate the percentage of the dam compared to the hp.



int percent;

  if (dam == 0)
    msgnum = 0;
  else {
    if (GET_HIT(victim) <= 0) /* If the victim is this low every hit   */
      percent = 100;          /* would hurt alot. Need this anyway so  */
                              /* we don't get division by zero, and    */
                              /* we don't want a divison by negative   */
                              /* numer either.                         */
    else
      percent = (100 * dam) / GET_HIT(victim);

    if (percent <= 2)           msgnum = 1;
    else if (percent <= 5)      msgnum = 2;
    .
    .
    else                        msgnum = 10;
  }



-Johan
    
+-----------------------------------------------------------+
| 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