* Add regeneration type 'Karmic Meditation'

This commit is contained in:
Kreuvf
2025-01-21 18:53:24 +01:00
parent d9ce773878
commit cfb4e7fd01
5 changed files with 465 additions and 0 deletions
+14
View File
@@ -1019,6 +1019,16 @@ The solution: convert the <input>s to type="text" and make them look like normal
display: initial;
}
/** Karmic Meditation */
.charsheet .on-a-mission-show:checked ~ label > .on-a-mission-show,
.charsheet .selfish-show:checked ~ label > .selfish-show,
.charsheet .sinner-show:checked ~ label > .sinner-show,
.charsheet .other-world-show:checked ~ label > .other-world-show,
.charsheet .demonic-show:checked ~ label > .demonic-show {
display: initial;
}
/*--------------------------------------------Configuration-------------------------------------*/
@@ -1243,6 +1253,7 @@ upper left, upper right, lower right, lower left */
/* Regeneration Roll Template(s) */
.sheet-rolltemplate-reg-astralmeditation table,
.sheet-rolltemplate-reg-deepbreath table,
.sheet-rolltemplate-reg-karmicmeditation table,
.sheet-rolltemplate-reg-relax table,
.sheet-rolltemplate-reg-rest table,
.sheet-rolltemplate-reg-sleep table {
@@ -1252,6 +1263,7 @@ upper left, upper right, lower right, lower left */
.sheet-rolltemplate-reg-astralmeditation td.sheet-highlight,
.sheet-rolltemplate-reg-deepbreath td.sheet-highlight,
.sheet-rolltemplate-reg-karmicmeditation td.sheet-highlight,
.sheet-rolltemplate-reg-relax td.sheet-highlight,
.sheet-rolltemplate-reg-rest td.sheet-highlight,
.sheet-rolltemplate-reg-sleep td.sheet-highlight {
@@ -1260,6 +1272,7 @@ upper left, upper right, lower right, lower left */
.sheet-rolltemplate-reg-astralmeditation tr.sheet-detail-level-1 td:first-child,
.sheet-rolltemplate-reg-deepbreath tr.sheet-detail-level-1 td:first-child,
.sheet-rolltemplate-reg-karmicmeditation tr.sheet-detail-level-1 td:first-child,
.sheet-rolltemplate-reg-relax tr.sheet-detail-level-1 td:first-child,
.sheet-rolltemplate-reg-rest tr.sheet-detail-level-1 td:first-child,
.sheet-rolltemplate-reg-sleep tr.sheet-detail-level-1 td:first-child {
@@ -1268,6 +1281,7 @@ upper left, upper right, lower right, lower left */
.sheet-rolltemplate-reg-astralmeditation td.sheet-regeneration-result,
.sheet-rolltemplate-reg-deepbreath td.sheet-regeneration-result,
.sheet-rolltemplate-reg-karmicmeditation td.sheet-regeneration-result,
.sheet-rolltemplate-reg-relax td.sheet-regeneration-result,
.sheet-rolltemplate-reg-rest td.sheet-regeneration-result,
.sheet-rolltemplate-reg-sleep td.sheet-regeneration-result {
@@ -445,4 +445,51 @@
</div>
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-reg-karmicmeditation">
<div class="sheet-rolltemplate-templates-general">
<div class="results">
<table>
<tr>
<th colspan="2">Karmale Meditation</th>
</tr>
{{#notrequired}}
<tr>
<td colspan="2">Keine karmale Meditation durchführbar. Die Karmalenergie befindet sich bereits auf oder über dem Maximum ({{ke}}/{{kemax}}).</td>
</tr>
{{/notrequired}}
{{^notrequired}}
<tr>
{{#rollTotal() computed::checkresult 0}}
<td colspan="2">Liturgiekenntnisprobe {{computed::mod}} mit {{computed::checkpoints}}&nbsp;<span class="abbr" title="Liturgiekenntnispunkte nach der Probe">LkP*</span> misslungen ({{computed::checkroll}}).</td>
{{/rollTotal() computed::checkresult 0}}
{{#rollTotal() computed::checkresult 1}}
<td colspan="2">Liturgiekenntnisprobe {{computed::mod}} mit {{computed::checkpoints}}&nbsp;<span class="abbr" title="Liturgiekenntnispunkte nach der Probe">LkP*</span> gelungen ({{computed::checkroll}}).</td>
{{/rollTotal() computed::checkresult 1}}
</tr>
<tr>
<td><span class="abbr" title="Liturgiekenntniswert">LkW</span>: {{wert}}</td>
<td>Eigenschaften: {{computed::stats}}</td>
</tr>
{{#rollTotal() computed::checkresult 1}}
<tr>
<td colspan="2" class="highlight">&#x1f64f; Karmaenergie: {{ke}}&nbsp;<span class="abbr" title="Karmapunkte">KaP</span> &#x279e; {{computed::ke}}&nbsp;<span class="abbr" title="Karmapunkte">KaP</span></td>
</tr>
<tr class="detail-level-1">
<td>Meditation</td>
<td class="regeneration-result">{{computed::kegain}}&nbsp;<span class="abbr" title="Karmapunkte">KaP</span></td>
</tr>
<tr>
<td colspan="2" class="highlight">&#x1f929; Entrückung: {{entrueckung}} &#x279e; {{computed::entrueckung}}</td>
</tr>
<tr class="detail-level-1">
<td>Meditation</td>
<td class="regeneration-result">{{computed::entrueckunggain}}</td>
</tr>
{{/rollTotal() computed::checkresult 1}}
{{/notrequired}}
</table>
</div>
</div>
</rolltemplate>
<!-- regeneration roll templates end -->
@@ -133,6 +133,88 @@
<input type="hidden" name="attr_reg_astralmeditation_action" value="">
<button type="roll" name="roll_reg_astralmeditation" value="@{reg_astralmeditation_action}"> <span>Astrale Meditation</span></button> <span class="abbr" title="Die Probe zur astralen Meditation lässt sich regeltechnisch in keine bekannte Probenkategorie einordnen (Talent, Zauber, Ritual, Liturgie) und wird daher auch nicht durch Effekte beeinflusst, die den Wert kritischer Erfolge und Misserfolge verändern wie beispielsweise &bdquo;Tollpatsch&ldquo; oder &bdquo;Wilde Magie&ldquo;.">&#x2139;&#xfe0f;</span>
</div>
<h4>Karmale Meditation</h4>
<div class="fieldset-workaround reg-karmicmeditation">
<h2 class="legend-workaround"><span>Einstellungen</span></h2>
<input class="default-hide on-a-mission-show" type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_mission" value="1">
<input class="default-hide selfish-show" type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_selfish" value="1">
<input class="default-hide sinner-show" type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_sinner" value="1">
<input class="default-hide other-world-show" type="checkbox" name="attr_reg_karmicmeditation_mod_location_other_world" value="1">
<input class="default-hide demonic-show" type="checkbox" name="attr_reg_karmicmeditation_mod_location_demonic" value="1">
<label>
Zeit seit letzter Meditation:
<select name="attr_reg_karmicmeditation_mod_time_last_meditation">
<option value="12">bis zu zwei Tage (+12)</option>
<option value="8">zwei Tage bis eine Woche (+8)</option>
<option value="4">eine Woche bis ein Monat (+4)</option>
<option value="0">mehr als ein Monat (±0)</option>
</select>
<span class="abbr" title="Regeltechnisch (Wege der Götter, S. 241) ist leider nicht genau genug angegeben, für welche Zeitintervalle welche Erschwernis gilt. Sollte die Interpretation des Charakterbogens nicht der der Spielgruppe entsprechen, bitte anhand der Erschwernis entsprechend anpassen.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_emergency" value="1"> Notlage <span class="abbr" title="Die Meditation wird aus einer Notlage heraus durchgeführt.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_mission" value="1"> göttlicher/kirchlicher Auftrag<span class="default-hide on-a-mission-show">: <input type="number" style="width: 4em" name="attr_reg_karmicmeditation_mod_motivation_mission_value" min="-7" max="0" value="0"></span> <span class="abbr" title="Die Meditation wird in Verbindung mit einem Auftrag durchgeführt.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_selfish" value="1"> eigensüchtige Motive<span class="default-hide selfish-show">: <input type="number" style="width: 4em" name="attr_reg_karmicmeditation_mod_motivation_selfish_value" min="0" max="7" value="0"></span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_controlled" value="1"> (magisch) beherrscht oder beeinflusst
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_freshman" value="1"> frisch konvertiert <span class="abbr" title="Abhängig von Glaubensfestigkeit und Verhalten bis zu drei Jahre seit Konvertierung.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_motivation_sinner" value="1"> nicht göttergefällig<span class="default-hide sinner-show">: <select name="attr_reg_karmicmeditation_mod_motivation_sinner_value">
<option value="3">Eidbrecher (+3)</option>
<option value="7">Frevler (+7)</option>
</select></span> <span class="abbr" title="Das Verhalten des Geweihten war mehr als nur ein wenig nicht göttergefällig.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_nonbeliever_presence" value="1"> Gegenwart Ungläubiger und Zweifler <span class="abbr" title="Die Meditation wird in ein Gegenwart vieler Ungläubiger und Zweifler durchgeführt.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_holy_ground_pantheon" value="1"> geweihter Boden (Pantheon) <span class="abbr" title="Die Meditation wird auf geweihtem Boden eines anderen Gottes desselben Pantheons durchgeführt.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_holy_ground_god" value="1"> Kapelle/Schrein <span class="abbr" title="Die Meditation wird in einer Kapelle oder einem Schrein des eigenen Gottes durchgeführt (einfach geweihter Boden).">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_temple_god" value="1"> Tempel <span class="abbr" title="Die Meditation wird in einem Tempel des eigenen Gottes durchgeführt (zweifach geweihter Boden).">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_sanctum_god" value="1"> heiliger Ort <span class="abbr" title="Die Meditation wird an einem heiligen Ort des eigenen Gottes durchgeführt.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_nonbeliever_territory" value="1"> Gebiet Ungläubiger und Zweifler <span class="abbr" title="Die Meditation wird tief in einem Gebiet durchgeführt, das voller Ungläubiger und Zweifler ist.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_other_world" value="1"> in einer anderen Welt/Globule/im Limbus<span class="default-hide other-world-show">: <input type="number" style="width: 4em" name="attr_reg_karmicmeditation_mod_location_other_world_value" min="7" max="99" value="7"></span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_location_demonic" value="1"> dämonisch pervertiertes Gebiet<span class="default-hide demonic-show">: <input type="number" style="width: 4em" name="attr_reg_karmicmeditation_mod_location_demonic_value" min="7" max="99" value="7"></span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_time_month" value="1"> Monat des Zwölfgottes <span class="abbr" title="Gilt analog für entsprechende Zeiten anderer Götter.">&#x2139;&#xfe0f;</span>
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_time_holiday" value="1"> Feiertag der Gottheit
</label>
<label>
<input type="checkbox" name="attr_reg_karmicmeditation_mod_time_nameless" value="1"> namenlose Tage
</label>
<label>
sonstiger Modifikator <input type="number" style="width: 4em" name="attr_reg_karmicmeditation_mod_other" min="-99" max="99" value="0"> <span class="abbr" title="Beispiele: Niedrige Lebensenergie, niedrige Ausdauer.">&#x2139;&#xfe0f;</span>
</label>
</div>
<div class="fieldset-workaround">
<h2 class="legend-workaround"><span>Wurf</span></h2>
<button type="action" name="act_reg_karmicmeditation-action" class="default-hide"></button>
<input type="hidden" name="attr_reg_karmicmeditation_action" value="">
<button type="roll" name="roll_reg_karmicmeditation" value="@{reg_karmicmeditation_action}"> <span>Karmale Meditation</span></button>
</div>
<p>Hinweis: Durch Regenerationswürfe werden die betroffenen Werte automatisch geändert. Bei einem Wurf mit falschen Werten kann daher nicht erneut mit den korrekten Werten gewürfelt werden, um den Fehler auszugleichen. Dies führt schlicht zu einer weiteren Regeneration. Zu diesem Zweck enthält die Wurfvorlage die Werte vor und nach dem Wurf, sodass die Werte entsprechend händisch zurückgesetzt werden können.</p>
</div>
<!-- sheet section regeneration end -->
@@ -263,6 +263,7 @@ const defaultValues = {
"shield_tpkk": "13/3",
"shield_tp_roll": "1d6 + 1",
///
/// Encumbrance, Armour, Initiative
"BE": 0,
"be_at_mod": 0,
@@ -1037,6 +1038,7 @@ const melee = [
const reg = [
'reg_astralmeditation',
'reg_deepbreath',
'reg_karmicmeditation',
'reg_relax',
'reg_rest',
'reg_sleep'
@@ -2825,4 +2825,324 @@ on('clicked:reg_astralmeditation-action', async (info) => {
}
});
// Generating Regeneration Roll (Karmic Meditation)
on(
[
"gm_roll_opt",
"mu", "in", "ch",
"ke", "ke_max", "entrueckung",
"liturgiekenntnis",
"reg_karmicmeditation_mod_location_demonic",
"reg_karmicmeditation_mod_location_demonic_value",
"reg_karmicmeditation_mod_location_holy_ground_god",
"reg_karmicmeditation_mod_location_holy_ground_pantheon",
"reg_karmicmeditation_mod_location_nonbeliever_presence",
"reg_karmicmeditation_mod_location_nonbeliever_territory",
"reg_karmicmeditation_mod_location_other_world",
"reg_karmicmeditation_mod_location_other_world_value",
"reg_karmicmeditation_mod_location_sanctum_god",
"reg_karmicmeditation_mod_location_temple_god",
"reg_karmicmeditation_mod_motivation_controlled",
"reg_karmicmeditation_mod_motivation_emergency",
"reg_karmicmeditation_mod_motivation_freshman",
"reg_karmicmeditation_mod_motivation_mission",
"reg_karmicmeditation_mod_motivation_mission_value",
"reg_karmicmeditation_mod_motivation_selfish",
"reg_karmicmeditation_mod_motivation_selfish_value",
"reg_karmicmeditation_mod_motivation_sinner",
"reg_karmicmeditation_mod_motivation_sinner_value",
"reg_karmicmeditation_mod_other",
"reg_karmicmeditation_mod_time_holiday",
"reg_karmicmeditation_mod_time_last_meditation",
"reg_karmicmeditation_mod_time_month",
"reg_karmicmeditation_mod_time_nameless",
].map(attr => "change:" + attr).join(" "),
function(eventInfo) {
safeGetAttrs(
[
'gm_roll_opt',
'MU', 'IN', 'CH',
'KE', 'KE_max', 'Entrueckung',
'Liturgiekenntnis',
'reg_karmicmeditation_mod_location_demonic',
'reg_karmicmeditation_mod_location_demonic_value',
'reg_karmicmeditation_mod_location_holy_ground_god',
'reg_karmicmeditation_mod_location_holy_ground_pantheon',
'reg_karmicmeditation_mod_location_nonbeliever_presence',
'reg_karmicmeditation_mod_location_nonbeliever_territory',
'reg_karmicmeditation_mod_location_other_world',
'reg_karmicmeditation_mod_location_other_world_value',
'reg_karmicmeditation_mod_location_sanctum_god',
'reg_karmicmeditation_mod_location_temple_god',
'reg_karmicmeditation_mod_motivation_controlled',
'reg_karmicmeditation_mod_motivation_emergency',
'reg_karmicmeditation_mod_motivation_freshman',
'reg_karmicmeditation_mod_motivation_mission',
'reg_karmicmeditation_mod_motivation_mission_value',
'reg_karmicmeditation_mod_motivation_selfish',
'reg_karmicmeditation_mod_motivation_selfish_value',
'reg_karmicmeditation_mod_motivation_sinner',
'reg_karmicmeditation_mod_motivation_sinner_value',
'reg_karmicmeditation_mod_other',
'reg_karmicmeditation_mod_time_holiday',
'reg_karmicmeditation_mod_time_last_meditation',
'reg_karmicmeditation_mod_time_month',
'reg_karmicmeditation_mod_time_nameless',
], function(values) {
const caller = "Action Listener for Generation of Regeneration Roll (Karmic Meditation)";
debugLog(caller, "eventInfo", eventInfo, "values", values);
let attrsToChange = {};
const lkw = parseInt(values["Liturgiekenntnis"]);
const entrueckung = parseInt(values["Entrueckung"]);
const KE = parseInt(values["KE"]);
const KEMax = parseInt(values["KE_max"]);
const lastMeditation = parseInt(values["reg_karmicmeditation_mod_time_last_meditation"]);
const emergency = values["reg_karmicmeditation_mod_motivation_emergency"];
const mission = values["reg_karmicmeditation_mod_motivation_mission"];
const missionValue = parseInt(values["reg_karmicmeditation_mod_motivation_mission_value"]);
const selfish = values["reg_karmicmeditation_mod_motivation_selfish"];
const selfishValue = parseInt(values["reg_karmicmeditation_mod_motivation_selfish_value"]);
const controlled = values["reg_karmicmeditation_mod_motivation_controlled"];
const freshman = values["reg_karmicmeditation_mod_motivation_freshman"];
const sinner = values["reg_karmicmeditation_mod_motivation_sinner"];
const sinnerValue = parseInt(values["reg_karmicmeditation_mod_motivation_sinner_value"]);
const nonbelieverPresence = values["reg_karmicmeditation_mod_location_nonbeliever_presence"];
const holyGroundPantheon = values["reg_karmicmeditation_mod_location_holy_ground_pantheon"];
const holyGroundGod = values["reg_karmicmeditation_mod_location_holy_ground_god"];
const templeGod = values["reg_karmicmeditation_mod_location_temple_god"];
const sanctumGod = values["reg_karmicmeditation_mod_location_sanctum_god"];
const nonbelieverTerritory = values["reg_karmicmeditation_mod_location_nonbeliever_territory"];
const otherWorld = values["reg_karmicmeditation_mod_location_other_world"];
const otherWorldValue = parseInt(values["reg_karmicmeditation_mod_location_other_world_value"]);
const demonic = values["reg_karmicmeditation_mod_location_demonic"];
const demonicValue = parseInt(values["reg_karmicmeditation_mod_location_demonic_value"]);
const month = values["reg_karmicmeditation_mod_time_month"];
const holiday = values["reg_karmicmeditation_mod_time_holiday"];
const nameless = values["reg_karmicmeditation_mod_time_nameless"];
const modOther = parseInt(values["reg_karmicmeditation_mod_other"]);
// Constant modifiers
const modEmergency = -3;
const modControlled = 12;
const modFreshman = 3;
const modNonbelieverPresence = 3;
const modHolyGroundPantheon = -1;
const modHolyGroundGod = -2;
const modTempleGod = -3;
const modSanctumGod = -4;
const modNonbelieverTerritory = 3;
const modMonth = -1;
const modHoliday = -3;
const modNameless = 7;
// Calculate modifier
let mod = 0;
mod += lastMeditation;
if (emergency === "1") { mod += modEmergency; }
if (mission === "1") { mod += missionValue; }
if (selfish === "1") { mod += selfishValue; }
if (controlled === "1") { mod += modControlled; }
if (freshman === "1") { mod += modFreshman; }
if (sinner === "1") { mod += sinnerValue; }
if (nonbelieverPresence === "1") { mod += modNonbelieverPresence; }
if (holyGroundPantheon === "1") { mod += modHolyGroundPantheon; }
if (holyGroundGod === "1") { mod += modHolyGroundGod; }
if (templeGod === "1") { mod += modTempleGod; }
if (sanctumGod === "1") { mod += modSanctumGod; }
if (nonbelieverTerritory === "1") { mod += modNonbelieverTerritory; }
if (otherWorld === "1") { mod += otherWorldValue; }
if (demonic === "1") { mod += demonicValue; }
if (month === "1") { mod += modMonth; }
if (holiday === "1") { mod += modHoliday; }
if (nameless === "1") { mod += modNameless; }
mod += modOther;
// Build roll
const baseRoll = [
values["gm_roll_opt"],
"&{template:reg-karmicmeditation}",
`{{ke=[[${KE}]]}}`,
`{{kemax=[[${KEMax}]]}}`,
];
const KERegenerationRoll = [
"{{kegain=[[0]]}}",
`{{entrueckung=[[${entrueckung}]]}}`,
`{{entrueckunggain=[[0]]}}`,
`{{wert=[[${lkw}]]}}`,
`{{mod=[[${mod}]]}}`,
`{{stats=[[ [MU:] [[${values["MU"]}]]d1cs0cf2 + [IN:] [[${values["IN"]}]]d1cs0cf2 + [CH:] [[${values["CH"]}]]d1cs0cf2]]}}`,
'{{checkroll=[[ [MU-Wurf:] 1d20cs1cf20 + [IN-Wurf:] 1d20cs1cf20 + [CH-Wurf:] 1d20cs1cf20]]}}',
"{{checkresult=[[0]]}}",
"{{checkpoints=[[0]]}}",
];
const notRequiredRoll = [ "{{notrequired=[[0]]}}", ];
let roll = [ ... baseRoll ];
if (KE >= KEMax)
{
roll = [
... roll,
... notRequiredRoll,
];
} else {
roll = [
... roll,
... KERegenerationRoll,
];
}
attrsToChange["reg_karmicmeditation_roll"] = roll.join(" ").trim();
debugLog(caller, "attrsToChange", attrsToChange);
safeSetAttrs(attrsToChange);
});
});
on('clicked:reg_karmicmeditation-action', async (info) => {
const caller = "Action Listener for Regeneration Button (Karmic Meditation)";
let results = await startRoll("@{reg_karmicmeditation_roll}");
debugLog(caller, "head", "info:", info, "results:", results);
const rollID = results.rollId;
results = results.results;
let computed = {};
let attrsToChange = {};
// Convenience Object
let resultsOnly = {};
for (let property in results)
{
resultsOnly[property] = results[property].result;
}
// Roll required?
if (Object.hasOwn(resultsOnly, "notrequired"))
{
finishRoll(rollID);
} else {
const stats = [
results.stats.rolls[0].dice,
results.stats.rolls[1].dice,
results.stats.rolls[2].dice
];
const LkW = resultsOnly["wert"];
const mod = resultsOnly["mod"];
const rolls = [
results["checkroll"]["rolls"][0].results[0],
results["checkroll"]["rolls"][1].results[0],
results["checkroll"]["rolls"][2].results[0],
];
let KE = resultsOnly["ke"];
const KEMax = resultsOnly["kemax"];
const regenerationMinimum = 1;
let entrueckung = resultsOnly["entrueckung"];
// Last meditation was right now
attrsToChange["reg_karmicmeditation_mod_time_last_meditation"] = "12";
// 3d20 Check (Liturgy rules apply)
/// Result: 0 (Failure) or 1 (Success)
let result = 0;
/// Calculation of remaining skill points (= after check)
let effRolls = rolls.slice(); // copying the array
let effLkW = LkW - mod;
let LkPstar = effLkW;
//// Negative effective skill value: add |effLkW| to each individual roll
if (effLkW < 0)
{
for (let roll in rolls)
{
effRolls[roll] = rolls[roll] + Math.abs(effLkW);
}
LkPstar = 0;
}
//// Skill point consumption for every roll
for (let roll in effRolls)
{
LkPstar -= Math.max(0, effRolls[roll] - stats[roll]);
}
//// Limit result to skill value
LkPstar = Math.min(LkW, LkPstar);
computed["checkpoints"] = LkPstar;
//// Liturgies: Result only dependent on remaining skill points
result = LkPstar < 0 ? 0 : 1;
computed["checkresult"] = result;
// Effects of result
if (result === 1)
{
// Results of 0 remaining skill points count as 1
let KEGain = 0;
if (LkPstar === 0)
{
KEGain = regenerationMinimum;
} else {
KEGain = LkPstar;
}
computed["kegain"] = KEGain;
KE += KEGain;
// Limit to maximum
KE = Math.min(KEMax, KE);
computed["ke"] = KE;
attrsToChange["KE"] = KE;
// Limit rapture gain to only those karma points which could be stored
let entrueckungGain = KE - resultsOnly["ke"]
entrueckung += entrueckungGain;
computed["entrueckung"] = entrueckung;
computed["entrueckunggain"] = entrueckungGain;
attrsToChange["Entrueckung"] = entrueckung;
}
// Prepare output
computed["stats"] = stats.toString().replaceAll(",", "/");
computed["checkroll"] = rolls.toString().replaceAll(",", "/");
computed["mod"] = mod;
/// Prettify certain output
{
// "mod" and "result" correspond to the prettification function used
let modUseComputed = [
"kegain",
"entrueckunggain",
"mod"
];
for (let part of modUseComputed)
{
if (Object.hasOwn(computed, part))
{
computed[part] = prettifyMod(computed[part]);
}
}
let resultUseComputed = [
"wert",
"checkpoints",
];
for (let part of resultUseComputed)
{
if (Object.hasOwn(computed, part))
{
computed[part] = prettifyResult(computed[part]);
}
}
}
// Finishing
debugLog(caller, "tail", "rollID", rollID, "resultsOnly", resultsOnly, "attrsToChange", attrsToChange, "computed", computed);
safeSetAttrs(attrsToChange);
finishRoll(rollID, computed);
}
});
/* regeneration end */