fix armor, remove unused attribute
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
<input type="checkbox" class="settings-toggle" name="attr_flag_attribute" checked="checked" title="Settings toggle" /><span>x</span>
|
||||
<div class="attr-col attr-col-left">
|
||||
<!-- ~~:+: Body :+:~~ -->
|
||||
<input type="hidden" name="attr_body" value="" />
|
||||
<input type="hidden" name="attr_body" value="0" />
|
||||
<button type="roll" name="body" value="@{gm_toggle} &{template:rolls}{{header=^{body}}}{{base=^{attributes}}}{{dice=[[(@{body}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span class="red" data-i18n="body">Body</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -91,7 +91,7 @@
|
||||
<div class="display"><span name="attr_display_body" title="@{body}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Agility :+:~~ -->
|
||||
<input type="hidden" name="attr_agility" value="" />
|
||||
<input type="hidden" name="attr_agility" value="0" />
|
||||
<button type="roll" name="agility" value="@{gm_toggle} &{template:rolls}{{header=^{agility}}}{{base=^{attributes}}}{{dice=[[(@{agility}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span class="red" data-i18n="agility">Agility</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -102,7 +102,7 @@
|
||||
<div class="display"><span name="attr_display_agility" title="@{agility}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Reaction :+:~~ -->
|
||||
<input type="hidden" name="attr_reaction" value="" />
|
||||
<input type="hidden" name="attr_reaction" value="0" />
|
||||
<button type="roll" name="reaction" value="@{gm_toggle} &{template:rolls}{{header=^{reaction}}}{{base=^{attributes}}}{{dice=[[(@{reaction}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span class="red" data-i18n="reaction">Reaction</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -113,7 +113,7 @@
|
||||
<div class="display"><span name="attr_display_reaction" title="@{reaction}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Strength :+:~~ -->
|
||||
<input type="hidden" name="attr_strength" value="" />
|
||||
<input type="hidden" name="attr_strength" value="0" />
|
||||
<button type="roll" name="strength" value="@{gm_toggle} &{template:rolls}{{header=^{strength}}}{{base=^{attributes}}}{{dice=[[(@{strength}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span class="red" data-i18n="strength">Strength</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -124,7 +124,7 @@
|
||||
<div class="display"><span name="attr_display_strength" title="@{strength}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Willpower :+:~~ -->
|
||||
<input type="hidden" name="attr_willpower" value="" />
|
||||
<input type="hidden" name="attr_willpower" value="0" />
|
||||
<button type="roll" name="willpower" value="@{gm_toggle} &{template:rolls}{{header=^{willpower}}}{{base=^{attributes}}}{{dice=[[(@{willpower}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span data-i18n="willpower">Willpower</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -135,7 +135,7 @@
|
||||
<div class="display"><span name="attr_display_willpower" title="@{willpower}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Logic :+:~~ -->
|
||||
<input type="hidden" name="attr_logic" value="" />
|
||||
<input type="hidden" name="attr_logic" value="0" />
|
||||
<button type="roll" name="logic" value="@{gm_toggle} &{template:rolls}{{header=^{logic}}}{{base=^{attributes}}}{{dice=[[(@{logic}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span data-i18n="logic">Logic</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -146,7 +146,7 @@
|
||||
<div class="display"><span name="attr_display_logic" title="@{logic}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Intuition :+:~~ -->
|
||||
<input type="hidden" name="attr_intuition" value="" />
|
||||
<input type="hidden" name="attr_intuition" value="0" />
|
||||
<button type="roll" name="intuition" value="@{gm_toggle} &{template:rolls}{{header=^{intuition}}}{{base=^{attributes}}}{{dice=[[(@{intuition}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span data-i18n="intuition">Intuition</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -157,7 +157,7 @@
|
||||
<div class="display"><span name="attr_display_intuition" title="@{intuition}"></span></div>
|
||||
</div>
|
||||
<!-- ~~:+: Charisma :+:~~ -->
|
||||
<input type="hidden" name="attr_charisma" value="" />
|
||||
<input type="hidden" name="attr_charisma" value="0" />
|
||||
<button type="roll" name="charisma" value="@{gm_toggle} &{template:rolls}{{header=^{charisma}}}{{base=^{attributes}}}{{dice=[[(@{charisma}+(@{attribute_roll})+@{wounds_toggle}+@{modifiers_toggle}+@{edge_toggle})d6>5@{explode_toggle}]]}}{{mod=[[@{modifiers_toggle}]]}}{{wound=[[@{wounds_toggle}]]}}{{edge=[[@{edge_toggle}]]}}"><span data-i18n="charisma">Charisma</span></button>
|
||||
<div class="attr-und">
|
||||
<div class="settings">
|
||||
@@ -1132,34 +1132,34 @@
|
||||
<div class="collapse"><span name="attr_notes"></span></div>
|
||||
<div class="settings">
|
||||
<label data-i18n-title="name" title="name">
|
||||
<input name="attr_name" placeholder="Armor Jacket" title="@{repeating_armor_${x}_name}" type="text" value=""/>
|
||||
<input name="attr_name" placeholder="Armor Jacket" title="@{@{repeating_armor_${x}_name}" type="text" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="rating" title="rating">
|
||||
<input name="attr_rating" placeholder="12" title="@{repeating_armor_${x}_rating}" type="number" value=""/>
|
||||
<input name="attr_rating" placeholder="12" title="@{@{repeating_armor_${x}_rating}" type="number" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="acid" title="acid">
|
||||
<input name="attr_acid_modifier" placeholder="+5" title="@{repeating_armor_${x}_acid_modifier}" type="number" value=""/>
|
||||
<input name="attr_acid_modifier" placeholder="+5" title="@{@{repeating_armor_${x}_acid_modifier}" type="number" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="cold" title="cold">
|
||||
<input name="attr_cold_modifier" placeholder="0" title="@{repeating_armor_${x}_cold_modifier}" type="number" value=""/>
|
||||
<input name="attr_cold_modifier" placeholder="0" title="@{@{repeating_armor_${x}_cold_modifier}" type="number" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="electrical" title="electrical">
|
||||
<input name="attr_electrical_modifier" placeholder="0" title="@{repeating_armor_${x}_electrical_modifier}" type="number" value=""/>
|
||||
<input name="attr_electrical_modifier" placeholder="0" title="@{@{repeating_armor_${x}_electrical_modifier}" type="number" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="fire" title="fire">
|
||||
<input name="attr_fire_modifier" placeholder="0" title="@{repeating_armor_${x}_fire_modifier}" type="number" value=""/>
|
||||
<input name="attr_fire_modifier" placeholder="0" title="@{@{repeating_armor_${x}_fire_modifier}" type="number" value=""/>
|
||||
</label>
|
||||
<label data-i18n-title="radiation" title="radiation">
|
||||
<input name="attr_radiation_modifier" placeholder="0" title="@{repeating_armor_${x}_radiation_modifier}" type="number" value=""/>
|
||||
<input name="attr_radiation_modifier" placeholder="0" title="@{@{repeating_armor_${x}_radiation_modifier}" type="number" value=""/>
|
||||
</label>
|
||||
<div class="row">
|
||||
<h3 data-i18n="primary">primary</h3>
|
||||
<label data-i18n-title="primary" title="Primary">
|
||||
<input name="attr_primary" type="checkbox" title="@{repeating_armor_${x}_primary}" value="primary"/>
|
||||
<input name="attr_primary" type="checkbox" title="@{@{repeating_armor_${x}_primary}" value="primary"/>
|
||||
</label>
|
||||
<h3 data-i18n="modifier">modifier</h3>
|
||||
<label data-i18n-title="modifier" title="modifier">
|
||||
<input name="attr_dicepool_modifier" placeholder="0" title="@{repeating_armor_${x}_dicepool_modifier}" type="number" value="0"/>
|
||||
<input name="attr_dicepool_modifier" placeholder="0" title="@{@{repeating_armor_${x}_dicepool_modifier}" type="number" value="0"/>
|
||||
</label>
|
||||
</div>
|
||||
<h3 data-i18n="notes">notes</h3>
|
||||
@@ -3275,12 +3275,8 @@
|
||||
|
||||
<input type="hidden" name="attr_armor_name" value="select a Primary in Arms" />
|
||||
<input type="hidden" name="attr_soak" min="0" value="3" />
|
||||
<input type="hidden" name="attr_armor" min="0" value="3" />
|
||||
<input type="hidden" name="attr_acid_protection" min="0" value="3" />
|
||||
<input type="hidden" name="attr_cold_protection" min="0" value="3" />
|
||||
<input type="hidden" name="attr_electrical_protection" min="0" value="3" />
|
||||
<input type="hidden" name="attr_fire_protection" min="0" value="3" />
|
||||
<input type="hidden" name="attr_radiation_protection" min="0" value="3" />
|
||||
<input type="hidden" name="attr_soak_modifier" min="0" value="3" />
|
||||
<input type="hidden" name="attr_armor_rating" min="0" value="3" />
|
||||
|
||||
<input type="hidden" name="attr_primary_range_weapon" value="select a Primary in Arms" />
|
||||
<input type="hidden" name="attr_primary_range_weapon_skill" />
|
||||
@@ -3455,7 +3451,11 @@ const sheetAttributes = {
|
||||
rangeAttributes: ['dicepool', 'weapon', 'damage', 'acc', 'ap', 'skill', 'ammo', 'mode', 'recoil'],
|
||||
meleeAttributes: ['dicepool', 'weapon', 'damage', 'acc', 'ap', 'skill', 'reach'],
|
||||
|
||||
spellTypes: ['spell', 'preps', 'ritual', 'forms']
|
||||
spellTypes: ['spell', 'preps', 'ritual', 'forms'],
|
||||
|
||||
armorAttributes: ['name', 'rating', 'acid_modifier', 'electrical_modifier', 'cold_modifier', 'fire_modifier', 'radiation_modifier', 'dicepool_modifier'],
|
||||
armorSoak: ['dicepool_modifier', 'rating'],
|
||||
armorProtections: ['acid', 'electrical', 'cold', 'fire', 'radiation']
|
||||
}
|
||||
|
||||
class PrimaryWeapon {
|
||||
@@ -3487,22 +3487,41 @@ class PrimaryMeleeWeapon extends PrimaryWeapon {
|
||||
}
|
||||
|
||||
|
||||
class PrimaryArmor {
|
||||
constructor(name) {
|
||||
this.armor_name = name || 'select a Primary in Arms',
|
||||
this.soak = 0,
|
||||
this.armor_rating = 0,
|
||||
this.acid_protection = 0,
|
||||
this.cold_protection = 0,
|
||||
this.fire_protection = 0,
|
||||
this.radiation_protection = 0,
|
||||
this.electrical_protection = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const processingFunctions = {
|
||||
convertIntegerNegative: number => number > 0 ? -Math.abs(number) : number,
|
||||
convertIntegersNegatives: numbers => {
|
||||
for (let [key, value] of Object.entries(numbers)) {
|
||||
numbers[key] = processingFunctions.convertIntegerNegative(value);
|
||||
}calculateConditionTracks
|
||||
}
|
||||
return numbers
|
||||
},
|
||||
findRepeatingField: trigger => trigger.split('_')[1],
|
||||
//Roll20 does not allow for Promises
|
||||
//getAttributes: array => new Promise((resolve, reject) => array ? getAttrs(array, v => resolve(v)) : reject(errorMessage('Function failed'))),
|
||||
getReprowid: trigger => {calculateConditionTracks
|
||||
getReprowid: trigger => {
|
||||
const split = trigger.split('_');
|
||||
return `${split[0]}_${split[1]}_${split[2]}`
|
||||
},
|
||||
getReprowAttribute: key => {
|
||||
const getReprowid = processingFunctions.getReprowid(key)
|
||||
return key.split(`${getReprowid}_`)[1]
|
||||
},
|
||||
getTranslations: translationKeys => {
|
||||
let translations = {}
|
||||
translationKeys.forEach(key => translations[`${key}`] = getTranslationByKey(key))
|
||||
@@ -3609,6 +3628,14 @@ const processingFunctions = {
|
||||
attrs.essence ? Math.ceil(attrs.essence) || 0 : false;
|
||||
return processingFunctions.shadowrun.calculateLimitTotal(Object.values(attrs))
|
||||
},
|
||||
resetPrimaryArmor: () => {
|
||||
const resetPrimary = new PrimaryArmor()
|
||||
let update = {}
|
||||
for (let [key, value] of Object.entries(resetPrimary)) {
|
||||
update[key] = value
|
||||
}
|
||||
return update
|
||||
},
|
||||
resetPrimaryWeapon: type => {
|
||||
const resetPrimary = type === 'range' ? new PrimaryRangeWeapon(type) : new PrimaryMeleeWeapon(type)
|
||||
let update = {}
|
||||
@@ -3617,12 +3644,30 @@ const processingFunctions = {
|
||||
}
|
||||
return update
|
||||
},
|
||||
updatePrimaryArmor: attrs => {
|
||||
let update = {}
|
||||
|
||||
for (let [key, value] of Object.entries(attrs)) {
|
||||
const repRowID = processingFunctions.getReprowid(key)
|
||||
if (key.includes('name')) {
|
||||
update['armor_name'] = attrs[`${repRowID}_name`]
|
||||
} else if (key.includes('rating')) {
|
||||
update['armor_rating'] = value
|
||||
} else if (key.includes('dicepool_modifier')) {
|
||||
update['soak_modifier'] = value
|
||||
} else {
|
||||
const type = key.split('_')[3]
|
||||
update[`${type}_modifier`] = value
|
||||
}
|
||||
}
|
||||
|
||||
return update
|
||||
},
|
||||
updatePrimaryWeapons: attrs => {
|
||||
let update = {}
|
||||
for (let [key, value] of Object.entries(attrs)) {
|
||||
const type = processingFunctions.findRepeatingField(key)
|
||||
const getReprowid = processingFunctions.getReprowid(key)
|
||||
const weaponAttribute = key.split(`${getReprowid}_`)[1]
|
||||
const weaponAttribute = processingFunctions.getReprowAttribute(key)
|
||||
const primaryAttributeName = key.includes('weapon') ? `primary_${type}_weapon` : `primary_${type}_weapon_${weaponAttribute}`
|
||||
update[primaryAttributeName] = value
|
||||
|
||||
@@ -3674,11 +3719,18 @@ const updateSpellsDicepool = eventinfo => {
|
||||
|
||||
const resetNpcCondition = () => setAttributes({physical: 0, stun: 0, matrix: 0})
|
||||
|
||||
const updatePrimaryWeapon = eventinfo => {
|
||||
const updatePrimary = eventinfo => {
|
||||
const repRowID = processingFunctions.getReprowid(eventinfo.triggerName)
|
||||
getAttrs([`${repRowID}_primary`], attrs => {
|
||||
if (attrs[`${repRowID}_primary`] === 'primary') {
|
||||
let update = processingFunctions.shadowrun.updatePrimaryWeapons({[eventinfo.triggerName]: eventinfo.newValue})
|
||||
let update = {}
|
||||
|
||||
if (repRowID.includes('armor')) {
|
||||
update = processingFunctions.shadowrun.updatePrimaryArmor({[eventinfo.triggerName]: eventinfo.newValue})
|
||||
} else {
|
||||
update = processingFunctions.shadowrun.updatePrimaryWeapons({[eventinfo.triggerName]: eventinfo.newValue})
|
||||
}
|
||||
|
||||
processingFunctions.setAttributes(update)
|
||||
}
|
||||
})
|
||||
@@ -3699,6 +3751,21 @@ const updateRepeatingWeaponPrimary = (eventinfo, type) => {
|
||||
}
|
||||
}
|
||||
|
||||
const updateRepeatingArmorPrimary = eventinfo => {
|
||||
const repRowID = processingFunctions.getReprowid(eventinfo.triggerName)
|
||||
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 updateRepeatingWeaponDicepool = trigger => {
|
||||
const repRowID = processingFunctions.getReprowid(trigger)
|
||||
getAttrs([`${repRowID}_dicepool_modifier`, `${repRowID}_specialization`], attrs => {
|
||||
@@ -3859,113 +3926,24 @@ const updateDerivedAttribute = derivedAttribute => {
|
||||
})
|
||||
}
|
||||
|
||||
const updateInitiativeDice = () => {
|
||||
getAttrs(["initiative_dice_modifier", "edge_toggle", "initiative_dice_temp", "initiative_dice_temp_flag"], values => {
|
||||
const edgeFlag = values.edge_toggle === "@{edge}" ? true : false;
|
||||
values = processingFunctions.shadowrun.processTempFlags(values)
|
||||
values = processingFunctions.parseIntegers(values)
|
||||
const bonus = processingFunctions.shadowrun.calculateBonuses(values)
|
||||
const total = Math.min(values.bonus+1,5)
|
||||
processingFunctions.setAttributes({
|
||||
initiative_dice: edgeFlag ? 5 : total
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const resetConditionTrack = eventinfo => {
|
||||
const attr = eventinfo.triggerName.split("_").pop();
|
||||
processingFunctions.setAttributes({[`${attr}`] : 0})
|
||||
}
|
||||
<!--Old functions working to become obsolete-->
|
||||
//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}_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_modifier"] = v[`${source}`]; break;
|
||||
case /acid/.test(source) : update["acid_modifier"] = v[`${source}`]; break;
|
||||
case /cold/.test(source) : update["cold_modifier"] = v[`${source}`]; break;
|
||||
case /electrical/.test(source): update["electrical_modifier"] = v[`${source}`]; break;
|
||||
case /fire/.test(source) : update["fire_modifier"] = v[`${source}`]; break;
|
||||
case /radiation/.test(source) : update["radiation_modifier"] = v[`${source}`]; break;
|
||||
default: console.log(`Source ${source} was invalid`);}
|
||||
|
||||
setAttrs(update);
|
||||
};
|
||||
});
|
||||
} else {
|
||||
console.log("CHANGE NOT RELEVENT Primary Armor");
|
||||
};
|
||||
});
|
||||
|
||||
const updateInitiativeDice = () => {
|
||||
getAttrs(["initiative_dice_modifier", "edge_toggle", "initiative_dice_temp", "initiative_dice_temp_flag"], values => {
|
||||
console.log(values)
|
||||
const edgeFlag = values.edge_toggle === "@{edge}" ? true : false;
|
||||
|
||||
values = processingFunctions.shadowrun.processTempFlags(values)
|
||||
values = processingFunctions.parseIntegers(values)
|
||||
|
||||
const bonus = processingFunctions.shadowrun.calculateBonuses(values)
|
||||
const total = Math.min(values.bonus+1,5);
|
||||
setAttrs({
|
||||
initiative_dice: edgeFlag ? 5 : total
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//Calculate Astral Initiatve
|
||||
const updateAstralInitiative = () => {
|
||||
getAttrs(["intuition", "astral_mod_modifier"], v => {
|
||||
v = processingFunctions.parseIntegers(v);
|
||||
const base = v.intuition * 2, bonus = v.astral_mod_modifier, total = base + bonus;
|
||||
|
||||
setAttrs({
|
||||
["astral_mod"]: total,
|
||||
["display_astral_mod"]: bonus === 0 ? base : `${base} (${total})`
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const updateAstralInitiativeDice = () => {
|
||||
getAttrs(["astral_dice_modifier", "edge_toggle"], v => {
|
||||
const edgeFlag = v.edge_toggle === "@{edge}" ? true : false;
|
||||
const bonus = parseInt(v.astral_dice_modifier) || 0;
|
||||
|
||||
setAttrs({
|
||||
astral_dice: edgeFlag ? 5 : Math.min(bonus+3,5)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//Calculate Matrix Initiatve.
|
||||
const updateMatrixInitiative = () => {
|
||||
@@ -3988,12 +3966,6 @@ const updateDerivedAttribute = derivedAttribute => {
|
||||
});
|
||||
};
|
||||
|
||||
const resetConditionTrack = eventinfo => {
|
||||
const attr = eventinfo.triggerName.split("_").pop();
|
||||
setAttrs({
|
||||
[`${attr}`] : 0
|
||||
});
|
||||
}
|
||||
|
||||
//Weapon displays set into an Array
|
||||
// Builder function to display details properly
|
||||
@@ -4339,9 +4311,13 @@ const onepointthreefive = () => {
|
||||
on(`change:repeating_${type}:primary`, eventinfo => updateRepeatingWeaponPrimary(eventinfo, type))
|
||||
})
|
||||
|
||||
sheetAttributes.rangeAttributes.forEach(attr => on(`change:repeating_range:${attr}`, eventinfo => updatePrimaryWeapon(eventinfo)))
|
||||
sheetAttributes.rangeAttributes.forEach(attr => on(`change:repeating_range:${attr}`, eventinfo => updatePrimary(eventinfo)))
|
||||
|
||||
sheetAttributes.meleeAttributes.forEach(attr => on(`change:repeating_melee:${attr}`, eventinfo => updatePrimaryWeapon(eventinfo)))
|
||||
sheetAttributes.meleeAttributes.forEach(attr => on(`change:repeating_melee:${attr}`, eventinfo => updatePrimary(eventinfo)))
|
||||
|
||||
sheetAttributes.armorAttributes.forEach(attr => on(`change:repeating_armor:${attr}`, eventinfo => updatePrimary(eventinfo)))
|
||||
|
||||
on("change:repeating_armor:primary", eventinfo => updateRepeatingArmorPrimary(eventinfo))
|
||||
|
||||
on(`change:repeating_active:skill`, eventinfo => updateRepeatingSkillName(eventinfo))
|
||||
|
||||
@@ -4367,6 +4343,8 @@ const onepointthreefive = () => {
|
||||
|
||||
on("change:host_rating", eventinfo => updateHostAttributes(eventinfo.newValue))
|
||||
|
||||
|
||||
|
||||
|
||||
//IMPORTERS
|
||||
const importHeroLab = (character) => {
|
||||
|
||||
Reference in New Issue
Block a user