Started fixing action target selection

This commit is contained in:
ThaumRystra
2024-06-12 15:43:56 +02:00
parent 4921a34dfe
commit a5292cf0f2
17 changed files with 162 additions and 15 deletions

View File

@@ -1,6 +1,10 @@
import Task from '/imports/api/engine/action/tasks/Task';
type InputProvider = {
/**
* Get the ids of the creatures being targeted
*/
targetIds(target: 'singleTarget' | 'multipleTargets', currentTargetIds?: string[]): Promise<string[]>;
/**
* Show the user the next property or task to apply and wait for input to continue
*/

View File

@@ -8,6 +8,9 @@ export default function getReplayChoicesInputProvider(actionId: string, decision
const decisionStack = [...decisions].reverse();
const dRoller = getDeterministicDiceRoller(actionId);
const replaySavedInput: InputProvider = {
targetIds() {
return Promise.resolve(decisionStack.pop());
},
nextStep() {
return Promise.resolve();
},

View File

@@ -1,6 +1,9 @@
import InputProvider from '/imports/api/engine/action/functions/userInput/InputProvider';
const inputProviderForTests: InputProvider = {
async targetIds(target, currentTargetIds = []) {
return currentTargetIds;
},
/**
* For testing, randomness is hard to deal with
* rollDice function returns the average roll for every dice rolled