class Pokemongodb::Type
Public Class Methods
all()
click to toggle source
Returns array of all available Types.
Example:
>> Pokemongodb::Type.all => [Pokemongodb::Type::Bug, ..., Pokemongodb::Type::Water]
# File lib/pokemongodb/type.rb, line 9 def self.all [ Type::Bug, Type::Dark, Type::Dragon, Type::Electric, Type::Fairy, Type::Fighting, Type::Fire, Type::Flying, Type::Ghost, Type::Grass, Type::Ground, Type::Ice, Type::Normal, Type::Poison, Type::Psychic, Type::Rock, Type::Steel, Type::Water ] end
locations()
click to toggle source
Returns array of locations where type spawns
Example:
>> Pokemongodb::Type::Normal.locations => [Pokemongodb::Location::CollegeCampus, Pokemongodb::Location::ParkingLot, ...]
# File lib/pokemongodb/type.rb, line 37 def self.locations Pokemongodb::Location.all.select do |location| location.types.include?(self) end end
strong_against()
click to toggle source
Returns array of types where both the offense and defense are strong.
Example:
>> Pokemongodb::Type::Steel.strong_against => [Pokemongodb::Type::Fairy, Pokemongodb::Type::Ice, Pokemongodb::Type::Rock]
# File lib/pokemongodb/type.rb, line 48 def self.strong_against self.offense_strong & self.defense_strong end
weak_against()
click to toggle source
Returns array of types where both the offense and defense are weak.
Example:
>> Pokemongodb::Type::Grass.weak_against => [Pokemongodb::Type::Bug, Pokemongodb::Type::Fire, Pokemongodb::Type::Flying, Pokemongodb::Type::Poison]
# File lib/pokemongodb/type.rb, line 57 def self.weak_against self.offense_weak & self.defense_weak end
Protected Class Methods
defense_strong()
click to toggle source
Returns array of types where you have a strong defense.
Example:
>> Pokemongodb::Type::Dark.defense_strong => [Pokemongodb::Type::Dark, Pokemongodb::Type::Ghost]
# File lib/pokemongodb/type.rb, line 67 def self.defense_strong all.select { |type| type.offense_weak.include?(self) } end
defense_weak()
click to toggle source
Returns array of types where you have a weak defense.
Example:
>> Pokemongodb::Type::Bug.defense_weak => [Pokemongodb::Type::Flying, Pokemongodb::Type::Fire, Pokemongodb::Type::Dark]
# File lib/pokemongodb/type.rb, line 76 def self.defense_weak all.select { |type| type.offense_strong.include?(self) } end