Adds effects for changing target stats.

This commit is contained in:
2022-09-10 12:20:48 +02:00
parent a710527975
commit 0f85f4f0a4
8 changed files with 218 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
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]
}
fn on_secondary_effect(&self, mv: ExecutingMove, target: Pokemon, hit: u8) {
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
}
}