bug fixes

This commit is contained in:
Rudis Muiznieks 2021-08-22 14:29:49 -05:00
parent 314806f647
commit d4238d446a
3 changed files with 16 additions and 12 deletions

View file

@ -24,7 +24,8 @@ class Pastor extends Job {
const plorg: IResource = state.getResource('plorg');
// each pastor can collect from up to 100 followers
let tithed: number = this.value * 100;
if (plorg.value < tithed) tithed = plorg.value;
if (Math.floor(plorg.value) < tithed)
tithed = Math.floor(plorg.value);
let collected: number = tithed * state.config.cfgTitheAmount;
if (collected > money.max(state) - money.value)
collected = money.max(state) - money.value;

View file

@ -108,28 +108,30 @@ class PlayerOrg implements IResource {
&& (Object.keys(this._followerSources).length > 0
|| Object.keys(this._followerDests).length > 0)) {
if (Object.keys(this._followerDests).length > 0) {
let msg: string;
let msg: string = '';
let total: number = 0;
for (const rkey of Object.keys(this._followerDests)) {
if (msg === undefined) msg = 'You lost ';
else msg += ' and ';
if (msg !== '') msg += ', ';
const religion: IResource = state.getResource(rkey);
msg +=
`${state.formatNumber(this._followerDests[rkey])} followers to ${religion.name}`;
`${state.formatNumber(this._followerDests[rkey])} to ${religion.name}`;
total += this._followerDests[rkey];
delete this._followerDests[rkey];
}
state.log(msg);
state.log(`You lost ${state.formatNumber(total)} followers: ${msg}`);
}
if (Object.keys(this._followerSources).length > 0) {
let msg: string;
let msg: string = '';
let total: number = 0;
for (const rkey of Object.keys(this._followerSources)) {
if (msg === undefined) msg = 'You gained ';
else msg += ' and ';
if (msg !== '') msg += ', ';
const religion: IResource = state.getResource(rkey);
msg +=
`${state.formatNumber(this._followerSources[rkey])} followers from ${religion.name}`;
`${state.formatNumber(this._followerSources[rkey])} from ${religion.name}`;
total += this._followerSources[rkey];
delete this._followerSources[rkey];
}
state.log(msg);
state.log(`You gained ${state.formatNumber(total)} followers: ${msg}`);
}
this._lastRecruitmentLog = state.now;
}

View file

@ -85,7 +85,8 @@ class DebugRenderer implements IRenderer {
document.getElementById('dbg-btn-reset')
.addEventListener('click', (): void => {
state.reset();
this._handleClick = true;
document.getElementById('irreligious-game').innerHTML = '';
this._initialized = false;
});
}
for (const rkey of rkeys) {