39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| 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
 | |
|     }
 | |
| }
 |