upgrade system
This commit is contained in:
parent
921947c131
commit
83256bfbe5
15 changed files with 331 additions and 43 deletions
|
|
@ -58,6 +58,29 @@ pub struct Quantity {
|
|||
pub bones: u32,
|
||||
}
|
||||
|
||||
impl Quantity {
|
||||
pub fn to_string(&self) -> String {
|
||||
let souls_text = if self.souls > 0 {
|
||||
format!("{} souls", self.souls)
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
let divider_text = if self.souls > 0 && self.bones > 0 {
|
||||
", "
|
||||
} else if self.souls == 0 && self.bones == 0 {
|
||||
"FREE!!!"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let bones_text = if self.bones > 0 {
|
||||
format!("{} bones", self.bones)
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
format!("{}{}{}", souls_text, divider_text, bones_text)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<u32> for Quantity {
|
||||
type Output = Quantity;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue