Class: PFM::Pokemon

Inherits:
Object show all
Includes:
Hooks
Defined in:
scripts/01450 Systems/09000 GTS/09000 GTS.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00401 ExpList.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00001 Initialize.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/02000 Pokemon Flavors.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb,
scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01000 Pokemon Params (generate).rb

Overview

The InGame Pokemon management

Author:

  • Nuri Yuri

Direct Known Subclasses

PokemonBattler

Defined Under Namespace

Classes: ExpList

Constant Summary collapse

ABILITY_CHANCES =

List of chance to get a specific ability on Pokemon generation

[49, 98, 100]
FLAG_UNKOWN_USE =

Unknown flag (should always be up in Pokemon)

0x0080_0000
FLAG_FROM_THIS_GAME =

Flag telling the Pokemon comes from this game (this fangame)

0x0040_0000
FLAG_CAUGHT_BY_PLAYER =

Flag telling the Pokemon has been caught by the player

0x0020_0000
FLAG_PRESENT_TIME =

Flag telling the Pokemon comes from present time (used to distinguish pokemon imported from previous games)

0x0010_0000
Shiny_IV =

Flag that tells the Pokemon object to generate Shiny with IV starting at 15

false
FORM_CALIBRATE =
{}
FORM_GENERATION =
{}
ArceusItem =

List of items (in the form index order) that change the form of Arceus

%i[__undef__ flame_plate splash_plate zap_plate meadow_plate
icicle_plate fist_plate toxic_plate earth_plate sky_plate
mind_plate insect_plate stone_plate spooky_plate draco_plate
iron_plate dread_plate pixie_plate]
GenesectModules =

List of items (in the form index order) that change the form of Genesect

%i[__undef__ burn_drive chill_drive douse_drive shock_drive]
SilvallyROM =

List of item (in the form index oreder) that change the form of Silvally

%i[__undef__ fighting_memory flying_memory poison_memory
ground_memory rock_memory bug_memory ghost_memory steel_memory
__undef__ fire_memory water_memory grass_memory electric_memory
psychic_memory ice_memory dragon_memory dark_memory fairy_memory]
EGG_FILENAMES =

All possible attempt of finding an egg

['egg_%<id>03d_%<form>02d', 'egg_%<id>03d', 'egg_%<name>s_%<form>02d', 'egg_%<name>s', 'egg']
SPRITES_FILENAMES =

All possible attempt of finding a sprite filename

{
  female: ['%<id>03df_%<form>02d', '%<id>03df', '%<name>s_female_%<form>02d', '%<name>s_female'],
  default: ['%<id>03d_%<form>02d', '%<id>03d', '%<name>s_%<form>02d', '%<name>s']
}
GIF_FILENAMES =

All possible attempt of finding a gif filename

{
  female: ['%<id>03df_%<form>02d.gif', '%<id>03df.gif', '%<name>s_female_%<form>02d.gif', '%<name>s_female.gif'],
  default: ['%<id>03d_%<form>02d.gif', '%<id>03d.gif', '%<name>s_%<form>02d.gif', '%<name>s.gif']
}
ICON_FILENAMES =

All possible attempt of finding a icon filename

{
  female_shiny: ['%<id>03dfs_%<form>02d', '%<id>03dfs', '%<name>s_female_shiny_%<form>02d', '%<name>s_female_shiny'],
  default_shiny: ['%<id>03ds_%<form>02d', '%<id>03ds', '%<name>s_shiny_%<form>02d', '%<name>s_shiny'],
  **SPRITES_FILENAMES
}
SPRITES_TO_CHECK =

All the sprite collection to check depending on the female & shiny couple

[
%i[default], # Nothing
%i[default_shiny default], # Shiny
%i[female default], # Female
%i[female_shiny default_shiny female default]
BATTLER_SIZE =

Size of a battler

96
ICON_SIZE =

Size of an icon

32
FOOT_SIZE =

Size of a footprint

16
SPECIAL_EVOLUTION_ID =

List of key in evolution Hash that corresponds to the expected ID when evolution is valid

Returns:

  • (Array<Symbol>)
%i[trade id]
G_ID =

PSP 0.7 ID Hash key

'ID'
G_NV =

PSP 0.7 level Hash key

'NV'
G_OBJ =

PSP 0.7 item hash key

'OBJ'
G_STAT =

PSP 0.7 stat hash key

'STAT'
G_MOVE =

PSP 0.7 move hash key

'MOVE'
G_GR =

PSP 0.7 gender hash key

'GR'
G_FORM =

PSP 0.7 form hash key

'FORM'
G_SHINY =

PSP 0.7 shiny hash key

'SHINY'

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hooks

#exec_hooks, #force_return, included, register, remove, remove_without_name

Constructor Details

#initialize(id, level, force_shiny = false, no_shiny = false, form = -1,, opts = {}) ⇒ Pokemon

Create a new Pokemon with specific parameters

Parameters:

  • id (Integer, Symbol)

    ID of the Pokemon in the database

  • level (Integer)

    level of the Pokemon

  • force_shiny (Boolean) (defaults to: false)

    if the Pokemon have 100% chance to be shiny

  • no_shiny (Boolean) (defaults to: false)

    if the Pokemon have 0% chance to be shiny (override force_shiny)

  • form (Integer) (defaults to: -1,)

    Form index of the Pokemon (-1 = automatic generation)

  • opts (Hash) (defaults to: {})

    Hash describing optional value you want to assign to the Pokemon

Options Hash (opts):

  • :given_name (String)

    Nickname of the Pokemon

  • :captured_with (Integer, Symbol)

    ID of the ball used to catch the Pokemon

  • :captured_in (Integer)

    ID of the zone where the Pokemon was caught

  • :captured_at (Integer, Time)

    Time when the Pokemon was caught

  • :captured_level (Integer)

    Level of the Pokemon when it was caught

  • :egg_in (Integer)

    ID of the zone where the egg was layed/found

  • :egg_at (Integer, Time)

    Time when the egg was layed/found

  • :gender (Integer, String)

    Forced gender of the Pokemon

  • :nature (Integer)

    Nature of the Pokemon

  • :stats (Array<Integer>)

    IV array ([hp, atk, dfe, spd, ats, dfs])

  • :bonus (Array<Integer>)

    EV array ([hp, atk, dfe, spd, ats, dfs])

  • :item (Integer, Symbol)

    ID of the item the Pokemon is holding

  • :ability (Integer, Symbol)

    ID of the ability the Pokemon has

  • :rareness (Integer)

    Rareness of the Pokemon (0 = not catchable, 255 = always catchable)

  • :loyalty (Integer)

    Happiness of the Pokemon

  • :moves (Array<Integer, Symbol>)

    Current Moves of the Pokemon (0 = default)

  • :memo_text (Array(Integer, Integer))

    Text used for the memo ([file_id, text_id])

  • :trainer_name (String)

    Name of the trainer that caught / got the Pokemon

  • :trainer_id (Integer)

    ID of the trainer that caught / got the Pokemon



44
45
46
47
48
49
50
51
52
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00001 Initialize.rb', line 44

def initialize(id, level, force_shiny = false, no_shiny = false, form = -1, opts = {})
  primary_data_initialize(id, level, force_shiny, no_shiny)
  catch_data_initialize(opts)
  form_data_initialize(form)
  stat_data_initialize(opts)
  moves_initialize(opts)
  item_holding_initialize(opts)
  ability_initialize(opts)
end

Class Attribute Details

.evolution_criteriaHash{ Symbol => Proc } (readonly)

List of evolution criteria

Returns:

  • (Hash{ Symbol => Proc })


17
18
19
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 17

def evolution_criteria
  @evolution_criteria
end

.evolution_reason_required_criteriaHash{ Symbol => Array<Symbol> } (readonly)

List of evolution criteria required for specific reason

Returns:

  • (Hash{ Symbol => Array<Symbol> })


20
21
22
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 20

def evolution_reason_required_criteria
  @evolution_reason_required_criteria
end

Instance Attribute Details

#abilityInteger

Return the current ability of the Pokemon

Returns:



398
399
400
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 398

def ability
  return @ability
end

#ability_indexInteger?

Index of the ability in the Pokemon data

Returns:



137
138
139
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 137

def ability_index
  @ability_index
end

#ability_usedBoolean

If the Truant (Absenteisme) ability has been “used”

Returns:

  • (Boolean)


131
132
133
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 131

def ability_used
  @ability_used
end

#attack_orderInteger

Attack order value tells when the Pokemon attacks (used to test if attack before another pokemon)

Returns:



169
170
171
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 169

def attack_order
  @attack_order
end

#battle_itemInteger?

ID of the item the Pokemon is holding in battle

Returns:



184
185
186
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 184

def battle_item
  @battle_item
end

#battle_item_dataArray?

Various data information of the item during battle

Returns:

  • (Array, nil)


187
188
189
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 187

def battle_item_data
  @battle_item_data
end

#battle_stageArray(Integer, Integer, Integer, Integer, Integer, Integer, Integer)

The battle Stage of the Pokemon [atk, dfe, spd, ats, dfs, eva, acc]



151
152
153
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 151

def battle_stage
  @battle_stage
end

#battle_turnsInteger

Number of turn the Pokemon has fought

Returns:



166
167
168
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 166

def battle_turns
  @battle_turns
end

#captured_atInteger

Time when the Pokemon was captured (in seconds from jan 1970)

Returns:



29
30
31
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 29

def captured_at
  @captured_at
end

#captured_inInteger

Zone (id) where the Pokemon was captured mixed with the Gemme 4.0 Flag

Returns:



26
27
28
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 26

def captured_in
  @captured_in
end

#captured_levelInteger

Level of the Pokemon when the Pokemon was caught

Returns:



32
33
34
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 32

def captured_level
  @captured_level
end

#captured_withInteger

ID of the item used to catch the Pokemon

Returns:



23
24
25
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 23

def captured_with
  @captured_with
end

#characterString

Character filename of the Pokemon (FollowMe optimizations)

Returns:



116
117
118
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 116

def character
  @character
end

#codeInteger

Code of the pokemon

Returns:



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

def code
  @code
end

#confuseBoolean

If the pokemon is confused

Returns:

  • (Boolean)


163
164
165
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 163

def confuse
  @confuse
end

#critical_modifier



155
156
157
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 155

def critical_modifier
  @critical_modifier || 0
end

#egg_atInteger

Time when the Egg has been obtained

Returns:



38
39
40
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 38

def egg_at
  @egg_at
end

#egg_inInteger

Zone (id) where the Egg has been obtained

Returns:



35
36
37
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 35

def egg_in
  @egg_in
end

#ev_atkInteger

ATK Effort Value

Returns:



62
63
64
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 62

def ev_atk
  @ev_atk
end

#ev_atsInteger

ATS Effort Value

Returns:



71
72
73
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 71

def ev_ats
  @ev_ats
end

#ev_dfeInteger

DFE Effort Value

Returns:



65
66
67
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 65

def ev_dfe
  @ev_dfe
end

#ev_dfsInteger

DFS Effort Value

Returns:



74
75
76
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 74

def ev_dfs
  @ev_dfs
end

#ev_hpInteger

HP Effort Value

Returns:



59
60
61
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 59

def ev_hp
  @ev_hp
end

#ev_spdInteger

SPD Effort Value

Returns:



68
69
70
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 68

def ev_spd
  @ev_spd
end

#expInteger

The total amount of exp the Pokemon got

Returns:



11
12
13
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 11

def exp
  @exp
end

#exp_rateFloat

The rate of exp point the Pokemon has in its level

Returns:

  • (Float)


101
102
103
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 101

def exp_rate
  @exp_rate
end

#formInteger

Form Index of the Pokemon, ex: Unkown A = 0, Unkown Z = 25

Returns:



56
57
58
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 56

def form
  @form
end

#game_codeInteger?

Code of the game where the Pokemon comes from (nil if the Pokemon hasn't been tainted by GTS system)

Returns:



989
990
991
# File 'scripts/01450 Systems/09000 GTS/09000 GTS.rb', line 989

def game_code
  @game_code
end

#genderInteger

Gender of the Pokemon : 0 = no gender, 1 = male, 2 = female

Returns:



50
51
52
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 50

def gender
  @gender
end

#given_nameString Also known as: nickname

Return the given name of the Pokemon (Pokedex name if no given name)

Returns:



47
48
49
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 47

def given_name
  @given_name
end

#hpInteger

The current HP the Pokemon has

Returns:



14
15
16
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 14

def hp
  @hp
end

#hp_rateFloat

The rate of HP the Pokemon has

Returns:

  • (Float)


98
99
100
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 98

def hp_rate
  @hp_rate
end

#idInteger

ID of the Pokemon in the database

Returns:



5
6
7
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 5

def id
  @id
end

#item_holdingInteger

ID of the item the Pokemon is holding

Returns:



104
105
106
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 104

def item_holding
  @item_holding
end

#iv_atkInteger

ATK Individual Value

Returns:



80
81
82
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 80

def iv_atk
  @iv_atk
end

#iv_atsInteger

ATS Individual Value

Returns:



89
90
91
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 89

def iv_ats
  @iv_ats
end

#iv_dfeInteger

DFE Individual Value

Returns:



83
84
85
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 83

def iv_dfe
  @iv_dfe
end

#iv_dfsInteger

DFS Individual Value

Returns:



92
93
94
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 92

def iv_dfs
  @iv_dfs
end

#iv_hpInteger

HP Individual Value

Returns:



77
78
79
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 77

def iv_hp
  @iv_hp
end

#iv_spdInteger

SPD Individual Value

Returns:



86
87
88
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 86

def iv_spd
  @iv_spd
end

#levelInteger

Current Level of the Pokemon

Returns:



8
9
10
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 8

def level
  @level
end

#loyaltyInteger

Happiness/loyalty of the Pokemon (0 no bonds, 255 full bonds)

Returns:



53
54
55
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 53

def loyalty
  @loyalty
end

#memo_textArray<Integer>

Memo text [file_id, text_id]

Returns:



119
120
121
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 119

def memo_text
  @memo_text
end

#natureArray<Integer>

Return the nature data of the Pokemon

Returns:

  • (Array<Integer>)
    text_id, atk%, dfe%, spd%, ats%, dfs%


320
321
322
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 320

def nature
  return Configs.natures[nature_id]
end

#positionInteger?

The position in the Battle, > 0 = actor, < 0 = enemy (index = -position-1), nil = not fighting

Returns:



160
161
162
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 160

def position
  @position
end

#prepared_skillInteger

ID of the skill the Pokemon would like to use

Returns:



172
173
174
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 172

def prepared_skill
  @prepared_skill
end

#ribbonsArray<Integer>

List of Ribbon ID the Pokemon got

Returns:



122
123
124
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 122

def ribbons
  @ribbons
end

#skill_learntArray<Integer> (readonly)

List of Skill id the Pokemon learnt during its life

Returns:



125
126
127
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 125

def skill_learnt
  @skill_learnt
end

#skills_setArray<PFM::Skill> Also known as: moveset

The current moveset of the Pokemon

Returns:



128
129
130
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 128

def skills_set
  @skills_set
end

#statusInteger

ID of the status of the Pokemon

Returns:



140
141
142
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 140

def status
  @status
end

#status_countInteger

Internal status counter that helps some status to terminate or worsen

Returns:



143
144
145
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 143

def status_count
  @status_count
end

#step_remainingInteger

Number of step before the egg hatch (thus the Pokemon is an egg)

Returns:



20
21
22
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 20

def step_remaining
  @step_remaining
end

#sub_codeInteger?

Real code of the Pokemon when used transform (needed to test if roaming pokemon is ditto)

Returns:



178
179
180
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 178

def sub_code
  @sub_code
end

#sub_formInteger?

Real form index of the Pokemon when used transform (needed to test if roaming pokemon is ditto)

Returns:



181
182
183
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 181

def sub_form
  @sub_form
end

#sub_idInteger?

Real id of the Pokemon when used transform

Returns:



175
176
177
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 175

def sub_id
  @sub_id
end

#trainer_idInteger

Return the normalized trainer id of the Pokemon

Returns:



374
375
376
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 374

def trainer_id
  return @trainer_id % 100_000
end

#trainer_nameString

Name of the original trainer

Returns:



44
45
46
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 44

def trainer_name
  @trainer_name
end

#type1Integer

Return the current first type of the Pokemon

Returns:



5
6
7
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 5

def type1
  return data_type(data.type1).id
end

#type2Integer

Return the current second type of the Pokemon

Returns:



11
12
13
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 11

def type2
  return data_type(data.type2).id
end

#type3Integer

Return the current third type of the Pokemon

Returns:



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

def type3
  return 0
end

Class Method Details

.add_evolution_criteria(key, reasons = nil, &block)

Add a new evolution criteria

Parameters:

  • key (Symbol)

    hash key expected in special evolution

  • reasons (Array<Symbol>) (defaults to: nil)

    evolution reasons that require this criteria in order to allow evolution

  • block (Proc)

    executed proc for special evolution test, will receive : value, extend_data, reason



26
27
28
29
30
31
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 26

def add_evolution_criteria(key, reasons = nil, &block)
  @evolution_criteria[key] = block
  reasons&.each do |reason|
    (@evolution_reason_required_criteria[reason] ||= []) << key
  end
end

.back_filename(id, form, female, shiny, egg) ⇒ String

Return the back battler name

Parameters:

  • id (Integer)

    ID of the Pokemon

  • form (Integer)

    form index of the Pokemon

  • female (Boolean)

    if the Pokemon is a female

  • shiny (Boolean)

    shiny state of the Pokemon

  • egg (Boolean)

    egg state of the Pokemon

Returns:



106
107
108
109
110
111
112
113
114
115
116
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 106

def back_filename(id, form, female, shiny, egg)
  format_arg = { id: id, form: form, name: data_creature(id).db_symbol }
  return correct_filename_from(EGG_FILENAMES, format_arg, RPG::Cache.method(:poke_back_exist?)) || EGG_FILENAMES.last if egg

  hue = shiny ? 1 : 0
  cache_exist = proc { |filename| RPG::Cache.poke_back_exist?(filename, hue) }
  filename = correct_filename_from(SPRITES_FILENAMES[:female], format_arg, cache_exist) if female
  filename ||= correct_filename_from(SPRITES_FILENAMES[:default], format_arg, cache_exist)

  return filename || '000'
end

.back_gif_filename(id, form, female, shiny, egg) ⇒ String?

Return the back gif name

Parameters:

  • id (Integer)

    ID of the Pokemon

  • form (Integer)

    form index of the Pokemon

  • female (Boolean)

    if the Pokemon is a female

  • shiny (Boolean)

    shiny state of the Pokemon

  • egg (Boolean)

    egg state of the Pokemon

Returns:



125
126
127
128
129
130
131
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 125

def back_gif_filename(id, form, female, shiny, egg)
  format_arg = { id: id, form: form, name: data_creature(id).db_symbol }
  hue = shiny ? 1 : 0
  cache_exist = proc { |filename| RPG::Cache.poke_back_exist?(filename, hue) }
  filename = correct_filename_from(GIF_FILENAMES[:female], format_arg, cache_exist) if female
  return filename || correct_filename_from(GIF_FILENAMES[:default], format_arg, cache_exist)
end

.front_filename(id, form, female, shiny, egg) ⇒ String

Return the front battler name

Parameters:

  • id (Integer)

    ID of the Pokemon

  • form (Integer)

    form index of the Pokemon

  • female (Boolean)

    if the Pokemon is a female

  • shiny (Boolean)

    shiny state of the Pokemon

  • egg (Boolean)

    egg state of the Pokemon

Returns:



72
73
74
75
76
77
78
79
80
81
82
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 72

def front_filename(id, form, female, shiny, egg)
  format_arg = { id: id, form: form, name: data_creature(id).db_symbol }
  return correct_filename_from(EGG_FILENAMES, format_arg, RPG::Cache.method(:poke_front_exist?)) || EGG_FILENAMES.last if egg

  hue = shiny ? 1 : 0
  cache_exist = proc { |filename| RPG::Cache.poke_front_exist?(filename, hue) }
  filename = correct_filename_from(SPRITES_FILENAMES[:female], format_arg, cache_exist) if female
  filename ||= correct_filename_from(SPRITES_FILENAMES[:default], format_arg, cache_exist)

  return filename || '000'
end

.front_gif_filename(id, form, female, shiny, egg) ⇒ String?

Return the front gif name

Parameters:

  • id (Integer)

    ID of the Pokemon

  • form (Integer)

    form index of the Pokemon

  • female (Boolean)

    if the Pokemon is a female

  • shiny (Boolean)

    shiny state of the Pokemon

  • egg (Boolean)

    egg state of the Pokemon

Returns:



91
92
93
94
95
96
97
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 91

def front_gif_filename(id, form, female, shiny, egg)
  format_arg = { id: id, form: form, name: data_creature(id).db_symbol }
  hue = shiny ? 1 : 0
  cache_exist = proc { |filename| RPG::Cache.poke_front_exist?(filename, hue) }
  filename = correct_filename_from(GIF_FILENAMES[:female], format_arg, cache_exist) if female
  return filename || correct_filename_from(GIF_FILENAMES[:default], format_arg, cache_exist)
end

.generate_from_hash(hash) ⇒ PFM::Pokemon

Generate a Pokemon from a hash

Parameters:

  • hash (Hash)

    Hash describing optional value you want to assign to the Pokemon

Options Hash (hash):

  • :id (Integer, Symbol)

    ID of the Pokemon

  • :level (Integer)

    level of the Pokemon

  • :shiny (Boolean)

    if the pokemon will be shiny

  • :no_shiny (Boolean)

    if the pokemon will never be shiny

  • :form (Integer)

    form index of the Pokemon

  • :given_name (String)

    Nickname of the Pokemon

  • :captured_with (Integer, Symbol)

    ID of the ball used to catch the Pokemon

  • :captured_in (Integer)

    ID of the zone where the Pokemon was caught

  • :captured_at (Integer, Time)

    Time when the Pokemon was caught

  • :captured_level (Integer)

    Level of the Pokemon when it was caught

  • :egg_in (Integer)

    ID of the zone where the egg was layed/found

  • :egg_at (Integer, Time)

    Time when the egg was layed/found

  • :gender (Integer, String)

    Forced gender of the Pokemon

  • :nature (Integer)

    Nature of the Pokemon

  • :stats (Array<Integer>)

    IV array ([hp, atk, dfe, spd, ats, dfs])

  • :bonus (Array<Integer>)

    EV array ([hp, atk, dfe, spd, ats, dfs])

  • :item (Integer, Symbol)

    ID of the item the Pokemon is holding

  • :ability (Integer, Symbol)

    ID of the ability the Pokemon has

  • :rareness (Integer)

    Rareness of the Pokemon (0 = not catchable, 255 = always catchable)

  • :loyalty (Integer)

    Happiness of the Pokemon

  • :moves (Array<Integer, Symbol>)

    Current Moves of the Pokemon (0 = default)

  • :memo_text (Array(Integer, Integer))

    Text used for the memo ([file_id, text_id])

  • :trainer_name (String)

    Name of the trainer that caught / got the Pokemon

  • :trainer_id (Integer)

    ID of the trainer that caught / got the Pokemon

Returns:



47
48
49
50
51
52
53
54
55
56
57
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01000 Pokemon Params (generate).rb', line 47

def generate_from_hash(hash)
  pkmn_id = hash[:id]
  return psp_generate_from_hash(hash) unless pkmn_id # On est donc en mode PSP 0.7

  level = hash[:level].to_i
  shiny = hash[:shiny]
  ns = hash[:no_shiny]
  form = hash[:form] || -1
  hash[:captured_with] ||= hash[:ball]
  return PFM::Pokemon.new(pkmn_id, level, shiny, ns, form, hash)
end

.icon_filename(id, form, female, shiny, egg) ⇒ String

Icon filename of a Pokemon

Parameters:

  • id (Integer)

    ID of the Pokemon

  • form (Integer)

    form index of the Pokemon

  • female (Boolean)

    if the Pokemon is a female

  • shiny (Boolean)

    shiny state of the Pokemon

  • egg (Boolean)

    egg state of the Pokemon

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 49

def icon_filename(id, form, female, shiny, egg)
  format_arg = { id: id, form: form, name: data_creature(id).db_symbol }
  cache_exist = RPG::Cache.method(:b_icon_exist?)
  return correct_filename_from(EGG_FILENAMES, format_arg, cache_exist) || EGG_FILENAMES.last if egg

  check_index = shiny ? 1 : 0
  check_index += 2 if female

  SPRITES_TO_CHECK[check_index].each do |symbol|
    filename = correct_filename_from(ICON_FILENAMES[symbol], format_arg, cache_exist)
    return filename if filename
  end

  return '000'
end

Instance Method Details

#ability_db_symbolSymbol

Return the db_symbol of the Pokemon's Ability

Returns:

  • (Symbol)


404
405
406
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 404

def ability_db_symbol
  data_ability(ability).db_symbol
end

#ability_descrString

Reture the description of the current ability of the Pokemon

Returns:



70
71
72
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 70

def ability_descr
  return data_ability(ability_db_symbol).descr
end

#ability_nameString

Return the name of the current ability of the Pokemon

Returns:



64
65
66
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 64

def ability_name
  return data_ability(ability_db_symbol).name
end

#absofusion(pokemon)

Absofusion of the Pokemon (if possible)

Parameters:

  • pokemon

    PFM::Pokemon The Pokemon used in the fusion



69
70
71
72
73
74
75
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 69

def absofusion(pokemon)
  return if @fusion
  return unless form_calibrate(pokemon.db_symbol)

  @fusion = pokemon
  $actors.delete(pokemon)
end

#absofusionned?Boolean

If the Pokemon is a absofusion

Returns:

  • (Boolean)


87
88
89
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 87

def absofusionned?
  return !@fusion.nil?
end

#acc_stageInteger

Return the accuracy stage

Returns:



115
116
117
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 115

def acc_stage
  return @battle_stage[6]
end

#add_bonus(list) ⇒ Boolean?

Add ev bonus to a Pokemon (with item interaction : x2)

Parameters:

  • list (Array<Integer>)

    an ev list : [hp, atk, dfe, spd, ats, dfs]

Returns:

  • (Boolean, nil)

    if the ev had totally been added or not (nil = couldn't be added at all)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 13

def add_bonus(list)
  return nil if egg?

  stats = Configs.stats
  # Bracelet Macho
  n = item_db_symbol == :macho_brace ? 2 : 1
  r = add_ev_hp(list[stats.hp_index] * n, total_ev)
  r &= add_ev_atk(list[stats.atk_index] * n, total_ev)
  r &= add_ev_dfe(list[stats.dfe_index] * n, total_ev)
  r &= add_ev_spd(list[stats.spd_index] * n, total_ev)
  r &= add_ev_ats(list[stats.ats_index] * n, total_ev)
  r &= add_ev_dfs(list[stats.dfs_index] * n, total_ev)
  return r
end

#add_ev_atk(n, evs) ⇒ Boolean

Safely add ATK EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



119
120
121
122
123
124
125
126
127
128
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 119

def add_ev_atk(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_atk > Configs.stats.max_stat_ev - 1

  @ev_atk += n
  @ev_atk.clamp(0, Configs.stats.max_stat_ev)
  return true
end

#add_ev_ats(n, evs) ⇒ Boolean

Safely add ATS EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



164
165
166
167
168
169
170
171
172
173
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 164

def add_ev_ats(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_ats > Configs.stats.max_stat_ev - 1

  @ev_ats += n
  @ev_ats.clamp(0, Configs.stats.max_stat_ev)
  return true
end

#add_ev_dfe(n, evs) ⇒ Boolean

Safely add DFE EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



134
135
136
137
138
139
140
141
142
143
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 134

def add_ev_dfe(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_dfe > Configs.stats.max_stat_ev - 1

  @ev_dfe += n
  @ev_dfe.clamp(0, Configs.stats.max_stat_ev)
  return true
end

#add_ev_dfs(n, evs) ⇒ Boolean

Safely add DFS EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



179
180
181
182
183
184
185
186
187
188
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 179

def add_ev_dfs(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_dfs > Configs.stats.max_stat_ev - 1

  @ev_dfs += n
  @ev_dfs.clamp(0, Configs.stats.max_stat_ev)
  return true
end

#add_ev_hp(n, evs) ⇒ Boolean

Safely add HP EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



102
103
104
105
106
107
108
109
110
111
112
113
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 102

def add_ev_hp(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_hp > Configs.stats.max_stat_ev - 1

  @ev_hp += n
  @ev_hp.clamp(0, Configs.stats.max_stat_ev)
  @hp = (@hp_rate * max_hp).round
  @hp_rate = @hp.to_f / max_hp
  return true
end

#add_ev_spd(n, evs) ⇒ Boolean

Safely add SPD EV

Parameters:

Returns:

  • (Boolean)

    if the ev has successfully been added



149
150
151
152
153
154
155
156
157
158
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 149

def add_ev_spd(n, evs)
  return true if n == 0

  n -= 1 while (evs + n) > Configs.stats.max_total_ev
  return false if @ev_spd > Configs.stats.max_stat_ev - 1

  @ev_spd += n
  @ev_spd.clamp(0, Configs.stats.max_stat_ev)
  return true
end

#add_ribbon(id)

Add a ribbon to the Pokemon

Parameters:

  • id (Integer)

    ID of the ribbon (in the ribbon text file)



410
411
412
413
414
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 410

def add_ribbon(id)
  return unless id.between?(0, 50)

  @ribbons << id unless @ribbons.include?(id)
end

#alive?Boolean

Is the Pokemon able to fight

Returns:

  • (Boolean)


11
12
13
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 11

def alive?
  return hp > 0 && !egg?
end

#asleep?Boolean

Is the Pokemon asleep?

Returns:

  • (Boolean)


105
106
107
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 105

def asleep?
  return @status == Configs.states.ids[:sleep]
end

#atkInteger

Return the current atk

Returns:



49
50
51
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 49

def atk
  return (atk_basis * atk_modifier).floor
end

#atk_basisInteger

Return the atk stat without battle modifier

Returns:



251
252
253
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 251

def atk_basis
  return calc_regular_stat(base_atk, @iv_atk, @ev_atk, 1)
end

#atk_modifierFloat

Return the atk modifier

Returns:

  • (Float)

    the multiplier



196
197
198
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 196

def atk_modifier
  return modifier_stage(atk_stage)
end

#atk_stageInteger

Return the atk stage

Returns:



79
80
81
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 79

def atk_stage
  return @battle_stage[0]
end

#atsInteger

Return the current ats

Returns:



67
68
69
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 67

def ats
  return (ats_basis * ats_modifier).floor
end

#ats_basisInteger

Return the ats stat without battle modifier

Returns:



269
270
271
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 269

def ats_basis
  return calc_regular_stat(base_ats, @iv_ats, @ev_ats, 4)
end

#ats_modifierFloat

Return the ats modifier

Returns:

  • (Float)

    the multiplier



214
215
216
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 214

def ats_modifier
  return modifier_stage(ats_stage)
end

#ats_stageInteger

Return the ats stage

Returns:



97
98
99
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 97

def ats_stage
  return @battle_stage[3]
end

#ball_colorColor

Return the ball color of the Pokemon (flash)

Returns:



365
366
367
368
369
370
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 365

def ball_color
  item = data_item(@captured_with)
  return Color.new(0, 0, 0) unless item.is_a?(Studio::BallItem)

  return Studio::BallItem.from(item).color
end

#ball_imageTexture

Return the ball image of the Pokemon

Returns:



37
38
39
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 37

def ball_image
  return RPG::Cache.ball(ball_sprite)
end

#ball_spriteString

Return the ball sprite name of the Pokemon

Returns:

  • (String)

    Sprite to load in Graphics/ball/



356
357
358
359
360
361
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 356

def ball_sprite
  item = data_item(@captured_with)
  return 'ball_1' unless item.is_a?(Studio::BallItem)

  return Studio::BallItem.from(item).img
end

#base_atkInteger

Return the base ATK

Returns:



11
12
13
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 11

def base_atk
  return data.base_atk
end

#base_atsInteger

Return the base ATS

Returns:



29
30
31
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 29

def base_ats
  return data.base_ats
end

#base_dfeInteger

Return the base DFE

Returns:



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

def base_dfe
  return data.base_dfe
end

#base_dfsInteger

Return the base DFS

Returns:



35
36
37
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 35

def base_dfs
  return data.base_dfs
end

#base_expInteger

Return the base experience of the Pokemon

Returns:



36
37
38
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 36

def base_exp
  return data.base_experience
end

#base_hpInteger

Return the base HP

Returns:



5
6
7
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 5

def base_hp
  return data.base_hp
end

#base_spdInteger

Return the base SPD

Returns:



23
24
25
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 23

def base_spd
  return data.base_spd
end

#battle_listArray<Integer>

Return the list of EV the pokemon gives when beaten

Returns:

  • (Array<Integer>)

    ev list (used in bonus functions) : [hp, atk, dfe, spd, ats, dfs]



5
6
7
8
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 5

def battle_list
  data = get_data
  return [data.ev_hp, data.ev_atk, data.ev_dfe, data.ev_spd, data.ev_ats, data.ev_dfs]
end

#battler_backTexture

Return the back battle of the Pokemon

Returns:



165
166
167
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 165

def battler_back
  return RPG::Cache.poke_back(PFM::Pokemon.back_filename(id, form, female?, shiny?, egg?), shiny? ? 1 : 0)
end

#battler_faceTexture Also known as: battler_front

Return the front battler of the Pokemon

Returns:



158
159
160
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 158

def battler_face
  return RPG::Cache.poke_front(PFM::Pokemon.front_filename(id, form, female?, shiny?, egg?), shiny? ? 1 : 0)
end

#burn?Boolean Also known as: burnt?

Is the Pokemon burnt?

Returns:

  • (Boolean)


81
82
83
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 81

def burn?
  return @status == Configs.states.ids[:burn]
end

#calyrex_form(reason)

Determine the form of the Calyrex

Parameters:

  • reason (Symbol)

    The db_symbol of the Pokemon used for the fusion



178
179
180
181
182
183
184
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 178

def calyrex_form(reason)
  return @form unless %i[glastrier spectrier none].include?(reason)
  return 1 if reason == :glastrier
  return 2 if reason == :spectrier

  return 0
end

#can_be_asleep?Boolean

Can the Pokemon be asleep?

Returns:

  • (Boolean)


129
130
131
132
133
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 129

def can_be_asleep?
  return false if @status != 0

  return true
end

#can_be_burn?Boolean

Can the Pokemon be burnt?

Returns:

  • (Boolean)


99
100
101
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 99

def can_be_burn?
  return @status == 0 && !type_fire?
end

#can_be_frozen?(skill_type = 0) ⇒ Boolean

Can the Pokemon be frozen?

Returns:

  • (Boolean)


164
165
166
167
168
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 164

def can_be_frozen?(skill_type = 0)
  return false if @status != 0 || (skill_type == 6 && type_ice?)

  return true
end

#can_be_paralyzed?Boolean

Can the Pokemon be paralyzed?

Returns:

  • (Boolean)


72
73
74
75
76
77
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 72

def can_be_paralyzed?
  return false if @status != 0
  return false if type_electric?

  return true
end

#can_be_poisoned?Boolean

Can the Pokemon be poisoned ?

Returns:

  • (Boolean)


46
47
48
49
50
51
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 46

def can_be_poisoned?
  return false if type_poison? || type_steel?
  return false if @status != 0

  return true
end

#can_learn?(db_symbol) ⇒ Boolean?

Check if the Pokemon can learn a skill

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move

Returns:

  • (Boolean, nil)

    nil = learnt, false = cannot learn, true = can learn



109
110
111
112
113
114
115
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 109

def can_learn?(db_symbol)
  return false if egg?

  return nil if skill_learnt?(db_symbol)

  return data.move_set.any? { |move| move.move == db_symbol && !move.breed_learnable? }
end

#can_learn_skill_at_this_level?(level = @level) ⇒ Boolean

Can learn skill at this level

Parameters:

  • level (Integer) (defaults to: @level)

Returns:

  • (Boolean)


102
103
104
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 102

def can_learn_skill_at_this_level?(level = @level)
  data.move_set.select { |move| move.level_learnable? && move.level == level }.any?
end

#can_mega_evolve?Integer, false

Check if the Pokemon can mega evolve

Returns:

  • (Integer, false)

    form index if the Pokemon can mega evolve, false otherwise



33
34
35
36
37
38
39
40
41
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 33

def can_mega_evolve?
  return false if mega_evolved?
  return 30 if db_symbol == :rayquaza && skills_set.any? { |skill| skill.db_symbol == :dragon_ascent }

  item = item_db_symbol
  mega_evolution = data.evolutions.find { |evolution| evolution.condition_data(:gemme) == item }

  return mega_evolution ? mega_evolution.form : false
end

#captured_zone_nameString

Return the name of the zone where the Pokemon has been caught

Returns:



44
45
46
47
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 44

def captured_zone_name
  zone_name = _utf8(data_zone(zone_id).name)
  return PFM::Text.parse_string_for_messages(zone_name)
end

#caught_by_player?Boolean

Tell if the Pokemon is caught by the trainer

Returns:

  • (Boolean)


268
269
270
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 268

def caught_by_player?
  return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)
end

#change_acc(amount) ⇒ Integer

Change the acc stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



179
180
181
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 179

def change_acc(amount)
  return change_stat(6, amount)
end

#change_atk(amount) ⇒ Integer

Change the atk stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



137
138
139
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 137

def change_atk(amount)
  return change_stat(0, amount)
end

#change_ats(amount) ⇒ Integer

Change the ats stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



158
159
160
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 158

def change_ats(amount)
  return change_stat(3, amount)
end

#change_dfe(amount) ⇒ Integer

Change the dfe stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



144
145
146
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 144

def change_dfe(amount)
  return change_stat(1, amount)
end

#change_dfs(amount) ⇒ Integer

Change the dfs stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



165
166
167
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 165

def change_dfs(amount)
  return change_stat(4, amount)
end

#change_eva(amount) ⇒ Integer

Change the eva stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



172
173
174
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 172

def change_eva(amount)
  return change_stat(5, amount)
end

#change_spd(amount) ⇒ Integer

Change the spd stage

Parameters:

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



151
152
153
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 151

def change_spd(amount)
  return change_stat(2, amount)
end

#change_stat(stat_id, amount) ⇒ Integer

Change a stat stage

Parameters:

  • stat_id (Integer)

    id of the stat : 0 = atk, 1 = dfe, 2 = spd, 3 = ats, 4 = dfs, 5 = eva, 6 = acc

  • amount (Integer)

    the amount to change on the stat stage

Returns:

  • (Integer)

    the difference between the current and the last stage value



123
124
125
126
127
128
129
130
131
132
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 123

def change_stat(stat_id, amount)
  last_value = @battle_stage[stat_id]
  @battle_stage[stat_id] += amount
  if @battle_stage[stat_id] > 6
    @battle_stage[stat_id] = 6
  elsif @battle_stage[stat_id] < -6
    @battle_stage[stat_id] = -6
  end
  return @battle_stage[stat_id] - last_value
end

#character_nameString

Return the character name of the Pokemon

Returns:



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 177

def character_name
  unless @character
    character = nil
    if female?
      character = sprintf("%03df%s_%d", id, shiny? ? "s" : nil, form)
      character = nil unless RPG::Cache.character_exist?(character)
    end
    unless character
      character = sprintf("%03d%s_%d", id, shiny? ? "s" : nil, form)
      unless RPG::Cache.character_exist?(character)
        character = sprintf("%03d%s_0", id, shiny? ? "s" : nil)
        character = sprintf("%03d_0", id) unless RPG::Cache.character_exist?(character)
      end
    end
    @character = character
  end
  return @character
end

#check_skill_and_learn(silent = false, level = @level)

Check if the Pokemon can learn a new skill and make it learn the skill

Parameters:

  • silent (Boolean) (defaults to: false)

    if the skill is automatically learnt or not (false = show skill learn interface & messages)

  • level (Integer) (defaults to: @level)

    The level to check in order to learn the moves (<= 0 = evolution)



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 79

def check_skill_and_learn(silent = false, level = @level)
  learn_move = proc do |db_symbol|
    next if skill_learnt?(db_symbol)
    next GamePlay.open_move_teaching(self, db_symbol) unless silent

    @skills_set << PFM::Skill.new(db_symbol)
    @skills_set.shift if @skills_set.size > 4
    @skill_learnt << db_symbol unless @skill_learnt.include?(id) || @skill_learnt.include?(db_symbol)
  end

  if level <= 0
    data.move_set.select(&:evolution_learnable?).each do |move|
      learn_move.call(move.move)
    end
  else
    data.move_set.select { |move| move.level_learnable? && move.level == level }.each do |move|
      learn_move.call(move.move)
    end
  end
end

#cryString

Return the cry file name of the Pokemon

Returns:



198
199
200
201
202
203
204
205
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 198

def cry
  return nil.to_s if @step_remaining > 0
  with_form = format('Audio/SE/Cries/%03d_%02dCry.ogg', @id, @form)
  return with_form if File.exist?(with_form)
  with_form = format('Audio/SE/Cries/%03d_%02dCry.wav', @id, @form)
  return with_form if File.exist?(with_form)
  return format('Audio/SE/Cries/%03dCry', @id)
end

#cure

Cure the Pokemon from its statues modifications



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

def cure
  @status = 0
  @status_count = 0
end

#current_deerling_formInteger

Calculate the form of deerling & sawsbuck

Returns:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 125

def current_deerling_form
  time = Time.new
  case time.month
  when 1, 2
    return @form = 3
  when 3
    return @form = (time.day < 21 ? 3 : 0)
  when 6
    return @form = (time.day < 21 ? 0 : 1)
  when 7, 8
    return @form = 1
  when 9
    return @form = (time.day < 21 ? 1 : 2)
  when 10, 11
    return @form = 2
  when 12
    return @form = (time.day < 21 ? 2 : 3)
  end
  return @form = 0
end

#dataStudio::CreatureForm Also known as: get_data

Get the current data of the Pokemon



197
198
199
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 197

def data
  data_creature(db_symbol).forms.find { |creature_form| creature_form.form == form } || primary_data
end

#db_symbolSymbol

Return the db_symbol of the Pokemon in the database

Returns:

  • (Symbol)


237
238
239
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 237

def db_symbol
  return @db_symbol ||= data_creature(id).db_symbol
end

#dead?Boolean

Is the Pokemon not able to fight

Returns:

  • (Boolean)


5
6
7
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 5

def dead?
  return hp <= 0 || egg?
end

#dfeInteger

Return the current dfe

Returns:



55
56
57
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 55

def dfe
  return (dfe_basis * dfe_modifier).floor
end

#dfe_basisInteger

Return the dfe stat without battle modifier

Returns:



257
258
259
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 257

def dfe_basis
  return calc_regular_stat(base_dfe, @iv_dfe, @ev_dfe, 2)
end

#dfe_modifierFloat

Return the dfe modifier

Returns:

  • (Float)

    the multiplier



202
203
204
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 202

def dfe_modifier
  return modifier_stage(dfe_stage)
end

#dfe_stageInteger

Return the dfe stage

Returns:



85
86
87
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 85

def dfe_stage
  return @battle_stage[1]
end

#dfsInteger

Return the current dfs

Returns:



73
74
75
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 73

def dfs
  return (dfs_basis * dfs_modifier).floor
end

#dfs_basisInteger

Return the dfs stat without battle modifier

Returns:



275
276
277
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 275

def dfs_basis
  return calc_regular_stat(base_dfs, @iv_dfs, @ev_dfs, 5)
end

#dfs_modifierFloat

Return the dfs modifier

Returns:

  • (Float)

    the multiplier



220
221
222
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 220

def dfs_modifier
  return modifier_stage(dfs_stage)
end

#dfs_stageInteger

Return the dfs stage

Returns:



103
104
105
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 103

def dfs_stage
  return @battle_stage[4]
end

#dv_modifier(list)

Change the IV and update the statistics

Parameters:

  • list (Array<Integer>)

    list of new IV [hp, atk, dfe, spd, ats, dfs]



226
227
228
229
230
231
232
233
234
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 226

def dv_modifier(list)
  @iv_hp = get_dv_value(list[0], @iv_hp)
  @iv_atk = get_dv_value(list[1], @iv_atk)
  @iv_dfe = get_dv_value(list[2], @iv_dfe)
  @iv_spd = get_dv_value(list[3], @iv_spd)
  @iv_ats = get_dv_value(list[4], @iv_ats)
  @iv_dfs = get_dv_value(list[5], @iv_dfs)
  @hp = max_hp
end

#edit_bonus(list) ⇒ Boolean?

Add ev bonus to a Pokemon (without item interaction)

Parameters:

  • list (Array<Integer>)

    an ev list : [hp, atk, dfe, spd, ats, dfs]

Returns:

  • (Boolean, nil)

    if the ev had totally been added or not (nil = couldn't be added at all)



31
32
33
34
35
36
37
38
39
40
41
42
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 31

def edit_bonus(list)
  return nil if egg?

  stats = Configs.stats
  r = add_ev_hp(list[stats.hp_index], total_ev)
  r &= add_ev_atk(list[stats.atk_index], total_ev)
  r &= add_ev_dfe(list[stats.dfe_index], total_ev)
  r &= add_ev_spd(list[stats.spd_index], total_ev)
  r &= add_ev_ats(list[stats.ats_index], total_ev)
  r &= add_ev_dfs(list[stats.dfs_index], total_ev)
  return r
end

#egg?Boolean Also known as: egg

Tell if the Pokemon is an egg or not

Returns:

  • (Boolean)


243
244
245
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 243

def egg?
  return @step_remaining > 0
end

#egg_finish

Ends the egg process of the Pokemon



64
65
66
67
68
69
70
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00001 Initialize.rb', line 64

def egg_finish
  @captured_in = $env.master_zone
  self.flags = (FLAG_UNKOWN_USE | FLAG_FROM_THIS_GAME | FLAG_PRESENT_TIME | FLAG_CAUGHT_BY_PLAYER)
  @captured_at = Time.new.to_i
  @trainer_id = $trainer.id
  @trainer_name = $trainer.name
end

#egg_init

Initialize the egg process of the Pokemon



55
56
57
58
59
60
61
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00001 Initialize.rb', line 55

def egg_init
  @egg_in = $env.master_zone
  @egg_at = Time.new.to_i
  @step_remaining = data.hatch_steps
  @item_holding = 0
  $quests.get_egg
end

#egg_zone_nameString

Return the name of the zone where the egg has been obtained

Returns:



51
52
53
54
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 51

def egg_zone_name
  zone_name = _utf8(data_zone(zone_id(@egg_in)).name)
  return PFM::Text.parse_string_for_messages(zone_name)
end

#elv_armulysBoolean

Check evolve condition to evolve in Silcoon (Armulys)

Returns:

  • (Boolean)

    if the condition is valid



323
324
325
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 323

def elv_armulys
  ((@code & 0xFFFF) % 10) <= 4
end

#elv_blindalysBoolean

Check evolve condition to evolve in Cascoon (Blindalys)

Returns:

  • (Boolean)

    if the condition is valid



329
330
331
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 329

def elv_blindalys
  !elv_armulys
end

#elv_demantaBoolean

Check evolve condition to evolve in Mantine

Returns:

  • (Boolean)

    if the condition is valid



335
336
337
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 335

def elv_demanta
  PFM.game_state.has_pokemon?(223)
end

#elv_kapoeraBoolean

Check evolve condition to evolve in Hitmontop (Kapoera)

Returns:

  • (Boolean)

    if the condition is valid



317
318
319
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 317

def elv_kapoera
  atk == dfe
end

#elv_kickleeBoolean

Check evolve condition to evolve in Hitmonlee (kicklee)

Returns:

  • (Boolean)

    if the condition is valid



305
306
307
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 305

def elv_kicklee
  atk > dfe
end

#elv_nymphaliBoolean

Check evolve condition to evolve in Sylveon (Nymphali)

Returns:

  • (Boolean)

    if the condition is valid



354
355
356
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 354

def elv_nymphali
  return @skills_set.any? { |skill| skill&.type_fairy? }
end

#elv_pandarbareBoolean

Check evolve condition to evolve in Pangoro (Pandarbare)

Returns:

  • (Boolean)

    if the condition is valid



341
342
343
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 341

def elv_pandarbare
  return $actors.any? { |pokemon| pokemon&.type_dark? }
end

#elv_sepiatroceBoolean

Note:

uses :DOWN to validate the evolve condition

Check evolve condition to evolve in Malamar (Sepiatroce)

Returns:

  • (Boolean)

    if the condition is valid



348
349
350
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 348

def elv_sepiatroce
  return Input.press?(:DOWN)
end

#elv_tygnonBoolean

Check evolve condition to evolve in Hitmonchan (tygnon)

Returns:

  • (Boolean)

    if the condition is valid



311
312
313
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 311

def elv_tygnon
  atk < dfe
end

#encodeString

Encode the Pokemon to a String in order to send it to the GTS system

Returns:



992
993
994
# File 'scripts/01450 Systems/09000 GTS/09000 GTS.rb', line 992

def encode
  return [Zlib::Deflate.deflate(Marshal.dump(self))].pack('m')
end

#ev_atk_textString

Return the EV ATK text

Returns:



304
305
306
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 304

def ev_atk_text
  format(ev_text, ev_atk)
end

#ev_ats_textString

Return the EV ATS text

Returns:



322
323
324
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 322

def ev_ats_text
  format(ev_text, ev_ats)
end

#ev_check(index, apply = false, count = 1) ⇒ Integer, false

Automatic ev adder using an index

Parameters:

  • index (Integer)

    ev index (see GameData::EV), should add 10. If index > 10 take index % 10 and add only 1 EV.

  • apply (Boolean) (defaults to: false)

    if the ev change is applied

  • count (Integer) (defaults to: 1)

    number of EV to add

Returns:

  • (Integer, false)

    if not false, the value of the current EV depending on the index



55
56
57
58
59
60
61
62
63
64
65
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 55

def ev_check(index, apply = false, count = 1)
  evs = total_ev
  return false if evs >= Configs.stats.max_total_ev

  if index >= 10
    index = index % 10
    return (ev_var(index, evs, apply ? count : 0) < Configs.stats.max_stat_ev)
  else
    return (ev_var(index, evs, apply ? 10 : 0) < 100)
  end
end

#ev_dfe_textString

Return the EV DFE text

Returns:



310
311
312
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 310

def ev_dfe_text
  format(ev_text, ev_dfe)
end

#ev_dfs_textString

Return the EV DFS text

Returns:



328
329
330
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 328

def ev_dfs_text
  format(ev_text, ev_dfs)
end

#ev_hp_textString

Return the EV HP text

Returns:



298
299
300
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 298

def ev_hp_text
  format(ev_text, ev_hp)
end

#ev_spd_textString

Return the EV SPD text

Returns:



316
317
318
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 316

def ev_spd_text
  format(ev_text, ev_spd)
end

#ev_var(index, evs, value = 0) ⇒ Integer

Get and add EV

Parameters:

  • index (Integer)

    ev index (see GameData::EV)

  • evs (Integer)

    the total ev

  • value (Integer) (defaults to: 0)

    the quantity of EV to add (if 0 no add)

Returns:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 72

def ev_var(index, evs, value = 0)
  stats = Configs.stats
  case index
  when stats.hp_index
    add_ev_hp(value, evs) if value > 0
    return @ev_hp
  when stats.atk_index
    add_ev_atk(value, evs) if value > 0
    return @ev_atk
  when stats.dfe_index
    add_ev_dfe(value, evs) if value > 0
    return @ev_dfe
  when stats.spd_index
    add_ev_spd(value, evs) if value > 0
    return @ev_spd
  when stats.ats_index
    add_ev_ats(value, evs) if value > 0
    return @ev_ats
  when stats.dfs_index
    add_ev_dfs(value, evs) if value > 0
    return @ev_dfs
  else
    return 0
  end
end

#eva_stageInteger

Return the evasion stage

Returns:



109
110
111
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 109

def eva_stage
  return @battle_stage[5]
end

#evolve(id, form)

Method that actually make a Pokemon evolve

Parameters:

  • id (Integer)

    ID of the Pokemon that evolve

  • form (Integer, nil)

    form of the Pokemon that evolve



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 238

def evolve(id, form)
  old_evolution_db_symbol = db_symbol
  old_evolution_form = self.form
  hp_diff = self.max_hp - self.hp
  self.id = id
  if form
    self.form = form
  else
    form_calibrate(:evolve)
  end
  return unless $actors.include?(self) # Don't do te rest if the pokemon isn't in the current party

  # evolution_items = (data.special_evolution || []).map { |hash| hash[:item_hold] || 0 }
  previous_pokemon_evolution_method = data_creature_form(old_evolution_db_symbol, old_evolution_form).evolutions
  evolution_items = previous_pokemon_evolution_method.map { |evolution| evolution.condition_data(:itemHold) }.compact
  self.item_holding = 0 if evolution_items.include?(item_db_symbol)
  # Normal skill learn
  check_skill_and_learn
  # Evolution skill learn
  check_skill_and_learn(false, 0)
  # Pokedex register (self is used to be sure we get the right information)
  $pokedex.mark_seen(self.id, self.form, forced: true)
  $pokedex.mark_captured(self.id)
  $pokedex.increase_creature_caught_count(self.id)
  # Refresh hp
  self.hp = (self.max_hp - hp_diff) if self.hp > 0
  exec_hooks(PFM::Pokemon, :evolution, binding)
end

#evolve_check(reason = :level_up, extend_data = nil) ⇒ Array<Integer, nil>, false

Check if the Pokemon can evolve and return the evolve id if possible

Parameters:

  • reason (Symbol) (defaults to: :level_up)

    evolve check reason (:level_up, :trade, :stone)

  • extend_data (Hash, nil) (defaults to: nil)

    extend_data generated by an item

Returns:

  • (Array<Integer, nil>, false)

    if the Pokemon can evolve, the evolve id, otherwise false



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 161

def evolve_check(reason = :level_up, extend_data = nil)
  return false if item_db_symbol == :everstone

  data = Configs.settings.always_use_form0_for_evolution ? primary_data : self.data

  if data.evolutions.empty?
    data = primary_data if Configs.settings.use_form0_when_no_evolution_data
    return false if data.evolutions.empty?
  end

  required_criterion = Pokemon.evolution_reason_required_criteria[reason] || []
  criteria = Pokemon.evolution_criteria

  expected_evolution = data.evolutions.find do |evolution|
    next false unless required_criterion.all? { |key| evolution.condition_data(key) }

    next evolution.conditions.all? do |condition|
      next false unless (block = criteria[condition[:type]])

      next instance_exec(condition[:value], extend_data, reason, &block)
    end
  end

  return false unless expected_evolution

  return data_creature(expected_evolution.db_symbol).id, expected_evolution.form
end

#exp_listExpList

Return the exp curve

Returns:



48
49
50
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 48

def exp_list
  return ExpList.new(exp_type)
end

#exp_lvlInteger

Return the required total exp (so including old levels) to increase the Pokemon's level

Returns:



54
55
56
57
58
59
60
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 54

def exp_lvl
  data = exp_list
  v = data[@level + 1]
  return data[@level] if !v || PFM.game_state&.level_max_limit.to_i <= @level

  return v
end

#exp_remaining_textString

Return the text of the amount of exp the pokemon needs to go to the next level

Returns:



64
65
66
67
68
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 64

def exp_remaining_text
  expa = exp_lvl - exp
  expa = 0 if expa < 0
  return expa.to_s
end

#exp_textString

Return the text of the current pokemon experience

Returns:



72
73
74
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 72

def exp_text
  @exp.to_s
end

#exp_typeInteger

Return the exp curve type ID

Returns:



42
43
44
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 42

def exp_type
  return data.experience_type
end

#female?Boolean

Tell if the Pokemon is a female

Returns:

  • (Boolean)


308
309
310
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 308

def female?
  gender == 2
end

#find_skill(db_symbol) ⇒ PFM::Skill, false

Find a skill in the moveset of the Pokemon

Parameters:

  • db_symbol (Symbol)

    db_symbol of the skill in the database

Returns:



66
67
68
69
70
71
72
73
74
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 66

def find_skill(db_symbol)
  return false if egg?

  move = data_move(db_symbol)
  @skills_set.each do |skill|
    return skill if skill && skill.db_symbol == move.db_symbol
  end
  return false
end

#flagsInteger

Get Pokemon flags

Returns:



256
257
258
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 256

def flags
  return @captured_in & 0xFFFF_0000
end

#flags=(flag)

Set the captured_in flags (to know from which game the pokemon came from)

Parameters:



250
251
252
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 250

def flags=(flag)
  @captured_in = zone_id | (flag & 0xFFFF_0000)
end

#flavor_disliked?(flavor) ⇒ Boolean

Tell if the Creature dislikes flavor

Parameters:

  • flavor (Symbol)

Returns:

  • (Boolean)


13
14
15
16
17
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/02000 Pokemon Flavors.rb', line 13

def flavor_disliked?(flavor)
  return false if no_preferences?

  return Configs.flavors.nature_disliking_flavor[flavor].include?(nature_id)
end

#flavor_liked?(flavor) ⇒ Boolean

Tell if the Creature likes flavor

Parameters:

  • flavor (Symbol)

Returns:

  • (Boolean)


5
6
7
8
9
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/02000 Pokemon Flavors.rb', line 5

def flavor_liked?(flavor)
  return false if no_preferences?

  return Configs.flavors.nature_liking_flavor[flavor].include?(nature_id)
end

#forget_skill(db_symbol)

Forget a skill by its id

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move in the database



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

def forget_skill(db_symbol)
  move = data_move(db_symbol)
  @skills_set.delete_if { |skill| skill.db_symbol == move.db_symbol }
  form_calibrate if data.db_symbol == :keldeo
end

#form_calibrate(reason = :menu) ⇒ Boolean

Note:

It calls the block stored in the hash FORM_CALIBRATE where the key is the Pokemon db_symbol & the block parameter is the reason. The block should change @form

Automatically calibrate the form of the Pokemon

Parameters:

  • reason (Symbol) (defaults to: :menu)

    what called form_calibrate (:menu, :evolve, :load, …)

Returns:

  • (Boolean)

    if the Pokemon's form has changed



111
112
113
114
115
116
117
118
119
120
121
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 111

def form_calibrate(reason = :menu)
  @character = nil
  last_form = @form
  block = FORM_CALIBRATE[db_symbol]
  instance_exec(reason, &block) if block
  # Set the form to 0 if the form does not exists in the Database
  @form = 0 if data_creature(db_symbol).forms.none? { |creature_form| creature_form.form == @form }
  # Update the ability
  update_ability
  return last_form != @form
end

#form_generation(form, old_value = nil) ⇒ Integer

Note:

It calls the block stored in the hash FORM_GENERATION where the key is the Pokemon db_symbol

Automatically generate the form index of the Pokemon

Parameters:

  • form (Integer)

    if form != 0 does not generate the form (protection)

Returns:



95
96
97
98
99
100
101
102
103
104
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 95

def form_generation(form, old_value = nil)
  form = old_value if old_value
  return form if form != -1

  @character = nil
  block = FORM_GENERATION[db_symbol]
  return instance_exec(&block).to_i if block

  return 0
end

#from_past?Boolean

Tell if the pokemon is from a past version

Returns:

  • (Boolean)


262
263
264
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 262

def from_past?
  return !flags.anybits?(FLAG_PRESENT_TIME)
end

#from_player?Boolean

Return if the Pokemon is from the player (he caught it)

Returns:

  • (Boolean)


380
381
382
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 380

def from_player?
  return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)
end

#front_offset_yInteger

Return the front offset y of the Pokemon

Returns:



171
172
173
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 171

def front_offset_y
  return data.front_offset_y
end

#frozen?Boolean

Is the Pokemon frozen?

Returns:

  • (Boolean)


147
148
149
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 147

def frozen?
  return @status == Configs.states.ids[:freeze]
end

#genderless?Boolean

Tell if the Pokemon is genderless

Returns:

  • (Boolean)


296
297
298
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 296

def genderless?
  gender == 0
end

#get_dv_value(value, old) ⇒ Integer

Get the adjusted IV

Parameters:

Returns:

  • (Integer)

    something between old and 31 (value in most case)



240
241
242
243
244
245
246
247
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 240

def get_dv_value(value, old)
  if value < 0
    return old
  elsif value > 31
    return 31
  end
  return value
end

#gif_back::Yuki::GifReader?

Return the GifReader back of the Pokemon

Returns:



218
219
220
221
222
223
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 218

def gif_back
  return nil unless @step_remaining

  filename = Pokemon.back_gif_filename(@id, @form, female?, shiny?, false)
  return filename && Yuki::GifReader.new(RPG::Cache.poke_back(filename, shiny? ? 1 : 0), true)
end

#gif_face::Yuki::GifReader?

Return the GifReader face of the Pokemon

Returns:



209
210
211
212
213
214
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 209

def gif_face
  return nil unless @step_remaining

  filename = Pokemon.front_gif_filename(@id, @form, female?, shiny?, false)
  return filename && Yuki::GifReader.new(RPG::Cache.poke_front(filename, shiny? ? 1 : 0), true)
end

#heightNumeric

Return the height of the Pokemon

Returns:

  • (Numeric)


344
345
346
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 344

def height
  return data.height
end

#hp_pokemon_numberString

Returns the HP text (to_pokemon_number)

Returns:



105
106
107
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 105

def hp_pokemon_number
  "#@hp / #{self.max_hp}".to_pokemon_number
end

#hp_textString

Returns the HP text

Returns:



99
100
101
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 99

def hp_text
  "#@hp / #{self.max_hp}"
end

#iconTexture

Return the icon of the Pokemon

Returns:



152
153
154
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00200 Pokemon Graphics.rb', line 152

def icon
  return RPG::Cache.b_icon(PFM::Pokemon.icon_filename(id, form, female?, shiny?, egg?))
end

#id_textString

Return the text of the Pokemon ID

Returns:



111
112
113
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 111

def id_text
  format('%03d', dex_id)
end

#id_text2String

Return the text of the Pokemon ID with N°

Returns:



117
118
119
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 117

def id_text2
  format('N°%03d', dex_id)
end

#id_text3String

Return the text of the Pokemon ID to pokemon number

Returns:



123
124
125
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 123

def id_text3
  format('%03d', dex_id).to_pokemon_number
end

#item_db_symbolSymbol

Return the db_symbol of the Pokemon's item held

Returns:

  • (Symbol)


386
387
388
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 386

def item_db_symbol
  return data_item($game_temp.in_battle ? (@battle_item || @item_holding) : @item_holding).db_symbol
end

#item_holdInteger

Alias for item_holding

Returns:



392
393
394
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 392

def item_hold
  return @item_holding
end

#item_nameString

Return the name of the item the Pokemon is holding

Returns:



58
59
60
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 58

def item_name
  return data_item(item_db_symbol).name
end

#iv_atk_textString

Return the IV ATK text

Returns:



340
341
342
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 340

def iv_atk_text
  format(iv_text, iv_atk)
end

#iv_ats_textString

Return the IV ATS text

Returns:



358
359
360
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 358

def iv_ats_text
  format(iv_text, iv_ats)
end

#iv_dfe_textString

Return the IV DFE text

Returns:



346
347
348
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 346

def iv_dfe_text
  format(iv_text, iv_dfe)
end

#iv_dfs_textString

Return the IV DFS text

Returns:



364
365
366
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 364

def iv_dfs_text
  format(iv_text, iv_dfs)
end

#iv_hp_textString

Return the IV HP text

Returns:



334
335
336
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 334

def iv_hp_text
  format(iv_text, iv_hp)
end

#iv_spd_textString

Return the IV SPD text

Returns:



352
353
354
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 352

def iv_spd_text
  format(iv_text, iv_spd)
end

#kyurem_form(reason)

Determine the form of the Kyurem

Parameters:

  • reason (Symbol)

    The db_symbol of the Pokemon used for the fusion



158
159
160
161
162
163
164
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 158

def kyurem_form(reason)
  return @form unless %i[reshiram zekrom none].include?(reason)
  return 1 if reason == :zekrom
  return 2 if reason == :reshiram

  return 0
end

#learn_skill(db_symbol) ⇒ Boolean?

Learn a new skill

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move in the database

Returns:

  • (Boolean, nil)

    true = learnt, false = already learnt, nil = couldn't learn



6
7
8
9
10
11
12
13
14
15
16
17
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 6

def learn_skill(db_symbol)
  move = data_move(db_symbol)
  return false if skill_learnt?(move.db_symbol, only_in_move_set: true)

  if @skills_set.size < 4
    @skills_set << PFM::Skill.new(move.db_symbol)
    @skill_learnt << move.db_symbol unless @skill_learnt.include?(move.id) || @skill_learnt.include?(move.db_symbol)
    form_calibrate if data.db_symbol == :keldeo
    return true
  end
  return nil
end

#level_pokemon_numberString

Return the level text (to_pokemon_number)

Returns:



87
88
89
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 87

def level_pokemon_number
  @level.to_s.to_pokemon_number
end

#level_textString

Returns the level text

Returns:



82
83
84
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 82

def level_text
  @level.to_s
end

#level_text2String

Return the level text with “Level: ” inside

Returns:



93
94
95
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 93

def level_text2
  "#{text_get(27, 29)}#@level"
end

#level_upBoolean

Increase the level of the Pokemon

Returns:

  • (Boolean)

    if the level has successfully been increased



93
94
95
96
97
98
99
100
101
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 93

def level_up
  return false if @level >= PFM.game_state.level_max_limit

  exp_last = exp_list[@level]
  delta = exp_lvl - exp_last
  self.exp += (delta - (exp - exp_last))
  update_loyalty if $game_temp.in_battle
  return true
end

#level_up_stat_refreshArray<Array<Integer>>

Generate the level up stat list for the level up window

Returns:

  • (Array<Array<Integer>>)

    list0, list1 : old, new basis value



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 115

def level_up_stat_refresh
  st = $game_temp.in_battle
  $game_temp.in_battle = false
  list0 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]
  @level += 1 if @level < PFM.game_state.level_max_limit
  self.exp = exp_list[@level] if @exp < exp_list[@level].to_i
  self.exp = exp # Fix the exp amount
  hp_diff = list0[0] - @hp
  list1 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]
  self.hp = (max_hp - hp_diff) if @hp > 0
  $game_temp.in_battle = st
  return [list0, list1]
end

#level_up_window_call(list0, list1, z_level)

Show the level up window

Parameters:

  • list0 (Array<Integer>)

    old basis stat list

  • list1 (Array<Integer>)

    new basis stat list

  • z_level (Integer)

    z superiority of the Window



133
134
135
136
137
138
139
140
141
142
143
144
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 133

def level_up_window_call(list0, list1, z_level)
  vp = $scene&.viewport
  window = UI::LevelUpWindow.new(vp, self, list0, list1)
  window.z = z_level
  Graphics.sort_z
  until Input.trigger?(:A)
    window.update
    Graphics.update
  end
  $game_system.se_play($data_system.decision_se)
  window.dispose
end

#load_skill_from_array(skills)

Load the skill from an Array

Parameters:

  • skills (Array)

    the skills array (containing IDs or Symbols)



136
137
138
139
140
141
142
143
144
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 136

def load_skill_from_array(skills)
  skills.each_with_index do |skill, j|
    next skills_set[j] = nil if skill == :__remove__
    next if skill == 0 || skill == :__undef__ || skill.is_a?(String)

    replace_skill_index(j, skill)
  end
  skills_set.compact!
end

#male?Boolean

Tell if the Pokemon is a male

Returns:

  • (Boolean)


302
303
304
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 302

def male?
  gender == 1
end

#max_hpInteger

Return the max HP of the Pokemon

Returns:



41
42
43
44
45
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 41

def max_hp
  return 1 if db_symbol == :shedinja

  return ((@iv_hp + 2 * base_hp + @ev_hp / 4) * @level) / 100 + 10 + @level
end

#max_levelInteger

Give the maximum level of the Pokemon

Returns:



204
205
206
207
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 204

def max_level
  infinity = Float::INFINITY
  return [@max_level || infinity, PFM.game_state.level_max_limit || infinity, Configs.settings.max_level].min.clamp(1, Float::INFINITY)
end

#max_level=(level)

Set the maximum level of the Pokemon

Parameters:



211
212
213
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 211

def max_level=(level)
  @max_level = level.is_a?(Integer) ? level : nil
end

#mega_evolve

Mega evolve the Pokemon (if possible)



44
45
46
47
48
49
50
51
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 44

def mega_evolve
  mega_evolution = can_mega_evolve?
  return unless mega_evolution

  @mega_evolved = @form
  @form = mega_evolution
  self.ability = data_ability(data.abilities[rand(3)]).id # Pokemon will always be a PFM::PokemonBattler
end

#mega_evolved?Boolean

Is the Pokemon mega evolved ?

Returns:

  • (Boolean)


63
64
65
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 63

def mega_evolved?
  return @mega_evolved != false
end

#modifier_stage(stage) ⇒ Float

Return the stage modifier (multiplier)

Parameters:

  • stage (Integer)

    the value of the stage

Returns:

  • (Float)

    the multiplier



186
187
188
189
190
191
192
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 186

def modifier_stage(stage)
  if stage >= 0
    return (2 + stage) / 2.0
  else
    return 2.0 / (2 - stage)
  end
end

#nameString

Return the Pokemon name in the Pokedex

Returns:



5
6
7
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 5

def name
  return Studio::Text.get(0,@step_remaining==0 ? @id : 0)
end

#name_upperString

Return the Pokemon name upcase in the Pokedex

Returns:



11
12
13
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 11

def name_upper
  return Studio::Text.get(0,@step_remaining==0 ? @id : 0).upcase
end

#nature_idInteger

Return the nature id of the Pokemon

Returns:



326
327
328
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 326

def nature_id
  return @nature
end

#nature_textString

Return the text of the nature

Returns:



38
39
40
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 38

def nature_text
  return text_get(8, nature.first)
end

#necrozma_form(reason)

Determine the form of the Necrozma

Parameters:

  • reason (Symbol)

    The db_symbol of the Pokemon used for the fusion



168
169
170
171
172
173
174
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 168

def necrozma_form(reason)
  return @form unless %i[solgaleo lunala none].include?(reason)
  return 1 if reason == :solgaleo
  return 2 if reason == :lunala

  return 0
end

#no_preferences?Boolean

Check if the Creature has a nature with no preferences

Returns:

  • (Boolean)


20
21
22
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/02000 Pokemon Flavors.rb', line 20

def no_preferences?
  return Configs.flavors.nature_with_no_preferences.include?(nature_id)
end

#paralyzed?Boolean

Is the Pokemon paralyzed?

Returns:

  • (Boolean)


55
56
57
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 55

def paralyzed?
  return @status == Configs.states.ids[:paralysis]
end

#poisoned?Boolean

Is the Pokemon poisoned?

Returns:

  • (Boolean)


29
30
31
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 29

def poisoned?
  return @status == Configs.states.ids[:poison]
end

#primary_dataStudio::CreatureForm

Get the primary data of the Pokemon



191
192
193
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 191

def primary_data
  data_creature(db_symbol).forms[0]
end

#rarenessInteger

Return the Pokemon rareness

Returns:



332
333
334
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 332

def rareness
  return @rareness || data.catch_rate
end

#rareness=(v)

Change the Pokemon rareness

Parameters:

  • v (Integer, nil)

    the new rareness of the Pokemon



338
339
340
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 338

def rareness=(v)
  @rareness = v&.clamp(0, 255)
end

#remindable_skills(mode = 0) ⇒ Array<Symbol>

Get the list of all the skill the Pokemon can learn again

Parameters:

  • mode (Integer) (defaults to: 0)

    Define the moves that can be learnt again : 1 = breed_moves + learnt + potentially_learnt 2 = all moves other = learnt + potentially_learnt

Returns:

  • (Array<Symbol>)


123
124
125
126
127
128
129
130
131
132
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 123

def remindable_skills(mode = 0)
  move_set = data.move_set
  level = mode == 2 ? Float::INFINITY : @level

  moves = move_set.select { |move| move.level_learnable? && level >= move.level }.map(&:move)
  moves.concat(@skill_learnt.map { |move| move.is_a?(Integer) ? data_move(move).db_symbol : move })
  moves.concat(move_set.select { |move| move.breed_learnable? || move.evolution_learnable? }.map(&:move))

  return (moves - skills_set.map(&:db_symbol)).uniq
end

#replace_skill_index(index, db_symbol)

Replace the skill at a specific index

Parameters:

  • index (Integer)

    index of the skill to replace by a new skill

  • db_symbol (Symbol)

    db_symbol of the move in the database



38
39
40
41
42
43
44
45
46
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 38

def replace_skill_index(index, db_symbol)
  return if index >= 4

  move = data_move(db_symbol)
  @skills_set[index] = PFM::Skill.new(move.db_symbol)
  @skills_set.compact!
  @skill_learnt << move.db_symbol unless @skill_learnt.include?(move.id) || @skill_learnt.include?(move.db_symbol)
  form_calibrate if data.db_symbol == :keldeo
end

#ribbon_got?(id) ⇒ Boolean

Has the pokemon got a ribbon ?

Returns:

  • (Boolean)


418
419
420
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 418

def ribbon_got?(id)
  return @ribbons.include?(id)
end

#separate

Separate (if possible) the Pokemon and restore the Pokemon used in the fusion



78
79
80
81
82
83
84
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 78

def separate
  return unless @fusion || $actors.size != 6

  form_calibrate(:none)
  $actors << @fusion
  @fusion = nil
end

#shaymin_form(reason)

Determine the form of Shaymin

Parameters:

  • reason (Symbol)


148
149
150
151
152
153
154
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 148

def shaymin_form(reason)
  return 0 if frozen?
  return 1 if @form == 1 && ($env.morning? || $env.day?)
  return 1 if reason == :gracidea && ($env.morning? || $env.day?)

  return 0
end

#shiny=(shiny)

Set the shiny attribut

Parameters:

  • shiny (Boolean)


224
225
226
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 224

def shiny=(shiny)
  @code = (@code & 0xFFFF0000) | (shiny ? 0 : 0xFFFF)
end

#shiny?Boolean Also known as: shiny

Get the shiny attribute

Returns:

  • (Boolean)


217
218
219
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 217

def shiny?
  return (@code & 0xFFFF) < shiny_rate || @shiny
end

#shiny_rateInteger

Give the shiny rate for the Pokemon, The number should be between 0 & 0xFFFF. 0 means absolutely no chance to be shiny, 0xFFFF means always shiny

Returns:



231
232
233
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 231

def shiny_rate
  16
end

#skill_learnt?(db_symbol, only_in_move_set: true) ⇒ Boolean Also known as: has_skill?

Has the pokemon already learnt a skill ?

Parameters:

  • db_symbol (Symbol)

    db_symbol of the move

  • only_in_move_set (Boolean) (defaults to: true)

    if the function only check in the current move set

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 52

def skill_learnt?(db_symbol, only_in_move_set: true)
  return false if egg?

  move = data_move(db_symbol)
  return true if @skills_set.any? { |skill| skill && skill.db_symbol == move.db_symbol }
  return false if only_in_move_set

  return @skill_learnt.include?(move.id) || @skill_learnt.include?(move.db_symbol)
end

#sleep_checkBoolean

Check if the Pokemon is still asleep

Returns:

  • (Boolean)

    true = the Pokemon is still asleep



137
138
139
140
141
142
143
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 137

def sleep_check
  @status_count -= 1
  return true if @status_count > 0

  @status = 0
  return false
end

#spdInteger

Return the current spd

Returns:



61
62
63
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 61

def spd
  return (spd_basis * spd_modifier).floor
end

#spd_basisInteger

Return the spd stat without battle modifier

Returns:



263
264
265
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 263

def spd_basis
  return calc_regular_stat(base_spd, @iv_spd, @ev_spd, 3)
end

#spd_modifierFloat

Return the spd modifier

Returns:

  • (Float)

    the multiplier



208
209
210
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 208

def spd_modifier
  return modifier_stage(spd_stage)
end

#spd_stageInteger

Return the spd stage

Returns:



91
92
93
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00700 Pokemon Stats.rb', line 91

def spd_stage
  return @battle_stage[2]
end

#status?Boolean

Is the pokemon affected by a status

Returns:

  • (Boolean)


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

def status?
  return @status != 0
end

#status_burn(forcing = false) ⇒ Boolean

Burn the Pokemon

Parameters:

  • forcing (Boolean) (defaults to: false)

    force the new status

Returns:

  • (Boolean)

    if the pokemon has been burnt



89
90
91
92
93
94
95
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 89

def status_burn(forcing = false)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:burn]
    return true
  end
  return false
end

#status_frozen(forcing = false) ⇒ Boolean

Freeze the Pokemon

Parameters:

  • forcing (Boolean) (defaults to: false)

    force the new status

Returns:

  • (Boolean)

    if the pokemon has been frozen



154
155
156
157
158
159
160
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 154

def status_frozen(forcing = false)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:freeze]
    return true
  end
  return false
end

#status_paralyze(forcing = false) ⇒ Boolean

Paralyze the Pokemon

Parameters:

  • forcing (Boolean) (defaults to: false)

    force the new status

Returns:

  • (Boolean)

    if the pokemon has been paralyzed



62
63
64
65
66
67
68
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 62

def status_paralyze(forcing = false)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:paralysis]
    return true
  end
  return false
end

#status_poison(forcing = false) ⇒ Boolean

Empoison the Pokemon

Parameters:

  • forcing (Boolean) (defaults to: false)

    force the new status

Returns:

  • (Boolean)

    if the pokemon has been empoisoned



36
37
38
39
40
41
42
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 36

def status_poison(forcing = false)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:poison]
    return true
  end
  return false
end

#status_sleep(forcing = false, nb_turn = nil) ⇒ Boolean

Put the Pokemon to sleep

Parameters:

  • forcing (Boolean) (defaults to: false)

    force the new status

  • nb_turn (Integer, nil) (defaults to: nil)

    number of turn the Pokemon will sleep

Returns:

  • (Boolean)

    if the pokemon has been put to sleep



113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 113

def status_sleep(forcing = false, nb_turn = nil)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:sleep]
    if nb_turn
      @status_count = nb_turn
    else
      @status_count = $scene.is_a?(Battle::Scene) ? $scene.logic.generic_rng.rand(2..5) : rand(2..5)
    end
    @status_count = (@status_count / 2).floor if $scene.is_a?(Battle::Scene) ? has_ability?(:early_bird) : ability_db_symbol == :early_bird
    return true
  end
  return false
end

#status_toxic(forcing = true) ⇒ Boolean

Intoxicate the Pokemon

Parameters:

  • forcing (Boolean) (defaults to: true)

    force the new status

Returns:

  • (Boolean)

    if the pokemon has been intoxicated



179
180
181
182
183
184
185
186
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 179

def status_toxic(forcing = true)
  if (@status == 0 || forcing) && !dead?
    @status = Configs.states.ids[:toxic]
    @status_count = 0
    return true
  end
  return false
end

#swap_skills_index(index1, index2)

Swap the position of two skills in the skills_set

Parameters:

  • index1 (Integer)

    Index of the first skill to swap

  • index2 (Integer)

    Index of the second skill to swap



30
31
32
33
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00600 Pokemon Skills.rb', line 30

def swap_skills_index(index1, index2)
  @skills_set[index1], @skills_set[index2] = @skills_set[index2], @skills_set[index1]
  @skills_set.compact!
end

#to_sString

Convert the Pokemon to a string (battle debug)

Returns:



32
33
34
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 32

def to_s
  return "<P:#{self.given_name}_#{@code.to_s(36)}_#{@position}>"
end

#total_evInteger

Return the total amount of EV

Returns:



46
47
48
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00300 Pokemon EV.rb', line 46

def total_ev
  return @ev_hp + @ev_atk + @ev_dfe + @ev_spd + @ev_ats + @ev_dfs
end

#toxic?Boolean

Is the Pokemon in toxic state ?

Returns:

  • (Boolean)


172
173
174
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00800 Pokemon Status.rb', line 172

def toxic?
  return @status == Configs.states.ids[:toxic]
end

#trainer_id_textString

Return the normalized text trainer id of the Pokemon

Returns:



76
77
78
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/01100 Pokemon Text.rb', line 76

def trainer_id_text
  return sprintf("%05d", self.trainer_id)
end

#type?(type) ⇒ Boolean

Check the Pokemon type by the type ID

Parameters:

  • type (Integer)

    ID of the type in the database

Returns:

  • (Boolean)


147
148
149
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 147

def type?(type)
  return (type1 == type || type2 == type || (type3 == type && type != 0))
end

#type_bug?Boolean Also known as: type_insect?

Is the Pokemon type insect/bug ?

Returns:

  • (Boolean)


98
99
100
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 98

def type_bug?
  return type?(data_type(:bug).id)
end

#type_dark?Boolean Also known as: type_tenebre?

Is the Pokemon type dark ?

Returns:

  • (Boolean)


132
133
134
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 132

def type_dark?
  return type?(data_type(:dark).id)
end

#type_dragon?Boolean

Is the Pokemon type dragon ?

Returns:

  • (Boolean)


119
120
121
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 119

def type_dragon?
  return type?(data_type(:dragon).id)
end

#type_electric?Boolean Also known as: type_electrique?

Is the Pokemon type electric ?

Returns:

  • (Boolean)


42
43
44
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 42

def type_electric?
  return type?(data_type(:electric).id)
end

#type_fairy?Boolean Also known as: type_fee?

Is the Pokemon type fairy ?

Returns:

  • (Boolean)


139
140
141
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 139

def type_fairy?
  return type?(data_type(:fairy).id)
end

#type_fighting?Boolean Also known as: type_combat?

Is the Pokemon type fighting ?

Returns:

  • (Boolean)


63
64
65
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 63

def type_fighting?
  return type?(data_type(:fighting).id)
end

#type_fire?Boolean Also known as: type_feu?

Is the Pokemon type fire ?

Returns:

  • (Boolean)


29
30
31
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 29

def type_fire?
  return type?(data_type(:fire).id)
end

#type_flying?Boolean Also known as: type_vol?, type_fly?

Is the Pokemon type fly ?

Returns:

  • (Boolean)


83
84
85
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 83

def type_flying?
  return type?(data_type(:flying).id)
end

#type_ghost?Boolean Also known as: type_spectre?

Is the Pokemon type ghost ?

Returns:

  • (Boolean)


112
113
114
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 112

def type_ghost?
  return type?(data_type(:ghost).id)
end

#type_grass?Boolean Also known as: type_plante?

Is the Pokemon type grass ?

Returns:

  • (Boolean)


49
50
51
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 49

def type_grass?
  return type?(data_type(:grass).id)
end

#type_ground?Boolean Also known as: type_sol?

Is the Pokemon type ground ?

Returns:

  • (Boolean)


76
77
78
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 76

def type_ground?
  return type?(data_type(:ground).id)
end

#type_ice?Boolean Also known as: type_glace?

Is the Pokemon type ice ?

Returns:

  • (Boolean)


56
57
58
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 56

def type_ice?
  return type?(data_type(:ice).id)
end

#type_normal?Boolean

Is the Pokemon type normal ?

Returns:

  • (Boolean)


23
24
25
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 23

def type_normal?
  return type?(data_type(:normal).id)
end

#type_poison?Boolean

Is the Pokemon type poison ?

Returns:

  • (Boolean)


70
71
72
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 70

def type_poison?
  return type?(data_type(:poison).id)
end

#type_psychic?Boolean Also known as: type_psy?

Is the Pokemon type psy ?

Returns:

  • (Boolean)


91
92
93
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 91

def type_psychic?
  return type?(data_type(:psychic).id)
end

#type_rock?Boolean Also known as: type_roche?

Is the Pokemon type rock ?

Returns:

  • (Boolean)


105
106
107
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 105

def type_rock?
  return type?(data_type(:rock).id)
end

#type_steel?Boolean Also known as: type_acier?

Is the Pokemon type steel ?

Returns:

  • (Boolean)


125
126
127
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 125

def type_steel?
  return type?(data_type(:steel).id)
end

#type_water?Boolean Also known as: type_eau?

Is the Pokemon type water ?

Returns:

  • (Boolean)


36
37
38
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 36

def type_water?
  return type?(data_type(:water).id)
end

#unmega_evolve

Reset the Pokemon to its normal form after mega evolution



54
55
56
57
58
59
60
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00500 Pokemon Forms.rb', line 54

def unmega_evolve
  if @mega_evolved
    @form = @mega_evolved
    restore_ability # Pokemon will always be a PFM::PokemonBattler
    @mega_evolved = false
  end
end

#update_ability

Update the Pokemon Ability



297
298
299
300
301
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 297

def update_ability
  return unless @ability_index

  @ability = get_data.abilities[@ability_index.to_i]
end

#update_loyalty

Update the Pokemon loyalty



104
105
106
107
108
109
110
111
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 104

def update_loyalty
  value = 3
  value = 4 if loyalty < 200
  value = 5 if loyalty < 100
  value *= 2 if data_item(captured_with).db_symbol == :luxury_ball
  value *= 1.5 if item_db_symbol == :soothe_bell
  self.loyalty += value.floor
end

#weightNumeric

Return the weight of the Pokemon

Returns:

  • (Numeric)


350
351
352
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 350

def weight
  return data.weight
end

#zone_id(special_zone = nil)

Get the zone id where the Pokemon has been found

Parameters:

  • special_zone (Integer, nil) (defaults to: nil)

    if you want to use this function for stuff like egg_zone_id



274
275
276
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 274

def zone_id(special_zone = nil)
  (special_zone || @captured_in) & 0x0000FFFF
end