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

Prochaine révision
Révision précédente
simulateur_saison3 [2026/09/20 23:54] – créée nanakisimulateur_saison3 [2026/10/12 00:41] (Version actuelle) – nanaki
Ligne 1: Ligne 1:
-Voici un simulateur en version beta, n'hésitez pas à faire vos remarques sur le discord ou le forum. +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; 
-  padding:10px;+    padding:10px; 
 +} 
 + 
 +h1,h2 { color:gold; } 
 +h3 { color:#7dd3fc; } 
 + 
 +.box { 
 +    border:1px solid gold; 
 +    padding:10px; 
 +    margin-bottom:10px; 
 +} 
 + 
 +select { 
 +    margin:3px; 
 +    max-width:220px; 
 +} 
 + 
 +input { 
 +    margin:3px; 
 +    width:65px; 
 +} 
 + 
 +.statLine { 
 +    display:flex; 
 +    justify-content:space-between; 
 +    max-width:260px; 
 +} 
 + 
 +.result { 
 +    background:#000; 
 +    color:#00ffcc; 
 +    padding:10px; 
 +    white-space:pre-wrap; 
 +    overflow-wrap:anywhere; 
 +} 
 + 
 +.small { 
 +    font-size:12px; 
 +    color:#aaa; 
 +} 
 + 
 +.equipStats { 
 +    margin-left:5px; 
 +} 
 + 
 +.bonus,.special { 
 +    color:#00ff00; 
 +} 
 + 
 +.malus { 
 +    color:#ff3333; 
 +} 
 + 
 +/* Magie interdite : rouge uniquement dans les bonus/malus */ 
 +.forbiddenMagic { 
 +    color:#ff3333; 
 +    font-weight:bold; 
 +} 
 + 
 +button { 
 +    margin:4px; 
 +    padding:7px 10px; 
 +    cursor:pointer;
 } }
-h1,h2 { color:gold;} 
-.box { border:1px solid gold; padding:10px; margin-bottom:10px; } 
-select { margin:3px; max-width:150px; } 
-input { margin:3px; width:60px; } 
-.statLine { display:flex; justify-content:space-between; max-width:260px; } 
-.result { background:#000; color:#00ffcc; padding:10px; white-space:pre-wrap; } 
-.small { font-size:12px; color:#aaa; } 
 </style> </style>
 </head> </head>
Ligne 29: Ligne 87:
  
 <div class="box"> <div class="box">
-Race : +    Race : 
-<select id="race"></select> +    <select id="race"></select> 
-<h3>Stats de base</h3> + 
-<pre id="baseStats"></pre>+    <h3>Stats de base</h3> 
 +    <pre id="baseStats"></pre>
 </div> </div>
  
 <div class="box"> <div class="box">
-<h3>Améliorations</h3> +    <h3>Améliorations</h3> 
-<div id="stats"></div> +    <div id="stats"></div> 
-<div id="cost"></div>+    <div id="cost"></div>
 </div> </div>
  
 <div class="box"> <div class="box">
-<h3>Équipement (3 max + 1 anneau)</h3> +    <h3>Équipement (3 max + 1 anneau)</h3> 
-Tête <select id="head"></select> <span id="headStats"></span><br> + 
-Cou <select id="neck"></select> <span id="neckStats"></span><br> +    Tête 
-Dos <select id="cape"></select> <span id="capeStats"></span><br> +    <select id="head"></select> 
-Main droite <select id="rightHand"></select> <span id="rightStats"></span><br> +    <span id="headStats" class="equipStats"></span> 
-Main gauche <select id="leftHand"></select> <span id="leftStats"></span><br> +    <br> 
-Corps <select id="body"></select> <span id="bodyStats"></span><br> + 
-Anneau <select id="ring"></select> <span id="ringStats"></span><br> +    Dos 
-Pieds <select id="feet"></select> <span id="feetStats"></span> +    <select id="cape"></select> 
-<div id="limitWarn" style="color:red;"></div>+    <span id="capeStats" class="equipStats"></span> 
 +    <br> 
 + 
 +    Main droite 
 +    <select id="rightHand"></select> 
 +    <span id="rightStats" class="equipStats"></span> 
 +    <br> 
 + 
 +    Main gauche 
 +    <select id="leftHand"></select> 
 +    <span id="leftStats" class="equipStats"></span> 
 +    <br> 
 + 
 +    Corps 
 +    <select id="body"></select> 
 +    <span id="bodyStats" class="equipStats"></span> 
 +    <br> 
 + 
 +    Anneau 
 +    <select id="ring"></select> 
 +    <span id="ringStats" class="equipStats"></span> 
 +    <br> 
 + 
 +    Pieds 
 +    <select id="feet"></select> 
 +    <span id="feetStats" class="equipStats"></span> 
 + 
 +    <div id="limitWarn" style="color:red;"></div>
 </div> </div>
  
 <div class="box"> <div class="box">
-<h3>Passifs</h3> +    <h3>Passifs</h3> 
-<div id="skills"></div>+    <div id="skills"></div>
 </div> </div>
  
 <div class="box"> <div class="box">
-<h3>Sorts actifs</h3> +    <h3>Sorts actifs</h3> 
-<div id="spells"></div> +    <div id="spells"></div> 
-<div id="spellBonus" class="small"></div>+    <div id="spellBonus" class="small"></div>
 </div> </div>
  
 +<div class="box">
 +    <h3>Simulateur de poussée</h3>
  
 +    Force assaillant
 +    <input id="pushF" type="number" value="10">
  
-<!-- ================= POUSSEE ================= --> +    Renforcement 
-<div class="box"> +    <select id="pushBuff"> 
-<h3>Simulateur de poussée</h3>+        <option value="0">0</option> 
 +        <option value="6">+6</option> 
 +    </select>
  
-Force assaillant <input id="pushF" type="number" value="10"> +    <br>
-Renforcement <select id="pushBuff"><option value="0">0</option><option value="6">+6</option></select><br>+
  
-Endurance <input id="pushE" type="number" value="5"> +    Endurance 
-Agilité <input id="pushAgi" type="number" value="5"><br>+    <input id="pushE" type="number" value="5">
  
-PV actuels <input id="pushPV" type="number" value="50"><br>+    Agilité 
 +    <input id="pushAgi" type="number" value="5">
  
-Instabilité <select id="pushDebuff"><option value="0">0</option><option value="-6">-6</option></select> +    <br>
-Stabilité <select id="pushStab"><option value="0">0</option><option value="6">+6</option><option value="12">+12</option><option value="18">+18</option></select>+
  
-<pre id="pushResult" class="result"></pre> +    PV actuels 
-</div>+    <input id="pushPV" type="number" value="50">
  
-<button onclick="resetAll()">Reset</button>+    <br> 
 + 
 +    Instabilité 
 +    <select id="pushDebuff"> 
 +        <option value="0">0</option> 
 +        <option value="-6">-6</option> 
 +    </select> 
 + 
 +    Stabilité 
 +    <select id="pushStab"> 
 +        <option value="0">0</option> 
 +        <option value="6">+6</option> 
 +        <option value="12">+12</option> 
 +        <option value="18">+18</option> 
 +    </select> 
 + 
 +    <pre id="pushResult" class="result"></pre> 
 +</div>
  
-<button onclick="exportBuild()">📤 Export</button> +<button type="button" onclick="resetAll()">Reset</button> 
-<button onclick="importBuild()">📥 Import</button> +<button type="button" onclick="exportBuild()">📤 Export</button> 
-<button onclick="copyLink()">🔗 Lien</button>+<button type="button" onclick="importBuild()">📥 Import</button> 
 +<button type="button" onclick="copyLink()">🔗 Lien</button>
  
 <pre id="result" class="result"></pre> <pre id="result" class="result"></pre>
  
 <script> <script>
 +"use strict";
 +
 +/* =========================================================
 +   RACES
 +========================================================= */
  
-// ===== RACES ===== 
 const races = { const races = {
-Elfe:{a:2,cc:9,ct:10,f:9,e:4,agi:9,p:5,mvt:5,pv:55,pm:30,r:4,rm:6,fm:8,m:6}, + 
-Nain:{a:2,cc:11,ct:8,f:11,e:6,agi:6,p:4,mvt:4,pv:50,pm:15,r:5,rm:4,fm:10,m:3}, +    Elfe:{ 
-Géant:{a:2,cc:9,ct:10,f:12,e:4,agi:7,p:4,mvt:5,pv:65,pm:20,r:5,rm:5,fm:6,m:5}, +        a:2,cc:9,ct:10,f:9,e:4,agi:9, 
-Olympien:{a:2,cc:10,ct:9,f:10,e:5,agi:8,p:4,mvt:5,pv:60,pm:30,r:5,rm:6,fm:7,m:5}, +        p:5,mvt:5,pv:55,pm:30,r:4,rm:6, 
-HS:{a:2,cc:8,ct:9,f:7,e:3,agi:11,p:5,mvt:6,pv:45,pm:40,r:3,rm:7,fm:9,m:5}+        fm:8,pui:6,res:5 
 +    }, 
 + 
 +    Nain:{ 
 +        a:2,cc:11,ct:8,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:{ 
 +        a:2,cc:9,ct:10,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:{ 
 +        a:2,cc:10,ct:9,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:{ 
 +        a:2,cc:8,ct:9,f:8,e:3,agi:11, 
 +        p:5,mvt:6,pv:50,pm:40,r:3,rm:6, 
 +        fm:9,pui:5,res:6 
 +    }
 }; };
  
-// ===== COST =====+/* ========================================================= 
 +   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" 
 +}; 
 + 
 +/* ========================================================= 
 +   COUT DES AMELIORATIONS 
 +========================================================= */ 
 const costTable = { const costTable = {
-a:[800,200,100], +    a:[800,200,100], 
-cc:[100,50,30], ct:[110,50,30], +    cc:[100,50,30], 
-f:[120,55,30], e:[120,55,30], +    ct:[110,50,30], 
-agi:[95,45,25], +    f:[120,55,30], 
-m:[110,55,35], +    e:[120,55,30], 
-fm:[100,50,30], +    agi:[95,45,25], 
-p:[110,85,78], +    pui:[120,55,30], 
-pv:[4,2,1], +    res:[120,55,30], 
-pm:[5,3,1], +    fm:[100,50,30], 
-mvt:[100,50,30], +    p:[110,85,78], 
-r:[40,30,15], +    pv:[4,2,1], 
-rm:[50,40,20]+    pm:[5,3,1], 
 +    mvt:[100,50,30], 
 +    r:[40,30,15], 
 +    rm:[50,40,20]
 }; };
  
-// ===== PASSIFS ===== +/* ========================================================= 
-const skills = [ +   EQUIPEMENTS 
-{name:"Fulgurance",desc:"+1 toucher au cac + 1 esquive tous les 5 mouvements"}, +========================================================= */
-{name:"Couverture",desc:"85% CC / 15% AGI"}, +
-{name:"Réflexes fulgurants",desc:"85% AGI / 15% CC"}, +
-{name:"Berserker",desc:"+1 toucher au cac tous les 10 pv perdus"}, +
-{name:"Griffes",desc:"+3 dégâts au poings"}, +
-{name:"Anguille",desc:"Avantage esquive"} +
-];+
  
-// ===== SORTS ===== +const equipments = [
-const spells = [ +
-{name:"Peau de granit",dex:0,prot:2}, +
-{name:"Coup précis",dex:2,prot:0},+
  
-{name:"Maladresse",dex:-2,prot:0}, +/* COMMUN */
-{name:"Vulnérabilité",dex:0,prot:-2},+
  
-{name:"Puissance de la nature",dex:2,prot:2},+{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", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:1,cc:-2} 
 +}, 
 +{ 
 +    name:"Arbalète de poing", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{f:12,ct:1} 
 +}, 
 +{ 
 +    name:"Torche", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{cc:-2,f:-2,feu:true} 
 +}, 
 +{ 
 +    name:"Lance barbelée", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:1,f:1,cc:-1} 
 +}, 
 +{ 
 +    name:"Lance", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:1,cc:-1} 
 +}, 
 +{ 
 +    name:"Rapière", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{cc:2,f:-1} 
 +}, 
 +{ 
 +    name:"Arc", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:1,cc:-1} 
 +}, 
 +{ 
 +    name:"Arc long", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:2,f:-1,cc:-2} 
 +}, 
 +{ 
 +    name:"Bélier", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{demolition:10,cc:-2} 
 +}, 
 +{ 
 +    name:"Pioche", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{demolition:5} 
 +}, 
 +{ 
 +    name:"Catalyseur magique", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{fPui:true,cc:-3,demolition:10} 
 +},
  
-{name:"Aide",dex:4,prot:0}, +{ 
-{name:"Malchance",dex:-4,prot:0},+    name:"Targe", 
 +    race:"all", 
 +    slot:"leftHand", 
 +    stats:{cc:1,agi:-1} 
 +}, 
 +{ 
 +    name:"Bouclier Parma", 
 +    race:"all", 
 +    slot:"leftHand", 
 +    stats:{e:1,agi:-1} 
 +}, 
 +{ 
 +    name:"Écu brillant", 
 +    race:"all", 
 +    slot:"leftHand", 
 +    stats:{res:1,agi:-1} 
 +},
  
-{name:"Fatigue",dex:0,prot:-4}, +{ 
-{name:"Réflexes accrus",dex:0,prot:4},+    name:"Armure matelassée", 
 +    race:"all", 
 +    slot:"body", 
 +    stats:{e:1,agi:-1} 
 +}, 
 +{ 
 +    name:"Toge d'apprenti", 
 +    race:"all", 
 +    slot:"body", 
 +    stats:{res:1,agi:-1} 
 +}, 
 +{ 
 +    name:"Ceinture", 
 +    race:"all", 
 +    slot:"body", 
 +    stats:{r:1} 
 +},
  
-{name:"Bénédiction",dex:4,prot:4},+{ 
 +    name:"Cape de chasse", 
 +    race:"all", 
 +    slot:"cape", 
 +    stats:{ct:1} 
 +},
  
-{name:"Puissance du lutin capricieux",dex:-4,prot:-4},+{ 
 +    name:"Couronne d'adonis", 
 +    race:"all", 
 +    slot:"head", 
 +    stats:{rm:1} 
 +}, 
 +{ 
 +    name:"Visière", 
 +    race:"all", 
 +    slot:"head", 
 +    stats:{p:1,cc:-1,fm:-1} 
 +}, 
 +{ 
 +    name:"Collier tressé", 
 +    race:"all", 
 +    slot:"head", 
 +    stats:{pv:5,pm:5} 
 +},
  
-{name:"Exténuation",dex:0,prot:-8}, +{ 
-{name:"Sauvegarde",dex:0,prot:8}, +    name:"Bottes de marche", 
-{name:"Guigne",dex:-8,prot:0}, +    race:"all", 
-{name:"Virtuose",dex:8,prot:0} +    slot:"feet", 
-];+    stats:{mvt:1} 
 +}, 
 +{ 
 +    name:"Sceptre de mage", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{pui:1,fm:1} 
 +}, 
 +{ 
 +    name:"Sarbacane", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{ct:1,f:10,cc:-1} 
 +}, 
 +{ 
 +    name:"Pierre Noire", 
 +    race:"all", 
 +    slot:"rightHand", 
 +    stats:{f:1,cc:-1} 
 +},
  
 +/* OLYMPIENS */
  
 +{
 +    name:"Spatha",
 +    race:"Olympien",
 +    slot:"rightHand",
 +    stats:{cc:1,f:1}
 +},
 +{
 +    name:"Lame sainte",
 +    race:"Olympiens",
 +    slot:"rightHand",
 +    stats:{cc:1,pui:1,fPui:true}
 +},
 +{
 +    name:"Pilum",
 +    race:"Olympien",
 +    slot:"rightHand",
 +    stats:{f:1,mvt:1,cc:-1}
 +},
 +{
 +    name:"Sceptre de puissance",
 +    race:"Olympien",
 +    slot:"rightHand",
 +    stats:{pui:1,pm:8}
 +},
 +{
 +    name:"Gastraphète",
 +    race:"Olympien",
 +    slot:"rightHand",
 +    stats:{f:15,ct:-2,cc:-1}
 +},
 +{
 +    name:"Bouclier Ancile",
 +    race:"Olympien",
 +    slot:"leftHand",
 +    stats:{e:1,pv:5}
 +},
 +{
 +    name:"Armure Hoplitique",
 +    race:"Olympien",
 +    slot:"body",
 +    stats:{e:1,res:1}
 +},
 +{
 +    name:"Lorica",
 +    race:"Olympien",
 +    exo:true,
 +    slot:"body",
 +    stats:{e:1,res:1}
 +},
 +{
 +    name:"Cape de dueliste",
 +    race:"Olympien",
 +    slot:"cape",
 +    stats:{cc:2,f:-1}
 +},
 +{
 +    name:"Diadème",
 +    race:"Olympien",
 +    slot:"head",
 +    stats:{r:1,rm:2}
 +},
 +{
 +    name:"Tiare d'Oracle",
 +    race:"Olympien",
 +    slot:"head",
 +    stats:{fm:1,p:1}
 +},
 +{
 +    name:"Cnémides",
 +    race:"Olympien",
 +    slot:"feet",
 +    stats:{mvt:1,rm:1,r:1}
 +},
  
 +/* ELFES */
  
-const equipments = [+{ 
 +    name:"Lance de garde Sylvestre", 
 +    race:"Elfe", 
 +    slot:"rightHand", 
 +    stats:{cc:1,f:1} 
 +}, 
 +{ 
 +    name:"Baton du Pelerin", 
 +    race:"Elfe", 
 +    slot:"rightHand", 
 +    stats:{mvt:1,fm:1} 
 +}, 
 +{ 
 +    name:"Charybde", 
 +    race:"Elfe", 
 +    slot:"rightHand", 
 +    stats:{pui:2,e:-1} 
 +}, 
 +{ 
 +    name:"Arc Ensorcelé", 
 +    race:"Elfes", 
 +    slot:"rightHand", 
 +    stats:{ct:1,rm:2,cc:-1,fPui:true} 
 +}, 
 +{ 
 +    name:"Arc Elfique", 
 +    race:"Elfe", 
 +    exo:true, 
 +    slot:"rightHand", 
 +    stats:{ct:1,f:1,mvt:1,cc:-2} 
 +}, 
 +{ 
 +    name:"Targe renforcée", 
 +    race:"Elfe", 
 +    slot:"leftHand", 
 +    stats:{e:1,cc:1} 
 +}, 
 +{ 
 +    name:"Cuirasse", 
 +    race:"Elfe", 
 +    slot:"body", 
 +    stats:{res:1,r:2} 
 +}, 
 +{ 
 +    name:"Armure de garde Sylvestre", 
 +    race:"Elfe", 
 +    exo:true, 
 +    slot:"body", 
 +    stats:{res:2,pm:-10} 
 +}, 
 +{ 
 +    name:"Cape de feuillages", 
 +    race:"Elfe", 
 +    slot:"cape", 
 +    stats:{fm:1,pv:5} 
 +}, 
 +{ 
 +    name:"Marque Forestière", 
 +    race:"Elfe", 
 +    slot:"head", 
 +    stats:{pm:10,r:1} 
 +}, 
 +{ 
 +    name:"Capuche du chasseur", 
 +    race:"Elfe", 
 +    slot:"head", 
 +    stats:{ct:1,r:1,rm:1} 
 +}, 
 +{ 
 +    name:"Bottes Tâlroval", 
 +    race:"Elfe", 
 +    slot:"feet", 
 +    stats:{mvt:2} 
 +},
  
-/* ========================================================= +/* NAINS */
-   COMMUNS +
-   ========================================================= */+
  
-{name:"Bâton de marche",race:"all",slot:"weapon",stats:{mvt:1}}, +{ 
-{name:"Gladius",race:"all",slot:"weapon",stats:{cc:1}}, +    name:"Labrys", 
-{name:"Sceptre",race:"all",slot:"weapon",stats:{fm:1}}, +    race:"Nain", 
-{name:"Fustibale",race:"all",slot:"weapon",stats:{ct:1,cc:-2}}, +    slot:"rightHand", 
-{name:"Arbalète de poing",race:"all",slot:"weapon",stats:{f:12,ct:1}}, +    stats:{cc:1,f:1} 
-{name:"Torche",race:"all",slot:"weapon",stats:{cc:-2,f:-2}}, +}, 
-{name:"Lance barbelée",race:"all",slot:"weapon",stats:{ct:1,f:1,cc:-1}}, +{ 
-{name:"Lance",race:"all",slot:"weapon",stats:{ct:1,cc:-1}}, +    name:"Hache runique", 
-{name:"Rapière",race:"all",slot:"weapon",stats:{cc:2,f:-1}}, +    race:"Nain", 
-{name:"Arc",race:"all",slot:"weapon2h",stats:{ct:1,cc:-1}}, +    slot:"rightHand", 
-{name:"Arc long",race:"all",slot:"weapon2h",stats:{ct:2,f:-1,cc:-2}}, +    stats:{cc:1,fm:1} 
-{name:"Bélier",race:"all",slot:"weapon2h",stats:{cc:-2}}, +}, 
-{name:"Pioche",race:"all",slot:"weapon2h",stats:{}}, +{ 
-{name:"Catalyseur magique",race:"all",slot:"weapon2h",stats:{cc:-3}}, +    name:"Marteau runique", 
-{name:"Targe",race:"all",slot:"offhand",stats:{cc:1,agi:-1}}, +    race:"Nains", 
-{name:"Bouclier Parma",race:"all",slot:"offhand",stats:{e:1,agi:-1}}, +    slot:"rightHand", 
-{name:"Écu brillant",race:"all",slot:"offhand",stats:{r:1,agi:-1}}, +    stats:{fPui:true,pui:2} 
-{name:"Armure matelassée",race:"all",slot:"body",stats:{e:1,agi:-1}}, +}, 
-{name:"Toge d'apprenti",race:"all",slot:"body",stats:{r:1,agi:-1}}, +{ 
-{name:"Ceinture",race:"all",slot:"body",stats:{r:1}}, +    name:"Baton d'archimage", 
-{name:"Cape de chasse",race:"all",slot:"cape",stats:{ct:1}}, +    race:"Nain", 
-{name:"Couronne d'adonis",race:"all",slot:"head",stats:{rm:1}}, +    slot:"rightHand", 
-{name:"Visière",race:"all",slot:"head",stats:{p:1,cc:-1,fm:-1}}, +    stats:{fm:1,pm:10} 
-{name:"Collier tressé",race:"all",slot:"head",stats:{pv:5,pm:5}}, +}, 
-{name:"Bottes de marche",race:"all",slot:"feet",stats:{mvt:1}}, +{ 
-{name:"Sceptre de mage",race:"all",slot:"weapon",stats:{m:1,fm:1}}, +    name:"Marteau de guerre", 
-{name:"Sarbacane",race:"all",slot:"weapon",stats:{ct:1,f:10,cc:-1}}, +    race:"Nain", 
-{name:"Pierre Noire",race:"all",slot:"weapon",stats:{f:1,cc:-1}},+    slot:"rightHand", 
 +    stats:{f:2,cc:-1} 
 +}, 
 +{ 
 +    name:"Bouclier Miroir", 
 +    race:"Nain", 
 +    slot:"leftHand", 
 +    stats:{res:1,pv:5} 
 +}, 
 +{ 
 +    name:"Armure runique", 
 +    race:"Nain", 
 +    slot:"body", 
 +    stats:{e:1,pm:8} 
 +}, 
 +{ 
 +    name:"Cotte de mailles", 
 +    race:"Nain", 
 +    exo:true, 
 +    slot:"body", 
 +    stats:{e:2,esquive:-4} 
 +}, 
 +{ 
 +    name:"Cape dorée", 
 +    race:"Nain", 
 +    exo:true, 
 +    slot:"cape", 
 +    stats:{res:1,mvt:1} 
 +}, 
 +{ 
 +    name:"Casque grossissant", 
 +    race:"Nain", 
 +    slot:"head", 
 +    stats:{ct:2,p:-1} 
 +}, 
 +{ 
 +    name:"Casque de guerre", 
 +    race:"Nain", 
 +    slot:"head", 
 +    stats:{pv:5,r:1,pm:5,rm:1} 
 +}, 
 +{ 
 +    name:"Solerets", 
 +    race:"Nain", 
 +    slot:"feet", 
 +    stats:{mvt:1,pm:5,pv:5} 
 +},
  
 +/* GEANTS */
  
-/* ========================================================= +{ 
-   OLYMPIENS +    name:"Masse d'arme", 
-   ========================================================= */+    race:"Géant", 
 +    slot:"rightHand", 
 +    stats:{cc:1,f:1} 
 +}, 
 +{ 
 +    name:"Hallebarde de pierre", 
 +    race:"Géant", 
 +    slot:"rightHand", 
 +    stats:{f:1,mvt:1} 
 +}, 
 +{ 
 +    name:"Javelot lourd", 
 +    race:"Géant", 
 +    slot:"rightHand", 
 +    stats:{f:2,ct:-1,cc:-1} 
 +}, 
 +{ 
 +    name:"Pierre en fusion", 
 +    race:"Géants", 
 +    slot:"rightHand", 
 +    stats:{fPui:true,ct:-2,feu:true} 
 +}, 
 +{ 
 +    name:"Baton de shaman", 
 +    race:"Géant", 
 +    exo:true, 
 +    slot:"rightHand", 
 +    stats:{fm:2} 
 +}, 
 +{ 
 +    name:"Bouclier Clipeus", 
 +    race:"Géant", 
 +    slot:"leftHand", 
 +    stats:{e:1,pv:10} 
 +}, 
 +{ 
 +    name:"Peau de granit manifiée", 
 +    race:"Géant", 
 +    slot:"body", 
 +    stats:{res:1,rm:2,esquive:-2} 
 +}, 
 +{ 
 +    name:"Broigne", 
 +    race:"Géant", 
 +    exo:true, 
 +    slot:"body", 
 +    stats:{res:2,fm:-1} 
 +}, 
 +{ 
 +    name:"Cape de l'arpenteur", 
 +    race:"Géant", 
 +    slot:"cape", 
 +    stats:{cc:1,ct:1} 
 +}, 
 +{ 
 +    name:"Fétiche de shaman", 
 +    race:"Géant", 
 +    slot:"head", 
 +    stats:{r:2,pm:5} 
 +}, 
 +{ 
 +    name:"Coiffe de rage", 
 +    race:"Géant", 
 +    slot:"head", 
 +    stats:{cc:1,pv:5,r:1} 
 +}, 
 +{ 
 +    name:"Bottes incandescentes", 
 +    race:"Géant", 
 +    slot:"feet", 
 +    stats:{mvt:1,r:1,pv:5} 
 +},
  
-{name:"Spatha",race:"Olympien",slot:"weapon",stats:{cc:1,f:1}}, +/* HS */
-{name:"Lame sainte",race:"Olympien",slot:"weapon",stats:{cc:1,m:1}}, +
-{name:"Pilum",race:"Olympien",slot:"weapon",stats:{f:1,mvt:1,cc:-1}}, +
-{name:"Sceptre de puissance",race:"Olympien",slot:"weapon",stats:{m:1,pm:8}}, +
-{name:"Gastraphète",race:"Olympien",slot:"weapon2h",stats:{f:15,ct:-2,cc:-1}}, +
-{name:"Bouclier Ancile",race:"Olympien",slot:"offhand",stats:{e:1,pv:5}}, +
-{name:"Armure Hoplitique",race:"Olympien",slot:"body",stats:{e:1,r:1}}, +
-{name:"Lorica (exo)",race:"Olympien",slot:"body",stats:{e:1,r:1}}, +
-{name:"Cape de dueliste",race:"Olympien",slot:"cape",stats:{cc:2,f:-1}}, +
-{name:"Diadème",race:"Olympien",slot:"head",stats:{r:1,rm:2}}, +
-{name:"Tiare d'Oracle",race:"Olympien",slot:"head",stats:{fm:1,p:1}}, +
-{name:"Cnémides",race:"Olympien",slot:"feet",stats:{mvt:1,rm:1,r:1}},+
  
 +{
 +    name:"Ceste",
 +    race:"HS",
 +    slot:"rightHand",
 +    stats:{f:1,cc:1}
 +},
 +{
 +    name:"Mains de mana",
 +    race:"HS",
 +    slot:"rightHand",
 +    stats:{fPui:true,cc:2}
 +},
 +{
 +    name:"Baton de Sage",
 +    race:"HS",
 +    slot:"rightHand",
 +    stats:{pui:1,agi:1}
 +},
 +{
 +    name:"Orbe de mana",
 +    race:"HS",
 +    slot:"rightHand",
 +    stats:{pui:2,fm:-1}
 +},
 +{
 +    name:"Bouclier en lianes",
 +    race:"HS",
 +    slot:"leftHand",
 +    stats:{res:1,agi:1}
 +},
 +{
 +    name:"Manteau de feuillage",
 +    race:"HS",
 +    slot:"body",
 +    stats:{e:1,agi:1}
 +},
 +{
 +    name:"Armure de fourrure",
 +    race:"HS",
 +    exo:true,
 +    slot:"body",
 +    stats:{e:2,rm:-3}
 +},
 +{
 +    name:"Cape de mage",
 +    race:"HS",
 +    slot:"cape",
 +    stats:{fm:1,rm:1}
 +},
 +{
 +    name:"Collier d'apaisement",
 +    race:"HS",
 +    slot:"head",
 +    stats:{pv:10,pm:5}
 +},
 +{
 +    name:"Coiffe de rapace",
 +    race:"HS",
 +    slot:"head",
 +    stats:{ct:1,p:1}
 +},
 +{
 +    name:"Bottes griffues",
 +    race:"HS",
 +    exo:true,
 +    slot:"feet",
 +    stats:{cc:1,f:1,pv:5}
 +},
 +{
 +    name:"Bottes de voleur",
 +    race:"HS",
 +    slot:"feet",
 +    stats:{mvt:1,agi:1}
 +},
  
 +/* LUTINS : ANNEAUX */
  
-/* ========================================================= +{ 
-   ELFES +    name:"Anneau d'Horizon", 
-   ========================================================= */+    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{p:1} 
 +}, 
 +{ 
 +    name:"Anneau de Caprice", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{fm:1} 
 +}, 
 +{ 
 +    name:"Anneau de Puissance", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{pui:1} 
 +}, 
 +{ 
 +    name:"Anneau de Férocité", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{f:1} 
 +}, 
 +{ 
 +    name:"Anneau de Résistance", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{res:1} 
 +}, 
 +{ 
 +    name:"Anneau d'Équilibre", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{pv:5,pm:5} 
 +}, 
 +{ 
 +    name:"Anneau de Finesse", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{cc:1} 
 +}, 
 +{ 
 +    name:"Anneau de Prétention", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{ct:1} 
 +}, 
 +{ 
 +    name:"Anneau de Tenacité", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{e:1} 
 +}, 
 +{ 
 +    name:"Anneau de Souplesse", 
 +    race:"Lutin", 
 +    slot:"ring", 
 +    stats:{agi:1} 
 +},
  
-{name:"Lance de garde Sylvestre",race:"Elfe",slot:"weapon",stats:{cc:1,f:1}}, +{ 
-{name:"Baton du Pelerin",race:"Elfe",slot:"weapon",stats:{mvt:1,fm:1}}, +    name:"Bottes de 7 lieux", 
-{name:"Charybde",race:"Elfe",slot:"weapon2h",stats:{m:2,e:-1}}, +    race:"Lutin", 
-{name:"Arc Ensorcelé",race:"Elfe",slot:"weapon2h",stats:{ct:1,rm:2,cc:-1}}, +    exo:true, 
-{name:"Arc Elfique (exo)",race:"Elfe",slot:"weapon2h",stats:{ct:1,f:1,mvt:1,cc:-2}}, +    slot:"feet", 
-{name:"Targe renforcée",race:"Elfe",slot:"offhand",stats:{e:1,cc:1}}, +    stats:{mvt:3} 
-{name:"Cuirasse",race:"Elfe",slot:"body",stats:{r:1,r:2}}, +}
-{name:"Armure de garde Sylvestre",race:"Elfe",slot:"body",stats:{r:2,pm:-10}}, +
-{name:"Cape de feuillages",race:"Elfe",slot:"cape",stats:{fm:1,pv:5}}, +
-{name:"Marque Forestière",race:"Elfe",slot:"head",stats:{pm:10,r:1}}, +
-{name:"Capuche du chasseur",race:"Elfe",slot:"head",stats:{ct:1,r:1,rm:1}}, +
-{name:"Bottes Tâlroval",race:"Elfe",slot:"feet",stats:{mvt:2}},+
  
 +];
  
 +/* =========================================================
 +   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"
 +]);
  
 /* ========================================================= /* =========================================================
-   NAINS +   PASSIFS 
-   ========================================================= */+========================================================= */
  
-{name:"Labrys",race:"Nain",slot:"weapon",stats:{cc:1,f:1}}, +const skills = [ 
-{name:"Hache runique",race:"Nain",slot:"weapon",stats:{cc:1,fm:1}}, +    { 
-{name:"Marteau runique",race:"Nain",slot:"weapon2h",stats:{m:2}}, +        name:"Fulgurance", 
-{name:"Baton d'archimage",race:"Nain",slot:"weapon",stats:{fm:1,pm:10}}, +        desc:"+1 toucher CAC et +1 esquive par tranche de 5 mouvements" 
-{name:"Marteau de guerre",race:"Nain",slot:"weapon2h",stats:{f:2,cc:-1}}, +    }, 
-{name:"Bouclier Miroir",race:"Nain",slot:"offhand",stats:{r:1,pv:5}}, +    { 
-{name:"Armure runique",race:"Nain",slot:"body",stats:{e:1,pm:8}}, +        name:"Couverture", 
-{name:"Cotte de mailles",race:"Nain",slot:"body",stats:{e:2}}, +        desc:"85% CC / 15% AGI" 
-{name:"Cape dorée (exo)",race:"Nain",slot:"cape",stats:{r:1,mvt:1}}, +    }, 
-{name:"Casque grossissant",race:"Nain",slot:"head",stats:{ct:2,p:-1}}, +    { 
-{name:"Casque de guerre",race:"Nain",slot:"head",stats:{pv:5,r:1,pm:5,rm:1}}, +        name:"Réflexes fulgurants", 
-{name:"Solerets",race:"Nain",slot:"feet",stats:{mvt:1,pm:5,pv:5}},+        desc:"85% AGI / 15% CC" 
 +    }, 
 +    { 
 +        name:"Berserker", 
 +        desc:"+1 F par tranche de 10 PV perdus (non calculé)" 
 +    }, 
 +    { 
 +        name:"Griffes", 
 +        desc:"+3 dégâts à mains nues, avec une ceste ou des mains de mana" 
 +    }, 
 +    { 
 +        name:"Anguille", 
 +        desc:"+1 esquive (non calculé)" 
 +    } 
 +];
  
 +/* =========================================================
 +   SORTS
 +========================================================= */
  
 +const spells = [
 +    {name:"Peau de granit",dex:0,prot:2},
 +    {name:"Coup précis",dex:2,prot:0},
 +    {name:"Maladresse",dex:-2,prot:0},
 +    {name:"Vulnérabilité",dex:0,prot:-2},
 +    {name:"Puissance de la nature",dex:2,prot:2},
 +    {name:"Aide",dex:4,prot:0},
 +    {name:"Malchance",dex:-4,prot:0},
 +    {name:"Fatigue",dex:0,prot:-4},
 +    {name:"Réflexes accrus",dex:0,prot:4},
 +    {name:"Bénédiction",dex:4,prot:4},
 +    {name:"Puissance du lutin capricieux",dex:-4,prot:-4},
 +    {name:"Exténuation",dex:0,prot:-8},
 +    {name:"Sauvegarde",dex:0,prot:8},
 +    {name:"Guigne",dex:-8,prot:0},
 +    {name:"Virtuose",dex:8,prot:0}
 +];
  
 /* ========================================================= /* =========================================================
-   GÉANTS +   INITIALISATION 
-   ========================================================= */+========================================================= */
  
-{name:"Masse d'arme",race:"Géant",slot:"weapon",stats:{cc:1,f:1}}, +const raceSelect = document.getElementById("race");
-{name:"Hallebarde de pierre",race:"Géant",slot:"weapon",stats:{f:1,mvt:1}}, +
-{name:"Javelot lourd",race:"Géant",slot:"weapon2h",stats:{f:2,ct:-1,cc:-1}}, +
-{name:"Pierre en fusion",race:"Géant",slot:"weapon",stats:{ct:-2}}, +
-{name:"Baton de shaman (exo)",race:"Géant",slot:"weapon2h",stats:{fm:2}}, +
-{name:"Bouclier Clipeus",race:"Géant",slot:"offhand",stats:{e:1,pv:10}}, +
-{name:"Peau de granit manifiée",race:"Géant",slot:"body",stats:{r:1,rm:2}}, +
-{name:"Broigne",race:"Géant",slot:"body",stats:{r:2,fm:-1}}, +
-{name:"Cape de l'arpenteur",race:"Géant",slot:"cape",stats:{cc:1,ct:1}}, +
-{name:"Fétiche de shaman",race:"Géant",slot:"head",stats:{r:2,pm:5}}, +
-{name:"Coiffe de rage",race:"Géant",slot:"head",stats:{cc:1,pv:5,r:1}}, +
-{name:"Bottes incandescentes",race:"Géant",slot:"feet",stats:{mvt:1,r:1,pv:5}},+
  
 +Object.keys(races).forEach(r=>{
 +    const option=document.createElement("option");
 +    option.value=r;
 +    option.textContent=r;
 +    raceSelect.appendChild(option);
 +});
  
 +/* AMELIORATIONS */
  
-/* ========================================================= +const statsDiv=document.getElementById("stats");
-   HS +
-   ========================================================= */+
  
-{name:"Ceste",race:"HS",slot:"weapon",stats:{f:1,cc:1}}, +statOrder.forEach(stat=>{ 
-{name:"Mains de mana",race:"HS",slot:"weapon2h",stats:{cc:2}}, +    if(!costTable[stat]) return;
-{name:"Baton de Sage",race:"HS",slot:"weapon",stats:{m:1,agi:1}}, +
-{name:"Orbe de mana",race:"HS",slot:"weapon2h",stats:{m:2,fm:-1}}, +
-{name:"Bouclier en lianes",race:"HS",slot:"offhand",stats:{r:1,agi:1}}, +
-{name:"Manteau de feuillage",race:"HS",slot:"body",stats:{e:1,agi:1}}, +
-{name:"Armure de fourrure",race:"HS",slot:"body",stats:{e:2,rm:-3}}, +
-{name:"Cape de mage",race:"HS",slot:"cape",stats:{fm:1,rm:1}}, +
-{name:"Collier d'apaisement",race:"HS",slot:"head",stats:{pv:10,pm:5}}, +
-{name:"Coiffe de rapace",race:"HS",slot:"head",stats:{ct:1,p:1}}, +
-{name:"Bottes griffues (exo)",race:"HS",slot:"feet",stats:{cc:1,f:1,pv:5}}, +
-{name:"Bottes de voleur",race:"HS",slot:"feet",stats:{mvt:1,agi:1}},+
  
 +    const line=document.createElement("div");
 +    line.className="statLine";
  
 +    const label=document.createElement("label");
 +    label.textContent=statLabels[stat]||stat;
  
-/* ========================================================= +    const input=document.createElement("input"); 
-   LUTINS +    input.type="number"; 
-   ========================================================= */+    input.id="up_"+stat; 
 +    input.value=0; 
 +    input.min=0;
  
-{name:"Anneau d'Horizon",race:"Lutin",slot:"ring",stats:{p:1}}, +    input.addEventListener("input",calculate);
-{name:"Anneau de Caprice",race:"Lutin",slot:"ring",stats:{fm:1}}, +
-{name:"Anneau de Puissance",race:"Lutin",slot:"ring",stats:{m:1}}, +
-{name:"Anneau de Férocité",race:"Lutin",slot:"ring",stats:{f:1}}, +
-{name:"Anneau de Résistance",race:"Lutin",slot:"ring",stats:{r:1}}, +
-{name:"Anneau d'Équilibre",race:"Lutin",slot:"ring",stats:{pv:5,pm:5}}, +
-{name:"Anneau de Finesse",race:"Lutin",slot:"ring",stats:{cc:1}}, +
-{name:"Anneau de Prétention",race:"Lutin",slot:"ring",stats:{ct:1}}, +
-{name:"Anneau de Tenacité",race:"Lutin",slot:"ring",stats:{e:1}}, +
-{name:"Anneau de Souplesse",race:"Lutin",slot:"ring",stats:{agi:1}}, +
-{name:"Bottes de 7 lieux (exo)",race:"Lutin",slot:"feet",stats:{mvt:3}}+
  
-];+    line.append(label,input); 
 +    statsDiv.appendChild(line); 
 +});
  
 +/* PASSIFS */
  
-// ===== INIT ===== +const skillsDiv=document.getElementById("skills");
-const raceSelect = document.getElementById("race"); +
-const statsDiv = document.getElementById("stats"); +
-const baseDiv = document.getElementById("baseStats");+
  
-for(let r in races){ +skills.forEach((s,i)=>{ 
-raceSelect.innerHTML += `<option>${r}</option>`; +    const label=document.createElement("label"); 
-}+    const cb=document.createElement("input");
  
-// stats UI +    cb.type="checkbox"; 
-for(let s in costTable){ +    cb.id="skill_"+i; 
-statsDiv.innerHTML += ` +    cb.addEventListener("change",calculate);
-<div class="statLine"> +
-<span>${s}</span> +
-<input type="number" id="${s}" value="0" min="0"> +
-</div>`; +
-}+
  
-// passifs +    label.append( 
-skills.forEach(s=>{ +        cb, 
-document.getElementById("skills").innerHTML += ` +        document.createTextNode(" "+s.name+" — "+s.desc) 
-<label> +    ); 
-<input type="checkbox" class="skill" data-name="${s.name}"> + 
-<b>${s.name}</b><br> +    skillsDiv.append(label,document.createElement("br"));
-<span class="small">${s.desc}</span> +
-</label><br>`;+
 }); });
  
 +/* SORTS */
  
-// affichage sorts +const spellsDiv=document.getElementById("spells");
-spells.forEach(s=>{ +
-document.getElementById("spells").innerHTML += ` +
-<label> +
-<input type="checkbox" class="spell" data-dex="${s.dex}" data-prot="${s.prot}"> +
-<b>${s.name}</b>  +
-<span class="small">(Dex ${s.dex>=0?"+":""}${s.dex} | Prot ${s.prot>=0?"+":""}${s.prot})</span> +
-</label><br>`; +
-});+
  
-// base stats +spells.forEach((s,i)=>{ 
-function displayBase(){ +    const label=document.createElement("label"); 
-baseDiv.textContent = JSON.stringify(races[raceSelect.value],null,2); +    const cb=document.createElement("input");
-} +
-raceSelect.addEventListener("change", displayBase); +
-displayBase();+
  
-// ===== COST ===== +    cb.type="checkbox"; 
-function calcCost(b,m1,m2,n){ +    cb.id="spell_"+i; 
-let total=0,last=b; +    cb.addEventListener("change",calculate);
-for(let i=1;i<=n;i++){ +
-if(i===1) last=b; +
-else if(i<=3) last+=m1; +
-else last+=m2; +
-total+=last; +
-} +
-return total; +
-}+
  
-function updateCost(){ +    label.append( 
-let total=0; +        cb, 
-for(let s in costTable){ +        document.createTextNode( 
-let v=+document.getElementById(s).value||0; +            " "+s.name+" (Dex "+s.dex+", Prot "+s.prot+")" 
-let [b,m1,m2]=costTable[s]; +        ) 
-total+=calcCost(b,m1,m2,v); +    ); 
-} + 
-document.getElementById("cost").innerHTML="💰 PI : "+total; +    spellsDiv.append(label,document.createElement("br")); 
-}+}); 
 + 
 +/* ========================================================= 
 +   EQUIPEMENTS 
 +========================================================= */
  
-// ===== SLOTS ===== 
 const slots = { const slots = {
-head:head,neck:neck,cape:cape,rightHand:rightHand, +    head:document.getElementById("head"), 
-leftHand:leftHand,body:body,ring:ring,feet:feet+    cape:document.getElementById("cape"), 
 +    rightHand:document.getElementById("rightHand"), 
 +    leftHand:document.getElementById("leftHand"), 
 +    body:document.getElementById("body"), 
 +    ring:document.getElementById("ring"), 
 +    feet:document.getElementById("feet")
 }; };
  
-function resetSlots(){ +const statIds = { 
-Object.values(slots).forEach(s=>s.innerHTML="<option value=''>--</option>");+    head:"headStats", 
 +    cape:"capeStats", 
 +    rightHand:"rightStats", 
 +    leftHand:"leftStats", 
 +    body:"bodyStats", 
 +    ring:"ringStats", 
 +    feet:"feetStats" 
 +}; 
 + 
 +/* COMPATIBILITE EXOTIQUE */ 
 + 
 +function canEquip(item,race){ 
 + 
 +    if(!item.exo){ 
 +        return true; 
 +    } 
 + 
 +    const aliases = { 
 +        "Olympiens":"Olympien", 
 +        "Elfes":"Elfe", 
 +        "Nains":"Nain", 
 +        "Géants":"Géant" 
 +    }; 
 + 
 +    const owner=aliases[item.race]||item.race; 
 + 
 +    return owner===race;
 } }
 +
 +/* REMPLISSAGE */
  
 function fillEquip(){ function fillEquip(){
-let r=raceSelect.value; 
  
-equipments.forEach((e,i)=>{ +    const race=raceSelect.value;
-if(e.race!=="all"&&e.race!==r) return;+
  
-if(e.slot==="weapon"||e.slot==="weapon2h") rightHand.innerHTML+=`<option value="${i}">${e.name}</option>`; +    for(const key in slots){
-if(e.slot==="offhand") leftHand.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="body") body.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="head") head.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="neck") neck.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="cape") cape.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="feet") feet.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-if(e.slot==="ring") ring.innerHTML+=`<option value="${i}">${e.name}</option>`; +
-}); +
-}+
  
-raceSelect.addEventListener("change",()=>{ +        const select=slots[key]; 
-resetSlots(); +        select.innerHTML="";
-fillEquip(); +
-autoCalculate(); +
-});+
  
-resetSlots(); +        const empty=document.createElement("option"); 
-fillEquip();+        empty.value=""; 
 +        empty.textContent="— Aucun —"; 
 +        select.appendChild(empty);
  
-// ===== BONUS ===== +        const available=equipments 
-function displayStats(select,id){ +            .filter(e=>e.slot===key) 
-let v=select.value; +            .filter(e=>canEquip(e,race)) 
-let el=document.getElementById(id); +            .sort((a,b)=> 
-if(v===""){el.innerHTML="";return;} +                a.name.localeCompare( 
-let e=equipments[v]; +                    b.name, 
-let txt=""; +                    "fr", 
-for(let s in e.stats){ +                    {sensitivity:"base"} 
-let val=e.stats[s]; +                ) 
-txt+=val>0?`+${val} ${s} `:`${val} ${s} `; +            ); 
-} + 
-el.innerHTML=txt;+        available.forEach(item=>{ 
 + 
 +            const option=document.createElement("option"); 
 + 
 +            option.value=String(equipments.indexOf(item)); 
 + 
 +            /* Le titre reste uniquement le nom de l'objet */ 
 +            option.textContent= 
 +                item.name+ 
 +                (item.exo?" (exo)":""); 
 + 
 +            select.appendChild(option); 
 +        }); 
 + 
 +        select.onchange=()=>{ 
 + 
 +            checkLimit(key); 
 +            displayAllEquipStats(); 
 +            calculate(); 
 +        }; 
 +    } 
 + 
 +    displayAllEquipStats(); 
 +    checkLimit(); 
 +    calculate();
 } }
  
-const slotToStatId = { +/* AFFICHAGE DES BONUS */ 
-head:"headStats", + 
-neck:"neckStats", +const statNames = { 
-cape:"capeStats", +    a:"A",f:"F",e:"E",agi:"Agi", 
-rightHand:"rightStats", +    cc:"CC",ct:"CT",fm:"FM",mvt:"Mvt", 
-leftHand:"leftStats", +    pv:"PV",pm:"PM",r:"R",res:"Rés", 
-body:"bodyStats", +    rm:"RM",p:"P",pui:"Pui",fPui:"F=Pui", 
-ring:"ringStats", +    esquive:"Esquive", 
-feet:"feetStats"+    demolition:"Démolition", 
 +    magique:"Magique", 
 +    feu:"Feu"
 }; };
  
-Object.entries(slots).forEach(([k,s])=>{ +function displayStats(select,id){
-s.addEventListener("change",()=>{ +
-displayStats(s, slotToStatId[k]); +
-checkLimit(); +
-autoCalculate(); +
-}); +
-});+
  
-// ===== LIMIT ===== +    const el=document.getElementById(id);
-function checkLimit(){ +
-let count=0; +
-Object.entries(slots).forEach(([k,s])=>{ +
-if(k!=="ring"&&s.value!=="") count++; +
-});+
  
-if(count>=3){ +    if(!el) return; 
-limitWarn.innerText="Limite atteinte"; + 
-Object.entries(slots).forEach(([k,s])=>{ +    if(select.value===""){ 
-if(k!=="ring"&&s.value==="") s.disabled=true; +        el.innerHTML=""; 
-}); +        return; 
-}else{ +    } 
-limitWarn.innerText=""; + 
-Object.values(slots).forEach(s=>s.disabled=false);+    const item=equipments[Number(select.value)]; 
 + 
 +    if(!item){ 
 +        el.innerHTML=""; 
 +        return; 
 +    } 
 + 
 +    let html=""; 
 + 
 +    /* Bonus et malus */ 
 + 
 +    for(const [stat,value] of Object.entries(item.stats||{})){ 
 + 
 +        const name=statNames[stat]||stat; 
 + 
 +        if(value===true){ 
 +            html+=`<span class="special">${name}</span> `; 
 +            continue; 
 +        } 
 + 
 +        if(typeof value!=="number"||value===0){ 
 +            continue; 
 +        } 
 + 
 +        if(value>0){ 
 +            html+=`<span class="bonus">+${value} ${name}</span> `; 
 +        }else{ 
 +            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;
 } }
 +
 +function displayAllEquipStats(){
 +
 +    for(const key in slots){
 +        displayStats(slots[key],statIds[key]);
 +    }
 } }
  
-// ===== CALCUL =====+/* ========================================================= 
 +   LIMITE : 3 EQUIPEMENTS + 1 ANNEAU 
 +========================================================= */
  
-function calculate(){+function checkLimit(changedSlot=null){
  
-let activeSpells = [...document.querySelectorAll(".spell:checked")];+    const warn=document.getElementById("limitWarn");
  
-let bestDex = 0; +    const count=Object.keys(slots) 
-let bestProt = 0;+        .filter(key=>key!=="ring") 
 +        .filter(key=>slots[key].value!=="") 
 +        .length;
  
-activeSpells.forEach(s=>{ +    if(count>3){
-let d = +s.dataset.dex; +
-let p = +s.dataset.prot;+
  
-if(Math.abs(d) > Math.abs(bestDex)) bestDex = d; +        if(changedSlot&&changedSlot!=="ring"){
-if(Math.abs(p) > Math.abs(bestProt)) bestProt = p; +
-});+
  
-let char={...races[raceSelect.value]};+            slots[changedSlot].value=""; 
 + 
 +            displayStats( 
 +                slots[changedSlot], 
 +                statIds[changedSlot] 
 +            ); 
 +        } 
 + 
 +        warn.textContent= 
 +            "⚠️ Maximum 3 équipements hors anneau. L'anneau est un emplacement supplémentaire."; 
 + 
 +        return false; 
 +    }
  
-// stats investies +    warn.textContent=""; 
-for(let s in costTable){ +    return true;
-let v=+document.getElementById(s).value||0; +
-char[s]=(char[s]||0)+v;+
 } }
  
-// equip +function resetSlots(){ 
-Object.values(slots).forEach(sel=>{ + 
-if(sel.value==="") return; +    for(const key in slots){ 
-let e=equipments[sel.value]; +        slots[key].value=""; 
-for(let s in e.stats){ +    } 
-char[s]=(char[s]||0)+e.stats[s];+ 
 +    displayAllEquipStats(); 
 +    checkLimit();
 } }
-}); 
  
-// ===== DÉS ===== +/* ========================================================= 
-let ccDice = char.cc * 2; +   STATS DE BASE 
-let ctDice = char.ct * 2; +========================================================= */
-let fmDice = char.fm * 2; +
-let agiDice = char.agi * 2;+
  
-// ===== VALEURS FINALES ===== +function displayBase(){
-let finalCC = ccDice + bestDex; +
-let finalCT = ctDice + bestDex; +
-let finalFM = fmDice + bestDex;+
  
 +    const r=races[raceSelect.value];
  
-// ===== CT DISTANCE ===== +    let text=""; 
-function getCTDistance(baseCT, distance){ + 
-if(distance <= 2) return baseCT; +    statOrder.forEach(stat=>{ 
-return baseCT - (distance - 2) * 3;+ 
 +        if(r[stat]!==undefined){ 
 + 
 +            text+=(statLabels[stat]||stat)+": "+r[stat]+"\n"; 
 +        } 
 +    }); 
 + 
 +    document.getElementById("baseStats").textContent=text.trim();
 } }
  
-let ct1 = getCTDistance(finalCT,1); +/* ========================================================= 
-let ct2 = getCTDistance(finalCT,2); +   COUT 
-let ct3 = getCTDistance(finalCT,3); +========================================================= */
-let ct4 = getCTDistance(finalCT,4);+
  
 +function calcCost(){
  
-// ===== ESQUIVE =====+    let total=0;
  
-let checked = [...document.querySelectorAll(".skill:checked")].map(e=>e.dataset.name);+    for(const stat in costTable){
  
-// ===== ESQUIVE CAC ===== +        const input=document.getElementById("up_"+stat);
-// règle : meilleur entre CC et AGI (dés), puis conversion jet + protection+
  
-let esquiveCAC = Math.max(ccDice, agiDice);+        if(!input) continue;
  
-// conversion en jet + protection +        const level=Math.max( 
-esquiveCAC = esquiveCAC + bestProt;+            0, 
 +            parseInt(input.value,10)||0 
 +        );
  
 +        if(!level) continue;
  
-// ===== ESQUIVE TIR ===== +        const [B,M1,M2]=costTable[stat];
-// règle : +
-// max entre : +
-// (3/4 CC + 1/4 AGI) +
-// (1/4 CC + 3/4 AGI) +
-// arrondi inférieur → dés → ×2 → + protection+
  
-let esquiveA = Math.floor(char.cc * 0.75 + char.agi * 0.25); +        for(let n=1;n<=level;n++){
-let esquiveB = Math.floor(char.cc * 0.25 + char.agi * 0.75);+
  
-// passifs qui remplacent le calcul +            let cost;
-let esquiveStat;+
  
-if(checked.includes("Réflexes fulgurants")){ +            if(n===1){ 
-    esquiveStat = Math.floor(char.agi * 0.85 + char.cc * 0.15);+                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; 
 +        } 
 +    } 
 + 
 +    return total;
 } }
-else if(checked.includes("Couverture")){ + 
-    esquiveStat = Math.floor(char.cc * 0.85 + char.agi * 0.15);+function updateCost(){ 
 + 
 +    document.getElementById("cost").textContent= 
 +        "Coût total : "+calcCost();
 } }
-else{ + 
-    esquiveStat = Math.max(esquiveA, esquiveB);+/* ========================================================= 
 +   LECTURE DES PASSIFS 
 +========================================================= */ 
 + 
 +function isChecked(index){ 
 + 
 +    const cb=document.getElementById("skill_"+index); 
 + 
 +    return cb?cb.checked:false;
 } }
  
-// conversion en jet +/* ========================================================= 
-let esquiveTir = esquiveStat * 2;+   CALCUL DU PERSONNAGE 
 +========================================================= */
  
-// protection (UNE seule fois) +function calculate(){
-esquiveTir += bestProt;+
  
-// bonus passifs +    const race=races[raceSelect.value];
-if(checked.includes("Fulgurance")) +
-    esquiveTir += 1;+
  
 +    if(!race) return;
  
-// ===== ESQUIVE MAGIQUE ===== +    updateCost(); 
-// règle : FM en jet + protection+    displayBase();
  
-let esquiveFM = fmDice + bestProt;+    const char={...race};
  
-// ===== MAGIE ===== +    /* Améliorations */
-let jetFM = finalFM;+
  
-let sorts = ""; +    for(const stat in costTable){
-for(let lvl=1; lvl<=5; lvl++){ +
-    let seuil = 6 + 6 * lvl; +
-    let reussite = jetFM >= seuil ? "✅" : "❌";+
  
-    sorts += `Niveau ${lvl} → Seuil ${seuil} | Jet ${jetFM} ${reussite}\n`; +        const input=document.getElementById("up_"+stat);
-}+
  
-// ===== AFFICHAGE ===== +        if(input){
-document.getElementById("spellBonus").innerText = +
-"Bonus actifs → Dex: "+bestDex+" | Protection: "+bestProt;+
  
-result.textContent =+            char[stat]= 
 +                (char[stat]||0)+ 
 +                (parseInt(input.value,10)||0); 
 +        } 
 +    }
  
-"===== PERSONNAGE =====\n"+ +    /* Equipements */
-"Race : "+raceSelect.value++
  
-"\n\n===== STATS =====\n"+ +    let forcePui=false;
-JSON.stringify(char,null,2)++
  
-"\n\n===== JET OFFENSIF =====\n"+ +    for(const key in slots){
-"\n⚔ CC : jet moyen "+ccDice+" ("+finalCC+")"+ +
-"\n🎯 CT : jet moyen "+ctDice+" ("+finalCT+")"+ +
-"\n✨ FM : jet moyen "+fmDice+" ("+finalFM+")"++
  
-"\n\n===== JET DEFENSIF =====\n"+ +        const value=slots[key].value;
-"\n🛡 Esquive CAC : "+esquiveCAC+ +
-"\n🏹 Esquive tir : "+esquiveTir+ +
-"\n✨ Esquive FM : "+esquiveFM++
  
-"\n\n===== JET DISTANCE =====\n"+ +        if(value==="") continue;
-"\n🎯 CT distances :"+ +
-"\n1 case : "+ct1+ +
-"\n2 cases : "+ct2+ +
-"\n3 cases : "+ct3+ +
-"\n4 cases : "+ct4++
  
-"\n\n===== MAGIE =====\n"+ +        const item=equipments[Number(value)];
-"Jet FM : "+jetFM+"\n\n"+ +
-sorts; +
-}+
  
 +        if(!item) continue;
  
-// ===== AUTO ===== +        for(const [stat,bonus] of Object.entries(item.stats||{})){ 
-function autoCalculate(){ + 
-updateCost(); +            if(stat==="fPui" && bonus===true){ 
-calculate();+                forcePui=true; 
 +                continue; 
 +            } 
 + 
 +            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; 
 +    }
 } }
  
-// events stats +    /* Sorts : bonus de plus grande valeur absolue */
-document.querySelectorAll("#stats input").forEach(i=>{ +
-i.addEventListener("input", autoCalculate); +
-});+
  
-document.querySelectorAll(".spell").forEach(s=>{ +    let bestDex=0; 
-s.addEventListener("change", autoCalculate); +    let bestProt=0;
-});+
  
 +    const spellDetails=[];
  
-// passifs +    spells.forEach((spell,i)=>{
-document.querySelectorAll(".skill").forEach(s=>{ +
-s.addEventListener("change", autoCalculate); +
-});+
  
 +        const cb=document.getElementById("spell_"+i);
  
 +        if(!cb||!cb.checked) return;
  
-// ===== RESET ===== +        if(Math.abs(spell.dex)>Math.abs(bestDex)){ 
-function resetAll(){+            bestDex=spell.dex; 
 +        }
  
-document.querySelectorAll("#stats input").forEach(i=>i.value=0); +        if(Math.abs(spell.prot)>Math.abs(bestProt)){ 
-document.querySelectorAll(".spell").forEach(s=>s.checked=false);+            bestProt=spell.prot; 
 +        }
  
-Object.values(slots).forEach(s=>{ +        spellDetails.push(spell.name); 
-s.value=""; +    });
-s.disabled=false; +
-});+
  
-document.querySelectorAll(".skill").forEach(s=>s.checked=false);+    document.getElementById("spellBonus").textContent= 
 +        spellDetails.length 
 +        ? "Sorts actifs : "+spellDetails.join(", ")+ 
 +          " | Bonus Dex : "+bestDex+ 
 +          " | Protection : "+bestProt 
 +        : "";
  
-resetSlots(); +    /* Dés */
-fillEquip(); +
-displayBase(); +
-checkLimit(); +
-autoCalculate(); +
-}+
  
-// init +    const ccDice=char.cc*2; 
-autoCalculate();+    const ctDice=char.ct*2; 
 +    const fmDice=char.fm*2; 
 +    const agiDice=char.agi*2;
  
 +    /* Fiche personnage */
  
 +    let result="=== PERSONNAGE ===\n\n";
  
-// ===== POUSSEE ===== +    statOrder.forEach(stat=>{
-function calculatePush(){+
  
-let F=+pushF.value; +        if(char[stat]!==undefined){
-let buff=+pushBuff.value;+
  
-let E=+pushE.value; +            result+= 
-let agi=+pushAgi.value; +                (statLabels[stat]||stat)+ 
-let pv=+pushPV.value;+                ": "+char[stat]+"\n"; 
 +        } 
 +    });
  
-let instability=+pushDebuff.value; +    if(griffes){
-let stability=+pushStab.value;+
  
-let attaque=F+buff; +        result+=griffesActives 
-let defense=Math.max(E+4,agi)+(pv/10)+instability+stability;+            ? "\nGriffes : +3 F appliqué." 
 +            : "\nGriffes : inactif (arme autre que ceste ou mains de mana)."; 
 +    }
  
-pushResult.textContent= +    result+="\n\n=== COMBAT ===\n\n"; 
-"Attaque: "+attaque+ + 
-"\nDéfense: "+defense.toFixed(1)+ +    /* Touchers */ 
-"\n"+(attaque>=defense?"✅ PUSH":"❌ FAIL");+ 
 +    const finalCC= 
 +        ccDice+bestDex+(fulgurance?1:0); 
 + 
 +    const finalCT= 
 +        ctDice+bestDex; 
 + 
 +    const finalFM= 
 +        fmDice+bestDex; 
 + 
 +    result+="Toucher CAC : "+finalCC+"\n"; 
 +    result+="Toucher tir : "+finalCT+"\n"; 
 +    result+="FM : "+finalFM+"\n"; 
 + 
 +    /* Tir par distance */ 
 + 
 +    result+="\n=== TIR ===\n\n"; 
 + 
 +    for(let cases=1;cases<=4;cases++){ 
 + 
 +        let ctDistance=finalCT; 
 + 
 +        if(cases>2){ 
 +            ctDistance-=(cases-2)*3; 
 +        } 
 + 
 +        result+= 
 +            cases+ 
 +            " case(s) : CT "+ 
 +            ctDistance+ 
 +            "\n"; 
 +    } 
 + 
 +    /* Esquive CAC */ 
 + 
 +    const meleeDodge= 
 +        Math.max(ccDice,agiDice)+bestProt; 
 + 
 +    result+="\n=== ESQUIVE CAC ===\n\n"; 
 +    result+="Esquive : "+meleeDodge+"\n"; 
 + 
 +    /* Esquive tir */ 
 + 
 +    let evadeStat; 
 + 
 +    if(couverture){ 
 + 
 +        evadeStat=Math.floor( 
 +            char.cc*0.85+char.agi*0.15 
 +        ); 
 + 
 +    }else if(reflexes){ 
 + 
 +        evadeStat=Math.floor( 
 +            char.agi*0.85+char.cc*0.15 
 +        ); 
 + 
 +    }else{ 
 + 
 +        evadeStat=Math.max( 
 +            Math.floor( 
 +                char.cc*0.75+ 
 +                char.agi*0.25 
 +            ), 
 +            Math.floor( 
 +                char.agi*0.75+ 
 +                char.cc*0.25 
 +            ) 
 +        ); 
 +    } 
 + 
 +    const fulguranceDodge= 
 +        fulgurance? 
 +        Math.floor(char.mvt/5): 
 +        0; 
 + 
 +    const rangedDodge= 
 +        evadeStat*2+ 
 +        bestProt+ 
 +        fulguranceDodge; 
 + 
 +    result+="\n=== ESQUIVE TIR ===\n\n"; 
 +    result+="Esquive tir : "+rangedDodge+"\n"; 
 + 
 +    /* Esquive FM */ 
 + 
 +    const fmDodge= 
 +        fmDice+ 
 +        bestProt; 
 + 
 +    result+="\n=== ESQUIVE FM ===\n\n"; 
 +    result+="Esquive FM : "+fmDodge+"\n"; 
 + 
 +    /* Magie */ 
 + 
 +    result+="\n=== MAGIE ===\n\n"; 
 +    result+="Jet FM : "+finalFM+"\n"; 
 + 
 +    for(let lvl=1;lvl<=5;lvl++){ 
 + 
 +        const threshold=6+6*lvl; 
 + 
 +        result+= 
 +            "Sort niveau "+ 
 +            lvl+ 
 +            " (seuil "+ 
 +            threshold+ 
 +            ") : "+ 
 +            ( 
 +                finalFM>=threshold 
 +                ?"Réussi" 
 +                :"Échec" 
 +            )+ 
 +            "\n"; 
 +    } 
 + 
 +    document.getElementById("result").textContent=result;
 } }
  
-// ===== EVENTS ===== +/* ========================================================= 
-document.querySelectorAll("input").forEach(i=>i.addEventListener("input",()=>{ +   SIMULATEUR DE POUSSEE 
-updateCost(); calculate(); calculatePush(); +   FORMULE CONSERVEE 
-}));+========================================================= */
  
-document.querySelectorAll("select").forEach(i=>i.addEventListener("change",()=>{ +function calculatePush(){
-updateCost(); calculate(); calculatePush(); +
-}));+
  
 +    const F=parseInt(
 +        document.getElementById("pushF").value,
 +        10
 +    )||0;
  
-// ===== INIT ===== +    const E=parseInt( 
-updateCost(); +        document.getElementById("pushE").value, 
-calculate(); +        10 
-calculatePush();+    )||0;
  
 +    const Agi=parseInt(
 +        document.getElementById("pushAgi").value,
 +        10
 +    )||0;
  
-// ===================================== +    const PV=parseInt( 
-// ENCODE / DECODE +        document.getElementById("pushPV").value, 
-// =====================================+        10 
 +    )||0;
  
-function encodeBuild(data){ +    const buff=parseInt( 
-    return encodeURIComponent(JSON.stringify(data));+        document.getElementById("pushBuff").value, 
 +        10 
 +    )||0; 
 + 
 +    const debuff=parseInt( 
 +        document.getElementById("pushDebuff").value, 
 +        10 
 +    )||0; 
 + 
 +    const stab=parseInt( 
 +        document.getElementById("pushStab").value, 
 +        10 
 +    )||0; 
 + 
 +    const finalF= 
 +        F+ 
 +        buff+ 
 +        debuff+ 
 +        stab; 
 + 
 +    const score= 
 +        finalF+ 
 +        E+ 
 +        Agi; 
 + 
 +    document.getElementById("pushResult").textContent= 
 +        "Force finale : "+finalF+ 
 +        "\nEndurance : "+E+ 
 +        "\nAgilité : "+Agi+ 
 +        "\nPV actuels : "+PV+ 
 +        "\n\nScore : "+score;
 } }
  
-function decodeBuild(code){ +/* EVENEMENTS POUSSEE */ 
-    return JSON.parse(decodeURIComponent(code));+ 
 +[ 
 +    "pushF", 
 +    "pushBuff", 
 +    "pushE", 
 +    "pushAgi", 
 +    "pushPV", 
 +    "pushDebuff", 
 +    "pushStab" 
 +].forEach(id=>{ 
 + 
 +    const el=document.getElementById(id); 
 + 
 +    el.addEventListener("input",calculatePush); 
 +    el.addEventListener("change",calculatePush); 
 +}); 
 + 
 +/* ========================================================= 
 +   RESET GENERAL 
 +========================================================= */ 
 + 
 +function resetAll(){ 
 + 
 +    raceSelect.selectedIndex=0; 
 + 
 +    statOrder.forEach(stat=>{ 
 + 
 +        const input=document.getElementById("up_"+stat); 
 + 
 +        if(input){ 
 +            input.value=0; 
 +        } 
 +    }); 
 + 
 +    resetSlots(); 
 + 
 +    skills.forEach((s,i)=>{ 
 + 
 +        const cb=document.getElementById("skill_"+i); 
 + 
 +        if(cb){ 
 +            cb.checked=false; 
 +        } 
 +    }); 
 + 
 +    spells.forEach((s,i)=>{ 
 + 
 +        const cb=document.getElementById("spell_"+i); 
 + 
 +        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(); 
 +    calculatePush();
 } }
  
-// ===================================== +/* ========================================================= 
-// BUILD DATA +   EXPORT / IMPORT / PARTAGE 
-// =====================================+========================================================= */
  
 function getBuildData(){ function getBuildData(){
  
-    let data = { +    const data={ 
-        race: raceSelect.value, +        race:raceSelect.value, 
-        stats: {}, +        upgrades:{}, 
-        equip: {}, +        equipment:{}, 
-        skills: [], +        skills:[], 
-        spells: []+        spells:[]
     };     };
  
-    // stats +    statOrder.forEach(stat=>{
-    for(let s in costTable){ +
-        data.stats[s] = +document.getElementById(s).value || 0; +
-    }+
  
-    // équipements +        const input=document.getElementById("up_"+stat); 
-    Object.entries(slots).forEach(([k,s])=>{ + 
-        data.equip[k] = s.value;+        if(input){ 
 +            data.upgrades[stat]= 
 +                parseInt(input.value,10)||0; 
 +        }
     });     });
  
-    // passifs +    for(const key in slots){ 
-    document.querySelectorAll(".skill:checked").forEach(s=>{ +        data.equipment[key]=slots[key].value; 
-        data.skills.push(s.dataset.name);+    } 
 + 
 +    skills.forEach((s,i)=>{ 
 + 
 +        const cb=document.getElementById("skill_"+i); 
 + 
 +        if(cb&&cb.checked){ 
 +            data.skills.push(i); 
 +        }
     });     });
  
-    // sorts +    spells.forEach((s,i)=>{ 
-    document.querySelectorAll(".spell:checked").forEach(s=>{ + 
-        data.spells.push({ +        const cb=document.getElementById("spell_"+i); 
-            dex: +s.dataset.dex, + 
-            prot: +s.dataset.prot +        if(cb&&cb.checked){ 
-        });+            data.spells.push(i); 
 +        }
     });     });
  
Ligne 758: Ligne 1801:
 } }
  
-// ===================================== +function applyBuildData(data){
-// APPLY BUILD +
-// =====================================+
  
-function applyBuild(data){+    if(data.race&&races[data.race]){ 
 +        raceSelect.value=data.race; 
 +    }
  
-    // race +    if(data.upgrades){ 
-    raceSelect.value = data.race || "Elfe";+ 
 +        statOrder.forEach(stat=>{ 
 + 
 +            const input=document.getElementById("up_"+stat); 
 + 
 +            if( 
 +                input&& 
 +                data.upgrades[stat]!==undefined 
 +            ){ 
 +                input.value=data.upgrades[stat]; 
 +            } 
 +        }); 
 +    }
  
-    // recharge équipements race 
-    resetSlots(); 
     fillEquip();     fillEquip();
  
-    // stats +    if(data.equipment){ 
-    for(let s in costTable){ + 
-        document.getElementById(s).value = +        for(const key in slots){ 
-            data.stats?.[s] || 0;+ 
 +            if(data.equipment[key]!==undefined){ 
 + 
 +                const wanted= 
 +                    String(data.equipment[key]); 
 + 
 +                const exists= 
 +                    [...slots[key].options] 
 +                    .some( 
 +                        option=> 
 +                            option.value===wanted 
 +                    ); 
 + 
 +                if(exists){ 
 +                    slots[key].value=wanted; 
 +                } 
 +            } 
 +        }
     }     }
-     
-    // équipements 
-    Object.entries(slots).forEach(([k,s])=>{ 
-        s.value = data.equip?.[k] || ""; 
-    }); 
  
-    // refresh affichage bonus équipements +    skills.forEach((s,i)=>{ 
-    Object.entries(slots).forEach(([k,s])=>{ + 
-        displayStats(s, slotToStatId[k]); +        const cb=document.getElementById("skill_"+i);
-    }); +
-    +
  
-    // passifs +        if(cb){ 
-    document.querySelectorAll(".skill").forEach(s=>{ +            cb.checked= 
-        s.checked = +                Array.isArray(data.skills)&& 
-            data.skills?.includes(s.dataset.name);+                data.skills.includes(i); 
 +        }
     });     });
  
-    // sorts +    spells.forEach((s,i)=>{
-    document.querySelectorAll(".spell").forEach(s=>{+
  
-        s.checked = data.spells?.some(sp => +        const cb=document.getElementById("spell_"+i);
-            sp.dex == +s.dataset.dex && +
-            sp.prot == +s.dataset.prot +
-        );+
  
 +        if(cb){
 +            cb.checked=
 +                Array.isArray(data.spells)&&
 +                data.spells.includes(i);
 +        }
     });     });
  
-    displayBase(); +    /* Corrige les configurations importées dépassant la limite */
-    checkLimit(); +
-    autoCalculate(); +
-}+
  
-// ===================================== +    let count=0;
-// EXPORT +
-// =====================================+
  
-function exportBuild(){+    for(const key of [ 
 +        "head", 
 +        "cape", 
 +        "rightHand", 
 +        "leftHand", 
 +        "body", 
 +        "feet" 
 +    ]){
  
-    let data = getBuildData();+        if(slots[key].value!==""){
  
-    let code = encodeBuild(data);+            count++;
  
-    prompt("Copie ton build :", code);+            if(count>3){ 
 +                slots[key].value=""; 
 +            } 
 +        } 
 +    } 
 + 
 +    displayAllEquipStats(); 
 +    checkLimit(); 
 +    calculate();
 } }
  
-// ===================================== +function exportBuild(){
-// IMPORT +
-// =====================================+
  
-function importBuild(codeInput){+    const encoded=btoa( 
 +        encodeURIComponent( 
 +            JSON.stringify(getBuildData()) 
 +        ) 
 +    );
  
-    let code = codeInput;+    prompt( 
 +        "Copiez ce code de configuration :", 
 +        encoded 
 +    ); 
 +}
  
-    if(!code){ +function importBuild(){
-        code = prompt("Colle le code du build :"); +
-    }+
  
-    if(!code) return;+    const text= 
 +        prompt( 
 +            "Collez le code de configuration :" 
 +        ); 
 + 
 +    if(!text) return;
  
     try{     try{
  
-        code = code.trim(); +        const data=JSON.parse( 
- +            decodeURIComponent( 
-        let data = decodeBuild(code);+                atob(text.trim()) 
 +            ) 
 +        );
  
-        applyBuild(data); +        applyBuildData(data);
- +
-        alert("✅ Build importé");+
  
     }catch(e){     }catch(e){
  
-        console.log(e); +        console.error("Erreur import :",e); 
- +        alert("Configuration invalide.");
-        alert("❌ Code invalide");+
     }     }
 } }
- 
-// ===================================== 
-// LIEN PARTAGE 
-// ===================================== 
  
 function copyLink(){ function copyLink(){
  
-    let data = getBuildData();+    const encoded=btoa( 
 +        encodeURIComponent( 
 +            JSON.stringify(getBuildData()) 
 +        ) 
 +    );
  
-    let code = encodeBuild(data);+    const url= 
 +        location.origin+ 
 +        location.pathname+ 
 +        "?id=simulateur&build="+ 
 +        encoded;
  
-    let url = +    if( 
-        window.location.origin + +        navigator.clipboard&& 
-        window.location.pathname + +        navigator.clipboard.writeText 
-        "?id=simulateur&build=" + code;+    ){
  
-    navigator.clipboard.writeText(url).then(()=>{+        navigator.clipboard.writeText(url) 
 +            .then( 
 +                ()=> 
 +                    alert( 
 +                        "Lien copié dans le presse-papiers." 
 +                    ) 
 +            ) 
 +            .catch( 
 +                ()=> 
 +                    prompt( 
 +                        "Copiez ce lien :", 
 +                        url 
 +                    ) 
 +            );
  
-        alert("🔗 Lien copié !");+    }else{
  
-    }).catch(()=>{+        prompt( 
 +            "Copiez ce lien :", 
 +            url 
 +        ); 
 +    } 
 +}
  
-        prompt("Copie ce lien :", url);+function loadFromURL(){
  
-    }); +    const params= 
-}+        new URLSearchParams(location.search);
  
-// ===================================== +    const encoded= 
-// AUTO LOAD URL +        params.get("build");
-// =====================================+
  
-(function(){+    if(!encoded) return;
  
     try{     try{
  
-        let params = +        const data=JSON.parse( 
-            new URLSearchParams(window.location.search);+            decodeURIComponent( 
 +                atob(encoded) 
 +            ) 
 +        );
  
-        let code = params.get("build");+        applyBuildData(data);
  
-        if(!code) return;+    }catch(e){
  
-        let data = decodeBuild(code);+        console.error( 
 +            "Erreur lors du chargement du build :", 
 +            e 
 +        );
  
-        applyBuild(data);+        alert( 
 +            "Impossible de charger la configuration depuis le lien." 
 +        ); 
 +    } 
 +}
  
-        console.log("✅ Build URL chargé");+/* ========================================================= 
 +   CHANGEMENT DE RACE 
 +========================================================= */
  
-    }catch(e){+raceSelect.addEventListener("change",()=>{
  
-        console.log("Erreur chargement URL", e);+    resetSlots(); 
 +    fillEquip(); 
 +    calculate(); 
 +});
  
-    }+/* ========================================================= 
 +   INITIALISATION 
 +========================================================= */
  
-})();+fillEquip(); 
 +displayBase(); 
 +calculate(); 
 +calculatePush(); 
 +loadFromURL();
  
 </script> </script>
 +
 </body> </body>
 </html> </html>
simulateur_saison3.1789941264.txt.gz · Dernière modification : 2026/09/20 23:54 de nanaki