diff --git a/Knight/knight.css b/Knight/knight.css index 21c8f90c22..4fd5a754ae 100644 --- a/Knight/knight.css +++ b/Knight/knight.css @@ -503,6 +503,9 @@ div.charsheet > div.content input[type=hidden].phase2[value="1"] ~ div button[ty background: RGB(93, 111, 179); color: white; } +div.charsheet > div.content input[type=hidden].herauts[value="0"] ~ div div.herauts { + display: none; +} div.charsheet > div.content div.topLeft { display: flex; background-image: url("https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Knight/knightLogo.png"); @@ -2519,6 +2522,9 @@ div.charsheet > div.content div.tabArmure div.dataArmure div.titre, div.charsheet > div.content div.tabArmure div.dataArmure h1.titre { display: flex; } +div.charsheet > div.content div.tabArmure div.dataArmure h1.titre { + text-transform: capitalize; +} div.charsheet > div.content div.tabArmure div.dataArmure input[type=number] { width: 100%; border: 0px; @@ -4920,6 +4926,88 @@ div.charsheet > div.content div.tabArmure div.styleCombat input[type=hidden][val div.charsheet > div.content div.tabArmure div.styleCombat input[type=hidden][value=suppression] ~ div.suppression { display: flex; } +div.charsheet > div.content div.tabArmure div.herauts { + flex-wrap: wrap; + width: 100%; + align-content: baseline; + background-color: RGB(93, 111, 179); + border: 1px solid RGB(93, 111, 179); + /* + ///PARAMETRES EXISTANTS\\\ + - titre : Pour tous les paramètres concernant le titre principal + - hasButton : Pour dire qu'il y a des boutons. (true / false) + - hasRollSpecial : S'il y a un bouton "Jet spécial". (true / false) + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + - hasButtonPersonnel : s'il s'agit d'un bouton "Personnel" (true / false) + - hasActionSpecial : s'il s'agit d'un bouton "action spécial" (true / false) + - hasSelect : s'il s'agit d'un select (true / false) + + - secondTitre : S'il y a un second titre (avec la classe titreBis + - actif : Pour dire qu'il est actif. (true / false) + - background : pour définir le background (transparent par défaut) + - color : pour définir la couleur du texte (white par défaut) + - hasButton : s'il a un bouton (true/false). + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + + - titreInverse : Si les boutons du titre sont inversés par rapport à d'habitude. + - actif : Pour dire qu'il est actif. (true / false) + - hasButton : s'il a un bouton (true/false). + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + */ +} +div.charsheet > div.content div.tabArmure div.herauts h1.titre { + width: 100%; + align-content: baseline; + background: transparent; + color: white; + line-height: 28px; + min-height: 28px; + justify-content: center; + font-size: 14px; +} +div.charsheet > div.content div.tabArmure div.herauts div.titre { + align-content: center; + align-items: center; + position: relative; + width: 100%; + min-height: 28px; + border-bottom: 1px solid RGB(93, 111, 179); +} +div.charsheet > div.content div.tabArmure div.herauts h1.titre { + display: flex; +} +div.charsheet > div.content div.tabArmure div.herauts div { + display: flex; + width: 100%; + background: RGB(213, 215, 237); + justify-content: space-between; + flex-wrap: wrap; + padding-right: 2px; + padding-left: 2px; +} +div.charsheet > div.content div.tabArmure div.herauts div button[type=action] { + display: flex; + width: calc((100% / 2) - 5px); + background: RGB(213, 215, 237); + color: black; + justify-content: center; + border: 1px solid black; + padding: 0px; + margin-top: 2px; + margin-bottom: 2px; + font-weight: bold; + height: 25px; + line-height: 25px; +} +div.charsheet > div.content div.tabArmure div.herauts div button[type=action]:nth-of-type(3) { + margin-left: auto; + margin-right: auto; +} +div.charsheet > div.content div.tabArmure div.herauts div input[type=hidden].devasterAnatheme[value="1"] ~ button[type=action].devasterAnatheme, div.charsheet > div.content div.tabArmure div.herauts div input[type=hidden].bourreauTenebres[value="1"] ~ button[type=action].bourreauTenebres, div.charsheet > div.content div.tabArmure div.herauts div input[type=hidden].equilibreBalance[value="1"] ~ button[type=action].equilibreBalance { + background: RGB(93, 111, 179); + color: white; +} div.charsheet > div.content div.tabArmure div.barbarianGoliath { flex-wrap: wrap; width: 100%; @@ -14050,6 +14138,9 @@ div.charsheet > div.content div.tabCombat div.dataArmure input[type=number] { text-align: center; height: 28px; } +div.charsheet > div.content div.tabCombat div.dataArmure h1.titre { + text-transform: capitalize; +} div.charsheet > div.content div.tabCombat div.dataArmure div.ligneTitre { display: flex; width: 100%; @@ -14914,6 +15005,88 @@ div.charsheet > div.content div.tabCombat div.styleCombat input[type=hidden][val div.charsheet > div.content div.tabCombat div.styleCombat input[type=hidden][value=suppression] ~ div.suppression { display: flex; } +div.charsheet > div.content div.tabCombat div.herauts { + flex-wrap: wrap; + width: 100%; + align-content: baseline; + background-color: RGB(93, 111, 179); + border: 1px solid RGB(93, 111, 179); + /* + ///PARAMETRES EXISTANTS\\\ + - titre : Pour tous les paramètres concernant le titre principal + - hasButton : Pour dire qu'il y a des boutons. (true / false) + - hasRollSpecial : S'il y a un bouton "Jet spécial". (true / false) + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + - hasButtonPersonnel : s'il s'agit d'un bouton "Personnel" (true / false) + - hasActionSpecial : s'il s'agit d'un bouton "action spécial" (true / false) + - hasSelect : s'il s'agit d'un select (true / false) + + - secondTitre : S'il y a un second titre (avec la classe titreBis + - actif : Pour dire qu'il est actif. (true / false) + - background : pour définir le background (transparent par défaut) + - color : pour définir la couleur du texte (white par défaut) + - hasButton : s'il a un bouton (true/false). + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + + - titreInverse : Si les boutons du titre sont inversés par rapport à d'habitude. + - actif : Pour dire qu'il est actif. (true / false) + - hasButton : s'il a un bouton (true/false). + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + */ +} +div.charsheet > div.content div.tabCombat div.herauts h1.titre { + width: 100%; + align-content: baseline; + background: transparent; + color: white; + line-height: 28px; + min-height: 28px; + justify-content: center; + font-size: 14px; +} +div.charsheet > div.content div.tabCombat div.herauts div.titre { + align-content: center; + align-items: center; + position: relative; + width: 100%; + min-height: 28px; + border-bottom: 1px solid RGB(93, 111, 179); +} +div.charsheet > div.content div.tabCombat div.herauts h1.titre { + display: flex; +} +div.charsheet > div.content div.tabCombat div.herauts div { + display: flex; + width: 100%; + background: RGB(213, 215, 237); + justify-content: space-between; + flex-wrap: wrap; + padding-right: 2px; + padding-left: 2px; +} +div.charsheet > div.content div.tabCombat div.herauts div button[type=action] { + display: flex; + width: calc((100% / 2) - 5px); + background: RGB(213, 215, 237); + color: black; + justify-content: center; + border: 1px solid black; + padding: 0px; + margin-top: 2px; + margin-bottom: 2px; + font-weight: bold; + height: 25px; + line-height: 25px; +} +div.charsheet > div.content div.tabCombat div.herauts div button[type=action]:nth-of-type(3) { + margin-left: auto; + margin-right: auto; +} +div.charsheet > div.content div.tabCombat div.herauts div input[type=hidden].devasterAnatheme[value="1"] ~ button[type=action].devasterAnatheme, div.charsheet > div.content div.tabCombat div.herauts div input[type=hidden].bourreauTenebres[value="1"] ~ button[type=action].bourreauTenebres, div.charsheet > div.content div.tabCombat div.herauts div input[type=hidden].equilibreBalance[value="1"] ~ button[type=action].equilibreBalance { + background: RGB(93, 111, 179); + color: white; +} div.charsheet > div.content div.tabCombat label.BMJets { display: flex; background: RGB(213, 215, 237); @@ -34015,6 +34188,88 @@ div.charsheet > div.content div.tabVehicule div.donnees label select { div.charsheet > div.content div.tabVehicule div.donnees label:not(:first-of-type) { border-top: 1px solid RGB(93, 111, 179); } +div.charsheet > div.content div.tabVehicule div.herauts { + flex-wrap: wrap; + width: 100%; + align-content: baseline; + background-color: RGB(93, 111, 179); + border: 1px solid RGB(93, 111, 179); + /* + ///PARAMETRES EXISTANTS\\\ + - titre : Pour tous les paramètres concernant le titre principal + - hasButton : Pour dire qu'il y a des boutons. (true / false) + - hasRollSpecial : S'il y a un bouton "Jet spécial". (true / false) + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + - hasButtonPersonnel : s'il s'agit d'un bouton "Personnel" (true / false) + - hasActionSpecial : s'il s'agit d'un bouton "action spécial" (true / false) + - hasSelect : s'il s'agit d'un select (true / false) + + - secondTitre : S'il y a un second titre (avec la classe titreBis + - actif : Pour dire qu'il est actif. (true / false) + - background : pour définir le background (transparent par défaut) + - color : pour définir la couleur du texte (white par défaut) + - hasButton : s'il a un bouton (true/false). + - hasBonusCarac : s'il s'agit de boutons de caracs (true / false) + + - titreInverse : Si les boutons du titre sont inversés par rapport à d'habitude. + - actif : Pour dire qu'il est actif. (true / false) + - hasButton : s'il a un bouton (true/false). + - hasButtonActivate : s'il s'agit de boutons "Activé" (true / false) + */ +} +div.charsheet > div.content div.tabVehicule div.herauts h1.titre { + width: 100%; + align-content: baseline; + background: transparent; + color: white; + line-height: 28px; + min-height: 28px; + justify-content: center; + font-size: 14px; +} +div.charsheet > div.content div.tabVehicule div.herauts div.titre { + align-content: center; + align-items: center; + position: relative; + width: 100%; + min-height: 28px; + border-bottom: 1px solid RGB(93, 111, 179); +} +div.charsheet > div.content div.tabVehicule div.herauts h1.titre { + display: flex; +} +div.charsheet > div.content div.tabVehicule div.herauts div { + display: flex; + width: 100%; + background: RGB(213, 215, 237); + justify-content: space-between; + flex-wrap: wrap; + padding-right: 2px; + padding-left: 2px; +} +div.charsheet > div.content div.tabVehicule div.herauts div button[type=action] { + display: flex; + width: calc((100% / 2) - 5px); + background: RGB(213, 215, 237); + color: black; + justify-content: center; + border: 1px solid black; + padding: 0px; + margin-top: 2px; + margin-bottom: 2px; + font-weight: bold; + height: 25px; + line-height: 25px; +} +div.charsheet > div.content div.tabVehicule div.herauts div button[type=action]:nth-of-type(3) { + margin-left: auto; + margin-right: auto; +} +div.charsheet > div.content div.tabVehicule div.herauts div input[type=hidden].devasterAnatheme[value="1"] ~ button[type=action].devasterAnatheme, div.charsheet > div.content div.tabVehicule div.herauts div input[type=hidden].bourreauTenebres[value="1"] ~ button[type=action].bourreauTenebres, div.charsheet > div.content div.tabVehicule div.herauts div input[type=hidden].equilibreBalance[value="1"] ~ button[type=action].equilibreBalance { + background: RGB(93, 111, 179); + color: white; +} div.charsheet > div.content div.tabVehicule div.jet { flex-wrap: wrap; width: 100%; @@ -41524,11 +41779,11 @@ div.charsheet > div.content div.tabEquipage div.equipage .repcontainer .repitem: .sheet-rolltemplate-simple div.sheet-ligneF > span.sheet-fullText > *, .sheet-rolltemplate-combat div.sheet-ligneF > span.sheet-fullText > *, .sheet-rolltemplate-mechaArmure div.sheet-ligneF > span.sheet-fullText > * { - width: max-content; + width: 100%; font-size: inherit; font-weight: inherit; line-height: inherit; - padding-right: 2px; + padding: 0px; } .sheet-rolltemplate-base div.sheet-ligneF > span.sheet-fullText .inlinerollresult, .sheet-rolltemplate-simple div.sheet-ligneF > span.sheet-fullText .inlinerollresult, @@ -41542,6 +41797,23 @@ div.charsheet > div.content div.tabEquipage div.equipage .repcontainer .repitem: .sheet-rolltemplate-mechaArmure div.sheet-ligneF > span.sheet-fullText:last-of-type { margin-bottom: 3px; } +.sheet-rolltemplate-base div.sheet-ligneFullHerauts, +.sheet-rolltemplate-simple div.sheet-ligneFullHerauts, +.sheet-rolltemplate-combat div.sheet-ligneFullHerauts, +.sheet-rolltemplate-mechaArmure div.sheet-ligneFullHerauts { + display: flex; + width: 100%; + background: RGB(213, 215, 237); + line-height: 16px; + flex-wrap: wrap; + justify-content: center; + word-wrap: anywhere; + min-height: 28px; + align-content: center; + font-weight: bold; + font-size: 12px; + text-align: center; +} .sheet-rolltemplate-base .sheet-space > span:last-of-type, .sheet-rolltemplate-simple .sheet-space > span:last-of-type, .sheet-rolltemplate-combat .sheet-space > span:last-of-type, diff --git a/Knight/knight.html b/Knight/knight.html index 1590beea29..86ad16e103 100644 --- a/Knight/knight.html +++ b/Knight/knight.html @@ -856,7 +856,10 @@ const i18n_deplacement = getTranslationByKey("deplacement"), i18n_lameCinetique = getTranslationByKey("lames-cinetiques-geantes-effets"), i18n_attaquesOmbres = getTranslationByKey("capacite-fan-made-Attaque-dans-les-ombres"), i18n_porteeMoyenne = getTranslationByKey("portee-moyenne"), - i18n_porteeCourte = getTranslationByKey("portee-courte") + i18n_porteeCourte = getTranslationByKey("portee-courte"), + i18n_devasterAnatheme = getTranslationByKey("devaster-anatheme"), + i18n_bourreauTenebres = getTranslationByKey("bourreau-tenebres"), + i18n_equilibrerBalance = getTranslationByKey("equilibrer-balance") ; function maxCar(carac, score, aspect) @@ -2924,12 +2927,14 @@ function getWeaponsEffects(prefix, effet, hasArmure, armure, vForce, vDexterite, let isLeste = false; let isLourd = false; let isELumiere = false; + let isFureur = false; let isMeurtrier = false; let isObliteration = false; let isOrfevrerie = false; let isSilencieux = false; let isTenebricide = false; let isTirRafale = false; + let isUltraviolence = false; const eAntiAnatheme = isApplied(effet[`${prefix}antiAnatheme`]); const eAntiVehicule = isApplied(effet[`${prefix}antiVehicule`]); @@ -3065,6 +3070,7 @@ function getWeaponsEffects(prefix, effet, hasArmure, armure, vForce, vDexterite, if (eFureur) { isConditionnelV = true; + isFureur = true; firstExec.push(`{{fureurValue=[[${eFureurV}D6]]}}`); @@ -3146,8 +3152,6 @@ function getWeaponsEffects(prefix, effet, hasArmure, armure, vForce, vDexterite, isConditionnelD = true; isConditionnelV = true; - exec.push(`{{tenebricide=${i18n_tenebricide}}} {{tenebricideConditionD=${i18n_tenebricideConditionD}}} {{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); - isTenebricide = true; } @@ -3160,6 +3164,7 @@ function getWeaponsEffects(prefix, effet, hasArmure, armure, vForce, vDexterite, if (eUltraviolence) { isConditionnelV = true; + isUltraviolence = true; firstExec.push(`{{ultraviolenceValue=[[${eUltraviolenceV}D6]]}}`); @@ -3254,6 +3259,8 @@ function getWeaponsEffects(prefix, effet, hasArmure, armure, vForce, vDexterite, result.isAssistantAttaque = isAssistantAttaque; result.isAntiAnatheme = isAntiAnatheme; result.isTirRafale = isTirRafale; + result.isFureur = isFureur; + result.isUltraviolence = isUltraviolence; result.eLumiere = eLumiere; result.isELumiere = isELumiere; @@ -6410,6 +6417,427 @@ function getStyleDistanceMod(value, diceDegats, diceViolence, pilonnage, hasArmu return result; } + +function updateRoll(roll, totalDegats, diceDegats, bonusDegats, totalViolence, diceViolence, bonusViolence, conditions) { + const tSurprise = roll.results.attaqueSurpriseValue || {}; + const tDestructeur = roll.results.destructeurValue || {}; + const tFureur = roll.results.fureurValue || {}; + const tMeurtrier = roll.results.meurtrierValue || {}; + const tUltraviolence = roll.results.ultraviolenceValue || {}; + + const tArmeAzurineValueD = roll.results.armeAzurineValueD || {}; + const tArmeAzurineValueV = roll.results.armeAzurineValueV || {}; + const tArmeRougeSangValueD = roll.results.armeRougeSangValueD || {}; + const tArmeRougeSangValueV = roll.results.armeRougeSangValueV || {}; + const tCheneSculpte = roll.results.cheneSculpteValue || {}; + const tGriffuresGraveesValueD = roll.results.griffuresGraveesValueD || {}; + const tGriffuresGraveesValueV = roll.results.griffuresGraveesValueV || {}; + const tMasqueBriseValueD = roll.results.masqueBriseValueD || {}; + const tMasqueBriseValueV = roll.results.masqueBriseValueV || {}; + const tRouagesCassesValueD = roll.results.rouagesCassesValueD || {}; + const tRouagesCassesValueV = roll.results.rouagesCassesValueV || {}; + + const isTenebricide = conditions.isTenebricide || false; + const isSurprise = conditions.isSurprise || false; + const isDestructeur = conditions.isDestructeur || false; + const isFureur = conditions.isFureur || false; + const isMeurtrier = conditions.isMeurtrier || false; + const isUltraviolence = conditions.isUltraviolence || false; + + const isArmeAzurine = conditions.isArmeAzurine || false; + const isArmeRougeSang = conditions.isArmeRougeSang || false; + const isCheneSculpte = conditions.isCheneSculpte || false; + const isGriffureGravee = conditions.isGriffureGravee || false; + const isMasqueBrise = conditions.isMasqueBrise || false; + const isRouagesCasses = conditions.isRouagesCasses || false; + + let tDegats = totalDegats; + let tViolence = totalViolence; + + let hDestructeur = 0; + let hFureur = 0; + let hMeurtrier = 0; + let hSurprise = 0; + let hUltraviolence = 0; + + let hArmeAzurineValueD = 0; + let hArmeAzurineValueV = 0; + let hArmeRougeSangValueD = 0; + let hArmeRougeSangValueV = 0; + let hCheneSculpte = 0; + let hGriffuresGraveesValueD = 0; + let hGriffuresGraveesValueV = 0; + let hMasqueBriseValueD = 0; + let hMasqueBriseValueV = 0; + let hRouagesCassesValueD = 0; + let hRouagesCassesValueV = 0; + + if (isSurprise) { hSurprise = tSurprise.result; } + if (isDestructeur) { hDestructeur = tDestructeur.result; } + if (isFureur) { hFureur = tFureur.result; } + if (isMeurtrier) { hMeurtrier = tMeurtrier.result; } + if (isUltraviolence) { hUltraviolence = tUltraviolence.result; } + + if (isArmeAzurine) { + hArmeAzurineValueD = tArmeAzurineValueD.result; + hArmeAzurineValueV = tArmeAzurineValueV.result; + } + if (isArmeRougeSang) { + hArmeRougeSangValueD = tArmeRougeSangValueD.result; + hArmeRougeSangValueV = tArmeRougeSangValueV.result; + } + if (isCheneSculpte) { hCheneSculpte = tCheneSculpte.result; } + if (isGriffureGravee) { + hGriffuresGraveesValueD = tGriffuresGraveesValueD.result; + hGriffuresGraveesValueV = tGriffuresGraveesValueV.result; + } + if (isMasqueBrise) { + hMasqueBriseValueD = tMasqueBriseValueD.result; + hMasqueBriseValueV = tMasqueBriseValueV.result; + } + if (isRouagesCasses) { + hRouagesCassesValueD = tRouagesCassesValueD.result; + hRouagesCassesValueV = tRouagesCassesValueV.result; + } + + let vTDegats = 0; + let vTViolence = 0; + let vTDestructeur = 0; + let vTFureur = 0; + let vTMeurtrier = 0; + let vTSurprise = 0; + let vTUltraviolence = 0; + + let vTCheneSculpte = 0; + + if (conditions.bourreau || conditions.equilibre) { + tDegats = diceDegats.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + if (bonusDegats.length !== 0) { tDegats += bonusDegats.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); } + + if (isDestructeur) { + hDestructeur = tDestructeur.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isMeurtrier) { + hMeurtrier = tMeurtrier.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isSurprise) { + if (tSurprise.dice.length !== 0) { + const normalRoll = tSurprise.dice.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); + const bonusSurprise = +tSurprise.result - +normalRoll; + + hSurprise = tSurprise.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + + hSurprise += bonusSurprise; + } + } + + if (isArmeAzurine) { + hArmeAzurineValueD = tArmeAzurineValueD.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isArmeRougeSang) { + hArmeRougeSangValueD = tArmeRougeSangValueD.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isCheneSculpte) { + hCheneSculpte = tCheneSculpte.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isGriffureGravee) { + hGriffuresGraveesValueD = tGriffuresGraveesValueD.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isMasqueBrise) { + hMasqueBriseValueD = tMasqueBriseValueD.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isRouagesCasses) { + hRouagesCassesValueD = tRouagesCassesValueD.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + } + + if (conditions.devaste || conditions.equilibre) { + tViolence = diceViolence.reduce((accumulateur, valeurCourante) => { + let newV = valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + + if (bonusViolence.length !== 0) { tViolence += bonusViolence.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); } + + if (isFureur) { + hFureur = tFureur.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isUltraviolence) { + hUltraviolence = tUltraviolence.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isArmeAzurine) { + hArmeAzurineValueV = tArmeAzurineValueV.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isArmeRougeSang) { + hArmeRougeSangValueV = tArmeRougeSangValueV.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isGriffureGravee) { + hGriffuresGraveesValueV = tGriffuresGraveesValueV.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isMasqueBrise) { + hMasqueBriseValueV = tMasqueBriseValueV.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (isRouagesCasses) { + hRouagesCassesValueV = tRouagesCassesValueV.dice.reduce((accumulateur, valeurCourante) => { + let newV = +valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + } + + if (isTenebricide) { + let limiteD = Math.floor(+diceDegats.length / 2); + let limiteV = Math.floor(+diceViolence.length / 2); + + if (limiteD < 1) { limiteD = 1; } + if (limiteV < 1) { limiteV = 1; } + + vTDegats = diceDegats.reduce((accumulateur, valeurCourante, index) => { + let result = +accumulateur; + + if (index < limiteD) { + let newV = +valeurCourante; + + if (conditions.bourreau || conditions.equilibre) { + if (newV <= 3) { newV = 4; } + } + + result += newV; + } + + return result; + }, 0); + + if (bonusDegats.length !== 0) { vTDegats += bonusDegats.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); } + + vTViolence = diceViolence.reduce((accumulateur, valeurCourante, index) => { + let result = +accumulateur; + + if (index < limiteV) { + let newV = +valeurCourante; + + if (conditions.bourreau || conditions.equilibre) { + if (newV <= 3) { newV = 4; } + } + + result += newV; + } + + return result; + }, 0); + + if (bonusViolence.length !== 0) { vTViolence += bonusViolence.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); } + + if (isMeurtrier) { + let diceMeurtrier = +tMeurtrier.dice[0]; + + if (conditions.bourreau || conditions.equilibre) { + if (diceMeurtrier <= 3) { diceMeurtrier = 4; } + } + + vTMeurtrier = diceMeurtrier; + } + + if (isDestructeur) { + let diceDestructeur = +tDestructeur.dice[0]; + + if (conditions.bourreau || conditions.equilibre) { + if (diceDestructeur <= 3) { diceDestructeur = 4; } + } + + vTDestructeur = diceDestructeur; + } + + if (isCheneSculpte) { + let diceCheneSculpte = +tCheneSculpte.dice[0]; + + if (conditions.bourreau || conditions.equilibre) { + if (diceCheneSculpte <= 3) { diceCheneSculpte = 4; } + } + + vTCheneSculpte = diceCheneSculpte; + } + + if (isFureur) { + let diceFureur1 = +tFureur.dice[0]; + let diceFureur2 = +tFureur.dice[1]; + + if (conditions.devaste || conditions.equilibre) { + if (diceFureur1 <= 3) { diceFureur1 = 4; } + if (diceFureur2 <= 3) { diceFureur2 = 4; } + } + + vTFureur = diceFureur1 + diceFureur2; + } + + if (isSurprise) { + let bonusSurprise = +tSurprise.result; + + if (tSurprise.dice.length !== 0) { + const dices = tSurprise.dice; + const limiteS = Math.floor(+dices.length / 2); + const normalRoll = dices.reduce((accumulateur, valeurCourante) => accumulateur + +valeurCourante); + bonusSurprise -= +normalRoll; + + vTSurprise = dices.reduce((accumulateur, valeurCourante, index) => { + let result = accumulateur; + + if (index < limiteS) { + let newV = +valeurCourante; + + if (conditions.bourreau || conditions.equilibre) { + if (newV <= 3) { newV = 4; } + } + + result += newV; + } + + return result; + }, 0); + } + + vTSurprise += +bonusSurprise; + } + + if (isUltraviolence) { + let diceUltraviolence = +tUltraviolence.dice[0]; + + if (conditions.devaste || conditions.equilibre) { + if (diceUltraviolence <= 3) { diceUltraviolence = 4; } + } + + vTUltraviolence = diceUltraviolence; + } + } + + const computed = { + degats: tDegats, + violence: tViolence, + tenebricideValueD: vTDegats, + tenebricideValueV: vTViolence, + tenebricideASValue: vTSurprise, + destructeurValue: hDestructeur, + fureurValue: hFureur, + meurtrierValue: hMeurtrier, + attaqueSurpriseValue: hSurprise, + ultraviolenceValue: hUltraviolence, + armeAzurineValueD: hArmeAzurineValueD, + armeAzurineValueV: hArmeAzurineValueV, + armeRougeSangValueD: hArmeRougeSangValueD, + armeRougeSangValueV: hArmeRougeSangValueV, + cheneSculpteValue: hCheneSculpte, + griffuresGraveesValueD: hGriffuresGraveesValueD, + griffuresGraveesValueV: hGriffuresGraveesValueV, + masqueBriseValueD: hMasqueBriseValueD, + masqueBriseValueV: hMasqueBriseValueV, + rouagesCassesValueD: hRouagesCassesValueD, + rouagesCassesValueV: hRouagesCassesValueV, + tDestructeurValue: vTDestructeur, + tFureurValue: vTFureur, + tMeurtrierValue: vTMeurtrier, + tUltraviolenceValue: vTUltraviolence, + tCheneSculpteValue: vTCheneSculpte, + }; + + return computed; +} /* eslint-disable no-restricted-syntax */ /* eslint-disable guard-for-in */ /* eslint-disable object-shorthand */ @@ -7228,13 +7656,17 @@ on('change:armurePJModif', async () => { await setAttrsAsync({ armureAscension_max: base + modif }); }); -on('change:cdfPJModif', async () => { - const attrs = await getAttrsAsync(['cdfPJModif']); +on('change:cdfPJAscensionModif', async () => { + const attrs = await getAttrsAsync(['cdfPJAscensionModif']); const base = 10; - const modif = +attrs.cdfPJModif; + const modif = +attrs.cdfPJAscensionModif; + const total = base + modif; - await setAttrsAsync({ cdfAscension_max: base + modif }); + await setAttrsAsync({ + cdfAscension: total, + cdfAscension_max: total, + }); }); on('change:shamanNbreTotem', async () => { @@ -9588,6 +10020,26 @@ on('change:rangerArmeDegatEvol change:rangerArmeDegat change:rangerArmeViolenceE }); // LONGBOW +// HERAUT DE LEQUILIBRE - CHEVALIER DE LA LUMIERE +const chevalierHerauts = ['devasterAnatheme', 'bourreauTenebres', 'equilibreBalance']; + +chevalierHerauts.forEach((button) => { + on(`clicked:${button}`, async () => { + const attrs = await getAttrsAsync([button]); + const value = +attrs[button]; + const result = {}; + + let newValue = 1; + + if (value === 1) { newValue = 0; } + + result[button] = newValue; + + await setAttrsAsync(result); + }); +}); +// HERAUT DE LEQUILIBRE - CHEVALIER DE LA LUMIERE + // Import NPC on('clicked:importKNPCG', () => { getAttrs(['importKNPCG'], (value) => { @@ -10094,6 +10546,16 @@ on('change:ameliorationOArmes', (eventInfo) => { setAttrsAsync(update); }); + +on('change:chevaliersHerauts', () => { + const update = {}; + + update.devasterAnatheme = 0; + update.bourreauTenebres = 0; + update.equilibreBalance = 0; + + setAttrsAsync(update); +}); /* eslint-disable prefer-destructuring */ /* eslint-disable no-undef */ const buttontab = ['dossier', 'armure', 'combat', 'module', 'overdrive', 'ia', 'ia-incarnee', 'historique', 'art', 'heroisme', 'vehicule', 'mecha-armure', 'capacites', 'equipage']; @@ -10932,108 +11394,153 @@ on('clicked:domaineArtistique', (info) => { }); /* eslint-disable camelcase */ /* eslint-disable no-undef */ -on('clicked:distanceBard', (info) => { +on('clicked:distanceBard', async (info) => { const roll = info.htmlAttributes.value; let attributs = [ 'armureLegende', 'bardAttSpe', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(listArmureLegende); + const attrs = await getAttrsAsync(attributs); - getAttrs(attributs, (value) => { - const exec = []; + const exec = []; - const armureL = value.armureLegende; + const armureL = attrs.armureLegende; - const degats = value.bardAttSpe; - const violence = value.bardAttSpe; + const degats = attrs.bardAttSpe; + const violence = attrs.bardAttSpe; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; - let MALGoliath; - let MALGhost; - let MALTypeSoldier; - let MALTypeHunter; - let MALTypeHerald; - let MALTypeScholar; - let MALTypeScout; + let MALGoliath; + let MALGhost; + let MALTypeSoldier; + let MALTypeHunter; + let MALTypeHerald; + let MALTypeScholar; + let MALTypeScout; - exec.push(roll); + exec.push(roll); - switch (armureL) { - case 'barbarian': - MALGoliath = Number(value.MALBarbarianGoliath); + switch (armureL) { + case 'barbarian': + MALGoliath = Number(attrs.MALBarbarianGoliath); - if (MALGoliath !== 0) { exec.push(`{{MALGoliath=[[${MALGoliath}]]}}`); } - break; + if (MALGoliath !== 0) { exec.push(`{{MALGoliath=[[${MALGoliath}]]}}`); } + break; - case 'rogue': - MALGhost = value.MALRogueGhost; + case 'rogue': + MALGhost = attrs.MALRogueGhost; - if (MALGhost !== '') { exec.push(`{{MALspecial2=${i18n_ghostActive}}}`); } - break; + if (MALGhost !== '') { exec.push(`{{MALspecial2=${i18n_ghostActive}}}`); } + break; - case 'warrior': - MALTypeSoldier = value.MALWarriorSoldierA; - MALTypeHunter = value.MALWarriorHunterA; - MALTypeHerald = value.MALWarriorHeraldA; - MALTypeScholar = value.MALWarriorScholarA; - MALTypeScout = value.MALWarriorScoutA; + case 'warrior': + MALTypeSoldier = attrs.MALWarriorSoldierA; + MALTypeHunter = attrs.MALWarriorHunterA; + MALTypeHerald = attrs.MALWarriorHeraldA; + MALTypeScholar = attrs.MALWarriorScholarA; + MALTypeScout = attrs.MALWarriorScoutA; - if (MALTypeSoldier !== 0) { exec.push(`{{MALspecial2=${i18n_typeSoldier}}}`); } + if (MALTypeSoldier !== 0) { exec.push(`{{MALspecial2=${i18n_typeSoldier}}}`); } - if (MALTypeHunter !== 0) { exec.push(`{{MALspecial2=${i18n_typeHunter}}}`); } + if (MALTypeHunter !== 0) { exec.push(`{{MALspecial2=${i18n_typeHunter}}}`); } - if (MALTypeHerald !== 0) { exec.push(`{{MALspecial2=${i18n_typeHerald}}}`); } + if (MALTypeHerald !== 0) { exec.push(`{{MALspecial2=${i18n_typeHerald}}}`); } - if (MALTypeScholar !== 0) { exec.push(`{{MALspecial2=${i18n_typeScholar}}}`); } + if (MALTypeScholar !== 0) { exec.push(`{{MALspecial2=${i18n_typeScholar}}}`); } - if (MALTypeScout !== 0) { exec.push(`{{MALspecial2=${i18n_typeScout}}}`); } - break; + if (MALTypeScout !== 0) { exec.push(`{{MALspecial2=${i18n_typeScout}}}`); } + break; - default: - MALGoliath = 0; + default: + MALGoliath = 0; - MALGhost = ''; + MALGhost = ''; - MALTypeSoldier = ''; - MALTypeHunter = ''; - MALTypeHerald = ''; - MALTypeScholar = ''; - MALTypeScout = ''; - break; - } + MALTypeSoldier = ''; + MALTypeHunter = ''; + MALTypeHerald = ''; + MALTypeScholar = ''; + MALTypeScout = ''; + break; + } - exec.push(`{{degats=[[${degats}]]}}`); - exec.push(`{{violence=[[${violence}]]}}`); - exec.push('{{succesConditionnel=true}}'); - exec.push(`{{chocAutomatique=${i18n_choc} 1}}`); - exec.push(`{{chocAutomatiqueCondition=${i18n_chocAutomatique} < 12}}`); - exec.push(`{{effets=${i18n_ignoreArmure} / ${i18n_ignoreCDF} / ${i18n_dispersion} 6}}`); + exec.push(`{{degats=[[${degats}]]}}`); + exec.push(`{{violence=[[${violence}]]}}`); + exec.push('{{succesConditionnel=true}}'); + exec.push(`{{chocAutomatique=${i18n_choc} 1}}`); + exec.push(`{{chocAutomatiqueCondition=${i18n_chocAutomatique} < 12}}`); + exec.push(`{{effets=${i18n_ignoreArmure} / ${i18n_ignoreCDF} / ${i18n_dispersion} 6}}`); - startRoll(exec.join(' '), (results) => { - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - degats: tDegats, - violence: tViolence, - }, - ); - }); - }); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + // ROLL + const finalRoll = await startRoll(exec.join(' ')); + + const rDegats = finalRoll.results.degats.rolls[0].results; + const rViolence = finalRoll.results.violence.rolls[0].results; + + let tDegats = finalRoll.results.degats.result; + let tViolence = finalRoll.results.violence.result; + + if (bourreau || equilibre) { + tDegats = rDegats.reduce((accumulateur, valeurCourante) => { + let newV = valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + + tDegats += 6; + } + + if (devaste || equilibre) { + tViolence = rViolence.reduce((accumulateur, valeurCourante) => { + let newV = valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + + tViolence += 6; + } + + const computed = { + degats: tDegats, + violence: tViolence, + }; + + finishRoll(finalRoll.rollId, computed); + // ROLL }); /* eslint-disable camelcase */ /* eslint-disable no-undef */ const berserkIlluminationRoll = ['berserkIlluminationBlaze', 'berserkIlluminationLantern']; berserkIlluminationRoll.forEach((button) => { - on(`clicked:${button}`, (info) => { + on(`clicked:${button}`, async (info) => { const roll = info.htmlAttributes.value; - const attributs = []; + const attributs = [ + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', + ]; if (button === 'berserkIlluminationBlaze') { attributs.push(`${button}Dgts`); @@ -11046,43 +11553,79 @@ berserkIlluminationRoll.forEach((button) => { attributs.push(`${button}Portee`); } - getAttrs(attributs, (value) => { - const exec = []; - exec.push(roll); + const attrs = await getAttrsAsync(attributs); + const exec = []; + exec.push(roll); - const dgts = value[`${button}Dgts`]; - let violence = 0; - const portee = value[`${button}Portee`]; + const dgts = attrs[`${button}Dgts`]; + let violence = 0; + const portee = attrs[`${button}Portee`]; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; - if (button === 'berserkIlluminationBlaze') { - violence = value[`${button}Violence`]; - exec.push(`{{violence=[[${violence}]]}}`); + if (button === 'berserkIlluminationBlaze') { + violence = attrs[`${button}Violence`]; + exec.push(`{{violence=[[${violence}]]}}`); + } + + if (button === 'berserkIlluminationLantern') { + exec.push(`{{esperance=${i18n_esperance}}}`); + exec.push(`{{esperanceConditionD=${i18n_esperanceConditionD}}}`); + exec.push('{{degatsConditionnel=true}}'); + } + + exec.push(`{{degats=[[${dgts}]]}}`); + exec.push(`{{portee=${i18n_portee} ${portee}}}`); + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + // ROLL + const finalRoll = await startRoll(exec.join(' ')); + + const rDegats = finalRoll.results.degats.rolls[0].results; + + let tDegats = finalRoll.results.degats.result; + let tViolence = 0; + + if (bourreau || equilibre) { + tDegats = rDegats.reduce((accumulateur, valeurCourante) => { + let newV = valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); + } + + if (finalRoll.results.violence !== undefined) { + const rViolence = finalRoll.results.violence.rolls[0].results; + + tViolence = finalRoll.results.violence.result; + + if (devaste || equilibre) { + tViolence = rViolence.reduce((accumulateur, valeurCourante) => { + let newV = valeurCourante; + if (newV <= 3) { newV = 4; } + + return accumulateur + newV; + }, 0); } + } - if (button === 'berserkIlluminationLantern') { - exec.push(`{{esperance=${i18n_esperance}}}`); - exec.push(`{{esperanceConditionD=${i18n_esperanceConditionD}}}`); - exec.push('{{degatsConditionnel=true}}'); - } + const computed = { + degats: tDegats, + violence: tViolence, + }; - exec.push(`{{degats=[[${dgts}]]}}`); - exec.push(`{{portee=${i18n_portee} ${portee}}}`); - - startRoll(exec.join(' '), (results) => { - const tDegats = results.results.degats.result; - let tViolence = 0; - - if (results.results.violence !== undefined) { tViolence = results.results.violence.result; } - - finishRoll( - results.rollId, - { - degats: tDegats, - violence: tViolence, - }, - ); - }); - }); + finishRoll(finalRoll.rollId, computed); }); }); @@ -11590,6 +12133,9 @@ rollCombatContact.forEach((button) => { `${ODValue.combat}`, 'energiePJ', 'espoir', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listArmure, listArmureLegende, listStyle, listBase); @@ -11842,6 +12388,7 @@ rollCombatContact.forEach((button) => { let eASAssassin = ''; let eASAssassinValue = 0; + let isSurprise = false; let isAssistantAttaque = false; let isAntiAnatheme = false; let isCadence = false; @@ -11852,14 +12399,14 @@ rollCombatContact.forEach((button) => { let isDestructeur = false; let vDestructeur = 0; let isLeste = false; + let isFureur = false; let isMeurtrier = false; let vMeurtrier = 0; let nowSilencieux = false; let isObliteration = false; let isOrfevrerie = false; let isTenebricide = false; - - let ASTenebricide = []; + let isUltraviolence = false; let isCheneSculpte = false; let vCheneSculpte = 0; @@ -11895,6 +12442,10 @@ rollCombatContact.forEach((button) => { const energie = attrs.energiePJ; const espoir = attrs.espoir; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + let autresEffets = []; let autresAmeliorationsS = []; let autresAmeliorationsO = []; @@ -12030,6 +12581,10 @@ rollCombatContact.forEach((button) => { isObliteration = effets.isObliteration; + isFureur = effets.isFureur; + + isUltraviolence = effets.isUltraviolence; + lumiere = effets.eLumiere; isELumiere = effets.isELumiere; lumiereValue = Number(effets.eLumiereValue); @@ -12084,7 +12639,7 @@ rollCombatContact.forEach((button) => { // GESTION DES AMELIORATIONS ORNEMENTALES - ameliorationsO = getWeaponsContactAO(prefix, AO, isCadence, vCadence, isObliteration, isAntiAnatheme); + ameliorationsO = getWeaponsContactAO(prefix, attrs, isCadence, vCadence, isObliteration, isAntiAnatheme); if (ameliorationsO.isChromee) { sCadence = ameliorationsO.rCadence; @@ -12131,6 +12686,14 @@ rollCombatContact.forEach((button) => { diceViolence += ameliorationsO.diceViolence; // FIN GESTION DES AMELIORATIONS ORNEMENTALES + } else if (armure === 'berserk') { + isConditionnelD = true; + isConditionnelV = true; + + exec.push(`{{antiAnatheme=${i18n_antiAnatheme}}} {{antiAnathemeCondition=${i18n_antiAnathemeCondition}}}`); + + isAntiAnatheme = true; + isTenebricide = true; } // GESTION DU STYLE @@ -12296,46 +12859,6 @@ rollCombatContact.forEach((button) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); - if (isTenebricide) { - let degatsTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - const diceDegatsTenebricide = Math.floor(diceDegats / 2); - const diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); - - if (eASAssassinValue > 0) { - eAssassinTenebricideValue = Math.ceil(eASAssassinValue / 2); - - ASTenebricide.unshift(eASAssassin); - ASValueTenebricide.unshift(`${eAssassinTenebricideValue}D6`); - - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - } - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } else if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } - } - if (isObliteration) { let ASObliteration = []; let ASValueObliteration = []; @@ -12405,6 +12928,24 @@ rollCombatContact.forEach((button) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + isSurprise = true; + } + + if (isTenebricide) { + exec.push(`{{tenebricide=${i18n_tenebricide}}} {{tenebricideConditionD=${i18n_tenebricideConditionD}}} {{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); + + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); + } + + if (isMeurtrier) { firstExec.push('{{tMeurtrierValue=[[0]]}}'); } + if (isDestructeur) { firstExec.push('{{tDestructeurValue=[[0]]}}'); } + if (isFureur) { firstExec.push('{{tFureurValue=[[0]]}}'); } + if (isUltraviolence) { firstExec.push('{{tUltraviolenceValue=[[0]]}}'); } + if (isCheneSculpte) { firstExec.push('{{tCheneSculpteValue=[[0]]}}'); } } if (isELumiere) { autresEffets.push(`${i18n_lumiere} ${lumiereValue}`); } else if (isASLumiere) { autresAmeliorationsS.push(lumiere); } @@ -12447,100 +12988,94 @@ rollCombatContact.forEach((button) => { if (ameliorationsO.firstExec) { firstExec = firstExec.concat(ameliorationsO.firstExec); } } + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + exec = firstExec.concat(exec); + // ROLL + let finalRoll; + if (pasEnergie === false) { - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + finalRoll = await startRoll(exec.join(' ')); + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tJet = finalRoll.results.jet.result; - const tMeurtrier = results.results.meurtrierValue; - let vTMeurtrier = 0; + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - if (tMeurtrier !== undefined) { vTMeurtrier = tMeurtrier.dice[0]; } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - const tDestructeur = results.results.destructeurValue; - let vTDestructeur = 0; + const conditions = { + bourreau, + devaste, + equilibre, + isTenebricide, + isSurprise, + isDestructeur, + isFureur, + isMeurtrier, + isUltraviolence, + isArmeAzurine, + isArmeRougeSang, + isCheneSculpte, + isGriffureGravee, + isMasqueBrise, + isRouagesCasses, + }; - if (tDestructeur !== undefined) { vTDestructeur = tDestructeur.dice[0]; } + const computed = updateRoll(finalRoll, tDegats, rDegats, bDegats, tViolence, rViolence, bViolence, conditions); - const tFureur = results.results.fureurValue; - let vTFureur = 0; + const finalComputed = { + jet: tJet + tBonus, + }; - if (tFureur !== undefined) { vTFureur = tFureur.dice[0] + tFureur.dice[1]; } + Object.assign(finalComputed, computed); - const tUltraviolence = results.results.ultraviolenceValue; + finishRoll(finalRoll.rollId, finalComputed); - let vTUltraviolence = 0; + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; - if (tUltraviolence !== undefined) { vTUltraviolence = tUltraviolence.dice[0]; } + const exploitComputed = { + jet: tRExploit, + }; - const tCheneSculpte = results.results.cheneSculpteValue; - let vTCheneSculpte = 0; + finishRoll(exploitRoll.rollId, exploitComputed); + } - if (tCheneSculpte !== undefined) { vTCheneSculpte = tCheneSculpte.dice[0]; } - - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - meurtrierValue: vTMeurtrier, - destructeurValue: vTDestructeur, - fureurValue: vTFureur, - ultraviolenceValue: vTUltraviolence, - cheneSculpteValue: vTCheneSculpte, - }, - ); - - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); + if (sEnergie !== false) { + if (armure === 'berserk') { + setAttrs({ espoir: newEnergie }); + } else { + setAttrs({ energiePJ: newEnergie }); } - if (sEnergie !== false) { - if (armure === 'berserk') { - setAttrs({ - espoir: newEnergie, - }); - } else { - setAttrs({ - energiePJ: newEnergie, - }); - } - - if (newEnergie === 0) { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); - } + if (newEnergie === 0) { + const noEnergieRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`); + finishRoll(noEnergieRoll.rollId, {}); } - }); + } } else if (button === 'repeating_armeCaC:armecontact') { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`); + finishRoll(finalRoll.rollId, {}); } else { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{text=${sEnergieText}}}${name}`); + finishRoll(finalRoll.rollId, {}); } }); + // ROLL }); /* eslint-disable max-len */ /* eslint-disable prefer-destructuring */ @@ -12568,6 +13103,9 @@ rollCombatDistance.forEach((button) => { `${ODValue.dexterite}`, 'tir', `${ODValue.tir}`, + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listArmure, listArmureLegende, listStyle, listBase); @@ -12810,6 +13348,7 @@ rollCombatDistance.forEach((button) => { let eASAssassin = ''; let eASAssassinValue = 0; + let isSurprise = false; let isAssistantAttaque = false; let isAntiAnatheme = false; let isCadence = false; @@ -12818,12 +13357,14 @@ rollCombatDistance.forEach((button) => { let isDeuxMains = false; let isDestructeur = false; let vDestructeur = 0; + let isFureur = false; let isMeurtrier = false; let vMeurtrier = 0; let nowSilencieux = false; let isObliteration = false; let isTenebricide = false; let isTirRafale = false; + let isUltraviolence = false; let isChambreDouble = false; let isELumiere = false; @@ -12837,6 +13378,10 @@ rollCombatDistance.forEach((button) => { const energie = attrs.energiePJ; const espoir = attrs.espoir; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + let autresEffets = []; let autresAmeliorationsA = []; const autresSpecial = []; @@ -12930,6 +13475,7 @@ rollCombatDistance.forEach((button) => { isAntiAnatheme = effets.isAntiAnatheme; + isAssassin = effets.isAssassin; isAssistantAttaque = effets.isAssistantAttaque; isCadence = effets.isCadence; @@ -12949,6 +13495,9 @@ rollCombatDistance.forEach((button) => { isTenebricide = effets.isTenebricide; + isFureur = effets.isFureur; + isUltraviolence = effets.isUltraviolence; + isObliteration = effets.isObliteration; isTirRafale = effets.isTirRafale; @@ -13171,47 +13720,6 @@ rollCombatDistance.forEach((button) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); - if (isTenebricide) { - let degatsTenebricide = []; - let ASTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - const diceDegatsTenebricide = Math.floor(diceDegats / 2); - const diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); - - if (eASAssassinValue > 0) { - eAssassinTenebricideValue = Math.ceil(eASAssassinValue / 2); - - ASTenebricide.unshift(eASAssassin); - ASValueTenebricide.unshift(`${eAssassinTenebricideValue}D6`); - - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - } - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } else if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } - } - if (isObliteration) { let ASObliteration = []; let ASValueObliteration = []; @@ -13269,10 +13777,37 @@ rollCombatDistance.forEach((button) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + isSurprise = true; + } + + if (isTenebricide) { + exec.push(`{{tenebricide=${i18n_tenebricide}}} {{tenebricideConditionD=${i18n_tenebricideConditionD}}} {{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); + + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); + } + + if (isMeurtrier) { firstExec.push('{{tMeurtrierValue=[[0]]}}'); } + if (isDestructeur) { firstExec.push('{{tDestructeurValue=[[0]]}}'); } + if (isFureur) { firstExec.push('{{tFureurValue=[[0]]}}'); } + if (isUltraviolence) { firstExec.push('{{tUltraviolenceValue=[[0]]}}'); } } if (isELumiere) { autresEffets.push(`${i18n_lumiere} ${lumiereValue}`); } + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (autresEffets.length > 0) { autresEffets.sort(); exec.push(`{{effets=${autresEffets.join(' / ')}}}`); @@ -13300,90 +13835,76 @@ rollCombatDistance.forEach((button) => { exec = firstExec.concat(exec); + // ROLL + let finalRoll; + if (pasEnergie === false) { - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + finalRoll = await startRoll(exec.join(' ')); + const tJet = finalRoll.results.jet.result; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - const tMeurtrier = results.results.meurtrierValue; - let vTMeurtrier = 0; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tMeurtrier !== undefined) { vTMeurtrier = tMeurtrier.dice[0]; } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - const tDestructeur = results.results.destructeurValue; - let vTDestructeur = 0; + const conditions = { + bourreau, + devaste, + equilibre, + isTenebricide, + isSurprise, + isDestructeur, + isFureur, + isMeurtrier, + isUltraviolence, + }; - if (tDestructeur !== undefined) { vTDestructeur = tDestructeur.dice[0]; } + const computed = updateRoll(finalRoll, tDegats, rDegats, bDegats, tViolence, rViolence, bViolence, conditions); - const tFureur = results.results.fureurValue; - let vTFureur = 0; + const finalComputed = { + jet: tJet + tBonus, + }; - if (tFureur !== undefined) { vTFureur = tFureur.dice[0] + tFureur.dice[1]; } + Object.assign(finalComputed, computed); - const tUltraviolence = results.results.ultraviolenceValue; + finishRoll(finalRoll.rollId, finalComputed); - let vTUltraviolence = 0; + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; - if (tUltraviolence !== undefined) { vTUltraviolence = tUltraviolence.dice[0]; } + finishRoll(exploitRoll.rollId, exploitComputed); + } - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - meurtrierValue: vTMeurtrier, - destructeurValue: vTDestructeur, - fureurValue: vTFureur, - ultraviolenceValue: vTUltraviolence, - }, - ); - - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); + if (sEnergie !== false) { + if (armure === 'berserk') { + setAttrs({ + espoir: newEnergie, + }); + } else { + setAttrs({ + energiePJ: newEnergie, }); } - if (sEnergie !== false) { - if (armure === 'berserk') { - setAttrs({ - espoir: newEnergie, - }); - } else { - setAttrs({ - energiePJ: newEnergie, - }); - } - - if (newEnergie === 0) { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); - } + if (newEnergie === 0) { + const noEnergieRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`); + finishRoll(noEnergieRoll.rollId, {}); } - }); + } } else if (button === 'repeating_armeCaC:armecontact') { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`); + finishRoll(finalRoll.rollId, {}); } else { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${name}}} {{text=${sEnergieText}}}`); + finishRoll(finalRoll.rollId, {}); } }); }); @@ -13441,6 +13962,9 @@ rollCombatGrenade.forEach((button) => { 'discretion', `${ODValue.discretion}`, 'tir', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listArmure, listArmureLegende, listStyle, listBase); @@ -13480,6 +14004,14 @@ rollCombatGrenade.forEach((button) => { let attaquesSurprisesCondition = ''; let isTenebricide = false; + let isDestructeur = false; + let isMeurtrier = false; + let isUltraviolence = false; + let isSurprise = false; + + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; const autresEffets = []; @@ -13576,6 +14108,9 @@ rollCombatGrenade.forEach((button) => { exec.push(`{{ultraviolence=${i18n_ultraviolence}}} {{ultraviolenceCondition=${i18n_ultraviolenceCondition}}} {{meurtrier=${i18n_meurtrier}}} {{meurtrierCondition=${i18n_meurtrierCondition}}}`); autresEffets.push(`${i18n_dispersion} 6`); + + isMeurtrier = true; + isUltraviolence = true; break; case 'grenade2': isConditionnelA = true; @@ -13594,6 +14129,8 @@ rollCombatGrenade.forEach((button) => { autresEffets.push(`${i18n_perceArmure} 20`); autresEffets.push(`${i18n_penetrant} 6`); autresEffets.push(`${i18n_dispersion} 6`); + + isDestructeur = true; break; case 'grenade4': isConditionnelA = true; @@ -13723,38 +14260,33 @@ rollCombatGrenade.forEach((button) => { exec.push(`{{Exploit=[[${cRoll.join('+')}]]}}`); exec.push(`{{bonus=[[${bonus.join('+')}]]}}`); - if (isTenebricide && hasDgts) { - let degatsTenebricide = []; - let ASTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - const diceDegatsTenebricide = Math.floor(diceDegats / 2); - const diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); - - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } - } - if (attaquesSurprises.length > 0 && hasDgts) { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + + isSurprise = true; + } + + if (isTenebricide && hasDgts) { + exec.push(`{{tenebricide=${i18n_tenebricide}}} {{tenebricideConditionD=${i18n_tenebricideConditionD}}} {{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); + + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); + } + } + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); } if (autresEffets.length > 0) { @@ -13770,51 +14302,48 @@ rollCombatGrenade.forEach((button) => { exec = firstExec.concat(exec); - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + const finalRoll = await startRoll(exec.join(' ')); + const tJet = finalRoll.results.jet.result; + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const finalComputed = { + jet: tJet + tBonus, + }; - const tMeurtrier = results.results.meurtrierValue; - let vTMeurtrier = 0; + if (hasDgts) { + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tMeurtrier !== undefined) { vTMeurtrier = tMeurtrier.dice[0]; } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - const tDestructeur = results.results.destructeurValue; - let vTDestructeur = 0; + const conditions = { + bourreau, + devaste, + equilibre, + isTenebricide, + isSurprise, + isDestructeur, + isMeurtrier, + isUltraviolence, + }; - if (tDestructeur !== undefined) { vTDestructeur = tDestructeur.dice[0]; } + const computed = updateRoll(finalRoll, tDegats, rDegats, bDegats, tViolence, rViolence, bViolence, conditions); + Object.assign(finalComputed, computed); + } - const tUltraviolence = results.results.ultraviolenceValue; + finishRoll(finalRoll.rollId, finalComputed); - let vTUltraviolence = 0; + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; - if (tUltraviolence !== undefined) { vTUltraviolence = tUltraviolence.dice[0]; } - - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - meurtrierValue: vTMeurtrier, - destructeurValue: vTDestructeur, - ultraviolenceValue: vTUltraviolence, - }, - ); - - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + finishRoll(exploitRoll.rollId, exploitComputed); + } }); }); /* eslint-disable no-loop-func */ @@ -13948,6 +14477,9 @@ for (let i = 0; i < rollCombatImprovise; i += 1) { `${ODValue.tir}`, 'combat', `${ODValue.combat}`, + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listBase); @@ -13993,10 +14525,17 @@ for (let i = 0; i < rollCombatImprovise; i += 1) { const oTir = +attrs[ODValue.tir]; const oCombat = +attrs[ODValue.combat]; + let isSurprise = false; + let isTenebricide = false; + let attaquesSurprises = []; let attaquesSurprisesValue = []; let attaquesSurprisesCondition = ''; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const autresEffets = []; if (hasArmure) { exec.push('{{OD=true}}'); } @@ -14172,6 +14711,8 @@ for (let i = 0; i < rollCombatImprovise; i += 1) { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + + isSurprise = true; } if (armure === 'berserk') { @@ -14181,37 +14722,31 @@ for (let i = 0; i < rollCombatImprovise; i += 1) { exec.push(`{{antiAnatheme=${i18n_antiAnatheme}}}`); exec.push(`{{antiAnathemeCondition=${i18n_antiAnathemeCondition}}}`); - let degatsTenebricide = []; - let ASTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - const diceDegatsTenebricide = Math.floor(diceDegats / 2); - const diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); exec.push(`{{tenebricide=${i18n_tenebricide}}}`); exec.push(`{{tenebricideConditionD=${i18n_tenebricideConditionD}}}`); exec.push(`{{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); + isTenebricide = true; - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); } } + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (autresEffets.length > 0) { autresEffets.sort(); exec.push(`{{effets=${autresEffets.join(' / ')}}}`); @@ -14223,32 +14758,48 @@ for (let i = 0; i < rollCombatImprovise; i += 1) { if (isConditionnelV) { exec.push('{{violenceConditionnel=true}}'); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + // ROLL + const finalRoll = await startRoll(exec.join(' ')); - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tJet = finalRoll.results.jet.result; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - }, - ); + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + isSurprise, + isTenebricide, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, bDegats, tViolence, rViolence, bViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); } /* eslint-disable prefer-destructuring */ @@ -14363,6 +14914,9 @@ on('clicked:druidLionArmeBase', async (info) => { 'coupBVDiversTotal', 'bVDiversD6', 'bVDiversFixe', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(arme, special); @@ -14406,6 +14960,10 @@ on('clicked:druidLionArmeBase', async (info) => { const bete = totalADruid(attrs, 'druidLionBete'); const AEBete = +attrs.druidLionBeteAE; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const cRoll = []; const AE = []; let bonus = []; @@ -14417,10 +14975,10 @@ on('clicked:druidLionArmeBase', async (info) => { cRoll.push(aspectValue); diceDegats = +attrs.druidLionBaseDegats; - bonusDegats.push(attrs.druidLionBaseDegatsBonus); + bonusDegats.push(+attrs.druidLionBaseDegatsBonus); diceViolence = +attrs.druidLionBaseViolence; - bonusViolence.push(attrs.druidLionBaseViolenceBonus); + bonusViolence.push(+attrs.druidLionBaseViolenceBonus); // GESTION DES BONUS DIVERS const bChairD = Math.ceil(vChair / 2); @@ -14431,9 +14989,9 @@ on('clicked:druidLionArmeBase', async (info) => { // GESTION DES ASPECTS EXCEPTIONNELS if (AEBete > 0) { - let bonusBete = AEBete; + let bonusBete = +AEBete; - if (AEBete > 5) { bonusBete += bete; } + if (AEBete > 5) { bonusBete += +bete; } exec.push(`{{vBeteD=+${bonusBete}}}`); bonusDegats.push(bonusBete); @@ -14443,11 +15001,11 @@ on('clicked:druidLionArmeBase', async (info) => { // GESTION DES BONUS SPECIAUX const sBonusDegats = attrs.coupBDDiversTotal; const sBonusDegatsD6 = attrs.bDDiversD6; - const sBonusDegatsFixe = attrs.bDDiversFixe; + const sBonusDegatsFixe = +attrs.bDDiversFixe; const sBonusViolence = attrs.coupBVDiversTotal; const sBonusViolenceD6 = attrs.bVDiversD6; - const sBonusViolenceFixe = attrs.bVDiversFixe; + const sBonusViolenceFixe = +attrs.bVDiversFixe; if (sBonusDegats !== '0') { exec.push(`{{vMSpecialD=+${sBonusDegatsD6}D6+${sBonusDegatsFixe}}}`); @@ -14487,42 +15045,61 @@ on('clicked:druidLionArmeBase', async (info) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (isConditionnelA === true) { exec.push('{{succesConditionnel=true}}'); } if (isConditionnelD === true) { exec.push('{{degatsConditionnel=true}}'); } if (isConditionnelV === true) { exec.push('{{violenceConditionnel=true}}'); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const finalRoll = await startRoll(exec.join(' ')); - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tJet = finalRoll.results.jet.result; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - degats: tDegats, - violence: tViolence, - }, - ); + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { @@ -14643,6 +15220,9 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { 'repeating_armeDruidLion_bVDiversFixe', 'repeating_armeDruidLion_energie', 'repeating_armeDruidLion_energieValue', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(wpn, effets, ameliorations, special); @@ -14706,6 +15286,17 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { const vMasque = totalADruid(attrs, 'druidLionMasque'); const vAEMasque = +attrs.druidLionMasqueAE; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + + let isDestructeur = false; + let isFureur = false; + let isMeurtrier = false; + let isUltraviolence = false; + let isSurprise = false; + let isTenebricide = false; + const cRoll = []; const AE = []; let bonus = []; @@ -14719,10 +15310,10 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { cRoll.push(aspectValue); diceDegats = Number(attrs.repeating_armeDruidLion_degatDruidLion); - bonusDegats.push(attrs.repeating_armeDruidLion_degatBonusDruidLion); + bonusDegats.push(+attrs.repeating_armeDruidLion_degatBonusDruidLion); diceViolence = Number(attrs.repeating_armeDruidLion_violenceDruidLion); - bonusViolence.push(attrs.repeating_armeDruidLion_violenceBonusDruidLion); + bonusViolence.push(+attrs.repeating_armeDruidLion_violenceBonusDruidLion); // GESTION DES BONUS DIVERS let bChairD = Math.ceil(vChair / 2); @@ -14735,7 +15326,7 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { // GESTION DES ASPECTS EXCEPTIONNELS if (vAEBete > 0) { - let bonusBete = vAEBete; + let bonusBete = +vAEBete; if (vAEBete > 5) { bonusBete += vBete; } @@ -14827,6 +15418,7 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { } if (eAssassin !== '0') { + isConditionnelD = true; eASAssassin = i18n_assassin; eASAssassinValue = eAssassinV; @@ -14854,6 +15446,8 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{destructeur=${i18n_destructeur}}}`); exec.push(`{{destructeurValue=[[${eDestructeurV}D6]]}}`); exec.push(`{{destructeurCondition=${i18n_destructeurCondition}}}`); + + isDestructeur = true; } if (eEnChaine !== '0') { @@ -14875,6 +15469,8 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{fureur=${i18n_fureur}}}`); exec.push(`{{fureurValue=[[${eFureurV}D6]]}}`); exec.push(`{{fureurCondition=${i18n_fureurCondition}}}`); + + isFureur = true; } if (eLeste !== '0') { @@ -14889,6 +15485,8 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{meurtrier=${i18n_meurtrier}}}`); exec.push(`{{meurtrierValue=[[${eMeurtrierV}D6]]}}`); exec.push(`{{meurtrierCondition=${i18n_meurtrierCondition}}}`); + + isMeurtrier = true; } if (eObliteration !== '0') { @@ -14923,6 +15521,7 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { attaquesSurprises.push(i18n_silencieux); attaquesSurprisesValue.push(totalSilencieux); + isConditionnelD = true; if (attaquesSurprisesCondition === '') { attaquesSurprisesCondition = `{{attaqueSurpriseCondition=${i18n_attaqueSurpriseCondition}}}`; } } @@ -14937,17 +15536,23 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{tenebricide=${i18n_tenebricide}}}`); exec.push(`{{tenebricideConditionD=${i18n_tenebricideConditionD}}}`); exec.push(`{{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); + isConditionnelD = true; + isConditionnelV = true; } if (eTirRafale !== '0') { exec.push(`{{tirRafale=${i18n_tirRafale}}}`); exec.push(`{{tirRafaleCondition=${i18n_tirRafaleCondition}}}`); + isConditionnelD = true; } if (eUltraviolence !== '0') { exec.push(`{{ultraviolence=${i18n_ultraviolence}}}`); exec.push(`{{ultraviolenceValue=[[${eUltraviolenceV}D6]]}}`); exec.push(`{{ultraviolenceCondition=${i18n_ultraviolenceCondition}}}`); + + isConditionnelV = true; + isUltraviolence = true; } if (eAntiVehicule !== '0') { autresEffets.push(i18n_antiVehicule); } @@ -15117,11 +15722,11 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { // GESTION DES BONUS SPECIAUX const sBonusDegats = attrs.repeating_armeDruidLion_bDDiversTotal; const sBonusDegatsD6 = attrs.repeating_armeDruidLion_bDDiversD6; - const sBonusDegatsFixe = attrs.repeating_armeDruidLion_bDDiversFixe; + const sBonusDegatsFixe = +attrs.repeating_armeDruidLion_bDDiversFixe; const sBonusViolence = attrs.repeating_armeDruidLion_bVDiversTotal; const sBonusViolenceD6 = attrs.repeating_armeDruidLion_bVDiversD6; - const sBonusViolenceFixe = attrs.repeating_armeDruidLion_bVDiversFixe; + const sBonusViolenceFixe = +attrs.repeating_armeDruidLion_bVDiversFixe; const sEnergie = attrs.repeating_armeDruidLion_energie; const sEnergieValue = attrs.repeating_armeDruidLion_energieValue; @@ -15190,47 +15795,6 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); - if (eTenebricide !== '0') { - let degatsTenebricide = []; - let ASTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - diceDegatsTenebricide = Math.floor(diceDegats / 2); - diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bonusDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bonusViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); - - if (eASAssassinValue > 0) { - eAssassinTenebricideValue = Math.ceil(eASAssassinValue / 2); - - ASTenebricide.unshift(eASAssassin); - ASValueTenebricide.unshift(`${eAssassinTenebricideValue}D6`); - - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - } - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } else if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } - } - if (eObliteration !== '0') { let ASObliteration = []; let ASValueObliteration = []; @@ -15285,6 +15849,35 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + + isSurprise = true; + } + + if (eTenebricide !== '0') { + isTenebricide = true; + + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); + + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); + } + + if (isMeurtrier) { firstExec.push('{{tMeurtrierValue=[[0]]}}'); } + if (isDestructeur) { firstExec.push('{{tDestructeurValue=[[0]]}}'); } + if (isFureur) { firstExec.push('{{tFureurValue=[[0]]}}'); } + if (isUltraviolence) { firstExec.push('{{tUltraviolenceValue=[[0]]}}'); } + } + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); } if (autresEffets.length > 0) { exec.push(`{{effets=${autresEffets.join(' / ')}}}`); } @@ -15299,84 +15892,68 @@ on('clicked:repeating_armeDruidLion:combatdruidroll', async (info) => { if (isConditionnelV === true) { exec.push('{{violenceConditionnel=true}}'); } + log(exec); + if (pasDEnergie === false) { - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tJetDice = results.results.jet.dice.length; + const finalRoll = await startRoll(exec.join(' ')); - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tJet = finalRoll.results.jet.result; + const tJetDice = finalRoll.results.jet.dice.length; - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - const tMeurtrier = results.results.meurtrierValue; - let vTMeurtrier = 0; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tMeurtrier !== undefined) { vTMeurtrier = tMeurtrier.dice[0]; } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - const tDestructeur = results.results.destructeurValue; - let vTDestructeur = 0; + const conditions = { + bourreau, + devaste, + equilibre, + isTenebricide, + isSurprise, + isDestructeur, + isFureur, + isMeurtrier, + isUltraviolence, + }; - if (tDestructeur !== undefined) { vTDestructeur = tDestructeur.dice[0]; } + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); - const tFureur = results.results.fureurValue; - let vTFureur = 0; + const finalComputed = { + jet: tJet + tBonus, + }; - if (tFureur !== undefined) { vTFureur = tFureur.dice[0] + tFureur.dice[1]; } + Object.assign(finalComputed, computed); - const tUltraviolence = results.results.ultraviolenceValue; + finishRoll(finalRoll.rollId, finalComputed); - let vTUltraviolence = 0; + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${i18n_exploit}}} {{jet=[[ {[[{${tJetDice}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; - if (tUltraviolence !== undefined) { vTUltraviolence = tUltraviolence.dice[0]; } + finishRoll(exploitRoll.rollId, exploitComputed); + } - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - degats: tDegats, - violence: tViolence, - meurtrierValue: vTMeurtrier, - destructeurValue: vTDestructeur, - fureurValue: vTFureur, - ultraviolenceValue: vTUltraviolence, - }, - ); + if (sEnergie !== '0') { + setAttrs({ + [nEnergie]: newEnergie, + }); - if (tJet !== 0 && tJet === tExploit) { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${i18n_exploit}}} {{jet=[[ {[[{${tJetDice}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); + if (newEnergie === 0) { + const noEnergieRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`); + finishRoll(noEnergieRoll.rollId, {}); } - - if (sEnergie !== '0') { - setAttrs({ - [nEnergie]: newEnergie, - }); - - if (newEnergie === 0) { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); - } - } - }); + } } else { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`); + finishRoll(finalRoll.rollId, {}); } }); @@ -15488,6 +16065,9 @@ on('clicked:MALDruidLionArmeBase', async (info) => { 'MALCoupBVDiversTotal', 'MALBVDiversD6', 'MALBVDiversFixe', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(arme, special); @@ -15531,6 +16111,10 @@ on('clicked:MALDruidLionArmeBase', async (info) => { const bete = totalADruid(attrs, 'MALDruidLionBete'); const AEBete = +attrs.MALDruidLionBeteAE; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const cRoll = []; const AE = []; let bonus = []; @@ -15542,10 +16126,10 @@ on('clicked:MALDruidLionArmeBase', async (info) => { cRoll.push(aspectValue); diceDegats = Number(attrs.MALDruidLionBaseDegats); - bonusDegats.push(attrs.MALDruidLionBaseDegatsBonus); + bonusDegats.push(+attrs.MALDruidLionBaseDegatsBonus); diceViolence = Number(attrs.MALDruidLionBaseViolence); - bonusViolence.push(attrs.MALDruidLionBaseViolenceBonus); + bonusViolence.push(+attrs.MALDruidLionBaseViolenceBonus); // GESTION DES BONUS DIVERS const bChairD = Math.ceil(vChair / 2); @@ -15556,9 +16140,9 @@ on('clicked:MALDruidLionArmeBase', async (info) => { // GESTION DES ASPECTS EXCEPTIONNELS if (AEBete > 0) { - let bonusBete = AEBete; + let bonusBete = +AEBete; - if (AEBete > 5) { bonusBete += bete; } + if (AEBete > 5) { bonusBete += +bete; } exec.push(`{{vBeteD=+${bonusBete}}}`); bonusDegats.push(bonusBete); @@ -15568,11 +16152,11 @@ on('clicked:MALDruidLionArmeBase', async (info) => { // GESTION DES BONUS SPECIAUX const sBonusDegats = attrs.MALCoupBDDiversTotal; const sBonusDegatsD6 = attrs.MALBDDiversD6; - const sBonusDegatsFixe = attrs.MALBDDiversFixe; + const sBonusDegatsFixe = +attrs.MALBDDiversFixe; const sBonusViolence = attrs.MALCoupBVDiversTotal; const sBonusViolenceD6 = attrs.MALBVDiversD6; - const sBonusViolenceFixe = attrs.MALBVDiversFixe; + const sBonusViolenceFixe = +attrs.MALBVDiversFixe; if (sBonusDegats !== '0') { exec.push(`{{vMSpecialD=+${sBonusDegatsD6}D6+${sBonusDegatsFixe}}}`); @@ -15612,42 +16196,61 @@ on('clicked:MALDruidLionArmeBase', async (info) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (isConditionnelA === true) { exec.push('{{succesConditionnel=true}}'); } if (isConditionnelD === true) { exec.push('{{degatsConditionnel=true}}'); } if (isConditionnelV === true) { exec.push('{{violenceConditionnel=true}}'); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const finalRoll = await startRoll(exec.join(' ')); - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tJet = finalRoll.results.jet.result; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - degats: tDegats, - violence: tViolence, - }, - ); + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`$${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { @@ -15768,6 +16371,9 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { 'repeating_armeMALDruidLion_bVDiversFixe', 'repeating_armeMALDruidLion_energie', 'repeating_armeMALDruidLion_energieValue', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(wpn, effets, ameliorations, special); @@ -15831,10 +16437,21 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { const vMasque = totalADruid(attrs, 'MALDruidLionMasque'); const vAEMasque = +attrs.MALDruidLionMasqueAE; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const cRoll = []; const AE = []; let bonus = []; + let isDestructeur = false; + let isFureur = false; + let isMeurtrier = false; + let isUltraviolence = false; + let isTenebricide = false; + let isSurprise = false; + AE.push(AEValue); exec.push(`{{special1B=${arme}}}`); @@ -15844,10 +16461,10 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { cRoll.push(aspectValue); diceDegats = +attrs.repeating_armeMALDruidLion_degatDruidLion; - bonusDegats.push(attrs.repeating_armeMALDruidLion_degatBonusDruidLion); + bonusDegats.push(+attrs.repeating_armeMALDruidLion_degatBonusDruidLion); diceViolence = +attrs.repeating_armeMALDruidLion_violenceDruidLion; - bonusViolence.push(attrs.repeating_armeMALDruidLion_violenceBonusDruidLion); + bonusViolence.push(+attrs.repeating_armeMALDruidLion_violenceBonusDruidLion); // GESTION DES BONUS DIVERS let bChairD = Math.ceil(vChair / 2); @@ -15860,9 +16477,9 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { // GESTION DES ASPECTS EXCEPTIONNELS if (vAEBete > 0) { - let bonusBete = vAEBete; + let bonusBete = +vAEBete; - if (vAEBete > 5) { bonusBete += vBete; } + if (vAEBete > 5) { bonusBete += +vBete; } exec.push(`{{vBeteD=+${bonusBete}}}`); bonusDegats.push(bonusBete); @@ -15976,6 +16593,7 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { if (eDestructeur !== '0') { isConditionnelD = true; + isDestructeur = true; exec.push(`{{destructeur=${i18n_destructeur}}}`); exec.push(`{{destructeurValue=[[${eDestructeurV}D6]]}}`); exec.push(`{{destructeurCondition=${i18n_destructeurCondition}}}`); @@ -15997,6 +16615,7 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { if (eFureur !== '0') { isConditionnelV = true; + isFureur = true; exec.push(`{{fureur=${i18n_fureur}}}`); exec.push(`{{fureurValue=[[${eFureurV}D6]]}}`); exec.push(`{{fureurCondition=${i18n_fureurCondition}}}`); @@ -16011,6 +16630,7 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { if (eMeurtrier !== '0') { isConditionnelD = true; + isMeurtrier = true; exec.push(`{{meurtrier=${i18n_meurtrier}}}`); exec.push(`{{meurtrierValue=[[${eMeurtrierV}D6]]}}`); exec.push(`{{meurtrierCondition=${i18n_meurtrierCondition}}}`); @@ -16062,17 +16682,26 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { exec.push(`{{tenebricide=${i18n_tenebricide}}}`); exec.push(`{{tenebricideConditionD=${i18n_tenebricideConditionD}}}`); exec.push(`{{tenebricideConditionV=${i18n_tenebricideConditionV}}}`); + + isTenebricide = true; + isConditionnelD = true; + isConditionnelV = true; } if (eTirRafale !== '0') { exec.push(`{{tirRafale=${i18n_tirRafale}}}`); exec.push(`{{tirRafaleCondition=${i18n_tirRafaleCondition}}}`); + + isConditionnelD = true; } if (eUltraviolence !== '0') { exec.push(`{{ultraviolence=${i18n_ultraviolence}}}`); exec.push(`{{ultraviolenceValue=[[${eUltraviolenceV}D6]]}}`); exec.push(`{{ultraviolenceCondition=${i18n_ultraviolenceCondition}}}`); + + isConditionnelV = true; + isUltraviolence = true; } if (eAntiVehicule !== '0') { autresEffets.push(i18n_antiVehicule); } @@ -16242,11 +16871,11 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { // GESTION DES BONUS SPECIAUX const sBonusDegats = attrs.repeating_armeMALDruidLion_bDDiversTotal; const sBonusDegatsD6 = attrs.repeating_armeMALDruidLion_bDDiversD6; - const sBonusDegatsFixe = attrs.repeating_armeMALDruidLion_bDDiversFixe; + const sBonusDegatsFixe = +attrs.repeating_armeMALDruidLion_bDDiversFixe; const sBonusViolence = attrs.repeating_armeMALDruidLion_bVDiversTotal; const sBonusViolenceD6 = attrs.repeating_armeMALDruidLion_bVDiversD6; - const sBonusViolenceFixe = attrs.repeating_armeMALDruidLion_bVDiversFixe; + const sBonusViolenceFixe = +attrs.repeating_armeMALDruidLion_bVDiversFixe; const sEnergie = attrs.repeating_armeMALDruidLion_energie; const sEnergieValue = attrs.repeating_armeMALDruidLion_energieValue; @@ -16315,47 +16944,6 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); - if (eTenebricide !== '0') { - let degatsTenebricide = []; - let ASTenebricide = []; - let ASValueTenebricide = []; - - let violenceTenebricide = []; - - diceDegatsTenebricide = Math.floor(diceDegats / 2); - diceViolenceTenebricide = Math.floor(diceViolence / 2); - - degatsTenebricide.push(`${diceDegatsTenebricide}D6`); - degatsTenebricide = degatsTenebricide.concat(bonusDegats); - - violenceTenebricide.push(`${diceViolenceTenebricide}D6`); - violenceTenebricide = violenceTenebricide.concat(bonusViolence); - - exec.push(`{{tenebricideValueD=[[${degatsTenebricide.join('+')}]]}}`); - exec.push(`{{tenebricideValueV=[[${violenceTenebricide.join('+')}]]}}`); - - if (eASAssassinValue > 0) { - eAssassinTenebricideValue = Math.ceil(eASAssassinValue / 2); - - ASTenebricide.unshift(eASAssassin); - ASValueTenebricide.unshift(`${eAssassinTenebricideValue}D6`); - - if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - } - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } else if (attaquesSurprises.length > 0) { - ASTenebricide = ASTenebricide.concat(attaquesSurprises); - ASValueTenebricide = ASValueTenebricide.concat(attaquesSurprisesValue); - - exec.push(`{{tenebricideAS=${ASTenebricide.join('\n+')}}}`); - exec.push(`{{tenebricideASValue=[[${ASValueTenebricide.join('+')}]]}}`); - } - } - if (eObliteration !== '0') { let ASObliteration = []; let ASValueObliteration = []; @@ -16410,6 +16998,19 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + isSurprise = true; + isConditionnelD = true; + } + + if (eTenebricide !== '0') { + isTenebricide = true; + exec.push('{{tenebricideValueD=[[0]]}}'); + exec.push('{{tenebricideValueV=[[0]]}}'); + + if (attaquesSurprises.length > 0) { + exec.push(`{{tenebricideAS=${attaquesSurprises.join('\n+')}}}`); + exec.push('{{tenebricideASValue=[[0]]}}'); + } } if (autresEffets.length > 0) { exec.push(`{{effets=${autresEffets.join(' / ')}}}`); } @@ -16425,83 +17026,65 @@ on('clicked:repeating_armeMALDruidLion:combatdruidroll', async (info) => { if (isConditionnelV === true) { exec.push('{{violenceConditionnel=true}}'); } if (pasDEnergie === false) { - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tJetDice = results.results.jet.dice.length; + const finalRoll = await startRoll(exec.join(' ')); - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tJet = finalRoll.results.jet.result; + const tJetDice = finalRoll.results.jet.dice.length; - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - const tMeurtrier = results.results.meurtrierValue; - let vTMeurtrier = 0; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tMeurtrier !== undefined) { vTMeurtrier = tMeurtrier.dice[0]; } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - const tDestructeur = results.results.destructeurValue; - let vTDestructeur = 0; + const conditions = { + bourreau, + devaste, + equilibre, + isTenebricide, + isSurprise, + isDestructeur, + isFureur, + isMeurtrier, + isUltraviolence, + }; - if (tDestructeur !== undefined) { vTDestructeur = tDestructeur.dice[0]; } + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); - const tFureur = results.results.fureurValue; - let vTFureur = 0; + const finalComputed = { + jet: tJet + tBonus, + }; - if (tFureur !== undefined) { vTFureur = tFureur.dice[0] + tFureur.dice[1]; } + Object.assign(finalComputed, computed); - const tUltraviolence = results.results.ultraviolenceValue; + finishRoll(finalRoll.rollId, finalComputed); - let vTUltraviolence = 0; + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${i18n_exploit}}} {{jet=[[ {[[{${tJetDice}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; - if (tUltraviolence !== undefined) { vTUltraviolence = tUltraviolence.dice[0]; } + finishRoll(exploitRoll.rollId, exploitComputed); + } - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - degats: tDegats, - violence: tViolence, - meurtrierValue: vTMeurtrier, - destructeurValue: vTDestructeur, - fureurValue: vTFureur, - ultraviolenceValue: vTUltraviolence, - }, - ); + if (sEnergie !== '0') { + setAttrs({ + [nEnergie]: newEnergie, + }); - if (tJet !== 0 && tJet === tExploit) { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${i18n_exploit}}} {{jet=[[ {[[{${tJetDice}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); + if (newEnergie === 0) { + const noEnergieRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`); + finishRoll(noEnergieRoll.rollId, {}); } - - if (sEnergie !== '0') { - setAttrs({ - [nEnergie]: newEnergie, - }); - - if (newEnergie === 0) { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); - } - } - }); + } } else { - startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`, (text) => { - finishRoll( - text.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=^{druid-companion-lion}}} {{special1=@{name}}} {{special1B=${arme}}} {{text=${sEnergieText}}}`); + finishRoll(finalRoll.rollId, {}); } }); @@ -16568,7 +17151,11 @@ druidRollFighter.forEach((button) => { on(`clicked:${button}`, async (info) => { const roll = info.htmlAttributes.value; - const attributs = []; + const attributs = [ + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', + ]; let nbreW = ''; if (button === 'DWolfFighterRoll') { nbreW = 'druidNombreCompagnon'; } else if (button === 'MALDWolfFighterN1Roll') { nbreW = 'MALDruidNombreCompagnon'; } @@ -16582,6 +17169,10 @@ druidRollFighter.forEach((button) => { const exec = []; exec.push(roll); + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const degats = []; const violence = []; @@ -16591,18 +17182,35 @@ druidRollFighter.forEach((button) => { exec.push(`{{degats=[[${degats.join('+')}]]}}`); exec.push(`{{violence=[[${violence.join('+')}]]}}`); - startRoll(exec.join(' '), (results) => { - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - degats: tDegats, - violence: tViolence, - }, - ); - }); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + // ROLL + + const finalRoll = await startRoll(exec.join(' ')); + + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [], tViolence, rViolence, [], conditions); + + finishRoll(finalRoll.rollId, computed); }); }); @@ -16954,6 +17562,9 @@ for (let i = 0; i < rollMAImprovise; i += 1) { `${ODValue.tir}`, 'combat', `${ODValue.combat}`, + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; const arme = []; @@ -17011,6 +17622,12 @@ for (let i = 0; i < rollMAImprovise; i += 1) { const attaquesSurprisesValue = []; const attaquesSurprisesCondition = ''; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + + let isSurprise = false; + const autresEffets = []; exec.push('{{OD=true}}'); @@ -17111,6 +17728,18 @@ for (let i = 0; i < rollMAImprovise; i += 1) { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + + isSurprise = true; + } + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); } if (autresEffets.length > 0) { @@ -17120,32 +17749,45 @@ for (let i = 0; i < rollMAImprovise; i += 1) { if (isConditionnelD) { exec.push('{{degatsConditionnel=true}}'); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + const finalRoll = await startRoll(exec.join(' ')); - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + const tJet = finalRoll.results.jet.result; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - }, - ); + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; + const rDegats = finalRoll.results.degats.dice; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const rViolence = finalRoll.results.violence.dice; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + isSurprise, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, bDegats, tViolence, rViolence, bViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); } @@ -17294,6 +17936,9 @@ rollCombatArchangel.forEach((button) => { 'canonMetatronCaracteristique4', roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); @@ -17404,32 +18049,58 @@ rollCombatArchangel.forEach((button) => { break; } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - }, - ); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const finalRoll = await startRoll(exec.join(' ')); + + const tJet = finalRoll.results.jet.result; + + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; + + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [bDegats], tViolence, rViolence, [bViolence], conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); }); @@ -17448,6 +18119,14 @@ rollNephilim.forEach((button) => { let tours; let degats; let violence; + + let devaste = false; + let bourreau = false; + let equilibre = false; + + let isMeurtrier = false; + let isFureur = false; + const effets = []; exec.push(base); @@ -17470,6 +18149,16 @@ rollNephilim.forEach((button) => { break; case 'MANOGStationMissile': + attrs = await getAttrsAsync([ + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', + ]); + + devaste = +attrs.devasterAnatheme; + bourreau = +attrs.bourreauTenebres; + equilibre = +attrs.equilibreBalance; + degats = roll[1]; violence = roll[2]; @@ -17481,9 +18170,19 @@ rollNephilim.forEach((button) => { break; case 'MANOGStationRoquette': + attrs = await getAttrsAsync([ + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', + ]); + degats = roll[1]; violence = roll[2]; + devaste = +attrs.devasterAnatheme; + bourreau = +attrs.bourreauTenebres; + equilibre = +attrs.equilibreBalance; + exec.push(`{{degats=[[${degats}]]}} {{violence=[[${violence}]]}}`); break; @@ -17491,6 +18190,9 @@ rollNephilim.forEach((button) => { attrs = await getAttrsAsync([ roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]); degats = attrs[roll[1]]; @@ -17501,15 +18203,46 @@ rollNephilim.forEach((button) => { effets.push(i18n_briserResilience); effets.sort(); + isMeurtrier = true; + isFureur = true; + exec.push(`{{degats=[[${degats}]]}} {{degatsConditionnel=true}} {{meurtrier=${i18n_meurtrier}}} {{meurtrierValue=[[2D6]]}} {{meurtrierCondition=${i18n_meurtrierCondition}}} {{violence=[[${violence}]]}} {{violenceConditionnel=true}} {{fureur=${i18n_fureur}}} {{fureurValue=[[2D6]]}} {{fureurCondition=${i18n_fureurCondition}}} {{antiAnatheme=${i18n_antiAnatheme}}} {{antiAnathemeCondition=${i18n_antiAnathemeCondition}}} {{effets=${effets.join(' / ')}}}`); break; } - startRoll(exec.join(' '), (results) => { - finishRoll( - results.rollId, {}, - ); - }); + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + const finalRoll = await startRoll(exec.join(' ')); + + let computed = {}; + + if (button === 'MANOGStationMissile' || button === 'MANOGStationRoquette' || button === 'MANMJ') { + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + isFureur, + isMeurtrier, + }; + + computed = updateRoll(finalRoll, tDegats, rDegats, [], tViolence, rViolence, [], conditions); + } + + finishRoll(finalRoll.rollId, computed); }); }); @@ -17545,6 +18278,8 @@ rollCombatNephilim.forEach((button) => { let bDegats; let violence; let bViolence; + let isFureur = false; + let isUltraviolence = false; let getStyle; @@ -17564,6 +18299,9 @@ rollCombatNephilim.forEach((button) => { 'canonMagmaCaracteristique2', 'canonMagmaCaracteristique3', 'canonMagmaCaracteristique4', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); @@ -17573,6 +18311,8 @@ rollCombatNephilim.forEach((button) => { bCarac = attrs.bonusCarac; mod = +attrs.jetModifDes; + isFureur = true; + C1 = attrs.canonMagmaCaracteristique1; C2 = attrs.canonMagmaCaracteristique2; C3 = attrs.canonMagmaCaracteristique3; @@ -17675,12 +18415,17 @@ rollCombatNephilim.forEach((button) => { 'MSurturCaracteristique2', 'MSurturCaracteristique3', 'MSurturCaracteristique4', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); attrs = await getAttrsAsync(listAttrs); + isUltraviolence = true; + bCarac = attrs.bonusCarac; mod = +attrs.jetModifDes; @@ -17780,32 +18525,60 @@ rollCombatNephilim.forEach((button) => { break; } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - }, - ); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const finalRoll = await startRoll(exec.join(' ')); + + const tJet = finalRoll.results.jet.result; + + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; + + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + isFureur, + isUltraviolence, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [bDegats], tViolence, rViolence, [bViolence], conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); }); @@ -17822,6 +18595,8 @@ rollDemon.forEach((button) => { let degats; let violence; + let bDegats = 0; + let bViolence = 0; exec.push(base); @@ -17831,11 +18606,17 @@ rollDemon.forEach((button) => { attrs = await getAttrsAsync([ roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]); degats = attrs[roll[1]]; violence = attrs[roll[2]]; + bDegats = +degats.split('+')[1]; + bViolence = +violence.split('+')[1]; + exec.push(`{{degats=[[${degats}]]}} {{violence=[[${violence}]]}} {{effets=^{CDF-desactive-pendant} [[1D3]] ^{tours}}}`); break; @@ -17843,6 +18624,9 @@ rollDemon.forEach((button) => { attrs = await getAttrsAsync([ roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]); degats = attrs[roll[1]]; @@ -17852,11 +18636,37 @@ rollDemon.forEach((button) => { break; } - startRoll(exec.join(' '), (results) => { - finishRoll( - results.rollId, {}, - ); - }); + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + const finalRoll = await startRoll(exec.join(' ')); + + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [bDegats], tViolence, rViolence, [bViolence], conditions); + + finishRoll(finalRoll.rollId, computed); }); }); @@ -17914,6 +18724,9 @@ rollCombatDemon.forEach((button) => { 'DSouffleCaracteristique4', roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); @@ -18023,6 +18836,9 @@ rollCombatDemon.forEach((button) => { 'caracteristiqueWraith4', roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attrs = await getAttrsAsync(listAttrs); @@ -18108,6 +18924,9 @@ rollCombatDemon.forEach((button) => { 'APoingsCaracteristique4', roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); @@ -18216,6 +19035,9 @@ rollCombatDemon.forEach((button) => { 'LCGCaracteristique4', roll[1], roll[2], + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; listAttrs = listAttrs.concat(listStyle); @@ -18321,32 +19143,62 @@ rollCombatDemon.forEach((button) => { break; } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + if (button !== 'MADjinnWraith') { + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - }, - ); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; - - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); + exec.push(`{{herauts=${herauts.join(' / ')}}}`); } - }); + } + + const finalRoll = await startRoll(exec.join(' ')); + + const tJet = finalRoll.results.jet.result; + + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; + + const finalComputed = { + jet: tJet + tBonus, + }; + + if (button !== 'MADjinnWraith') { + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [bDegats], tViolence, rViolence, [bViolence], conditions); + + Object.assign(finalComputed, computed); + } + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:mechaArmure} {{special1=@{mechaArmureNom}}} {{special1B=${i18n_exploit}}}${jet}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); }); /* eslint-disable default-case */ @@ -18519,6 +19371,9 @@ monkCeaRoll.forEach((button) => { ODValue.tir, ODValue.discretion, 'discretion', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; const attDegats = []; @@ -18597,6 +19452,15 @@ monkCeaRoll.forEach((button) => { let degats = []; let violence = []; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + + let isSurprise = false; + let isDestructeur = false; + let isMeurtrier = false; + let isUltraviolence = false; + const autresEffets = []; exec.push(roll); @@ -18681,6 +19545,7 @@ monkCeaRoll.forEach((button) => { isConditionnelA = true; isConditionnelD = true; + isDestructeur = true; if (PG250 === 1) { exec.push(`{{parasitage=${i18n_parasitage} 4}}`); } else { exec.push(`{{parasitage=${i18n_parasitage} 2}}`); } @@ -18705,6 +19570,8 @@ monkCeaRoll.forEach((button) => { isConditionnelA = true; isConditionnelD = true; isConditionnelV = true; + isMeurtrier = true; + isUltraviolence = true; exec.push(`{{parasitage=${i18n_parasitage} 1}}`); exec.push(`{{parasitageCondition=${i18n_parasitageCondition}}}`); @@ -18881,6 +19748,17 @@ monkCeaRoll.forEach((button) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + isSurprise = true; + } + + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); } if (isConditionnelA === true) { exec.push('{{succesConditionnel=true}}'); } @@ -18891,38 +19769,49 @@ monkCeaRoll.forEach((button) => { if (autresEffets.length > 0) { exec.push(`{{effets=${autresEffets.join(' / ')}}}`); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tBonus = results.results.tBonus.result; - const tExploit = results.results.Exploit.result; + // ROLL + const finalRoll = await startRoll(exec.join(' ')); - const total = tJet + tBonus; + const tJet = finalRoll.results.jet.result; - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tBonus = finalRoll.results.tBonus.result; + const tExploit = finalRoll.results.Exploit.result; - finishRoll( - results.rollId, - { - jet: total, - degats: tDegats, - violence: tViolence, - }, - ); + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const conditions = { + bourreau, + devaste, + equilibre, + isDestructeur, + isMeurtrier, + isUltraviolence, + isSurprise, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); }); /* eslint-disable no-undef */ @@ -19037,6 +19926,9 @@ on('clicked:distanceRangerLongbow', async (info) => { 'bVDiversTotalRanger', 'bVDiversD6', 'bVDiversFixe', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(arme, evolutions, effets, ameliorations, special, listBase, listArmureLegende, listStyle); @@ -19067,6 +19959,10 @@ on('clicked:distanceRangerLongbow', async (info) => { let attaquesSurprisesValue = []; let attaquesSurprisesCondition = ''; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const portee = attrs.rangerArmePortee; const autresEffets = []; const autresAmeliorations = []; @@ -19075,6 +19971,10 @@ on('clicked:distanceRangerLongbow', async (info) => { const energie = attrs.energiePJ; let energieDepense = 0; + let isSurprise = false; + let isFureur = false; + let isUltraviolence = false; + if (PG50_2 === 'on') { diceDegats = Number(attrs.rangerArmeDegatEvol.split('D')[0]); diceViolence = Number(attrs.rangerArmeViolenceEvol.split('D')[0]); @@ -19118,9 +20018,9 @@ on('clicked:distanceRangerLongbow', async (info) => { let C3Nom = ''; let C4Nom = ''; - const vDiscretion = attrs.discretion; - const oDiscretion = attrs[ODValue.discretion]; - const oTir = attrs[ODValue.tir]; + const vDiscretion = +attrs.discretion; + const oDiscretion = +attrs[ODValue.discretion]; + const oTir = +attrs[ODValue.tir]; let E1 = 2; let E2 = 3; @@ -19259,6 +20159,8 @@ on('clicked:distanceRangerLongbow', async (info) => { } if (eUltraviolence !== '0') { + isUltraviolence = true; + exec.push(`{{ultraviolence=${i18n_ultraviolence}}}`); exec.push('{{ultraviolenceValue=[[2D6]]}}'); exec.push(`{{ultraviolenceCondition=${i18n_ultraviolenceCondition}}}`); @@ -19300,6 +20202,7 @@ on('clicked:distanceRangerLongbow', async (info) => { } if (eFureur !== '0') { + isFureur = true; isConditionnelV = true; exec.push(`{{fureur=${i18n_fureur}}}`); exec.push('{{fureurValue=[[4D6]]}}'); @@ -19675,65 +20578,82 @@ on('clicked:distanceRangerLongbow', async (info) => { exec.push(`{{attaqueSurprise=${attaquesSurprises.join('\n+')}}}`); exec.push(`{{attaqueSurpriseValue=[[${attaquesSurprisesValue.join('+')}]]}}`); exec.push(attaquesSurprisesCondition); + isSurprise = true; } if (rChambreDouble !== 0) { exec.push(`{{vChambreDouble=${rChambreDouble}}}`); } + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (isConditionnelA === true) { exec.push('{{succesConditionnel=true}}'); } if (isConditionnelD === true) { exec.push('{{degatsConditionnel=true}}'); } if (isConditionnelV === true) { exec.push('{{violenceConditionnel=true}}'); } + let finalRoll; if (!pasEnergie) { - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tBonus = results.results.bonus.result; - const tExploit = results.results.Exploit.result; + finalRoll = await startRoll(exec.join(' ')); - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tJet = finalRoll.results.jet.result; - finishRoll( - results.rollId, - { - jet: tJet + tBonus, - degats: tDegats, - violence: tViolence, - }, - ); + const tBonus = finalRoll.results.bonus.result; + const tExploit = finalRoll.results.Exploit.result; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - setAttrs({ - energiePJ: resultatEnergie, - }); + const conditions = { + bourreau, + devaste, + equilibre, + isFureur, + isUltraviolence, + isSurprise, + }; - if (resultatEnergie === 0) { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=^{ranger-fusil-longbow}}} {{text=${i18n_plusEnergie}}}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); - } + const computed = updateRoll(finalRoll, tDegats, rDegats, bonusDegats, tViolence, rViolence, bonusViolence, conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } + + setAttrs({ + energiePJ: resultatEnergie, }); + + if (resultatEnergie === 0) { + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=^{ranger-fusil-longbow}}} {{text=${i18n_plusEnergie}}}`); + finishRoll(finalRoll.rollId, {}); + } } else { - startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=^{ranger-fusil-longbow}}} {{text=${i18n_pasEnergie}}}`, (exploit) => { - finishRoll( - exploit.rollId, {}, - ); - }); + finalRoll = await startRoll(`@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=^{ranger-fusil-longbow}}} {{text=${i18n_pasEnergie}}}`); + finishRoll(finalRoll.rollId, {}); } }); /* eslint-disable no-undef */ @@ -21960,6 +22880,9 @@ on('clicked:distanceWizardBorealis', async (info) => { 'calODCom', 'discretion', ODValue.discretion, + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(listBase, listStyle, listArmureLegende); @@ -22002,6 +22925,10 @@ on('clicked:distanceWizardBorealis', async (info) => { let bonus = []; let OD = 0; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + let ODMALBarbarian = []; const ODMALWarrior = []; let ODMALShaman = []; @@ -22188,40 +23115,57 @@ on('clicked:distanceWizardBorealis', async (info) => { exec.push(`{{antiAnatheme=${i18n_antiAnatheme}}}`); exec.push(`{{antiAnathemeCondition=${i18n_antiAnathemeCondition}}}`); + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + if (isConditionnel === true) { exec.push('{{conditionnel=true}}'); } - startRoll(exec.join(' '), (results) => { - const tJet = results.results.jet.result; - const tBonus = results.results.tBonus.result; - const tExploit = results.results.Exploit.result; + // ROLL + const finalRoll = await startRoll(exec.join(' ')); - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + const tJet = finalRoll.results.jet.result; - const total = tJet + tBonus; + const tBonus = finalRoll.results.tBonus.result; + const tExploit = finalRoll.results.Exploit.result; - finishRoll( - results.rollId, - { - jet: total, - degats: tDegats, - violence: tViolence, - }, - ); + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; - if (tJet !== 0 && tJet === tExploit) { - startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`, (exploit) => { - const tExploit2 = exploit.results.jet.result; + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; - finishRoll( - exploit.rollId, - { - jet: tExploit2, - }, - ); - }); - } - }); + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [], tViolence, rViolence, [], conditions); + + const finalComputed = { + jet: tJet + tBonus, + }; + + Object.assign(finalComputed, computed); + + finishRoll(finalRoll.rollId, finalComputed); + + if (tJet !== 0 && tJet === tExploit) { + const exploitRoll = await startRoll(`${roll}@{jetGM} &{template:simple} {{Nom=@{name}}} {{special1=${i18n_exploit}}}{{jet=[[ {[[{${cRoll.join('+')}, 0}kh1]]d6cs2cs4cs6cf1cf3cf5s%2}=0]]}}`); + const tRExploit = exploitRoll.results.jet.result; + const exploitComputed = { + jet: tRExploit, + }; + + finishRoll(exploitRoll.rollId, exploitComputed); + } }); on('clicked:distanceWizardOriflamme', async (info) => { @@ -22231,6 +23175,9 @@ on('clicked:distanceWizardOriflamme', async (info) => { 'wizardODmg', 'wizardOViolence', 'wizardOPortee', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(listArmureLegende); @@ -22254,6 +23201,10 @@ on('clicked:distanceWizardOriflamme', async (info) => { const violence = attrs.wizardOViolence; const portee = attrs.wizardOPortee; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + exec.push(roll); switch (armureL) { @@ -22314,18 +23265,34 @@ on('clicked:distanceWizardOriflamme', async (info) => { exec.push(`{{effets=${autresEffets.join(' / ')}}}`); - startRoll(exec.join(' '), (results) => { - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + if (devaste || bourreau || equilibre) { + const herauts = []; - finishRoll( - results.rollId, - { - degats: tDegats, - violence: tViolence, - }, - ); - }); + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + + // ROLL + const finalRoll = await startRoll(exec.join(' ')); + + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [], tViolence, rViolence, [], conditions); + + finishRoll(finalRoll.rollId, computed); }); on('clicked:distanceMALWizardOriflamme', async (info) => { @@ -22335,6 +23302,9 @@ on('clicked:distanceMALWizardOriflamme', async (info) => { 'MALWizardODmg', 'MALWizardOViolence', 'MALWizardOPortee', + 'devasterAnatheme', + 'bourreauTenebres', + 'equilibreBalance', ]; attributs = attributs.concat(listArmureLegende); @@ -22349,6 +23319,10 @@ on('clicked:distanceMALWizardOriflamme', async (info) => { const violence = attrs.MALWizardOViolence; const portee = attrs.MALWizardOPortee; + const devaste = +attrs.devasterAnatheme; + const bourreau = +attrs.bourreauTenebres; + const equilibre = +attrs.equilibreBalance; + const autresEffets = []; let MALGoliath; @@ -22416,20 +23390,36 @@ on('clicked:distanceMALWizardOriflamme', async (info) => { exec.push(`{{affecteAnathemeD=${i18n_affecteAnatheme}}}`); exec.push(`{{affecteAnathemeV=${i18n_affecteAnatheme}}}`); + if (devaste || bourreau || equilibre) { + const herauts = []; + + if (devaste) { herauts.push(i18n_devasterAnatheme); } + if (bourreau) { herauts.push(i18n_bourreauTenebres); } + if (equilibre) { herauts.push(i18n_equilibrerBalance); } + + exec.push(`{{herauts=${herauts.join(' / ')}}}`); + } + exec.push(`{{effets=${autresEffets.join(' / ')}}}`); - startRoll(exec.join(' '), (results) => { - const tDegats = results.results.degats.result; - const tViolence = results.results.violence.result; + // ROLL + const finalRoll = await startRoll(exec.join(' ')); - finishRoll( - results.rollId, - { - degats: tDegats, - violence: tViolence, - }, - ); - }); + const rDegats = finalRoll.results.degats.dice; + const rViolence = finalRoll.results.violence.dice; + + const tDegats = finalRoll.results.degats.result; + const tViolence = finalRoll.results.violence.result; + + const conditions = { + bourreau, + devaste, + equilibre, + }; + + const computed = updateRoll(finalRoll, tDegats, rDegats, [], tViolence, rViolence, [], conditions); + + finishRoll(finalRoll.rollId, computed); }); /* eslint-disable camelcase */ /* eslint-disable no-undef */ @@ -25198,6 +26188,12 @@ on('clicked:rollVehicule', async (info) => { Inclure un onglet pour gérer le véhicule. +