class Creatures

a collection for managing all of the creatures in a room

Constants

ARCHETYPES
BY_NAME
METADATA
METADATA_URL
STATES

Public Class Methods

bounty() click to toggle source
# File lib/Olib/combat/creatures.rb, line 69
def self.bounty
  select do |creature|
    creature.name.include?(Bounty.creature)
  end
end
fetch() click to toggle source
# File lib/Olib/combat/creatures.rb, line 44
def Creatures.fetch
  unsafe.select do |creature| 
    creature.aggressive?
  end.reject do |creature| 
      creature.tags.include?(:companion) || 
      creature.tags.include?(:familiar)  || 
      creature.gone?                     || 
      creature.name =~ /nest/
  end
end
fetch_metadata!() click to toggle source
# File lib/Olib/combat/creatures.rb, line 22
def Creatures.fetch_metadata!
  begin
    JSON.parse Net::HTTP.get URI METADATA_URL
  rescue
    puts $!
    puts $!.backtrace[0..1]
    []
  end
end
living() click to toggle source
# File lib/Olib/combat/creatures.rb, line 63
def self.living
  reject do |creature|
    creature.undead?
  end
end
unsafe() click to toggle source
# File lib/Olib/combat/creatures.rb, line 38
def Creatures.unsafe
  (GameObj.npcs || [])
    .map do |obj| Creature.new obj end
    .reject do |creature| creature.gone? end
end