18 lines
678 B
Rust
18 lines
678 B
Rust
use super::dice::DiceThrow;
|
|
|
|
/// A characteristic is a basic trait of a hero.
|
|
/// There are 8 of those, and they are usually abbreviated with two capital letters.
|
|
pub struct Characteristic {
|
|
/// This is the identifier, it's a static str containing the two capital letter abbreviation.
|
|
pub identifier: &'static str,
|
|
/// This is the value indicating how good the hero is in regard of this characteristic.
|
|
pub value: i8,
|
|
}
|
|
|
|
impl Characteristic {
|
|
/// Test the hero's ability to do something regarding this characteristic.
|
|
pub fn trial(&self, dice_throw: DiceThrow, modificator: i8) -> i8 {
|
|
self.value + modificator - (dice_throw.throw as i8)
|
|
}
|
|
}
|