Complete overhaul of code structure and relevant files (#639)
This commit is contained in:
11
src/Sim/ReplacedGameFunctions/SimAuraMult.js
Normal file
11
src/Sim/ReplacedGameFunctions/SimAuraMult.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SimDragonAura, SimDragonAura2 } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.auraMult but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimAuraMult(what) {
|
||||
let n = 0;
|
||||
if (Game.dragonAuras[SimDragonAura].name === what || Game.dragonAuras[SimDragonAura2].name === what) n = 1;
|
||||
if (Game.dragonAuras[SimDragonAura].name === 'Reality Bending' || Game.dragonAuras[SimDragonAura2].name === 'Reality Bending') n += 0.1;
|
||||
return n;
|
||||
}
|
||||
10
src/Sim/ReplacedGameFunctions/SimEff.js
Normal file
10
src/Sim/ReplacedGameFunctions/SimEff.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { SimEffs } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.Eff but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimEff(name, def) {
|
||||
if (typeof SimEffs[name] === 'undefined') {
|
||||
return (typeof def === 'undefined' ? 1 : def);
|
||||
} return SimEffs[name];
|
||||
}
|
||||
27
src/Sim/ReplacedGameFunctions/SimGetHeavenlyMultiplier.js
Normal file
27
src/Sim/ReplacedGameFunctions/SimGetHeavenlyMultiplier.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import SimAuraMult from './SimAuraMult';
|
||||
import SimHas from './SimHas';
|
||||
import SimHasGod from './SimHasGod';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.GetHeavenlyMultiplier but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimGetHeavenlyMultiplier() {
|
||||
let heavenlyMult = 0;
|
||||
if (SimHas('Heavenly chip secret')) heavenlyMult += 0.05;
|
||||
if (SimHas('Heavenly cookie stand')) heavenlyMult += 0.20;
|
||||
if (SimHas('Heavenly bakery')) heavenlyMult += 0.25;
|
||||
if (SimHas('Heavenly confectionery')) heavenlyMult += 0.25;
|
||||
if (SimHas('Heavenly key')) heavenlyMult += 0.25;
|
||||
// if (SimHasAura('Dragon God')) heavenlyMult*=1.05;
|
||||
heavenlyMult *= 1 + SimAuraMult('Dragon God') * 0.05;
|
||||
if (SimHas('Lucky digit')) heavenlyMult *= 1.01;
|
||||
if (SimHas('Lucky number')) heavenlyMult *= 1.01;
|
||||
if (SimHas('Lucky payout')) heavenlyMult *= 1.01;
|
||||
if (Game.hasGod) {
|
||||
const godLvl = SimHasGod('creation');
|
||||
if (godLvl === 1) heavenlyMult *= 0.7;
|
||||
else if (godLvl === 2) heavenlyMult *= 0.8;
|
||||
else if (godLvl === 3) heavenlyMult *= 0.9;
|
||||
}
|
||||
return heavenlyMult;
|
||||
}
|
||||
12
src/Sim/ReplacedGameFunctions/SimGetSellMultiplier.js
Normal file
12
src/Sim/ReplacedGameFunctions/SimGetSellMultiplier.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import SimAuraMult from './SimAuraMult';
|
||||
|
||||
/**
|
||||
* This function calculates the sell multiplier based on current "sim data"
|
||||
* It is called by CM.Sim.BuildingSell()
|
||||
* @returns {number} giveBack The multiplier
|
||||
*/
|
||||
export default function SimGetSellMultiplier() {
|
||||
let giveBack = 0.25;
|
||||
giveBack *= 1 + SimAuraMult('Earth Shatterer');
|
||||
return giveBack;
|
||||
}
|
||||
32
src/Sim/ReplacedGameFunctions/SimGetTieredCpsMult.js
Normal file
32
src/Sim/ReplacedGameFunctions/SimGetTieredCpsMult.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { SimObjects } from '../VariablesAndData';
|
||||
import SimHas from './SimHas';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.GetTieredCpsMult but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimGetTieredCpsMult(me) {
|
||||
let mult = 1;
|
||||
for (const i in me.tieredUpgrades) {
|
||||
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)) mult *= 2;
|
||||
}
|
||||
for (const i in me.synergies) {
|
||||
if (SimHas(me.synergies[i].name)) {
|
||||
const syn = me.synergies[i];
|
||||
if (syn.buildingTie1.name === me.name) mult *= (1 + 0.05 * syn.buildingTie2.amount);
|
||||
else if (syn.buildingTie2.name === me.name) mult *= (1 + 0.001 * syn.buildingTie1.amount);
|
||||
}
|
||||
}
|
||||
if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07;
|
||||
if (me.grandma && SimHas(me.grandma.name)) mult *= (1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1)));
|
||||
if (typeof me.tieredUpgrades.misfortune === 'object') {
|
||||
if (me.vanilla === 1 && SimHas(me.tieredUpgrades.misfortune.name)) {
|
||||
switch (Game.elderWrath) {
|
||||
default: mult *= 1; break;
|
||||
case 1: mult *= 1.02; break;
|
||||
case 2: mult *= 1.04; break;
|
||||
case 3: mult *= 1.06; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
}
|
||||
10
src/Sim/ReplacedGameFunctions/SimHas.js
Normal file
10
src/Sim/ReplacedGameFunctions/SimHas.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { SimUpgrades } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.Has but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimHas(what) {
|
||||
const it = SimUpgrades[what];
|
||||
if (Game.ascensionMode === 1 && (it.pool === 'prestige' || it.tier === 'fortune')) return 0;
|
||||
return (it ? it.bought : 0);
|
||||
}
|
||||
8
src/Sim/ReplacedGameFunctions/SimHasAchiev.js
Normal file
8
src/Sim/ReplacedGameFunctions/SimHasAchiev.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SimAchievements } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.HasAchiev but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimHasAchiev(what) {
|
||||
return (SimAchievements[what] ? SimAchievements[what].won : 0);
|
||||
}
|
||||
11
src/Sim/ReplacedGameFunctions/SimHasAura.js
Normal file
11
src/Sim/ReplacedGameFunctions/SimHasAura.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SimDragonAura, SimDragonAura2 } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions creates functions similarly to Game.hasAura but checks Sim Data instead of Game Data
|
||||
*/
|
||||
export default function SimHasAura(what) {
|
||||
if (Game.dragonAuras[SimDragonAura].name === what || Game.dragonAuras[SimDragonAura2].name === what) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
21
src/Sim/ReplacedGameFunctions/SimHasGod.js
Normal file
21
src/Sim/ReplacedGameFunctions/SimHasGod.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { SimObjects } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function checks for the current God level in the sim data
|
||||
* It functions similarly to Game.hasGod()
|
||||
* @param {string} what Name of the achievement
|
||||
*/
|
||||
export default function SimHasGod(what) {
|
||||
if (Game.hasGod) {
|
||||
if (SimObjects.Temple.minigame === undefined) {
|
||||
SimObjects.Temple.minigame = Game.Objects.Temple.minigame;
|
||||
}
|
||||
const god = SimObjects.Temple.minigame.gods[what];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (SimObjects.Temple.minigame.slot[i] === god.id) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
33
src/Sim/ReplacedGameFunctions/SimModifyBuidlingPrice.js
Normal file
33
src/Sim/ReplacedGameFunctions/SimModifyBuidlingPrice.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { SimObjects } from '../VariablesAndData';
|
||||
import SimAuraMult from './SimAuraMult';
|
||||
import SimEff from './SimEff';
|
||||
import SimHas from './SimHas';
|
||||
import SimHasGod from './SimHasGod';
|
||||
|
||||
/**
|
||||
* This function calculates the sell price of a building based on current "sim data"
|
||||
* @param {string} building Name of the building
|
||||
* @param {number} price Current price of building
|
||||
* @returns {number} price The modified building price
|
||||
*/
|
||||
export default function SimModifyBuildingPrice(building, price) {
|
||||
if (SimHas('Season savings')) price *= 0.99;
|
||||
if (SimHas('Santa\'s dominion')) price *= 0.99;
|
||||
if (SimHas('Faberge egg')) price *= 0.99;
|
||||
if (SimHas('Divine discount')) price *= 0.99;
|
||||
if (SimHas('Fortune #100')) price *= 0.99;
|
||||
// if (SimHasAura('Fierce Hoarder')) price *= 0.98;
|
||||
price *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
|
||||
if (Game.hasBuff('Everything must go')) price *= 0.95;
|
||||
if (Game.hasBuff('Crafty pixies')) price *= 0.98;
|
||||
if (Game.hasBuff('Nasty goblins')) price *= 1.02;
|
||||
if (building.fortune && SimHas(building.fortune.name)) price *= 0.93;
|
||||
price *= SimEff('buildingCost');
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = SimHasGod('creation');
|
||||
if (godLvl === 1) price *= 0.93;
|
||||
else if (godLvl === 2) price *= 0.95;
|
||||
else if (godLvl === 3) price *= 0.98;
|
||||
}
|
||||
return price;
|
||||
}
|
||||
Reference in New Issue
Block a user