New source found from dndbeyond.com
This commit is contained in:
@@ -124,7 +124,7 @@ export function generateVehicleMeta(vehicle, ruleData) {
|
||||
}
|
||||
let type = VehicleAccessors.getType(vehicle);
|
||||
let typeName = type === null ? '' : RuleDataUtils.getObjectTypeName(type, ruleData);
|
||||
typeName = typeName ? typeName.toLowerCase() : '';
|
||||
typeName = typeName || '';
|
||||
let primaryText = `${size} ${typeName}`.trim();
|
||||
let movementTypesText = VehicleAccessors.getMovementNames(vehicle).join(', ');
|
||||
metaText.push(`${primaryText}${movementTypesText ? ` (${movementTypesText})` : ''}`.trim());
|
||||
|
||||
@@ -109,12 +109,15 @@ export function stripTooltipTags(str, fallback = '') {
|
||||
* Formats the specified number as a distance with the appropriate unit
|
||||
* @param distance The distance measured in feet to format
|
||||
*/
|
||||
export function renderDistance(distance) {
|
||||
export function renderDistance(distance, useMph) {
|
||||
let displayNumber = distance;
|
||||
let label = 'ft.';
|
||||
if (distance !== 0 && distance % FEET_IN_MILES === 0) {
|
||||
displayNumber = CoreUtils.convertFeetToMiles(distance);
|
||||
label = `mile${Math.abs(displayNumber) === 1 ? '' : 's'}`;
|
||||
if (useMph) {
|
||||
label = `mph`;
|
||||
}
|
||||
}
|
||||
return `${displayNumber} ${label}`;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ export var VehicleConfigurationDisplayTypeEnum;
|
||||
VehicleConfigurationDisplayTypeEnum["SHIP"] = "ship";
|
||||
VehicleConfigurationDisplayTypeEnum["INFERNAL_WAR_MACHINE"] = "infernal-war-machine";
|
||||
VehicleConfigurationDisplayTypeEnum["SPELLJAMMER"] = "spelljammer";
|
||||
VehicleConfigurationDisplayTypeEnum["ELEMENTAL_AIRSHIP"] = "elemental-airship";
|
||||
})(VehicleConfigurationDisplayTypeEnum || (VehicleConfigurationDisplayTypeEnum = {}));
|
||||
export var VehicleConfigurationPrimaryComponentManageTypeEnum;
|
||||
(function (VehicleConfigurationPrimaryComponentManageTypeEnum) {
|
||||
|
||||
@@ -2,7 +2,6 @@ export var ComponentAdjustmentEnum;
|
||||
(function (ComponentAdjustmentEnum) {
|
||||
ComponentAdjustmentEnum["HIT_POINT_SPEED_ADJUSTMENT"] = "speed";
|
||||
})(ComponentAdjustmentEnum || (ComponentAdjustmentEnum = {}));
|
||||
//TODO new for spelljammers
|
||||
export var ComponentCostTypeEnum;
|
||||
(function (ComponentCostTypeEnum) {
|
||||
ComponentCostTypeEnum["COMPONENT"] = "component";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ActionAccessors } from "../engine/Action";
|
||||
import { CharacterUtils } from "../engine/Character";
|
||||
import { HelperUtils } from "../engine/Helper";
|
||||
import { RuleDataAccessors } from "../engine/RuleData";
|
||||
import { VehicleConfigurationPrimaryComponentManageTypeEnum } from "../engine/Vehicle";
|
||||
import { VehicleConfigurationDisplayTypeEnum, VehicleConfigurationPrimaryComponentManageTypeEnum, } from "../engine/Vehicle";
|
||||
import { VehicleComponentAccessors } from "../engine/VehicleComponent";
|
||||
import { rulesEngineSelectors } from "../selectors";
|
||||
import { BaseManager } from './BaseManager';
|
||||
@@ -133,7 +133,10 @@ export class VehicleComponentManager extends BaseManager {
|
||||
allowComponentProperty() {
|
||||
const primaryManageType = this.vehicle.getPrimaryComponentManageType();
|
||||
const isPrimaryComponent = this.getIsPrimary();
|
||||
return !(primaryManageType === VehicleConfigurationPrimaryComponentManageTypeEnum.VEHICLE && isPrimaryComponent);
|
||||
const isElementalAirship = this.vehicle.getDisplayType() === VehicleConfigurationDisplayTypeEnum.ELEMENTAL_AIRSHIP;
|
||||
return !(primaryManageType === VehicleConfigurationPrimaryComponentManageTypeEnum.VEHICLE &&
|
||||
isPrimaryComponent &&
|
||||
!isElementalAirship);
|
||||
}
|
||||
generateVehicleComponentSpeedInfos() {
|
||||
const enableSpeeds = this.vehicle.getEnableComponentSpeeds();
|
||||
|
||||
@@ -119,6 +119,7 @@ export class VehicleManager extends BaseManager {
|
||||
this.isSpelljammer = () => this.getDisplayType() === VehicleConfigurationDisplayTypeEnum.SPELLJAMMER;
|
||||
this.isInfernalWarMachine = () => this.getDisplayType() === VehicleConfigurationDisplayTypeEnum.INFERNAL_WAR_MACHINE;
|
||||
this.isShip = () => this.getDisplayType() === VehicleConfigurationDisplayTypeEnum.SHIP;
|
||||
this.isElementalAirship = () => this.getDisplayType() === VehicleConfigurationDisplayTypeEnum.ELEMENTAL_AIRSHIP;
|
||||
// Utils
|
||||
this.generateVehicleMeta = () => {
|
||||
const ruleData = rulesEngineSelectors.getRuleData(this.state);
|
||||
|
||||
Reference in New Issue
Block a user