[DGD]Melville

Stephen Schmidt schmidsj at union.edu
Mon Jul 31 05:34:34 CEST 2000


On Sun, 30 Jul 2000, Darius AMJ wrote:
> I'm not even sure where to start the combat
> to be quite honest. heart_beat I suppose, is a good start.

Here's a more-or-less traditional outline. Modify at will :)

heart_beat() {
  if (I am dead) {
    die() ;
  } else {
    if (healing is needed) heal() ;
    if (it seems wise) start_combat() ;
    if (in combat) attack() ;
}

die() then goes through whatever death routine you want; clone
a corpse object, move equipment to the ground, take away a level
(or delete user file if you feel strongly about it ;), all that.

heal() adds any hit points or spell points or whatever it is
that regularly regenerates.

start_combat() begins a fight with another living object. Be
sure to have start_combat() also call start_combat() in the
victim (so the victim fights back) and check the list of
current targets before doing anything (so you don't infinitely
recurse when the victim's start_combat() calls it again in you).
Here, you'd want to check to see if there's an object present
with which you want to automagically start combat (usually the
case if this is a monster and it sees a player that previously
attacked it, although you might do that in init() instead).
The kill command also invokes start_combat(), as do a few
other things in the lib.

attack() picks a target, picks a weapon if you need to do that
sort of thing, calculates a hit chance, determines success,
calculates damage, and so forth.

However, please do NOT feel obligated to follow this outline;
I'm sure there's tons of other ways to do it. This is just the
basic method that most LPs have historically used.

Stephen Schmidt

It is vain to expect a well-balanced government without a
well-balanced society.
			-- Gideon Welles



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list