Fix armament rangemod calculation
Updated change log Updated sheet version Removed unnecessary console logging
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
v2.0 Richard W: Added ship tab
|
||||
v2.01 Richard W: Fixed Rolltemplate AllProps and Stress hits
|
||||
v3.00 Richard W: Added encumbrance and list tab indicators, API dice rolls
|
||||
v3.01 Richard W: AFixed roll names to make macros work
|
||||
v3.01 Richard W: Fixed roll names to make macros work
|
||||
v3.02 Richard W: Fixed armament roll rangemod to calculate on load
|
||||
-->
|
||||
|
||||
<input type="hidden" name="attr_sheetversion" value="3.01">
|
||||
<input type="hidden" name="attr_sheetversion" value="3.02">
|
||||
<input type="hidden" name="attr_version" value="0">
|
||||
<input type="hidden" name="attr_newchar" value="1">
|
||||
<input class="tab-sheet" type="hidden" name="attr_tab_sheet" value="Character">
|
||||
@@ -1745,7 +1746,7 @@
|
||||
<div class="grid-item weapon-item type">
|
||||
<input type="hidden" name="attr_armament5_rangemod" readonly hidden />
|
||||
<button type="roll" name="armament5" class="button-skill roll-rolltemplate" value="@{secret_roll} &{template:alien} {{character-name=@{ship-name}}} {{roll-name=@{armament5_name}}} {{roll-type=@{armament5_type}}} {{base-dice=[[@{armament5_bonus} + @{armament5_ranged} + @{armament5_rangemod} + ?{Modifiers|0} ]] }} {{base-roll-one=[[1d6]] }} {{base-roll-two=[[1d6]] }} {{base-roll-three=[[1d6]] }} {{base-roll-four=[[1d6]] }} {{base-roll-five=[[1d6]] }} {{base-roll-six=[[1d6]] }} {{base-roll-seven=[[1d6]] }} {{base-roll-eight=[[1d6]] }} {{base-roll-nine=[[1d6]] }} {{base-roll-ten=[[1d6]] }} {{base-roll-eleven=[[1d6]] }} {{base-roll-twelve=[[1d6]] }} {{base-roll-thirteen=[[1d6]] }} {{base-roll-fourteen=[[1d6]] }} {{base-roll-fifteen=[[1d6]] }} {{base-roll-sixteen=[[1d6]] }} {{base-roll-seventeen=[[1d6]] }} {{base-roll-eighteen=[[1d6]] }} {{stress-dice=[[@{armament5_stress}]] }} {{stress-roll-one=[[1d6]] }} {{stress-roll-two=[[1d6]] }} {{stress-roll-three=[[1d6]] }} {{stress-roll-four=[[1d6]] }} {{stress-roll-five=[[1d6]] }} {{stress-roll-six=[[1d6]] }} {{stress-roll-seven=[[1d6]] }} {{stress-roll-eight=[[1d6]] }} {{stress-roll-nine=[[1d6]] }} {{stress-roll-ten=[[1d6]] }} {{current-bonus=@{armament5_bonus} }} {{current-damage=@{armament5_damage} }} {{current-range=@{armament5_targetrange} }} {{current-comment=@{armament5_comment} }}" data-i18n="attack-u">Attack</button>
|
||||
<button type="roll" name="armament5_api" class="button-skill roll-api" data-i18n="attack-u" value="@{roll_command} [@{armament5_type}: @{armament5_name}] [[(@{armament5_bonus}+@{armament1_ranged}+@{armament5_rangemod}+?{Modifiers|0})d6]] [[@{armament5_stress}d6]] --runas|@{ship-name} --|Skill @{armament5_ranged}+@{armament5_bonus}, Damage @{armament5_damage}, @{armament5_targetrange} Range --|@{armament5_comment}" title="Roll API Dice!">
|
||||
<button type="roll" name="armament5_api" class="button-skill roll-api" data-i18n="attack-u" value="@{roll_command} [@{armament5_type}: @{armament5_name}] [[(@{armament5_bonus}+@{armament5_ranged}+@{armament5_rangemod}+?{Modifiers|0})d6]] [[@{armament5_stress}d6]] --runas|@{ship-name} --|Skill @{armament5_ranged}+@{armament5_bonus}, Damage @{armament5_damage}, @{armament5_targetrange} Range --|@{armament5_comment}" title="Roll API Dice!">
|
||||
<span >Attack</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1888,23 +1889,35 @@
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="grid-item-black span-one-thru-six cover-100-flex flex-content-right">
|
||||
<div class="grid-item-black span-one-thru-six cover-100-flex flex-content-right">
|
||||
<div class="grid-item clip-edges w120 h-fit marg-right">
|
||||
<span class="centered bold">v3.01 <br/>(2022-01-10)</span>
|
||||
<span class="centered bold">v3.02 <br/>(2022-01-19)</span>
|
||||
</div>
|
||||
<div class="cover-75 flex-content-right flex-column">
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right shift-down-5">
|
||||
<span class="text-input cover-100 align-left" title="">Fixed macros not working due to roll names being duplicated. </span>
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right">
|
||||
<span class="text-input cover-100 align-left" title="">Fixed armament roll issue by calculating rangemod at sheet load. </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-item-black span-one-thru-six cover-100-flex flex-content-right">
|
||||
<div class="grid-item clip-edges w120 h-fit marg-right">
|
||||
<span class="centered bold">v3.01 <br/>(2022-01-10)</span>
|
||||
</div>
|
||||
<div class="cover-75 flex-content-right flex-column">
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right">
|
||||
<span class="text-input cover-100 align-left" title="">Fixed macros not working due to roll names being duplicated. </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-item-black span-one-thru-six cover-100-flex flex-content-right">
|
||||
<div class="grid-item clip-edges w120 h-fit marg-right">
|
||||
<span class="centered bold">v3.00 <br/>(2021-12-28)</span>
|
||||
</div>
|
||||
<div class="cover-75 flex-content-right flex-column">
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right shift-down-5">
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right">
|
||||
<span class="text-input cover-100 align-left" title="">Added configuration tab for sheet level options and customizations, like input fields and background image. </span><button class="button-link appearance-none" type="roll" value="/me https://app.roll20.net/forum/post/10565779/">Link to forum post in chat.</a>
|
||||
</div>
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right">
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right shift-down-5">
|
||||
<span class="text-input cover-100 align-left" title="">Added support for API rolls using the Alien RPG dice roller script. This requires a Pro account.</span>
|
||||
</div>
|
||||
<div class="grid-item clip-edges align-left marg-right pad-left pad-right shift-down-5">
|
||||
@@ -3039,8 +3052,8 @@
|
||||
/* */
|
||||
// CALCULATE Health
|
||||
on("change:strength change:tough sheet:opened", (eventinfo) => {
|
||||
clog("Change detected: Health");
|
||||
clog(`Eventinfo: ${JSON.stringify(eventinfo)}`);
|
||||
//clog("Change detected: Health");
|
||||
//clog(`Eventinfo: ${JSON.stringify(eventinfo)}`);
|
||||
getAttrs(["strength", "tough", "health_calc"], (values) => {
|
||||
const strength = int(values.strength),
|
||||
tough = int(values.tough),
|
||||
@@ -3117,7 +3130,7 @@
|
||||
const food = Math.ceil(int(values.food)/4),
|
||||
water = Math.ceil(int(values.water)/4),
|
||||
encumb = food + water;
|
||||
clog(`Food ${food}, water ${water} and encumberance ${encumb}`);
|
||||
//clog(`Food ${food}, water ${water} and encumberance ${encumb}`);
|
||||
setAttrs({
|
||||
encumbrance_consum: encumb
|
||||
});
|
||||
@@ -3137,16 +3150,16 @@
|
||||
carrycap = (strength*2) + packmule,
|
||||
config = values.config_advencumbrance,
|
||||
encumb = int(values.encumbrance);
|
||||
clog(`Carry cap and pack mule: pack mule ${packmule}, strength ${strength} and carry cap ${carrycap}`);
|
||||
clog(`Test total ${total} for nonzero value: ${total != 0}`);
|
||||
clog(`advanced encumbrance: ${values.config_advencumbrance}`);
|
||||
//clog(`Carry cap and pack mule: pack mule ${packmule}, strength ${strength} and carry cap ${carrycap}`);
|
||||
//clog(`Test total ${total} for nonzero value: ${total != 0}`);
|
||||
//clog(`advanced encumbrance: ${values.config_advencumbrance}`);
|
||||
var overencumbered = 0, overloaded = 0, total = 0;
|
||||
( config == "on" ) ? total = encumb_calc : total = encumb;
|
||||
( total > carrycap ) ? overencumbered = 1 : overencumbered = 0;
|
||||
( total > (carrycap*2) ) ? overloaded = 1 : overloaded = 0;
|
||||
clog(`Manual encumbrance is ${encumb}, calculated encumbrance is ${encumb_calc} and total is ${total}`);
|
||||
clog(`Overencumbered: ${total > carrycap}`);
|
||||
clog(`overloaded: ${total > (carrycap*2)}`);
|
||||
//clog(`Manual encumbrance is ${encumb}, calculated encumbrance is ${encumb_calc} and total is ${total}`);
|
||||
//clog(`Overencumbered: ${total > carrycap}`);
|
||||
//clog(`overloaded: ${total > (carrycap*2)}`);
|
||||
//if ( total > carrycap ) overencumbered = 1;
|
||||
//if ( total > (carrycap*2) ) overloaded = 1;
|
||||
//if ( encumb > carrycap ) overenc_manual = 0;
|
||||
@@ -3169,7 +3182,7 @@
|
||||
const target = arma+"_targetrange";
|
||||
const rangemod = arma+"_rangemod";
|
||||
//clog("Armament: "+arma+" Target: "+target+" Range mod: "+rangemod);
|
||||
on(`change:${target}`, (eventInfo) => {
|
||||
on(`change:${target} sheet:opened`, (eventInfo) => {
|
||||
getAttrs([target, rangemod], (values) => {
|
||||
//clog("Armament changed: "+target+" value: "+values[target]+" current range mod: "+values[rangemod]);
|
||||
var actual = 0;
|
||||
@@ -3235,7 +3248,7 @@
|
||||
// Set Ship logs 2nd tab indicator
|
||||
on(`change:log16 change:log17 change:log18 change:log19 change:log20 change:log21 change:log22 change:log23 change:log24 change:log25 change:log26 change:log27 change:log28 change:log29 change:log30 sheet:opened`, (eventInfo) => {
|
||||
getAttrs(["log16", "log17", "log18", "log19", "log20", "log21", "log22", "log23", "log24", "log25", "log26", "log27", "log28", "log29", "log30"], (values) => {
|
||||
clog("log values for button status: "+JSON.stringify(values));
|
||||
//clog("log values for button status: "+JSON.stringify(values));
|
||||
const button = "logs2_tab";
|
||||
var active = "-";
|
||||
|
||||
@@ -3243,10 +3256,10 @@
|
||||
if( values[`log${i}`] != "" ) {
|
||||
active = "II";
|
||||
}
|
||||
clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
|
||||
//clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
|
||||
}
|
||||
|
||||
clog("active eor : "+active);
|
||||
//clog("active eor : "+active);
|
||||
setAttrs({
|
||||
[button]: active
|
||||
},{silent:true});
|
||||
@@ -3257,7 +3270,7 @@
|
||||
// Set Ship logs 3rd tab indicator
|
||||
on(`change:log31 change:log32 change:log33 change:log34 change:log35 change:log36 change:log37 change:log38 change:log39 change:log40 change:log41 change:log42 change:log43 change:log44 change:log45 sheet:opened`, (eventInfo) => {
|
||||
getAttrs(["log31", "log32", "log33", "log34", "log35", "log36", "log37", "log38", "log39", "log40", "log41", "log42", "log43", "log44", "log45"], (values) => {
|
||||
clog("log values for button status: "+JSON.stringify(values));
|
||||
//clog("log values for button status: "+JSON.stringify(values));
|
||||
const button = "logs3_tab";
|
||||
var active = "-";
|
||||
|
||||
@@ -3265,10 +3278,10 @@
|
||||
if( values[`log${i}`] != "" ) {
|
||||
active = "III";
|
||||
}
|
||||
clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
|
||||
//clog("value: "+ JSON.stringify(values[`log${i}`]) +", active: "+ active);
|
||||
}
|
||||
|
||||
clog("active eor : "+active);
|
||||
//clog("active eor : "+active);
|
||||
setAttrs({
|
||||
[button]: active
|
||||
},{silent:true});
|
||||
@@ -3279,10 +3292,10 @@
|
||||
talents = {"one": "I", "two": "II", "three": "III", "four": "IV", "five": "V", "six": "VI", "seven": "VII", "eight": "VIII"};
|
||||
_.each(Object.keys(talents), (tal) => {
|
||||
on(`change:talent_${tal} sheet:opened`, function() {
|
||||
clog(`Current talent: ${tal}, current value: ${talents[tal]}`);
|
||||
//clog(`Current talent: ${tal}, current value: ${talents[tal]}`);
|
||||
getAttrs([`talent_${tal}`], function(v){
|
||||
var talentname = v[`talent_${tal}`];
|
||||
clog("Talent output: "+ (talentname.length > 0) ? talents[`${tal}`] : "-");
|
||||
//clog("Talent output: "+ (talentname.length > 0) ? talents[`${tal}`] : "-");
|
||||
var txt = (talentname.length > 0) ? talents[`${tal}`] : "-";
|
||||
setAttrs({[`tal_${tal}`]: txt});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user