Create world.js

This commit is contained in:
Nick Walton 2020-05-27 17:15:14 -06:00 committed by GitHub
parent c77a425744
commit 6f0bc83dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

25
world.js Normal file
View file

@ -0,0 +1,25 @@
const world = {
'orc': 'Orcs have been mistreated for many years in the kingdom of Larion. Treated as second class citizens they are often denied jobs and treated as criminals. There is a movement called the Human Orc Friendship Association (HOFA) that seeks equality between humans and orcs.',
'hofa': 'HOFA (the Human Orc Friendship Association) is a group dedicated to seeking equality between orcs and humans',
'human': 'Many humans hate orcs, but there are also a large number of humans who believe orcs have been greatly mistreated and deserve equal rights.',
'king': 'The king of Larion doesn\'t hate orcs necessarily, but he\'s hesitant to upset the balance of the kingdom by increasing their rights.',
'queen': 'The queen feels fondness towards orcs and has a soft place in her heart for them.',
'zeradell': 'Zeradell is the capital of Lario and is where the King and Queen live.'
}
const worldContext = (relevant) => {
const lower = relevant.toLowerCase()
let context = ''
for(key in world){
if(lower.includes(key)){
context = context + world[key] + '\n'
}
}
return context
}
const modifier = () => {
const lastOutput = history?.length > 0 ? history[history.length-1] : ''
const context = worldContext(lastOutput + '\n' + text)