Adds effects for changing target stats.
This commit is contained in:
		
							
								
								
									
										38
									
								
								gen_7_scripts/src/moves/automize.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								gen_7_scripts/src/moves/automize.rs
									
									
									
									
									
										Normal 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 | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user