diff --git a/src/App.vue b/src/App.vue index 4a92fd7..1f48030 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,8 @@ - + + @@ -9,20 +10,23 @@ import { Component, Vue, Prop, Emit } from 'vue-property-decorator' import Combat from './components/Combat.vue' import Header from './components/Header.vue' +import Explore from './components/Explore.vue' import * as Creatures from '@/game/creatures' import * as Items from '@/game/items' import { Creature } from '@/game/creature' -import { ProperNoun, TheyPronouns, FemalePronouns, MalePronouns, ImproperNoun } from '@/game/language' +import { ProperNoun, TheyPronouns, FemalePronouns, MalePronouns, ImproperNoun, POV } from '@/game/language' +import { Place, Direction, World } from '@/game/world' import { Encounter } from './game/combat' @Component({ components: { - Combat, Header + Combat, Header, Explore }, data () { return { encounter: null, - encounters: null + encounters: null, + world: null } } }) @@ -46,6 +50,18 @@ export default class App extends Vue { this.$data.encounters.push(new Encounter({ name: 'Large Wah' }, this.makeParty().concat([new Creatures.Shingo()]))) this.$data.encounter = this.$data.encounters[0] + + const foo = new Place('Foo', 'A very foo-y place') + const other = new Place('Bar', 'The bar') + foo.biconnect(Direction.North, other) + + const something = new Place('Baz', 'BAZZZZZZZZZZ') + foo.biconnect(Direction.East, something) + + const player = new Creatures.Wolf() + player.perspective = POV.Second + player.location = foo + this.$data.world = new World(player) } makeParty (): Creature[] { diff --git a/src/components/Explore.vue b/src/components/Explore.vue new file mode 100644 index 0000000..845c5d8 --- /dev/null +++ b/src/components/Explore.vue @@ -0,0 +1,137 @@ + + + + + + + Time: {{ world.time }} + + + {{ location.name }} + {{ location.desc }} + + + + {{location.connections[direction].name}} + + + + + + + + + + + diff --git a/src/game/combat.ts b/src/game/combat.ts index 091f716..41e46fd 100644 --- a/src/game/combat.ts +++ b/src/game/combat.ts @@ -477,12 +477,10 @@ export class Encounter { // still not undefined... const currentProgress = this.initiatives.get(combatant) ?? 0 this.initiatives.set(combatant, currentProgress + closestRemaining * Math.max(combatant.stats.Speed, 1)) - console.log(combatant.name.toString(), currentProgress, closestRemaining) }) // TODO: still let the creature use drained-vigor moves - console.log(this.currentMove.name.toString()) if (this.currentMove.disabled) { this.nextMove() } diff --git a/src/game/entity.ts b/src/game/entity.ts index d8555fe..7e16e3b 100644 --- a/src/game/entity.ts +++ b/src/game/entity.ts @@ -1,7 +1,7 @@ import { DamageType, Damage, Stats, Vigor, VoreStats, VoreStat, Stat, Vigors } from './combat' import { Noun, Pronoun, TextLike, POV, PronounAsNoun, FirstPersonPronouns, SecondPersonPronouns } from './language' import { LogEntry, LogLine } from './interface' -import { Container } from './vore' +import { Place, Nowhere } from './world' export abstract class Entity { get name (): Noun { @@ -27,9 +27,10 @@ export abstract class Entity { desc: TextLike = "It's a ting." perspective: POV = POV.Third title: TextLike = "Some thing." + location: Place constructor (public baseName: Noun, public kind: Noun, public basePronouns: Pronoun) { - + this.location = Nowhere } } diff --git a/src/game/world.ts b/src/game/world.ts new file mode 100644 index 0000000..b884a9d --- /dev/null +++ b/src/game/world.ts @@ -0,0 +1,64 @@ +import { TextLike } from './language' +import { Entity } from './entity' +import { Creature } from './creature' + +export enum Direction { + Northwest = "Northwest", + North = "North", + Northeast = "Northeast", + West = "West", + East = "East", + Southwest = "Southwest", + South = "South", + Southeast = "Southeast" +} + +export function reverse (dir: Direction): Direction { + switch (dir) { + case Direction.Northwest: return Direction.Southeast + case Direction.North: return Direction.South + case Direction.Northeast: return Direction.Southwest + case Direction.West: return Direction.East + case Direction.East: return Direction.West + case Direction.Southwest: return Direction.Northeast + case Direction.South: return Direction.North + case Direction.Southeast: return Direction.Northwest + } +} + +export class Connection { + constructor (public src: Place, public dst: Place) { + + } +} + +export class Place { + connections: {[key in Direction]?: Place} = {} + + constructor (public name: TextLike, public desc: TextLike) { + + } + + connect (dir: Direction, dst: Place) { + this.connections[dir] = dst + } + + biconnect (dir: Direction, dst: Place) { + this.connections[dir] = dst + dst.connections[reverse(dir)] = this + } +} + +export const Nowhere = new Place( + "Nowhere", + "This isn't anywhere!" +) + +export class World { + time = "It's time!" + creatures: Creature[] = [] + + constructor (public player: Creature) { + this.creatures.push(player) + } +}
Time: {{ world.time }}
{{ location.desc }}