View Issue Details

IDProjectCategoryView StatusLast Update
0006397Dwarf FortressDwarf Mode -- Trapspublic2015-01-19 20:37
ReporterQuietust Assigned ToToady One  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version0.34.11 
Fixed in Version0.40.24 
Summary0006397: Nonlethal fall onto upright spike causes unreasonably high skill gain
DescriptionAs discussed in the below-linked forum thread, both goblins and dwarves which fall 2 Z-levels onto an upright spike and survive appear to receive an inordinately large amount of experience in their weapon skill, Figher, and Shield User, enough to boost a Novice up to nearly Legendary+70.
Additional Informationhttp://www.bay12forums.com/smf/index.php?topic=134512.0
Tagsbinary patch

Relationships

related to 0003855 confirmeduser6 Upright spear/spike traps, if constantly toggled, will rapidly train dwarves' skills ("danger room" exploit) 

Activities

UristDaVinci

2014-03-14 00:32

reporter   ~0024604

Last edited: 2014-03-17 21:33

The following binary edit MITIGATES this problem in Win32 v0.34.11 SDL:
  0x006C3161 : 03 -> 31

This forces the upright spear to only hit as fast as a weapon trap, regardless of how fast you fall on it. Dwarves only gain about 125 xp with the patch, which is not enough to cause them to move beyond dabbling skill level. In comparison, arena testing shows a usual skill gain of about 3 xp for being stabbed with a spear by another creature. Upright weapons (and perhaps anything using the trap code) may be providing xp much faster than intended.

The bug appears to be due to the trap function being designed for word-sized speed numbers. It extracts the lower word of the dword-sized new projectile speed of the falling creature, does some math, and adds it to the base attack speed that all weapon traps share. My mitigation binary edit zeroes the extracted creature speed, causing the upright spear to attack just like a spear in a weapon trap.

I don't get why the super-fast trap would grant more XP, but nerfing the attack speed does lower the absurd XP gain.

UristDaVinci

2014-05-12 00:58

reporter   ~0024753

The cause of the absurd XP is as follows:

-In the trap code, the super-high attack speed is also used to calculate the "hit_rating".
-Traps use virtual projectile data structures to implement attacks.
-Projectiles have a "hit_rating". A skilled marksdwarf fires crossbow bolts that have a high hit_rating (about 100 to 200 or so). A dabbling marksdwarf shoots bolts that have low hit_rating (about 3-33 or so).
-The amount of experience gained by the victim of a crossbow bolt depends partially on the bolt's hit_rating. I.e. you gain more experience by being wounded by a skilled opponent than by an unskilled opponent.

If I edit a crossbow bolt in flight using DFHack to have a hit_rating of about 50000 or more, it causes the creature it strikes to gain massive amounts of skill and become a legendary fighter as per this bug.

UristDaVinci

2014-05-12 01:02

reporter   ~0024754

Suggested changes:
1. Put a cap on skill gains related to opponent's skill/accuracy.
2. Fix the formula that is converting the new parabolic projectile velocity.

UristDaVinci

2014-08-13 18:33

reporter   ~0029006

Related: in the notes for 0000089 Toady One mentions "In combat, you gain the attack skill roll of your opponent to your opposing skill."

cybergon

2014-10-30 03:32

reporter   ~0030801

Confirmed as still present in 40.14

Just made a fort exclusively for this, made a 3 tile deep pit with an upright wooden spear at the bottom, retired and made a human adventurer go jump inside that hole.

An interesting note is that when the weapon and shield were strapped on me, there was no gain whatsoever. And since the adventurer had no armor, I assume that's the reason it didn't gain legendary armor user status either. But when I drew the sword and shield then jumped in, bam! legendary swordsman and shield user.

robotic

2014-11-04 20:28

reporter   ~0030868

Uploaded a set of save files to illustrate this as I was curious, before and after the "lucky" fall that rocketed me into Legendary Fighter, Shield User and Swordsman. Had armor on (incomplete set, no gauntlets), Legendary Armor user skill was NOT gained.

http://dffd.wimbli.com/file.php?id=10026

Issue History

Date Modified Username Field Change
2013-12-21 08:26 Quietust New Issue
2013-12-24 14:32 user1294 Relationship added related to 0003855
2014-03-14 00:32 UristDaVinci Note Added: 0024604
2014-03-14 00:32 UristDaVinci Tag Attached: binary patch
2014-03-15 18:52 user6 Note Edited: 0024604
2014-03-17 21:33 UristDaVinci Note Edited: 0024604
2014-03-25 13:43 user11 Assigned To => user11
2014-03-25 13:43 user11 Status new => acknowledged
2014-05-12 00:58 UristDaVinci Note Added: 0024753
2014-05-12 01:02 UristDaVinci Note Added: 0024754
2014-08-13 18:33 UristDaVinci Note Added: 0029006
2014-10-30 03:32 cybergon Note Added: 0030801
2014-10-30 11:12 user6 Status acknowledged => confirmed
2014-11-04 20:28 robotic Note Added: 0030868
2014-12-31 11:29 Toady One Status confirmed => resolved
2014-12-31 11:29 Toady One Fixed in Version => Next Version
2014-12-31 11:29 Toady One Resolution open => fixed
2014-12-31 11:29 Toady One Assigned To user11 => Toady One