Adds most features
Roll20 Sheet Build Successful The Ravenous Roll20 sheet was generated and validated successfully.
Ravenous/ravenous_roll20/pipeline/head This commit looks good
Details
Roll20 Sheet Build Successful The Ravenous Roll20 sheet was generated and validated successfully.
Ravenous/ravenous_roll20/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2e54ee67a9
commit
dd3608557b
|
|
@ -98,3 +98,9 @@ localisation. Les résistances cochées se cumulent et retirent chacune deux DMG
|
|||
par point. Une protection cochée ne compte que si son intégrité est supérieure
|
||||
à zéro ; le calcul retire alors sa Protection ainsi que la Force finale du
|
||||
défenseur sélectionné.
|
||||
|
||||
Le menu Protection de **Subir** permet d'utiliser les protections cochées ou la
|
||||
protection d'une localisation fixe/personnalisée. Pour l'AB, les résistances
|
||||
retirent un point par point et seule la première protection valide de la liste
|
||||
Combat s'applique, sans la Force ; ordonnez donc les protections de haut en bas
|
||||
selon leur ordre d'impact.
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@
|
|||
"max_tier_exclusive": 5,
|
||||
"techniques": 232,
|
||||
"skills": 26,
|
||||
"content_hash": "190eaeab27cc"
|
||||
"content_hash": "c4b53c0a8188"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@
|
|||
</div>
|
||||
<div class="damage-summary"><span>Résistance cumulée <output name="attr_damage_resistance_total">0</output></span><span>Protection active <output name="attr_active_protection_total">0</output></span><button type="action" name="act_clear_damage_resistances">Tout décocher</button></div>
|
||||
<input type="hidden" name="attr_active_protection_count" value="0">
|
||||
<input type="hidden" name="attr_active_first_protection" value="0">
|
||||
<input type="hidden" name="attr_active_mitigation_total" value="0">
|
||||
<input type="hidden" name="attr_damage_location_query" value="?{Protection|Sélection actuelle,0}">
|
||||
</section>
|
||||
|
||||
<section class="page page-skills">
|
||||
|
|
@ -420,7 +423,8 @@
|
|||
{{#damagecalc}}<div class="sheet-template-row"><b>DMG</b> {{computed::damage}}</div>{{/damagecalc}}
|
||||
{{#damage}}{{^damagecalc}}<div class="sheet-template-row"><b>DMG</b> {{damage}}</div>{{/damagecalc}}{{/damage}}
|
||||
{{#damagebreakdown}}<div class="sheet-template-calculation">Calcul : {{computed::incoming_damage}} − {{computed::resistance_reduction}} (resist) − {{computed::protection_reduction}} (armor) = {{computed::damage}}</div>{{/damagebreakdown}}
|
||||
{{#breakdamage}}<div class="sheet-template-row"><b>AB</b> {{breakdamage}}</div>{{/breakdamage}}
|
||||
{{#abcalc}}<div class="sheet-template-row"><b>AB subi</b> {{computed::break_damage}}</div><div class="sheet-template-calculation">Calcul AB : {{computed::incoming_break}} − {{computed::break_resistance}} (resist) − {{computed::break_protection}} (first armor) = {{computed::break_damage}}</div>{{/abcalc}}
|
||||
{{#breakdamage}}{{^abcalc}}<div class="sheet-template-row"><b>AB</b> {{breakdamage}}</div>{{/abcalc}}{{/breakdamage}}
|
||||
{{#thresholds}}<div class="sheet-template-row"><b>Défenses</b> {{thresholds}}</div>{{/thresholds}}
|
||||
{{#buttons}}<div class="sheet-template-actions">{{buttons}}</div>{{/buttons}}
|
||||
{{#cost}}<div class="sheet-template-row"><b>Coût</b> {{cost}}</div>{{/cost}}
|
||||
|
|
@ -443,6 +447,14 @@ const attackDamage = (attack, defenseSuccesses = 0) => {
|
|||
return {finalSuccesses, damage};
|
||||
};
|
||||
const DAMAGE_RESISTANCES = ["slash","pierce","blunt","fire","earth","wood","magma","water","wind","ice","lightning","abyssal","celestial"];
|
||||
const FIXED_LOCATIONS = [["Tête","head"],["Torse","torso"],["Bras gauche","left_arm"],["Bras droit","right_arm"],["Jambe gauche","left_leg"],["Jambe droite","right_leg"]];
|
||||
const PACK_FACTOR = 10000;
|
||||
const safeQueryLabel = value => String(value || "Localisation").replace(/[|,}]/g, " ");
|
||||
const packedProtection = (protection, hasIntegrity, force) => {
|
||||
const effectiveProtection = hasIntegrity ? Math.max(0, Math.round(number(protection))) : 0;
|
||||
const mitigation = hasIntegrity ? effectiveProtection + Math.max(0, Math.round(number(force))) : 0;
|
||||
return mitigation * PACK_FACTOR + effectiveProtection;
|
||||
};
|
||||
|
||||
const recalculateDamageResistances = () => {
|
||||
const attrs = DAMAGE_RESISTANCES.flatMap(type => [`resist_${type}`, `damage_apply_${type}`]);
|
||||
|
|
@ -455,12 +467,36 @@ const recalculateDamageResistances = () => {
|
|||
const recalculateProtections = () => getSectionIDs("protections", ids => {
|
||||
const attrs = ids.flatMap(id => [`repeating_protections_${id}_active`,`repeating_protections_${id}_integrity`,`repeating_protections_${id}_protection`]);
|
||||
getAttrs(attrs, values => {
|
||||
let total = 0; let count = 0;
|
||||
let total = 0; let count = 0; let firstProtection = 0;
|
||||
ids.forEach(id => {
|
||||
const prefix = `repeating_protections_${id}_`;
|
||||
if (values[prefix+"active"] === "1" && number(values[prefix+"integrity"]) > 0) { total += number(values[prefix+"protection"]); count += 1; }
|
||||
if (values[prefix+"active"] === "1" && number(values[prefix+"integrity"]) > 0) {
|
||||
const protection = number(values[prefix+"protection"]);
|
||||
total += protection;
|
||||
if (count === 0) firstProtection = protection;
|
||||
count += 1;
|
||||
}
|
||||
});
|
||||
setAttrs({active_protection_total:total, active_protection_count:count}, {silent:true});
|
||||
getAttrs(["force_total"], character => {
|
||||
const mitigation = count > 0 ? total + number(character.force_total) : 0;
|
||||
setAttrs({active_protection_total:total, active_protection_count:count, active_first_protection:firstProtection, active_mitigation_total:mitigation}, {silent:true}, recalculateDamageLocations);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const recalculateDamageLocations = () => getSectionIDs("locations", ids => {
|
||||
const fixedAttrs = ["force_total","active_mitigation_total","active_first_protection", ...FIXED_LOCATIONS.flatMap(([,key]) => [`${key}_protection`,`${key}_armor`])];
|
||||
const customAttrs = ids.flatMap(id => [`repeating_locations_${id}_name`,`repeating_locations_${id}_protection`,`repeating_locations_${id}_armor`]);
|
||||
getAttrs([...fixedAttrs,...customAttrs], values => {
|
||||
const force = number(values.force_total);
|
||||
const selectedPacked = Math.round(number(values.active_mitigation_total)) * PACK_FACTOR + Math.max(0, Math.round(number(values.active_first_protection)));
|
||||
const options = [`Sélection actuelle,${selectedPacked}`];
|
||||
FIXED_LOCATIONS.forEach(([label,key]) => options.push(`${label},${packedProtection(values[`${key}_protection`], number(values[`${key}_armor`]) > 0, force)}`));
|
||||
ids.forEach(id => {
|
||||
const prefix = `repeating_locations_${id}_`;
|
||||
options.push(`${safeQueryLabel(values[prefix+"name"])},${packedProtection(values[prefix+"protection"], number(values[prefix+"armor"]) > 0, force)}`);
|
||||
});
|
||||
setAttrs({damage_location_query:`?{Protection|${options.join("|")}}`}, {silent:true});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -530,15 +566,19 @@ on("clicked:repeating_attacks:damage", event => {
|
|||
on("clicked:repeating_attacks:take_damage", event => {
|
||||
const prefix = event.sourceAttribute.replace(/take_damage$/, "");
|
||||
getAttrs([prefix+"name",prefix+"base_damage",prefix+"damage_per_success",prefix+"break_damage",prefix+"rmax"], values => {
|
||||
const command = `&{template:ravenous} {{title=Subir · ${templateText(values[prefix+"name"] || "Attaque")}}} {{subtitle=@{selected|character_name}}} {{damagecalc=1}} {{damagebreakdown=1}} {{remaining=[[?{Succès restants|1}]]}} {{selected_resistance=[[@{selected|damage_resistance_total}]]}} {{selected_protection=[[@{selected|active_protection_total}]]}} {{selected_protection_count=[[@{selected|active_protection_count}]]}} {{selected_strength=[[@{selected|force_total}]]}} {{finalsuccesses=[[0]]}} {{incoming_damage=[[0]]}} {{resistance_reduction=[[0]]}} {{protection_reduction=[[0]]}} {{damage=[[0]]}} {{breakdamage=${number(values[prefix+"break_damage"])}}}`;
|
||||
const command = `&{template:ravenous} {{title=Subir · ${templateText(values[prefix+"name"] || "Attaque")}}} {{subtitle=@{selected|character_name}}} {{damagecalc=1}} {{damagebreakdown=1}} {{abcalc=1}} {{remaining=[[?{Succès restants|1}]]}} {{selected_resistance=[[@{selected|damage_resistance_total}]]}} {{location_protection=[[@{selected|damage_location_query}]]}} {{finalsuccesses=[[0]]}} {{incoming_damage=[[0]]}} {{resistance_reduction=[[0]]}} {{protection_reduction=[[0]]}} {{damage=[[0]]}} {{incoming_break=[[0]]}} {{break_resistance=[[0]]}} {{break_protection=[[0]]}} {{break_damage=[[0]]}}`;
|
||||
startRoll(`@{selected|roll_whisper}${command}`, results => {
|
||||
const remaining = Math.max(0, Math.floor(results.results.remaining.result));
|
||||
const finalSuccesses = Math.min(remaining, Math.max(0, Math.floor(number(values[prefix+"rmax"]))));
|
||||
const incoming = finalSuccesses > 0 ? number(values[prefix+"base_damage"]) + (finalSuccesses - 1) * number(values[prefix+"damage_per_success"]) : 0;
|
||||
const resistanceReduction = results.results.selected_resistance.result * 2;
|
||||
const hasProtection = results.results.selected_protection_count.result > 0;
|
||||
const protectionReduction = hasProtection ? results.results.selected_protection.result + results.results.selected_strength.result : 0;
|
||||
finishRoll(results.rollId, {finalsuccesses:finalSuccesses, incoming_damage:incoming, resistance_reduction:resistanceReduction, protection_reduction:protectionReduction, damage:Math.max(0, incoming - resistanceReduction - protectionReduction)});
|
||||
const packed = Math.max(0, Math.round(results.results.location_protection.result));
|
||||
const protectionReduction = Math.floor(packed / PACK_FACTOR);
|
||||
const firstProtection = packed % PACK_FACTOR;
|
||||
const incomingBreak = Math.max(0, number(values[prefix+"break_damage"]));
|
||||
const breakResistance = Math.max(0, results.results.selected_resistance.result);
|
||||
const breakDamage = Math.max(0, Math.min(incomingBreak, incomingBreak - breakResistance - firstProtection));
|
||||
finishRoll(results.rollId, {finalsuccesses:finalSuccesses, incoming_damage:incoming, resistance_reduction:resistanceReduction, protection_reduction:protectionReduction, damage:Math.max(0, incoming - resistanceReduction - protectionReduction), incoming_break:incomingBreak, break_resistance:breakResistance, break_protection:firstProtection, break_damage:breakDamage});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -567,7 +607,7 @@ const recalculate = () => {
|
|||
update.toxicite_max = 8 + stage + number(values.toxicite_max_modifier);
|
||||
update.satiete_max = 6 + Math.floor(stage / 2) + number(values.satiete_max_modifier);
|
||||
update.actions_max = 4 + number(values.actions_max_modifier);
|
||||
setAttrs(update, {silent: true}, () => { recalculateSkills(); recalculateCustomSkills(); });
|
||||
setAttrs(update, {silent: true}, () => { recalculateSkills(); recalculateCustomSkills(); recalculateProtections(); });
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -602,7 +642,8 @@ const recalculateCustomSkills = () => getSectionIDs("customskills", ids => {
|
|||
on("sheet:opened change:force change:agilite change:perception change:intelligence change:volonte change:psy change:chance change:charisme change:stage change:force_manual change:agilite_manual change:perception_manual change:intelligence_manual change:volonte_manual change:psy_manual change:chance_manual change:charisme_manual change:torque_modifier change:speed_modifier change:half_speed_modifier change:run_speed_modifier change:swim_speed_modifier change:fly_speed_modifier change:hp_modifier change:jauge_max_modifier change:fatigue_max_modifier change:toxicite_max_modifier change:satiete_max_modifier change:actions_max_modifier", recalculate);
|
||||
on("sheet:opened change:secret_rolls", () => getAttrs(["secret_rolls"], values => setAttrs({roll_whisper:values.secret_rolls === "1" ? "/w gm " : ""}, {silent:true})));
|
||||
on(`sheet:opened ${DAMAGE_RESISTANCES.flatMap(type => [`change:resist_${type}`,`change:damage_apply_${type}`]).join(" ")}`, recalculateDamageResistances);
|
||||
on("sheet:opened change:repeating_protections", recalculateProtections);
|
||||
on("sheet:opened change:repeating_protections change:_reporder_repeating_protections", recalculateProtections);
|
||||
on(`sheet:opened change:repeating_locations ${FIXED_LOCATIONS.flatMap(([,key]) => [`change:${key}_protection`,`change:${key}_armor`]).join(" ")}`, recalculateDamageLocations);
|
||||
on("clicked:clear_damage_resistances", () => {
|
||||
const update = {};
|
||||
DAMAGE_RESISTANCES.forEach(type => update[`damage_apply_${type}`] = "0");
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@
|
|||
</div>
|
||||
<div class="damage-summary"><span>Résistance cumulée <output name="attr_damage_resistance_total">0</output></span><span>Protection active <output name="attr_active_protection_total">0</output></span><button type="action" name="act_clear_damage_resistances">Tout décocher</button></div>
|
||||
<input type="hidden" name="attr_active_protection_count" value="0">
|
||||
<input type="hidden" name="attr_active_first_protection" value="0">
|
||||
<input type="hidden" name="attr_active_mitigation_total" value="0">
|
||||
<input type="hidden" name="attr_damage_location_query" value="?{Protection|Sélection actuelle,0}">
|
||||
</section>
|
||||
|
||||
<section class="page page-skills">
|
||||
|
|
@ -209,7 +212,8 @@
|
|||
{{#damagecalc}}<div class="sheet-template-row"><b>DMG</b> {{computed::damage}}</div>{{/damagecalc}}
|
||||
{{#damage}}{{^damagecalc}}<div class="sheet-template-row"><b>DMG</b> {{damage}}</div>{{/damagecalc}}{{/damage}}
|
||||
{{#damagebreakdown}}<div class="sheet-template-calculation">Calcul : {{computed::incoming_damage}} − {{computed::resistance_reduction}} (resist) − {{computed::protection_reduction}} (armor) = {{computed::damage}}</div>{{/damagebreakdown}}
|
||||
{{#breakdamage}}<div class="sheet-template-row"><b>AB</b> {{breakdamage}}</div>{{/breakdamage}}
|
||||
{{#abcalc}}<div class="sheet-template-row"><b>AB subi</b> {{computed::break_damage}}</div><div class="sheet-template-calculation">Calcul AB : {{computed::incoming_break}} − {{computed::break_resistance}} (resist) − {{computed::break_protection}} (first armor) = {{computed::break_damage}}</div>{{/abcalc}}
|
||||
{{#breakdamage}}{{^abcalc}}<div class="sheet-template-row"><b>AB</b> {{breakdamage}}</div>{{/abcalc}}{{/breakdamage}}
|
||||
{{#thresholds}}<div class="sheet-template-row"><b>Défenses</b> {{thresholds}}</div>{{/thresholds}}
|
||||
{{#buttons}}<div class="sheet-template-actions">{{buttons}}</div>{{/buttons}}
|
||||
{{#cost}}<div class="sheet-template-row"><b>Coût</b> {{cost}}</div>{{/cost}}
|
||||
|
|
@ -232,6 +236,14 @@ const attackDamage = (attack, defenseSuccesses = 0) => {
|
|||
return {finalSuccesses, damage};
|
||||
};
|
||||
const DAMAGE_RESISTANCES = ["slash","pierce","blunt","fire","earth","wood","magma","water","wind","ice","lightning","abyssal","celestial"];
|
||||
const FIXED_LOCATIONS = [["Tête","head"],["Torse","torso"],["Bras gauche","left_arm"],["Bras droit","right_arm"],["Jambe gauche","left_leg"],["Jambe droite","right_leg"]];
|
||||
const PACK_FACTOR = 10000;
|
||||
const safeQueryLabel = value => String(value || "Localisation").replace(/[|,}]/g, " ");
|
||||
const packedProtection = (protection, hasIntegrity, force) => {
|
||||
const effectiveProtection = hasIntegrity ? Math.max(0, Math.round(number(protection))) : 0;
|
||||
const mitigation = hasIntegrity ? effectiveProtection + Math.max(0, Math.round(number(force))) : 0;
|
||||
return mitigation * PACK_FACTOR + effectiveProtection;
|
||||
};
|
||||
|
||||
const recalculateDamageResistances = () => {
|
||||
const attrs = DAMAGE_RESISTANCES.flatMap(type => [`resist_${type}`, `damage_apply_${type}`]);
|
||||
|
|
@ -244,12 +256,36 @@ const recalculateDamageResistances = () => {
|
|||
const recalculateProtections = () => getSectionIDs("protections", ids => {
|
||||
const attrs = ids.flatMap(id => [`repeating_protections_${id}_active`,`repeating_protections_${id}_integrity`,`repeating_protections_${id}_protection`]);
|
||||
getAttrs(attrs, values => {
|
||||
let total = 0; let count = 0;
|
||||
let total = 0; let count = 0; let firstProtection = 0;
|
||||
ids.forEach(id => {
|
||||
const prefix = `repeating_protections_${id}_`;
|
||||
if (values[prefix+"active"] === "1" && number(values[prefix+"integrity"]) > 0) { total += number(values[prefix+"protection"]); count += 1; }
|
||||
if (values[prefix+"active"] === "1" && number(values[prefix+"integrity"]) > 0) {
|
||||
const protection = number(values[prefix+"protection"]);
|
||||
total += protection;
|
||||
if (count === 0) firstProtection = protection;
|
||||
count += 1;
|
||||
}
|
||||
});
|
||||
setAttrs({active_protection_total:total, active_protection_count:count}, {silent:true});
|
||||
getAttrs(["force_total"], character => {
|
||||
const mitigation = count > 0 ? total + number(character.force_total) : 0;
|
||||
setAttrs({active_protection_total:total, active_protection_count:count, active_first_protection:firstProtection, active_mitigation_total:mitigation}, {silent:true}, recalculateDamageLocations);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const recalculateDamageLocations = () => getSectionIDs("locations", ids => {
|
||||
const fixedAttrs = ["force_total","active_mitigation_total","active_first_protection", ...FIXED_LOCATIONS.flatMap(([,key]) => [`${key}_protection`,`${key}_armor`])];
|
||||
const customAttrs = ids.flatMap(id => [`repeating_locations_${id}_name`,`repeating_locations_${id}_protection`,`repeating_locations_${id}_armor`]);
|
||||
getAttrs([...fixedAttrs,...customAttrs], values => {
|
||||
const force = number(values.force_total);
|
||||
const selectedPacked = Math.round(number(values.active_mitigation_total)) * PACK_FACTOR + Math.max(0, Math.round(number(values.active_first_protection)));
|
||||
const options = [`Sélection actuelle,${selectedPacked}`];
|
||||
FIXED_LOCATIONS.forEach(([label,key]) => options.push(`${label},${packedProtection(values[`${key}_protection`], number(values[`${key}_armor`]) > 0, force)}`));
|
||||
ids.forEach(id => {
|
||||
const prefix = `repeating_locations_${id}_`;
|
||||
options.push(`${safeQueryLabel(values[prefix+"name"])},${packedProtection(values[prefix+"protection"], number(values[prefix+"armor"]) > 0, force)}`);
|
||||
});
|
||||
setAttrs({damage_location_query:`?{Protection|${options.join("|")}}`}, {silent:true});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -319,15 +355,19 @@ on("clicked:repeating_attacks:damage", event => {
|
|||
on("clicked:repeating_attacks:take_damage", event => {
|
||||
const prefix = event.sourceAttribute.replace(/take_damage$/, "");
|
||||
getAttrs([prefix+"name",prefix+"base_damage",prefix+"damage_per_success",prefix+"break_damage",prefix+"rmax"], values => {
|
||||
const command = `&{template:ravenous} {{title=Subir · ${templateText(values[prefix+"name"] || "Attaque")}}} {{subtitle=@{selected|character_name}}} {{damagecalc=1}} {{damagebreakdown=1}} {{remaining=[[?{Succès restants|1}]]}} {{selected_resistance=[[@{selected|damage_resistance_total}]]}} {{selected_protection=[[@{selected|active_protection_total}]]}} {{selected_protection_count=[[@{selected|active_protection_count}]]}} {{selected_strength=[[@{selected|force_total}]]}} {{finalsuccesses=[[0]]}} {{incoming_damage=[[0]]}} {{resistance_reduction=[[0]]}} {{protection_reduction=[[0]]}} {{damage=[[0]]}} {{breakdamage=${number(values[prefix+"break_damage"])}}}`;
|
||||
const command = `&{template:ravenous} {{title=Subir · ${templateText(values[prefix+"name"] || "Attaque")}}} {{subtitle=@{selected|character_name}}} {{damagecalc=1}} {{damagebreakdown=1}} {{abcalc=1}} {{remaining=[[?{Succès restants|1}]]}} {{selected_resistance=[[@{selected|damage_resistance_total}]]}} {{location_protection=[[@{selected|damage_location_query}]]}} {{finalsuccesses=[[0]]}} {{incoming_damage=[[0]]}} {{resistance_reduction=[[0]]}} {{protection_reduction=[[0]]}} {{damage=[[0]]}} {{incoming_break=[[0]]}} {{break_resistance=[[0]]}} {{break_protection=[[0]]}} {{break_damage=[[0]]}}`;
|
||||
startRoll(`@{selected|roll_whisper}${command}`, results => {
|
||||
const remaining = Math.max(0, Math.floor(results.results.remaining.result));
|
||||
const finalSuccesses = Math.min(remaining, Math.max(0, Math.floor(number(values[prefix+"rmax"]))));
|
||||
const incoming = finalSuccesses > 0 ? number(values[prefix+"base_damage"]) + (finalSuccesses - 1) * number(values[prefix+"damage_per_success"]) : 0;
|
||||
const resistanceReduction = results.results.selected_resistance.result * 2;
|
||||
const hasProtection = results.results.selected_protection_count.result > 0;
|
||||
const protectionReduction = hasProtection ? results.results.selected_protection.result + results.results.selected_strength.result : 0;
|
||||
finishRoll(results.rollId, {finalsuccesses:finalSuccesses, incoming_damage:incoming, resistance_reduction:resistanceReduction, protection_reduction:protectionReduction, damage:Math.max(0, incoming - resistanceReduction - protectionReduction)});
|
||||
const packed = Math.max(0, Math.round(results.results.location_protection.result));
|
||||
const protectionReduction = Math.floor(packed / PACK_FACTOR);
|
||||
const firstProtection = packed % PACK_FACTOR;
|
||||
const incomingBreak = Math.max(0, number(values[prefix+"break_damage"]));
|
||||
const breakResistance = Math.max(0, results.results.selected_resistance.result);
|
||||
const breakDamage = Math.max(0, Math.min(incomingBreak, incomingBreak - breakResistance - firstProtection));
|
||||
finishRoll(results.rollId, {finalsuccesses:finalSuccesses, incoming_damage:incoming, resistance_reduction:resistanceReduction, protection_reduction:protectionReduction, damage:Math.max(0, incoming - resistanceReduction - protectionReduction), incoming_break:incomingBreak, break_resistance:breakResistance, break_protection:firstProtection, break_damage:breakDamage});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -356,7 +396,7 @@ const recalculate = () => {
|
|||
update.toxicite_max = 8 + stage + number(values.toxicite_max_modifier);
|
||||
update.satiete_max = 6 + Math.floor(stage / 2) + number(values.satiete_max_modifier);
|
||||
update.actions_max = 4 + number(values.actions_max_modifier);
|
||||
setAttrs(update, {silent: true}, () => { recalculateSkills(); recalculateCustomSkills(); });
|
||||
setAttrs(update, {silent: true}, () => { recalculateSkills(); recalculateCustomSkills(); recalculateProtections(); });
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -391,7 +431,8 @@ const recalculateCustomSkills = () => getSectionIDs("customskills", ids => {
|
|||
on("sheet:opened change:force change:agilite change:perception change:intelligence change:volonte change:psy change:chance change:charisme change:stage change:force_manual change:agilite_manual change:perception_manual change:intelligence_manual change:volonte_manual change:psy_manual change:chance_manual change:charisme_manual change:torque_modifier change:speed_modifier change:half_speed_modifier change:run_speed_modifier change:swim_speed_modifier change:fly_speed_modifier change:hp_modifier change:jauge_max_modifier change:fatigue_max_modifier change:toxicite_max_modifier change:satiete_max_modifier change:actions_max_modifier", recalculate);
|
||||
on("sheet:opened change:secret_rolls", () => getAttrs(["secret_rolls"], values => setAttrs({roll_whisper:values.secret_rolls === "1" ? "/w gm " : ""}, {silent:true})));
|
||||
on(`sheet:opened ${DAMAGE_RESISTANCES.flatMap(type => [`change:resist_${type}`,`change:damage_apply_${type}`]).join(" ")}`, recalculateDamageResistances);
|
||||
on("sheet:opened change:repeating_protections", recalculateProtections);
|
||||
on("sheet:opened change:repeating_protections change:_reporder_repeating_protections", recalculateProtections);
|
||||
on(`sheet:opened change:repeating_locations ${FIXED_LOCATIONS.flatMap(([,key]) => [`change:${key}_protection`,`change:${key}_armor`]).join(" ")}`, recalculateDamageLocations);
|
||||
on("clicked:clear_damage_resistances", () => {
|
||||
const update = {};
|
||||
DAMAGE_RESISTANCES.forEach(type => update[`damage_apply_${type}`] = "0");
|
||||
|
|
|
|||
|
|
@ -102,6 +102,11 @@ class BuildTests(unittest.TestCase):
|
|||
self.assertIn('name="attr_secret_rolls"', sheet)
|
||||
self.assertIn('values.secret_rolls === "1" ? "/w gm " : ""', sheet)
|
||||
self.assertIn("@{selected|roll_whisper}", sheet)
|
||||
self.assertIn("active_first_protection", sheet)
|
||||
self.assertIn("damage_location_query", sheet)
|
||||
self.assertIn("repeating_locations_${id}_name", sheet)
|
||||
self.assertIn("incomingBreak - breakResistance - firstProtection", sheet)
|
||||
self.assertNotIn("{{break_damage=[[0]]}}}", sheet)
|
||||
|
||||
def test_techniques_are_chat_activatable_and_typst_free(self):
|
||||
sheet = (ROOT / "build/ravenous.html").read_text()
|
||||
|
|
|
|||
Loading…
Reference in New Issue