Creating Equipment

This page serves as a brief tutorial for making equipment.

For starters, all the code you need to make equipment can be found in the Equipment.dm. This is where the basic equipment types and procs are all defined. For the more casual user, you only need to pay attention to the Accessories, Armor, and Weapons .dm files.

**Basic Equipment Statistics**

All equipment shares a number of basic stats. These stats are as follows:

* name: What is the displayed name of the item

* desc: What description should the game display when the 'Description' verb is used
* icon: What icon does the item use? For non-accessories, this is what's displayed on the character
* rarity: How rare/strong, in general, is the item? Lower rarity items are more common and widespread. Rarity can be any number, but some numbers are already named. There are currently 7 named rarities of items (displayed color in parentheses):
	1. Common (White)
	2. Quality (Silver)
	3. Rare (Yellow)
	4. Exceptional (Lime)
	5. Mythical (Teal)
	6. Legendary (Purple)
	7. Artifact (Red)
* value: How much is this item worth? Currently serves little purpose, but can be used in conjunction with rarity to denote which items should populate containers/mob item lists
* slotcost: How many slots does the item take? All players have 4 slots for accessories by default, alongside varying armor slots per limb and one weapon slot per hand.

**Accessories**

Accessories are the easiest type of equipment to make, as they do not equip to particular limbs. All you need to make an accessory is a name, an icon, a description, and what you want the accessory to do. You can optionally set rarity and value for the accessory. To make the accessory actually do something, you need to override the equip() and unequip() procs. See the code for the Backpack below as an example:

You need to know the variable name of the stats you wish to modify, but any stats housed on the mob itself can be affected.

**Armor**

Creating armor is slightly more complicated than creating accessories. In addition to the general equipment stats, armor has the following stats:

* armored: How much damage per limb does this armor reduce? This is a flat reduction to damage the limb takes. This stat is countered by penetration on weapons.
* deflection: How much does this armor increase your dodge rate? The deflection from all equipped armor is added to your dodge calculation.
* protection: Percentage reduction to damage taken per limb. This is a "divisor", so a value of 2 means the limb will take half damage. Stacks multiplicatively across armor pieces, so wearing a shirt with 2 protection and a shirt with 1.5 protection would lead to a total protection for the affected limbs of 3, causing them to take 1/3 damage.
* slots: A list of the limbs the armor covers. This list is the type paths of the limbs, so see mobparts.dm for these paths. There are a set of default "types" provided for each armor type, so you can use one of those armor types and ignore this variable.

There are a number of "basic" armor types already provided, these come with a set of slots already specified. These are:

* Body: Covers the Torso, Abdomen, and each Arm
* Helmet: Covers the Head
* Gloves: Cover the Hands
* Boots: Cover the Feet
* Pants: Cover the Legs

Creating armor basic armor involves simply setting the general equipment variables and the armored, deflection, and protection stats as you see fit. "General" character stats can be modified by overriding the equip() and unequip() procs in the same way accessories do.

**Weapons**

Weapons also possess a unique set of stats in addition to the general equipment stats:

* damage: Added damage per melee attack the character makes. Stacks between weapons.
* penetration: Armor ignored per attack. Directly counters armored, but does not increase damage beyond negating armor's damage reduction.
* accuracy: Modifies your hit rate, directly counters deflection.
* speed: Multiplies the time between attacks, stacks multiplicatively between weapons. A speed of 0.5 means attacking twice as fast, for example.
* slots: Weapons by default only take one hand to wield. You can make them two-handed by adding an extra hand to the slot list.
* wtype: The type of weapon, split into the categories of Sword, Axe, Staff, Spear, Club, and Hammer. Using the existing weapon typings automatically sets wtype.

Creating weapons involves setting the general equipment variables and the weapon-specific ones as you see fit. As with armor, "general" character stats can be modified by overriding the equip() and unequip() procs.