Class: Improves::AnotherMove
- Inherits:
-
ImproveHunter
- Object
- ImproveHunter
- Improves::AnotherMove
- Includes:
- Moveable
- Defined in:
- app/services/improves/another_move.rb
Overview
Used to apply an Improvements::AnotherMove to a hunter if the hunter is a valid target
Instance Method Summary collapse
- #improve ⇒ Object
-
#initialize(hunters_improvement) ⇒ AnotherMove
constructor
A new instance of AnotherMove.
- #valid? ⇒ Boolean
Methods included from Moveable
#already_advanced_moves?, #hunter_move_exists?, #invalid_move?, #move, #moves, #not_basic_moves?, #not_haven_move?, #playbook_move_match?, #playbook_move_mismatch?
Methods inherited from ImproveHunter
#check, for, #hunter_not_advanced?, #hunter_playbook_mismatch?
Constructor Details
#initialize(hunters_improvement) ⇒ AnotherMove
Returns a new instance of AnotherMove.
9 10 11 12 |
# File 'app/services/improves/another_move.rb', line 9 def initialize(hunters_improvement) super move end |
Instance Method Details
#improve ⇒ Object
14 15 16 17 |
# File 'app/services/improves/another_move.rb', line 14 def improve return false unless valid? @hunter.moves << move end |
#valid? ⇒ Boolean
19 20 21 22 23 24 25 26 |
# File 'app/services/improves/another_move.rb', line 19 def valid? super check :playbook_move_match?, :move, 'matches improvement playbook' check :hunter_move_exists?, :hunter, "already has move with id #{@move&.id}" @hunters_improvement.errors.none? end |