Buffs no longer have the "applied" field, it was redundant

Because children of actions are always inactive in the new engine, buffs 
that are children of actions are inactive while buffs elsewhere on the 
character sheet are active, making it redundant to keep the extra field
This commit is contained in:
Stefan Zermatten
2021-10-18 13:46:38 +02:00
parent 7a11a4aa22
commit 417ff6e210
6 changed files with 13 additions and 98 deletions

View File

@@ -15,7 +15,6 @@ export default function applyBuff(node, {creature, targets, scope, log}){
let buffTargets = prop.target === 'self' ? [creature] : targets;
// Then copy the decendants of the buff to the targets
prop.applied = true;
let propList = [prop];
function addChildrenToPropList(children){
children.forEach(child => {

View File

@@ -19,7 +19,6 @@ export default function computeInactiveStatus(node){
function isActive(prop){
if (prop.disabled) return false;
switch (prop.type){
case 'buff': return !!prop.applied;
case 'item': return !!prop.equipped;
case 'spell': return !!prop.prepared || !!prop.alwaysPrepared;
case 'note': return false;

View File

@@ -21,8 +21,9 @@ function discoverInlineCalculationFields(prop, schemas){
prop._computationDetails.inlineCalculations.push(inlineCalcObj);
// Extract the calculations and store them on the property
let string = inlineCalcObj.text;
// If there is no text, delete the whole field
if (!string){
delete inlineCalcObj.hash;
unset(prop, calcKey);
return;
}
const inlineCalcHash = cyrb53(inlineCalcObj.text);

View File

@@ -8,12 +8,6 @@ export default function(){
const byAncestor = (propId, note) => assertDeactivatedByAncestor(computation, propId, note);
const active = (propId, note) => assertActive(computation, propId, note);
// Buffs
bySelf('buffNotAppliedId');
byAncestor('buffNotAppliedChildId');
active('buffAppliedId');
active('buffAppliedChildId');
// Items
active('itemUnequippedId', 'Unequipped items should be active');
byAncestor('itemUnequippedChildId', 'Children of unequipped items should be inactive');
@@ -53,28 +47,6 @@ function assertActive(computation, propId, note){
}
var testProperties = [
// Buffs
clean({
_id: 'buffNotAppliedId',
type: 'buff',
ancestors: [{id: 'charId'}],
}),
clean({
_id: 'buffNotAppliedChildId',
type: 'folder',
ancestors: [{id: 'charId'}, {id: 'buffNotAppliedId'}],
}),
clean({
_id: 'buffAppliedId',
type: 'buff',
applied: true,
ancestors: [{id: 'charId'}],
}),
clean({
_id: 'buffAppliedChildId',
type: 'folder',
ancestors: [{id: 'charId'}, {id: 'buffAppliedId'}],
}),
// Items
clean({
_id: 'itemUnequippedId',