Fixed slotLevel not having the right value in spell scope

This commit is contained in:
Stefan Zermatten
2022-08-25 11:40:30 +02:00
parent e42ec4b862
commit 1d98c41168

View File

@@ -9,7 +9,6 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
import { damagePropertyWork } from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
import { doActionWork } from '/imports/api/engine/actions/doAction.js';
import { CreatureLogSchema } from '/imports/api/creature/log/CreatureLogs.js';
import ActionContext from '/imports/api/engine/actions/ActionContext.js';
const doAction = new ValidatedMethod({
@@ -65,8 +64,6 @@ const doAction = new ValidatedMethod({
let slotLevel = spell.level || 0;
let slot;
actionContext.scope['slotLevel'] = slotLevel;
if (slotId && !spell.castWithoutSpellSlots){
slot = CreatureProperties.findOne(slotId);
if (!slot){
@@ -109,6 +106,8 @@ const doAction = new ValidatedMethod({
});
}
actionContext.scope['slotLevel'] = slotLevel;
// Do the action
doActionWork({
properties, ancestors, actionContext, methodScope: scope,