From c6835606b7425d260698d0828e9bdcf36b0e69eb Mon Sep 17 00:00:00 2001 From: ArchercatNEO Date: Tue, 9 Apr 2024 13:42:12 +0100 Subject: [PATCH] Refactor everything to oop because c# brainwash --- LICENSE | 21 --- inde2x.html | 50 ------ node_modules/.package-lock.json | 73 ++++++++ src/App.vue | 60 +++++-- src/ChatBoiler.vue | 1 - src/accel/CityWindow.vue | 21 +++ src/accel/FieldWindow.vue | 21 +++ src/assets/base.css | 8 +- src/assets/main.css | 2 +- src/chatgptboiler.js | 1 - src/common/Currency.ts | 6 + src/common/Upgrade/Upgrade.ts | 49 ++++++ .../Upgrade}/UpgradeCircle.vue | 43 +++-- src/common/Upgrade/UpgradeGrid.vue | 79 +++++++++ src/common/notations.ts | 12 ++ src/components/GrassCanvas.vue | 159 ------------------ src/components/NavDiv/ArrowButtons.vue | 48 ------ src/components/NavDiv/HeaderDiv.vue | 34 ---- src/components/NavDiv/NavDiv.vue | 27 --- src/components/Tabs/CityWindow.vue | 18 -- src/components/Tabs/FieldWindow.vue | 17 -- .../UpgradeComponents/UpgradeBtns.vue | 28 --- .../UpgradeComponents/UpgradeGrid.vue | 64 ------- src/grass/GrassCanvas.vue | 143 ++++++++++++++++ src/grass/GrassField.ts | 13 ++ src/grass/grass.ts | 91 ++++++++++ src/grass/grassUpgrades.ts | 19 +++ src/main.ts | 12 +- src/map/ArrowButtons.vue | 47 ++++++ src/map/map.ts | 3 + src/player.ts | 19 ++- src/scripts/engine/grassFieldStats.ts | 11 -- src/scripts/engine/main.ts | 72 -------- src/scripts/engine/notations.ts | 12 -- src/scripts/engine/upgrade.ts | 117 ------------- src/scripts/layers/grass.ts | 5 - src/scripts/layers/test.ts | 53 ------ src/scripts/map.ts | 4 - 38 files changed, 676 insertions(+), 787 deletions(-) delete mode 100644 LICENSE delete mode 100644 inde2x.html delete mode 100644 src/ChatBoiler.vue create mode 100644 src/accel/CityWindow.vue create mode 100644 src/accel/FieldWindow.vue delete mode 100644 src/chatgptboiler.js create mode 100644 src/common/Currency.ts create mode 100644 src/common/Upgrade/Upgrade.ts rename src/{components/UpgradeComponents => common/Upgrade}/UpgradeCircle.vue (62%) create mode 100644 src/common/Upgrade/UpgradeGrid.vue create mode 100644 src/common/notations.ts delete mode 100644 src/components/GrassCanvas.vue delete mode 100644 src/components/NavDiv/ArrowButtons.vue delete mode 100644 src/components/NavDiv/HeaderDiv.vue delete mode 100644 src/components/NavDiv/NavDiv.vue delete mode 100644 src/components/Tabs/CityWindow.vue delete mode 100644 src/components/Tabs/FieldWindow.vue delete mode 100644 src/components/UpgradeComponents/UpgradeBtns.vue delete mode 100644 src/components/UpgradeComponents/UpgradeGrid.vue create mode 100644 src/grass/GrassCanvas.vue create mode 100644 src/grass/GrassField.ts create mode 100644 src/grass/grass.ts create mode 100644 src/grass/grassUpgrades.ts create mode 100644 src/map/ArrowButtons.vue create mode 100644 src/map/map.ts delete mode 100644 src/scripts/engine/grassFieldStats.ts delete mode 100644 src/scripts/engine/main.ts delete mode 100644 src/scripts/engine/notations.ts delete mode 100644 src/scripts/engine/upgrade.ts delete mode 100644 src/scripts/layers/grass.ts delete mode 100644 src/scripts/layers/test.ts delete mode 100644 src/scripts/map.ts diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 30a4c3e..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 ArchercatNEO - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/inde2x.html b/inde2x.html deleted file mode 100644 index 3505835..0000000 --- a/inde2x.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - - - diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 27ca477..0ad9fce 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -470,6 +470,79 @@ "node": ">=6.9.0" } }, + "node_modules/@biomejs/biome": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.3.3.tgz", + "integrity": "sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.3.3", + "@biomejs/cli-darwin-x64": "1.3.3", + "@biomejs/cli-linux-arm64": "1.3.3", + "@biomejs/cli-linux-x64": "1.3.3", + "@biomejs/cli-win32-arm64": "1.3.3", + "@biomejs/cli-win32-x64": "1.3.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.3.tgz", + "integrity": "sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.3.tgz", + "integrity": "sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/win32-x64": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", diff --git a/src/App.vue b/src/App.vue index f30b99e..caccbad 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,21 +1,61 @@ - + diff --git a/src/ChatBoiler.vue b/src/ChatBoiler.vue deleted file mode 100644 index c5e3fa9..0000000 --- a/src/ChatBoiler.vue +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/accel/CityWindow.vue b/src/accel/CityWindow.vue new file mode 100644 index 0000000..b18a3a4 --- /dev/null +++ b/src/accel/CityWindow.vue @@ -0,0 +1,21 @@ + + + + + diff --git a/src/accel/FieldWindow.vue b/src/accel/FieldWindow.vue new file mode 100644 index 0000000..03f1a57 --- /dev/null +++ b/src/accel/FieldWindow.vue @@ -0,0 +1,21 @@ + + + + + diff --git a/src/assets/base.css b/src/assets/base.css index 8710b9a..f10adb8 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -70,14 +70,14 @@ body { Inter, -apple-system, BlinkMacSystemFont, - 'Segoe UI', + "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, - 'Fira Sans', - 'Droid Sans', - 'Helvetica Neue', + "Fira Sans", + "Droid Sans", + "Helvetica Neue", sans-serif; font-size: 15px; text-rendering: optimizeLegibility; diff --git a/src/assets/main.css b/src/assets/main.css index da0e140..a02a47e 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -1,4 +1,4 @@ -@import './base.css'; +@import "./base.css"; #app { max-width: 1280px; diff --git a/src/chatgptboiler.js b/src/chatgptboiler.js deleted file mode 100644 index 71dc376..0000000 --- a/src/chatgptboiler.js +++ /dev/null @@ -1 +0,0 @@ -//Sometimes we need to process chatgpt diff --git a/src/common/Currency.ts b/src/common/Currency.ts new file mode 100644 index 0000000..a105fa4 --- /dev/null +++ b/src/common/Currency.ts @@ -0,0 +1,6 @@ +import type Decimal from "break_infinity.js"; + +export interface Currency { + get amount(): Decimal; + set amount(value: Decimal); +} diff --git a/src/common/Upgrade/Upgrade.ts b/src/common/Upgrade/Upgrade.ts new file mode 100644 index 0000000..e160a15 --- /dev/null +++ b/src/common/Upgrade/Upgrade.ts @@ -0,0 +1,49 @@ +import type Decimal from "break_infinity.js"; +import type { Currency } from "../Currency"; + +export abstract class Upgrade { + /** Currency the upgrade acts upon */ + public readonly currency: Currency; + + /** Description of the upgrade in expanded view */ + public readonly description: string; + + constructor(currency: Currency, description: string) { + this.currency = currency; + this.description = description; + } + + /** The current level of the upgrade */ + abstract level(): number; + /** The max level of the upgrade */ + abstract levelCap(): number; + + /** The next cost of an upgrde */ + abstract nextCost(): Decimal; + + /** + * return {boolean} whether buying was successful or not + */ + abstract buyOne(): boolean; + + /** Buy the next 25 levels */ + buyNext(): void { + const remaining = this.level() % 25; + for (let purchased = 25 - remaining; purchased > 0; purchased--) { + if (!this.buyOne()) { + break; + } + } + } + + buyMax() { + while (this.buyOne()) { + continue; + } + } + + /** The icon on top of the upgrade */ + abstract icon(): string; + /** The background behind the upgrade */ + abstract background(): string; +} \ No newline at end of file diff --git a/src/components/UpgradeComponents/UpgradeCircle.vue b/src/common/Upgrade/UpgradeCircle.vue similarity index 62% rename from src/components/UpgradeComponents/UpgradeCircle.vue rename to src/common/Upgrade/UpgradeCircle.vue index ec2e2e1..d3480cb 100644 --- a/src/components/UpgradeComponents/UpgradeCircle.vue +++ b/src/common/Upgrade/UpgradeCircle.vue @@ -1,44 +1,51 @@ diff --git a/src/common/notations.ts b/src/common/notations.ts new file mode 100644 index 0000000..681dac3 --- /dev/null +++ b/src/common/notations.ts @@ -0,0 +1,12 @@ +import Decimal from "break_infinity.js"; +import * as ADNotations from "@antimatter-dimensions/notations"; + +const scientific = new ADNotations.ScientificNotation(); + +export function format( + number: Decimal | number | string, + places: number, + placesUnder1000: number +): string { + return scientific.format(number, places, placesUnder1000); +} diff --git a/src/components/GrassCanvas.vue b/src/components/GrassCanvas.vue deleted file mode 100644 index a34732a..0000000 --- a/src/components/GrassCanvas.vue +++ /dev/null @@ -1,159 +0,0 @@ - - - - - diff --git a/src/components/NavDiv/ArrowButtons.vue b/src/components/NavDiv/ArrowButtons.vue deleted file mode 100644 index a6821e5..0000000 --- a/src/components/NavDiv/ArrowButtons.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/src/components/NavDiv/HeaderDiv.vue b/src/components/NavDiv/HeaderDiv.vue deleted file mode 100644 index ca6695b..0000000 --- a/src/components/NavDiv/HeaderDiv.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - - - diff --git a/src/components/NavDiv/NavDiv.vue b/src/components/NavDiv/NavDiv.vue deleted file mode 100644 index fe2e1a6..0000000 --- a/src/components/NavDiv/NavDiv.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/src/components/Tabs/CityWindow.vue b/src/components/Tabs/CityWindow.vue deleted file mode 100644 index bc6cf80..0000000 --- a/src/components/Tabs/CityWindow.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/src/components/Tabs/FieldWindow.vue b/src/components/Tabs/FieldWindow.vue deleted file mode 100644 index b866204..0000000 --- a/src/components/Tabs/FieldWindow.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/src/components/UpgradeComponents/UpgradeBtns.vue b/src/components/UpgradeComponents/UpgradeBtns.vue deleted file mode 100644 index e11cb3e..0000000 --- a/src/components/UpgradeComponents/UpgradeBtns.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - - - diff --git a/src/components/UpgradeComponents/UpgradeGrid.vue b/src/components/UpgradeComponents/UpgradeGrid.vue deleted file mode 100644 index 5be85d4..0000000 --- a/src/components/UpgradeComponents/UpgradeGrid.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - diff --git a/src/grass/GrassCanvas.vue b/src/grass/GrassCanvas.vue new file mode 100644 index 0000000..9abe858 --- /dev/null +++ b/src/grass/GrassCanvas.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/src/grass/GrassField.ts b/src/grass/GrassField.ts new file mode 100644 index 0000000..2efb3c9 --- /dev/null +++ b/src/grass/GrassField.ts @@ -0,0 +1,13 @@ +export interface GrassCube { + posX: number; + posY: number; + collectGrass(): void; +} + +export interface GrassField { + growSpeed(): number; + grassCap(): number; + cutterLength(): number; + + spawnGrass(canvas: HTMLCanvasElement): GrassCube; +} diff --git a/src/grass/grass.ts b/src/grass/grass.ts new file mode 100644 index 0000000..8d21be7 --- /dev/null +++ b/src/grass/grass.ts @@ -0,0 +1,91 @@ +import Decimal from "break_infinity.js"; + +import player from "@/player"; +import type { Currency } from "@/common/Currency"; +import { Upgrade } from "@/common/Upgrade/Upgrade"; +import type { GrassCube, GrassField } from "./GrassField"; + +class NormalGrass implements Currency { + get amount(): Decimal { + return player.grass; + } + + set amount(value: Decimal) { + player.grass = value; + } +} + +export class NormalGrassUpgrade extends Upgrade { + private _index: number; + level(): number { + player.grassUpgrades[this._index] ??= 0; + return player.grassUpgrades[this._index]; + } + + private _levelCap: number; + levelCap(): number { + return this._levelCap; + } + + icon(): string { + return "images/Curr/Grass.png"; + } + + background(): string { + return "images/Bases/GrassBase.png"; + } + + constructor(description: string, _index: number, _levelCap: number) { + super(new NormalGrass(), description); + this._index = _index; + this._levelCap = _levelCap; + } + + nextCost(): Decimal { + return new Decimal(this.level() * 10); + } + + buyOne(): boolean { + if (this.level() >= this.levelCap()) { return false; } + if (this.currency.amount.lt(this.nextCost())) { return false; } + + this.currency.amount = this.currency.amount.minus(this.nextCost()); + player.grassUpgrades[this._index] ??= 0; + player.grassUpgrades[this._index]++; + return true; + } +} + +export class NormalGrassCube implements GrassCube { + posX: number; + posY: number; + + public constructor(posX: number, posY: number) { + this.posX = posX; + this.posY = posY; + } + + collectGrass(): void { + player.grass = player.grass.add(1); + } +} + +export class NormalGrassField implements GrassField { + growSpeed(): number { + return 1; + } + + grassCap(): number { + return 50; + } + + cutterLength(): number { + return 6; + } + + spawnGrass(canvas: HTMLCanvasElement): GrassCube { + const posX = Math.random() * canvas.width; + const posY = Math.random() * canvas.height; + return new NormalGrassCube(posX, posY); + } +} \ No newline at end of file diff --git a/src/grass/grassUpgrades.ts b/src/grass/grassUpgrades.ts new file mode 100644 index 0000000..8444434 --- /dev/null +++ b/src/grass/grassUpgrades.ts @@ -0,0 +1,19 @@ +import { NormalGrassUpgrade } from "./grass"; + +export const grassUpgrades: NormalGrassUpgrade[] = [ + new NormalGrassUpgrade( + "Hello World", + 0, + 100 + ), + new NormalGrassUpgrade( + "Goodbye world", + 1, + 100 + ), + new NormalGrassUpgrade( + "Where are we", + 2, + 100 + ), +]; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 4d0f189..76713b2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,8 @@ -import './assets/main.css' -import './assets/boxes.css' -import './assets/vars.css' +import "./assets/main.css"; +import "./assets/boxes.css"; +import "./assets/vars.css"; -import { createApp } from 'vue' -import App from './App.vue' +import { createApp } from "vue"; +import App from "./App.vue"; -createApp(App).mount('#app') +createApp(App).mount("#app"); diff --git a/src/map/ArrowButtons.vue b/src/map/ArrowButtons.vue new file mode 100644 index 0000000..fa1c906 --- /dev/null +++ b/src/map/ArrowButtons.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/map/map.ts b/src/map/map.ts new file mode 100644 index 0000000..8011d2a --- /dev/null +++ b/src/map/map.ts @@ -0,0 +1,3 @@ +import FieldWindow from "@/accel/FieldWindow.vue"; + +export const map = [[FieldWindow, FieldWindow], [FieldWindow]]; diff --git a/src/player.ts b/src/player.ts index 458fa7f..72fb36b 100644 --- a/src/player.ts +++ b/src/player.ts @@ -1,7 +1,14 @@ -import { reactive } from 'vue' -import Decimal from 'break_infinity.js' +import { reactive } from "vue"; +import Decimal from "break_infinity.js"; -export default reactive({ - grass: new Decimal(0), - position: [0, 0] -}) +class Player { + //Other information + position: [number, number] = [0, 0]; + + //Grass things + grass: Decimal = new Decimal(0); + grassUpgrades: number[] = []; +} + +const player = reactive(new Player()); +export { player as default }; diff --git a/src/scripts/engine/grassFieldStats.ts b/src/scripts/engine/grassFieldStats.ts deleted file mode 100644 index 59687dd..0000000 --- a/src/scripts/engine/grassFieldStats.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const fieldStats = { - growSpeed() { - return 1 - }, - grassCap() { - return 500 - }, - cutterLength() { - return 20 - } -} diff --git a/src/scripts/engine/main.ts b/src/scripts/engine/main.ts deleted file mode 100644 index 8c6c896..0000000 --- a/src/scripts/engine/main.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*function init() { - windows = [ - [$('#Achievements'), $('#Settings')], - [$('#City'), $('#GrassField')], - [$('#Time'), $('#Automation')] - ] - - for (let array of windows) for (let field of array) field.hide() - - for (let i = 0; i < player.field.gridSize; i++) { - for (let j = 0; j < player.field.gridSize; j++) { - player.field.emptySpace.push({ x: j, y: i }) - } - } - - SwitchWindow('none') - SwitchGrassField('accel') - InitGrass() - initPrestige() - - return -} - -const deltaTime = 1 / 60 -function tick() { - //called every 1/60th of a second - drawEveryGrass(player.growSpeed * deltaTime) - return -} - -let windows: JQuery[][] -interface Player { - field: { - grassLength: number - grassBorder: number - grassCount: number - grassCap: number - canvas: CanvasRenderingContext2D - colour: string - emptySpace: position[] - grassSpace: position[] - gridSize: number - } - - realm: 'planetoid' | 'reccel' | 'deccel' | 'accel' - range: number - growSpeed: number - position: number[] -} -interface position { - x: number - y: number -} -const player: Player = { - field: { - grassLength: 3, - grassBorder: 5, - grassCount: 0, - grassCap: 5000, - canvas: 69 as unknown as CanvasRenderingContext2D, - colour: '#0F0', - emptySpace: [], - grassSpace: [], - gridSize: 71 - }, - - realm: 'accel', - range: 10, - growSpeed: 1, - position: [1, 1] -} -*/ diff --git a/src/scripts/engine/notations.ts b/src/scripts/engine/notations.ts deleted file mode 100644 index 7a388f9..0000000 --- a/src/scripts/engine/notations.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Decimal from 'break_infinity.js' -import * as ADNotations from '@antimatter-dimensions/notations' - -const scientific = new ADNotations.ScientificNotation() - -export function format( - number: Decimal | number | string, - places: number, - placesUnder1000: number -): string { - return scientific.format(number, places, placesUnder1000) -} diff --git a/src/scripts/engine/upgrade.ts b/src/scripts/engine/upgrade.ts deleted file mode 100644 index 5ed3bd6..0000000 --- a/src/scripts/engine/upgrade.ts +++ /dev/null @@ -1,117 +0,0 @@ -import Decimal from 'break_infinity.js' - -export interface Upgrade { - description: string - level: number - cost: (level: number) => number - effect: (level: number) => number - bg: string - icon: string - config: UpgradeData -} - -export interface UpgradeData { - description: string - cost: (level: number) => number - currency: () => Decimal | number - bg: string - icon: string -} - -export class Upgrade implements Upgrade { - description: string - cost: (level: number) => number - bg: string - icon: string - config: UpgradeData - - constructor(data: UpgradeData) { - this.description = data.description - this.cost = data.cost - this.bg = data.bg - this.icon = data.icon - this.config = data - } - - get isAffordable(): boolean { - return new Decimal(this.currency).gte(this.cost(56)) - } - - get currency(): number | Decimal { - return this.config.currency() - } -} - -/*abstract class UpgradeLayer { - isFree = false - abstract resource: Resource - - level: number = 0 - cap: number - - cost: Function - effect: Function - - buyNext = () => { - if (this.level >= this.cap) return - if (this.cost(this.level) < this.resource.amount) { - if (!this.isFree) this.resource.amount -= this.cost(this.level) - this.level++ - } - } - - buyMax = () => { - for (let i = this.level; i < this.cap; i++) this.buyNext() - } - - constructor(costFunc: Formula, effectFunc: Formula, cap: number) { - this.cost = costFunc - this.effect = () => effectFunc(this.level) - this.cap = cap - } -} - -interface Formula { - (level: number): number -} -interface Resource { - amount: number - name: string - bg: string -} -interface UpgradeData { - resource: Resource - target: string - selector: string - layers: UpgradeLayer[] -} - -function GenerateCostFormula(base: number = 1, linear: number = 0, exponential: number = 1) { - return (level: number) => { - let cost = base - cost *= 1 + level * linear - cost *= exponential ** level - - return cost - } -} - -class Upgradey { - resource: Resource - target: string - - layers: UpgradeLayer[] - html: JQuery - - autoSettings: 'off' | 'capped' | 'on' = 'off' - isFree = false - - constructor(data: UpgradeData) { - NewUpgrade(data.resource.name + ' ' + data.target, data.resource.name, data.resource.bg) - this.resource = data.resource - this.target = data.target - this.html = $(data.selector) - this.layers = data.layers - } -} -*/ diff --git a/src/scripts/layers/grass.ts b/src/scripts/layers/grass.ts deleted file mode 100644 index 77cbbe0..0000000 --- a/src/scripts/layers/grass.ts +++ /dev/null @@ -1,5 +0,0 @@ -import player from '@/player' - -export function GainGrass() { - player.grass = player.grass.add(1) -} diff --git a/src/scripts/layers/test.ts b/src/scripts/layers/test.ts deleted file mode 100644 index 5d6174f..0000000 --- a/src/scripts/layers/test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Upgrade } from '../engine/upgrade' -import type { UpgradeData } from '../engine/upgrade' -import player from '@/player' - -const GrassUpgradeData: UpgradeData[] = [ - { - description: 'WEeeee', - cost() { - return 0 - }, - bg: 'images/Bases/AutoBase.png', - icon: 'images/Curr/Astrolabe.png', - currency: () => player.grass - }, - { - description: 'WEewooe', - cost(level) { - return 10 - }, - bg: 'images/Bases/AstroBase.png', - icon: 'images/Curr/Charge.png', - currency: () => player.grass - }, - { - description: 'hi', - cost(level) { - return 20 - }, - bg: 'images/Bases/AstroBase.png', - icon: 'images/Curr/Cloud.png', - currency: () => player.grass - }, - { - description: 'tftft', - cost(level) { - return 30 - }, - bg: 'images/Bases/AstroBase.png', - icon: 'images/Curr/Fun.png', - currency: () => player.grass - }, - { - description: 'gddhgt', - cost(level) { - return 40 - }, - bg: 'images/Bases/AstroBase.png', - icon: 'images/Curr/Astrolabe.png', - currency: () => player.grass - } -] - -export const GrassUpgrades = GrassUpgradeData.map((e) => new Upgrade(e)) diff --git a/src/scripts/map.ts b/src/scripts/map.ts deleted file mode 100644 index c8c871d..0000000 --- a/src/scripts/map.ts +++ /dev/null @@ -1,4 +0,0 @@ -import FieldWindow from '@/components/Tabs/FieldWindow.vue' -import CityWindow from '@/components/Tabs/CityWindow.vue' - -export const map = [[CityWindow, FieldWindow], [FieldWindow]]