Replace prototype with fusion system and CSV export
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657<!DOCTYPE html><html><head><meta charset="utf-8"><title>Recluce Card Prototype</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{margin:0;background:#14100d;color:#ebd9b4;font-family:Georgia,serif;padding:14px}h1{font-size:20px;color:#e5b34b;margin:0 0 4px}h2{font-size:14px;color:#e5b34b;border-bottom:1px solid #4a3824;margin:14px 0 6px}.row{display:flex;gap:14px;flex-wrap:wrap}.col{flex:1;min-width:300px}.card{border:1px solid #8a6a3a;border-radius:8px;padding:8px;margin:6px 0;background:#241b13;font-size:12px}.card.sel{border-color:#e5b34b;box-shadow:0 0 6px #e5b34b}button{background:#7b562e;color:#fff;border:1px solid #c49645;border-radius:5px;padding:6px 10px;margin:2px;cursor:pointer}input[type=range]{width:100%}.bar{height:12px;background:#333;border-radius:4px;overflow:hidden}.bar i{display:block;height:100%}#log{font-size:11px;max-height:170px;overflow:auto;background:#0b0907;padding:6px;border-radius:5px}.note{font-size:11px;color:#a89877}</style></head><body><h1>Recluce Card Prototype</h1><div class="note">Design prototype. Numbers are first-pass values, not final balance. Slide a card to -25 (Order) or +25 (Chaos) to ascend its elements from Alpha to Prime.</div><div class="row"><div class="col"><h2>1. Mint and tune cards</h2><button onclick="mint()">Mint random card</button><div id="cards"></div></div><div class="col"><h2>2. Duel: your selected card vs a Chaos wizard</h2><div>Player HP <span id="php"></span><div class="bar"><i id="pb" style="background:#4a4"></i></div></div><div>Wizard HP <span id="ehp"></span><div class="bar"><i id="eb" style="background:#a44"></i></div></div><div>Wizard Chaos Mana <span id="emn"></span><div class="bar"><i id="mb" style="background:#a6f"></i></div></div><button onclick="cast()">Cast selected card</button><button onclick="wiz()">Wizard attacks</button><button onclick="resetDuel()">Reset duel</button><div id="log"></div></div></div><script>const EL=['Fire','Water','Steam','Earth','Air','Wood','Optics'];const T2={Fire:'Thermogenics',Water:'Tempest',Steam:'Vaporworks',Earth:'Tectonics',Air:'Aetherflux',Wood:'Ironwood',Optics:'Luminance'};const TPL=[['Thermal Projection',50,12],['Molecular Fortify',40,10],['Kinetic Ruiner',85,22]];let cards=[],sel=-1,P,E,seq=0;function resetDuel(){P={hp:100};E={hp:140,mana:100};draw();document.getElementById('log').innerHTML=''}function log(t){const l=document.getElementById('log');l.innerHTML=t+'<br>'+l.innerHTML}function rnd(){return Math.random()}function mint(){seq++;const t=TPL[Math.floor(rnd()*3)];const a=EL[Math.floor(rnd()*7)];let b=EL[Math.floor(rnd()*7)];if(b===a)b=EL[(EL.indexOf(a)+1)%7];const pv=+(rnd()*20-6).toFixed(1);cards.push({id:'CRD-'+Date.now().toString(36).toUpperCase()+seq,name:t[0],p:+(t[1]*(1+pv/100)).toFixed(1),cost:t[2],el:[a,b],asc:[0,0],pol:0,lvl:1,pv});if(sel<0)sel=0;draw()}function setPol(i,v){const c=cards[i];c.pol=+v;if(c.pol<=-25||c.pol>=25){c.el.forEach((e,j)=>{if(!c.asc[j]){c.asc[j]=c.pol<0?-1:1;log('Ascended '+e+' to '+(c.pol<0?'Order-':'Chaos-')+T2[e])}});c.lvl++;c.pol=0}draw()}function pick(i){sel=i;draw()}function side(c){return c.pol<-8||c.asc.some(x=>x<0)&&c.pol<=0?'order':c.pol>8||c.asc.some(x=>x>0)?'chaos':'gray'}function cast(){if(sel<0){log('Mint and select a card first');return}const c=cards[sel];const s=side(c);const asc=c.asc.filter(x=>x).length;let d=c.p*(1+asc*.35);if(E.mana<20){d*=2.5;log('Exhausted wizard: punish x2.5')}if(s==='order'){E.mana=Math.max(0,E.mana-c.cost*1.5);d*=.6;log('Order cast drains '+(c.cost*1.5).toFixed(0)+' wizard mana')}else if(s==='chaos'){d*=1.3;log('Chaos burst')}E.hp=Math.max(0,E.hp-d);log('You deal '+d.toFixed(0));draw()}function wiz(){const tax=1.15+(sel>=0&&side(cards[sel])==='order'?0.7:0);const cost=14*tax;E.mana=Math.max(0,E.mana-cost);if(E.mana<=0){log('Wizard burned out and cannot cast')}else if(rnd()<(sel>=0&&side(cards[sel])==='order'?.35:.1)){log('Bolt missed (Order screen). Cost '+cost.toFixed(0)+' mana')}else{P.hp=Math.max(0,P.hp-18);log('Wizard hits for 18. Cost '+cost.toFixed(0)+' mana')}draw()}function draw(){document.getElementById('cards').innerHTML=cards.map((c,i)=>'<div class="card '+(i===sel?'sel':'')+'"><b>'+c.id+'</b> '+c.name+' Lv'+c.lvl+' ['+side(c)+']<br>'+c.el.map((e,j)=>c.asc[j]?(c.asc[j]<0?'Order-':'Chaos-')+T2[e]+' Prime':e+' Alpha').join(' + ')+'<br>Power '+c.p+' | Cost '+c.cost+' | variance '+c.pv+'%<br>Polarity '+c.pol+'<input type="range" min="-25" max="25" value="'+c.pol+'" onchange="setPol('+i+',this.value)"><button onclick="pick('+i+')">Select for duel</button></div>').join('');document.getElementById('php').textContent=P.hp;document.getElementById('ehp').textContent=E.hp.toFixed(0);document.getElementById('emn').textContent=E.mana.toFixed(0);document.getElementById('pb').style.width=P.hp+'%';document.getElementById('eb').style.width=(E.hp/1.4)+'%';document.getElementById('mb').style.width=E.mana+'%'}resetDuel();mint();mint();</script></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101<!DOCTYPE html><html><head><meta charset="utf-8"><title>Recluce Fusion Prototype</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{margin:0;background:#14100d;color:#ebd9b4;font-family:Georgia,serif;padding:14px}h1{font-size:20px;color:#e5b34b;margin:0 0 4px}h2{font-size:14px;color:#e5b34b;border-bottom:1px solid #4a3824;margin:14px 0 6px}.row{display:flex;gap:14px;flex-wrap:wrap}.col{flex:1;min-width:320px}.card{border:1px solid #8a6a3a;border-radius:8px;padding:8px;margin:6px 0;background:#241b13;font-size:12px}.card.sel{border-color:#e5b34b;box-shadow:0 0 6px #e5b34b}button{background:#7b562e;color:#fff;border:1px solid #c49645;border-radius:5px;padding:6px 10px;margin:2px;cursor:pointer}input[type=range]{width:100%}.bar{height:12px;background:#333;border-radius:4px;overflow:hidden}.bar i{display:block;height:100%}#log{font-size:11px;max-height:190px;overflow:auto;background:#0b0907;padding:6px;border-radius:5px}.note{font-size:11px;color:#a89877}</style></head><body><h1>Recluce Fusion Prototype</h1><div class="note">Design prototype. Every pair of elements fuses into a different element, and results can be fused again. Property numbers and power values are first-pass, not balanced. Names marked auto-named are placeholders.</div><div class="row"><div class="col"><h2>1. Your cards (select two, then fuse)</h2><button onclick="doFuse()">Fuse selected</button><button onclick="mintBase()">Mint random base card</button><button onclick="dl()">Download fusion matrix CSV</button><div class="note">Discovered: <span id="codex"></span></div><div id="inv"></div></div><div class="col"><h2>2. Duel a Chaos wizard</h2><div>Player HP <span id="php"></span><div class="bar"><i id="pb" style="background:#4a4"></i></div></div><div>Wizard HP <span id="ehp"></span><div class="bar"><i id="eb" style="background:#a44"></i></div></div><div>Wizard Chaos Mana <span id="emn"></span><div class="bar"><i id="mb" style="background:#a6f"></i></div></div><button onclick="cast()">Cast chosen card</button><button onclick="wiz()">Wizard attacks</button><button onclick="resetDuel()">Reset duel</button><div id="log"></div></div></div><script>const DIMS=['heat','wet','dense','energy','light','life'];const BASE={Fire:{heat:3,energy:2,light:1},Water:{wet:3,heat:-1},Earth:{dense:3},Air:{energy:1,dense:-2},Wood:{life:3,dense:1},Optics:{light:3}};const PRE={Fire:'Pyro',Water:'Hydro',Earth:'Terra',Air:'Aero',Wood:'Xylo',Optics:'Lumi'};const HAND={'Fire|Water':'Steam','Earth|Fire':'Magma','Air|Fire':'Void','Earth|Water':'Mud','Earth|Steam':'Geyser','Fire|Void':'Plasma','Fire|Wood':'Ember','Fire|Optics':'Beam','Water|Wood':'Sap','Earth|Wood':'Petrified Oak','Air|Water':'Mist','Air|Earth':'Dust','Air|Wood':'Pollen','Air|Optics':'Mirage','Optics|Water':'Prism','Earth|Optics':'Crystal','Optics|Wood':'Bloom'};function mkBase(n){const v={};DIMS.forEach(k=>v[k]=BASE[n][k]||0);return{name:n,vec:v,tree:n,depth:0,auto:false}}function fuse(a,b){const tree='('+[a.tree,b.tree].sort().join('+')+')';const v={};DIMS.forEach(k=>v[k]=Math.max(-5,Math.min(5,a.vec[k]+b.vec[k])));const key=[a.name,b.name].sort().join('|');let name,auto;if(HAND[key]){name=HAND[key];auto=false}else{const ps=[PRE[a.name]||a.name.slice(0,4),PRE[b.name]||b.name.slice(0,4)].sort();name=ps.join('-');auto=true}return{name:name,vec:v,tree:tree,depth:Math.max(a.depth,b.depth)+1,auto:auto}}function power(e){return DIMS.reduce((s,k)=>s+Math.abs(e.vec[k]),0)}function matrixCSV(){const B=Object.keys(BASE).map(mkBase);const L1=[];for(let i=0;i<B.length;i++)for(let j=i+1;j<B.length;j++)L1.push(fuse(B[i],B[j]));const pool=B.concat(L1);const out=[['depth','input_a','input_b','result','recipe','auto_named'].concat(DIMS).concat(['power']).join(',')];for(let i=0;i<pool.length;i++)for(let j=i+1;j<pool.length;j++){const e=fuse(pool[i],pool[j]);out.push([e.depth,pool[i].name,pool[j].name,e.name,e.tree,e.auto?'yes':'no'].concat(DIMS.map(k=>e.vec[k])).concat([power(e)]).join(','));}return out.join('\n')+'\n';}let inv=[],selIdx=[],duelIdx=-1,seen={},P,E;function add(e){inv.push({el:e,pol:0,prime:0})}function log(t){const l=document.getElementById('log');l.innerHTML=t+'<br>'+l.innerHTML}function mintBase(){const n=Object.keys(BASE);add(mkBase(n[Math.floor(Math.random()*n.length)]));draw()}function toggle(i){const k=selIdx.indexOf(i);if(k>=0)selIdx.splice(k,1);else{if(selIdx.length==2)selIdx.shift();selIdx.push(i)}draw()}function doFuse(){if(selIdx.length!=2){log('Select two cards to fuse');return}const a=inv[selIdx[0]],b=inv[selIdx[1]];const r=fuse(a.el,b.el);const hi=Math.max(selIdx[0],selIdx[1]),lo=Math.min(selIdx[0],selIdx[1]);inv.splice(hi,1);inv.splice(lo,1);add(r);const isNew=!seen[r.tree];seen[r.tree]=r.name;log((isNew?'NEW: ':'')+a.el.name+' + '+b.el.name+' = '+r.name+' (depth '+r.depth+', power '+power(r)+')');selIdx=[];duelIdx=-1;draw()}function setPol(i,v){const c=inv[i];c.pol=+v;if(!c.prime&&Math.abs(c.pol)>=25){c.prime=c.pol<0?-1:1;log(c.el.name+' ascended to '+(c.prime<0?'Order':'Chaos')+' Prime');c.pol=0}draw()}function duelPick(i){duelIdx=i;draw()}function sideOf(c){return c.prime<0||c.pol<-8?'order':(c.prime>0||c.pol>8?'chaos':'gray')}function cardPower(c){return power(c.el)*(1+0.35*Math.abs(c.prime))}function resetDuel(){P={hp:100};E={hp:140,mana:100};document.getElementById('log').innerHTML='';draw()}function cast(){if(duelIdx<0||!inv[duelIdx]){log('Pick a card for the duel first');return}const c=inv[duelIdx],s=sideOf(c),cost=6+c.el.depth*4;let d=cardPower(c)*2;if(E.mana<20){d*=2.5;log('Wizard exhausted: punish x2.5')}if(s=='order'){E.mana=Math.max(0,E.mana-cost*1.5);d*=0.6;log('Order cast drains '+(cost*1.5).toFixed(0)+' wizard mana')}else if(s=='chaos'){d*=1.3}E.hp=Math.max(0,E.hp-d);log('You deal '+d.toFixed(0));draw()}function wiz(){const order=duelIdx>=0&&inv[duelIdx]&&sideOf(inv[duelIdx])=='order';const cost=14*(order?1.85:1.15);E.mana=Math.max(0,E.mana-cost);if(E.mana<=0)log('Wizard burned out');else if(Math.random()<(order?0.35:0.1))log('Bolt missed (cost '+cost.toFixed(0)+' mana)');else{P.hp=Math.max(0,P.hp-18);log('Wizard hits for 18 (cost '+cost.toFixed(0)+' mana)')}draw()}function dl(){const b=new Blob([matrixCSV()],{type:'text/csv'});const a=document.createElement('a');a.href=URL.createObjectURL(b);a.download='recluce_fusion_matrix.csv';a.click()}function draw(){document.getElementById('inv').innerHTML=inv.map((c,i)=>{const e=c.el,tag=c.prime?(c.prime<0?' [Order Prime]':' [Chaos Prime]'):'';return '<div class="card '+(selIdx.includes(i)?'sel':'')+'"><b>'+e.name+'</b>'+tag+(e.auto?' <i>(auto-named)</i>':'')+' depth '+e.depth+' power '+cardPower(c).toFixed(1)+'<br><span class="note">'+e.tree+'</span><br>'+DIMS.map(k=>k+' '+e.vec[k]).join(' | ')+'<br>Polarity '+c.pol+'<input type="range" min="-25" max="25" value="'+c.pol+'" onchange="setPol('+i+',this.value)">'+'<button onclick="toggle('+i+')">'+(selIdx.includes(i)?'Deselect':'Select to fuse')+'</button><button onclick="duelPick('+i+')">'+(duelIdx==i?'In duel':'Use in duel')+'</button></div>'}).join('');document.getElementById('codex').textContent=Object.values(seen).join(', ')||'none yet';document.getElementById('php').textContent=P.hp;document.getElementById('ehp').textContent=E.hp.toFixed(0);document.getElementById('emn').textContent=E.mana.toFixed(0);document.getElementById('pb').style.width=P.hp+'%';document.getElementById('eb').style.width=(E.hp/1.4)+'%';document.getElementById('mb').style.width=E.mana+'%'}Object.keys(BASE).forEach(n=>{add(mkBase(n));add(mkBase(n))});resetDuel();</script></body></html>
index.html+84-40