summaryrefslogtreecommitdiff
path: root/app/models/character.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/character.rb')
-rw-r--r--app/models/character.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/character.rb b/app/models/character.rb
index 74dbe9f..0f434cf 100644
--- a/app/models/character.rb
+++ b/app/models/character.rb
@@ -321,10 +321,17 @@ class Character < ApplicationRecord
end
def resistance(damage_type)
- unless %w[slash pierce bash arcane fire frost lightning acid thunder radiant necrotic poison bleed].include?(damage_type)
+ unless %w[slash pierce bash arcane fire frost lightning acid thunder radiant necrotic poison
+ bleed physical energy].include?(damage_type)
raise "Invalid damage type"
end
- [total_stat_change("#{damage_type}_resistance"), 0].max
+ res = total_stat_change("#{damage_type}_resistance")
+ if %w[slash pierce bash].include?(damage_type)
+ res += resistance("physical")
+ elsif %w[arcane fire frost lightning acid thunder radiant necrotic].include?(damage_type)
+ res += resistance("energy")
+ end
+ [res, 0].max
end
def max_wounds