From 76fbb6c3003eb757f8694a114e633ca84a8515af Mon Sep 17 00:00:00 2001 From: Randy Knapp Date: Mon, 1 Jun 2020 10:59:52 -0700 Subject: [PATCH] [Zafir] Combat attribute calculator --- Zafir/zafir.css | 40 ++++++++++++++++++++ Zafir/zafir.html | 97 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 122 insertions(+), 15 deletions(-) diff --git a/Zafir/zafir.css b/Zafir/zafir.css index d4068ac2c4..ec7a104bb2 100644 --- a/Zafir/zafir.css +++ b/Zafir/zafir.css @@ -126,6 +126,38 @@ select.sheet-dtype { margin-top:12px; } +.sheet-attrcol1 { + display: inline-block; + vertical-align: top; + width: calc(20%); + margin-right: 20px; +} + +.sheet-attrcol2 { + display: inline-block; + vertical-align: top; + width: calc(50%); + margin-right: 20px; +} + +.sheet-attrcol3 { + display: inline-block; + vertical-align: top; + width: calc(24%); + margin-right: 0px; +} + +.sheet-attrvalue { + display: inline-block; + width: 24px; + text-align: center; +} + +.sheet-attrtotal { + border-radius: 5px; + border: 2px solid #c1912e; +} + .sheet-gmtools select, .sheet-res select, .sheet-atk select { @@ -301,6 +333,10 @@ div.itemcontrol { border: 2px solid #AAA; } +.sheet-skillroller { + border: 2px solid #c1912e; +} + .sheet-attack label, .sheet-paneltracker label { vertical-align: middle; @@ -474,6 +510,10 @@ input[type=checkbox] { margin-bottom: 6px; } +.sheet-combatattr .sheet-tooltiptext { + left: 10%; +} + .sheet-tooltip .sheet-tooltiptext b { font-size: 14px; font-weight: bold; diff --git a/Zafir/zafir.html b/Zafir/zafir.html index bd47edd3bc..005e98140e 100644 --- a/Zafir/zafir.html +++ b/Zafir/zafir.html @@ -23,7 +23,7 @@
-
+

Base Attributes



@@ -31,20 +31,47 @@
-
+

Combat Attributes

-
-
-
- + + = + 2Base HP: 2 + + + Half Level + + + Toughness + + + Body Armor: HP + + + Other +
+ + = + 6Base Speed: 6 + + + Agility × 2 + + + Other +
+ + = + Accuracy + + + Other +
+ + = + Discipline + + + Other
-
+

Status

 / 


- +  / 
@@ -53,7 +80,7 @@
- + @@ -62,13 +89,13 @@

- +
-

Combat Panel

+

Combat

@@ -425,7 +452,7 @@
-
+

Game Master's Toolkit

- +

@@ -792,7 +819,7 @@ buttonlistAbilities.forEach(button => { }); }); -// Combat panel sheet tab bar +// Combat sheet tab bar const buttonlistAttacks = ["cwp", "cwl"]; buttonlistAttacks.forEach(button => { on(`clicked:${button}`, function() { @@ -802,7 +829,7 @@ buttonlistAttacks.forEach(button => { }); }); -// Combat panel sheet tab bar +// Combat sheet tab bar const buttonlistGm = ["gmcombat", "gmunits"]; buttonlistGm.forEach(button => { on(`clicked:${button}`, function() { @@ -837,6 +864,46 @@ function sheetOpenAndAttrChanged(inputs) { return "sheet:opened change:" + inputs.join(" change:"); } +// Setting the calculated attributes +const combatAttrInputs = [ + "level", + "toughness", + "agility", + "accuracy", + "discipline", + "maxhpother", + "speedother", + "aimother", + "willother", + "bahp" +]; +on(sheetOpenAndAttrChanged(combatAttrInputs), function() { + getAttrs(combatAttrInputs, function(values) { + let level = parseInt(values.level)||0; + let toughness = parseInt(values.toughness)||0; + let agility = parseInt(values.agility)||0; + let accuracy = parseInt(values.accuracy)||0; + let discipline = parseInt(values.discipline)||0; + let maxhpother = parseInt(values.maxhpother)||0; + let speedother = parseInt(values.speedother)||0; + let aimother = parseInt(values.aimother)||0; + let willother = parseInt(values.willother)||0; + let bodyArmorHP = parseInt(values.bahp)||0; + + let halflevel = Math.floor(level / 2); + let doubleAgility = (agility * 2); + + setAttrs({ + halflevel: halflevel, + doubleagility: doubleAgility, + hp_max: 2 + halflevel + toughness + bodyArmorHP + maxhpother, + speed: 6 + doubleAgility + speedother, + aim: accuracy + aimother, + will: discipline + willother + }); + }); +}); + // Setting the aim dice for weapon attacks const attackDiceInputs = [ "wpaimdice",