More work on switching battle data to interior mutability, instead of exterior mutability.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-19 12:07:54 +02:00
parent 2e19005a30
commit 715f16e2b8
14 changed files with 256 additions and 280 deletions

View File

@@ -45,7 +45,7 @@ pub struct MoveData {
base_usages: u8,
target: MoveTarget,
priority: i8,
secondary_effect: SecondaryEffect,
secondary_effect: Option<SecondaryEffect>,
flags: HashSet<StringKey>,
}
@@ -59,7 +59,7 @@ impl MoveData {
base_usages: u8,
target: MoveTarget,
priority: i8,
secondary_effect: SecondaryEffect,
secondary_effect: Option<SecondaryEffect>,
flags: HashSet<StringKey>,
) -> MoveData {
MoveData {
@@ -102,14 +102,10 @@ impl MoveData {
self.priority
}
pub fn secondary_effect(&self) -> &SecondaryEffect {
pub fn secondary_effect(&self) -> &Option<SecondaryEffect> {
&self.secondary_effect
}
pub fn has_secondary_effect(&self) -> bool {
self.secondary_effect.effect_name() != &StringKey::empty()
}
pub fn has_flag(&self, key: &StringKey) -> bool {
self.flags.contains(key)
}