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--- heroPos=30; heroSprite="hero.jpg"; desc[0]="heal potion"; sprite[0]="bauble.jpg"; damAcc[0]=0; speed[0]=0; size[0]=0; goal[0]=-99; iq[0]=0; priority[0]=0; blocking[0]=0; mobile[0]=0; location[0]=0; desc[1]="heal potion"; sprite[1]="bauble.jpg"; damAcc[1]=0; speed[1]=0; size[1]=0; goal[1]=-99; iq[1]=0; priority[1]=0; blocking[1]=0; mobile[1]=0; location[1]=1; desc[2]="skeleton"; sprite[2]="skeleton.jpg"; damAcc[2]=0; speed[2]=8; size[2]=2; goal[2]=-99; iq[2]=2; priority[2]=1; blocking[2]=0; mobile[2]=8; location[2]=2; desc[3]="wall"; sprite[3]="wall.jpg"; damAcc[3]=0; speed[3]=0; size[3]=8; goal[3]=-99; iq[3]=1; priority[3]=0; blocking[3]=8; mobile[3]=0; location[3]=3; desc[4]="key"; sprite[4]="carpet.jpg"; damAcc[4]=0; speed[4]=0; size[4]=0; goal[4]=-99; iq[4]=3; priority[4]=0; blocking[4]=0; mobile[4]=0; location[4]=8; desc[5]="heal potion"; sprite[5]="bauble.jpg"; damAcc[5]=0; speed[5]=0; size[5]=0; goal[5]=-99; iq[5]=0; priority[5]=0; blocking[5]=0; mobile[5]=0; location[5]=10; desc[6]="skeleton"; sprite[6]="skeleton.jpg"; damAcc[6]=0; speed[6]=8; size[6]=2; goal[6]=-99; iq[6]=2; priority[6]=1; blocking[6]=0; mobile[6]=8; location[6]=11; desc[7]="skeleton"; sprite[7]="skeleton.jpg"; damAcc[7]=0; speed[7]=8; size[7]=2; goal[7]=-99; iq[7]=2; priority[7]=1; blocking[7]=0; mobile[7]=8; location[7]=12; desc[8]="wall"; sprite[8]="wall.jpg"; damAcc[8]=0; speed[8]=0; size[8]=8; goal[8]=-99; iq[8]=1; priority[8]=0; blocking[8]=8; mobile[8]=0; location[8]=13; desc[9]="wall"; sprite[9]="wall.jpg"; damAcc[9]=0; speed[9]=0; size[9]=8; goal[9]=-99; iq[9]=1; priority[9]=0; blocking[9]=8; mobile[9]=0; location[9]=16; desc[10]="wall"; sprite[10]="wall.jpg"; damAcc[10]=0; speed[10]=0; size[10]=8; goal[10]=-99; iq[10]=1; priority[10]=0; blocking[10]=8; mobile[10]=0; location[10]=20; desc[11]="wall"; sprite[11]="wall.jpg"; damAcc[11]=0; speed[11]=0; size[11]=8; goal[11]=-99; iq[11]=1; priority[11]=0; blocking[11]=8; mobile[11]=0; location[11]=21; desc[12]="bloodknight"; sprite[12]="sage.jpg"; damAcc[12]=0; speed[12]=10; size[12]=3; goal[12]=-99; iq[12]=6; priority[12]=1; blocking[12]=0; mobile[12]=0; location[12]=22; desc[13]="wall"; sprite[13]="wall.jpg"; damAcc[13]=0; speed[13]=0; size[13]=8; goal[13]=-99; iq[13]=1; priority[13]=0; blocking[13]=8; mobile[13]=0; location[13]=23; desc[14]="wall"; sprite[14]="wall.jpg"; damAcc[14]=0; speed[14]=0; size[14]=8; goal[14]=-99; iq[14]=1; priority[14]=0; blocking[14]=8; mobile[14]=0; location[14]=26; desc[15]="temple"; sprite[15]="gate.jpg"; damAcc[15]=0; speed[15]=8; size[15]=8; goal[15]=-99; iq[15]=8; priority[15]=1; blocking[15]=0; mobile[15]=0; location[15]=27; desc[16]="castle"; sprite[16]="gate.jpg"; damAcc[16]=0; speed[16]=8; size[16]=8; goal[16]=-99; iq[16]=8; priority[16]=1; blocking[16]=0; mobile[16]=0; location[16]=28; desc[17]="secret door"; sprite[17]="wall.jpg"; damAcc[17]=0; speed[17]=0; size[17]=0; goal[17]=-99; iq[17]=3; priority[17]=0; blocking[17]=0; mobile[17]=0; location[17]=31; desc[18]="wall"; sprite[18]="wall.jpg"; damAcc[18]=0; speed[18]=0; size[18]=8; goal[18]=-99; iq[18]=1; priority[18]=0; blocking[18]=8; mobile[18]=0; location[18]=36; desc[19]="temple"; sprite[19]="wall.jpg"; damAcc[19]=0; speed[19]=8; size[19]=8; goal[19]=-99; iq[19]=8; priority[19]=1; blocking[19]=0; mobile[19]=0; location[19]=37; desc[20]="wall"; sprite[20]="wall.jpg"; damAcc[20]=0; speed[20]=8; size[20]=8; goal[20]=-99; iq[20]=8; priority[20]=1; blocking[20]=0; mobile[20]=0; location[20]=38; desc[21]="wall"; sprite[21]="wall.jpg"; damAcc[21]=0; speed[21]=0; size[21]=8; goal[21]=-99; iq[21]=1; priority[21]=0; blocking[21]=8; mobile[21]=0; location[21]=40; desc[22]="wall"; sprite[22]="wall.jpg"; damAcc[22]=0; speed[22]=0; size[22]=8; goal[22]=-99; iq[22]=1; priority[22]=0; blocking[22]=8; mobile[22]=0; location[22]=41; desc[23]=""closed""; sprite[23]="gate.jpg"; damAcc[23]=0; speed[23]=0; size[23]=0; goal[23]=-99; iq[23]=0; priority[23]=0; blocking[23]=0; mobile[23]=0; location[23]=42; desc[24]="wall"; sprite[24]="wall.jpg"; damAcc[24]=0; speed[24]=0; size[24]=8; goal[24]=-99; iq[24]=1; priority[24]=0; blocking[24]=8; mobile[24]=0; location[24]=43; desc[25]="wall"; sprite[25]="wall.jpg"; damAcc[25]=0; speed[25]=0; size[25]=8; goal[25]=-99; iq[25]=1; priority[25]=0; blocking[25]=8; mobile[25]=0; location[25]=44; desc[26]="crypt entrance"; sprite[26]="gate.jpg"; damAcc[26]=0; speed[26]=0; size[26]=0; goal[26]=-99; iq[26]=3; priority[26]=0; blocking[26]=0; mobile[26]=0; location[26]=45; desc[27]="secret door"; sprite[27]="wall.jpg"; damAcc[27]=0; speed[27]=0; size[27]=0; goal[27]=-99; iq[27]=3; priority[27]=0; blocking[27]=0; mobile[27]=0; location[27]=46; desc[28]="altar"; sprite[28]="altar.jpg"; damAcc[28]=0; speed[28]=0; size[28]=0; goal[28]=-99; iq[28]=0; priority[28]=0; blocking[28]=0; mobile[28]=0; location[28]=47; desc[29]="axe"; sprite[29]="axe.jpg"; damAcc[29]=0; speed[29]=0; size[29]=0; goal[29]=-99; iq[29]=0; priority[29]=0; blocking[29]=0; mobile[29]=0; location[29]=48; desc[30]="amber"; sprite[30]="bauble.jpg"; damAcc[30]=0; speed[30]=1; size[30]=1; goal[30]=-99; iq[30]=1; priority[30]=0; blocking[30]=0; mobile[30]=0; location[30]=50; desc[31]="amber"; sprite[31]="bauble.jpg"; damAcc[31]=0; speed[31]=1; size[31]=1; goal[31]=-99; iq[31]=1; priority[31]=0; blocking[31]=0; mobile[31]=0; location[31]=51; desc[32]="shopkeeper"; sprite[32]="salesman.jpg"; damAcc[32]=0; speed[32]=1; size[32]=1; goal[32]=-99; iq[32]=1; priority[32]=0; blocking[32]=0; mobile[32]=1; location[32]=53; desc[33]="wall"; sprite[33]="wall.jpg"; damAcc[33]=0; speed[33]=0; size[33]=8; goal[33]=-99; iq[33]=1; priority[33]=0; blocking[33]=8; mobile[33]=0; location[33]=54; desc[34]="troll"; sprite[34]="troll.gif"; damAcc[34]=0; speed[34]=8; size[34]=8; goal[34]=5; iq[34]=4; priority[34]=1; blocking[34]=0; mobile[34]=8; location[34]=55; desc[35]="wall"; sprite[35]="wall.jpg"; damAcc[35]=0; speed[35]=0; size[35]=8; goal[35]=-99; iq[35]=1; priority[35]=0; blocking[35]=8; mobile[35]=0; location[35]=56; desc[36]="spear"; sprite[36]="spear.jpg"; damAcc[36]=0; speed[36]=0; size[36]=0; goal[36]=-99; iq[36]=0; priority[36]=0; blocking[36]=0; mobile[36]=0; location[36]=57; desc[37]="sword"; sprite[37]="sword.jpg"; damAcc[37]=0; speed[37]=0; size[37]=0; goal[37]=-99; iq[37]=0; priority[37]=0; blocking[37]=0; mobile[37]=0; location[37]=58; itemsTotal=37; alert("working") HELP