fix(exp): crash when gaining many levels at once

This commit is contained in:
timokoesters 2019-10-05 13:38:33 +02:00 committed by Piotr Korgól
parent 09429b45d1
commit 2fc4a8d9aa

View File

@ -40,9 +40,11 @@ impl<'a> System<'a> for Sys {
}
if stat.exp.current() >= stat.exp.maximum() {
stat.exp.change_by(-(stat.exp.maximum() as i64));
stat.exp.change_maximum_by(25);
stat.level.change_by(1);
while stat.exp.current() >= stat.exp.maximum() {
stat.exp.change_by(-(stat.exp.maximum() as i64));
stat.exp.change_maximum_by(25);
stat.level.change_by(1);
}
stat.update_hp_bonus(stat.level.level());
stat.health
.set_to(stat.health.maximum(), HealthSource::LevelUp)