Making every sword usable in one hand or two
Swords took the spear's versatile flag, a grip decided from the hands and the skill, a class ability that asks that rule, and no save migration.
Every sword in the game can now be held in one hand or two, and nobody is asked which. If a party member knows Two-Handed and has nothing else in either hand, both hands go on the sword and it does 1.25 times its damage. With a shield or a second weapon beside it, or without the skill, it’s the one-handed sword it always was. I haven’t played it yet and I didn’t tune any number.
Why did swords need this?
The Samurai’s ability, Clean Cut, makes 15 percent of hits with a sword held in both hands do double damage. No sword in the game could be held in both hands, so the first version read it as a sword with nothing in the other hand. I was asked whether every sword should be versatile, with a recommendation of no, because it moves every sword’s numbers. I said to make them usable in one hand or two.
How does a sword know which grip it’s in?
The rule already existed for spears, so the work was to give swords the same flag. Each weapon type has a row in a data file, and the sword row now carries one more field:
{"skill": "sword", "speed": 4, "reach": 4, "damage": 1, "damage_type": "slashing", "versatile": true},
The grip is decided in WeaponRules from what’s in the hands and what the wielder knows. in_both_hands is true when a weapon is two-handed as made, or when it’s versatile, its wielder knows Two-Handed, and it’s the only thing in either hand. hands_used returns 0 for bare hands, 2 for a weapon in both hands and 1 otherwise, and the style code uses it to pick the two-handed style. That means the Two-Handed skill’s bonus applies too, at 1.1, 1.25, 1.5 and 2.0 times for ranks 10, 25, 50 and 100. held_damage then multiplies a versatile weapon’s damage by 1.25 while it’s in both hands, and leaves weapons that are two-handed as made alone, since they were already made with extra damage.
Clean Cut used to keep its own check for “both hands”. I deleted that, so the ability is now three lines: the main weapon is a sword, and WeaponRules.in_both_hands says yes. There’s one definition of a two-handed grip in the game, and the ability asks it.
What about old saves?
I didn’t write a migration. A saved item with an id takes every field of its definition when it loads, so an old save’s sword comes back versatile. A test loads a save from before the class change to check that. The other tests compare a loaded save with a fixture, so I added a helper that rewrites every sword in a fixture the way an old file had it (not versatile) before the comparison. The items baseline, which records every item’s numbers, was recorded again for the three swords.
What changed in the numbers?
A Samurai with a plain sword alone went from 77 to 91 a blow, and Clean Cut turns a 91 into 182. With a shield or a second weapon nothing changes. A Ninja, who also knows Two-Handed, went from 75 to 89, and a member without the skill is unchanged.
tests/swords_versatile has 169 checks. They cover the grips, Clean Cut over 600 rolls in each case, a member without Two-Handed, the spear as it was and the old save. At the merge I ran the suite by name, 24 tests, and 1 failed, save_schema, which fails the same way before this change.