Skip to content

Commit

Permalink
Merge pull request Roll20#8213 from DBFBlackbull/AD&D_2E-Weapontype-v…
Browse files Browse the repository at this point in the history
…s-armor

[AD&D 2E] weapontype vs armor and more
  • Loading branch information
mperes authored Feb 3, 2021
2 parents 5bfcef6 + 78b05c1 commit 106eacd
Show file tree
Hide file tree
Showing 7 changed files with 7,561 additions and 2,121 deletions.
5,437 changes: 4,076 additions & 1,361 deletions AD&D 2E Revised/2ESheet.html

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions AD&D 2E Revised/2EStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,14 @@ table.sheet-default-header-every-third-column td:nth-child(3n+1),
vertical-align: middle;
}

.sheet-centering-horizontal {
text-align: center;
}

.sheet-centering-vertical {
vertical-align: middle;
}

.sheet-table-center {
margin-left: auto;
margin-right: auto;
Expand Down Expand Up @@ -1307,12 +1315,14 @@ input.sheet-show-spell-details:checked ~ .sheet-spell-details {
}

/* Announcement styling start */
.sheet-worn-equipment,
.sheet-spell-points-wiz,
.sheet-spell-points-pri,
.sheet-announcement {
display: none;
}

input.sheet-show-worn-equipment:checked ~ .sheet-worn-equipment,
input.sheet-show-spell-points-wiz:checked ~ .sheet-spell-points-wiz,
input.sheet-show-spell-points-pri:checked ~ .sheet-spell-points-pri,
input.sheet-show-announcement:checked ~ .sheet-announcement
Expand Down
598 changes: 585 additions & 13 deletions AD&D 2E Revised/javascript/priestSpells.js

Large diffs are not rendered by default.

115 changes: 67 additions & 48 deletions AD&D 2E Revised/javascript/sheetWorkers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// --- ALL SHEET WORKERS START --- //
const SheetWorker = 'sheetworker';
const Player = 'player';

//Ability Score Parser function
function getLookupValue(abilityScoreString, defaultValue, isStrength = false) {
Expand Down Expand Up @@ -473,35 +475,37 @@ function setupSpellSumming(sections, oldField, newField, resultFieldName) {
// --- End summing numbers from repeating spells for wizard and priest --- //

function setupAutoFillSpellInfo(section, spellsTable) {
on(`change:repeating_spells-${section}:spell-select`, function(eventInfo){

let spell = spellsTable[section][eventInfo.newValue];
if (spell === undefined)
return;

let spellInfo ={
[`repeating_spells-${section}_spell-name`] : spell['name'],
[`repeating_spells-${section}_spell-cast-time`] : spell['cast-time'],
[`repeating_spells-${section}_spell-level`] : spell['level'],
[`repeating_spells-${section}_spell-school`] : spell['school'],
[`repeating_spells-${section}_spell-components`] : spell['components'],
[`repeating_spells-${section}_spell-range`] : spell['range'],
[`repeating_spells-${section}_spell-aoe`] : spell['aoe'],
[`repeating_spells-${section}_spell-duration`] : spell['duration'],
[`repeating_spells-${section}_spell-damage`] : spell['damage'],
[`repeating_spells-${section}_spell-damage-type`] : spell['damage-type'],
[`repeating_spells-${section}_spell-saving-throw`] : spell['saving-throw'],
[`repeating_spells-${section}_spell-healing`] : spell['healing'],
[`repeating_spells-${section}_spell-materials`] : spell['materials'],
[`repeating_spells-${section}_spell-reference`] : spell['reference'],
[`repeating_spells-${section}_spell-effect`] : spell['effect']
}
if (section.startsWith('pri')) {
spellInfo[`repeating_spells-${section}_spell-sphere`] = spell['sphere'];
}
if (spellsTable[section]) {
on(`change:repeating_spells-${section}:spell-select`, function(eventInfo){

let spell = spellsTable[section][eventInfo.newValue];
if (spell === undefined)
return;

let spellInfo ={
[`repeating_spells-${section}_spell-name`] : spell['name'],
[`repeating_spells-${section}_spell-cast-time`] : spell['cast-time'],
[`repeating_spells-${section}_spell-level`] : spell['level'],
[`repeating_spells-${section}_spell-school`] : spell['school'],
[`repeating_spells-${section}_spell-components`] : spell['components'],
[`repeating_spells-${section}_spell-range`] : spell['range'],
[`repeating_spells-${section}_spell-aoe`] : spell['aoe'],
[`repeating_spells-${section}_spell-duration`] : spell['duration'],
[`repeating_spells-${section}_spell-damage`] : spell['damage'],
[`repeating_spells-${section}_spell-damage-type`] : spell['damage-type'],
[`repeating_spells-${section}_spell-saving-throw`] : spell['saving-throw'],
[`repeating_spells-${section}_spell-healing`] : spell['healing'],
[`repeating_spells-${section}_spell-materials`] : spell['materials'],
[`repeating_spells-${section}_spell-reference`] : spell['reference'],
[`repeating_spells-${section}_spell-effect`] : spell['effect']
}
if (section.startsWith('pri')) {
spellInfo[`repeating_spells-${section}_spell-sphere`] = spell['sphere'];
}

setAttrs(spellInfo);
});
setAttrs(spellInfo);
});
}
}

function setupCalculateRemaining(totalField, sumField, remainingField) {
Expand Down Expand Up @@ -564,30 +568,30 @@ function setupRepeatingRowCalculateTotal(repeatingTotalField, repeatingFieldsToS
let wizardSpellLevelsSections = [
{level: 1, sections: ['', '2', '3', 'wiz1']},
{level: 2, sections: ['4', '5', '6', 'wiz2']},
{level: 3, sections: ['7', '8', '9']},
{level: 4, sections: ['10', '11', '12']},
{level: 5, sections: ['70', '71', '72']}, //... legacy naming convention
{level: 6, sections: ['13', '14', '15']},
{level: 7, sections: ['16', '17', '18']},
{level: 8, sections: ['19', '20', '21']},
{level: 9, sections: ['22', '23', '24']},
{level: 10, sections: ['25', '26', '27']},
{level: 11, sections: ['52', '53', '54']}, //... legacy naming convention
{level: 12, sections: ['55', '56', '57']},
{level: 13, sections: ['58', '59', '60']},
{level: 14, sections: ['61', '62', '63']},
{level: 15, sections: ['64', '65', '66']},
{level: 3, sections: ['7', '8', '9', 'wiz3']},
{level: 4, sections: ['10', '11', '12', 'wiz4']},
{level: 5, sections: ['70', '71', '72', 'wiz5']}, //... legacy naming convention
{level: 6, sections: ['13', '14', '15', 'wiz6']},
{level: 7, sections: ['16', '17', '18', 'wiz7']},
{level: 8, sections: ['19', '20', '21', 'wiz8']},
{level: 9, sections: ['22', '23', '24', 'wiz9']},
{level: 10, sections: ['25', '26', '27', 'wiz10']},
{level: 11, sections: ['52', '53', '54', 'wiz11']}, //... legacy naming convention
{level: 12, sections: ['55', '56', '57', 'wiz12']},
{level: 13, sections: ['58', '59', '60', 'wiz13']},
{level: 14, sections: ['61', '62', '63', 'wiz14']},
{level: 15, sections: ['64', '65', '66', 'wiz15']},
];

let priestSpellLevelsSections = [
{level: '1', sections: ['28', '29', '30', 'pri1']},
{level: '2', sections: ['31', '32', '33', 'pri2']},
{level: '3', sections: ['34', '35', '36']},
{level: '4', sections: ['37', '38', '39']},
{level: '5', sections: ['40', '41', '42']},
{level: '6', sections: ['43', '44', '45']},
{level: '7', sections: ['46', '47', '48']},
{level: 'q', sections: ['49', '50', '51']},
{level: '3', sections: ['34', '35', '36', 'pri3']},
{level: '4', sections: ['37', '38', '39', 'pri4']},
{level: '5', sections: ['40', '41', '42', 'pri5']},
{level: '6', sections: ['43', '44', '45', 'pri6']},
{level: '7', sections: ['46', '47', '48', 'pri7']},
{level: 'q', sections: ['49', '50', '51', 'priq']},
];

// --- Start setup Spell Slots --- //
Expand Down Expand Up @@ -682,6 +686,21 @@ on('change:repeating_customrogue:crl remove:repeating_customrogue', function(){
});
// --- End setup Rogue skills total --- //

//Related weapons / familiarity penalty
on('change:nonprof-penalty', function (eventInfo) {
if (eventInfo.sourceType === SheetWorker) {
return;
}
getAttrs(['nonprof-penalty'], function(values) {
let nonprof = Math.abs(parseInt(values['nonprof-penalty'])) * -1;
let famil = Math.floor(nonprof / 2)
setAttrs({
['nonprof-penalty']: nonprof,
['famil-penalty']: famil
});
});
})

//Weapon proficiency slots
on('change:repeating_weaponprofs:weapprofnum remove:repeating_weaponprofs', function(){
TAS.repeatingSimpleSum('weaponprofs', 'weapprofnum', 'weapprofslotssum');
Expand All @@ -700,7 +719,7 @@ on('change:repeating_gear:gearweight change:repeating_gear:gearqty remove:repeat

//Equipment Stored Section
//Mount Equipment Carried Section Continued
on('change:repeating_gear-stored:gear-stored-weight change:repeating_gear-stored:gear-stored-qty change:repeating_gear-stored:on-mount remove:repeating_gear-stored change:on-mount change:gear-stored-weight change:gear-stored-qty', function(){
on('change:repeating_gear-stored:gear-stored-weight change:repeating_gear-stored:gear-stored-qty change:repeating_gear-stored:on-mount remove:repeating_gear-stored', function(){

TAS.repeating('gear-stored')
.attrs('mount-gear-weight-total','stored-gear-weight-total')
Expand Down
53 changes: 11 additions & 42 deletions AD&D 2E Revised/javascript/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// --- Version change start --- //

const sheetName = 'AD&D 2E Revised';
const sheetVersion = '3.3.2a';
const sheetVersion = '3.4.0';

function moveStaticToRepeating(section, fieldsToMove) {
getAttrs(fieldsToMove, function (values) {
Expand Down Expand Up @@ -37,46 +37,7 @@ on('sheet:opened', function(){
version: `v${sheetVersion}`,
announcement: 1
},{silent:true});

getAttrs(['spell-points', 'spell-points-priest'], function(values) {
let sp = parseInt(values['spell-points']) || 0;
let psp = parseInt(values['spell-points-priest']) || 0;

let newValue = {};
if (sp > 0) {
console.log(`Old spell points: ${sp}`);
newValue['spell-points-lvl'] = sp;
newValue['spell-points'] = '';
}

if (psp > 0) {
console.log(`Old spell points priest: ${psp}`);
newValue['spell-points-priest-lvl'] = psp;
newValue['spell-points-priest'] = '';
}

setAttrs(newValue);
});

TAS.repeating('spells')
.fields('spell-points', 'spell-points1', 'arc', 'arc1')
.each(function (r) {
let spellPoints1 = r.I['spell-points1'];
if (spellPoints1) {
console.log('Updating repeating spells-points');
r['spell-points'] = spellPoints1;
r['spell-points1'] = '';
}

let arc1 = r.I['arc1'];
if (arc1) {
console.log('Updating repeating arc');
r['arc'] = arc1;
r['arc1'] = '';
}
})
.execute();


moveStaticToRepeating('weaponprofs', ['weapprofname', 'weapprofnum', 'expert', 'specialist', 'mastery', 'high-mastery', 'grand-mastery', 'chosen-weapon']);
moveStaticToRepeating('profs', ['profname', 'profslots', 'profstatnum', 'profmod']);
moveStaticToRepeating('langs', ['langname', 'lang-rw']);
Expand All @@ -91,7 +52,15 @@ on('sheet:opened', function(){
//melee damage weapons
moveStaticToRepeating('weapons', ['weaponname', 'strbonus', 'dexbonus', 'prof-level', 'attacknum', 'attackadj', 'ThAC0', 'crit-thresh', 'range', 'size', 'weaptype-slash', 'weaptype-pierce', 'weaptype-blunt', 'weapspeed']);
moveStaticToRepeating('weapons-damage', ['weaponname1', 'strbonus1', 'dexbonus1', 'specialist-damage', 'mastery-damage', 'damadj', 'damsm', 'daml', 'knockdown1']);


getAttrs(['nonprof-penalty'], function(values) {
let nonprof = Math.abs(parseInt(values['nonprof-penalty'])) * -1;
let famil = Math.floor(nonprof / 2)
setAttrs({
['nonprof-penalty']: nonprof,
['famil-penalty']: famil
});
});
}
});
});
Expand Down
Loading

0 comments on commit 106eacd

Please sign in to comment.