Skip to content

Commit

Permalink
Merge pull request #75 from diabeatz96/bugsAndFixesAfflictions
Browse files Browse the repository at this point in the history
Fix afflictions not showing correctly and add kit point min/max
  • Loading branch information
diabeatz96 authored Sep 15, 2024
2 parents 356cc24 + a8a31e7 commit 9c7f4a0
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 12 deletions.
1 change: 1 addition & 0 deletions module/documents/player-overview.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class PlayerOverview extends Application {
agendaAbilities: actor ? this._getItemsFromIDs(actor.system.currentAgendaAbilities) : [],
blasphemies: actor ? this._getItemsFromIDs(actor.system.currentBlasphemies) : [],
blasphemyPowers: actor ? this._getItemsFromIDs(actor.system.currentBlasphemyPowers) : [],
afflictions: actor ? this._getItemsFromIDs(actor.system.afflictions) : [],
message: actor ? null : "No actor assigned. Please assign an actor for player overview."
};
});
Expand Down
22 changes: 21 additions & 1 deletion module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,27 @@ export class CainActorSheet extends ActorSheet {
// Update the corresponding field value
this.actor.update({ [`system.${field}.value`]: value });
});

html.find('.kit-points-increase').click(ev => {
ev.preventDefault();
const actor = this.actor;
actor.update({ 'system.kitPoints.max': actor.system.kitPoints.max + 1 });
});

// Event listener for decreasing kit points
html.find('.kit-points-decrease').click(ev => {
ev.preventDefault();
const actor = this.actor;
const newMax = actor.system.kitPoints.max - 1;
if (newMax >= 0) {
const updates = { 'system.kitPoints.max': newMax };
if (newMax < actor.system.kitPoints.value) {
updates['system.kitPoints.value'] = newMax;
}
actor.update(updates);
}
});


let scHtml = new HTMLShortcut(html);
// Character sheet specific listeners
Expand Down Expand Up @@ -325,7 +346,6 @@ export class CainActorSheet extends ActorSheet {
html.find('.blasphemy-power-to-chat').on('click', this._sendBlasphemyPowerMessage.bind(this));
html.find('.remove-blasphemy-power-button').on('click', this._removeBlasphemyPowerButton.bind(this));
html.find('.remove-blasphemy-button').on('click', this._removeBlasphemyButton.bind(this));
html.find('.remove-blasphemy-button').on('click', this._removeBlasphemyButton.bind(this));
html.find('.remove-affliction-button').on('click', this._removeAfflictionButton.bind(this));
scHtml.setLeftClick('.add-task-button', this._addNewTask.bind(this));

Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"thumbnail": "systems/cain/assets/cain.png"
}
],
"version": "1.1.5",
"version": "1.1.6",
"compatibility": {
"minimum": 11,
"verified": "12"
Expand Down
2 changes: 1 addition & 1 deletion templates/actor/actor-character-sheet.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div class="flex-group-center mob-psycho-flex-group">
<label for="system.XID" class="resource-label mob-psycho-label">XID</label>
<div style="padding: 5px">
<input type="text" name="system.XID" value="{{system.XID}}" data-dtype="Number" class="mob-psycho-input"/>
<input type="text" name="system.XID" value="{{system.XID}}" data-dtype="String" class="mob-psycho-input"/>
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion templates/actor/parts/actor-abilities.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,19 @@
<ul class="editable-blasphemy-powers">
{{#each currentUnlinkedBlasphemyPowers}}
<li>
<span data-id="{{this.id}}" title="{{this.system.powerDescription}}">{{this.system.powerName}}</span>
<span data-id="{{this.id}}" class="blasphemy-power" title="{{this.system.powerDescription}}">{{this.system.powerName}}</span>
<a class="item-control blasphemy-power-to-chat" data-id="{{this.id}}" title="Send to Chat">
<i class="fas fa-comment"></i>
</a>
<a class="item-control remove-blasphemy-power-button" data-id="{{this.id}}" title="Remove">
<i class="fas fa-trash"></i>
</a>
<div class="power-description-card">
<h4>Keywords</h4>
<p>{{this.system.keywords}}</p>
<h4>Power Description</h4>
<p>{{formatted this.system.powerDescription ../../system.CATLEVEL.value}}</p>
</div>
</li>
{{/each}}
</ul>
Expand Down
16 changes: 16 additions & 0 deletions templates/actor/parts/actor-items.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<img class="kit-points-selection" src="systems/cain/assets/KIT/{{#if (lt index ../system.kitPoints.value)}}KIT-filled.png{{else}}KIT-empty.png{{/if}}" data-kit="{{CainOffset index 1}}" data-tooltip="Right click to clear">
{{/range}}
<span class="kit-points-text">{{system.kitPoints.value}} / {{system.kitPoints.max}}</span>
<button type="button" class="kit-points-decrease">-</button>
<button type="button" class="kit-points-increase">+</button>
</div>
<div class="scrip" style="display: flex; align-items: center;">
<label for="system.scrip" style="margin-right: 10px;">Scrip:</label>
Expand Down Expand Up @@ -121,6 +123,20 @@
color: #00ff00;
margin-left: 10px;
align-self: center;
font-size: medium;
}
.kit-points-increase, .kit-points-decrease {
background-color: white;
color: black;
border: none;
padding: 5px 10px;
margin-left: 20px;
cursor: pointer;
}
.kit-points-increase:hover, .kit-points-decrease:hover {
background-color: #e0e0e0;
}
.scrip {
Expand Down
16 changes: 8 additions & 8 deletions templates/player-overview/overview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@
</table>
</div>

<div class="afflictions-container">
<div class="afflictions-container">
{{#each playerData}}
{{#if actor}}
<div class="afflictions-column">
<h3>{{actor.name}}'s Afflictions</h3>
<ul class="afflictions-list">
{{#if actor.system.afflictions.affliction1}}<li>{{actor.system.afflictions.affliction1}}</li>{{/if}}
{{#if actor.system.afflictions.affliction2}}<li>{{actor.system.afflictions.affliction2}}</li>{{/if}}
{{#if actor.system.afflictions.affliction3}}<li>{{actor.system.afflictions.affliction3}}</li>{{/if}}
{{#if actor.system.afflictions.affliction4}}<li>{{actor.system.afflictions.affliction4}}</li>{{/if}}
{{#if actor.system.afflictions.affliction5}}<li>{{actor.system.afflictions.affliction5}}</li>{{/if}}
{{#unless (or actor.system.afflictions.affliction1 actor.system.afflictions.affliction2 actor.system.afflictions.affliction3 actor.system.afflictions.affliction4 actor.system.afflictions.affliction5)}}
{{#each afflictions}}
<li>
<strong>{{this.system.afflictionName}}</strong>: {{this.system.afflictionDescription}}
</li>
{{/each}}
{{#unless afflictions.length}}
<li>No afflictions</li>
{{/unless}}
</ul>
</div>
{{/if}}
{{/each}}
</div>
</div>
</div>

<style>
Expand Down

0 comments on commit 9c7f4a0

Please sign in to comment.