Fixed spell casting
This commit is contained in:
@@ -35,10 +35,6 @@ type InputProvider = {
|
||||
* Get the details of a check or save
|
||||
*/
|
||||
check(suggestedParams: CheckParams): Promise<CheckParams>;
|
||||
/**
|
||||
* Get the details of casting a spell
|
||||
*/
|
||||
castSpell(suggestedParams: Partial<CastSpellParams>): Promise<CastSpellParams>;
|
||||
}
|
||||
|
||||
export type Advantage = 0 | 1 | -1;
|
||||
@@ -53,10 +49,4 @@ export type CheckParams = {
|
||||
targetAbilityVariableName?: string;
|
||||
}
|
||||
|
||||
export type CastSpellParams = {
|
||||
spellId: string,
|
||||
slotId: string | undefined,
|
||||
ritual: boolean,
|
||||
}
|
||||
|
||||
export default InputProvider;
|
||||
|
||||
@@ -28,9 +28,6 @@ export default function getReplayChoicesInputProvider(actionId: string, decision
|
||||
check() {
|
||||
return Promise.resolve(decisionStack.pop());
|
||||
},
|
||||
castSpell() {
|
||||
return Promise.resolve(decisionStack.pop());
|
||||
},
|
||||
}
|
||||
return replaySavedInput;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import InputProvider, { CastSpellParams } from '/imports/api/engine/action/functions/userInput/InputProvider';
|
||||
import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider';
|
||||
|
||||
const inputProviderForTests: InputProvider = {
|
||||
async targetIds(target, currentTargetIds = []) {
|
||||
@@ -42,9 +42,6 @@ const inputProviderForTests: InputProvider = {
|
||||
async check(suggestedParams) {
|
||||
return suggestedParams;
|
||||
},
|
||||
async castSpell(suggestedParams) {
|
||||
return suggestedParams as CastSpellParams;
|
||||
},
|
||||
}
|
||||
|
||||
export const critInputProvider: InputProvider = {
|
||||
|
||||
@@ -13,8 +13,10 @@ export default function saveInputChoices(action: EngineAction, userInput: InputP
|
||||
}
|
||||
|
||||
// For every function in the given input provider
|
||||
for (const key in userInput) {
|
||||
let key: keyof InputProvider;
|
||||
for (key in userInput) {
|
||||
const oldFn = userInput[key];
|
||||
if (!oldFn) continue;
|
||||
// Make a new function that does the same thing, but saves the result to action._decisions
|
||||
const newFn = async (...args) => {
|
||||
const result = await oldFn(...args);
|
||||
|
||||
Reference in New Issue
Block a user