Class: FFXI::SkillupCalculator

Inherits:
Util::RubyBean show all
Includes:
Constants
Defined in:
lib/Vana/skillup_calculator.rb

Constant Summary

Constants included from Constants

Constants::BASIS_DATE, Constants::DAY, Constants::HOUR, Constants::MINUTE, Constants::MOON_DATE, Constants::MS_BASIS_DATE, Constants::MS_BASIS_VANA, Constants::MS_DAY, Constants::MS_GAME_DAY, Constants::MS_HOUR, Constants::MS_MINUTE, Constants::MS_MONTH, Constants::MS_MOON_DATE, Constants::MS_SECOND, Constants::MS_YEAR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Util::RubyBean

#add_listener, #has_listeners?, property, #remove_listener

Constructor Details

#initialize(opts = {}) ⇒ SkillupCalculator

Returns a new instance of SkillupCalculator.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/Vana/skillup_calculator.rb', line 13

def initialize(opts={})
 super()

 add_listener(opts[:listener]) if opts[:listener]

 @recipe_cap = opts[:recipe_cap] || 0
 @skill = opts[:skill] || 0
 update_base_difficulty

 @crystal_element = opts[:crystal_element] if opts[:crystal_element]

 if opts[:vana_day] and opts[:vana_moon]
  update_day_and_moon(opts[:vana_day], opts[:vana_moon])
 end
end

Instance Attribute Details

#crystal_elementObject

Returns the value of attribute crystal_element.



72
73
74
# File 'lib/Vana/skillup_calculator.rb', line 72

def crystal_element
  @crystal_element
end

#recipe_capObject

Returns the value of attribute recipe_cap.



72
73
74
# File 'lib/Vana/skillup_calculator.rb', line 72

def recipe_cap
  @recipe_cap
end

#skillObject

Returns the value of attribute skill.



72
73
74
# File 'lib/Vana/skillup_calculator.rb', line 72

def skill
  @skill
end

Instance Method Details

#update_day_and_moon(vanaday, vanamoon) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/Vana/skillup_calculator.rb', line 29

def update_day_and_moon(vanaday, vanamoon)
 if (! vanaday.is_a? VanaDay) || (! vanamoon.is_a? VanaMoon)
  raise "invalid input. initialize with a VanaDay and VanaMoon object"
 end

 @day_element = vanaday.day_element
 @moon_percent = vanamoon.moon_percent

 if @day_element and @moon_percent
  update_moon_phase_factor

  if ! @crystal_element.nil?
   update_day_crystal_factor
   update_skillup_difficulty
  end
 end
end