Newer
Older
/** Returns the revivalist nationality associated with the player's arcology, or 0 if none
* @returns {string|0}
*/
globalThis.getRevivalistNationality = function() {
if (V.arcologies[0].FSRomanRevivalist > 90) {
return "Roman Revivalist";
} else if (V.arcologies[0].FSAztecRevivalist > 90) {
return "Aztec Revivalist";
} else if (V.arcologies[0].FSEgyptianRevivalist > 90) {
return "Ancient Egyptian Revivalist";
} else if (V.arcologies[0].FSEdoRevivalist > 90) {
return "Edo Revivalist";
} else if (V.arcologies[0].FSArabianRevivalist > 90) {
return "Arabian Revivalist";
} else if (V.arcologies[0].FSChineseRevivalist > 90) {
return "Ancient Chinese Revivalist";
}
return 0;
};
/** Calculate and return economic uncertainty multiplier for a given arcology
* @param {number} arcologyID
* @returns {number}
*/
App.Utils.economicUncertainty = function(arcologyID) {
let uncertainty = arcologyID === 0 ? 5 : 10;
if (assistant.power === 1) {
uncertainty -= Math.max(Math.trunc(uncertainty / 2), 0);
} else if (assistant.power > 1) {
uncertainty = 0;
}
return jsRandom(100 - uncertainty, 100 + uncertainty) / 100;
};
/**
* @returns {number}
*/
App.Utils.schoolCounter = function() {
return Array.from(App.Data.misc.schools.keys()).filter(s => V[s].schoolPresent).length;
};
/**
* @returns {string}
*/
App.Utils.schoolFailure = function() {
return Array.from(App.Data.misc.schools.keys()).find(s => V[s].schoolPresent && V[s].schoolProsperity <= -10);
};
/**
* @typedef {Object} menialObject
* @property {string} text
* @property {number} value
*/
/**
* @returns {menialObject}
*/
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
globalThis.menialPopCap = function() {
let r = "";
let popCap = 500 * (1 + V.building.findCells(cell => cell instanceof App.Arcology.Cell.Manufacturing && cell.type === "Pens").length);
let overMenialCap = V.menials + V.fuckdolls + V.menialBioreactors - popCap;
if (overMenialCap > 0) {
const price = menialSlaveCost(-overMenialCap);
if (V.menials > 0) {
if (V.menials > overMenialCap) {
cashX((overMenialCap * price), "menialTrades");
V.menialDemandFactor -= overMenialCap;
V.menials -= overMenialCap;
overMenialCap = 0;
r += "You don't have enough room for all your menials and are obliged to sell some.";
} else {
cashX((V.menials * price), "menialTrades");
V.menialDemandFactor -= V.menials;
overMenialCap -= V.menials;
V.menials = 0;
r += "You don't have enough room for your menials and are obliged to sell them.";
}
}
if (overMenialCap > 0 && V.fuckdolls > 0) {
if (V.fuckdolls > overMenialCap) {
cashX(overMenialCap * (price * 2), "menialTrades");
V.menialDemandFactor -= overMenialCap;
V.fuckdolls -= overMenialCap;
overMenialCap = 0;
r += "You don't have enough room for all your Fuckdolls and are obliged to sell some.";
} else {
cashX(V.fuckdolls * (price * 2), "menialTrades");
V.menialDemandFactor -= V.fuckdolls;
overMenialCap -= V.fuckdolls;
V.fuckdolls = 0;
r += "You don't have enough room for your Fuckdolls and are obliged to sell them.";
}
}
if (overMenialCap > 0 && V.menialBioreactors > 0) {
cashX(overMenialCap * (price - 100), "menialTrades");
V.menialDemandFactor -= overMenialCap;
V.menialBioreactors -= overMenialCap;
r += "You don't have enough room for all your menial bioreactors and are obliged to sell some.";
}
}
return {text: r, value: popCap};
};