mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-17 16:27:59 +00:00
check if poison counter is above 10 for lose condition
This commit is contained in:
@@ -237,6 +237,18 @@ const hasCommanderDamageReached21 = (player: Player) => {
|
|||||||
return commanderDamageTotal >= 21 || partnerDamageTotal >= 21;
|
return commanderDamageTotal >= 21 || partnerDamageTotal >= 21;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const playerCanLose = (player: Player) => {
|
||||||
|
const poisonCounter = player.extraCounters.find(
|
||||||
|
(counter) => counter.type === 'poison'
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
player.lifeTotal < 1 ||
|
||||||
|
hasCommanderDamageReached21(player) ||
|
||||||
|
(poisonCounter && poisonCounter.value >= 10)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const LifeCounter = ({
|
const LifeCounter = ({
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
player,
|
player,
|
||||||
@@ -340,7 +352,7 @@ const LifeCounter = ({
|
|||||||
}}
|
}}
|
||||||
rotation={player.settings.rotation}
|
rotation={player.settings.rotation}
|
||||||
/>
|
/>
|
||||||
{(player.lifeTotal < 1 || hasCommanderDamageReached21(player)) && (
|
{playerCanLose(player) && (
|
||||||
<LoseGameButton
|
<LoseGameButton
|
||||||
rotation={player.settings.rotation}
|
rotation={player.settings.rotation}
|
||||||
onClick={toggleGameLost}
|
onClick={toggleGameLost}
|
||||||
|
|||||||
Reference in New Issue
Block a user