From b923b0febd35ba1b635dde02a7f97428367f7831 Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 26 May 2021 21:59:47 -0400 Subject: Implement activity speed increases from HAs, add lab 2, and tweak some construct costs --- app/models/character.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/models') 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? -- cgit v1.2.3