Class: Improves::RatingBoost
- Inherits:
-
ImproveHunter
- Object
- ImproveHunter
- Improves::RatingBoost
- Defined in:
- app/services/improves/rating_boost.rb
Overview
Used to apply an Improvements::RatingBoost to a hunter if the hunter is a valid target
Instance Method Summary collapse
- #improve ⇒ Object
-
#initialize(hunters_improvement) ⇒ RatingBoost
constructor
A new instance of RatingBoost.
- #over_max_limit? ⇒ Boolean
- #valid? ⇒ Boolean
Methods inherited from ImproveHunter
#check, for, #hunter_not_advanced?, #hunter_playbook_mismatch?
Constructor Details
#initialize(hunters_improvement) ⇒ RatingBoost
Returns a new instance of RatingBoost.
7 8 9 10 |
# File 'app/services/improves/rating_boost.rb', line 7 def initialize(hunters_improvement) super @rating = @improvement.(@hunters_improvement) end |
Instance Method Details
#improve ⇒ Object
12 13 14 15 16 |
# File 'app/services/improves/rating_boost.rb', line 12 def improve return false unless valid? = { @rating => @hunter.send(@rating) + 1 } @hunter.update() end |
#over_max_limit? ⇒ Boolean
25 26 27 |
# File 'app/services/improves/rating_boost.rb', line 25 def over_max_limit? @hunter.send(@rating) >= @improvement.stat_limit end |
#valid? ⇒ Boolean
18 19 20 21 22 23 |
# File 'app/services/improves/rating_boost.rb', line 18 def valid? super check :over_max_limit?, :hunter, "#{@rating} rating would exceed max for improvement." @hunters_improvement.errors.none? end |