Make your own free website on Tripod.com
') document.write('
') nexttable='
'; document.write(nexttable); if (navigator.appName == "WebTV Internet Terminal") document.write('Health
Stats
Items
ready
slung
inspect
'); else document.write('
') i=0; while (i < 59) { for (h=0; h < 9; h++) { document.write(''); i++ } h=0; i++; document.write("
") } document.write('
'); document.write('
') document.images[lToI(heroPos)].src = heroSprite; for (m=0; m<=itemsTotal; m++) document.images[lToI(location[m])].src = sprite[m]; } lookAt="Health"; chosen="bow"; // -rewrite the status bar with selected info function fillForms(Loc) { if (navigator.appName != "WebTV Internet Terminal") { list=document.looky.lookit; lookAt=list.options[list.selectedIndex].text } if (lookAt == "Health") { displayString = "A"+nToG(agiStat, agility); displayString += " P"+nToG(phyStat, physique); displayString += " S("+socStat+")"; displayString += nToG(socStat, socStat) } if (lookAt == "Stats") { displayString = "Phy="+physique; displayString += " Agi "+agility; displayString += " Men="+mentality; displayString += " Per="+perception; displayString += " Soc="+socStat; } if (lookAt == "Items") { displayString = "Amber="+amber; displayString += " Potions="+potions; } if (lookAt == "ready") displayString = rW+" risk="+rR+" att="+rA+" def="+rD; if (lookAt == "slung") displayString = sW+" risk="+sR+" att="+sA+" def="+sD; if (lookAt == "inspect") { displayString = ""; for (g=0; g<=itemsTotal; g++) if (location[g] == Loc) { displayString += desc[g]+", "; } } status = displayString; return true } // - construct an ascii-graphic from numeric stats for status // - bar display function nToG(curr, maxi) { statGraph=""; for (i=0; i=0; p--) for (s=0; s<=itemsTotal; s++) if (location[s]==oldPos && priority[s]==p) return sprite[s]; return mapBg; } function oblit(victim) { temp=location[victim]; location[victim] = -99; document.images[lToI(temp)].src = oldSprite(temp) } // conduct a player turn function move(moveTo) { validMove=false; if (agiStat < agility) agiStat++; if (moveTo == heroPos) { heal(); movementLoop(); document.images[lToI(heroPos)].src = "hero.jpg"; return } if (moveTo == heroPos+1 || moveTo == heroPos-1 || moveTo == heroPos+9 || moveTo == heroPos+10 || moveTo == heroPos+11 || moveTo == heroPos-9 || moveTo == heroPos-10 || moveTo == heroPos-11) validMove=true; else bow(moveTo); if (validMove == false) { movementLoop(); document.images[lToI(heroPos)].src = "hero.jpg"; return } for (m=0; m<=itemsTotal; m++) if (moveTo == location[m]) if (blocking[m]!=0) {movementLoop(); return} for (m=0; m<=itemsTotal; m++) if (moveTo == location[m]) contact("hero", m); if (validMove==false) { movementLoop(); document.images[lToI(heroPos)].src = "hero.jpg"; return } document.images[lToI(heroPos)].src = oldSprite(heroPos); heroPos = moveTo //-MOVE MONSTERS movementLoop(); document.images[lToI(heroPos)].src = "hero.jpg"; fillForms(heroPos); } function movementLoop() { for (t=0; t<=itemsTotal; t++) if (location[t]>=0 && mobile[t]!=0) {active=t; monMove()} } function monMove() { if (location[active]<0) return; validMove = true moveTo = smartMove(); if (moveTo<0 || moveTo>58) return; if (moveTo==9 || moveTo==19 || moveTo==29 || moveTo==39 || moveTo==49) return; if (moveTo == elementalLocation) { if (Math.random() tarTens) return position-10; if (posOnes < tarOnes) return position+1; if (posOnes > tarOnes) return position-1; } else { if (posOnes < tarOnes) return position+1; if (posOnes > tarOnes) return position-1; if (posTens < tarTens) return position+10; if (posTens > tarTens) return position-10; } } power=0 function combat(mon) { curve = (Math.random()+Math.random())/2; if (chosen == "distort time") { for (x=0; xsize[mon]) ? size[mon] : speed[mon]; si = (size[mon]>speed[mon]) ? speed[mon] : size[mon]; if (sp>rA) sp-=rA; else sp=0; if (si>rD) si-=rD; else si=0; if (moveTo == heroPos) monRoll = si+(Math.round(speed[mon]*curve)-damAcc[mon]); else monRoll = sp+(Math.round(size[mon]*curve)-damAcc[mon]); if (monRoll<0) monRoll=0; heroRoll = Math.round(Math.random()+Math.random()*rR); if (heroRoll>rR) heroRoll=rR; dam = monRoll-heroRoll; damage(dam); } function damage(ouch) { if (ouch <= 0) {alert("no damage"); return} alert("you are hit for "+ouch+" damage"); if (agiStat-ouch < 0) {ouch -= agiStat; agiStat = 0} else {agiStat-=ouch; ouch = 0} if (phyStat-ouch< 0) {ouch -= phyStat; phyStat = 0} else {phyStat-=ouch; ouch = 0} socStat -= ouch; agiStat = 0; if (socStat < 1) {alert("you die"); document.location=document.location} lookAt = "Health"; fillForms(heroPos); return false } function heal() { if (phyStat < physique) { roll = Math.round(Math.random()*5)+1 result = "you feel no better than before" if (roll <= physique) {result = "you heal one physique point"; phyStat++} alert(result) } fillForms(heroPos); } function bow(targ) { if (chosen == "bow") { tarTens = Math.floor(targ/10); tarOnes = targ - tarTens*10; heroTens = Math.floor(heroPos/10); heroOnes = heroPos - heroTens*10; xDist = Math.abs(tarTens-heroTens); yDist = Math.abs(tarOnes-heroOnes); if (xDist>yDist) dist=xDist; else dist=yDist; if (dist>perception) {alert("it is too far for your bow"); return} for (m=0; m<=itemsTotal; m++) if (targ==location[m]) if (Math.random()>.5) { damAcc[m]=perception; alert("A hit!"); goal[m]=-99; } else alert("You miss") } if (chosen == "blast") { if (amber<2) {alert("You need more amber"); return} for (m=0; m<=itemsTotal; m++) if (targ==location[m]) { amber-=2; damAcc[m]=mentality; alert("you blast the "+desc[m]) } } if (chosen == "elemental") { if (amber<2) {alert("You need more amber"); return} amber-=2; document.images[lToI(targ)].src = oldSprite(targ); elementalLocation = targ; document.images[lToI(targ)].src="elemental.jpg"; } } activeSpell = 0 function useIt() { list=document.actions.actionList chosen=list.options[list.selectedIndex].text if (chosen == "bow") { temp = elementalLocation; elementalLocation = -99; document.images[lToI(temp)].src = oldSprite(temp); return } if (chosen == "potion") { if (potions<1) {alert("you have no potions"); return} agiStat=agility; phyStat=physique; potions--; temp = elementalLocation; elementalLocation = -99; oldSprite(temp); fillForms(heroPos); chosen="bow"; document.actions.actionList.selectedIndex = 0; return; } if (chosen == "enchant") { if (amber < 1) {alert("You are out of amber"); return} amber--; power = Math.floor(Math.random()*mentality); alert("Your Risk is +"+power) } if (chosen == "blast") { temp = elementalLocation; elementalLocation = -99; oldSprite(temp); return } if (chosen == "elemental") {return} if (chosen == "forsee") { if (amber<3) {alert("You need more amber"); return} alert("You see two branches of time"); amber-=3; temp = elementalLocation; elementalLocation = -99; oldSprite(temp); return } if (chosen == "draw") { temp = rW // ready weapon; rW = sW; sW = temp; temp = rR // ready weapon RISK; rR = sR; sR = temp; temp = rA // ready weapon attack bonus; rA = sA; sA = temp; temp = rD // ready weapon defence bonus; rD = sD; sD = temp; lookAt = "Health"; alert("You draw your "+rW+" and sheath your "+sW) chosen="bow"; document.actions.actionList.selectedIndex = 0; } } function pickup(item, bal, att, def) { if (item=="potion") {alert("you find a potion"); potions++; return} var phy=physique; var agi=agility; var per = perception; var men=mentality; if (phy < agi/2) phy = agi/2; if (agi < phy/2) agi = phy/2; bal0 = Math.round(phy*.25 + agi*.25 + per*.25 + men*.25); bal1 = Math.round(phy*.3 + agi*.3 + per*.2 + men*.2); bal2 = Math.round(phy*.5 + agi*.5); bal3 = Math.round(agi*1); bal4 = Math.round(phy*1); if (bal == "B0") newRisk = bal0; if (bal == "B1") newRisk = bal1; if (bal == "B2") newRisk = bal2; if (bal == "B3") newRisk = bal3; if (bal == "B4") newRisk = bal4; newStats = item+" risk="+newRisk+" att="+att+" def="+def; oldStats = sW+" risk="+sR+" att="+sA+" def="+sD; if (confirm("replace "+oldStats+" with "+newStats+"?")==true) { sW = item; sR = newRisk; sA = att; sD = def; } } function altar() { alert("you have earned an expertise point") if (confirm("do you want the point added to physique?") == true) {physique++; return} if (confirm("do you want the point added to agility?") == true) {agility++; return} if (confirm("do you want the point added to perception?") == true) {perception++; return} if (confirm("do you want the point added to mentality?") == true) {mentality++; return} fillForms(heroPos) } //--All copies must include this message //- Permission is granted to reproduce //- for non-commercial use only. //- original by hymn@webtv.net //- http://members.tripod.com/~AO //---CUT & PASTE DATA BELOW--- //---CUT AND PASTE DATA ABOVE--- HELP