mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 04:01:06 +01:00
Fixed normal levelup
This commit is contained in:
parent
0aa08deaa3
commit
b18f072c64
14 changed files with 159 additions and 104 deletions
|
|
@ -115,7 +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 }),
|
||||
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 }),
|
||||
|
|
@ -315,4 +315,10 @@ export default class DhCharacter extends BaseDataActor {
|
|||
level: this.levelData.level.current
|
||||
};
|
||||
}
|
||||
|
||||
async _preDelete() {
|
||||
if (this.companion) {
|
||||
this.companion.updateLevel(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,23 +85,23 @@ export default class DhCompanion extends BaseDataActor {
|
|||
const level = this.levelData.levelups[levelKey];
|
||||
for (let selection of level.selections) {
|
||||
switch (selection.type) {
|
||||
case 'lightInTheDark':
|
||||
case 'hope':
|
||||
this.resources.hope += selection.value;
|
||||
break;
|
||||
case 'vicious':
|
||||
if (selection.data === 'damage') {
|
||||
if (selection.data[0] === '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':
|
||||
case 'stress':
|
||||
this.resources.stress.bonus += selection.value;
|
||||
break;
|
||||
case 'aware':
|
||||
case 'evasion':
|
||||
this.evasion.bonus += selection.value;
|
||||
break;
|
||||
case 'intelligent':
|
||||
case 'experience':
|
||||
Object.keys(this.experiences).forEach(key => {
|
||||
const experience = this.experiences[key];
|
||||
experience.bonus += selection.value;
|
||||
|
|
@ -118,6 +118,10 @@ export default class DhCompanion extends BaseDataActor {
|
|||
experience.total = experience.value + experience.bonus;
|
||||
}
|
||||
|
||||
if (this.partner) {
|
||||
this.partner.system.resources.hope.max += this.resources.hope;
|
||||
}
|
||||
|
||||
this.resources.stress.maxTotal = this.resources.stress.max + this.resources.stress.bonus;
|
||||
this.evasion.total = this.evasion.value + this.evasion.bonus;
|
||||
}
|
||||
|
|
@ -129,7 +133,9 @@ export default class DhCompanion extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
_preDelete() {
|
||||
/* Null Character Companion field */
|
||||
async _preDelete() {
|
||||
if (this.partner) {
|
||||
await this.partner.update({ 'system.companion': null });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ export default class DhLevelData extends foundry.abstract.DataModel {
|
|||
return {
|
||||
level: new fields.SchemaField({
|
||||
current: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
||||
changed: new fields.NumberField({ required: true, integer: true, initial: 1 })
|
||||
changed: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
||||
bonuses: new fields.TypedObjectField(new fields.NumberField({ integer: true, nullable: false }))
|
||||
}),
|
||||
levelups: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
|
|
|
|||
|
|
@ -59,13 +59,16 @@ class DhLevelOption extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
export const CompanionLevelOptionType = {
|
||||
lightInTheDark: {
|
||||
id: 'lightInTheDark',
|
||||
hope: {
|
||||
id: 'hope',
|
||||
label: 'Light In The Dark'
|
||||
},
|
||||
createComfort: {
|
||||
id: 'createComfort',
|
||||
label: 'Create Comfort'
|
||||
creatureComfort: {
|
||||
id: 'creatureComfort',
|
||||
label: 'Creature Comfort'
|
||||
// actions: [
|
||||
|
||||
// ],
|
||||
},
|
||||
armored: {
|
||||
id: 'armored',
|
||||
|
|
@ -390,20 +393,20 @@ export const defaultCompanionTier = {
|
|||
minCost: 1,
|
||||
type: LevelOptionType.experience.id,
|
||||
value: 1,
|
||||
amount: 2
|
||||
amount: 1
|
||||
},
|
||||
lightInTheDark: {
|
||||
hope: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.lightInTheDark',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.lightInTheDark.id,
|
||||
type: CompanionLevelOptionType.hope.id,
|
||||
value: 1
|
||||
},
|
||||
creatureComfort: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.creatureComfort',
|
||||
checkboxSelections: 1,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.createComfort.id,
|
||||
type: CompanionLevelOptionType.creatureComfort.id,
|
||||
value: 1
|
||||
},
|
||||
armored: {
|
||||
|
|
@ -421,11 +424,11 @@ export const defaultCompanionTier = {
|
|||
value: 1,
|
||||
amount: 1
|
||||
},
|
||||
resilient: {
|
||||
stress: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.resilient',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.resilient.id,
|
||||
type: LevelOptionType.stress.id,
|
||||
value: 1
|
||||
},
|
||||
bonded: {
|
||||
|
|
@ -435,11 +438,11 @@ export const defaultCompanionTier = {
|
|||
type: CompanionLevelOptionType.bonded.id,
|
||||
value: 1
|
||||
},
|
||||
aware: {
|
||||
evasion: {
|
||||
label: 'DAGGERHEART.LevelUp.Options.aware',
|
||||
checkboxSelections: 3,
|
||||
minCost: 1,
|
||||
type: CompanionLevelOptionType.aware.id,
|
||||
type: LevelOptionType.evasion.id,
|
||||
value: 2,
|
||||
amount: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
return acc;
|
||||
}, {});
|
||||
|
||||
levels[i] = DhLevelupLevel.initializeData(pcLevelData.levelups[i], tier.availableOptions, {
|
||||
levels[i] = DhLevelupLevel.initializeData(pcLevelData.levelups[i], tier.maxSelections[i], {
|
||||
...initialAchievements,
|
||||
experiences,
|
||||
domainCards
|
||||
|
|
@ -99,7 +99,6 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
|||
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