Class: PFM::Pokemon::ExpList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb

Overview

Helper class helping to get exp values based on each kind of equation

Constant Summary collapse

KIND_TO_METHOD =

List of method name per kind of exp

%i[exp_fast exp_normal exp_slow exp_parabolic exp_eratic exp_fluctuating]

Instance Method Summary collapse

Constructor Details

#initialize(kind) ⇒ ExpList

Create a new ExpList

Parameters:



10
11
12
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb', line 10

def initialize(kind)
  @method = KIND_TO_METHOD[kind] || :exp_normal
end

Instance Method Details

#[](level) ⇒ Integer

Get the total amount of exp to level up to the level parameter

Parameters:

Returns:



17
18
19
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb', line 17

def [](level)
  send(@method, level)
end

#each



21
22
23
24
25
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb', line 21

def each
  return to_enum(__method__) unless block_given?

  1.upto(size) { |i| yield(self[i]) }
end

#size



27
28
29
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb', line 27

def size
  Configs.settings.max_level
end