Issue Data
|
Issue #29500: Traps Ignore Disease Resistance
tl;dr: The TrapHitBase script ignores player disease resistance, fix attached using the same method as used for the new Survival diseases in the unofficial survival patch.
This probably never got noticed because the chance of contracting disease from a trap is very low (usually 1-2%), and vampires and werewolves have a separate check that makes them immune, and so only players who have 100+ disease immunity and aren't werewolves or vampires would have noticed. Players with less than 100 disease immunity would probably think they were just very unlucky. An easy way to confirm the bug's existence is to take a vanilla trap like the Dwemer Thresher, change the DiseaseChance property on TrapHitBase to 100.0 so that the trap will try to apply the disease on every hit (instead of only 1% of the time), and equip a necklace of disease immunity. You'll still get diseases after every hit. Based on this it doesn't appear that AddSpell checks the player's disease resistance before applying a disease. With the fix, it behaves as expected. So if the trap had a 1% chance of infecting the player, and the player had 50 disease resistance, we would expect the final chance of a disease to be 0.5%. As seen here: Float diseaseResistMult = Game.GetPlayer().GetActorValue("DiseaseResist") if canDisease && isPlayer && C00.PlayerHasBeastBlood == false && PlrVampQuest.VampireStatus == 0 && diseaseResistMult < 100.0 ;if randomFloat(0.0, 100.0) <= diseaseChance Float chance = diseaseChance * (100.0 - diseaseResistMult) Float result = utility.RandomFloat(1.0, 10000.0) if result <= chance int diseasePick diseasePick = randomInt(1,6) A disease is applied if the random float is 50.0 or less out of 10000.0, which is a 0.5% chance as expected. Attached Files: Trap Disease Fix.zip |