mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Added Aura type to action areas
This commit is contained in:
parent
329d820aab
commit
ab4fb6970f
8 changed files with 45 additions and 11 deletions
|
|
@ -113,7 +113,8 @@
|
|||
"area": {
|
||||
"sectionTitle": "Areas",
|
||||
"shape": "Shape",
|
||||
"size": "Size"
|
||||
"size": "Size",
|
||||
"hasHole": "Area Hole"
|
||||
},
|
||||
"displayInChat": "Display in chat",
|
||||
"deleteTriggerTitle": "Delete Trigger",
|
||||
|
|
@ -870,6 +871,10 @@
|
|||
"bruiser": "for each Bruiser adversary.",
|
||||
"solo": "for each Solo adversary."
|
||||
},
|
||||
"AreaTypes": {
|
||||
"aura": { "label": "Aura" },
|
||||
"placed": { "label": "Placed Area" }
|
||||
},
|
||||
"ArmorInteraction": {
|
||||
"none": { "label": "Ignores Armor" },
|
||||
"active": { "label": "Active w/ Armor" },
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
|
|||
return inBounds.length === 1 ? inBounds[0] : null;
|
||||
}
|
||||
|
||||
static getTemplateShape({ type, angle, range, direction } = {}) {
|
||||
static getTemplateShape({ shapeType, angle, range, direction, hasHole } = {}) {
|
||||
const { line, rectangle, inFront, cone, circle, emanation } = CONFIG.DH.GENERAL.templateTypes;
|
||||
|
||||
/* Length calculation */
|
||||
|
|
@ -112,11 +112,11 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
|
|||
|
||||
const shapeData = {
|
||||
...canvas.mousePosition,
|
||||
type: type,
|
||||
type: shapeType,
|
||||
direction: direction ?? 0
|
||||
};
|
||||
|
||||
switch (type) {
|
||||
switch (shapeType) {
|
||||
case rectangle.id:
|
||||
shapeData.width = length;
|
||||
shapeData.height = length;
|
||||
|
|
@ -145,7 +145,8 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
|
|||
y: 0,
|
||||
width: 1,
|
||||
height: 1,
|
||||
shape: game.canvas.grid.isHexagonal ? CONST.TOKEN_SHAPES.ELLIPSE_1 : CONST.TOKEN_SHAPES.RECTANGLE_1
|
||||
shape: game.canvas.grid.isHexagonal ? CONST.TOKEN_SHAPES.ELLIPSE_1 : CONST.TOKEN_SHAPES.RECTANGLE_1,
|
||||
hole: hasHole
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ export const advantageState = {
|
|||
export const areaTypes = {
|
||||
placed: {
|
||||
id: 'placed',
|
||||
label: 'Placed Area'
|
||||
label: 'DAGGERHEART.CONFIG.AreaTypes.placed.label'
|
||||
},
|
||||
aura: {
|
||||
id: 'aura',
|
||||
label: 'DAGGERHEART.CONFIG.AreaTypes.aura.label'
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ export default class AreasField extends fields.ArrayField {
|
|||
initial: CONFIG.DH.GENERAL.range.veryClose.id,
|
||||
label: 'DAGGERHEART.ACTIONS.Config.area.size'
|
||||
}),
|
||||
hasHole: new fields.BooleanField({
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.ACTIONS.Config.area.hasHole'
|
||||
}),
|
||||
effects: new fields.ArrayField(new fields.DocumentIdField())
|
||||
});
|
||||
super(element, options, context);
|
||||
|
|
|
|||
|
|
@ -276,8 +276,12 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
async onCreateAreas(event) {
|
||||
const createArea = async selectedArea => {
|
||||
const effects = selectedArea.effects.map(effect => this.system.action.item.effects.get(effect).uuid);
|
||||
const { shape: type, size: range } = selectedArea;
|
||||
const shapeData = CONFIG.Canvas.layers.regions.layerClass.getTemplateShape({ type, range });
|
||||
const { shape: shapeType, size: range, hasHole } = selectedArea;
|
||||
const shapeData = CONFIG.Canvas.layers.regions.layerClass.getTemplateShape({
|
||||
shapeType,
|
||||
range,
|
||||
hasHole
|
||||
});
|
||||
|
||||
const scene = game.scenes.get(game.user.viewedScene);
|
||||
const level = scene.levels.find(x => x.isView);
|
||||
|
|
@ -305,7 +309,10 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
visibility: CONST.REGION_VISIBILITY.ALWAYS
|
||||
};
|
||||
const placeRegion = data => {
|
||||
canvas.regions.placeRegion(data, { create: true });
|
||||
canvas.regions.placeRegion(data, {
|
||||
create: true,
|
||||
attachToToken: selectedArea.type === CONFIG.DH.ACTIONS.areaTypes.aura.id
|
||||
});
|
||||
};
|
||||
|
||||
// Regions with effects must be placed by the GM
|
||||
|
|
|
|||
|
|
@ -58,10 +58,11 @@ export const renderMeasuredTemplate = async event => {
|
|||
if (!type || !range || !game.canvas.scene) return;
|
||||
|
||||
const shapeData = CONFIG.Canvas.layers.regions.layerClass.getTemplateShape({
|
||||
type,
|
||||
shapetype: type,
|
||||
angle,
|
||||
range,
|
||||
direction
|
||||
direction,
|
||||
hasHole: false
|
||||
});
|
||||
|
||||
await canvas.regions.placeRegion(
|
||||
|
|
|
|||
|
|
@ -384,6 +384,10 @@
|
|||
justify-content: space-between;
|
||||
}
|
||||
|
||||
label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
|
@ -399,6 +403,13 @@
|
|||
> .checkbox {
|
||||
align-self: end;
|
||||
}
|
||||
|
||||
.auto-sized {
|
||||
width: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
{{formField ../fields.type value=area.type name=(concat "areas." index ".type") localize=true}}
|
||||
{{formField ../fields.shape value=area.shape name=(concat "areas." index ".shape") localize=true}}
|
||||
{{formField ../fields.size value=area.size name=(concat "areas." index ".size") localize=true}}
|
||||
{{formField ../fields.hasHole value=area.hasHole name=(concat "areas." index ".hasHole") localize=true classes="auto-sized" }}
|
||||
</div>
|
||||
|
||||
<div class="sub-section-header">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue