mirror of
https://github.com/Zenithsiz/dcb.git
synced 2026-02-11 12:41:48 +00:00
Added validation to Move card property.
This commit is contained in:
@@ -89,6 +89,22 @@ impl Bytes for Move {
|
||||
}
|
||||
|
||||
fn validate(&self) -> Validation {
|
||||
Validation::new()
|
||||
// Create the initial validation
|
||||
let mut validation = Validation::new();
|
||||
|
||||
// If our name is longer or equal to `0x16` bytes, emit error
|
||||
if self.name.len() >= 0x16 {
|
||||
validation.add_error("Name must be at most 21 characters.");
|
||||
}
|
||||
|
||||
// If the power isn't a multiple of 10, warn, as we don't know how the game handles
|
||||
// powers that aren't multiples of 10.
|
||||
// TODO: Verify if the game can handle non-multiple of 10 powers.
|
||||
if self.power % 10 != 0 {
|
||||
validation.add_warning("Powers that are not a multiple of 10 are not fully supported.");
|
||||
}
|
||||
|
||||
// And return the validation
|
||||
validation
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user