If you’re implementing the body parts as things, along the lines of I4L’s “A left arm is a part of every person,” then you can use a table to automatically give every body part of a certain kind a certain health (and other properties) to start with. [This is mentioned somewhat in passing in section 15.16 of the documentation, which is mostly about defining things with tables but also mentions that you can define kinds with tables too.]
Here’s an example that seems to work as far as it goes:
[code]The arena is a room. The black knight is a man in the arena. The white knight is a man in the arena.
A body part is a kind of thing. Some kinds of body part are defined by the Table of Body Part Health.
A left leg is part of every person. A right leg is part of every person. A right arm is part of every person. A left arm is part of every person. [As far as I know, there’s no neat way to say “every person has one of each kind of every body part” or "one of each kind of body part listed in the table of body part health.]
Table of body part health
body part health [This means that every body part defined in this table is automatically assigned a number called health as a property, and that is initially set to the value listed in the table.]
left leg 7
right leg 7
left arm 3
right arm 3
[And now let’s give some rules for examining and changing body part health, so we can see that it works.]
Instead of examining a person:
if the noun incorporates a body part:
repeat with limb running through body parts incorporated by the noun:
say “[The limb] has health [health of limb].”;
otherwise:
say “[The noun] is waddling around, limbless, threatening to bite your knees off.”
Instead of examining a body part:
say “[The noun] has health [health of noun].”
Instead of attacking a body part:
decrease the health of the noun by 1;
if the health of the noun is 0:
say “You strike [the noun] clean off!”;
remove the noun from play;
otherwise:
say “You deal [the noun] a cruel blow, reducing its health to [health of noun]!”
Instead of attacking a person:
if the noun is the player:
say “That’s not a good idea.”;
otherwise if the noun incorporates a body part:
try attacking a random body part that is part of the noun;
otherwise:
say “[The noun] is currently waddling around, limbless, threatening to bite your knees off. You haven’t the heart to attack him.”[/code]
Note that you can attack your own limbs, if you specify them precisely in the command.