38 lines
1003 B
Rust
38 lines
1003 B
Rust
use crate::common_usings::*;
|
|
use pkmn_lib_interface::PkmnResult;
|
|
|
|
script!(Automize, "automize");
|
|
|
|
impl Script for Automize {
|
|
fn new() -> Self {
|
|
Self {}
|
|
}
|
|
|
|
fn get_name(&self) -> &'static str {
|
|
Self::get_const_name()
|
|
}
|
|
|
|
fn get_capabilities(&self) -> &[ScriptCapabilities] {
|
|
&[ScriptCapabilities::OnSecondaryEffect]
|
|
}
|
|
|
|
fn on_secondary_effect(&self, mv: ExecutingMove, _target: Pokemon, _hit: u8) -> PkmnResult<()> {
|
|
let user = mv.user();
|
|
let stats = user.boosted_stats();
|
|
let original_speed = stats.speed()?;
|
|
let original_weight = user.weight()?;
|
|
user.change_stat_boost(Statistic::Speed, 2, true)?;
|
|
if user.boosted_stats().speed()? != original_speed {
|
|
user.set_weight(original_weight - 100.0);
|
|
if user.weight()? != original_weight {
|
|
// TODO: Became nimble dialog.
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn as_any(&self) -> &dyn Any {
|
|
self
|
|
}
|
|
}
|