Adds support for item use scripts
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
@@ -1,2 +1,46 @@
|
||||
use crate::dynamic_data::Pokemon;
|
||||
use crate::static_data::EffectParameter;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// The script functions that are relevant to item use.
|
||||
pub trait ItemScript {}
|
||||
pub trait ItemScript {
|
||||
/// Initializes the script with the given parameters for a specific item
|
||||
fn on_initialize(&self, _pars: Vec<Arc<EffectParameter>>) -> anyhow_ext::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Returns whether the item is usable in the current context.
|
||||
fn is_item_usable(&self) -> anyhow_ext::Result<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Returns whether the item requires a target to be used.
|
||||
fn requires_target(&self) -> anyhow_ext::Result<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Returns whether the item is usable on the given target.
|
||||
fn is_target_valid(&self, _target: &Pokemon) -> anyhow_ext::Result<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Returns whether the item can be held by the given target.
|
||||
fn is_holdable(&self) -> anyhow_ext::Result<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Returns whether the item can be held by the given target.
|
||||
fn can_target_hold(&self, _target: &Pokemon) -> anyhow_ext::Result<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
/// Handles the use of the item.
|
||||
fn on_use(&self) -> anyhow_ext::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Handles the use of the item on the given target.
|
||||
fn on_use_with_target(&self, _target: &Pokemon) -> anyhow_ext::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user