xenua 1 year ago
parent
commit
5d41363c20
Signed by: xenua
GPG Key ID: 8F93B68BD37255B8
  1. 11
      src/general.rs
  2. 154
      src/pokemon/mod.rs

11
src/general.rs

@ -2551,3 +2551,14 @@ pub enum GameVersion { @@ -2551,3 +2551,14 @@ pub enum GameVersion {
Scarlet = 50,
Violet = 51,
}
pub struct LearnedMove {
pub r#move: Move,
pub max_pp: u8,
pub current_pp: u8,
pub pp_up: u8,
}
pub struct MoveSet(
LearnedMove
)

154
src/pokemon/mod.rs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
use std::io::Read;
use crate::general::{BinaryGender, Gender, Language, Nature, PokeBall, Species};
use crate::general::{Ability, BinaryGender, Gender, Language, Move, Nature, PokeBall, Species};
pub mod gen5;
@ -9,70 +9,96 @@ pub trait StringConverter { @@ -9,70 +9,96 @@ pub trait StringConverter {
fn to_bytes(string: String) -> Box<dyn Read>;
}
pub trait Pokemon {
// main
fn species(&self) -> Species;
fn nickname(&self) -> String;
fn held_item(&self) -> Item;
fn gender(&self) -> Gender;
fn nature(&self) -> Nature;
fn ability(&self) -> Ability;
fn form(&self) -> PokemonForm;
fn is_egg(&self) -> bool;
fn is_nicknamed(&self) -> bool;
fn exp(&self) -> u32;
fn ot_name(&self) -> String;
fn ot_gender(&self) -> BinaryGender;
fn level(&self) -> u8;
fn met_level(&self) -> u8;
pub struct Pokemon<P> {
pkm: P,
pending_progressions: Vec<Progression>,
}
pub trait PKM {
fn ot(&self) -> &Trainer;
// internal
fn tid16(&self) -> u16;
fn sid16(&self) -> u16;
fn id32(&self) -> u32;
fn ball(&self) -> PokeBall;
fn current_friendship(&self) -> i32;
fn version(&self) -> i32;
fn pokerus_strain(&self) -> i32;
fn pokerus_days(&self) -> i32;
fn encryption_constant(&self) -> u32;
fn pid(&self) -> u32;
fn gain_xp(&mut self, xp: u32) -> Vec<Progression>;
}
// misc
fn language(&self) -> Language;
fn is_fateful_encounter(&self) -> bool;
pub enum Progression {
LevelUp,
Evolution(Species),
LearnMove(Move),
}
// battle
fn move1(&self) -> u16;
fn move2(&self) -> u16;
fn move3(&self) -> u16;
fn move4(&self) -> u16;
fn pp_move1(&self) -> u8;
fn pp_move2(&self) -> u8;
fn pp_move3(&self) -> u8;
fn pp_move4(&self) -> u8;
fn pp_up_move1(&self) -> u8;
fn pp_up_move2(&self) -> u8;
fn pp_up_move3(&self) -> u8;
fn pp_up_move4(&self) -> u8;
fn ev_hp(&self) -> u8;
fn ev_attack(&self) -> u8;
fn ev_defense(&self) -> u8;
fn ev_speed(&self) -> u8;
fn ev_sp_attack(&self) -> u8;
fn ev_sp_defense(&self) -> u8;
fn iv_hp(&self) -> IV;
fn iv_attack(&self) -> IV;
fn iv_defense(&self) -> IV;
fn iv_speed(&self) -> IV;
fn iv_sp_attack(&self) -> IV;
fn iv_sp_defense(&self) -> IV;
fn status_condition(&self) -> StatusCondition;
fn stat_hp_max(&self) -> u16;
fn stat_hp_current(&self) -> u16;
fn stat_attack(&self) -> u16;
fn stat_defense(&self) -> u16;
fn stat_speed(&self) -> u16;
fn stat_sp_attack(&self) -> u16;
fn stat_sp_defense(&self) -> u16;
impl<P> Pokemon<P>
where
P: PKM,
{
pub fn into_inner(self) -> P {
self.pkm
}
}
// pub trait Pokemon {
// // main
// fn species(&self) -> Species;
// fn nickname(&self) -> String;
// fn held_item(&self) -> Item;
// fn gender(&self) -> Gender;
// fn nature(&self) -> Nature;
// fn ability(&self) -> Ability;
// fn form(&self) -> PokemonForm;
// fn is_egg(&self) -> bool;
// fn is_nicknamed(&self) -> bool;
// fn exp(&self) -> u32;
// fn ot_name(&self) -> String;
// fn ot_gender(&self) -> BinaryGender;
// fn level(&self) -> u8;
// fn met_level(&self) -> u8;
// // internal
// fn tid16(&self) -> u16;
// fn sid16(&self) -> u16;
// fn id32(&self) -> u32;
// fn ball(&self) -> PokeBall;
// fn current_friendship(&self) -> i32;
// fn version(&self) -> i32;
// fn pokerus_strain(&self) -> i32;
// fn pokerus_days(&self) -> i32;
// fn encryption_constant(&self) -> u32;
// fn pid(&self) -> u32;
// // misc
// fn language(&self) -> Language;
// fn is_fateful_encounter(&self) -> bool;
// // battle
// fn move1(&self) -> u16;
// fn move2(&self) -> u16;
// fn move3(&self) -> u16;
// fn move4(&self) -> u16;
// fn pp_move1(&self) -> u8;
// fn pp_move2(&self) -> u8;
// fn pp_move3(&self) -> u8;
// fn pp_move4(&self) -> u8;
// fn pp_up_move1(&self) -> u8;
// fn pp_up_move2(&self) -> u8;
// fn pp_up_move3(&self) -> u8;
// fn pp_up_move4(&self) -> u8;
// fn ev_hp(&self) -> u8;
// fn ev_attack(&self) -> u8;
// fn ev_defense(&self) -> u8;
// fn ev_speed(&self) -> u8;
// fn ev_sp_attack(&self) -> u8;
// fn ev_sp_defense(&self) -> u8;
// fn iv_hp(&self) -> IV;
// fn iv_attack(&self) -> IV;
// fn iv_defense(&self) -> IV;
// fn iv_speed(&self) -> IV;
// fn iv_sp_attack(&self) -> IV;
// fn iv_sp_defense(&self) -> IV;
// fn status_condition(&self) -> StatusCondition;
// fn stat_hp_max(&self) -> u16;
// fn stat_hp_current(&self) -> u16;
// fn stat_attack(&self) -> u16;
// fn stat_defense(&self) -> u16;
// fn stat_speed(&self) -> u16;
// fn stat_sp_attack(&self) -> u16;
// fn stat_sp_defense(&self) -> u16;
// }

Loading…
Cancel
Save