Class: Oakdex::Battle::StatusConditions::BadlyPoisoned

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

Overview

Represents BadlyPoisoned 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_received_damage, #before_turn, #damage_modifier, #prevents_move?, #stat_modifier

Constructor Details

#initialize(pokemon) ⇒ BadlyPoisoned

Returns a new instance of BadlyPoisoned.



6
7
8
9
# File 'lib/oakdex/battle/status_conditions/badly_poisoned.rb', line 6

def initialize(pokemon)
  super
  @turn_count = 0
end

Instance Method Details

#after_switched_out(_battle) ⇒ Object



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

def after_switched_out(_battle)
  @turn_count = 0
end

#after_turn(turn) ⇒ Object



11
12
13
14
15
16
17
18
# 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