Moved action system to new tree format
This commit is contained in:
@@ -5,7 +5,7 @@ import { applyNodeTriggers } from '/imports/api/engine/actions/applyTriggers';
|
||||
|
||||
export default function applyAdjustment(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
const damageTargets = prop.target === 'self' ? [actionContext.creature] : actionContext.targets;
|
||||
|
||||
if (!prop.amount) {
|
||||
|
||||
@@ -8,7 +8,7 @@ export default function applyBranch(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const scope = actionContext.scope;
|
||||
const targets = actionContext.targets;
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
switch (prop.branchType) {
|
||||
case 'if':
|
||||
recalculateCalculation(prop.condition, actionContext);
|
||||
|
||||
@@ -17,7 +17,7 @@ import recalculateInlineCalculations from './shared/recalculateInlineCalculation
|
||||
|
||||
export default function applyBuff(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
let buffTargets = prop.target === 'self' ? [actionContext.creature] : actionContext.targets;
|
||||
|
||||
// Mark the buff as dirty for recalculation
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function applyBuffRemover(node, actionContext) {
|
||||
// Apply triggers
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
|
||||
// Log Name
|
||||
if (prop.name && !prop.silent) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import applySavingThrow from '/imports/api/engine/actions/applyPropertyByType/ap
|
||||
export default function applyDamage(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
const scope = actionContext.scope;
|
||||
|
||||
// Skip if there is no parse node to work with
|
||||
|
||||
@@ -6,7 +6,7 @@ import { adjustQuantityWork } from '/imports/api/creature/creatureProperties/met
|
||||
|
||||
export default function applyItemAsAmmo(node, actionContext) {
|
||||
// The item node should come without children, since it is not part of the original action tree
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
// Get all the item's descendant properties
|
||||
const properties = getPropertyDecendants(actionContext.creature._id, prop._id);
|
||||
properties.sort((a, b) => a.order - b.order);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { applyNodeTriggers } from '/imports/api/engine/actions/applyTriggers';
|
||||
|
||||
export default function applyNote(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
|
||||
// Log Name, summary
|
||||
let content = { name: prop.name };
|
||||
|
||||
@@ -6,7 +6,7 @@ import { applyNodeTriggers } from '/imports/api/engine/actions/applyTriggers';
|
||||
|
||||
export default function applyRoll(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
|
||||
if (prop.roll?.calculation) {
|
||||
const logValue = [];
|
||||
|
||||
@@ -8,7 +8,7 @@ import { applyUnresolvedEffects } from '/imports/api/engine/actions/doCheck.js';
|
||||
|
||||
export default function applySavingThrow(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
const originalTargets = actionContext.targets;
|
||||
|
||||
let saveTargets = prop.target === 'self' ? [actionContext.creature] : actionContext.targets;
|
||||
|
||||
@@ -4,7 +4,7 @@ import applyChildren from '/imports/api/engine/actions/applyPropertyByType/share
|
||||
|
||||
export default function applyToggle(node, actionContext) {
|
||||
applyNodeTriggers(node, 'before', actionContext);
|
||||
const prop = node.node;
|
||||
const prop = node.doc
|
||||
recalculateCalculation(prop.condition, actionContext);
|
||||
if (prop.condition?.value) {
|
||||
return applyChildren(node, actionContext);
|
||||
|
||||
Reference in New Issue
Block a user