Fix in creature+actor sheet
This commit is contained in:
@@ -1456,6 +1456,47 @@ a.ability-used-btn {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Creature traits tags */
|
||||||
|
.awemmy .creature-content .creature-main fieldset .tags-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.3rem;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 2rem;
|
||||||
|
padding: 0.3rem 0.4rem;
|
||||||
|
background: rgba(0,0,0,0.03);
|
||||||
|
border: 1px solid #7a7a88;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.awemmy .creature-content .creature-main fieldset .tags-list .tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.2rem;
|
||||||
|
padding: 0.15rem 0.5rem;
|
||||||
|
background: #cfdaeb;
|
||||||
|
border: 1px solid #7a7a88;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: #2c2c2c;
|
||||||
|
}
|
||||||
|
.awemmy .creature-content .creature-main fieldset .tags-list .tag a {
|
||||||
|
color: #6c6c6c;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.awemmy .creature-content .creature-main fieldset .tags-list .tag a:hover {
|
||||||
|
color: #e8a020;
|
||||||
|
}
|
||||||
|
.awemmy .creature-content .creature-main fieldset .tags-list .new-tag {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 120px;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
padding: 0.15rem 0.4rem;
|
||||||
|
border-style: dashed;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================================ */
|
/* ============================================================ */
|
||||||
/* Token Action HUD - Conditions styling */
|
/* Token Action HUD - Conditions styling */
|
||||||
/* ============================================================ */
|
/* ============================================================ */
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
createKit: AwECreatureSheet.#onCreateKit,
|
createKit: AwECreatureSheet.#onCreateKit,
|
||||||
createEquipment: AwECreatureSheet.#onCreateEquipment,
|
createEquipment: AwECreatureSheet.#onCreateEquipment,
|
||||||
rollWeapon: AwECreatureSheet.#onRollWeapon,
|
rollWeapon: AwECreatureSheet.#onRollWeapon,
|
||||||
rollDamage: AwECreatureSheet.#onRollDamage
|
rollDamage: AwECreatureSheet.#onRollDamage,
|
||||||
|
useAbility: AwECreatureSheet.#onUseAbility,
|
||||||
|
toggleCondition: AwECreatureSheet.#onToggleCondition,
|
||||||
|
addTrait: AwECreatureSheet.#onAddTrait,
|
||||||
|
removeTrait: AwECreatureSheet.#onRemoveTrait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +90,8 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
img: item.img,
|
img: item.img,
|
||||||
system: item.system,
|
system: item.system,
|
||||||
costLabel: game.i18n.localize(SYSTEM.ABILITY_COST[item.system.cost]?.label ?? item.system.cost)
|
costLabel: game.i18n.localize(SYSTEM.ABILITY_COST[item.system.cost]?.label ?? item.system.cost),
|
||||||
|
usedToday: item.system.usedToday
|
||||||
}))
|
}))
|
||||||
context.skills = this.document.itemTypes.skill.map(item => ({
|
context.skills = this.document.itemTypes.skill.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -102,6 +107,19 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
img: item.img,
|
img: item.img,
|
||||||
system: item.system
|
system: item.system
|
||||||
}))
|
}))
|
||||||
|
const doc = this.document
|
||||||
|
context.conditions = Object.values(SYSTEM.CONDITIONS).map(c => ({
|
||||||
|
...c,
|
||||||
|
label: game.i18n.localize(c.label),
|
||||||
|
img: `systems/fvtt-adventures-with-emmy/assets/conditions/${c.id}.svg`,
|
||||||
|
active: doc.statuses.has(c.id)
|
||||||
|
}))
|
||||||
|
context.inhibitedActive = doc.statuses.has("inhibited")
|
||||||
|
context.vulnerableActive = doc.statuses.has("vulnerable")
|
||||||
|
context.inhibitedPenalty = doc.system.inhibitedPenalty
|
||||||
|
context.vulnerablePenalty = doc.system.vulnerablePenalty
|
||||||
|
context.hasConditionPenalties = context.inhibitedActive || context.vulnerableActive
|
||||||
|
context.traitSuggestions = SYSTEM.TRAITS
|
||||||
break
|
break
|
||||||
case "inventory":
|
case "inventory":
|
||||||
context.tab = context.tabs.inventory
|
context.tab = context.tabs.inventory
|
||||||
@@ -135,6 +153,20 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
return super._onDropItem(item)
|
return super._onDropItem(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_onRender(context, options) {
|
||||||
|
super._onRender(context, options)
|
||||||
|
this.element.querySelectorAll("input.new-tag[data-action]").forEach(input => {
|
||||||
|
input.addEventListener("keydown", event => {
|
||||||
|
if (event.key !== "Enter") return
|
||||||
|
event.preventDefault()
|
||||||
|
const actionName = input.dataset.action
|
||||||
|
const handler = this.options.actions?.[actionName]
|
||||||
|
if (handler) handler.call(this, event, input)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
static #onCreateAbility(event, target) {
|
static #onCreateAbility(event, target) {
|
||||||
const type = "ability"
|
const type = "ability"
|
||||||
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
|
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
|
||||||
@@ -165,6 +197,16 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
|
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async #onUseAbility(event, target) {
|
||||||
|
const itemId = target.closest("[data-item-id]")?.dataset.itemId
|
||||||
|
await this.document.useAbility(itemId)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #onToggleCondition(event, target) {
|
||||||
|
const conditionId = target.dataset.conditionId
|
||||||
|
await this.document.toggleStatusEffect(conditionId)
|
||||||
|
}
|
||||||
|
|
||||||
static async #onRollWeapon(event, target) {
|
static async #onRollWeapon(event, target) {
|
||||||
const itemId = target.closest("[data-item-id]")?.dataset.itemId
|
const itemId = target.closest("[data-item-id]")?.dataset.itemId
|
||||||
const item = this.document.items.get(itemId)
|
const item = this.document.items.get(itemId)
|
||||||
@@ -178,4 +220,19 @@ export default class AwECreatureSheet extends AwEActorSheet {
|
|||||||
if (!item) return
|
if (!item) return
|
||||||
await this.document.rollDamage(item)
|
await this.document.rollDamage(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async #onAddTrait(event, target) {
|
||||||
|
const value = target.value.trim()
|
||||||
|
if (!value) return
|
||||||
|
const current = foundry.utils.getProperty(this.document, "system.traits") ?? []
|
||||||
|
await this.document.update({ "system.traits": [...current, value] })
|
||||||
|
target.value = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #onRemoveTrait(event, target) {
|
||||||
|
const index = Number(target.dataset.index)
|
||||||
|
const current = [...(foundry.utils.getProperty(this.document, "system.traits") ?? [])]
|
||||||
|
current.splice(index, 1)
|
||||||
|
await this.document.update({ "system.traits": current })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ export default class AwERoll extends Roll {
|
|||||||
Object.entries(CONFIG.Dice.rollModes).map(([k, v]) => [k, game.i18n.localize(v.label ?? v)])
|
Object.entries(CONFIG.Dice.rollModes).map(([k, v]) => [k, game.i18n.localize(v.label ?? v)])
|
||||||
)
|
)
|
||||||
|
|
||||||
// Bonus choices: -5 to +5
|
// Bonus choices: -10 to +10
|
||||||
const bonusChoices = Array.from({length: 11}, (_, i) => i - 5)
|
const bonusChoices = Array.from({length: 21}, (_, i) => i - 10)
|
||||||
.map(v => ({ value: v, label: v > 0 ? `+${v}` : String(v), selected: v === 0 }))
|
.map(v => ({ value: v, label: v > 0 ? `+${v}` : String(v), selected: v === 0 }))
|
||||||
|
|
||||||
// DC choices: blank + 10..30
|
// DC choices: blank + 10..30
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ export default class AwECharacter extends foundry.abstract.TypeDataModel {
|
|||||||
}, {})
|
}, {})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
schema.keyAttribute = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: "agility",
|
||||||
|
choices: Object.fromEntries(Object.values(SYSTEM.ATTRIBUTES).map(a => [a.id, a.label]))
|
||||||
|
})
|
||||||
|
|
||||||
// Condition penalty magnitudes (used when the respective condition is active)
|
// Condition penalty magnitudes (used when the respective condition is active)
|
||||||
schema.inhibitedPenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
schema.inhibitedPenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
||||||
schema.vulnerablePenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
schema.vulnerablePenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
||||||
@@ -70,5 +77,8 @@ export default class AwECharacter extends foundry.abstract.TypeDataModel {
|
|||||||
const bonusPart = attr.bonus !== 0 ? ` + Bonus ${attr.bonus >= 0 ? '+' : ''}${attr.bonus}` : ''
|
const bonusPart = attr.bonus !== 0 ? ` + Bonus ${attr.bonus >= 0 ? '+' : ''}${attr.bonus}` : ''
|
||||||
attr.modBreakdown = `Level ${level} + Boosts ${attr.boostLevel}${bonusPart} = ${attr.mod >= 0 ? '+' : ''}${attr.mod}`
|
attr.modBreakdown = `Level ${level} + Boosts ${attr.boostLevel}${bonusPart} = ${attr.mod >= 0 ? '+' : ''}${attr.mod}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.hp.max = (10 * level) + this.attributes.fitness.mod
|
||||||
|
this.hp.value = Math.min(this.hp.value, this.hp.max)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ export default class AwECreature extends foundry.abstract.TypeDataModel {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
schema.traits = new fields.ArrayField(new fields.StringField())
|
||||||
|
schema.inhibitedPenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
||||||
|
schema.vulnerablePenalty = new fields.NumberField({ required: true, nullable: false, integer: true, initial: 2, min: 0 })
|
||||||
|
|
||||||
// Eureka Rubric
|
// Eureka Rubric
|
||||||
schema.eurekaClaims = new fields.StringField({ initial: "", required: false, nullable: true })
|
schema.eurekaClaims = new fields.StringField({ initial: "", required: false, nullable: true })
|
||||||
schema.eurekaEvidence = new fields.StringField({ initial: "", required: false, nullable: true })
|
schema.eurekaEvidence = new fields.StringField({ initial: "", required: false, nullable: true })
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<div class="resource-values">
|
<div class="resource-values">
|
||||||
{{formInput systemFields.hp.fields.value value=system.hp.value classes="hp-value"}}
|
{{formInput systemFields.hp.fields.value value=system.hp.value classes="hp-value"}}
|
||||||
<span class="separator">/</span>
|
<span class="separator">/</span>
|
||||||
{{formInput systemFields.hp.fields.max value=system.hp.max disabled=isPlayMode classes="hp-max"}}
|
{{formInput systemFields.hp.fields.max value=system.hp.max disabled classes="hp-max"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="resource-temp">
|
<div class="resource-temp">
|
||||||
<label>{{localize "AWEMMY.Character.HPTemp"}}</label>
|
<label>{{localize "AWEMMY.Character.HPTemp"}}</label>
|
||||||
|
|||||||
@@ -44,6 +44,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="form-row" style="margin-top: 0.4rem;">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>{{localize "AWEMMY.Field.KeyAttribute"}}</label>
|
||||||
|
{{formField systemFields.keyAttribute value=system.keyAttribute disabled=isPlayMode localize=true}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{!-- Abilities --}}
|
{{!-- Abilities --}}
|
||||||
|
|||||||
+61
-11
@@ -17,16 +17,16 @@
|
|||||||
<td>{{formInput systemFields.attributes.fields.agility.fields.mod value=system.attributes.agility.mod}}</td>
|
<td>{{formInput systemFields.attributes.fields.agility.fields.mod value=system.attributes.agility.mod}}</td>
|
||||||
<td class="attr-dc">{{system.attributes.agility.dc}}</td>
|
<td class="attr-dc">{{system.attributes.agility.dc}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="attr-label rollable" data-attribute-id="fitness">{{localize "AWEMMY.Attribute.Fitness"}} <i class="fa-solid fa-dice-d20"></i></td>
|
<td class="attr-label rollable" data-attribute-id="awareness">{{localize "AWEMMY.Attribute.Awareness"}} <i class="fa-solid fa-dice-d20"></i></td>
|
||||||
<td>{{formInput systemFields.attributes.fields.fitness.fields.mod value=system.attributes.fitness.mod}}</td>
|
<td>{{formInput systemFields.attributes.fields.awareness.fields.mod value=system.attributes.awareness.mod}}</td>
|
||||||
<td class="attr-dc">{{system.attributes.fitness.dc}}</td>
|
<td class="attr-dc">{{system.attributes.awareness.dc}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="attr-label rollable" data-attribute-id="awareness">{{localize "AWEMMY.Attribute.Awareness"}} <i class="fa-solid fa-dice-d20"></i></td>
|
<td class="attr-label rollable" data-attribute-id="fitness">{{localize "AWEMMY.Attribute.Fitness"}} <i class="fa-solid fa-dice-d20"></i></td>
|
||||||
<td>{{formInput systemFields.attributes.fields.awareness.fields.mod value=system.attributes.awareness.mod}}</td>
|
<td>{{formInput systemFields.attributes.fields.fitness.fields.mod value=system.attributes.fitness.mod}}</td>
|
||||||
<td class="attr-dc">{{system.attributes.awareness.dc}}</td>
|
<td class="attr-dc">{{system.attributes.fitness.dc}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="attr-label rollable" data-attribute-id="influence">{{localize "AWEMMY.Attribute.Influence"}} <i class="fa-solid fa-dice-d20"></i></td>
|
<td class="attr-label rollable" data-attribute-id="influence">{{localize "AWEMMY.Attribute.Influence"}} <i class="fa-solid fa-dice-d20"></i></td>
|
||||||
<td>{{formInput systemFields.attributes.fields.influence.fields.mod value=system.attributes.influence.mod}}</td>
|
<td>{{formInput systemFields.attributes.fields.influence.fields.mod value=system.attributes.influence.mod}}</td>
|
||||||
@@ -36,17 +36,38 @@
|
|||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
{{!-- Traits --}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "AWEMMY.Ability.Traits"}}</legend>
|
||||||
|
<div class="tags-list">
|
||||||
|
{{#each system.traits}}
|
||||||
|
<span class="tag" data-tooltip="{{traitTooltip this}}">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||||
|
{{/each}}
|
||||||
|
<input type="text" class="new-tag" data-action="addTrait"
|
||||||
|
list="awemmy-trait-suggestions"
|
||||||
|
placeholder="{{localize 'AWEMMY.Ability.AddTrait'}}" />
|
||||||
|
<datalist id="awemmy-trait-suggestions">
|
||||||
|
{{#each traitSuggestions}}<option value="{{this}}">{{/each}}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{!-- Abilities --}}
|
{{!-- Abilities --}}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "AWEMMY.Character.Repertoire"}}</legend>
|
<legend>{{localize "AWEMMY.Character.Repertoire"}}</legend>
|
||||||
<div class="item-list">
|
<div class="item-list">
|
||||||
{{#each abilities as |item|}}
|
{{#each abilities as |item|}}
|
||||||
<div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
|
<div class="item-row {{#if item.usedToday}}ability-used{{/if}}" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
|
||||||
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
<div class="item-name">{{item.name}}</div>
|
<div class="item-name">{{item.name}}</div>
|
||||||
<div class="item-cost">{{item.costLabel}}</div>
|
<div class="item-cost">{{item.costLabel}}</div>
|
||||||
{{#if item.system.frequency}}<div class="item-frequency">{{item.system.frequency}}</div>{{/if}}
|
{{#if item.system.frequency}}<div class="item-frequency">{{item.system.frequency}}</div>{{/if}}
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
|
<a data-action="useAbility" data-item-id="{{item.id}}"
|
||||||
|
class="{{#if item.usedToday}}ability-used-btn{{/if}}"
|
||||||
|
data-tooltip="{{#if item.usedToday}}{{localize "AWEMMY.Ability.AlreadyUsed"}}{{else}}{{localize "AWEMMY.Ability.Use"}}{{/if}}">
|
||||||
|
<i class="fas fa-bolt"></i>
|
||||||
|
</a>
|
||||||
<a data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{localize 'AWEMMY.Sheet.EditItem'}}"><i class="fas fa-edit"></i></a>
|
<a data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{localize 'AWEMMY.Sheet.EditItem'}}"><i class="fas fa-edit"></i></a>
|
||||||
{{#if ../isEditMode}}
|
{{#if ../isEditMode}}
|
||||||
<a data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{localize 'AWEMMY.Sheet.DeleteItem'}}"><i class="fas fa-trash"></i></a>
|
<a data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{localize 'AWEMMY.Sheet.DeleteItem'}}"><i class="fas fa-trash"></i></a>
|
||||||
@@ -106,4 +127,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
{{!-- Conditions --}}
|
||||||
|
<fieldset class="conditions-fieldset">
|
||||||
|
<legend>{{localize "AWEMMY.Condition.Panel"}}</legend>
|
||||||
|
<div class="conditions-panel">
|
||||||
|
{{#each conditions as |cond|}}
|
||||||
|
<a class="condition-badge {{#if cond.active}}active{{/if}}" data-action="toggleCondition" data-condition-id="{{cond.id}}" data-tooltip="{{cond.label}}">
|
||||||
|
<img src="{{cond.img}}" alt="{{cond.label}}" />
|
||||||
|
<span class="condition-label">{{cond.label}}</span>
|
||||||
|
</a>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{#if hasConditionPenalties}}
|
||||||
|
<div class="condition-penalties">
|
||||||
|
{{#if inhibitedActive}}
|
||||||
|
<div class="condition-penalty-row">
|
||||||
|
<label>{{localize "AWEMMY.Condition.Inhibited"}} {{localize "AWEMMY.Condition.Penalty"}}</label>
|
||||||
|
{{formInput systemFields.inhibitedPenalty value=inhibitedPenalty classes="condition-penalty-input"}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if vulnerableActive}}
|
||||||
|
<div class="condition-penalty-row">
|
||||||
|
<label>{{localize "AWEMMY.Condition.Vulnerable"}} {{localize "AWEMMY.Condition.DCPenalty"}}</label>
|
||||||
|
{{formInput systemFields.vulnerablePenalty value=vulnerablePenalty classes="condition-penalty-input"}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user