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:
@@ -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 => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -17,11 +17,6 @@ let BuffSchema = createPropertySchema({
|
||||
type: 'fieldToCompute',
|
||||
optional: true,
|
||||
},
|
||||
applied: {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
index: 1,
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
|
||||
@@ -7,26 +7,6 @@
|
||||
:error-messages="errors.name"
|
||||
@change="change('name', ...arguments)"
|
||||
/>
|
||||
<smart-switch
|
||||
label="Applied"
|
||||
class="mt-0"
|
||||
:value="model.applied"
|
||||
:error-messages="errors.applied"
|
||||
@change="change('applied', ...arguments)"
|
||||
/>
|
||||
<v-expand-transition>
|
||||
<div v-if="model.applied">
|
||||
<v-alert
|
||||
type="info"
|
||||
outlined
|
||||
>
|
||||
When buffs are applied they become active on a creature.
|
||||
Turn this off if the buff needs to be applied to a target by an action
|
||||
or spell.
|
||||
</v-alert>
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
|
||||
<inline-computation-field
|
||||
label="Description"
|
||||
:model="model.description"
|
||||
@@ -49,7 +29,6 @@
|
||||
<smart-select
|
||||
v-if="!model.applied"
|
||||
label="Target"
|
||||
:hint="targetOptionHint"
|
||||
:items="targetOptions"
|
||||
:value="model.target"
|
||||
:error-messages="errors.target"
|
||||
@@ -80,47 +59,17 @@
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
targetOptions(){
|
||||
if (this.parentTarget === 'singleTarget') {
|
||||
return [
|
||||
{
|
||||
text: 'Self',
|
||||
value: 'self',
|
||||
}, {
|
||||
text: 'Target',
|
||||
value: 'every',
|
||||
},
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
{
|
||||
text: 'Self',
|
||||
value: 'self',
|
||||
}, {
|
||||
text: 'Roll once for each target',
|
||||
value: 'each',
|
||||
}, {
|
||||
text: 'Roll once and apply to every target',
|
||||
value: 'every',
|
||||
},
|
||||
];
|
||||
}
|
||||
},
|
||||
targetOptionHint(){
|
||||
let hints = {
|
||||
self: 'The buff will be applied to the character taking the action',
|
||||
target: 'The buff will be applied to the target of the action',
|
||||
each: 'The buff will be rolled separately for each of the targets of the action',
|
||||
every: 'The buff will be rolled once and applied to each of the targets of the action',
|
||||
};
|
||||
if (this.parentTarget === 'singleTarget'){
|
||||
hints.each = hints.target;
|
||||
hints.every = hints.target;
|
||||
}
|
||||
return hints[this.model.target];
|
||||
}
|
||||
}
|
||||
data(){return {
|
||||
targetOptions: [
|
||||
{
|
||||
text: 'Self',
|
||||
value: 'self',
|
||||
}, {
|
||||
text: 'Target',
|
||||
value: 'target',
|
||||
},
|
||||
],
|
||||
}},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user