Skip to content

Commit

Permalink
Fix ability links.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Oct 25, 2024
1 parent 3639fe2 commit cb9bce7
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
23 changes: 23 additions & 0 deletions src/gamecore/AbilityLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { inject } from 'vue';
defineProps<{abilityName:string|{Value:string}}>()
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
<template v-if="typeof(abilityName) == 'string'">
<RouterLink v-if="abilityName" :to="createAbilityRoute(abilityName)">
<em>{{ abilityName }}</em>
</RouterLink>
</template>
<template v-else-if="typeof(abilityName) == 'object'">
<RouterLink v-if="abilityName.Value" :to="createAbilityRoute(abilityName.Value)">
<em>{{ abilityName.Value }}</em>
</RouterLink>
</template>
</template>

<style scoped>
</style>
8 changes: 2 additions & 6 deletions src/gamecore/tasks/AddStageAbilityByName.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<script setup lang="ts">
import { inject } from 'vue';
import { GamecoreTask, } from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import AbilityLink from '../AbilityLink.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
StageAbilityName:string
}
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
<BlockLayout :source="node">

Add ability
<RouterLink :to="createAbilityRoute(node.StageAbilityName)">
<em>{{ node.StageAbilityName }}</em>
</RouterLink>
<AbilityLink :abilityName="node.StageAbilityName" />
to the stage

</BlockLayout>
Expand Down
8 changes: 2 additions & 6 deletions src/gamecore/tasks/OwnerEntityAddAbility.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<script setup lang="ts">
import { inject } from 'vue';
import { GamecoreTask, } from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import AbilityLink from '../AbilityLink.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
AbilityName:string
}
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
<BlockLayout :source="node">

Add ability
<RouterLink :to="createAbilityRoute(node.AbilityName)">
<em>{{ node.AbilityName }}</em>
</RouterLink>
<AbilityLink :abilityName="node.AbilityName" />
to the ability owner

</BlockLayout>
Expand Down
8 changes: 2 additions & 6 deletions src/gamecore/tasks/TriggerAbility.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { inject } from 'vue';
import { GamecoreTask, GamecoreTargetType, } from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateTargetType from '../EvaluateTargetType.vue';
import AbilityLink from '../AbilityLink.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
Expand All @@ -11,8 +11,6 @@
AbilityInherentTargetType?:GamecoreTargetType
AbilityName:string
}
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
Expand All @@ -24,9 +22,7 @@
</template>

ability
<RouterLink :to="createAbilityRoute(node.AbilityName)">
<em>{{ node.AbilityName }}</em>
</RouterLink>
<AbilityLink :abilityName="node.AbilityName" />

<template v-if="node.AbilityInherentTargetType">
targeting <em><EvaluateTargetType :target="node.AbilityInherentTargetType" /></em>
Expand Down
8 changes: 2 additions & 6 deletions src/gamecore/tasks/TurnInsertAbility.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { inject } from 'vue';
import { GamecoreTask, GamecoreTargetType, } from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateTargetType from '../EvaluateTargetType.vue';
import AnyTask from '../AnyTask.vue';
import AbilityLink from '../AbilityLink.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
Expand All @@ -16,17 +16,13 @@
ShowInActionBar:boolean
PreCheck?:GamecoreTask
}
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
<BlockLayout :source="node">

Insert ability
<RouterLink :to="createAbilityRoute(node.AbilityName)">
<em>{{ node.AbilityName }}</em>
</RouterLink>
<AbilityLink :abilityName="node.AbilityName" />
<template v-if="node.TargetType">
for <em><EvaluateTargetType :target="node.TargetType" /></em>
</template>
Expand Down
10 changes: 4 additions & 6 deletions src/gamecore/tasks/TurnInsertAction.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { inject } from 'vue';
import { GamecoreTask, GamecoreTargetType, } from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateTargetType from '../EvaluateTargetType.vue';
import AbilityLink from '../AbilityLink.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
Expand All @@ -15,17 +15,15 @@
CanInsertUltraSkill?:boolean
SkillTypeWhenDelayed?:string
}
const createAbilityRoute = inject<(key:string) => object>('createAbilityRoute') as (key:string) => object
</script>

<template>
<BlockLayout :source="node">

Insert extra turn action
<RouterLink v-if="node.PrepareAbilityName" :to="createAbilityRoute(node.PrepareAbilityName)">
with ability <em>{{ node.PrepareAbilityName }}</em>
</RouterLink>
<template v-if="node.PrepareAbilityName">
with ability <AbilityLink :abilityName="node.PrepareAbilityName" />
</template>
<template v-if="node.TargetType">
for <em><EvaluateTargetType :target="node.TargetType" /></em>
</template>
Expand Down

0 comments on commit cb9bce7

Please sign in to comment.