Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0006397Dwarf FortressDwarf Mode -- Trapspublic2013-12-21 08:262015-01-19 20:37
Quietust 
Toady One 
normalminorhave not tried
resolvedfixed 
0.34.11 
0.40.24 
0006397: Nonlethal fall onto upright spike causes unreasonably high skill gain
As 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.
http://www.bay12forums.com/smf/index.php?topic=134512.0 [^]
binary patch
related to 0003855confirmed Footkerchief Upright spear/spike traps, if constantly toggled, will rapidly train dwarves' skills ("danger room" exploit) 
Issue History
2013-12-21 08:26QuietustNew Issue
2013-12-24 14:32Knight OtuRelationship addedrelated to 0003855
2014-03-14 00:32UristDaVinciNote Added: 0024604
2014-03-14 00:32UristDaVinciTag Attached: binary patch
2014-03-15 18:52FootkerchiefNote Edited: 0024604bug_revision_view_page.php?bugnote_id=0024604#r9203
2014-03-17 21:33UristDaVinciNote Edited: 0024604bug_revision_view_page.php?bugnote_id=0024604#r9204
2014-03-25 13:43DwarfuAssigned To => Dwarfu
2014-03-25 13:43DwarfuStatusnew => acknowledged
2014-05-12 00:58UristDaVinciNote Added: 0024753
2014-05-12 01:02UristDaVinciNote Added: 0024754
2014-08-13 18:33UristDaVinciNote Added: 0029006
2014-08-13 18:354maskwolfIssue Monitored: 4maskwolf
2014-10-30 03:32cybergonNote Added: 0030801
2014-10-30 03:33cybergonIssue Monitored: cybergon
2014-10-30 11:12FootkerchiefStatusacknowledged => confirmed
2014-11-04 20:28roboticNote Added: 0030868
2014-12-31 11:29Toady OneStatusconfirmed => resolved
2014-12-31 11:29Toady OneFixed in Version => Next Version
2014-12-31 11:29Toady OneResolutionopen => fixed
2014-12-31 11:29Toady OneAssigned ToDwarfu => Toady One
2015-01-19 20:374maskwolfIssue End Monitor: 4maskwolf

Notes
(0024604)
UristDaVinci   
2014-03-14 00:32   
(edited on: 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.

(0024753)
UristDaVinci   
2014-05-12 00:58   
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.
(0024754)
UristDaVinci   
2014-05-12 01:02   
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.
(0029006)
UristDaVinci   
2014-08-13 18:33   
Related: in the notes for 0000089 Toady One mentions "In combat, you gain the attack skill roll of your opponent to your opposing skill."
(0030801)
cybergon   
2014-10-30 03:32   
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.
(0030868)
robotic   
2014-11-04 20:28   
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 [^]