mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Temp
This commit is contained in:
parent
4f5e693c7f
commit
b7f962b22d
16 changed files with 844 additions and 212 deletions
|
|
@ -115,6 +115,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
magic: new fields.NumberField({ integer: true, initial: 0 })
|
||||
})
|
||||
}),
|
||||
companion: new ForeignDocumentUUIDField({ type: 'actor', nullable: true, initial: null }),
|
||||
rules: new fields.SchemaField({
|
||||
maxArmorMarked: new fields.SchemaField({
|
||||
value: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import BaseDataActor from './base.mjs';
|
|||
import DhLevelData from '../levelData.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import ActionField from '../fields/actionField.mjs';
|
||||
import { adjustDice, adjustRange } from '../../helpers/utils.mjs';
|
||||
|
||||
export default class DhCompanion extends BaseDataActor {
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.Sheets.Companion'];
|
||||
|
|
@ -9,7 +10,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
label: 'TYPES.Actor.companion',
|
||||
type: 'character'
|
||||
type: 'companion'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +24,8 @@ export default class DhCompanion extends BaseDataActor {
|
|||
value: new fields.NumberField({ initial: 0, integer: true }),
|
||||
bonus: new fields.NumberField({ initial: 0, integer: true }),
|
||||
max: new fields.NumberField({ initial: 3, integer: true })
|
||||
})
|
||||
}),
|
||||
hope: new fields.NumberField({ initial: 0, integer: true })
|
||||
}),
|
||||
evasion: new fields.SchemaField({
|
||||
value: new fields.NumberField({ required: true, min: 1, initial: 10, integer: true }),
|
||||
|
|
@ -31,7 +33,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
}),
|
||||
experiences: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
description: new fields.StringField({}),
|
||||
name: new fields.StringField({}),
|
||||
value: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
bonus: new fields.NumberField({ integer: true, initial: 0 })
|
||||
}),
|
||||
|
|
@ -43,7 +45,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
}
|
||||
),
|
||||
attack: new ActionField({
|
||||
base: {
|
||||
initial: {
|
||||
name: 'Attack',
|
||||
_id: foundry.utils.randomID(),
|
||||
systemPath: 'attack',
|
||||
|
|
@ -60,7 +62,11 @@ export default class DhCompanion extends BaseDataActor {
|
|||
damage: {
|
||||
parts: [
|
||||
{
|
||||
multiplier: 'flat'
|
||||
multiplier: 'flat',
|
||||
value: {
|
||||
dice: 'd6',
|
||||
multiplier: 'flat'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -74,6 +80,36 @@ export default class DhCompanion extends BaseDataActor {
|
|||
const partnerSpellcastingModifier = this.partner?.system?.spellcastingModifiers?.main;
|
||||
const spellcastingModifier = this.partner?.system?.traits?.[partnerSpellcastingModifier]?.total;
|
||||
this.attack.roll.bonus = spellcastingModifier ?? 0; // Needs to expand on which modifier it is that should be used because of multiclassing;
|
||||
|
||||
for (let levelKey in this.levelData.levelups) {
|
||||
const level = this.levelData.levelups[levelKey];
|
||||
for (let selection of level.selections) {
|
||||
switch (selection.type) {
|
||||
case 'lightInTheDark':
|
||||
this.resources.hope += selection.value;
|
||||
break;
|
||||
case 'vicious':
|
||||
if (selection.data === 'damage') {
|
||||
this.attack.damage.parts[0].value.dice = adjustDice(this.attack.damage.parts[0].value.dice);
|
||||
} else {
|
||||
this.attack.range = adjustRange(this.attack.range);
|
||||
}
|
||||
break;
|
||||
case 'resilient':
|
||||
this.resources.stress.bonus += selection.value;
|
||||
break;
|
||||
case 'aware':
|
||||
this.evasion.bonus += selection.value;
|
||||
break;
|
||||
case 'intelligent':
|
||||
Object.keys(this.experiences).forEach(key => {
|
||||
const experience = this.experiences[key];
|
||||
experience.bonus += selection.value;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
|
|
@ -92,4 +128,8 @@ export default class DhCompanion extends BaseDataActor {
|
|||
...data
|
||||
};
|
||||
}
|
||||
|
||||
_preDelete() {
|
||||
/* Null Character Companion field */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,37 @@ class DhLevelOption extends foundry.abstract.DataModel {
|
|||
}
|
||||
}
|
||||
|
||||
export const CompanionLevelOptionType = {
|
||||
lightInTheDark: {
|
||||
id: 'lightInTheDark',
|
||||
label: 'Light In The Dark'
|
||||
},
|
||||
createComfort: {
|
||||
id: 'createComfort',
|
||||
label: 'Create Comfort'
|
||||
},
|
||||
armored: {
|
||||
id: 'armored',
|
||||
label: 'Armored'
|
||||
},
|
||||
vicious: {
|
||||
id: 'vicious',
|
||||
label: 'Viscious'
|
||||
},
|
||||
resilient: {
|
||||
id: 'resilient',
|
||||
label: 'Resilient'
|
||||
},
|
||||
bonded: {
|
||||
id: 'bonded',
|
||||
label: 'Bonded'
|
||||
},
|
||||
aware: {
|
||||
id: 'aware',
|
||||
label: 'Aware'
|
||||
}
|
||||
};
|
||||
|
||||
export const LevelOptionType = {
|
||||
trait: {
|
||||
id: 'trait',
|
||||
|
|
@ -106,7 +137,8 @@ export const LevelOptionType = {
|
|||
multiclass: {
|
||||
id: 'multiclass',
|
||||
label: 'Multiclass'
|
||||
}
|
||||
},
|
||||
...CompanionLevelOptionType
|
||||
};
|
||||
|
||||
export const defaultLevelTiers = {
|
||||
|
|
@ -338,3 +370,80 @@ export const defaultLevelTiers = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const defaultCompanionTier = {
|
||||
tiers: {
|
||||
2: {
|
||||
tier: 2,
|
||||
name: 'Companion Choices',
|
||||
levels: {
|
||||
start: 2,
|
||||
end: 10
|
||||
},
|
||||
initialAchievements: {},
|
||||
availableOptions: 1,
|
||||
domainCardByLevel: 0,
|
||||
options: {
|
||||
experience: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.intelligent',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: LevelOptionType.experience.id,
|
||||
value: 1,
|
||||
amount: 2
|
||||
},
|
||||
lightInTheDark: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.lightInTheDark',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.lightInTheDark.id,
|
||||
value: 1
|
||||
},
|
||||
creatureComfort: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.creatureComfort',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.createComfort.id,
|
||||
value: 1
|
||||
},
|
||||
armored: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.armored',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.armored.id,
|
||||
value: 1
|
||||
},
|
||||
vicious: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.vicious',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.vicious.id,
|
||||
value: 1,
|
||||
amount: 1
|
||||
},
|
||||
resilient: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.resilient',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.resilient.id,
|
||||
value: 1
|
||||
},
|
||||
bonded: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.bonded',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.bonded.id,
|
||||
value: 1
|
||||
},
|
||||
aware: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.aware',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.aware.id,
|
||||
value: 2,
|
||||
amount: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
name: tier.name,
|
||||
belongingLevels: belongingLevels,
|
||||
options: Object.keys(tier.options).reduce((acc, key) => {
|
||||
acc[key] = tier.options[key].toObject();
|
||||
acc[key] = tier.options[key].toObject?.() ?? tier.options[key];
|
||||
return acc;
|
||||
}, {})
|
||||
};
|
||||
|
|
@ -98,6 +98,8 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
case 'experience':
|
||||
case 'domainCard':
|
||||
case 'subclass':
|
||||
case 'vicious':
|
||||
case 'intelligent':
|
||||
return checkbox.data.length === (checkbox.amount ?? 1);
|
||||
case 'multiclass':
|
||||
const classSelected = checkbox.data.length === 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue