From 7f9b2ae237ac58404a2fc53860b68d06a833ff50 Mon Sep 17 00:00:00 2001 From: Cassie Levett Date: Mon, 11 May 2020 11:53:30 -0500 Subject: [PATCH] fix bug in primaries (#6415) --- Shadowrun4thEdition/Shadowrun4thEdition.html | 2232 +----------------- Shadowrun4thEdition/Shadowrun4thEdition.pug | 2 +- Shadowrun4thEdition/package.json | 30 + Shadowrun4thEdition/src/js/eventhandlers.js | 4 +- Shadowrun4thEdition/src/js/scripts.js | 96 +- Shadowrun4thEdition/translation.json | 2 +- 6 files changed, 88 insertions(+), 2278 deletions(-) create mode 100644 Shadowrun4thEdition/package.json diff --git a/Shadowrun4thEdition/Shadowrun4thEdition.html b/Shadowrun4thEdition/Shadowrun4thEdition.html index 4998cc486d..f4123975c7 100644 --- a/Shadowrun4thEdition/Shadowrun4thEdition.html +++ b/Shadowrun4thEdition/Shadowrun4thEdition.html @@ -1,47 +1,4 @@ - - - - -
-
Shadowrun -

Character

- -

Player

- -

/w GM

- -

wounds

- -

modifiers

- -

edge

- - - - - - - - - - - - -
- -
+
Shadowrun

Character

Player

/w GM

wounds

modifiers

edge

Personal Data

@@ -350,86 +307,7 @@
- -
-
-
-
- -

active..

-
-
-
-
- -

know..

-
-
-
-
- -

lang..

-
-
-
-

Skills

-
-
-
-
-
-

Skill

-

RTG

-

Attribute

-
-
- -
-
-
- - - - -
-
- - - - - - -
- - -
- - i - x -
-
-

active..

know..

lang..

Skills

Skill

RTG

Attribute

-
ix
- - - - -
-
-
-
-
-
-
- - - - - -
- - -
- - i - x -
-
- - - - - -
-
-
-
-
-
-
- - - - - -
- - -
- - i - x -
-
- - - - - -
-
-
-
-
-
-
-
-
+
ix
ix

Core Combat Info

@@ -775,1088 +537,7 @@
-
-
-
-
- -

Qualities

-
-
-
-
- -

Martial Arts

-
-
-
-
-
- -
-
-

Quality

-

Type

-
-
-
- - i - x -
-
- - -

notes

- -
-
-
-
-
-
-

Technique

-

Style

-
-
-
- - i - x -
-
- - -

notes

- -
-
-
-
-
-
-
- -
-
-
-

Weapons

-
-
-
-
-
- -

Ranged

-
-
-
-
- -

Melee

-
-
-
-
-
- -
-
-

Weapon

-

Dam

-

AP

-

Mode

-

Recoil

-

Ammo

-
-
- - - - - i - x -
-
- - - - - - -
-

Mode Options

- -

range

- -

primary

- -
-
-

skill

- -

specialization

- -

modifier

- - -
Exotic weapons are not linked to a skill. Use Modifier input to set dicepool.
-
-

notes

- -
-
-
-
-
-

Weapon

-

Dam

-

AP

-

Reach

-
-
- - - - i - x -
-
- - - - -

primary

- -
-

skill

- -

specialization

- -

modifier

- - -
Exotic weapons are not linked to a skill. Use Modifier input to set dicepool.
-
-

notes

- -
-
-
-
-
-
-
-
-

Armor

-
-
-
-
-
-
-

armor

-

ballistic

-

impact

-
-
- -
- - - i - x -
- - - - - - - - - - - - -
-
-
- - - -
-

Acid

-

Cold

-

Elec

-

Fire

-

Radi

-

Laser

-

Gause

-
-
- - - - - - - -
-
-

primary

- -

modifier

- -
-

notes

- -
-
-
-
-
-
-
-
-
-
-

Augmentations

-
-
-
-
-
-

Augmentations

-

Rating

-

Essence

-
-
-
- i - x -
-
- - - -

notes

- -
-
-
-
-
-
-
-
-
-
-

gear

-
-
-
-
-
-

Item

-

Rating

-

Quantity

-
-
-
- i - x -
-
- - - -

notes

- -
-
-
-
-
-
-
-
-
-
-

Magic

-
-
-
-
-
- -

Spells

-
-
-
-
- -

Prep...

-
-
-
-
- -

Rituals

-
-
-
-
-
- - + - -

modifier

- - -
-

spells

-

type

-

range

-

duration

-

drain

-
-
-
-
- - - i - x -
-
- - - - - -
-

Category

- -

Combat

- -

Damage

- -
-
-

Skill

- -

specialization

- -

modifier dice

- -
-

notes

- -
-
-
-
-
-
-
- - - i - x -
-
- - - - - -
-

Category

- -

Combat

- -

Damage

- -
-
-

Skill

- -

specialization

- -

modifier dice

- -
-

notes

- -
-
-
-
-

-
-

-

-

-

-
-
- - i - x -
-
- - - - -

notes

- -
-
-
-
-
-
-
- - - i - x -
-
- -
-

skill

- -

specialization

- -

modifier

- -
-

notes

- -
-
-
-
-
-
-
-
-
-

Adept Powers or Other Abilities

-
-
-
-
- - + - -

modifier

- -
-

Name

-

Rating

-
-
-
- i - x -
-
- - -

notes

- -
-
-
-
-
-
-
-
-
-
-

Commlinks

-
-
-
-
- -
-

Programs

-
- Q - - i - x -
-
-
- -
-
-

rating

- -
-
-

skill

- -
-
-

specialization

- -
-
-

modifier

- -
-

notes

- -
-
-
-
-
-
-
-
-

Complex Forms

-
-
-
-
- - + - -

modifier

- -
-
-

-

-

-

-
-
- - - i - x -
-
- - - - -
-

skill

- -

- -

modifier

- -
-

notes

- -
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-

- -
-
-

- -
-
-

- -
-
-

-
-
-
- - i - x -
-
-

-
-
-

-
-
-

-
-
-
-

- -

- -

- -

- -
-
-
-
-
-
-
-
-

-
-
-
-
-
-

name

-

loyalty

-

connection

-

favor

-
-
-
- - i - x -
-
- - - - -

notes

- -
-
-
-
-
-
-
+

Qualities

Martial Arts

Quality

Type

ix

notes

Technique

Style

ix

notes

Weapons

Ranged

Melee

Weapon

Dam

AP

Mode

Recoil

Ammo

ix

Mode Options

range

primary

skill

specialization

modifier

Exotic weapons are not linked to a skill. Use Modifier input to set dicepool.

notes

Weapon

Dam

AP

Reach

ix

primary

skill

specialization

modifier

Exotic weapons are not linked to a skill. Use Modifier input to set dicepool.

notes

Armor

armor

ballistic

impact

ix

Acid

Cold

Elec

Fire

Radi

Laser

Gause

primary

modifier

notes

Augmentations

Augmentations

Rating

Essence

ix

notes

gear

Item

Rating

Quantity

ix

notes

Magic

Spells

Prep...

Rituals

+

modifier

spells

type

range

duration

drain

ix

Category

Combat

Damage

Skill

specialization

modifier dice

notes

ix

Category

Combat

Damage

Skill

specialization

modifier dice

notes

ix

notes

ix

skill

specialization

modifier

notes

Adept Powers or Other Abilities

+

modifier

Name

Rating

ix

notes

Commlinks

Programs

Qix

rating

skill

specialization

modifier

notes

Complex Forms

+

modifier

ix

skill

modifier

notes

ix

name

loyalty

connection

favor

ix

notes

Vehicle

@@ -1994,7 +675,7 @@
-
+

Options

@@ -2043,459 +724,7 @@
-
- -
-
Shadowrun black and metallic logo -

/w GM

- -

wounds

- -

modifiers

- -

edge

- - - - y -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ess

- -

m

- -

f

- -

r

- -
-
- - - - - - - - - - -
-
-

Hand

- -

Hand (Off)

- -

Speed

- -

Speed (Off)

- -

Accel

- -

Body

- - - -

Sensor

- -

Seat

- -
-
- - - - - - - - - - -
-
-
-

Bonuses

- -
-

Professional Rating

- -
-
- - + - d6=+d6 -
-
- - + - d6=+d6 -
-
- - + - d6=+d6 -
-
-

Movement

- / - / + - = / / + -
-
- - / - =/ -
-
- - / - =/ -
-
- -
-
-
-

- -
-
-

- -
-
-

- / - -
-
-
-

soak

- = -
-
- - -
-
-
-

Modifier

-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-

Options

-
-
- - - -
-
- -
-
-
-
- -
-

key

- -
- -
-

key

- -
- -
-

key

- -
- -
-

key

- -
- -
-

key

- -
- -
-

key

- -
- -
-

key

- -
-
- -

key

-
- -
-
- -

key

-
- -
-
-

skills

-
- - - - - - x - - -
-

Skill

-

Rating

-

Rating Modifier

-

Attribute

-

wounds

modifiers

edge

y

ess

m

f

r

Hand

Hand (Off)

Speed

Speed (Off)

Accel

Body

Sensor

Seat

Bonuses

Professional Rating

+d6=+d6
+d6=+d6
+d6=+d6

Movement

/ / + = / / +
/=/
/=/

/

soak

=

Modifier

Options

key

key

key

key

key

key

key

key


key


skills

x

Skill

Rating

Rating Modifier

Attribute

- - - -

specialization

- -
-
-
-
-

knowledgeskills

-
- - - - - x - - -
-

Skill

-

Rating

-

Rating Modifier

-

Attribute

- - - - -

specialization

- -
-
-
-
-

languageskills

-
- - - - - x - - -
-

Skill

-

Rating

-

Rating Modifier

-

Attribute

- - - - -

specialization

- -
-
-
-
-

Weapons

-
- x - - - -
-

Range

-

Dice

-

Name

-

Type

-

Reach

-

Dam

-

AP

-

Modes

-

Recoil

-

Ammo

- - - - - - - - - - - (c) -
-
-
-
-

Spells

-
- x - - -
- -

Category

-

Dice

-

Name

-

Type

-

Range

-

Duration

-

Drain

-

Combat

-

Dam

- - - - - - - - - - -
-
-
-
-

Complex Forms

-
- x - - -
-

Dice

-

Name

-

Target

-

Duration

-

Fade

- - - - - - -
-
-
-
-
- -
- -
-
{{#header}} -

{{header}}

{{/header}} - {{#base}}{{base}}{{/base}} - {{#rollLess() wound 0}} ♦ {{/rollLess() wound 0}} - {{#rollLess() mod 0}} ♦ {{/rollLess() mod 0}} - {{#rollGreater() mod 0}} ♦ {{/rollGreater() mod 0}} - {{#rollGreater() edge 0}} ♦ {{/rollGreater() edge 0}} -
-
{{#dice}} -
{{dice}}
{{/dice}} - {{#desc}} -
- {{desc}} - {{#rollGreater() rea 0}},{{rea}} - {{/rollGreater() rea 0}} - {{#rollGreater() drain 1}},{{drain}} - {{/rollGreater() drain 1}} - {{#rollLess() drain 1}},{{drain}} - {{/rollLess() drain 1}}
{{/desc}} -
-
-
-
+

specialization

knowledgeskills

x

Skill

Rating

Rating Modifier

Attribute

specialization

languageskills

x

Skill

Rating

Rating Modifier

Attribute

specialization

Weapons

x

Range

Dice

Name

Type

Reach

Dam

AP

Modes

Recoil

Ammo

(c)

Spells

x

Category

Dice

Name

Type

Range

Duration

Drain

Combat

Dam

Complex Forms

x

Dice

Name

Target

Duration

Fade

{{#header}}

{{header}}

{{/header}} +{{#base}}{{base}}{{/base}} +{{#rollLess() wound 0}} ♦ {{/rollLess() wound 0}} +{{#rollLess() mod 0}} ♦ {{/rollLess() mod 0}} +{{#rollGreater() mod 0}} ♦ {{/rollGreater() mod 0}} +{{#rollGreater() edge 0}} ♦ {{/rollGreater() edge 0}}
{{#dice}}
{{dice}}
{{/dice}} +{{#desc}}
{{desc}} +{{#rollGreater() rea 0}},{{rea}} +{{/rollGreater() rea 0}} +{{#rollGreater() drain 1}},{{drain}} +{{/rollGreater() drain 1}} +{{#rollLess() drain 1}},{{drain}} +{{/rollLess() drain 1}}
{{/desc}}
@@ -3017,9 +957,7 @@ - - \ No newline at end of file diff --git a/Shadowrun4thEdition/Shadowrun4thEdition.pug b/Shadowrun4thEdition/Shadowrun4thEdition.pug index 90385a675a..ce13fa24b4 100644 --- a/Shadowrun4thEdition/Shadowrun4thEdition.pug +++ b/Shadowrun4thEdition/Shadowrun4thEdition.pug @@ -1,4 +1,4 @@ -input(name='attr_version' type='hidden' value='1.01') +input(name='attr_version' type='hidden' value='1.02') //- CHARACTER SHEET PAGE input.sheet_type(name='attr_sheet_type' type='hidden' value='pc') diff --git a/Shadowrun4thEdition/package.json b/Shadowrun4thEdition/package.json new file mode 100644 index 0000000000..eedacbe453 --- /dev/null +++ b/Shadowrun4thEdition/package.json @@ -0,0 +1,30 @@ +{ + "name": "roll20-character-sheets", + "version": "1.0.0", + "description": "compilers for character sheets", + "main": "index.js", + "dependencies": { + "pug": "^2.0.4", + "autoprefixer": "^7.1.4", + "node-sass": "^4.5.3", + "npm-run-all": "^4.1.1", + "postcss-cli": "^4.1.1" + }, + "scripts": { + "start": "npm-run-all --parallel compile:sass compile:pug", + "compile:sass": "node-sass Shadowrun4thEdition.scss Shadowrun4thEdition.css -w", + "compile:pug": "pug Shadowrun4thEdition.pug Shadowrun4thEdition.html -w", + "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style.comp.css -o css/style.prefix.css", + "build:css": "npm-run-all compile:sass prefix:css" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/clevett/roll20-character-sheets.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/clevett/roll20-character-sheets/issues" + }, + "homepage": "https://github.com/clevett/roll20-character-sheets#readme" +} diff --git a/Shadowrun4thEdition/src/js/eventhandlers.js b/Shadowrun4thEdition/src/js/eventhandlers.js index a6b64eba84..1f083e9d0a 100644 --- a/Shadowrun4thEdition/src/js/eventhandlers.js +++ b/Shadowrun4thEdition/src/js/eventhandlers.js @@ -43,7 +43,7 @@ sheetAttributes.weaponTypes.forEach(type => { on(`change:repeating_${type}:dicepool_modifier change:repeating_${type}:specialization`, eventinfo => updateRepeatingWeaponDicepool(eventinfo.triggerName)) - on(`change:repeating_${type}:primary`, eventinfo => updateRepeatingWeaponPrimary(eventinfo, type)) + on(`change:repeating_${type}:primary`, eventinfo => updateRepeatingPrimary(eventinfo, type)) }) sheetAttributes.rangeAttributes.forEach(attr => on(`change:repeating_range:${attr}`, eventinfo => updatePrimary(eventinfo))) @@ -52,7 +52,7 @@ sheetAttributes.armorAttributes.forEach(attr => on(`change:repeating_armor:${attr}`, eventinfo => updatePrimary(eventinfo))) - on("change:repeating_armor:primary", eventinfo => updateRepeatingArmorPrimary(eventinfo)) + on("change:repeating_armor:primary", eventinfo => updateRepeatingPrimary(eventinfo, 'armor')) on(`change:repeating_active:skill`, eventinfo => updateRepeatingSkillName(eventinfo)) diff --git a/Shadowrun4thEdition/src/js/scripts.js b/Shadowrun4thEdition/src/js/scripts.js index 6178ead69f..b39f76b370 100644 --- a/Shadowrun4thEdition/src/js/scripts.js +++ b/Shadowrun4thEdition/src/js/scripts.js @@ -50,36 +50,23 @@ const updatePrimary = eventinfo => { }) } -const updateRepeatingArmorPrimary = eventinfo => { +const updateRepeatingPrimary = (eventinfo, type) => { const repRowID = processingFunctions.getReprowid(eventinfo.triggerName) if (eventinfo.newValue === undefined) { return false } else if (eventinfo.newValue === 'primary') { - const constructedArmorAttributes = processingFunctions.shadowrun.addRepRow(repRowID, sheetAttributes.armorAttributes) - getAttrs(constructedArmorAttributes, attrs => { - const update = processingFunctions.shadowrun.updatePrimaryArmor(attrs) - processingFunctions.setAttributes(update) - }) - processingFunctions.shadowrun.resetRepeatingFieldsPrimaries(`repeating_armor`, repRowID) - } else { - const update = processingFunctions.shadowrun.resetPrimaryArmor() - processingFunctions.setAttributes(update) - } -} + const constructedAttributes = type === 'armor' ? shadowrunFunctions.addRepRow(repRowID, sheetAttributes.armorAttributes) : shadowrunFunctions.contructRepeatingWeaponAttributes(repRowID, type); -const updateRepeatingWeaponPrimary = (eventinfo, type) => { - const repRowID = processingFunctions.getReprowid(eventinfo.triggerName) - if (eventinfo.newValue === undefined) { - return false - } else if (eventinfo.newValue === 'primary') { - const constructedWeaponAttributes = processingFunctions.shadowrun.contructRepeatingWeaponAttributes(repRowID, type) - getAttrs(constructedWeaponAttributes, attrs => { - const update = processingFunctions.shadowrun.updatePrimaryWeapons(attrs) + //get the attributes to update primary + getAttrs(constructedAttributes, attrs => { + const update = type === 'armor' ? shadowrunFunctions.updatePrimaryArmor(attrs) : shadowrunFunctions.updatePrimaryWeapons(attrs); processingFunctions.setAttributes(update) }) - processingFunctions.shadowrun.resetRepeatingFieldsPrimaries(`repeating_${type}`, repRowID) + + //Reset all the other primaries + shadowrunFunctions.resetRepeatingFieldsPrimaries(`repeating_${type}`, repRowID) } else { - const update = processingFunctions.shadowrun.resetPrimaryWeapon(type) + const update = type === 'armor' ? shadowrunFunctions.resetPrimaryArmor() : shadowrunFunctions.resetPrimaryWeapon(type); processingFunctions.setAttributes(update) } } @@ -271,71 +258,6 @@ const updateDefaultAttribute = newValue => { /* OLD SCRIPTS */ -//This function checks changes to repeating_armor and updates the Primary Armor if needed -on("change:repeating_armor", (eventInfo) => { - const source = eventInfo.sourceAttribute; - const newV = eventInfo.newValue; - const arm = ["repeating_armor"]; - const armors = [`${arm}_name`, `${arm}_rating`, `${arm}_acid_modifier`, `${arm}_electrical_modifier`, `${arm}_laser_modifier`, `${arm}_gause_round_modifier`, `${arm}_cold_modifier`,`${arm}_fire_modifier`, `${arm}_radiation_modifier`, `${arm}_dicepool_modifier`]; - - //Check if the event was related to the primary flag & armor is set to primary - if (source.includes('primary') && newV === 'primary') { - //Get attributes from the repeating_armor - getAttrs(armors, (v) => { - let update = {}; - //Update the hidden static Primary Armor attributes with the repeating_armor attributes - _.each(armors, (armor) => { - const name = (armor.includes("name") || armor.includes("rating")) ? armor.split("repeating_")[1] : armor.split(`${arm}_`)[1]; - update[`${name}`] = v[`${armor}`]; - }); - - setAttrs(update); - }); - - //Set the other repeating_armor primary flags to 0 aka unchecked - getSectionIDs(`${arm}`, function(ids) { - let IDs = []; - let update = {}; - - for(var i=0; i < ids.length; i++) { - IDs.push(`${arm}_` + ids[i] + "_primary"); - }; - - IDs.forEach(id => { - if (id != source) { - update[`${id}`] = 0; - }; - }); - - setAttrs(update); - }); - //Check if the event was for a relevant Primary Armor attribute - } else if (source.includes('name') || source.includes('rating') || source.includes('dicepool') || source.includes('acid') || source.includes('cold') || source.includes('electrical') || source.includes('fire') || source.includes('radiation')) { - //Get the primary flag attribute for this armor. Also get the repeating_armor attribute we'll need for an update, doing it now is more efficient. - getAttrs([`${arm}_primary`, `${source}`], (v) => { - //Check if this armor is the designated Primary Armor. - if (v[`${arm}_primary`] === 'primary') { - let update = {}; - //Apply the repeating_armor attribute to its static counterpart - switch (true) { - case /name/.test(source) : update["armor_name"] = v[`${source}`]; break; - case /rating/.test(source) : update["armor_rating"] = v[`${source}`]; break; - case /dicepool/.test(source) : update["soak"] = v[`${source}`]; break; - case /acid/.test(source) : update["acid"] = v[`${source}`]; break; - case /cold/.test(source) : update["cold"] = v[`${source}`]; break; - case /electrical/.test(source): update["electrical"] = v[`${source}`]; break; - case /fire/.test(source) : update["fire"] = v[`${source}`]; break; - case /radiation/.test(source) : update["radiation"] = v[`${source}`]; break; - default: console.log(`Source ${source} was invalid`);} - - setAttrs(update); - }; - }); - } else { - console.log("CHANGE NOT RELEVENT Primary Armor"); - }; -}); - //Weapon displays set into an Array // Builder function to display details properly diff --git a/Shadowrun4thEdition/translation.json b/Shadowrun4thEdition/translation.json index 47149d346c..b65178c6c1 100644 --- a/Shadowrun4thEdition/translation.json +++ b/Shadowrun4thEdition/translation.json @@ -371,7 +371,7 @@ ,"run modifier": "run modifier" ,"movement modifier": "movement modifier" ,"preperations": "preperations" - ,"force": "force" + ,"force": "Force" ,"potency": "potency" ,"trigger": "trigger" ,"command": "command"