class Oakdex::Battle::StatusConditions::Freeze

Represents Freeze status condition

Public Instance Methods

after_received_damage(move_execution) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

defrost(battle) click to toggle source
# File lib/oakdex/battle/status_conditions/freeze.rb, line 27
def defrost(battle)
  pokemon.remove_status_condition(self)
  battle.add_to_log('defrosts',
                    pokemon.trainer.name,
                    pokemon.name)
end