Skip to content

Commit

Permalink
Load AI factors from characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Aug 13, 2024
1 parent 6f32223 commit c042b97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/sources/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Avatar } from './avatar';
import { Monster } from './monster';
import { DynamicValues } from './gamecore';
import { BattleEvent } from './battleevent';
import { AIFactorGroup } from './autofactorgroup';

export interface CharacterSkillAIWeightGroup
{
Expand Down Expand Up @@ -58,6 +59,10 @@ export interface Character
[hash: number]: {}
}
}
GlobalAIFactorGroups:
{
[key:string]: AIFactorGroup
}
}

export async function getCharacterByAvatar(commitId:string, avatar:Avatar) : Promise<Character|undefined>
Expand Down
4 changes: 2 additions & 2 deletions src/views/aside/AvatarAI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@

<template v-if="skill.ComplexSkillAIPreCheck">
<h3>Precheck Weights</h3>
<AIWeights :weightData="skill.ComplexSkillAIPreCheck" />
<AIWeights :weightData="skill.ComplexSkillAIPreCheck" :character="character" />
</template>

<template v-if="skill.ComplexSkillAI">
<h3>Weights</h3>
<AIWeights :weightData="skill.ComplexSkillAI" />
<AIWeights :weightData="skill.ComplexSkillAI" :character="character" />
</template>

<div class="minor" v-if="skill.AIUltraSkillPriority">
Expand Down
6 changes: 3 additions & 3 deletions src/views/aside/components/AIWeight.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup lang="ts">
import { ref, inject, } from 'vue';
import { cleanupNumber } from '@/common/common';
import { CharacterSkillAIWeightGroup } from '@/sources/character';
import { Character, CharacterSkillAIWeightGroup } from '@/sources/character';
import { AIFactorGroup, getAIFactorGroup } from '@/sources/autofactorgroup';
import AnyTask from '@/gamecore/AnyTask.vue';
import FoldableLayout from '@/components/FoldableLayout.vue';
const props = defineProps<{weightGroup:CharacterSkillAIWeightGroup}>()
const props = defineProps<{character:Character, weightGroup:CharacterSkillAIWeightGroup}>()
const commitId = inject<string>('commitId') as string
const aiFactorGroup = ref<AIFactorGroup>(await getAIFactorGroup(commitId, props.weightGroup.GroupName))
const aiFactorGroup = ref<AIFactorGroup>(props.character?.GlobalAIFactorGroups?.[props.weightGroup.GroupName] ?? await getAIFactorGroup(commitId, props.weightGroup.GroupName))
</script>

<template>
Expand Down
6 changes: 3 additions & 3 deletions src/views/aside/components/AIWeights.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup lang="ts">
import { cleanupNumber } from '@/common/common';
import { CharacterSkillAIWeightData } from '@/sources/character';
import { Character, CharacterSkillAIWeightData } from '@/sources/character';
import AIWeight from './AIWeight.vue';
defineProps<{weightData:CharacterSkillAIWeightData}>()
defineProps<{character:Character, weightData:CharacterSkillAIWeightData}>()
</script>

<template>
<ul>
<li v-for="weightGroup in weightData?.Groups">
<AIWeight :weightGroup="weightGroup" />
<AIWeight :weightGroup="weightGroup" :character="character" />
</li>
</ul>
<div class="minor" v-if="weightData?.SkillBasicPower">
Expand Down

0 comments on commit c042b97

Please sign in to comment.