Added the ability to silence most action props
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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'}`
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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({});
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -27,6 +27,11 @@ const DamageSchema = createPropertySchema({
|
||||
defaultValue: 'slashing',
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
},
|
||||
// Prevent the property from showing up in the log
|
||||
silent: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
const ComputedOnlyDamageSchema = createPropertySchema({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -141,6 +141,18 @@
|
||||
@change="change('usesUsed', ...arguments)"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<smart-select
|
||||
label="Reset"
|
||||
|
||||
@@ -59,6 +59,12 @@
|
||||
:value="model.tags"
|
||||
@change="change('tags', ...arguments)"
|
||||
/>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
<form-section
|
||||
v-if="$slots.children"
|
||||
name="Children"
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
:value="model.tags"
|
||||
@change="change('tags', ...arguments)"
|
||||
/>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
<form-section
|
||||
name="Children"
|
||||
standalone
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
</form-section>
|
||||
<form-section
|
||||
name="Advanced"
|
||||
>
|
||||
<v-row dense>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<smart-switch
|
||||
label="Hide remove button"
|
||||
@@ -53,6 +59,20 @@
|
||||
:error-messages="errors.hideRemoveButton"
|
||||
@change="change('hideRemoveButton', ...arguments)"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<smart-combobox
|
||||
label="Tags"
|
||||
multiple
|
||||
|
||||
@@ -115,6 +115,20 @@
|
||||
:value="model.tags"
|
||||
@change="change('tags', ...arguments)"
|
||||
/>
|
||||
<v-row dense>
|
||||
<v-col
|
||||
cols="12"
|
||||
sm="6"
|
||||
md="4"
|
||||
>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</form-section>
|
||||
</form-sections>
|
||||
</div>
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
:error-messages="errors.tags"
|
||||
@change="change('tags', ...arguments)"
|
||||
/>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
<form-section
|
||||
v-if="$slots.children"
|
||||
name="Children"
|
||||
|
||||
@@ -65,6 +65,12 @@
|
||||
:error-messages="errors.tags"
|
||||
@change="change('tags', ...arguments)"
|
||||
/>
|
||||
<smart-switch
|
||||
label="Don't show in log"
|
||||
:value="model.silent"
|
||||
:error-messages="errors.silent"
|
||||
@change="change('silent', ...arguments)"
|
||||
/>
|
||||
<form-section
|
||||
v-if="$slots.children"
|
||||
name="Children"
|
||||
|
||||
Reference in New Issue
Block a user