diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyAction.js b/app/imports/api/engine/actions/applyPropertyByType/applyAction.js index 26da462a..8d6bd185 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyAction.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyAction.js @@ -20,7 +20,7 @@ export default function applyAction(node, actionContext) { recalculateInlineCalculations(prop.summary, actionContext); content.value = prop.summary.value; } - actionContext.addLog(content); + if (!prop.silent) actionContext.addLog(content); // Spend the resources const failed = spendResources(prop, actionContext); @@ -188,7 +188,7 @@ function applyChildren(node, actionContext) { function spendResources(prop, actionContext){ // Check Uses if (prop.usesLeft <= 0){ - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Error', value: `${prop.name || 'action'} does not have enough uses left`, }); @@ -196,7 +196,7 @@ function spendResources(prop, actionContext){ } // Resources if (prop.insufficientResources){ - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Error', value: 'This creature doesn\'t have sufficient resources to perform this action', }); @@ -257,7 +257,7 @@ function spendResources(prop, actionContext){ }, { selector: prop }); - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Uses left', value: prop.usesLeft - 1, inline: true, @@ -288,12 +288,12 @@ function spendResources(prop, actionContext){ }); // Log all the spending - if (gainLog.length) actionContext.addLog({ + if (gainLog.length && !prop.silent) actionContext.addLog({ name: 'Gained', value: gainLog.join('\n'), inline: true, }); - if (spendLog.length) actionContext.addLog({ + if (spendLog.length && !prop.silent) actionContext.addLog({ name: 'Spent', value: spendLog.join('\n'), inline: true, diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyAdjustment.js b/app/imports/api/engine/actions/applyPropertyByType/applyAdjustment.js index cc63f53a..ede94665 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyAdjustment.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyAdjustment.js @@ -24,7 +24,7 @@ export default function applyAdjustment(node, actionContext){ damageTargets.forEach(target => { let stat = target.variables[prop.stat]; if (!stat?.type) { - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Error', value: `Could not apply attribute damage, creature does not have \`${prop.stat}\` set` }); @@ -36,7 +36,7 @@ export default function applyAdjustment(node, actionContext){ value, actionContext, }); - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Attribute damage', value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` + ` ${value}`, @@ -44,7 +44,7 @@ export default function applyAdjustment(node, actionContext){ }); }); } else { - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: 'Attribute damage', value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` + ` ${value}`, diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyBranch.js b/app/imports/api/engine/actions/applyPropertyByType/applyBranch.js index 3106b88b..ce918c4a 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyBranch.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyBranch.js @@ -36,25 +36,25 @@ export default function applyBranch(node, actionContext){ break; case 'hit': if (scope['$attackHit']?.value){ - if (!targets.length) actionContext.addLog({value: '**On hit**'}); + if (!targets.length && !prop.silent) actionContext.addLog({value: '**On hit**'}); applyChildren(); } break; case 'miss': if (scope['$attackMiss']?.value){ - if (!targets.length) actionContext.addLog({value: '**On miss**'}); + if (!targets.length && !prop.silent) actionContext.addLog({value: '**On miss**'}); applyChildren(); } break; case 'failedSave': if (scope['$saveFailed']?.value){ - if (!targets.length) actionContext.addLog({value: '**On failed save**'}); + if (!targets.length && !prop.silent) actionContext.addLog({value: '**On failed save**'}); applyChildren(); } break; case 'successfulSave': if (scope['$saveSucceeded']?.value){ - if (!targets.length) actionContext.addLog({value: '**On save**',}); + if (!targets.length && !prop.silent) actionContext.addLog({value: '**On save**',}); applyChildren(); } break; diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js b/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js index 965ef8b3..d9e2827f 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js @@ -43,7 +43,7 @@ export default function applyBuff(node, actionContext){ copyNodeListToTarget(propList, target, oldParent); //Log the buff - if (prop.name || prop.description?.value){ + if ((prop.name || prop.description?.value) && !prop.silent){ if (target._id === actionContext.creature._id){ // Targeting self actionContext.addLog({ diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyBuffRemover.js b/app/imports/api/engine/actions/applyPropertyByType/applyBuffRemover.js index 09e4e987..86b60949 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyBuffRemover.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyBuffRemover.js @@ -13,7 +13,7 @@ export default function applyBuffRemover(node, actionContext) { const prop = node.node; // Log Name - if (prop.name){ + if (prop.name && !prop.silent){ actionContext.addLog({ name: prop.name }); } @@ -29,7 +29,7 @@ export default function applyBuffRemover(node, actionContext) { }); return; } - removeBuff(nearestBuff, actionContext); + removeBuff(nearestBuff, actionContext, prop); } else { // Get all the buffs targeted by tags const allBuffs = getPropertiesOfType(actionContext.creature._id, 'buff'); @@ -41,7 +41,7 @@ export default function applyBuffRemover(node, actionContext) { if (prop.removeAll) { // Remove all matching buffs targetedBuffs.forEach(buff => { - removeBuff(buff, actionContext); + removeBuff(buff, actionContext, prop); }); } else { // Sort in reverse order @@ -49,7 +49,7 @@ export default function applyBuffRemover(node, actionContext) { // Remove the one with the highest order const buff = targetedBuffs[0]; if (buff) { - removeBuff(buff, actionContext); + removeBuff(buff, actionContext, prop); } } } @@ -60,8 +60,8 @@ export default function applyBuffRemover(node, actionContext) { node.children.forEach(child => applyProperty(child, actionContext)); } -function removeBuff(buff, actionContext) { - actionContext.addLog({ +function removeBuff(buff, actionContext, prop) { + if (!prop.silent) actionContext.addLog({ name: 'Removed', value: `${buff.name || 'Buff'}` }); diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyDamage.js b/app/imports/api/engine/actions/applyPropertyByType/applyDamage.js index 0ee3bbd7..540ec5cb 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyDamage.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyDamage.js @@ -128,7 +128,7 @@ export default function applyDamage(node, actionContext){ // There are no targets, just log the result logValue.push(`**${damage}** ${suffix}`); } - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: logName, value: logValue.join('\n'), inline: true, diff --git a/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js b/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js index 6064e3bd..a5aa4bae 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applySavingThrow.js @@ -20,7 +20,7 @@ export default function applySavingThrow(node, actionContext){ }); return node.children.forEach(child => applyProperty(child, actionContext)); } - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: prop.name, value: `DC **${dc}**`, inline: true, @@ -94,7 +94,7 @@ export default function applySavingThrow(node, actionContext){ } else { scope['$saveFailed'] = {value: true}; } - actionContext.addLog({ + if (!prop.silent) actionContext.addLog({ name: saveSuccess ? 'Successful save' : 'Failed save', value: resultPrefix + '\n**' + result + '**', inline: true, diff --git a/app/imports/api/properties/Actions.js b/app/imports/api/properties/Actions.js index 53e57afa..1ff4d6fd 100644 --- a/app/imports/api/properties/Actions.js +++ b/app/imports/api/properties/Actions.js @@ -114,6 +114,11 @@ let ActionSchema = createPropertySchema({ type: 'fieldToCompute', optional: true, }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); const ComputedOnlyActionSchema = createPropertySchema({ diff --git a/app/imports/api/properties/Adjustments.js b/app/imports/api/properties/Adjustments.js index 49c1b248..0d1edb6a 100644 --- a/app/imports/api/properties/Adjustments.js +++ b/app/imports/api/properties/Adjustments.js @@ -31,6 +31,11 @@ const AdjustmentSchema = createPropertySchema({ allowedValues: ['set', 'increment'], defaultValue: 'increment', }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); const ComputedOnlyAdjustmentSchema = createPropertySchema({ diff --git a/app/imports/api/properties/Branches.js b/app/imports/api/properties/Branches.js index 952c7715..386773a1 100644 --- a/app/imports/api/properties/Branches.js +++ b/app/imports/api/properties/Branches.js @@ -37,6 +37,11 @@ let BranchSchema = createPropertySchema({ optional: true, parseLevel: 'compile', }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); let ComputedOnlyBranchSchema = createPropertySchema({ diff --git a/app/imports/api/properties/BuffRemovers.js b/app/imports/api/properties/BuffRemovers.js index 8752f750..ae86bf5e 100644 --- a/app/imports/api/properties/BuffRemovers.js +++ b/app/imports/api/properties/BuffRemovers.js @@ -68,6 +68,11 @@ let BuffRemoverSchema = createPropertySchema({ type: String, max: STORAGE_LIMITS.tagLength, }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); let ComputedOnlyBuffRemoverSchema = createPropertySchema({}); diff --git a/app/imports/api/properties/Buffs.js b/app/imports/api/properties/Buffs.js index dac2d7ff..ad993bb7 100644 --- a/app/imports/api/properties/Buffs.js +++ b/app/imports/api/properties/Buffs.js @@ -29,6 +29,11 @@ let BuffSchema = createPropertySchema({ ], defaultValue: 'target', }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); let ComputedOnlyBuffSchema = createPropertySchema({ diff --git a/app/imports/api/properties/Damages.js b/app/imports/api/properties/Damages.js index 85cafee0..8f5e2a67 100644 --- a/app/imports/api/properties/Damages.js +++ b/app/imports/api/properties/Damages.js @@ -26,7 +26,12 @@ const DamageSchema = createPropertySchema({ max: STORAGE_LIMITS.calculation, defaultValue: 'slashing', regEx: VARIABLE_NAME_REGEX, - }, + }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); const ComputedOnlyDamageSchema = createPropertySchema({ diff --git a/app/imports/api/properties/SavingThrows.js b/app/imports/api/properties/SavingThrows.js index f5cfbf70..05210a53 100644 --- a/app/imports/api/properties/SavingThrows.js +++ b/app/imports/api/properties/SavingThrows.js @@ -30,6 +30,11 @@ let SavingThrowSchema = createPropertySchema({ optional: true, max: STORAGE_LIMITS.variableName, }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); const ComputedOnlySavingThrowSchema = createPropertySchema({ diff --git a/app/imports/api/properties/Triggers.js b/app/imports/api/properties/Triggers.js index 4b66e422..0bfd7d9d 100644 --- a/app/imports/api/properties/Triggers.js +++ b/app/imports/api/properties/Triggers.js @@ -109,6 +109,11 @@ let TriggerSchema = createPropertySchema({ type: String, max: STORAGE_LIMITS.tagLength, }, + // Prevent the property from showing up in the log + silent: { + type: Boolean, + optional: true, + }, }); const ComputedOnlyTriggerSchema = createPropertySchema({ diff --git a/app/imports/ui/properties/forms/ActionForm.vue b/app/imports/ui/properties/forms/ActionForm.vue index c550d75a..91bebdd2 100644 --- a/app/imports/ui/properties/forms/ActionForm.vue +++ b/app/imports/ui/properties/forms/ActionForm.vue @@ -141,6 +141,18 @@ @change="change('usesUsed', ...arguments)" /> + + + + + - + + + + + + + + + + + + + diff --git a/app/imports/ui/properties/forms/DamageForm.vue b/app/imports/ui/properties/forms/DamageForm.vue index 81bb3a10..fc8be6ee 100644 --- a/app/imports/ui/properties/forms/DamageForm.vue +++ b/app/imports/ui/properties/forms/DamageForm.vue @@ -53,6 +53,12 @@ :error-messages="errors.tags" @change="change('tags', ...arguments)" /> + +