blastmud/blastmud_game/src/models/effect.rs

30 lines
891 B
Rust
Raw Normal View History

use super::item::Item;
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, PartialOrd, Clone, Serialize, Deserialize, Debug, Ord)]
pub enum EffectType {
Ephemeral, // i.e. no enduring impact to show in status.
Bandages,
}
pub struct EffectSet {
pub effect_type: EffectType,
pub effects: Vec<Effect>,
}
pub enum Effect {
// messagef takes player, causative item, target as the 3 parameters. Returns (explicit, non explicit) message.
BroadcastMessage {
delay_secs: u64,
messagef: Box<dyn Fn(&Item, &Item, &Item) -> (String, String) + Sync + Send>,
},
// skill_multiplier is always positive - sign flipped for crit fails.
ChangeTargetHealth {
delay_secs: u64,
base_effect: i64,
skill_multiplier: f64,
max_effect: i64,
message: Box<dyn Fn(&Item) -> (String, String) + Sync + Send>,
},
}