Critical Hits now affect boss damage fixes #5429 (#8092)

* Moved critical hit calculation from _addPoints() to _calculateDelta(). Added user as an input argument to _calculateDelta() so for critical hit calculation

* Changed test to expect task value of 1.5 after critical hit

* Revert "Moved critical hit calculation from _addPoints() to _calculateDelta(). Added user as an input argument to _calculateDelta() so for critical hit calculation"

This reverts commit 51b8ab6498.

* Moved critical hit calculation to _changeTaskValue(). Use value stored in user._tmp.crit in _addPoints()

* Test is no longer affected by critical hits

* Removed unneeded comment

* Added WIP test of critical hits

* Want the crit function to return 2 to test critical hits

* Changed crit function to export as a function within an object so that it can be stubbed for testing. References to the crit() function were updated to call crit.crit() instead

* Added test for increased experience on critical hits
This commit is contained in:
Alyssa Batula
2017-01-18 10:11:39 -05:00
committed by Keith Holliday
parent fa024e071b
commit 016447ec77
5 changed files with 43 additions and 11 deletions
+4 -2
View File
@@ -1,10 +1,12 @@
import predictableRandom from './predictableRandom';
module.exports = function crit (user, stat = 'str', chance = 0.03) {
function crit (user, stat = 'str', chance = 0.03) {
let s = user._statsComputed[stat];
if (predictableRandom(user) <= chance * (1 + s / 100)) {
return 1.5 + 4 * s / (s + 200);
} else {
return 1;
}
};
}
module.exports = { crit };