brouillon10
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| brouillon10 [2026/04/29 16:57] – nanaki | brouillon10 [2026/04/29 23:56] (Version actuelle) – nanaki | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | < | ||
| < | < | ||
| < | < | ||
| Ligne 21: | Ligne 20: | ||
| } | } | ||
| - | /* MOBILE FIX */ | + | select |
| - | input { | + | input { margin: |
| - | | + | |
| - | } | + | |
| - | + | ||
| - | select | + | |
| - | max-width:180px; | + | |
| - | } | + | |
| .statLine { | .statLine { | ||
| display: | display: | ||
| justify-content: | justify-content: | ||
| - | | + | |
| } | } | ||
| .result { | .result { | ||
| - | background:# | + | background:# |
| + | color:# | ||
| padding: | padding: | ||
| + | white-space: | ||
| + | } | ||
| + | |||
| + | .small { | ||
| + | font-size: | ||
| + | color:#aaa; | ||
| } | } | ||
| </ | </ | ||
| Ligne 52: | Ligne 52: | ||
| < | < | ||
| - | <div id=" | + | <pre id=" |
| </ | </ | ||
| Ligne 81: | Ligne 81: | ||
| </ | </ | ||
| - | <button onclick=" | + | <button onclick=" |
| <pre id=" | <pre id=" | ||
| Ligne 96: | Ligne 96: | ||
| }; | }; | ||
| - | // ===== COSTS ===== | + | // ===== COST ===== |
| const costTable = { | const costTable = { | ||
| cc: | cc: | ||
| Ligne 113: | Ligne 113: | ||
| // ===== PASSIFS ===== | // ===== PASSIFS ===== | ||
| const skills = [ | const skills = [ | ||
| - | " | + | {name:" |
| - | "Duelliste", | + | {name:"Couverture",desc:"85% CC / 15% AGI"}, |
| - | "Encaisser", | + | {name:"Réflexes fulgurants",desc:"85% AGI / 15% CC"}, |
| - | "Anguille", | + | {name:" |
| - | "Couverture", | + | |
| - | "Inépuisable", | + | |
| - | "Maitre bretteur" | + | |
| ]; | ]; | ||
| - | // ===== ÉQUIPEMENTS | + | |
| + | // ===== ÉQUIPEMENTS ===== | ||
| const equipments = [ | const equipments = [ | ||
| - | {name:" | + | |
| - | {name:" | + | /* ================= COMMUNS ================= */ |
| - | {name:" | + | |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| - | {name:" | + | {name:" |
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= ELFES ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= NAINS ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= GÉANTS ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= HS ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= OLYMPIENS ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | |||
| + | /* ================= ANNEAUX ================= */ | ||
| + | |||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| + | {name:" | ||
| ]; | ]; | ||
| Ligne 141: | Ligne 221: | ||
| const baseDiv = document.getElementById(" | const baseDiv = document.getElementById(" | ||
| - | const slots = [" | ||
| - | |||
| - | // race select | ||
| for(let r in races){ | for(let r in races){ | ||
| raceSelect.innerHTML += `< | raceSelect.innerHTML += `< | ||
| } | } | ||
| - | // stats inputs | + | // stats UI |
| for(let s in costTable){ | for(let s in costTable){ | ||
| - | statsDiv.innerHTML += `<div class=" | + | statsDiv.innerHTML += ` |
| + | <div class=" | ||
| + | <span>${s}</ | ||
| + | < | ||
| + | </ | ||
| } | } | ||
| // passifs | // passifs | ||
| skills.forEach(s=> | skills.forEach(s=> | ||
| - | document.getElementById(" | + | document.getElementById(" |
| + | < | ||
| + | <input type=" | ||
| + | <b>${s.name}</ | ||
| + | <span class=" | ||
| + | </ | ||
| }); | }); | ||
| - | // ===== BASE STATS DISPLAY ===== | + | // base stats |
| function displayBase(){ | function displayBase(){ | ||
| - | let r = races[raceSelect.value]; | + | baseDiv.textContent |
| - | baseDiv.innerHTML = JSON.stringify(r,null,2); | + | |
| } | } | ||
| + | raceSelect.addEventListener(" | ||
| + | displayBase(); | ||
| - | // ===== EQUIP ===== | + | // ===== COST ===== |
| - | function | + | function |
| - | slots.forEach(id=>{ | + | let total=0, |
| - | document.getElementById(id).innerHTML = `<option value="" | + | for(let i=1; |
| - | }); | + | if(i===1) last=b; |
| + | else if(i<=3) last+=m1; | ||
| + | else last+=m2; | ||
| + | total+=last; | ||
| + | } | ||
| + | return total; | ||
| + | } | ||
| + | |||
| + | function updateCost(){ | ||
| + | let total=0; | ||
| + | for(let s in costTable){ | ||
| + | let v=+document.getElementById(s).value||0; | ||
| + | let [b, | ||
| + | total+=calcCost(b, | ||
| + | } | ||
| + | document.getElementById(" | ||
| + | } | ||
| + | |||
| + | // ===== SLOTS ===== | ||
| + | const slots = { | ||
| + | head: | ||
| + | leftHand: | ||
| + | }; | ||
| + | |||
| + | function resetSlots(){ | ||
| + | Object.values(slots).forEach(s=> | ||
| } | } | ||
| function fillEquip(){ | function fillEquip(){ | ||
| + | let r=raceSelect.value; | ||
| + | |||
| equipments.forEach((e, | equipments.forEach((e, | ||
| - | if(e.slot===" | + | if(e.race!==" |
| - | rightHand.innerHTML += `<option value=" | + | |
| - | if(e.slot===" | + | if(e.slot===" |
| - | leftHand.innerHTML += `<option value=" | + | if(e.slot===" |
| - | if(e.slot===" | + | if(e.slot===" |
| - | body.innerHTML += `<option value=" | + | if(e.slot===" |
| - | if(e.slot===" | + | if(e.slot===" |
| - | head.innerHTML += `<option value=" | + | if(e.slot===" |
| - | if(e.slot===" | + | if(e.slot===" |
| - | neck.innerHTML += `<option value=" | + | if(e.slot===" |
| - | if(e.slot===" | + | |
| - | cape.innerHTML += `<option value=" | + | |
| - | if(e.slot===" | + | |
| - | feet.innerHTML += `<option value=" | + | |
| - | if(e.slot===" | + | |
| - | ring.innerHTML += `<option value=" | + | |
| }); | }); | ||
| } | } | ||
| - | raceSelect.addEventListener(" | + | raceSelect.addEventListener(" |
| - | displayBase(); | + | resetSlots(); |
| - | resetEquip(); | + | |
| fillEquip(); | fillEquip(); | ||
| + | autoCalculate(); | ||
| }); | }); | ||
| - | displayBase(); | + | resetSlots(); |
| fillEquip(); | fillEquip(); | ||
| - | // ===== COST ===== | + | // ===== BONUS ===== |
| - | function | + | function |
| - | let total=0, last=b; | + | let v=select.value; |
| - | for(let i=1;i<=n;i++){ | + | let el=document.getElementById(id); |
| - | if(i===1) last=b; | + | if(v==="" |
| - | else if(i<=3) last+=m1; | + | let e=equipments[v]; |
| - | else last+=m2; | + | let txt="" |
| - | total+=last; | + | for(let s in e.stats){ |
| + | let val=e.stats[s]; | ||
| + | txt+=val>0?`+${val} ${s} `:`${val} ${s} `; | ||
| + | } | ||
| + | el.innerHTML=txt; | ||
| + | } | ||
| + | |||
| + | Object.entries(slots).forEach(([k, | ||
| + | s.addEventListener(" | ||
| + | displayStats(s, | ||
| + | checkLimit(); | ||
| + | autoCalculate(); | ||
| + | }); | ||
| + | }); | ||
| + | |||
| + | // ===== LIMIT ===== | ||
| + | function checkLimit(){ | ||
| + | let count=0; | ||
| + | Object.entries(slots).forEach(([k, | ||
| + | if(k!==" | ||
| + | }); | ||
| + | |||
| + | if(count> | ||
| + | limitWarn.innerText=" | ||
| + | Object.entries(slots).forEach(([k, | ||
| + | if(k!==" | ||
| + | }); | ||
| + | }else{ | ||
| + | limitWarn.innerText="" | ||
| + | Object.values(slots).forEach(s=> | ||
| } | } | ||
| - | return total; | ||
| } | } | ||
| Ligne 216: | Ligne 352: | ||
| function calculate(){ | function calculate(){ | ||
| - | let char = {...races[raceSelect.value]}; | + | let char={...races[raceSelect.value]}; |
| - | let totalPI = 0; | + | |
| - | let equipCount = 0; | + | |
| - | // stats | + | // stats investies |
| for(let s in costTable){ | for(let s in costTable){ | ||
| - | let v = +document.getElementById(s).value || 0; | + | let v=+document.getElementById(s).value||0; |
| - | char[s]+=v; | + | char[s]=(char[s]||0)+v; |
| - | let [b, | + | |
| - | totalPI | + | |
| } | } | ||
| // equip | // equip | ||
| - | slots.forEach(id=>{ | + | Object.values(slots).forEach(sel=>{ |
| - | let val = document.getElementById(id).value; | + | if(sel.value==="" |
| - | if(val==="" | + | let e=equipments[sel.value]; |
| + | for(let s in e.stats){ | ||
| + | char[s]=(char[s]||0)+e.stats[s]; | ||
| + | } | ||
| + | }); | ||
| - | let e = equipments[val]; | + | // esquive |
| + | let esquive=Math.round(char.agi*0.75+char.cc*0.25); | ||
| - | if(e.slot!==" | + | let checked=[...document.querySelectorAll(".skill: |
| - | for(let stat in e.stats){ | + | if(checked.includes(" |
| - | char[stat]=(char[stat]||0)+e.stats[stat]; | + | esquive=Math.round(char.agi*0.85+char.cc*0.15); |
| + | |||
| + | if(checked.includes(" | ||
| + | esquive=Math.round(char.cc*0.85+char.agi*0.15); | ||
| + | |||
| + | if(checked.includes(" | ||
| + | esquive+=1; | ||
| + | |||
| + | // affichage | ||
| + | result.textContent = | ||
| + | "===== STATS =====\n" | ||
| + | JSON.stringify(char, | ||
| + | " | ||
| + | " | ||
| + | "\n✨ FM : " | ||
| + | " | ||
| } | } | ||
| + | |||
| + | // ===== AUTO ===== | ||
| + | function autoCalculate(){ | ||
| + | updateCost(); | ||
| + | calculate(); | ||
| + | } | ||
| + | |||
| + | // events stats | ||
| + | document.querySelectorAll("# | ||
| + | i.addEventListener(" | ||
| }); | }); | ||
| - | // limite | + | // passifs |
| - | document.getElementById("limitWarn").innerText | + | document.querySelectorAll(".skill").forEach(s=>{ |
| - | equipCount>3 ? "⚠ Trop d' | + | s.addEventListener("change", autoCalculate); |
| + | }); | ||
| - | // ===== SCORE ===== | + | // ===== RESET ===== |
| - | let cc = char.cc; | + | function resetAll(){ |
| - | let fm = char.fm; | + | |
| - | let ct1 = char.ct; | + | |
| - | let ct2 = char.ct -1; | + | |
| - | let ct3 = char.ct -2; | + | |
| - | let ct4 = char.ct -3; | + | |
| - | let esquiveTir = Math.round(char.agi*0.75 + char.cc*0.25); | + | document.querySelectorAll("# |
| - | // ===== RESULT ===== | + | Object.values(slots).forEach(s=>{ |
| - | result.innerText | + | s.value="" |
| - | JSON.stringify(char, | + | s.disabled=false; |
| - | + "\n\n💰 PI : "+totalPI | + | }); |
| - | + " | + | |
| - | + " | + | |
| - | + "\n✨ FM : "+fm | + | |
| - | + " | + | |
| + | document.querySelectorAll(" | ||
| + | |||
| + | resetSlots(); | ||
| + | fillEquip(); | ||
| + | displayBase(); | ||
| + | checkLimit(); | ||
| + | autoCalculate(); | ||
| } | } | ||
| - | </script> | + | // init |
| + | autoCalculate(); | ||
| + | </ | ||
| </ | </ | ||
| </ | </ | ||
brouillon10.1777474624.txt.gz · Dernière modification : 2026/04/29 16:57 de nanaki
