Beispiel #1
0
const newPlayer = (playerName, playerRace) => {

    let state = copyObject(config);
    const raceState = race.getRace(playerRace);

    state.name = playerName;
    state.type = raceState.type;
    state.properties = Object.assign(state.properties, raceState.properties);

    state.element = {
        name: name(state),
        type: type(state),
        health: health(state),
        rank: rank(state),
        attack: attack(state),
        defense: defense(state),
        dexterity: dexterity(state),
        speed: speed(state),
        slots: slots(state),
        items: items(state),
        weapon: weapon(state),
        armor: armor(state),
        summary: summary(state),
        event: new EventEmitter()
    };

    return state.element;
};
Beispiel #2
0
export let getRace = type => getFirstByType(copyObject(config).templates, type);