Class: Studio::Type

Inherits:
Object show all
Defined in:
scripts/00800 Studio/00001 Data/00071 Type.rb

Overview

Data class describing a type

Defined Under Namespace

Classes: DamageTo

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colorColor? (readonly)

Color of the type

Returns:



22
23
24
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 22

def color
  @color
end

#damage_toArray<DamageTo> (readonly)

List of damage the type deals to another type

Returns:



18
19
20
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 18

def damage_to
  @damage_to
end

#db_symbolSymbol (readonly)

db_symbol of the type

Returns:

  • (Symbol)


10
11
12
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 10

def db_symbol
  @db_symbol
end

#idInteger (readonly)

ID of the type

Returns:



6
7
8
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 6

def id
  @id
end

#text_idInteger (readonly)

ID of the text of the type in the text files

Returns:



14
15
16
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 14

def text_id
  @text_id
end

Instance Method Details

#hit(other_type) ⇒ Float

Get the modifier of this type when hitting another type

Parameters:

  • other_type (Symbol)

    db_symbol of the other type

Returns:

  • (Float)


33
34
35
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 33

def hit(other_type)
  return damage_to.find { |damage| damage.defensive_type == other_type }&.factor || 1
end

#nameString

Get the text name of the type

Returns:



26
27
28
# File 'scripts/00800 Studio/00001 Data/00071 Type.rb', line 26

def name
  return text_get(3, @text_id)
end