broke credibility hit out into its own inc value
This commit is contained in:
parent
0b6e263cc7
commit
208e441086
|
@ -1,8 +1,8 @@
|
|||
/// <reference path="./model/GameConfig.ts" />
|
||||
/// <reference path="./render/DebugRenderer.ts" />
|
||||
|
||||
const versionMajor = 2;
|
||||
const versionMinor = 1;
|
||||
const versionMajor = 3;
|
||||
const versionMinor = 0;
|
||||
|
||||
let globalStartTime = 0;
|
||||
let globalTimeout: number | null = null;
|
||||
|
|
|
@ -47,16 +47,19 @@ class Money extends Resource {
|
|||
const tithings =
|
||||
((state.resource.pastors?.value ?? 0) *
|
||||
(state.resource.followers?.value ?? 0) *
|
||||
(state.config.cfgTitheAmount ?? 0) *
|
||||
Credibility.ratio(state)) /
|
||||
(state.config.cfgTitheAmount ?? 0)) /
|
||||
state.config.cfgTimeBetweenTithes;
|
||||
|
||||
// credibility hit
|
||||
const credibility = tithings - tithings * Credibility.ratio(state);
|
||||
|
||||
// salaries
|
||||
const compoundManagers =
|
||||
(state.resource.compoundManagers?.value ?? 0) *
|
||||
(state.config.cfgSalary.compoundManagers ?? 0);
|
||||
|
||||
if (tithings > 0) inc.pastors = tithings;
|
||||
if (credibility > 0) inc.credibility = credibility * -1;
|
||||
if (compoundManagers > 0) inc.compoundManagers = compoundManagers * -1;
|
||||
|
||||
return inc;
|
||||
|
|
|
@ -111,18 +111,21 @@ class DebugRenderer implements IRenderer {
|
|||
if (el.className !== 'resource') el.className = 'resource';
|
||||
const elV = el.getElementsByClassName('resource-value')[0];
|
||||
const elT = el.getElementsByClassName('resource-max')[0];
|
||||
const value = resource.valueInWholeNumbers
|
||||
? Math.floor(resource.value)
|
||||
: resource.value;
|
||||
const value = formatNumber(
|
||||
resource.valueInWholeNumbers
|
||||
? Math.floor(resource.value)
|
||||
: resource.value
|
||||
);
|
||||
const max =
|
||||
resource.max !== undefined ? resource.max(state) : undefined;
|
||||
elV.innerHTML = formatNumber(value);
|
||||
elT.innerHTML =
|
||||
if (elV.innerHTML !== value) elV.innerHTML = value;
|
||||
const maxStr =
|
||||
max !== undefined
|
||||
? ` / ${formatNumber(
|
||||
resource.valueInWholeNumbers ? Math.floor(max) : max
|
||||
)}`
|
||||
: '';
|
||||
if (elT.innerHTML !== maxStr) elT.innerHTML = maxStr;
|
||||
if (resource.userActions !== undefined) {
|
||||
for (let i = 0; i < resource.userActions.length; i++) {
|
||||
const elB = document.getElementById(`resource-btn-${rkey}-${i}`);
|
||||
|
@ -139,17 +142,21 @@ class DebugRenderer implements IRenderer {
|
|||
const inc = resourceNumberSum(resInc);
|
||||
const elI = el.getElementsByClassName('resource-inc')[0];
|
||||
if (inc !== 0) {
|
||||
elI.innerHTML = ` ${inc > 0 ? '+' : ''}${formatNumber(inc)}/s`;
|
||||
elI.setAttribute('title', this._getIncDetails(resource, state));
|
||||
const incStr = ` ${inc > 0 ? '+' : ''}${formatNumber(inc)}/s`;
|
||||
if (elI.innerHTML !== incStr) {
|
||||
elI.innerHTML = incStr;
|
||||
elI.setAttribute('title', this._getIncDetails(resource, state));
|
||||
}
|
||||
} else if (elI.innerHTML !== '') {
|
||||
elI.innerHTML = '';
|
||||
elI.removeAttribute('title');
|
||||
}
|
||||
}
|
||||
if (this._handleClick) {
|
||||
const elC = el.getElementsByClassName('resource-cost');
|
||||
if (elC.length > 0) {
|
||||
elC[0].innerHTML = this._getCostStr(resource, state);
|
||||
const elC = el.getElementsByClassName('resource-cost');
|
||||
if (elC.length > 0) {
|
||||
const costStr = this._getCostStr(resource, state);
|
||||
if (elC[0].innerHTML !== costStr) {
|
||||
elC[0].innerHTML = costStr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Reference in New Issue