Outils pour utilisateurs

Outils du site


simulateur_saison3

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
simulateur_saison3 [2026/09/21 00:22] – nanakisimulateur_saison3 [2026/10/12 00:41] (Version actuelle) – nanaki
Ligne 1: Ligne 1:
 +Bonjour,
 +Voici le simulateur pour la saison 3. \\
 +N'hésitez pas à remonter des problèmes si il y a.\\
 +Le bouton import et export ne fonctionnent plus très bien, utiliser le bouton lien pour le moment.
 +
 <html> <html>
 <head> <head>
 <meta charset="UTF-8"> <meta charset="UTF-8">
 +<meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Simulateur RPG</title> <title>Simulateur RPG</title>
  
 <style> <style>
 body { body {
-    font-family: Arial;+    font-family: Arial, sans-serif;
     background:#0b1a13;     background:#0b1a13;
     color:#7dd3fc;     color:#7dd3fc;
Ligne 12: Ligne 18:
 } }
  
-h1,h2 { +h1,h2 { color:gold; } 
-    color:gold; +h3 { color:#7dd3fc; }
-}+
  
 .box { .box {
Ligne 24: Ligne 29:
 select { select {
     margin:3px;     margin:3px;
-    max-width:180px;+    max-width:220px;
 } }
  
 input { input {
     margin:3px;     margin:3px;
-    width:60px;+    width:65px;
 } }
  
Ligne 43: Ligne 48:
     padding:10px;     padding:10px;
     white-space:pre-wrap;     white-space:pre-wrap;
 +    overflow-wrap:anywhere;
 } }
  
Ligne 54: Ligne 60:
 } }
  
-.bonus {+.bonus,.special {
     color:#00ff00;     color:#00ff00;
 } }
Ligne 62: Ligne 68:
 } }
  
-.special { +/* Magie interdite : rouge uniquement dans les bonus/malus */ 
-    color:#00ff00;+.forbiddenMagic { 
 +    color:#ff3333; 
 +    font-weight:bold; 
 +} 
 + 
 +button { 
 +    margin:4px; 
 +    padding:7px 10px; 
 +    cursor:pointer;
 } }
 </style> </style>
Ligne 181: Ligne 195:
 </div> </div>
  
-<button onclick="resetAll()">Reset</button> +<button type="button" onclick="resetAll()">Reset</button> 
-<button onclick="exportBuild()">📤 Export</button> +<button type="button" onclick="exportBuild()">📤 Export</button> 
-<button onclick="importBuild()">📥 Import</button> +<button type="button" onclick="importBuild()">📥 Import</button> 
-<button onclick="copyLink()">🔗 Lien</button>+<button type="button" onclick="copyLink()">🔗 Lien</button>
  
 <pre id="result" class="result"></pre> <pre id="result" class="result"></pre>
- 
  
 <script> <script>
 +"use strict";
  
 /* ========================================================= /* =========================================================
Ligne 198: Ligne 212:
  
     Elfe:{     Elfe:{
-        a:2, +        a:2,cc:9,ct:10,f:9,e:4,agi:9, 
-        cc:9, +        p:5,mvt:5,pv:55,pm:30,r:4,rm:6, 
-        ct:10, +        fm:8,pui:6,res:5
-        f:9, +
-        e:4, +
-        agi:9, +
-        p:5, +
-        mvt:5, +
-        pv:55, +
-        pm:30, +
-        r:4, +
-        rm:6, +
-        fm:8, +
-        pui:6, +
-        res:5+
     },     },
  
     Nain:{     Nain:{
-        a:2, +        a:2,cc:11,ct:8,f:11,e:6,agi:7, 
-        cc:11, +        p:4,mvt:4,pv:60,pm:25,r:7,rm:5, 
-        ct:8, +        fm:10,pui:4,res:3
-        f:11, +
-        e:6, +
-        agi:7, +
-        p:4, +
-        mvt:4, +
-        pv:60, +
-        pm:25, +
-        r:7, +
-        rm:5, +
-        fm:10, +
-        pui:4, +
-        res:3+
     },     },
  
     Géant:{     Géant:{
-        a:2, +        a:2,cc:9,ct:10,f:12,e:4,agi:8, 
-        cc:9, +        p:4,mvt:5,pv:70,pm:30,r:6,rm:6, 
-        ct:10, +        fm:6,pui:5,res:4
-        f:12, +
-        e:4, +
-        agi:8, +
-        p:4, +
-        mvt:5, +
-        pv:70, +
-        pm:30, +
-        r:6, +
-        rm:6, +
-        fm:6, +
-        pui:5, +
-        res:4+
     },     },
  
     Olympien:{     Olympien:{
-        a:2, +        a:2,cc:10,ct:9,f:10,e:5,agi:9, 
-        cc:10, +        p:4,mvt:5,pv:60,pm:30,r:5,rm:6, 
-        ct:9, +        fm:7,pui:5,res:5
-        f:10, +
-        e:5, +
-        agi:9, +
-        p:4, +
-        mvt:5, +
-        pv:60, +
-        pm:30, +
-        r:5, +
-        rm:6, +
-        fm:7, +
-        pui:5, +
-        res:5+
     },     },
  
     HS:{     HS:{
-        a:2, +        a:2,cc:8,ct:9,f:8,e:3,agi:11, 
-        cc:8, +        p:5,mvt:6,pv:50,pm:40,r:3,rm:6, 
-        ct:9, +        fm:9,pui:5,res:6
-        f:8, +
-        e:3, +
-        agi:11, +
-        p:5, +
-        mvt:6, +
-        pv:50, +
-        pm:40, +
-        r:3, +
-        rm:6, +
-        fm:9, +
-        pui:5, +
-        res:6+
     }     }
 }; };
  
 +/* =========================================================
 +   CARACTERISTIQUES
 +========================================================= */
 +
 +const statOrder = [
 +    "a","cc","ct","f","e","agi","p",
 +    "pui","fm","mvt","pv","pm","r","res","rm"
 +];
 +
 +const statLabels = {
 +    a:"A",cc:"CC",ct:"CT",f:"F",e:"E",
 +    agi:"Agi",p:"P",pui:"Pui",fm:"FM",
 +    mvt:"Mvt",pv:"PV",pm:"PM",r:"R",
 +    res:"Rés",rm:"RM"
 +};
  
 /* ========================================================= /* =========================================================
Ligne 294: Ligne 263:
  
 const costTable = { const costTable = {
- 
     a:[800,200,100],     a:[800,200,100],
- 
     cc:[100,50,30],     cc:[100,50,30],
     ct:[110,50,30],     ct:[110,50,30],
- 
     f:[120,55,30],     f:[120,55,30],
     e:[120,55,30],     e:[120,55,30],
- 
     agi:[95,45,25],     agi:[95,45,25],
- +    pui:[120,55,30], 
-    pui:[110,55,35], +    res:[120,55,30],
-    res:[110,55,35], +
     fm:[100,50,30],     fm:[100,50,30],
- 
     p:[110,85,78],     p:[110,85,78],
- 
     pv:[4,2,1],     pv:[4,2,1],
     pm:[5,3,1],     pm:[5,3,1],
- 
     mvt:[100,50,30],     mvt:[100,50,30],
- 
     r:[40,30,15],     r:[40,30,15],
     rm:[50,40,20]     rm:[50,40,20]
 }; };
- 
  
 /* ========================================================= /* =========================================================
    EQUIPEMENTS    EQUIPEMENTS
-========================================================= +========================================================= */
- +
-Règle : +
-- équipement normal = toutes les races +
-- équipement exo = uniquement la race indiquée dans "race" +
- +
-Rappel : +
-R   = r +
-Rés = res +
-*/+
  
 const equipments = [ const equipments = [
  
-/* ========================= +/* COMMUN */
-   COMMUN +
-========================= */ +
- +
-{ +
-    name:"Bâton de marche", +
-    race:"all", +
-    slot:"rightHand", +
-    stats:{mvt:1} +
-}, +
- +
-{ +
-    name:"Gladius", +
-    race:"all", +
-    slot:"rightHand", +
-    stats:{cc:1} +
-}, +
- +
-{ +
-    name:"Sceptre", +
-    race:"all", +
-    slot:"rightHand", +
-    stats:{fm:1} +
-},+
  
 +{name:"Bâton de marche",race:"all",slot:"rightHand",stats:{mvt:1}},
 +{name:"Gladius",race:"all",slot:"rightHand",stats:{cc:1}},
 +{name:"Sceptre",race:"all",slot:"rightHand",stats:{fm:1}},
 { {
     name:"Fustibale",     name:"Fustibale",
Ligne 368: Ligne 297:
     stats:{ct:1,cc:-2}     stats:{ct:1,cc:-2}
 }, },
- 
 { {
     name:"Arbalète de poing",     name:"Arbalète de poing",
Ligne 375: Ligne 303:
     stats:{f:12,ct:1}     stats:{f:12,ct:1}
 }, },
- 
 { {
     name:"Torche",     name:"Torche",
Ligne 382: Ligne 309:
     stats:{cc:-2,f:-2,feu:true}     stats:{cc:-2,f:-2,feu:true}
 }, },
- 
 { {
     name:"Lance barbelée",     name:"Lance barbelée",
Ligne 389: Ligne 315:
     stats:{ct:1,f:1,cc:-1}     stats:{ct:1,f:1,cc:-1}
 }, },
- 
 { {
     name:"Lance",     name:"Lance",
Ligne 396: Ligne 321:
     stats:{ct:1,cc:-1}     stats:{ct:1,cc:-1}
 }, },
- 
 { {
     name:"Rapière",     name:"Rapière",
Ligne 403: Ligne 327:
     stats:{cc:2,f:-1}     stats:{cc:2,f:-1}
 }, },
- 
 { {
     name:"Arc",     name:"Arc",
Ligne 410: Ligne 333:
     stats:{ct:1,cc:-1}     stats:{ct:1,cc:-1}
 }, },
- 
 { {
     name:"Arc long",     name:"Arc long",
Ligne 417: Ligne 339:
     stats:{ct:2,f:-1,cc:-2}     stats:{ct:2,f:-1,cc:-2}
 }, },
- 
 { {
     name:"Bélier",     name:"Bélier",
Ligne 424: Ligne 345:
     stats:{demolition:10,cc:-2}     stats:{demolition:10,cc:-2}
 }, },
- 
 { {
     name:"Pioche",     name:"Pioche",
Ligne 431: Ligne 351:
     stats:{demolition:5}     stats:{demolition:5}
 }, },
- 
 { {
     name:"Catalyseur magique",     name:"Catalyseur magique",
     race:"all",     race:"all",
     slot:"rightHand",     slot:"rightHand",
-    stats:{magique:true,cc:-3,demolition:10}+    stats:{fPui:true,cc:-3,demolition:10}
 }, },
  
Ligne 445: Ligne 364:
     stats:{cc:1,agi:-1}     stats:{cc:1,agi:-1}
 }, },
- 
 { {
     name:"Bouclier Parma",     name:"Bouclier Parma",
Ligne 452: Ligne 370:
     stats:{e:1,agi:-1}     stats:{e:1,agi:-1}
 }, },
- 
 { {
     name:"Écu brillant",     name:"Écu brillant",
Ligne 466: Ligne 383:
     stats:{e:1,agi:-1}     stats:{e:1,agi:-1}
 }, },
- 
 { {
     name:"Toge d'apprenti",     name:"Toge d'apprenti",
Ligne 473: Ligne 389:
     stats:{res:1,agi:-1}     stats:{res:1,agi:-1}
 }, },
- 
 { {
     name:"Ceinture",     name:"Ceinture",
Ligne 494: Ligne 409:
     stats:{rm:1}     stats:{rm:1}
 }, },
- 
 { {
     name:"Visière",     name:"Visière",
Ligne 501: Ligne 415:
     stats:{p:1,cc:-1,fm:-1}     stats:{p:1,cc:-1,fm:-1}
 }, },
- 
 { {
     name:"Collier tressé",     name:"Collier tressé",
Ligne 515: Ligne 428:
     stats:{mvt:1}     stats:{mvt:1}
 }, },
- 
 { {
     name:"Sceptre de mage",     name:"Sceptre de mage",
Ligne 522: Ligne 434:
     stats:{pui:1,fm:1}     stats:{pui:1,fm:1}
 }, },
- 
 { {
     name:"Sarbacane",     name:"Sarbacane",
Ligne 529: Ligne 440:
     stats:{ct:1,f:10,cc:-1}     stats:{ct:1,f:10,cc:-1}
 }, },
- 
 { {
     name:"Pierre Noire",     name:"Pierre Noire",
Ligne 537: Ligne 447:
 }, },
  
- +/* OLYMPIENS */
-/* ========================= +
-   OLYMPIENS +
-========================= */+
  
 { {
     name:"Spatha",     name:"Spatha",
-    race:"Olympiens",+    race:"Olympien",
     slot:"rightHand",     slot:"rightHand",
     stats:{cc:1,f:1}     stats:{cc:1,f:1}
 }, },
- 
 { {
     name:"Lame sainte",     name:"Lame sainte",
     race:"Olympiens",     race:"Olympiens",
     slot:"rightHand",     slot:"rightHand",
-    stats:{cc:1,pui:1,magique:true}+    stats:{cc:1,pui:1,fPui:true}
 }, },
- 
 { {
     name:"Pilum",     name:"Pilum",
-    race:"Olympiens",+    race:"Olympien",
     slot:"rightHand",     slot:"rightHand",
     stats:{f:1,mvt:1,cc:-1}     stats:{f:1,mvt:1,cc:-1}
 }, },
- 
 { {
     name:"Sceptre de puissance",     name:"Sceptre de puissance",
-    race:"Olympiens",+    race:"Olympien",
     slot:"rightHand",     slot:"rightHand",
     stats:{pui:1,pm:8}     stats:{pui:1,pm:8}
 }, },
- 
 { {
     name:"Gastraphète",     name:"Gastraphète",
-    race:"Olympiens",+    race:"Olympien",
     slot:"rightHand",     slot:"rightHand",
     stats:{f:15,ct:-2,cc:-1}     stats:{f:15,ct:-2,cc:-1}
 }, },
- 
 { {
     name:"Bouclier Ancile",     name:"Bouclier Ancile",
-    race:"Olympiens",+    race:"Olympien",
     slot:"leftHand",     slot:"leftHand",
     stats:{e:1,pv:5}     stats:{e:1,pv:5}
 }, },
- 
 { {
     name:"Armure Hoplitique",     name:"Armure Hoplitique",
-    race:"Olympiens",+    race:"Olympien",
     slot:"body",     slot:"body",
     stats:{e:1,res:1}     stats:{e:1,res:1}
 }, },
- 
 { {
     name:"Lorica",     name:"Lorica",
-    race:"Olympiens",+    race:"Olympien",
     exo:true,     exo:true,
     slot:"body",     slot:"body",
     stats:{e:1,res:1}     stats:{e:1,res:1}
 }, },
- 
 { {
     name:"Cape de dueliste",     name:"Cape de dueliste",
-    race:"Olympiens",+    race:"Olympien",
     slot:"cape",     slot:"cape",
     stats:{cc:2,f:-1}     stats:{cc:2,f:-1}
 }, },
- 
 { {
     name:"Diadème",     name:"Diadème",
-    race:"Olympiens",+    race:"Olympien",
     slot:"head",     slot:"head",
     stats:{r:1,rm:2}     stats:{r:1,rm:2}
 }, },
- 
 { {
     name:"Tiare d'Oracle",     name:"Tiare d'Oracle",
-    race:"Olympiens",+    race:"Olympien",
     slot:"head",     slot:"head",
     stats:{fm:1,p:1}     stats:{fm:1,p:1}
 }, },
- 
 { {
     name:"Cnémides",     name:"Cnémides",
-    race:"Olympiens",+    race:"Olympien",
     slot:"feet",     slot:"feet",
     stats:{mvt:1,rm:1,r:1}     stats:{mvt:1,rm:1,r:1}
 }, },
  
- +/* ELFES */
-/* ========================= +
-   ELFES +
-========================= */+
  
 { {
     name:"Lance de garde Sylvestre",     name:"Lance de garde Sylvestre",
-    race:"Elfes",+    race:"Elfe",
     slot:"rightHand",     slot:"rightHand",
     stats:{cc:1,f:1}     stats:{cc:1,f:1}
 }, },
- 
 { {
     name:"Baton du Pelerin",     name:"Baton du Pelerin",
-    race:"Elfes",+    race:"Elfe",
     slot:"rightHand",     slot:"rightHand",
     stats:{mvt:1,fm:1}     stats:{mvt:1,fm:1}
 }, },
- 
 { {
     name:"Charybde",     name:"Charybde",
-    race:"Elfes",+    race:"Elfe",
     slot:"rightHand",     slot:"rightHand",
     stats:{pui:2,e:-1}     stats:{pui:2,e:-1}
 }, },
- 
 { {
     name:"Arc Ensorcelé",     name:"Arc Ensorcelé",
     race:"Elfes",     race:"Elfes",
     slot:"rightHand",     slot:"rightHand",
-    stats:{ct:1,rm:2,cc:-1,magique:true}+    stats:{ct:1,rm:2,cc:-1,fPui:true}
 }, },
- 
 { {
     name:"Arc Elfique",     name:"Arc Elfique",
-    race:"Elfes",+    race:"Elfe",
     exo:true,     exo:true,
     slot:"rightHand",     slot:"rightHand",
     stats:{ct:1,f:1,mvt:1,cc:-2}     stats:{ct:1,f:1,mvt:1,cc:-2}
 }, },
- 
 { {
     name:"Targe renforcée",     name:"Targe renforcée",
-    race:"Elfes",+    race:"Elfe",
     slot:"leftHand",     slot:"leftHand",
     stats:{e:1,cc:1}     stats:{e:1,cc:1}
 }, },
- 
 { {
     name:"Cuirasse",     name:"Cuirasse",
-    race:"Elfes",+    race:"Elfe",
     slot:"body",     slot:"body",
     stats:{res:1,r:2}     stats:{res:1,r:2}
 }, },
- 
 { {
     name:"Armure de garde Sylvestre",     name:"Armure de garde Sylvestre",
-    race:"Elfes",+    race:"Elfe",
     exo:true,     exo:true,
     slot:"body",     slot:"body",
     stats:{res:2,pm:-10}     stats:{res:2,pm:-10}
 }, },
- 
 { {
     name:"Cape de feuillages",     name:"Cape de feuillages",
-    race:"Elfes",+    race:"Elfe",
     slot:"cape",     slot:"cape",
     stats:{fm:1,pv:5}     stats:{fm:1,pv:5}
 }, },
- 
 { {
     name:"Marque Forestière",     name:"Marque Forestière",
-    race:"Elfes",+    race:"Elfe",
     slot:"head",     slot:"head",
     stats:{pm:10,r:1}     stats:{pm:10,r:1}
 }, },
- 
 { {
     name:"Capuche du chasseur",     name:"Capuche du chasseur",
-    race:"Elfes",+    race:"Elfe",
     slot:"head",     slot:"head",
     stats:{ct:1,r:1,rm:1}     stats:{ct:1,r:1,rm:1}
 }, },
- 
 { {
     name:"Bottes Tâlroval",     name:"Bottes Tâlroval",
-    race:"Elfes",+    race:"Elfe",
     slot:"feet",     slot:"feet",
     stats:{mvt:2}     stats:{mvt:2}
 }, },
  
- +/* NAINS */
-/* ========================= +
-   NAINS +
-========================= */+
  
 { {
     name:"Labrys",     name:"Labrys",
-    race:"Nains",+    race:"Nain",
     slot:"rightHand",     slot:"rightHand",
     stats:{cc:1,f:1}     stats:{cc:1,f:1}
 }, },
- 
 { {
     name:"Hache runique",     name:"Hache runique",
-    race:"Nains",+    race:"Nain",
     slot:"rightHand",     slot:"rightHand",
     stats:{cc:1,fm:1}     stats:{cc:1,fm:1}
 }, },
- 
 { {
     name:"Marteau runique",     name:"Marteau runique",
     race:"Nains",     race:"Nains",
     slot:"rightHand",     slot:"rightHand",
-    stats:{magique:true,pui:2}+    stats:{fPui:true,pui:2}
 }, },
- 
 { {
     name:"Baton d'archimage",     name:"Baton d'archimage",
-    race:"Nains",+    race:"Nain",
     slot:"rightHand",     slot:"rightHand",
     stats:{fm:1,pm:10}     stats:{fm:1,pm:10}
 }, },
- 
 { {
     name:"Marteau de guerre",     name:"Marteau de guerre",
-    race:"Nains",+    race:"Nain",
     slot:"rightHand",     slot:"rightHand",
     stats:{f:2,cc:-1}     stats:{f:2,cc:-1}
 }, },
- 
 { {
     name:"Bouclier Miroir",     name:"Bouclier Miroir",
-    race:"Nains",+    race:"Nain",
     slot:"leftHand",     slot:"leftHand",
     stats:{res:1,pv:5}     stats:{res:1,pv:5}
 }, },
- 
 { {
     name:"Armure runique",     name:"Armure runique",
-    race:"Nains",+    race:"Nain",
     slot:"body",     slot:"body",
     stats:{e:1,pm:8}     stats:{e:1,pm:8}
 }, },
- 
 { {
     name:"Cotte de mailles",     name:"Cotte de mailles",
-    race:"Nains",+    race:"Nain",
     exo:true,     exo:true,
     slot:"body",     slot:"body",
     stats:{e:2,esquive:-4}     stats:{e:2,esquive:-4}
 }, },
- 
 { {
     name:"Cape dorée",     name:"Cape dorée",
-    race:"Nains",+    race:"Nain",
     exo:true,     exo:true,
     slot:"cape",     slot:"cape",
     stats:{res:1,mvt:1}     stats:{res:1,mvt:1}
 }, },
- 
 { {
     name:"Casque grossissant",     name:"Casque grossissant",
-    race:"Nains",+    race:"Nain",
     slot:"head",     slot:"head",
     stats:{ct:2,p:-1}     stats:{ct:2,p:-1}
 }, },
- 
 { {
     name:"Casque de guerre",     name:"Casque de guerre",
-    race:"Nains",+    race:"Nain",
     slot:"head",     slot:"head",
     stats:{pv:5,r:1,pm:5,rm:1}     stats:{pv:5,r:1,pm:5,rm:1}
 }, },
- 
 { {
     name:"Solerets",     name:"Solerets",
-    race:"Nains",+    race:"Nain",
     slot:"feet",     slot:"feet",
     stats:{mvt:1,pm:5,pv:5}     stats:{mvt:1,pm:5,pv:5}
 }, },
  
- +/* GEANTS */
-/* ========================= +
-   GEANTS +
-========================= */+
  
 { {
     name:"Masse d'arme",     name:"Masse d'arme",
-    race:"Géants",+    race:"Géant",
     slot:"rightHand",     slot:"rightHand",
     stats:{cc:1,f:1}     stats:{cc:1,f:1}
 }, },
- 
 { {
     name:"Hallebarde de pierre",     name:"Hallebarde de pierre",
-    race:"Géants",+    race:"Géant",
     slot:"rightHand",     slot:"rightHand",
     stats:{f:1,mvt:1}     stats:{f:1,mvt:1}
 }, },
- 
 { {
     name:"Javelot lourd",     name:"Javelot lourd",
-    race:"Géants",+    race:"Géant",
     slot:"rightHand",     slot:"rightHand",
     stats:{f:2,ct:-1,cc:-1}     stats:{f:2,ct:-1,cc:-1}
 }, },
- 
 { {
     name:"Pierre en fusion",     name:"Pierre en fusion",
     race:"Géants",     race:"Géants",
     slot:"rightHand",     slot:"rightHand",
-    stats:{magique:true,ct:-2,feu:true}+    stats:{fPui:true,ct:-2,feu:true}
 }, },
- 
 { {
     name:"Baton de shaman",     name:"Baton de shaman",
-    race:"Géants",+    race:"Géant",
     exo:true,     exo:true,
     slot:"rightHand",     slot:"rightHand",
     stats:{fm:2}     stats:{fm:2}
 }, },
- 
 { {
     name:"Bouclier Clipeus",     name:"Bouclier Clipeus",
-    race:"Géants",+    race:"Géant",
     slot:"leftHand",     slot:"leftHand",
     stats:{e:1,pv:10}     stats:{e:1,pv:10}
 }, },
- 
 { {
     name:"Peau de granit manifiée",     name:"Peau de granit manifiée",
-    race:"Géants",+    race:"Géant",
     slot:"body",     slot:"body",
     stats:{res:1,rm:2,esquive:-2}     stats:{res:1,rm:2,esquive:-2}
 }, },
- 
 { {
     name:"Broigne",     name:"Broigne",
-    race:"Géants",+    race:"Géant",
     exo:true,     exo:true,
     slot:"body",     slot:"body",
     stats:{res:2,fm:-1}     stats:{res:2,fm:-1}
 }, },
- 
 { {
     name:"Cape de l'arpenteur",     name:"Cape de l'arpenteur",
-    race:"Géants",+    race:"Géant",
     slot:"cape",     slot:"cape",
     stats:{cc:1,ct:1}     stats:{cc:1,ct:1}
 }, },
- 
 { {
     name:"Fétiche de shaman",     name:"Fétiche de shaman",
-    race:"Géants",+    race:"Géant",
     slot:"head",     slot:"head",
     stats:{r:2,pm:5}     stats:{r:2,pm:5}
 }, },
- 
 { {
     name:"Coiffe de rage",     name:"Coiffe de rage",
-    race:"Géants",+    race:"Géant",
     slot:"head",     slot:"head",
     stats:{cc:1,pv:5,r:1}     stats:{cc:1,pv:5,r:1}
 }, },
- 
 { {
     name:"Bottes incandescentes",     name:"Bottes incandescentes",
-    race:"Géants",+    race:"Géant",
     slot:"feet",     slot:"feet",
     stats:{mvt:1,r:1,pv:5}     stats:{mvt:1,r:1,pv:5}
 }, },
  
- +/* HS */
-/* ========================= +
-   HS +
-========================= */+
  
 { {
Ligne 911: Ligne 762:
     stats:{f:1,cc:1}     stats:{f:1,cc:1}
 }, },
- 
 { {
     name:"Mains de mana",     name:"Mains de mana",
     race:"HS",     race:"HS",
     slot:"rightHand",     slot:"rightHand",
-    stats:{magique:true,cc:2}+    stats:{fPui:true,cc:2}
 }, },
- 
 { {
     name:"Baton de Sage",     name:"Baton de Sage",
Ligne 925: Ligne 774:
     stats:{pui:1,agi:1}     stats:{pui:1,agi:1}
 }, },
- 
 { {
     name:"Orbe de mana",     name:"Orbe de mana",
Ligne 932: Ligne 780:
     stats:{pui:2,fm:-1}     stats:{pui:2,fm:-1}
 }, },
- 
 { {
     name:"Bouclier en lianes",     name:"Bouclier en lianes",
Ligne 939: Ligne 786:
     stats:{res:1,agi:1}     stats:{res:1,agi:1}
 }, },
- 
 { {
     name:"Manteau de feuillage",     name:"Manteau de feuillage",
Ligne 946: Ligne 792:
     stats:{e:1,agi:1}     stats:{e:1,agi:1}
 }, },
- 
 { {
     name:"Armure de fourrure",     name:"Armure de fourrure",
Ligne 954: Ligne 799:
     stats:{e:2,rm:-3}     stats:{e:2,rm:-3}
 }, },
- 
 { {
     name:"Cape de mage",     name:"Cape de mage",
Ligne 961: Ligne 805:
     stats:{fm:1,rm:1}     stats:{fm:1,rm:1}
 }, },
- 
 { {
     name:"Collier d'apaisement",     name:"Collier d'apaisement",
Ligne 968: Ligne 811:
     stats:{pv:10,pm:5}     stats:{pv:10,pm:5}
 }, },
- 
 { {
     name:"Coiffe de rapace",     name:"Coiffe de rapace",
Ligne 975: Ligne 817:
     stats:{ct:1,p:1}     stats:{ct:1,p:1}
 }, },
- 
 { {
     name:"Bottes griffues",     name:"Bottes griffues",
Ligne 983: Ligne 824:
     stats:{cc:1,f:1,pv:5}     stats:{cc:1,f:1,pv:5}
 }, },
- 
 { {
     name:"Bottes de voleur",     name:"Bottes de voleur",
Ligne 991: Ligne 831:
 }, },
  
- +/* LUTINS : ANNEAUX */
-/* ========================= +
-   LUTINS +
-========================= */+
  
 { {
Ligne 1002: Ligne 839:
     stats:{p:1}     stats:{p:1}
 }, },
- 
 { {
     name:"Anneau de Caprice",     name:"Anneau de Caprice",
Ligne 1009: Ligne 845:
     stats:{fm:1}     stats:{fm:1}
 }, },
- 
 { {
     name:"Anneau de Puissance",     name:"Anneau de Puissance",
Ligne 1016: Ligne 851:
     stats:{pui:1}     stats:{pui:1}
 }, },
- 
 { {
     name:"Anneau de Férocité",     name:"Anneau de Férocité",
Ligne 1023: Ligne 857:
     stats:{f:1}     stats:{f:1}
 }, },
- 
 { {
     name:"Anneau de Résistance",     name:"Anneau de Résistance",
Ligne 1030: Ligne 863:
     stats:{res:1}     stats:{res:1}
 }, },
- 
 { {
     name:"Anneau d'Équilibre",     name:"Anneau d'Équilibre",
Ligne 1037: Ligne 869:
     stats:{pv:5,pm:5}     stats:{pv:5,pm:5}
 }, },
- 
 { {
     name:"Anneau de Finesse",     name:"Anneau de Finesse",
Ligne 1044: Ligne 875:
     stats:{cc:1}     stats:{cc:1}
 }, },
- 
 { {
     name:"Anneau de Prétention",     name:"Anneau de Prétention",
Ligne 1051: Ligne 881:
     stats:{ct:1}     stats:{ct:1}
 }, },
- 
 { {
     name:"Anneau de Tenacité",     name:"Anneau de Tenacité",
Ligne 1058: Ligne 887:
     stats:{e:1}     stats:{e:1}
 }, },
- 
 { {
     name:"Anneau de Souplesse",     name:"Anneau de Souplesse",
Ligne 1076: Ligne 904:
 ]; ];
  
 +/* =========================================================
 +   MAGIE INTERDITE
 +   Affichée uniquement après les bonus/malus de l'objet.
 +========================================================= */
 +
 +const magieInterdite = new Set([
 +    "Lance barbelée", "Rapière", "Bélier", "Pioche",
 +    "Catalyseur magique", "Bouclier Parma", "Écu brillant",
 +    "Armure matelassée", "Toge d'apprenti", "Pierre Noire",
 +    "Spatha", "Pilum", "Gastraphète", "Armure Hoplitique",
 +    "Cape de dueliste", "Lance de garde Sylvestre", "Arc Elfique",
 +    "Targe renforcée", "Armure de garde Sylvestre", "Bottes Tâlroval",
 +    "Labrys", "Marteau runique", "Marteau de guerre", "Cotte de mailles",
 +    "Cape dorée", "Casque grossissant", "Casque de guerre",
 +    "Masse d'arme", "Hallebarde de pierre", "Javelot lourd",
 +    "Pierre en fusion", "Bouclier Clipeus", "Broigne", "Cape de l'arpenteur",
 +    "Ceste", "Bouclier en lianes", "Armure de fourrure"
 +]);
  
 /* ========================================================= /* =========================================================
Ligne 1082: Ligne 928:
  
 const skills = [ const skills = [
- 
     {     {
         name:"Fulgurance",         name:"Fulgurance",
-        desc:"+1 toucher au cac + 1 esquive tous les 5 mouvements"+        desc:"+1 toucher CAC et +1 esquive par tranche de 5 mouvements"
     },     },
- 
     {     {
         name:"Couverture",         name:"Couverture",
         desc:"85% CC / 15% AGI"         desc:"85% CC / 15% AGI"
     },     },
- 
     {     {
         name:"Réflexes fulgurants",         name:"Réflexes fulgurants",
         desc:"85% AGI / 15% CC"         desc:"85% AGI / 15% CC"
     },     },
- 
     {     {
         name:"Berserker",         name:"Berserker",
-        desc:"+1 toucher au cac tous les 10 pv perdus"+        desc:"+1 F par tranche de 10 PV perdus (non calculé)"
     },     },
- 
     {     {
         name:"Griffes",         name:"Griffes",
-        desc:"+3 dégâts au poings"+        desc:"+3 dégâts à mains nues, avec une ceste ou des mains de mana"
     },     },
- 
     {     {
         name:"Anguille",         name:"Anguille",
-        desc:"Avantage esquive"+        desc:"+1 esquive (non calculé)"
     }     }
- 
 ]; ];
- 
  
 /* ========================================================= /* =========================================================
Ligne 1121: Ligne 959:
  
 const spells = [ const spells = [
- 
     {name:"Peau de granit",dex:0,prot:2},     {name:"Peau de granit",dex:0,prot:2},
     {name:"Coup précis",dex:2,prot:0},     {name:"Coup précis",dex:2,prot:0},
Ligne 1137: Ligne 974:
     {name:"Guigne",dex:-8,prot:0},     {name:"Guigne",dex:-8,prot:0},
     {name:"Virtuose",dex:8,prot:0}     {name:"Virtuose",dex:8,prot:0}
- 
 ]; ];
- 
  
 /* ========================================================= /* =========================================================
Ligne 1147: Ligne 982:
 const raceSelect = document.getElementById("race"); const raceSelect = document.getElementById("race");
  
-for(const r in races){ +Object.keys(races).forEach(r=>{ 
-    const o=document.createElement("option"); +    const option=document.createElement("option"); 
-    o.value=r; +    option.value=r; 
-    o.textContent=r; +    option.textContent=r; 
-    raceSelect.appendChild(o); +    raceSelect.appendChild(option); 
-}+});
  
- +/* AMELIORATIONS */
-/* ========================================================= +
-   STATS AMELIORATIONS +
-========================================================= */+
  
 const statsDiv=document.getElementById("stats"); const statsDiv=document.getElementById("stats");
  
-for(const stat in costTable){+statOrder.forEach(stat=>{ 
 +    if(!costTable[stat]) return;
  
     const line=document.createElement("div");     const line=document.createElement("div");
Ligne 1167: Ligne 1000:
  
     const label=document.createElement("label");     const label=document.createElement("label");
-    label.textContent=stat.toUpperCase();+    label.textContent=statLabels[stat]||stat;
  
     const input=document.createElement("input");     const input=document.createElement("input");
Ligne 1177: Ligne 1010:
     input.addEventListener("input",calculate);     input.addEventListener("input",calculate);
  
-    line.appendChild(label); +    line.append(label,input);
-    line.appendChild(input); +
     statsDiv.appendChild(line);     statsDiv.appendChild(line);
-}+});
  
- +/* PASSIFS */
-/* ========================================================= +
-   PASSIFS +
-========================================================= */+
  
 const skillsDiv=document.getElementById("skills"); const skillsDiv=document.getElementById("skills");
  
 skills.forEach((s,i)=>{ skills.forEach((s,i)=>{
- 
     const label=document.createElement("label");     const label=document.createElement("label");
 +    const cb=document.createElement("input");
  
-    const cb=document.createElement("input"); 
     cb.type="checkbox";     cb.type="checkbox";
     cb.id="skill_"+i;     cb.id="skill_"+i;
- 
     cb.addEventListener("change",calculate);     cb.addEventListener("change",calculate);
  
-    label.appendChild(cb); +    label.append( 
-    label.appendChild(+        cb,
         document.createTextNode(" "+s.name+" — "+s.desc)         document.createTextNode(" "+s.name+" — "+s.desc)
     );     );
  
-    skillsDiv.appendChild(label); +    skillsDiv.append(label,document.createElement("br"));
-    skillsDiv.appendChild(document.createElement("br"));+
 }); });
  
- +/* SORTS */
-/* ========================================================= +
-   SORTS +
-========================================================= */+
  
 const spellsDiv=document.getElementById("spells"); const spellsDiv=document.getElementById("spells");
  
 spells.forEach((s,i)=>{ spells.forEach((s,i)=>{
- 
     const label=document.createElement("label");     const label=document.createElement("label");
 +    const cb=document.createElement("input");
  
-    const cb=document.createElement("input"); 
     cb.type="checkbox";     cb.type="checkbox";
     cb.id="spell_"+i;     cb.id="spell_"+i;
- 
     cb.addEventListener("change",calculate);     cb.addEventListener("change",calculate);
  
-    label.appendChild(cb); +    label.append( 
-    label.appendChild(+        cb,
         document.createTextNode(         document.createTextNode(
-            " "+s.name+ +            " "+s.name+" (Dex "+s.dex+", Prot "+s.prot+")"
-            " (Dex "+s.dex+", Prot "+s.prot+")"+
         )         )
     );     );
  
-    spellsDiv.appendChild(label); +    spellsDiv.append(label,document.createElement("br"));
-    spellsDiv.appendChild(document.createElement("br"));+
 }); });
- 
  
 /* ========================================================= /* =========================================================
    EQUIPEMENTS    EQUIPEMENTS
 ========================================================= */ ========================================================= */
- 
-const head=document.getElementById("head"); 
-const cape=document.getElementById("cape"); 
-const rightHand=document.getElementById("rightHand"); 
-const leftHand=document.getElementById("leftHand"); 
-const body=document.getElementById("body"); 
-const ring=document.getElementById("ring"); 
-const feet=document.getElementById("feet"); 
  
 const slots = { const slots = {
 +    head:document.getElementById("head"),
 +    cape:document.getElementById("cape"),
 +    rightHand:document.getElementById("rightHand"),
 +    leftHand:document.getElementById("leftHand"),
 +    body:document.getElementById("body"),
 +    ring:document.getElementById("ring"),
 +    feet:document.getElementById("feet")
 +};
  
-    head:head, +const statIds = { 
-    cape:cape, +    head:"headStats", 
-    rightHand:rightHand, +    cape:"capeStats", 
-    leftHand:leftHand, +    rightHand:"rightStats", 
-    body:body, +    leftHand:"leftStats", 
-    ring:ring, +    body:"bodyStats", 
-    feet:feet +    ring:"ringStats", 
 +    feet:"feetStats"
 }; };
  
 +/* COMPATIBILITE EXOTIQUE */
  
-/* ========================================================= +function canEquip(item,race){
-   REGLE D'EQUIPEMENT +
-=========================================================+
  
-Normal : +    if(!item.exo){ 
-    toutes les races+        return true; 
 +    }
  
-Exo : +    const aliases = { 
-    uniquement la race propriétaire +        "Olympiens":"Olympien", 
-*/+        "Elfes":"Elfe", 
 +        "Nains":"Nain", 
 +        "Géants":"Géant" 
 +    };
  
-function canEquip(e,race){+    const owner=aliases[item.race]||item.race;
  
-    if(e.exo === true){ +    return owner===race;
-        return e.race === race; +
-    } +
- +
-    return true;+
 } }
  
- +/* REMPLISSAGE */
-/* ========================================================= +
-   REMPLISSAGE DES EQUIPEMENTS +
-========================================================= */+
  
 function fillEquip(){ function fillEquip(){
Ligne 1296: Ligne 1109:
  
         const select=slots[key];         const select=slots[key];
- 
         select.innerHTML="";         select.innerHTML="";
  
Ligne 1304: Ligne 1116:
         select.appendChild(empty);         select.appendChild(empty);
  
-        equipments +        const available=equipments 
-            .filter(e => e.slot===key) +            .filter(e=>e.slot===key) 
-            .filter(e => canEquip(e,race)) +            .filter(e=>canEquip(e,race)) 
-            .forEach(e=>{+            .sort((a,b)=> 
 +                a.name.localeCompare( 
 +                    b.name, 
 +                    "fr", 
 +                    {sensitivity:"base"} 
 +                ) 
 +            );
  
-                const o=document.createElement("option");+        available.forEach(item=>{
  
-                o.value=equipments.indexOf(e);+            const option=document.createElement("option");
  
-                o.textContent= +            option.value=String(equipments.indexOf(item));
-                    e.name + +
-                    (e.exo ? " (exo)" : "");+
  
-                select.appendChild(o); +            /* Le titre reste uniquement le nom de l'objet */ 
-            });+            option.textContent= 
 +                item.name+ 
 +                (item.exo?" (exo)":"");
  
- select.onchange=()=>{ +            select.appendChild(option); 
- +        });
- const statIds = { +
- head:"headStats", +
- cape:"capeStats", +
- rightHand:"rightStats", +
- leftHand:"leftStats", +
- body:"bodyStats", +
- ring:"ringStats", +
- feet:"feetStats" +
- };+
  
- displayStats(select,statIds[key]);+        select.onchange=()=>{
  
- checkLimit(key); +            checkLimit(key); 
- calculate(); +            displayAllEquipStats(); 
- };+            calculate(); 
 +        };
     }     }
  
Ligne 1344: Ligne 1154:
 } }
  
 +/* AFFICHAGE DES BONUS */
  
-/* ========================================================= +const statNames = { 
-   AFFICHAGE DES CARACTERISTIQUES +    a:"A",f:"F",e:"E",agi:"Agi", 
-========================================================= */ +    cc:"CC",ct:"CT",fm:"FM",mvt:"Mvt", 
- +    pv:"PV",pm:"PM",r:"R",res:"Rés", 
-const statNames={ +    rm:"RM",p:"P",pui:"Pui",fPui:"F=Pui",
- +
-    f:"F", +
-    e:"E", +
- +
-    agi:"Agi", +
- +
-    cc:"CC", +
-    ct:"CT", +
-    fm:"FM", +
- +
-    mvt:"Mvt", +
- +
-    pv:"PV", +
-    pm:"PM", +
- +
-    r:"R", +
-    res:"Rés", +
-    rm:"RM", +
- +
-    p:"P", +
-    pui:"Pui", +
     esquive:"Esquive",     esquive:"Esquive",
- 
     demolition:"Démolition",     demolition:"Démolition",
- 
     magique:"Magique",     magique:"Magique",
     feu:"Feu"     feu:"Feu"
 }; };
- 
  
 function displayStats(select,id){ function displayStats(select,id){
Ligne 1385: Ligne 1171:
     const el=document.getElementById(id);     const el=document.getElementById(id);
  
-    if(!el){ +    if(!el) return;
-        return; +
-    } +
- +
-    const index=select.value;+
  
-    if(index===""){+    if(select.value===""){
         el.innerHTML="";         el.innerHTML="";
         return;         return;
     }     }
  
-    const e=equipments[Number(index)];+    const item=equipments[Number(select.value)];
  
-    if(!e){+    if(!item){
         el.innerHTML="";         el.innerHTML="";
         return;         return;
Ligne 1405: Ligne 1187:
     let html="";     let html="";
  
-    for(const [stat,value] of Object.entries(e.stats || {})){+    /* Bonus et malus */
  
-        const name=statNames[stat] || stat;+    for(const [stat,value] of Object.entries(item.stats||{})){ 
 + 
 +        const name=statNames[stat]||stat;
  
-        /* Booléens : Magique / Feu */ 
         if(value===true){         if(value===true){
- +            html+=`<span class="special">${name}</span> `;
-            html += +
-                `<span class="special">${name}</span> `; +
             continue;             continue;
         }         }
  
-        if(value===false || value===0){+        if(typeof value!=="number"||value===0){
             continue;             continue;
         }         }
  
         if(value>0){         if(value>0){
- +            html+=`<span class="bonus">+${value} ${name}</span> `;
-            html += +
-                `<span class="bonus">+${value} ${name}</span> `; +
         }else{         }else{
- +            html+=`<span class="malus">${value} ${name}</span> `;
-            html += +
-                `<span class="malus">${value} ${name}</span> `; +
         }         }
 +    }
 +
 +    /* Magie interdite : toujours après les bonus/malus */
 +    if(magieInterdite.has(item.name)){
 +        html += `<span class="forbiddenMagic">Magie interdite</span> `;
     }     }
  
     el.innerHTML=html;     el.innerHTML=html;
 } }
- 
  
 function displayAllEquipStats(){ function displayAllEquipStats(){
  
-    displayStats(head,"headStats"); +    for(const key in slots){ 
-    displayStats(cape,"capeStats"); +        displayStats(slots[key],statIds[key]); 
-    displayStats(rightHand,"rightStats"); +    }
-    displayStats(leftHand,"leftStats"); +
-    displayStats(body,"bodyStats"); +
-    displayStats(ring,"ringStats"); +
-    displayStats(feet,"feetStats");+
 } }
- 
  
 /* ========================================================= /* =========================================================
-   LIMITE 3 EQUIPEMENTS + 1 ANNEAU+   LIMITE : 3 EQUIPEMENTS + 1 ANNEAU
 ========================================================= */ ========================================================= */
  
-function checkLimit(changedSlot = null){+function checkLimit(changedSlot=null){
  
-    let count = 0;+    const warn=document.getElementById("limitWarn");
  
-    for(const key in slots){+    const count=Object.keys(slots) 
 +        .filter(key=>key!=="ring") 
 +        .filter(key=>slots[key].value!=="") 
 +        .length;
  
-        if(key === "ring"){ +    if(count>3){
-            continue; +
-        }+
  
-        if(slots[key].value !== ""){ +        if(changedSlot&&changedSlot!=="ring"){
-            count++; +
-        } +
-    }+
  
-    const warn = document.getElementById("limitWarn");+            slots[changedSlot].value="";
  
-    if(count > 3){ 
- 
-        // Si un équipement vient d'être ajouté, 
-        // on le retire immédiatement 
-        if(changedSlot && changedSlot !== "ring"){ 
-            slots[changedSlot].value = ""; 
             displayStats(             displayStats(
                 slots[changedSlot],                 slots[changedSlot],
-                changedSlot + "Stats"+                statIds[changedSlot]
             );             );
         }         }
  
-        count--;+        warn.textContent= 
 +            "⚠️ Maximum 3 équipements hors anneau. L'anneau est un emplacement supplémentaire.";
  
-        warn.textContent = +        return false; 
-            "⚠️ Maximum 3 équipements hors anneau.";+    }
  
-    }else{ +    warn.textContent=""; 
- +    return true;
-        warn.textContent = ""; +
-    }+
 } }
- 
- 
-/* ========================================================= 
-   RESET DES EQUIPEMENTS 
-========================================================= */ 
  
 function resetSlots(){ function resetSlots(){
  
     for(const key in slots){     for(const key in slots){
- 
         slots[key].value="";         slots[key].value="";
     }     }
Ligne 1510: Ligne 1268:
     checkLimit();     checkLimit();
 } }
- 
  
 /* ========================================================= /* =========================================================
Ligne 1520: Ligne 1277:
     const r=races[raceSelect.value];     const r=races[raceSelect.value];
  
-    document.getElementById("baseStats").textContent = +    let text=""; 
-        JSON.stringify(r,null,2); + 
-}+    statOrder.forEach(stat=>{
  
 +        if(r[stat]!==undefined){
 +
 +            text+=(statLabels[stat]||stat)+": "+r[stat]+"\n";
 +        }
 +    });
 +
 +    document.getElementById("baseStats").textContent=text.trim();
 +}
  
 /* ========================================================= /* =========================================================
-   CALCUL DU COUT+   COUT
 ========================================================= */ ========================================================= */
  
Ligne 1537: Ligne 1302:
         const input=document.getElementById("up_"+stat);         const input=document.getElementById("up_"+stat);
  
-        if(!input){ +        if(!input) continue;
-            continue; +
-        }+
  
-        let level=parseInt(input.value)||0;+        const level=Math.max( 
 +            0, 
 +            parseInt(input.value,10)||0 
 +        );
  
-        const costs=costTable[stat];+        if(!level) continue;
  
-        for(let i=0;i<level;i++){+        const [B,M1,M2]=costTable[stat];
  
-            total += +        for(let n=1;n<=level;n++){ 
-                costs[Math.min(i,costs.length-1)];+ 
 +            let cost; 
 + 
 +            if(n===1){ 
 +                cost=B; 
 +            }else if(n===2){ 
 +                cost=B+M1; 
 +            }else if(n===3){ 
 +                cost=B+2*M1; 
 +            }else{ 
 +                cost=B+2*M1+(n-3)*M2; 
 +            } 
 + 
 +            total+=cost;
         }         }
     }     }
Ligne 1554: Ligne 1333:
     return total;     return total;
 } }
- 
  
 function updateCost(){ function updateCost(){
  
-    document.getElementById("cost").textContent =+    document.getElementById("cost").textContent=
         "Coût total : "+calcCost();         "Coût total : "+calcCost();
 } }
  
 +/* =========================================================
 +   LECTURE DES PASSIFS
 +========================================================= */
 +
 +function isChecked(index){
 +
 +    const cb=document.getElementById("skill_"+index);
 +
 +    return cb?cb.checked:false;
 +}
  
 /* ========================================================= /* =========================================================
-   CALCUL+   CALCUL DU PERSONNAGE
 ========================================================= */ ========================================================= */
  
Ligne 1571: Ligne 1359:
     const race=races[raceSelect.value];     const race=races[raceSelect.value];
  
-    if(!race){ +    if(!race) return;
-        return; +
-    }+
  
     updateCost();     updateCost();
     displayBase();     displayBase();
  
-    /* +    const char={...race};
-       Copie des stats raciales +
-    */+
  
-    const char={}; +    /* Améliorations */
- +
-    for(const stat in race){ +
- +
-        char[stat]=race[stat]; +
-    } +
- +
- +
-    /* +
-       Ajout des améliorations +
-    */+
  
     for(const stat in costTable){     for(const stat in costTable){
Ligne 1600: Ligne 1374:
         if(input){         if(input){
  
-            char[stat] = +            char[stat]= 
-                (char[stat]||0) + +                (char[stat]||0)+ 
-                (parseInt(input.value)||0);+                (parseInt(input.value,10)||0);
         }         }
     }     }
  
 +    /* Equipements */
  
-    /* +    let forcePui=false;
-       Ajout équipement +
-    */+
  
     for(const key in slots){     for(const key in slots){
  
-        const index=slots[key].value;+        const value=slots[key].value;
  
-        if(index===""){ +        if(value==="") continue;
-            continue; +
-        }+
  
-        const e=equipments[Number(index)];+        const item=equipments[Number(value)];
  
-        if(!e){ +        if(!item) continue;
-            continue; +
-        }+
  
-        for(const [stat,value] of Object.entries(e.stats||{})){+        for(const [stat,bonus] of Object.entries(item.stats||{})){
  
-            if(typeof value==="number"){+            if(stat==="fPui" && bonus===true){ 
 +                forcePui=true; 
 +                continue; 
 +            }
  
-                char[stat]=(char[stat]||0)+value;+            if(typeof bonus==="number"){ 
 +                char[stat]=(char[stat]||0)+bonus;
             }             }
         }         }
     }     }
  
 +    /* F=Pui */
 +
 +    if(forcePui){
 +        char.f=char.pui;
 +    }
 +
 +    /* Passifs */
 +
 +    const fulgurance=isChecked(0);
 +    const couverture=isChecked(1);
 +    const reflexes=isChecked(2);
 +    const griffes=isChecked(4);
 +
 +    /* Griffes : mains nues, Ceste ou Mains de mana */
 +
 +    const mainDroite = rightHand.value === ""
 +    ? null
 +    : equipments[Number(rightHand.value)];
 +
 +const griffesActives =
 +    griffes &&
 +    (
 +        !mainDroite ||
 +        mainDroite.name === "Ceste" ||
 +        mainDroite.name === "Mains de mana"
 +    );
 +
 +if(griffesActives){
 +    if(race === "HS" && mainDroite && mainDroite.name === "Mains de mana"){
 +        char.f = char.pui + 3;
 +    }else{
 +        char.f += 3;
 +    }
 +}
  
-    /* +    /* Sorts : bonus de plus grande valeur absolue */
-       Sorts actifs +
-    */+
  
     let bestDex=0;     let bestDex=0;
     let bestProt=0;     let bestProt=0;
  
-    let spellDetails=[];+    const spellDetails=[];
  
-    spells.forEach((s,i)=>{+    spells.forEach((spell,i)=>{
  
         const cb=document.getElementById("spell_"+i);         const cb=document.getElementById("spell_"+i);
  
-        if(cb && cb.checked){+        if(!cb||!cb.checked) return;
  
-            bestDex=Math.max(bestDex,s.dex); +        if(Math.abs(spell.dex)>Math.abs(bestDex)){ 
-            bestProt=Math.max(bestProt,s.prot);+            bestDex=spell.dex; 
 +        }
  
-            spellDetails.push(s.name);+        if(Math.abs(spell.prot)>Math.abs(bestProt)){ 
 +            bestProt=spell.prot;
         }         }
 +
 +        spellDetails.push(spell.name);
     });     });
  
- +    document.getElementById("spellBonus").textContent=
-    document.getElementById("spellBonus").textContent =+
         spellDetails.length         spellDetails.length
-        ? +        ? "Sorts actifs : "+spellDetails.join(", ")+ 
-        "Sorts actifs : "+spellDetails.join(", ")+ +          " | Bonus Dex : "+bestDex+ 
-        " | Bonus Dex : "+bestDex+ +          " | Protection : "+bestProt 
-        " | Protection : "+bestProt +        : "";
-        : +
-        ""; +
  
-    /* +    /* Dés */
-       Dés de caractéristiques +
-    */+
  
     const ccDice=char.cc*2;     const ccDice=char.cc*2;
Ligne 1677: Ligne 1480:
     const agiDice=char.agi*2;     const agiDice=char.agi*2;
  
 +    /* Fiche personnage */
  
-    /* +    let result="=== PERSONNAGE ===\n\n";
-       Résultats principaux +
-    */+
  
-    let result="";+    statOrder.forEach(stat=>{
  
 +        if(char[stat]!==undefined){
  
-    result += +            result+= 
-        "=== PERSONNAGE ===\n\n";+                (statLabels[stat]||stat)+ 
 +                ": "+char[stat]+"\n"; 
 +        } 
 +    });
  
-    result += +    if(griffes){
-        "Force : "+char.f+"\n";+
  
-    result += +        result+=griffesActives 
-        "Endurance : "+char.e+"\n";+            ? "\nGriffes : +3 F appliqué." 
 +            : "\nGriffes : inactif (arme autre que ceste ou mains de mana)."; 
 +    }
  
-    result += +    result+="\n\n=== COMBAT ===\n\n";
-        "Agilité : "+char.agi+"\n";+
  
-    result += +    /* Touchers */
-        "CC : "+char.cc+"\n";+
  
-    result += +    const finalCC= 
-        "CT : "+char.ct+"\n";+        ccDice+bestDex+(fulgurance?1:0);
  
-    result += +    const finalCT= 
-        "FM : "+char.fm+"\n";+        ctDice+bestDex;
  
-    result += +    const finalFM= 
-        "PV : "+char.pv+"\n";+        fmDice+bestDex;
  
-    result += +    result+="Toucher CAC : "+finalCC+"\n"; 
-        "PM : "+char.pm+"\n";+    result+="Toucher tir : "+finalCT+"\n"; 
 +    result+="FM : "+finalFM+"\n";
  
-    result += +    /* Tir par distance */
-        "Mvt : "+char.mvt+"\n";+
  
-    result += +    result+="\n=== TIR ===\n\n";
-        "R : "+char.r+"\n"; +
- +
-    result += +
-        "Rés : "+char.res+"\n"; +
- +
-    result += +
-        "RM : "+char.rm+"\n"; +
- +
-    result += +
-        "P : "+char.p+"\n"; +
- +
-    result += +
-        "Pui : "+char.pui+"\n"; +
- +
- +
-    result += +
-        "\n=== COMBAT ===\n\n"; +
- +
- +
-    /* +
-       CC / CT / FM +
-    */ +
- +
-    const finalCC=ccDice+bestDex; +
-    const finalCT=ctDice+bestDex; +
-    const finalFM=fmDice+bestDex; +
- +
- +
-    result += +
-        "Toucher CAC : "+finalCC+"\n"; +
- +
-    result += +
-        "Toucher tir : "+finalCT+"\n"; +
- +
-    result += +
-        "FM : "+finalFM+"\n"; +
- +
- +
-    /* +
-       Tir selon distance +
-    */ +
- +
-    result += +
-        "\n=== TIR ===\n\n";+
  
     for(let cases=1;cases<=4;cases++){     for(let cases=1;cases<=4;cases++){
Ligne 1766: Ligne 1527:
  
         if(cases>2){         if(cases>2){
- +            ctDistance-=(cases-2)*3;
-            ctDistance -= +
-                (cases-2)*3;+
         }         }
  
-        result += +        result+= 
-            cases+" case(s) : CT "+ctDistance+"\n";+            cases+ 
 +            " case(s) : CT "+ 
 +            ctDistance+ 
 +            "\n";
     }     }
  
 +    /* Esquive CAC */
  
-    /* +    const meleeDodge=
-       Esquive CAC +
-    */ +
- +
-    let meleeDodge=+
         Math.max(ccDice,agiDice)+bestProt;         Math.max(ccDice,agiDice)+bestProt;
  
 +    result+="\n=== ESQUIVE CAC ===\n\n";
 +    result+="Esquive : "+meleeDodge+"\n";
  
-    /* +    /* Esquive tir */
-       Fulgurance +
-    */+
  
-    const fulg=document.getElementById("skill_0");+    let evadeStat;
  
-    if(fulg && fulg.checked){+    if(couverture){
  
-        meleeDodge += 1; +        evadeStat=Math.floor( 
-    }+            char.cc*0.85+char.agi*0.15 
 +        );
  
 +    }else if(reflexes){
  
-    result += +        evadeStat=Math.floor( 
-        "\n=== ESQUIVE CAC ===\n\n";+            char.agi*0.85+char.cc*0.15 
 +        );
  
-    result += +    }else{
-        "Esquive : "+meleeDodge+"\n";+
  
- +        evadeStat=Math.max(
-    /* +
-       Esquive tir +
-    */ +
- +
-    let rangedDodge; +
- +
-    const couverture= +
-        document.getElementById("skill_1"); +
- +
-    const reflexes= +
-        document.getElementById("skill_2"); +
- +
-    if(couverture && couverture.checked){ +
- +
-        rangedDodge=+
             Math.floor(             Math.floor(
-                (ccDice*0.85)+(agiDice*0.15) +                char.cc*0.75+ 
-            ); +                char.agi*0.25 
- +            ),
-    }else if(reflexes && reflexes.checked){ +
- +
-        rangedDodge=+
             Math.floor(             Math.floor(
-                (agiDice*0.85)+(ccDice*0.15) +                char.agi*0.75+ 
-            ); +                char.cc*0.25 
- +            ) 
-    }else{ +        );
- +
-        rangedDodge= +
-            Math.floor( +
-                (ccDice+agiDice)/2 +
-            );+
     }     }
  
-    rangedDodge += bestProt;+    const fulguranceDodge= 
 +        fulgurance? 
 +        Math.floor(char.mvt/5): 
 +        0;
  
-    result += +    const rangedDodge= 
-        "\n=== ESQUIVE TIR ===\n\n";+        evadeStat*2+ 
 +        bestProt+ 
 +        fulguranceDodge;
  
-    result += +    result+="\n=== ESQUIVE TIR ===\n\n"; 
-        "Esquive : "+rangedDodge+"\n";+    result+="Esquive tir : "+rangedDodge+"\n";
  
 +    /* Esquive FM */
  
-    /* +    const fmDodge= 
-       Esquive magie +        fmDice+ 
-    */+        bestProt;
  
-    const magicDodge= +    result+="\n=== ESQUIVE FM ===\n\n"; 
-        fmDice+bestProt;+    result+="Esquive FM : "+fmDodge+"\n";
  
-    result += +    /* Magie */
-        "\n=== ESQUIVE MAGIQUE ===\n\n";+
  
-    result += +    result+="\n=== MAGIE ===\n\n"; 
-        "FM défensive : "+magicDodge+"\n";+    result+="Jet FM : "+finalFM+"\n";
  
 +    for(let lvl=1;lvl<=5;lvl++){
  
-    /* +        const threshold=6+6*lvl;
-       Seuils magie +
-    */+
  
-    const magicLevels=[ +        result+= 
-        12, +            "Sort niveau "+ 
-        18, +            lvl+ 
-        24, +            " (seuil "+ 
-        30, +            threshold+ 
-        36 +            ") : "+ 
-    ]; +            ( 
- +                finalFM>=threshold 
-    result += +                ?"Réussi" 
-        "\n=== SEUILS MAGIE ===\n\n"; +                :"Échec" 
- +            )+
-    magicLevels.forEach((threshold,i)=>{ +
- +
-        result += +
-            "Niveau "+(i+1)+ +
-            " : "+threshold+ +
-            " → "+ +
-            (finalFM>=threshold ? "OK" : "NON")++
             "\n";             "\n";
-    }); +    }
  
     document.getElementById("result").textContent=result;     document.getElementById("result").textContent=result;
- 
-    calculatePush(); 
 } }
- 
  
 /* ========================================================= /* =========================================================
-   POUSSEE+   SIMULATEUR DE POUSSEE 
 +   FORMULE CONSERVEE
 ========================================================= */ ========================================================= */
  
 function calculatePush(){ function calculatePush(){
  
-    const F= +    const F=parseInt( 
-        parseInt( +        document.getElementById("pushF").value, 
-            document.getElementById("pushF").value +        10 
-        )||0;+    )||0;
  
-    const buff= +    const E=parseInt( 
-        parseInt( +        document.getElementById("pushE").value, 
-            document.getElementById("pushBuff").value +        10 
-        )||0;+    )||0;
  
-    const E= +    const Agi=parseInt( 
-        parseInt( +        document.getElementById("pushAgi").value, 
-            document.getElementById("pushE").value +        10 
-        )||0;+    )||0;
  
-    const agi= +    const PV=parseInt( 
-        parseInt( +        document.getElementById("pushPV").value, 
-            document.getElementById("pushAgi").value +        10 
-        )||0;+    )||0;
  
-    const pv= +    const buff=parseInt( 
-        parseInt( +        document.getElementById("pushBuff").value, 
-            document.getElementById("pushPV").value +        10 
-        )||0;+    )||0;
  
-    const instability= +    const debuff=parseInt( 
-        parseInt( +        document.getElementById("pushDebuff").value, 
-            document.getElementById("pushDebuff").value +        10 
-        )||0;+    )||0;
  
-    const stability= +    const stab=parseInt( 
-        parseInt( +        document.getElementById("pushStab").value, 
-            document.getElementById("pushStab").value +        10 
-        )||0;+    )||0;
  
 +    const finalF=
 +        F+
 +        buff+
 +        debuff+
 +        stab;
  
-    const attaque= +    const score= 
-        F+buff;+        finalF+ 
 +        E+ 
 +        Agi;
  
-    const defense= +    document.getElementById("pushResult").textContent= 
-        Math.max(E+4,agi) +        "Force finale : "+finalF+ 
-        +(pv/10) +        "\nEndurance : "+E+ 
-        +instability +        "\nAgilité : "+Agi+ 
-        +stability; +        "\nPV actuels : "+PV+ 
- +        "\n\nScore : "+score;
- +
-    const result= +
-        "Attaque : "+attaque+ +
-        "\nDéfense : "+defense; +
- +
- +
-    document.getElementById("pushResult").textContent=result;+
 } }
  
- +/* EVENEMENTS POUSSEE */
-/* ========================================================= +
-   EVENEMENTS POUSSEE +
-========================================================= */+
  
 [ [
Ligne 1967: Ligne 1696:
 ].forEach(id=>{ ].forEach(id=>{
  
-    document.getElementById(id) +    const el=document.getElementById(id);
-        .addEventListener("input",calculatePush);+
  
-    document.getElementById(id) +    el.addEventListener("input",calculatePush); 
-        .addEventListener("change",calculatePush);+    el.addEventListener("change",calculatePush);
 }); });
- 
  
 /* ========================================================= /* =========================================================
-   RESET COMPLET+   RESET GENERAL
 ========================================================= */ ========================================================= */
  
Ligne 1983: Ligne 1710:
     raceSelect.selectedIndex=0;     raceSelect.selectedIndex=0;
  
-    for(const stat in costTable){+    statOrder.forEach(stat=>{
  
         const input=document.getElementById("up_"+stat);         const input=document.getElementById("up_"+stat);
Ligne 1990: Ligne 1717:
             input.value=0;             input.value=0;
         }         }
-    }+    });
  
 +    resetSlots();
 +
 +    skills.forEach((s,i)=>{
 +
 +        const cb=document.getElementById("skill_"+i);
  
-    document +        if(cb){
-        .querySelectorAll( +
-            '#skills input[type="checkbox"], #spells input[type="checkbox"]' +
-        ) +
-        .forEach(cb=>{+
             cb.checked=false;             cb.checked=false;
-        });+        } 
 +    });
  
 +    spells.forEach((s,i)=>{
  
-    resetSlots();+        const cb=document.getElementById("spell_"+i);
  
-    fillEquip();+        if(cb){ 
 +            cb.checked=false; 
 +        } 
 +    });
  
 +    document.getElementById("pushF").value=10;
 +    document.getElementById("pushBuff").value=0;
 +    document.getElementById("pushE").value=5;
 +    document.getElementById("pushAgi").value=5;
 +    document.getElementById("pushPV").value=50;
 +    document.getElementById("pushDebuff").value=0;
 +    document.getElementById("pushStab").value=0;
 +
 +    fillEquip();
     calculate();     calculate();
 +    calculatePush();
 } }
- 
  
 /* ========================================================= /* =========================================================
-   EXPORT+   EXPORT / IMPORT / PARTAGE
 ========================================================= */ ========================================================= */
  
-function exportBuild(){+function getBuildData(){
  
-    const build={};+    const data={ 
 +        race:raceSelect.value, 
 +        upgrades:{}, 
 +        equipment:{}, 
 +        skills:[], 
 +        spells:[] 
 +    };
  
-    build.race=raceSelect.value;+    statOrder.forEach(stat=>{
  
-    build.stats={};+        const input=document.getElementById("up_"+stat);
  
-    for(const stat in costTable){ +        if(input){ 
- +            data.upgrades[stat]= 
-        build.stats[stat]= +                parseInt(input.value,10)||0; 
-            parseInt( +        } 
-                document.getElementById("up_"+stat).value +    });
-            )||0; +
-    } +
- +
- +
-    build.equipment={};+
  
     for(const key in slots){     for(const key in slots){
- +        data.equipment[key]=slots[key].value;
-        build.equipment[key]= +
-            slots[key].value;+
     }     }
- 
- 
-    build.skills=[]; 
  
     skills.forEach((s,i)=>{     skills.forEach((s,i)=>{
Ligne 2046: Ligne 1784:
         const cb=document.getElementById("skill_"+i);         const cb=document.getElementById("skill_"+i);
  
-        if(cb.checked){ +        if(cb&&cb.checked){ 
-            build.skills.push(s.name);+            data.skills.push(i);
         }         }
     });     });
- 
- 
-    build.spells=[]; 
  
     spells.forEach((s,i)=>{     spells.forEach((s,i)=>{
Ligne 2058: Ligne 1793:
         const cb=document.getElementById("spell_"+i);         const cb=document.getElementById("spell_"+i);
  
-        if(cb.checked){ +        if(cb&&cb.checked){ 
- +            data.spells.push(i);
-            build.spells.push({ +
-                dex:s.dex, +
-                prot:s.prot +
-            });+
         }         }
     });     });
  
- +    return data;
-    const text= +
-        JSON.stringify(build,null,2); +
- +
- +
-    prompt( +
-        "Copie ton build :", +
-        text +
-    );+
 } }
  
 +function applyBuildData(data){
  
-/* ========================================================= +    if(data.race&&races[data.race]){ 
-   IMPORT +        raceSelect.value=data.race;
-========================================================= */ +
- +
-function importBuild(){ +
- +
-    const text= +
-        prompt("Colle ton build :"); +
- +
-    if(!text){ +
-        return;+
     }     }
  
 +    if(data.upgrades){
  
-    try{+        statOrder.forEach(stat=>{
  
-        const build= +            const input=document.getElementById("up_"+stat);
-            JSON.parse(text);+
  
- +            if( 
-        /* +                input&& 
-           Race +                data.upgrades[stat]!==undefined 
-        */ +            ){ 
- +                input.value=data.upgrades[stat];
-        if(build.race && races[build.race]){ +
- +
-            raceSelect.value=build.race; +
-        } +
- +
- +
-        /* +
-           Stats +
-        */ +
- +
-        if(build.stats){ +
- +
-            for(const stat in build.stats){ +
- +
-                const input= +
-                    document.getElementById("up_"+stat); +
- +
-                if(input){ +
- +
-                    input.value= +
-                        build.stats[stat]; +
-                }+
             }             }
-        }+        }); 
 +    }
  
 +    fillEquip();
  
-        /* +    if(data.equipment){
-           Recrée les listes d'équipements +
-        */+
  
-        fillEquip();+        for(const key in slots){
  
- +            if(data.equipment[key]!==undefined){
-        /* +
-           Equipements +
- +
-           On essaye d'abord de retrouver +
-           l'équipement par son index. +
-        */ +
- +
-        if(build.equipment){ +
- +
-            for(const key in build.equipment){ +
- +
-                if(!slots[key]){ +
-                    continue; +
-                }+
  
                 const wanted=                 const wanted=
-                    build.equipment[key];+                    String(data.equipment[key]);
  
-                if(wanted==="" || wanted===null){ +                const exists= 
-                    continue; +                    [...slots[key].options] 
-                } +                    .some( 
- +                        option=> 
-                /* +                            option.value===wanted 
-                   Ancien format : index +                    );
-                */ +
- +
-                if( +
-                    equipments[wanted] && +
-                    canEquip( +
-                        equipments[wanted], +
-                        raceSelect.value +
-                    ) +
-                ){+
  
 +                if(exists){
                     slots[key].value=wanted;                     slots[key].value=wanted;
-                    continue; 
-                } 
- 
- 
-                /* 
-                   Nouveau format éventuel : 
-                   nom de l'objet 
-                */ 
- 
-                const found= 
-                    equipments.findIndex(e => 
-                        e.name===wanted && 
-                        e.slot===key && 
-                        canEquip( 
-                            e, 
-                            raceSelect.value 
-                        ) 
-                    ); 
- 
-                if(found>=0){ 
- 
-                    slots[key].value=found; 
                 }                 }
             }             }
         }         }
 +    }
  
 +    skills.forEach((s,i)=>{
  
-        /* +        const cb=document.getElementById("skill_"+i);
-           Passifs +
-        */+
  
-        document +        if(cb){ 
-            .querySelectorAll( +            cb.checked= 
-                '#skills input[type="checkbox"]' +                Array.isArray(data.skills)&& 
-            ) +                data.skills.includes(i); 
-            .forEach(cb=>{ +        } 
-                cb.checked=false; +    });
-            });+
  
 +    spells.forEach((s,i)=>{
  
-        if(Array.isArray(build.skills)){+        const cb=document.getElementById("spell_"+i);
  
-            build.skills.forEach(name=>{ +        if(cb){ 
- +            cb.checked= 
-                const index= +                Array.isArray(data.spells)&& 
-                    skills.findIndex( +                data.spells.includes(i);
-                        s=>s.name===name +
-                    ); +
- +
-                if(index>=0){ +
- +
-                    document.getElementById( +
-                        "skill_"+index +
-                    ).checked=true; +
-                } +
-            });+
         }         }
 +    });
  
 +    /* Corrige les configurations importées dépassant la limite */
  
-        /* +    let count=0;
-           Sorts +
-        */+
  
-        document +    for(const key of [ 
-            .querySelectorAll( +        "head", 
-                '#spells input[type="checkbox"]' +        "cape", 
-            ) +        "rightHand", 
-            .forEach(cb=>{ +        "leftHand", 
-                cb.checked=false; +        "body", 
-            });+        "feet" 
 +    ]){
  
 +        if(slots[key].value!==""){
  
-        if(Array.isArray(build.spells)){+            count++;
  
-            build.spells.forEach(spell=>{ +            if(count>3){ 
- +                slots[key].value=""; 
-                const index= +            }
-                    spells.findIndex( +
-                        s => +
-                            s.dex===spell.dex && +
-                            s.prot===spell.prot +
-                    ); +
- +
-                if(index>=0){ +
- +
-                    document.getElementById( +
-                        "spell_"+index +
-                    ).checked=true; +
-                } +
-            });+
         }         }
 +    }
  
 +    displayAllEquipStats();
 +    checkLimit();
 +    calculate();
 +}
  
-        displayAllEquipStats(); +function exportBuild(){
-        checkLimit(); +
-        calculate();+
  
 +    const encoded=btoa(
 +        encodeURIComponent(
 +            JSON.stringify(getBuildData())
 +        )
 +    );
  
-    }catch(err){ +    prompt( 
- +        "Copiez ce code de configuration :", 
-        alert( +        encoded 
-            "Erreur lors de l'import : "+ +    );
-            err.message +
-        ); +
-    }+
 } }
  
 +function importBuild(){
  
-/* ========================================================= +    const text= 
-   LIEN +        prompt( 
-========================================================= */+            "Collez le code de configuration :" 
 +        );
  
-function copyLink(){+    if(!text) return;
  
-    const build={};+    try{
  
-    build.race=raceSelect.value;+        const data=JSON.parse( 
 +            decodeURIComponent( 
 +                atob(text.trim()) 
 +            ) 
 +        );
  
-    build.stats={};+        applyBuildData(data);
  
-    for(const stat in costTable){+    }catch(e){
  
-        build.stats[stat]= +        console.error("Erreur import :",e); 
-            parseInt( +        alert("Configuration invalide.");
-                document.getElementById("up_"+stat).value +
-            )||0;+
     }     }
 +}
  
 +function copyLink(){
  
-    build.equipment={}; +    const encoded=btoa( 
- +        encodeURIComponent( 
-    for(const key in slots){ +            JSON.stringify(getBuildData()) 
- +        ) 
-        const index=slots[key].value; +    );
- +
-        if(index===""){ +
- +
-            build.equipment[key]=""; +
- +
-        }else{ +
- +
-            /* +
-               On sauvegarde le nom plutôt que l'index. +
-               Cela évite que les liens cassent si +
-               l'ordre des équipements change. +
-            */ +
- +
-            build.equipment[key]= +
-                equipments[Number(index)] +
-                ? equipments[Number(index)].name +
-                : ""; +
-        } +
-    } +
- +
- +
-    build.skills=[]; +
- +
-    skills.forEach((s,i)=>{ +
- +
-        if( +
-            document.getElementById("skill_"+i).checked +
-        ){ +
- +
-            build.skills.push(s.name); +
-        } +
-    }); +
- +
- +
-    build.spells=[]; +
- +
-    spells.forEach((s,i)=>{ +
- +
-        if( +
-            document.getElementById("spell_"+i).checked +
-        ){ +
- +
-            build.spells.push({ +
-                dex:s.dex, +
-                prot:s.prot +
-            }); +
-        } +
-    }); +
- +
- +
-    const encoded= +
-        btoa( +
-            unescape( +
-                encodeURIComponent( +
-                    JSON.stringify(build) +
-                ) +
-            ) +
-        ); +
  
     const url=     const url=
         location.origin+         location.origin+
         location.pathname+         location.pathname+
-        "?build="+ +        "?id=simulateur&build="+ 
-        encodeURIComponent(encoded);+        encoded;
  
 +    if(
 +        navigator.clipboard&&
 +        navigator.clipboard.writeText
 +    ){
  
-    navigator.clipboard.writeText(url) +        navigator.clipboard.writeText(url) 
-        .then(()=>{ +            .then( 
- +                ()=> 
-            alert( +                    alert( 
-                "Lien copié dans le presse-papiers."+                        "Lien copié dans le presse-papiers." 
 +                    ) 
 +            ) 
 +            .catch( 
 +                ()=> 
 +                    prompt( 
 +                        "Copiez ce lien :", 
 +                        url 
 +                    )
             );             );
  
-        }) +    }else{
-        .catch(()=>{+
  
-            prompt( +        prompt( 
-                "Copie ce lien :", +            "Copiez ce lien :", 
-                url +            url 
-            ); +        ); 
-        });+    }
 } }
  
- +function loadFromURL(){
-/* ========================================================= +
-   CHARGEMENT D'UN BUILD DEPUIS L'URL +
-========================================================= */ +
- +
-function loadBuildFromUrl(){+
  
     const params=     const params=
-        new URLSearchParams( +        new URLSearchParams(location.search);
-            location.search +
-        );+
  
     const encoded=     const encoded=
         params.get("build");         params.get("build");
  
-    if(!encoded){ +    if(!encoded) return;
-        return; +
-    } +
  
     try{     try{
  
-        const json=+        const data=JSON.parse(
             decodeURIComponent(             decodeURIComponent(
-                escape( +                atob(encoded) 
-                    atob( +            ) 
-                        decodeURIComponent(encoded) +        );
-                    ) +
-                ) +
-            );+
  
 +        applyBuildData(data);
  
-        const build= +    }catch(e){
-            JSON.parse(json); +
- +
- +
-        if(build.race && races[build.race]){ +
- +
-            raceSelect.value= +
-                build.race; +
-        } +
- +
- +
-        fillEquip(); +
- +
- +
-        /* +
-           Stats +
-        */ +
- +
-        if(build.stats){ +
- +
-            for(const stat in build.stats){ +
- +
-                const input= +
-                    document.getElementById( +
-                        "up_"+stat +
-                    ); +
- +
-                if(input){ +
- +
-                    input.value= +
-                        build.stats[stat]; +
-                } +
-            } +
-        } +
- +
- +
-        /* +
-           Equipements par nom +
-        */ +
- +
-        if(build.equipment){ +
- +
-            for(const key in build.equipment){ +
- +
-                if(!slots[key]){ +
-                    continue; +
-                } +
- +
-                const name= +
-                    build.equipment[key]; +
- +
-                if(!name){ +
-                    continue; +
-                } +
- +
-                const index= +
-                    equipments.findIndex(e => +
-                        e.name===name && +
-                        e.slot===key && +
-                        canEquip( +
-                            e, +
-                            raceSelect.value +
-                        ) +
-                    ); +
- +
-                if(index>=0){ +
- +
-                    slots[key].value= +
-                        index; +
-                } +
-            } +
-        } +
- +
- +
-        /* +
-           Passifs +
-        */ +
- +
-        if(Array.isArray(build.skills)){ +
- +
-            build.skills.forEach(name=>{ +
- +
-                const index= +
-                    skills.findIndex( +
-                        s=>s.name===name +
-                    ); +
- +
-                if(index>=0){ +
- +
-                    document.getElementById( +
-                        "skill_"+index +
-                    ).checked=true; +
-                } +
-            }); +
-        } +
- +
- +
-        /* +
-           Sorts +
-        */ +
- +
-        if(Array.isArray(build.spells)){ +
- +
-            build.spells.forEach(spell=>{ +
- +
-                const index= +
-                    spells.findIndex( +
-                        s => +
-                            s.dex===spell.dex && +
-                            s.prot===spell.prot +
-                    ); +
- +
-                if(index>=0){ +
- +
-                    document.getElementById( +
-                        "spell_"+index +
-                    ).checked=true; +
-                } +
-            }); +
-        } +
- +
- +
-        displayAllEquipStats(); +
-        checkLimit(); +
-        calculate(); +
- +
- +
-    }catch(err){+
  
         console.error(         console.error(
-            "Impossible de charger le build :", +            "Erreur lors du chargement du build :", 
-            err+            e 
 +        ); 
 + 
 +        alert( 
 +            "Impossible de charger la configuration depuis le lien."
         );         );
     }     }
 } }
- 
  
 /* ========================================================= /* =========================================================
Ligne 2562: Ligne 2017:
 ========================================================= */ ========================================================= */
  
-raceSelect.addEventListener( +raceSelect.addEventListener("change",()=>{
-    "change", +
-    ()=>{ +
-        fillEquip(); +
-        displayBase(); +
-        calculate(); +
-    } +
-);+
  
 +    resetSlots();
 +    fillEquip();
 +    calculate();
 +});
  
 /* ========================================================= /* =========================================================
Ligne 2578: Ligne 2030:
 fillEquip(); fillEquip();
 displayBase(); displayBase();
 +calculate();
 calculatePush(); calculatePush();
-loadBuildFromUrl();+loadFromURL();
  
 </script> </script>
simulateur_saison3.1789942931.txt.gz · Dernière modification : 2026/09/21 00:22 de nanaki