Removed .js from all imports to smooth ts migration
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import _variable from './computeByType/computeVariable.js';
|
||||
import action from './computeByType/computeAction.js';
|
||||
import attribute from './computeByType/computeAttribute.js';
|
||||
import skill from './computeByType/computeSkill.js';
|
||||
import pointBuy from './computeByType/computePointBuy.js';
|
||||
import propertySlot from './computeByType/computeSlot.js';
|
||||
import container from './computeByType/computeContainer.js';
|
||||
import spellList from './computeByType/computeSpellList.js';
|
||||
import toggle from './computeByType/computeToggle.js';
|
||||
import _calculation from './computeByType/computeCalculation.js';
|
||||
import _variable from './computeByType/computeVariable';
|
||||
import action from './computeByType/computeAction';
|
||||
import attribute from './computeByType/computeAttribute';
|
||||
import skill from './computeByType/computeSkill';
|
||||
import pointBuy from './computeByType/computePointBuy';
|
||||
import propertySlot from './computeByType/computeSlot';
|
||||
import container from './computeByType/computeContainer';
|
||||
import spellList from './computeByType/computeSpellList';
|
||||
import toggle from './computeByType/computeToggle';
|
||||
import _calculation from './computeByType/computeCalculation';
|
||||
|
||||
export default Object.freeze({
|
||||
_variable,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import evaluateCalculation from '../../utility/evaluateCalculation.js';
|
||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||
import evaluateCalculation from '../../utility/evaluateCalculation';
|
||||
import { getPropertyName } from '/imports/constants/PROPERTIES';
|
||||
|
||||
export default function computeCalculation(computation, node) {
|
||||
const calcObj = node.data;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import aggregate from './computeVariable/aggregate/index.js';
|
||||
import { safeStrip } from '/imports/api/engine/computation/utility/stripFloatingPointOddities.js';
|
||||
import aggregate from './computeVariable/aggregate/index';
|
||||
import { safeStrip } from '/imports/api/engine/computation/utility/stripFloatingPointOddities';
|
||||
|
||||
export default function computeContainer(computation, node) {
|
||||
if (!node.data) node.data = {};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { has } from 'lodash';
|
||||
import evaluateCalculation from '../../utility/evaluateCalculation.js';
|
||||
import evaluateCalculation from '../../utility/evaluateCalculation';
|
||||
|
||||
export default function computePointBuy(computation, node) {
|
||||
const prop = node.data;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import aggregate from './computeVariable/aggregate/index.js';
|
||||
import computeVariableAsAttribute from './computeVariable/computeVariableAsAttribute.js';
|
||||
import computeVariableAsSkill from './computeVariable/computeVariableAsSkill.js';
|
||||
import computeVariableAsConstant from './computeVariable/computeVariableAsConstant.js';
|
||||
import computeVariableAsClass from './computeVariable/computeVariableAsClass.js';
|
||||
import computeVariableAsToggle from './computeVariable/computeVariableAsToggle.js';
|
||||
import computeImplicitVariable from './computeVariable/computeImplicitVariable.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import aggregate from './computeVariable/aggregate/index';
|
||||
import computeVariableAsAttribute from './computeVariable/computeVariableAsAttribute';
|
||||
import computeVariableAsSkill from './computeVariable/computeVariableAsSkill';
|
||||
import computeVariableAsConstant from './computeVariable/computeVariableAsConstant';
|
||||
import computeVariableAsClass from './computeVariable/computeVariableAsClass';
|
||||
import computeVariableAsToggle from './computeVariable/computeVariableAsToggle';
|
||||
import computeImplicitVariable from './computeVariable/computeImplicitVariable';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
|
||||
export default function computeVariable(computation, node) {
|
||||
const scope = computation.scope;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import definition from './aggregateDefinition.js';
|
||||
import damageMultiplier from './aggregateDamageMultiplier.js';
|
||||
import effect from './aggregateEffect.js';
|
||||
import eventDefinition from './aggregateEventDefinition.js';
|
||||
import proficiency from './aggregateProficiency.js';
|
||||
import classLevel from './aggregateClassLevel.js';
|
||||
import inventory from './aggregateInventory.js';
|
||||
import definition from './aggregateDefinition';
|
||||
import damageMultiplier from './aggregateDamageMultiplier';
|
||||
import effect from './aggregateEffect';
|
||||
import eventDefinition from './aggregateEventDefinition';
|
||||
import proficiency from './aggregateProficiency';
|
||||
import classLevel from './aggregateClassLevel';
|
||||
import inventory from './aggregateInventory';
|
||||
|
||||
export default Object.freeze({
|
||||
classLevel,
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
import getAggregatorResult from './getAggregatorResult.js';
|
||||
import getAggregatorResult from './getAggregatorResult';
|
||||
|
||||
/*
|
||||
* Variables with effects, proficiencies, or damage multipliers but no defining
|
||||
* properties are added to the scope as implicit variables
|
||||
*/
|
||||
export default function computeImplicitVariable(node){
|
||||
const prop = {};
|
||||
export default function computeImplicitVariable(node) {
|
||||
const prop = {};
|
||||
|
||||
// Combine damage multipliers
|
||||
if (node.data.immunity){
|
||||
if (node.data.immunity) {
|
||||
prop.immunity = node.data.immunity;
|
||||
prop.immunities = node.data.immunities;
|
||||
}
|
||||
if (node.data.resistance){
|
||||
if (node.data.resistance) {
|
||||
prop.resistance = node.data.resistance;
|
||||
prop.resistances = node.data.resistances;
|
||||
}
|
||||
if (node.data.vulnerability){
|
||||
if (node.data.vulnerability) {
|
||||
prop.vulnerability = node.data.vulnerability;
|
||||
prop.vulnerabilities = node.data.vulnerabilities;
|
||||
}
|
||||
|
||||
const result = getAggregatorResult(node);
|
||||
if (result !== undefined){
|
||||
prop.value = result;
|
||||
}
|
||||
if (node.data.proficiency !== undefined){
|
||||
prop.proficiency = node.data.proficiency;
|
||||
}
|
||||
const result = getAggregatorResult(node);
|
||||
if (result !== undefined) {
|
||||
prop.value = result;
|
||||
}
|
||||
if (node.data.proficiency !== undefined) {
|
||||
prop.proficiency = node.data.proficiency;
|
||||
}
|
||||
|
||||
// denormalise class level aggregator
|
||||
let classLevelAgg = node.data.classLevelAggregator;
|
||||
if (classLevelAgg){
|
||||
prop.level = classLevelAgg.level;
|
||||
}
|
||||
// denormalise class level aggregator
|
||||
let classLevelAgg = node.data.classLevelAggregator;
|
||||
if (classLevelAgg) {
|
||||
prop.level = classLevelAgg.level;
|
||||
}
|
||||
|
||||
// denormalise the effect aggregator fields
|
||||
const aggregator = node.data.effectAggregator;
|
||||
if (aggregator){
|
||||
if (aggregator.advantage && !aggregator.disadvantage){
|
||||
prop.advantage = 1;
|
||||
} else if (aggregator.disadvantage && !aggregator.advantage){
|
||||
prop.advantage = -1;
|
||||
} else {
|
||||
prop.advantage = 0;
|
||||
}
|
||||
// Passive bonus
|
||||
prop.passiveBonus = aggregator.passiveAdd;
|
||||
// conditional benefits
|
||||
prop.conditionalBenefits = aggregator.conditional;
|
||||
// Roll bonuses
|
||||
prop.rollBonus = aggregator.rollBonus;
|
||||
// Forced to fail
|
||||
prop.fail = aggregator.fail;
|
||||
// Rollbonus
|
||||
prop.rollBonuses = aggregator.rollBonus;
|
||||
}
|
||||
// denormalise the effect aggregator fields
|
||||
const aggregator = node.data.effectAggregator;
|
||||
if (aggregator) {
|
||||
if (aggregator.advantage && !aggregator.disadvantage) {
|
||||
prop.advantage = 1;
|
||||
} else if (aggregator.disadvantage && !aggregator.advantage) {
|
||||
prop.advantage = -1;
|
||||
} else {
|
||||
prop.advantage = 0;
|
||||
}
|
||||
// Passive bonus
|
||||
prop.passiveBonus = aggregator.passiveAdd;
|
||||
// conditional benefits
|
||||
prop.conditionalBenefits = aggregator.conditional;
|
||||
// Roll bonuses
|
||||
prop.rollBonus = aggregator.rollBonus;
|
||||
// Forced to fail
|
||||
prop.fail = aggregator.fail;
|
||||
// Rollbonus
|
||||
prop.rollBonuses = aggregator.rollBonus;
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import getAggregatorResult from './getAggregatorResult.js';
|
||||
import getAggregatorResult from './getAggregatorResult';
|
||||
|
||||
export default function computeVariableAsAttribute(computation, node, prop) {
|
||||
let result = getAggregatorResult(node) || 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { parse } from '/imports/parser/parser.js';
|
||||
import { parse } from '/imports/parser/parser';
|
||||
|
||||
export default function computeVariableAsConstant(computation, node, prop){
|
||||
export default function computeVariableAsConstant(computation, node, prop) {
|
||||
let string = prop.calculation;
|
||||
if (!string) return;
|
||||
let parseNode;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import aggregate from './aggregate/index.js';
|
||||
import aggregate from './aggregate/index';
|
||||
|
||||
export default function computeVariableAsSkill(computation, node, prop) {
|
||||
// Skills are based on some ability Modifier
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import getAggregatorResult from './getAggregatorResult.js';
|
||||
import getAggregatorResult from './getAggregatorResult';
|
||||
|
||||
export default function computeVariableAsToggle(computation, node, prop){
|
||||
export default function computeVariableAsToggle(computation, node, prop) {
|
||||
let result = getAggregatorResult(node, prop) || 0;
|
||||
|
||||
prop.value = !!result || !!prop.enabled || !!prop.condition?.value;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import stripFloatingPointOddities from '/imports/api/engine/computation/utility/stripFloatingPointOddities.js';
|
||||
import stripFloatingPointOddities from '/imports/api/engine/computation/utility/stripFloatingPointOddities';
|
||||
|
||||
export default function getAggregatorResult(node){
|
||||
export default function getAggregatorResult(node) {
|
||||
// Work out the base value as the greater of the deining stat value
|
||||
// This baseValue comes from aggregating definitions
|
||||
let statBase = node.data.baseValue;
|
||||
@@ -12,9 +12,9 @@ export default function getAggregatorResult(node){
|
||||
if (!aggregator) return statBase;
|
||||
|
||||
let base;
|
||||
if (!Number.isFinite(aggregator.base)){
|
||||
if (!Number.isFinite(aggregator.base)) {
|
||||
base = statBase || 0;
|
||||
} else if (!Number.isFinite(statBase)){
|
||||
} else if (!Number.isFinite(statBase)) {
|
||||
base = aggregator.base || 0;
|
||||
} else {
|
||||
base = Math.max(aggregator.base, statBase);
|
||||
@@ -29,9 +29,9 @@ export default function getAggregatorResult(node){
|
||||
if (aggregator.set !== undefined) {
|
||||
result = aggregator.set;
|
||||
}
|
||||
if (!node.data.definingProp?.decimal && Number.isFinite(result)){
|
||||
if (!node.data.definingProp?.decimal && Number.isFinite(result)) {
|
||||
result = Math.floor(result);
|
||||
} else if (Number.isFinite(result)){
|
||||
} else if (Number.isFinite(result)) {
|
||||
result = stripFloatingPointOddities(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const scope = id => computation.scope[id];
|
||||
@@ -20,41 +20,41 @@ var testProperties = [
|
||||
type: 'class',
|
||||
variableName: 'wizard',
|
||||
classType: 'startingClass',
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
clean({
|
||||
_id: 'rangerId',
|
||||
type: 'class',
|
||||
variableName: 'ranger',
|
||||
classType: 'multiClass',
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz1Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 1,
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz2Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 2,
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
clean({
|
||||
_id: 'wiz4Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'wizard',
|
||||
level: 4,
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
clean({
|
||||
_id: 'rang1Id',
|
||||
type: 'classLevel',
|
||||
variableName: 'ranger',
|
||||
level: 1,
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
@@ -23,6 +23,6 @@ var testProperties = [
|
||||
baseValue: {
|
||||
calculation: 'arrayConstant[3]',
|
||||
},
|
||||
ancestors: [{id: 'charId'}],
|
||||
ancestors: [{ id: 'charId' }],
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const scope = id => computation.scope[id];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties, compareOrder } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function () {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
import { applyNestedSetProperties, compareOrder } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default function () {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation.js';
|
||||
import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation';
|
||||
import clean from '../../utility/cleanProp.testFn';
|
||||
|
||||
export default function(){
|
||||
export default function () {
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import computeAction from './computeAction.testFn.js';
|
||||
import computeAttribute from './computeAttribute.testFn.js';
|
||||
import computeClasses from './computeClasses.testFn.js';
|
||||
import computeConstants from './computeConstants.testFn.js';
|
||||
import computeInventory from './computeInventory.testFn.js';
|
||||
import computeDamageMultipliers from './computeDamageMultipliers.testFn.js';
|
||||
import computeEffects from './computeEffects.testFn.js';
|
||||
import computeSkills from './computeSkills.testFn.js';
|
||||
import computeProficiencies from './computeProficiencies.testFn.js';
|
||||
import computeAction from './computeAction.testFn';
|
||||
import computeAttribute from './computeAttribute.testFn';
|
||||
import computeClasses from './computeClasses.testFn';
|
||||
import computeConstants from './computeConstants.testFn';
|
||||
import computeInventory from './computeInventory.testFn';
|
||||
import computeDamageMultipliers from './computeDamageMultipliers.testFn';
|
||||
import computeEffects from './computeEffects.testFn';
|
||||
import computeSkills from './computeSkills.testFn';
|
||||
import computeProficiencies from './computeProficiencies.testFn';
|
||||
|
||||
export default [{
|
||||
text: 'Computes actions',
|
||||
|
||||
Reference in New Issue
Block a user