Commit 24e11c58 authored by Maxime FRIESS's avatar Maxime FRIESS 💙
Browse files

Merge branch 'ui-clean' into 'master'

Fix #29 #30

Closes #30 and #29

See merge request le-jeu/t432_las21_t3_b!34
parents f5bf12bc f8ddb29c
Pipeline #68893 passed with stages
in 13 minutes and 19 seconds
...@@ -12,7 +12,7 @@ export const calcScore = (effects: EndEffect[], currentRep: number): number => { ...@@ -12,7 +12,7 @@ export const calcScore = (effects: EndEffect[], currentRep: number): number => {
const reputation: EndEffect = effects.find((e) => e.name === 'reputation') as EndEffect; const reputation: EndEffect = effects.find((e) => e.name === 'reputation') as EndEffect;
const diff = (difficulty.value + 69) / 240; const diff = (difficulty.value + 69) / 240;
const r = (reputation.value + currentRep) / 500; const r = Math.max(Math.min(reputation.value + currentRep, 500), 0) / 500;
const base = -200 * (r + 0.05) * (diff - r) * (diff - r) + r; const base = -200 * (r + 0.05) * (diff - r) * (diff - r) + r;
const lowbonus = Math.min((1 - r) / 2, 1); const lowbonus = Math.min((1 - r) / 2, 1);
const dangermalus = (danger.value / 80) * (-4 * (r - 0.5) * (r - 0.5) + 1); const dangermalus = (danger.value / 80) * (-4 * (r - 0.5) * (r - 0.5) + 1);
......
...@@ -93,7 +93,7 @@ export const Done: FC = () => { ...@@ -93,7 +93,7 @@ export const Done: FC = () => {
<div style={{ width: '20vw' }}> <div style={{ width: '20vw' }}>
<Progress percent={globalPop / 5} /> <Progress percent={globalPop / 5} />
</div> </div>
<div style={{ fontSize: '32px', marginTop: '0.5em', marginBottom: '0.5em' }}>{globalPop}/500</div> <div style={{ fontSize: '32px', marginTop: '0.5em', marginBottom: '0.5em' }}>{Math.round(globalPop)}/500</div>
{runs.map((run: Run, index: number) => { {runs.map((run: Run, index: number) => {
return ( return (
<div <div
......
...@@ -61,7 +61,7 @@ export const Start = () => { ...@@ -61,7 +61,7 @@ export const Start = () => {
<div style={{ width: '20vw' }}> <div style={{ width: '20vw' }}>
<Progress percent={globalPop / 5} /> <Progress percent={globalPop / 5} />
</div> </div>
<div style={{ fontSize: '32px', marginTop: '0.5em' }}>{globalPop}/500</div> <div style={{ fontSize: '32px', marginTop: '0.5em' }}>{Math.round(globalPop)}/500</div>
</div> </div>
</PlayContainerMid> </PlayContainerMid>
<PlayContainerBot> <PlayContainerBot>
......
...@@ -67,6 +67,7 @@ export const appReducer: Reducer = (state: AppState = JSON.parse(JSON.stringify( ...@@ -67,6 +67,7 @@ export const appReducer: Reducer = (state: AppState = JSON.parse(JSON.stringify(
break; break;
case 'state/reputation': case 'state/reputation':
state.stats.reputation += action.reputation; state.stats.reputation += action.reputation;
state.stats.reputation = Math.max(Math.min(state.stats.reputation, 500), 0);
break; break;
case 'game/end': case 'game/end':
state.current_effects = action.effects; state.current_effects = action.effects;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment