Class: Configs::States

Inherits:
Object show all
Defined in:
scripts/00800 Studio/00000 Configs/00003 States.rb

Overview

Configuration of states

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStates

Returns a new instance of States.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 8

def initialize
  @ids = {
    poison: 1,
    paralysis: 2,
    burn: 3,
    sleep: 4,
    freeze: 5,
    confusion: 6,
    toxic: 8,
    death: 9,
    ko: 9,
    flinch: 7
  }
end

Instance Attribute Details

#idsHash<Symbol => Integer>

Get the ID of states

Returns:



6
7
8
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 6

def ids
  @ids
end

Instance Method Details

#symbol(id) ⇒ Symbol?

Get the symbol of a state from its id

Returns:

  • (Symbol, nil)


25
26
27
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 25

def symbol(id)
  @ids.key(id)
end

#to_json



29
30
31
32
33
34
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 29

def to_json(*)
  {
    klass: self.class.to_s,
    ids: @ids
  }.to_json
end