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 styled from 'styled-components';
import { Player } from './Types/Player';
import { initialPlayers } from './Data/initialPlayers';
import { initialPlayers } from './Data/getInitialPlayers';
const MainWrapper = styled.div`
width: 100vmax;

View File

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

View File

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