Class: Improves::GainLuck
- Inherits:
-
ImproveHunter
- Object
- ImproveHunter
- Improves::GainLuck
- Defined in:
- app/services/improves/gain_luck.rb
Overview
Used to apply an Improvements::GainLuck to a hunter if the hunter is a valid target
Instance Method Summary collapse
Methods inherited from ImproveHunter
#check, for, #hunter_not_advanced?, #hunter_playbook_mismatch?, #initialize
Constructor Details
This class inherits a constructor from ImproveHunter
Instance Method Details
#improve ⇒ Object
7 8 9 10 |
# File 'app/services/improves/gain_luck.rb', line 7 def improve return false unless valid? @hunter.increment! :luck # rubocop:disable Rails/SkipsModelValidations end |
#max_luck? ⇒ Boolean
19 20 21 |
# File 'app/services/improves/gain_luck.rb', line 19 def max_luck? @hunter.luck >= Hunter::MAX_LUCK end |
#valid? ⇒ Boolean
12 13 14 15 16 17 |
# File 'app/services/improves/gain_luck.rb', line 12 def valid? super check :max_luck?, :hunter, 'already has maximum luck' @hunters_improvement.errors.none? end |