Make your own free website on Tripod.com
') document.write('
') document.write('
') //-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 MONSTERS for (m=0; monType[m] != "end"; m++) document.images[lToI(monLoc[m])].src = monSprite[m]; //-DRAW ITEMS for (m=0; itemType[m] != "end"; m++) document.images[lToI(itemLoc[m])].src = itemSprite[m]; //-DRAW TERRAINS for (m=0; terrType[m] != "end"; m++) document.images[lToI(terrLoc[m])].src = terrSprite[m]; //-CREDITS document.write('
hymn@webtv.net Fantastic Gateway The DungeonPager
') } function fillForms() { list = document.look.whichLook; lookAt = list.options[list.selectedIndex].text; phyDam = physique-phyStat if (lookAt == "Physique") displayString = "Physique "+nToG(phyStat, physique); if (lookAt == "Agility") displayString = "Agility "+nToG(agiStat, agility); if (lookAt == "Mentality") displayString = lookAt+"="+mentality; if (lookAt == "Risk") displayString = lookAt+"="+risk; if (lookAt == "Perception") displayString = lookAt+"="+perception; if (lookAt == "Social Status") displayString = "SocialStatus "+nToG(socStat, socStat); if (lookAt == "Health") displayString = "A"+nToG(agiStat, agility)+" P"+nToG(phyStat, physique)+" S("+socStat+")"+nToG(socStat, socStat); status = displayString; return true } function nToG(num1, num2) { statGraph=""; for (i=0; i= 0) monMove(monLoc[n]); //-DRAW HERO document.images[lToI(heroPos)].src = "hero.jpg"; fillForms(); } function monMove(monPos) { validMove = true //-GENERATE RANDOM MOVE direction = Math.floor(Math.random()*(monIq[n]+3)) if (direction < 1) moveTo = monPos-1; else if (direction == 1) moveTo = monPos+1; else if (direction == 2) moveTo = monPos-10; else if (direction == 3) moveTo = monPos+10; else if (direction > 3) smartMove(monPos); else return; //-CHECK FOR LEGAL MOVE if (moveTo < 0 || moveTo > 58) return; if (moveTo == 9 || moveTo == 19 || moveTo == 29 || moveTo == 39 || moveTo == 49) return; //-CHECK FOR TERRAIN COLLISIONS for (p=0; terrType[p] != "end"; p++) if (moveTo == terrLoc[p]) contact(terrType[p], monType[n]); //-CHECK FOR HERO COLLISIONS if (moveTo == heroPos) combat(n); if (monLoc[n] < 0) {document.images[lToI(monPos)].src = oldSprite(monPos); return} //-CHECK FOR ITEM COLLISIONS for (p=0; itemType[p] != "end"; p++) if (moveTo == itemLoc[p]) contact(itemType[p], itemType[n]); if (validMove == false) return; monLoc[n] = moveTo; document.images[lToI(monPos)].src = oldSprite(monPos); document.images[lToI(moveTo)].src = monSprite[n] } function smartMove(sitPos) { posTens = Math.floor(sitPos/10); posOnes = sitPos - posTens*10 if (monTarget[n] == -99) monT=heroPos; else monT = monTarget[n] tarTens = Math.floor(monT/10); tarOnes = monT- tarTens*10 if (Math.random()<.5) { if (posTens < tarTens) moveTo = sitPos+10; if (posTens > tarTens) moveTo = sitPos-10; if (posOnes < tarOnes) moveTo = sitPos+1; if (posOnes > tarOnes) moveTo = sitPos-1; } else { if (posOnes < tarOnes) moveTo = sitPos+1; if (posOnes > tarOnes) moveTo = sitPos-1; if (posTens < tarTens) moveTo = sitPos+10; if (posTens > tarTens) moveTo = sitPos-10; } if (posTens == tarTens && posOnes == tarOnes) {moveTo=sitPos; monTarget[n]=-99} } power=0 function combat(mon) { document.images[lToI(heroPos)].src = heroSprite; monLoc[mon]=-99 magResult = ""; heroMagic="" magMod = power - Math.floor(Math.random()*monIq[mon]); if (magMod<=0) magMod=0; if (power>0) { heroMagic = "+"+power+" magic points"; monRes=power-magMod; magResult=" and resists "+monRes+" magic points" } monRoll = Math.round(monSpeed[mon]*(Math.random()+Math.random())/2) - monDam[mon] heroRoll = Math.round(Math.random()*risk+Math.random()*risk); if (heroRoll > risk) heroRoll = risk; monTot = monSize[mon]+monRoll; dam = monTot-magMod-heroRoll; damage(dam) } function bow(target) { tarTens = Math.floor(target/10); tarOnes = target - 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 (mon=0; monType[mon] != "end"; mon++) {if (monLoc[mon] == target) if (Math.random() > .5) {monDam[mon]=perception; alert("A hit!")} else alert("You miss") } } function magic() { if (amber < 1) {alert("You are out of amber"); return} amber-- ; document.it.amber.value = amber power = Math.floor(Math.random()*mentality) alert("Your risk will be +"+power+" for the remainder of the battle"); } function damage(ouch) { if (ouch <= 0) {alert("no damage"); return} agiStat -= ouch; if (agiStat < 0) {ouch = Math.abs(agiStat); agiStat = 0} else ouch = 0; phyStat -= ouch; if (phyStat < 0) {ouch = phyStat-2*phyStat; phyStat = 0} else ouch = 0; socStat -= ouch; agiStat = 0 if (socStat < 1) alert("you die"); fillForms() } 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(); } function calcRISK(weapon) { var phy = physique var agi = agility var per = perception var men = mentality if (phy < agi/2) phy = agi/2; axeRISK = Math.round(phy*1); spearRISK = Math.round(agi/3 + phy/3 + 1); if (agi < phy/2) agi = phy/2; swordRISK = Math.round(agi*1); shtswdRISK = Math.round(phy/4 + agi/4 + per/4 + men/4 + .5); if (weapon == "axe") {newRisk = axeRISK} if (weapon == "sword") {newRisk = swordRISK} if (weapon == "spear") {newRisk = spearRISK} if (weapon == "shortsword") {newRisk = shtswdRISK} if (newRisk > risk) {risk = newRisk; alert("your risk is now "+risk)} else alert("this weapon is not as good as your present one") } function altar() { alert("you have earned an expertise point") if (confirm("do you want the point added to physique?") == true) {physique++; itemLoc[m] = -99; return} if (confirm("do you want the point added to agility?") == true) {agility++; itemLoc[m] = -99; return} if (confirm("do you want the point added to perception?") == true) {perception++; itemLoc[m] = -99; return} if (confirm("do you want the point added to mentality?") == true) {mentality++; itemLoc[m] = -99; return} fillForms() } //--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=0; heroSprite="hero.jpg"; monType[0]="bloodknight"; monSpeed[0]=10; monSize[0]=3; monDam[0]=0; monLoc[0]=0; monIq[0]=6; monTarget[0]=24; monSprite[0]="bloodknight.jpg"; monType[1]="bloodknight"; monSpeed[1]=10; monSize[1]=3; monDam[1]=0; monLoc[1]=8; monIq[1]=6; monTarget[1]=24; monSprite[1]="bloodknight.jpg"; monType[2]="bloodknight"; monSpeed[2]=10; monSize[2]=3; monDam[2]=0; monLoc[2]=50; monIq[2]=6; monTarget[2]=24; monSprite[2]="bloodknight.jpg"; monType[3]="bloodknight"; monSpeed[3]=10; monSize[3]=3; monDam[3]=0; monLoc[3]=58; monIq[3]=6; monTarget[3]=24; monSprite[3]="bloodknight.jpg"; monType[4]="end"; terrType[0]="castle"; terrLoc[0]=24; terrSprite[0]="castle.jpg"; terrType[1]="mountain"; terrLoc[1]=34; terrSprite[1]="mount.jpg"; terrType[2]="end"; itemType[0]="altar"; itemLoc[0]=4; itemSprite[0]="altar.jpg"; itemType[1]="altar"; itemLoc[1]=20; itemSprite[1]="altar.jpg"; itemType[2]="sword"; itemLoc[2]=28; itemSprite[2]="sword.jpg"; itemType[3]="axe"; itemLoc[3]=30; itemSprite[3]="axe.jpg"; itemType[4]="altar"; itemLoc[4]=38; itemSprite[4]="altar.jpg"; itemType[5]="spear"; itemLoc[5]=53; itemSprite[5]="spear.jpg"; itemType[6]="altar"; itemLoc[6]=54; itemSprite[6]="altar.jpg"; itemType[7]="end"; function contact(monster, who) {if (who == "hero") {if (monster == "castle") {alert("City of Corum"); ; ; ; return} if (monster == "mountain") {; validMove=false; ; ; return} if (monster == "altar") {altar(); ; ; return} if (monster == "altar") {altar(); ; ; return} if (monster == "sword") {calcRISK("sword"); itemLoc[m]=-99; return} if (monster == "axe") {calcRISK("axe"); itemLoc[m]=-99; return} if (monster == "altar") {altar(); ; ; return} if (monster == "spear") {calcRISK("spear"); itemLoc[m]=-99; return} if (monster == "altar") {altar(); ; ; return} } else {if (monster == "hero") {combat(n)} if (monster == "castle") {; validMove=false; ; return} if (monster == "mountain") {; ; ; return} if (monster == "altar") {; ; ; return} if (monster == "altar") {; ; ; return} if (monster == "sword") {; ; ; return} if (monster == "axe") {; ; ; return} if (monster == "altar") {; ; ; return} if (monster == "spear") {; ; ; return} if (monster == "altar") {; ; ; return} } } makePage("bg-forest.gif") //-ready to cut and paste //---CUT AND PASTE DATA ABOVE---