Bladeren bron

Add intros to encounters

vintage
Fen Dweller 5 jaren geleden
bovenliggende
commit
25427ae6e8
4 gewijzigde bestanden met toevoegingen van 23 en 8 verwijderingen
  1. +1
    -1
      src/App.vue
  2. +7
    -1
      src/components/Combat.vue
  3. +3
    -0
      src/game/combat.ts
  4. +12
    -6
      src/game/maps/town.ts

+ 1
- 1
src/App.vue Bestand weergeven

@@ -3,7 +3,7 @@
<Header />
<div id="main-area">
<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>
</div>
</div>


+ 7
- 1
src/components/Combat.vue Bestand weergeven

@@ -43,7 +43,7 @@
</div>
<div v-if="encounter.winner === null" class="action-description">
</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
</button>
<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 { Side, Encounter } from '@/game/combat'
import { NoAI } from '../game/ai'
import { World } from '@/game/world'

@Component(
{
@@ -82,6 +83,9 @@ export default class Combat extends Vue {
@Prop()
encounter!: Encounter

@Prop()
world!: World

Side = Side

actionDescription = ''
@@ -293,6 +297,8 @@ export default class Combat extends Vue {
leftStats.scrollTo(leftStats.getBoundingClientRect().width * 2, 0)
}

this.writeLog(this.encounter.desc.intro(this.world))

this.pickNext()
}
}


+ 3
- 0
src/game/combat.ts Bestand weergeven

@@ -2,6 +2,7 @@ import { Creature } from "./creature"
import { TextLike, DynText, ToBe, LiveText, PairLineArgs, PairLine } from './language'
import { LogEntry, LogLines, FAElem, LogLine, FormatEntry, FormatOpt, PropElem, nilLog } from './interface'
import { Resistances } from './entity'
import { World } from './world'

export enum DamageType {
Pierce = "Pierce",
@@ -534,7 +535,9 @@ export abstract class StatusEffect extends Effective implements VisibleStatus {

export type EncounterDesc = {
name: TextLike;
intro: (world: World) => LogEntry;
}

/**
* An Encounter describes a fight: who is in it and whose turn it is
*/


+ 12
- 6
src/game/maps/town.ts Bestand weergeven

@@ -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 { Encounter, Stat, Damage, DamageType, Vigor } from '../combat'
import * as Creatures from '../creatures'
@@ -95,7 +95,10 @@ export const Town = (): Place => {
"yolo",
(world, executor) => {
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()]
)

@@ -110,7 +113,10 @@ export const Town = (): Place => {
"yolo",
(world, executor) => {
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()]
)

@@ -121,15 +127,15 @@ export const Town = (): Place => {

const bossEncounters = [
new Encounter(
{ name: "Withers & Kenzie" },
{ name: "Withers & Kenzie", intro: (world: World) => nilLog },
makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()])
),
new Encounter(
{ name: "Goldeneye" },
{ name: "Goldeneye", intro: (world: World) => nilLog },
makeParty().concat([new Creatures.Goldeneye()])
),
new Encounter(
{ name: "Large Wah" },
{ name: "Large Wah", intro: (world: World) => nilLog },
makeParty().concat([new Creatures.Shingo()])
)
]


Laden…
Annuleren
Opslaan