Adds a large amount of the WASM interface
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-14 13:25:21 +01:00
parent 7511f56b1a
commit ca54820483
21 changed files with 777 additions and 9 deletions

View File

@@ -51,6 +51,9 @@ pub trait Form: ValueIdentifiable + Debug {
/// Check if the form has a specific flag set.
fn has_flag(&self, key: &StringKey) -> bool;
/// Arbitrary flags that can be applied to the move.
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
}
/// A form is a variant of a specific species. A species always has at least one form, but can have
@@ -207,6 +210,10 @@ impl Form for FormImpl {
fn has_flag(&self, key: &StringKey) -> bool {
self.flags.contains(key)
}
fn has_flag_by_hash(&self, key_hash: u32) -> bool {
self.flags.contains::<u32>(&key_hash)
}
}
impl ValueIdentifiable for FormImpl {
@@ -240,6 +247,7 @@ pub(crate) mod tests {
fn get_random_ability(&self, rand: &mut Random) -> &StringKey;
fn get_random_hidden_ability(&self, rand: &mut Random) -> &StringKey;
fn has_flag(&self, key: &StringKey) -> bool;
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
}
impl ValueIdentifiable for Form {
fn value_identifier(&self) -> ValueIdentifier {