41 lines
888 B
Rust
Executable File
41 lines
888 B
Rust
Executable File
use core::any::Any;
|
|
use pkmn_lib_interface::app_interface::{ExecutingMove, Pokemon};
|
|
use pkmn_lib_interface::handling::{Script, ScriptCapabilities};
|
|
|
|
pub struct AfterYou {}
|
|
|
|
impl AfterYou {
|
|
pub const fn get_const_name() -> &'static str {
|
|
"after_you"
|
|
}
|
|
}
|
|
|
|
impl Script for AfterYou {
|
|
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) {
|
|
if !target
|
|
.battle()
|
|
.unwrap()
|
|
.choice_queue()
|
|
.move_pokemon_choice_next(&target)
|
|
{
|
|
mv.get_hit_data(&target, hit).fail()
|
|
}
|
|
}
|
|
|
|
fn as_any(&self) -> &dyn Any {
|
|
self
|
|
}
|
|
}
|