Advertisement
Jacorb90

True Infinity Omega

Jun 13th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. Dimension = class {
  2. constructor(dim, loc, amount, bought) {
  3. this.dim = n(dim || 0).floor();
  4.  
  5. this.loc = oa(loc || [0]);
  6. this.str_loc = joa(loc || [0]);
  7.  
  8. this.amount = n(amount || 0).floor();
  9. this.bought = n(bought || 0).floor();
  10.  
  11. this.price_start = OmegaNum.pow(10, this.dim.add(1));
  12.  
  13. this.id = Math.floor(Math.random() * 10000000000);
  14. }
  15.  
  16. get mult() {
  17. if (game.prestige[this.str_loc]) {
  18. return OmegaNum.pow(2, this.bought).mul(game.prestige[this.str_loc].mult);
  19. } else {
  20. return n(1);
  21. }
  22. }
  23.  
  24. get index() {
  25. return game.prestige[this.str_loc].dims.indexOf(this);
  26. }
  27.  
  28. get price() {
  29. if (game.state == 0) {
  30. return OmegaNum.pow(this.dim.floor().lt(25) ? 10 : this.dim.mul(0.9).floor(), this.dim.pow(2).add(1).mul(this.bought.pow(2).add(1)));
  31. } else {
  32. return OmegaNum.pow(10, this.dim.pow(2).add(1).mul(this.bought.pow(2).add(1)));
  33. }
  34. }
  35.  
  36. get afford() {
  37. return game.prestige[this.str_loc].points.gte(this.price);
  38. }
  39.  
  40. get next_str_loc() {
  41. let x = oa(JSON.parse(this.str_loc)[0]);
  42. x[0] = x[0].add(1);
  43. return JSON.stringify(x);
  44. }
  45.  
  46. buy() {
  47. if (this.afford) {
  48. let pc = this.price;
  49. this.amount = this.amount.add(1);
  50. this.bought = this.bought.add(1);
  51.  
  52. game.prestige[this.str_loc].subPoints(pc);
  53.  
  54. return true;
  55. } else {
  56. return false;
  57. }
  58. }
  59.  
  60. get max_afford() {
  61. if (this.dim.gt(100)) {
  62. return new OmegaNum(this.afford ? 1 : 0);
  63. }
  64. if (game.prestige[this.str_loc].points.isint() && this.price_start.isint() && this.bought.isint() && this.afford){
  65. let target = game.prestige[this.str_loc].points.logBase(this.dim.floor().lt(25) ? 10 : this.dim.mul(0.9).floor()).div(this.dim.pow(2).add(1)).sub(1).sqrt().plus(1).floor()
  66. return target.sub(this.bought)
  67. }
  68. return n(0);
  69. }
  70.  
  71. get max_price() {
  72. return OmegaNum.pow(this.dim.floor().lt(25) ? 10 : this.dim.mul(0.9).floor(), this.dim.pow(2).add(1).mul(this.bought.plus(this.max_afford.sub(1)).pow(2).add(1)))
  73. }
  74.  
  75. buyMax() {
  76. if (this.afford) {
  77. let ma = this.max_afford || n(0);
  78. let mp = this.max_price || n(0);
  79.  
  80. this.amount = this.amount.add(ma);
  81. this.bought = this.bought.add(ma);
  82.  
  83. game.prestige[this.str_loc].subPoints(mp);
  84.  
  85. return true;
  86. }
  87. return false;
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement