diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js b/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js
index d9e2827f..93bf413c 100644
--- a/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js
+++ b/app/imports/api/engine/actions/applyPropertyByType/applyBuff.js
@@ -13,6 +13,7 @@ import logErrors from './shared/logErrors.js';
import { insertCreatureLog } from '/imports/api/creature/log/CreatureLogs.js';
import cyrb53 from '/imports/api/engine/computation/utility/cyrb53.js';
import { applyNodeTriggers } from '/imports/api/engine/actions/applyTriggers.js';
+import INLINE_CALCULATION_REGEX from '/imports/constants/INLINE_CALCULTION_REGEX.js';
export default function applyBuff(node, actionContext){
applyNodeTriggers(node, 'before', actionContext);
@@ -32,7 +33,9 @@ export default function applyBuff(node, actionContext){
});
}
addChildrenToPropList(node.children);
- crystalizeVariables({propList, actionContext});
+ if (!prop.skipCrystalization) {
+ crystalizeVariables({propList, actionContext});
+ }
let oldParent = {
id: prop.parent.id,
@@ -96,6 +99,7 @@ function crystalizeVariables({propList, actionContext}){
delete prop._skipCrystalize;
return;
}
+ // Iterate through all the calculations and crystalize them
computedSchemas[prop.type].computedFields().forEach( calcKey => {
applyFnToKey(prop, calcKey, (prop, key) => {
const calcObj = get(prop, key);
@@ -132,5 +136,36 @@ function crystalizeVariables({propList, actionContext}){
calcObj.hash = cyrb53(calcObj.calculation);
});
});
+ // For each key in the schema
+ computedSchemas[prop.type].inlineCalculationFields().forEach( calcKey => {
+ // That ends in .inlineCalculations
+ applyFnToKey(prop, calcKey, (prop, key) => {
+ const inlineCalcObj = get(prop, key);
+ if (!inlineCalcObj) return;
+
+ // If there is no text, skip
+ if (!inlineCalcObj.text){
+ return;
+ }
+
+ // Replace all the existing calculations
+ let index = -1;
+ inlineCalcObj.text = inlineCalcObj.text.replace(INLINE_CALCULATION_REGEX, () => {
+ index += 1;
+ return `{${inlineCalcObj.inlineCalculations[index].calculation}}`;
+ });
+
+ // Set the value to the uncomputed string
+ inlineCalcObj.value = inlineCalcObj.text;
+
+ // Write a new hash
+ const inlineCalcHash = cyrb53(inlineCalcObj.text);
+ if (inlineCalcHash === inlineCalcObj.hash) {
+ // Skip if nothing changed
+ return;
+ }
+ inlineCalcObj.hash = inlineCalcHash;
+ });
+ });
});
}
diff --git a/app/imports/api/properties/Buffs.js b/app/imports/api/properties/Buffs.js
index ad993bb7..2e15d441 100644
--- a/app/imports/api/properties/Buffs.js
+++ b/app/imports/api/properties/Buffs.js
@@ -31,6 +31,11 @@ let BuffSchema = createPropertySchema({
},
// Prevent the property from showing up in the log
silent: {
+ type: Boolean,
+ optional: true,
+ },
+ // Prevent the children from being crystalized
+ skipCrystalization: {
type: Boolean,
optional: true,
},
diff --git a/app/imports/ui/properties/forms/BuffForm.vue b/app/imports/ui/properties/forms/BuffForm.vue
index e8848bed..a7c3b0dd 100644
--- a/app/imports/ui/properties/forms/BuffForm.vue
+++ b/app/imports/ui/properties/forms/BuffForm.vue
@@ -72,6 +72,18 @@
@change="change('silent', ...arguments)"
/>
+
+
+