Add game
This commit is contained in:
parent
d36e98ad0b
commit
c071b286af
23 changed files with 713 additions and 11 deletions
72
src/services/game/structures/entities.ts
Normal file
72
src/services/game/structures/entities.ts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import { Location } from "./locations.js";
|
||||
import { Race } from "./races.js";
|
||||
import type { IInventory } from "../types.js";
|
||||
|
||||
export interface IEntity {
|
||||
name: string;
|
||||
description: string;
|
||||
race: Race;
|
||||
location: Location;
|
||||
inventory: IInventory;
|
||||
experience: number;
|
||||
vitality: number;
|
||||
strength: number;
|
||||
endurance: number;
|
||||
agility: number;
|
||||
dexterity: number;
|
||||
intelligence: number;
|
||||
wisdom: number;
|
||||
stealth: number;
|
||||
charisma: number;
|
||||
lockpicking: number;
|
||||
}
|
||||
|
||||
export interface IPlayer extends IEntity {
|
||||
health: number;
|
||||
}
|
||||
|
||||
export interface INPC extends IEntity {
|
||||
id: NPC;
|
||||
type: NpcType;
|
||||
}
|
||||
|
||||
export interface INPCData {
|
||||
id: NPC;
|
||||
health: number;
|
||||
dead: boolean;
|
||||
}
|
||||
|
||||
export enum NPC {
|
||||
BECKY = "BECKY",
|
||||
}
|
||||
|
||||
export enum NpcType {
|
||||
QUEST_GIVER = "QUEST_GIVER",
|
||||
PASSIVE = "PASSIVE",
|
||||
AGGRESIVE = "AGGRESIVE",
|
||||
}
|
||||
|
||||
export const npcBecky: INPC = {
|
||||
id: NPC.BECKY,
|
||||
name: "Becky",
|
||||
description: "A 50 meter tall giantess. Might be a bad idea to attack",
|
||||
race: Race.GIANT,
|
||||
location: Location.NIGHTROOT_FOREST,
|
||||
inventory: {
|
||||
items: [],
|
||||
},
|
||||
experience: 10000,
|
||||
vitality: 250,
|
||||
strength: 250,
|
||||
endurance: 50,
|
||||
agility: 5,
|
||||
dexterity: 10,
|
||||
intelligence: 20,
|
||||
wisdom: 30,
|
||||
stealth: 0,
|
||||
charisma: 5,
|
||||
lockpicking: 50,
|
||||
type: NpcType.QUEST_GIVER,
|
||||
};
|
||||
|
||||
export const npcs = [npcBecky];
|
||||
59
src/services/game/structures/items.ts
Normal file
59
src/services/game/structures/items.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { Rarity } from "./rarities.js";
|
||||
|
||||
export interface IItem {
|
||||
baseName: string;
|
||||
description: string;
|
||||
value: number;
|
||||
durability: number;
|
||||
type: ItemType;
|
||||
rarity: Rarity;
|
||||
stats: IStat[];
|
||||
}
|
||||
|
||||
export interface IStat {
|
||||
abilityType?: Ability;
|
||||
damageType?: DamageType;
|
||||
damage: number;
|
||||
defense: number;
|
||||
}
|
||||
|
||||
export enum ItemType {
|
||||
ITEM = "ITEM",
|
||||
CURRENCY = "CURRENCY",
|
||||
WEAPON_1H = "WEAPON_1H",
|
||||
WEAPON_2H = "WEAPON_2H",
|
||||
SHIELD = "SHIELD",
|
||||
CHEST = "CHEST",
|
||||
LEGS = "LEGS",
|
||||
HEAD = "HEAD",
|
||||
BOOTS = "BOOTS",
|
||||
}
|
||||
|
||||
export enum DamageType {
|
||||
PHYSICAL = "PHYSICAL",
|
||||
ELEMENTAL = "ELEMENTAL",
|
||||
ARCANE = "ARCANE",
|
||||
PSYCHIC = "PSYCHIC",
|
||||
POISON = "POISON",
|
||||
RADIATION = "RADIATION",
|
||||
}
|
||||
|
||||
export enum Ability {
|
||||
TELEPORT = "TELEPORT",
|
||||
}
|
||||
|
||||
export const itemShortsword: IItem = {
|
||||
baseName: "Shortsword",
|
||||
description: "A common sword",
|
||||
value: 10,
|
||||
durability: 100,
|
||||
type: ItemType.WEAPON_1H,
|
||||
rarity: Rarity.COMMON,
|
||||
stats: [
|
||||
{
|
||||
damageType: DamageType.PHYSICAL,
|
||||
damage: 10,
|
||||
defense: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
97
src/services/game/structures/locations.ts
Normal file
97
src/services/game/structures/locations.ts
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
export interface ILocation {
|
||||
id: Location;
|
||||
name: string;
|
||||
description: string;
|
||||
X: number;
|
||||
Y: number;
|
||||
childLocations: Location[];
|
||||
}
|
||||
|
||||
export interface ILocationData {
|
||||
id: Location;
|
||||
destroyed: boolean;
|
||||
}
|
||||
|
||||
export enum Location {
|
||||
UNIVERSE = "UNIVERSE",
|
||||
SOL = "SOL",
|
||||
EARTH = "EARTH",
|
||||
FARLANDS = "FARLANDS",
|
||||
HIGHMERE = "HIGHMERE",
|
||||
HIGHMERE_TAVERN = "HIGHMERE_TAVERN",
|
||||
NIGHTROOT_FOREST = "NIGHTROOT_FOREST",
|
||||
}
|
||||
|
||||
export const locationUniverse: ILocation = {
|
||||
id: Location.UNIVERSE,
|
||||
name: "Universe",
|
||||
description: "Everything",
|
||||
X: 0,
|
||||
Y: 0,
|
||||
childLocations: [Location.SOL],
|
||||
};
|
||||
|
||||
export const locationSol: ILocation = {
|
||||
id: Location.SOL,
|
||||
name: "Sol",
|
||||
description: "Home system",
|
||||
X: 0,
|
||||
Y: 0,
|
||||
childLocations: [Location.EARTH],
|
||||
};
|
||||
|
||||
export const locationEarth: ILocation = {
|
||||
id: Location.EARTH,
|
||||
name: "Earth",
|
||||
description: "Home planet",
|
||||
X: 0,
|
||||
Y: 0,
|
||||
childLocations: [Location.FARLANDS],
|
||||
};
|
||||
|
||||
export const locationFarlands: ILocation = {
|
||||
id: Location.FARLANDS,
|
||||
name: "Farlands",
|
||||
description: "Large plains",
|
||||
X: 0,
|
||||
Y: 0,
|
||||
childLocations: [Location.HIGHMERE, Location.NIGHTROOT_FOREST],
|
||||
};
|
||||
|
||||
export const locationHighmere: ILocation = {
|
||||
id: Location.HIGHMERE,
|
||||
name: "Highmere",
|
||||
description: "A large capital city of Farlands",
|
||||
X: 5,
|
||||
Y: 5,
|
||||
childLocations: [Location.HIGHMERE_TAVERN],
|
||||
};
|
||||
|
||||
export const locationHighmereTavern: ILocation = {
|
||||
id: Location.HIGHMERE_TAVERN,
|
||||
name: "Highmere Tavern",
|
||||
description: "",
|
||||
X: 0.3,
|
||||
Y: 0.5,
|
||||
childLocations: [],
|
||||
};
|
||||
|
||||
export const locationNightrootForest: ILocation = {
|
||||
id: Location.NIGHTROOT_FOREST,
|
||||
name: "Nightroot Forest",
|
||||
description:
|
||||
"Forest full of tall trees through which barely any light shines",
|
||||
X: 3,
|
||||
Y: 6,
|
||||
childLocations: [],
|
||||
};
|
||||
|
||||
export const locations = [
|
||||
locationUniverse,
|
||||
locationSol,
|
||||
locationEarth,
|
||||
locationFarlands,
|
||||
locationHighmere,
|
||||
locationHighmereTavern,
|
||||
locationNightrootForest,
|
||||
];
|
||||
10
src/services/game/structures/quests.ts
Normal file
10
src/services/game/structures/quests.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export interface IQuest {
|
||||
name: string;
|
||||
description: string;
|
||||
type: QuestType;
|
||||
}
|
||||
|
||||
export enum QuestType {
|
||||
FETCH = "FETCH",
|
||||
KILL = "KILL",
|
||||
}
|
||||
31
src/services/game/structures/races.ts
Normal file
31
src/services/game/structures/races.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
export interface IRace {
|
||||
id: Race;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export enum Race {
|
||||
HUMAN = "HUMAN",
|
||||
GIANT = "GIANT",
|
||||
ELF = "ELF",
|
||||
}
|
||||
|
||||
export const raceHuman: IRace = {
|
||||
id: Race.HUMAN,
|
||||
name: "Human",
|
||||
description: "Just a normal human",
|
||||
};
|
||||
|
||||
export const raceGiant: IRace = {
|
||||
id: Race.GIANT,
|
||||
name: "Giant",
|
||||
description: "Basically a human, but of an extreme size and strength",
|
||||
};
|
||||
|
||||
export const raceElf: IRace = {
|
||||
id: Race.ELF,
|
||||
name: "Elf",
|
||||
description: "A weird creature with pointy ears",
|
||||
};
|
||||
|
||||
export const races = [raceHuman, raceGiant, raceElf];
|
||||
52
src/services/game/structures/rarities.ts
Normal file
52
src/services/game/structures/rarities.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
export interface IRarity {
|
||||
id: Rarity;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export enum Rarity {
|
||||
COMMON = "COMMON",
|
||||
UNCOMMON = "UNCOMMON",
|
||||
RARE = "RARE",
|
||||
VERY_RARE = "VERY_RARE",
|
||||
LEGENDARY = "LEGENDARY",
|
||||
MAGICAL = "MAGICAL",
|
||||
}
|
||||
|
||||
export const rarityCommon: IRarity = {
|
||||
id: Rarity.COMMON,
|
||||
name: "Common",
|
||||
};
|
||||
|
||||
export const rarityUncommon: IRarity = {
|
||||
id: Rarity.UNCOMMON,
|
||||
name: "Uncommon",
|
||||
};
|
||||
|
||||
export const rarityRare: IRarity = {
|
||||
id: Rarity.RARE,
|
||||
name: "Rare",
|
||||
};
|
||||
|
||||
export const rarityVeryRare: IRarity = {
|
||||
id: Rarity.VERY_RARE,
|
||||
name: "Very Rare",
|
||||
};
|
||||
|
||||
export const rarityLegendary: IRarity = {
|
||||
id: Rarity.LEGENDARY,
|
||||
name: "Legendary",
|
||||
};
|
||||
|
||||
export const rarityMagical: IRarity = {
|
||||
id: Rarity.MAGICAL,
|
||||
name: "Magical",
|
||||
};
|
||||
|
||||
export const rarities = [
|
||||
rarityCommon,
|
||||
rarityUncommon,
|
||||
rarityRare,
|
||||
rarityVeryRare,
|
||||
rarityLegendary,
|
||||
rarityMagical,
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue