mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Compare commits
No commits in common. "37c53ad74e2ae7cdc746fc35148308cb07f05b5d" and "4aab5d315a47e110861109420b5a9b30423f0790" have entirely different histories.
37c53ad74e
...
4aab5d315a
10 changed files with 21 additions and 54 deletions
|
|
@ -59,8 +59,6 @@ CONFIG.Canvas.layers.tokens.layerClass = DhTokenLayer;
|
||||||
|
|
||||||
CONFIG.MeasuredTemplate.objectClass = placeables.DhMeasuredTemplate;
|
CONFIG.MeasuredTemplate.objectClass = placeables.DhMeasuredTemplate;
|
||||||
|
|
||||||
CONFIG.Region.objectClass = placeables.DhRegion;
|
|
||||||
|
|
||||||
CONFIG.RollTable.documentClass = documents.DhRollTable;
|
CONFIG.RollTable.documentClass = documents.DhRollTable;
|
||||||
CONFIG.RollTable.resultTemplate = 'systems/daggerheart/templates/ui/chat/table-result.hbs';
|
CONFIG.RollTable.resultTemplate = 'systems/daggerheart/templates/ui/chat/table-result.hbs';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1222,8 +1222,8 @@
|
||||||
"cone": "Cone",
|
"cone": "Cone",
|
||||||
"emanation": "Emanation",
|
"emanation": "Emanation",
|
||||||
"inFront": "In Front",
|
"inFront": "In Front",
|
||||||
"rectangle": "Rectangle",
|
"rect": "Rectangle",
|
||||||
"line": "Line"
|
"ray": "Ray"
|
||||||
},
|
},
|
||||||
"TokenSize": {
|
"TokenSize": {
|
||||||
"tiny": "Tiny",
|
"tiny": "Tiny",
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,9 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
|
||||||
*/
|
*/
|
||||||
static async #addCategory() {
|
static async #addCategory() {
|
||||||
await this.actor.update({
|
await this.actor.update({
|
||||||
[`system.potentialAdversaries.${foundry.utils.randomID()}`]: {
|
[`system.potentialAdversaries.${foundry.utils.randomID()}.label`]: game.i18n.localize(
|
||||||
label: game.i18n.localize('DAGGERHEART.ACTORS.Environment.newAdversary')
|
'DAGGERHEART.ACTORS.Environment.newAdversary'
|
||||||
}
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,8 +138,4 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onDropItem(event, item) {
|
|
||||||
console.log(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
export { default as DhMeasuredTemplate } from './measuredTemplate.mjs';
|
export { default as DhMeasuredTemplate } from './measuredTemplate.mjs';
|
||||||
export { default as DhRuler } from './ruler.mjs';
|
export { default as DhRuler } from './ruler.mjs';
|
||||||
export { default as DhRegion } from './region.mjs';
|
|
||||||
export { default as DhRegionLayer } from './regionLayer.mjs';
|
export { default as DhRegionLayer } from './regionLayer.mjs';
|
||||||
export { default as DhTokenPlaceable } from './token.mjs';
|
export { default as DhTokenPlaceable } from './token.mjs';
|
||||||
export { default as DhTokenRuler } from './tokenRuler.mjs';
|
export { default as DhTokenRuler } from './tokenRuler.mjs';
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import DhMeasuredTemplate from './measuredTemplate.mjs';
|
|
||||||
|
|
||||||
export default class DhRegion extends foundry.canvas.placeables.Region {
|
|
||||||
/**@inheritdoc */
|
|
||||||
_formatMeasuredDistance(distance) {
|
|
||||||
const range = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).rangeMeasurement;
|
|
||||||
if (!range.enabled) return super._formatMeasuredDistance(distance);
|
|
||||||
|
|
||||||
const { distance: resultDistance, units } = DhMeasuredTemplate.getRangeLabels(distance, range);
|
|
||||||
return `${resultDistance} ${units}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -74,8 +74,8 @@ export const range = {
|
||||||
export const templateTypes = {
|
export const templateTypes = {
|
||||||
CIRCLE: 'circle',
|
CIRCLE: 'circle',
|
||||||
CONE: 'cone',
|
CONE: 'cone',
|
||||||
RECTANGLE: 'rectangle',
|
RECTANGLE: 'rect',
|
||||||
LINE: 'line',
|
RAY: 'ray',
|
||||||
EMANATION: 'emanation',
|
EMANATION: 'emanation',
|
||||||
INFRONT: 'inFront'
|
INFRONT: 'inFront'
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export default class DhEnvironment extends BaseDataActor {
|
||||||
potentialAdversaries: new fields.TypedObjectField(
|
potentialAdversaries: new fields.TypedObjectField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
label: new fields.StringField(),
|
label: new fields.StringField(),
|
||||||
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' }, { required: false, initial: [] })
|
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' })
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
notes: new fields.HTMLField()
|
notes: new fields.HTMLField()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default class ForeignDocumentUUIDArrayField extends foundry.data.fields.A
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
initialize(value, model, options = {}) {
|
initialize(value, model, options = {}) {
|
||||||
const v = super.initialize(value ?? [], model, options);
|
const v = super.initialize(value, model, options);
|
||||||
return () => {
|
return () => {
|
||||||
const data = v.map(entry => (typeof entry === 'function' ? entry() : entry));
|
const data = v.map(entry => (typeof entry === 'function' ? entry() : entry));
|
||||||
return this.options.prune ? data.filter(d => !!d) : data;
|
return this.options.prune ? data.filter(d => !!d) : data;
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ export default function DhTemplateEnricher(match, _options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const renderMeasuredTemplate = async event => {
|
export const renderMeasuredTemplate = async event => {
|
||||||
const { LINE, RECTANGLE, INFRONT, CONE } = CONFIG.DH.GENERAL.templateTypes;
|
|
||||||
|
|
||||||
const button = event.currentTarget,
|
const button = event.currentTarget,
|
||||||
type = button.dataset.type,
|
type = button.dataset.type,
|
||||||
range = button.dataset.range,
|
range = button.dataset.range,
|
||||||
|
|
@ -59,9 +57,13 @@ export const renderMeasuredTemplate = async event => {
|
||||||
|
|
||||||
if (!type || !range || !game.canvas.scene) return;
|
if (!type || !range || !game.canvas.scene) return;
|
||||||
|
|
||||||
const usedType = type === 'inFront' ? 'cone' : type;
|
const usedType = type === 'inFront' ? 'cone' : type === 'emanation' ? 'circle' : type;
|
||||||
const usedAngle =
|
const usedAngle =
|
||||||
type === CONE ? (angle ?? CONFIG.MeasuredTemplate.defaults.angle) : type === INFRONT ? '180' : undefined;
|
type === CONFIG.DH.GENERAL.templateTypes.CONE
|
||||||
|
? (angle ?? CONFIG.MeasuredTemplate.defaults.angle)
|
||||||
|
: type === CONFIG.DH.GENERAL.templateTypes.INFRONT
|
||||||
|
? '180'
|
||||||
|
: undefined;
|
||||||
|
|
||||||
let baseDistance = range;
|
let baseDistance = range;
|
||||||
if (Number.isNaN(Number(range))) {
|
if (Number.isNaN(Number(range))) {
|
||||||
|
|
@ -69,32 +71,16 @@ export const renderMeasuredTemplate = async event => {
|
||||||
range
|
range
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
const distance = type === CONFIG.DH.GENERAL.templateTypes.EMANATION ? baseDistance + 2.5 : baseDistance;
|
||||||
const dimensionConstant = game.scenes.active.grid.size / game.scenes.active.grid.distance;
|
const radius = (distance / game.scenes.active.grid.distance) * game.scenes.active.grid.size;
|
||||||
|
|
||||||
baseDistance *= dimensionConstant;
|
|
||||||
|
|
||||||
const length = baseDistance;
|
|
||||||
const radius = length;
|
|
||||||
|
|
||||||
const shapeWidth = type === LINE ? 5 * dimensionConstant : type === RECTANGLE ? length : undefined;
|
|
||||||
|
|
||||||
const { width, height } = game.canvas.scene.dimensions;
|
const { width, height } = game.canvas.scene.dimensions;
|
||||||
const shapeData = {
|
const shapeData = {
|
||||||
x: width / 2,
|
x: width / 2,
|
||||||
y: height / 2,
|
y: height / 2,
|
||||||
base: {
|
|
||||||
type: 'token',
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width: 1,
|
|
||||||
height: 1,
|
|
||||||
shape: game.canvas.grid.isHexagonal ? CONST.TOKEN_SHAPES.ELLIPSE_1 : CONST.TOKEN_SHAPES.RECTANGLE_1
|
|
||||||
},
|
|
||||||
t: usedType,
|
t: usedType,
|
||||||
length: length,
|
distance: distance,
|
||||||
width: shapeWidth,
|
width: type === CONFIG.DH.GENERAL.templateTypes.RAY ? 5 : undefined,
|
||||||
height: length,
|
|
||||||
angle: usedAngle,
|
angle: usedAngle,
|
||||||
radius: radius,
|
radius: radius,
|
||||||
direction: direction,
|
direction: direction,
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
"description": "An unofficial implementation of the Daggerheart system",
|
"description": "An unofficial implementation of the Daggerheart system",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "14.355",
|
"minimum": "14.354",
|
||||||
"verified": "14.355",
|
"verified": "14.354",
|
||||||
"maximum": "14"
|
"maximum": "14"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue