chapter 4 ui

main
Yanick Champoux 2023-01-15 15:05:59 -05:00
parent bf23443f3a
commit 3e9ceddb48
5 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,6 @@
const api = genApi();
setContext('api', api);
console.log('api set, sucka');
const routes = {
// Exact path

View File

@ -33,7 +33,9 @@
<AdditionalCharacter
on:change={changeCity}
selection={city.selection}
choices={city.choices}
choices={status !== 'ongoing'
? []
: city.choices.filter((c) => c !== city.selection)}
/>
{/if}
</dd>

View File

@ -4,7 +4,7 @@
???
{:else}
<a href={`#/campaign/${campaignId}/battle/${id}`}>
Battle of {city}</a
Battle of {typeof city === 'string' ? city : city.selection}</a
><span>, {status}</span>
{/if}
</p>

View File

@ -9,7 +9,7 @@ const seedCampaign = {
export function updateBattle(campaign, battleId, status) {
const battle = campaign.battles[battleId - 1];
if (status === 'lost' && battle.wave == 1) {
if (status === 'lost' && (battle.wave == 1 || battle.id < 7)) {
return u.updateIn(campaign, `battles.${battleId - 1}`, {
wave: 2,
});

View File

@ -112,7 +112,7 @@ export function genChapter4Battle(battles) {
.slice(0, 6)
.filter(({ status }) => status !== 'lost')
.map(R.prop('city')),
battles.slice(6).map((b) => b.city.selection),
battles.slice(6).map((b) => b.city?.selection),
);
const characters = battles.slice(0, 6).map(R.prop('character'));