Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function buyBuildings() {
- var customVars = MODULES["buildings"];
- var oldBuy = preBuy2();
- game.global.buyAmt = 1;
- var perTrap = 1 + game.portal.Bait.level;
- var trapFlag = perTrap > game.resources.trimps.owned / (game.global.challengeActive == "Trapper" ? 1000 : 100); //if trap produces more than 1/100th of our population (1/1000th in trapper), use traps
- if(trapFlag && game.resources.trimps.owned < trimpsRealMax - 1 && canAffordBuilding('Trap') && game.global.buildingsQueue.length === 0 && game.buildings.Trap.owned === 0)
- safeBuyBuilding('Trap');
- buyFoodEfficientHousing(); //["Hut", "House", "Mansion", "Hotel", "Resort"];
- if ((game.jobs.Miner.locked && game.global.challengeActive != 'Metal') || (game.jobs.Scientist.locked && game.global.challengeActive != "Scientist"))
- return;
- buyGemEfficientHousing(); //["Hotel", "Resort", "Gateway", "Collector", "Warpstation"];
- //WormHoles:
- if ((game.buildings.Wormhole.owned < getPageSetting('MaxWormhole') || getPageSetting('MaxWormhole') < 0) && !game.buildings.Wormhole.locked) {
- safeBuyBuilding('Wormhole');
- }
- //Buy non-housing buildings:
- //Gyms:
- if (!game.buildings.Gym.locked) {
- var skipGym = false;
- if ( game.buildings.Gym.owned >= getPageSetting('MaxGym') && getPageSetting('MaxGym') >= 0)
- skipGym = true;
- if(game.upgrades.Gymystic.allowed > game.upgrades.Gymystic.done)
- skipGym = true; //dont spend wood on gyms when we need gymystic upgrade. should add a check to buy gyms until they cost some percentage of gymystic
- //ShieldBlock cost Effectiveness:
- if (game.equipment['Shield'].blockNow) {
- var gymEff = evaluateEquipmentEfficiency('Gym');
- var shieldEff = evaluateEquipmentEfficiency('Shield');
- if ((gymEff.Wall) || (gymEff.Factor <= shieldEff.Factor && !gymEff.Wall))
- skipGym = true;
- }
- if(buyCoords && game.upgrades.Coordination.done < game.upgrades.Coordination.allowed)
- skipGym = true;
- if (!skipGym)
- safeBuyBuilding('Gym');
- }
- //Tributes:
- var tributes = getPageSetting('MaxTribute');
- if (!game.buildings.Tribute.locked && tributes !== 0 && (tributes > game.buildings.Tribute.owned || tributes < 0)){
- safeBuyBuilding('Tribute');
- }
- if(game.global.spireActive && !isActiveSpireAT() && getPageSetting('NurseriesSurvive')){
- var howMany = calcCurrSendHealth(true, true, false, game.global.world);
- if(howMany > 0){
- safeBuyBuilding('Nursery');
- postBuy2(oldBuy);
- return;
- }
- }
- var nursminlvl = getPageSetting('NoNurseriesUntil');
- var maxNursery = (isActiveSpireAT() ? getPageSetting('PreSpireNurseries') : getPageSetting('MaxNursery'));
- if (((game.global.world < nursminlvl || nursminlvl < 0) && !isActiveSpireAT()) || (game.buildings.Nursery.owned >= maxNursery && maxNursery >= 0) || maxNursery === 0 || (getPageSetting('NoNurseriesIce') && (getEmpowerment() == "Ice") && game.global.world > nursminlvl+5)) {
- postBuy2(oldBuy);
- return;
- }
- /*var nwr = customVars.nursCostRatio; //nursery to warpstation/collector cost ratio. Also for extra gems.
- var nursCost = getBuildingItemPrice(game.buildings.Nursery, "gems", false, 1);
- var warpCost = getBuildingItemPrice(game.buildings.Warpstation, "gems", false, 1);
- var collCost = getBuildingItemPrice(game.buildings.Collector, "gems", false, 1);
- var resomod = Math.pow(1 - game.portal.Resourceful.modifier, game.portal.Resourceful.level); //need to apply the resourceful mod when comparing anything other than building vs building.
- //buy nurseries irrelevant of warpstations (after we unlock them) - if we have enough extra gems that its not going to impact anything. note:(we will be limited by wood anyway - might use a lot of extra wood)
- var buyWithExtraGems = (!game.buildings.Warpstation.locked && nursCost * resomod < nwr * game.resources.gems.owned);
- if ((buyWithExtraGems ||
- ((nursCost < nwr * warpCost || game.buildings.Warpstation.locked) &&
- (nursCost < nwr * collCost || game.buildings.Collector.locked || !game.buildings.Warpstation.locked)))) {*/
- safeBuyBuilding('Nursery');
- //}
- postBuy2(oldBuy);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement