Outils pour utilisateurs

Outils du site


brouillon8

Ceci est une ancienne révision du document !


Essai

Simulateur RPG

🧝 Simulateur RPG

Race

Stats à améliorer

Équipement

Tête
Cou
Dos
Main droite
Main gauche
Corps
Anneau
Pieds

Compétences (max 15)

Résultat


// ================= CALCUL ================= function calculate(){ let char = {...races[race.value]}; let totalPi=0; let magicBlocked=false; // stats for(let s in costTable){ let v=parseInt(document.getElementById(s).value)||0; char[s]+=v; totalPi+=cost(s,v); } // equip let slots = [head,neck,cape,rightHand,leftHand,body,feet]; let count=0; slots.forEach(sel=>{ if(sel.value==="") return; count++; let item = equipments[sel.value]; if(item.magicBlock) magicBlocked=true; for(let stat in item.stats){ char[stat]=(char[stat]||0)+item.stats[stat]; } }); if(count>3){ alert("Max 3 objets !"); return; } if(ring.value!==""){ let item = equipments[ring.value]; for(let stat in item.stats){ char[stat]+=item.stats[stat]; } } // skills let sk = document.querySelectorAll(".sk:checked"); if(sk.length>15){ alert("Max 15 compétences"); return; } // affichage result.innerText = Object.entries(char).map(([k,v])=>k.toUpperCase()+": "+v).join("\n") + "\n\nPI: "+totalPi + "\nCompétences: "+sk.length+"/15" + "\nMagie: "+(magicBlocked?"❌ BLOQUÉE":"✔ OK"); } // ================= EXPORT ================= function exportWiki(){ let txt="==== Build ====\n\n"; txt+="=== Race ===\n"+race.value+"\n\n"; txt+="=== Stats ===\n"; for(let s in costTable){ let v=document.getElementById(s).value; if(v>0) txt+=" * +"+v+" "+s+"\n"; } txt+="\n=== Équipement ===\n"; let map = { "Tête":head,"Cou":neck,"Dos":cape, "Main droite":rightHand,"Main gauche":leftHand, "Corps":body,"Anneau":ring,"Pieds":feet }; for(let k in map){ if(map[k].value!==""){ txt+=" * "+k+" : "+equipments[map[k].value].name+"\n"; } } txt+="\n=== Compétences ===\n"; document.querySelectorAll(".sk:checked").forEach(s=>{ txt+=" * "+s.parentNode.innerText+"\n"; }); result.innerText=txt; }

brouillon8.1777395266.txt.gz · Dernière modification : 2026/04/28 18:54 de nanaki