aslobot-matrix/src/services/game/structures/entities.ts
2026-01-23 10:35:09 -05:00

217 lines
5.1 KiB
TypeScript

import { Location } from "./locations.js";
import { Race } from "./races.js";
import type { IInventory } from "../types.js";
import { DamageType } from "./items.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;
attacks: Attack[];
}
export interface IPlayer extends IEntity {
isPlayer: true;
health: number;
}
export interface INPC extends IEntity {
id: NPC;
type: NpcType;
}
export interface INPCData {
id: NPC;
health: number;
dead: boolean;
}
export type TFullNPC = INPC & INPCData;
export enum NPC {
BECKY = "BECKY",
TATO = "TATO",
}
export enum NpcType {
QUEST_GIVER = "QUEST_GIVER",
PASSIVE = "PASSIVE",
AGGRESIVE = "AGGRESIVE",
}
export interface IAttack {
id: Attack;
damageType: DamageType;
damageMultiplier: number;
messages: string[];
messagesDead: string[];
messagesOverpower: string[];
}
export enum Attack {
PUNCH = "PUNCH",
CUT = "CUT",
STAB = "STAB",
KICK = "KICK",
STOMP = "STOMP",
SIT = "SIT",
RIP = "RIP",
}
export const attackPunch: IAttack = {
id: Attack.PUNCH,
damageType: DamageType.PHYSICAL,
damageMultiplier: 0.5,
messages: ["ATTACKER punches DEFENDER"],
messagesDead: [
"ATTACKER punches DEFENDER to death",
"ATTACKER beats DEFENDER to death",
],
messagesOverpower: ["ATTACKER punches DEFENDER into mush"],
};
export const attackCut: IAttack = {
id: Attack.CUT,
damageType: DamageType.PHYSICAL,
damageMultiplier: 1,
messages: ["ATTACKER cuts DEFENDER"],
messagesDead: [
"ATTACKER cuts DEFENDER in half",
"ATTACKER cuts DEFENDER's head off",
"ATTACKER cuts DEFENDER, instantly killing them",
],
messagesOverpower: ["ATTACKER cuts DEFENDER in half"],
};
export const attackStab: IAttack = {
id: Attack.STAB,
damageType: DamageType.PHYSICAL,
damageMultiplier: 1.5,
messages: ["ATTACKER stabs DEFENDER"],
messagesDead: [
"ATTACKER stabs DEFENDER to death",
"ATTACKER stabs DEFENDER, instantly killing them",
],
messagesOverpower: ["ATTACKER stabs DEFENDER, instantly killing them"],
};
export const attackKick: IAttack = {
id: Attack.KICK,
damageType: DamageType.PHYSICAL,
damageMultiplier: 0.75,
messages: [
"ATTACKER kick DEFENDER",
"ATTACKER kick DEFENDER in their face",
],
messagesDead: ["ATTACKER kicks DEFENDER to death"],
messagesOverpower: ["ATTACKER kicks DEFENDER into mush"],
};
export const attackStomp: IAttack = {
id: Attack.STOMP,
damageType: DamageType.PHYSICAL,
damageMultiplier: 0.75,
messages: [
"ATTACKER stomps DEFENDER",
"ATTACKER stomps DEFENDER in their face",
],
messagesDead: ["ATTACKER stomps DEFENDER to death"],
messagesOverpower: [
"ATTACKER stomps DEFENDER into mush",
"DEFENDER explodes after ATTACKER stomps them into bloody mush",
],
};
export const attackSit: IAttack = {
id: Attack.SIT,
damageType: DamageType.PHYSICAL,
damageMultiplier: 0.65,
messages: ["ATTACKER sits on DEFENDER"],
messagesDead: ["ATTACKER sits on DEFENDER and crushes them to death"],
messagesOverpower: [
"ATTACKER sits on DEFENDER and crushes them into mush and goo",
"DEFENDER explodes after ATTACKER sits on them with their full weight",
],
};
export const attackRip: IAttack = {
id: Attack.RIP,
damageType: DamageType.PHYSICAL,
damageMultiplier: 0.3,
messages: ["ATTACKER tries to rip DEFENDER's limbs off"],
messagesDead: ["ATTACKER rips DEFENDER's head off"],
messagesOverpower: ["ATTACKER effortlessly rips DEFENDER's body in half"],
};
export const attacks = [
attackPunch,
attackCut,
attackStab,
attackKick,
attackStomp,
attackSit,
attackRip,
];
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,
attacks: [Attack.KICK, Attack.STOMP, Attack.SIT, Attack.RIP],
};
export const npcTato: INPC = {
id: NPC.TATO,
name: "Tato",
description: "A drunk troll",
race: Race.TROLL,
location: Location.HIGHMERE_TAVERN,
inventory: {
items: [],
},
experience: 500,
vitality: 25,
strength: 25,
endurance: 5,
agility: 15,
dexterity: 30,
intelligence: 5,
wisdom: 10,
stealth: 5,
charisma: 20,
lockpicking: 0,
type: NpcType.QUEST_GIVER,
attacks: [Attack.PUNCH],
};
export const npcs = [npcBecky, npcTato];