Add fights

This commit is contained in:
Aslan 2026-01-23 10:35:09 -05:00
parent a14be66890
commit b79e970b07
5 changed files with 323 additions and 0 deletions

View file

@ -1,6 +1,7 @@
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;
@ -19,9 +20,11 @@ export interface IEntity {
stealth: number;
charisma: number;
lockpicking: number;
attacks: Attack[];
}
export interface IPlayer extends IEntity {
isPlayer: true;
health: number;
}
@ -49,6 +52,120 @@ export enum NpcType {
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",
@ -70,6 +187,7 @@ export const npcBecky: INPC = {
charisma: 5,
lockpicking: 50,
type: NpcType.QUEST_GIVER,
attacks: [Attack.KICK, Attack.STOMP, Attack.SIT, Attack.RIP],
};
export const npcTato: INPC = {
@ -93,6 +211,7 @@ export const npcTato: INPC = {
charisma: 20,
lockpicking: 0,
type: NpcType.QUEST_GIVER,
attacks: [Attack.PUNCH],
};
export const npcs = [npcBecky, npcTato];