mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix(exp): crash when gaining many levels at once
This commit is contained in:
parent
09429b45d1
commit
2fc4a8d9aa
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user