mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-11 22:16:59 +00:00
simplify percent progress calculation
This commit is contained in:
@@ -37,13 +37,10 @@ export class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPercentProgress(): number {
|
getPercentProgress(): number {
|
||||||
let maxProgress = 0;
|
let maxProgress = this.getMaxProgress();
|
||||||
let progressPoints = 0;
|
let progressPoints = this.getProgress();
|
||||||
for (const phase of this.phases) {
|
if (maxProgress === 0) return 0;
|
||||||
maxProgress += phase.maxPoints;
|
return progressPoints / maxProgress * 100;
|
||||||
progressPoints += phase.points;
|
|
||||||
}
|
|
||||||
return Math.round(progressPoints / maxProgress * 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isCompleted(): boolean {
|
isCompleted(): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user