2022-09-10 10:20:48 +00:00
|
|
|
use crate::script;
|
|
|
|
use core::any::Any;
|
|
|
|
use pkmn_lib_interface::app_interface::{ExecutingMove, Pokemon, Statistic};
|
|
|
|
use pkmn_lib_interface::handling::{Script, ScriptCapabilities};
|
|
|
|
|
|
|
|
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]
|
|
|
|
}
|
|
|
|
|
2022-09-16 09:01:17 +00:00
|
|
|
fn on_secondary_effect(&self, mv: ExecutingMove, _target: Pokemon, _hit: u8) {
|
2022-09-10 10:20:48 +00:00
|
|
|
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.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn as_any(&self) -> &dyn Any {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|