class Oakdex::Battle::StatusConditions::Poison

Represents Poison status condition

Public Instance Methods

after_turn(turn) click to toggle source
# File lib/oakdex/battle/status_conditions/poison.rb, line 6
def after_turn(turn)
  return if pokemon.fainted?
  turn.battle.add_to_log('damage_by_poison',
                         pokemon.trainer.name,
                         pokemon.name, hp_by_turn)
  pokemon.change_hp_by(hp_by_turn)
end

Private Instance Methods

hp_by_turn() click to toggle source
# File lib/oakdex/battle/status_conditions/poison.rb, line 16
def hp_by_turn
  [-(pokemon.hp / 8).to_i, -1].min
end