Fix self-targeted spells not casting correctly

This commit is contained in:
ThaumRystra
2025-01-25 20:51:20 +02:00
parent c42da1d492
commit b8ed9aa658
3 changed files with 8 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ export default async function applySpellProperty(
task: CastSpellTask, action: EngineAction, result: TaskResult, userInput: InputProvider
): Promise<void> {
const prop = task.prop;
const targetIds = prop.target === 'self' ? [action.creatureId] : task.targetIds;
if (!prop) {
result.appendLog({
@@ -65,7 +66,7 @@ export default async function applySpellProperty(
result.appendLog({
name: message,
silenced: prop.silent,
}, task.targetIds);
}, targetIds);
// Add the slot level to the scope
result.pushScope = {
@@ -76,6 +77,6 @@ export default async function applySpellProperty(
// Run the rest of the spell as if it were an action
return applyActionProperty({
prop,
targetIds: task.targetIds,
targetIds: targetIds,
}, action, result, userInput);
}

View File

@@ -72,6 +72,9 @@ export default async function doAction({
const finishedAction = await applyAction(
action, getErrorOnInputRequestProvider(action._id), { simulate: true }
);
if (replaceDialog) {
$store.dispatch('popDialogStack', finishedAction);
}
return callActionMethod(finishedAction);
} catch (e) {
if (e !== 'input-requested') throw e;

View File

@@ -29,7 +29,7 @@
</div>
</div>
<div
v-if="contentGroup.targetIds.length"
v-if="contentGroup.targetIds && contentGroup.targetIds.length"
class="content-target-ids d-flex flex-column justify-center"
>
<v-tooltip
@@ -101,7 +101,7 @@ export default {
}
currentContent = {
targetIds: contentItem.targetIds,
targetCreatures: contentItem.targetIds.map(getCreature),
targetCreatures: contentItem.targetIds?.map(getCreature) ?? [],
content: [contentItem],
};
} else {