New source found from dndbeyond.com
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { visuallyHidden } from "@mui/utils";
|
||||
import { useContext } from "react";
|
||||
import { Tooltip } from "@dndbeyond/character-common-components/es";
|
||||
import {
|
||||
AbilityManager,
|
||||
@@ -8,9 +6,14 @@ import {
|
||||
SituationalSavingThrowInfo,
|
||||
SituationalSavingThrowInfoLookup,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
import { DiceTools, IRollContext, RollType } from "@dndbeyond/dice";
|
||||
import { GameLogContext } from "@dndbeyond/game-log-components";
|
||||
import { RollTypes } from "@dndbeyond/pocket-dimension-dice/constants";
|
||||
import { RollContext } from "@dndbeyond/pocket-dimension-dice/types";
|
||||
|
||||
import { NumberDisplay } from "~/components/NumberDisplay";
|
||||
import a11yStyles from "~/styles/accessibility.module.css";
|
||||
|
||||
import BoxBackground from "../BoxBackground";
|
||||
import { DigitalDiceWrapper } from "../Dice";
|
||||
import { ProficiencyLevelIcon } from "../Icons";
|
||||
import {
|
||||
ThemedSavingThrowSelectionBoxSvg,
|
||||
@@ -22,9 +25,6 @@ import {
|
||||
DarkModePositiveBonusPositiveSvg,
|
||||
DarkModeNegativeBonusNegativeSvg,
|
||||
} from "../Svg";
|
||||
import { isNotNullOrUndefined } from "../utils/TypeScriptUtils";
|
||||
import { DigitalDiceWrapper } from "../Dice";
|
||||
import { NumberDisplay } from "~/components/NumberDisplay";
|
||||
|
||||
interface Props {
|
||||
abilities: Array<AbilityManager>;
|
||||
@@ -34,8 +34,8 @@ interface Props {
|
||||
className?: string;
|
||||
diceEnabled?: boolean;
|
||||
theme: CharacterTheme;
|
||||
rollContext: IRollContext;
|
||||
};
|
||||
rollContext: RollContext;
|
||||
}
|
||||
|
||||
export default function SavingThrowsSummary({
|
||||
abilities,
|
||||
@@ -58,9 +58,6 @@ export default function SavingThrowsSummary({
|
||||
}
|
||||
};
|
||||
|
||||
const [{ messageTargetOptions, defaultMessageTargetOption, userId }] =
|
||||
useContext(GameLogContext);
|
||||
|
||||
return (
|
||||
<div className="ddbc-saving-throws-summary">
|
||||
{abilities.map((ability) => {
|
||||
@@ -108,6 +105,7 @@ export default function SavingThrowsSummary({
|
||||
StyleComponent = ThemedSavingThrowRowSmallBoxSvg;
|
||||
SelectionBox = ThemedSavingThrowSelectionSmallBoxSvg;
|
||||
}
|
||||
const modifier = ability.getSave();
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -124,7 +122,9 @@ export default function SavingThrowsSummary({
|
||||
themeColor: `${theme.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<h3 style={visuallyHidden}>{ability.getLabel()} Saving Throw</h3>
|
||||
<h3 className={a11yStyles.screenreaderOnly}>
|
||||
{ability.getLabel()} Saving Throw
|
||||
</h3>
|
||||
<div className="ddbc-saving-throws-summary__ability-proficiency">
|
||||
<ProficiencyLevelIcon
|
||||
proficiencyLevel={ability.getProficiencyLevel()}
|
||||
@@ -148,21 +148,15 @@ export default function SavingThrowsSummary({
|
||||
</div>
|
||||
<div className="ddbc-saving-throws-summary__ability-modifier">
|
||||
<DigitalDiceWrapper
|
||||
diceNotation={DiceTools.CustomD20(ability.getSave())}
|
||||
rollType={RollType.Save}
|
||||
rollAction={ability.getName()}
|
||||
diceEnabled={diceEnabled}
|
||||
themeColor={theme.themeColor}
|
||||
rollContext={rollContext}
|
||||
rollTargetOptions={
|
||||
messageTargetOptions?.entities
|
||||
? Object.values(messageTargetOptions.entities).filter(
|
||||
isNotNullOrUndefined
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
rollTargetDefault={defaultMessageTargetOption}
|
||||
userId={Number(userId)}
|
||||
diceNotation={`1d20${
|
||||
modifier > 0 ? `+${modifier}` : modifier !== 0 ? modifier : ""
|
||||
}`}
|
||||
rollType={RollTypes.Save}
|
||||
action={ability.getName()}
|
||||
isDiceEnabled={diceEnabled}
|
||||
entityId={String(rollContext.entityId)}
|
||||
entityType={String(rollContext.entityType)}
|
||||
name={String(rollContext.name)}
|
||||
>
|
||||
<NumberDisplay
|
||||
number={ability.getSave()}
|
||||
@@ -192,4 +186,4 @@ export default function SavingThrowsSummary({
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user