Advertisement
Slivermasterz

Untitled

Dec 22nd, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. function buyBuildings() {
  2. var customVars = MODULES["buildings"];
  3. var oldBuy = preBuy2();
  4. game.global.buyAmt = 1;
  5. var perTrap = 1 + game.portal.Bait.level;
  6. 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
  7. if(trapFlag && game.resources.trimps.owned < trimpsRealMax - 1 && canAffordBuilding('Trap') && game.global.buildingsQueue.length === 0 && game.buildings.Trap.owned === 0)
  8. safeBuyBuilding('Trap');
  9.  
  10. buyFoodEfficientHousing(); //["Hut", "House", "Mansion", "Hotel", "Resort"];
  11. if ((game.jobs.Miner.locked && game.global.challengeActive != 'Metal') || (game.jobs.Scientist.locked && game.global.challengeActive != "Scientist"))
  12. return;
  13. buyGemEfficientHousing(); //["Hotel", "Resort", "Gateway", "Collector", "Warpstation"];
  14. //WormHoles:
  15. if ((game.buildings.Wormhole.owned < getPageSetting('MaxWormhole') || getPageSetting('MaxWormhole') < 0) && !game.buildings.Wormhole.locked) {
  16. safeBuyBuilding('Wormhole');
  17. }
  18. //Buy non-housing buildings:
  19. //Gyms:
  20. if (!game.buildings.Gym.locked) {
  21. var skipGym = false;
  22. if ( game.buildings.Gym.owned >= getPageSetting('MaxGym') && getPageSetting('MaxGym') >= 0)
  23. skipGym = true;
  24. if(game.upgrades.Gymystic.allowed > game.upgrades.Gymystic.done)
  25. 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
  26. //ShieldBlock cost Effectiveness:
  27. if (game.equipment['Shield'].blockNow) {
  28. var gymEff = evaluateEquipmentEfficiency('Gym');
  29. var shieldEff = evaluateEquipmentEfficiency('Shield');
  30. if ((gymEff.Wall) || (gymEff.Factor <= shieldEff.Factor && !gymEff.Wall))
  31. skipGym = true;
  32. }
  33. if(buyCoords && game.upgrades.Coordination.done < game.upgrades.Coordination.allowed)
  34. skipGym = true;
  35. if (!skipGym)
  36. safeBuyBuilding('Gym');
  37. }
  38. //Tributes:
  39. var tributes = getPageSetting('MaxTribute');
  40. if (!game.buildings.Tribute.locked && tributes !== 0 && (tributes > game.buildings.Tribute.owned || tributes < 0)){
  41. safeBuyBuilding('Tribute');
  42. }
  43.  
  44. if(game.global.spireActive && !isActiveSpireAT() && getPageSetting('NurseriesSurvive')){
  45. var howMany = calcCurrSendHealth(true, true, false, game.global.world);
  46. if(howMany > 0){
  47. safeBuyBuilding('Nursery');
  48. postBuy2(oldBuy);
  49. return;
  50. }
  51. }
  52.  
  53. var nursminlvl = getPageSetting('NoNurseriesUntil');
  54. var maxNursery = (isActiveSpireAT() ? getPageSetting('PreSpireNurseries') : getPageSetting('MaxNursery'));
  55. 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)) {
  56. postBuy2(oldBuy);
  57. return;
  58. }
  59.  
  60. /*var nwr = customVars.nursCostRatio; //nursery to warpstation/collector cost ratio. Also for extra gems.
  61. var nursCost = getBuildingItemPrice(game.buildings.Nursery, "gems", false, 1);
  62. var warpCost = getBuildingItemPrice(game.buildings.Warpstation, "gems", false, 1);
  63. var collCost = getBuildingItemPrice(game.buildings.Collector, "gems", false, 1);
  64. 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.
  65. //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)
  66. var buyWithExtraGems = (!game.buildings.Warpstation.locked && nursCost * resomod < nwr * game.resources.gems.owned);
  67. if ((buyWithExtraGems ||
  68. ((nursCost < nwr * warpCost || game.buildings.Warpstation.locked) &&
  69. (nursCost < nwr * collCost || game.buildings.Collector.locked || !game.buildings.Warpstation.locked)))) {*/
  70. safeBuyBuilding('Nursery');
  71. //}
  72. postBuy2(oldBuy);
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement