A package containing business logic shared between the client-side and server-side application for untitled-combat-game. Relies heavily on typescript for input validation where business logic is not implemented.
This is still very much a work in progres.
All of the currently exposed functions. Check character.types.d.ts for type definitions.
// calculates shield/armor combat stats
getArmorCombatStats: (armor?: ArmorType | ShieldType | undefined) => ArmorCombatStatsType;
// validates character baseStats
validateCharacterStats: (stats: CharacterStatsType) => boolean;
// calculates max character fatigue based on baseStats
calculateMaxFatigue: (data: {
baseStats: CharacterStatsType;
armor?: ArmorType | undefined;
shield?: ShieldType | undefined;
}) => number;
// calculates max character hitpoints base on baseStats
calculateMaxHitpoints: (baseStats: CharacterStatsType) => number;
// calculates max character resolve based on baseStats
calculateMaxResolve: (baseStats: CharacterStatsType) => number;
// Calculates character combat stats based on baseStats, equipped armor and shield
calculateCombatStats: (data: {
baseStats: CharacterStatsType;
armor?: ArmorType | undefined;
shield?: ShieldType | undefined;
}) => CombatStatsType;
// Calculates character skills based on baseStats, equiped shield and weapon
calculateCharacterSkills: (data: {
baseStats: CharacterStatsType;
shield?: ShieldType | undefined;
weapon?: WeaponType | undefined;
}) => SkillValuesType[];
// Calculated final character basa. Represents a entry in the characters database.
calculateCharacter: (data: {
armor?: ArmorType | undefined;
baseStats: CharacterStatsType;
description: string;
name: string;
_id: string | null;
shield?: ShieldType | undefined;
weapon?: WeaponType | undefined;
}) => CharacterType;