Refactored actions, 'cast a spell' task now works

This commit is contained in:
Thaum Rystra
2024-10-28 12:28:36 +02:00
parent 804c5f3aee
commit 8f8c9c28aa
39 changed files with 423 additions and 399 deletions

View File

@@ -14,7 +14,6 @@ import TaskResult from '/imports/api/engine/action/tasks/TaskResult';
export default async function applyCheckTask(
task: CheckTask, action: EngineAction, result: TaskResult, userInput: InputProvider
): Promise<void> {
const prop = task.prop;
const targetIds = task.targetIds;
if (task.contest) {
@@ -45,7 +44,7 @@ export default async function applyCheckTask(
if (skill || ability) {
// Create a new result after before triggers have run
result = new TaskResult(task.prop._id, task.targetIds);
result = new TaskResult(task.targetIds);
action.results.push(result);
}
@@ -75,7 +74,7 @@ export default async function applyCheckTask(
name: checkName,
inline: true,
...dc !== null && { value: `DC **${dc}**` },
...prop?.silent && { silenced: prop.silent }
...task?.silent && { silenced: task.silent }
}, [targetId]);
// Roll the dice
@@ -109,7 +108,7 @@ export default async function applyCheckTask(
name: rollName,
value: `${resultPrefix}\n**${totalValue}**`,
inline: true,
...prop?.silent && { silenced: prop.silent }
...task?.silent && { silenced: task.silent }
}, [targetId]);
// After check triggers