inverts cooldown display, removes unintuitive progress/activate button and also fixes a bug in the tooltip

pull/65/head
macniel 2025-11-12 20:42:29 +01:00
parent 811806a68b
commit 1bc6d9673a
10 changed files with 46 additions and 56 deletions

View File

@ -20,9 +20,7 @@
} }
}, },
"COOLDOWN": { "COOLDOWN": {
"progress": "{t} weiter durchführen", "cancel": "{t} abbrechen"
"cancel": "{t} abbrechen",
"activate": "{t} auslösen"
}, },
"WEAPON": { "WEAPON": {
"attack": "Mit {weapon} angreifen", "attack": "Mit {weapon} angreifen",

View File

@ -126,7 +126,7 @@ export class CombatActionDialog extends HandlebarsApplicationMixin(ApplicationV2
/** @type Cooldown */ /** @type Cooldown */
const newCooldown = { const newCooldown = {
start: maneuver.cooldown({weapon, skill, target, mod: this._mod}), start: maneuver.cooldown({weapon, skill, target, mod: this._mod}),
current: maneuver.cooldown({weapon, skill, target, mod: this._mod}), current: 0,
data: { data: {
cssClass: "Kampf", cssClass: "Kampf",
weapon: this._weaponId, weapon: this._weaponId,

View File

@ -163,7 +163,7 @@ export class LiturgyDialog extends HandlebarsApplicationMixin(ApplicationV2) {
} }
cooldowns.push({ cooldowns.push({
start: castingTime, start: castingTime,
current: castingTime, current: 0,
data: { data: {
cssClass: "Karmal", cssClass: "Karmal",
title: this._liturgy.name, title: this._liturgy.name,

View File

@ -26,9 +26,11 @@ export default {
context.lepper = Math.min((actorData.system.lep.aktuell / actorData.system.lep.max) * 100, 100) context.lepper = Math.min((actorData.system.lep.aktuell / actorData.system.lep.max) * 100, 100)
context.keper = Math.min((actorData.system.kap.aktuell / actorData.system.kap.max) * 100, 100) context.keper = Math.min((actorData.system.kap.aktuell / actorData.system.kap.max) * 100, 100)
context.aspper = Math.min((actorData.system.asp.aktuell / actorData.system.asp.max) * 100, 100) context.aspper = Math.min((actorData.system.asp.aktuell / actorData.system.asp.max) * 100, 100)
context.lepcurrent = actorData.system.lep.aktuell ?? 0
context.lepcurrent = actorData.system.lep.aktuell ?? 0
context.aupcurrent = actorData.system.aup.aktuell ?? 0 context.aupcurrent = actorData.system.aup.aktuell ?? 0
context.aspcurrent = actorData.system.asp.aktuell ?? 0
context.kapcurrent = actorData.system.kap.aktuell ?? 0
return context return context

View File

@ -153,7 +153,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
cooldowns.splice(cooldownId, 1) cooldowns.splice(cooldownId, 1)
if (cooldown) { if (cooldown) {
cooldown.current = cooldown.current - 1 cooldown.current = cooldown.current + 1
} }
cooldowns.push(cooldown) cooldowns.push(cooldown)
@ -177,7 +177,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
const cooldowns = this.document.system.cooldowns const cooldowns = this.document.system.cooldowns
const cooldown = this.document.system.cooldowns[cooldownId] const cooldown = this.document.system.cooldowns[cooldownId]
if (cooldown && cooldown.current <= 0) { if (cooldown && cooldown.current >= cooldown.start) {
const am = new ActionManager(this.document) const am = new ActionManager(this.document)
console.log(cooldown.data.maneuver) console.log(cooldown.data.maneuver)
const action = new Function(`return ${cooldown.data.maneuver}`) const action = new Function(`return ${cooldown.data.maneuver}`)
@ -412,8 +412,11 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
context.lepper = Math.min((actorData.system.lep.aktuell / actorData.system.lep.max) * 100, 100) context.lepper = Math.min((actorData.system.lep.aktuell / actorData.system.lep.max) * 100, 100)
context.keper = Math.min((actorData.system.kap.aktuell / actorData.system.kap.max) * 100, 100) context.keper = Math.min((actorData.system.kap.aktuell / actorData.system.kap.max) * 100, 100)
context.aspper = Math.min((actorData.system.asp.aktuell / actorData.system.asp.max) * 100, 100) context.aspper = Math.min((actorData.system.asp.aktuell / actorData.system.asp.max) * 100, 100)
context.lepcurrent = actorData.system.lep.aktuell ?? 0 context.lepcurrent = actorData.system.lep.aktuell ?? 0
context.aupcurrent = actorData.system.aup.aktuell ?? 0 context.aupcurrent = actorData.system.aup.aktuell ?? 0
context.aspcurrent = actorData.system.asp.aktuell ?? 0
context.kapcurrent = actorData.system.kap.aktuell ?? 0
const fernkampf = actorData.findEquipmentOnSlot("fernkampf", actorData.system.setEquipped, actorData) const fernkampf = actorData.findEquipmentOnSlot("fernkampf", actorData.system.setEquipped, actorData)
const links = actorData.findEquipmentOnSlot("links", actorData.system.setEquipped, actorData) const links = actorData.findEquipmentOnSlot("links", actorData.system.setEquipped, actorData)
@ -493,11 +496,16 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
} }
if (cooldown.data.target) { if (cooldown.data.target) {
target = game.actors.get(game.scenes.current.tokens.find(p => p._id === cooldown.data.target).actorId) target = game.actors.get(game.scenes.current.tokens.find(p => p._id === cooldown.data.target).actorId)
tooltip += `<br/>Waffe:${target.name}` tooltip += `<br/>Ziel: ${target.name}`
} }
cooldown.title = cooldown.data.title cooldown.title = cooldown.data.title
cooldown.progress = ((cooldown.current / cooldown.start) * 100) + "%" cooldown.progress = ((cooldown.current / cooldown.start) * 100) + "%"
cooldown.tooltip = tooltip + `<br/>Aktionen verbleibend: ${cooldown.current}` if (cooldown.start - cooldown.current > 0) {
cooldown.tooltip = tooltip + `<br/>Aktionen verbleibend: ${cooldown.start - cooldown.current}<hr/><i class="fa-solid fa-computer-mouse"></i>: 1 Aktion aufwenden`
} else {
cooldown.tooltip = tooltip + `<br/>Aktionen verbleibend: ${cooldown.start - cooldown.current}<hr/><i class="fa-solid fa-computer-mouse"></i>: Aktion durchführen`
}
}) })
context.hasSpells = actorData.itemTypes["Spell"].length > 0 context.hasSpells = actorData.itemTypes["Spell"].length > 0

View File

@ -1,12 +1,12 @@
$nachteil-color: #555753; $nachteil-color: #555753;
$nachteil-text-color: #FFF; $nachteil-text-color: #FFF;
$liturgie-color: #edd400; $liturgie-color: #59aebf;
$liturgie-text-color: #000; $liturgie-text-color: #000;
$zauber-color: #3465a4; $zauber-color: #3465a4;
$zauber-text-color: #000; $zauber-text-color: #000;
$talent-color: #f57900; $talent-color: #f57900;
$talent-text-color: #000; $talent-text-color: #000;
$kampftalent-color: #cc0000; $kampftalent-color: #c36e14;
$kampftalent-text-color: #FFF; $kampftalent-text-color: #FFF;
$talent-body-color: #45d18c; $talent-body-color: #45d18c;

View File

@ -11,7 +11,7 @@
width: 100%; width: 100%;
position: relative; position: relative;
border: 1px inset #ccc; border: 1px inset #ccc;
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.5);
margin: 8px 0; margin: 8px 0;
label { label {
@ -19,8 +19,6 @@
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 48px;
background-color: rgba(0, 0, 0, 0.1);
z-index: 3; z-index: 3;
line-height: 24px; line-height: 24px;
vertical-align: middle; vertical-align: middle;
@ -226,22 +224,13 @@
position: absolute; position: absolute;
background: url('/systems/DSA_4-1/assets/gradient.png'); background: url('/systems/DSA_4-1/assets/gradient.png');
background-size: 12px 100%; background-size: 12px 100%;
background-blend-mode: overlay;
background-color: rgba(128, 0, 192, 1);
left: 0; left: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
border-radius: 12px; border-radius: 12px;
z-index: 2; z-index: 2;
&::after { // progress fill
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: 12px;
background-color: rgba(128, 0, 192, 0.5);
}
} }
&::after { &::after {
@ -256,20 +245,20 @@
} }
&.Kampf .progress::after { &.Kampf .progress {
background-color: rgba(colors.$kampftalent-color, 0.5); background-color: rgba(colors.$kampftalent-color, 1);
} }
&.Karmal .progress::after { &.Karmal .progress {
background-color: rgba(colors.$liturgie-color, 0.5); background-color: rgba(colors.$liturgie-color, 1);
} }
&.Magisch .progress::after { &.Magisch .progress {
background-color: rgba(colors.$zauber-color, 0.5); background-color: rgba(colors.$zauber-color, 1);
} }
&.Talent .progress::after { &.Talent .progress {
background-color: rgba(colors.$talent-color, 0.5); background-color: rgba(colors.$talent-color, 1);
} }
} }

View File

@ -28,7 +28,7 @@
position: relative; position: relative;
border: 1px inset #ccc; border: 1px inset #ccc;
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
height: 8px; height: 16px;
span.fill { span.fill {
position: absolute; position: absolute;

View File

@ -32,12 +32,14 @@
<img class="profile-img" src="{{img}}" data-action="editImage" data-edit="img" title="{{name}}"/> <img class="profile-img" src="{{img}}" data-action="editImage" data-edit="img" title="{{name}}"/>
<div class="sidebar-element resource-bar"> <div class="sidebar-element resource-bar">
<label>LeP: {{this.lep}}</label><span class="resource-fill lep" style="width: {{this.lepper}}%"></span> <label>LeP: {{this.lepcurrent}}</label><span class="resource-fill lep"
style="width: {{this.lepper}}%"></span>
</div> </div>
{{#if ausdauer}} {{#if ausdauer}}
<div class="sidebar-element resource-bar"> <div class="sidebar-element resource-bar">
<label>AuP: {{this.aup}}</label><span class="resource-fill aup" style="width: {{this.aupper}}%"></span> <label>AuP: {{this.aupcurrent}}</label><span class="resource-fill aup"
style="width: {{this.aupper}}%"></span>
</div> </div>
{{/if}} {{/if}}

View File

@ -1,23 +1,14 @@
<div class="cooldown{{#if this.data.cssClass}} {{this.data.cssClass}}{{/if}}"> <div class="cooldown{{#if this.data.cssClass}} {{this.data.cssClass}}{{/if}}">
<div class="progress" style="width: {{this.progress}}"></div> <div class="progress" style="width: {{this.progress}}"></div>
{{#if (gt this.current 0)}} <span data-tooltip="{{this.tooltip}}"
<button data-tooltip="{{localize "COOLDOWN.progress" t=this.title}}" class="btn-left" {{#if (lt this.current this.start)}}
data-action="progressCooldown" data-cooldown-id="{{@key}}"> data-action="progressCooldown"
<i class="fa fa-person-running-fast"></i>
</button>
<span data-tooltip="{{this.tooltip}}">{{this.title}}</span>
<button data-tooltip="{{localize "COOLDOWN.cancel" t=this.title}}" class="btn-right"
data-action="cancelCooldown" data-cooldown-id="{{@key}}">
<i class="fa fa-xmark"></i>
</button>
{{else}} {{else}}
<button data-tooltip="{{localize "COOLDOWN.activate" t=this.title}}" class="btn-left" data-action="activateCooldown"
data-action="activateCooldown" data-cooldown-id="{{@key}}"> {{/if}}
<i class="fa fa-person-running"></i> data-cooldown-id="{{@key}}">{{this.title}}</span>
</button>
<span data-tooltip="{{this.tooltip}}">{{this.title}}</span>
<button data-tooltip="{{localize "COOLDOWN.cancel" t=this.title}}" class="btn-right" <button data-tooltip="{{localize "COOLDOWN.cancel" t=this.title}}" class="btn-right"
data-action="cancelCooldown" data-cooldown-id="{{@key}}"> data-action="cancelCooldown" data-cooldown-id="{{@key}}">
<i class="fa fa-xmark"></i> <i class="fa-solid fa-xmark"></i>
</button> </button>
{{/if}}</div> </div>