1 import { Profession } from './profession';
2 import { Stat } from './stats';
3 import { SkillDefinition, Skill } from './skills';
4 import { EquippedItemDetails } from './equipped';
8 account_type: 'session' | 'auth',
10 profession: Profession,
26 export type PlayerWithSkills = Player & {
27 skills: (SkillDefinition & Skill)[]
30 export function maxHp(constitution: number, playerLevel: number): number {
31 return Math.ceil((constitution * 1.7) + (playerLevel * 1.3));
34 export function maxVigor(constitution: number, playerLevel: number): number {
35 return Math.ceil((constitution * 3.8) + (playerLevel * 1.5));
38 export function expToLevel(level: number): number {
40 return level * 10 - 10;
47 export function totalDefence(equippedItems: EquippedItemDetails[], player: Player, accountForVigor: boolean = true): number {
48 const vigorPercent = player.vigor / maxVigor(player.constitution, player.level);
50 const totalDefence = equippedItems.reduce((acc, curr) => {
51 let defence = curr.boosts.defence ?? 0;
52 return acc += defence;
56 return Math.ceil(totalDefence * vigorPercent);
64 export type StatDisplay = {
71 export const StatDef: Map<Stat, StatDisplay> = new Map<Stat, StatDisplay>();
73 StatDef.set(Stat.strength, {
77 description: 'Affects your melee damage'
80 StatDef.set(Stat.constitution, {
81 id: Stat.constitution,
82 display: 'Constitution',
84 description: 'Affects your max HP and Vigor'
87 StatDef.set(Stat.dexterity, {
91 description: 'Affects you ability to dodge attacks double-hit'
94 StatDef.set(Stat.intelligence, {
95 id: Stat.intelligence,
96 display: 'Intelligence',
98 description: 'Affects your magical damage'