Class: Oakdex::Battle::StatusConditions::Freeze

Inherits:
NonVolatile show all
Defined in:
lib/oakdex/battle/status_conditions/freeze.rb

Overview

Represents Freeze status condition

Instance Attribute Summary

Attributes inherited from Base

#pokemon

Instance Method Summary collapse

Methods inherited from NonVolatile

#after_fainted

Methods inherited from Base

#after_fainted, #after_switched_out, #after_turn, #damage_modifier, #initialize, #stat_modifier

Constructor Details

This class inherits a constructor from Oakdex::Battle::StatusConditions::Base

Instance Method Details

#after_received_damage(move_execution) ⇒ Object



15
16
17
18
# File 'lib/oakdex/battle/status_conditions/freeze.rb', line 15

def after_received_damage(move_execution)
  return unless move_execution.move.type_id == 'fire'
  defrost(move_execution.battle)
end

#before_turn(turn) ⇒ Object



20
21
22
23
# File 'lib/oakdex/battle/status_conditions/freeze.rb', line 20

def before_turn(turn)
  return unless rand(1..100) <= 20
  defrost(turn.battle)
end

#prevents_move?(move_execution) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
# File 'lib/oakdex/battle/status_conditions/freeze.rb', line 6

def prevents_move?(move_execution)
  move_execution
    .battle
    .add_to_log('frozen',
                move_execution.pokemon.trainer.name,
                move_execution.pokemon.name)
  true
end