From 89a91bb4ca790c6e9ff3ab742518768e1d295874 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Fri, 7 Aug 2020 16:02:50 -0400 Subject: [PATCH] Auto-select the default AI for a creature when creating its statblock --- src/components/Statblock.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Statblock.vue b/src/components/Statblock.vue index 112140d..891ca45 100644 --- a/src/components/Statblock.vue +++ b/src/components/Statblock.vue @@ -60,7 +60,7 @@ - @@ -71,7 +71,7 @@ import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator' import { Creature } from '@/game/creature' import { POV } from '@/game/language' -import { NoAI, RandomAI, VoreAI } from '@/game/ai' +import { NoAI, RandomAI, VoreAI, AI } from '@/game/ai' import { Stats, Stat, StatIcons, StatDescs, Vigor, VigorIcons, VigorDescs, VoreStatDescs, VoreStatIcons, VisibleStatus } from '@/game/combat' import ContainerView from './ContainerView.vue' import tippy, { delegate, createSingleton } from 'tippy.js' @@ -156,6 +156,10 @@ export default class Statblock extends Vue { createSingleton(tippyInstances, { delay: 500, touch: ["hold", 500] }) this.statusChanged([]) + + const picker = this.$el.querySelector(".ai-picker") as HTMLSelectElement + console.log(this.$data.ais.indexOf(this.subject.ai)) + picker.selectedIndex = this.$data.ais.findIndex((ai: AI) => ai.name === this.subject.ai.name) } }