diff options
author | David Gay <david@davidgay.org> | 2021-06-07 19:49:17 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-07 19:49:17 -0400 |
commit | 831e3ff7f43ae7acf2aaf589c4f0794649da4f85 (patch) | |
tree | 0b456dc5c05fa4e631085a560dc2ab78fbe77f19 | |
parent | 39ff6a5146cd81c5d6c245b2ceb2ec14d0693520 (diff) |
Allow negative resistances, speed, accuracy, power, and evasion
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | app/models/character.rb | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ef00d5..70983fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ All notable changes to this project will be documented in this file. ### General - You now receive an informative message when someone buys or sells items to you via one of your bazaar orders. +### Combat +- The following stats can now be negative: resistances, speed, accuracy, power, and evasion + ### Monsters - Stalk beast - Bash resistance 6 -> 4 diff --git a/app/models/character.rb b/app/models/character.rb index 15169a4..f2c450e 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -339,7 +339,7 @@ class Character < ApplicationRecord res = (res * 0.75).ceil if elusive? res = (res * 1.25).floor if protective? - [res, 0].max + res end def max_wounds @@ -351,11 +351,11 @@ class Character < ApplicationRecord end def speed - [self.beastslay_level + total_stat_change("speed"), 0].max + self.beastslay_level + total_stat_change("speed") end def accuracy(with_combat_style: false) - base = [self.beastslay_level + total_stat_change("accuracy"), 0].max + base = self.beastslay_level + total_stat_change("accuracy") if with_combat_style && self.precise? base = (base * 1.25).floor elsif with_combat_style && self.brutal? @@ -365,7 +365,7 @@ class Character < ApplicationRecord end def power(with_combat_style: false) - base = [self.beastslay_level + total_stat_change("power"), 0].max + base = self.beastslay_level + total_stat_change("power") if with_combat_style && self.precise? base = (base * 0.75).ceil elsif with_combat_style && self.brutal? @@ -375,7 +375,7 @@ class Character < ApplicationRecord end def evasion(with_combat_style: false) - base = [self.beastslay_level + total_stat_change("evasion"), 0].max + base = self.beastslay_level + total_stat_change("evasion") if with_combat_style && self.elusive? base = (base * 1.25).floor elsif with_combat_style && self.protective? |