Class: RPG::Class

Inherits:
BaseItem show all
Extended by:
RgssDb::JsonableConstructor
Includes:
RgssDb::Jsonable
Defined in:
lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb,
lib/rgss_db/model/rpg_maker_data/xp/rpg/class.rb,
lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class.rb,
lib/rgss_db/model/rpg_maker_data/vx/rpg/class_learning.rb,
lib/rgss_db/model/rpg_maker_data/xp/rpg/class_learning.rb,
lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class_learning.rb

Overview

The data class for class.

Defined Under Namespace

Classes: Learning

Instance Attribute Summary collapse

Attributes inherited from BaseItem

#description, #features, #icon_index, #note

Instance Method Summary collapse

Methods included from RgssDb::JsonableConstructor

json_create, json_new

Methods included from RgssDb::Jsonable

#as_json, #to_json

Constructor Details

#initializeClass

Returns a new instance of Class.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 11

def initialize
  @id = 0
  @name = ""
  @position = 0
  @weapon_set = []
  @armor_set = []
  @element_ranks = Table.new(1)
  @state_ranks = Table.new(1)
  @learnings = []
  @skill_name_valid = false
  @skill_name = ""
end

Instance Attribute Details

#armor_setObject

Returns the value of attribute armor_set.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def armor_set
  @armor_set
end

#element_ranksObject

Returns the value of attribute element_ranks.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def element_ranks
  @element_ranks
end

#exp_paramsObject

Returns the value of attribute exp_params.



35
36
37
# File 'lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class.rb', line 35

def exp_params
  @exp_params
end

#idObject

Returns the value of attribute id.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def id
  @id
end

#learningsObject

Returns the value of attribute learnings.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def learnings
  @learnings
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def name
  @name
end

#paramsObject

Returns the value of attribute params.



35
36
37
# File 'lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class.rb', line 35

def params
  @params
end

#positionObject

Returns the value of attribute position.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def position
  @position
end

#skill_nameObject

Returns the value of attribute skill_name.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def skill_name
  @skill_name
end

#skill_name_validObject

Returns the value of attribute skill_name_valid.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def skill_name_valid
  @skill_name_valid
end

#state_ranksObject

Returns the value of attribute state_ranks.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def state_ranks
  @state_ranks
end

#weapon_setObject

Returns the value of attribute weapon_set.



28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 28

def weapon_set
  @weapon_set
end

Instance Method Details

#exp_for_level(level) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class.rb', line 25

def exp_for_level(level)
  lv = level.to_f
  basis = @exp_params[0].to_f
  extra = @exp_params[1].to_f
  acc_a = @exp_params[2].to_f
  acc_b = @exp_params[3].to_f
  (basis * ((lv - 1)**(0.9 + acc_a / 250)) * lv * (lv + 1) / (6 + lv**2 / 50 / acc_b) + (lv - 1) * extra)
    .round.to_i
end

#to_sObject



24
25
26
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb', line 24

def to_s
  @name.to_s
end