Advertisement
Amonimus

AntimaterCalculator.js

Mar 19th, 2023
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Glyph {
  2.   constructor() {
  3.     this.effects = [];
  4.     this.step()
  5.   }
  6.   // COMMON
  7.   step() {
  8.     this.getStats();
  9.     this.showGlyph();
  10.     this.hideEffects();
  11.     this.calculateEffects();
  12.     this.showEffects();
  13.   }
  14.   capitalizeType() {
  15.     return this.type.charAt(0).toUpperCase() + this.type.slice(1);
  16.   }
  17.   capitalizeRarityLabel() {
  18.     return this.rarityLabel.charAt(0).toUpperCase() + this.rarityLabel.slice(1);
  19.   }
  20.   greenNumber(number, aprox){
  21.     return '<div class="green">' + number.toFixed(aprox) + '</div>';
  22.   }
  23.   // STATS
  24.   getStats() {
  25.     this.type = document.getElementById("CalculatorInputGlyphType").value;
  26.     this.level = document.getElementById("CalculatorInputGlyphLevel").value;
  27.     this.rarity = document.getElementById("CalculatorInputRarityNumber").value;
  28.     this.strength = (this.rarity / 40) + 1;
  29.     this.sacrificePower = 1000;
  30.     this.sacrificeBoost = Math.log10(Math.max(Math.min(this.sacrificePower, 1e100)/1e60, 1)) / 2;
  31.     this.getRarityLabel();
  32.   }
  33.   getGlyphSymbol() {
  34.     var GlyphSelects = document.getElementById("CalculatorInputGlyphType").children;
  35.     for (var i=0; i<GlyphSelects.length; i++){
  36.       if(GlyphSelects[i].value == this.type){
  37.         var GlyphSymbol = GlyphSelects[i].innerText.split(" ")[1];
  38.         return GlyphSymbol;
  39.       }
  40.     }
  41.   }
  42.   getRarityLabel() {
  43.     this.rarityLabel = "celestial";
  44.     if (this.rarity < 100) {
  45.       this.rarityLabel = "transcendent";
  46.     }
  47.     if (this.rarity < 90) {
  48.       this.rarityLabel = "mythical";
  49.     }
  50.     if (this.rarity < 80) {
  51.       this.rarityLabel = "legendary";
  52.     }
  53.     if (this.rarity < 70) {
  54.       this.rarityLabel = "epic";
  55.     }
  56.     if (this.rarity < 60) {
  57.       this.rarityLabel = "rare";
  58.     }
  59.     if (this.rarity < 40) {
  60.       this.rarityLabel = "uncommon";
  61.     }
  62.     if (this.rarity < 20) {
  63.       this.rarityLabel = "common";
  64.     }
  65.   }
  66.   // MATH
  67.   // POWER
  68.   getADPower() {
  69.     var Calc = 0.015 + ((Math.pow(this.level, 0.2) * Math.pow(this.strength, 0.4)) / 75);
  70.     this.effects.push("Antimatter Dimension power +"+this.greenNumber(Calc, 3));
  71.   }
  72.   getDimboostMult() {
  73.     var Calc = Math.pow(this.level * this.strength, 0.5) * Math.pow(1 + this.sacrificeBoost, 3);
  74.     this.effects.push("Dimension Boost multiplier ×"+this.greenNumber(Calc, 2));
  75.   }
  76.   getADMult() {
  77.     var Calc = Math.pow(this.level * this.strength * 10, this.level * this.strength * 10);
  78.     this.effects.push("Antimatter Dimension Multipliers x"+this.greenNumber(Calc, 2));
  79.   }
  80.   getBuy10Mult() {
  81.     var Calc = 1 + (this.level * this.strength) / 12;
  82.     this.effects.push("Increase the bonus from buying 10 Antimatter Dimensions by "+this.greenNumber(Calc, 2));
  83.   }
  84.   // INFINITY
  85.   getIDPower() {
  86.     var Calc = 0.007 + (Math.pow(this.level, 0.21) * Math.pow(this.strength, 0.4)) / 75 + (this.sacrificeBoost / 50);
  87.     this.effects.push("Infinity Dimension power +"+this.greenNumber(Calc, 3));
  88.   }
  89.   getInfinityPowerConversion() {
  90.     var Calc = (Math.pow(this.level, 0.2) * Math.pow(this.strength, 0.04)) / 25;
  91.     this.effects.push("Infinity Power conversion rate +"+this.greenNumber(Calc, 3));
  92.   }
  93.   getMultInfinityPointGain() {
  94.     var Calc = Math.pow(this.level * (this.strength + 1), 6) * 10000;
  95.     this.effects.push("Multiply Infinity Point Gain by "+this.greenNumber(Calc, 3));
  96.   }
  97.   getMultInfinityGain() {
  98.     var Calc = Math.pow(this.level * this.strength, 1.5) * 2;
  99.     this.effects.push("Multiply Infinity gain by "+this.greenNumber(Calc, 1));
  100.   }
  101.   // REPLICATION
  102.   getMultiplyReplicationSpeed() {
  103.     var Calc = this.level * this.strength * 3;
  104.     this.effects.push("Multiply Replication Speed by "+this.greenNumber(Calc, 1));
  105.   }
  106.   getReplicantiMultPower() {
  107.     var Calc = 0.1 + Math.pow(this.level, 0.5) + (this.strength / 25) + 3 * this.sacrificeBoost;
  108.     this.effects.push("Replicanti multiplier power +"+this.greenNumber(Calc, 3));
  109.   }
  110.   getMultDilatedTime() {
  111.     var Calc = 3 * Math.pow(this.level, 0.3) * Math.pow(this.strength, 0.65);
  112.     this.effects.push("Multiply Dilated Time gain by +"+this.greenNumber(Calc, 3));
  113.   }
  114.   getReplicantiFactor() {
  115.     var Calc = (Math.pow(this.level, 0.125) * Math.pow(this.strength, 0.2)) / 50;
  116.     this.effects.push("Replicanti factor for Glyph level: ^0.4 ➜ ^(0.4 + "+this.greenNumber(Calc, 3)+")");
  117.   }
  118.   // TIME
  119.   getTimeDimPower() {
  120.     var Calc = 0.01 + (Math.pow(this.level, 0.32) * Math.pow(this.strength, 0.45)) / 75;
  121.     this.effects.push("Time Dimension power +"+this.greenNumber(Calc, 3));
  122.   }
  123.   getMultGameSpeed() {
  124.     var Calc = 1 + (Math.pow(this.level, 0.3) * Math.pow(this.strength, 0.65)) / 20;
  125.     this.effects.push("Multiply game speed by "+this.greenNumber(Calc, 3));
  126.   }
  127.   getMultEternityGain() {
  128.     var Calc = Math.pow((3 + this.strength) * this.level, 0.9) * Math.pow(3, this.sacrificeBoost);
  129.     this.effects.push("Multiply Eternity Gain by "+this.greenNumber(Calc, 2));
  130.   }
  131.   getMultEternityPointGain() {
  132.     var Calc = 100 * Math.pow(this.level * this.strength, 3);
  133.     this.effects.push("Raise Eternity Point Gain by "+this.greenNumber(Calc, 3));
  134.   }
  135.   // DILATION
  136.   getMultDilatedTimeGain() {
  137.     var Calc = 2 * Math.pow(this.level * this.strength, 1.5);
  138.     this.effects.push("Multiply Dilated Time Gain by "+this.greenNumber(Calc, 3));
  139.   }
  140.   getTachyonGalaxyMult() {
  141.     var Calc = 1 - ((Math.pow(this.level, 0.17) * Math.pow(this.strength, 0.35)) / 100) - (this.sacrificeBoost / 50);
  142.     this.effects.push("Tachyon Galaxy Threshold multiplier x"+this.greenNumber(Calc, 3));
  143.   }
  144.   getGenerateTimeTheorems() {
  145.     var Calc = (Math.pow(this.level * this.strength, 0.5) / 10000) * 3600;
  146.     this.effects.push("Generate "+this.greenNumber(Calc, 3)+" Time Theorems per hour");
  147.   }
  148.   getAntimatterDimensionsDilated() {
  149.     var Calc = 0.1 + (Math.pow(this.level, 0.7) * Math.pow(this.strength, 0.7)) / 25;
  150.     this.effects.push("Antimatter Dimensions power +"+this.greenNumber(Calc, 2)+" while Dilated");
  151.   }
  152.   // EFFARIG
  153.   // CURSED
  154.   // REALITY
  155.   // COMPANION
  156.   getCompanionSmile() {
  157.     this.effects.push("It does nothing but sit there and cutely smile at you, whisper into your dreams politely, and plot the demise of all who stand against you. This one-of-a-kind Glyph will never leave you.");
  158.   }
  159.   getCompanionThankYou() {
  160.     this.effects.push("Thanks for your dedication for the game! You reached X Eternity Points on your first Reality.");
  161.   }
  162.   // MATH ROUTER
  163.   calculateEffects() {
  164.     this.effects = []
  165.     if (this.type == "power") {
  166.       this.getADPower();
  167.       this.getDimboostMult();
  168.       // this.getADMult();
  169.       this.getBuy10Mult();
  170.     } else if (this.type == "infinity") {
  171.       this.getIDPower();
  172.       this.getInfinityPowerConversion();
  173.       this.getMultInfinityPointGain();
  174.       this.getMultInfinityGain();
  175.     } else if (this.type == "replication") {
  176.       this.getMultiplyReplicationSpeed();
  177.       this.getReplicantiMultPower();
  178.       this.getMultDilatedTime();
  179.       this.getReplicantiFactor();
  180.     } else if (this.type == "time") {
  181.       this.getTimeDimPower();
  182.       this.getMultGameSpeed();
  183.       this.getMultEternityGain();
  184.       this.getMultEternityPointGain();
  185.     } else if (this.type == "dilation") {
  186.       this.getMultDilatedTimeGain();
  187.       this.getTachyonGalaxyMult();
  188.       this.getGenerateTimeTheorems();
  189.       this.getAntimatterDimensionsDilated();
  190.     } else if (this.type == "effarig") {
  191.     } else if (this.type == "cursed") {
  192.     } else if (this.type == "reality") {
  193.     } else if (this.type == "companion") {
  194.       this.getCompanionSmile();
  195.       this.getCompanionThankYou();
  196.     }
  197.   }
  198.   // DISPLAY  
  199.   showGlyph() {
  200.     var CalculatorResultGlyphType = document.getElementById("CalculatorResultGlyphType");
  201.     CalculatorResultGlyphType.innerText = this.capitalizeType();
  202.     CalculatorResultGlyphType.style.color = "var(--"+this.type+"-color)";
  203.    
  204.     var CalculatorResultGlyphLevel = document.getElementById("CalculatorResultGlyphLevel");
  205.     CalculatorResultGlyphLevel.innerText = this.level;
  206.  
  207.     var CalculatorResultGlyphIcon = document.getElementById("CalculatorResultGlyphIcon");
  208.     CalculatorResultGlyphIcon.innerText = this.getGlyphSymbol();
  209.     CalculatorResultGlyphIcon.style.color = "var(--"+this.rarityLabel+"-color)";
  210.  
  211.     var CalculatorResultGlyphRarity = document.getElementById("CalculatorResultGlyphRarity");
  212.     CalculatorResultGlyphRarity.innerText = this.rarity + "%";
  213.     CalculatorResultGlyphRarity.style.color = "var(--"+this.rarityLabel+"-color)";
  214.    
  215.     var CalculatorResultGlyphFullTitle = document.getElementById("CalculatorResultGlyphFullTitle");
  216.     CalculatorResultGlyphFullTitle.innerHTML = this.capitalizeRarityLabel() + " Glyph of " + this.capitalizeType();
  217.     CalculatorResultGlyphFullTitle.style.color = "var(--"+this.rarityLabel+"-color)";
  218.   }
  219.   hideEffects() {
  220.     var EffectList = document.getElementById("CalculatorResultEffectList");
  221.     EffectList.innerHTML = "";
  222.   }
  223.   showEffects() {
  224.     for (var i=0; i<this.effects.length; i++){
  225.       var effectDiv = document.createElement("div");
  226.       effectDiv.className = "CalculatorGlyphEffect";
  227.       effectDiv.innerHTML = this.effects[i];
  228.       var EffectList = document.getElementById("CalculatorResultEffectList");
  229.       EffectList.appendChild(effectDiv);
  230.     }
  231.   }
  232. }
  233. glyph = new Glyph()
  234.  
  235. function GlyphUpdate() {
  236.   glyph.step()
  237. }
  238.  
  239. CalculatorInputGlyphType = document.getElementById("CalculatorInputGlyphType")
  240. selectTypes = CalculatorInputGlyphType.children
  241. for (var i=0; i<selectTypes.length; i++){
  242.   selectTypes[i].style.color = "var(--"+selectTypes[i].value+"-color)";
  243. }
  244. CalculatorInputGlyphType.style.color = "var(--"+CalculatorInputGlyphType.value+"-color)";
  245. CalculatorInputGlyphType.addEventListener("change", (event) => {
  246.   CalculatorInputGlyphType.style.color = "var(--"+CalculatorInputGlyphType.value+"-color)";
  247. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement