mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Stuffs
This commit is contained in:
parent
d136593968
commit
41046cdfca
13 changed files with 43 additions and 30 deletions
|
|
@ -716,7 +716,7 @@
|
||||||
"name": "Hope",
|
"name": "Hope",
|
||||||
"abbreviation": "HO"
|
"abbreviation": "HO"
|
||||||
},
|
},
|
||||||
"armorStack": {
|
"armorSlot": {
|
||||||
"name": "Armor Slot",
|
"name": "Armor Slot",
|
||||||
"abbreviation": "AS"
|
"abbreviation": "AS"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
||||||
await super.close({});
|
await super.close({});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async armorStackQuery({ actorId, damage, type }) {
|
static async armorSlotQuery({ actorId, damage, type }) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const actor = await fromUuid(actorId);
|
const actor = await fromUuid(actorId);
|
||||||
if (!actor || !actor?.isOwner) reject();
|
if (!actor || !actor?.isOwner) reject();
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
||||||
context.disableOption = this.disableOption.bind(this);
|
context.disableOption = this.disableOption.bind(this);
|
||||||
context.isNPC = this.action.actor?.isNPC;
|
context.isNPC = this.action.actor?.isNPC;
|
||||||
context.baseSaveDifficulty = this.action.actor?.baseSaveDifficulty;
|
context.baseSaveDifficulty = this.action.actor?.baseSaveDifficulty;
|
||||||
context.baseAttackBonus = this.action.actor?.system.attack?.damage.parts[0].value.bonus;
|
context.baseAttackBonus = this.action.actor?.system.attack?.roll.bonus;
|
||||||
context.hasRoll = this.action.hasRoll;
|
context.hasRoll = this.action.hasRoll;
|
||||||
|
|
||||||
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,10 @@ export const healingTypes = {
|
||||||
label: 'DAGGERHEART.CONFIG.HealingType.hope.name',
|
label: 'DAGGERHEART.CONFIG.HealingType.hope.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.HealingType.hope.abbreviation'
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.hope.abbreviation'
|
||||||
},
|
},
|
||||||
armorStack: {
|
armorSlot: {
|
||||||
id: 'armorStack',
|
id: 'armorSlot',
|
||||||
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
label: 'DAGGERHEART.CONFIG.HealingType.armorSlot.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorStack.abbreviation'
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorSlot.abbreviation'
|
||||||
},
|
},
|
||||||
fear: {
|
fear: {
|
||||||
id: 'fear',
|
id: 'fear',
|
||||||
|
|
@ -199,7 +199,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
healing: {
|
healing: {
|
||||||
applyTo: healingTypes.armorStack.id,
|
applyTo: healingTypes.armorSlot.id,
|
||||||
value: {
|
value: {
|
||||||
custom: {
|
custom: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
@ -287,7 +287,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
healing: {
|
healing: {
|
||||||
applyTo: healingTypes.armorStack.id,
|
applyTo: healingTypes.armorSlot.id,
|
||||||
value: {
|
value: {
|
||||||
custom: {
|
custom: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
@ -425,8 +425,8 @@ export const refreshTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const abilityCosts = {
|
export const abilityCosts = {
|
||||||
hp: {
|
hitPoints: {
|
||||||
id: 'hp',
|
id: 'hitPoints',
|
||||||
label: 'DAGGERHEART.CONFIG.HealingType.hitPoints.name',
|
label: 'DAGGERHEART.CONFIG.HealingType.hitPoints.name',
|
||||||
group: 'Global'
|
group: 'Global'
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -604,7 +604,7 @@ export const weaponFeatures = {
|
||||||
img: 'icons/skills/melee/hand-grip-sword-strike-orange.webp',
|
img: 'icons/skills/melee/hand-grip-sword-strike-orange.webp',
|
||||||
cost: [
|
cost: [
|
||||||
{
|
{
|
||||||
type: 'armorStack',
|
type: 'armorSlot',
|
||||||
value: 1
|
value: 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
|
|
||||||
async consume(config) {
|
async consume(config) {
|
||||||
const usefulResources = foundry.utils.deepClone(this.actor.system.resources);
|
const usefulResources = foundry.utils.deepClone(this.actor.system.resources);
|
||||||
|
|
||||||
for (var cost of config.costs) {
|
for (var cost of config.costs) {
|
||||||
if (cost.keyIsID) {
|
if (cost.keyIsID) {
|
||||||
usefulResources[cost.key] = {
|
usefulResources[cost.key] = {
|
||||||
|
|
@ -223,13 +224,10 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
keyIsID: resource.keyIsID
|
keyIsID: resource.keyIsID
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
console.log(resources)
|
||||||
await this.actor.modifyResource(resources);
|
await this.actor.modifyResource(resources);
|
||||||
if (config.uses?.enabled) {
|
if (config.uses?.enabled)
|
||||||
const newActions = foundry.utils.getProperty(this.item.system, this.systemPath).map(x => x.toObject());
|
this.update({ 'uses.value': this.uses.value + 1 });
|
||||||
newActions[this.index].uses.value++;
|
|
||||||
await this.item.update({ [`system.${this.systemPath}`]: newActions });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -563,6 +563,12 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
||||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||||
|
|
||||||
|
this.resources.armor = {
|
||||||
|
value: this.armor.system.marks.value,
|
||||||
|
max: this.armorScore,
|
||||||
|
isReversed: true
|
||||||
|
};
|
||||||
|
|
||||||
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,19 @@ export default class CostField extends fields.ArrayField {
|
||||||
}
|
}
|
||||||
|
|
||||||
static calcCosts(costs) {
|
static calcCosts(costs) {
|
||||||
|
console.log(costs, CostField.getResources.call(this, costs))
|
||||||
|
const resources = CostField.getResources.call(this, costs);
|
||||||
return costs.map(c => {
|
return costs.map(c => {
|
||||||
c.scale = c.scale ?? 1;
|
c.scale = c.scale ?? 1;
|
||||||
c.step = c.step ?? 1;
|
c.step = c.step ?? 1;
|
||||||
c.total = c.value * c.scale * c.step;
|
c.total = c.value + ((c.scale - 1) * c.step);
|
||||||
c.enabled = c.hasOwnProperty('enabled') ? c.enabled : true;
|
c.enabled = c.hasOwnProperty('enabled') ? c.enabled : true;
|
||||||
|
c.max = c.key === 'fear'
|
||||||
|
? game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear)
|
||||||
|
: resources[c.key].isReversed
|
||||||
|
? resources[c.key].max
|
||||||
|
: resources[c.key].value
|
||||||
|
if(c.scalable) c.maxStep = Math.floor(c.max / c.step);
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export class DHActionRollData extends foundry.abstract.DataModel {
|
||||||
if(!this.parent?.actor) return modifiers;
|
if(!this.parent?.actor) return modifiers;
|
||||||
switch (this.parent.actor.type) {
|
switch (this.parent.actor.type) {
|
||||||
case 'character':
|
case 'character':
|
||||||
const trait = this.useDefault || !this.trait ? this.parent.item.system.attack.roll.trait : this.trait;
|
const trait = this.useDefault || !this.trait ? (this.parent.item.system.attack.roll.trait ?? 'agility') : this.trait;
|
||||||
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id || this.type === CONFIG.DH.GENERAL.rollTypes.trait.id)
|
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id || this.type === CONFIG.DH.GENERAL.rollTypes.trait.id)
|
||||||
modifiers.push(
|
modifiers.push(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ export default class DhpActor extends Actor {
|
||||||
this.system.armor &&
|
this.system.armor &&
|
||||||
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
|
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
|
||||||
) {
|
) {
|
||||||
const armorStackResult = await this.owner.query('armorStack', {
|
const armorSlotResult = await this.owner.query('armorSlot', {
|
||||||
actorId: this.uuid,
|
actorId: this.uuid,
|
||||||
damage: hpDamage.value,
|
damage: hpDamage.value,
|
||||||
type: [...hpDamage.damageTypes]
|
type: [...hpDamage.damageTypes]
|
||||||
|
|
@ -490,11 +490,11 @@ export default class DhpActor extends Actor {
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (armorStackResult) {
|
if (armorSlotResult) {
|
||||||
const { modifiedDamage, armorSpent, stressSpent } = armorStackResult;
|
const { modifiedDamage, armorSpent, stressSpent } = armorSlotResult;
|
||||||
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
|
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
|
||||||
updates.push(
|
updates.push(
|
||||||
...(armorSpent ? [{ value: armorSpent, key: 'armorStack' }] : []),
|
...(armorSpent ? [{ value: armorSpent, key: 'armor' }] : []),
|
||||||
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
|
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -569,6 +569,7 @@ export default class DhpActor extends Actor {
|
||||||
armor: { target: this.system.armor, resources: {} },
|
armor: { target: this.system.armor, resources: {} },
|
||||||
items: {}
|
items: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
resources.forEach(r => {
|
resources.forEach(r => {
|
||||||
if (r.keyIsID) {
|
if (r.keyIsID) {
|
||||||
updates.items[r.key] = {
|
updates.items[r.key] = {
|
||||||
|
|
@ -584,7 +585,7 @@ export default class DhpActor extends Actor {
|
||||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear) + r.value
|
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear) + r.value
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'armorStack':
|
case 'armor':
|
||||||
updates.armor.resources['system.marks.value'] = Math.max(
|
updates.armor.resources['system.marks.value'] = Math.max(
|
||||||
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
|
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
|
||||||
0
|
0
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ export const registerSocketHooks = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const registerUserQueries = () => {
|
export const registerUserQueries = () => {
|
||||||
CONFIG.queries.armorStack = DamageReductionDialog.armorStackQuery;
|
CONFIG.queries.armorSlot = DamageReductionDialog.armorSlotQuery;
|
||||||
CONFIG.queries.reactionRoll = game.system.api.models.actions.actionsTypes.base.rollSaveQuery;
|
CONFIG.queries.reactionRoll = game.system.api.models.actions.actionsTypes.base.rollSaveQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
{{#each source as |cost index|}}
|
{{#each source as |cost index|}}
|
||||||
<div class="nest-inputs">
|
<div class="nest-inputs">
|
||||||
{{formField ../fields.scalable label="Scalable" value=cost.scalable name=(concat "cost." index ".scalable") classes="checkbox"}}
|
{{formField ../fields.scalable label="Scalable" value=cost.scalable name=(concat "cost." index ".scalable") classes="checkbox"}}
|
||||||
{{formField ../fields.key choices=(@root.disableOption index @root.costOptions ../source) label="Resource" value=cost.key name=(concat "cost." index ".key") localize=true}}
|
{{formField ../fields.key choices=(@root.disableOption index @root.costOptions ../source) label="Resource" value=cost.key name=(concat "cost." index ".key") localize=true blank=false}}
|
||||||
{{formField ../fields.value label="Amount" value=cost.value name=(concat "cost." index ".value")}}
|
{{formField ../fields.value label="Amount" value=cost.value name=(concat "cost." index ".value")}}
|
||||||
{{formField ../fields.step label="Step" value=cost.step name=(concat "cost." index ".step") disabled=(not cost.scalable)}}
|
{{formField ../fields.step label="Step" value=cost.step name=(concat "cost." index ".step") disabled=(not cost.scalable)}}
|
||||||
<a class="btn" data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeElement" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
<a class="btn" data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeElement" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
<label>{{label}}</label>
|
<label>{{label}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if scalable}}
|
{{#if (and scalable (gt maxStep 1))}}
|
||||||
<input type="range" value="{{scale}}" min="1" max="10" step="{{step}}" name="costs.{{index}}.scale">
|
<input type="range" value="{{scale}}" min="1" max="{{maxStep}}" step="1" name="costs.{{index}}.scale">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<label class="modifier-label">{{total}}/10</label>
|
<label class="modifier-label">{{total}}/{{max}}</label>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue