Class: Oakdex::Battle::StatusConditions::Sleep
- Inherits:
-
NonVolatile
- Object
- Base
- NonVolatile
- Oakdex::Battle::StatusConditions::Sleep
- Defined in:
- lib/oakdex/battle/status_conditions/sleep.rb
Overview
Represents Sleep status condition
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #after_turn(turn) ⇒ Object
-
#initialize(pokemon) ⇒ Sleep
constructor
A new instance of Sleep.
- #prevents_move?(move_execution) ⇒ Boolean
Methods inherited from NonVolatile
Methods inherited from Base
#after_fainted, #after_received_damage, #after_switched_out, #before_turn, #damage_modifier, #stat_modifier
Constructor Details
#initialize(pokemon) ⇒ Sleep
Returns a new instance of Sleep.
6 7 8 9 10 |
# File 'lib/oakdex/battle/status_conditions/sleep.rb', line 6 def initialize(pokemon) super @turn_count = 0 @max_turn_count = rand(1..3) end |
Instance Method Details
#after_turn(turn) ⇒ Object
12 13 14 15 |
# File 'lib/oakdex/battle/status_conditions/sleep.rb', line 12 def after_turn(turn) wake_up(turn.battle) if @turn_count >= @max_turn_count @turn_count += 1 end |
#prevents_move?(move_execution) ⇒ Boolean
17 18 19 20 21 22 23 24 |
# File 'lib/oakdex/battle/status_conditions/sleep.rb', line 17 def prevents_move?(move_execution) move_execution .battle .add_to_log('sleeping', pokemon.trainer.name, pokemon.name) true end |