small fix

This commit is contained in:
Viktor Rådberg
2023-07-06 23:01:19 +02:00
parent 2ddf58f3d7
commit e98d7d5e67
3 changed files with 13 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ import './App.css';
import Counters from './Components/Counters/Counters'; import Counters from './Components/Counters/Counters';
import styled from 'styled-components'; import styled from 'styled-components';
import { Player } from './Types/Player'; import { Player } from './Types/Player';
import { initialPlayers } from './Data/initialPlayers'; import { initialPlayers } from './Data/getInitialPlayers';
const MainWrapper = styled.div` const MainWrapper = styled.div`
width: 100vmax; width: 100vmax;

View File

@@ -22,10 +22,10 @@ export const CenteredText = styled.div`
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 5vmin; font-size: 7vmin;
font-weight: bold; font-weight: bold;
text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, -webkit-text-stroke: 2px #ffffff; /* Add a 2-pixel black stroke */
1px 1px 0 #ffffff; -webkit-text-fill-color: #000000;
color: #000000; color: #000000;
user-select: none; user-select: none;
-webkit-touch-callout: none; -webkit-touch-callout: none;

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Player } from '../../Types/Player'; import { Player } from '../../Types/Player';
import * as S from './PlayerMenu.style'; import * as S from './PlayerMenu.style';
import { initialPlayers } from '../../Data/initialPlayers'; import { initialPlayers } from '../../Data/getInitialPlayers';
type SettingsProps = { type SettingsProps = {
player: Player; player: Player;
@@ -40,14 +40,15 @@ const Settings = ({ player, opponents, onChange }: SettingsProps) => {
opponents.forEach((opponent) => { opponents.forEach((opponent) => {
// Only reset commander damage from the player that is being reset // Only reset commander damage from the player that is being reset
opponent.commanderDamage.forEach((commanderDamage) => { opponent.commanderDamage.forEach((commanderDamage) => {
if (commanderDamage.source === player.key) { if (commanderDamage.source !== player.key) {
opponent.lifeTotal = return;
opponent.lifeTotal +
commanderDamage.damageTotal +
commanderDamage.partnerDamageTotal;
commanderDamage.damageTotal = 0;
commanderDamage.partnerDamageTotal = 0;
} }
opponent.lifeTotal =
opponent.lifeTotal +
commanderDamage.damageTotal +
commanderDamage.partnerDamageTotal;
commanderDamage.damageTotal = 0;
commanderDamage.partnerDamageTotal = 0;
}); });
onChange(opponent); onChange(opponent);
}); });
@@ -56,9 +57,7 @@ const Settings = ({ player, opponents, onChange }: SettingsProps) => {
}; };
const handleNewGame = () => { const handleNewGame = () => {
//remove local storage
localStorage.removeItem('players'); localStorage.removeItem('players');
//reload page
window.location.reload(); window.location.reload();
}; };