# Looting Troubles

Hello again. I was hoping that I could figure this out on my own, but this makes no sense to me. I searched around for different possibilities, but yeah… I’m stumped. This should be working (I think), but it’s not. I want the player to loot a dead enemy, but the code isn’t working. Here’s my ENTIRE test game so you have the full code and can know what’s going on:

[code]“Test4” by Strange Impressions

Book - Fighting

The Arena is a room. An Orc is in the Arena.

A monster is a kind of person.

An Orc is a monster.

The East Hallway is a room. It is east of the Arena.

Chapter - Armor

A brooch is a thing. A brooch is wearable. A brooch is in the Arena.

A brooch has a number called armor. The armor of a brooch is usually 5.

say “You see a brooch. If you wear this brooch, it will increase your health by five points.”

After wearing the brooch:
increase the maximum hit points of the player by the armor of the brooch;
increase the current hit points of the player by the armor of the brooch.

After dropping the brooch:
decrease the maximum hit points of the player by the armor of the brooch;
decrease the current hit points of the player by the armor of the brooch.

After taking off the brooch:
decrease the maximum hit points of the player by the armor of the brooch;
decrease the current hit points of the player by the armor of the brooch.

Chapter - Combat

A person can be female or male. A person is usually male.

A person has a number called carrying capacity. The carrying capacity of a person is usually 10.

A weapon is a kind of thing.

A club is a weapon. The player carries a club.

A sword is a weapon. The orc carries a sword.

A person has a number called maximum hit points. A person has a number called current hit points.

The maximum hit points of the player is usually 35. The maximum hit points of the Orc is 25.

The current hit points of the player is 35. The current hit points of the Orc is 25.

Definition: A person is alive if its current hit points are greater than 0.

Definition: A person is dead if its current hit points are less than 0.

A person has a number called maximum attack. The maximum attack of the player is usually 5. The maximum attack of the orc is 5.

The Orc carries a weapon called a mace.

A person has a number called maximum hit points. A person has a number called current hit points.

The maximum hit points of the player is usually 35. The maximum hit points of the orc is 25.

The current hit points of the player is 35. The current hit points of the orc is 25.

let the damage be a random number between 1 and 5 plus the maximum attack of the player;
say “You attack [the noun], causing [damage] points of damage!”;
decrease the current hit points of the noun by the damage;
if the current hit points of the noun is less than 0:
say “[line break][The noun] has been defeated!”;
stop the action;
let the enemy damage be a random number between 1 and 5 plus the maximum attack;
say “[line break][The noun] attacks you, causing [enemy damage] points of damage!”;
decrease the current hit points of the player by the enemy damage;
if the current hit points of the player is less than 0:
end the story.

When play begins:
now the left hand status line is “Health: [current hit points of player] / [maximum hit points of player]”

Chapter - Looting and Potions

The can’t take people’s possessions rule is not listed in the check taking rulebook.

Check an actor taking (this is the can’t take living people’s possessions rule):
let the local ceiling be the common ancestor of the actor with the noun;
let H be the not-counting-parts holder of the noun;
while H is not nothing and H is not the local ceiling:
if H is an alive person:
if the actor is the player:
say “[regarding the noun][Those] [seem] to belong to [the H].” (A);
if H is a dead person:
continue the action;
let H be the not-counting-parts holder of H;

After examining a dead person (this is the give list of possession on dead person rule):
if the number of things carried by the noun is at least one:
say “On the [if the noun is plural-named]bodies[otherwise]body[end if] of [the noun] you also see [list of things carried by the noun with indefinite articles].”

A thing is either drinkable or undrinkable.

The block drinking rule is not listed in the check drinking rules.

A potion is drinkable. The player carries a potion.

After drinking a potion:
now the current hit points of the player is the maximum hit points of the player.