Skip to content

Commit

Permalink
Merge pull request #217 from juanferrer/master
Browse files Browse the repository at this point in the history
4.6.2
  • Loading branch information
ClipplerBlood authored Nov 28, 2024
2 parents 7466610 + 7a10418 commit e941df2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src/module/active-effects/item-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ export class DLActiveEffects {
overrideEffect('system.characteristics.size', ancestryLevel.characteristics.size, priority, true),
addEffect('system.characteristics.power', ancestryLevel.characteristics.power, priority),
addEffect('system.attributes.perception.value', ancestryLevel.characteristics.perception, priority),
addEffect('system.characteristics.speed', ancestryLevel.characteristics.speed, priority),

(ancestryLevel.level === '0' ?
overrideEffect('system.characteristics.speed', ancestryLevel.characteristics.speed, priority)
: addEffect('system.characteristics.speed', ancestryLevel.characteristics.speed, priority)),
addEffect('system.characteristics.defense', ancestryLevel.characteristics.defense, priority),
addEffect('system.characteristics.insanity.immune', ancestryLevel.characteristics.insanity.immune, priority),
addEffect('system.characteristics.corruption.immune', ancestryLevel.characteristics.corruption.immune, priority),
Expand Down
17 changes: 9 additions & 8 deletions src/module/data/item/AncestryDataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@ export default class AncestryDataModel extends foundry.abstract.DataModel {
attributeSelectTwoSetSelectedValue2: makeBoolField(true),
attributes: new foundry.data.fields.SchemaField({
strength: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(0, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
agility: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(0, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
intellect: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(0, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
will: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(0, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
Expand All @@ -65,7 +65,7 @@ export default class AncestryDataModel extends foundry.abstract.DataModel {
size: makeStringField(),
defense: makeIntField(),
perception: makeIntField(),
speed: makeIntField(10),
speed: makeIntField(),
power: makeIntField(),
insanity: new foundry.data.fields.SchemaField({
value: makeIntField(),
Expand Down Expand Up @@ -113,7 +113,7 @@ export default class AncestryDataModel extends foundry.abstract.DataModel {
}

// Move attributes and characteristics into a new level 0
if (source.attributes && source.levels?.filter(l => l.level === '0').length === 0) {
if (source.attributes && (!source.levels || source.levels?.filter(l => l.level === '0').length === 0)) {
if (!source.levels) source.levels = []

source.levels = [{
Expand All @@ -136,7 +136,7 @@ export default class AncestryDataModel extends foundry.abstract.DataModel {
}

// Update from level4 to any number of levels
if (source.level4 && !source.levels) {
if (source.level4) {
if (!source.levels) source.levels = []

source.levels = source.levels.concat([
Expand All @@ -148,10 +148,11 @@ export default class AncestryDataModel extends foundry.abstract.DataModel {
},
// option1 is not in use
// option1text is not in use, but let's add it anyways
optionsText: source.option1text,
optionsText: source.level4.option1text,
talents: source.level4.talent,
spells: source.level4.spells,
talentsSelected: source.level4.pickedTalents,
talentspick: source.level4.pickedTalents,
// picks is not in use
}
])
Expand Down
8 changes: 4 additions & 4 deletions src/module/data/item/PathDataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ export default class PathDataModel extends foundry.abstract.DataModel {
attributeSelectTwoSetSelectedValue2: makeBoolField(true),
attributes: new foundry.data.fields.SchemaField({
strength: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(1, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
agility: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(1, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
intellect: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(1, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
}),
will: new foundry.data.fields.SchemaField({
value: makeIntField(10, 20, 0),
value: makeIntField(1, 20, 0),
formula: makeStringField(),
immune: makeBoolField(),
selected: makeBoolField(),
Expand Down
7 changes: 7 additions & 0 deletions src/module/item/sheets/base-item-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,13 @@ export default class DLBaseItemSheet extends HandlebarsApplicationMixin(ItemShee
newLevel.attributes.intellect.selected = foundLevel.attributes.intellect.selected
newLevel.attributes.will.selected = foundLevel.attributes.will.selected
}

// And roll formulas
newLevel.attributes.strength.formula = foundLevel.attributes.strength.formula
newLevel.attributes.agility.formula = foundLevel.attributes.agility.formula
newLevel.attributes.intellect.formula = foundLevel.attributes.intellect.formula
newLevel.attributes.will.formula = foundLevel.attributes.will.formula

} else notFound.push(newLevel)
}

Expand Down

0 comments on commit e941df2

Please sign in to comment.