PokeLib v0.1.1 PokeLib.Gen1.Pokemon View Source
Decode/Encode Pokemon binaries. Info can be found here
Link to this section Summary
Functions
Decode a pokemon from binary data
Decodes two bytes into iv data.
- The first byte is attack and defense ivs.
- The second byte is speed and special ivs
Decodes a pp data byte. The first 2 bits are applied pp ups, the last 6 bits are the ammount of pp
Decodes a status byte into a human readable name. Info here
Decodes a type binary to a human readable name. Info here
Encode a Pokemon back to a binary
Encodes attack, defense, speed, and special iv values to 2 bytes
Encodes pp data into a single byte
Encodes a status to a single byte. Info here
Examples
Encodes a type to a binary. Info here
Translate an index to a human readable name. Info here
Translate an index to a human readable move name. Info here
Translate a move name to a machine readable index. Info here
Translate a pokemon name to a machine readable index. Info here
Link to this section Functions
Decode a pokemon from binary data.
Decodes two bytes into iv data.
- The first byte is attack and defense ivs.
- The second byte is speed and special ivs.
Examples
iex> PokeLib.Gen1.Pokemon.decode_iv_data(<<102, 33>>) {6, 6, 2, 1}
Decodes a pp data byte. The first 2 bits are applied pp ups, the last 6 bits are the ammount of pp.
Examples
iex> PokeLib.Gen1.Pokemon.decode_pp_data(<<94>>) {30, 1}
Decodes a status byte into a human readable name. Info here
Examples
iex> PokeLib.Gen1.Pokemon.decode_status(<<0>>) “None”
iex> PokeLib.Gen1.Pokemon.decode_status(<<255>>) “Asleep”
iex> PokeLib.Gen1.Pokemon.decode_status(<<120>>) “Poisoned”
Decodes a type binary to a human readable name. Info here
Examples
iex> PokeLib.Gen1.Pokemon.decode_type(<<0x08>>) “Ghost”
iex> PokeLib.Gen1.Pokemon.decode_type(<<0x02>>) “Flying”
Encode a Pokemon back to a binary.
Encodes attack, defense, speed, and special iv values to 2 bytes.
Examples
iex> PokeLib.Gen1.Pokemon.encode_iv_data(6,6,2,1) <<102, 33>>
Encodes a status to a single byte. Info here
Examples
iex> PokeLib.Gen1.Pokemon.encode_status(“Asleep”) <<0x04>>
iex> PokeLib.Gen1.Pokemon.encode_status(“Poisoned”) <<0x08>>
Encodes a type to a binary. Info here
Examples
iex> PokeLib.Gen1.Pokemon.encode_type(“Flying”) <<0x02>>
iex> PokeLib.Gen1.Pokemon.encode_type(“Bug”) <<0x07>>
Translate an index to a human readable name. Info here
Examples
iex> PokeLib.Gen1.Pokemon.index_to_name(84) “Pikachu”
iex> PokeLib.Gen1.Pokemon.index_to_name(0xA3) “Ponyta”
Translate an index to a human readable move name. Info here
Examples
iex> PokeLib.Gen1.Pokemon.move_index_to_move_name(12) “Guillotine”
iex> PokeLib.Gen1.Pokemon.move_index_to_move_name(<<16>>) “Gust”
iex> PokeLib.Gen1.Pokemon.move_index_to_move_name(0x07) “Fire Punch”
Translate a move name to a machine readable index. Info here
Examples
iex> PokeLib.Gen1.Pokemon.move_name_to_move_index(“Roar”) 46
iex> PokeLib.Gen1.Pokemon.move_name_to_move_index(“Psychic”) 94
Translate a pokemon name to a machine readable index. Info here
Examples
iex> PokeLib.Gen1.Pokemon.name_to_index(“Rattata”) 165
iex> PokeLib.Gen1.Pokemon.name_to_index(“Venomoth”) 119