Class: PFM::Pokemon
- 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
Direct Known Subclasses
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
%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
-
.evolution_criteria ⇒ Hash{ Symbol => Proc }
readonly
List of evolution criteria.
-
.evolution_reason_required_criteria ⇒ Hash{ Symbol => Array<Symbol> }
readonly
List of evolution criteria required for specific reason.
Instance Attribute Summary collapse
-
#ability ⇒ Integer
Return the current ability of the Pokemon.
-
#ability_index ⇒ Integer?
Index of the ability in the Pokemon data.
-
#ability_used ⇒ Boolean
If the Truant (Absenteisme) ability has been “used”.
-
#attack_order ⇒ Integer
Attack order value tells when the Pokemon attacks (used to test if attack before another pokemon).
-
#battle_item ⇒ Integer?
ID of the item the Pokemon is holding in battle.
-
#battle_item_data ⇒ Array?
Various data information of the item during battle.
-
#battle_stage ⇒ Array(Integer, Integer, Integer, Integer, Integer, Integer, Integer)
The battle Stage of the Pokemon [atk, dfe, spd, ats, dfs, eva, acc].
-
#battle_turns ⇒ Integer
Number of turn the Pokemon has fought.
-
#captured_at ⇒ Integer
Time when the Pokemon was captured (in seconds from jan 1970).
-
#captured_in ⇒ Integer
Zone (id) where the Pokemon was captured mixed with the Gemme 4.0 Flag.
-
#captured_level ⇒ Integer
Level of the Pokemon when the Pokemon was caught.
-
#captured_with ⇒ Integer
ID of the item used to catch the Pokemon.
-
#character ⇒ String
Character filename of the Pokemon (FollowMe optimizations).
-
#code ⇒ Integer
Code of the pokemon.
-
#confuse ⇒ Boolean
If the pokemon is confused.
- #critical_modifier
-
#egg_at ⇒ Integer
Time when the Egg has been obtained.
-
#egg_in ⇒ Integer
Zone (id) where the Egg has been obtained.
-
#ev_atk ⇒ Integer
ATK Effort Value.
-
#ev_ats ⇒ Integer
ATS Effort Value.
-
#ev_dfe ⇒ Integer
DFE Effort Value.
-
#ev_dfs ⇒ Integer
DFS Effort Value.
-
#ev_hp ⇒ Integer
HP Effort Value.
-
#ev_spd ⇒ Integer
SPD Effort Value.
-
#exp ⇒ Integer
The total amount of exp the Pokemon got.
-
#exp_rate ⇒ Float
The rate of exp point the Pokemon has in its level.
-
#form ⇒ Integer
Form Index of the Pokemon, ex: Unkown A = 0, Unkown Z = 25.
-
#game_code ⇒ Integer?
Code of the game where the Pokemon comes from (nil if the Pokemon hasn't been tainted by GTS system).
-
#gender ⇒ Integer
Gender of the Pokemon : 0 = no gender, 1 = male, 2 = female.
-
#given_name ⇒ String
(also: #nickname)
Return the given name of the Pokemon (Pokedex name if no given name).
-
#hp ⇒ Integer
The current HP the Pokemon has.
-
#hp_rate ⇒ Float
The rate of HP the Pokemon has.
-
#id ⇒ Integer
ID of the Pokemon in the database.
-
#item_holding ⇒ Integer
ID of the item the Pokemon is holding.
-
#iv_atk ⇒ Integer
ATK Individual Value.
-
#iv_ats ⇒ Integer
ATS Individual Value.
-
#iv_dfe ⇒ Integer
DFE Individual Value.
-
#iv_dfs ⇒ Integer
DFS Individual Value.
-
#iv_hp ⇒ Integer
HP Individual Value.
-
#iv_spd ⇒ Integer
SPD Individual Value.
-
#level ⇒ Integer
Current Level of the Pokemon.
-
#loyalty ⇒ Integer
Happiness/loyalty of the Pokemon (0 no bonds, 255 full bonds).
-
#memo_text ⇒ Array<Integer>
Memo text [file_id, text_id].
-
#nature ⇒ Array<Integer>
Return the nature data of the Pokemon.
-
#position ⇒ Integer?
The position in the Battle, > 0 = actor, < 0 = enemy (index = -position-1), nil = not fighting.
-
#prepared_skill ⇒ Integer
ID of the skill the Pokemon would like to use.
-
#ribbons ⇒ Array<Integer>
List of Ribbon ID the Pokemon got.
-
#skill_learnt ⇒ Array<Integer>
readonly
List of Skill id the Pokemon learnt during its life.
-
#skills_set ⇒ Array<PFM::Skill>
(also: #moveset)
The current moveset of the Pokemon.
-
#status ⇒ Integer
ID of the status of the Pokemon.
-
#status_count ⇒ Integer
Internal status counter that helps some status to terminate or worsen.
-
#step_remaining ⇒ Integer
Number of step before the egg hatch (thus the Pokemon is an egg).
-
#sub_code ⇒ Integer?
Real code of the Pokemon when used transform (needed to test if roaming pokemon is ditto).
-
#sub_form ⇒ Integer?
Real form index of the Pokemon when used transform (needed to test if roaming pokemon is ditto).
-
#sub_id ⇒ Integer?
Real id of the Pokemon when used transform.
-
#trainer_id ⇒ Integer
Return the normalized trainer id of the Pokemon.
-
#trainer_name ⇒ String
Name of the original trainer.
-
#type1 ⇒ Integer
Return the current first type of the Pokemon.
-
#type2 ⇒ Integer
Return the current second type of the Pokemon.
-
#type3 ⇒ Integer
Return the current third type of the Pokemon.
Class Method Summary collapse
-
.add_evolution_criteria(key, reasons = nil, &block)
Add a new evolution criteria.
-
.back_filename(id, form, female, shiny, egg) ⇒ String
Return the back battler name.
-
.back_gif_filename(id, form, female, shiny, egg) ⇒ String?
Return the back gif name.
-
.front_filename(id, form, female, shiny, egg) ⇒ String
Return the front battler name.
-
.front_gif_filename(id, form, female, shiny, egg) ⇒ String?
Return the front gif name.
-
.generate_from_hash(hash) ⇒ PFM::Pokemon
Generate a Pokemon from a hash.
-
.icon_filename(id, form, female, shiny, egg) ⇒ String
Icon filename of a Pokemon.
Instance Method Summary collapse
-
#ability_db_symbol ⇒ Symbol
Return the db_symbol of the Pokemon's Ability.
-
#ability_descr ⇒ String
Reture the description of the current ability of the Pokemon.
-
#ability_name ⇒ String
Return the name of the current ability of the Pokemon.
-
#absofusion(pokemon)
Absofusion of the Pokemon (if possible).
-
#absofusionned? ⇒ Boolean
If the Pokemon is a absofusion.
-
#acc_stage ⇒ Integer
Return the accuracy stage.
-
#add_bonus(list) ⇒ Boolean?
Add ev bonus to a Pokemon (with item interaction : x2).
-
#add_ev_atk(n, evs) ⇒ Boolean
Safely add ATK EV.
-
#add_ev_ats(n, evs) ⇒ Boolean
Safely add ATS EV.
-
#add_ev_dfe(n, evs) ⇒ Boolean
Safely add DFE EV.
-
#add_ev_dfs(n, evs) ⇒ Boolean
Safely add DFS EV.
-
#add_ev_hp(n, evs) ⇒ Boolean
Safely add HP EV.
-
#add_ev_spd(n, evs) ⇒ Boolean
Safely add SPD EV.
-
#add_ribbon(id)
Add a ribbon to the Pokemon.
-
#alive? ⇒ Boolean
Is the Pokemon able to fight.
-
#asleep? ⇒ Boolean
Is the Pokemon asleep?.
-
#atk ⇒ Integer
Return the current atk.
-
#atk_basis ⇒ Integer
Return the atk stat without battle modifier.
-
#atk_modifier ⇒ Float
Return the atk modifier.
-
#atk_stage ⇒ Integer
Return the atk stage.
-
#ats ⇒ Integer
Return the current ats.
-
#ats_basis ⇒ Integer
Return the ats stat without battle modifier.
-
#ats_modifier ⇒ Float
Return the ats modifier.
-
#ats_stage ⇒ Integer
Return the ats stage.
-
#ball_color ⇒ Color
Return the ball color of the Pokemon (flash).
-
#ball_image ⇒ Texture
Return the ball image of the Pokemon.
-
#ball_sprite ⇒ String
Return the ball sprite name of the Pokemon.
-
#base_atk ⇒ Integer
Return the base ATK.
-
#base_ats ⇒ Integer
Return the base ATS.
-
#base_dfe ⇒ Integer
Return the base DFE.
-
#base_dfs ⇒ Integer
Return the base DFS.
-
#base_exp ⇒ Integer
Return the base experience of the Pokemon.
-
#base_hp ⇒ Integer
Return the base HP.
-
#base_spd ⇒ Integer
Return the base SPD.
-
#battle_list ⇒ Array<Integer>
Return the list of EV the pokemon gives when beaten.
-
#battler_back ⇒ Texture
Return the back battle of the Pokemon.
-
#battler_face ⇒ Texture
(also: #battler_front)
Return the front battler of the Pokemon.
-
#burn? ⇒ Boolean
(also: #burnt?)
Is the Pokemon burnt?.
-
#calyrex_form(reason)
Determine the form of the Calyrex.
-
#can_be_asleep? ⇒ Boolean
Can the Pokemon be asleep?.
-
#can_be_burn? ⇒ Boolean
Can the Pokemon be burnt?.
-
#can_be_frozen?(skill_type = 0) ⇒ Boolean
Can the Pokemon be frozen?.
-
#can_be_paralyzed? ⇒ Boolean
Can the Pokemon be paralyzed?.
-
#can_be_poisoned? ⇒ Boolean
Can the Pokemon be poisoned ?.
-
#can_learn?(db_symbol) ⇒ Boolean?
Check if the Pokemon can learn a skill.
-
#can_learn_skill_at_this_level?(level = @level) ⇒ Boolean
Can learn skill at this level.
-
#can_mega_evolve? ⇒ Integer, false
Check if the Pokemon can mega evolve.
-
#captured_zone_name ⇒ String
Return the name of the zone where the Pokemon has been caught.
-
#caught_by_player? ⇒ Boolean
Tell if the Pokemon is caught by the trainer.
-
#change_acc(amount) ⇒ Integer
Change the acc stage.
-
#change_atk(amount) ⇒ Integer
Change the atk stage.
-
#change_ats(amount) ⇒ Integer
Change the ats stage.
-
#change_dfe(amount) ⇒ Integer
Change the dfe stage.
-
#change_dfs(amount) ⇒ Integer
Change the dfs stage.
-
#change_eva(amount) ⇒ Integer
Change the eva stage.
-
#change_spd(amount) ⇒ Integer
Change the spd stage.
-
#change_stat(stat_id, amount) ⇒ Integer
Change a stat stage.
-
#character_name ⇒ String
Return the character name of the Pokemon.
-
#check_skill_and_learn(silent = false, level = @level)
Check if the Pokemon can learn a new skill and make it learn the skill.
-
#cry ⇒ String
Return the cry file name of the Pokemon.
-
#cure
Cure the Pokemon from its statues modifications.
-
#current_deerling_form ⇒ Integer
Calculate the form of deerling & sawsbuck.
-
#data ⇒ Studio::CreatureForm
(also: #get_data)
Get the current data of the Pokemon.
-
#db_symbol ⇒ Symbol
Return the db_symbol of the Pokemon in the database.
-
#dead? ⇒ Boolean
Is the Pokemon not able to fight.
-
#dfe ⇒ Integer
Return the current dfe.
-
#dfe_basis ⇒ Integer
Return the dfe stat without battle modifier.
-
#dfe_modifier ⇒ Float
Return the dfe modifier.
-
#dfe_stage ⇒ Integer
Return the dfe stage.
-
#dfs ⇒ Integer
Return the current dfs.
-
#dfs_basis ⇒ Integer
Return the dfs stat without battle modifier.
-
#dfs_modifier ⇒ Float
Return the dfs modifier.
-
#dfs_stage ⇒ Integer
Return the dfs stage.
-
#dv_modifier(list)
Change the IV and update the statistics.
-
#edit_bonus(list) ⇒ Boolean?
Add ev bonus to a Pokemon (without item interaction).
-
#egg? ⇒ Boolean
(also: #egg)
Tell if the Pokemon is an egg or not.
-
#egg_finish
Ends the egg process of the Pokemon.
-
#egg_init
Initialize the egg process of the Pokemon.
-
#egg_zone_name ⇒ String
Return the name of the zone where the egg has been obtained.
-
#elv_armulys ⇒ Boolean
Check evolve condition to evolve in Silcoon (Armulys).
-
#elv_blindalys ⇒ Boolean
Check evolve condition to evolve in Cascoon (Blindalys).
-
#elv_demanta ⇒ Boolean
Check evolve condition to evolve in Mantine.
-
#elv_kapoera ⇒ Boolean
Check evolve condition to evolve in Hitmontop (Kapoera).
-
#elv_kicklee ⇒ Boolean
Check evolve condition to evolve in Hitmonlee (kicklee).
-
#elv_nymphali ⇒ Boolean
Check evolve condition to evolve in Sylveon (Nymphali).
-
#elv_pandarbare ⇒ Boolean
Check evolve condition to evolve in Pangoro (Pandarbare).
-
#elv_sepiatroce ⇒ Boolean
Check evolve condition to evolve in Malamar (Sepiatroce).
-
#elv_tygnon ⇒ Boolean
Check evolve condition to evolve in Hitmonchan (tygnon).
-
#encode ⇒ String
Encode the Pokemon to a String in order to send it to the GTS system.
-
#ev_atk_text ⇒ String
Return the EV ATK text.
-
#ev_ats_text ⇒ String
Return the EV ATS text.
-
#ev_check(index, apply = false, count = 1) ⇒ Integer, false
Automatic ev adder using an index.
-
#ev_dfe_text ⇒ String
Return the EV DFE text.
-
#ev_dfs_text ⇒ String
Return the EV DFS text.
-
#ev_hp_text ⇒ String
Return the EV HP text.
-
#ev_spd_text ⇒ String
Return the EV SPD text.
-
#ev_var(index, evs, value = 0) ⇒ Integer
Get and add EV.
-
#eva_stage ⇒ Integer
Return the evasion stage.
-
#evolve(id, form)
Method that actually make a Pokemon evolve.
-
#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.
-
#exp_list ⇒ ExpList
Return the exp curve.
-
#exp_lvl ⇒ Integer
Return the required total exp (so including old levels) to increase the Pokemon's level.
-
#exp_remaining_text ⇒ String
Return the text of the amount of exp the pokemon needs to go to the next level.
-
#exp_text ⇒ String
Return the text of the current pokemon experience.
-
#exp_type ⇒ Integer
Return the exp curve type ID.
-
#female? ⇒ Boolean
Tell if the Pokemon is a female.
-
#find_skill(db_symbol) ⇒ PFM::Skill, false
Find a skill in the moveset of the Pokemon.
-
#flags ⇒ Integer
Get Pokemon flags.
-
#flags=(flag)
Set the captured_in flags (to know from which game the pokemon came from).
-
#flavor_disliked?(flavor) ⇒ Boolean
Tell if the Creature dislikes flavor.
-
#flavor_liked?(flavor) ⇒ Boolean
Tell if the Creature likes flavor.
-
#forget_skill(db_symbol)
Forget a skill by its id.
-
#form_calibrate(reason = :menu) ⇒ Boolean
Automatically calibrate the form of the Pokemon.
-
#form_generation(form, old_value = nil) ⇒ Integer
Automatically generate the form index of the Pokemon.
-
#from_past? ⇒ Boolean
Tell if the pokemon is from a past version.
-
#from_player? ⇒ Boolean
Return if the Pokemon is from the player (he caught it).
-
#front_offset_y ⇒ Integer
Return the front offset y of the Pokemon.
-
#frozen? ⇒ Boolean
Is the Pokemon frozen?.
-
#genderless? ⇒ Boolean
Tell if the Pokemon is genderless.
-
#get_dv_value(value, old) ⇒ Integer
Get the adjusted IV.
-
#gif_back ⇒ ::Yuki::GifReader?
Return the GifReader back of the Pokemon.
-
#gif_face ⇒ ::Yuki::GifReader?
Return the GifReader face of the Pokemon.
-
#height ⇒ Numeric
Return the height of the Pokemon.
-
#hp_pokemon_number ⇒ String
Returns the HP text (to_pokemon_number).
-
#hp_text ⇒ String
Returns the HP text.
-
#icon ⇒ Texture
Return the icon of the Pokemon.
-
#id_text ⇒ String
Return the text of the Pokemon ID.
-
#id_text2 ⇒ String
Return the text of the Pokemon ID with N°.
-
#id_text3 ⇒ String
Return the text of the Pokemon ID to pokemon number.
-
#initialize(id, level, force_shiny = false, no_shiny = false, form = -1,, opts = {}) ⇒ Pokemon
constructor
Create a new Pokemon with specific parameters.
-
#item_db_symbol ⇒ Symbol
Return the db_symbol of the Pokemon's item held.
-
#item_hold ⇒ Integer
Alias for item_holding.
-
#item_name ⇒ String
Return the name of the item the Pokemon is holding.
-
#iv_atk_text ⇒ String
Return the IV ATK text.
-
#iv_ats_text ⇒ String
Return the IV ATS text.
-
#iv_dfe_text ⇒ String
Return the IV DFE text.
-
#iv_dfs_text ⇒ String
Return the IV DFS text.
-
#iv_hp_text ⇒ String
Return the IV HP text.
-
#iv_spd_text ⇒ String
Return the IV SPD text.
-
#kyurem_form(reason)
Determine the form of the Kyurem.
-
#learn_skill(db_symbol) ⇒ Boolean?
Learn a new skill.
-
#level_pokemon_number ⇒ String
Return the level text (to_pokemon_number).
-
#level_text ⇒ String
Returns the level text.
-
#level_text2 ⇒ String
Return the level text with “Level: ” inside.
-
#level_up ⇒ Boolean
Increase the level of the Pokemon.
-
#level_up_stat_refresh ⇒ Array<Array<Integer>>
Generate the level up stat list for the level up window.
-
#level_up_window_call(list0, list1, z_level)
Show the level up window.
-
#load_skill_from_array(skills)
Load the skill from an Array.
-
#male? ⇒ Boolean
Tell if the Pokemon is a male.
-
#max_hp ⇒ Integer
Return the max HP of the Pokemon.
-
#max_level ⇒ Integer
Give the maximum level of the Pokemon.
-
#max_level=(level)
Set the maximum level of the Pokemon.
-
#mega_evolve
Mega evolve the Pokemon (if possible).
-
#mega_evolved? ⇒ Boolean
Is the Pokemon mega evolved ?.
-
#modifier_stage(stage) ⇒ Float
Return the stage modifier (multiplier).
-
#name ⇒ String
Return the Pokemon name in the Pokedex.
-
#name_upper ⇒ String
Return the Pokemon name upcase in the Pokedex.
-
#nature_id ⇒ Integer
Return the nature id of the Pokemon.
-
#nature_text ⇒ String
Return the text of the nature.
-
#necrozma_form(reason)
Determine the form of the Necrozma.
-
#no_preferences? ⇒ Boolean
Check if the Creature has a nature with no preferences.
-
#paralyzed? ⇒ Boolean
Is the Pokemon paralyzed?.
-
#poisoned? ⇒ Boolean
Is the Pokemon poisoned?.
-
#primary_data ⇒ Studio::CreatureForm
Get the primary data of the Pokemon.
-
#rareness ⇒ Integer
Return the Pokemon rareness.
-
#rareness=(v)
Change the Pokemon rareness.
-
#remindable_skills(mode = 0) ⇒ Array<Symbol>
Get the list of all the skill the Pokemon can learn again.
-
#replace_skill_index(index, db_symbol)
Replace the skill at a specific index.
-
#ribbon_got?(id) ⇒ Boolean
Has the pokemon got a ribbon ?.
-
#separate
Separate (if possible) the Pokemon and restore the Pokemon used in the fusion.
-
#shaymin_form(reason)
Determine the form of Shaymin.
-
#shiny=(shiny)
Set the shiny attribut.
-
#shiny? ⇒ Boolean
(also: #shiny)
Get the shiny attribute.
-
#shiny_rate ⇒ Integer
Give the shiny rate for the Pokemon, The number should be between 0 & 0xFFFF.
-
#skill_learnt?(db_symbol, only_in_move_set: true) ⇒ Boolean
(also: #has_skill?)
Has the pokemon already learnt a skill ?.
-
#sleep_check ⇒ Boolean
Check if the Pokemon is still asleep.
-
#spd ⇒ Integer
Return the current spd.
-
#spd_basis ⇒ Integer
Return the spd stat without battle modifier.
-
#spd_modifier ⇒ Float
Return the spd modifier.
-
#spd_stage ⇒ Integer
Return the spd stage.
-
#status? ⇒ Boolean
Is the pokemon affected by a status.
-
#status_burn(forcing = false) ⇒ Boolean
Burn the Pokemon.
-
#status_frozen(forcing = false) ⇒ Boolean
Freeze the Pokemon.
-
#status_paralyze(forcing = false) ⇒ Boolean
Paralyze the Pokemon.
-
#status_poison(forcing = false) ⇒ Boolean
Empoison the Pokemon.
-
#status_sleep(forcing = false, nb_turn = nil) ⇒ Boolean
Put the Pokemon to sleep.
-
#status_toxic(forcing = true) ⇒ Boolean
Intoxicate the Pokemon.
-
#swap_skills_index(index1, index2)
Swap the position of two skills in the skills_set.
-
#to_s ⇒ String
Convert the Pokemon to a string (battle debug).
-
#total_ev ⇒ Integer
Return the total amount of EV.
-
#toxic? ⇒ Boolean
Is the Pokemon in toxic state ?.
-
#trainer_id_text ⇒ String
Return the normalized text trainer id of the Pokemon.
-
#type?(type) ⇒ Boolean
Check the Pokemon type by the type ID.
-
#type_bug? ⇒ Boolean
(also: #type_insect?)
Is the Pokemon type insect/bug ?.
-
#type_dark? ⇒ Boolean
(also: #type_tenebre?)
Is the Pokemon type dark ?.
-
#type_dragon? ⇒ Boolean
Is the Pokemon type dragon ?.
-
#type_electric? ⇒ Boolean
(also: #type_electrique?)
Is the Pokemon type electric ?.
-
#type_fairy? ⇒ Boolean
(also: #type_fee?)
Is the Pokemon type fairy ?.
-
#type_fighting? ⇒ Boolean
(also: #type_combat?)
Is the Pokemon type fighting ?.
-
#type_fire? ⇒ Boolean
(also: #type_feu?)
Is the Pokemon type fire ?.
-
#type_flying? ⇒ Boolean
(also: #type_vol?, #type_fly?)
Is the Pokemon type fly ?.
-
#type_ghost? ⇒ Boolean
(also: #type_spectre?)
Is the Pokemon type ghost ?.
-
#type_grass? ⇒ Boolean
(also: #type_plante?)
Is the Pokemon type grass ?.
-
#type_ground? ⇒ Boolean
(also: #type_sol?)
Is the Pokemon type ground ?.
-
#type_ice? ⇒ Boolean
(also: #type_glace?)
Is the Pokemon type ice ?.
-
#type_normal? ⇒ Boolean
Is the Pokemon type normal ?.
-
#type_poison? ⇒ Boolean
Is the Pokemon type poison ?.
-
#type_psychic? ⇒ Boolean
(also: #type_psy?)
Is the Pokemon type psy ?.
-
#type_rock? ⇒ Boolean
(also: #type_roche?)
Is the Pokemon type rock ?.
-
#type_steel? ⇒ Boolean
(also: #type_acier?)
Is the Pokemon type steel ?.
-
#type_water? ⇒ Boolean
(also: #type_eau?)
Is the Pokemon type water ?.
-
#unmega_evolve
Reset the Pokemon to its normal form after mega evolution.
-
#update_ability
Update the Pokemon Ability.
-
#update_loyalty
Update the Pokemon loyalty.
-
#weight ⇒ Numeric
Return the weight of the Pokemon.
-
#zone_id(special_zone = nil)
Get the zone id where the Pokemon has been found.
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
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_criteria ⇒ Hash{ Symbol => Proc } (readonly)
List of evolution criteria
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_criteria ⇒ Hash{ Symbol => Array<Symbol> } (readonly)
List of evolution criteria required for specific reason
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
#ability ⇒ Integer
Return the current ability of the Pokemon
398 399 400 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 398 def ability return @ability end |
#ability_index ⇒ Integer?
Index of the ability in the Pokemon data
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_used ⇒ Boolean
If the Truant (Absenteisme) ability has been “used”
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_order ⇒ Integer
Attack order value tells when the Pokemon attacks (used to test if attack before another pokemon)
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_item ⇒ Integer?
ID of the item the Pokemon is holding in battle
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_data ⇒ Array?
Various data information of the item during battle
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_stage ⇒ Array(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_turns ⇒ Integer
Number of turn the Pokemon has fought
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_at ⇒ Integer
Time when the Pokemon was captured (in seconds from jan 1970)
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_in ⇒ Integer
Zone (id) where the Pokemon was captured mixed with the Gemme 4.0 Flag
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_level ⇒ Integer
Level of the Pokemon when the Pokemon was caught
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_with ⇒ Integer
ID of the item used to catch the Pokemon
23 24 25 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 23 def captured_with @captured_with end |
#character ⇒ String
Character filename of the Pokemon (FollowMe optimizations)
116 117 118 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 116 def character @character end |
#code ⇒ Integer
Code of the pokemon
17 18 19 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 17 def code @code end |
#confuse ⇒ Boolean
If the pokemon is confused
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_at ⇒ Integer
Time when the Egg has been obtained
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_in ⇒ Integer
Zone (id) where the Egg has been obtained
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_atk ⇒ Integer
ATK Effort Value
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_ats ⇒ Integer
ATS Effort Value
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_dfe ⇒ Integer
DFE Effort Value
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_dfs ⇒ Integer
DFS Effort Value
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_hp ⇒ Integer
HP Effort Value
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_spd ⇒ Integer
SPD Effort Value
68 69 70 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 68 def ev_spd @ev_spd end |
#exp ⇒ Integer
The total amount of exp the Pokemon got
11 12 13 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 11 def exp @exp end |
#exp_rate ⇒ Float
The rate of exp point the Pokemon has in its level
101 102 103 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 101 def exp_rate @exp_rate end |
#form ⇒ Integer
Form Index of the Pokemon, ex: Unkown A = 0, Unkown Z = 25
56 57 58 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 56 def form @form end |
#game_code ⇒ Integer?
Code of the game where the Pokemon comes from (nil if the Pokemon hasn't been tainted by GTS system)
989 990 991 |
# File 'scripts/01450 Systems/09000 GTS/09000 GTS.rb', line 989 def game_code @game_code end |
#gender ⇒ Integer
Gender of the Pokemon : 0 = no gender, 1 = male, 2 = female
50 51 52 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 50 def gender @gender end |
#given_name ⇒ String Also known as: nickname
Return the given name of the Pokemon (Pokedex name if no given name)
47 48 49 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 47 def given_name @given_name end |
#hp ⇒ Integer
The current HP the Pokemon has
14 15 16 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 14 def hp @hp end |
#hp_rate ⇒ Float
The rate of HP the Pokemon has
98 99 100 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 98 def hp_rate @hp_rate end |
#id ⇒ Integer
ID of the Pokemon in the database
5 6 7 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 5 def id @id end |
#item_holding ⇒ Integer
ID of the item the Pokemon is holding
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_atk ⇒ Integer
ATK Individual Value
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_ats ⇒ Integer
ATS Individual Value
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_dfe ⇒ Integer
DFE Individual Value
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_dfs ⇒ Integer
DFS Individual Value
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_hp ⇒ Integer
HP Individual Value
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_spd ⇒ Integer
SPD Individual Value
86 87 88 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 86 def iv_spd @iv_spd end |
#level ⇒ Integer
Current Level of the Pokemon
8 9 10 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 8 def level @level end |
#loyalty ⇒ Integer
Happiness/loyalty of the Pokemon (0 no bonds, 255 full bonds)
53 54 55 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 53 def loyalty @loyalty end |
#memo_text ⇒ Array<Integer>
Memo text [file_id, text_id]
119 120 121 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 119 def memo_text @memo_text end |
#nature ⇒ Array<Integer>
Return the nature data of the Pokemon
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 |
#position ⇒ Integer?
The position in the Battle, > 0 = actor, < 0 = enemy (index = -position-1), nil = not fighting
160 161 162 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 160 def position @position end |
#prepared_skill ⇒ Integer
ID of the skill the Pokemon would like to use
172 173 174 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 172 def prepared_skill @prepared_skill end |
#ribbons ⇒ Array<Integer>
List of Ribbon ID the Pokemon got
122 123 124 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 122 def ribbons @ribbons end |
#skill_learnt ⇒ Array<Integer> (readonly)
List of Skill id the Pokemon learnt during its life
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_set ⇒ Array<PFM::Skill> Also known as: moveset
The current moveset of the Pokemon
128 129 130 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 128 def skills_set @skills_set end |
#status ⇒ Integer
ID of the status of the Pokemon
140 141 142 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 140 def status @status end |
#status_count ⇒ Integer
Internal status counter that helps some status to terminate or worsen
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_remaining ⇒ Integer
Number of step before the egg hatch (thus the Pokemon is an egg)
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_code ⇒ Integer?
Real code of the Pokemon when used transform (needed to test if roaming pokemon is ditto)
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_form ⇒ Integer?
Real form index of the Pokemon when used transform (needed to test if roaming pokemon is ditto)
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_id ⇒ Integer?
Real id of the Pokemon when used transform
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_id ⇒ Integer
Return the normalized trainer id of the Pokemon
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_name ⇒ String
Name of the original trainer
44 45 46 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 44 def trainer_name @trainer_name end |
#type1 ⇒ Integer
Return the current first type of the Pokemon
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 |
#type2 ⇒ Integer
Return the current second type of the Pokemon
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 |
#type3 ⇒ Integer
Return the current third type of the Pokemon
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
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
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
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
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
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
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
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_symbol ⇒ Symbol
Return the db_symbol of the Pokemon's Ability
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_descr ⇒ String
Reture the description of the current ability of the Pokemon
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_name ⇒ String
Return the name of the current ability of the Pokemon
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)
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
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_stage ⇒ Integer
Return the accuracy stage
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)
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
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
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
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
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
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
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
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
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?
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 |
#atk ⇒ Integer
Return the current atk
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_basis ⇒ Integer
Return the atk stat without battle modifier
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_modifier ⇒ Float
Return the atk modifier
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_stage ⇒ Integer
Return the atk stage
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 |
#ats ⇒ Integer
Return the current ats
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_basis ⇒ Integer
Return the ats stat without battle modifier
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_modifier ⇒ Float
Return the ats modifier
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_stage ⇒ Integer
Return the ats stage
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_color ⇒ Color
Return the ball color of the Pokemon (flash)
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_image ⇒ Texture
Return the ball image of the Pokemon
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_sprite ⇒ String
Return the ball sprite name of the Pokemon
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_atk ⇒ Integer
Return the base ATK
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_ats ⇒ Integer
Return the base ATS
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_dfe ⇒ Integer
Return the base DFE
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_dfs ⇒ Integer
Return the base DFS
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_exp ⇒ Integer
Return the base experience of the Pokemon
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_hp ⇒ Integer
Return the base HP
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_spd ⇒ Integer
Return the base SPD
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_list ⇒ Array<Integer>
Return the list of EV the pokemon gives when beaten
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_back ⇒ Texture
Return the back battle of the Pokemon
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_face ⇒ Texture Also known as: battler_front
Return the front battler of the Pokemon
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?
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
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?
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?
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?
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?
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 ?
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
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
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
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_name ⇒ String
Return the name of the zone where the Pokemon has been caught
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.(zone_name) end |
#caught_by_player? ⇒ Boolean
Tell if the Pokemon is caught by the trainer
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
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
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
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
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
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
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
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
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_name ⇒ String
Return the character name of the Pokemon
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
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 |
#cry ⇒ String
Return the cry file name of the Pokemon
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_form ⇒ Integer
Calculate the form of deerling & sawsbuck
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 |
#data ⇒ Studio::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_symbol ⇒ Symbol
Return the db_symbol of the Pokemon in the database
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
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 |
#dfe ⇒ Integer
Return the current dfe
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_basis ⇒ Integer
Return the dfe stat without battle modifier
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_modifier ⇒ Float
Return the dfe modifier
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_stage ⇒ Integer
Return the dfe stage
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 |
#dfs ⇒ Integer
Return the current dfs
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_basis ⇒ Integer
Return the dfs stat without battle modifier
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_modifier ⇒ Float
Return the dfs modifier
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_stage ⇒ Integer
Return the dfs stage
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
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)
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
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_name ⇒ String
Return the name of the zone where the egg has been obtained
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.(zone_name) end |
#elv_armulys ⇒ Boolean
Check evolve condition to evolve in Silcoon (Armulys)
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_blindalys ⇒ Boolean
Check evolve condition to evolve in Cascoon (Blindalys)
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_demanta ⇒ Boolean
Check evolve condition to evolve in Mantine
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_kapoera ⇒ Boolean
Check evolve condition to evolve in Hitmontop (Kapoera)
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_kicklee ⇒ Boolean
Check evolve condition to evolve in Hitmonlee (kicklee)
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_nymphali ⇒ Boolean
Check evolve condition to evolve in Sylveon (Nymphali)
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_pandarbare ⇒ Boolean
Check evolve condition to evolve in Pangoro (Pandarbare)
341 342 343 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00400 Pokemon exp & evolve.rb', line 341 def return $actors.any? { |pokemon| pokemon&.type_dark? } end |
#elv_sepiatroce ⇒ Boolean
uses :DOWN to validate the evolve condition
Check evolve condition to evolve in Malamar (Sepiatroce)
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_tygnon ⇒ Boolean
Check evolve condition to evolve in Hitmonchan (tygnon)
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 |
#encode ⇒ String
Encode the Pokemon to a String in order to send it to the GTS system
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_text ⇒ String
Return the EV ATK text
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_text ⇒ String
Return the EV ATS text
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
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_text ⇒ String
Return the EV DFE text
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_text ⇒ String
Return the EV DFS text
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_text ⇒ String
Return the EV HP text
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_text ⇒ String
Return the EV SPD text
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
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_stage ⇒ Integer
Return the evasion stage
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
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
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_list ⇒ ExpList
Return the exp curve
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_lvl ⇒ Integer
Return the required total exp (so including old levels) to increase the Pokemon's level
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_text ⇒ String
Return the text of the amount of exp the pokemon needs to go to the next level
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_text ⇒ String
Return the text of the current pokemon experience
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_type ⇒ Integer
Return the exp curve type ID
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
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
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 |
#flags ⇒ Integer
Get Pokemon flags
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)
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
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
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
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
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
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
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
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
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)
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_y ⇒ Integer
Return the front offset y of the Pokemon
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?
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
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
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
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
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 |
#height ⇒ Numeric
Return the height of the Pokemon
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_number ⇒ String
Returns the HP text (to_pokemon_number)
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_text ⇒ String
Returns the HP text
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 |
#icon ⇒ Texture
Return the icon of the Pokemon
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_text ⇒ String
Return the text of the Pokemon ID
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_text2 ⇒ String
Return the text of the Pokemon ID with N°
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_text3 ⇒ String
Return the text of the Pokemon ID to pokemon number
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_symbol ⇒ Symbol
Return the db_symbol of the Pokemon's item held
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_hold ⇒ Integer
Alias for item_holding
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_name ⇒ String
Return the name of the item the Pokemon is holding
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_text ⇒ String
Return the IV ATK text
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_text ⇒ String
Return the IV ATS text
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_text ⇒ String
Return the IV DFE text
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_text ⇒ String
Return the IV DFS text
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_text ⇒ String
Return the IV HP text
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_text ⇒ String
Return the IV SPD text
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
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
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_number ⇒ String
Return the level text (to_pokemon_number)
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_text ⇒ String
Returns the level text
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_text2 ⇒ String
Return the level text with “Level: ” inside
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_up ⇒ Boolean
Increase the level of the Pokemon
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_refresh ⇒ Array<Array<Integer>>
Generate the level up stat list for the level up window
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
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&. 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
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
302 303 304 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00002 Properties.rb', line 302 def male? gender == 1 end |
#max_hp ⇒ Integer
Return the max HP of the Pokemon
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_level ⇒ Integer
Give the maximum level of the Pokemon
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
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 ?
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)
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 |
#name ⇒ String
Return the Pokemon name in the Pokedex
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_upper ⇒ String
Return the Pokemon name upcase in the Pokedex
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_id ⇒ Integer
Return the nature id of the Pokemon
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_text ⇒ String
Return the text of the nature
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
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
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?
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?
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_data ⇒ Studio::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 |
#rareness ⇒ Integer
Return the Pokemon rareness
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
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
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
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 ?
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
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
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
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_rate ⇒ Integer
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
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 ?
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_check ⇒ Boolean
Check if 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 |
#spd ⇒ Integer
Return the current spd
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_basis ⇒ Integer
Return the spd stat without battle modifier
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_modifier ⇒ Float
Return the spd modifier
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_stage ⇒ Integer
Return the spd stage
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
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
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
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
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
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
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
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
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_s ⇒ String
Convert the Pokemon to a string (battle debug)
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_ev ⇒ Integer
Return the total amount of EV
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 ?
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_text ⇒ String
Return the normalized text trainer id of the Pokemon
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
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
83 84 85 |
# File 'scripts/01450 Systems/00000 General/00001 PFM/00300 Pokemon/00900 Pokemon Types.rb', line 83 def return type?(data_type(:flying).id) end |
#type_ghost? ⇒ Boolean Also known as: type_spectre?
Is the Pokemon type ghost ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 ?
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 |
#weight ⇒ Numeric
Return the weight of the Pokemon
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
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 |