2021-08-14 21:37:30 -04:00
|
|
|
<script lang="ts">
|
2021-08-23 14:26:25 -04:00
|
|
|
import { createEventDispatcher } from "svelte";
|
2021-08-14 21:37:30 -04:00
|
|
|
import { Card, CardHeader, CardTitle, CardBody, CardSubtitle, CardText, CardFooter, Container, Row, Icon } from "sveltestrap";
|
|
|
|
|
import { capitalize } from "lodash";
|
|
|
|
|
|
2021-08-23 14:26:25 -04:00
|
|
|
import { Dungeon, rollDungeon } from "../rollers/dungeons";
|
|
|
|
|
import CardButtons from "./CardTitleButtons.svelte";
|
|
|
|
|
import { RerolledEvent } from "../types/RerolledEvent";
|
2021-08-14 21:37:30 -04:00
|
|
|
|
2021-08-23 14:26:25 -04:00
|
|
|
const dispatch = createEventDispatcher();
|
2021-08-14 21:37:30 -04:00
|
|
|
export let dungeon: Dungeon;
|
|
|
|
|
export let timestamp;
|
|
|
|
|
|
2021-08-23 14:26:25 -04:00
|
|
|
function reroll() {
|
|
|
|
|
dungeon = rollDungeon();
|
|
|
|
|
dispatch("rerolled", new RerolledEvent("dungeon", dungeon));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function remove() {
|
|
|
|
|
dispatch("remove");
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-14 21:37:30 -04:00
|
|
|
function getIcon(t: string, c: string): string {
|
|
|
|
|
return t == "discovery"
|
|
|
|
|
? "eye-fill"
|
|
|
|
|
: t == "danger"
|
|
|
|
|
? "exclamation-triangle-fill"
|
|
|
|
|
: c == "mundane"
|
|
|
|
|
? "exclamation-triangle"
|
|
|
|
|
: c == "unusual"
|
|
|
|
|
? "exclamation-square"
|
|
|
|
|
: c == "extraordinary"
|
|
|
|
|
? "exclamation-octagon"
|
|
|
|
|
: "";
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
|
<Card class="mb-3">
|
|
|
|
|
<CardHeader>
|
2021-08-23 14:26:25 -04:00
|
|
|
<CardTitle>
|
|
|
|
|
<div class="title">
|
|
|
|
|
<div class="description">
|
|
|
|
|
Dungeon:
|
|
|
|
|
{capitalize(dungeon.size.description)}
|
|
|
|
|
{dungeon.function.description} built by {dungeon.builder.description}
|
|
|
|
|
</div>
|
|
|
|
|
<CardButtons data={dungeon} dataType="dungeon" on:reroll={reroll} on:remove={remove} />
|
|
|
|
|
</div>
|
|
|
|
|
</CardTitle>
|
2021-08-14 21:37:30 -04:00
|
|
|
</CardHeader>
|
|
|
|
|
<CardBody>
|
|
|
|
|
<CardSubtitle>
|
|
|
|
|
Fell to ruination from <em>{dungeon.ruination.description}</em>.
|
|
|
|
|
</CardSubtitle>
|
|
|
|
|
<CardText>
|
|
|
|
|
<Container>
|
|
|
|
|
<Row>
|
|
|
|
|
<strong>Common Themes ({dungeon.size.commonThemes}):</strong>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each dungeon.commonThemes as theme}
|
|
|
|
|
<li><Icon name={getIcon("theme", theme.category)} /> {theme.category}: {theme.description}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<strong>Unique Themes ({dungeon.size.uniqueThemes}):</strong>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each dungeon.uniqueThemes as theme}
|
|
|
|
|
<li><Icon name={getIcon("theme", theme.category)} /> {theme.category}: {theme.description}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<strong>Common Areas ({dungeon.size.commonAreas}):</strong>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each dungeon.commonAreas as area}
|
|
|
|
|
<li><Icon name={getIcon(area.type, area.category)} /> {area.type}/{area.category}: {area.description}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<strong>Unique Areas ({dungeon.size.uniqueAreas}):</strong>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each dungeon.uniqueAreas as area}
|
|
|
|
|
<li><Icon name={getIcon(area.type, area.category)} /> {area.type}/{area.category}: {area.description}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</Row>
|
|
|
|
|
</Container>
|
|
|
|
|
</CardText>
|
|
|
|
|
</CardBody>
|
2021-08-23 14:26:25 -04:00
|
|
|
{#if timestamp}
|
|
|
|
|
<CardFooter>{timestamp}</CardFooter>
|
|
|
|
|
{/if}
|
2021-08-14 21:37:30 -04:00
|
|
|
</Card>
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
main {
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
2021-08-23 14:26:25 -04:00
|
|
|
.title {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
2021-08-14 21:37:30 -04:00
|
|
|
ul {
|
|
|
|
|
margin-left: 2em;
|
|
|
|
|
}
|
|
|
|
|
</style>
|