Skip to content

Commit

Permalink
Broke everything as I update BladesRoll, BladesRollMod & BladesConseq…
Browse files Browse the repository at this point in the history
…uence to BladesTargetLink
  • Loading branch information
Eunomiac committed Jan 26, 2024
1 parent 64a3825 commit 24a99c8
Show file tree
Hide file tree
Showing 19 changed files with 915 additions and 935 deletions.
5 changes: 3 additions & 2 deletions module/classes/BladesConsequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import C, { BladesActorType, AttributeTrait, ConsequenceType, RollResult, RollTy
import U from "../core/utilities.js";
import BladesRoll, { BladesRollPrimary } from "./BladesRoll.js";
import BladesChat from "./BladesChat.js";
class BladesConsequence {
import BladesTargetLink from "./BladesTargetLink.js";
class BladesConsequence extends BladesTargetLink {
static async Initialize() {
if (!game.messages) {
throw new Error("[BladesConsequence] Messages Not Ready!");
Expand Down Expand Up @@ -109,7 +110,7 @@ class BladesConsequence {
if (!csqData) {
throw new Error(`Could not find consequence data for ID ${csqID} in message ${msg.id}`);
}
const { type, resistTo, armorTo, specialArmorTo: specialTo } = csqData;
const { type, resistTo, armorTo, specialTo: specialTo } = csqData;
if (!(type in ConsequenceType)) {
throw new Error(`Consequence type ${type} is not a valid consequence type`);
}
Expand Down
6 changes: 3 additions & 3 deletions module/classes/BladesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,18 @@ class BladesDialog extends Dialog {
}
}
updateConsequenceSpecialArmorResist(_csqElem$, cData) {
// If consequence is already minimal, toggle specialArmorNegates to true and set 'specialArmorTo' to None-type
// If consequence is already minimal, toggle specialArmorNegates to true and set 'specialTo' to None-type
const minimalCsqTypes = Object.entries(C.ResistedConsequenceTypes)
.filter(([_, rCsqType]) => rCsqType === ConsequenceType.None)
.map(([csqType]) => csqType);
if (minimalCsqTypes.includes(cData.type)) {
cData.specialArmorNegates = true;
cData.specialArmorTo = BladesConsequence.None;
cData.specialTo = BladesConsequence.None;
}
else {
delete cData.specialArmorNegates;
cData.specialArmorNegates ??= false;
cData.specialArmorTo = this.getSelectedResistOption(cData);
cData.specialTo = this.getSelectedResistOption(cData);
}
}
updateConsequenceData(html, cData) {
Expand Down
199 changes: 101 additions & 98 deletions templates/components/consequence.hbs
Original file line number Diff line number Diff line change
@@ -1,105 +1,110 @@
{{eLog "Consequence Context" this}}

<div class="comp consequence-display-container full-width {{~#if isAccepted}}consequence-accepted{{/if}}"
data-user-id="{{flagData.rollUserID}}"
data-roll-id="{{flagData.rollID}}"
data-csq-id="{{id}}"
data-csq-name="{{name}}"
data-csq-type="{{type}}"
data-resist-attribute="{{attribute}}"
data-resist-attribute-val="{{attributeVal}}"
data-resist-name="{{resistTo.name}}"
data-resist-type="{{resistTo.type}}"
data-armor-name="{{armorTo.name}}"
data-armor-type="{{armorTo.type}}"
data-special-name="{{specialArmorTo.name}}"
data-special-type="{{specialArmorTo.type}}" >

{{!-- Consequence Selection BG Image --}}
<img class="consequence-bg-image" src="systems/eunos-blades/assets/chat/csq-strip-long.png" />

{{!-- Interaction Pads --}}
<div class="consequence-interaction-pad interaction-pad-right" data-action="accept-consequence"></div>
<div class="consequence-interaction-pad interaction-pad-left">
<div class="consequence-interaction-pad interaction-pad-left-resist" data-action="resist-consequence"></div>
{{#if specialArmorTo}}
<div class="consequence-interaction-pad interaction-pad-left-special" data-action="special-consequence"></div>
{{/if}}
{{#if armorTo}}
<div class="consequence-interaction-pad interaction-pad-left-armor" data-action="armor-consequence"></div>
{{/if}}
</div>
<div id="{{id}}" class="comp consequence-display-container full-width {{~#if isAccepted}}consequence-accepted{{/if}}" >

{{#unless isAccepted}}
{{!-- Consequence Selection BG Image --}}
<img class="consequence-bg-image" src="systems/eunos-blades/assets/chat/csq-strip-long.png" />

{{!-- Interaction Pads --}}
<div class="consequence-interaction-pad interaction-pad-right" data-action="accept-consequence"></div>
<div class="consequence-interaction-pad interaction-pad-left">
{{#if resistTo}}
<div class="consequence-interaction-pad interaction-pad-left-resist" data-action="resist-consequence"></div>
{{/if}}
{{#if specialTo}}
<div class="consequence-interaction-pad interaction-pad-left-special" data-action="special-consequence"></div>
{{/if}}
{{#if armorTo}}
<div class="consequence-interaction-pad interaction-pad-left-armor" data-action="armor-consequence"></div>
{{/if}}
</div>
{{/unless}}

{{!-- Icon --}}
{{#unless (test type "==" "None")}}
<div class="consequence-icon-container">

{{!-- Icon Circles --}}
{{#if isAccepted}}
<div class="consequence-icon-circle base-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/base-{{icon}}.svg" />
</div>
<div class="consequence-icon-circle accept-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/accept-{{icon}}.svg" />
</div>
{{#if resistTo}}{{#unless (test resistTo.type "==" "None")}}
<div class="consequence-icon-circle resist-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/resist-{{resistTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}
{{#if armorTo}}{{#unless (test armorTo.type "==" "None")}}
<div class="consequence-icon-circle armor-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/base-{{armorTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}
{{#if specialArmorTo}}{{#unless (test specialArmorTo.type "==" "None")}}
<div class="consequence-icon-circle special-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/special-{{specialArmorTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}

{{!-- Buttons --}}
<div class="consequence-button-container consequence-accept-button-container accept-consequence">
<div class="consequence-button-bg consequence-accept-button-bg"></div>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-accept-button"
buttonClass="fa-solid fa-square-check"
action="acceptconsequence"
}}
<label class="consequence-button-label consequence-accept-button-label">ACCEPT</label>
</div>
{{#if resistTo}}
<div class="consequence-button-container consequence-resist-button-container resist-consequence" data-csq-id="{{resistTo.id}}">
<div class="consequence-button-bg consequence-resist-button-bg"></div>
<label class="consequence-button-label consequence-resist-button-label">RESIST</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-resist-button"
buttonClass="fa-solid fa-hand-fist"
action="resistconsequence"
}}
</div>
{{/if}}
{{#if armorTo}}
<div class="consequence-button-container consequence-armor-button-container armor-consequence" data-csq-id="{{armorTo.id}}">
<div class="consequence-button-bg consequence-armor-button-bg"></div>
<label class="consequence-button-label consequence-armor-button-label">ARMOR</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-armor-button"
buttonClass="fa-duotone fa-shield-quartered"
action="armorconsequence"
}}
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/{{acceptanceMode}}-{{icon}}.svg" />
</div>
{{/if}}
{{#if specialArmorTo}}
<div class="consequence-button-container consequence-special-button-container special-consequence" data-csq-id="{{specialArmorTo.id}}">
<div class="consequence-button-bg consequence-special-button-bg"></div>
<label class="consequence-button-label consequence-special-button-label">SPECIAL</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-special-button"
buttonClass="fa-duotone fa-shield-quartered"
action="specialarmorconsequence"
}}
{{else}}
<div class="consequence-icon-circle base-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/base-{{icon}}.svg" />
</div>
{{/if}}

{{#unless isAccepted}}
<div class="consequence-icon-circle accept-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/accept-{{icon}}.svg" />
</div>

{{#if resistTo}}{{#unless (test resistTo.type "==" "None")}}
<div class="consequence-icon-circle resist-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/resist-{{resistTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}

{{#if armorTo}}{{#unless (test armorTo.type "==" "None")}}
<div class="consequence-icon-circle armor-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/base-{{armorTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}

{{#if specialTo}}{{#unless (test specialTo.type "==" "None")}}
<div class="consequence-icon-circle special-consequence">
<img class="consequence-icon-img" src="systems/eunos-blades/assets/icons/consequence-icons/special-{{specialTo.icon}}.svg" />
</div>
{{/unless}}{{/if}}

{{!-- Buttons --}}
<div class="consequence-button-container consequence-accept-button-container accept-consequence">
<div class="consequence-button-bg consequence-accept-button-bg"></div>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-accept-button"
buttonClass="fa-solid fa-square-check"
action="acceptconsequence"
}}
<label class="consequence-button-label consequence-accept-button-label">ACCEPT</label>
</div>
{{#if resistTo}}
<div class="consequence-button-container consequence-resist-button-container resist-consequence" data-csq-id="{{resistTo.id}}">
<div class="consequence-button-bg consequence-resist-button-bg"></div>
<label class="consequence-button-label consequence-resist-button-label">RESIST</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-resist-button"
buttonClass="fa-solid fa-hand-fist"
action="resistconsequence"
}}
</div>
{{/if}}
{{#if armorTo}}
<div class="consequence-button-container consequence-armor-button-container armor-consequence" data-csq-id="{{armorTo.id}}">
<div class="consequence-button-bg consequence-armor-button-bg"></div>
<label class="consequence-button-label consequence-armor-button-label">ARMOR</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-armor-button"
buttonClass="fa-duotone fa-shield-quartered"
action="armorconsequence"
}}
</div>
{{/if}}
{{#if specialTo}}
<div class="consequence-button-container consequence-special-button-container special-consequence" data-csq-id="{{specialTo.id}}">
<div class="consequence-button-bg consequence-special-button-bg"></div>
<label class="consequence-button-label consequence-special-button-label">SPECIAL</label>
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="consequence-special-button"
buttonClass="fa-duotone fa-shield-quartered"
action="specialarmorconsequence"
}}
</div>
{{/if}}
{{/unless}}
</div>
{{/unless}}

{{!-- Type Surtitle --}}
<div class="consequence-type-container">
Expand All @@ -115,8 +120,8 @@
{{#if armorTo}}{{#unless (test armorTo.type "==" "None")}}
<label class="consequence-type armor-consequence">{{armorTo.typeDisplay}}</label>
{{/unless}}{{/if}}
{{#if specialArmorTo}}{{#unless (test specialArmorTo.type "==" "None")}}
<label class="consequence-type special-consequence">{{specialArmorTo.typeDisplay}}</label>
{{#if specialTo}}{{#unless (test specialTo.type "==" "None")}}
<label class="consequence-type special-consequence">{{specialTo.typeDisplay}}</label>
{{/unless}}{{/if}}

</div>
Expand All @@ -139,10 +144,10 @@
<label class="consequence-name armor-consequence">{{armorTo.name}}</label>
{{/if}}{{/if}}

{{#if specialArmorTo}}{{#if (test specialArmorTo.type "==" "None")}}
{{#if specialTo}}{{#if (test specialTo.type "==" "None")}}
<label class="consequence-name special-consequence fully-negated"></label>
{{else}}
<label class="consequence-name special-consequence">{{specialArmorTo.name}}</label>
<label class="consequence-name special-consequence">{{specialTo.name}}</label>
{{/if}}{{/if}}

</div>
Expand All @@ -167,13 +172,11 @@
<label class="consequence-footer-message consequence-special-message special-consequence">Resist with Armor</label>
{{/if}}

{{#if specialArmorTo}}{{#if specialArmorTo.footerMsg}}
{{#if specialTo}}{{#if specialTo.footerMsg}}
<div class="consequence-footer-bg special-consequence"></div>
<label class="consequence-footer-message consequence-special-message special-consequence">{{specialArmorTo.footerMsg}}</label>
<label class="consequence-footer-message consequence-special-message special-consequence">{{specialTo.footerMsg}}</label>
{{/if}}{{/if}}

</div>



</div>
Loading

0 comments on commit 24a99c8

Please sign in to comment.