Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dimension = class {
- constructor(dim, loc, amount, bought) {
- this.dim = n(dim || 0).floor();
- this.loc = oa(loc || [0]);
- this.str_loc = joa(loc || [0]);
- this.amount = n(amount || 0).floor();
- this.bought = n(bought || 0).floor();
- this.price_start = OmegaNum.pow(10, this.dim.add(1));
- this.id = Math.floor(Math.random() * 10000000000);
- }
- get mult() {
- if (game.prestige[this.str_loc]) {
- return OmegaNum.pow(2, this.bought).mul(game.prestige[this.str_loc].mult);
- } else {
- return n(1);
- }
- }
- get index() {
- return game.prestige[this.str_loc].dims.indexOf(this);
- }
- get price() {
- if (game.state == 0) {
- 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)));
- } else {
- return OmegaNum.pow(10, this.dim.pow(2).add(1).mul(this.bought.pow(2).add(1)));
- }
- }
- get afford() {
- return game.prestige[this.str_loc].points.gte(this.price);
- }
- get next_str_loc() {
- let x = oa(JSON.parse(this.str_loc)[0]);
- x[0] = x[0].add(1);
- return JSON.stringify(x);
- }
- buy() {
- if (this.afford) {
- let pc = this.price;
- this.amount = this.amount.add(1);
- this.bought = this.bought.add(1);
- game.prestige[this.str_loc].subPoints(pc);
- return true;
- } else {
- return false;
- }
- }
- get max_afford() {
- if (this.dim.gt(100)) {
- return new OmegaNum(this.afford ? 1 : 0);
- }
- if (game.prestige[this.str_loc].points.isint() && this.price_start.isint() && this.bought.isint() && this.afford){
- 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()
- return target.sub(this.bought)
- }
- return n(0);
- }
- get max_price() {
- 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)))
- }
- buyMax() {
- if (this.afford) {
- let ma = this.max_afford || n(0);
- let mp = this.max_price || n(0);
- this.amount = this.amount.add(ma);
- this.bought = this.bought.add(ma);
- game.prestige[this.str_loc].subPoints(mp);
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement