change yellow for orange

This commit is contained in:
Yanick Champoux 2023-01-16 11:55:30 -05:00
parent 4657b83fd6
commit c1e3708b87
3 changed files with 16 additions and 10 deletions

View File

@ -64,7 +64,7 @@
/> />
<div class="medium-divider" /> <div class="medium-divider" />
<Battle <Battle
{...battles[4] ?? { id: 'notYet' }} {...battles[5] ?? { id: 'notYet' }}
{campaignId} {campaignId}
chapter={3} chapter={3}
chapterBattle={2} chapterBattle={2}

View File

@ -8,7 +8,7 @@
> >
<div> <div>
{#if status === 'ongoing' && wave == 2} {#if status === 'ongoing' && wave == 2}
<i style="color: yellow">mood_bad</i> <i class="orange-text">mood_bad</i>
{:else if status === 'ongoing' && wave == 1} {:else if status === 'ongoing' && wave == 1}
<i style="color: blue">sentiment_neutral</i> <i style="color: blue">sentiment_neutral</i>
{:else if status === 'lost'} {:else if status === 'lost'}

View File

@ -25,20 +25,26 @@ function campaignStatus(campaign) {
} }
function calculateScore(campaign) { function calculateScore(campaign) {
return [ const values = [
// -campaign.battles.slice(0, 6).filter(({ wave }) => wave === 2).length, -campaign.battles.slice(0, 6).filter(({ wave }) => wave === 2).length,
// -campaign.battles.slice(6).filter(({ status }) => status === 'lost') -campaign.battles.slice(6).filter(({ status }) => status === 'lost')
// .length, .length,
...campaign.battles.map(({ difficulty }) => parseInt(difficulty)), ...campaign.battles
].reduce((a, b) => a + b, 0); .map(({ difficulty }) => parseInt(difficulty))
.map((x) => (Number.isNaN(x) ? 0 : x)),
];
console.log(values);
return values.reduce((a, b) => a + b, 0);
} }
export function updateBattle(campaign, battleId, status) { export function updateBattle(campaign, battleId, status) {
const battle = campaign.battles[battleId - 1]; const battle = campaign.battles[battleId - 1];
if (status === 'lost' && (battle.wave == 1 || battle.id < 7)) { if (status === 'lost' && battle.wave == 1 && battle.id < 7) {
return u.updateIn(campaign, `battles.${battleId - 1}`, { campaign = u.updateIn(campaign, `battles.${battleId - 1}`, {
wave: 2, wave: 2,
}); });
campaign = u.updateIn(campaign, 'score', calculateScore(campaign));
return campaign;
} }
campaign = u.updateIn(campaign, `battles.${battleId - 1}`, { campaign = u.updateIn(campaign, `battles.${battleId - 1}`, {
status, status,