Skip to content

Commit

Permalink
Merge branch 'health_bug'
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarBear committed Jul 18, 2021
2 parents 844fd7d + 09ce1ff commit 1aa84c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
11 changes: 7 additions & 4 deletions module/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function cypherToken() {

export function add3rdBarToPCTokens() {
//Update existing tokens with the extra attribute
game.scenes.entities.forEach(scene => {
game.scenes.forEach(scene => {
scene.data.tokens.forEach(token => {
if (!token.data.hasOwnProperty("bar3")) {
token.bar1 = {attribute: "stats.might.pool"};
Expand Down Expand Up @@ -266,10 +266,13 @@ function getCypherNPCTokenBarAttribute(barName, { alternative } = {}) {

let data = getProperty(this.actor.data.data, "health");
data = duplicate(data);
const model = game.system.model.Actor[this.actor.type];

return {
type: "bar",
attribute: "health",
value: parseInt(data.value || 0),
max: parseInt(data.max || 0)
}
}
max: parseInt(data.max || 0),
editable: foundry.utils.hasProperty(model, "health.value"),
};
}
1 change: 1 addition & 0 deletions sass/numenera.scss
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ form.numenera button.animated {
/// HUD STUFF
/// ----------

//TODO make these classes, they shouldn't be id's since they're probably not unique!
#token-hud {
#innerTokenHud {
height: 100%;
Expand Down
27 changes: 13 additions & 14 deletions templates/hud/tokenHUD.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<div id="cypherTokenStats">
<div class="attribute bar1">
{{#if displayBar1}}
<input type="text" name="bar1.value" id="mightBar" data-bar="bar1" value="{{bar1Data.value}}">
<input type="text" name="bar1.value" data-bar="bar1" value="{{bar1Data.value}}" {{#unless bar1Data.editable}}disabled{{/unless}}>
{{/if}}
</div>

<div class="attribute bar2">
{{#if displayBar2}}
<input type="text" name="bar2.value" id="speedBar" data-bar="bar2" value="{{bar2Data.value}}">
<input type="text" name="bar2.value" data-bar="bar2" value="{{bar2Data.value}}" {{#unless bar2Data.editable}}disabled{{/unless}}>
{{/if}}
</div>

<div class="attribute bar3">
{{#if displayBar3}}
<input type="text" name="bar3.value" id="intellectBar" data-bar="bar3" value="{{bar3Data.value}}">
<input type="text" name="bar3.value" data-bar="bar3" value="{{bar3Data.value}}" {{#unless bar3Data.editable}}disabled{{/unless}}>
{{/if}}
</div>
</div>
Expand All @@ -43,39 +43,38 @@

<div class="col middle">
{{#unless isPC}}
<div class="attribute bar1">
{{#if displayBar1}}
<input type="text" name="bar1.value" data-bar="bar1" value="{{bar1Data.value}}" {{#unless bar1Data.editable}}disabled{{/unless}}>
{{/if}}
</div>

<div class="attribute bar2">
{{#if displayBar2}}
<input type="text" name="bar2.value" data-bar="bar2" value="{{bar2Data.value}}" {{#unless bar2Data.editable}}disabled{{/unless}}>
{{/if}}
</div>
<div class="attribute bar1">
{{#if displayBar1}}
<input type="text" name="bar1.value" data-bar="bar1" value="{{bar1Data.value}}" {{#unless bar1Data.editable}}disabled{{/unless}}>
{{/if}}
</div>
{{/unless}}
</div>

<div class="col right">

{{#if isGM}}
<div class="control-icon visibility {{visibilityClass}}" data-action="visibility">
<div class="control-icon {{visibilityClass}}" data-action="visibility">
<img src="{{icons.visibility}}" width="36" height="36" title="Toggle Visibility"/>
</div>
{{/if}}

<div class="control-icon effects {{effectsClass}}" data-action="effects">
<div class="control-icon {{effectsClass}}" data-action="effects">
<img src="{{icons.effects}}" width="36" height="36" title="Assign Status Effects"/>
<div class="status-effects">
{{#each statusEffects as |status src|}}
<img class="effect-control {{status.cssClass}}" src="{{status.src}}" width="24" height="24"/>
<img class="effect-control {{status.cssClass}}" src="{{status.src}}"
{{#if status.title}}title="{{status.title}}"{{/if}} data-status-id="{{status.id}}"/>
{{/each}}
</div>
</div>

{{#if canToggleCombat}}
<div class="control-icon combat {{combatClass}}" data-action="combat">
<div class="control-icon {{combatClass}}" data-action="combat">
<img src="{{icons.combat}}" width="36" height="36" title="Toggle Combat State"/>
</div>
{{/if}}
Expand Down

0 comments on commit 1aa84c8

Please sign in to comment.