prevent DreamSense from pushing over max

This commit is contained in:
pigalot 2022-01-13 17:55:56 +00:00
parent e245cc471a
commit abdc786403

@ -435,10 +435,19 @@ export class Industry implements IIndustry {
const popularityGain = corporation.getDreamSenseGain(), const popularityGain = corporation.getDreamSenseGain(),
awarenessGain = popularityGain * 4; awarenessGain = popularityGain * 4;
if (popularityGain > 0) { if (popularityGain > 0) {
this.popularity += popularityGain * marketCycles; if (this.awareness === Number.MAX_VALUE || this.awareness + (awarenessGain * marketCycles) > Number.MAX_VALUE) {
this.awareness == Number.MAX_VALUE;
} else {
this.awareness += awarenessGain * marketCycles; this.awareness += awarenessGain * marketCycles;
} }
if (this.popularity === Number.MAX_VALUE || this.popularity + (popularityGain * marketCycles) > Number.MAX_VALUE) {
this.popularity == Number.MAX_VALUE;
} else {
this.popularity += popularityGain * marketCycles;
}
}
return; return;
} }