diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/character.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/character.rb b/app/models/character.rb index 073a986..c973d7d 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -118,6 +118,8 @@ class Character < ApplicationRecord case scaling_entry[:type] when "skill" duration -= self.skill_level(scaling_entry[:gid]) * scaling_entry[:scale_value] + when "stat" + duration -= self.total_stat_change(scaling_entry[:gid]) * scaling_entry[:scale_value] else raise "Invalid scaling type." # TODO: Improve this end @@ -181,7 +183,7 @@ class Character < ApplicationRecord end def total_stat_change(stat) - effects.filter_map { |e| e[:modifier] if e[:type] == "stat_change" }.sum + effects.filter_map { |e| e[:modifier] if e[:type] == "stat_change" && e[:stat] == stat }.sum end def can_fight? |