Difference between revisions of "Manual:Game Mechanics/Objects"
(checked against the current code (wiki review 2026-11-15)) |
|||
| Line 1: | Line 1: | ||
| − | This | + | This page explains what the numbers on weapons, armour, shields and magic items do in the game, and gives guidelines for choosing them. How to write the objects themselves is in the [[Manual:Zone Manual/The Objects Section|Zone Manual]], with all the macros on [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]]. The macros named here are in <code>vme/include/wmacros.h</code>, which <code>macros.h</code> includes. |
| − | + | == Craftsmanship and magic == | |
| − | + | Weapons, armour and shields have two numbers: '''craftsmanship''' (<code>value[1]</code>), how well the item was made and of what, and the '''magic bonus''' (<code>value[2]</code>). Both are on the bonus scale from -7 to +7, with names in <code>vme/include/values.h</code>. vmc refuses a value outside it ("Illegal bonus (-7..+7 allowed)") and the zone doesn't compile. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | When the item is loaded into the game, the server turns each into a combat bonus (<code>bonus_map_a()</code> in <code>vme/src/common.cpp</code>): | |
| − | |||
| − | |||
| − | |||
| − | 2. | + | {| class="wikitable" |
| + | ! Constant !! Value !! In the game | ||
| + | |- | ||
| + | | <code>BONUS_ARTIFACT</code> || 7 || +20 | ||
| + | |- | ||
| + | | <code>BONUS_SUPERIOR</code> || 6 || +17 | ||
| + | |- | ||
| + | | <code>BONUS_EXCELLENT_PLUS</code> || 5 || +14 | ||
| + | |- | ||
| + | | <code>BONUS_EXCELLENT</code> || 4 || +11 | ||
| + | |- | ||
| + | | <code>BONUS_GOOD_PLUS</code> || 3 || +8 | ||
| + | |- | ||
| + | | <code>BONUS_GOOD</code> || 2 || +5 | ||
| + | |- | ||
| + | | <code>BONUS_AVERAGE_PLUS</code> || 1 || +2 | ||
| + | |- | ||
| + | | <code>BONUS_AVERAGE</code> || 0 || 0 | ||
| + | |- | ||
| + | | <code>BONUS_AVERAGE_MINUS</code> || -1 || -2 | ||
| + | |- | ||
| + | | <code>BONUS_BAD</code> || -2 || -5 | ||
| + | |- | ||
| + | | <code>BONUS_BAD_MINUS</code> || -3 || -8 | ||
| + | |- | ||
| + | | <code>BONUS_TERRIBLE</code> || -4 || -11 | ||
| + | |- | ||
| + | | <code>BONUS_TERRIBLE_MINUS</code> || -5 || -14 | ||
| + | |- | ||
| + | | <code>BONUS_JUNK_ALMOST</code> || -6 || -17 | ||
| + | |- | ||
| + | | <code>BONUS_JUNK</code> || -7 || -20 | ||
| + | |} | ||
| + | A value that isn't 0 gets twice the open-ended roll divided by 100 added, so now and then an item comes out 2 or 4 points better (rarely worse). Craftsmanship and magic count the same in a fight: on a weapon they are added to the attack, on armour and shields to the defence (see [[Manual:Game Mechanics/Combat|Combat]]). The old manual's scale of -25% to +25%, with tables of materials, is gone; choose the craftsmanship from what the item is made of and how well. As a guide: | ||
| + | * an ordinary item is <code>BONUS_AVERAGE</code>; don't punish a club for being wood, or a spear for having a wooden shaft; | ||
| + | * rusty, cracked or makeshift items are below average; a sword made of wood is junk; | ||
| + | * fine work, or a better material such as steel, is good; mithril or the work of a master is excellent or better; | ||
| + | * a magic bonus makes an item magic: the item should also have <code>flags {UNIT_FL_MAGIC}</code> so that detect magic finds it. | ||
| − | + | === Wear and breaking === | |
| + | Craftsmanship also sets how much wear an item takes before it breaks. vmc gives it hit points (<code>set_hits()</code>; a <code>hit</code> field on the object is ignored): | ||
| + | {| class="wikitable" | ||
| + | ! Craftsmanship !! -7 !! -5 !! -3 !! -1 !! 0 !! +1 !! +3 !! +5 !! +7 | ||
| + | |- | ||
| + | | Hit points || 755 || 825 || 895 || 965 || 1,000 || 1,200 || 1,600 || 2,000 || 2,400 | ||
| + | |} | ||
| + | That is 1,000 + 200 per point above average, or 1,000 - 35 per point below. In a fight (<code>damage_object()</code> in <code>vme/src/fight.cpp</code>): | ||
| + | * a weapon that hits loses a quarter of the damage it does; | ||
| + | * the armour on the place that was hit loses the damage; | ||
| + | * a shield that blocks loses twice the damage the blow would have done; | ||
| + | in each case less the item's magic bonus, and then divided by 10. When its hit points go below 0, the item breaks: it gets "(broken)" after its title and becomes worthless trash. | ||
| − | + | == Weapons == | |
| − | + | <pre> | |
| − | + | WEAPON_DEF(weapon_type, craftsmanship, magic_bonus) | |
| − | + | </pre> | |
| − | + | <code>weapon_type</code> is one of the <code>WPN_*</code> weapon types in <code>vme/include/values.h</code>, such as <code>WPN_LONG_SWORD</code> or <code>WPN_DAGGER</code>. The families (<code>WPN_SWORD</code>, <code>WPN_AXE_HAM</code>...) are not weapon types, and vmc refuses them. The macro also sets the type, <code>MANIPULATE_TAKE</code> and <code>MANIPULATE_WIELD</code>. See [[Manual:Zone Manual/Appendices/weapon definitions in values.h|weapon definitions]]. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | Everything else about a weapon type is in <code>vme/etc/weapons.def</code>: | |
| − | + | {| class="wikitable" | |
| − | + | ! Field !! What it is | |
| − | + | |- | |
| − | + | | <code>sphere</code> || the family, which decides the skill a player falls back on | |
| − | + | |- | |
| − | + | | <code>hands</code> || 1 or 2 | |
| − | + | |- | |
| − | + | | <code>speed</code> || how much of a combat round a blow takes: 9 for two-handed weapons, 7 for one-handed, 4 for light ones like the dagger, 2 for natural attacks (4 is the least that counts) | |
| − | + | |- | |
| − | + | | <code>fumble</code> || a roll of this or less is a fumble: the blow misses and costs half a round | |
| − | + | |- | |
| − | + | | <code>ability</code> || the three abilities averaged for the attack, mostly strength, strength, dexterity | |
| + | |- | ||
| + | | <code>shield</code> || whether a shield can block the blow (<code>SHIELD_M_BLOCK</code>), only soften it (<code>SHIELD_M_REDUCE</code>), or not help at all (<code>SHIELD_M_USELESS</code>) | ||
| + | |- | ||
| + | | <code>attack clothes</code> ... <code>attack plate</code> || the damage table against each kind of armour | ||
| + | |} | ||
| + | Each damage entry is three numbers {''offset'', ''base'', ''step''}: a blow whose result reaches the offset does ''base'' + (result - offset) / ''step'' damage; below the offset it does none. For example: | ||
| + | {| class="wikitable" | ||
| + | ! Weapon !! Speed !! Fumble !! vs clothes !! vs soft leather !! vs hard leather !! vs chain !! vs plate | ||
| + | |- | ||
| + | | battle axe (2 hands) || 9 || 5 || {60, 10, 4} || {50, 9, 5} || {40, 8, 6} || {35, 7, 7} || {30, 6, 8} | ||
| + | |- | ||
| + | | long sword || 7 || 7 || {50, 7, 6} || {50, 6, 7} || {50, 5, 8} || {50, 4, 9} || {50, 3, 10} | ||
| + | |- | ||
| + | | dagger || 4 || 2 || {40, 3, 12} || {50, 2, 13} || {60, 1, 14} || {80, 1, 15} || {100, 1, 16} | ||
| + | |} | ||
| + | Light weapons are fast and seldom fumble but do little against heavy armour; two-handed weapons hit hardest. Many weapon types share the same table: the comment at the top of <code>weapons.def</code> lists which. | ||
| + | Examples: | ||
| + | <pre> | ||
| + | rusty_dagger | ||
| + | names {"rusty dagger", "dagger"} | ||
| + | title "a rusty dagger" | ||
| + | descr "A rusty dagger lies here." | ||
| + | WEAPON_DEF(WPN_DAGGER, BONUS_BAD, BONUS_AVERAGE) | ||
| + | weight 1 | ||
| + | cost 4 COPPER_PIECE | ||
| + | end | ||
| − | + | orcbane | |
| − | + | names {"orcbane", "long sword", "sword"} | |
| − | + | title "the long sword Orcbane" | |
| − | + | descr "A long sword with runes on its blade lies here." | |
| − | long | + | WEAPON_DEF(WPN_LONG_SWORD, BONUS_GOOD, BONUS_GOOD_PLUS) |
| − | + | WEAPON_SLAYER(RACE_ORC) | |
| − | + | weight 8 | |
| − | + | cost 20 GOLD_PIECE | |
| − | + | end | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | === Slaying weapons === | |
| − | + | <code>WEAPON_SLAYER(race)</code> makes a weapon a slayer of one race; <code>WEAPON_SLAYER_DRAGONS</code> of all dragons (an extra <code>$slayer</code> with the range of races). Both also set <code>UNIT_FL_MAGIC</code>. Put them after <code>WEAPON_DEF</code>, which would otherwise overwrite them. Against that race, the attack gets 50 more, plus 1 for each level the victim is above 50, and a blow that hits is looked up in the damage table a fifth higher. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | == Armour == | ||
| + | <pre> | ||
| + | ARMOUR_CLOTHES(craftsmanship, magic_bonus) | ||
| + | ARMOUR_LEATHER(...) ARMOUR_HRD_LEATHER(...) ARMOUR_CHAIN(...) ARMOUR_PLATE(...) | ||
| + | ARMOUR_DEF(ARM_CHAIN, craftsmanship, magic_bonus) | ||
| + | </pre> | ||
| + | The macros set only <code>MANIPULATE_TAKE</code>: add the place where it is worn. Armour protects only where a blow can land. Each blow lands on one place, found with 2d8: | ||
| + | {| class="wikitable" | ||
| + | ! Place !! Wear flag !! Chance | ||
| + | |- | ||
| + | | body || <code>MANIPULATE_WEAR_BODY</code> || 34% | ||
| + | |- | ||
| + | | legs || <code>MANIPULATE_WEAR_LEGS</code> || 28% | ||
| + | |- | ||
| + | | arms || <code>MANIPULATE_WEAR_ARMS</code> || 23% | ||
| + | |- | ||
| + | | head || <code>MANIPULATE_WEAR_HEAD</code> || 5% | ||
| + | |- | ||
| + | | hands || <code>MANIPULATE_WEAR_HANDS</code> || 5% | ||
| + | |- | ||
| + | | feet || <code>MANIPULATE_WEAR_FEET</code> || 5% | ||
| + | |} | ||
| + | The armour worn there decides two things: which column of the weapon's damage table is used, and its craftsmanship and magic are added to the defence. Where nothing is worn, the character's natural armour is used (clothes for a player) with no bonus. Armour of another kind, a cloak about the body for instance, gives no protection. | ||
| − | + | Heavier armour lowers the wearer's dexterity in a fight, unless they are strong and practised in it; see [[Manual:Game Mechanics/Abilities#Armour and dexterity|Abilities]]. Plate is the best protection and the heaviest burden. | |
| − | Armour | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | <pre> | |
| + | chain_shirt | ||
| + | names {"chain mail shirt", "chain shirt", "shirt"} | ||
| + | title "a chain mail shirt" | ||
| + | descr "A chain mail shirt lies here in a heap." | ||
| + | ARMOUR_CHAIN(BONUS_AVERAGE_PLUS, BONUS_AVERAGE) | ||
| + | manipulate {MANIPULATE_WEAR_BODY} | ||
| + | weight 25 | ||
| + | cost 8 GOLD_PIECE | ||
| + | end | ||
| + | </pre> | ||
| − | + | == Shields == | |
| − | + | <pre> | |
| − | + | SHIELD_DEF(shield_type, craftsmanship, magic_bonus) | |
| + | </pre> | ||
| + | The shield types are <code>SHIELD_SMALL</code>, <code>SHIELD_MEDIUM</code> and <code>SHIELD_LARGE</code>. The server also knows <code>SHIELD_TOWER</code>, but vmc refuses it. The macro sets <code>MANIPULATE_TAKE</code> and <code>MANIPULATE_WEAR_SHIELD</code>. | ||
| − | + | When a blow hits, a defender who is awake and has a shield tries to use it (<code>shield_bonus()</code> in <code>vme/src/experience.cpp</code>). The shield's own value is 15 for a small shield, 20 medium, 25 large, 35 tower, plus its craftsmanship and magic. Then an opposed check: roll + shield value + the defender's shield skill - the attacker's shield skill - 50 (a monster uses its effective dexterity for the skill; behind a tower shield, the lowest of its strength, constitution and effective dexterity). A defender who can't see the attacker loses 12, and one the attacker can't see gains 12. If the result is 0 or more, the chance to block is a tenth of the result plus half the shield value. Then, depending on the weapon: | |
| − | + | * <code>SHIELD_M_BLOCK</code>: within that chance the blow is stopped, and the shield takes the damage; | |
| − | + | * <code>SHIELD_M_REDUCE</code> (morning star, flail): within that chance the damage is cut by that many percent; | |
| − | + | * <code>SHIELD_M_USELESS</code> (whip): the shield doesn't help. | |
| − | + | Attack spells are blocked the same way, each spell with its own method in <code>vme/etc/spells.def</code>. See [[Help/Shields|help shields]]. | |
| − | |||
| − | + | <pre> | |
| − | + | oak_shield | |
| − | + | names {"oak shield", "shield"} | |
| − | + | title "an oak shield" | |
| − | + | descr "A round shield of oak lies here." | |
| − | + | SHIELD_DEF(SHIELD_MEDIUM, BONUS_AVERAGE, BONUS_AVERAGE) | |
| − | + | weight 10 | |
| − | + | cost 2 GOLD_PIECE | |
| − | + | end | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == Magic items == | |
| − | + | An item with magic should have <code>flags {UNIT_FL_MAGIC}</code>; the transfer macros and the potion, scroll, wand and staff macros set it themselves, <code>WEAPON_DEF</code>, <code>ARMOUR_*</code> and <code>SHIELD_DEF</code> don't. | |
| − | |||
| − | + | === Bonuses while worn === | |
| − | + | While an item is worn or wielded, transfers change the wearer: | |
| − | + | * <code>STR_TRANSFER(n)</code>, <code>DEX_TRANSFER</code>, <code>CON_TRANSFER</code>, <code>CHA_TRANSFER</code>, <code>BRA_TRANSFER</code>, <code>MAG_TRANSFER</code>, <code>DIV_TRANSFER</code>, <code>HIT_TRANSFER</code>: an ability; | |
| − | + | * <code>SKILL_TRANSFER(SKI_x, n)</code>, <code>SPELL_TRANSFER(SPL_x, n)</code>, <code>WEAPON_TRANSFER(WPN_x, n)</code>: a skill, a spell or a weapon skill; | |
| − | + | * <code>SPEED_TRANSFER(n)</code>, <code>SLOW_TRANSFER(n)</code>, <code>CHAR_FLAG_TRANSFER(flags)</code>, <code>PROTECTION_FROM_GOOD</code>, <code>PROTECTION_FROM_EVIL</code>. | |
| − | + | ''n'' is on the bonus scale, -7 to +7; when the item is loaded it becomes -10 to +10 points (the table is on [[Manual:Game Mechanics/Abilities#Items that change abilities|Abilities]]). A player can wear many items at once, so even small bonuses add up: give large ones rarely. Magic that changes abilities or skills has to be taken off before a teacher will train the player. | |
| − | |||
| − | + | === Identifying === | |
| + | The identify spells show an item's numbers, and two extras of your own: | ||
| + | * <code>extra {"$identify"}</code> is shown by identify and improved identify; | ||
| + | * <code>extra {"$improved identify"}</code> only by improved identify. | ||
| + | Use them on every magic item to tell the player what they hold: | ||
| + | <pre> | ||
| + | crown_of_lich | ||
| + | names {"black crown", "crown"} | ||
| + | title "a black crown" | ||
| + | descr "A black crown lies here." | ||
| + | manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_HEAD} | ||
| + | BRA_TRANSFER(BONUS_EXCELLENT) | ||
| + | extra {"$identify"} | ||
| + | "Once the crown of an undead king, it is said to sharpen the mind." | ||
| + | extra {"$improved identify"} | ||
| + | "The crown adds to the wearer's brain." | ||
| + | weight 2 | ||
| + | cost 50 GOLD_PIECE | ||
end | end | ||
| + | </pre> | ||
| − | + | === Potions, scrolls, wands and staffs === | |
| − | + | <code>POTION_DEF(power, spell1, spell2, spell3)</code>, <code>SCROLL_DEF(power, spell1, spell2, spell3)</code>, <code>WAND_DEF(power, charges, spell1, spell2)</code> and <code>STAFF_DEF(power, charges, spell1, spell2)</code>. ''power'' takes the place of the caster's skill and ability. Use <code>SPL_NONE</code> for a spell that isn't used; 0 is a real spell. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == Notes and signs == | |
| − | + | An extra with no names, <code>extra {}</code>, is shown when someone looks at the object itself, so it is the text of a note or a sign; <code>read</code> does the same as <code>look</code>. | |
| − | + | <pre> | |
| − | and | + | old_note |
| − | + | names {"old note", "note", "paper"} | |
| − | + | title "an old note" | |
| − | + | descr "An old note has been dropped here." | |
| − | + | manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD} | |
| − | + | extra {} | |
| − | + | "Written in blood: Help free the world of the evil behind these doors." | |
| − | + | extra {"blood"} | |
| − | + | "The blood is dried and brown." | |
| − | extra { | + | weight 1 |
| − | |||
| − | the | ||
| − | |||
| − | |||
| − | extra { | ||
| − | |||
| − | |||
end | end | ||
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == Limiting powerful items == | |
| − | + | Very good items should be rare. Load them with <code>max</code> in the <code>%reset</code> section, which counts the copies in the whole game, and from a monster that is hard to kill. The <code>rent</code> field charges players for keeping an item, per real day, but only when <code>rent</code> in <code>server.cfg</code> is above 0; it is 0 in the distributed configuration. | |
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 06:27, 15 November 2026
This page explains what the numbers on weapons, armour, shields and magic items do in the game, and gives guidelines for choosing them. How to write the objects themselves is in the Zone Manual, with all the macros on Object macros. The macros named here are in vme/include/wmacros.h, which macros.h includes.
Contents
Craftsmanship and magic
Weapons, armour and shields have two numbers: craftsmanship (value[1]), how well the item was made and of what, and the magic bonus (value[2]). Both are on the bonus scale from -7 to +7, with names in vme/include/values.h. vmc refuses a value outside it ("Illegal bonus (-7..+7 allowed)") and the zone doesn't compile.
When the item is loaded into the game, the server turns each into a combat bonus (bonus_map_a() in vme/src/common.cpp):
| Constant | Value | In the game |
|---|---|---|
BONUS_ARTIFACT |
7 | +20 |
BONUS_SUPERIOR |
6 | +17 |
BONUS_EXCELLENT_PLUS |
5 | +14 |
BONUS_EXCELLENT |
4 | +11 |
BONUS_GOOD_PLUS |
3 | +8 |
BONUS_GOOD |
2 | +5 |
BONUS_AVERAGE_PLUS |
1 | +2 |
BONUS_AVERAGE |
0 | 0 |
BONUS_AVERAGE_MINUS |
-1 | -2 |
BONUS_BAD |
-2 | -5 |
BONUS_BAD_MINUS |
-3 | -8 |
BONUS_TERRIBLE |
-4 | -11 |
BONUS_TERRIBLE_MINUS |
-5 | -14 |
BONUS_JUNK_ALMOST |
-6 | -17 |
BONUS_JUNK |
-7 | -20 |
A value that isn't 0 gets twice the open-ended roll divided by 100 added, so now and then an item comes out 2 or 4 points better (rarely worse). Craftsmanship and magic count the same in a fight: on a weapon they are added to the attack, on armour and shields to the defence (see Combat). The old manual's scale of -25% to +25%, with tables of materials, is gone; choose the craftsmanship from what the item is made of and how well. As a guide:
- an ordinary item is
BONUS_AVERAGE; don't punish a club for being wood, or a spear for having a wooden shaft; - rusty, cracked or makeshift items are below average; a sword made of wood is junk;
- fine work, or a better material such as steel, is good; mithril or the work of a master is excellent or better;
- a magic bonus makes an item magic: the item should also have
flags {UNIT_FL_MAGIC}so that detect magic finds it.
Wear and breaking
Craftsmanship also sets how much wear an item takes before it breaks. vmc gives it hit points (set_hits(); a hit field on the object is ignored):
| Craftsmanship | -7 | -5 | -3 | -1 | 0 | +1 | +3 | +5 | +7 |
|---|---|---|---|---|---|---|---|---|---|
| Hit points | 755 | 825 | 895 | 965 | 1,000 | 1,200 | 1,600 | 2,000 | 2,400 |
That is 1,000 + 200 per point above average, or 1,000 - 35 per point below. In a fight (damage_object() in vme/src/fight.cpp):
- a weapon that hits loses a quarter of the damage it does;
- the armour on the place that was hit loses the damage;
- a shield that blocks loses twice the damage the blow would have done;
in each case less the item's magic bonus, and then divided by 10. When its hit points go below 0, the item breaks: it gets "(broken)" after its title and becomes worthless trash.
Weapons
WEAPON_DEF(weapon_type, craftsmanship, magic_bonus)
weapon_type is one of the WPN_* weapon types in vme/include/values.h, such as WPN_LONG_SWORD or WPN_DAGGER. The families (WPN_SWORD, WPN_AXE_HAM...) are not weapon types, and vmc refuses them. The macro also sets the type, MANIPULATE_TAKE and MANIPULATE_WIELD. See weapon definitions.
Everything else about a weapon type is in vme/etc/weapons.def:
| Field | What it is |
|---|---|
sphere |
the family, which decides the skill a player falls back on |
hands |
1 or 2 |
speed |
how much of a combat round a blow takes: 9 for two-handed weapons, 7 for one-handed, 4 for light ones like the dagger, 2 for natural attacks (4 is the least that counts) |
fumble |
a roll of this or less is a fumble: the blow misses and costs half a round |
ability |
the three abilities averaged for the attack, mostly strength, strength, dexterity |
shield |
whether a shield can block the blow (SHIELD_M_BLOCK), only soften it (SHIELD_M_REDUCE), or not help at all (SHIELD_M_USELESS)
|
attack clothes ... attack plate |
the damage table against each kind of armour |
Each damage entry is three numbers {offset, base, step}: a blow whose result reaches the offset does base + (result - offset) / step damage; below the offset it does none. For example:
| Weapon | Speed | Fumble | vs clothes | vs soft leather | vs hard leather | vs chain | vs plate |
|---|---|---|---|---|---|---|---|
| battle axe (2 hands) | 9 | 5 | {60, 10, 4} | {50, 9, 5} | {40, 8, 6} | {35, 7, 7} | {30, 6, 8} |
| long sword | 7 | 7 | {50, 7, 6} | {50, 6, 7} | {50, 5, 8} | {50, 4, 9} | {50, 3, 10} |
| dagger | 4 | 2 | {40, 3, 12} | {50, 2, 13} | {60, 1, 14} | {80, 1, 15} | {100, 1, 16} |
Light weapons are fast and seldom fumble but do little against heavy armour; two-handed weapons hit hardest. Many weapon types share the same table: the comment at the top of weapons.def lists which.
Examples:
rusty_dagger
names {"rusty dagger", "dagger"}
title "a rusty dagger"
descr "A rusty dagger lies here."
WEAPON_DEF(WPN_DAGGER, BONUS_BAD, BONUS_AVERAGE)
weight 1
cost 4 COPPER_PIECE
end
orcbane
names {"orcbane", "long sword", "sword"}
title "the long sword Orcbane"
descr "A long sword with runes on its blade lies here."
WEAPON_DEF(WPN_LONG_SWORD, BONUS_GOOD, BONUS_GOOD_PLUS)
WEAPON_SLAYER(RACE_ORC)
weight 8
cost 20 GOLD_PIECE
end
Slaying weapons
WEAPON_SLAYER(race) makes a weapon a slayer of one race; WEAPON_SLAYER_DRAGONS of all dragons (an extra $slayer with the range of races). Both also set UNIT_FL_MAGIC. Put them after WEAPON_DEF, which would otherwise overwrite them. Against that race, the attack gets 50 more, plus 1 for each level the victim is above 50, and a blow that hits is looked up in the damage table a fifth higher.
Armour
ARMOUR_CLOTHES(craftsmanship, magic_bonus) ARMOUR_LEATHER(...) ARMOUR_HRD_LEATHER(...) ARMOUR_CHAIN(...) ARMOUR_PLATE(...) ARMOUR_DEF(ARM_CHAIN, craftsmanship, magic_bonus)
The macros set only MANIPULATE_TAKE: add the place where it is worn. Armour protects only where a blow can land. Each blow lands on one place, found with 2d8:
| Place | Wear flag | Chance |
|---|---|---|
| body | MANIPULATE_WEAR_BODY |
34% |
| legs | MANIPULATE_WEAR_LEGS |
28% |
| arms | MANIPULATE_WEAR_ARMS |
23% |
| head | MANIPULATE_WEAR_HEAD |
5% |
| hands | MANIPULATE_WEAR_HANDS |
5% |
| feet | MANIPULATE_WEAR_FEET |
5% |
The armour worn there decides two things: which column of the weapon's damage table is used, and its craftsmanship and magic are added to the defence. Where nothing is worn, the character's natural armour is used (clothes for a player) with no bonus. Armour of another kind, a cloak about the body for instance, gives no protection.
Heavier armour lowers the wearer's dexterity in a fight, unless they are strong and practised in it; see Abilities. Plate is the best protection and the heaviest burden.
chain_shirt
names {"chain mail shirt", "chain shirt", "shirt"}
title "a chain mail shirt"
descr "A chain mail shirt lies here in a heap."
ARMOUR_CHAIN(BONUS_AVERAGE_PLUS, BONUS_AVERAGE)
manipulate {MANIPULATE_WEAR_BODY}
weight 25
cost 8 GOLD_PIECE
end
Shields
SHIELD_DEF(shield_type, craftsmanship, magic_bonus)
The shield types are SHIELD_SMALL, SHIELD_MEDIUM and SHIELD_LARGE. The server also knows SHIELD_TOWER, but vmc refuses it. The macro sets MANIPULATE_TAKE and MANIPULATE_WEAR_SHIELD.
When a blow hits, a defender who is awake and has a shield tries to use it (shield_bonus() in vme/src/experience.cpp). The shield's own value is 15 for a small shield, 20 medium, 25 large, 35 tower, plus its craftsmanship and magic. Then an opposed check: roll + shield value + the defender's shield skill - the attacker's shield skill - 50 (a monster uses its effective dexterity for the skill; behind a tower shield, the lowest of its strength, constitution and effective dexterity). A defender who can't see the attacker loses 12, and one the attacker can't see gains 12. If the result is 0 or more, the chance to block is a tenth of the result plus half the shield value. Then, depending on the weapon:
SHIELD_M_BLOCK: within that chance the blow is stopped, and the shield takes the damage;SHIELD_M_REDUCE(morning star, flail): within that chance the damage is cut by that many percent;SHIELD_M_USELESS(whip): the shield doesn't help.
Attack spells are blocked the same way, each spell with its own method in vme/etc/spells.def. See help shields.
oak_shield
names {"oak shield", "shield"}
title "an oak shield"
descr "A round shield of oak lies here."
SHIELD_DEF(SHIELD_MEDIUM, BONUS_AVERAGE, BONUS_AVERAGE)
weight 10
cost 2 GOLD_PIECE
end
Magic items
An item with magic should have flags {UNIT_FL_MAGIC}; the transfer macros and the potion, scroll, wand and staff macros set it themselves, WEAPON_DEF, ARMOUR_* and SHIELD_DEF don't.
Bonuses while worn
While an item is worn or wielded, transfers change the wearer:
STR_TRANSFER(n),DEX_TRANSFER,CON_TRANSFER,CHA_TRANSFER,BRA_TRANSFER,MAG_TRANSFER,DIV_TRANSFER,HIT_TRANSFER: an ability;SKILL_TRANSFER(SKI_x, n),SPELL_TRANSFER(SPL_x, n),WEAPON_TRANSFER(WPN_x, n): a skill, a spell or a weapon skill;SPEED_TRANSFER(n),SLOW_TRANSFER(n),CHAR_FLAG_TRANSFER(flags),PROTECTION_FROM_GOOD,PROTECTION_FROM_EVIL.
n is on the bonus scale, -7 to +7; when the item is loaded it becomes -10 to +10 points (the table is on Abilities). A player can wear many items at once, so even small bonuses add up: give large ones rarely. Magic that changes abilities or skills has to be taken off before a teacher will train the player.
Identifying
The identify spells show an item's numbers, and two extras of your own:
extra {"$identify"}is shown by identify and improved identify;extra {"$improved identify"}only by improved identify.
Use them on every magic item to tell the player what they hold:
crown_of_lich
names {"black crown", "crown"}
title "a black crown"
descr "A black crown lies here."
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_HEAD}
BRA_TRANSFER(BONUS_EXCELLENT)
extra {"$identify"}
"Once the crown of an undead king, it is said to sharpen the mind."
extra {"$improved identify"}
"The crown adds to the wearer's brain."
weight 2
cost 50 GOLD_PIECE
end
Potions, scrolls, wands and staffs
POTION_DEF(power, spell1, spell2, spell3), SCROLL_DEF(power, spell1, spell2, spell3), WAND_DEF(power, charges, spell1, spell2) and STAFF_DEF(power, charges, spell1, spell2). power takes the place of the caster's skill and ability. Use SPL_NONE for a spell that isn't used; 0 is a real spell.
Notes and signs
An extra with no names, extra {}, is shown when someone looks at the object itself, so it is the text of a note or a sign; read does the same as look.
old_note
names {"old note", "note", "paper"}
title "an old note"
descr "An old note has been dropped here."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
extra {}
"Written in blood: Help free the world of the evil behind these doors."
extra {"blood"}
"The blood is dried and brown."
weight 1
end
Limiting powerful items
Very good items should be rare. Load them with max in the %reset section, which counts the copies in the whole game, and from a monster that is hard to kill. The rent field charges players for keeping an item, per real day, but only when rent in server.cfg is above 0; it is 0 in the distributed configuration.