| @@ -3,7 +3,7 @@ | |||||
| <Header /> | <Header /> | ||||
| <div id="main-area"> | <div id="main-area"> | ||||
| <transition name="component-fade" mode='out-in'> | <transition name="component-fade" mode='out-in'> | ||||
| <component @profile="$data.profileOn = true" @exit="$data.profileOn = false" @leaveCombat="$data.world.encounter = null" v-bind:is="mode" :world="$data.world" :encounter="$data.world.encounter" /> | |||||
| <component @profile="$data.profileOn = true" @exit="$data.profileOn = false" @leave-combat="$data.world.encounter = null" v-bind:is="mode" :world="$data.world" :encounter="$data.world.encounter" /> | |||||
| </transition> | </transition> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -43,7 +43,7 @@ | |||||
| </div> | </div> | ||||
| <div v-if="encounter.winner === null" class="action-description"> | <div v-if="encounter.winner === null" class="action-description"> | ||||
| </div> | </div> | ||||
| <button @click="$emit('leaveCombat')" v-if="encounter.winner !== null" class="exit-combat"> | |||||
| <button @click="$emit('leave-combat')" v-if="encounter.winner !== null" class="exit-combat"> | |||||
| Exit Combat | Exit Combat | ||||
| </button> | </button> | ||||
| <button @click="continuing = true; pickNext()" v-if="encounter.winner !== null && !continuing" class="continue-combat"> | <button @click="continuing = true; pickNext()" v-if="encounter.winner !== null && !continuing" class="continue-combat"> | ||||
| @@ -61,6 +61,7 @@ import Statblock from './Statblock.vue' | |||||
| import ActionButton from './ActionButton.vue' | import ActionButton from './ActionButton.vue' | ||||
| import { Side, Encounter } from '@/game/combat' | import { Side, Encounter } from '@/game/combat' | ||||
| import { NoAI } from '../game/ai' | import { NoAI } from '../game/ai' | ||||
| import { World } from '@/game/world' | |||||
| @Component( | @Component( | ||||
| { | { | ||||
| @@ -82,6 +83,9 @@ export default class Combat extends Vue { | |||||
| @Prop() | @Prop() | ||||
| encounter!: Encounter | encounter!: Encounter | ||||
| @Prop() | |||||
| world!: World | |||||
| Side = Side | Side = Side | ||||
| actionDescription = '' | actionDescription = '' | ||||
| @@ -293,6 +297,8 @@ export default class Combat extends Vue { | |||||
| leftStats.scrollTo(leftStats.getBoundingClientRect().width * 2, 0) | leftStats.scrollTo(leftStats.getBoundingClientRect().width * 2, 0) | ||||
| } | } | ||||
| this.writeLog(this.encounter.desc.intro(this.world)) | |||||
| this.pickNext() | this.pickNext() | ||||
| } | } | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ import { Creature } from "./creature" | |||||
| import { TextLike, DynText, ToBe, LiveText, PairLineArgs, PairLine } from './language' | import { TextLike, DynText, ToBe, LiveText, PairLineArgs, PairLine } from './language' | ||||
| import { LogEntry, LogLines, FAElem, LogLine, FormatEntry, FormatOpt, PropElem, nilLog } from './interface' | import { LogEntry, LogLines, FAElem, LogLine, FormatEntry, FormatOpt, PropElem, nilLog } from './interface' | ||||
| import { Resistances } from './entity' | import { Resistances } from './entity' | ||||
| import { World } from './world' | |||||
| export enum DamageType { | export enum DamageType { | ||||
| Pierce = "Pierce", | Pierce = "Pierce", | ||||
| @@ -534,7 +535,9 @@ export abstract class StatusEffect extends Effective implements VisibleStatus { | |||||
| export type EncounterDesc = { | export type EncounterDesc = { | ||||
| name: TextLike; | name: TextLike; | ||||
| intro: (world: World) => LogEntry; | |||||
| } | } | ||||
| /** | /** | ||||
| * An Encounter describes a fight: who is in it and whose turn it is | * An Encounter describes a fight: who is in it and whose turn it is | ||||
| */ | */ | ||||
| @@ -1,4 +1,4 @@ | |||||
| import { Place, Choice, Direction } from '../world' | |||||
| import { Place, Choice, Direction, World } from '../world' | |||||
| import { ProperNoun, ImproperNoun, MalePronouns, FemalePronouns, TheyPronouns } from '../language' | import { ProperNoun, ImproperNoun, MalePronouns, FemalePronouns, TheyPronouns } from '../language' | ||||
| import { Encounter, Stat, Damage, DamageType, Vigor } from '../combat' | import { Encounter, Stat, Damage, DamageType, Vigor } from '../combat' | ||||
| import * as Creatures from '../creatures' | import * as Creatures from '../creatures' | ||||
| @@ -95,7 +95,10 @@ export const Town = (): Place => { | |||||
| "yolo", | "yolo", | ||||
| (world, executor) => { | (world, executor) => { | ||||
| world.encounter = new Encounter( | world.encounter = new Encounter( | ||||
| { name: "You punched a wolf" }, | |||||
| { | |||||
| name: "You punched a wolf", | |||||
| intro: (world: World) => new LogLine(`You punched a wolf. The wolf is angry.`) | |||||
| }, | |||||
| [executor, new Creatures.Wolf()] | [executor, new Creatures.Wolf()] | ||||
| ) | ) | ||||
| @@ -110,7 +113,10 @@ export const Town = (): Place => { | |||||
| "yolo", | "yolo", | ||||
| (world, executor) => { | (world, executor) => { | ||||
| world.encounter = new Encounter( | world.encounter = new Encounter( | ||||
| { name: "You punched a dragon" }, | |||||
| { | |||||
| name: "You punched a dragon", | |||||
| intro: (world: World) => new LogLine(`You punched a dragon. The dragon is angry.`) | |||||
| }, | |||||
| [executor, new Creatures.Dragon()] | [executor, new Creatures.Dragon()] | ||||
| ) | ) | ||||
| @@ -121,15 +127,15 @@ export const Town = (): Place => { | |||||
| const bossEncounters = [ | const bossEncounters = [ | ||||
| new Encounter( | new Encounter( | ||||
| { name: "Withers & Kenzie" }, | |||||
| { name: "Withers & Kenzie", intro: (world: World) => nilLog }, | |||||
| makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()]) | makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()]) | ||||
| ), | ), | ||||
| new Encounter( | new Encounter( | ||||
| { name: "Goldeneye" }, | |||||
| { name: "Goldeneye", intro: (world: World) => nilLog }, | |||||
| makeParty().concat([new Creatures.Goldeneye()]) | makeParty().concat([new Creatures.Goldeneye()]) | ||||
| ), | ), | ||||
| new Encounter( | new Encounter( | ||||
| { name: "Large Wah" }, | |||||
| { name: "Large Wah", intro: (world: World) => nilLog }, | |||||
| makeParty().concat([new Creatures.Shingo()]) | makeParty().concat([new Creatures.Shingo()]) | ||||
| ) | ) | ||||
| ] | ] | ||||