Compare commits

...

2 commits

Author SHA1 Message Date
WBHarry
7943477faa Added select and autocomplete 2026-02-26 22:47:36 +01:00
WBHarry
eea1b6e6b8 Added to compendium 2026-02-26 21:05:38 +01:00
8 changed files with 219 additions and 61 deletions

View file

@ -192,6 +192,10 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
...conditional,
...game.system.api.data.activeEffects.EffectConditional.getConditionalFieldUseage(conditional.type)
}));
partContext.statusChoices = Object.values(CONFIG.statusEffects).map(x => ({
id: x.id,
label: x.name
}));
break;
case 'changes':
const fields = this.document.system.schema.fields.changes.element.fields;
@ -267,6 +271,19 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
event.target.name.endsWith('type')
) {
const container = event.target.closest('.conditional-container');
const statusSelect = container.querySelector('.form-group.status-select');
const attributeAuto = container.querySelector('.form-group.attribute-auto');
if (event.target.value === CONFIG.DH.GENERAL.activeEffectConditionalType.status.id) {
statusSelect.classList.remove('not-visible');
attributeAuto.classList.add('not-visible');
} else {
statusSelect.classList.add('not-visible');
attributeAuto.classList.remove('not-visible');
}
statusSelect.querySelector('select').selectedIndex = '-1';
attributeAuto.querySelector('input').value = '';
const { usesValue, usesComparator } =
game.system.api.data.activeEffects.EffectConditional.getConditionalFieldUseage(event.target.value);

View file

@ -21,12 +21,14 @@ export class EffectConditionals extends foundry.data.fields.ArrayField {
x => !x.disabled && x.statuses.has(conditional.key)
);
if (!hasStatus) return true;
break;
case CONFIG.DH.GENERAL.activeEffectConditionalType.attribute.id:
const actorValue = foundry.utils.getProperty(actor, conditional.key);
const conditionalValue = game.system.api.documents.DhActiveEffect.effectSafeEval(
itemAbleRollParse(conditional.value, actor)
);
if (!compareValues(actorValue, conditionalValue, conditional.comparator)) return true;
break;
}
}

View file

@ -8,6 +8,9 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/**@override */
get isSuppressed() {
const conditionalSuspended = game.system.api.data.activeEffects.EffectConditionals.isConditionalSuspended(this);
if (conditionalSuspended) return true;
// If this is a copied effect from an attachment, never suppress it
// (These effects have attachmentSource metadata)
if (this.flags?.daggerheart?.attachmentSource) {
@ -26,9 +29,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
return isVaultSupressed || domainTouchedSupressed;
}
const conditionalSuspended = game.system.api.data.activeEffects.EffectConditionals.isConditionalSuspended(this);
if (conditionalSuspended) return true;
return super.isSuppressed;
}

View file

@ -28,27 +28,36 @@
"type": "withinRange",
"target": "hostile",
"range": "melee"
}
},
"_id": "UJTsJlnhi5Zi0XQ2",
"img": "systems/daggerheart/assets/icons/domains/domain-card/bone.png",
"changes": [
{
"key": "system.rules.damageReduction.thresholdImmunities.minor",
"mode": 5,
"value": "1",
"priority": null
"value": 1,
"priority": null,
"type": "override"
}
],
"disabled": true,
"duration": {
"startTime": null,
"combat": null,
"seconds": null,
"rounds": null,
"turns": null,
"startRound": null,
"startTurn": null
"type": ""
},
"conditionals": [
{
"type": "attribute",
"key": "system.resources.hitPoints.value",
"value": "@system.resources.hitPoints.max - 2",
"comparator": "gte",
"target": "self"
}
]
},
"_id": "UJTsJlnhi5Zi0XQ2",
"img": "systems/daggerheart/assets/icons/domains/domain-card/bone.png",
"disabled": false,
"duration": {
"value": null,
"units": "seconds",
"expiry": null,
"expired": false
},
"description": "<p class=\"Body\">When you have 2 or fewer Hit Points unmarked, you dont take Minor damage.</p>",
"origin": null,
@ -60,6 +69,16 @@
"_stats": {
"compendiumSource": null
},
"start": {
"time": 0,
"combat": null,
"combatant": null,
"initiative": null,
"round": null,
"turn": null
},
"showIcon": 1,
"folder": null,
"_key": "!items.effects!zbxPl81kbWEegKQN.UJTsJlnhi5Zi0XQ2"
}
],

View file

@ -30,31 +30,40 @@
"type": "withinRange",
"target": "hostile",
"range": "melee"
}
},
"changes": [
{
"key": "system.bonuses.damage.physical.bonus",
"mode": 2,
"value": "@system.levelData.level.current",
"priority": null
"priority": null,
"type": "add"
},
{
"key": "system.bonuses.damage.magical.bonus",
"mode": 2,
"value": "@system.levelData.level.current",
"priority": null
"priority": null,
"type": "add"
}
],
"disabled": true,
"duration": {
"startTime": null,
"combat": null,
"seconds": null,
"rounds": null,
"turns": null,
"startRound": null,
"startTurn": null
"type": ""
},
"conditionals": [
{
"type": "status",
"key": "vulnerable",
"value": "",
"comparator": "eq",
"target": "self"
}
]
},
"disabled": false,
"duration": {
"value": null,
"units": "seconds",
"expiry": null,
"expired": false
},
"description": "<p>While you're Vulnerable, add your level to your damage rolls.</p>",
"tint": "#ffffff",
@ -64,6 +73,16 @@
"_stats": {
"compendiumSource": null
},
"start": {
"time": 0,
"combat": null,
"combatant": null,
"initiative": null,
"round": null,
"turn": null
},
"showIcon": 1,
"folder": null,
"_key": "!items.effects!uByM34yQlw38yf1V.HMx9uZ54mvMiH95x"
}
],

View file

@ -26,27 +26,36 @@
"type": "withinRange",
"target": "hostile",
"range": "melee"
}
},
"_id": "0i7GVOvjH6bK5AUM",
"img": "icons/magic/defensive/barrier-shield-dome-blue-purple.webp",
"changes": [
{
"key": "system.evasion",
"mode": 2,
"value": "@system.proficiency",
"priority": 21
"priority": 21,
"type": "add"
}
],
"duration": {
"type": ""
},
"conditionals": [
{
"type": "attribute",
"key": "system.resources.hope.value",
"value": "2",
"comparator": "gte",
"target": "self"
}
]
},
"_id": "0i7GVOvjH6bK5AUM",
"img": "icons/magic/defensive/barrier-shield-dome-blue-purple.webp",
"disabled": false,
"duration": {
"startTime": null,
"combat": null,
"seconds": null,
"rounds": null,
"turns": null,
"startRound": null,
"startTurn": null
"value": null,
"units": "seconds",
"expiry": null,
"expired": false
},
"description": "<p>While you have at least 2 Hope, you add your Proficiency to your Evasion.</p>",
"origin": null,
@ -58,6 +67,16 @@
"_stats": {
"compendiumSource": null
},
"start": {
"time": 0,
"combat": null,
"combatant": null,
"initiative": null,
"round": null,
"turn": null
},
"showIcon": 1,
"folder": null,
"_key": "!items.effects!oirsCnN66GOlK3Fa.0i7GVOvjH6bK5AUM"
}
],

View file

@ -16,7 +16,72 @@
"artist": ""
}
},
"effects": [],
"effects": [
{
"name": "Rise To The Challenge",
"type": "base",
"system": {
"changes": [
{
"key": "system.rules.dualityRoll.defaultHopeDice",
"type": "upgrade",
"value": 20,
"priority": null,
"phase": "initial"
}
],
"conditionals": [
{
"type": "attribute",
"key": "system.resources.hitPoints.value",
"value": "@system.resources.hitPoints.max - 2",
"comparator": "gte",
"target": "self"
}
],
"duration": {
"description": "",
"type": ""
},
"rangeDependence": {
"enabled": false,
"type": "withinRange",
"target": "hostile",
"range": "melee"
}
},
"_id": "MA744uJrGMQCDywg",
"img": "icons/magic/control/debuff-energy-hold-levitate-yellow.webp",
"disabled": false,
"start": {
"time": 0,
"combat": null,
"combatant": null,
"initiative": null,
"round": null,
"turn": null
},
"duration": {
"value": null,
"units": "seconds",
"expiry": null,
"expired": false
},
"description": "<p>While you have 2 or fewer Hit Points unmarked, you can roll a d20 as your Hope Die.</p>",
"origin": null,
"tint": "#ffffff",
"transfer": true,
"statuses": [],
"showIcon": 1,
"folder": null,
"sort": 0,
"flags": {},
"_stats": {
"compendiumSource": null
},
"_key": "!items.effects!dcutk8RVOJ2sEkO1.MA744uJrGMQCDywg"
}
],
"sort": 0,
"ownership": {
"default": 0,

View file

@ -9,7 +9,24 @@
<div class="conditional-container">
{{!-- {{formGroup ../systemFields.conditionals.element.fields.target value=conditional.target name=(concat "system.conditionals." index ".target") localize=true }} --}}
{{formGroup ../systemFields.conditionals.element.fields.type value=conditional.type name=(concat "system.conditionals." index ".type") localize=true }}
{{formGroup ../systemFields.conditionals.element.fields.key value=conditional.key name=(concat "system.conditionals." index ".key") localize=true }}
<div class="form-group status-select {{#unless (eq conditional.type 'status')}}not-visible{{/unless}}">
<label>{{localize "EFFECT.FIELDS.changes.element.key.label"}}</label>
<div class="form-fields">
<select name="{{concat "system.conditionals." index ".key"}}">
{{selectOptions ../statusChoices selected=conditional.key labelAttr="label" valueAttr="id" blank="" localize=true}}
</select>
</div>
</div>
<div class="form-group attribute-auto {{#unless (eq conditional.type 'attribute')}}not-visible{{/unless}}">
<label>{{localize "EFFECT.FIELDS.changes.element.key.label"}}</label>
<div class="form-fields">
<input type="text" class="effect-change-input" name="{{concat "system.conditionals." index ".key"}}" value="{{conditional.key}}" />
</div>
</div>
<div class="form-group value {{#unless conditional.usesValue}}not-visible{{/unless}}">
<label>{{localize "EFFECT.FIELDS.changes.element.value.label"}}</label>