mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-19 17:28:01 +00:00
commander damage in localstorage
This commit is contained in:
@@ -60,56 +60,61 @@ const VerticalSeperator = styled.div`
|
|||||||
|
|
||||||
type CommanderDamageBarProps = {
|
type CommanderDamageBarProps = {
|
||||||
lifeTotal: number;
|
lifeTotal: number;
|
||||||
setLifeTotal: (lifeTotal: number) => void;
|
|
||||||
opponents: Player[];
|
opponents: Player[];
|
||||||
|
player: Player;
|
||||||
|
onPlayerChange: (updatedPlayer: Player) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CommanderDamageBar = ({
|
const CommanderDamageBar = ({
|
||||||
opponents,
|
opponents,
|
||||||
lifeTotal,
|
lifeTotal,
|
||||||
setLifeTotal,
|
player,
|
||||||
|
onPlayerChange,
|
||||||
}: CommanderDamageBarProps) => {
|
}: CommanderDamageBarProps) => {
|
||||||
const [commanderDamage, setCommanderDamage] = useState<number[]>(
|
|
||||||
Array(opponents.length).fill(0)
|
|
||||||
);
|
|
||||||
const [partnerCommanderDamage, setPartnerCommanderDamage] = useState<
|
|
||||||
number[]
|
|
||||||
>(Array(opponents.length).fill(0));
|
|
||||||
|
|
||||||
const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);
|
const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);
|
||||||
const [timeoutFinished, setTimeoutFinished] = useState(false);
|
const [timeoutFinished, setTimeoutFinished] = useState(false);
|
||||||
const [hasPressedDown, setHasPressedDown] = useState(false);
|
const [hasPressedDown, setHasPressedDown] = useState(false);
|
||||||
|
|
||||||
const handleCommanderDamageChange = (index: number, increment: number) => {
|
const handleLifeChange = (updatedLifeTotal: number) => {
|
||||||
const currentCommanderDamage = commanderDamage[index];
|
const updatedPlayer = { ...player, lifeTotal: updatedLifeTotal };
|
||||||
if (currentCommanderDamage === 0 && increment === -1) {
|
onPlayerChange(updatedPlayer);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentCommanderDamage === 21 && increment === 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedCommanderDamage = [...commanderDamage];
|
|
||||||
updatedCommanderDamage[index] += increment;
|
|
||||||
setCommanderDamage(updatedCommanderDamage);
|
|
||||||
setLifeTotal(lifeTotal - increment);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePartnerCommanderDamageChange = (
|
const handleCommanderDamageChange = (
|
||||||
index: number,
|
index: number,
|
||||||
increment: number
|
increment: number,
|
||||||
|
isPartner: boolean
|
||||||
) => {
|
) => {
|
||||||
const currentPartnerCommanderDamage = partnerCommanderDamage[index];
|
const currentCommanderDamage = player.commanderDamage[index];
|
||||||
if (currentPartnerCommanderDamage === 0 && increment === -1) {
|
if (isPartner) {
|
||||||
|
if (currentCommanderDamage.partnerDamageTotal === 0 && increment === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatedPartnerCommanderDamage = [...partnerCommanderDamage];
|
const updatedCommanderDamage = [...player.commanderDamage];
|
||||||
updatedPartnerCommanderDamage[index] += increment;
|
updatedCommanderDamage[index].partnerDamageTotal += increment;
|
||||||
|
|
||||||
setPartnerCommanderDamage(updatedPartnerCommanderDamage);
|
const updatedPlayer = {
|
||||||
setLifeTotal(lifeTotal - increment);
|
...player,
|
||||||
|
commanderDamage: updatedCommanderDamage,
|
||||||
|
};
|
||||||
|
onPlayerChange(updatedPlayer);
|
||||||
|
handleLifeChange(lifeTotal - increment);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (currentCommanderDamage.damageTotal === 0 && increment === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedCommanderDamage = [...player.commanderDamage];
|
||||||
|
updatedCommanderDamage[index].damageTotal += increment;
|
||||||
|
|
||||||
|
const updatedPlayer = {
|
||||||
|
...player,
|
||||||
|
commanderDamage: updatedCommanderDamage,
|
||||||
|
};
|
||||||
|
onPlayerChange(updatedPlayer);
|
||||||
|
handleLifeChange(lifeTotal - increment);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownInput = (index: number) => {
|
const handleDownInput = (index: number) => {
|
||||||
@@ -117,7 +122,7 @@ const CommanderDamageBar = ({
|
|||||||
setHasPressedDown(true);
|
setHasPressedDown(true);
|
||||||
timeoutRef.current = setTimeout(() => {
|
timeoutRef.current = setTimeout(() => {
|
||||||
setTimeoutFinished(true);
|
setTimeoutFinished(true);
|
||||||
handleCommanderDamageChange(index, -1);
|
handleCommanderDamageChange(index, -1, false);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,7 +131,7 @@ const CommanderDamageBar = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearTimeout(timeoutRef.current);
|
clearTimeout(timeoutRef.current);
|
||||||
handleCommanderDamageChange(index, 1);
|
handleCommanderDamageChange(index, 1, false);
|
||||||
setHasPressedDown(false);
|
setHasPressedDown(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -141,7 +146,7 @@ const CommanderDamageBar = ({
|
|||||||
setHasPressedDown(true);
|
setHasPressedDown(true);
|
||||||
timeoutRef.current = setTimeout(() => {
|
timeoutRef.current = setTimeout(() => {
|
||||||
setTimeoutFinished(true);
|
setTimeoutFinished(true);
|
||||||
handlePartnerCommanderDamageChange(index, -1);
|
handleCommanderDamageChange(index, -1, true);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -150,7 +155,7 @@ const CommanderDamageBar = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearTimeout(timeoutRef.current);
|
clearTimeout(timeoutRef.current);
|
||||||
handlePartnerCommanderDamageChange(index, 1);
|
handleCommanderDamageChange(index, 1, true);
|
||||||
setHasPressedDown(false);
|
setHasPressedDown(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -178,7 +183,9 @@ const CommanderDamageBar = ({
|
|||||||
backgroundColor={opponent.color}
|
backgroundColor={opponent.color}
|
||||||
>
|
>
|
||||||
<CommanderDamageButtonText>
|
<CommanderDamageButtonText>
|
||||||
{commanderDamage[index] > 0 ? commanderDamage[index] : ''}
|
{player.commanderDamage[index].damageTotal > 0
|
||||||
|
? player.commanderDamage[index].damageTotal
|
||||||
|
: ''}
|
||||||
</CommanderDamageButtonText>
|
</CommanderDamageButtonText>
|
||||||
</CommanderDamageButton>
|
</CommanderDamageButton>
|
||||||
|
|
||||||
@@ -198,8 +205,8 @@ const CommanderDamageBar = ({
|
|||||||
backgroundColor={opponent.color}
|
backgroundColor={opponent.color}
|
||||||
>
|
>
|
||||||
<CommanderDamageButtonText>
|
<CommanderDamageButtonText>
|
||||||
{partnerCommanderDamage[index] > 0
|
{player.commanderDamage[index].partnerDamageTotal > 0
|
||||||
? partnerCommanderDamage[index]
|
? player.commanderDamage[index].partnerDamageTotal
|
||||||
: ''}
|
: ''}
|
||||||
</CommanderDamageButtonText>
|
</CommanderDamageButtonText>
|
||||||
</CommanderDamageButton>
|
</CommanderDamageButton>
|
||||||
|
|||||||
@@ -34,3 +34,10 @@ export const GridItemContainerFlipped = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const ExtraCountersGrid = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-grow: 1;
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|||||||
115
my-app/src/Components/Counters/ExtraCountersBar.tsx
Normal file
115
my-app/src/Components/Counters/ExtraCountersBar.tsx
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
import * as S from './Counters.style';
|
||||||
|
import { CounterType, Player } from '../../Types/Player';
|
||||||
|
import ExtraCounter from '../Buttons/ExtraCounter';
|
||||||
|
import CommanderTaxIcon from '../../Icons/CommanderTaxIcon';
|
||||||
|
import EnergyIcon from '../../Icons/EnergyIcon';
|
||||||
|
import ExperienceIcon from '../../Icons/ExperienceIcon';
|
||||||
|
import PoisonIcon from '../../Icons/PoisonIcon';
|
||||||
|
import PartnerTaxIcon from '../../Icons/PartnerTaxIcon';
|
||||||
|
|
||||||
|
type ExtraCountersBarProps = {
|
||||||
|
player: Player;
|
||||||
|
onPlayerChange: (updatedPlayer: Player) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ExtraCountersBar = ({
|
||||||
|
player,
|
||||||
|
onPlayerChange,
|
||||||
|
}: ExtraCountersBarProps) => {
|
||||||
|
const handleCounterChange = (
|
||||||
|
updatedCounterTotal: number,
|
||||||
|
type: CounterType
|
||||||
|
) => {
|
||||||
|
const existingCounter = player.extraCounters.find(
|
||||||
|
(counter) => counter.type === type
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!existingCounter) {
|
||||||
|
const newCounter = {
|
||||||
|
type,
|
||||||
|
value: updatedCounterTotal,
|
||||||
|
};
|
||||||
|
const updatedExtraCounters = [...player.extraCounters, newCounter];
|
||||||
|
const updatedPlayer = { ...player, extraCounters: updatedExtraCounters };
|
||||||
|
onPlayerChange(updatedPlayer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedExtraCounters = player.extraCounters.map((counter) => {
|
||||||
|
if (counter.type === type) {
|
||||||
|
return { ...counter, value: updatedCounterTotal };
|
||||||
|
}
|
||||||
|
return counter;
|
||||||
|
});
|
||||||
|
|
||||||
|
const updatedPlayer = { ...player, extraCounters: updatedExtraCounters };
|
||||||
|
onPlayerChange(updatedPlayer);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<S.ExtraCountersGrid>
|
||||||
|
{player.settings.useCommanderDamage && (
|
||||||
|
<ExtraCounter
|
||||||
|
Icon={<CommanderTaxIcon size="8vmin" />}
|
||||||
|
type={CounterType.CommanderTax}
|
||||||
|
counterTotal={
|
||||||
|
player.extraCounters?.find(
|
||||||
|
(counter) => counter.type === 'commanderTax'
|
||||||
|
)?.value
|
||||||
|
}
|
||||||
|
setCounterTotal={handleCounterChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{Boolean(
|
||||||
|
player.settings.useCommanderDamage && player.settings.usePartner
|
||||||
|
) && (
|
||||||
|
<ExtraCounter
|
||||||
|
Icon={<PartnerTaxIcon size="8vmin" />}
|
||||||
|
type={CounterType.PartnerTax}
|
||||||
|
counterTotal={
|
||||||
|
player.extraCounters?.find(
|
||||||
|
(counter) => counter.type === 'partnerTax'
|
||||||
|
)?.value
|
||||||
|
}
|
||||||
|
setCounterTotal={handleCounterChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{player.settings.usePoison && (
|
||||||
|
<ExtraCounter
|
||||||
|
Icon={<PoisonIcon size="8vmin" />}
|
||||||
|
type={CounterType.Poison}
|
||||||
|
counterTotal={
|
||||||
|
player.extraCounters?.find((counter) => counter.type === 'poison')
|
||||||
|
?.value
|
||||||
|
}
|
||||||
|
setCounterTotal={handleCounterChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{player.settings.useEnergy && (
|
||||||
|
<ExtraCounter
|
||||||
|
Icon={<EnergyIcon size="8vmin" />}
|
||||||
|
type={CounterType.Energy}
|
||||||
|
counterTotal={
|
||||||
|
player.extraCounters?.find((counter) => counter.type === 'energy')
|
||||||
|
?.value
|
||||||
|
}
|
||||||
|
setCounterTotal={handleCounterChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{player.settings.useExperience && (
|
||||||
|
<ExtraCounter
|
||||||
|
Icon={<ExperienceIcon size="8vmin" />}
|
||||||
|
type={CounterType.Experience}
|
||||||
|
counterTotal={
|
||||||
|
player.extraCounters?.find(
|
||||||
|
(counter) => counter.type === 'experience'
|
||||||
|
)?.value
|
||||||
|
}
|
||||||
|
setCounterTotal={handleCounterChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</S.ExtraCountersGrid>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ExtraCountersBar;
|
||||||
@@ -51,10 +51,3 @@ export const LifeCounterText = styled.p`
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ExtraCountersGrid = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-grow: 1;
|
|
||||||
width: 100%;
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import * as S from './LifeCounter.style';
|
import * as S from './LifeCounter.style';
|
||||||
import { CounterType, Player } from '../../Types/Player';
|
import { CounterType, Player } from '../../Types/Player';
|
||||||
import { useSwipeable } from 'react-swipeable';
|
import { useSwipeable } from 'react-swipeable';
|
||||||
@@ -6,14 +6,8 @@ import AddLifeButton from '../Buttons/AddLifeButton';
|
|||||||
import SubtractLifeButton from '../Buttons/SubtractLifeButton';
|
import SubtractLifeButton from '../Buttons/SubtractLifeButton';
|
||||||
import CommanderDamageBar from '../Buttons/CommanderDamageBar';
|
import CommanderDamageBar from '../Buttons/CommanderDamageBar';
|
||||||
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
||||||
|
|
||||||
import ExtraCounter from '../Buttons/ExtraCounter';
|
|
||||||
import CommanderTaxIcon from '../../Icons/CommanderTaxIcon';
|
|
||||||
import EnergyIcon from '../../Icons/EnergyIcon';
|
|
||||||
import ExperienceIcon from '../../Icons/ExperienceIcon';
|
|
||||||
import PoisonIcon from '../../Icons/PoisonIcon';
|
|
||||||
import PartnerTaxIcon from '../../Icons/PartnerTaxIcon';
|
|
||||||
import SettingsButton from '../Buttons/SettingsButton';
|
import SettingsButton from '../Buttons/SettingsButton';
|
||||||
|
import ExtraCountersBar from '../Counters/ExtraCountersBar';
|
||||||
|
|
||||||
type LifeCounterProps = {
|
type LifeCounterProps = {
|
||||||
player: Player;
|
player: Player;
|
||||||
@@ -33,36 +27,6 @@ const LifeCounter = ({
|
|||||||
onPlayerChange(updatedPlayer);
|
onPlayerChange(updatedPlayer);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCounterChange = (
|
|
||||||
updatedCounterTotal: number,
|
|
||||||
type: CounterType
|
|
||||||
) => {
|
|
||||||
const existingCounter = player.extraCounters.find(
|
|
||||||
(counter) => counter.type === type
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!existingCounter) {
|
|
||||||
const newCounter = {
|
|
||||||
type: type,
|
|
||||||
value: updatedCounterTotal,
|
|
||||||
};
|
|
||||||
const updatedExtraCounters = [...player.extraCounters, newCounter];
|
|
||||||
const updatedPlayer = { ...player, extraCounters: updatedExtraCounters };
|
|
||||||
onPlayerChange(updatedPlayer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedExtraCounters = player.extraCounters.map((counter) => {
|
|
||||||
if (counter.type === type) {
|
|
||||||
return { ...counter, value: updatedCounterTotal };
|
|
||||||
}
|
|
||||||
return counter;
|
|
||||||
});
|
|
||||||
|
|
||||||
const updatedPlayer = { ...player, extraCounters: updatedExtraCounters };
|
|
||||||
onPlayerChange(updatedPlayer);
|
|
||||||
};
|
|
||||||
|
|
||||||
const [showPlayerMenu, setShowPlayerMenu] = useState(false);
|
const [showPlayerMenu, setShowPlayerMenu] = useState(false);
|
||||||
|
|
||||||
const swipeHandlers = useSwipeable({
|
const swipeHandlers = useSwipeable({
|
||||||
@@ -77,8 +41,9 @@ const LifeCounter = ({
|
|||||||
<S.LifeCounterContentContainer {...swipeHandlers}>
|
<S.LifeCounterContentContainer {...swipeHandlers}>
|
||||||
<CommanderDamageBar
|
<CommanderDamageBar
|
||||||
lifeTotal={player.lifeTotal}
|
lifeTotal={player.lifeTotal}
|
||||||
setLifeTotal={handleLifeChange}
|
|
||||||
opponents={opponents}
|
opponents={opponents}
|
||||||
|
player={player}
|
||||||
|
onPlayerChange={onPlayerChange}
|
||||||
/>
|
/>
|
||||||
<SettingsButton
|
<SettingsButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -96,72 +61,8 @@ const LifeCounter = ({
|
|||||||
setLifeTotal={handleLifeChange}
|
setLifeTotal={handleLifeChange}
|
||||||
/>
|
/>
|
||||||
</S.LifeCountainer>
|
</S.LifeCountainer>
|
||||||
<S.ExtraCountersGrid>
|
<ExtraCountersBar player={player} onPlayerChange={onPlayerChange} />
|
||||||
{player.settings.useCommanderDamage && (
|
|
||||||
<ExtraCounter
|
|
||||||
Icon={<CommanderTaxIcon size="8vmin" />}
|
|
||||||
type={CounterType.CommanderTax}
|
|
||||||
counterTotal={
|
|
||||||
player.extraCounters?.find(
|
|
||||||
(counter) => counter.type === 'commanderTax'
|
|
||||||
)?.value
|
|
||||||
}
|
|
||||||
setCounterTotal={handleCounterChange}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{Boolean(
|
|
||||||
player.settings.useCommanderDamage && player.settings.usePartner
|
|
||||||
) && (
|
|
||||||
<ExtraCounter
|
|
||||||
Icon={<PartnerTaxIcon size="8vmin" />}
|
|
||||||
type={CounterType.PartnerTax}
|
|
||||||
counterTotal={
|
|
||||||
player.extraCounters?.find(
|
|
||||||
(counter) => counter.type === 'partnerTax'
|
|
||||||
)?.value
|
|
||||||
}
|
|
||||||
setCounterTotal={handleCounterChange}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{player.settings.usePoison && (
|
|
||||||
<ExtraCounter
|
|
||||||
Icon={<PoisonIcon size="8vmin" />}
|
|
||||||
type={CounterType.Poison}
|
|
||||||
counterTotal={
|
|
||||||
player.extraCounters?.find(
|
|
||||||
(counter) => counter.type === 'poison'
|
|
||||||
)?.value
|
|
||||||
}
|
|
||||||
setCounterTotal={handleCounterChange}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{player.settings.useEnergy && (
|
|
||||||
<ExtraCounter
|
|
||||||
Icon={<EnergyIcon size="8vmin" />}
|
|
||||||
type={CounterType.Energy}
|
|
||||||
counterTotal={
|
|
||||||
player.extraCounters?.find(
|
|
||||||
(counter) => counter.type === 'energy'
|
|
||||||
)?.value
|
|
||||||
}
|
|
||||||
setCounterTotal={handleCounterChange}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{player.settings.useExperience && (
|
|
||||||
<ExtraCounter
|
|
||||||
Icon={<ExperienceIcon size="8vmin" />}
|
|
||||||
type={CounterType.Experience}
|
|
||||||
counterTotal={
|
|
||||||
player.extraCounters?.find(
|
|
||||||
(counter) => counter.type === 'experience'
|
|
||||||
)?.value
|
|
||||||
}
|
|
||||||
setCounterTotal={handleCounterChange}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</S.ExtraCountersGrid>
|
|
||||||
</S.LifeCounterContentContainer>
|
</S.LifeCounterContentContainer>
|
||||||
|
|
||||||
{showPlayerMenu && (
|
{showPlayerMenu && (
|
||||||
<PlayerMenu
|
<PlayerMenu
|
||||||
player={player}
|
player={player}
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ export const initialPlayers: Player[] = [
|
|||||||
flipped: true,
|
flipped: true,
|
||||||
},
|
},
|
||||||
extraCounters: [],
|
extraCounters: [],
|
||||||
|
commanderDamage: [
|
||||||
|
{ source: 1, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 2, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 3, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 4, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
lifeTotal: 40,
|
lifeTotal: 40,
|
||||||
@@ -28,6 +34,12 @@ export const initialPlayers: Player[] = [
|
|||||||
flipped: true,
|
flipped: true,
|
||||||
},
|
},
|
||||||
extraCounters: [],
|
extraCounters: [],
|
||||||
|
commanderDamage: [
|
||||||
|
{ source: 1, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 2, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 3, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 4, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
lifeTotal: 40,
|
lifeTotal: 40,
|
||||||
@@ -42,6 +54,12 @@ export const initialPlayers: Player[] = [
|
|||||||
flipped: false,
|
flipped: false,
|
||||||
},
|
},
|
||||||
extraCounters: [],
|
extraCounters: [],
|
||||||
|
commanderDamage: [
|
||||||
|
{ source: 1, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 2, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 3, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 4, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
lifeTotal: 40,
|
lifeTotal: 40,
|
||||||
@@ -56,5 +74,11 @@ export const initialPlayers: Player[] = [
|
|||||||
flipped: false,
|
flipped: false,
|
||||||
},
|
},
|
||||||
extraCounters: [],
|
extraCounters: [],
|
||||||
|
commanderDamage: [
|
||||||
|
{ source: 1, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 2, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 3, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
{ source: 4, damageTotal: 0, partnerDamageTotal: 0 },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export type Player = {
|
|||||||
key: number;
|
key: number;
|
||||||
color: string;
|
color: string;
|
||||||
settings: PlayerSettings;
|
settings: PlayerSettings;
|
||||||
|
commanderDamage: CommanderDamage[];
|
||||||
extraCounters: ExtraCounter[];
|
extraCounters: ExtraCounter[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -20,6 +21,12 @@ type ExtraCounter = {
|
|||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CommanderDamage = {
|
||||||
|
source: number;
|
||||||
|
damageTotal: number;
|
||||||
|
partnerDamageTotal: number;
|
||||||
|
};
|
||||||
|
|
||||||
export enum CounterType {
|
export enum CounterType {
|
||||||
CommanderTax = 'commanderTax',
|
CommanderTax = 'commanderTax',
|
||||||
PartnerTax = 'partnerTax',
|
PartnerTax = 'partnerTax',
|
||||||
|
|||||||
Reference in New Issue
Block a user