Skip to content

Commit

Permalink
Consequences and resistance rolls working!
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunomiac committed Nov 22, 2023
1 parent bc5602d commit 83298d7
Show file tree
Hide file tree
Showing 67 changed files with 2,072 additions and 2,269 deletions.
Binary file added assets/animations/chat/energy-beam.webp
Binary file not shown.
Binary file added assets/animations/chat/fail-bg.webp
Binary file not shown.
Binary file added assets/animations/chat/lightning-ray.webp
Binary file not shown.
Binary file added assets/debug-false-canvas.webp
Binary file not shown.
726 changes: 639 additions & 87 deletions css/style.min.css

Large diffs are not rendered by default.

61 changes: 39 additions & 22 deletions css/tinymce/content.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ html, :root {
1px 1px 2px var(--blades-black-dark),
1px 1px 2px var(--blades-black-dark),
1px 1px 2px var(--blades-black-dark);
--text-shadow-emboss:
-1px -1px 1px var(--blades-white),
1px 1px 1px var(--blades-black-dark);
--box-shadow-dark: inset 0 0 0.3rem var(--blades-black-dark-fade);
--box-shadow-dark-strong: inset 0 0 0.5rem var(--blades-black-dark);
--color-default: var(--blades-white);
Expand Down Expand Up @@ -1072,7 +1075,7 @@ html .comp.controls-container .controls-panel.active .controls-list li:hover > a
}
html .comp.consequence-display-container, :root .comp.consequence-display-container {
--container-height: 40px;
--container-left-shift: 40px;
--container-left-shift: 0px;
--csq-icon-bg-color: var(--blades-black-dark);
--csq-type-bg: var(--csq-icon-dark);
--csq-button-size-mult: 0.33;
Expand All @@ -1084,13 +1087,13 @@ html .comp.consequence-display-container, :root .comp.consequence-display-contai
}
@keyframes icon-glow {
0% {
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px rgb(115, 255, 213));
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px var(--blades-red));
}
10% {
filter: brightness(1.25) blur(0px) drop-shadow(0px 0px 12px rgb(115, 255, 213));
filter: brightness(1.25) blur(0px) drop-shadow(0px 0px 12px var(--blades-red));
}
100% {
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px rgb(115, 255, 213));
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px var(--blades-red));
}
}
html .comp.consequence-display-container.dead-roll, html .comp.consequence-display-container .dead-roll *, :root .comp.consequence-display-container.dead-roll, :root .comp.consequence-display-container .dead-roll * {
Expand All @@ -1099,13 +1102,16 @@ html .comp.consequence-display-container.dead-roll, html .comp.consequence-displ
}
html .comp.consequence-display-container.consequence-accepted, html .comp.consequence-display-container.consequence-accepted *, :root .comp.consequence-display-container.consequence-accepted, :root .comp.consequence-display-container.consequence-accepted * {
--container-left-shift: 0px;
--csq-type-color: var(--blades-red) !important;
--csq-icon-bright: var(--blades-red) !important;
--csq-type-color: var(--blades-grey-bright) !important;
--csq-icon-bright: var(--blades-grey-bright) !important;
animation: none !important;
pointer-events: none !important;
outline: none !important;
text-shadow: var(--text-shadow-dark) !important;
}
html .comp.consequence-display-container.consequence-accepted .consequence-icon-container, html .comp.consequence-display-container.consequence-accepted * .consequence-icon-container, :root .comp.consequence-display-container.consequence-accepted .consequence-icon-container, :root .comp.consequence-display-container.consequence-accepted * .consequence-icon-container {
top: -3px !important;
}
html .comp.consequence-display-container .base-consequence, :root .comp.consequence-display-container .base-consequence {
--csq-icon-dark: var(--blades-black);
--csq-icon-med: var(--blades-grey);
Expand Down Expand Up @@ -1143,7 +1149,7 @@ html .comp.consequence-display-container .consequence-bg-image, :root .comp.cons
position: absolute;
height: 500%;
top: 80%;
transform: translate(-100%, -50%);
transform: translate(-110%, -50%);
transform-origin: 0% 50%;
width: 808.2px;
min-width: 808.2px;
Expand All @@ -1164,14 +1170,18 @@ html .comp.consequence-display-container .consequence-interaction-pad.accept-con
left: var(--pad-left-shift);
width: calc(100% - var(--pad-left-shift));
}
html .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad {
left: 0;
width: calc(var(--container-left-shift) - var(--container-height) * 0);
html .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad {
left: -200px;
width: calc(200px + var(--container-left-shift) - var(--container-height) * 0);
}
html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad {
height: 40%;
height: 50%;
z-index: 3;
}
html .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad {
height: 25%;
z-index: 4;
}
html .comp.consequence-display-container .consequence-icon-container, :root .comp.consequence-display-container .consequence-icon-container {
position: relative;
height: var(--container-height);
Expand Down Expand Up @@ -2693,7 +2703,7 @@ html .comp.controls-container .controls-panel.active .controls-list li:hover > a
}
html .comp.consequence-display-container, :root .comp.consequence-display-container {
--container-height: 40px;
--container-left-shift: 40px;
--container-left-shift: 0px;
--csq-icon-bg-color: var(--blades-black-dark);
--csq-type-bg: var(--csq-icon-dark);
--csq-button-size-mult: 0.33;
Expand All @@ -2705,13 +2715,13 @@ html .comp.consequence-display-container, :root .comp.consequence-display-contai
}
@keyframes icon-glow {
0% {
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px rgb(115, 255, 213));
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px var(--blades-red));
}
10% {
filter: brightness(1.25) blur(0px) drop-shadow(0px 0px 12px rgb(115, 255, 213));
filter: brightness(1.25) blur(0px) drop-shadow(0px 0px 12px var(--blades-red));
}
100% {
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px rgb(115, 255, 213));
filter: brightness(1) blur(1px) drop-shadow(0px 0px 0px var(--blades-red));
}
}
html .comp.consequence-display-container.dead-roll, html .comp.consequence-display-container .dead-roll *, :root .comp.consequence-display-container.dead-roll, :root .comp.consequence-display-container .dead-roll * {
Expand All @@ -2720,13 +2730,16 @@ html .comp.consequence-display-container.dead-roll, html .comp.consequence-displ
}
html .comp.consequence-display-container.consequence-accepted, html .comp.consequence-display-container.consequence-accepted *, :root .comp.consequence-display-container.consequence-accepted, :root .comp.consequence-display-container.consequence-accepted * {
--container-left-shift: 0px;
--csq-type-color: var(--blades-red) !important;
--csq-icon-bright: var(--blades-red) !important;
--csq-type-color: var(--blades-grey-bright) !important;
--csq-icon-bright: var(--blades-grey-bright) !important;
animation: none !important;
pointer-events: none !important;
outline: none !important;
text-shadow: var(--text-shadow-dark) !important;
}
html .comp.consequence-display-container.consequence-accepted .consequence-icon-container, html .comp.consequence-display-container.consequence-accepted * .consequence-icon-container, :root .comp.consequence-display-container.consequence-accepted .consequence-icon-container, :root .comp.consequence-display-container.consequence-accepted * .consequence-icon-container {
top: -3px !important;
}
html .comp.consequence-display-container .base-consequence, :root .comp.consequence-display-container .base-consequence {
--csq-icon-dark: var(--blades-black);
--csq-icon-med: var(--blades-grey);
Expand Down Expand Up @@ -2764,7 +2777,7 @@ html .comp.consequence-display-container .consequence-bg-image, :root .comp.cons
position: absolute;
height: 500%;
top: 80%;
transform: translate(-100%, -50%);
transform: translate(-110%, -50%);
transform-origin: 0% 50%;
width: 808.2px;
min-width: 808.2px;
Expand All @@ -2785,14 +2798,18 @@ html .comp.consequence-display-container .consequence-interaction-pad.accept-con
left: var(--pad-left-shift);
width: calc(100% - var(--pad-left-shift));
}
html .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad {
left: 0;
width: calc(var(--container-left-shift) - var(--container-height) * 0);
html .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, html .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.resist-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad {
left: -200px;
width: calc(200px + var(--container-left-shift) - var(--container-height) * 0);
}
html .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.special-armor-consequence-pad {
height: 40%;
height: 50%;
z-index: 3;
}
html .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad, :root .comp.consequence-display-container .consequence-interaction-pad.armor-consequence-pad {
height: 25%;
z-index: 4;
}
html .comp.consequence-display-container .consequence-icon-container, :root .comp.consequence-display-container .consequence-icon-container {
position: relative;
height: var(--container-height);
Expand Down
12 changes: 6 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const REGEXPPATTERNS = {
reverse, for end-of-lines: \s*?(\r\n)?
*/
init: new Map([
[/^\s+$/gm, "/*~ @@DOUBLE-BLANK@@ ~*/"] // Replace double-blank lines with token for later retrieval
[/^XXX/g, ""] // [/^\s+$/gm, "/*~ @@DOUBLE-BLANK@@ ~*/"] // Replace double-blank lines with token for later retrieval
]),
ts: new Map([
[/from "gsap\/all"/gu, 'from "/scripts/greensock/esm/all.js"'],
Expand All @@ -336,11 +336,11 @@ const REGEXPPATTERNS = {
[/#(region.*?)[ \t]*~$/gim, "#$1"], // Strip '~' from end-of-lines (used for automatic region folding)
[/#reg.*? /gs, ""], // Convert region headers to standard headers
[/((\r?\n)[ \t]*(?:\r?\n))+/g, "\r\n"], // Strip excess blank lines
[
/([ \t]*\r?\n\/\*~? @@DOUBLE-BLANK@@ ~\*\/)+/g,
"\r\n/*~ @@DOUBLE-BLANK@@ ~*/"
], // Collapse multiple double-blank lines
[/\/\*~? @@DOUBLE-BLANK@@ ~\*\//g, ""], // Restore double-blank lines
// [
// /([ \t]*\r?\n\/\*~? @@DOUBLE-BLANK@@ ~\*\/)+/g,
// "\r\n/*~ @@DOUBLE-BLANK@@ ~*/"
// ], // Collapse multiple double-blank lines
// [/\/\*~? @@DOUBLE-BLANK@@ ~\*\//g, ""], // Restore double-blank lines
[/([ \t]*\r?\n)*$/, ""], // Strip whitespace from end of files
[/^([ \t]*\r?\n)*/, ""] // Strip whitespace from start of files
])
Expand Down
25 changes: 0 additions & 25 deletions module/BladesActiveEffect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BladesActor from "./BladesActor.js";
import U from "./core/utilities.js";
import { Tag, BladesPhase, BladesActorType } from "./core/constants.js";
/*~ @@DOUBLE-BLANK@@ ~*/
const FUNCQUEUE = {};
// {type: "ability", name: "rX:/^(?!Ghost)/"}
const CUSTOMFUNCS = {
Expand Down Expand Up @@ -42,15 +41,13 @@ const CUSTOMFUNCS = {
APPLYTOMEMBERS: async () => new Promise(() => undefined),
APPLYTOCOHORTS: async () => new Promise(() => undefined),
remItem: async (actor, funcData, _, isReversing = false) => {
/*~ @@DOUBLE-BLANK@@ ~*/
function testString(targetString, testDef) {
if (testDef.startsWith("rX")) {
const pat = new RegExp(testDef.replace(/^rX:\/(.*?)\//, "$1"));
return pat.test(targetString);
}
return targetString === testDef;
}
/*~ @@DOUBLE-BLANK@@ ~*/
if (funcData.startsWith("{")) {
if (isReversing) {
console.error("Cannot reverse a 'remItem' custom effect that was defined with a JSON object.");
Expand Down Expand Up @@ -92,7 +89,6 @@ const CUSTOMFUNCS = {
return undefined;
}
};
/*~ @@DOUBLE-BLANK@@ ~*/
var EffectMode;
(function (EffectMode) {
EffectMode[EffectMode["Custom"] = 0] = "Custom";
Expand All @@ -102,22 +98,16 @@ var EffectMode;
EffectMode[EffectMode["Upgrade"] = 4] = "Upgrade";
EffectMode[EffectMode["Override"] = 5] = "Override";
})(EffectMode || (EffectMode = {}));
/*~ @@DOUBLE-BLANK@@ ~*/
class BladesActiveEffect extends ActiveEffect {
static Initialize() {
CONFIG.ActiveEffect.documentClass = BladesActiveEffect;
/*~ @@DOUBLE-BLANK@@ ~*/
Hooks.on("preCreateActiveEffect", async (effect) => {
/*~ @@DOUBLE-BLANK@@ ~*/
eLog.checkLog3("effect", "PRECREATE ActiveEffect", { effect, parent: effect.parent?.name });
/*~ @@DOUBLE-BLANK@@ ~*/
if (!(effect.parent instanceof BladesActor)) {
return;
}
/*~ @@DOUBLE-BLANK@@ ~*/
// Does this effect have an "APPLYTOMEMBERS" or "APPLYTOCOHORTS" CUSTOM effect?
if (effect.changes.some((change) => change.key === "APPLYTOMEMBERS")) {
/*~ @@DOUBLE-BLANK@@ ~*/
if (BladesActor.IsType(effect.parent, BladesActorType.pc) && BladesActor.IsType(effect.parent.crew, BladesActorType.crew)) {
const otherMembers = effect.parent.crew.members.filter((member) => member.id !== effect.parent?.id);
if (otherMembers.length > 0) {
Expand Down Expand Up @@ -163,11 +153,9 @@ class BladesActiveEffect extends ActiveEffect {
// Update effect on parent to only include 'APPLYTOCOHORTS' change
await effect.updateSource({ changes: effect.changes.filter((change) => change.key === "APPLYTOCOHORTS") });
}
/*~ @@DOUBLE-BLANK@@ ~*/
// Partition effect.changes into permanent and non-permanent changes:
const [permChanges, changes] = U.partition(effect.changes, (change) => change.key.startsWith("perm"));
await effect.updateSource({ changes });
/*~ @@DOUBLE-BLANK@@ ~*/
for (const permChange of permChanges) {
const { key, value } = permChange;
const permFuncName = key.replace(/^perm/, "");
Expand All @@ -186,13 +174,10 @@ class BladesActiveEffect extends ActiveEffect {
}
}
});
/*~ @@DOUBLE-BLANK@@ ~*/
Hooks.on("applyActiveEffect", (actor, changeData) => {
/*~ @@DOUBLE-BLANK@@ ~*/
if (!(actor instanceof BladesActor)) {
return;
}
/*~ @@DOUBLE-BLANK@@ ~*/
if (changeData.key in CUSTOMFUNCS) {
const funcData = {
funcName: changeData.key,
Expand All @@ -203,7 +188,6 @@ class BladesActiveEffect extends ActiveEffect {
BladesActiveEffect.ThrottleCustomFunc(actor, funcData);
}
});
/*~ @@DOUBLE-BLANK@@ ~*/
Hooks.on("updateActiveEffect", (effect, { disabled }) => {
if (!(effect.parent instanceof BladesActor)) {
return;
Expand All @@ -219,12 +203,10 @@ class BladesActiveEffect extends ActiveEffect {
BladesActiveEffect.ThrottleCustomFunc(effect.parent, funcData);
});
});
/*~ @@DOUBLE-BLANK@@ ~*/
Hooks.on("deleteActiveEffect", async (effect) => {
if (!(effect.parent instanceof BladesActor)) {
return;
}
/*~ @@DOUBLE-BLANK@@ ~*/
// Does this effect have an "APPLYTOMEMBERS" or "APPLYTOCOHORTS" CUSTOM effect?
if (effect.changes.some((change) => change.key === "APPLYTOMEMBERS")) {
if (BladesActor.IsType(effect.parent, BladesActorType.pc) && BladesActor.IsType(effect.parent.crew, BladesActorType.crew)) {
Expand Down Expand Up @@ -263,7 +245,6 @@ class BladesActiveEffect extends ActiveEffect {
// Clear flag from parent
await effect.parent.unsetFlag("eunos-blades", `cohortEffects.${effect.id}`);
}
/*~ @@DOUBLE-BLANK@@ ~*/
const customEffects = effect.changes.filter((changes) => changes.mode === 0);
customEffects.forEach(({ key, value }) => {
const funcData = {
Expand All @@ -276,12 +257,10 @@ class BladesActiveEffect extends ActiveEffect {
});
});
}
/*~ @@DOUBLE-BLANK@@ ~*/
static async AddActiveEffect(doc, name, eChanges, icon = "systems/eunos-blades/assets/icons/effect-icons/default.png") {
const changes = [eChanges].flat();
await doc.createEmbeddedDocuments("ActiveEffect", [{ name, icon, changes }]);
}
/*~ @@DOUBLE-BLANK@@ ~*/
static ThrottleCustomFunc(actor, data) {
const { funcName, funcData, isReversing, effect } = data;
if (!actor.id) {
Expand All @@ -307,7 +286,6 @@ class BladesActiveEffect extends ActiveEffect {
queue: []
};
}
/*~ @@DOUBLE-BLANK@@ ~*/
static async RunCustomFunc(actor, funcPromise) {
if (!actor.id) {
return;
Expand Down Expand Up @@ -365,7 +343,6 @@ class BladesActiveEffect extends ActiveEffect {
default: return null;
}
}
/*~ @@DOUBLE-BLANK@@ ~*/
async _preCreate(data, options, user) {
eLog.checkLog3("effect", "ActiveEffect._preCreate()", { data, options, user });
await super._preCreate(data, options, user);
Expand All @@ -374,7 +351,6 @@ class BladesActiveEffect extends ActiveEffect {
eLog.checkLog3("effect", "ActiveEffect._onDelete()", { options, userID });
super._onDelete(options, userID);
}
/*~ @@DOUBLE-BLANK@@ ~*/
get isSuppressed() {
// Get source item from "origin.js" field -- of form 'Actor.<id>.Item.<id>'
if (!/Actor.*Item/.test(this.origin)) {
Expand All @@ -386,5 +362,4 @@ class BladesActiveEffect extends ActiveEffect {
return super.isSuppressed || item?.hasTag(Tag.System.Archived);
}
}
/*~ @@DOUBLE-BLANK@@ ~*/
export default BladesActiveEffect;
Loading

0 comments on commit 83298d7

Please sign in to comment.