Class: Studio::Group::Encounter::ShinySetup

Inherits:
Object
  • Object
show all
Defined in:
scripts/00800 Studio/00001 Data/00011 Group.rb

Overview

Data class helping to know the shiny setup of a creature

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ ShinySetup

Create a new shiny setup

Parameters:

  • hash (Hash)

    shiny setup info



115
116
117
118
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 115

def initialize(hash)
  @kind = hash['kind'].to_sym
  @rate = hash['rate'].to_f
end

Instance Method Details

#not_shinyBoolean

Get the forbid shiny attribute

Returns:

  • (Boolean)


131
132
133
134
135
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 131

def not_shiny
  return false if @kind == :automatic

  return @rate == 0
end

#shiny(rate = rand) ⇒ Boolean

Get the shiny attribute of the creature

Parameters:

  • rate (Float) (defaults to: rand)

    current rate to guess the creature shiny rate

Returns:

  • (Boolean)


123
124
125
126
127
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 123

def shiny(rate = rand)
  return false if @kind == :automatic

  return @rate > rate
end