2022-08-28 13:50:12 +00:00
|
|
|
use crate::moves::*;
|
2023-01-28 12:59:54 +00:00
|
|
|
use crate::pokemon;
|
2022-09-10 08:29:00 +00:00
|
|
|
use crate::pokemon::*;
|
2022-07-24 07:25:37 +00:00
|
|
|
use alloc::boxed::Box;
|
2022-08-28 13:50:12 +00:00
|
|
|
use pkmn_lib_interface::app_interface::{get_hash, StringKey};
|
2022-07-24 07:25:37 +00:00
|
|
|
use pkmn_lib_interface::handling::{Script, ScriptCategory};
|
|
|
|
|
|
|
|
macro_rules! resolve_match {
|
|
|
|
(
|
|
|
|
$mid:expr,
|
|
|
|
$(
|
2022-08-28 13:50:12 +00:00
|
|
|
$script:ty,
|
2022-07-24 07:25:37 +00:00
|
|
|
)*
|
|
|
|
) => (
|
|
|
|
match $mid {
|
|
|
|
$(
|
2022-08-28 13:50:12 +00:00
|
|
|
const { get_hash(<$script>::get_const_name()) } => {
|
|
|
|
return Some(Box::new(<$script>::new()))
|
2022-07-24 07:25:37 +00:00
|
|
|
}
|
|
|
|
)*
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_script(category: ScriptCategory, name: &StringKey) -> Option<Box<dyn Script>> {
|
|
|
|
match category {
|
|
|
|
ScriptCategory::Move => {
|
2023-01-28 12:59:54 +00:00
|
|
|
resolve_match! {
|
2022-07-24 07:25:37 +00:00
|
|
|
name.hash(),
|
2022-08-28 13:50:12 +00:00
|
|
|
acrobatics::Acrobatics,
|
|
|
|
acupressure::Acupressure,
|
|
|
|
after_you::AfterYou,
|
2022-09-09 18:09:56 +00:00
|
|
|
assist::Assist,
|
|
|
|
assurance::Assurance,
|
2022-09-10 08:29:00 +00:00
|
|
|
attract::Attract,
|
2022-09-10 09:13:03 +00:00
|
|
|
aurora_veil::AuroraVeil,
|
2022-09-10 10:20:48 +00:00
|
|
|
automize::Automize,
|
|
|
|
change_all_target_stats::ChangeAllTargetStats,
|
|
|
|
change_target_stats::ChangeTargetAttack,
|
|
|
|
change_target_stats::ChangeTargetDefense,
|
|
|
|
change_target_stats::ChangeTargetSpecialAttack,
|
|
|
|
change_target_stats::ChangeTargetSpecialDefense,
|
|
|
|
change_target_stats::ChangeTargetSpeed,
|
2022-09-10 10:41:33 +00:00
|
|
|
cure_party_status::CurePartyStatus,
|
2022-09-10 10:54:34 +00:00
|
|
|
drain::Drain,
|
2022-09-10 11:51:28 +00:00
|
|
|
flinch::Flinch,
|
2023-01-28 12:59:54 +00:00
|
|
|
crate::moves::heal_each_end_of_turn::HealEachEndOfTurn,
|
|
|
|
multi_hit_move::MultiHitMove,
|
2022-09-10 11:08:44 +00:00
|
|
|
struggle::Struggle,
|
2023-01-28 12:59:54 +00:00
|
|
|
};
|
2022-07-24 07:25:37 +00:00
|
|
|
}
|
|
|
|
ScriptCategory::Ability => {}
|
|
|
|
ScriptCategory::Status => {}
|
2022-09-10 08:29:00 +00:00
|
|
|
ScriptCategory::Pokemon => {
|
2023-01-28 12:59:54 +00:00
|
|
|
resolve_match! {
|
|
|
|
name.hash(),
|
|
|
|
infatuated::Infatuated,
|
|
|
|
pokemon::heal_each_end_of_turn::HealEachEndOfTurnEffect,
|
|
|
|
}
|
2022-09-10 08:29:00 +00:00
|
|
|
}
|
2022-08-28 13:50:12 +00:00
|
|
|
ScriptCategory::Battle => {
|
2023-01-28 12:59:54 +00:00
|
|
|
resolve_match! {name.hash(), crate::util_scripts::ForceEffectTriggerScript,}
|
2022-08-28 13:50:12 +00:00
|
|
|
}
|
2022-07-24 07:25:37 +00:00
|
|
|
ScriptCategory::Side => {}
|
|
|
|
ScriptCategory::ItemBattleTrigger => {}
|
2022-09-16 09:01:17 +00:00
|
|
|
ScriptCategory::Weather => {}
|
2022-07-24 07:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
None
|
|
|
|
}
|