cfeat: set die chance for female

This commit is contained in:
2021-08-23 23:40:12 +02:00
parent 5bae616ed2
commit 5618cb2d7e

View File

@@ -202,6 +202,16 @@ func Born(father *Hamster, mother *Hamster) ([]*Hamster, error) {
} }
mother.Child = append(mother.Child, child...) mother.Child = append(mother.Child, child...)
father.Child = append(father.Child, child...) father.Child = append(father.Child, child...)
if mother.Age >= 500 {
var dieRoll = randNumber(0, 100)
if (mother.Age < 525 && dieRoll <= 5) ||
(mother.Age >= 525 && mother.Age < 550 && dieRoll <= 10) ||
(mother.Age >= 550 && mother.Age < 575 && dieRoll <= 25) ||
(mother.Age >= 575 && dieRoll <= 75) {
mother.Die()
}
}
return child, nil return child, nil
} }