untitled-combat-game-calculations
v1.1.0
Published
A set of helper functions to unify the untitled-combat-game calculations between client-side and server-side code. Includes all re-used business logic.
Downloads
2
Readme
untitled-combat-game-calculations
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.
Exposed functions
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;