AnthropicallyHuggingFaces's picture
Replace prototype with fusion system and CSV export
fc00bdb verified
Raw History Blame Contribute Delete
7.71 kB
<!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>