Re: combat code

From: Edward Glamkowski (EGlamkowski@MATHEMATICA-MPR.COM)
Date: 10/08/97


The calc_speed() function is not very difficult, it is
insuring you integrate it correctly into perform_violence()
that matters.

You could have a calc_speed function as simple as:

int calc_speed(void) {
    return (dice(1, 10));
}

You probably want modifiers, so something like:

int calc_speed(struct char_data *ch) {
  s = dice(1, 10);

  s -= dex_app[GET_DEX(ch)].reaction;

  /* Simulate multi-hit code by letting warriors attack *
   * more often... */
  if (IS_WARRIOR(ch))
    s -= GET_LEVEL(ch) / 10;

  /* Etc. for any additional modifiers you want */

  return s;
}


Edward Glamkowski, Programmer           Mathematica Policy Research
EGlamkowski@mathematic-MPR.COM          Princeton, NJ
                http://www.mathematica-mpr.com/

        Il dort. Quoique le sort fut pour lui bien etrange,
        Il vivait. Il mourut quand il n'eut plus son ange.
        La chose simplement d'elle-meme arriva,
        Comme la nuit se fait lorsque le jour s'en va.

>----------
>From:  Angus Mezick[SMTP:angus@EDGIL.CCMAIL.COMPUSERVE.COM]
>Sent:  Wednesday, October 08, 1997 3:06 PM
>To:    CIRCLE@post.queensu.ca
>Subject:        combat code
>
>Daniel, would you happen to mind posting your calculate_speed function? This
>idea seems very interesting. (i hope you still have the code, it is an old
>post
>from the archives.)  I would like to integrate this with the timed spell
>casting
>function. thinking about giving my magic usrers more to practice by giving
>them
>the choice of raising skill level with the spell, or speed.  maybe I will
>remove
>practices and just make spells/skills learned items with having to go to the
>guild master every time they learn 5% points to get the next point. that or
>have
>them just go up once per level. and have the guild master actually do the
>teaching, while the player has to use it a certain amount for the master to
>be
>willing to teach.  hrms....
>--Angus
>______________________________ Forward Header
>__________________________________
>Did it. And it was actually quite easy! [IF ANYONE
>INTREPRETS THAT AS AN INSULT TO ANYONE'S INTELLIGENCE I WILL
>SLAP THE LIVING HELL OUT OF THEM] What I did was change the
>combat pulses to occur every second, then I made a temp
>variable for characters (where-ever they have 'fighting' and
>'hunting' and all those other temporary things) that would
>save how long it takes to attack. Next I created a function
>called 'calculate_speed' that took into account HASTE and
>SLOW, and dextrity, weapon weight, what they person was
>wearing (eg., huge armor slowed them down), what they were
>carrying (lots of weight slowed them down), terrain, etc.,
>etc. and a bit of randomisity then returned that.  In hit()
>I would do: 'NEXT_HIT(ch) = calculate_speed(ch);' and a
>check to make sure that their opponent was fighting (if not
>then I made them hit the person to get them fighting).
>Finally, in perform_violence() I did something like:
>
>if ((NEXT_HIT(ch)--))
>  continue;
>
>Inside my loop...
>
>Oh, now that I think about it, my multi-code (which was very
>simple) that, in response to someone else, I tried to have
>mix attacks up, would benefit from this. And actually, on my
>MUD, this completely replaces the multi-hit code. I figure
>if the person is fast enough, they'll get off a hit or two
>before their opponent does, anyway.
>
><*=-+Daniel+-=*>
>"Forgive me father, for I am sin."
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
>


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



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