Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ed35ad807 | |||
| 89d8396c2a | |||
| aa33c5b9e0 | |||
| b18e844ed1 | |||
| d7728bd36b | |||
| 9a2900c50e | |||
| 3972c433bd | |||
| e321263459 | |||
| c836eb4632 | |||
| 96eb036a8e | |||
| 5274835279 | |||
| b3a0d51ef8 | |||
| d625fa7eee | |||
| 463fc90c9a | |||
| 7da3e91af2 | |||
| 03c16126da | |||
| d221e8f8f7 | |||
| 28e9df8251 | |||
| 2ce333fd63 | |||
| c0b51e8362 | |||
| 6cc8304018 | |||
| 49baa613bd | |||
| ae65ff9d51 | |||
| 4de7ac97d1 | |||
| 6e9dc1ada1 | |||
| 3368755a31 | |||
| a821094513 | |||
| 2cb9221da1 | |||
| 85ed1224c0 | |||
| 0d87376270 | |||
| ae89704380 | |||
| 972b9251c3 | |||
| 2f10f940d8 | |||
| d962c85629 | |||
| e71326d89b | |||
| 20567be96d | |||
| 3c79074c4c | |||
| 571dee6cc9 | |||
| b49a30bb6e | |||
| 2a38461a47 | |||
| 52c340be26 | |||
| f2c5304643 | |||
| b6aefde9da | |||
| f31a0013a9 | |||
| e4af877358 | |||
| d162771749 | |||
| f53644119a | |||
| 34999a27b7 | |||
| 6e23f9a7b4 | |||
| d852f6fd96 | |||
| 0e0c133f6f | |||
| 8a6b581981 | |||
| 5497717605 | |||
| 85fa53b16e | |||
| 9feab73fd2 | |||
| ed7c9e66ec | |||
| 82350c6c42 | |||
| 0b7489b21f | |||
| 21fb2c5f72 | |||
| 20e7af41ae | |||
| 17a091bec8 | |||
| 13cb2c5a55 | |||
| 28fe055f32 | |||
| b35de64cea | |||
| 1e7eb5c750 | |||
| 1b1695bf1f | |||
| f524ce5e2e | |||
| d14ef20fb1 | |||
| 83070b632b | |||
| 2723801c9c | |||
| 5d1ce0a262 | |||
| 74ebac9862 | |||
| 2a5b162605 | |||
| d6e897c289 | |||
| a2b8b40464 | |||
| bdaa3bc029 | |||
| 816c1fb0e7 | |||
| acdd8f6964 | |||
| 5fa8f2cf15 | |||
| 5a818fb142 | |||
| 6625a5b9de | |||
| cf69b92934 | |||
| 005cde4a01 | |||
| 1b94d676e7 | |||
| 7cda820a99 | |||
| 7281fdab60 | |||
| 3b9441b555 | |||
| c2abfd6dfd | |||
| f05c393600 | |||
| 23b6f4b4f8 | |||
| d5195aa157 | |||
| 15072fe2c8 | |||
| ba4a6cb2a2 | |||
| 4847d22f7e | |||
| 2c053cc3eb | |||
| c55e0c8bb6 | |||
| 29aafedcfa | |||
| 8070c855a0 | |||
| aaf0eb6546 | |||
| c14a135c94 | |||
| 40d5a876b8 | |||
| 3b47ed1bed | |||
| fdc5d370de | |||
| 19c4a3f7ac | |||
| 2dad283de9 | |||
| 61ff80b69f | |||
| a185bc2153 | |||
| b213cae62b | |||
| 19d3dd5515 | |||
| 4f2d742284 | |||
| a0b7db1bf6 | |||
| c569a1110c | |||
| 56407505ea | |||
| 5e4a78530a | |||
| 7be4d2b9ca | |||
| eb4b0fba00 | |||
| 3f22b4511d | |||
| 6f777332a4 | |||
| 101ea0ffb5 | |||
| af11324fb7 | |||
| 6903774f97 | |||
| 1a9d2d0d9f | |||
| 359abd3ab4 | |||
| 1a3a493df4 | |||
| 0890efd1ec | |||
| 5b4278cf30 |
@@ -0,0 +1,23 @@
|
|||||||
|
# Game Design Document
|
||||||
|
|
||||||
|
## 1. Introduction
|
||||||
|
|
||||||
|
Guild Master is a game simulating being a fantasy guild master. The player will be able to recruit adventurers,
|
||||||
|
send them on quests, and manage the guild's resources.
|
||||||
|
|
||||||
|
## 2. Gameplay
|
||||||
|
|
||||||
|
Player will recruit adventurers and assign then to quests. Adventurers will have different statistics and a passive
|
||||||
|
ability that will make each character unique. Player will have to manage guild's resources to complete more and more
|
||||||
|
resource intensive quests and assignments.
|
||||||
|
|
||||||
|
## 3. Mechanics
|
||||||
|
Menus. Lots of menus. Possibly with fancy animations.
|
||||||
|
|
||||||
|
## 4. Characters
|
||||||
|
Set amount of available adventurers. Each with their own inventory and passive ability. Items in the inventory will
|
||||||
|
boost specific statistics of the character. They will be scaled based on level and the xp curve will be exponential.
|
||||||
|
|
||||||
|
## 5. Quests
|
||||||
|
There will always be a minimum set amount of quests available. Adventurers will have to be assigned to a quest that is
|
||||||
|
within their level range. Quests will come in different difficulties within the level range.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* This file is used to import the character portraits to base64 from raw assets
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const characterData = require('./rawAssets/data/adventurers.json');
|
||||||
|
|
||||||
|
for (const character of characterData) {
|
||||||
|
try {
|
||||||
|
const base64 = base64_encode(`./rawAssets/img/portraits/${character.id}.png`);
|
||||||
|
character.portrait = "data:image/png;base64,"+base64;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Error: Didn't find portrait for ${character.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync('./public/data/adventurers.json', JSON.stringify(characterData, null, 2), "utf-8");
|
||||||
|
|
||||||
|
function base64_encode(file) {
|
||||||
|
return fs.readFileSync(file, "base64");
|
||||||
|
}
|
||||||
@@ -1,18 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Guild Master - Adventurer's guild management game</title>
|
<title>Guild Master - Adventurer's guild management game</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond&display=swap" rel="stylesheet">
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<meta name="description"
|
||||||
|
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
|
||||||
|
<meta property="twitter:title" content="Guild Master - Adventurer's guild management game"/>
|
||||||
|
<meta property="twitter:image" content="https://guildmaster.yht.one/img/app-icons/icon.png"/>
|
||||||
|
<meta property="twitter:description"
|
||||||
|
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
|
||||||
|
<meta property="og:title" content="Guild Master - Adventurer's guild management game"/>
|
||||||
|
<meta property="og:url" content="https://guildmaster.yht.one/"/>
|
||||||
|
<meta property="og:description"
|
||||||
|
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
|
||||||
|
<meta property="og:image" content="https://guildmaster.yht.one/img/app-icons/icon.png"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<noscript>
|
<noscript>
|
||||||
This is a javascript game. You need to enable javascript for it to work.
|
This is a javascript game. You need to enable javascript for it to work.
|
||||||
</noscript>
|
</noscript>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,29 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "adventurers-guild",
|
"name": "adventurers-guild",
|
||||||
"version": "0.1.0",
|
"version": "0.15.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
"dev-public": "vite --host",
|
||||||
"build": "run-p type-check build-only && cp -r CNAME dist/CNAME",
|
"build": "run-p type-check build-only && cp -r CNAME dist/CNAME",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
"type-check": "vue-tsc --noEmit"
|
"type-check": "vue-tsc --noEmit",
|
||||||
|
"gen-character-data": "node characterDataGenerator.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vueuse/components": "^9.13.0",
|
"@vueuse/components": "^9.13.0",
|
||||||
"sass": "^1.59.3",
|
"sass": "^1.66.1",
|
||||||
"vue": "^3.2.45",
|
"vue": "^3.3.4",
|
||||||
"vue-router": "^4.1.6"
|
"vue-router": "^4.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.12",
|
"@types/node": "^18.17.6",
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
"@vitejs/plugin-vue": "^4.3.1",
|
||||||
"@vue/tsconfig": "^0.1.3",
|
"@vue/tsconfig": "^0.4.0",
|
||||||
"eslint": "^8.36.0",
|
"eslint": "^8.47.0",
|
||||||
"eslint-plugin-vue": "^9.9.0",
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"typescript": "~4.7.4",
|
"typescript": "~5.1.6",
|
||||||
"vite": "^4.0.0",
|
"vite": "4.4.9",
|
||||||
"vue-tsc": "^1.0.12"
|
"vue-tsc": "^1.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
{
|
||||||
|
"ranks": {
|
||||||
|
"A": [
|
||||||
|
{
|
||||||
|
"title": "Ogre king",
|
||||||
|
"text": "Ogres have chosen a new king through democratic vote. They all voted for the strongest ogre."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Devilish dungeon",
|
||||||
|
"text": "New dungeon was discovered. It needs to be mapped and explored so lower rank adventurers can enter."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Eater of Worlds",
|
||||||
|
"text": "A giant worm emerged from the ground and appears to be consuming the ground itself."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"B": [
|
||||||
|
{
|
||||||
|
"title": "Undead horde",
|
||||||
|
"text": "Due to the spillage of necromancy potion at nearby graveyard we now have an undead army on our doorstep."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Runaway prisoner",
|
||||||
|
"text": "During the last prison guard strike a prisoner managed to escape. Bring them back to their cell."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "The aristocrats",
|
||||||
|
"text": "Royalty wants an escort for one of their carriages."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"C": [
|
||||||
|
{
|
||||||
|
"title": "Scratchy, the butcher",
|
||||||
|
"text": "Scratchy turned evil and is terrorizing its victims. Put a stop to it!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Hobgnoblin subjugation",
|
||||||
|
"text": "Gnoblins evolved and are back for vengeance."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Holy",
|
||||||
|
"text": "Gnoblins summoned their machine god and it started going haywire on everything around it. Destroy it!"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"D": [
|
||||||
|
{
|
||||||
|
"title": "Caravan escort",
|
||||||
|
"text": "Escort a merchant caravan."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rare ore",
|
||||||
|
"text": "Obtain laudanium ore for town's blacksmith."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Demonic pests!",
|
||||||
|
"text": "Clear the fields from cabbage imps."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"E": [
|
||||||
|
{
|
||||||
|
"title": "Gnoblin subjugation",
|
||||||
|
"text": "Kill 3 gnoblins."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Phantom menace",
|
||||||
|
"text": "Exorcise ghosts out of someone's apartment."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Scratchy in peril",
|
||||||
|
"text": "Get Scratchy the cat from the tree safe onto the ground."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"F": [
|
||||||
|
{
|
||||||
|
"title": "Frog Frenzy",
|
||||||
|
"text": "Kill 10 demon frogs."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rats!",
|
||||||
|
"text": "Get rid of the rats from someone's basement."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Herb gathering",
|
||||||
|
"text": "Collect medicinal herbs."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Big pile of rubble",
|
||||||
|
"text": "Tavern collapsed. Again. Help clean up the debris."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"S": [
|
||||||
|
{
|
||||||
|
"title": "The Demon King",
|
||||||
|
"text": "Demon King has awoken and is a threat to whole existence. Heroes needed."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Scratchy, Destruction Incarnate",
|
||||||
|
"text": "Scratchy was reborn as a machine of pure destruction and needs to be stopped."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Jiggly Jungle",
|
||||||
|
"text": "A jungle south began rapidly expanding and experts think arson is our only option."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Ogre king",
|
|
||||||
"text": "Ogres have chosen a new king through democratic vote. They all voted for the strongest ogre."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Devilish dungeon",
|
|
||||||
"text": "New dungeon was discovered. It needs to be mapped and explored so lower rank adventurers can enter."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Eater of Worlds",
|
|
||||||
"text": "A giant worm emerged from the ground and appears to be consuming the ground itself."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Undead horde",
|
|
||||||
"text": "Due to the spillage of necromancy potion at nearby graveyard we now have an undead army on our doorstep."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Runaway prisoner",
|
|
||||||
"text": "During the last prison guard strike a prisoner managed to escape. Bring them back to their cell."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "The aristocrats",
|
|
||||||
"text": "Royalty wants an escort for one of their carriages."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Scratchy, the butcher",
|
|
||||||
"text": "Scratchy turned evil and is terrorizing its victims. Put a stop to it!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Hobgnoblin subjegation",
|
|
||||||
"text": "Gnoblins evolved and are back for vengeance."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Holy",
|
|
||||||
"text": "Gnoblins summoned their machine god and it started going haywire on everything around it. Destroy it!"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Caravan escort",
|
|
||||||
"text": "Escort a merchant caravan."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Rare ore",
|
|
||||||
"text": "Obtain laudanium ore for town's blacksmith."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Demonic pests!",
|
|
||||||
"text": "Clear the fields from cabbage imps."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Gnoblin subjegation",
|
|
||||||
"text": "Kill 3 gnoblins."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Phantom menace",
|
|
||||||
"text": "Exorcise ghosts out of someone's apartment."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Scratchy in peril",
|
|
||||||
"text": "Get Scratchy the cat from the tree safe onto the ground."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Frog Frenzy",
|
|
||||||
"text": "Kill 10 demon frogs."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Rats!",
|
|
||||||
"text": "Get rid of the rats from someone's basement."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Herb gathering",
|
|
||||||
"text": "Collect medicinal herbs."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Big pile of rubble",
|
|
||||||
"text": "Tavern collapsed. Again. Help clean up the debris."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "The Demon King",
|
|
||||||
"text": "Demon King has awoken and is a threat to whole existence. Heroes needed."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Scratchy, Destruction Incarnate",
|
|
||||||
"text": "Scratchy was reborn as a machine of pure destruction and needs to be stopped."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Jiggly Jungle",
|
|
||||||
"text": "A jungle south began rapidly expanding and experts think arson is our only option."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 234 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 304 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 119 KiB |
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"name": "Guild Master - Adventurer's guild management game",
|
||||||
|
"short_name": "Guild Master",
|
||||||
|
"theme_color": "#3C2114",
|
||||||
|
"background_color": "#d9c8b3",
|
||||||
|
"display": "standalone",
|
||||||
|
"scope": "./",
|
||||||
|
"start_url": "./",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-72x72.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-96x96.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-128x128.png",
|
||||||
|
"sizes": "128x128",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-144x144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-152x152.png",
|
||||||
|
"sizes": "152x152",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon-384x384.png",
|
||||||
|
"sizes": "384x384",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "img/app-icons/icon.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png",
|
||||||
|
"purpose": "maskable any"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "aldek",
|
||||||
|
"name": "Aldek",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "aria",
|
||||||
|
"name": "Aria",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "burnett",
|
||||||
|
"name": "Burnett",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "charlotte",
|
||||||
|
"name": "Charlotte",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ella",
|
||||||
|
"name": "Ella",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "elyza",
|
||||||
|
"name": "Elyza",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "emille",
|
||||||
|
"name": "Emille",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "garret",
|
||||||
|
"name": "Garret",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "gryza",
|
||||||
|
"name": "Gryza",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "lestat",
|
||||||
|
"name": "Lestat",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "lydia",
|
||||||
|
"name": "Lydia",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "noor",
|
||||||
|
"name": "Noor",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "noron",
|
||||||
|
"name": "Noron",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "oola",
|
||||||
|
"name": "Oola",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "owen",
|
||||||
|
"name": "Owen",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ryslette",
|
||||||
|
"name": "Ryslette",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sally",
|
||||||
|
"name": "Sally",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tovu",
|
||||||
|
"name": "Tovu",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "wrydio",
|
||||||
|
"name": "Wrydio",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "xarya",
|
||||||
|
"name": "Xarya",
|
||||||
|
"attackExponent": 1.1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Before Width: | Height: | Size: 4.9 MiB After Width: | Height: | Size: 4.9 MiB |
|
Before Width: | Height: | Size: 5.6 MiB After Width: | Height: | Size: 5.6 MiB |
|
Before Width: | Height: | Size: 5.3 MiB After Width: | Height: | Size: 5.3 MiB |
|
Before Width: | Height: | Size: 4.9 MiB After Width: | Height: | Size: 4.9 MiB |
|
After Width: | Height: | Size: 406 KiB |
|
After Width: | Height: | Size: 470 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="800px" height="800px" viewBox="0 0 569.613 569.614"
|
||||||
|
xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path d="M371.49,563.638l113.052-65.854c5.26-3.063,9.088-8.094,10.64-13.975c1.555-5.888,0.701-12.148-2.359-17.405
|
||||||
|
l-30.769-52.807c4.789-6.524,9.083-13.115,12.972-19.918c3.893-6.799,7.405-13.84,10.606-21.275l61.114-0.221
|
||||||
|
c6.086-0.021,11.915-2.464,16.202-6.781c4.287-4.32,6.687-10.165,6.665-16.255l-0.48-130.833
|
||||||
|
c-0.024-6.089-2.464-11.919-6.784-16.206c-4.299-4.269-10.113-6.662-16.166-6.662c-0.03,0-0.062,0-0.089,0l-61.182,0.242
|
||||||
|
c-6.444-14.462-14.428-28.14-23.871-40.913l30.417-53.143c6.294-11.001,2.481-25.025-8.52-31.316L369.403,5.335
|
||||||
|
c-5.281-3.023-11.545-3.822-17.424-2.231c-5.872,1.598-10.872,5.462-13.892,10.747L307.665,67
|
||||||
|
c-15.766-1.662-31.653-1.613-47.363,0.144l-30.796-52.892c-3.063-5.263-8.094-9.091-13.975-10.646
|
||||||
|
c-5.884-1.551-12.148-0.704-17.408,2.359L85.068,71.823c-10.949,6.38-14.657,20.429-8.28,31.38l30.765,52.831
|
||||||
|
c-4.761,6.484-9.048,13.076-12.953,19.899c-3.904,6.824-7.417,13.855-10.6,21.255l-61.139,0.235
|
||||||
|
C10.187,197.472-0.046,207.785,0,220.456L0.48,351.29c0.024,6.086,2.463,11.919,6.784,16.206
|
||||||
|
c4.299,4.269,10.11,6.661,16.166,6.661c0.028,0,0.058,0,0.086,0l61.203-0.229c6.432,14.452,14.413,28.131,23.868,40.915
|
||||||
|
l-30.413,53.141c-3.023,5.284-3.825,11.548-2.231,17.423c1.597,5.872,5.462,10.872,10.747,13.896l113.535,64.977
|
||||||
|
c3.596,2.056,7.513,3.032,11.38,3.032c7.962,0,15.701-4.146,19.942-11.552l30.417-53.149c15.799,1.671,31.684,1.619,47.348-0.144
|
||||||
|
l30.799,52.89c3.066,5.26,8.094,9.088,13.978,10.643C359.967,567.552,366.23,566.705,371.49,563.638z M341.129,465.911
|
||||||
|
c-4.902-8.418-14.599-12.815-24.137-10.994c-20.588,3.935-42.174,3.999-63.128,0.202c-9.572-1.735-19.184,2.741-24.015,11.181
|
||||||
|
l-26.748,46.745l-73.694-42.18l26.75-46.741c4.832-8.439,3.819-19.006-2.521-26.371c-13.978-16.239-24.685-34.594-31.818-54.554
|
||||||
|
c-3.265-9.131-11.918-15.227-21.61-15.227c-0.027,0-0.058,0-0.085,0l-53.825,0.199l-0.315-84.937l53.819-0.205
|
||||||
|
c9.722-0.04,18.366-6.197,21.576-15.374c3.69-10.557,7.962-20.019,13.06-28.917c5.101-8.914,11.089-17.387,18.311-25.897
|
||||||
|
c6.294-7.417,7.225-17.993,2.334-26.396l-27.081-46.509l73.385-42.754l27.078,46.497c4.893,8.4,14.544,12.821,24.095,11.004
|
||||||
|
c20.716-3.911,42.317-3.978,63.189-0.19c9.557,1.753,19.189-2.742,24.019-11.178l26.753-46.744l73.697,42.179l-26.753,46.742
|
||||||
|
c-4.826,8.437-3.816,19,2.521,26.368c13.956,16.221,24.669,34.587,31.842,54.59c3.271,9.119,11.919,15.202,21.604,15.202
|
||||||
|
c0.031,0,0.062,0,0.092,0l53.789-0.214l0.315,84.927l-53.783,0.192c-9.712,0.037-18.351,6.182-21.569,15.347
|
||||||
|
c-3.746,10.654-8.023,20.131-13.082,28.975c-5.064,8.847-11.067,17.338-18.356,25.958c-6.271,7.418-7.194,17.978-2.305,26.368
|
||||||
|
l27.078,46.472l-73.391,42.749L341.129,465.911z"/>
|
||||||
|
<path d="M392.531,346.458c16.472-28.773,20.746-62.24,12.047-94.232s-29.342-58.685-58.115-75.151
|
||||||
|
c-18.761-10.74-40.05-16.417-61.562-16.417c-44.446,0-85.762,23.944-107.822,62.485c-33.994,59.404-13.327,135.39,46.071,169.386
|
||||||
|
c18.764,10.737,40.052,16.411,61.564,16.411C329.158,408.943,370.475,385.001,392.531,346.458z M352.696,323.658
|
||||||
|
c-13.902,24.293-39.955,39.385-67.985,39.385c-13.528,0-26.934-3.58-38.764-10.349c-37.433-21.426-50.456-69.312-29.033-106.751
|
||||||
|
c13.905-24.291,39.958-39.385,67.987-39.385c13.528,0,26.932,3.58,38.762,10.355c18.136,10.379,31.142,27.197,36.628,47.359
|
||||||
|
C365.771,284.435,363.075,305.524,352.696,323.658z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 4.2 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 731 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 1018 KiB After Width: | Height: | Size: 1018 KiB |
|
Before Width: | Height: | Size: 947 KiB After Width: | Height: | Size: 947 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 474 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
@@ -1,22 +1,31 @@
|
|||||||
import type {Guild} from "@/classes/Guild";
|
import {Guild} from "@/classes/Guild";
|
||||||
import {Adventurer} from "@/classes/Adventurer";
|
import {Adventurer} from "@/classes/Adventurer";
|
||||||
import {Quest} from "@/classes/Quest";
|
import {Quest} from "@/classes/quests/Quest";
|
||||||
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
||||||
|
import QuestPhase from "@/classes/quests/QuestPhase";
|
||||||
|
import {PhaseType} from "@/classes/quests/QuestPhaseType";
|
||||||
|
|
||||||
export class GameData {
|
export class GameData {
|
||||||
guild: Guild;
|
guild: Guild;
|
||||||
adventurers: { [key: string]: Adventurer };
|
adventurers: { [key: string]: Adventurer };
|
||||||
missives: { [key: string]: { [key: string]: Quest } };
|
missives: Array<Quest>;
|
||||||
lastQuestGot: { [key: string]: null | number };
|
lastQuestGot: { [key: string]: null | number };
|
||||||
lastRecruitAction: null | number;
|
adventurersForHire: {[key: string]: Adventurer};
|
||||||
|
nextRecruitArrival: Date;
|
||||||
|
|
||||||
constructor(guild: Guild, adventurers: { [key: string]: Adventurer }, missives: { [key: string]: { [key: string]: Quest } }, lastQuestGot: { [key: string]: null | number }, lastRecruitAction: null | number) {
|
constructor(
|
||||||
this.guild = guild;
|
data: any,
|
||||||
this.adventurers = adventurers;
|
) {
|
||||||
this.missives = missives;
|
this.guild = data.guild ?? new Guild(1, 0);
|
||||||
this.lastQuestGot = lastQuestGot;
|
this.adventurers = data.adventurers ?? {};
|
||||||
this.lastRecruitAction = lastRecruitAction;
|
this.missives = data.missives ?? [] as Array<Quest>;
|
||||||
|
this.lastQuestGot = data.lastQuestGot ?? {};
|
||||||
|
this.adventurersForHire = data.adventurersForHire ?? {};
|
||||||
|
this.nextRecruitArrival = data.nextRecruitArrival ? new Date(data.nextRecruitArrival) : new Date();
|
||||||
|
if (isNaN(this.nextRecruitArrival.getTime())) {
|
||||||
|
this.nextRecruitArrival = new Date();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -24,90 +33,149 @@ export class GameData {
|
|||||||
* Save the game to local storage
|
* Save the game to local storage
|
||||||
*/
|
*/
|
||||||
export function saveGame(
|
export function saveGame(
|
||||||
data: GameData
|
data: GameData
|
||||||
): void {
|
): void {
|
||||||
console.debug("Saving game...");
|
console.debug("Saving game...");
|
||||||
window.localStorage.setItem("savedGame", JSON.stringify({
|
|
||||||
guild: data.guild,
|
const adventurers = {} as { [key: string]: any };
|
||||||
adventurers: data.adventurers,
|
for (const adventurerId in data.adventurers) {
|
||||||
missives: data.missives,
|
const adventurer: {[key: string]: any} = JSON.parse(JSON.stringify(data.adventurers[adventurerId]));
|
||||||
lastQuestGot: data.lastQuestGot,
|
delete adventurer.portrait;
|
||||||
lastRecruitAction: data.lastRecruitAction,
|
adventurers[adventurerId] = adventurer;
|
||||||
}));
|
}
|
||||||
|
|
||||||
|
const adventurersForHire = {} as { [key: string]: any };
|
||||||
|
for (const adventurerId in data.adventurersForHire) {
|
||||||
|
const adventurer: {[key: string]: any} = JSON.parse(JSON.stringify(data.adventurersForHire[adventurerId]));
|
||||||
|
delete adventurer.portrait;
|
||||||
|
adventurersForHire[adventurerId] = adventurer;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.localStorage.setItem("savedGame", JSON.stringify({
|
||||||
|
guild: data.guild,
|
||||||
|
adventurers: adventurers,
|
||||||
|
missives: data.missives,
|
||||||
|
lastQuestGot: data.lastQuestGot,
|
||||||
|
adventurersForHire: adventurersForHire,
|
||||||
|
nextRecruitArrival: data.nextRecruitArrival.getTime(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadGame(): GameData | null {
|
export function loadGame(): GameData | null {
|
||||||
const savedGame = window.localStorage.getItem("savedGame");
|
const savedGame = window.localStorage.getItem("savedGame");
|
||||||
if (!savedGame) return null;
|
if (!savedGame) return null;
|
||||||
console.debug("Loading game...");
|
const parsedGame = JSON.parse(savedGame);
|
||||||
const parsedGame = JSON.parse(savedGame);
|
console.debug("Loading game...");
|
||||||
return new GameData(
|
return new GameData(parsedGame);
|
||||||
parsedGame.guild,
|
|
||||||
parsedGame.adventurers,
|
|
||||||
parsedGame.missives,
|
|
||||||
parsedGame.lastQuestGot,
|
|
||||||
parsedGame.lastRecruitAction
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadAvailableQuests(): Promise<{ [key: string]: { [key: string]: Quest } }> {
|
export async function loadAvailableQuests(): Promise<{ [key: string]: { [key: string]: Quest } }> {
|
||||||
const quests = {
|
const quests = {
|
||||||
S: {} as { [key: string]: Quest },
|
S: {} as { [key: string]: Quest },
|
||||||
A: {} as { [key: string]: Quest },
|
A: {} as { [key: string]: Quest },
|
||||||
B: {} as { [key: string]: Quest },
|
B: {} as { [key: string]: Quest },
|
||||||
C: {} as { [key: string]: Quest },
|
C: {} as { [key: string]: Quest },
|
||||||
D: {} as { [key: string]: Quest },
|
D: {} as { [key: string]: Quest },
|
||||||
E: {} as { [key: string]: Quest },
|
E: {} as { [key: string]: Quest },
|
||||||
F: {} as { [key: string]: Quest },
|
F: {} as { [key: string]: Quest },
|
||||||
} as { [key: string]: { [key: string]: Quest } };
|
} as { [key: string]: { [key: string]: Quest } };
|
||||||
|
|
||||||
for (const rank in quests) {
|
const questsResponse = await fetch(`data/quests.json`);
|
||||||
const response = await fetch(`data/quests/Rank${rank}.json`);
|
|
||||||
if (response.status !== 200) {
|
|
||||||
console.error("Failed to load quests");
|
|
||||||
alert("Failed to load quests. Please try refreshing the page.");
|
|
||||||
return quests;
|
|
||||||
}
|
|
||||||
const questData = await response.json();
|
|
||||||
|
|
||||||
let id = 0;
|
if (questsResponse.status !== 200) {
|
||||||
for (const quest of questData) {
|
console.error("Failed to load quests");
|
||||||
id++;
|
alert("Failed to load quests. Please try refreshing the page.");
|
||||||
quests[rank.toString()][id] = new Quest(
|
|
||||||
id.toString(),
|
|
||||||
getFromString(rank as QuestRank),
|
|
||||||
quest.title,
|
|
||||||
quest.text,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return quests;
|
return quests;
|
||||||
|
}
|
||||||
|
|
||||||
|
const questsData = await questsResponse.json();
|
||||||
|
|
||||||
|
for (const rank of Object.keys(questsData.ranks)) {
|
||||||
|
const questRank = getFromString(rank as keyof typeof QuestRank);
|
||||||
|
if (!questRank) {
|
||||||
|
console.error(`Invalid quest rank: ${rank}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const questRankData = questsData.ranks[questRank];
|
||||||
|
|
||||||
|
for (const quest of questRankData) {
|
||||||
|
const id = hash(JSON.stringify(quest));
|
||||||
|
|
||||||
|
const phases = [] as Array<QuestPhase>;
|
||||||
|
if (Array.isArray(quest?.phases)) {
|
||||||
|
for (const phase of quest.phases) {
|
||||||
|
const phaseTypes: PhaseType[] = [];
|
||||||
|
if (Array.isArray(phase?.types)) {
|
||||||
|
for (const type of phase.types) {
|
||||||
|
const phaseType = PhaseType[type as keyof typeof PhaseType];
|
||||||
|
if (!phaseType) {
|
||||||
|
console.error(`Invalid phase type: ${type}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
phaseTypes.push(phaseType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phases.push(new QuestPhase(
|
||||||
|
phaseTypes,
|
||||||
|
phase.maxPoints,
|
||||||
|
0,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
quests[questRank][id] = new Quest(
|
||||||
|
id,
|
||||||
|
questRank,
|
||||||
|
quest.title,
|
||||||
|
quest.text,
|
||||||
|
phases,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return quests;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadAdventurersForHire(currentAdventurerIds: Array<string> = []): Promise<Array<Adventurer>> {
|
export async function loadAdventurersForHire(): Promise<{[key: string]: Adventurer}> {
|
||||||
const response = await fetch("data/adventurers.json");
|
const response = await fetch("data/adventurers.json");
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
console.error("Failed to load adventurers");
|
console.error("Failed to load adventurers");
|
||||||
alert("Failed to load adventurers. Please try refreshing the page.");
|
alert("Failed to load adventurers. Please try refreshing the page.");
|
||||||
return [];
|
return {};
|
||||||
}
|
}
|
||||||
const adventurerData = await response.json();
|
const adventurerData = await response.json();
|
||||||
|
|
||||||
const adventurers = [] as Array<Adventurer>;
|
const adventurers: {[key: string]: Adventurer} = {};
|
||||||
for (const adventurer of adventurerData) {
|
for (const adventurer of adventurerData) {
|
||||||
if (currentAdventurerIds.includes(adventurer.id)) continue;
|
const loadedAdventurer = new Adventurer(
|
||||||
adventurers.push(new Adventurer(
|
adventurer.id,
|
||||||
adventurer.id,
|
adventurer.name,
|
||||||
adventurer.name,
|
adventurer.portrait,
|
||||||
adventurer.portrait,
|
adventurer.attackExponent,
|
||||||
adventurer.attackExponent,
|
adventurer.level,
|
||||||
adventurer.level,
|
adventurer.exp,
|
||||||
adventurer.exp,
|
)
|
||||||
));
|
adventurers[loadedAdventurer.id] = loadedAdventurer;
|
||||||
}
|
}
|
||||||
|
return adventurers;
|
||||||
return adventurers;
|
}
|
||||||
|
|
||||||
|
export function removeAlreadyHiredAdventurers(
|
||||||
|
adventurers: { [key: string]: Adventurer },
|
||||||
|
adventurersHired: { [key: string]: Adventurer }
|
||||||
|
): { [key: string]: Adventurer } {
|
||||||
|
const adventurersForHire: { [key: string]: Adventurer } = {};
|
||||||
|
for (const adventurer of Object.values(adventurers)) {
|
||||||
|
if (adventurersHired[adventurer.id]) continue;
|
||||||
|
adventurersForHire[adventurer.id] = adventurer;
|
||||||
|
}
|
||||||
|
return adventurersForHire;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hash(str: string): string {
|
||||||
|
let hash = 5381;
|
||||||
|
for (let i = 0; i < str.length; i++) {
|
||||||
|
hash = (hash * 33) ^ str.charCodeAt(i);
|
||||||
|
}
|
||||||
|
return (hash >>> 0).toString(16);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
:root {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 0 10rem;
|
|
||||||
min-height: calc(100vh - 10rem);
|
|
||||||
font-family: 'EB Garamond', serif;
|
|
||||||
overflow-y: scroll;
|
|
||||||
user-select: none;
|
|
||||||
background-size: 30%;
|
|
||||||
background: rgba(87, 50, 20, 0.75) url("/img/background/panels/plaster.png") repeat;
|
|
||||||
background-blend-mode: darken;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
@@ -44,12 +44,13 @@ export class Adventurer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
canPrestigeUp(): boolean {
|
canPrestigeUp(): boolean {
|
||||||
|
if (this.busy) return false;
|
||||||
if (this.level < getMaxLevelForPrestige(this.prestige)) return false;
|
if (this.level < getMaxLevelForPrestige(this.prestige)) return false;
|
||||||
return this.prestige < 5
|
return this.prestige < 5
|
||||||
}
|
}
|
||||||
|
|
||||||
getNextLevelExpRequirement(): number {
|
getNextLevelExpRequirement(): number {
|
||||||
return this.level * 3;
|
return Math.max(1, Math.floor((3 * Math.pow(1.2, this.level - 1)) * Math.pow(1.025, this.level - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
import type {GuildUpgrade} from "@/classes/GuildUpgrade";
|
import type {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
import {AdventurerCapacityUpgrade} from "@/classes/guildUpgrades/AdventurerCapacityUpgrade";
|
import AdventurerCapacityUpgrade from "@/classes/guildUpgrades/AdventurerCapacityUpgrade";
|
||||||
|
import {formatGold} from "@/classes/NumberMagic";
|
||||||
|
import QuestExpUpgrade from "@/classes/guildUpgrades/QuestExpUpgrade";
|
||||||
|
import QuestGoldUpgrade from "@/classes/guildUpgrades/QuestGoldUpgrade";
|
||||||
|
import AutoFinishQuestsUpgrade from "@/classes/guildUpgrades/AutoFinishQuestsUpgrade";
|
||||||
|
import RecruitmentCapacityUpgrade from "@/classes/guildUpgrades/RecruitmentCapacityUpgrade";
|
||||||
|
|
||||||
|
const MAX_LEVEL: number = 8;
|
||||||
|
|
||||||
export class Guild {
|
export class Guild {
|
||||||
gold: number;
|
gold: number;
|
||||||
@@ -7,15 +14,23 @@ export class Guild {
|
|||||||
displayUpgradeCost: number|string;
|
displayUpgradeCost: number|string;
|
||||||
upgradeCost: number|null = null;
|
upgradeCost: number|null = null;
|
||||||
adventurerCapacity: AdventurerCapacityUpgrade;
|
adventurerCapacity: AdventurerCapacityUpgrade;
|
||||||
|
expModifier: QuestExpUpgrade;
|
||||||
|
goldModifier: QuestGoldUpgrade;
|
||||||
|
autoFinishQuestsUpgrade: AutoFinishQuestsUpgrade;
|
||||||
|
recruitmentCapacity: RecruitmentCapacityUpgrade;
|
||||||
|
|
||||||
constructor(level: number, gold: number, upgrades: {[index:string]: GuildUpgrade} = {}) {
|
constructor(level: number, gold: number, upgrades: {[index:string]: GuildUpgrade} = {}) {
|
||||||
this.gold = gold;
|
this.gold = gold;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.displayUpgradeCost = this.getUpgradeCost() ?? "Max level";
|
const rawDisplayUpgradeCost = this.getUpgradeCost();
|
||||||
|
this.displayUpgradeCost = rawDisplayUpgradeCost ? formatGold(rawDisplayUpgradeCost) : "Max level";
|
||||||
this.upgradeCost = this.getUpgradeCost();
|
this.upgradeCost = this.getUpgradeCost();
|
||||||
|
|
||||||
this.adventurerCapacity = upgrades.adventurerCapacity as AdventurerCapacityUpgrade ?? new AdventurerCapacityUpgrade();
|
this.adventurerCapacity = upgrades.adventurerCapacity as AdventurerCapacityUpgrade ?? new AdventurerCapacityUpgrade();
|
||||||
|
this.expModifier = upgrades.expModifier as QuestExpUpgrade ?? new QuestExpUpgrade();
|
||||||
|
this.goldModifier = upgrades.goldModifier as QuestGoldUpgrade ?? new QuestGoldUpgrade();
|
||||||
|
this.autoFinishQuestsUpgrade = upgrades.autoFinishQuestsUpgrade as AutoFinishQuestsUpgrade ?? new AutoFinishQuestsUpgrade();
|
||||||
|
this.recruitmentCapacity = upgrades.recruitmentCapacity as RecruitmentCapacityUpgrade ?? new RecruitmentCapacityUpgrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrade(): void {
|
upgrade(): void {
|
||||||
@@ -24,13 +39,13 @@ export class Guild {
|
|||||||
if (this.gold < cost) return;
|
if (this.gold < cost) return;
|
||||||
this.gold -= cost;
|
this.gold -= cost;
|
||||||
this.level += 1;
|
this.level += 1;
|
||||||
if (this.level >= 7) {
|
if (this.level >= MAX_LEVEL) {
|
||||||
this.displayUpgradeCost = "Max level";
|
this.displayUpgradeCost = "Max level";
|
||||||
this.upgradeCost = null;
|
this.upgradeCost = null;
|
||||||
} else {
|
} else {
|
||||||
const newCost = this.getUpgradeCost();
|
const newCost = this.getUpgradeCost();
|
||||||
if (newCost === null) return;
|
if (newCost === null) return;
|
||||||
this.displayUpgradeCost = newCost;
|
this.displayUpgradeCost = formatGold(newCost);
|
||||||
this.upgradeCost = newCost;
|
this.upgradeCost = newCost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +55,7 @@ export class Guild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isMaxLevel(): boolean {
|
isMaxLevel(): boolean {
|
||||||
return this.level >= 7;
|
return this.level >= MAX_LEVEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,5 +65,6 @@ const upgradeCosts = {
|
|||||||
"3": 5000,
|
"3": 5000,
|
||||||
"4": 10000,
|
"4": 10000,
|
||||||
"5": 25000,
|
"5": 25000,
|
||||||
"6": 50000,
|
"6": 100000,
|
||||||
|
"7": 750000,
|
||||||
} as {[index:string]: number}
|
} as {[index:string]: number}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export default interface MaxLevellable {
|
||||||
|
|
||||||
|
maxLevel: number;
|
||||||
|
|
||||||
|
isMaxLevel(): boolean;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
const goldFormatter = new Intl.NumberFormat('en-US', {
|
||||||
|
maximumFractionDigits: 3,
|
||||||
|
// @ts-ignore - typescript doesn't know about this option for some godforsaken reason
|
||||||
|
notation: "compact",
|
||||||
|
useGrouping: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const damageFormatter = new Intl.NumberFormat('en-US', {
|
||||||
|
maximumFractionDigits: 2,
|
||||||
|
// @ts-ignore - typescript doesn't know about this option for some godforsaken reason
|
||||||
|
notation: "compact",
|
||||||
|
});
|
||||||
|
|
||||||
|
export function formatGold(number: number | null): string {
|
||||||
|
if (number === null) return "";
|
||||||
|
return goldFormatter.format(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDamage(number: number): string {
|
||||||
|
return damageFormatter.format(number);
|
||||||
|
}
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
import type {Adventurer} from "@/classes/Adventurer";
|
|
||||||
import {QuestRank} from "@/classes/QuestRank";
|
|
||||||
|
|
||||||
export class Quest {
|
|
||||||
id: string;
|
|
||||||
rank: QuestRank;
|
|
||||||
title: string;
|
|
||||||
text: string;
|
|
||||||
adventurers: Array<Adventurer>;
|
|
||||||
progressPoints: number;
|
|
||||||
maxProgress: number;
|
|
||||||
expReward: number;
|
|
||||||
goldReward: number;
|
|
||||||
|
|
||||||
constructor(id: string, rank: QuestRank, title: string, text: string, maxProgress: number, expReward: number, goldReward: number) {
|
|
||||||
this.id = id;
|
|
||||||
this.rank = rank;
|
|
||||||
this.title = title;
|
|
||||||
this.text = text;
|
|
||||||
this.maxProgress = maxProgress;
|
|
||||||
this.expReward = expReward;
|
|
||||||
this.goldReward = goldReward;
|
|
||||||
this.progressPoints = 0;
|
|
||||||
this.adventurers = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
getPercentProgress(): number {
|
|
||||||
return Math.round(this.progressPoints / this.maxProgress * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate rewards for a quest and return it
|
|
||||||
* @param quest
|
|
||||||
*/
|
|
||||||
export function getQuestWithRewards(quest: Quest) {
|
|
||||||
|
|
||||||
let maxProgress = 1;
|
|
||||||
|
|
||||||
switch (quest.rank) {
|
|
||||||
case QuestRank.S:
|
|
||||||
// at level 30 adventurers have ~6513 dps, this will take 30 seconds on level 30
|
|
||||||
maxProgress = 195390;
|
|
||||||
break;
|
|
||||||
case QuestRank.A:
|
|
||||||
// at level 25 adventurers have ~2051 dps, this will take 15 seconds on level 25
|
|
||||||
maxProgress = 30770;
|
|
||||||
break;
|
|
||||||
case QuestRank.B:
|
|
||||||
// at level 20 adventurers have ~645 dps, this will take 15 seconds on level 20
|
|
||||||
maxProgress = 9690;
|
|
||||||
break;
|
|
||||||
case QuestRank.C:
|
|
||||||
// at level 15 adventurers have ~203 dps, this will take 15 seconds on level 15
|
|
||||||
maxProgress = 3045;
|
|
||||||
break;
|
|
||||||
case QuestRank.D:
|
|
||||||
// at level 10 adventurers have ~64 dps, this will take 15 seconds on level 10
|
|
||||||
maxProgress = 960;
|
|
||||||
break;
|
|
||||||
case QuestRank.E:
|
|
||||||
// at level 5 adventurers have ~20 dps, this will take 15 seconds on level 5
|
|
||||||
maxProgress = 300;
|
|
||||||
break;
|
|
||||||
case QuestRank.F:
|
|
||||||
// at level 1 adventurers have ~8 dps, this will take 15 seconds on level 1
|
|
||||||
maxProgress = 120;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let goldReward = Math.floor(maxProgress/6);
|
|
||||||
let expReward = Math.floor(Math.floor(maxProgress/120) - maxProgress/1000);
|
|
||||||
|
|
||||||
// add some randomness to the rewards
|
|
||||||
goldReward = Math.floor(randomNumberBetween(goldReward * 0.95, goldReward * 1.1));
|
|
||||||
expReward = Math.max(1, Math.floor(randomNumberBetween(expReward * 0.95, expReward * 1.2)));
|
|
||||||
|
|
||||||
return new Quest(quest.id, quest.rank, quest.title, quest.text, maxProgress, expReward, goldReward);
|
|
||||||
}
|
|
||||||
|
|
||||||
function randomNumberBetween(min: number, max: number) {
|
|
||||||
return Math.random() * (max - min) + min;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a random adventurer from the pool
|
||||||
|
* @param adventurerPool
|
||||||
|
* @param exceptions
|
||||||
|
* @returns {Adventurer|null} null if the pool is empty
|
||||||
|
*/
|
||||||
|
export function getNewAdventurerForHire(adventurerPool: Array<Adventurer>, exceptions: Array<Adventurer> = []): Adventurer|null {
|
||||||
|
if (adventurerPool.length <= 0) return null;
|
||||||
|
const pool = Array.from(adventurerPool);
|
||||||
|
const exceptionSet = new Set(exceptions);
|
||||||
|
pool.filter((adventurer) => !exceptionSet.has(adventurer));
|
||||||
|
const randomId = adventurerPool.length * Math.random() << 0;
|
||||||
|
return adventurerPool[randomId];
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
|
|
||||||
export class AdventurerCapacityUpgrade extends GuildUpgrade {
|
export default class AdventurerCapacityUpgrade extends GuildUpgrade {
|
||||||
constructor(level: number = 1) {
|
constructor(level: number = 1) {
|
||||||
super();
|
super();
|
||||||
this.level = level;
|
this.level = level;
|
||||||
@@ -14,8 +14,8 @@ export class AdventurerCapacityUpgrade extends GuildUpgrade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCostForLevel(level: number): number {
|
getCostForLevel(level: number): number {
|
||||||
const scalingFactor = Math.pow(1.25, level - 1);
|
if (level === 1) return 1500;
|
||||||
return Math.floor(1500 * scalingFactor * Math.pow(level, 1.25));
|
return Math.floor(1500 * (level * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
|
import type MaxLevellable from "@/classes/MaxLevellable";
|
||||||
|
import {QuestRank} from "@/classes/QuestRank";
|
||||||
|
|
||||||
|
export default class AutoFinishQuestsUpgrade extends GuildUpgrade implements MaxLevellable {
|
||||||
|
|
||||||
|
maxLevel: number;
|
||||||
|
|
||||||
|
constructor(level: number = 1) {
|
||||||
|
super();
|
||||||
|
this.level = level;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
this.guildLevelRequirement = 7;
|
||||||
|
this.maxLevel = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
upgrade(): void {
|
||||||
|
this.level += 1;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCostForLevel(level: number): number {
|
||||||
|
switch (level) {
|
||||||
|
case 1:
|
||||||
|
return 25000;
|
||||||
|
case 2:
|
||||||
|
return 50000;
|
||||||
|
case 3:
|
||||||
|
return 75000;
|
||||||
|
case 4:
|
||||||
|
return 150000;
|
||||||
|
case 5:
|
||||||
|
return 275000;
|
||||||
|
case 6:
|
||||||
|
return 750000;
|
||||||
|
case 7:
|
||||||
|
return 1500000;
|
||||||
|
case 8:
|
||||||
|
return 2500000;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isMaxLevel(): boolean {
|
||||||
|
return this.level >= this.maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRanksToAutoFinishQuestsIn(): Array<QuestRank> {
|
||||||
|
switch (this.level) {
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
case 2:
|
||||||
|
return [QuestRank.F];
|
||||||
|
case 3:
|
||||||
|
return [QuestRank.F, QuestRank.E];
|
||||||
|
case 4:
|
||||||
|
return [QuestRank.F, QuestRank.E, QuestRank.D];
|
||||||
|
case 5:
|
||||||
|
return [QuestRank.F, QuestRank.E, QuestRank.D, QuestRank.C];
|
||||||
|
case 6:
|
||||||
|
return [QuestRank.F, QuestRank.E, QuestRank.D, QuestRank.C, QuestRank.B];
|
||||||
|
case 7:
|
||||||
|
return [QuestRank.F, QuestRank.E, QuestRank.D, QuestRank.C, QuestRank.B, QuestRank.A];
|
||||||
|
case 8:
|
||||||
|
return [QuestRank.F, QuestRank.E, QuestRank.D, QuestRank.C, QuestRank.B, QuestRank.A, QuestRank.S];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
|
|
||||||
|
export default class QuestExpUpgrade extends GuildUpgrade {
|
||||||
|
constructor(level: number = 1) {
|
||||||
|
super();
|
||||||
|
this.level = level;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
this.guildLevelRequirement = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
upgrade(): void {
|
||||||
|
this.level += 1;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCostForLevel(level: number): number {
|
||||||
|
if (level === 1) return 1000000;
|
||||||
|
return Math.floor(1000000 * (level * 1.05));
|
||||||
|
}
|
||||||
|
|
||||||
|
getModifier(): number {
|
||||||
|
return 1 + (this.level * 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
|
|
||||||
|
export default class QuestGoldUpgrade extends GuildUpgrade {
|
||||||
|
constructor(level: number = 1) {
|
||||||
|
super();
|
||||||
|
this.level = level;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
this.guildLevelRequirement = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
upgrade(): void {
|
||||||
|
this.level += 1;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCostForLevel(level: number): number {
|
||||||
|
if (level === 1) return 1000000;
|
||||||
|
return Math.floor(1000000 * (level * 1.05));
|
||||||
|
}
|
||||||
|
|
||||||
|
getModifier(): number {
|
||||||
|
return 1 + (this.level * 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import {GuildUpgrade} from "@/classes/GuildUpgrade";
|
||||||
|
import type MaxLevellable from "@/classes/MaxLevellable";
|
||||||
|
|
||||||
|
export default class AdventurerCapacityUpgrade extends GuildUpgrade implements MaxLevellable {
|
||||||
|
|
||||||
|
maxLevel: number;
|
||||||
|
|
||||||
|
constructor(level: number = 1) {
|
||||||
|
super();
|
||||||
|
this.level = level;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
this.guildLevelRequirement = 3;
|
||||||
|
this.maxLevel = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
upgrade(): void {
|
||||||
|
this.level += 1;
|
||||||
|
this.nextLevelCost = this.getCostForLevel(this.level);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCostForLevel(level: number): number {
|
||||||
|
if (level === 1) return 1500;
|
||||||
|
return Math.floor(1500 * (level * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of adventurers the guild can have
|
||||||
|
*/
|
||||||
|
getRecruitmentCapacity(): number {
|
||||||
|
return this.level ;
|
||||||
|
}
|
||||||
|
|
||||||
|
isMaxLevel(): boolean {
|
||||||
|
return this.level >= this.maxLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
|
import {QuestRank} from "@/classes/QuestRank";
|
||||||
|
import QuestPhase from "@/classes/quests/QuestPhase";
|
||||||
|
|
||||||
|
export class Quest {
|
||||||
|
id: string;
|
||||||
|
rank: QuestRank;
|
||||||
|
title: string;
|
||||||
|
text: string;
|
||||||
|
adventurers: Array<Adventurer>;
|
||||||
|
phases: QuestPhase[] = [];
|
||||||
|
maxAdventurers: number;
|
||||||
|
expReward: number;
|
||||||
|
goldReward: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
id: string,
|
||||||
|
rank: QuestRank,
|
||||||
|
title: string,
|
||||||
|
text: string,
|
||||||
|
phases: QuestPhase[],
|
||||||
|
expReward: number = 0,
|
||||||
|
goldReward: number = 0,
|
||||||
|
maxAdventurers: number = 1
|
||||||
|
) {
|
||||||
|
this.id = id;
|
||||||
|
this.rank = rank;
|
||||||
|
this.title = title;
|
||||||
|
this.text = text;
|
||||||
|
this.expReward = expReward;
|
||||||
|
this.goldReward = goldReward;
|
||||||
|
this.adventurers = [];
|
||||||
|
this.maxAdventurers = maxAdventurers;
|
||||||
|
for (const phase of phases) {
|
||||||
|
this.phases.push(new QuestPhase(Array.from(phase.types), phase.maxPoints, phase.points));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getPercentProgress(): number {
|
||||||
|
let maxProgress = this.getMaxProgress();
|
||||||
|
let progressPoints = this.getProgress();
|
||||||
|
if (maxProgress === 0) return 0;
|
||||||
|
return progressPoints / maxProgress * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
isCompleted(): boolean {
|
||||||
|
for (const phase of this.phases) {
|
||||||
|
if (!phase.completed()) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMaxProgress(): number {
|
||||||
|
let maxProgress = 0;
|
||||||
|
for (const phase of this.phases) {
|
||||||
|
maxProgress += phase.maxPoints;
|
||||||
|
}
|
||||||
|
return maxProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProgress(): number {
|
||||||
|
let progressPoints = 0;
|
||||||
|
for (const phase of this.phases) {
|
||||||
|
progressPoints += phase.points;
|
||||||
|
}
|
||||||
|
return progressPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
serialize(): {[key: string]: any} {
|
||||||
|
return {
|
||||||
|
id: this.id,
|
||||||
|
rank: this.rank,
|
||||||
|
title: this.title,
|
||||||
|
text: this.text,
|
||||||
|
phases: this.phases.map(phase => phase.serialize()),
|
||||||
|
expReward: this.expReward,
|
||||||
|
goldReward: this.goldReward,
|
||||||
|
maxAdventurers: this.maxAdventurers,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static deserialize(data: {[key: string]: any}): Quest {
|
||||||
|
if (!data || typeof data !== 'object') {
|
||||||
|
throw new Error("Invalid data for Quest deserialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
const phases = (data.phases || []).map((phaseData: any) => QuestPhase.deserialize(phaseData));
|
||||||
|
|
||||||
|
return new Quest(
|
||||||
|
data.id,
|
||||||
|
data.rank,
|
||||||
|
data.title,
|
||||||
|
data.text,
|
||||||
|
phases,
|
||||||
|
data.expReward || 0,
|
||||||
|
data.goldReward || 0,
|
||||||
|
data.maxAdventurers || 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate rewards for a quest and return it
|
||||||
|
* @param quest
|
||||||
|
* @param expModifier - multiplification modifier for the exp reward
|
||||||
|
* @param goldModifier - multiplification modifier for the gold reward
|
||||||
|
*/
|
||||||
|
export function getQuestWithRewards(quest: Quest, expModifier: number = 1, goldModifier: number = 1) {
|
||||||
|
|
||||||
|
let rewardValue = 1;
|
||||||
|
|
||||||
|
switch (quest.rank) {
|
||||||
|
case QuestRank.S:
|
||||||
|
// at level 30 adventurers have ~6513 dps, this will take 30 seconds on level 30
|
||||||
|
rewardValue = 195390;
|
||||||
|
break;
|
||||||
|
case QuestRank.A:
|
||||||
|
// at level 25 adventurers have ~2051 dps, this will take 15 seconds on level 25
|
||||||
|
rewardValue = 30770;
|
||||||
|
break;
|
||||||
|
case QuestRank.B:
|
||||||
|
// at level 20 adventurers have ~645 dps, this will take 15 seconds on level 20
|
||||||
|
rewardValue = 9690;
|
||||||
|
break;
|
||||||
|
case QuestRank.C:
|
||||||
|
// at level 15 adventurers have ~203 dps, this will take 15 seconds on level 15
|
||||||
|
rewardValue = 3045;
|
||||||
|
break;
|
||||||
|
case QuestRank.D:
|
||||||
|
// at level 10 adventurers have ~64 dps, this will take 15 seconds on level 10
|
||||||
|
rewardValue = 960;
|
||||||
|
break;
|
||||||
|
case QuestRank.E:
|
||||||
|
// at level 5 adventurers have ~20 dps, this will take 15 seconds on level 5
|
||||||
|
rewardValue = 300;
|
||||||
|
break;
|
||||||
|
case QuestRank.F:
|
||||||
|
// at level 1 adventurers have ~8 dps, this will take 15 seconds on level 1
|
||||||
|
rewardValue = 120;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let goldReward = Math.floor(rewardValue/6 * goldModifier);
|
||||||
|
let expReward = Math.floor((Math.floor(rewardValue/120) - rewardValue/1000) * expModifier);
|
||||||
|
|
||||||
|
// add some randomness to the rewards
|
||||||
|
goldReward = Math.floor(randomNumberBetween(goldReward * 0.95, goldReward * 1.1));
|
||||||
|
expReward = Math.max(1, Math.floor(randomNumberBetween(expReward * 0.95, expReward * 1.2)));
|
||||||
|
|
||||||
|
return new Quest(quest.id, quest.rank, quest.title, quest.text, quest.phases, expReward, goldReward);
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomNumberBetween(min: number, max: number) {
|
||||||
|
return Math.random() * (max - min) + min;
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
|
import {PhaseType} from "@/classes/quests/QuestPhaseType";
|
||||||
|
|
||||||
|
export default class QuestPhase {
|
||||||
|
|
||||||
|
types: Set<PhaseType>;
|
||||||
|
points: number;
|
||||||
|
maxPoints: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
types: PhaseType[],
|
||||||
|
maxPoints: number,
|
||||||
|
points: number = 0,
|
||||||
|
) {
|
||||||
|
this.types = new Set<PhaseType>(types);
|
||||||
|
this.points = Math.max(0, points);
|
||||||
|
this.maxPoints = Math.max(1, maxPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get how many points should be added each tick based on adventurers on a task.
|
||||||
|
*/
|
||||||
|
getPointIncrement(adventurers: Array<Adventurer>): number {
|
||||||
|
// TODO add point multiplier based on adventurer stats
|
||||||
|
return 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
public tick(adventurers: Array<Adventurer> = []) {
|
||||||
|
if (this.completed()) return;
|
||||||
|
const pointsToAdd = this.getPointIncrement(adventurers);
|
||||||
|
this.points = Math.max(Math.min(this.points + pointsToAdd, this.maxPoints), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public completed(): boolean {
|
||||||
|
return this.points >= this.maxPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public serialize(): string {
|
||||||
|
return JSON.stringify({
|
||||||
|
types: Array.from(this.types),
|
||||||
|
points: this.points,
|
||||||
|
maxPoints: this.maxPoints,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static deserialize(data: string): QuestPhase {
|
||||||
|
const parsedData = JSON.parse(data);
|
||||||
|
|
||||||
|
if (typeof parsedData?.points !== 'number') {
|
||||||
|
throw new Error("Invalid data: 'points' must be a number.");
|
||||||
|
}
|
||||||
|
if (typeof parsedData?.maxPoints !== 'number') {
|
||||||
|
throw new Error("Invalid data: 'maxPoints' must be a number.");
|
||||||
|
}
|
||||||
|
if (!Array.isArray(parsedData?.types)) {
|
||||||
|
throw new Error("Invalid data: 'types' must be an array.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const types = parsedData.types.map((type: string) => PhaseType[type as keyof typeof PhaseType]);
|
||||||
|
return new QuestPhase(
|
||||||
|
types,
|
||||||
|
parsedData.maxPoints,
|
||||||
|
parsedData.points
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export enum PhaseType {
|
||||||
|
|
||||||
|
TRAVEL = "travel",
|
||||||
|
FIGHT = "fight",
|
||||||
|
GATHER = "gather",
|
||||||
|
PHYSICAL = "physical",
|
||||||
|
MENTAL = "mental",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,13 +18,13 @@ export default defineComponent({
|
|||||||
name: "AdventurerList",
|
name: "AdventurerList",
|
||||||
components: {AdventurerMiniComponent},
|
components: {AdventurerMiniComponent},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
currentAdventurer: null as Adventurer|null
|
currentAdventurer: null as Adventurer | null
|
||||||
}),
|
}),
|
||||||
props: {
|
props: {
|
||||||
adventurers: {
|
adventurers: {
|
||||||
type: Object as PropType<{[key: string]: Adventurer}>,
|
type: Object as PropType<Array<Adventurer>>,
|
||||||
default() {
|
default() {
|
||||||
return {} as {[key: string]: Adventurer};
|
return [] as Array<Adventurer>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -39,12 +39,13 @@ export default defineComponent({
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.slot {
|
.slot {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 5rem;
|
width: 5rem;
|
||||||
height: 5rem;
|
height: 5rem;
|
||||||
border: 2px solid #000;
|
border: 2px solid #000;
|
||||||
background-color: rgba(0,0,0, 0.2);
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|||||||