New source found from dndbeyond.com
This commit is contained in:
+42
-17
@@ -110,16 +110,21 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
};
|
||||
|
||||
renderSpeedInfo = (
|
||||
modes: Array<VehicleComponentSpeedModeInfo>
|
||||
modes: Array<VehicleComponentSpeedModeInfo>,
|
||||
displayType: Constants.VehicleConfigurationDisplayTypeEnum
|
||||
): React.ReactNode => {
|
||||
const isElementalAirship =
|
||||
displayType ===
|
||||
Constants.VehicleConfigurationDisplayTypeEnum.ELEMENTAL_AIRSHIP;
|
||||
|
||||
let speedDisplayStrings: Array<string> = modes.map((mode) => {
|
||||
const { value, description, restrictionsText, movementInfo } = mode;
|
||||
|
||||
let stringParts: Array<string> = [];
|
||||
if (movementInfo) {
|
||||
if (movementInfo && !isElementalAirship) {
|
||||
stringParts.push(`${movementInfo.description} speed`);
|
||||
}
|
||||
stringParts.push(FormatUtils.renderDistance(value));
|
||||
stringParts.push(FormatUtils.renderDistance(value, isElementalAirship));
|
||||
if (description) {
|
||||
stringParts.push(description);
|
||||
}
|
||||
@@ -134,12 +139,16 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
};
|
||||
|
||||
renderArmorClassAttribute = (): React.ReactNode => {
|
||||
const { armorClassInfo } = this.props;
|
||||
const { armorClassInfo, displayType } = this.props;
|
||||
|
||||
if (armorClassInfo === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isElementalAirship =
|
||||
displayType ===
|
||||
Constants.VehicleConfigurationDisplayTypeEnum.ELEMENTAL_AIRSHIP;
|
||||
|
||||
const { moving, base, description } = armorClassInfo;
|
||||
|
||||
let armorClassValue: number | null = base;
|
||||
@@ -155,7 +164,7 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
|
||||
return (
|
||||
<VehicleBlockAttribute
|
||||
label="Armor Class"
|
||||
label={isElementalAirship ? "AC" : "Armor Class"}
|
||||
value={
|
||||
description
|
||||
? `${armorClassValue} (${description})`
|
||||
@@ -164,6 +173,7 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
: armorClassValue
|
||||
}
|
||||
extraValue={motionlessArmorClassValue}
|
||||
displayColon={isElementalAirship}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -206,7 +216,9 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
);
|
||||
|
||||
const costValues: Array<string> = sortedCosts.map((cost) => {
|
||||
const value: string = cost.value ? `${cost.value} gp` : "--";
|
||||
const value: string = cost.value
|
||||
? `${FormatUtils.renderLocaleNumber(cost.value)} GP`
|
||||
: "--";
|
||||
const description: string = cost.description
|
||||
? `(${cost.description})`
|
||||
: "";
|
||||
@@ -216,25 +228,33 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
|
||||
const isSpelljammer =
|
||||
displayType === Constants.VehicleConfigurationDisplayTypeEnum.SPELLJAMMER;
|
||||
const isElementalAirship =
|
||||
displayType ===
|
||||
Constants.VehicleConfigurationDisplayTypeEnum.ELEMENTAL_AIRSHIP;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
{armorClassInfo !== null && this.renderArmorClassAttribute()}
|
||||
{hitPointInfo !== null && (
|
||||
<VehicleBlockAttribute
|
||||
label="Hit Points"
|
||||
label={isElementalAirship ? "HP" : "Hit Points"}
|
||||
value={this.renderHitPointInfo()}
|
||||
extraValue={
|
||||
!isSpelljammer ? this.renderHitPointThresholdInfo() : undefined
|
||||
!isSpelljammer && !isElementalAirship
|
||||
? this.renderHitPointThresholdInfo()
|
||||
: undefined
|
||||
}
|
||||
displayColon={isElementalAirship}
|
||||
/>
|
||||
)}
|
||||
{isSpelljammer && !!hitPointInfo?.damageThreshold && (
|
||||
<VehicleBlockAttribute
|
||||
label="Damage Threshold"
|
||||
value={hitPointInfo?.damageThreshold}
|
||||
/>
|
||||
)}
|
||||
{(isSpelljammer || isElementalAirship) &&
|
||||
!!hitPointInfo?.damageThreshold && (
|
||||
<VehicleBlockAttribute
|
||||
label={"Damage Threshold"}
|
||||
value={hitPointInfo?.damageThreshold}
|
||||
displayColon={isElementalAirship}
|
||||
/>
|
||||
)}
|
||||
{speedInfos.map((speedInfo, idx) => {
|
||||
let speedAttributeLabel: string = "Speed";
|
||||
if (speedInfo.type !== null && !isSpelljammer) {
|
||||
@@ -248,7 +268,8 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
<VehicleBlockAttribute
|
||||
key={`${speedInfo.type}-${idx}`}
|
||||
label={speedAttributeLabel}
|
||||
value={this.renderSpeedInfo(modes)}
|
||||
value={this.renderSpeedInfo(modes, displayType)}
|
||||
displayColon={isElementalAirship}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -258,7 +279,7 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
value={`Grants ${coverType} Cover`}
|
||||
/>
|
||||
)}
|
||||
{requiredCrew !== null && !isSpelljammer && (
|
||||
{requiredCrew !== null && !isSpelljammer && !isElementalAirship && (
|
||||
<VehicleBlockAttribute label="Required Crew" value={requiredCrew} />
|
||||
)}
|
||||
{isPrimaryComponent &&
|
||||
@@ -273,7 +294,11 @@ export default class VehicleBlockPrimaryAttributes extends React.PureComponent<P
|
||||
/>
|
||||
)}
|
||||
{costValues.length > 0 && (
|
||||
<VehicleBlockAttribute label="Cost" value={costValues.join(", ")} />
|
||||
<VehicleBlockAttribute
|
||||
label="Cost"
|
||||
value={costValues.join(", ")}
|
||||
displayColon={isElementalAirship}
|
||||
/>
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user