Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x | /**
* @module Engine.Characters
* Characters actions
*/
import { IMapsState } from '@engine/Maps/reducers';
import { Character, RaceId } from '@models';
import { Genre } from '@models/Character/Genre';
import { Action } from 'redux';
//#region ActionType
export enum CharacterActions {
MOVE = 'CharacterActions.MOVE',
CREATE = 'CharacterActions.CREATE',
UPDATE_MOTD = 'CharacterActions.UPDATE_MOTD',
// CHANGE_DEXTERITY = 'CharacterActions.CHANGE_DEXTERITY',
// ATTACK = 'CharacterActions.ATTACK',
// DAMAGE = 'CharacterActions.DAMAGE',
// CHANGE_POSTURE = 'CharacterActions.CHANGE_POSTURE',
}
export enum CharactersActions {
LOAD_DATABASE = 'CharactersActions.LOAD_DATABASE',
SAVE_DATABASE = 'CharactersActions.SAVE_DATABASE',
LINK_TO_MAP = 'CharactersActions.LINK_TO_MAP',
}
export type CharacterActionsType = Action<CharacterActions>;
export type MoveAction = CharacterActionsType & { character: Character, newX: number, newY: number, cost: number };
export type CreateAction = CharacterActionsType & { owner: number, name: string, race: RaceId, genre: Genre };
export type UpdateMotdAction = CharacterActionsType & { character: Character, message: string };
//#endregion ActionType
export const move = (character: Character, newX: number, newY: number, cost: number): MoveAction => ({
type: CharacterActions.MOVE,
character,
newX,
newY,
cost,
});
export const create = (owner: number, name: string, race: RaceId, genre: Genre): CreateAction => ({
type: CharacterActions.CREATE,
owner,
name,
race,
genre,
});
export const updateMotd = (character: Character, message: string): UpdateMotdAction => ({
type: CharacterActions.UPDATE_MOTD,
character,
message,
});
export const loadDatabase = () => ({
type: CharactersActions.LOAD_DATABASE,
});
export const saveDatabase = () => ({
type: CharactersActions.SAVE_DATABASE,
});
export const linkToMap = (maps: IMapsState) => ({
type: CharactersActions.LINK_TO_MAP,
maps,
});
|