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]} //-DRAW STAT BOXES document.write('') document.write('
current physique
current agility
social status
weapon risk

physique
agility
perception
mentality
') //-CREDIT LINE document.write('
hymn@webtv.net Fantastic Gateway The DungeonPager
') fillForms() document.write('
') } function fillForms() { document.it.physique.value = physique document.it.agility.value = agility document.it.perception.value = perception document.it.mentality.value = mentality document.it.phyStat.value = phyStat document.it.agiStat.value = agiStat document.it.socStat.value = socStat document.it.risk.value = risk document.it.amber.value = amber } function oldSprite(oldPos) { //-CHECK FOR EXISTING MONSTERS for (m=0; monType[m] != "end"; m++) {if (oldPos == monLoc[m]) return monSprite[m]} //-CHECK FOR EXISTING TERRAINS for (m=0; terrType[m] != "end"; m++) {if (oldPos == terrLoc[m]) return terrSprite[m]} //-CHECK FOR EXISTING ITEMS for (m=0; itemType[m] != "end"; m++) {if (oldPos == itemLoc[m]) return itemSprite[m]} return mapBg } function move(moveTo) { validMove=false if (moveTo == heroPos) heal() //-CHECK FOR LEGAL MOVES 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; //-CHECK FOR TERRAIN COLLISIONS for (m=0; terrType[m] != "end"; m++) {if (moveTo == terrLoc[m]) contact(terrType[m], "hero")} //-CHECK FOR MONSTER COLLISIONS IF LEGAL if (validMove==true) {for (m=0; monType[m] != "end"; m++) {if (moveTo == monLoc[m]) contact(monType[m], "hero")}} //-CHECK FOR ITEM COLLISIONS for (m=0; itemType[m] != "end"; m++) {if (moveTo == itemLoc[m]) contact(itemType[m], "hero")} }; else bow(moveTo) //-EXECUTE MOVE IF LEGAL if (validMove==true) {document.images[lToI(heroPos)].src = oldSprite(heroPos); heroPos = moveTo} //-MOVE MONSTERS for (n=0; monType[n] != "end"; n++) {if (monLoc[n] >= 0) monMove(monLoc[n])}; //-DRAW HERO document.images[lToI(heroPos)].src = "hero.jpg"; } function monMove(monPos) { validMove = true //-GENERATE RANDOM MOVE direction = Math.round(Math.random()*(monIq[n]+4)) 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) contact("hero", monType[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 (posTens < tarTens) moveTo = sitPos+10; if (posTens > tarTens) moveTo = sitPos-10; if (posOnes < tarOnes) moveTo = sitPos+1; if (posOnes > tarOnes) moveTo = sitPos-1; if (Math.random()<.5) {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; result = "You roll "+heroRoll+heroMagic+", the "+monType[mon]+" rolls "+monTot+magResult damage(dam, result) } 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, epilogue) { phyDam = ouch-agiStat; if (phyDam <= 0) {alert("no damage"); return} agiStat = 0; socDam = phyDam - phyStat phyStat -= phyDam; if (phyStat < 0) {socDam -= phyStat; phyStat = 0; socStat -= socDam; } if (socStat < 1) {alert("you die"); document.location = document.location}; else alert(epilogue+" You now have "+agiStat+" agility, "+phyStat+" physique, and "+socStat+" social status"); fillForms() } function heal() { if (agiStat < agility) agiStat++; 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=50; heroSprite="hero.jpg"; monType[0]="skeleton1"; monSpeed[0]=8; monSize[0]=2; monLoc[0]=10; monIq[0]=3; monTarget[0]=-99; monSprite[0]="skeleton.jpg"; monType[1]="skeleton1"; monSpeed[1]=8; monSize[1]=2; monLoc[1]=12; monIq[1]=3; monTarget[1]=-99; monSprite[1]="skeleton.jpg"; monType[2]="skeleton"; monSpeed[2]=8; monSize[2]=2; monLoc[2]=34; monIq[2]=3; monTarget[2]=5; monSprite[2]="skeleton.jpg"; monType[3]="skeleton"; monSpeed[3]=8; monSize[3]=2; monLoc[3]=36; monIq[3]=3; monTarget[3]=5; monSprite[3]="skeleton.jpg"; monType[4]="skeleton"; monSpeed[4]=8; monSize[4]=2; monLoc[4]=37; monIq[4]=3; monTarget[4]=5; monSprite[4]="skeleton.jpg"; monType[5]="skeleton"; monSpeed[5]=8; monSize[5]=2; monLoc[5]=38; monIq[5]=3; monTarget[5]=5; monSprite[5]="skeleton.jpg"; monType[6]="skeleton"; monSpeed[6]=8; monSize[6]=2; monLoc[6]=44; monIq[6]=3; monTarget[6]=5; monSprite[6]="skeleton.jpg"; monType[7]="skeleton"; monSpeed[7]=8; monSize[7]=2; monLoc[7]=48; monIq[7]=3; monTarget[7]=5; monSprite[7]="skeleton.jpg"; monType[8]="skeleton"; monSpeed[8]=8; monSize[8]=2; monLoc[8]=54; monIq[8]=3; monTarget[8]=5; monSprite[8]="skeleton.jpg"; monType[9]="skeleton"; monSpeed[9]=8; monSize[9]=2; monLoc[9]=55; monIq[9]=3; monTarget[9]=5; monSprite[9]="skeleton.jpg"; monType[10]="skeleton"; monSpeed[10]=8; monSize[10]=2; monLoc[10]=56; monIq[10]=3; monTarget[10]=5; monSprite[10]="skeleton.jpg"; monType[11]="skeleton"; monSpeed[11]=8; monSize[11]=2; monLoc[11]=57; monIq[11]=3; monTarget[11]=5; monSprite[11]="skeleton.jpg"; monType[12]="skeleton"; monSpeed[12]=8; monSize[12]=2; monLoc[12]=58; monIq[12]=3; monTarget[12]=5; monSprite[12]="skeleton.jpg"; monType[13]="end"; terrType[0]="wall"; terrLoc[0]=23; terrSprite[0]="wall.jpg"; terrType[1]="wall"; terrLoc[1]=24; terrSprite[1]="wall.jpg"; terrType[2]="wall"; terrLoc[2]=26; terrSprite[2]="wall.jpg"; terrType[3]="wall"; terrLoc[3]=27; terrSprite[3]="wall.jpg"; terrType[4]="wall"; terrLoc[4]=28; terrSprite[4]="wall.jpg"; terrType[5]="wall"; terrLoc[5]=33; terrSprite[5]="wall.jpg"; terrType[6]="wall"; terrLoc[6]=43; terrSprite[6]="wall.jpg"; terrType[7]="wall"; terrLoc[7]=53; terrSprite[7]="wall.jpg"; terrType[8]="end"; itemType[0]="altar"; itemLoc[0]=45; itemSprite[0]="altar.jpg"; itemType[1]="sword"; itemLoc[1]=46; itemSprite[1]="sword.jpg"; itemType[2]="altar"; itemLoc[2]=47; itemSprite[2]="altar.jpg"; itemType[3]="end"; function contact(monster, who) {if (who == "hero") {if (monster == "skeleton1") {combat(m); return}; if (monster == "skeleton1") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "skeleton") {combat(m); return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "wall") {; validMove=false; ; ; return}; if (monster == "altar") {altar(); ; ; return}; if (monster == "sword") {calcRISK("sword"); itemLoc[m]=-99; return}; if (monster == "altar") {altar(); ; ; return}; }; else {if (monster == "hero") {combat(n)}; if (monster == "skeleton1") {; return}; if (monster == "skeleton1") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "skeleton") {; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "wall") {; validMove=false; ; return}; if (monster == "altar") {; ; ; return}; if (monster == "sword") {; ; ; return}; if (monster == "altar") {; ; ; return}; } } makePage("bg-muddy.gif"); //-ready to cut and paste //---CUT AND PASTE DATA ABOVE---