rustemon/model/evolution.rs
1//! Evolution group models
2
3use super::{
4 items::Item,
5 locations::{Location, Region},
6 moves::Move,
7 pokemon::{PokemonSpecies, Type},
8 resource::{Name, NamedApiResource},
9};
10
11/// [EvolutionChain official documentation](https:///pokeapi.co/docs/v2#evolutionchain)
12#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
13#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
14pub struct EvolutionChain {
15 /// The identifier for this resource.
16 pub id: i64,
17 /// The item that a Pokémon would be holding when mating that would trigger the egg
18 /// hatching a baby Pokémon rather than a basic Pokémon.
19 pub baby_trigger_item: Option<NamedApiResource<Item>>,
20 /// The base chain link object. Each link contains evolution details for a Pokémon in the chain.
21 /// Each link references the next Pokémon in the natural evolution order.
22 pub chain: ChainLink,
23}
24
25/// [ChainLink official documentation](https:///pokeapi.co/docs/v2#chainlink)
26#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
27#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
28pub struct ChainLink {
29 /// Whether or not this link is for a baby Pokémon. This would only ever be true on the base link.
30 pub is_baby: bool,
31 /// The Pokémon species at this point in the evolution chain.
32 pub species: NamedApiResource<PokemonSpecies>,
33 /// All details regarding the specific details of the referenced Pokémon species evolution.
34 pub evolution_details: Vec<EvolutionDetail>,
35 /// A List of chain objects.
36 pub evolves_to: Vec<ChainLink>,
37}
38
39/// [EvolutionDetail official documentation](https:///pokeapi.co/docs/v2#evolutiondetail)
40#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
41#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
42pub struct EvolutionDetail {
43 /// The item required to cause evolution this into Pokémon species.
44 pub item: Option<NamedApiResource<Item>>,
45 /// The type of event that triggers evolution into this Pokémon species.
46 pub trigger: NamedApiResource<EvolutionTrigger>,
47 /// The id of the gender of the evolving Pokémon species must be in order to evolve into this Pokémon species.
48 pub gender: Option<i64>,
49 /// The item the evolving Pokémon species must be holding during the evolution trigger event
50 /// to evolve into this Pokémon species.
51 pub held_item: Option<NamedApiResource<Item>>,
52 /// The move that must be known by the evolving Pokémon species during the evolution trigger event
53 /// in order to evolve into this Pokémon species.
54 pub known_move: Option<NamedApiResource<Move>>,
55 /// The evolving Pokémon species must know a move with this type during the evolution trigger event
56 /// in order to evolve into this Pokémon species.
57 pub known_move_type: Option<NamedApiResource<Type>>,
58 /// The location the evolution must be triggered at.
59 pub location: Option<NamedApiResource<Location>>,
60 /// The minimum required level of the evolving Pokémon species to evolve into this Pokémon species.
61 pub min_level: Option<i64>,
62 /// The minimum required level of happiness the evolving Pokémon species to evolve into this Pokémon species.
63 pub min_happiness: Option<i64>,
64 /// The minimum required level of beauty the evolving Pokémon species to evolve into this Pokémon species.
65 pub min_beauty: Option<i64>,
66 /// The minimum required level of affection the evolving Pokémon species to evolve into this Pokémon species.
67 pub min_affection: Option<i64>,
68 /// Whether or not multiplayer link play is needed to evolve into this Pokémon species (e.g. Union Circle).
69 pub needs_multiplayer: bool,
70 /// Whether or not it must be raining in the overworld to cause evolution this Pokémon species.
71 pub needs_overworld_rain: bool,
72 /// The Pokémon species that must be in the players party in order for the evolving Pokémon species
73 /// to evolve into this Pokémon species.
74 pub party_species: Option<NamedApiResource<PokemonSpecies>>,
75 /// The player must have a Pokémon of this type in their party during the evolution trigger event
76 /// in order for the evolving Pokémon species to evolve into this Pokémon species.
77 pub party_type: Option<NamedApiResource<Type>>,
78 /// The required relation between the Pokémon's Attack and Defense stats.
79 /// 1 means Attack > Defense. 0 means Attack = Defense. -1 means Attack < Defense.
80 pub relative_physical_stats: Option<i64>,
81 /// The required time of day. Day or night.
82 pub time_of_day: String,
83 /// Pokémon species for which this one must be traded.
84 pub trade_species: Option<NamedApiResource<PokemonSpecies>>,
85 /// Whether or not the 3DS needs to be turned upside-down as this Pokémon levels up.
86 pub turn_upside_down: bool,
87 /// The required region in which this evolution can occur.
88 pub region: Option<NamedApiResource<Region>>,
89 /// The required form for which this evolution can occur.
90 pub base_form: Option<NamedApiResource<PokemonSpecies>>,
91 /// The move that must be used by the evolving Pokémon species during the evolution trigger event
92 /// in order to evolve into this Pokémon species.
93 pub used_move: Option<NamedApiResource<Move>>,
94 /// The minimum number of times a move must be used in order to evolve into this Pokémon species.
95 pub min_move_count: Option<i64>,
96 /// The minimum number of steps that must be taken in order to evolve into this Pokémon species.
97 pub min_steps: Option<i64>,
98 /// The minimum amount of damage taken during the evolution trigger event in order to
99 /// evolve into this Pokémon species.
100 pub min_damage_taken: Option<i64>,
101}
102
103/// [EvolutionTrigger official documentation](https:///pokeapi.co/docs/v2#evolutiontrigger)
104#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
105#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
106pub struct EvolutionTrigger {
107 /// The identifier for this resource.
108 pub id: i64,
109 /// The name for this resource.
110 pub name: String,
111 /// The name of this resource listed in different languages.
112 pub names: Vec<Name>,
113 /// A list of pokemon species that result from this evolution trigger.
114 pub pokemon_species: Vec<NamedApiResource<PokemonSpecies>>,
115}