Make your own free website on Tripod.com
') document.write('
') nexttable='
'; document.write(nexttable); //-DRAW THE MAP i=0; while (i < 59) { for (h=0; h < 9; h++) { document.write(''); i++ } h=0; i++; document.write("
") } document.write('
'); //-DRAW HERO document.images[lToI(heroPos)].src = heroSprite; //-DRAW ITEMS for (m=0; m<=itemsTotal; m++) document.images[lToI(location[m])].src = sprite[m]; //-CREDITS document.write(' hymn@webtv.net Fantastic Gateway The DungeonPager
') //-CONTROLS document.write('
') } // -rewrite the status bar with selected info function fillForms(Loc) { list = document.look.whichLook; 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 = "Physique="+physique; displayString += " Agility "+agility; displayString += " Mentality="+mentality; displayString += " Perception="+perception; displayString += " SocialStatus="+socStat; } if (lookAt == "Items") { displayString = "Amber="+amber; displayString += " Potions="+potions; } if (lookAt == "ready weapon") displayString = rW+" risk="+rR+" att="+rA+" def="+rD; if (lookAt == "slung weapon") 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; if (displayString.length > 10) {showLongFolks()} return true } function showLongFolks() { it = displayString; for (a=0; a=it.length-1; a++) if (z<10) ? z-- : z=10 curr = it.substring(it.indexOf(a), it.indexOf(a+10)); setTimeout("showLongFolks()", 100) } // - 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) { magMod = power - Math.floor(Math.random()*iq[mon]); if (magMod<=0) magMod=0; curve = (Math.random()+Math.random())/2; if (document.look.item.selectedIndex == 5) { for (x=0; x risk) heroRoll = risk; dam = size[mon]+monRoll-magMod-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} document.look.whichLook.selectedIndex = 0; 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 (document.look.item.selectedIndex == 0) { 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 (document.look.item.selectedIndex == 3) { 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 (document.look.item.selectedIndex == 4) { 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.look.item; spell = list.options[list.selectedIndex].text; if (spell == "bow") { temp = elementalLocation; elementalLocation = -99; document.images[lToI(temp)].src = oldSprite(temp); return } if (spell == "drink potion") { agiStat=agility; phyStat=physique; potions--; temp = elementalLocation; elementalLocation = -99; oldSprite(temp); list.selectedIndex = 0 fillForms(heroPos); return; } if (spell == "enchant") { if (amber < 1) {alert("You are out of amber"); return} amber--; power = Math.floor(Math.random()*mentality); alert("Your Risk is +"+power) } if (spell == "blast") { temp = elementalLocation; elementalLocation = -99; oldSprite(temp); return } if (spell == "elemental") {return} if (spell == "distort time") { 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 (spell == "switch weapons") { 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; document.look.item.selectedndex = 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=58; heroSprite="hero.jpg"; desc[0]="castle"; sprite[0]="castle.jpg"; damAcc[0]=0; speed[0]=8; size[0]=8; goal[0]=-99; iq[0]=8; priority[0]=1; blocking[0]=0; mobile[0]=0; location[0]=0; desc[1]="wolf"; sprite[1]="hawk.jpg"; damAcc[1]=0; speed[1]=6; size[1]=0; goal[1]=-99; iq[1]=3; priority[1]=1; blocking[1]=0; mobile[1]=6; location[1]=12; desc[2]="wolf"; sprite[2]="hawk.jpg"; damAcc[2]=0; speed[2]=6; size[2]=0; goal[2]=-99; iq[2]=3; priority[2]=1; blocking[2]=0; mobile[2]=6; location[2]=13; desc[3]="wolf"; sprite[3]="hawk.jpg"; damAcc[3]=0; speed[3]=6; size[3]=0; goal[3]=-99; iq[3]=3; priority[3]=1; blocking[3]=0; mobile[3]=6; location[3]=14; desc[4]="wolf"; sprite[4]="hawk.jpg"; damAcc[4]=0; speed[4]=6; size[4]=0; goal[4]=-99; iq[4]=3; priority[4]=1; blocking[4]=0; mobile[4]=6; location[4]=15; desc[5]="wolf"; sprite[5]="hawk.jpg"; damAcc[5]=0; speed[5]=6; size[5]=0; goal[5]=-99; iq[5]=3; priority[5]=1; blocking[5]=0; mobile[5]=6; location[5]=16; desc[6]="wolf"; sprite[6]="hawk.jpg"; damAcc[6]=0; speed[6]=6; size[6]=0; goal[6]=-99; iq[6]=3; priority[6]=1; blocking[6]=0; mobile[6]=6; location[6]=17; desc[7]="wolf"; sprite[7]="hawk.jpg"; damAcc[7]=0; speed[7]=6; size[7]=0; goal[7]=-99; iq[7]=3; priority[7]=1; blocking[7]=0; mobile[7]=6; location[7]=21; desc[8]="amber"; sprite[8]="bauble.jpg"; damAcc[8]=0; speed[8]=6; size[8]=1; goal[8]=-99; iq[8]=2; priority[8]=0; blocking[8]=0; mobile[8]=0; location[8]=23; desc[9]="amber"; sprite[9]="bauble.jpg"; damAcc[9]=0; speed[9]=6; size[9]=1; goal[9]=-99; iq[9]=2; priority[9]=0; blocking[9]=0; mobile[9]=0; location[9]=24; desc[10]="amber"; sprite[10]="bauble.jpg"; damAcc[10]=0; speed[10]=6; size[10]=1; goal[10]=-99; iq[10]=2; priority[10]=0; blocking[10]=0; mobile[10]=0; location[10]=25; desc[11]="wolf"; sprite[11]="hawk.jpg"; damAcc[11]=0; speed[11]=6; size[11]=0; goal[11]=-99; iq[11]=3; priority[11]=1; blocking[11]=0; mobile[11]=6; location[11]=27; desc[12]="wolf"; sprite[12]="hawk.jpg"; damAcc[12]=0; speed[12]=6; size[12]=0; goal[12]=-99; iq[12]=3; priority[12]=1; blocking[12]=0; mobile[12]=6; location[12]=31; desc[13]="amber"; sprite[13]="bauble.jpg"; damAcc[13]=0; speed[13]=6; size[13]=1; goal[13]=-99; iq[13]=2; priority[13]=0; blocking[13]=0; mobile[13]=0; location[13]=33; desc[14]="amber"; sprite[14]="bauble.jpg"; damAcc[14]=0; speed[14]=6; size[14]=1; goal[14]=-99; iq[14]=2; priority[14]=0; blocking[14]=0; mobile[14]=0; location[14]=34; desc[15]="amber"; sprite[15]="bauble.jpg"; damAcc[15]=0; speed[15]=6; size[15]=1; goal[15]=-99; iq[15]=2; priority[15]=0; blocking[15]=0; mobile[15]=0; location[15]=35; desc[16]="wolf"; sprite[16]="hawk.jpg"; damAcc[16]=0; speed[16]=6; size[16]=0; goal[16]=-99; iq[16]=3; priority[16]=1; blocking[16]=0; mobile[16]=6; location[16]=37; desc[17]="wolf"; sprite[17]="hawk.jpg"; damAcc[17]=0; speed[17]=6; size[17]=0; goal[17]=-99; iq[17]=3; priority[17]=1; blocking[17]=0; mobile[17]=6; location[17]=41; desc[18]="wolf"; sprite[18]="hawk.jpg"; damAcc[18]=0; speed[18]=6; size[18]=0; goal[18]=-99; iq[18]=3; priority[18]=1; blocking[18]=0; mobile[18]=6; location[18]=42; desc[19]="wolf"; sprite[19]="hawk.jpg"; damAcc[19]=0; speed[19]=6; size[19]=0; goal[19]=-99; iq[19]=3; priority[19]=1; blocking[19]=0; mobile[19]=6; location[19]=43; desc[20]="wolf"; sprite[20]="hawk.jpg"; damAcc[20]=0; speed[20]=6; size[20]=0; goal[20]=-99; iq[20]=3; priority[20]=1; blocking[20]=0; mobile[20]=6; location[20]=44; desc[21]="wolf"; sprite[21]="hawk.jpg"; damAcc[21]=0; speed[21]=6; size[21]=0; goal[21]=-99; iq[21]=3; priority[21]=1; blocking[21]=0; mobile[21]=6; location[21]=45; desc[22]="wolf"; sprite[22]="hawk.jpg"; damAcc[22]=0; speed[22]=6; size[22]=0; goal[22]=-99; iq[22]=3; priority[22]=1; blocking[22]=0; mobile[22]=6; location[22]=46; desc[23]="heal"; sprite[23]="food.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]=47; desc[24]="heal"; sprite[24]="food.jpg"; damAcc[24]=0; speed[24]=0; size[24]=0; goal[24]=-99; iq[24]=0; priority[24]=0; blocking[24]=0; mobile[24]=0; location[24]=48; desc[25]="heal"; sprite[25]="food.jpg"; damAcc[25]=0; speed[25]=0; size[25]=0; goal[25]=-99; iq[25]=0; priority[25]=0; blocking[25]=0; mobile[25]=0; location[25]=57; itemsTotal=25; function contact(phasing, obstacle) {if (phasing=="hero" || obstacle=="hero") {if (obstacle=="hero") {obstacle=phasing; phasing="hero"} if (obstacle==0) {newScreen("sample36.html"); } if (obstacle==1) {combat(obstacle); oblit(obstacle); } if (obstacle==2) {combat(obstacle); oblit(obstacle); } if (obstacle==3) {combat(obstacle); oblit(obstacle); } if (obstacle==4) {combat(obstacle); oblit(obstacle); } if (obstacle==5) {combat(obstacle); oblit(obstacle); } if (obstacle==6) {combat(obstacle); oblit(obstacle); } if (obstacle==7) {combat(obstacle); oblit(obstacle); } if (obstacle==8) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==9) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==10) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==11) {combat(obstacle); oblit(obstacle); } if (obstacle==12) {combat(obstacle); oblit(obstacle); } if (obstacle==13) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==14) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==15) {oblit(obstacle); alert("you find magic amber"); amber++} if (obstacle==16) {combat(obstacle); oblit(obstacle); } if (obstacle==17) {combat(obstacle); oblit(obstacle); } if (obstacle==18) {combat(obstacle); oblit(obstacle); } if (obstacle==19) {combat(obstacle); oblit(obstacle); } if (obstacle==20) {combat(obstacle); oblit(obstacle); } if (obstacle==21) {combat(obstacle); oblit(obstacle); } if (obstacle==22) {combat(obstacle); oblit(obstacle); } if (obstacle==23) {oblit(obstacle); pickup("potion")} if (obstacle==24) {oblit(obstacle); pickup("potion")} if (obstacle==25) {oblit(obstacle); pickup("potion")} } else {if (obstacle==23) {oblit(obstacle); alert("A monster eats the potion")} if (obstacle==24) {oblit(obstacle); alert("A monster eats the potion")} if (obstacle==25) {oblit(obstacle); alert("A monster eats the potion")} }} makePage("bg-forest.gif") //-ready to cut and paste //---CUT AND PASTE DATA ABOVE---