Make your own free website on Tripod.com
') 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('
physique
agility
perception
mentality
current physique
current agility
social status
weapon risk
') fillForms() //-CREDIT LINE document.write('
hymn@webtv.net Fantastic Gateway The DungeonPager
') } 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 } 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 "transparent.gif" } 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")} } //-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"; fillForms() } function monMove(monPos) { validMove = true //-GENERATE RANDOM MOVE direction = Math.round(Math.random()*monIq[n]) 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) { if (sitPos < 9) posTens = 0; else posTens = Math.floor(sitPos/10); posOnes = sitPos - posTens*10 if (monTarget[n] < 9) tarTens = 0 else tarTens = Math.floor(monTarget[n]/10); tarOnes = monTarget[n]- 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 } function combat(mon) { document.images[lToI(heroPos)].src = heroSprite; monLoc[mon]=-99 monRoll = Math.round(monSpeed[mon]*(Math.random()+Math.random())/2); total = monSize[mon]+monRoll; if (wpnType == "unarmed") {useUnarmed(); return}; heroRoll = Math.round(Math.random()*risk+Math.random()*risk); if (heroRoll > risk) heroRoll = risk; dam = parseInt(total)-parseInt(heroRoll) damage(dam) } function useUnarmed() { risk = physique/2 + agility/2 + perception/2 + mentality/2 heroRoll = Math.round(Math.random()*rating) pcap = physique acap = agility/2 if (pcap > acap) {fincap = pcap} else {fincap = acap}; if (heroRoll > fincap) {roll = fincap}; alert("You attack unarmed; (Phy="+physique+", Agi="+agility+", Per="+perception+", Men="+mentality+"), rolling a "+heroRoll); dam = parseInt(total)-parseInt(heroRoll); damage(dam) } function damage(ouch) { if (ouch < 0) {alert("no damage"); return} agiStat -= ouch; if (agiStat < 0) {ouch = agiStat-2*agiStat; agiStat = 0}; else ouch = 0; phyStat -= ouch; if (phyStat < 0) {ouch = phyStat-2*phyStat; phyStat = 0}; else ouch = 0; socStat -= ouch; if (socStat < 1) alert("you die"); else alert("You now have "+agiStat+" agility, "+phyStat+" physique, and "+socStat+" social status") } function heal() { if (agiStat < agility) agiStat++; if (phyStat < physique) { roll = Math.round(Math.random()*5)+1 result = "you feel no better than yesterday" if (roll <= physique) {result = "you heal one physique point"; phyStat++} alert(result) } } 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} } //--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]="dragon"; monSpeed[0]=30; monSize[0]=30; monLoc[0]=2; monIq[0]=8; monTarget[0]=50; monSprite[0]="dragon.jpg"; monType[1]="dragon"; monSpeed[1]=30; monSize[1]=30; monLoc[1]=3; monIq[1]=8; monTarget[1]=50; monSprite[1]="dragon.jpg"; monType[2]="dragon"; monSpeed[2]=30; monSize[2]=30; monLoc[2]=14; monIq[2]=8; monTarget[2]=50; monSprite[2]="dragon.jpg"; monType[3]="dragon"; monSpeed[3]=30; monSize[3]=30; monLoc[3]=20; monIq[3]=8; monTarget[3]=14; monSprite[3]="dragon.jpg"; monType[4]="dragon"; monSpeed[4]=30; monSize[4]=30; monLoc[4]=41; monIq[4]=8; monTarget[4]=14; monSprite[4]="dragon.jpg"; monType[5]="dragon"; monSpeed[5]=30; monSize[5]=30; monLoc[5]=43; monIq[5]=8; monTarget[5]=14; monSprite[5]="dragon.jpg"; monType[6]="end"; terrType[0]="castle"; terrLoc[0]=44; terrSprite[0]="castle.jpg"; terrType[1]="end"; itemType[0]="end"; function contact(monster, who) {if (who == "hero") {if (monster == "dragon") {combat(m); return}; if (monster == "dragon") {combat(m); return}; if (monster == "dragon") {combat(m); return}; if (monster == "dragon") {combat(m); return}; if (monster == "dragon") {combat(m); return}; if (monster == "dragon") {combat(m); return}; if (monster == "castle") {alert("City of Corum"); ; ; ; return}; }; else {if (monster == "hero") {combat(n)}; if (monster == "dragon") {; return}; if (monster == "dragon") {; return}; if (monster == "dragon") {; return}; if (monster == "dragon") {; return}; if (monster == "dragon") {; return}; if (monster == "dragon") {; return}; if (monster == "castle") {; validMove=false; ; return}; } } makePage("bg-forest.gif"); //-ready to cut and paste //---CUT AND PASTE DATA ABOVE---