Skip to content

Instantly share code, notes, and snippets.

@ndugger
Last active April 26, 2020 01:49
Show Gist options
  • Save ndugger/cc0ebf3c7c6e356865114fe756b38275 to your computer and use it in GitHub Desktop.
Save ndugger/cc0ebf3c7c6e356865114fe756b38275 to your computer and use it in GitHub Desktop.
import Character from 'forge/Character';
import Item from 'forge/Item';
import Quest from 'forge/Quest';
const GOBLIN_TOOTH_ID = 13;
const GOBLIN_RACE_ID = 7;
const WOODEN_SHOVEL_ID = 4;
export default new Quest('Farm Pests', workflow => {
workflow.describe(`
I hate goblins. Please murder seven of them.
Yank out a tooth or two while you're at it. Thanks.
I think it's funny to kill them with wooden shovels,
so I'll throw in a dimebag if you don't use any other
weapon.
`);
workflow.rule('Find one goblin tooth')
.when(Item.Action.Acquire)
.if(item => item.id === GOBLIN_TOOTH_ID)
.resolve();
workflow.rule('Kill seven goblins')
.when(Character.Action.Die)
.if(character => character.race.id === GOBLIN_RACE_ID)
.fork(workflow => {
workflow.rule('Use a wooden shovel')
.if(character => character.predator.weapon.id !== WOODEN_SHOVEL_ID)
.reject();
})
.repeat(7)
.resolve();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment