class Oakdex::Battle::StatusConditions::BadlyPoisoned
Represents BadlyPoisoned
status condition
Public Class Methods
new(pokemon)
click to toggle source
Calls superclass method
# File lib/oakdex/battle/status_conditions/badly_poisoned.rb, line 6 def initialize(pokemon) super @turn_count = 0 end
Public Instance Methods
after_switched_out(_battle)
click to toggle source
# File lib/oakdex/battle/status_conditions/badly_poisoned.rb, line 20 def after_switched_out(_battle) @turn_count = 0 end
after_turn(turn)
click to toggle source
# File lib/oakdex/battle/status_conditions/badly_poisoned.rb, line 11 def after_turn(turn) return if pokemon.fainted? turn.battle.add_to_log('damage_by_badly_poisoned', pokemon.trainer.name, pokemon.name, hp_by_turn) pokemon.change_hp_by(hp_by_turn) @turn_count += 1 end
Private Instance Methods
hp_by_turn()
click to toggle source
# File lib/oakdex/battle/status_conditions/badly_poisoned.rb, line 26 def hp_by_turn [-(pokemon.hp * percent).to_i, -1].min end
percent()
click to toggle source
# File lib/oakdex/battle/status_conditions/badly_poisoned.rb, line 30 def percent ([@turn_count.to_f, 15].min + 1) / 16.0 end