Class: PoorPokemon::Player

Inherits:
BasePlayer show all
Defined in:
lib/poor-pokemon/player.rb

Instance Attribute Summary

Attributes inherited from BasePlayer

#currentPokemon, #roster

Instance Method Summary collapse

Methods inherited from BasePlayer

#allDead?, #changeCurrent

Constructor Details

#initializePlayer

Returns a new instance of Player.



2
3
4
# File 'lib/poor-pokemon/player.rb', line 2

def initialize
    @roster = []
end

Instance Method Details

#add(pokemon) ⇒ Object



6
7
8
# File 'lib/poor-pokemon/player.rb', line 6

def add(pokemon)
    @roster.push(pokemon)
end

#validsObject



10
11
12
13
# File 'lib/poor-pokemon/player.rb', line 10

def valids
    #returns array of living pokemon

    @roster.select{|pokemon|pokemon.alive?}
end