- {{#damage2type}}
- {{damage2type}}
- {{/damage2type}}
- {{^damage2type}}
- DAMAGE
- {{/damage2type}}
-
+
+ {{#savetype}}{{savetype}} {{/savetype}}{{^savetype}}SAVE{{/savetype}}
- {{#rollWasCrit() r2}}
- {{#rollGreater() attackflag 0}}
- {{#crit2effect}}
-
-
- CRIT EFFECT
-
-
- {{crit2effect}}
-
-
- {{/crit2effect}}
- {{#crit2damage}}
-
-
- CRIT DAMAGE
-
-
- {{crit2damage}}
-
-
- {{/crit2damage}}
- {{/rollGreater() attackflag 0}}
- {{/rollWasCrit() r2}}
- {{/damage2}}
- {{/rollGreater() damageflag 0}}
- {{/rollGreater() fullattack 1}}{{#rollGreater() fullattack 2}}
- {{#rollGreater() attackflag 0}}
- {{#r3}}
-
3rd ATTACK
-
-
- {{#r3name}}
- {{r3name}}
- {{/r3name}}
- {{^r3name}}
- ATTACK
- {{/r3name}}
-
-
- {{r3}}
-
+
+ DC {{dc}}
- {{/r3}}
- {{/rollGreater() attackflag 0}}
- {{#rollGreater() damageflag 0}}
- {{#damage3}}
-
-
- {{#damage3type}}
- {{damage3type}}
- {{/damage3type}}
- {{^damage3type}}
- DAMAGE
- {{/damage3type}}
-
-
- {{damage3}}
-
-
- {{#rollWasCrit() r3}}
- {{#rollGreater() attackflag 0}}
- {{#crit3effect}}
-
-
- CRIT EFFECT
-
-
- {{crit3effect}}
-
-
- {{/crit3effect}}
- {{#crit3damage}}
-
-
- CRIT DAMAGE
-
-
- {{crit3damage}}
-
-
- {{/crit3damage}}
- {{/rollGreater() attackflag 0}}
- {{/rollWasCrit() r3}}
- {{/damage3}}
- {{/rollGreater() damageflag 0}}
- {{/rollGreater() fullattack 2}}{{#rollGreater() fullattack 3}}
- {{#rollGreater() attackflag 0}}
- {{#r4}}
-
4th ATTACK
-
-
- {{#r4name}}
- {{r4name}}
- {{/r4name}}
- {{^r4name}}
- ATTACK
- {{/r4name}}
-
-
- {{r4}}
-
-
- {{/r4}}
- {{/rollGreater() attackflag 0}}
- {{#rollGreater() damageflag 0}}
- {{#damage4}}
-
-
- {{#damage4type}}
- {{damage4type}}
- {{/damage4type}}
- {{^damage4type}}
- DAMAGE
- {{/damage4type}}
-
-
- {{damage4}}
-
-
- {{#rollWasCrit() r4}}
- {{#rollGreater() attackflag 0}}
- {{#crit4effect}}
-
-
- CRIT EFFECT
-
-
- {{crit4effect}}
-
-
- {{/crit4effect}}
- {{#crit4damage}}
-
-
- CRIT DAMAGE
-
-
- {{crit4damage}}
-
-
- {{/crit4damage}}
- {{/rollGreater() attackflag 0}}
- {{/rollWasCrit() r4}}
- {{/damage4}}
- {{/rollGreater() damageflag 0}}
- {{/rollGreater() fullattack 3}}{{#rollGreater() fullattack 4}}
- {{#rollGreater() attackflag 0}}
- {{#r5}}
-
5th ATTACK
-
-
- {{#r5name}}
- {{r5name}}
- {{/r5name}}
- {{^r5name}}
- ATTACK
- {{/r5name}}
-
-
- {{r5}}
-
-
- {{/r5}}
- {{/rollGreater() attackflag 0}}
- {{#rollGreater() damageflag 0}}
- {{#damage5}}
-
-
- {{#damage5type}}
- {{damage5type}}
- {{/damage5type}}
- {{^damage5type}}
- DAMAGE
- {{/damage5type}}
-
-
- {{damage5}}
-
-
- {{#rollWasCrit() r5}}
- {{#rollGreater() attackflag 0}}
- {{#crit5effect}}
-
-
- CRIT EFFECT
-
-
- {{crit5effect}}
-
-
- {{/crit5effect}}
- {{#crit5damage}}
-
-
- CRIT DAMAGE
-
-
- {{crit5damage}}
-
-
- {{/crit5damage}}
- {{/rollGreater() attackflag 0}}
- {{/rollWasCrit() r5}}
- {{/damage5}}
- {{/rollGreater() damageflag 0}}
- {{/rollGreater() fullattack 4}}{{#notes}}
+
+ {{/dc}}{{#savecritsuccess}}
+
+
+ {{/savecritsuccess}}{{#savesuccess}}
+
+ **Success**
+
+
+ {{/savesuccess}}{{#savefailure}}
+
+ **Failure**
+
+
+ {{/savefailure}}{{#savecritfailure}}
+
+ **Critical Failure**
+
+
+ {{/savecritfailure}}{{#notes}}
NOTES: {{notes}}
@@ -7044,7 +7790,7 @@ This pattern can be found at https://regexr.com/3mi9v
/*start starfinder.js*/
var sheet = sheet || (function(){
'use strict';
- const version = '0.011537880400',//The sheet's current version. This is put into the character_sheet attribute when a sheet is opened. I've been doing version numbering as 0.0Xyyyyyyyyyy where X represents the state of the sheet (currently in stage 4, or open beta) and y is the UNIX epoch timestamp for when I finished that build
+ const version = '0.011539090000',//The sheet's current version. This is put into the character_sheet attribute when a sheet is opened. I've been doing version numbering as 0.0Xyyyyyyyyyy where X represents the state of the sheet (currently in stage 4, or open beta) and y is the UNIX epoch timestamp for when I finished that build
pilotingRanks={},
sheetAttributes = [/*An array of all the non-repeating sheet attributes that could potentially be used in the calculations performed by the script
This array is used in the getAttrs call in accessStarfinder()*/
@@ -7688,6 +8434,7 @@ This pattern can be found at https://regexr.com/3mi9v
attributes = ['character_sheet'];
TAS.log('Updating Sheet');
getID(JSON.parse(JSON.stringify(repeatingAttributes)),(sectionAggregate)=>{
+ TAS.log(`sectionAggregate:${JSON.stringify(sectionAggregate)}`);
_.each(sectionAggregate,(section)=>{
_.each(section.id,(sid)=>{
_.each(section.fields,(f)=>{
@@ -7713,15 +8460,15 @@ This pattern can be found at https://regexr.com/3mi9v
updateBuildDateTo = buildDate*1||0;
});
TAS.log(`oldVersion: ${oldVersion} | oldBuildDate: ${oldBuildDate} | updateVersionTo: ${updateVersionTo} | updateBuildDateTo: ${updateBuildDateTo}`);
- if(updateAttrs.class_name!=='' && ((oldVersion <=0.01 && oldBuildDate <= 1535374800)||!oldVersion)){
+ if(updateAttrs.class_name!=='' && oldVersion <=0.01 && oldBuildDate <= 1535374800&&oldVersion && updateAttrs.sheet_type !== 'npc'){
firstUpgrade(updateAttrs,setObj);
}
TAS.log(`pre sep10 if | ${oldBuildDate} <= 1535374800: ${(oldBuildDate < 1536670800)}`);
- if(oldBuildDate < 1536670800 || !oldVersion){
+ if(oldBuildDate < 1536670800 && oldVersion && updateAttrs.sheet_type !== 'npc'){
TAS.log('here');
upgradeSep10(updateAttrs,setObj);
}
- if(oldBuildDate < 1537880400){
+ if(oldBuildDate < 1537880400 && oldVersion && updateAttrs.sheet_type !== 'npc'){
TAS.log('updating to v0.11537880400');
upgradeTo1537880400(updateAttrs,setObj);
}
@@ -7731,8 +8478,6 @@ This pattern can be found at https://regexr.com/3mi9v
upgradeTo1537880400 = function(attributes,setObj){
let profKeys = _.filter(_.keys(attributes),(key)=>{return /proficiency/.test(key)});
- TAS.log(`profKeys: ${JSON.stringify(profKeys)}`);
- TAS.log(`arcana_proficiency:${attributes.arcana_proficiency}`);
_.each(profKeys,(key)=>{
if(attributes[key]*1<0){
setObj[key]=-4;
@@ -7742,6 +8487,11 @@ This pattern can be found at https://regexr.com/3mi9v
setAttrs(setObj);
},
+ upgradeSep10 = function(attributes,setObj){
+ accessSheet({sourceAttribute:'dexterity_base',newValue:attributes.dexterity_base,previousValue:attributes.dexterity_base});
+ accessSheet({sourceAttribute:'charisma_base',newValue:attributes.charisma_base,previousValue:attributes.charisma_base});
+ },
+
firstUpgrade = function(attributes,setObj){
let profAttrs = _.filter(_.keys(attributes),(attr)=>{
return /proficiency/.test(attr);
@@ -7767,11 +8517,6 @@ This pattern can be found at https://regexr.com/3mi9v
});
},
- upgradeSep10 = function(attributes,setObj){
- accessSheet({sourceAttribute:'dexterity_base',newValue:attributes.dexterity_base,previousValue:attributes.dexterity_base});
- accessSheet({sourceAttribute:'charisma_base',newValue:attributes.charisma_base,previousValue:attributes.charisma_base});
- },
-
transferSpell = function(attributes,attribute,setObj){
let id = attribute.replace(/(repeating_[^_]+_[^_]+_).+/,'$1'),
level = attributes[`${id}level`],
@@ -7801,8 +8546,10 @@ This pattern can be found at https://regexr.com/3mi9v
*/
getID = function(cloneRepAttr,callback,sectionAggregate,event,attribute){
const currSection=cloneRepAttr.shift();
+ TAS.log(`currSection:${JSON.stringify(currSection)}`);
sectionAggregate = sectionAggregate || [];
- getSectionIDs('repeating_'+currSection.section,(itemIDArr)=>{
+ getSectionIDs(`repeating_${currSection.section}`,(itemIDArr)=>{
+ TAS.log(`itemIDArr:${JSON.stringify(itemIDArr)}`);
sectionAggregate.push({
section:currSection.section,
id:itemIDArr,
@@ -7829,7 +8576,13 @@ This pattern can be found at https://regexr.com/3mi9v
});
attributesToGet = attributesToGet.concat(sheetAttributes);
getAttrs(attributesToGet,(objs)=>{
- if(/repeating_(?:cantrip|spell[1-9]0?)_[^_]+_level/.test(attribute)){
+ if(objs.sheet_type==='npc'){
+ setObj.attack_query_translation=getTranslationByKey('attack number');
+ if(/repeating_attack/.test(event.triggerName)){
+ setObj[`${event.triggerName}_id`]=event.triggerName.replace(/repeating_attack_/,'');
+ }
+ setAttrs(setObj,{silent:true});
+ }else if(/repeating_(?:cantrip|spell[1-9]0?)_[^_]+_level/.test(attribute)){
transferSpell(objs,attribute,setObj);
_.each(_.keys(setObj),(key)=>{
TAS.log(`setObj[${key}]: ${setObj[key]}`);