import { Place, Choice, Direction } from '../world' import { ProperNoun, ImproperNoun, MalePronouns, FemalePronouns } from '../language' import { Encounter } from '../combat' import * as Creatures from '../creatures' import * as Items from '../items' import { LogLine, nilLog } from '../interface' import { Creature } from '../creature' function makeParty (): Creature[] { const fighter = new Creatures.Human(new ProperNoun("Redgar"), MalePronouns, { stats: { Toughness: 20, Power: 20, Speed: 15, Willpower: 15, Charm: 10 } }) fighter.title = "Lv. 6 Fighter" fighter.equipment.set(Items.EquipmentSlot.MainHand, new Items.Sword()) const rogue = new Creatures.Human(new ProperNoun('Lidda'), FemalePronouns, { stats: { Toughness: 10, Power: 15, Speed: 20, Willpower: 15, Charm: 20 } }) rogue.title = "Lv. 5 Rogue" rogue.equipment.set(Items.EquipmentSlot.MainHand, new Items.Dagger()) const wizard = new Creatures.Human(new ProperNoun('Mialee'), FemalePronouns, { stats: { Toughness: 10, Power: 10, Speed: 15, Willpower: 20, Charm: 25 } }) wizard.title = "Lv. 6 Wizard" wizard.equipment.set(Items.EquipmentSlot.MainHand, new Items.Wand()) const cleric = new Creatures.Human(new ProperNoun('Jozan'), MalePronouns, { stats: { Toughness: 15, Power: 15, Speed: 10, Willpower: 20, Charm: 15 } }) cleric.title = "Lv. 5 Cleric" cleric.equipment.set(Items.EquipmentSlot.MainHand, new Items.Mace()) return [fighter, cleric, rogue, wizard] } export const Town = (): Place => { const home = new Place( new ProperNoun('Your home'), "A very home-y place" ) const westAve = new Place( new ImproperNoun('West Avenue'), "Streets of Sim City" ) const westRoad = new Place( new ImproperNoun('road'), "West of town" ) const woods = new Place( new ImproperNoun('woods'), "Scary woods" ) const bosses = new Place( new ProperNoun("BOSS ZONE"), "Extra scary" ) woods.choices.push( new Choice( "Fight a wolf", "yolo", (world, executor) => { world.encounter = new Encounter( { name: "You punched a wolf" }, [executor, new Creatures.Wolf()] ) return new LogLine(`FIGHT TIME`) } ) ) woods.choices.push( new Choice( "Fight a dragon", "yolo", (world, executor) => { world.encounter = new Encounter( { name: "You punched a dragon" }, [executor, new Creatures.Dragon()] ) return new LogLine(`FIGHT TIME`) } ) ) const bossEncounters = [ new Encounter( { name: "Withers & Kenzie" }, makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()]) ), new Encounter( { name: "Goldeneye" }, makeParty().concat([new Creatures.Goldeneye()]) ), new Encounter( { name: "Large Wah" }, makeParty().concat([new Creatures.Shingo()]) ) ] bossEncounters.forEach(encounter => { bosses.choices.push( new Choice( encounter.desc.name, "Boss fight!", (world, executor) => { world.encounter = encounter return nilLog } ) ) }) home.biconnect(Direction.North, westAve) westAve.biconnect(Direction.West, westRoad) westRoad.biconnect(Direction.South, woods) westRoad.biconnect(Direction.North, bosses) return home }