Seed project for Discoteque engine, for quick and easy development. Includes example from repository readme!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

55 lines
2.3 KiB

import { INode, IActor, ILocation } from 'discoteque/lib/engine/types';
import { setState } from 'discoteque/lib/engine/lib/store';
import { IGameState, setCheck } from './store';
import { awardSkill, toast } from 'discoteque/lib/engine/lib/utils';
// Create Nodes
export const nodes: INode<IGameState>[] = [
{ id: 'beginning', kind: 'node', next: 'choice', lines: [
{ actorId: 'char_exampler', text: 'Hi! This is an example of Discoteque!' },
{ actorId: 'char_exampler', text: 'Let\'s try picking options' },
] },
{ id: 'choice', kind: 'node', next: 'choice', lines: [
// Make player pick an answer
{ text: 'Your choice?', options: [
// This answer is gated behind a skill check (dice throw)
{ text: 'Let\'s test a skill', value: 'test_success', skill: { name: 'test', difficulty: 15, failTo: 'test_fail' } },
{ text: 'Let me out!', value: 'exit' },
] }
] },
{ id: 'test_success', kind: 'node', next: 'choice', lines: [
(_, { myCheck }, dispatch) => {
if (!myCheck) {
dispatch(setCheck(true))
return { actorId: 'char_exampler', text: "Yay! You passed a check!" }
} else {
return { text: 'You think you\'ve already passed this check, so no need to do it again' }
}
},
]},
{ id: 'test_fail', kind: 'node', next: 'choice', lines: [
({ skillPoints }, _, dispatch) => {
awardSkill(dispatch, skillPoints);
return { actorId: 'char_exampler', text: 'You\'ve failed... Not a problem! Take a skill point and I\'ll give another if you fail again!' };
}
] },
{ id: 'exit', kind: 'node', next: 'choice', lines: [
(_, _gameState, dispatch) => {
dispatch(setState({ ui: { isOver: true } }));
return { actorId: 'char_exampler' , text: 'Bye-bye!' };
},
] }
];
// Create actors
export const actors: IActor<IGameState>[] = [
{ id: 'char_exampler', kind: 'actor', name: 'Exampler!', lines: [] },
];
// Create locations
export const locations: ILocation<IGameState>[] = [
{ id: 'loc_discoville', kind: 'location', name: 'Discoville!', next: 'beginning', lines: [
{ text: 'It\'s a beautiful day at Discoville today!' },
{ text: 'A friendly feller is approaching you.' }
] },
];