I6: Armour

Dear all,

I’m currently working on weapons and armour which shall be wielable/wearable and provide certain attributes. That was rather easy for weapons as you’re supposed to have only one, but for armour I want to heave a head, body and feet slot. I’m new to the properties concept and all other stuff I probably need to know. I made my armours a class Armour. If I have an armour object, how can I detect if the player is already wearing another one for the same slot as the first one?



I can think of two approaches offhand.

  1. The brute force approach. Use objectloop to go through the player’s possessions and test which of them are of the armour class and are worn in a certain slot.

  2. Give the player three properties corresponding to the three slots. When the player puts on a piece of armour, set the corresponding slot property to true. When that armour is removed, set it to false.

Objectloop. Didn’t think of that. Thanks for the hint!