foundry-vtt-system-midgard5/source/module/M5Base.ts

237 lines
4.5 KiB
TypeScript

import { BooleanField } from '@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/data/fields.mjs';
export interface M5Skill {
fw: number;
attribute: string;
pp: number;
}
export interface M5SkillUnlearned extends M5Skill {
initial: number;
}
export interface M5SkillLearned extends M5Skill {
skill: string;
type: string;
}
export interface M5SkillCalculated extends M5Skill {
label: string;
calc: any;
}
export interface M5Attribute {
value: number;
bonus: number;
}
export interface M5RollData {
c: any;
i: any;
iType: string;
rolls: {};
res: {
label: string;
};
}
export interface M5RollTemplate {
formula: string;
label: string;
enabled: boolean;
}
export interface M5RollResult extends M5RollTemplate {
total: number;
totalStr: string;
result: string;
dice: {};
css: string;
}
export enum M5ItemType {
SKILL = 'skill',
ITEM = 'item',
WEAPON = 'weapon',
DEFENSIVE_WEAPON = 'defensiveWeapon',
ARMOR = 'armor',
CONTAINER = 'container',
SPELL = 'spell',
KAMPFKUNST = 'kampfkunst',
EFFECT = 'effect',
}
export enum M5SkillType {
INNATE = 'innate',
GENERAL = 'general',
LANGUAGE = 'language',
COMBAT = 'combat',
}
export enum M5EwResult {
TBD = '',
FUMBLE = 'roll-ew-result-fumble',
CRITICAL = 'roll-ew-result-critical',
HIGH = 'roll-ew-result-high',
FAIL = 'roll-ew-result-fail',
PASS = 'roll-ew-result-pass',
}
export enum M5Attributes {
ST = 'st',
GW = 'gw',
GS = 'gs',
KO = 'ko',
IN = 'in',
ZT = 'zt',
AU = 'au',
PA = 'pa',
WK = 'wk',
}
export enum M5Stats {
DEFENSE = 'defenseBonus',
ATTACK = 'attackBonus',
DAMAGE = 'damageBonus',
MOVEMENT = 'movement',
RESISTANCE_MIND = 'resistanceMind',
RESISTANCE_BODY = 'resistanceBody',
SPELL_CASTING = 'spellCasting',
BRAWL = 'brawl',
POISON_RESISTANCE = 'poisonResistance',
LP = 'lp',
AP = 'ap',
PROTECTION_LP = 'lpProtection',
PROTECTION_AP = 'apProtection',
PERCEPTION = 'perception',
DRINKING = 'drinking',
HOARD = 'hoard',
HOARD_NEXT = 'hoardNext',
HOARD_MIN = 'hoardMin',
WEALTH = 'wealth',
LOAD = 'load',
HEAVY_LOAD = 'heavyLoad',
LOAD_MAX = 'loadMax',
THRUST_LOAD = 'thrustLoad',
ENCUMBRANCE = 'encumbrance',
}
export enum M5ModType {
ATTRIBUTE = 'attribute',
STAT = 'stat',
SKILL = 'skill',
}
export enum M5ModOperation {
ADD_100 = 'add100',
ROLL = 'roll',
ADD = 'add',
SET = 'set',
FIXED = 'fixed',
MULTIPLY = 'multiply',
SUBTRACT = 'subtract',
DIVISION = 'division',
}
export enum M5TimeUnit {
ROUND = 'round',
MINUTE = 'minute',
HOUR = 'hour',
LIMITLESS = 'limitless',
}
export interface M5ItemMod {
type: M5ModType;
id: string;
operation: M5ModOperation;
value: number;
}
export interface M5ModPair {
mod: M5ItemMod;
source: string;
}
export interface M5ModSource {
item: string;
operation: M5ModOperation;
value: number;
}
export interface M5ModResult {
mods: Array<M5ModSource>;
value: number;
}
export interface M5AttributeCalculated extends M5ModResult {
bonus: number;
}
export interface M5CharacterCalculatedData {
level: number;
attributes: {
st: M5AttributeCalculated;
gs: M5AttributeCalculated;
gw: M5AttributeCalculated;
ko: M5AttributeCalculated;
in: M5AttributeCalculated;
zt: M5AttributeCalculated;
au: M5AttributeCalculated;
pa: M5AttributeCalculated;
wk: M5AttributeCalculated;
};
stats: {
lp: M5ModResult;
ap: M5ModResult;
lpProtection: M5ModResult;
apProtection: M5ModResult;
defense: M5ModResult;
damageBonus: M5ModResult;
attackBonus: M5ModResult;
defenseBonus: M5ModResult;
movement: M5ModResult;
resistanceMind: M5ModResult;
resistanceBody: M5ModResult;
spellCasting: M5ModResult;
brawl: M5ModResult;
brawlFw: number;
poisonResistance: M5ModResult;
enduranceBonus: number;
perception: M5ModResult;
perceptionFW: number;
drinking: M5ModResult;
drinkingFW: number;
hoard: number;
hoardNext: number;
hoardMin: number;
wealth: number;
load: number;
heavyLoad: number;
loadMax: number;
thrustLoad: number;
encumbrance: number;
};
skillMods: {};
skills: {
innate: {};
general: {};
combat: {};
language: {};
custom: {};
};
gear: {
weapons: {};
defensiveWeapons: {};
armor: {};
items: {};
containers: {};
effects: {};
};
spells: {};
kampfkuenste: {};
}
export function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[] {
return Object.keys(obj).filter(k => Number.isNaN(+k)) as K[];
}