Refactored actions, 'cast a spell' task now works
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import { CheckParams } from '/imports/api/engine/action/functions/userInput/InputProvider';
|
||||
|
||||
type Task = PropTask | DamagePropTask | ItemAsAmmoTask | CheckTask | ResetTask;
|
||||
type Task = PropTask | DamagePropTask | ItemAsAmmoTask | CheckTask | ResetTask | CastSpellTask;
|
||||
|
||||
export default Task;
|
||||
|
||||
type BaseTask = {
|
||||
prop: { type: string, [key: string]: any };
|
||||
targetIds: string[];
|
||||
silent?: boolean | undefined;
|
||||
}
|
||||
|
||||
type Prop = {
|
||||
_id: string;
|
||||
type: string;
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
export type PropTask = BaseTask & {
|
||||
subtaskFn?: undefined,
|
||||
prop: Prop;
|
||||
subtaskFn?: undefined;
|
||||
silent?: undefined;
|
||||
}
|
||||
|
||||
export type DamagePropTask = BaseTask & {
|
||||
@@ -22,12 +30,14 @@ export type DamagePropTask = BaseTask & {
|
||||
title?: string;
|
||||
operation: 'increment' | 'set';
|
||||
value: number;
|
||||
targetProp: any;
|
||||
targetProp: Prop;
|
||||
};
|
||||
}
|
||||
|
||||
export type ItemAsAmmoTask = BaseTask & {
|
||||
subtaskFn: 'consumeItemAsAmmo';
|
||||
prop: Prop;
|
||||
silent?: undefined;
|
||||
params: {
|
||||
value: number;
|
||||
item: any;
|
||||
@@ -40,8 +50,17 @@ export type CheckTask = BaseTask & CheckParams & {
|
||||
}
|
||||
|
||||
export type ResetTask = BaseTask & {
|
||||
subtaskFn: 'reset',
|
||||
subtaskFn: 'reset';
|
||||
eventName: string;
|
||||
// One and only one target
|
||||
targetIds: [string];
|
||||
}
|
||||
|
||||
export type CastSpellTask = BaseTask & {
|
||||
prop?: Prop | undefined;
|
||||
silent?: undefined;
|
||||
subtaskFn: 'castSpell';
|
||||
params: {
|
||||
spellId: string | undefined;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user