|
@@ -4,9 +4,10 @@
|
|
|
import { onMount } from 'svelte';
|
|
|
import Select from '../Select.svelte';
|
|
|
import { newGame } from './game';
|
|
|
- import { enumProfessions } from './profession';
|
|
|
+ import { applyProfession, enumProfessions } from './profession';
|
|
|
import { enumSkills } from './skill';
|
|
|
import Stats from './Stats.svelte';
|
|
|
+ import Skills from './Skills.svelte';
|
|
|
|
|
|
let { game } = $props();
|
|
|
|
|
@@ -22,6 +23,7 @@
|
|
|
const professions = enumProfessions();
|
|
|
const skills = enumSkills();
|
|
|
|
|
|
+ let professionIx = $state(0);
|
|
|
let selectedProfession = $state(professions[0]);
|
|
|
|
|
|
// skip char-creation (for debug purposes)
|
|
@@ -43,12 +45,15 @@
|
|
|
addComponent(game0.world, Name, game0.pc, {
|
|
|
name: playerName,
|
|
|
});
|
|
|
+ applyProfession(game0.world, game0.pc, professions[professionIx]);
|
|
|
+ // NOTE: line below doesn't work because of Svelte reactivity conflict with bitECS
|
|
|
+ /* applyProfession(game0.world, game0.pc, selectedProfession); */
|
|
|
game = game0;
|
|
|
};
|
|
|
|
|
|
const finishCharacter = () => {
|
|
|
/*
|
|
|
- if (freePoints > 0) {
|
|
|
+ if (freeStatPoints > 0) {
|
|
|
error = 'Free stat points left!';
|
|
|
return;
|
|
|
}
|
|
@@ -62,18 +67,13 @@
|
|
|
<input bind:this={charNameWidget} bind:value={playerName} /> the {selectedProfession.name}
|
|
|
<div>
|
|
|
<h3>Profession</h3>
|
|
|
- <Select options={professions} bind:value={selectedProfession} />
|
|
|
+ <Select options={professions} bind:value={selectedProfession} bind:index={professionIx} />
|
|
|
</div>
|
|
|
<div>
|
|
|
<h3>Hobby</h3>
|
|
|
</div>
|
|
|
<Stats game={game0} bind:tick />
|
|
|
- <div>
|
|
|
- <h3>Skills</h3>
|
|
|
- {#each skills as [name, skill]}
|
|
|
- {name}
|
|
|
- {/each}
|
|
|
- </div>
|
|
|
+ <Skills game={game0} bind:tick />
|
|
|
<div>{error}</div>
|
|
|
<button onclick={finishCharacter}>Ok</button>
|
|
|
</section>
|