Frame 1
function get_difficulty(diff) {
if (diff == "game1") {
return("Basic");
}
if (diff == "game3") {
return("Advanced");
}
if (diff == "game3") {
return("Old School");
}
}
function myencode(src) {
var _local1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _local2 = 0;
var _local9 = new String("");
var _local7;
var _local5;
var _local4;
var _local11;
var _local10;
var _local8;
var _local3;
while (_local2 < src.length) {
_local7 = src.charCodeAt(_local2++);
_local5 = src.charCodeAt(_local2++);
_local4 = src.charCodeAt(_local2++);
_local11 = _local7 >> 2;
_local10 = ((_local7 & 3) << 4) | (_local5 >> 4);
_local8 = ((_local5 & 15) << 2) | (_local4 >> 6);
_local3 = _local4 & 63;
if (isNaN(_local5)) {
_local3 = 64;
_local8 = _local3;
} else if (isNaN(_local4)) {
_local3 = 64;
}
_local9 = _local9 + (_local1.charAt(_local11) + _local1.charAt(_local10));
_local9 = _local9 + (_local1.charAt(_local8) + _local1.charAt(_local3));
}
return(_local9);
}
function mydecode(src) {
var _local4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _local2 = 0;
var _local1 = new String("");
var _local8;
var _local11;
var _local10;
var _local9;
var _local7;
var _local5;
var _local6;
while (_local2 < src.length) {
_local9 = _local4.indexOf(src.charAt(_local2++));
_local7 = _local4.indexOf(src.charAt(_local2++));
_local5 = _local4.indexOf(src.charAt(_local2++));
_local6 = _local4.indexOf(src.charAt(_local2++));
_local8 = (_local9 << 2) | (_local7 >> 4);
_local11 = ((_local7 & 15) << 4) | (_local5 >> 2);
_local10 = ((_local5 & 3) << 6) | _local6;
_local1 = _local1 + String.fromCharCode(_local8);
if (_local5 != 64) {
_local1 = _local1 + String.fromCharCode(_local11);
}
if (_local6 != 64) {
_local1 = _local1 + String.fromCharCode(_local10);
}
}
return(_local1);
}
var myval = flash.external.ExternalInterface.call("loadgame");
_root.createcharacter = 0;
_root.testmode = 0;
_root.thisurl = "index.php";
bigsettings.restoregame.text = "";
_root.savegames = SharedObject.getLocal("drsaves");
var thislocalstring = "|";
if (_root.savegames.data.save_one.stats.characterlevel != undefined) {
thislocalstring = thislocalstring + (((((_root.savegames.data.save_one.charactername + ", lv ") + _root.savegames.data.save_one.stats.characterlevel) + " (saved ") + int(_root.savegames.data.save_one.savenumber)) + " times)");
}
thislocalstring = thislocalstring + "|";
if (_root.savegames.data.save_two.stats.characterlevel != undefined) {
thislocalstring = thislocalstring + (((((_root.savegames.data.save_two.charactername + ", lv ") + _root.savegames.data.save_two.stats.characterlevel) + " (saved ") + int(_root.savegames.data.save_one.savenumber)) + " times)");
}
thislocalstring = thislocalstring + "|";
if (_root.savegames.data.save_three.stats.characterlevel != undefined) {
thislocalstring = thislocalstring + (((((_root.savegames.data.save_three.charactername + ", lv ") + _root.savegames.data.save_three.stats.characterlevel) + " (saved ") + int(_root.savegames.data.save_one.savenumber)) + " times)");
}
thislocalstring = thislocalstring + "|";
if (_root.savegames.data.save_four.stats.characterlevel != undefined) {
thislocalstring = thislocalstring + (((((_root.savegames.data.save_four.charactername + ", lv ") + _root.savegames.data.save_four.stats.characterlevel) + " (saved ") + int(_root.savegames.data.save_one.savenumber)) + " times)");
}
thislocalstring = thislocalstring + "|";
var usehtml = 1;
if (((((_root.savegames.data.save_zero.characterclass == undefined) && (_root.savegames.data.save_one.characterclass == undefined)) && (_root.savegames.data.save_two.characterclass == undefined)) && (_root.savegames.data.save_three.characterclass == undefined)) && (_root.savegames.data.save_four.characterclass == undefined)) {
usehtml = 1;
}
_root.htmlsave = new Object();
var myval = flash.external.ExternalInterface.call("loadgame");
if ((myval != "") && (myval != undefined)) {
myval = unescape(myval);
myval = myval.split(newline).join("");
var vals = myval.split("{{|}}");
if (((vals != undefined) && (vals.length > 0)) && (usehtml == 1)) {
usehtml = 1;
} else {
usehtml = 0;
}
if (myencode(myval).length > 10) {
bigsettings.backupgame.text = myencode(myval);
bigsettings.backupgame.text = bigsettings.backupgame.text.split(newline).join("");
} else {
bigsettings.backupgame.text = "";
}
if (usehtml == 1) {
n = 0;
while (n < vals.length) {
var beginend = vals[n].split("{{:}}");
if (beginend.length == 2) {
var mybegin = beginend[0];
var myend = beginend[1];
if (Number(myend) == myend) {
myend = Number(myend);
}
var mypieces = mybegin.split("{{.}}");
if (mypieces.length == 1) {
_root.testscript.htmlText = _root.testscript.htmlText + "1111111111111111111111111111111111111 ";
} else if (mypieces.length == 2) {
if (mypieces[1] == int(mypieces[1])) {
if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Array();
}
} else if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Object();
}
if (myend == "null") {
_root.htmlsave[mypieces[0]][mypieces[1]] = new Object();
}
if (myend != "null") {
eval ("_root.htmlsave." + mypieces[0])[mypieces[1]] = myend;
}
} else if (mypieces.length == 3) {
if (mypieces[1] == int(mypieces[1])) {
if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Array();
}
} else if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Object();
}
if (mypieces[2] == int(mypieces[2])) {
if (eval ((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]] = new Array();
}
} else if (eval ((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]] = new Object();
}
eval ("_root.htmlsave." + mypieces[0])[mypieces[1]][mypieces[2]] = myend;
} else if (mypieces.length >= 4) {
if (mypieces[1] == int(mypieces[1])) {
if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Array();
}
} else if (eval ("_root.htmlsave." + mypieces[0]) == undefined) {
_root.htmlsave[mypieces[0]] = new Object();
}
if (mypieces[2] == int(mypieces[2])) {
if (eval ((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]] = new Array();
}
} else if (eval ((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]] = new Object();
}
if (mypieces[3] == int(mypieces[3])) {
if (eval ((((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) + ".") + mypieces[2]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]][mypieces[2]] = new Array();
}
} else if (eval ((((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) + ".") + mypieces[2]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]][mypieces[2]] = new Object();
}
if (mypieces.length == 4) {
eval ("_root.htmlsave." + mypieces[0])[mypieces[1]][mypieces[2]][mypieces[3]] = myend;
}
if (mypieces.length == 5) {
if (mypieces[4] == int(mypieces[4])) {
if (eval ((((((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) + ".") + mypieces[2]) + ".") + mypieces[3]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]][mypieces[2]][mypieces[3]] = new Array();
}
} else if (eval ((((((("_root.htmlsave." + mypieces[0]) + ".") + mypieces[1]) + ".") + mypieces[2]) + ".") + mypieces[3]) == undefined) {
_root.htmlsave[mypieces[0]][mypieces[1]][mypieces[2]][mypieces[3]] = new Object();
}
eval ("_root.htmlsave." + mypieces[0])[mypieces[1]][mypieces[2]][mypieces[3]][mypieces[4]] = myend;
}
}
}
n++;
}
}
}
var thishtmlstring = "";
thishtmlstring = thishtmlstring + "|";
if (_root.htmlsave.save_one.stats.characterlevel != undefined) {
thishtmlstring = thishtmlstring + (((((_root.htmlsave.save_one.charactername + ", lv ") + _root.htmlsave.save_one.stats.characterlevel) + " (saved ") + int(_root.htmlsave.save_one.savenumber)) + " times)");
}
thishtmlstring = thishtmlstring + "|";
if (_root.htmlsave.save_two.stats.characterlevel != undefined) {
thishtmlstring = thishtmlstring + (((((_root.htmlsave.save_two.charactername + ", lv ") + _root.htmlsave.save_two.stats.characterlevel) + " (saved ") + int(_root.htmlsave.save_one.savenumber)) + " times)");
}
thishtmlstring = thishtmlstring + "|";
if (_root.htmlsave.save_three.stats.characterlevel != undefined) {
thishtmlstring = thishtmlstring + (((((_root.htmlsave.save_three.charactername + ", lv ") + _root.htmlsave.save_three.stats.characterlevel) + " (saved ") + int(_root.htmlsave.save_one.savenumber)) + " times)");
}
thishtmlstring = thishtmlstring + "|";
if (_root.htmlsave.save_four.stats.characterlevel != undefined) {
thishtmlstring = thishtmlstring + (((((_root.htmlsave.save_four.charactername + ", lv ") + _root.htmlsave.save_four.stats.characterlevel) + " (saved ") + int(_root.htmlsave.save_one.savenumber)) + " times)");
}
thishtmlstring = thishtmlstring + "|";
if (thishtmlstring != thislocalstring) {
_root.versionsdiffer._x = 300;
thislocalstring = thislocalstring.split("|").join(newline);
_root.versionsdiffer.localdump.text = thislocalstring;
thishtmlstring = thishtmlstring.split("|").join(newline);
_root.versionsdiffer.backupdump.text = thishtmlstring;
_root.versionsdiffer.usethislocal.onPress = function () {
_root.versionsdiffer._x = -2000;
};
_root.versionsdiffer.usethishtml.onPress = function () {
_root.versionsdiffer._x = -2000;
_root.savegames = SharedObject.getLocal("drsaves");
for (i in _root.htmlsave) {
_root.savegames.data[i] = _root.htmlsave[i];
}
getURL (_root.thisurl);
};
}
_root.faqtext = "The very first single-player dungeoncrawl game was not a video game. It was a series of charts printed in the first edition of Dungeons and Dragons, back in 1979. By rolling dice according to the instructions, you could generate a dungeon which was <b>illogical, arbitrary, super-lethal</b>, and which often <b>didn't even produce usable results.</b>\n\n<b>THIS GAME USES THOSE CHARTS.</b>\n\nIn this cruel dungeoncrawl game, you're a hapless explorer trying to survive the infinite twists, turns, traps, treasures, and terrors programmed by D&D designer Gary Gygax 35 years ago. I've tweaked the original D&D rules for the purposes of the game, but faithfully preserved every bizarre or banal detail of the original dungeon-creation charts.\n\n<b>The map on the left side of the screen is not a map of the dungeon!</b> It's a flow-chart that visualizes the original, fiendishly complicated dungeon-creation rules. That flow chart will be used to create a text-based dungeon adventure for your character.\n\n<b>Basic Mode</b> is extremely difficult. You're likely to die before you get rich, but at least you can reload from the last time you entered the dungeon.\n<b>Advanced Mode</b> features lower hit points, worse stats, and permadeath. Advanced Mode is too hard for me.\n\nWelcome to the dungeon! It's been waiting for 35 years.";
_root.testscript.htmlText = _root.testscript.htmlText + "<font color=\"#999999\">9/3/24: Version 1.3. Pets and henchman can be named. Raised monster HP and lowered fighter and cleric HP. Added a teleporter into the dungeon. Added a way to restore drained levels. Many other assorted bugfixes. Full details on blogofholding.com.<br>8/8/13: Version 1.2. Revamped the savegame system for more security. Added Settings button for backing up savegame. Also added some inventory slots.</font>";
stop();
saveone.iconhouse1._alpha = 100;
savetwo.iconhouse2._alpha = 100;
savethree.iconhouse3._alpha = 100;
savefour.iconhouse4._alpha = 100;
littlesettings.onPress = function () {
bigsettings._x = 85;
};
bigsettings.closebutton.onPress = function () {
bigsettings._x = -1200;
};
bigsettings.deletesavegames.onPress = function () {
bigsettings.reallydeletesavegamestext._alpha = 100;
bigsettings.reallydeletesavegames._alpha = 100;
bigsettings.reallydeletesavegames.onPress = function () {
_root.bigsettings.reallydeletesavegamesconfirmation._alpha = 100;
_root.savegames.data.save_zero = null;
_root.savegames.data.save_one = null;
_root.savegames.data.save_two = null;
_root.savegames.data.save_three = null;
_root.savegames.data.save_four = null;
_root.savegames.data.game1 = null;
_root.savegames.data.game2 = null;
_root.savegames.data.game3 = null;
flash.external.ExternalInterface.call("savegame('')");
getURL (_root.thisurl);
};
bigsettings.reallydeletesavegames2.onPress = function () {
_root.bigsettings.reallydeletesavegamesconfirmation._alpha = 100;
_root.savegames.data.save_zero = null;
_root.savegames.data.save_one = null;
_root.savegames.data.save_two = null;
_root.savegames.data.save_three = null;
_root.savegames.data.save_four = null;
_root.savegames.data.game1 = null;
_root.savegames.data.game2 = null;
_root.savegames.data.game3 = null;
getURL (_root.thisurl);
};
};
bigsettings.restoregamebutton.onPress = function () {
var _local2 = bigsettings.restoregame.text;
if (_local2.length < 10) {
return(undefined);
}
_local2 = mydecode(_local2);
_local2 = escape(_local2);
_local2 = _local2.split(newline).join("");
flash.external.ExternalInterface.call(("savegame('" + _local2) + "')");
getURL (_root.thisurl);
};
ad.onPress = function () {
getURL ("http://blogofholding.com/?page_id=3294");
};
bigsettings.testmodebutton.onPress = function () {
_root.testmode = 1;
};
game1.onPress = function () {
_root.gamemode = "build";
gotoAndStop ("mainy");
};
game2.onPress = function () {
_root.gamemode = "game1";
gotoAndStop ("charcreate");
};
game3.onPress = function () {
_root.gamemode = "game3";
gotoAndStop ("charcreate");
};
game4.onPress = function () {
_root.gamemode = "game3";
gotoAndStop ("charcreate");
};
savezero.onRollOver = function () {
this.overlay._alpha = 100;
};
savezero.onRollOut = function () {
this.overlay._alpha = 0;
};
saveone.onRollOver = function () {
this.overlay._alpha = 100;
};
saveone.onRollOut = function () {
this.overlay._alpha = 0;
};
savetwo.onRollOver = function () {
this.overlay._alpha = 100;
};
savetwo.onRollOut = function () {
this.overlay._alpha = 0;
};
savethree.onRollOver = function () {
this.overlay._alpha = 100;
};
savethree.onRollOut = function () {
this.overlay._alpha = 0;
};
savefour.onRollOver = function () {
this.overlay._alpha = 100;
};
savefour.onRollOut = function () {
this.overlay._alpha = 0;
};
if (keyListener != undefined) {
Key.removeListener(keyListener);
}
var tosave = new Array();
if (_root.savegames.data.game1 == null) {
_root.savegames.data.game1 = new Object();
}
if (_root.savegames.data.game2 == null) {
_root.savegames.data.game2 = new Object();
}
if (_root.savegames.data.game3 == null) {
_root.savegames.data.game3 = new Object();
}
_root.showsavezero = 0;
_root.startnewgamebutton = 0;
var difficulty = "";
if (_root.savegames.data.save_zero.characterclass != undefined) {
_root.showsavezero = 1;
difficulty = get_difficulty(_root.savegames.data.save_zero.gamemode);
_root.savezero.topline.text = _root.savegames.data.save_zero.charactername + " Quicksave";
_root.savezero.middleline.text = difficulty + " quicksave";
_root.savezero.bottomline.text = (("lev " + _root.savegames.data.save_zero.stats.characterlevel) + " ") + _root.savegames.data.save_zero.characterclass;
}
if (_root.savegames.data.save_one.characterclass != undefined) {
difficulty = get_difficulty(_root.savegames.data.save_one.gamemode);
_root.saveone.topline.text = _root.savegames.data.save_one.charactername;
_root.saveone.middleline.text = difficulty + " savegame";
_root.saveone.bottomline.text = (("lev " + _root.savegames.data.save_one.stats.characterlevel) + " ") + _root.savegames.data.save_one.characterclass;
} else {
_root.saveone.topline.text = "";
_root.saveone.bottomline.text = "";
_root.saveone.middleline.text = "START NEW GAME";
_root.startnewgamebutton = 1;
}
if (_root.savegames.data.save_two.characterclass) {
difficulty = get_difficulty(_root.savegames.data.save_two.gamemode);
_root.savetwo.topline.text = _root.savegames.data.save_two.charactername;
_root.savetwo.middleline.text = difficulty + " savegame";
_root.savetwo.bottomline.text = (("lev " + _root.savegames.data.save_two.stats.characterlevel) + " ") + _root.savegames.data.save_two.characterclass;
_root.startnewgamebutton = 0;
} else {
_root.savetwo.topline.text = "";
_root.savetwo.bottomline.text = "";
_root.savetwo.middleline.text = "START NEW GAME";
if (_root.startnewgamebutton == 0) {
_root.startnewgamebutton = 2;
}
}
if (_root.savegames.data.save_three.characterclass) {
difficulty = get_difficulty(_root.savegames.data.save_three.gamemode);
_root.savethree.topline.text = _root.savegames.data.save_three.charactername;
_root.savethree.middleline.text = difficulty + " savegame";
_root.savethree.bottomline.text = (("lev " + _root.savegames.data.save_three.stats.characterlevel) + " ") + _root.savegames.data.save_three.characterclass;
_root.startnewgamebutton = 0;
} else {
_root.savethree.topline.text = "";
_root.savethree.bottomline.text = "";
_root.savethree.middleline.text = "START NEW GAME";
if (_root.startnewgamebutton == 0) {
_root.startnewgamebutton = 3;
}
}
if (_root.savegames.data.save_four.characterclass) {
difficulty = get_difficulty(_root.savegames.data.save_four.gamemode);
_root.savefour.topline.text = _root.savegames.data.save_four.charactername;
_root.savefour.middleline.text = difficulty + " savegame";
_root.savefour.bottomline.text = (("lev " + _root.savegames.data.save_four.stats.characterlevel) + " ") + _root.savegames.data.save_four.characterclass;
_root.startnewgamebutton = 4;
} else {
_root.savefour.topline.text = "";
_root.savefour.bottomline.text = "";
_root.savefour.middleline.text = "START NEW GAME";
if (_root.startnewgamebutton == 0) {
_root.startnewgamebutton = 4;
}
}
savezero.onPress = function () {
_root.mysavegame = 10;
gotoAndStop ("mainy");
};
saveone.onPress = function () {
var _local2 = _root.savegames.data.save_one.characterclass;
if (((((_local2 == "Cleric") || (_local2 == "Wizard")) || (_local2 == "Thief")) || (_local2 == "Fighter")) || (_local2 == "Dungeon Robber")) {
_root.mysavegame = 1;
gotoAndStop ("mainy");
} else {
game2._x = 760;
game3._x = 760;
}
};
savetwo.onPress = function () {
var _local2 = _root.savegames.data.save_two.characterclass;
if (((((_local2 == "Cleric") || (_local2 == "Wizard")) || (_local2 == "Thief")) || (_local2 == "Fighter")) || (_local2 == "Dungeon Robber")) {
_root.mysavegame = 2;
gotoAndStop ("mainy");
} else {
game2._x = 760;
game3._x = 760;
}
};
savethree.onPress = function () {
var _local2 = _root.savegames.data.save_three.characterclass;
if (((((_local2 == "Cleric") || (_local2 == "Wizard")) || (_local2 == "Thief")) || (_local2 == "Fighter")) || (_local2 == "Dungeon Robber")) {
_root.mysavegame = 3;
gotoAndStop ("mainy");
} else {
game2._x = 760;
game3._x = 760;
}
};
savefour.onPress = function () {
var _local2 = _root.savegames.data.save_four.characterclass;
if (((((_local2 == "Cleric") || (_local2 == "Wizard")) || (_local2 == "Thief")) || (_local2 == "Fighter")) || (_local2 == "Dungeon Robber")) {
_root.mysavegame = 4;
gotoAndStop ("mainy");
} else {
game2._x = 760;
game3._x = 760;
}
};
Frame 2
function chooseclass(thing) {
_root.class_dungeonrobber.mytext.textColor = 16777215 /* 0xFFFFFF */;
if (_root.class_thief.mytext.textColor != 6710886) {
_root.class_thief.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.class_fighter.mytext.textColor != 6710886) {
_root.class_fighter.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.class_cleric.mytext.textColor != 6710886) {
_root.class_cleric.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.class_wizard.mytext.textColor != 6710886) {
_root.class_wizard.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
thing.mytext.textColor = 16776960 /* 0xFFFF00 */;
}
function choosebonusstat(thing, stat) {
if (_root.bonusstat.bonusstr.mytext.textColor != 6710886) {
_root.bonusstat.bonusstr.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.bonusstat.bonusint.mytext.textColor != 6710886) {
_root.bonusstat.bonusint.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.bonusstat.bonuswis.mytext.textColor != 6710886) {
_root.bonusstat.bonuswis.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.bonusstat.bonusdex.mytext.textColor != 6710886) {
_root.bonusstat.bonusdex.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.bonusstat.bonuscon.mytext.textColor != 6710886) {
_root.bonusstat.bonuscon.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
if (_root.bonusstat.bonuscha.mytext.textColor != 6710886) {
_root.bonusstat.bonuscha.mytext.textColor = 16777215 /* 0xFFFFFF */;
}
thing.mytext.textColor = 16776960 /* 0xFFFF00 */;
_root.bonushistat = stat;
calcstats();
}
function calcstats() {
_root.histr = "";
_root.hiint = "";
_root.hiwis = "";
_root.hidex = "";
_root.hicon = "";
_root.hicha = "";
if ((_root.histat == "STR") || (_root.bonushistat == "STR")) {
_root.histr = "hi";
reclass("Fighter");
setnumber("attackbonus", 1);
arm();
} else {
declass("Fighter");
setnumber("attackbonus", 0);
arm();
}
if ((_root.histat == "INT") || (_root.bonushistat == "INT")) {
_root.hiint = "hi";
reclass("Wizard");
} else {
declass("Wizard");
}
if ((_root.histat == "WIS") || (_root.bonushistat == "WIS")) {
_root.hiwis = "hi";
reclass("Cleric");
setnumber("savingthrow", 3);
} else {
declass("Cleric");
setnumber("savingthrow", 4);
}
if ((_root.histat == "DEX") || (_root.bonushistat == "DEX")) {
_root.hidex = "hi";
reclass("Thief");
setnumber("ac", 11);
setnumber("sneakbonus", 1);
} else {
declass("Thief");
setnumber("ac", 10);
setnumber("sneakbonus", 0);
}
if ((_root.histat == "CON") || (_root.bonushistat == "CON")) {
_root.hicon = "hi";
setnumber("maxhp", (maxhp + classhpbonus()) + 1);
} else {
setnumber("maxhp", maxhp + classhpbonus());
}
if ((_root.histat == "CHA") || (_root.bonushistat == "CHA")) {
_root.hicha = "hi";
}
}
function declass(classname) {
if (_root.characterclass == classname) {
_root.characterclass = "Dungeon Robber";
_root.class_dungeonrobber.mytext.textColor = 16776960 /* 0xFFFF00 */;
arm();
}
eval (("_root.class_" + classname.toLowerCase()) + ".mytext").textColor = 6710886 /* 0x666666 */;
eval (("_root.class_" + classname.toLowerCase()) + ".mytext").backgroundColor = 0;
}
function reclass(classname) {
if (eval (("_root.class_" + classname.toLowerCase()) + ".mytext").textColor == 6710886) {
if (((((classname == "Fighter") && (_root.fighter_unlocked == 1)) || ((classname == "Thief") && (_root.thief_unlocked == 1))) || ((classname == "Cleric") && (_root.cleric_unlocked == 1))) || ((classname == "Wizard") && (_root.wizard_unlocked == 1))) {
eval (("_root.class_" + classname.toLowerCase()) + ".mytext").textColor = 16777215 /* 0xFFFFFF */;
eval (("_root.class_" + classname.toLowerCase()) + ".mytext").backgroundColor = 3355443 /* 0x333333 */;
}
}
}
function henchname(gender) {
var _local1 = new Array();
if ((gender == "lad") || (gender == null)) {
_local1.push("Marten");
_local1.push("Antony");
_local1.push("Eliot");
_local1.push("James");
_local1.push("Henry");
_local1.push("Dan");
_local1.push("Kevin");
_local1.push("Cristopher");
_local1.push("Stephen");
_local1.push("Donovan");
_local1.push("Gabriel");
_local1.push("Juris");
_local1.push("Minh");
_local1.push("Paul");
_local1.push("Padraig");
_local1.push("Richard");
_local1.push("Michael");
_local1.push("John");
_local1.push("Andrew");
}
if ((gender == "lass") || (gender == null)) {
_local1.push("Alison");
_local1.push("Janis");
_local1.push("Caoilfhionn");
_local1.push("Hannah");
_local1.push("Gwynhwyfar");
_local1.push("Tallis");
_local1.push("Sara");
_local1.push("Joanna");
_local1.push("Alejandra");
_local1.push("Elizabeth");
_local1.push("Laura");
_local1.push("Dahlia");
_local1.push("Fahmida");
_local1.push("Rachel");
_local1.push("Jacqueline");
_local1.push("Marcelyn");
_local1.push("Meg");
_local1.push("Amy");
}
return(_local1[Math.ceil(Math.random() * _local1.length) - 1]);
}
function setnumber(numbername, numbervalue) {
_root.stats[numbername] = numbervalue;
eval ((("_root." + numbername) + ".") + numbername).text = numbervalue;
eval ("_root.charsheet." + numbername).text = numbervalue;
}
function addnumber(numbername, numbervalue) {
var mynum = _root.stats[numbername];
if (mynum == null) {
mynum = 0;
}
mynum = mynum + numbervalue;
_root.stats[numbername] = mynum;
eval ((("_root." + numbername) + ".") + numbername).text = mynum;
eval ("_root.charsheet." + numbername).text = mynum;
}
function getnumber(numbername) {
var _local2 = _root.stats[numbername];
if (!_local2) {
_local2 = 0;
}
return(_local2);
}
function arm() {
var _local2 = 3;
if (_root.gamemode == "game2") {
_local2 = 2;
}
if (_root.gamemode == "game3") {
_local2 = 1;
}
if ((_root.characterclass == "Cleric") && (_local2 == 2)) {
_local2 = 1;
}
if (((_root.characterclass == "Wizard") || (_root.characterclass == "Thief")) && (_local2 == 3)) {
_local2 = 2;
}
if (_local2 == 3) {
_root.weapon = "bludgeon";
_root.charsheet.weapondamage.text = "1d6";
if ((_root.histat == "STR") || (_root.bonushistat == "STR")) {
_root.charsheet.weapondamage.text = "1d6+1";
}
_root.charsheet.possessions1.text = weapon;
_root.startingequipment.text = "You start the game with a bludgeon: a stout club, chair leg, or maybe a rusty mace.";
} else if (_local2 == 2) {
_root.weapon = "dagger";
_root.charsheet.weapondamage.text = "1d4";
if ((_root.histat == "STR") || (_root.bonushistat == "STR")) {
_root.charsheet.weapondamage.text = "1d4+1";
}
_root.charsheet.possessions1.text = weapon;
_root.startingequipment.text = "You start the game with the dagger that most common people carry by their side. Usually, you eat with it. Today you might be using it to defend your life.";
} else if (_local2 == 1) {
_root.weapon = "";
_root.charsheet.weapondamage.text = "1";
if ((_root.histat == "STR") || (_root.bonushistat == "STR")) {
_root.charsheet.weapondamage.text = "2";
}
_root.charsheet.possessions1.text = weapon;
_root.startingequipment.text = "You start the game with no weapons but your fists. Until you find a rusty knife or chair leg, every kobold and rat is more dangerous than you are.";
}
}
function classhpbonus() {
if (_root.characterclass == "Fighter") {
return(2);
}
if ((_root.characterclass == "Wizard") || (_root.characterclass == "Thief")) {
if (_root.maxhp != 1) {
return(-2);
}
}
return(0);
}
function myconbonus() {
if ((_root.histat == "CON") || (_root.bonushistat == "CON")) {
return(1);
}
return(0);
}
function hashi(mystat) {
if ((_root.histat == mystat) || (_root.bonushistat == mystat)) {
return(1);
}
return(0);
}
_root.createcharacter = 1;
_root.fighter_unlocked = 0;
_root.thief_unlocked = 0;
_root.wizard_unlocked = 0;
_root.cleric_unlocked = 0;
_root.mysavegame = 0;
if (eval ("_root.savegames.data." + _root.gamemode).retirees != null) {
if (eval ("_root.savegames.data." + _root.gamemode).retirees.merchant.length > 0) {
_root.thief_unlocked = 1;
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees.knight.length > 0) {
_root.fighter_unlocked = 1;
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees.bishop.length > 0) {
_root.cleric_unlocked = 1;
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees.count.length > 0) {
_root.wizard_unlocked = 1;
}
}
if (_root.testmode == 1) {
_root.thief_unlocked = 1;
_root.fighter_unlocked = 1;
_root.cleric_unlocked = 1;
_root.wizard_unlocked = 1;
}
_root.characterid = Math.ceil(Math.random() * 9000000) + 999999;
charsheet.closebutton._alpha = 0;
var stats = new Object();
_root.stats = stats;
if (_root.gamemode == "game1") {
var maxhp = 10;
} else if (_root.gamemode == "game2") {
var maxhp = 8;
} else if (_root.gamemode == "game3") {
var maxhp = 6;
}
_root.maxhp = maxhp;
arm();
_root.bonusstat._y = 306;
_root.stattext._y = 214;
if (_root.gamemode != "game1") {
_root.bonusstat._y = 188;
_root.stattext._y = 250;
}
setnumber("maxhp", maxhp);
setnumber("ac", 10);
setnumber("sneakbonus", 0);
setnumber("attackbonus", 0);
setnumber("savingthrow", 4);
if (fighter_unlocked) {
class_fighter.mytext.textColor = 16777215 /* 0xFFFFFF */;
class_fighter.mytext.background = true;
class_fighter.mytext.backgroundColor = 3355443 /* 0x333333 */;
}
if (thief_unlocked) {
class_thief.mytext.textColor = 16777215 /* 0xFFFFFF */;
class_thief.mytext.background = true;
class_thief.mytext.backgroundColor = 3355443 /* 0x333333 */;
}
if (cleric_unlocked) {
class_cleric.mytext.textColor = 16777215 /* 0xFFFFFF */;
class_cleric.mytext.background = true;
class_cleric.mytext.backgroundColor = 3355443 /* 0x333333 */;
}
if (wizard_unlocked) {
class_wizard.mytext.textColor = 16777215 /* 0xFFFFFF */;
class_wizard.mytext.background = true;
class_wizard.mytext.backgroundColor = 3355443 /* 0x333333 */;
}
var keyListener = new Object();
keyListener.onKeyUp = function () {
var _local2 = Selection.getFocus();
if (_local2 == "_level0.yourname") {
_root.charactername = _root.yourname.text;
if (Key.getCode() == 13) {
Selection.setFocus(null);
}
return(undefined);
}
keyup(Key);
};
Key.addListener(keyListener);
yourname.background = (class_dungeonrobber.mytext.background = (bonusstat.bonusstr.mytext.background = (bonusstat.bonuscha.mytext.background = (bonusstat.bonusint.mytext.background = (bonusstat.bonuswis.mytext.background = (bonusstat.bonusdex.mytext.background = (bonusstat.bonuscon.mytext.background = true)))))));
yourname.backgroundColor = (class_dungeonrobber.mytext.backgroundColor = (bonusstat.bonusstr.mytext.backgroundColor = (bonusstat.bonuscon.mytext.backgroundColor = (bonusstat.bonusint.mytext.backgroundColor = (bonusstat.bonuswis.mytext.backgroundColor = (bonusstat.bonusdex.mytext.backgroundColor = (bonusstat.bonuscha.mytext.backgroundColor = 3355443)))))));
var tf = new TextFormat();
tf.color = 16777215 /* 0xFFFFFF */;
tf.font = "Georgia";
tf.size = 18;
classdungeonrobber.setStyle("textFormat", tf);
n = 1;
while (n <= 11) {
eval ("charsheet.drop" + n)._alpha = 0;
eval ("charsheet.use" + n)._alpha = 0;
n++;
}
var thieftext = "You are a penniless thief. As you gain levels, you get better at sneaking past monsters.";
var dungeonrobbertext = "You are a Dungeon Robber - in other words, a penniless peasant. As you gain levels, you get better at fleeing from monsters.";
var fightertext = "You are a penniless fighter. As you gain levels, you get better at hitting monsters.";
var clerictext = "You are a penniless cleric. As you gain levels, you can cast your healing and protection spells more often.";
var wizardtext = "You are a penniless wizard. As you gain levels, you can cast your attack spells more often. You cast your spells from scrolls you find in the dungeon.";
var strtext = "You have high Strength. You get +1 to attack and damage against monsters and +1 to open doors.";
var inttext = "You have high Intelligence. You are much less likely to get lost in the dungeon. You can use Wizard scrolls (unless you're a Fighter or Cleric).";
var wistext = "You have high Wisdom. You get +1 to saving throws against traps and other dangers. You can use Cleric scrolls (unless you're a Fighter or Wizard).";
var dextext = "You have high Dexterity. You get +1 Armor Class. You get +1 to Sneak rolls.";
var context = "You have high Constitution. You get +1 HP now, and +1 every odd-numbered level.";
var chatext = "You have high Charisma. You get +1 on Parley rolls. You can have two henchmen at a time, while most characters can have one.";
classtext.text = dungeonrobbertext;
_root.characterclass = "Dungeon Robber";
if (_root.gamemode == "game1") {
var histat = Math.ceil(Math.random() * 6);
if (histat == 1) {
histat = "STR";
_root.stattext.text = strtext;
}
if (histat == 2) {
histat = "INT";
_root.stattext.text = inttext;
}
if (histat == 3) {
histat = "WIS";
_root.stattext.text = wistext;
}
if (histat == 4) {
histat = "DEX";
_root.stattext.text = dextext;
}
if (histat == 5) {
histat = "CON";
_root.stattext.text = context;
}
if (histat == 6) {
histat = "CHA";
_root.stattext.text = chatext;
}
_root.histat = histat;
_root.histattext.mytext.text = histat;
} else {
_root.randomhistatis._alpha = 0;
_root.histattext._alpha = 0;
}
if (histat == "STR") {
bonusstat.bonusstr.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonusstr.mytext.background = true;
bonusstat.bonusstr.mytext.backgroundColor = 0;
}
if (histat == "INT") {
bonusstat.bonusint.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonusint.mytext.background = true;
bonusstat.bonusint.mytext.backgroundColor = 0;
}
if (histat == "WIS") {
bonusstat.bonuswis.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonuswis.mytext.background = true;
bonusstat.bonuswis.mytext.backgroundColor = 0;
}
if (histat == "DEX") {
bonusstat.bonusdex.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonusdex.mytext.background = true;
bonusstat.bonusdex.mytext.backgroundColor = 0;
}
if (histat == "CON") {
bonusstat.bonuscon.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonuscon.mytext.background = true;
bonusstat.bonuscon.mytext.backgroundColor = 0;
}
if (histat == "CHA") {
bonusstat.bonuscha.mytext.textColor = 6710886 /* 0x666666 */;
bonusstat.bonuscha.mytext.background = true;
bonusstat.bonuscha.mytext.backgroundColor = 0;
}
if ((histat != "STR") && (_root.gamemode == "game1")) {
var bonushistat = "STR";
bonusstat.bonusstr.mytext.textColor = 16776960 /* 0xFFFF00 */;
} else if (_root.gamemode == "game1") {
var bonushistat = "INT";
bonusstat.bonusint.mytext.textColor = 16776960 /* 0xFFFF00 */;
}
calcstats();
bonusstat.bonusstr.onPress = function () {
stattext.text = strtext;
if (histat == "STR") {
return(undefined);
}
_root.bonushistat = "STR";
choosebonusstat(this, "STR");
};
bonusstat.bonusint.onPress = function () {
stattext.text = inttext;
if (histat == "INT") {
return(undefined);
}
_root.bonushistat = "INT";
choosebonusstat(this, "INT");
};
bonusstat.bonuswis.onPress = function () {
stattext.text = wistext;
if (histat == "WIS") {
return(undefined);
}
_root.bonushistat = "WIS";
choosebonusstat(this, "WIS");
};
bonusstat.bonusdex.onPress = function () {
stattext.text = dextext;
if (histat == "DEX") {
return(undefined);
}
_root.bonushistat = "DEX";
choosebonusstat(this, "DEX");
};
bonusstat.bonuscon.onPress = function () {
stattext.text = context;
if (histat == "CON") {
return(undefined);
}
_root.bonushistat = "CON";
choosebonusstat(this, "CON");
};
bonusstat.bonuscha.onPress = function () {
stattext.text = chatext;
if (histat == "CHA") {
return(undefined);
}
_root.bonushistat = "CHA";
choosebonusstat(this, "CHA");
};
startgamebutton.onPress = function () {
gotoAndStop ("mainy");
};
_root.charsheet.characterlevel.text = 0;
_root.charsheet.xp.text = 0;
class_dungeonrobber.onPress = function () {
chooseclass(this);
classtext.text = dungeonrobbertext;
_root.characterclass = "Dungeon Robber";
arm();
setnumber("maxhp", (maxhp + classhpbonus()) + myconbonus());
};
class_thief.onPress = function () {
if (thief_unlocked == 0) {
classtext.text = "You can unlock the Thief class by having a character retire as a Merchant.";
return(undefined);
}
if (!hashi("DEX")) {
classtext.text = "You need high Dexterity to start as a thief.";
return(undefined);
}
chooseclass(this);
classtext.text = thieftext;
_root.characterclass = "Thief";
arm();
setnumber("maxhp", (maxhp + classhpbonus()) + myconbonus());
};
class_fighter.onPress = function () {
if (fighter_unlocked == 0) {
classtext.text = "You can unlock the Fighter class by having a character retire as a Knight.";
return(undefined);
}
if (!hashi("STR")) {
classtext.text = "You need high Strength to start as a fighter.";
return(undefined);
}
chooseclass(this);
classtext.text = fightertext;
_root.characterclass = "Fighter";
arm();
setnumber("maxhp", (maxhp + classhpbonus()) + myconbonus());
};
class_cleric.onPress = function () {
if (cleric_unlocked == 0) {
classtext.text = "You can unlock the Cleric class by having a character retire as a Bishop.";
return(undefined);
}
if (!hashi("WIS")) {
classtext.text = "You need high Wisdom to start as a cleric.";
return(undefined);
}
chooseclass(this);
classtext.text = clerictext;
_root.characterclass = "Cleric";
arm();
setnumber("maxhp", (maxhp + classhpbonus()) + myconbonus());
};
class_wizard.onPress = function () {
if (wizard_unlocked == 0) {
classtext.text = "You can unlock the Wizard class by having a character retire as a Count.";
return(undefined);
}
if (!hashi("INT")) {
classtext.text = "You need high Intelligence to start as a wizard.";
return(undefined);
}
chooseclass(this);
classtext.text = wizardtext;
_root.characterclass = "Wizard";
arm();
setnumber("maxhp", (maxhp + classhpbonus()) + myconbonus());
};
var myname = henchname();
yourname.text = myname;
_root.charactername = myname;
if (_root.gamemode != "game1") {
stattext.text = strtext;
_root.bonusstat.bonusstr.mytext.textColor = 16776960 /* 0xFFFF00 */;
if (histat == "STR") {
return(undefined);
}
_root.bonushistat = "STR";
calcstats();
}
Frame 3
function myplural(mynum) {
if (mynum == 1) {
return("");
}
return("s");
}
function dead_end(dead_end_mode) {
if (((dead_end_mode == undefined) || (dead_end_mode == null)) || (dead_end_mode == "")) {
dead_end_mode = 0;
}
if (dead_end_mode == 10) {
dead_end_mode = 0;
}
if (getnumber("monsterhp") > 0) {
write(("You're trapped in a dead end by the " + _root.monstername) + "! You'll have to turn and fight.");
writestring = "";
_root.monstersource = "deadend";
if (dead_end_mode == 1) {
_root.monstersource = "deadend1";
}
if (dead_end_mode == 2) {
_root.monstersource = "deadend2";
}
writestring = writestring + (("<b>(a)ttack</b> the " + _root.monstername) + "?");
add_to_key("a", "attack");
if (has_usable_item()) {
writestring = writestring + " <b>(u)se</b> an item?";
add_to_key("u", "use_an_item");
}
if (has_spell()) {
writestring = writestring + " <b>(c)ast</b> a spell?";
add_to_key("c", "cast_a_spell");
}
write(writestring);
} else {
if (dead_end_mode == 0) {
var _local3 = "You'll have to go back the way you came. You're safe from monsters from the moment - unless this dead end has a secret door.";
} else if (dead_end_mode == 1) {
var _local3 = "You can't swim across the water. You'll have to go back the way you came. You're safe from monsters from the moment.";
} else if (dead_end_mode == 2) {
var _local3 = "You're safe from monsters from the moment.";
} else if (dead_end_mode == 3) {
var _local3 = "The chasm is unjumpable. You'll have to go back the way you came. You're safe from monsters from the moment.";
} else if (dead_end_mode == 4) {
var _local3 = "You're at the side of the lake.";
} else if (dead_end_mode == 5) {
var _local3 = "You're standing next to the pool in the cavern.";
}
if ((((dead_end_mode == 1) || (dead_end_mode == 2)) || (dead_end_mode == 4)) || (dead_end_mode == 5)) {
if (_root.fishedout == 0) {
if ((has_item("fishing_pole") || (has_item("+1_fishing_pole"))) || (has_item("+2_fishing_pole"))) {
var _local3 = _local3 + " <b>(c)ast</b> your fishing line?";
_root.monstersource = "deadend" + dead_end_mode;
add_to_key("c", "fish");
} else if (has_item("ten_foot_pole")) {
var _local3 = _local3 + " <b>(c)ast</b> a string tied to your ten foot pole? (The treasure haul would be better with a real fishing pole.)";
_root.monstersource = "deadend" + dead_end_mode;
add_to_key("c", "fish");
} else {
var _local3 = _local3 + " If you had a fishing pole, you could fish.";
}
}
}
if (_root.lost == 0) {
var _local3 = _local3 + " <b>(b)acktrack?</b>";
add_to_key("b", "backtrack");
if (dead_end_mode == 2) {
_local3 = _local3 + " cross the river and <b>(e)xplore</b> further?";
add_to_key("e", "explore");
} else if ((dead_end_mode == 4) || (dead_end_mode == 5)) {
_local3 = _local3 + " <b>(e)xplore</b> the rest of the cavern?";
add_to_key("e", "roomcontents");
}
} else {
var _local3 = _local3 + " <b>(w)ander back?</b>";
add_to_key("w", "wander");
}
if (dead_end_mode == 0) {
if (((_root.deadend[0] != 2) || (_root.deadend[1] != 2)) || (_root.deadend[2] != 2)) {
var _local3 = _local3 + " Search for secret doors to the ";
}
if (_root.deadend[0] != 2) {
var _local3 = _local3 + "<b>(l)ef(t)?";
add_to_key("l", "secretdoor", 0);
add_to_key("t", "secretdoor", 0);
}
if (_root.deadend[2] != 2) {
var _local3 = _local3 + " <b>(r)ight?";
add_to_key("r", "secretdoor", 2);
}
if (_root.deadend[1] != 2) {
var _local3 = _local3 + " <b>(a)head?";
add_to_key("a", "secretdoor", 1);
}
}
var _local4 = 0 + dead_end_mode;
if (_local4 == 0) {
_local4 = 10;
}
n = 0;
while (n < 15) {
if ((_root.possessions[n][0] == "food") && (getnumber("hp") < getnumber("maxhp"))) {
var _local3 = _local3 + " <b>eat (f)ood</b> and recover 1 HP?";
add_to_key("f", "food", "back", dead_end_mode);
} else if ((_root.possessions[n][0] == "food") && ((getnumber("henchmanhp") < getnumber("henchmanmaxhp")) || (getnumber("henchman2hp") < getnumber("henchman2maxhp")))) {
var _local3 = _local3 + " <b>share (f)ood</b> and restore 1 HP to your followers?";
add_to_key("f", "food", "back", dead_end_mode);
}
n++;
}
if (((getnumber("henchmanhp") > 0) && (henchman_has_tag("intelligent"))) || ((getnumber("henchman2hp") > 0) && (henchman_has_tag("intelligent", 2)))) {
if (_root.lost == 0) {
add_to_key("s", "opencharsheet", "open", _local4);
_root.instore = 1;
var _local3 = _local3 + " <b>(s)end your henchman back to town</b> to sell stuff?";
}
}
if ((_root.characterclass == "Wizard") || (_root.characterclass == "Cleric")) {
if (_root.recoveredspellshere == 0) {
if (_root.spells < (getnumber("characterlevel") + 1)) {
var _local3 = _local3 + " <b>rest and (p)repare</b> spells?";
add_to_key("p", "preparespells", "back", _local4);
}
}
}
if (has_usable_noncombat_item()) {
var _local3 = _local3 + " <b>(u)se</b> an item? ";
add_to_key("u", "use_a_noncombat_item", _local4);
}
var _local5 = 0;
if ((dead_end_mode == 10) || (dead_end_mode == 0)) {
_local5 = 1;
}
if ((((dead_end_mode == 1) || (dead_end_mode == 2)) || (dead_end_mode == 4)) || (dead_end_mode == 5)) {
if (_root.fishedout == 0) {
_local5 = 1;
}
}
if ((((_root.characterclass == "Cleric") && (_root.spells > 0)) && (_local5)) && (((getnumber("hp") < getnumber("maxhp")) || (getnumber("henchmanhp") < getnumber("henchmanmaxhp"))) || (getnumber("henchman2hp") < getnumber("henchman2maxhp")))) {
var _local3 = _local3 + " cast <b>(c)ure light wounds?</b> ";
add_to_key("c", "cast_clw", _local4);
}
write(_local3);
}
}
function run(arrowname, dieroll, mymode) {
showmonsters(100);
_root.loadings.loadingtext.text = "";
_root.loadings._alpha = 0;
if (arrowname == "start") {
var _local18 = " Draw this onto your map. Next, choose to explore a door or corridor.";
if (dieroll <= 4) {
write("Starting room: The Rectangle!" + _local18);
} else if (dieroll <= 8) {
write("Starting room: Frog Giving Thumbs Up!" + _local18);
} else if (dieroll <= 12) {
write("Starting room: The Triforce!" + _local18);
} else if (dieroll <= 16) {
write("Starting room: Open Arms!" + _local18);
} else if (dieroll <= 20) {
write("Starting room: The Deluxe!" + _local18);
}
} else if (arrowname == "mainloop") {
if (dieroll <= 2) {
write("Continue 60 feet.");
if (_root.lost == 0) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else {
var _local22 = "wandering";
if (_root.lost == 2) {
_local22 = "running";
}
write(("You realize you are " + _local22) + " in circles.");
var _local21 = Math.ceil(Math.random() * 10);
setnumber("roomnumber", _local21);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
add_to_master("wander");
}
} else if (dieroll <= 7) {
add_to_master("move_to", "sidepassages1", 0.65);
write("There is an intersection ahead.");
add_to_master("roll", "sidepassagewidth", 20);
} else if (dieroll <= 10) {
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
} else if (dieroll <= 13) {
add_to_master("move_to", "chamber");
add_to_master("roll", "chamber", 20);
} else if (dieroll <= 16) {
write("Passage Turns.");
add_to_master("move_to", "turndirection");
add_to_master("roll", "mainturns", 20);
} else if (dieroll <= 17) {
write("Dead End.");
var _local28 = new Array(0, 0, 0);
_root.deadend = _local28;
var _local29 = Math.ceil(Math.random() * 4);
var _local27 = Math.ceil(Math.random() * 4);
var _local24 = Math.ceil(Math.random() * 4);
if (_local29 == 4) {
_root.deadend[0] = 1;
}
if (_local27 == 4) {
_root.deadend[1] = 1;
}
if (_local24 == 4) {
_root.deadend[2] = 1;
}
add_to_master("move_to", "deadend");
add_to_master("roll", "deadend", 20);
} else {
if (dieroll <= 18) {
write("Stairs.");
add_to_master("move_to", "stairs", 0.5);
run_master();
stairsquestion("stairs");
return(undefined);
}
if (dieroll <= 19) {
write("Wandering Monster.");
_root.monstersource = "wandering";
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local20 = getnumber("dungeonlevel");
if (_local20 > 10) {
_local20 = 10;
}
add_to_master("roll", ("monster" + _local20) + "_", 4);
} else if (dieroll <= 20) {
add_to_master("move_to", "tricktrapb", 0.5);
add_to_master("roll", "tricktrapb", 20);
}
}
} else if (arrowname == "sidepassagewidth") {
if (dieroll <= 12) {
write("The corridor is 10' wide.");
} else if (dieroll <= 16) {
write("The corridor is 20' wide.");
} else if (dieroll <= 17) {
write("The corridor is 30' wide.");
} else if (dieroll <= 18) {
write("The corridor is 5' wide.");
} else {
write("Unusual passage:");
}
if (dieroll <= 18) {
add_to_master("move_to", "sidepassages1", 0.5);
add_to_master("roll", "sidepassagedirection", 20);
} else {
add_to_master("move_to", "sidepassages1", 0.65);
add_to_master("roll", "specialpassagea", 20);
}
} else if (arrowname == "sidepassagedirection") {
arrow_sidepassagedirection(dieroll);
} else if (arrowname == "doordirection") {
if (_root.gamemode == "build") {
if (dieroll <= 6) {
write("The door is to the left. Pass it or open it?");
add_to_master("switch_area_off");
add_to_master("switch_area_on", "doorleft");
} else if (dieroll <= 14) {
write("The door is straight ahead. What's beyond?");
_root.lastdoordirection = "ahead";
add_to_master("move_to", "doors2", 0.9);
add_to_master("roll", "beyonddoor", 20);
} else if (dieroll <= 20) {
write("The door is to the right. Pass it or open it?");
add_to_master("switch_area_off");
add_to_master("switch_area_on", "doorright");
}
} else if (getnumber("monsterhp") == 0) {
var _local14 = "<b>(f)orce</b> it open";
var _local15 = "f";
if (_root.characterclass == "Thief") {
_local14 = "<b>(p)ick</b> the lock";
_local15 = "p";
}
if (dieroll <= 6) {
if (_root.lost == 1) {
var _local25 = ("There is a door on the left side of the passage. " + _local14) + " or <b>(w)ander past</b>?";
add_to_key("w", "wander");
} else {
var _local25 = ("There is a door on the left side of of the passage. Could there be treasure on the other side? " + _local14) + " or <b>(c)ontinue</b> down the passage?";
add_to_key("c", "explore");
}
add_to_key(_local15, "forcedoor", "left", _local15);
} else if (dieroll <= 14) {
if (_root.lost == 1) {
var _local25 = ("There is a door at the end of the passage. " + _local14) + " or <b>(w)ander away</b>?";
add_to_key("w", "wander");
} else {
var _local25 = ("There is a door at the end of the passage. Could there be treasure on the other side? " + _local14) + " or <b>(b)acktrack</b>?";
add_to_key("b", "backtrack");
}
add_to_key(_local15, "forcedoor", "ahead", _local15);
} else if (dieroll <= 20) {
if (_root.lost == 1) {
var _local25 = ("There is a door on the right side of the passage. " + _local14) + " or <b>(w)ander past</b>?";
add_to_key("w", "wander");
} else {
var _local25 = ("There is a door on the right side of of the passage. Could there be treasure on the other side? " + _local14) + " or <b>(c)ontinue</b> down the passage?";
add_to_key("c", "explore");
}
add_to_key(_local15, "forcedoor", "right", _local15);
}
write(_local25);
} else {
if (dieroll <= 6) {
_root.lastdoordirection = "left";
} else if (dieroll <= 14) {
_root.lastdoordirection = "ahead";
} else if (dieroll <= 20) {
_root.lastdoordirection = "right";
}
_root.monstersource = "door";
write("The monster is right behind you. There's a door ahead of you.");
choosefight();
}
} else if (arrowname == "beyonddoor") {
arrow_beyonddoor(dieroll);
} else if (arrowname == "passagewidth") {
arrow_passagewidth(dieroll);
} else if (((arrowname == "specialpassagea") || (arrowname == "specialpassageb")) || (arrowname == "specialpassagec")) {
var _local17 = "a";
if (arrowname == "specialpassageb") {
_local17 = "b";
}
if (arrowname == "specialpassagec") {
_local17 = "c";
}
if (dieroll <= 4) {
write("40' wide corridor with columns down the center.");
} else if (dieroll <= 7) {
write("40' wide corridor with a double row of columns.");
} else if (dieroll <= 10) {
write("50' wide corridor with columns down the center.");
} else if (dieroll <= 12) {
var _local30 = Math.ceil(Math.random() * 4);
if (_local30 <= 3) {
write("50' wide corridor, columns supporting a 10' wide gallery 20' up. Stairs on the far side.");
} else {
write("50' wide corridor, columns supporting a 10' wide gallery 20' up. Stairs on the near side.");
}
} else if (dieroll <= 15) {
write("10' wide stream.");
add_to_master("roll", ("specialpassage" + _local17) + "stream", 20);
} else if (dieroll <= 17) {
write("20' wide river.");
add_to_master("roll", ("specialpassage" + _local17) + "river", 20);
} else if (dieroll <= 18) {
write("40' wide river.");
add_to_master("roll", ("specialpassage" + _local17) + "river", 20);
} else if (dieroll <= 19) {
write("60' wide river.");
add_to_master("roll", ("specialpassage" + _local17) + "river", 20);
} else if (dieroll <= 20) {
write("Chasm, 150' to 200' deep.");
add_to_master("roll", ("specialpassage" + _local17) + "chasm", 20);
}
if (dieroll <= 12) {
if (_local17 == "a") {
add_to_master("move_to", "sidepassages1", 0.5);
add_to_master("roll", "sidepassagedirection", 20);
} else if (_local17 == "b") {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (_local17 == "c") {
add_to_master("move_to", "exitpassagedirection");
add_to_master("move_to", "specialpassagec");
if ((_root.gamemode == "build") || (_root.noglintpossible == 1)) {
_root.noglintpossible = 0;
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else {
add_to_master("decide_to_turn");
}
}
}
} else {
if (((arrowname == "specialpassageastream") || (arrowname == "specialpassagebstream")) || (arrowname == "specialpassagecstream")) {
var _local32 = 0;
var _local17 = "a";
if (arrowname == "specialpassagebstream") {
_local17 = "b";
}
if (arrowname == "specialpassagecstream") {
_local17 = "c";
}
if (dieroll <= 15) {
write("There is a bridge.");
dead_end(2);
return(undefined);
}
dead_end(1);
return(undefined);
}
if (((arrowname == "specialpassageariver") || (arrowname == "specialpassagebriver")) || (arrowname == "specialpassagecriver")) {
var _local17 = "a";
if (arrowname == "specialpassagebriver") {
_local17 = "b";
}
if (arrowname == "specialpassagecriver") {
_local17 = "c";
}
if (dieroll <= 10) {
write("There is a bridge.");
dead_end(2);
return(undefined);
}
if (dieroll <= 15) {
var _local30 = Math.ceil(Math.random() * 2);
if (_local30 == 1) {
write("There is a boat on the near side.");
dead_end(2);
return(undefined);
}
write("There is a boat on the far side.");
dead_end(1);
return(undefined);
}
if (dieroll <= 20) {
write("There is no easy way to cross.");
dead_end(1);
return(undefined);
}
if (_local17 == "a") {
add_to_master("move_to", "sidepassages1", 0.5);
add_to_master("roll", "sidepassagedirection", 20);
} else if (_local17 == "b") {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (_local17 == "c") {
add_to_master("move_to", "exitpassagedirection");
add_to_master("move_to", "specialpassagec");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
} else if (((arrowname == "specialpassageachasm") || (arrowname == "specialpassagebchasm")) || (arrowname == "specialpassagecchasm")) {
var _local26 = arrow_specialpassagechasm(dieroll, arrowname);
if (_local26 == -1) {
return(undefined);
}
} else if (arrowname == "room") {
arrow_room(dieroll);
} else if (arrowname == "chamber") {
arrow_chamber(dieroll);
} else if (arrowname == "unusualshape") {
arrow_unusualshape(dieroll);
} else if (arrowname == "unusualsize") {
arrow_unusualsize(dieroll);
} else if (arrowname == "unusualshapecircular") {
arrow_unusualshapecircular(dieroll);
} else if (arrowname == "cave") {
arrow_cave(dieroll);
} else if (arrowname == "mammothcave") {
arrow_mammothcave(dieroll);
} else if (arrowname == "pool") {
arrow_pool(dieroll);
} else if (arrowname == "magicpool") {
arrow_magicpool(dieroll);
} else if (arrowname == "roomcontents") {
if (dieroll <= 12) {
var _local33 = useful_items();
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
} else if (dieroll <= 14) {
write("Monster!");
_root.monstersource = "monster";
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local20 = getnumber("dungeonlevel");
if (_local20 > 10) {
_local20 = 10;
}
add_to_master("roll", ("monster" + _local20) + "_", 4);
} else if (dieroll <= 17) {
write("Treasure and monster!");
_root.monstersource = "monsterandtreasure";
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local20 = getnumber("dungeonlevel");
if (_local20 > 10) {
_local20 = 10;
}
add_to_master("roll", ("monster" + _local20) + "_", 4);
} else if (dieroll <= 18) {
write("Treasure!");
var _local21 = Math.ceil(Math.random() * 20);
add_to_master("move_to", "treasure");
add_to_master("roll", "treasurein", 20);
} else {
if (dieroll <= 19) {
stairsquestion("roomcontentsspecial");
return(undefined);
}
add_to_master("move_to", "tricktrapb", 0.5);
add_to_master("roll", "tricktrapb", 20);
}
} else if (arrowname == "roomcontentsspecial") {
if (dieroll <= 6) {
if (_root.stairsdirection == "up") {
write("Stairs up 1 level.");
stairs(-1);
} else {
write("You ignore the stairs going up.");
}
} else if (dieroll <= 8) {
if (_root.stairsdirection == "up") {
write("Stairs up 2 levels.");
stairs(-2);
} else {
write("You ignore the stairs going up.");
}
} else if (dieroll <= 14) {
if (_root.stairsdirection == "down") {
write("Stairs down 1 level.");
stairs(1);
} else {
write("You ignore the stairs going down.");
}
} else if (dieroll <= 19) {
if (_root.stairsdirection == "down") {
write("Stairs down 2 levels.");
stairs(2);
} else {
write("You ignore the stairs going down.");
}
} else if (dieroll <= 20) {
if (_root.stairsdirection == "down") {
write("Down 3 levels: 2 stairs and a slanting passage.");
stairs(3);
} else {
write("You ignore the stairs going down.");
}
}
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
} else if (arrowname == "treasurehiddenby") {
if (dieroll <= 2) {
write("Treasure disguised by illusion.");
} else if (dieroll <= 3) {
write("Treasure in secret space under a container.");
} else if (dieroll <= 5) {
write("Treasure in secret compartment in a container.");
} else if (dieroll <= 8) {
write("Treasure is invisible.");
} else if (dieroll <= 13) {
write("Treasure in secret room nearby.");
} else if (dieroll <= 14) {
write("Treasure inside ordinary item in plain view.");
} else if (dieroll <= 15) {
write("Treasure under dung or trash.");
} else if (dieroll <= 17) {
write("Treasure under loose stone in floor.");
} else if (dieroll <= 19) {
write("Treasure behind loose stone in wall.");
} else if (dieroll <= 20) {
write("Treasure disguised as something else.");
}
add_to_master("move_to", "treasure");
add_to_master("roll", "treasure", 100);
} else if (arrowname == "treasureguardedby") {
var _local26 = arrow_treasureguardedby(dieroll);
if (_local26 == -1) {
return(undefined);
}
} else if (arrowname == "treasureguardedbydarts") {
if (dieroll == 1) {
write("Front of the container.");
} else if (dieroll == 2) {
write("Top of the container.");
} else if (dieroll == 3) {
write("Inside of the container.");
}
add_to_master("move_to", "treasure");
add_to_master("roll", "treasure", 100);
} else if (arrowname == "treasure") {
write("You find treasure!");
var _local21 = Math.ceil(Math.random() * 4);
var _local9 = 0;
var _local16 = 1;
if ((_root.monstersource == "monsterandtreasure") || (_root.monstersource == "deadend6")) {
_local16 = 1.1;
_root.secondtreasureroll++;
}
if (dieroll <= 25) {
_local9 = (1000 * getnumber("dungeonlevel")) * _local16;
write(("<font color='#009900'>" + _local9) + " cp.</font>");
addmoney("cp", _local9);
} else if (dieroll <= 50) {
_local9 = (1000 * getnumber("dungeonlevel")) * _local16;
write(("<font color='#009900'>" + _local9) + " sp.</font>");
addmoney("sp", _local9);
} else if (dieroll <= 65) {
_local9 = (750 * getnumber("dungeonlevel")) * _local16;
write(("<font color='#009900'>" + _local9) + " ep.</font>");
addmoney("ep", _local9);
} else if (dieroll <= 80) {
_local9 = (250 * getnumber("dungeonlevel")) * _local16;
write(("<font color='#009900'>" + _local9) + " gp.</font>");
addmoney("gp", _local9);
} else if (dieroll <= 90) {
_local9 = (100 * getnumber("dungeonlevel")) * _local16;
write(("<font color='#009900'>" + _local9) + " pp.</font>");
addmoney("pp", _local9);
} else if (dieroll <= 94) {
_local9 = _local21 * getnumber("dungeonlevel");
var _local31 = "";
if (_local9 > 1) {
_local31 = "s";
}
write(((("<font color='#009900'>" + _local9) + " gem") + _local31) + ".</font>");
addmoney("gems", _local9);
} else if (dieroll <= 97) {
var _local31 = "";
if (getnumber("dungeonlevel") > 1) {
_local31 = "s";
}
write(((("<font color='#009900'>" + getnumber("dungeonlevel")) + " piece") + _local31) + " of jewelry.</font>");
addmoney("jewelry", getnumber("dungeonlevel"));
} else if (dieroll <= 100) {
var _local19 = magic_items();
if ((_local19 != null) && (_local19 != "")) {
write(("<font color='#009900'>You find " + print_pretty(_local19, 1, "a")) + "!</font>");
add_equipment(_local19);
}
}
if (_root.secondtreasureroll == 1) {
add_to_master("roll", "treasure", 100);
} else {
if (_root.holder == "") {
write("Without a container, you can only keep 100 coins, gems, and jewelry.");
}
if (_root.monstersource == "deadend6") {
_root.monstersource = "";
dead_end(5);
} else {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
}
}
} else if (arrowname == "treasurein") {
if (dieroll <= 2) {
write("Treasure is in a bag.");
add_holder("sack");
} else if (dieroll <= 4) {
write("Treasure is in a sack.");
add_holder("sack");
} else if (dieroll <= 6) {
write("Treasure is in a coffer.");
add_holder("coffer");
} else if (dieroll <= 8) {
write("Treasure is in a chest.");
add_holder("chest");
} else if (dieroll <= 10) {
write("Treasure is in a huge chest.");
add_holder("huge chest");
} else if (dieroll <= 12) {
write("Treasure is in a pottery jar.");
add_holder("pottery jar");
} else if (dieroll <= 14) {
write("Treasure is in a metal urn.");
add_holder("metal urn");
} else if (dieroll <= 16) {
write("Treasure is in a stone container.");
add_holder("stone container");
} else if (dieroll <= 18) {
write("Treasure is in an iron trunk.");
add_holder("iron trunk");
} else if (dieroll <= 20) {
write("Treasure is loose.");
}
if ((_root.monstersource != "monsterandtreasure") && (_root.monstersource != "deadend6")) {
write("Could it be trapped?");
}
write("<b>(t)ake</b> it or <b>(l)eave</b> it?");
add_to_key("l", "move_to_and_roll", "exits", 0.7, 20);
if ((((((_root.monstersource == "monsterandtreasure") || (_root.monstersource == "deadend6")) || (dieroll == 19)) || (dieroll == 20)) || (dieroll <= 4)) || (Math.ceil(Math.random() * 2) == 2)) {
add_to_key("t", "roll", "treasure", 100);
} else {
add_to_key("t", "move_to_and_roll", "treasureguardedby", 0.5, 20);
}
} else if (arrowname == "tricktrapa") {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
} else if (arrowname == "tricktrapb") {
if (dieroll <= 5) {
var _local23 = 0;
write("Secret door. 3 in 20 chance to discover it. Otherwise, it's a pit!", 1);
var _local21 = Math.ceil(Math.random() * 20);
if (_local21 <= 3) {
write(("Roll: " + _local21) + "! You found the secret door!");
_local23 = 1;
} else {
write(("Roll: " + _local21) + "! Yup, it's a pit!");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a pit");
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
}
}
if (_local23 == 1) {
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
} else {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
} else if (dieroll <= 7) {
write("10' pit.");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a pit");
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 8) {
write("10' spiked pit.");
if (!savingthrow(1, 1)) {
damage(2, 6, "fell in a spiked pit");
if (!henchmansavingthrow()) {
damage(2, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(2, 6, 2);
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 11) {
write("20x20 elevator room.");
add_to_master("roll", "tricktrapbelevator", 6);
} else if (dieroll <= 12) {
write("Wall behind slides in, cutting you off. You'll have to find another way back.");
lostme(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 13) {
var _local12 = 1;
if (getnumber("henchmanhp") > 0) {
_local12++;
}
if (getnumber("henchman2hp") > 0) {
_local12++;
}
var _local21 = Math.ceil(Math.random() * _local12);
if (_local21 == 1) {
write("Oil and flaming cinders fall on you.");
if (!savingthrow(1)) {
damage(2, 6, "doused with flaming oil");
} else {
write("You only take minor burns.");
damage(1, 3, "doused with flaming oil");
}
} else {
write("Oil and flaming cinders fall on your companion.");
if (!henchmansavingthrow(_local12 - 1)) {
damage(2, 6, _local12 - 1);
} else {
write("Minor burns.");
damage(1, 3, _local12 - 1);
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 14) {
write("10' pit. Walls crush victims in 2-5 rounds.");
if (!savingthrow(1, 1)) {
damage(1, 6, "Crushed in a trash compactor.");
if ((_root.heavy == 1) && (getnumber("hp") > 0)) {
if ((_root.armor == "plate_mail") || (_root.armor == "+1_plate_mail")) {
write("You struggle to get out, but your armor is too heavy!");
damage(20, 1, "Wearing plate armor, too heavy to climb out of a trash compactor pit.");
} else {
write("You have to drop heavy equipment to get out of the pit.");
n = 0;
while (n < 15) {
if (_root.itemlist[_root.possessions[n][0]].heavy == 1) {
write(((("You drop " + _root.possessions[n][1]) + " ") + _root.possessions[n][0]) + "!");
add_equipment(_root.possessions[n][0], _root.possessions[n][1] * -1);
}
n++;
}
if (_root.holder != "sack") {
_root.holder = "";
keep_best(100);
}
}
_root.heavy = 0;
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 15) {
add_to_master("move_to", "gasb");
add_to_master("roll", "gasb", 20);
} else if (dieroll <= 17) {
var _local12 = 1;
var _local10 = "arrow";
if (dieroll == 17) {
_local10 = "spear";
}
if (getnumber("henchmanhp") > 0) {
_local12++;
}
if (getnumber("henchman2hp") > 0) {
_local12++;
}
var _local21 = Math.ceil(Math.random() * 20);
var _local13 = Math.ceil(Math.random() * 3);
if (_local21 == "20") {
var _local8 = " poison";
} else {
var _local8 = "";
}
write((((((((("You set off " + _local10) + " trap. ") + _local13) + " ") + _local8) + " ") + _local10) + myplural(_local13)) + "!");
na = 0;
while (na < _local13) {
var _local6 = Math.ceil(Math.random() * _local12);
var _local5 = Math.ceil(Math.random() * 20);
if (_local6 == 1) {
if (_local5 >= getnumber("ac")) {
damage(1, 6, ("killed by " + _local10) + " trap");
if ((getnumber("hp") > 0) && (_local8 != "")) {
if (!savingthrow()) {
damage(20, 1, ("killed by a poison " + _local10) + " trap");
}
}
} else {
write("Missed you!");
}
} else if (_local6 == 2) {
if (_local5 >= getnumber("henchmanac")) {
damage(1, 6, 1);
if ((getnumber("henchmanhp") > 0) && (_local8 != "")) {
if (!henchmansavingthrow(1)) {
damage(20, 1, 1);
}
}
} else {
write(("Missed " + _root.henchmanname) + "!");
}
} else if (_local6 == 3) {
if (_local5 >= getnumber("henchman2ac")) {
damage(1, 6, 2);
if ((getnumber("henchman2hp") > 0) && (_local8 != "")) {
if (!henchmansavingthrow(2)) {
damage(20, 1, 2);
}
}
} else {
write(("Missed " + _root.henchman2name) + "!");
}
}
na++;
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 18) {
add_to_master("roll", "tricktrapbwall", 20);
} else if (dieroll <= 19) {
write("The floor tilts, spilling you down a chute going down 1 level. It's too slippery to climb back up.");
lostme(1);
stairs(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 20) {
if (getnumber("dungeonlevel") <= 5) {
write("As you approach a door, it falls on you.");
if (!savingthrow(1, 1)) {
damage(1, 10, "crushed by a falling door");
}
if (!henchmansavingthrow(1)) {
damage(1, 10, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 10, 2);
}
} else {
write("A stone block falls on you.");
if (!savingthrow(1, 1)) {
damage(2, 10, "crushed by a falling stone");
}
if (!henchmansavingthrow(1)) {
damage(2, 10, 1);
}
if (!henchmansavingthrow(2)) {
damage(2, 10, 2);
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
}
} else if (arrowname == "tricktrapapit") {
if (dieroll <= 2) {
write("10' pit.");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a pit");
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
}
} else if (dieroll <= 3) {
write("10' spiked pit.");
if (!savingthrow(1, 1)) {
damage(2, 6, "fell in a spiked pit");
if (!henchmansavingthrow()) {
damage(2, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(2, 6, 2);
}
}
} else if (dieroll <= 4) {
write("10' pit. Walls crush victims in 2-5 rounds.");
if (!savingthrow(1, 1)) {
damage(1, 6, "crushed in a trash compactor");
if ((_root.heavy == 1) && (getnumber("hp") > 0)) {
if ((_root.armor == "plate_mail") || (_root.armor == "+1_plate_mail")) {
write("You struggle to get out, but your armor is too heavy!");
damage(20, 1, "Wearing plate armor, too heavy to climb out of a trash compactor pit.");
} else {
write("You have to drop heavy equipment to get out of the pit.");
n = 0;
while (n < 15) {
if (_root.itemlist[_root.possessions[n][0]].heavy == 1) {
write(((("You drop " + _root.possessions[n][1]) + " ") + _root.possessions[n][0]) + "!");
add_equipment(_root.possessions[n][0], _root.possessions[n][1] * -1);
}
n++;
}
if (_root.holder != "sack") {
_root.holder = "";
keep_best(100);
}
}
_root.heavy = 0;
}
}
}
} else if (arrowname == "tricktrapaelevator") {
lostme(1);
if (dieroll <= 1) {
write("A door closes behind you. The room descends 1 level and will not ascend.");
stairs(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 2) {
write("A door closes behind you. The room descends 2 levels and will not ascend.");
stairs(2);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 3) {
var _local21 = Math.ceil(Math.random() * 4);
_root.forceelevator = _local21;
write("A door closes behind you. The room descends a level. The door is stuck. <b>(f)orce door</b>?");
stairs(1);
add_to_key("f", "forceelevator");
return(undefined);
}
} else if (arrowname == "tricktrapbelevator") {
lostme(1);
if (dieroll <= 2) {
write("A door closes behind you. The room descends 1 level and will not ascend.");
stairs(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 4) {
write("A door closes behind you. The room descends 2 levels and will not ascend.");
stairs(2);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 6) {
var _local21 = Math.ceil(Math.random() * 4);
_root.forceelevator = _local21;
write("A door closes behind you. The room descends a level. The door is stuck. <b>(f)orce door</b>?");
stairs(1);
add_to_key("f", "forceelevator");
return(undefined);
}
} else if (arrowname == "tricktrapawall") {
if (dieroll <= 6) {
write("The floor is an illusion! It hides a pit trap.");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a pit cloaked by an illusionary floor");
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
}
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
} else if (dieroll <= 10) {
write("The floor is an illusion! You fall down a chute going down 1 level. It's too slippery to climb back up.");
lostme(1);
stairs(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 20) {
write("An illusionary wall vanishes, and you discover that you are not alone.");
_root.fudgeroll = 15;
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
} else if (arrowname == "tricktrapbwall") {
if (dieroll <= 6) {
write("The floor is an illusion! It hides a pit trap.");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a pit cloaked by an illusionary floor");
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
}
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 10) {
write("The floor is an illusion! You fall down a chute going down 1 level. It's too slippery to climb back up.");
lostme(1);
stairs(1);
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 20) {
write("An illusionary wall vanishes, and you discover that you are not alone.");
_root.fudgeroll = 15;
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
} else if (arrowname == "gasa") {
if (dieroll <= 1) {
write("Poison: save vs poison or die.");
} else if (dieroll <= 2) {
write("Sickness: must return to surface.");
} else if (dieroll <= 7) {
write("Strength: Adds 1-6 points of STR to all fighters for 1-10 hours.");
} else if (dieroll <= 8) {
write("Sleep for 2-12 turns (as sleep spell).");
} else if (dieroll <= 11) {
write("Fear: save vs magic or run back 120 feet.");
} else if (dieroll <= 13) {
write("Blindness for 1-6 turns.");
} else if (dieroll <= 20) {
write("Obscures vision while passing through.");
}
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
} else if (arrowname == "gasb") {
var _local26 = arrow_gasb(dieroll);
if (_local26 == -1) {
return(undefined);
}
} else if (arrowname == "exits") {
_root.exitno = 0;
_root.monstersource = "";
_root.monsteraware = 0;
_root.secondtreasureroll = 0;
_root.fishedout = 0;
exittype = "passage";
if (_root.roomorchamber == "room") {
exittype = "door";
}
if (dieroll <= 3) {
if (_root.sqft <= 600) {
write(("One " + exittype) + ".");
_root.exitno = 1;
}
if (_root.sqft > 600) {
write(("Two " + exittype) + "s.");
_root.exitno = 2;
}
} else if (dieroll <= 6) {
if (_root.sqft <= 600) {
write(("Two " + exittype) + "s.");
_root.exitno = 2;
}
if (_root.sqft > 600) {
write(("Three " + exittype) + "s.");
_root.exitno = 3;
}
} else if (dieroll <= 9) {
if (_root.sqft <= 600) {
write(("Three " + exittype) + "s.");
_root.exitno = 3;
}
if (_root.sqft > 600) {
write(("Four " + exittype) + "s.");
_root.exitno = 4;
}
} else if (dieroll <= 12) {
if (_root.sqft <= 1200) {
write("No exit.");
_root.exitno = 0;
}
if (_root.sqft > 1200) {
write(("One " + exittype) + ".");
_root.exitno = 1;
}
} else if (dieroll <= 15) {
if (_root.sqft <= 1600) {
write("No exit.");
_root.exitno = 0;
}
if (_root.sqft > 1600) {
write(("One " + exittype) + ".");
_root.exitno = 1;
}
} else if (dieroll <= 18) {
var _local21 = Math.ceil(Math.random() * 4);
if (_local21 == 1) {
write("One exit.");
_root.exitno = 1;
} else {
write(_local21 + " exits.");
_root.exitno = _local21;
}
} else {
if (_root.exittype == "passage") {
_root.exittype = "door";
} else {
_root.exittype = "passage";
}
write(("One " + exittype) + ".");
_root.exitno = 1;
}
if (_root.exitno == 0) {
var _local28 = new Array(0, 0, 0);
_root.deadend = _local28;
var _local29 = Math.ceil(Math.random() * 4);
var _local27 = Math.ceil(Math.random() * 4);
var _local24 = Math.ceil(Math.random() * 4);
if (_local29 == 4) {
_root.deadend[0] = 1;
}
if (_local27 == 4) {
_root.deadend[1] = 1;
}
if (_local24 == 4) {
_root.deadend[2] = 1;
}
dead_end(0);
} else {
add_to_master("move_to", "exitlocation");
add_to_master("roll", "exitlocation", 20);
}
} else if (arrowname == "exitlocation") {
if (dieroll <= 3) {
_root.turndir.push(4);
} else if (dieroll <= 8) {
_root.turndir.push(-2);
} else if (dieroll <= 13) {
_root.turndir.push(2);
} else {
_root.turndir.push(0);
}
_root.exitno--;
if (_root.exitno == 0) {
_root.roomorchamber = "";
_root.noglintpossible = 1;
if (_root.gamemode == "build") {
turn(turndir[0]);
add_to_master("move_to", "exittype");
if (_root.exittype == "door") {
_root.exittype = "";
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
} else {
_root.exittype = "";
add_to_master("move_to", "exitpassagedirection", 0.8);
add_to_master("roll", "exitpassagedirection", 20);
}
} else {
write("Which way will you go?");
var _local7 = new Array("", "", "second", "third", "fourth", "fifth", "sixth");
var _local4 = new Array(0, 0, 0, 0);
n = 0;
while (n < _root.turndir.length) {
if (_root.turndir[n] == 4) {
_local4[0]++;
write((((((n + 1) + ". <b>") + _local7[_local4[0]]) + " ") + _root.exittype) + " behind you?</b>");
add_to_key(n + 1, "takepassage", 4);
}
if (_root.turndir[n] == 2) {
_local4[1]++;
write((((((n + 1) + ". <b>") + _local7[_local4[1]]) + " ") + _root.exittype) + " to the right?</b>");
add_to_key(n + 1, "takepassage", 2);
}
if (_root.turndir[n] == -2) {
_local4[2]++;
write((((((n + 1) + ". <b>") + _local7[_local4[2]]) + " ") + _root.exittype) + " to the left?</b>");
add_to_key(n + 1, "takepassage", -2);
}
if (_root.turndir[n] == 0) {
_local4[3]++;
write((((((n + 1) + ". <b>") + _local7[_local4[3]]) + " ") + _root.exittype) + " in front of you?</b>");
add_to_key(n + 1, "takepassage", 0);
}
n++;
}
}
} else {
add_to_master("roll", "exitlocation", 20);
}
} else if (arrowname == "exitpassagedirection") {
if (dieroll <= 16) {
write("Passage is straight.");
} else if (dieroll <= 18) {
write("Passage goes 45 degrees right.");
turn(1);
} else if (dieroll <= 20) {
write("Passage goes 45 degrees left.");
turn(-1);
}
add_to_master("move_to", "turnwidth");
add_to_master("roll", "exitwidthd", 20);
} else if (arrowname == "exitwidthd") {
if (dieroll <= 1) {
write("The corridor is 30' wide.");
} else if (dieroll <= 5) {
write("The corridor is 20' wide.");
} else if (dieroll <= 17) {
write("The corridor is 10' wide.");
} else if (dieroll <= 18) {
write("The corridor is 5' wide.");
} else {
write("Unusual passage:");
}
if (dieroll <= 18) {
add_to_master("move_to", "b");
if ((_root.gamemode == "build") || (_root.noglintpossible == 1)) {
_root.noglintpossible = 0;
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else {
add_to_master("decide_to_turn");
}
} else {
add_to_master("move_to", "specialpassagec", 0.85);
add_to_master("roll", "specialpassagec", 20);
}
} else if (arrowname == "mainturns") {
if (dieroll <= 8) {
write("Passage turns left.");
_root.upcomingturn = -2;
} else if (dieroll <= 16) {
write("Passage turns right.");
_root.upcomingturn = 2;
} else if (dieroll <= 17) {
write("Passage turns 45 degrees right.");
_root.upcomingturn = 1;
} else if (dieroll <= 18) {
write("Passage turns 45 degrees left.");
_root.upcomingturn = -1;
} else if (dieroll <= 19) {
write("Passage takes a sharp 135-degree left turn.");
_root.upcomingturn = -3;
} else if (dieroll <= 20) {
write("Passage takes a sharp 135-degree right turn.");
_root.upcomingturn = 3;
}
add_to_master("move_to", "turnwidth");
add_to_master("roll", "exitwidthd", 20);
} else if (arrowname == "deadend") {
dead_end();
} else if (arrowname == "stairs") {
arrow_stairs(dieroll);
} else if ((((((((((arrowname == "monster1_") || "monster2_") || "monster3_") || "monster4_") || "monster5_") || "monster6_") || "monster7_") || "monster8_") || "monster9_") || "monster10_") {
var _local11 = getnumber("dungeonlevel");
if (_root.monsternumber == 0) {
_root.monsternumber = dieroll;
} else {
_root.monster2number = dieroll;
}
if (_local11 == 1) {
if (dieroll == 1) {
fight("Kobold");
} else if (dieroll == 2) {
fight("Fire Beetle");
} else if (dieroll == 3) {
fight("Giant Rat");
} else if (dieroll == 4) {
fight("Skeleton");
}
} else if (_local11 == 2) {
if (dieroll == 1) {
fight("Centipede");
} else if (dieroll == 2) {
fight("Orc");
} else if (dieroll == 3) {
fight("Troglodyte");
} else if (dieroll == 4) {
fight("Bugbear");
}
} else if (_local11 == 3) {
if (dieroll == 1) {
fight("Bandit");
} else if (dieroll == 2) {
fight("Ear Seeker");
} else if (dieroll == 3) {
fight("Piercer");
} else if (dieroll == 4) {
fight("Giant Toad");
}
} else if (_local11 == 4) {
if (dieroll == 1) {
fight("Hobgoblin");
} else if (dieroll == 2) {
fight("Shrieker");
} else if (dieroll == 3) {
fight("Giant Spider");
} else if (dieroll == 4) {
fight("Werewolf");
}
} else if (_local11 == 5) {
if (dieroll == 1) {
fight("Stirge");
} else if (dieroll == 2) {
fight("Boring Beetle");
} else if (dieroll == 3) {
fight("Carnivorous Ape");
} else if (dieroll == 4) {
fight("Giant Lizard");
}
} else if (_local11 == 6) {
if (dieroll == 1) {
fight("Gelatinous Cube");
} else if (dieroll == 2) {
fight("Rust Monster");
} else if (dieroll == 3) {
fight("Minotaur");
} else if (dieroll == 4) {
fight("Medusa");
}
} else if (_local11 == 7) {
if (dieroll == 1) {
fight("Ghast");
} else if (dieroll == 2) {
fight("Leucrotta");
} else if (dieroll == 3) {
fight("Carrion Crawler");
} else if (dieroll == 4) {
fight("Manticore");
}
} else if (_local11 == 8) {
if (dieroll == 1) {
fight("Su Monster");
} else if (dieroll == 2) {
fight("Yellow Mold");
} else if (dieroll == 3) {
fight("Hill Giant");
} else if (dieroll == 4) {
fight("Mind Flayer");
}
} else if (_local11 == 9) {
if (dieroll == 1) {
fight("Doppelganger");
} else if (dieroll == 2) {
fight("Vampire");
} else if (dieroll == 3) {
fight("Lurker Above");
} else if (dieroll == 4) {
fight("Purple Worm");
}
} else if (_local11 >= 10) {
if (dieroll == 1) {
fight("Mimic");
} else if (dieroll == 2) {
fight("Succubus");
} else if (dieroll == 3) {
fight("Storm Giant");
} else if (dieroll == 4) {
fight("Dragon");
}
}
}
}
run_master();
}
function arrow_unusualshape(dieroll) {
_root.sqft = 0;
if (dieroll <= 3) {
write("Triangular room.");
} else if (dieroll <= 6) {
write("Trapezoidal room.");
} else if (dieroll <= 11) {
write("Circular room.");
add_to_master("roll", "unusualshapecircular", 20);
} else if (dieroll <= 13) {
write("Oval room.");
} else if (dieroll <= 14) {
write("Cave.");
add_to_master("move_to", "cavescreen", 0.6);
add_to_master("roll", "cave", 20);
} else if (dieroll <= 16) {
write("Odd-shaped room.");
} else if (dieroll <= 18) {
write("Hexagonal room.");
} else if (dieroll <= 20) {
write("Octagonal room.");
}
if (((dieroll <= 6) || (dieroll >= 12)) && (dieroll != 14)) {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
}
}
function arrow_unusualsize(dieroll) {
if (dieroll <= 3) {
_root.sqft = _root.sqft + 500;
write(("About " + _root.sqft) + " sq. feet.");
} else if (dieroll <= 6) {
_root.sqft = _root.sqft + 900;
write(("About " + _root.sqft) + " sq. feet");
} else if (dieroll <= 8) {
_root.sqft = _root.sqft + 1300;
write(("About " + _root.sqft) + " sq. feet");
} else if (dieroll <= 10) {
_root.sqft = _root.sqft + 2000;
write(("About " + _root.sqft) + " sq. feet");
} else if (dieroll <= 12) {
_root.sqft = _root.sqft + 2700;
write(("About " + _root.sqft) + " sq. feet");
} else if (dieroll <= 14) {
_root.sqft = _root.sqft + 3400;
write(("About " + _root.sqft) + " sq. feet");
} else if (dieroll <= 20) {
write("+2000 ft and roll again: ");
_root.sqft = _root.sqft + 2000;
}
if (dieroll <= 14) {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
} else {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
}
}
function arrow_unusualshapecircular(dieroll) {
if (dieroll <= 5) {
} else if (dieroll <= 7) {
write("There's a well in the middle.");
} else if (dieroll <= 10) {
write("There's a shaft in the middle of the floor.");
}
if (dieroll <= 5) {
_root.cavedestination = "unusualsize";
add_to_master("move_to", "poolscreen");
add_to_master("roll", "pool", 20);
} else {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
}
}
function arrow_room(dieroll) {
_root.roomorchamber = "room";
if ((_root.direction % 2) == 1) {
turn(1);
}
if (dieroll <= 2) {
write("Square 10x10 room.");
_root.sqft = 100;
} else if (dieroll <= 4) {
write("Square 20x20 room.");
_root.sqft = 400;
} else if (dieroll <= 6) {
write("Square 30x30 room.");
_root.sqft = 900;
} else if (dieroll <= 8) {
write("Square 40x40 room.");
_root.sqft = 1600;
} else if (dieroll <= 10) {
write("Rectangular 10x20 room.");
_root.sqft = 200;
} else if (dieroll <= 13) {
write("Rectangular 20x30 room.");
_root.sqft = 600;
} else if (dieroll <= 15) {
write("Rectangular 20x40 room.");
_root.sqft = 800;
} else if (dieroll <= 17) {
write("Rectangular 30x40 room.");
_root.sqft = 1200;
} else if (dieroll <= 20) {
write("Room of unusual size.");
}
if (dieroll <= 17) {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
} else {
add_to_master("move_to", "unusualshape");
add_to_master("roll", "unusualshape", 20);
}
}
function arrow_chamber(dieroll) {
_root.roomorchamber = "chamber";
if ((_root.direction % 2) == 1) {
turn(1);
}
if (dieroll <= 4) {
write("Square 20x20 chamber.");
_root.sqft = 400;
} else if (dieroll <= 6) {
write("Square 30x30 chamber.");
_root.sqft = 900;
} else if (dieroll <= 8) {
write("Square 40x40 chamber.");
_root.sqft = 1600;
} else if (dieroll <= 13) {
write("Rectangular 20x30 chamber.");
_root.sqft = 600;
} else if (dieroll <= 15) {
write("Rectangular 30x50 chamber.");
_root.sqft = 1500;
} else if (dieroll <= 17) {
write("Rectangular 40x60 chamber.");
_root.sqft = 2400;
} else if (dieroll <= 20) {
write("Chamber of unusual size.");
}
if (dieroll <= 17) {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
} else {
add_to_master("move_to", "unusualshape");
add_to_master("roll", "unusualshape", 20);
}
}
function arrow_specialpassagechasm(dieroll, arrowname) {
var _local1 = "a";
if (arrowname == "specialpassagebchasm") {
_local1 = "b";
}
if (arrowname == "specialpassagecchasm") {
_local1 = "c";
}
if (dieroll <= 10) {
write("There is a bridge.");
} else if (dieroll <= 15) {
write("The chasm can be jumped.");
} else if (dieroll <= 20) {
write("There is no easy way to cross.");
dead_end(3);
return(-1);
}
if (_local1 == "a") {
add_to_master("move_to", "sidepassages1", 0.5);
add_to_master("roll", "sidepassagedirection", 20);
} else if (_local1 == "b") {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (_local1 == "c") {
add_to_master("move_to", "exitpassagedirection");
add_to_master("move_to", "specialpassagec");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
}
function arrow_passagewidth(dieroll) {
if (dieroll <= 12) {
write("The corridor is 10' wide.");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 16) {
write("The corridor is 20' wide.");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 17) {
write("The corridor is 30' wide.");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 18) {
write("The corridor is 5' wide.");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else if (dieroll <= 20) {
write("Unusual passage:");
add_to_master("move_to", "sidepassages2", 0.5);
add_to_master("roll", "specialpassageb", 20);
}
}
function try_to_lose(dc) {
if ((dc == null) || (dc == undefined)) {
dc = 4;
}
if (getnumber("monsterhp") > 0) {
var _local1 = Math.ceil(Math.random() * 6);
if (monster_has_tag("mapsense")) {
_local1++;
}
if (_local1 <= dc) {
write("You lost your pursuer!");
clear_monster();
}
}
}
function arrow_beyonddoor(dieroll) {
try_to_lose();
if (dieroll <= 4) {
write("The passage continues ahead.");
add_to_master("move_to", "passagewidth");
add_to_master("roll", "passagewidth", 20);
} else if (dieroll <= 8) {
if (_root.lastdoordirection == "ahead") {
add_to_master("move_to", "room");
_root.fudgeroll = 1;
add_to_master("roll", "room");
} else {
write("You're in a new passage, parallel to the last one you were in.");
add_to_master("move_to", "passagewidth");
add_to_master("roll", "passagewidth", 20);
}
} else if (dieroll <= 9) {
write("The passage turns 45 degrees ahead.");
turn(-1);
add_to_master("move_to", "passagewidth");
add_to_master("roll", "passagewidth", 20);
} else if (dieroll <= 10) {
write("The passage turns 45 degrees behind.");
turn(-3);
add_to_master("move_to", "passagewidth");
add_to_master("roll", "passagewidth", 20);
} else if (dieroll <= 18) {
write("The door opens to a room.");
add_to_master("move_to", "room");
add_to_master("roll", "room", 20);
} else if (dieroll <= 20) {
write("The door opens to a chamber.");
add_to_master("move_to", "chamber");
add_to_master("roll", "chamber", 20);
}
_root.lastdoordirection = "";
}
function arrow_stairs(dieroll) {
var _local4 = Math.ceil(Math.random() * 20);
var _local3 = "";
if (dieroll <= 1) {
if (_root.stairsdirection == "up") {
write("Up one level.");
stairs(-1);
} else {
write("You ignore the stairs going up.");
}
} else if (dieroll <= 6) {
if (_root.stairsdirection == "down") {
if (_local4 == 20) {
_local3 = "Door seals for the day.";
}
write("Down one level. " + _local3);
stairs(1);
} else {
write("You ignore the stairs going down.");
}
} else if (dieroll <= 7) {
if (_root.stairsdirection == "down") {
if (_local4 >= 19) {
_local3 = "Door seals for the day.";
}
write("Down two levels. " + _local3);
stairs(2);
} else {
write("You ignore the stairs going down.");
}
} else if (dieroll <= 8) {
if (_root.stairsdirection == "down") {
if (_local4 >= 18) {
_local3 = "Door seals for the day.";
}
write("Down three levels. " + _local3);
stairs(3);
} else {
write("You ignore the stairs going down.");
}
} else if (dieroll <= 9) {
if (_root.stairsdirection == "up") {
_local4 = Math.ceil(Math.random() * 6);
if (_local4 == 6) {
_local3 = "Chute down 2 levels.";
stairs(1);
}
write("Up dead end. " + _local3);
} else {
write("You ignore the stairs going up.");
}
} else if (dieroll <= 10) {
if (_root.stairsdirection == "down") {
_local4 = Math.ceil(Math.random() * 6);
if (_local4 == 6) {
_local3 = "Chute down 1 level.";
stairs(1);
}
write("Down dead end. " + _local3);
} else {
write("You ignore the chute going down.");
}
} else if (dieroll <= 11) {
if (_root.stairsdirection == "up") {
write("Chimney up 2 levels, passage continues.");
stairs(-2);
} else {
write("You ignore the chimney going up.");
}
} else if (dieroll <= 12) {
if (_root.stairsdirection == "up") {
write("Chimney up 1 level, passage continues.");
stairs(-1);
} else {
write("You ignore the chimney going up.");
}
} else if (dieroll <= 13) {
if (_root.stairsdirection == "down") {
write("Chimney down 2 levels, passage continues.");
stairs(2);
} else {
write("You ignore the chimney going down.");
}
} else if (dieroll <= 16) {
if (_root.stairsdirection == "down") {
write("Trapdoor down 1 level, passage continues.");
stairs(1);
} else {
write("You ignore the trapdoor going down.");
}
} else if (dieroll <= 17) {
if (_root.stairsdirection == "down") {
write("Trapdoor down 2 levels, passage continues.");
stairs(2);
} else {
write("You ignore the trapdoor going down.");
}
} else if (dieroll <= 20) {
if (_root.stairsdirection == "up") {
write("Stairs up 1 level, then slides you down 2 levels, with a chamber at the end.");
stairs(1);
} else {
write("You ignore the stairs going up.");
}
}
if ((_root.gameover != 1) && (_root.intown != 1)) {
if (dieroll <= 17) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
} else {
add_to_master("move_to", "chamber");
add_to_master("roll", "chamber", 20);
}
}
}
function arrow_gasb(dieroll) {
if (dieroll <= 7) {
write("A black, sooty gas hisses out around you. It obscures your vision as you pass through.");
if (getnumber("monsterhp") > 0) {
clear_monster();
write("You lose your pursuer in the dark!");
}
} else {
if (dieroll <= 9) {
write("You smell some sort of gas. Everything goes black. You're blind!");
clear_monster();
blind();
return(-1);
}
if (dieroll <= 12) {
if (!savingthrow()) {
write("A yellow gas sprays into your face. Your mind is filled with TERROR! You turn and run. When you come to yourself, you don't know where you are.");
lostme(1);
} else {
write("A yellow gas sprays into your face. You feel a brief moment of panic, but you fight it down.");
}
} else if (dieroll <= 13) {
write("A purple gas envelops you. You fall asleep.");
if (getnumber("hp") < getnumber("maxhp")) {
addnumber("hp", 1);
}
if (((getnumber("henchmanhp") > 0) && (!henchman_has_tag("undead"))) && (getnumber("henchmanhp") < getnumber("henchmanmaxhp"))) {
addnumber("henchmanhp", 1);
}
if (((getnumber("henchman2hp") > 0) && (!henchman_has_tag("undead", 2))) && (getnumber("henchman2hp") < getnumber("henchman2maxhp"))) {
addnumber("henchman2hp", 1);
}
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
if (getnumber("henchmanhp") > 0) {
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
}
if (getnumber("henchman2hp") > 0) {
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
}
if (Math.ceil(Math.random() * 2) == 2) {
write("You awake to find yourself being attacked!");
_root.monstersource = "wandering";
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local2 = getnumber("dungeonlevel");
if (_local2 > 10) {
_local2 = 10;
}
if (((_local2 == 0) || (_local2 == null)) || (_local2 == undefined)) {
_local2 = 1;
}
add_to_master("roll", ("monster" + _local2) + "_", 4);
} else {
write("You wake up refreshed!");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
} else if (dieroll <= 18) {
write("As a red mist surrounds you, you feel supernaturally strong! Until you return to the surface, your attacks will do more damage.");
_root.strengthspell = 1;
readyitem();
} else if (dieroll <= 19) {
write("You walk into a nearly invisible cloud of brownish gas. You cough and retch. You must return to the surface at once.");
setnumber("hp", 1);
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
} else if (dieroll <= 20) {
write("A cloud of poisonous green gas hisses from hidden valves.");
if (savingthrow()) {
write("You hold your breath and run through the gas.");
} else {
damage(20, 1, "killed by poison gas");
}
}
}
if (dieroll != 13) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
}
function arrow_treasureguardedby(dieroll) {
if (dieroll <= 2) {
write("Contact poison on container.");
if (!savingthrow(1)) {
damage(20, 1, "killed by contact poison on a treasure chest");
}
} else if (dieroll <= 4) {
write("Poison needles in lock.");
if (!savingthrow(1)) {
damage(20, 1, "poked by a poison needle in a lock");
}
} else if (dieroll <= 5) {
write("Poison needles on handle.");
if (!savingthrow(1)) {
damage(20, 1, "poisoned by a needle on a handle");
}
} else if (dieroll <= 7) {
write("Contact poison on treasure.");
if (!savingthrow(1)) {
damage(20, 1, "killed by contact poison on a treasure");
}
} else if (dieroll <= 10) {
write("Spring darts shoot from container:");
if (!savingthrow(1, 1)) {
damage(3, 3, "shot in the face with spring darts");
}
} else if (dieroll <= 12) {
write("Blade scything along inside of container.");
if (!savingthrow(1)) {
damage(1, 8, "beheaded by scything blade inside treasure chest");
}
} else if (dieroll <= 13) {
write("Poison insect or reptile in the container.");
if (!savingthrow(1, 1)) {
damage(20, 1, "bitten by poisonous snake in a treasure chest");
}
} else if (dieroll <= 14) {
write("Gas released by opening container.");
if (!savingthrow(1, 1)) {
damage(1, 6, "gassed by trapped chest");
}
} else if (dieroll <= 15) {
write("Trapdoor opens in front of container.");
if (!savingthrow(1, 1)) {
damage(1, 6, "fell in a trap door right in front of some treasure");
}
} else if (dieroll <= 16) {
write("Trapdoor opens 6 feet in front of container.");
if (!savingthrow(1, -1)) {
damage(1, 6, "fell in a trap door standing cautiously back from some treasure");
}
} else if (dieroll <= 17) {
write("Stone block drops in front of container.");
if (!savingthrow(1, 1)) {
damage(2, 10, "crushed by a stone block while opening a trapped chest");
}
} else if (dieroll <= 18) {
write("Spears release when container is opened.");
if (!savingthrow(1, 1)) {
damage(2, 6, "speared while looting trapped treasure");
}
} else if (dieroll <= 19) {
write("Explosive Runes.");
if (!savingthrow(1, 1)) {
damage(2, 6, "exploded by explosive runes");
}
if (!henchmansavingthrow()) {
damage(1, 6, 1);
}
if (!henchmansavingthrow(2)) {
damage(1, 6, 2);
}
} else if (dieroll <= 20) {
write("Symbol spell.");
if (!savingthrow(1, 1)) {
damage(1, 6, "snuffed out by Symbol spell");
}
}
if (getnumber("hp") == 0) {
return(-1);
}
if (((((dieroll >= 8) && (dieroll <= 10)) && (dieroll != undefined)) && (dieroll != NaN)) && (dieroll != null)) {
add_to_master("move_to", "treasureguardedby", 0.5);
add_to_master("roll", "treasureguardedbydarts", 3);
} else {
add_to_master("move_to", "treasure");
add_to_master("roll", "treasure", 100);
}
}
function arrow_sidepassagedirection(dieroll) {
var _local2 = new Array();
if (dieroll <= 2) {
write("Passage left.");
_local2.push(0);
_local2.push(-2);
} else if (dieroll <= 4) {
write("Passage right.");
_local2.push(0);
_local2.push(2);
} else if (dieroll <= 5) {
write("Passage 45 degrees left.");
_local2.push(0);
_local2.push(-1);
} else if (dieroll <= 6) {
write("Passage 45 degrees right.");
_local2.push(0);
_local2.push(1);
} else if (dieroll <= 7) {
write("Passage left, 45 degrees back.");
_local2.push(0);
_local2.push(-3);
} else if (dieroll <= 8) {
write("Passage right, 45 degrees back.");
_local2.push(0);
_local2.push(3);
} else if (dieroll <= 9) {
write("Left curve, 45 degrees ahead.");
_local2.push(0);
_local2.push(-1);
} else if (dieroll <= 10) {
write("Right curve, 45 degrees ahead.");
_local2.push(0);
_local2.push(1);
} else if (dieroll <= 13) {
write("T intersection.");
_local2.push(-2);
_local2.push(2);
} else if (dieroll <= 15) {
write("Y intersection.");
_local2.push(-1);
_local2.push(1);
} else if (dieroll <= 19) {
write("Crossroads.");
_local2.push(0);
_local2.push(-2);
_local2.push(2);
} else if (dieroll <= 20) {
if ((_root.direction % 2) == 0) {
write("Passage makes an X. You're coming from a fifth passage into the X.");
_local2.push(-1);
_local2.push(-3);
_local2.push(1);
_local2.push(3);
} else {
write("Passage makes an X.");
_local2.push(0);
_local2.push(-2);
_local2.push(2);
}
}
var _local4 = Math.ceil(Math.random() * 4);
if (_local4 == 1) {
_local4 = Math.ceil(Math.random() * _local2.length);
_root.glint = _local2[_local4 - 1];
write(("<font color=\"#cc9900\">You see a glint of light to the " + mydirection(_root.glint)) + ". It might be nothing, but it might be treasure, a trap, or the shining eyes of a monster.</font>");
if (_root.glint == 0) {
_root.glint = 10;
}
}
write("Which way will you go?");
_root.exittype = "";
n = 0;
while (n < _local2.length) {
if (_local2[n] == -3) {
write((n + 1) + ". <b>Back and to the left?</b>");
add_to_key(n + 1, "takepassage", -3);
}
if (_local2[n] == -2) {
write((n + 1) + ". <b>Left?</b>");
add_to_key(n + 1, "takepassage", -2);
}
if (_local2[n] == -1) {
write((n + 1) + ". <b>Slight left?</b>");
add_to_key(n + 1, "takepassage", -1);
}
if (_local2[n] == 0) {
write((n + 1) + ". <b>Continue straight?</b>");
add_to_key(n + 1, "takepassage", 0);
}
if (_local2[n] == 1) {
write((n + 1) + ". <b>Slight right?</b>");
add_to_key(n + 1, "takepassage", 1);
}
if (_local2[n] == 2) {
write((n + 1) + ". <b>Right?</b>");
add_to_key(n + 1, "takepassage", 2);
}
if (_local2[n] == 3) {
write((n + 1) + ". <b>Back and to the right?</b>");
add_to_key(n + 1, "takepassage", 3);
}
n++;
}
}
function arrow_cave(dieroll) {
_root.cavedestination = "";
if (dieroll <= 2) {
var _local3 = Math.ceil(Math.random() * 6);
var _local4 = Math.ceil(Math.random() * 6);
_local3 = _local3 * 10;
_local4 = _local4 * 10;
_local3 = _local3 + 140;
_local4 = _local4 + 340;
write(((("Mammoth cave, " + _local3) + "x") + _local4) + ".");
_root.sqft = _local3 * _local4;
} else if (dieroll <= 7) {
write("40x60 cave.");
_root.sqft = 2400;
} else if (dieroll <= 9) {
write("50x75 cave.");
_root.sqft = 3750;
} else if (dieroll <= 11) {
write("Double cave, 20x30 and 60x60.");
_root.sqft = 4200;
} else if (dieroll <= 13) {
write("120x150 cavern.");
_root.sqft = 18000;
} else if (dieroll <= 15) {
write("Double cave, 35x50 and 80x90.");
_root.sqft = 8950;
} else if (dieroll <= 17) {
write("120x150 cavern.");
_root.sqft = 18000;
} else if (dieroll <= 20) {
write("95x125 cavern.");
_root.sqft = 11875;
}
if (dieroll <= 2) {
add_to_master("move_to", "mammothcavescreen");
add_to_master("roll", "mammothcave", 20);
} else if ((dieroll >= 14) && (dieroll <= 20)) {
add_to_master("move_to", "poolscreen");
add_to_master("roll", "pool", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
}
function arrow_mammothcave(dieroll) {
if (dieroll <= 10) {
} else {
if (dieroll <= 15) {
write("There's a lake in the center.");
dead_end(4);
return(undefined);
}
if (dieroll <= 18) {
_root.monstersource = "deadend5";
write("There's a lake in the center, guarded by a monster.");
setnumber("monsterhp", Math.ceil(Math.random() * 4));
addnumber("monsterhp", getnumber("dungeonlevel"));
setnumber("monstermaxhp", getnumber("monsterhp"));
setnumber("monsterac", 15);
_root.monstername = "Sea Monster";
_root.monsternumber = 5;
_root.monsterhd = 5;
var tags = new Object();
tags.unintelligent = 1;
tags.immobile = 1;
_root.monstertags = tags;
_root.monsterwhite.monster5_5white._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
attack(0, 1);
return(undefined);
}
if (dieroll <= 20) {
var randy = Math.ceil(Math.random() * 10);
var lakeclause = "";
write("There's an enchanted lake in the center of the cavern. Crossing it, you find yourself in a strange temple on an island.");
if (getnumber("hp") < getnumber("maxhp")) {
write(" The monks bind your wounds.");
setnumber("hp", getnumber("maxhp"));
}
if (!wisbonus()) {
write(" The monks teach you riddles that unlock hidden truths. Your Wisdom increases!");
_root.hiwis = "hi";
}
write(" They feed you a meal and give you food for your travels.");
add_equipment("food");
write("When you turn around, the island is gone.");
}
}
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
function arrow_pool(dieroll) {
if (dieroll <= 8) {
} else {
if (dieroll <= 10) {
write("There's a pool in the center.");
dead_end(5);
return(undefined);
}
if (dieroll <= 12) {
write("There's a pool in the center, guarded by a monster.");
_root.monstersource = "deadend5";
setnumber("monsterhp", Math.ceil(Math.random() * 4));
addnumber("monsterhp", getnumber("dungeonlevel"));
setnumber("monstermaxhp", getnumber("monsterhp"));
setnumber("monsterac", 15);
if (getnumber("dungeonlevel") > 5) {
addnumber("monsterac", 3);
}
_root.monstername = "Sea Monster";
_root.monsternumber = 5;
_root.monsterhd = 5;
var tags = new Object();
tags.unintelligent = 1;
tags.immobile = 1;
_root.monstertags = tags;
_root.monsterwhite.monster5_5white._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
choosefight();
return(undefined);
}
if (dieroll <= 18) {
write("There's a pool in the center. A monster is guarding treasure.");
_root.monstersource = "deadend6";
setnumber("monsterhp", Math.ceil(Math.random() * 4));
addnumber("monsterhp", getnumber("dungeonlevel"));
setnumber("monstermaxhp", getnumber("monsterhp"));
setnumber("monsterac", 15);
if (getnumber("dungeonlevel") > 5) {
addnumber("monsterac", 3);
}
_root.monstername = "Sea Monster";
_root.monsternumber = 5;
_root.monsterhd = 5;
var tags = new Object();
tags.unintelligent = 1;
tags.immobile = 1;
_root.monstertags = tags;
_root.monsterwhite.monster5_5white._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
choosefight();
return(undefined);
}
if (dieroll <= 20) {
write("There's a magic pool in the center.");
write("<b>(b)athe</b> in the magic pool? It could be dangerous, or it could give you fabulous rewards.");
write("<b>(i)gnore</b> the pool and explore the rest of the cavern?");
add_to_key("b", "magicpool");
add_to_key("i", "roomcontents");
return(undefined);
}
}
if (dieroll <= 18) {
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
}
}
function arrow_magicpool(dieroll) {
if (dieroll <= 8) {
var _local7 = Math.ceil(Math.random() * 20);
if (_local7 <= 11) {
var _local8 = "platinum";
} else {
var _local8 = "lead";
}
write(("The pool turns gold to " + _local8) + ".");
var _local4 = getnumber("gp");
if (_local4 < 1) {
write("But you don't have any gold!");
} else {
setnumber("gp", 0);
if (_local8 == "platinum") {
addnumber("pp", _local4);
write(("You now have " + _local4) + " new platinum pieces!");
} else {
write(("You throw away your " + _local4) + " useless lead discs.");
}
}
} else if (dieroll <= 15) {
var _local7 = Math.ceil(Math.random() * 6);
var _local11 = Math.ceil(Math.random() * 2);
var _local13 = Math.ceil(Math.random() * 3);
var _local2 = "STR";
if (_local7 == 2) {
_local2 = "INT";
} else if (_local7 == 3) {
_local2 == "WIS";
} else if (_local7 == 4) {
_local2 = "DEX";
} else if (_local7 == 5) {
_local2 == "CON";
} else if (_local7 == 6) {
_local2 = "CHA";
}
if (_local11 == 1) {
var _local3 = "raises";
} else {
var _local3 = "lowers";
}
write(((("Pool " + _local3) + " your ") + _local2) + ".");
if (_local2 == "STR") {
if (_local3 == "raises") {
if (strbonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.histr = "hi";
readyitem();
}
} else if (strbonus()) {
_root.histr = "";
readyitem();
} else {
write("Don't worry, yours is already plenty low!");
}
} else if (_local2 == "INT") {
if (_local3 == "raises") {
if (intbonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.hiint = "hi";
readyitem();
}
} else if (intbonus()) {
_root.hiint = "";
readyitem();
} else {
write("Don't worry, yours is already plenty low!");
}
} else if (_local2 == "WIS") {
if (_local3 == "raises") {
if (wisbonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.hiwis = "hi";
readyitem();
}
} else if (wisbonus()) {
_root.hiwis = "";
readyitem();
} else {
write("Don't worry, yours is already plenty low!");
}
} else if (_local2 == "DEX") {
if (_local3 == "raises") {
if (dexbonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.hidex = "hi";
readyitem();
}
} else if (dexbonus()) {
_root.hidex = "";
readyitem();
} else {
write("Don't worry, yours is already plenty low!");
}
} else if (_local2 == "CON") {
var _local6 = int((getnumber("characterlevel") + 1) / 2);
if (_local3 == "raises") {
if (conbonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.hicon = "hi";
addnumber("maxhp", _local6);
addnumber("hp", _local6);
write("Your Hit Points go up!");
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
readyitem();
}
} else if (conbonus()) {
_root.hicon = "";
readyitem();
addnumber("maxhp", _local6 * -1);
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
write("Your maximum HP goes down permanently!");
} else {
write("Don't worry, yours is already plenty low!");
}
} else if (_local2 == "CHA") {
if (_local3 == "raises") {
if (chabonus()) {
write("Never mind, yours is already plenty high!");
} else {
_root.hicha = "hi";
readyitem();
}
} else if (chabonus()) {
_root.hicha = "";
readyitem();
if (getnumber("henchman2hp") > 0) {
write("Your second henchman starts looking at want ads!");
}
} else {
write("Don't worry, yours is already plenty low!");
}
}
} else {
if (dieroll <= 17) {
write("As you enter the pool, a voice says, \"I will give thee one wish, IF thou hast the correct alignment! Otherwise I will smite thee!\"");
write("\"By the way, what is thy alignment?\"");
write("1. <b>Lawful Good!</b> Grant me the rewards of my virtue!");
write("2. <b>Chaotic Good!</b> Things are gonna be different around here!");
write("3. <b>True Neutral!</b> Now I can make my fortune!");
write("4. <b>Lawful Evil!</b> Grant me the power I deserve!");
write("5. <b>Chaotic Evil!</b> Give me my wish, fool!");
add_to_key("1", "alignment", "lg");
add_to_key("2", "alignment", "cg");
add_to_key("3", "alignment", "n");
add_to_key("4", "alignment", "le");
add_to_key("5", "alignment", "ce");
return(undefined);
}
if (dieroll <= 20) {
var _local7 = Math.ceil(Math.random() * 20);
var _local10 = "";
write("It's a transporter pool! The cavern fades away.", 3);
if (_local7 <= 7) {
write("You're teleported out of the dungeon!");
town();
} else if (_local7 <= 12) {
_local10 = "elsewhere on the level";
write("You appear in a random place in the dungeon level!");
var _local12 = Math.ceil(Math.random() * 6) + 1;
setnumber("roomnumber", _local12);
while (_root.masterlist.length > 0) {
remove_from_master();
}
lostme(1);
wander();
} else if (_local7 <= 16) {
write("In ghostly form, you sink through the floor!");
while (_root.masterlist.length > 0) {
remove_from_master();
}
lostme(1);
stairs(1);
wander();
} else {
write("You're teleported 100 miles away!");
write("You trudge back towards your town. It takes weeks.");
var _local5 = has_item("food", 1);
_local5 = _local5 * -1;
if (_local5 > 0) {
add_equipment("food", _local5);
write("You eat all your food along the way.");
write("Finally you reach your town.");
}
town();
}
}
}
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
}
function alignment(align) {
var _local3 = Math.ceil(Math.random() * 20);
var _local2 = "";
if (_local3 <= 6) {
_local2 = "lg";
} else if (_local3 <= 9) {
_local2 = "le";
} else if (_local3 <= 12) {
_local2 = "cg";
} else if (_local3 <= 17) {
_local2 = "ce";
} else if (_local3 <= 20) {
_local2 = "n";
}
var _local4 = 0;
if (((align == "") || (align == null)) || (align == undefined)) {
_local4 = 1;
align = "";
}
if ((_local4 == 0) && (_local2 != align)) {
write("\"Thou hast chosen POORLY!\"");
damage(1, 20, "smitten for being the wrong alignment by a judgmental wishing pool");
if (getnumber("hp") > 0) {
write("\"Now never darken my shores again!\"");
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
}
} else {
if (align != "") {
write("\"Thy heart matches mine own! I shall grant thee a wish!\"");
}
_local4 = 1;
}
if (_local4 == 1) {
write("I wish for five times my weight in <b>(g)old</b>, and a magic sack to carry it in!");
add_to_key("g", "wish", "g");
write("I just wish I was <b>(h)ome</b> safe!");
add_to_key("h", "wish", "h");
write("I wish for <b>(m)agical</b> treasure!");
add_to_key("m", "wish", "m");
if (!strbonus()) {
write("I wish I was <b>(s)tronger</b>!");
add_to_key("s", "wish", "s");
}
write("I wish my best friend was a <b>(d)ragon!</b>");
add_to_key("d", "wish", "d");
if (!chabonus()) {
write("I wish I was <b>(b)etter looking</b>!");
add_to_key("b", "wish", "b");
}
write("I wish for more <b>(w)ishes</b>!");
add_to_key("w", "wish", "w");
}
}
function wish(wishletter) {
if (wishletter == "g") {
write("The voice considers. \"At 10 GP per pound, that's about 7500 GP.\" A bulging sack of treasure appears. Somehow you can easily lift it.");
addnumber("gp", 7500);
_root.holder = "sack";
_root.charsheet.holder.text = _root.holder;
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
} else if (wishletter == "h") {
write("\"A wise and humble wish. I will reward you with a special gift.\" You appear safe and sound back in town! Around your neck is a magical amulet shaped like a little house.");
add_equipment("amulet_of_recall");
town();
} else if (wishletter == "m") {
var myequip = magic_items();
write(("A shapely arm reaches up from the lake. It's holding " + print_pretty(myequip, 1, "a")) + "!");
add_equipment(myequip);
write("\"Now go!\"");
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
} else if (wishletter == "s") {
write("\"You are now strong as a lion!\" You have high Strength!");
_root.histr = "hi";
readyitem();
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
} else if (wishletter == "d") {
write("\"As you wish! A dragon is at your command!\" Until you return to town, a dragon will serve as your henchman.");
if (getnumber("henchmanhp") > 0) {
write(_root.henchmanname + " disappears!");
}
setnumber("henchmanhp", Math.ceil(Math.random() * 2) + 4);
setnumber("henchmanmaxhp", getnumber("henchmanhp"));
_root.henchmanhp.hpblood._alpha = 0;
setnumber("henchmanac", 20);
namepet("Dragon", 1);
_root.henchmannumber = 4;
_root.henchmanhd = 10;
var tags = new Object();
tags.intelligent = 1;
tags["area attack"] = 1;
tags.fiery = 1;
tags.powerful = 1;
_root.henchmantags = tags;
_root.henchmanwhite.monster10_4white._alpha = 100;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
} else if (wishletter == "b") {
write("\"You are now irresistable!\" You have high Charisma and can maintain two henchmen!");
_root.hicha = "hi";
if (_root.cavedestination == "unusualsize") {
add_to_master("move_to", "unusualsize");
add_to_master("roll", "unusualsize", 20);
} else {
add_to_master("move_to", "roomcontents");
add_to_master("roll", "roomcontents", 20);
}
run_master();
} else if (wishletter == "w") {
write("\"I grant you one more wish!\"");
alignment();
}
}
function opencharsheet(mymode, deadendmode) {
if ((mymode == null) || (mymode == undefined)) {
mymode = "";
}
if ((deadendmode == null) || (deadendmode == undefined)) {
deadendmode = "";
}
if (deadendmode == "") {
if ((_root.deadendmode > 0) || (_root.deadendmode == "0")) {
deadendmode = _root.deadendmode;
}
} else {
_root.deadendmode = deadendmode;
}
Selection.setFocus("faker");
if (charsheet._x == -500) {
if (mymode != "close") {
charsheet._x = 100;
charsheet._y = 100;
showmonsters(1);
}
} else {
if (mymode != "open") {
charsheet._x = -500;
charsheet._y = -500;
showmonsters(100);
}
if (((_root.instore == 1) && (_root.intown == 1)) && (mymode != "open")) {
town();
} else if (((_root.instore == 1) && (getnumber("dungeonlevel") > 0)) && (mymode != "open")) {
dead_end(deadendmode);
}
}
if (_root.instore == 1) {
write("Click \"sell\" next to an item. Close the character sheet when you are done selling.");
n = 1;
while (n < 14) {
eval ("charsheet.drop" + n).droporsell.text = "Sell";
n++;
}
} else {
n = 1;
while (n < 14) {
eval ("charsheet.drop" + n).droporsell.text = "Drop";
n++;
}
}
}
function add_to_key(letter, arg1, arg2, arg3, arg4) {
_root.loadings._alpha = 0;
var _local2 = new Array();
_local2.push(letter);
_local2.push(arg1);
_local2.push(arg2);
_local2.push(arg3);
_local2.push(arg4);
_root.keymenu.push(_local2);
_root.stoprolling = 1;
}
function reset_key() {
_root.keymenu = Array();
}
function keyup(keycode) {
_root.stoprolling = 0;
var _local3 = keycode.getCode();
var _local2 = String.fromCharCode(keycode.getAscii());
if (!_local2) {
return(undefined);
}
n = 0;
while (n < _root.keymenu.length) {
k = _root.keymenu[n];
if (k[0] == _local2) {
_root.mytext.setTextFormat(_root.normtxt);
_root.mytext.setTextFormat(_root.greytxt);
reset_key();
add_to_master(k[1], k[2], k[3], k[4]);
run_master();
break;
}
n++;
}
}
function switch_area_off() {
oldarea = _root.area;
if (oldarea) {
areabuttons(oldarea, "off");
}
run_master();
}
function switch_area_on(myarea) {
_root.area = myarea;
areabuttons(myarea, "on");
run_master();
}
function areabuttons(myarea, mydir) {
if (mydir == "on") {
myalpha = 100;
}
if (mydir == "off") {
myalpha = 0;
}
if (myarea == "start") {
dungeonmap.startleft._alpha = myalpha;
dungeonmap.startright._alpha = myalpha;
} else if (myarea == "premadestartingarea") {
dungeonmap.startdoor._alpha = myalpha;
dungeonmap.startcorridor._alpha = myalpha;
} else if (myarea == "doorright") {
dungeonmap.doorrightback._alpha = myalpha;
dungeonmap.doorrighton._alpha = myalpha;
} else if (myarea == "doorleft") {
dungeonmap.doorleftback._alpha = myalpha;
dungeonmap.doorlefton._alpha = myalpha;
}
}
function write(stuff, ellipses) {
showmonsters(100);
if (_root.linenumbers == undefined) {
_root.linenumbers = 0;
}
_root.linenumbers++;
if (_root.linenumbers > 250) {
_root.linenumbers = 250;
}
var _local3 = _root.mytext.htmlText;
_local3 = _local3.split("</P>").join("");
var _local2 = _local3.split("<P ALIGN=\"LEFT\">");
while (_local2.length > _root.linenumbers) {
_local2.shift();
}
_local3 = _local2.join(newline);
_root.mytext.htmlText = _local3;
_root.mytext.htmlText = _root.mytext.htmlText + (("" + stuff) + newline);
_root.mytext.scroll = _root.mytext.maxscroll;
}
function sleep() {
}
function jump_to(myname) {
var testx = (("_root.dungeonmap." + myname) + "._x");
var testy = (("_root.dungeonmap." + myname) + "._y");
var testxx = eval (testx);
var testyy = eval (testy);
var mapx = _root.dungeonmap._x;
var mapy = _root.dungeonmap._y;
var onscreenx = _root.onscreen._x;
var onscreeny = _root.onscreen._y;
_root.dungeonmap._x = (0 + onscreenx) - testxx;
_root.dungeonmap._y = (0 + onscreeny) - testyy;
}
function move_to(myname, myscale) {
showmonsters(50);
if (_root.gameover == 1) {
return(undefined);
}
_root.ready = 0;
if (((getnumber("dungeonlevel") == 0) || (getnumber("dungeonlevel") == null)) || (getnumber("dungeonlevel") == undefined)) {
setnumber("dungeonlevel", 1);
setnumber("roomnumber", 0);
}
if (!myscale) {
myscale = 1;
}
_root.targetscale = myscale;
_root.mytargetarea = myname;
var testx = (("_root.dungeonmap." + myname) + "._x");
var testy = (("_root.dungeonmap." + myname) + "._y");
var testxx = (eval (testx) * _root.currentscale);
var testyy = (eval (testy) * _root.currentscale);
var mapx = _root.dungeonmap._x;
var mapy = _root.dungeonmap._y;
var onscreenx = _root.onscreen._x;
var onscreeny = _root.onscreen._y;
_root.xchange = ((0 + onscreenx) - testxx) - _root.dungeonmap._x;
_root.ychange = ((0 + onscreeny) - testyy) - _root.dungeonmap._y;
if (_root.myinterval) {
clearInterval(_root.myinterval);
}
_root.myinterval = setInterval(move_me_to, 40);
}
function add_to_master(arg1, arg2, arg3, arg4) {
var _local2 = new Array();
_local2.push(arg1);
_local2.push(arg2);
_local2.push(arg3);
_local2.push(arg4);
_root.masterlist.push(_local2);
}
function prepend_to_master(arg1, arg2, arg3, arg4) {
var _local2 = new Array();
_local2.push(arg1);
_local2.push(arg2);
_local2.push(arg3);
_local2.push(arg4);
_root.masterlist.unshift(_local2);
}
function remove_from_master() {
_root.masterlist.pop();
}
function pause_me(mytimeout) {
var _local1 = setTimeout(run_master, mytimeout);
}
function run_master() {
if (_root.masterlist.length == 0) {
return(undefined);
}
var _local2 = _root.masterlist.shift();
if ((_root.intown == 0) && (_local2[0] != "opencharsheet")) {
_root.instore = 0;
_root.deadendmode = "";
}
if (_local2[0] == "roll") {
_root.lastroll = _local2;
roll(_local2[1], _local2[2], _local2[3]);
} else if (_local2[0] == "move_to") {
_root.lastmove = _local2;
move_to(_local2[1], _local2[2]);
} else if (_local2[0] == "move_to_and_roll") {
_root.lastroll = _local2;
_root.lastmove = _local2;
if (getnumber("roomnumber") == 0) {
setnumber("roomnumber", 1);
}
move_to(_local2[1], _local2[2]);
roll(_local2[1], _local2[3]);
} else if (_local2[0] == "cheat") {
roll("mammothcave", 20);
} else if (_local2[0] == "restart") {
restart();
} else if (_local2[0] == "switch_area_on") {
switch_area_on(_local2[1]);
} else if (_local2[0] == "switch_area_off") {
switch_area_off();
} else if (_local2[0] == "pause") {
pause_me(_local2[1]);
} else if (_local2[0] == "run") {
run(_local2[1], _local2[2]);
} else if (_local2[0] == "town") {
town();
} else if (_local2[0] == "fight") {
if (_local2[2]) {
fight(_local2[2], 1);
}
fight(_local2[1]);
} else if (_local2[0] == "stairs") {
stairs(_local2[1]);
} else if (_local2[0] == "save") {
save(_local2[1]);
} else if (_local2[0] == "movementphase") {
movementphase();
} else if (_local2[0] == "explore") {
explore();
} else if (_local2[0] == "wander") {
wander();
} else if (_local2[0] == "backtrack") {
backtrack();
} else if (_local2[0] == "roomcontents") {
move_to("roomcontents");
roll("roomcontents", 20);
} else if (_local2[0] == "magicpool") {
roll("magicpool", 20);
} else if (_local2[0] == "alignment") {
alignment(_local2[1]);
} else if (_local2[0] == "wish") {
wish(_local2[1]);
} else if (_local2[0] == "attack") {
attack(0, 0, _local2[1]);
} else if (_local2[0] == "use_an_item") {
use_an_item(_local2[1]);
} else if (_local2[0] == "use_a_noncombat_item") {
use_a_noncombat_item(_local2[1]);
} else if (_local2[0] == "cast_a_spell") {
cast_a_spell();
} else if (_local2[0] == "cast_clw") {
cast_clw(_local2[1]);
} else if (_local2[0] == "cast_this_spell") {
cast_this_spell(_local2[1], _local2[2]);
} else if (_local2[0] == "use_this_item") {
use_this_item(_local2[1], _local2[2], _local2[3]);
} else if (_local2[0] == "attacktwo") {
attack(2);
} else if (_local2[0] == "sneak") {
sneak();
} else if (_local2[0] == "parley") {
parley();
} else if (_local2[0] == "blind") {
blind(_local2[1]);
} else if (_local2[0] == "bribe") {
parley(1);
} else if (_local2[0] == "retreat") {
retreat();
} else if (_local2[0] == "choosefight") {
choosefight();
} else if (_local2[0] == "drop") {
drop(_local2[1]);
} else if (_local2[0] == "upstairs") {
upstairs();
} else if (_local2[0] == "rest") {
rest(_local2[1]);
} else if (_local2[0] == "restorelevel") {
restorelevel();
} else if (_local2[0] == "healup") {
healup();
} else if (_local2[0] == "secretdoor") {
mysecretdoor(_local2[1]);
} else if (_local2[0] == "downstairs") {
downstairs();
} else if (_local2[0] == "dead_end") {
dead_end(_local2[1]);
} else if (_local2[0] == "fish") {
fish();
} else if (_local2[0] == "stairsanswer") {
stairsanswer(_local2[1], _local2[2]);
} else if (_local2[0] == "enterdungeon") {
if (_root.gamemode == "game1") {
savegame(1, "movementphase");
write("Saved game!");
}
_root.dungeonmap.village._alpha = 0;
_root.compassrose._alpha = 100;
_root.dungeonlevel._alpha = 100;
_root.roomnumber._alpha = 100;
_root.mapexplanation._x = 181;
setnumber("roomnumber", 0);
setnumber("dungeonlevel", 1);
_root.accomplishments_deepestlevel = 1;
movementphase();
} else if (_local2[0] == "teleporttodungeon") {
teleporttodungeon();
} else if (_local2[0] == "set_dungeon_destination") {
set_dungeon_destination(_local2[1]);
} else if (_local2[0] == "reallyteleporttodungeon") {
reallyteleporttodungeon();
} else if (_local2[0] == "clhench") {
clhench();
} else if (_local2[0] == "quitgame") {
savegame(1, "town");
getURL (_root.thisurl);
} else if (_local2[0] == "bank") {
bank();
} else if (_local2[0] == "choosegender") {
choosegender(_local2[1]);
} else if (_local2[0] == "temple") {
store("temple");
} else if (_local2[0] == "graveyard") {
graveyard();
} else if (_local2[0] == "animatedead") {
animatedead(_local2[1]);
} else if (_local2[0] == "monument") {
monument();
} else if (_local2[0] == "inn") {
inn();
} else if (_local2[0] == "coliseum") {
coliseum();
} else if (_local2[0] == "roundofdrinks") {
roundofdrinks();
} else if (_local2[0] == "placards") {
placards();
} else if (_local2[0] == "towncrier") {
towncrier();
} else if (_local2[0] == "hire") {
hire(_local2[1], _local2[2]);
} else if (_local2[0] == "market") {
store("market");
} else if (_local2[0] == "smith") {
store("smith");
} else if (_local2[0] == "wizard_college") {
store("wizard_college");
} else if (_local2[0] == "royal_treasury") {
store("royal_treasury");
} else if (_local2[0] == "buy") {
buy(_local2[1], _local2[2]);
} else if (_local2[0] == "opencharsheet") {
opencharsheet(_local2[1], _local2[2]);
} else if (_local2[0] == "home") {
home();
} else if (_local2[0] == "retire") {
retire();
} else if (_local2[0] == "reallyretire") {
reallyretire();
} else if (_local2[0] == "deposit") {
deposit(_local2[1]);
} else if (_local2[0] == "loan") {
myloan(_local2[1]);
} else if (_local2[0] == "reallyloan") {
reallyloan(_local2[1]);
} else if (_local2[0] == "payloan") {
payloan(_local2[1]);
} else if (_local2[0] == "forcedoor") {
forcedoor(_local2[1], _local2[2]);
} else if (_local2[0] == "takepassage") {
takepassage(_local2[1]);
} else if (_local2[0] == "decide_to_turn") {
decide_to_turn();
} else if (_local2[0] == "food") {
food(_local2[1], _local2[2]);
} else if (_local2[0] == "preparespells") {
preparespells(_local2[1], _local2[2]);
} else if (_local2[0] == "deletecharacter") {
deletecharacter();
} else if (_local2[0] == "bury") {
bury();
} else if (_local2[0] == "forceelevator") {
forcetheelevator();
}
}
function roll(arrowname, dietype, mymode) {
if (_root.gameover == 1) {
return(undefined);
}
if (_root.stoprolling == 1) {
return(undefined);
}
if ((mymode == null) || (mymode == undefined)) {
mymode = 0;
}
eval (_root.mylastlight)._alpha = 0;
showmonsters(50);
if ((arrowname == "mainloop") && (_root.gamemode != "build")) {
if (_root.oktodomainloop != 1) {
movementphase();
return(undefined);
}
_root.oktodomainloop = 0;
}
_root.ready = 0;
_root.mapmult = 1;
var rollarray = new Array();
n = 1;
while (n < 101) {
if (eval (("dungeonmap." + arrowname) + n)) {
rollarray.push(("dungeonmap." + arrowname) + n);
}
n++;
}
var randNum = Math.ceil(Math.random() * dietype);
if (_root.fudgeroll) {
randNum = _root.fudgeroll;
_root.fudgeroll = 0;
rerollorkeep.choosearoll.text = 0;
}
n = 1;
while (n < 101) {
if (eval (("dungeonmap." + arrowname) + n)) {
if (n <= randNum) {
rollarray.push(("dungeonmap." + arrowname) + n);
}
}
n++;
}
_root.rollarray = rollarray;
add_to_master("run", arrowname, randNum, mymode);
if (_root.myinterval) {
clearInterval(_root.myinterval);
}
_root.myinterval = setInterval(rollthru, 75);
}
function rollthru() {
var lastcur = _root.mycur;
_root.mycur = _root.rollarray.shift();
if (!_root.mycur) {
_root.mycur = lastcur;
clearInterval(_root.myinterval);
showmonsters(100);
if ((_root.gamemode != "build") && (_root.testmode == 0)) {
_root.mylastlight = _root.mycur;
run_master();
} else {
_root.rerollorkeep._x = 110;
_root.rerollorkeep._y = 569;
if (_root.currentscale != 1) {
_root.nomaster = 1;
move_to(eval ("_root." + mycur));
}
}
} else {
eval (lastcur)._alpha = 0;
eval (mycur)._alpha = 100;
}
}
function move_me_to() {
var speed = 75;
var scalespeed = 0.05;
var testx = (("_root.dungeonmap." + mytargetarea) + "._x");
var testy = (("_root.dungeonmap." + mytargetarea) + "._y");
var testxx = (eval (testx) * _root.currentscale);
var testyy = (eval (testy) * _root.currentscale);
if (_root.nomaster == 1) {
testxx = testxx - 200;
testyy = testyy - 100;
}
var mapx = _root.dungeonmap._x;
var mapy = _root.dungeonmap._y;
var onscreenx = _root.onscreen._x;
var onscreeny = _root.onscreen._y;
_root.xchange = ((0 + onscreenx) - testxx) - _root.dungeonmap._x;
_root.ychange = ((0 + onscreeny) - testyy) - _root.dungeonmap._y;
var scalemult = _root.currentscale;
if (_root.targetscale > scalemult) {
scalemult = scalemult + scalespeed;
if (scalemult > _root.targetscale) {
scalemult = _root.targetscale;
}
}
if (_root.targetscale < scalemult) {
scalemult = scalemult - scalespeed;
if (scalemult < _root.targetscale) {
scalemult = _root.targetscale;
}
}
var schange = (1 + (_root.targetscale - _root.currentscale));
if (schange > 1.05) {
schange = 1.05;
}
if (schange < 0.95) {
schange = 0.95;
}
_root.currentscale = scalemult;
schange = (schange - 1) * (1 / _root.currentscale);
schange = schange + 1;
_root.dungeonmap._width = _root.originalwidth * _root.currentscale;
_root.dungeonmap._height = _root.originalheight * _root.currentscale;
if ((_root.xchange > speed) || (_root.xchange < (speed * -1))) {
if (_root.xchange > 0) {
_root.xchange = _root.xchange - speed;
_root.dungeonmap._x = (_root.dungeonmap._x * schange) + speed;
} else if (_root.xchange < 0) {
_root.xchange = _root.xchange + speed;
_root.dungeonmap._x = (_root.dungeonmap._x * schange) - speed;
}
} else {
_root.dungeonmap._x = (_root.dungeonmap._x * schange) + _root.xchange;
_root.xchange = 0;
}
if ((_root.ychange > speed) || (_root.ychange < (speed * -1))) {
if (_root.ychange > 0) {
_root.ychange = _root.ychange - speed;
_root.dungeonmap._y = (_root.dungeonmap._y * schange) + speed;
} else if (_root.ychange < 0) {
_root.ychange = _root.ychange + speed;
_root.dungeonmap._y = (_root.dungeonmap._y * schange) - speed;
}
} else {
_root.dungeonmap._y = (_root.dungeonmap._y * schange) + _root.ychange;
_root.ychange = 0;
}
if (((_root.xchange == 0) && (_root.ychange == 0)) && (scalemult == _root.targetscale)) {
clearInterval(_root.myinterval);
showmonsters(100);
if (_root.nomaster != 1) {
run_master();
}
_root.nomaster = 0;
}
}
function restart() {
write("Loading...");
getURL (_root.thisurl);
}
function takepassage(amount) {
if (amount != 0) {
try_to_lose();
}
if (_root.glint) {
if (_root.glint == 10) {
_root.glint = 0;
}
if (_root.glint == amount) {
_root.glint = 0;
var _local2 = Math.ceil(Math.random() * 10);
if (_local2 <= 2) {
_root.monstersource = "takepassage";
_root.upcomingturn = amount;
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local4 = getnumber("dungeonlevel");
if (_local4 > 10) {
_local4 = 10;
}
add_to_master("roll", ("monster" + _local4) + "_", 4);
run_master();
return(undefined);
}
if (_local2 <= 4) {
add_to_master("move_to", "tricktrapb", 0.5);
add_to_master("roll", "tricktrapb", 20);
run_master();
return(undefined);
}
if (_local2 <= 6) {
write("There's something on the ground.");
var _local3 = valuable_items();
if (_local3 != "") {
write(("<font color=\"#009900\">You find " + print_pretty(_local3, 1, "a")) + "!</font>");
add_equipment(_local3);
}
} else {
_local2 = Math.ceil(Math.random() * 25);
if (_local2 == 1) {
write("Just a reflection from a puddle of water.");
}
if (_local2 == 2) {
write("Just a drop of water dripping from the ceiling.");
}
if (_local2 == 3) {
write("Just reflected torchlight from a moist wall.");
}
if (_local2 == 4) {
write("Just a shard of glass on the ground.");
}
if (_local2 == 5) {
write("Just the gleaming eyes of some harmless rats.");
}
if (_local2 == 6) {
write("Just the shiny carapace of a dead beetle.");
}
if (_local2 == 7) {
write("Just an abandoned copper piece. You pick it up.");
addmoney("cp", 1);
}
if (_local2 == 8) {
write("Just an arrowhead buried in a wall.");
}
if (_local2 == 9) {
write("Whatever was gleaming a minute ago, it's gone now.");
}
if (_local2 == 10) {
write("You hear a quiet shuffle of feet. The gleam of light is gone.");
}
if (_local2 == 11) {
write("Just a rusted contraption of uncertain purpose and no use.");
}
if (_local2 == 12) {
write("Just a half-buried silver piece. You pick it up.");
addmoney("sp", 1);
}
if (_local2 == 13) {
write("Just some phosphorescent moss.");
}
if (_local2 == 14) {
write("Just a broken dagger.");
}
if (_local2 == 15) {
write("Just the belt buckle on a pile of bones and rags - maybe another dungeon robber like yourself.");
}
if (_local2 == 16) {
write("Just a trick of the light.");
}
if (_local2 == 17) {
write("Just a spark from your torch.");
}
if (_local2 == 18) {
write("Just a trick of your over-wrought imagination.");
}
if (_local2 == 19) {
write("Just a shiny stone in the wall. Worthless.");
}
if (_local2 == 20) {
write("Just a cave firefly.");
}
if (_local2 == 21) {
write("Just a nail driven into the floor for some unknown purpose.");
}
if (_local2 == 22) {
write("Just a faded chalk mark pointing forward.");
}
if (_local2 == 23) {
write("You blink. It's gone.");
}
if (_local2 == 24) {
write("A little pool of water. You go around it.");
}
if (_local2 == 25) {
write("There's oil on the ground here. You fill a vial of oil.");
add_equipment("oil_flask", 1);
}
}
}
_root.glint = 0;
}
while (_root.turndir.length > 0) {
_root.turndir.pop();
}
turn(amount);
if (_root.exittype == "door") {
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
} else if (_root.exittype == "passage") {
add_to_master("move_to", "exitpassagedirection", 0.8);
add_to_master("roll", "exitpassagedirection", 20);
} else {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
}
run_master();
_root.exittype = "";
}
function preparespells(eatinglocation, dead_end_mode) {
if ((dead_end_mode == undefined) || (dead_end_mode == null)) {
dead_end_mode = 0;
}
if ((eatinglocation == "back") && (dead_end_mode == 0)) {
var _local8 = Math.ceil(Math.random() * 6);
var _local7 = Math.ceil(Math.random() * 6);
var _local6 = Math.ceil(Math.random() * 6);
var _local2 = "";
if ((_root.deadend[0] > 0) && (_local8 == 1)) {
_local2 = "on the left of you";
}
if ((_root.deadend[1] > 0) && (_local7 == 1)) {
_local2 = "on the right of you";
}
if ((_root.deadend[2] > 0) && (_local6 == 1)) {
_local2 = "behind you";
}
if (_local2 != "") {
_root.monstersource = "wandering";
_root.ambush = 1;
write(("A secret door opens " + _local2) + ", surprising you as you rest!");
_root.monsteraware = 1;
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local5 = getnumber("dungeonlevel");
if (_local5 > 10) {
_local5 = 10;
}
add_to_master("roll", ("monster" + _local5) + "_", 4);
run_master();
} else {
_root.recoveredspellshere = 1;
write("You recover one spell!");
_root.spells++;
if (_root.spells > (getnumber("characterlevel") + 1)) {
_root.spells = getnumber("characterlevel") + 1;
}
dead_end(dead_end_mode);
}
} else if (eatinglocation == "back") {
_root.recoveredspellshere = 1;
write("You recover one spell!");
_root.spells++;
if (_root.spells > (getnumber("characterlevel") + 1)) {
_root.spells = getnumber("characterlevel") + 1;
}
dead_end(dead_end_mode);
} else {
_root.recoveredspellshere = 1;
write("You recover one spell!");
_root.spells++;
if (_root.spells > (getnumber("characterlevel") + 1)) {
_root.spells = getnumber("characterlevel") + 1;
}
if ((getnumber("hp") < getnumber("maxhp")) && (_root.possessions.food > 0)) {
add_to_key("f", "food", eatinglocation, dead_end_mode);
write("eat <b>(f)ood?</b>");
}
if (_root.lost >= 1) {
add_to_key("w", "wander");
write("<b>(w)ander on?</b>");
} else if (eatinglocation == "back") {
add_to_key("b", "backtrack");
write("<b>(b)acktrack?</b>");
} else if (eatinglocation == "forward") {
add_to_key("e", "explore");
write("<b>(e)xplore?</b>");
} else if (eatinglocation == "town") {
add_to_key("t", "town");
write("<b>return to (t)own?</b>");
}
}
}
function food(eatinglocation, dead_end_mode) {
if ((dead_end_mode == undefined) || (dead_end_mode == null)) {
dead_end_mode = 0;
}
var _local2 = 0;
n = 0;
while (n < 15) {
if ((_root.possessions[n][0] == "food") && (_root.possessions[n][1] > 0)) {
_local2 = 1;
}
n++;
}
if (_local2 == 1) {
add_equipment("food", -1);
var _local7 = 0;
if (_root.cursed.food > 0) {
var _local11 = Math.ceil(Math.random() * howmany);
if (_local11 <= _root.cursed[itemname]) {
write("The food is rotten! You lose HP.");
_root.cursed.food--;
_local7 = 1;
}
}
if (_local7 == 1) {
if (getnumber("hp") > 1) {
addnumber("hp", -1);
}
} else {
if (getnumber("hp") < getnumber("maxhp")) {
addnumber("hp", 1);
}
if ((!henchman_has_tag("undead")) && (getnumber("henchmanhp") < getnumber("henchmanmaxhp"))) {
write(_root.henchmanname + " shares!");
addnumber("henchmanhp", 1);
}
if ((!henchman_has_tag("undead", 2)) && (getnumber("henchman2hp") < getnumber("henchman2maxhp"))) {
write(_root.henchman2name + " shares!");
addnumber("henchman2hp", 1);
}
}
}
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
if (getnumber("henchmanhp") > 0) {
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
}
if (getnumber("henchman2hp") > 0) {
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
}
if ((eatinglocation == "back") && (dead_end_mode == 0)) {
var _local10 = Math.ceil(Math.random() * 6);
var _local9 = Math.ceil(Math.random() * 6);
var _local8 = Math.ceil(Math.random() * 6);
var _local3 = "";
if ((_root.deadend[0] > 0) && (_local10 == 1)) {
_local3 = "on the left of you";
}
if ((_root.deadend[1] > 0) && (_local9 == 1)) {
_local3 = "on the right of you";
}
if ((_root.deadend[2] > 0) && (_local8 == 1)) {
_local3 = "behind you";
}
if (_local3 != "") {
_root.monstersource = "wandering";
_root.ambush = 1;
write(("A secret door opens " + _local3) + "!");
_root.monsteraware = 1;
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local6 = getnumber("dungeonlevel");
if (_local6 > 10) {
_local6 = 10;
}
add_to_master("roll", ("monster" + _local6) + "_", 4);
run_master();
} else {
dead_end(dead_end_mode);
}
} else if (eatinglocation == "back") {
dead_end(dead_end_mode);
} else {
if ((getnumber("hp") < getnumber("maxhp")) && (_root.possessions.food > 0)) {
add_to_key("f", "food", eatinglocation, dead_end_mode);
write("eat more <b>(f)ood?</b>");
}
if (_root.lost >= 1) {
add_to_key("w", "wander");
write("<b>(w)ander on?</b>");
} else if (eatinglocation == "back") {
add_to_key("b", "backtrack");
write("<b>(b)acktrack?</b>");
} else if (eatinglocation == "forward") {
add_to_key("e", "explore");
write("<b>(e)xplore?</b>");
} else if (eatinglocation == "town") {
add_to_key("t", "town");
write("<b>return to (t)own?</b>");
}
}
}
function mysecretdoor(searchdirection) {
var _local4 = 0;
write("Searching", 3);
if (_root.deadend[searchdirection] == 1) {
var _local8 = Math.ceil(Math.random() * 2);
if (_local8 == 1) {
_local4 = 1;
}
}
if (_local4) {
write("You found a secret door!");
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
run_master();
} else {
write("You spend several minutes searching and find nothing.");
_root.deadend[searchdirection] = 2;
var _local7 = Math.ceil(Math.random() * 6);
var _local6 = Math.ceil(Math.random() * 6);
var _local5 = Math.ceil(Math.random() * 6);
var _local2 = "";
if ((_root.deadend[0] == 1) && (_local7 == 1)) {
_local2 = "on the left of you";
}
if ((_root.deadend[1] == 1) && (_local6 == 1)) {
_local2 = "on the right of you";
}
if ((_root.deadend[2] == 1) && (_local5 == 1)) {
_local2 = "in front of you";
}
if (_local2 != "") {
_root.monstersource = "wandering";
write(("But something finds you! A secret door opens " + _local2) + "!");
_root.monsteraware = 1;
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local3 = getnumber("dungeonlevel");
if (_local3 > 10) {
_local3 = 10;
}
add_to_master("roll", ("monster" + _local3) + "_", 4);
run_master();
} else {
dead_end();
}
}
}
function decide_to_turn() {
var _local2 = Math.ceil(Math.random() * 2);
if (_local2 <= 1) {
_root.glint = _root.upcomingturn;
write("<font color=\"#cc9900\">You see a glint of light around the corner. It might be nothing, but it might be treasure, a trap, or the shining eyes of a monster.</font>");
}
if (_root.lost == 0) {
write("You can <b>(t)ake the turn</b> or <b>(b)acktrack.</b>");
add_to_key("b", "backtrack");
} else if (_root.lost == 1) {
write("You can <b>(t)ake the turn</b> or <b>(w)ander back.</b>");
add_to_key("w", "wander");
} else {
write("<b>(t)ake the turn</b> and hope to shake off pursuit?");
}
add_to_key("t", "takepassage", _root.upcomingturn);
_root.upcomingturn = "";
}
function turn(amount) {
_root.direction = _root.direction + amount;
if (_root.direction < 0) {
_root.direction = _root.direction + 8;
}
if (_root.direction > 7) {
_root.direction = _root.direction - 8;
}
var _local2 = new Array("N", "NE", "E", "SE", "S", "SW", "W", "NW");
_root.compassrose.letter.text = _local2[_root.direction];
}
function stairs(stairs) {
if (stairs != 0) {
if (getnumber("monsterhp") > 0) {
clear_monster();
write("You escaped your pursuer!");
}
}
if (stairs > 0) {
_root.innrecruitlevel = 0;
if ((_root.lost == 0) || (getnumber("roomnumber") >= 10)) {
setnumber("roomnumber", 0);
} else {
setnumber("roomnumber", 6);
}
} else if (stairs < 0) {
setnumber("roomnumber", 10);
}
addnumber("dungeonlevel", stairs);
if (getnumber("dungeonlevel") <= 0) {
setnumber("dungeonlevel", 0);
while (_root.masterlist.length > 0) {
remove_from_master();
}
if (getnumber("henchmanhp") > 0) {
clear_henchman();
write("Your henchman departs!");
}
if (_root.gamemode == "game1") {
savegame(1, "town");
write("Saved game!");
}
jump_to("start");
town();
} else {
write(("To level " + getnumber("dungeonlevel")) + " of the dungeon!");
if (getnumber("dungeonlevel") > _root.accomplishments_deepestlevel) {
_root.accomplishments_deepestlevel = getnumber("dungeonlevel");
}
}
}
function upstairs() {
stairs(-1);
setnumber("roomnumber", 10);
lostme(0);
turn(0);
add_to_master("roll", "mainloop", 20);
run_master();
}
function downstairs() {
stairs(1);
setnumber("roomnumber", 0);
add_to_master("roll", "mainloop", 20);
run_master();
}
function addmoney(moneyname, moneyvalue) {
addnumber(moneyname, moneyvalue);
if (_root.holder == "") {
keep_best(100);
}
}
function yourwealth() {
var _local1 = ((((((int(getnumber("cp")) * 0.01) + (int(getnumber("sp")) * 0.1)) + (int(getnumber("ep")) * 0.5)) + (int(getnumber("gp")) * 1)) + (int(getnumber("pp")) * 5)) + (int(getnumber("gems")) * 250)) + (int(getnumber("jewelry")) * 1000);
return(_local1);
}
function pay(amount, youpay, youpayafter) {
if (youpay == null) {
youpay = "You pay";
}
if (youpayafter == null) {
youpayafter = "";
}
var _local4 = 0;
var _local6 = 0;
var _local3 = 0;
var _local5 = 0;
var _local7 = 0;
var _local8 = 0;
var _local2 = 0;
while ((amount >= 1000) && (getnumber("jewelry") > 0)) {
amount = amount - 1000;
addnumber("jewelry", -1);
_local4++;
}
while ((amount >= 250) && (getnumber("gems") > 0)) {
amount = amount - 250;
addnumber("gems", -1);
_local6++;
}
while ((amount >= 5) && (getnumber("pp") > 0)) {
amount = amount - 5;
addnumber("pp", -1);
_local3++;
}
while ((amount >= 1) && (getnumber("gp") > 0)) {
amount = amount - 1;
addnumber("gp", -1);
_local5++;
}
while ((amount >= 0.5) && (getnumber("ep") > 0)) {
amount = amount - 0.5;
addnumber("ep", -1);
_local7++;
}
while ((amount >= 0.1) && (getnumber("sp") > 0)) {
amount = amount - 0.1;
addnumber("sp", -1);
_local8++;
}
while ((amount > 0.01) && (getnumber("cp") > 0)) {
amount = amount - 0.01;
addnumber("cp", -1);
_local2++;
}
while ((amount > 0) && (getnumber("cp") > 0)) {
amount = amount - 0.01;
addnumber("cp", -1);
_local2++;
}
while ((amount > 0) && (getnumber("sp") > 0)) {
amount = amount - 0.1;
addnumber("sp", -1);
_local8++;
}
while ((amount > 0) && (getnumber("ep") > 0)) {
amount = amount - 0.5;
addnumber("ep", -1);
_local7++;
}
while ((amount > 0) && (getnumber("gp") > 0)) {
amount = amount - 1;
addnumber("gp", -1);
_local5++;
}
while ((amount > 0) && (getnumber("pp") > 0)) {
amount = amount - 5;
addnumber("pp", -1);
_local3++;
}
while ((amount > 0) && (getnumber("gems") > 0)) {
amount = amount - 250;
addnumber("gems", -1);
_local6++;
}
while ((amount > 0) && (getnumber("jewelry") > 0)) {
amount = amount - 1000;
addnumber("jewelry", -1);
_local4++;
}
var _local9 = youpay;
if (_local4 > 0) {
_local9 = _local9 + ((" " + _local4) + " jewelry");
}
if (_local6 > 0) {
_local9 = _local9 + ((" " + _local6) + " gems");
}
if (_local3 > 0) {
_local9 = _local9 + ((" " + _local3) + " PP");
}
if (_local5 > 0) {
_local9 = _local9 + ((" " + _local5) + " GP");
}
if (_local7 > 0) {
_local9 = _local9 + ((" " + _local7) + " EP");
}
if (_local8 > 0) {
_local9 = _local9 + ((" " + _local8) + " SP");
}
if (_local2 > 0) {
_local9 = _local9 + ((" " + _local2) + " CP");
}
_local9 = _local9 + youpayafter;
_local9 = _local9 + ".";
write(_local9);
}
function yourlevel(levelmode) {
var _local2 = getnumber("xp");
var _local3 = "";
if (_local2 < 1000) {
if (levelmode == "level") {
return(0);
}
if (levelmode == "title") {
return("laborer");
}
if (levelmode == "description") {
return("You need to keep robbing dungeons to survive. You can't retire yet.");
}
} else if (_local2 < 2000) {
if (levelmode == "level") {
return(1);
}
if (levelmode == "title") {
return("yeoman");
}
if (levelmode == "description") {
return("You have a little plot of land.");
}
} else if (_local2 < 3000) {
if (levelmode == "level") {
return(2);
}
if (levelmode == "title") {
return("tavernkeeper");
}
if (levelmode == "description") {
return("Every worker's dream is to own their own bar.");
}
} else if (_local2 < 4000) {
if (levelmode == "level") {
return(3);
}
if (levelmode == "title") {
return("merchant");
}
if (levelmode == "description") {
return("You have enough capital to fund your own store or caravan.");
}
} else if (_local2 < 5000) {
if (levelmode == "level") {
return(4);
}
if (levelmode == "title") {
return("gentleman");
}
if (levelmode == "description") {
return("You have a manor and the biggest farm in the village.");
}
} else if (_local2 < 10000) {
if (levelmode == "level") {
return(5);
}
if (levelmode == "title") {
return("mayor");
}
if (levelmode == "description") {
return("You're the leader of the local town.");
}
} else if (_local2 < 20000) {
if (levelmode == "level") {
return(6);
}
if (levelmode == "title") {
return("knight");
}
if (levelmode == "description") {
return("You've been knighted for your services to the realm.");
}
} else if (_local2 < 30000) {
if (levelmode == "level") {
return(7);
}
if (levelmode == "title") {
return("bishop");
}
if (levelmode == "description") {
return("You're in charge of the royal temple.");
}
} else if (_local2 < 40000) {
if (levelmode == "level") {
return(8);
}
if (levelmode == "title") {
return("count");
}
if (levelmode == "description") {
return("Your fabulous wealth has given you dominion over castles and lands.");
}
} else if (_local2 < 50000) {
if (levelmode == "level") {
return(9);
}
if (levelmode == "title") {
return("duke");
}
if (levelmode == "description") {
return("Your legendary wealth makes you one of the kingdom's leading nobles.");
}
} else if (_local2 < 100000) {
if (levelmode == "level") {
return(10);
}
if (levelmode == "title") {
return("prince");
}
if (levelmode == "description") {
return("The king has given you his daughter's (or son's) hand and half the kingdom.");
}
} else {
if (levelmode == "level") {
return(11);
}
if (levelmode == "title") {
return("king");
}
if (levelmode == "description") {
return("You went ahead and bought the whole kingdom. You have reached the highest level in Dungeon Robber! Congratulations!");
}
}
return(_local3);
}
function movementphase(noattack) {
if ((noattack == null) || (noattack == undefined)) {
noattack = 0;
}
if (noattack == 1) {
move_to("turndirection", 0.25);
}
_root.recoveredspellshere = 0;
_root.intown = 0;
_root.haste = 0;
_root.sanctuary = 0;
_root.held = 0;
while (_root.masterlist.length > 0) {
remove_from_master();
}
if (getnumber("roomnumber") == 0) {
lostme(0);
}
if (getnumber("monsterhp") > 0) {
if (monster_has_tag("immobile")) {
write(("The " + _root.monstername) + " doesn't pursue!");
clear_monster();
}
}
if (getnumber("monsterhp") && (noattack == 0)) {
lostme(2);
write("The monster behind you attacks!");
var _local8 = Math.ceil(Math.random() * 20) + _root.monsterhd;
var _local7 = getnumber("ac");
var _local10 = "";
if (_root.characterclass == "Dungeon Robber") {
_local7 = _local7 + (getnumber("characterlevel") + 2);
_local10 = (((" (AC " + getnumber("ac")) + ", Dungeon Robber retreat bonus +") + (getnumber("characterlevel") + 2)) + ")";
write(((("Attack roll: " + _local8) + " vs. AC ") + _local7) + _local10);
if (_local8 >= _local7) {
var _local9 = _root.monstername;
var _local3 = Math.ceil(Math.random() * 6);
var _local4 = "d6";
if (monster_has_tag("powerful")) {
_local3 = _local3 + Math.ceil(Math.random() * 6);
_local4 = "2d6";
}
if (monster_has_tag("vicious")) {
_local3++;
_local4 = _local4 + "+1";
}
if (monster_has_tag("unarmed")) {
_local3 = 1;
_local4 = 1;
}
if (monster_has_tag("rusty")) {
_local3 = 0;
_local4 = 0;
}
if (monster_has_tag("gaze")) {
_local3 = 0;
_local4 = 0;
}
targethp = getnumber("hp");
write(((("It hits! " + _local4) + ": <b>") + _local3) + "</b> damage!");
targethp = targethp - _local3;
if (targethp >= 1) {
setnumber("hp", targethp);
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
if (monster_has_tag("sticky")) {
_root.stuck = 1;
write("You're stuck! You can't escape!");
}
if (monster_has_tag("rusty")) {
rust();
}
if (monster_has_tag("leveldrain")) {
drainlevel();
}
if (monster_has_tag("gaze")) {
write("Gaze attack!");
if (savingthrow()) {
write("You look away in time!");
} else {
write("You are turned to stone!");
setnumber("hp", 0);
_root.hp.hpblood._alpha = 0;
_root.accomplishments_killedby = "stoned by a " + _local9;
}
}
if (monster_has_tag("paralysis")) {
if (savingthrow()) {
write("You are not paralyzed!");
} else {
write("You are paralyzed!");
_root.stunned = 1;
}
}
if (monster_has_tag("hold")) {
_root.held = 1;
write("You've been grabbed!");
}
} else {
setnumber("hp", 0);
_root.hp.hpblood._alpha = 0;
write("You are killed!");
_root.accomplishments_killedby = "killed while fleeing from a " + _local9;
}
} else {
write("Miss!");
}
}
}
if (getnumber("hp") == 0) {
death();
return(undefined);
}
if (getnumber("monsterhp") > 0) {
lostme(2);
}
savegame(0, "movementphase");
var _local2 = "Will you ";
if (!_root.lost) {
if (getnumber("roomnumber") < 10) {
_local2 = _local2 + "<b>(e)xplore</b> this level of the dungeon? ";
add_to_key("e", "explore");
}
if (getnumber("roomnumber") >= 1) {
_local2 = _local2 + "<b>(b)acktrack</b> to the stairs? ";
add_to_key("b", "backtrack");
}
} else {
var _local5 = "";
if (getnumber("roomnumber") >= 1) {
if ((getnumber("monsterhp") > 0) && (_root.stuck == 0)) {
if (((_root.armor != "plate_mail") && (_root.armor != "+1_plate_mail")) || (monster_has_tag("immobile"))) {
add_to_key("r", "wander");
if (_root.heavy == 1) {
_local5 = _local5 + ", dropping ";
if (_root.holder != "") {
_local5 = _local5 + "most of your loose treasure and ";
} else if (_root.holder != "sack") {
_local5 = _local5 + ((" your " + _root.holder) + " of treasure and ");
}
_local5 = _local5 + "any equipment too heavy to run with";
}
_local2 = _local2 + (("<b>(r)un</b> from your pursuer" + _local5) + "? ");
}
} else {
add_to_key("w", "wander");
_local2 = _local2 + "<b>(w)ander</b> aimlessly looking for a way out? ";
}
}
}
if (getnumber("monsterhp") > 0) {
_local2 = _local2 + "turn and <b>(a)ttack</b> your pursuer? ";
add_to_key("a", "attack");
if (yourwealth() >= (getnumber("dungeonlevel") * 10)) {
_local2 = _local2 + (("drop " + (getnumber("dungeonlevel") * 10)) + " GP of <b>(m)oney</b> as a distraction? ");
add_to_key("m", "drop", "money");
}
if (has_item("food")) {
_local2 = _local2 + "drop <b>(f)ood</b>? ";
add_to_key("f", "drop", "food");
}
if (has_item("oil_flask")) {
_local2 = _local2 + "drop flaming <b>(o)il</b> to create an obstacle? ";
add_to_key("o", "drop", "oil");
}
}
if ((getnumber("roomnumber") == 0) && (getnumber("dungeonlevel") <= 1)) {
_local2 = _local2 + "<b>(l)eave the dungeon? ";
add_to_key("l", "stairs", -1);
}
if ((getnumber("roomnumber") == 0) && (getnumber("dungeonlevel") > 1)) {
_local2 = _local2 + "go <b>(u)pstairs? ";
add_to_key("u", "upstairs");
} else if (has_usable_noncombat_item()) {
_local2 = _local2 + "<b>(u)se</b> an item? ";
add_to_key("u", "use_a_noncombat_item");
}
if (((_root.characterclass == "Cleric") && (_root.spells > 0)) && (((getnumber("hp") < getnumber("maxhp")) || (getnumber("henchmanhp") < getnumber("henchmanmaxhp"))) || (getnumber("henchman2hp") < getnumber("henchman2maxhp")))) {
_local2 = _local2 + "cast <b>(c)ure light wounds?</b> ";
add_to_key("c", "cast_clw");
}
if (getnumber("roomnumber") == 10) {
_local2 = _local2 + "go <b>(d)ownstairs? ";
add_to_key("d", "downstairs");
}
write(_local2);
}
function lostme(lostnum) {
if ((lostnum == null) || (lostnum == undefined)) {
lostnum = 1;
}
_root.lost = lostnum;
if (_root.lost >= 1) {
_root.compassrose._alpha = 0;
_root.roomnumber._alpha = 0;
} else if (_root.intown == 0) {
_root.roomnumber._alpha = 100;
_root.compassrose._alpha = 100;
}
}
function backtrack() {
_root.fishedout = 0;
var _local2 = Math.ceil(Math.random() * 20);
var _local4 = 0;
if (intbonus()) {
var _local3 = Math.ceil(Math.random() * 20);
if ((_local2 < getnumber("roomnumber")) && (_local3 > getnumber("roomnumber"))) {
_local2 = _local3;
_local4 = 1;
}
if ((_local2 < getnumber("roomnumber")) && (_local3 < _local2)) {
_local2 = _local3;
}
}
if (_local2 >= getnumber("roomnumber")) {
if (_local4 == 1) {
write("Due to your superior intelligence, you make it back to the beginning of the level.");
} else {
write("You make it back to the beginning of the level.");
}
setnumber("roomnumber", 0);
} else {
write("You get lost on your way back.");
setnumber("roomnumber", _local2);
lostme(1);
turn(0);
}
add_to_master("roll", "mainloop", 20);
run_master();
}
function wander(nosave) {
_root.fishedout = 0;
if (charsheet._x != -500) {
opencharsheet("close");
}
if (getnumber("monsterhp") > 0) {
if (monster_has_tag("immobile")) {
clear_monster();
write("You easily outdistance the monster.");
}
}
if (nosave == null) {
nosave = 0;
}
if (nosave == 0) {
addnumber("roomnumber", -1);
if (getnumber("roomnumber") < 0) {
setnumber("roomnumber", 0);
}
}
if ((_root.heavy == 1) && (getnumber("monsterhp") > 0)) {
n = 0;
while (n < 15) {
if (_root.itemlist[_root.possessions[n][0]].heavy == 1) {
write(((("You drop " + _root.possessions[n][1]) + " ") + print_pretty(_root.possessions[n][0])) + "!");
add_equipment(_root.possessions[n][0], _root.possessions[n][1] * -1);
}
n++;
}
if (_root.holder != "sack") {
_root.holder = "";
keep_best(100);
}
_root.heavy = 0;
}
if (getnumber("monsterhp") == 0) {
var _local3 = Math.ceil(Math.random() * 10);
if (_local3 == 1) {
write("This area looks familiar.");
lostme(0);
}
}
add_to_master("move_to", "turndirection", 0.25);
_root.oktodomainloop = 1;
add_to_master("roll", "mainloop", 20);
run_master();
}
function keep_best(coinnumber) {
var _local3 = Math.ceil(Math.random() * 2);
if (_local3 == 1) {
return(undefined);
}
if (_root.intown == 1) {
return(undefined);
}
if (getnumber("jewelry") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("jewelry") - coinnumber)) + " jewelry and all lesser coins!");
setnumber("jewelry", coinnumber);
setnumber("gems", 0);
setnumber("pp", 0);
setnumber("gp", 0);
setnumber("ep", 0);
setnumber("sp", 0);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("jewelry");
}
if (getnumber("gems") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("gems") - coinnumber)) + " gems and all lesser coins!");
setnumber("gems", coinnumber);
setnumber("pp", 0);
setnumber("gp", 0);
setnumber("ep", 0);
setnumber("sp", 0);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("gems");
}
if (getnumber("pp") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("pp") - coinnumber)) + " PP and all lesser coins!");
setnumber("pp", coinnumber);
setnumber("gp", 0);
setnumber("ep", 0);
setnumber("sp", 0);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("pp");
}
if (getnumber("gp") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("gp") - coinnumber)) + " GP and all lesser coins!");
setnumber("gp", coinnumber);
setnumber("ep", 0);
setnumber("sp", 0);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("gp");
}
if (getnumber("ep") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("ep") - coinnumber)) + " EP and all lesser coins!");
setnumber("ep", coinnumber);
setnumber("sp", 0);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("ep");
}
if (getnumber("sp") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("sp") - coinnumber)) + " SP and all copper!");
setnumber("sp", coinnumber);
setnumber("cp", 0);
} else {
coinnumber = coinnumber - getnumber("sp");
}
if (getnumber("cp") >= coinnumber) {
write(("Oops! There's a hole in your pocket! You've dropped " + (getnumber("cp") - coinnumber)) + " CP!");
setnumber("cp", coinnumber);
} else {
coinnumber = coinnumber - getnumber("cp");
}
}
function town() {
_root.mapexplanation._x = -500;
if (_root.gamemode == "game1") {
var villagename = "Basileus";
}
if (_root.gamemode == "game3") {
var villagename = "Advent";
}
var mygamemode = "";
if (_root.gamemode == "game1") {
mygamemode = "Basic";
}
if (_root.gamemode == "game3") {
mygamemode = "Advanced";
}
if (position_filled("yeoman")) {
_root.dungeonmap.village.villagefarm._alpha = 100;
}
if (position_filled("tavernkeeper")) {
_root.dungeonmap.village.villageinn._alpha = 100;
}
if (position_filled("merchant")) {
_root.dungeonmap.village.villagewestcity._alpha = 100;
_root.dungeonmap.village.villagebuilding2._alpha = 100;
}
if (position_filled("gentleman")) {
_root.dungeonmap.village.villagebuilding3._alpha = 100;
}
if (position_filled("mayor")) {
_root.dungeonmap.village.villageleftcity._alpha = 100;
_root.dungeonmap.village.villagebuilding6._alpha = 100;
_root.dungeonmap.village.villagesmith._alpha = 100;
}
if (position_filled("knight")) {
_root.dungeonmap.village.villagebuilding4._alpha = 100;
_root.dungeonmap.village.villagesmith._alpha = 100;
}
if (position_filled("bishop")) {
_root.dungeonmap.village.villagetemple._alpha = 100;
}
if (position_filled("count")) {
_root.dungeonmap.village.villagerightcity._alpha = 100;
_root.dungeonmap.village.villagebuilding6._alpha = 100;
_root.dungeonmap.village.villagepalace._alpha = 100;
}
if (position_filled("duke")) {
_root.dungeonmap.village.villagepalace._alpha = 100;
_root.dungeonmap.village.villagecoliseum._alpha = 100;
}
if (position_filled("prince")) {
_root.dungeonmap.village.villagesmith._alpha = 100;
_root.dungeonmap.village.villagepalace._alpha = 100;
}
if (position_filled("king")) {
_root.dungeonmap.village.villagepalace._alpha = 100;
}
_root.dungeonmap.village.nameplaque.nameplaque.text = villagename;
_root.towntext = ((("This is your home village of " + villagename) + ". All your ") + mygamemode) + " characters live here. If your characters return alive from the dungeon and retire, the town will grow.";
_root.towntext = _root.towntext + "\n\n\u2022When you retire with 1000-1999 XP, the town gets a <b>Yeoman.</b> The market sells food, which lets you distract monsters and heal in the dungeon.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.yeoman) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u20222000-2999 XP: town gets a <b>Tavernkeeper.</b> You can hire henchmen to share your dangers in the dungeon.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.tavernkeeper) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u20223000-3999 XP: town gets a <b>Merchant.</b> The Market carries more gear. You unlock the Thief class.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.merchant) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u20224000-4999 XP: town gets a <b>Gentleman/woman.</b> Leather armor and rapiers become available.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.gentleman) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u20225000-9999 XP: town gets a <b>Mayor.</b> A Smithy sells chain mail, swords, and shields.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.mayor) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u202210,000-19,999 XP: town gets a <b>Knight.</b> The Smithy sells plate mail and bastard swords. You unlock the Fighter class.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.knight) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u202220,000-29,999 XP: town gets a <b>Bishop.</b> A Temple sells healing supplies. You unlock the Cleric class.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.bishop) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u202230,000-39,999 XP: town gets a <b>Count/Countess.</b> A Wizard College sells magic supplies. You unlock the Wizard class.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.count) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u202240,000-49,999 XP: town gets a <b>Duke/Duchess.</b> A Coliseum lets you test your might against monsters or train them as pets.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.duke) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u202250,000-99,999 XP: town gets a <b>Prince/Princess.</b> Smithy sells magic armor.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.prince) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.towntext = _root.towntext + "\n\u2022100,000+ XP: town gets a <b>King/Queen.</b> The Royal Treasury sells the most powerful magic items in the game.";
if (eval ("_root.savegames.data." + _root.gamemode).retirees.king) {
_root.towntext = _root.towntext + " <font color=\"#009900\">Position Filled</font>";
} else {
_root.towntext = _root.towntext + " <font color=\"#ff0000\">Position Vacant</font>";
}
_root.faqtext = _root.towntext;
_root.dungeonmap.village.nameplaque.lozenge.gotoAndStop(1);
_root.treasure_finding = 0;
_root.strengthspell = 0;
readyitem();
if ((_root.characterclass == "Wizard") || (_root.characterclass == "Cleric")) {
_root.spells = getnumber("characterlevel") + 1;
}
_root.accomplishments_deepestlevel = 0;
_root.accomplishments_toughestmonster = "";
_root.accomplishments_toughestmonsterlevel = 0;
_root.accomplishments_magicitem = "";
_root.compassrose._alpha = 0;
_root.dungeonlevel._alpha = 0;
setnumber("dungeonlevel", 0);
_root.roomnumber._alpha = 0;
savegame(0, "town");
_root.instore = 0;
_root.intown = 1;
lostme(0);
_root.dungeonmap.village._alpha = 100;
move_to("start");
if (getnumber("monsterhp") > 0) {
clear_monster();
write("You escaped your pursuer!");
}
write((((((((((("You're in the town of " + villagename) + ". You have ") + getnumber("xp")) + " experience and ") + yourwealth()) + " GP. That's enough to make you a level ") + yourlevel("level")) + " ") + mytitle(yourlevel("title"))) + ". ") + yourlevel("description"));
var mywrite = "";
reset_key();
mywrite = mywrite + "<br><b>(e)nter</b> the dungeon? ";
add_to_key("e", "enterdungeon");
mywrite = mywrite + "<br><b>(h)ome</b> and rest?";
add_to_key("h", "home");
mywrite = mywrite + "<br><b>(b)ank</b> your treasure and earn XP? ";
add_to_key("b", "bank");
mywrite = mywrite + "<br><b>(m)arket?</b>";
add_to_key("m", "market");
mywrite = mywrite + "<br><b>(g)raveyard?</b>";
add_to_key("g", "graveyard");
mywrite = mywrite + "<br><b>(a)dventurers' monument?</b>";
add_to_key("a", "monument");
if (((position_filled("mayor") || (position_filled("knight"))) || (position_filled("prince"))) || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(s)mith?</b>";
add_to_key("s", "smith");
}
if (position_filled("tavernkeeper") || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(i)nn?</b>";
add_to_key("i", "inn");
}
if (position_filled("bishop") || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(t)emple?</b>";
add_to_key("t", "temple");
}
if (position_filled("duke") || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(c)oliseum?</b>";
add_to_key("c", "coliseum");
}
if (position_filled("count") || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(w)izard college?</b>";
add_to_key("w", "wizard_college");
}
if (position_filled("king") || (_root.testmode == 1)) {
mywrite = mywrite + "<br><b>(r)oyal treasury?</b>";
add_to_key("r", "royal_treasury");
}
if (has_usable_noncombat_item()) {
mywrite = mywrite + "<br><b>(u)se an item?</b>";
add_to_key("u", "use_a_noncombat_item");
}
mywrite = mywrite + "<br><b>(q)uit game?</b>";
add_to_key("q", "quitgame");
write(mywrite);
}
function clhench() {
clear_henchman();
town();
}
function rest(days) {
var _local2 = 10 * days;
if (_local2 > yourwealth()) {
write("You don't have enough money to rest this long. Maybe you should take out a loan at the bank.");
reset_keys();
town();
} else {
pay(_local2, "You pay ", " for medicines while you recover");
addnumber("hp", days);
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
town();
}
}
function healup() {
setnumber("hp", getnumber("maxhp"));
_root.hp.hpblood._alpha = 0;
town();
}
function restorelevel() {
addnumber("xp", getnumber("drainedxp"));
setnumber("drainedxp", 0);
pay(300, "You rest for a month and pay ", " GP for clerics to restore your lost levels");
levelup();
healup();
}
function home() {
changemoney();
var _local2 = "<br>You're home safe!";
if (getnumber("hp") < getnumber("maxhp")) {
if (_root.characterclass == "Cleric") {
_local2 = _local2 + "<br>magically <b>(h)eal</b> for free?";
add_to_key("h", "healup");
} else if (yourwealth() >= 10) {
_local2 = _local2 + "<br>Rest for a <b>(d)ay</b> and heal 1 hp (for a cost of 10 GP in medicines)? ";
var _local3 = getnumber("maxhp") - getnumber("hp");
add_to_key("d", "rest", 1);
if (_local3 > 1) {
_local2 = _local2 + (("<br>Rest for a <b>(w)eek</b> and fully heal (for " + (10 * _local3)) + " GP)? ");
add_to_key("w", "rest", _local3);
}
} else {
write("You can't afford healing! Maybe you should go to the bank and take a loan.");
}
}
if ((yourwealth() > 300) && (getnumber("drainedxp") > 0)) {
_local2 = _local2 + "<br><b>Rest for a <b>(m)onth</b> and restore your drained levels (for 300 GP)? ";
add_to_key("m", "restorelevel");
}
_local2 = _local2 + "<br>go to <b>(t)own</b>?";
if (getnumber("characterlevel") > 0) {
_local2 = _local2 + "<br><b>(r)etire</b> from adventuring?";
add_to_key("r", "retire");
}
write(_local2);
add_to_key("t", "town");
}
function position_filled(position) {
if (position == 0) {
return(false);
}
if (position == 1) {
return(true);
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees == null) {
return(false);
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees[position].length > 0) {
return(true);
}
return(false);
}
function retire() {
write(("If you retire from adventuring, you will become a " + mytitle(yourlevel("title"))) + ".");
if (eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")] != null) {
write(("The town already has a " + yourlevel("title")) + ". You will join:");
var n = 0;
while (n < eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")].length) {
write(((eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")][n].charactername + " with ") + eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")][n].wealth) + "!");
n++;
}
} else if (yourlevel("title") == "yeoman") {
write("Your farm will provide food for the market. If you keep adventuring, though, you might retire as a tavernkeeper or merchant.");
} else if (yourlevel("title") == "tavernkeeper") {
write(("In your inn, adventurers will be able to hire henchmen. If you keep adventuring, though, you might retire as a merchant or " + mytitle("gentleman")) + ".");
} else if (yourlevel("title") == "merchant") {
write(("Adventuring gear will be available in the market. New characters will be able to start as thieves. If you keep adventuring, though, you might retire as a " + mytitle("gentleman")) + " or mayor.");
} else if (yourlevel("title") == "gentleman") {
write("Leather armor and rapiers will be available in the market. If you keep adventuring, though, you might retire as a mayor or knight.");
} else if (yourlevel("title") == "mayor") {
write("A smithy will start selling metal weapons and armor. If you keep adventuring, though, you might retire as a knight or bishop.");
} else if (yourlevel("title") == "knight") {
write(("The smithy makes plate mail and bastard swords. New characters will be able to start as fighters. If you keep adventuring, though, you might retire as a bishop or " + mytitle("count")) + ".");
} else if (yourlevel("title") == "bishop") {
write(((("A temple will sell holy items. New characters will be able to start as clerics. If you keep adventuring, though, you might retire as a " + mytitle("count")) + " or ") + mytitle("duke")) + ".");
} else if (yourlevel("title") == "count") {
write(((("A wizard college will sell magic items. New characters will be able to start as wizards. If you keep adventuring, though, you might retire as a " + mytitle("duke")) + " or ") + mytitle("prince")) + ".");
} else if (yourlevel("title") == "duke") {
write(((("A coliseum will pit adventurers against monsters. You can buy a whip to tame monsters. If you keep adventuring, though, you might retire as a " + mytitle("prince")) + " or ") + mytitle("king")) + ".");
} else if (yourlevel("title") == "prince") {
write(("The smithy makes magical armor. If you keep adventuring, though, you might retire as a " + mytitle("king")) + ".");
} else if (yourlevel("title") == "king") {
write("The royal treasury sells all sorts of magical items. Yours is the highest position in the land.");
}
write("Really <b>(r)etire?</b> or keep <b>(a)dventuring?</b>");
add_to_key("r", "reallyretire");
add_to_key("a", "town");
}
function reallyretire() {
if (eval ("_root.savegames.data." + _root.gamemode).retirees == null) {
eval ("_root.savegames.data." + _root.gamemode).retirees = new Object();
}
if (eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")] == null) {
eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")] = new Array();
}
if (eval ("_root.savegames.data." + _root.gamemode).buildings == null) {
eval ("_root.savegames.data." + _root.gamemode).buildings = new Object();
}
var mygamemode = "";
if (_root.gamemode == "game1") {
mygamemode = "Basic";
}
if (_root.gamemode == "game2") {
mygamemode = "Advanced";
}
if (_root.gamemode == "game3") {
mygamemode = "Advanced";
}
var retirestuff = new Object();
retirestuff.charactername = _root.charactername;
retirestuff.gamemode = mygamemode;
retirestuff.characterclass = _root.characterclass;
retirestuff.charactertitle = "";
if (yourlevel("title") == "mayor") {
retirestuff.charactertitle = "Mayor ";
}
if (yourlevel("title") == "knight") {
retirestuff.charactertitle = mytitle("Sir") + " ";
}
if (yourlevel("title") == "bishop") {
retirestuff.charactertitle = "Bishop ";
}
if (yourlevel("title") == "count") {
retirestuff.charactertitle = mytitle("Count") + " ";
}
if (yourlevel("title") == "duke") {
retirestuff.charactertitle = mytitle("Duke") + " ";
}
if (yourlevel("title") == "prince") {
retirestuff.charactertitle = mytitle("Prince") + " ";
}
if (yourlevel("title") == "king") {
retirestuff.charactertitle = mytitle("King") + " ";
}
retirestuff.wealth = yourwealth() + getnumber("xp");
eval ("_root.savegames.data." + _root.gamemode).retirees[yourlevel("title")].push(retirestuff);
var she = "She";
if (_root.gender == "m") {
she = "He";
}
write(((((((((((((((("Congratulations to " + retirestuff.charactertitle) + _root.charactername) + "! ") + she) + " ventured into the dungeon and returned rich! ") + she) + " is now a ") + mytitle(yourlevel("title"))) + ". ") + _root.charactername) + " played on ") + mygamemode) + " difficulty. The story of ") + retirestuff.charactertitle) + _root.charactername) + " shall be recorded on the Adventurer's Monument to inspire further generations.");
deletesave(_root.characterid);
savehtml();
write("<br><b>(c)ontinue</b> to the main menu");
add_to_key("c", "restart");
}
function drawvillage() {
var mybuildings = new Array("villagefarm", "villageinn", "villagewestcity", "villagebuilding2", "villagesmith", "villagebuilding3", "villageleftcity", "villagebuilding6", "villagebuilding4", "villagetemple", "villagerightcity", "villagepalace", "villagecoliseum");
var n = 0;
while (n < mybuildings.length) {
if ((eval ("_root.savegames.data." + _root.gamemode).buildings[mybuildings[n]] != null) && (eval ("_root.savegames.data." + _root.gamemode).buildings[mybuildings[n]] == 1)) {
eval ("_root.dungeonmap.village." + mybuildings[n])._alpha = 100;
}
n++;
}
}
function changemoney() {
var _local4 = yourwealth();
var _local1 = yourwealth() - int(yourwealth());
_local1 = _local1 * 10;
var _local2 = _local1 - int(_local1);
_local2 = _local2 * 10;
var _local3 = int(yourwealth());
setnumber("cp", int(_local2));
setnumber("sp", int(_local1));
setnumber("ep", 0);
setnumber("gp", 0);
addmoney("gp", int(_local3));
setnumber("pp", 0);
setnumber("gems", 0);
setnumber("jewelry", 0);
}
function inn() {
write("You have a drink at the inn.");
if ((yourwealth >= 60) && (_root.innrecruitlevel == 0)) {
write("<b>(b)uy<b> a round of drinks for 5 GP and look for a henchman?");
add_to_key("b", "roundofdrinks");
} else if ((yourwealth >= 80) && (_root.innrecruitlevel == 1)) {
write("Spend 25 GP to <b>(p)ut up placards<b> advertising for a henchman?");
add_to_key("p", "placards");
} else if ((yourwealth >= 155) && (_root.innrecruitlevel == 2)) {
write("Spend 100 GP to <b>(h)ire a town crier<b> calling for henchmen?");
add_to_key("h", "towncrier");
} else if (_root.innrecruitlevel == 3) {
write("No brave souls in town! Maybe they'll be inspired by your deeds in the dungeon.");
} else {
write("You're too poor to afford henchmen.");
}
write("<b>Return to (t)own?</b>");
add_to_key("t", "town");
}
function graveyard() {
if (eval ("_root.savegames.data." + _root.gamemode).epitaphs == null) {
write("No one you know is buried in the graveyard.");
} else {
var n = 0;
while (n < eval ("_root.savegames.data." + _root.gamemode).epitaphs.length) {
write("\u2020 " + eval ("_root.savegames.data." + _root.gamemode).epitaphs[n]);
n++;
}
}
if (_root.characterclass == "Cleric") {
if ((getnumber("henchmanhp") == 0) || ((chabonus() == 1) && (getnumber("henchman2hp") == 0))) {
write("Cast <b>(a)nimate Dead</b> to raise a skeleton minion?");
add_to_key("a", "animatedead", 0);
}
}
if (((((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief")) && (has_item("scroll_of_animate_dead"))) && (wisbonus())) {
if ((getnumber("henchmanhp") == 0) || ((chabonus() == 1) && (getnumber("henchman2hp") == 0))) {
write("Use Animate Dead <b>(s)croll</b> to raise a skeleton minion?");
add_to_key("s", "animatedead", 1);
}
}
gotit("town", "return to (t)own", "t");
}
function animatedead(mymode) {
if (mymode == 1) {
write("You wait till midnight and read the unholy words. You summon a skeleton from the grave. You can <b>(e)nter the dungeon</b> or return to <b>(t)own</b>.");
add_equipment("scroll_of_animate_dead", -1);
} else {
write("You wait till midnight and summon a skeleton from the grave. You can <b>(e)nter the dungeon</b> or return to <b>(t)own</b>.");
_root.spells--;
}
var hitdice = 1;
var monsternumber = 4;
var tags = new Object();
tags.unintelligent = 1;
tags.relentless = 1;
tags.armed = 1;
tags.undead = 1;
tags.mindless = 1;
if ((getnumber("henchmanhp") > 0) && (chabonus())) {
setnumber("henchman2ac", 10 + hitdice);
setnumber("henchman2hp", 4);
setnumber("henchman2maxhp", getnumber("henchman2hp"));
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
namepet("Skeleton", 2);
_root.henchman2hd = hitdice;
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.henchman2number = monsternumber;
_root.henchman2white.monster1_4white._alpha = 100;
_root.henchman2tags = tags;
} else {
setnumber("henchmanac", 10 + hitdice);
setnumber("henchmanhp", 4);
setnumber("henchmanmaxhp", getnumber("henchmanhp"));
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmannumber = monsternumber;
namepet("Skeleton", 1);
_root.henchmanhd = hitdice;
_root.henchmanwhite.monster1_4white._alpha = 100;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmantags = tags;
}
add_to_key("e", "enterdungeon");
add_to_key("t", "clhench");
}
function monument() {
if (eval ("_root.savegames.data." + _root.gamemode).retirees == null) {
write("This town has no heroes to celebrate... yet.");
} else {
var mypositions = new Array("yeoman", "tavernkeeper", "merchant", "gentleman", "mayor", "knight", "bishop", "count", "duke", "prince", "king");
var n = 0;
while (n < mypositions.length) {
if (eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]] != null) {
write(("<b>Retired as " + mypositions[n]) + "</b>");
var o = 0;
while (o < eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]].length) {
var mytitle = "";
write((((((((("\u2022 " + eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]][o].charactertitle) + eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]][o].charactername) + ": ") + eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]][o].gamemode) + " ") + eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]][o].characterclass) + ", retired with ") + eval ("_root.savegames.data." + _root.gamemode).retirees[mypositions[n]][o].wealth) + " GP");
o++;
}
}
n++;
}
}
gotit("town", "return to (t)own", "t");
}
function mytitle(mytitle) {
if (_root.gender == "f") {
if (mytitle == "gentleman") {
mytitle = "gentlewoman";
}
if (mytitle == "sir") {
mytitle = "lady";
}
if (mytitle == "Sir") {
mytitle = "Lady";
}
if (mytitle == "count") {
mytitle = "countess";
}
if (mytitle == "Count") {
mytitle = "Countess";
}
if (mytitle == "duke") {
mytitle = "duchess";
}
if (mytitle == "Duke") {
mytitle = "Duchess";
}
if (mytitle == "prince") {
mytitle = "princess";
}
if (mytitle == "Prince") {
mytitle = "Princess";
}
if (mytitle == "king") {
mytitle = "queen";
}
if (mytitle == "King") {
mytitle = "Queen";
}
}
return(mytitle);
}
function coliseum() {
write("Here you can practice your martial skills. If you have a whip, you can train animals to serve you during your next dungeon delve.");
write("<b>1. Giant Rat</b>");
add_to_key(1, "fight", "Giant Rat");
write("<b>2. Centipede</b>");
add_to_key(2, "fight", "Centipede");
write("<b>3. Skeleton</b>");
add_to_key(3, "fight", "Skeleton");
write("<b>4. Lurker Above</b>");
add_to_key(4, "fight", "Lurker Above");
write("<b>5. Carrion Crawler</b>");
add_to_key(5, "fight", "Carrion Crawler");
write("<b>6. Vampire</b>");
add_to_key(6, "fight", "Vampire");
write("<b>7. Su Monster</b>");
add_to_key(7, "fight", "Su Monster");
write("<b>8. 2 Bandits</b>");
add_to_key(8, "fight", "Bandit", "Bandit");
write("<b>9. Hobgoblin and Spider</b>");
add_to_key(9, "fight", "Hobgoblin", "Giant Spider");
write("<b>Return to (t)own</b>");
add_to_key("t", "town");
}
function roundofdrinks() {
if (yourwealth() < 5) {
write("You can't afford all those drinks!");
town();
} else {
var _local2 = Math.ceil(Math.random() * 2);
pay(5);
if (_local2 == 2) {
write("No adventurous locals at the bar.");
_root.innrecruitlevel = 1;
inn();
} else if ((getnumber("henchmanhp") > 0) && ((getnumber("henchman2hp") > 0) || (chabonus() == 0))) {
write("You have enough henchmen!");
town();
} else {
makehenchman();
}
}
}
function placards() {
if (yourwealth() < 25) {
write("You can't afford all those placards!");
town();
} else {
var _local2 = Math.ceil(Math.random() * 2);
pay(25);
if (_local2 == 2) {
write("No adventurous locals answer your ad.");
_root.innrecruitlevel = 2;
inn();
} else if ((getnumber("henchmanhp") > 0) && ((getnumber("henchman2hp") > 0) || (chabonus() == 0))) {
write("You have enough henchmen!");
town();
} else {
makehenchman();
}
}
}
function towncrier() {
if (yourwealth() < 100) {
write("You can't afford a town crier!");
town();
} else {
var _local2 = Math.ceil(Math.random() * 2);
pay(100);
if (_local2 == 2) {
write("No adventurous locals answer your summons. Try again after you've adventured some more.");
_root.innrecruitlevel = 3;
inn();
} else if ((getnumber("henchmanhp") > 0) && ((getnumber("henchman2hp") > 0) || (chabonus() == 0))) {
write("You have enough henchmen!");
town();
} else {
makehenchman();
}
}
}
function makehenchman() {
var _local3 = Math.ceil(Math.random() * 2);
var _local2 = (Math.ceil(Math.random() * 5) * 10) + 50;
if (_local3 == 1) {
var _local1 = "lad";
} else {
var _local1 = "lass";
}
write(((("A likely " + _local1) + " offers to join you for ") + _local2) + " GP. <b>(a)ccept</b> or <b>(r)efuse?</b>");
add_to_key("r", "inn");
add_to_key("a", "hire", _local2, _local1);
}
function hire(price, gender) {
if (price > yourwealth()) {
write("You don't have enough gold!");
inn();
} else {
pay(price);
if (getnumber("henchmanhp") == 0) {
setnumber("henchmanhp", Math.ceil(Math.random() * 6));
setnumber("henchmanmaxhp", getnumber("henchmanhp"));
setnumber("henchmanac", 10);
_root.henchmanname = henchname(gender);
namepet("", 1);
_root.henchmannumber = 0;
if (gender == "lass") {
_root.henchmannumber = 1;
}
_root.henchmanhd = 0;
_root.henchmantags.armed = 1;
_root.henchmantags.intelligent = 1;
eval (("_root.henchmanwhite.monster0_" + _root.henchmannumber) + "white")._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmanhp._alpha = 100;
write(_root.henchmanname + " joins you!");
_root.hname1.mytext.text = _root.henchmanname;
_root.innrecruitlevel = 0;
} else {
setnumber("henchman2hp", Math.ceil(Math.random() * 6));
setnumber("henchman2maxhp", getnumber("henchman2hp"));
setnumber("henchman2ac", 10);
_root.henchman2name = henchname(gender);
namepet("", 2);
_root.henchman2number = 0;
if (gender == "lass") {
_root.henchman2number = 1;
}
_root.henchman2hd = 0;
_root.henchman2tags.armed = 1;
_root.henchman2tags.intelligent = 1;
eval (("_root.henchman2white.monster0_" + _root.henchman2number) + "white")._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.henchman2hp._alpha = 100;
write(_root.henchman2name + " joins you!");
_root.hname2.mytext.text = _root.henchman2name;
_root.innrecruitlevel = 0;
}
town();
}
}
function store(storetype) {
_root.instore = 1;
_root.dungeondestination = null;
changemoney();
write(((("Welcome to the " + print_pretty(storetype)) + "! You have ") + yourwealth()) + " GP. Items for sale:");
var _local8 = 0;
n = 0;
while (n < 100) {
var _local6 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l");
if (_root.itemlist[n] != null) {
var _local2 = _root.itemlist[n];
if (_local2.storetype == storetype) {
if (position_filled(_local2.prereq)) {
_local8++;
var _local3 = _local6[_local8];
var _local5 = "";
var _local4 = "";
if (!usable_by_class(_root.itemlist[_local2.itemname])) {
_local5 = "<font color=\"#666666\">";
_local4 = "</font>";
}
write(((((((("<b>" + _local3) + ". ") + _local5) + print_pretty(_local2.itemname)) + _local4) + ": ") + _local2.buy) + " GP</b>");
add_to_key(_local3, "buy", _local2.itemname, storetype);
}
}
}
n++;
}
write("<b>I'd like to (s)ell something, actually</b>");
add_to_key("s", "opencharsheet", "open");
if (storetype == "wizard_college") {
write("Use the <b>(m)ystic hexagram</b> to teleport to a random room in the dungeon?");
add_to_key("m", "teleporttodungeon");
}
write("<b>Return to <b>(t)own</b>");
add_to_key("t", "town");
}
function buy(itemname, storetype) {
var _local2 = _root.itemlist[itemname].buy;
if (yourwealth() >= _local2) {
pay(_local2);
write(("You bought the " + print_pretty(itemname)) + ".");
add_equipment(itemname);
} else {
write("You don't have enough money!");
}
store(storetype);
}
function bank() {
write(("At the Bank of Tiamat, the teller changes your money into GP. You can put up to " + yourwealth()) + " GP into your retirement fund. Every GP you save will give you 1 XP, but you can't withdraw it till you retire.");
var _local4 = "";
var _local3 = yourwealth();
changemoney();
if ((_root.loan > 0) && (_root.gamemode != "game3")) {
if ((yourwealth() < 100) && (_root.loan >= -500)) {
write("I'd like to <b>(b)orrow</b> 100 more GP!");
add_to_key("b", "loan", 100);
}
if (yourwealth() >= _root.loan) {
write(("I'm here to <b>(p)ay</b> off my loan of " + _root.loan) + "!");
add_to_key("p", "payloan");
} else {
write("I can't pay off my loan yet! <b>(g)oodbye!</b>");
add_to_key("g", "town");
}
} else {
var _local2 = "How much will you deposit? <br><b>(n)one</b>";
add_to_key("n", "town");
add_to_key("t", "town");
if (_local3 >= 1) {
_local2 = _local2 + "<br><b>(a)ll</b>";
add_to_key("a", "deposit", getnumber("gp"));
}
if (_local3 > 1) {
_local2 = _local2 + "<br><b>1:</b> 1 GP";
add_to_key("1", "deposit", 1);
}
if (_local3 > 5) {
_local2 = _local2 + "<br><b>2:</b> 5 GP";
add_to_key("2", "deposit", 5);
}
if (_local3 > 10) {
_local2 = _local2 + "<br><b>3:</b> 10 GP";
add_to_key("3", "deposit", 10);
}
if (_local3 > 50) {
_local2 = _local2 + "<br><b>4:</b> 50 GP";
add_to_key("4", "deposit", 50);
}
if (_local3 > 100) {
_local2 = _local2 + "<br><b>5:</b> 100 GP";
add_to_key("5", "deposit", 100);
}
if (_local3 > 500) {
_local2 = _local2 + "<br><b>6:</b> 500 GP";
add_to_key("6", "deposit", 500);
}
if (_local3 > 1000) {
_local2 = _local2 + "<br><b>7:</b> 1000 GP";
add_to_key("7", "deposit", 1000);
}
if (_local3 > 5000) {
_local2 = _local2 + "<br><b>8:</b> 5000 GP";
add_to_key("8", "deposit", 5000);
}
if (_local3 > 10000) {
_local2 = _local2 + "<br><b>9:</b> 10,000 GP";
add_to_key("9", "deposit", 10000);
}
if (_root.gamemode == "game1") {
_local2 = _local2 + "<br>Actually, I'm here to <b>(b)orrow</b> 100 GP";
add_to_key("b", "loan", 100);
}
_local2 = _local2 + "<br><b>Return to (t)own</b>";
write(_local2);
}
}
function myloan(loanamount) {
write(((("A wise investment! The interest rate is 100%. If you borrow " + loanamount) + ", you will be responsible for paying back ") + (loanamount * 2)) + ". If that meets with your approval, please sign these documents!");
write("<b>(n)o way</b>, that's a terrible idea!");
write("<b>(y)es</b>, I'll sign!");
add_to_key("n", "town");
add_to_key("y", "reallyloan", loanamount);
}
function reallyloan(loanamount) {
_root.loan = _root.loan + (loanamount * 2);
addmoney("gp", loanamount);
write(("Here's your money. Remember, you now owe us " + _root.loan) + "! Good luck in the dungeon!");
gotit("town", "(s)ee you soon!", "s");
}
function payloan() {
if (yourwealth() >= _root.loan) {
pay(_root.loan);
_root.loan = 0;
write("Congratulations! You've paid off your loan! Please think of us for all your financial needs!");
gotit("town", "(h)ooray!", "h");
} else {
write("You don't have enough money to pay the loan!");
gotit("town", "(d)amn!", "d");
}
}
function deposit(cash) {
if (cash > getnumber("gp")) {
return(undefined);
}
cash = int(cash);
addnumber("xp", cash);
cash = cash * -1;
addnumber("gp", cash);
var _local3 = levelup();
if (_local3 && (_root.gender == "")) {
write("By the way, are you <b>(m)ale</b> or <b>(f)emale<b>?");
add_to_key("m", "choosegender", "m");
add_to_key("f", "choosegender", "f");
} else if (yourwealth() > 1) {
bank();
} else {
town();
}
}
function choosegender(gender) {
_root.gender = gender;
if (yourwealth() > 1) {
bank();
} else {
town();
}
}
function drainlevel() {
var _local3 = getnumber("characterlevel");
if (_local3 == 0) {
damage(20, 1, "death by level drain");
return(undefined);
}
if (_local3 <= 5) {
var _local2 = _local3 * 1000;
_local2--;
var _local4 = getnumber("xp") - _local2;
if (_local4 < 0) {
_local4 = 0;
}
addnumber("drainedxp", _local4);
setnumber("xp", _local2);
} else {
addnumber("xp", -10000);
addnumber("drainedxp", 10000);
}
addnumber("characterlevel", -1);
setnumber("maxhp", hpbylevel(getnumber("characterlevel")));
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
_root.hp.hpblood._alpha = int(100 - int((getnumber("hp") / getnumber("maxhp")) * 100));
write("<font color=\"#ff0000\">You lost a level!</font> Rest up at home to restore it.");
}
function hpbylevel(levelnumber) {
var _local4 = _root.characterclass;
var _local2 = 6;
if (_root.gamemode == "game1") {
_local2 = 10;
}
if ((_root.characterclass == "Wizard") || (_root.characterclass == "Thief")) {
_local2 = _local2 - 2;
}
if (_root.characterclass == "Fighter") {
_local2 = _local2 + 2;
}
if (conbonus() == 1) {
_local2 = _local2 + int(levelnumber / 2);
}
if (((levelnumber % 2) == 1) && (conbonus() == 1)) {
_local2++;
}
if (_root.characterclass == "Fighter") {
_local2 = _local2 + levelnumber;
_local2 = _local2 + int(levelnumber / 2);
} else if (_root.characterclass == "Cleric") {
_local2 = _local2 + levelnumber;
_local2 = _local2 + int(levelnumber / 2);
} else if (_root.characterclass == "Wizard") {
_local2 = _local2 + int(levelnumber / 2);
} else if (_root.characterclass == "Thief") {
_local2 = _local2 + levelnumber;
} else if (_root.characterclass == "Dungeon Robber") {
_local2 = _local2 + levelnumber;
}
return(_local2);
}
function levelup() {
var _local7 = getnumber("xp");
var _local6 = yourlevel("level");
var _local2 = getnumber("characterlevel");
var _local5 = 0;
var _local4 = "";
var _local3 = hpbylevel(_local6);
while (_local2 < _local6) {
_local5 = 1;
addnumber("characterlevel", 1);
_local2 = getnumber("characterlevel");
if (_root.characterclass == "Fighter") {
addnumber("attackbonus", 1);
} else if (_root.characterclass == "Cleric") {
if ((getnumber("characterlevel") % 2) == 0) {
addnumber("attackbonus", 1);
}
} else if (_root.characterclass == "Wizard") {
} else if (_root.characterclass == "Thief") {
addnumber("sneakbonus", 1);
} else if (_root.characterclass == "Dungeon Robber") {
}
_local4 = ((((((("<font color=\"#009900\">Congratulations, " + _root.charactername) + ", you level up to level ") + yourlevel("level")) + "! If you retired you'd be a ") + mytitle(yourlevel("title"))) + "! ") + yourlevel("description")) + "</font>";
setnumber("maxhp", _local3);
setnumber("hp", _local3);
_root.hp.hpblood._alpha = 0;
}
if (_local4) {
write(_local4);
}
return(_local5);
}
function teleporttodungeon() {
write("<b>(t)eleport</b> to a random level of the dungeon? It might be a long trip back. <b>(s)kip it?</b>");
add_to_key("t", "reallyteleporttodungeon");
add_to_key("s", "wizard_college");
add_to_key("1", "set_dungeon_destination", 1);
add_to_key("2", "set_dungeon_destination", 2);
add_to_key("3", "set_dungeon_destination", 3);
add_to_key("4", "set_dungeon_destination", 4);
add_to_key("5", "set_dungeon_destination", 5);
add_to_key("6", "set_dungeon_destination", 6);
add_to_key("7", "set_dungeon_destination", 7);
add_to_key("8", "set_dungeon_destination", 8);
add_to_key("9", "set_dungeon_destination", 9);
add_to_key("0", "set_dungeon_destination", 0);
add_to_key("s", "wizard_college");
}
function set_dungeon_destination(dungeondestination) {
_root.dungeondestination = dungeondestination;
teleporttodungeon();
}
function reallyteleporttodungeon() {
var _local3 = Math.ceil(Math.random() * 8) + 1;
var _local2 = Math.ceil(Math.random() * 10);
if (((_root.dungeondestination != null) && (_root.dungeondestination != undefined)) && (_root.dungeondestination > 0)) {
_local2 = _root.dungeondestination;
_root.dungeondestination = null;
}
_root.dungeonmap.village._alpha = 0;
_root.compassrose._alpha = 100;
_root.dungeonlevel._alpha = 100;
_root.roomnumber._alpha = 100;
_root.mapexplanation._x = 181;
setnumber("roomnumber", _local3);
setnumber("dungeonlevel", _local2);
lostme(1);
_root.accomplishments_deepestlevel = _local2;
if (_root.gamemode == "game1") {
savegame(1, "movementphase");
write("Saved game!");
}
movementphase();
}
function explore(nosave) {
_root.fishedout = 0;
if (charsheet._x != -500) {
opencharsheet("close");
}
if (nosave == null) {
nosave = 0;
}
if (nosave == 0) {
addnumber("roomnumber", 1);
if (getnumber("roomnumber") > 10) {
setnumber("roomnumber", 10);
}
}
add_to_master("move_to", "turndirection", 0.25);
_root.oktodomainloop = 1;
add_to_master("roll", "mainloop", 20);
run_master();
}
function useful_items() {
var _local2 = Math.ceil(Math.random() * 100);
if (_root.treasure_finding) {
_local2 = Math.ceil(Math.random() * 5) + 95;
}
var _local5 = 1;
var _local3 = "";
if (_local2 <= 50) {
write("Nothing here.");
_local5 = 0;
} else if (_local2 <= 57) {
_local3 = "furniture";
} else if (_local2 <= 59) {
_local3 = "dagger";
} else if (_local2 <= 61) {
_local3 = "sword";
} else if (_local2 <= 63) {
_local3 = "leather_armor";
} else if (_local2 <= 65) {
_local3 = "shield";
} else if (_local2 <= 67) {
_local3 = "chain_mail";
} else if (_local2 <= 68) {
_local3 = "plate_mail";
} else if (_local2 <= 73) {
_local3 = "food";
} else if (_local2 <= 78) {
var _local4 = Math.ceil(Math.random() * 25);
addmoney("gp", _local4);
write(("<font color='#009900'>You find " + _local4) + " gold coins!</font>");
} else if (_local2 <= 80) {
_local3 = "rapier";
} else if (_local2 <= 82) {
_local3 = "fishing_pole";
} else if (_local2 <= 85) {
_local3 = "statue";
} else if (_local2 <= 86) {
_local3 = "bastard_sword";
} else if (_local2 <= 87) {
var _local4 = Math.ceil(Math.random() * 4);
write(((("<font color='#009900'>You find " + _local4) + " flask") + myplural(_local4)) + " of oil!</font>");
add_equipment("oil_flask", _local4);
} else if (_local2 <= 89) {
_local3 == "food";
} else if (_local2 <= 91) {
_local3 = "sack";
} else if (_local2 <= 93) {
_local3 = "whip";
} else if (_local2 <= 94) {
_local3 = "ten_foot_pole";
} else if (_local2 <= 95) {
_local3 = "healing_potion";
} else if (_local2 <= 99) {
_local3 = valuable_items();
} else if (_local2 <= 100) {
_local3 = magic_items();
}
if (_local3 != "") {
write(("<font color='#009900'>You find " + print_pretty(_local3, 1, "a")) + "!</font>");
add_equipment(_local3);
}
return(_local5);
}
function useless_items() {
var _local2 = "";
var _local1 = Math.ceil(Math.random() * 6);
if (_local1 == 1) {
_local2 = "bad statue";
} else if (_local1 == 1) {
_local2 = "moldy clothes";
} else if (_local1 == 1) {
_local2 = "flawed sword";
} else if (_local1 == 1) {
_local2 = "spoiled food";
} else if (_local1 == 1) {
var _local3 = Math.ceil(Math.random() * 20);
addmoney("cp", _local3);
write(("<font color='#009900'>You find " + _local3) + " copper coins!</font>");
} else if (_local1 == 1) {
var _local3 = Math.ceil(Math.random() * 20);
addmoney("sp", _local3);
write(("<font color='#009900'>You find " + _local3) + " copper coins!</font>");
}
return(_local2);
}
function valuable_items() {
var _local3 = Math.ceil(Math.random() * 10);
if (_root.treasure_finding) {
_local3 = Math.ceil(Math.random() * 3) + 7;
_root.treasure_finding = 0;
}
var _local2 = "";
if (_local3 == 1) {
_local2 = "plate_mail";
} else if (_local3 == 2) {
_local2 = "healing_potion";
} else if (_local3 == 3) {
_local2 = "blessed_symbol";
} else if (_local3 == 4) {
_local2 = "van_helsing_kit";
} else if (_local3 == 5) {
_local2 = "+1_dagger";
} else if (_local3 == 6) {
var _local5 = Math.ceil(Math.random() * 6);
if (_local5 <= 3) {
_local2 = "scroll_of_cure_light_wounds";
} else if (_local5 == 4) {
_local2 = "scroll_of_sanctuary";
} else if (_local5 == 5) {
_local2 = "scroll_of_command";
} else if (_local5 == 6) {
_local2 = "scroll_of_animate_dead";
}
} else if (_local3 == 7) {
var _local5 = Math.ceil(Math.random() * 4);
if (_local5 == 1) {
_local2 = "scroll_of_sleep";
} else if (_local5 == 2) {
_local2 = "scroll_of_charm";
} else if (_local5 == 3) {
_local2 = "scroll_of_magic_missile";
} else if (_local5 == 4) {
_local2 = "scroll_of_haste";
}
} else if (_local3 == 8) {
var _local4 = Math.ceil(Math.random() * 5);
if (_local4 == 1) {
_local2 = "tapestry";
}
if (_local4 == 2) {
_local2 = "gilded_chair";
}
if (_local4 == 3) {
_local2 = "cloth-of-gold_hangings";
}
if (_local4 == 4) {
_local2 = "gold_statue";
}
if (_local4 == 5) {
_local2 = "gold_ewer";
}
} else if (_local3 == 9) {
var _local4 = Math.ceil(Math.random() * 6);
if ((_local4 == 1) || (_local4 == 2)) {
_local2 = "jacinth_of_estimable_beauty";
}
if (_local4 == 3) {
_local2 = "resplendant_sapphire";
}
if (_local4 == 4) {
_local2 = "magnificent_emerald";
}
if (_local4 == 5) {
_local2 = "priceless_ruby";
}
if (_local4 == 6) {
_local2 = "flawless_diamond";
}
} else if (_local3 == 10) {
_local2 = magic_items();
}
return(_local2);
}
function magic_items() {
_root.treasure_finding = 0;
var _local3 = Math.ceil(Math.random() * 20);
var _local2 = "";
if (_local3 == 1) {
_local2 = "+1_sword";
} else if (_local3 == 2) {
_local2 = "+1_mace";
} else if (_local3 == 3) {
_local2 = "+1_leather_armor";
} else if (_local3 == 4) {
_local2 = "+1_plate_mail";
} else if (_local3 <= 6) {
var _local4 = Math.ceil(Math.random() * 6);
if (_local4 <= 3) {
_local2 = "scroll_of_cure_light_wounds";
} else if (_local4 == 4) {
_local2 = "scroll_of_sanctuary";
} else if (_local4 == 5) {
_local2 = "scroll_of_command";
} else if (_local4 == 6) {
_local2 = "scroll_of_animate_dead";
}
} else if (_local3 <= 8) {
var _local4 = Math.ceil(Math.random() * 4);
if (_local4 == 1) {
_local2 = "scroll_of_sleep";
} else if (_local4 == 2) {
_local2 = "scroll_of_charm";
} else if (_local4 == 3) {
_local2 = "scroll_of_magic_missile";
} else if (_local4 == 4) {
_local2 = "scroll_of_haste";
}
} else if (_local3 <= 10) {
_local2 = "healing_potion";
} else if (_local3 == 11) {
if ((_root.weapon == "dagger") || (_root.weapon == "+1_dagger")) {
_local2 = "-1_dagger";
} else if ((_root.weapon == "bludgeon") || (_root.weapon == "+1_mace")) {
_local2 = "-1_mace";
} else {
_local2 = "-1_sword";
}
} else if (_local3 == 12) {
_local2 = "bracers_AC_14";
} else if (_local3 == 13) {
_local2 = "wand_of_magic_missiles";
} else if (_local3 == 14) {
_local2 = "gauntlets_of_ogre_power";
} else if (_local3 == 15) {
_local2 = "boots_of_elvenkind";
} else if (_local3 == 16) {
_local2 = "potion_of_treasure_finding";
} else if (_local3 == 17) {
_local2 = "ring_of_invisibility";
} else if (_local3 == 18) {
_local2 = "ring_of_protection";
} else if (_local3 == 19) {
_local2 = "quickness_potion";
} else if (_local3 == 20) {
_local2 = "libram_of_improvement";
}
if (_local2) {
_root.accomplishments_magicitem = _local2;
}
return(_local2);
}
function use_item(itemnumber) {
var _local2 = _root.possessions[itemnumber - 1][0];
var _local4 = _root.possessions[itemnumber - 1][1];
if (_root.characterclass == "Fighter") {
if (_root.itemlist[_local2].fighter == 0) {
write(print_pretty(_local2, 0, "a") + " cannot be equipped by fighters.");
return(undefined);
}
} else if (_root.characterclass == "Thief") {
if (_root.itemlist[_local2].thief == 0) {
write(print_pretty(_local2, 0, "a") + " cannot be equipped by thieves.");
return(undefined);
}
} else if (_root.characterclass == "Wizard") {
if (_root.itemlist[_local2].wizard == 0) {
write(print_pretty(_local2, 0, "a") + " cannot be equipped by wizards.");
return(undefined);
}
} else if (_root.characterclass == "Cleric") {
if (_root.itemlist[_local2].cleric == 0) {
write(print_pretty(_local2, 0, "a") + " cannot be equipped by clerics.");
return(undefined);
}
}
if (_root.cursed[_local2] > 0) {
var _local5 = Math.ceil(Math.random() * _local4);
if (_local5 <= _root.cursed[_local2]) {
write("Oh no, it's cursed!");
_root.cursed[_local2]--;
add_equipment(_local2, -1);
var _local3 = 0;
while (_local3 < 100) {
if ((_root.itemlist[_local3].fake != null) && (_root.itemlist[_local3].fake == _local2)) {
_local2 = _root.itemlist[_local3].itemname;
add_equipment(_local2, 1, 1);
break;
}
_local3++;
}
}
}
if ((((((((((((_local2 == "dagger") || (_local2 == "+1_dagger")) || (_local2 == "-1_dagger")) || (_local2 == "bludgeon")) || (_local2 == "+1_mace")) || (_local2 == "-1_mace")) || (_local2 == "sword")) || (_local2 == "bastard_sword")) || (_local2 == "+1_sword")) || (_local2 == "-1_sword")) || (_local2 == "whip")) || (_local2 == "rapier")) {
if ((_root.intown != 1) && (((_root.weapon == "-1_dagger") || (_root.weapon == "-1_mace")) || (_root.weapon == "-1_sword"))) {
write("Cannot put away your cursed weapon while in the dungeon!");
return(undefined);
}
readyitem(_local2);
if (_local2 == _root.weapon) {
write(("<font color=\"#666666\">Equipped " + print_pretty(_local2)) + ".</font>");
} else {
write(("<font color=\"#666666\">Stowed " + print_pretty(_local2)) + ".</font>");
}
} else if (((((((_local2 == "leather_armor") || (_local2 == "+1_leather_armor")) || (_local2 == "chain_mail")) || (_local2 == "+1_chain_mail")) || (_local2 == "plate_mail")) || (_local2 == "+1_plate_mail")) || (_local2 == "bracers_AC_14")) {
if ((_root.intown != 1) && (((_root.weapon == "-1_leather_armor") || (_root.weapon == "-1_chain_mail")) || (_root.weapon == "-1_plate_mail"))) {
write("Cannot put away your cursed armor while in the dungeon!");
return(undefined);
}
readyitem(_local2);
if (_local2 == _root.armor) {
write(("<font color=\"#666666\">Equipped " + print_pretty(_local2)) + ".</font>");
} else {
write(("<font color=\"#666666\">Stowed " + print_pretty(_local2)) + ".</font>");
}
} else if ((_local2 == "shield") || (_local2 == "+1_shield")) {
if ((_root.intown != 1) && (_root.weapon == "-1_shield")) {
write("Cannot put away your cursed shield while in the dungeon!");
return(undefined);
}
readyitem(_local2);
if (_local2 == _root.shield) {
write(("<font color=\"#666666\">Equipped " + print_pretty(_local2)) + ".</font>");
} else {
write(("<font color=\"#666666\">Stowed " + print_pretty(_local2)) + ".</font>");
}
} else if (_root.itemlist[_local2].readyable == 1) {
readyitem(_local2);
} else if (_local2 == "furniture") {
write("You break the furniture. One of the pieces would make an effective bludgeon.");
add_equipment("furniture", -1);
add_equipment("bludgeon", 1);
}
}
function drop_item(itemnumber) {
var _local2 = _root.possessions[itemnumber - 1][0];
itemnumber = _root.possessions[itemnumber - 1][1];
if (_local2 == undefined) {
return(undefined);
}
if (_root.intown != 1) {
if (_root.itemlist[_local2].fake) {
if ((((_root.weapon == _local2) || (_root.armor == _local2)) || (_root.shield == _local2)) || (_root.readied[_local2] == 1)) {
write("Cannot drop a cursed item while in the dungeon!");
return(undefined);
}
}
}
_root.charsheet.reallydrop._alpha = 100;
if (_root.instore == 1) {
_root.charsheet.reallydrop.reallydrop.text = ((("Sell " + print_pretty(_local2)) + " for ") + _root.itemlist[_local2].sell) + " GP?";
} else {
_root.charsheet.reallydrop.reallydrop.text = ("Really drop " + print_pretty(_local2)) + "?";
}
_root.reallydropitemname = _local2;
var _local3 = 0;
while (_local3 < 20) {
if (_root.possessions[_local3][0] == _local2) {
itemnum = _root.possessions[_local3][1];
}
_local3++;
}
if ((_root.itemlist[_local2] == null) || (_root.itemlist[_local2] == undefined)) {
return(undefined);
}
if (((_root.itemlist[_local2].junk == 1) || (!usable_by_class(_root.itemlist[_local2]))) && (_root.instore == 1)) {
_root.charsheet.reallydrop.sellall._alpha = 100;
_root.charsheet.reallydrop.sellall.sellall.text = "sell vendor trash";
_root.charsheet.reallydrop.sellall.onPress = function () {
if (_root.instore != 1) {
return(undefined);
}
var _local5 = _root.reallydropitemname;
var _local4 = 0;
var _local2 = 20;
while (_local2 >= 0) {
var _local3 = _root.possessions[_local2][0];
if (_root.itemlist[_local3].junk || (!usable_by_class(_root.itemlist[_local3]))) {
if (_root.itemlist[_local3].sell > 0) {
_local4 = _local4 + (_root.itemlist[_local3].sell * _root.possessions[_local2][1]);
add_equipment(_local3, _root.possessions[_local2][1] * -1);
}
}
_local2--;
}
write(("Made " + _local4) + " GP from selling treasures found in the dungeon.");
addmoney("gp", _local4);
_root.charsheet.reallydrop.reallydrop.text = "";
_root.charsheet.reallydrop.yes.onPress = function () {
};
_root.charsheet.reallydrop.no.onPress = function () {
};
_root.charsheet.reallydrop.sellall.onPress = function () {
};
_root.charsheet.reallydrop._alpha = 0;
};
} else if ((itemnum > 1) && (_root.instore == 1)) {
_root.charsheet.reallydrop.sellall._alpha = 100;
_root.charsheet.reallydrop.sellall.sellall.text = "Sell all " + itemnum;
_root.charsheet.reallydrop.sellall.onPress = function () {
if (_root.instore != 1) {
return(undefined);
}
var _local3 = _root.reallydropitemname;
var _local4 = 0;
var _local2 = 0;
while (_local2 < 20) {
if (_root.possessions[_local2][0] == _local3) {
_local4 = _root.possessions[_local2][1];
}
_local2++;
}
var _local5 = 0;
_local5 = _root.itemlist[_local3].sell * _local4;
if ((_root.itemlist[_local3].readyable == 1) && ((((_root.weapon == _local3) || (_root.armor == _local3)) || (_root.shield == _local3)) || (_root.readied[_local3] == 1))) {
readyitem(_local3);
}
if (_root.cursed[_local3] > 0) {
write("Got some cursed stuff there. I'll buy it for a reduced price.");
_local5 = _local5 - (_root.itemlist[_local3].sell * _root.cursed[_local3]);
_local5 = _local5 + _root.cursed[_local3];
_root.cursed[_local3] = 0;
}
addmoney("gp", _local5);
add_equipment(_local3, -1 * _local4);
write(((((("Sold " + _local4) + " ") + print_pretty(_local3)) + " for ") + _local5) + " GP.");
_root.charsheet.reallydrop.reallydrop.text = "";
_root.charsheet.reallydrop.yes.onPress = function () {
};
_root.charsheet.reallydrop.no.onPress = function () {
};
_root.charsheet.reallydrop.sellall.onPress = function () {
};
_root.charsheet.reallydrop._alpha = 0;
};
} else {
_root.charsheet.reallydrop.sellall._alpha = 0;
_root.charsheet.reallydrop.sellall.onPress = function () {
};
}
_root.charsheet.reallydrop.yes.onPress = function () {
var _local2 = _root.reallydropitemname;
var _local4 = 0;
var _local3 = 0;
while (_local3 < 20) {
if (_root.possessions[_local3][0] == _local2) {
_local4 = _root.possessions[_local3][1];
}
_local3++;
}
_root.reallydropitemname = "";
if (_root.cursed[_local2] > 0) {
var _local6 = Math.ceil(Math.random() * _local4);
if (_local6 <= _root.cursed[_local2]) {
var _local7 = 1;
_root.cursed[_local2]--;
}
}
if (((_local4 == 1) && (_root.itemlist[_local2].readyable == 1)) && ((((_root.weapon == _local2) || (_root.armor == _local2)) || (_root.shield == _local2)) || (_root.readied[_local2] == 1))) {
readyitem(_local2);
}
var _local5 = _local2;
if (_root.instore == 1) {
if (_local7 == 1) {
_local3 = 0;
while (_local3 < 100) {
if ((_root.itemlist[_local3].fake != null) && (_root.itemlist[_local3].fake == _local2)) {
_local2 = _root.itemlist[_local3].itemname;
write(((("Hey, this is " + print_pretty(_local2, 0, "a")) + "! I'll only give you ") + _root.itemlist[_local2].sell) + " GP for it.");
addmoney("gp", _root.itemlist[_local2].sell);
break;
}
_local3++;
}
} else {
write(((("Sold " + print_pretty(_local2)) + " for ") + _root.itemlist[_local2].sell) + " GP.");
addmoney("gp", _root.itemlist[_local2].sell);
}
} else {
write(("<font color=\"#666666\">Dropped " + print_pretty(_local2)) + ".</font>");
}
add_equipment(_local5, -1, 1);
_root.charsheet.reallydrop.reallydrop.text = "";
_root.charsheet.reallydrop.yes.onPress = function () {
};
_root.charsheet.reallydrop.no.onPress = function () {
};
_root.charsheet.reallydrop.sellall.onPress = function () {
};
_root.charsheet.reallydrop._alpha = 0;
};
_root.charsheet.reallydrop.no.onPress = function () {
_root.charsheet.reallydrop.reallydrop.text = "";
_root.charsheet.reallydrop.yes.onPress = function () {
};
_root.charsheet.reallydrop.no.onPress = function () {
};
_root.charsheet.reallydrop.sellall.onPress = function () {
};
_root.charsheet.reallydrop._alpha = 0;
};
}
function readyitem(thing) {
var ac = 10;
weaponplus = 0;
sneakbonus = 0;
attackbonus = 0;
var thistype = "";
var old_weapon = _root.weapon;
var old_armor = _root.armor;
var old_shield = _root.shield;
var takeoff = 0;
if ((((thing != "") && (thing != null)) && (thing != undefined)) && (((thing == old_weapon) || (thing == old_armor)) || (thing == old_shield))) {
takeoff = 1;
}
if (_root.readied[thing] == 1) {
takeoff = 1;
}
if (thing == "dagger") {
_root.weapon = "dagger";
thistype = "weapon";
}
if (thing == "+1_dagger") {
_root.weapon = "+1_dagger";
thistype = "weapon";
}
if (thing == "-1_dagger") {
_root.weapon = "-1_dagger";
thistype = "weapon";
}
if (thing == "whip") {
_root.weapon = "whip";
thistype = "weapon";
}
if (thing == "bludgeon") {
_root.weapon = "bludgeon";
thistype = "weapon";
}
if (thing == "+1_mace") {
_root.weapon = "+1_mace";
thistype = "weapon";
}
if (thing == "-1_mace") {
_root.weapon = "-1_mace";
thistype = "weapon";
}
if (thing == "sword") {
_root.weapon = "sword";
thistype = "weapon";
}
if (thing == "bastard_sword") {
_root.weapon = "bastard_sword";
thistype = "weapon";
}
if (thing == "rapier") {
_root.weapon = "rapier";
thistype = "weapon";
}
if (thing == "+1_sword") {
_root.weapon = "+1_sword";
thistype = "weapon";
}
if (thing == "-1_sword") {
_root.weapon = "-1_sword";
thistype = "weapon";
}
if (thing == "leather_armor") {
_root.armor = "leather_armor";
thistype = "armor";
}
if (thing == "+1_leather_armor") {
_root.armor = "+1_leather_armor";
thistype = "armor";
}
if (thing == "chain_mail") {
_root.armor = "chain_mail";
thistype = "armor";
}
if (thing == "+1_chain_mail") {
_root.armor = "+1_chain_mail";
thistype = "armor";
}
if (thing == "plate_mail") {
_root.armor = "plate_mail";
thistype = "armor";
}
if (thing == "+1_plate_mail") {
_root.armor = "+1_plate_mail";
thistype = "armor";
}
if (thing == "bracers_AC_14") {
_root.armor = "bracers_AC_14";
thistype = "armor";
}
if (thing == "shield") {
_root.shield = "shield";
thistype = "shield";
}
if (thing == "+1_shield") {
_root.shield = "+1_shield";
thistype = "shield";
}
if (_root.weapon == "dagger") {
_root.weapondamage = 4;
weaponplus = 0;
}
if (_root.weapon == "+1_dagger") {
_root.weapondamage = 4;
weaponplus = 1;
attackbonus++;
}
if (_root.weapon == "-1_dagger") {
_root.weapondamage = 4;
weaponplus = -1;
attackbonus--;
}
if (_root.weapon == "whip") {
_root.weapondamage = 3;
weaponplus = 0;
}
if (_root.weapon == "bludgeon") {
_root.weapondamage = 6;
weaponplus = 0;
}
if (_root.weapon == "+1_mace") {
_root.weapondamage = 6;
weaponplus = 1;
attackbonus++;
}
if (_root.weapon == "-1_mace") {
_root.weapondamage = 6;
weaponplus = -1;
attackbonus--;
}
if (_root.weapon == "sword") {
_root.weapondamage = 8;
weaponplus = 0;
}
if (_root.weapon == "bastard_sword") {
_root.weapondamage = 10;
weaponplus = 0;
}
if (_root.weapon == "rapier") {
_root.weapondamage = 8;
weaponplus = 0;
}
if (_root.weapon == "+1_sword") {
_root.weapondamage = 8;
weaponplus = 1;
attackbonus++;
}
if (_root.weapon == "-1_sword") {
_root.weapondamage = 8;
weaponplus = -1;
attackbonus--;
}
if ((takeoff == 1) && (((thistype == "weapon") || (thistype == "armor")) || (thistype == "shield"))) {
thing = "";
}
if (((thing == "") && (thistype == "weapon")) || (thing == "fists")) {
_root.weapon = "fists";
_root.weapondamage = 1;
_root.weaponplus = 0;
_root.attackbonus = 0;
}
if ((thing == "") && (thistype == "armor")) {
_root.armor = "clothing";
}
if ((thing == "") && (thistype == "shield")) {
_root.shield = "";
}
if (thistype == "weapon") {
n = 0;
while (n < 15) {
if (_root.possessions[n][0] == old_weapon) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.normtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Equip";
}
n++;
}
} else if (thistype == "armor") {
n = 0;
while (n < 15) {
if (_root.possessions[n][0] == old_armor) {
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Equip";
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.normtxt);
}
n++;
}
} else if (thistype == "shield") {
n = 0;
while (n < 15) {
if (_root.possessions[n][0] == old_shield) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.normtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Equip";
}
n++;
}
} else if (takeoff == 1) {
n = 0;
while (n < 15) {
if (_root.possessions[n][0] == thing) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.normtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Equip";
}
n++;
}
_root.readied[thing] = 0;
} else {
n = 0;
while (n < 15) {
if ((thing != undefined) && (_root.possessions[n][0] == thing)) {
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Stow";
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.boldtxt);
}
n++;
}
_root.readied[thing] = 1;
}
if (takeoff == 0) {
n = 0;
while (n < 15) {
if ((thing != undefined) && (_root.possessions[n][0] == thing)) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.boldtxt);
eval (("_root.charsheet.use" + (n + 1)) + ".equiptext").text = "Stow";
}
n++;
}
}
if ((thing == "rapier") || (_root.weapon == "rapier")) {
weaponplus = weaponplus + dexbonus();
var strdexbonus = dexbonus();
} else {
weaponplus = weaponplus + strbonus();
var strdexbonus = strbonus();
}
if (weapondamage == 1) {
_root.charsheet.weapondamage.text = weapondamage + weaponplus;
} else {
_root.charsheet.weapondamage.text = "1d" + weapondamage;
if (weaponplus) {
_root.charsheet.weapondamage.text = _root.charsheet.weapondamage.text + ("+" + weaponplus);
}
}
attackbonus = attackbonus + ((strdexbonus + levelbonus("fighter")) + levelbonus("cleric", 2));
_root.weaponplus = weaponplus;
setnumber("attackbonus", attackbonus);
_root.sneakbonus = _root.sneakbonus + (dexbonus() + levelbonus("thief"));
if (_root.readied.boots_of_elvenkind == 1) {
_root.sneakbonus++;
}
if (_root.readied.ring_of_invisibility == 1) {
_root.sneakbonus = _root.sneakbonus + 2;
}
setnumber("sneakbonus", sneakbonus);
if (_root.armor == "leather_armor") {
ac = 12;
}
if (_root.armor == "chain_mail") {
ac = 14;
}
if (_root.armor == "plate_mail") {
ac = 16;
}
if (_root.armor == "+1_leather_armor") {
ac = 13;
}
if (_root.armor == "+1_chain_mail") {
ac = 15;
}
if (_root.armor == "+1_plate_mail") {
ac = 17;
}
if (_root.armor == "bracers_AC_14") {
ac = 14;
}
if (_root.shield == "shield") {
ac = ac + 1;
}
if (_root.shield == "+1_shield") {
ac = ac + 2;
}
if (_root.readied.ring_of_protection == 1) {
ac = ac + 1;
}
ac = ac + dexbonus();
setnumber("ac", ac);
}
function has_item(itemname, number) {
if (number == null) {
number = 0;
}
n = 0;
while (n < 15) {
if (_root.possessions[n][0] == itemname) {
if (number) {
return(_root.possessions[n][1]);
}
return(1);
}
n++;
}
return(0);
}
function has_usable_item() {
if (has_item("oil_flask")) {
return(1);
}
if (has_item("healing_potion")) {
return(1);
}
if (has_item("blessed_symbol")) {
return(1);
}
if (has_item("van_helsing_kit")) {
return(1);
}
if (has_item("wand_of_magic_missiles")) {
return(1);
}
if (has_item("quickness_potion")) {
return(1);
}
if (has_item("scroll_of_animate_dead")) {
return(1);
}
if (has_item("scroll_of_cure_light_wounds")) {
return(1);
}
if (has_item("scroll_of_charm")) {
return(1);
}
if (has_item("scroll_of_command")) {
return(1);
}
if (has_item("scroll_of_haste")) {
return(1);
}
if (has_item("scroll_of_magic_missile")) {
return(1);
}
if (has_item("scroll_of_sanctuary")) {
return(1);
}
if (has_item("scroll_of_sleep")) {
return(1);
}
return(0);
}
function has_usable_noncombat_item() {
if (has_item("healing_potion")) {
return(1);
}
if (has_item("scroll_of_cure_light_wounds")) {
return(1);
}
if (has_item("libram_of_improvement")) {
return(1);
}
if (has_item("amulet_of_recall")) {
return(1);
}
if (has_item("potion_of_treasure_finding")) {
return(1);
}
return(0);
}
function drop(itemname) {
var _local2 = Math.ceil(Math.random() * 10);
if (itemname == "money") {
pay(getnumber("dungeonlevel") * 10, "You drop");
if (monster_has_tag("intelligent")) {
if (monster_has_tag("greedy")) {
_local2 = 5;
}
if ((_local2 == 1) || (monster_has_tag("relentless"))) {
write(("The " + _root.monstername) + " keeps chasing you, perhaps hoping to get the rest of your money.");
} else {
write(("The " + _root.monstername) + " stops to pick up the glittering valuables.");
clear_monster();
}
} else if ((_local2 < 10) || (monster_has_tag("relentless"))) {
write(("The " + _root.monstername) + " doesn't appear to value money! It keeps chasing you.");
} else {
write(("The " + _root.monstername) + " stops, distracted by the shiny coins.");
clear_monster();
}
} else if (itemname == "oil") {
add_equipment("oil_flask", -1);
if (monster_has_tag("fiery")) {
write(("The " + _root.monstername) + " pursues you right through the wall of fire.");
} else {
write("The monster stops, foiled, on the other side of the pool of flaming oil.");
clear_monster();
}
} else if (itemname == "food") {
add_equipment("food", -1);
if (monster_has_tag("intelligent")) {
if ((_local2 < 10) || (monster_has_tag("relentless"))) {
write(("The " + _root.monstername) + " ignores the dropped food and keeps chasing you, intent on loot.");
} else {
write(("The " + _root.monstername) + " stops to pick up the food.");
clear_monster();
}
} else if ((_local2 == 1) || (monster_has_tag("relentless"))) {
write(("The " + _root.monstername) + " must think you'll be more delicious! It keeps chasing you.");
} else {
write(("The " + _root.monstername) + " stops and eats the food you dropped.");
clear_monster();
}
}
wander();
}
function add_holder(holdername) {
if (_root.holder != "sack") {
_root.holder = holdername;
}
_root.charsheet.myholder.text = _root.holder;
if (is_heavy()) {
_root.heavy = 1;
} else {
_root.heavy = 0;
}
}
function add_equipment(equip, equipnumber, forreals) {
if (_root.itemlist[equip] == undefined) {
if (equip != undefined) {
if (equip != "fists") {
write(("Tried to add " + equip) + " but failed! Email this bug to paul@blogofholding.com!");
return(undefined);
}
}
}
if (equip == "sack") {
add_holder("sack");
return(undefined);
}
if ((equipnumber == 0) || (equipnumber == null)) {
equipnumber = 1;
}
if (equip == "iron_rations_(10_food)") {
equip = "food";
equipnumber = equipnumber * 10;
}
if (forreals == null) {
forreals = 0;
}
if (forreals != 1) {
if (_root.itemlist[equip].fake) {
equip = _root.itemlist[equip].fake;
if (_root.cursed[equip] == null) {
_root.cursed[equip] = 0;
}
_root.cursed[equip] = _root.cursed[equip] + equipnumber;
}
}
var ownone = 0;
var n = 0;
while (n < 15) {
if (_root.possessions[n][0] == equip) {
ownone = 1;
_root.possessions[n][1] = _root.possessions[n][1] + equipnumber;
if (_root.possessions[n][1] < 1) {
_root.possessions[n] = null;
}
}
n++;
}
if (!ownone) {
var gotit = 0;
if (equipnumber > 0) {
var n = 0;
while (n < 15) {
if (_root.possessions[n] == null) {
if (gotit == 0) {
var myitem = new Array();
myitem.push(equip);
myitem.push(equipnumber);
_root.possessions[n] = myitem;
gotit = 1;
}
}
n++;
}
}
if ((gotit == 0) && (equipnumber > 0)) {
write("Backpack is full. Had to drop this item.");
}
}
var newpossessions = new Array();
for (var q in _root.possessions) {
if (((_root.possessions[q] != null) && (_root.possessions[q] != "null")) && (_root.possessions[q] != undefined)) {
newpossessions.push(_root.possessions[q]);
}
}
_root.possessions = newpossessions;
_root.possessions.sort(itemsort);
n = 0;
while (n < 15) {
if ((_root.itemlist[_root.possessions[n][1]].readyable == 1) && (usable_by_class(_root.possessions[n][1]))) {
if ((((_root.armor == _root.possessions[n][1]) || (_root.weapon == _root.possessions[n][1])) || (_root.shield == _root.possessions[n][1])) || (_root.readied[_root.possessions[n][1]] == 1)) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.boldtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Stow";
} else {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.normtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Equip";
}
}
n++;
}
if (_root.possessions[13]) {
write("<font color=\"#ff0000\">You have too many possessions! You must drop or sell some before you do anything else.</font>");
if (charsheet._x == -500) {
opencharsheet();
}
_root.overburdened = 1;
} else {
_root.overburdened = 0;
}
if (is_heavy()) {
_root.heavy = 1;
} else {
_root.heavy = 0;
}
n = 0;
while (n < 15) {
if (((_root.possessions[n][1] > 0) && (_root.possessions[n][1] != null)) && (_root.possessions[n][1] != undefined)) {
var openfont = "";
var closefont = "";
eval ("_root.charsheet.possessions" + (n + 1)).text = (_root.possessions[n][1] + " ") + print_pretty(_root.possessions[n][0]);
var itemtype = eval ("_root.charsheet.possessions" + (n + 1)).text;
var item_array = itemtype.split(" ");
item_array.shift();
itemtype = item_array.join("_");
eval ("_root.charsheet.use" + (n + 1))._alpha = 0;
if (_root.itemlist[itemtype].readyable == 1) {
eval ("_root.charsheet.use" + (n + 1))._alpha = 100;
}
eval ("_root.charsheet.drop" + (n + 1))._alpha = 100;
if ((((itemtype == _root.weapon) || (itemtype == _root.armor)) || (itemtype == _root.shield)) || (_root.readied[itemtype] == 1)) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.boldtxt);
eval ("_root.charsheet.use" + (n + 1)).equiptext.text = "Stow";
}
if ((!usable_by_class(_root.itemlist[_root.possessions[n][0]])) || (_root.itemlist[_root.possessions[n][0]].junk == 1)) {
if (n <= 12) {
eval ("_root.charsheet.possessions" + (n + 1)).setTextFormat(_root.greytxt);
}
}
} else {
eval ("_root.charsheet.possessions" + (n + 1)).text = "";
eval ("_root.charsheet.use" + (n + 1))._alpha = 0;
eval ("_root.charsheet.drop" + (n + 1))._alpha = 0;
}
n++;
}
}
function print_pretty(mytext, lieok, printmode) {
if (((lieok == undefined) || (lieok == null)) || (lieok == "")) {
lieok = 0;
}
if (((printmode == undefined) || (printmode == null)) || (printmode == "")) {
printmode = 0;
}
if (((_root.itemlist[mytext].fake != undefined) && (_root.itemlist[mytext].fake != null)) && (_root.itemlist[mytext].fake != "")) {
if (lieok == 1) {
mytext = _root.itemlist[mytext].fake;
}
}
mytext = mytext.split("_").join(" ");
if (printmode == "a") {
if (((((((mytext != "food") && (mytext != "furniture")) && (mytext != "leather armor")) && (mytext != "chain mail")) && (mytext != "plate mail")) && (mytext != "+1 chain mail")) && (mytext != "+1 plate mail")) {
var _local3 = mytext.charAt(0).toUpperCase();
if (((((_local3 == "A") || (_local3 == "E")) || (_local3 == "I")) || (_local3 == "O")) || (_local3 == "U")) {
mytext = "an " + mytext;
} else {
mytext = "a " + mytext;
}
}
}
return(mytext);
}
function itemsort(a, b) {
if (a == null) {
return(1);
}
if (b == null) {
return(-1);
}
var _local1 = a[0];
var _local2 = b[0];
_local1 = _local1.toUpperCase();
_local2 = _local2.toUpperCase();
if (_local1 > _local2) {
return(1);
}
if (_local1 < _local2) {
return(-1);
}
return(0);
}
function fish() {
var writestring = "";
writestring = writestring + "Fishing roll: d20";
var fishy = Math.ceil(Math.random() * 20);
if (has_item("+2_fishing_pole")) {
fishy = fishy + 2;
writestring = writestring + " +2";
} else if (has_item("+1_fishing_pole")) {
fishy++;
writestring = writestring + " +1";
} else if (has_item("fishing_pole")) {
fishy = fishy + 0;
writestring = writestring + "";
} else if (has_item("ten_foot_pole")) {
fishy--;
writestring = writestring + " -1";
}
writestring = writestring + ((": " + fishy) + "!\n");
if (fishy <= 2) {
writestring = writestring + "You hooked a sea monster!";
setnumber("monsterhp", Math.ceil(Math.random() * 4));
addnumber("monsterhp", getnumber("dungeonlevel"));
setnumber("monstermaxhp", getnumber("monsterhp"));
setnumber("monsterac", 15);
_root.monstername = "Sea Monster";
_root.monsternumber = 5;
_root.monsterhd = 5;
var tags = new Object();
tags.unintelligent = 1;
tags.immobile = 1;
_root.monstertags = tags;
_root.monsterwhite.monster5_5white._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
write(writestring);
attack(0, 1);
return(undefined);
}
if (fishy <= 4) {
writestring = writestring + "This area is fished out.";
_root.fishedout = 1;
} else if (fishy <= 8) {
writestring = writestring + "You didn't catch anything this time.";
} else if (fishy <= 10) {
writestring = writestring + "There was a nibble, but you didn't reel anything in.";
} else if (fishy <= 12) {
var crap = Math.ceil(Math.random() * 10);
if (crap == 1) {
writestring = writestring + "You hook an old shoe. You throw it away.";
}
if (crap == 2) {
writestring = writestring + "Your hook gets caught on a stick. You clear it.";
}
if (crap == 3) {
writestring = writestring + "You catch the bloated body of a dead adventurer. Stripped of all valuables.";
}
if (crap == 4) {
writestring = writestring + "You catch a poison eel. You throw it back.";
}
if (crap == 5) {
writestring = writestring + "You catch a message in a bottle. ";
var note = Math.ceil(Math.random() * 12);
if (note == 1) {
writestring = writestring + "It's water-damaged and illegible.";
}
if (note == 2) {
writestring = writestring + "It's in Goblin. Can't read it.";
}
if (note == 3) {
writestring = writestring + "It's from an adventurer stuck on an island on Level 8. Dated two years ago.";
}
if (note == 4) {
writestring = writestring + "It's a priceless work of poetry! You could sell that.";
add_equipment("priceless_poetry");
}
if (note == 5) {
writestring = writestring + "It says 'Re:Re:Re:>>>>>18 reasons why fishing is better than sex'. The rest is illegible.";
}
if (note == 6) {
writestring = writestring + "It says, 'This underground river flows to a sunless sea, where ships ply black waters carrying grim and unspeakable cargoes. If you get this note, please send me one grim cargo.' An address follows.";
}
if (note == 7) {
writestring = writestring + "A map of a dungeon. A different dungeon.";
}
if (note == 8) {
writestring = writestring + "A treasure map to an area many leagues away. Someday, if you ever travel far from home, this may be useful.";
_root.treasuremap = 1;
}
if (note == 9) {
writestring = writestring + "A recipe for braised cave fish with fennel.";
}
if (note == 10) {
writestring = writestring + "A letter from someone named Serpenticor to someone named Jezamel. 'Though we duel on the morrow, you have already pierced my heart with burning arrows of love.'";
}
if (note == 11) {
writestring = writestring + "A letter from someone named Jezamel to someone named Serpenticor. 'Tomorrow I shall kill you in single combat, and in doing so I will kill my own heart, for no dragon's flame burns hotter than my love for you.'";
}
if (note == 12) {
writestring = writestring + "Make 5 copies of this letter and put them in bottles. A halfling who did so found 1250 copper pieces. A dwarf who failed to do so fell in a spiked pit.";
}
}
if (crap == 6) {
writestring = writestring + "You nearly break your fishing rod pulling in a rock. You wade in to free your hook.";
}
if (crap == 7) {
writestring = writestring + "A rusty old helmet, sized for a goblin. Not even worth a copper. You throw it away.";
}
if (crap == 8) {
writestring = writestring + "Something nibbles off your bait and swims away.";
}
if (crap == 9) {
writestring = writestring + "You catch a skull. You throw it away.";
}
if (crap == 10) {
writestring = writestring + "Your hook snags some waterlogged cloth.";
}
} else if (fishy <= 16) {
writestring = writestring + "You caught a blind cave fish! Yum!";
add_equipment("food");
} else if (fishy == 17) {
writestring = writestring + "You caught a subterranean salmon! Big enough for two meals!";
add_equipment("food", 2);
} else if (fishy == 18) {
writestring = writestring + "You caught a giant cave lobster! Plenty of eating on those!";
add_equipment("food", 3);
} else if (fishy == 19) {
if (!useful_items()) {
writestring = writestring + "You caught something, but it came loose and drifted downriver. Bet it was good.";
}
} else if (((fishy == 20) && (!has_item("+1_fishing_pole"))) && (!has_item("+2_fishing_pole"))) {
writestring = writestring + "Among the bones of a previous angler, you dredge up a beautiful +1 fishing pole!";
add_equipment("+1_fishing_pole");
} else if ((fishy == 21) && (!has_item("+2_fishing_pole"))) {
writestring = writestring + "You pull up an exquisite +2 fishing pole! You are now a compleat angler.";
add_equipment("+2_fishing_pole");
} else if (fishy <= 30) {
var equip = valuable_items();
if (equip != "") {
write(("You find " + print_pretty(equip)) + "!");
add_equipment(equip);
}
}
if (_root.fishedout != 1) {
writestring = writestring + " <b>(c)ast</b> your line again?";
add_to_key("c", "fish");
}
writestring = writestring + " <b>(s)top</b> fishing?";
write(writestring);
if (_root.monstersource == "deadend1") {
add_to_key("s", "dead_end", 1);
}
if (_root.monstersource == "deadend2") {
add_to_key("s", "dead_end", 2);
}
if (_root.monstersource == "deadend4") {
add_to_key("s", "dead_end", 4);
}
if (_root.monstersource == "deadend5") {
add_to_key("s", "dead_end", 5);
}
}
function fight(monster, nochoosefight) {
if (_root.combatround == 0) {
write(monster + "!");
}
if (_root.gamemode == "build") {
return(undefined);
}
var hitdice = 1;
var monsternumber = 0;
_root.stunned = 0;
var tags = new Object();
if (monster == "Kobold") {
hitdice = 1;
monsternumber = 1;
tags.intelligent = 1;
tags.armed = 1;
tags.weak = 1;
}
if (monster == "Fire Beetle") {
hitdice = 1;
monsternumber = 2;
tags.unintelligent = 1;
tags.glands = 1;
}
if (monster == "Giant Rat") {
hitdice = 1;
monsternumber = 3;
tags.unintelligent = 1;
tags.weak = 1;
}
if (monster == "Skeleton") {
hitdice = 1;
monsternumber = 4;
tags.unintelligent = 1;
tags.relentless = 1;
tags.armed = 1;
tags.undead = 1;
tags.mindless = 1;
}
if (monster == "Centipede") {
hitdice = 2;
monsternumber = 1;
tags.unintelligent = 1;
}
if (monster == "Orc") {
hitdice = 2;
monsternumber = 2;
tags.intelligent = 1;
tags.armed = 1;
}
if (monster == "Troglodyte") {
hitdice = 2;
monsternumber = 3;
tags.intelligent = 1;
tags.armed = 1;
tags.nauseating = 1;
}
if (monster == "Bugbear") {
hitdice = 2;
monsternumber = 4;
tags.intelligent = 1;
tags.armed = 1;
tags.alert = 1;
}
if (monster == "Bandit") {
hitdice = 3;
monsternumber = 1;
tags.intelligent = 1;
tags.armed = 1;
tags.greedy = 1;
}
if (monster == "Ear Seeker") {
hitdice = 3;
monsternumber = 2;
tags.unintelligent = 1;
tags.immobile = 1;
tags.ambush = 1;
}
if (monster == "Piercer") {
hitdice = 3;
monsternumber = 3;
tags.unintelligent = 1;
tags.immobile = 1;
tags.ambush = 1;
}
if (monster == "Giant Toad") {
hitdice = 3;
monsternumber = 4;
tags.unintelligent = 1;
tags.sticky = 1;
}
if (monster == "Hobgoblin") {
hitdice = 4;
monsternumber = 1;
tags.intelligent = 1;
tags["well-armed"] = 1;
}
if (monster == "Shrieker") {
hitdice = 4;
monsternumber = 2;
tags.unintelligent = 1;
tags.passive = 1;
tags.loud = 1;
tags.immobile = 1;
}
if (monster == "Giant Spider") {
hitdice = 4;
monsternumber = 3;
tags.unintelligent = 1;
tags.sticky = 1;
}
if (monster == "Werewolf") {
hitdice = 4;
monsternumber = 4;
tags.intelligent = 1;
tags.werebite = 1;
}
if (monster == "Stirge") {
hitdice = 5;
monsternumber = 1;
tags.unintelligent = 1;
tags.hold = 1;
}
if (monster == "Boring Beetle") {
hitdice = 5;
monsternumber = 2;
tags.unintelligent = 1;
}
if (monster == "Carnivorous Ape") {
hitdice = 5;
monsternumber = 3;
tags.unintelligent = 1;
tags.vicious = 1;
}
if (monster == "Giant Lizard") {
hitdice = 5;
monsternumber = 4;
tags.unintelligent = 1;
}
if (monster == "Gelatinous Cube") {
hitdice = 6;
monsternumber = 1;
tags.unintelligent = 1;
tags.hold = 1;
tags.ambush = 1;
tags.mindless = 1;
}
if (monster == "Rust Monster") {
hitdice = 6;
monsternumber = 2;
tags.unintelligent = 1;
tags.rusty = 1;
}
if (monster == "Minotaur") {
hitdice = 6;
monsternumber = 3;
tags.intelligent = 1;
tags.vicious = 1;
tags.mapsense = 1;
}
if (monster == "Medusa") {
hitdice = 6;
monsternumber = 4;
tags.intelligent = 1;
tags.gaze = 1;
}
if (monster == "Ghast") {
hitdice = 7;
monsternumber = 1;
tags.intelligent = 1;
tags.undead = 1;
tags.nauseating = 1;
tags.paralysis = 1;
}
if (monster == "Leucrotta") {
hitdice = 7;
monsternumber = 2;
tags.intelligent = 1;
}
if (monster == "Carrion Crawler") {
hitdice = 7;
monsternumber = 3;
tags.unintelligent = 1;
tags.paralysis = 1;
}
if (monster == "Manticore") {
hitdice = 7;
monsternumber = 4;
tags.unintelligent = 1;
tags.tail = 1;
}
if (monster == "Su Monster") {
hitdice = 8;
monsternumber = 1;
tags.intelligent = 1;
tags.ambush = 1;
}
if (monster == "Yellow Mold") {
hitdice = 8;
monsternumber = 2;
tags.unintelligent = 1;
tags.immobile = 1;
tags.ambush = 1;
tags.mindless = 1;
}
if (monster == "Hill Giant") {
hitdice = 8;
monsternumber = 3;
tags.intelligent = 1;
}
if (monster == "Mind Flayer") {
hitdice = 8;
monsternumber = 4;
tags.intelligent = 1;
tags.area = 1;
tags.retreat = 1;
}
if (monster == "Doppelganger") {
hitdice = 9;
monsternumber = 1;
tags.intelligent = 1;
tags.double = 1;
}
if (monster == "Vampire") {
hitdice = 9;
monsternumber = 2;
tags.intelligent = 1;
tags.undead = 1;
tags.leveldrain = 1;
}
if (monster == "Lurker Above") {
hitdice = 9;
monsternumber = 3;
tags.unintelligent = 1;
tags.immobile = 1;
tags.ambush = 1;
tags.sticky = 1;
}
if (monster == "Purple Worm") {
hitdice = 9;
monsternumber = 4;
tags.unintelligent = 1;
tags.powerful = 1;
}
if (monster == "Mimic") {
hitdice = 10;
monsternumber = 1;
tags.unintelligent = 1;
tags.immobile = 1;
tags.ambush = 1;
tags.sticky = 1;
}
if (monster == "Succubus") {
hitdice = 10;
monsternumber = 2;
tags.intelligent = 1;
tags.leveldrain = 1;
}
if (monster == "Storm Giant") {
hitdice = 10;
monsternumber = 3;
tags.intelligent = 1;
tags.powerful = 1;
}
if (monster == "Dragon") {
hitdice = 10;
monsternumber = 4;
tags.intelligent = 1;
tags.area = 1;
tags.fiery = 1;
tags.powerful = 1;
}
if (getnumber("monsterhp") > 0) {
setnumber("monster2ac", 10 + hitdice);
setnumber("monster2hp", Math.ceil(Math.random() * 6));
if (getnumber("monster2hp") < int(hitdice / 2)) {
setnumber("monster2hp", int(hitdice / 2));
}
setnumber("monster2maxhp", getnumber("monster2hp"));
_root.monster2hp._alpha = 100;
_root.monster2ac._alpha = 100;
_root.monster2name = monster;
_root.monster2hd = hitdice;
_root.monster2hp._alpha = 100;
_root.monster2ac._alpha = 100;
_root.monster2number = monsternumber;
eval (((("_root.monster2white.monster" + _root.monster2hd) + "_") + _root.monster2number) + "white")._alpha = 100;
_root.monster2tags = tags;
if (monster_has_tag("weak", 2)) {
setnumber("monster2hp", Math.ceil(Math.random() * 4));
if (getnumber("monster2hp") < int(hitdice / 2)) {
setnumber("monster2hp", int(hitdice / 2));
}
setnumber("monster2maxhp", getnumber("monster2hp"));
}
if (monster_has_tag("ambush", 2)) {
_root.ambush = 1;
}
} else {
setnumber("monsterac", 10 + hitdice);
setnumber("monsterhp", Math.ceil(Math.random() * 6));
if (getnumber("monsterhp") < int(hitdice / 2)) {
setnumber("monsterhp", int(hitdice / 2));
}
setnumber("monstermaxhp", getnumber("monsterhp"));
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
_root.monsternumber = monsternumber;
_root.monstername = monster;
_root.monsterhd = hitdice;
eval (((("_root.monsterwhite.monster" + _root.monsterhd) + "_") + _root.monsternumber) + "white")._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
_root.monstertags = tags;
if (monster_has_tag("weak")) {
setnumber("monsterhp", Math.ceil(Math.random() * 4));
if (getnumber("monsterhp") < int(hitdice / 2)) {
setnumber("monsterhp", int(hitdice / 2));
}
setnumber("monstermaxhp", getnumber("monsterhp"));
}
if (monster_has_tag("ambush")) {
_root.ambush = 1;
}
}
if (getnumber("henchmanhp") > 0) {
if (_root.henchmandoppelganger == 1) {
if (getnumber("monster2hp") == 0) {
write("Oh no! Your henchman was the doppelganger!");
clear_henchman(1);
try_to_promote_henchman();
fight("Doppelganger", 2);
}
}
}
if (nochoosefight != 3) {
if (nochoosefight != 1) {
if (_root.ambush == 1) {
attack();
} else {
choosefight();
}
}
}
}
function choosefight() {
if (_root.intown == 1) {
monsteraware = 1;
}
savegame(0, "choosefight");
var _local2 = "";
if ((getnumber("monster2hp") == 0) && (_root.monstersource != "door")) {
if (getnumber("dungeonlevel") > 0) {
if (((_root.armor != "plate_mail") && (_root.armor != "+1_plate_mail")) || (monster_has_tag("immobile"))) {
_local2 = _local2 + "<b>(r)etreat</b>, ";
add_to_key("r", "retreat");
}
}
}
if (((_root.monsteraware == 0) && (_root.monstersource != "door")) && ((_root.monster2name == null) || (_root.monster2name == ""))) {
if ((((_root.armor != "plate_mail") && (_root.armor != "+1_plate_mail")) && (_root.armor != "chain_mail")) && (_root.armor != "+1_chain_mail")) {
if (_root.monstersource == "monsterandtreasure") {
_local2 = _local2 + "<b>(s)neak</b> by the monster and grab the treasure, ";
} else {
_local2 = _local2 + "<b>(s)neak</b>, ";
}
add_to_key("s", "sneak");
}
}
if (monster_has_tag("intelligent")) {
_local2 = _local2 + "<b>(p)arley</b>, ";
add_to_key("p", "parley");
if (yourwealth() >= (getnumber("dungeonlevel") * 10)) {
add_to_key("b", "bribe");
_local2 = _local2 + "<b>(b)ribe</b>, ";
}
}
if ((((_root.characterclass == "Thief") && (_root.monsteraware == 0)) && (_root.monstersource != "door")) && ((_root.monster2name == null) || (_root.monster2name == ""))) {
_local2 = _local2 + ("<b>sneak (a)ttack</b> the " + _root.monstername);
add_to_key("a", "attack", "sneak");
} else {
_local2 = _local2 + ("<b>(a)ttack</b> the " + _root.monstername);
if ((_root.weapon == "fists") || (_root.weapon == "")) {
_local2 = _local2 + " with your fists";
}
add_to_key("a", "attack");
}
if ((_root.monster2name != null) && (_root.monster2name != "")) {
add_to_key("t", "attacktwo");
_local2 = _local2 + (", <b>a(t)tack</b> the " + _root.monster2name);
}
if (has_usable_item()) {
_local2 = _local2 + ", <b>(u)se</b> an item";
add_to_key("u", "use_an_item");
}
if (has_spell()) {
_local2 = _local2 + ", <b>(c)ast</b> a spell";
add_to_key("c", "cast_a_spell");
}
if (_root.monstersource == "door") {
_local2 = _local2 + ", <b>(f)orce</b> door";
add_to_key("f", "forcedoor");
}
_local2 = _local2 + "?";
write(_local2);
_root.combatround++;
}
function attack(mnum, skipfirst, sneak) {
_root.monsteraware = 0;
if (mnum == null) {
mnum = 0;
}
if (sneak == null) {
sneak = 0;
}
if (skipfirst == null) {
skipfirst = 0;
}
if (_root.ambush == 1) {
_root.ambush = 0;
skipfirst = 1;
}
var myhp = getnumber("hp");
var monsterhp = getnumber("monsterhp");
if (mnum == 2) {
monsterhp = getnumber("monster2hp");
}
var monstermaxhp = getnumber("monstermaxhp");
if (mnum == 2) {
monstermaxhp = getnumber("monster2maxhp");
}
var monsterac = getnumber("monsterac");
if (mnum == 2) {
monsterac = getnumber("monster2ac");
}
var numberofattacks = 1;
if (_root.haste > 0) {
numberofattacks = 2;
}
var numberofhenchmanattacks = 1;
if (_root.haste == 2) {
numberofhenchmanattacks = 2;
}
if (getnumber("henchmanhp") > 0) {
if (monster_has_tag("double")) {
write(("The " + _root.monstername) + " looks like your henchman!");
write("You're not sure which is which!");
var r = 1;
while (r <= 10) {
var s = 0;
while (s <= 5) {
eval (((("_root.monsterwhite.monster" + r) + "_") + s) + "white")._alpha = 0;
s++;
}
r++;
}
eval (((("_root.monsterwhite.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
}
if (monster_has_tag("double", 2)) {
write(("The " + _root.monster2name) + " looks like your henchman!");
write("You're not sure which is which!");
var r = 1;
while (r <= 10) {
var s = 0;
while (s <= 5) {
eval (((("_root.monster2white.monster" + r) + "_") + s) + "white")._alpha = 0;
s++;
}
r++;
}
eval (((("_root.monster2white.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
}
}
if (skipfirst != 1) {
if (skipfirst == 2) {
numberofattacks = 0;
}
if (_root.stunned > 0) {
numberofattacks = 0;
write("You lose your turn!");
_root.stunned = 0;
}
var n = 1;
while (n <= numberofattacks) {
if ((mnum == 2) && (getnumber("monster2hp") == 0)) {
break;
}
if ((mnum != 2) && (getnumber("monsterhp") == 0)) {
break;
}
var istrained = 0;
var mysneakbonus = 0;
var mysneakdamagebonus = 0;
if (sneak == "sneak") {
mysneakbonus = levelbonus("thief") + 2;
mysneakdamagebonus = 2;
}
if (_root.sanctuary == 1) {
_root.sanctuary = 0;
write("Sanctuary ends!");
}
var myattackroll = ((Math.ceil(Math.random() * 20) + getnumber("attackbonus")) + mysneakbonus);
write((((("You attack! d20+" + (getnumber("attackbonus") + mysneakbonus)) + ": <b>") + myattackroll) + "</b> vs AC ") + monsterac, 1);
if (myattackroll >= monsterac) {
var mydamageroll = ((Math.ceil(Math.random() * _root.weapondamage) + _root.weaponplus) + mysneakdamagebonus);
write(((((("You hit! d" + _root.weapondamage) + "+") + (_root.weaponplus + mysneakdamagebonus)) + ": <b>") + mydamageroll) + "</b> damage!");
monsterhp = monsterhp - mydamageroll;
if (monsterhp >= 1) {
if (mnum == 2) {
setnumber("monster2hp", monsterhp);
_root.monster2hp.hpblood._alpha = 100 - int((getnumber("monster2hp") / getnumber("monster2maxhp")) * 100);
} else {
setnumber("monsterhp", monsterhp);
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
}
} else {
var monsterhd = _root.monsterhd;
var mymonstername = _root.monstername;
if (mnum == 2) {
monsterhd = _root.monster2hd;
}
if (mnum == 2) {
mymonstername = _root.monstername;
}
if (monsterhd > _root.accomplishments_toughestmonsterlevel) {
_root.accomplishments_toughestmonsterlevel = monsterhd;
_root.accomplishments_toughestmonster = mymonstername;
}
var myxp = (monsterhd * 10);
addnumber("xp", myxp);
write(("Earned " + myxp) + " XP!");
if ((((_root.weapon == "whip") && (monster_has_tag("unintelligent", mnum))) && (!monster_has_tag("mindless", mnum))) && (!monster_has_tag("immobile", mnum))) {
var istrained = 1;
write("<font color=\"#009900\">You have trained the monster to obey you!</font>");
if (getnumber("henchmanhp") == 0) {
setnumber("henchmanhp", getnumber("monstermaxhp"));
setnumber("henchmanmaxhp", getnumber("monstermaxhp"));
setnumber("henchmanac", getnumber("monsterac"));
namepet(_root.monstername, 1);
_root.henchmannumber = _root.monsternumber;
_root.henchmanhd = _root.monsterhd;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmantags = _root.monstertags;
eval (((("_root.henchmanwhite.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
} else if ((getnumber("henchman2hp") == 0) && (chabonus())) {
write("Because of your great charisma, the monster will join you as a second pet!");
setnumber("henchman2hp", getnumber("monstermaxhp"));
setnumber("henchman2maxhp", getnumber("monstermaxhp"));
setnumber("henchman2ac", getnumber("monsterac"));
namepet(_root.monstername, 2);
_root.henchman2number = _root.monsternumber;
_root.henchman2hd = _root.monsterhd;
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.henchman2tags = _root.monster2tags;
eval (((("_root.henchman2white.monster" + _root.henchman2hd) + "_") + _root.henchman2number) + "white")._alpha = 100;
} else {
write("You already have a henchman. The monster departs.");
}
}
if (mnum == 2) {
setnumber("monster2hp", 0);
setnumber("monster2maxhp", 0);
if (istrained == 0) {
write(("The " + _root.monster2name) + " is killed!", 1);
}
if (monster_has_tag("armed", 2)) {
write("You take its weapon!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) && (_root.characterclass != "Wizard")) && (_root.characterclass != "Thief")) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("bludgeon");
}
if (monster_has_tag("well-armed", 2)) {
write("You take its sword!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) || (_root.weapon == "bludgeon")) && ((_root.characterclass == "Dungeon Robber") || (_root.characterclass != "Fighter"))) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("sword");
}
if (monster_has_tag("glands", 2) && (_root.weapon != "whip")) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_monster(2);
} else {
setnumber("monsterhp", 0);
setnumber("monstermaxhp", 0);
if (istrained == 0) {
write(("The " + _root.monstername) + " is killed!", 1);
}
if (monster_has_tag("armed")) {
write("You take its weapon!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) && (_root.characterclass != "Wizard")) && (_root.characterclass != "Thief")) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("bludgeon");
}
if (monster_has_tag("well-armed")) {
write("You take its sword!");
add_equipment("sword");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) || (_root.weapon == "bludgeon")) && ((_root.characterclass == "Dungeon Robber") || (_root.characterclass != "Fighter"))) {
write("You can equip the weapon by opening your character sheet.");
}
}
if (monster_has_tag("glands") && (_root.weapon != "whip")) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_monster(1);
try_to_promote_monster();
}
}
} else {
write("You miss!", 1);
if (monster_has_tag("nauseating") || (monster_has_tag("nauseating", 2))) {
write("The stench is appalling!");
var randy = (Math.ceil(Math.random() * 6) + conbonus());
if (randy <= 2) {
write("You double over! You lose your next turn!");
_root.stunned = 1;
} else {
write("You fight through it!");
}
}
}
n++;
}
var henchnumber = 0;
if (getnumber("henchmanhp") > 0) {
henchnumber++;
}
if (getnumber("henchman2hp") > 0) {
henchnumber++;
}
o = 0;
while (o < henchnumber) {
if (o == 0) {
var henchlevel = _root.henchmanhd;
var henchname = _root.henchmanname;
}
if (o == 1) {
var henchlevel = _root.henchman2hd;
var henchname = _root.henchman2name;
}
var curmonstnum = 0;
if (getnumber("monsterhp") > 0) {
curmonstnum++;
}
if (getnumber("monster2hp") > 0) {
curmonstnum++;
}
if (curmonstnum == 0) {
break;
}
if (curmonstnum == 1) {
hmnum = 1;
}
if ((curmonstnum == 2) && (Math.ceil(Math.random() * 2) == 2)) {
hmnum = 2;
}
var myheld = 0;
if ((_root.monsterheld == 1) && (o == 0)) {
hmnum = 1;
myheld = 1;
}
if ((_root.monsterheld == 2) && (o == 1)) {
hmnum = 1;
myheld = 1;
}
if ((_root.monster2held == 1) && (o == 0)) {
hmnum = 1;
myheld = 1;
}
if ((_root.monster2held == 2) && (o == 1)) {
hmnum = 2;
myheld = 1;
}
var monsterhp = getnumber("monsterhp");
if (hmnum == 2) {
monsterhp = getnumber("monster2hp");
}
var monstermaxhp = getnumber("monstermaxhp");
if (hmnum == 2) {
monstermaxhp = getnumber("monster2maxhp");
}
var monsterac = getnumber("monsterac");
if (hmnum == 2) {
monsterac = getnumber("monster2ac");
}
var thisnumberofhenchmanattacks = numberofhenchmanattacks;
if (henchman_has_tag("tail", o + 1) && (getnumber("monster2hp") > 0)) {
thisnumberofhenchmanattacks++;
}
if (henchman_has_tag("area", o + 1) && (getnumber("monster2hp") > 0)) {
thisnumberofhenchmanattacks++;
}
n = 1;
while (n <= thisnumberofhenchmanattacks) {
if (henchman_has_tag("tail", o + 1) || (henchman_has_tag("area", o + 1))) {
if ((n == 1) && (getnumber("monster2hp") > 0)) {
hmnum = 2;
} else if ((n == 1) && (getnumber("monsterhp") > 0)) {
hmnum = 1;
}
if (n == 2) {
hmnum = 1;
}
}
if ((o == 1) && (_root.henchman2stunned > 0)) {
write(_root.henchman2name + " loses a turn!");
_root.henchman2stunned = 0;
break;
}
if ((o == 0) && (_root.henchmanstunned > 0)) {
write(_root.henchmanname + " loses a turn!");
_root.henchmanstunned = 0;
break;
}
if ((hmnum == 2) && (getnumber("monster2hp") == 0)) {
break;
}
if ((hmnum != 2) && (getnumber("monsterhp") == 0)) {
break;
}
var myattackroll = (Math.ceil(Math.random() * 20) + henchlevel);
var tailcomment = "";
if ((n == 1) && (henchman_has_tag("tail", o + 1))) {
tailcomment = " with its tail";
}
if (myheld == 0) {
write((((((((henchname + " attacks") + tailcomment) + "! d20+") + henchlevel) + ": <b>") + myattackroll) + "</b> vs AC ") + monsterac, 1);
} else {
write(henchname + " automatically hits!");
}
if ((myattackroll >= monsterac) || (myheld)) {
var mydamageroll = Math.ceil(Math.random() * 6);
if (henchman_has_tag("vicious", o + 1)) {
mydamageroll++;
}
if (henchman_has_tag("powerful", o + 1)) {
mydamageroll = mydamageroll + Math.ceil(Math.random() * 6);
}
if (henchman_has_tag("unarmed", o + 1)) {
mydamageroll = 1;
}
if (henchman_has_tag("rusty", o + 1)) {
mydamageroll = 0;
}
if (henchman_has_tag("gaze", o + 1)) {
mydamageroll = 0;
}
write(("Hit! <b>" + mydamageroll) + "</b> damage!");
monsterhp = monsterhp - mydamageroll;
if (monsterhp >= 1) {
if (hmnum == 2) {
setnumber("monster2hp", monsterhp);
_root.monster2hp.hpblood._alpha = 100 - int((getnumber("monster2hp") / getnumber("monster2maxhp")) * 100);
if (henchman_has_tag("rusty", o + 1) && (monster_has_tag("armed", 2) || (monster_has_tag("well-armed", 2)))) {
_root.monster2tags.armed = 0;
_root.monster2tags["well-armed"] = 0;
_root.monster2tags.unarmed = 1;
write("Weapon rusted!");
}
if (henchman_has_tag("gaze", o + 1)) {
write("Gaze attack!");
if (Math.ceil(Math.random() * 2) == 1) {
write(_root.monster2name + " survived!");
} else {
write(_root.monster2name + " is turned to stone!");
clear_monster(2);
}
}
if (henchman_has_tag("paralysis", o + 1)) {
if (Math.ceil(Math.random() * 2) == 1) {
write(_root.monster2name + " is not paralyzed!");
} else {
write(_root.monster2name + " is paralyzed!");
_root.monster2stunned = 1;
}
}
if (henchman_has_tag("hold", o + 1)) {
_root.monster2held = o + 1;
write(_root.monster2name + " has been grabbed!");
}
} else {
setnumber("monsterhp", monsterhp);
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
if (henchman_has_tag("rusty", o + 1) && (monster_has_tag("armed") || (monster_has_tag("well-armed")))) {
_root.monstertags.armed = 0;
_root.monstertags["well-armed"] = 0;
_root.monstertags.unarmed = 1;
write("Weapon rusted!");
}
if (henchman_has_tag("gaze", o + 1)) {
write("Gaze attack!");
if (Math.ceil(Math.random() * 2) == 1) {
write(_root.monstername + " survived!");
} else {
write(_root.monstername + " is turned to stone!");
clear_monster(1);
try_to_promote_monster();
}
}
if (henchman_has_tag("paralysis", o + 1)) {
if (Math.ceil(Math.random() * 2) == 1) {
write(_root.monstername + " is not paralyzed!");
} else {
write(_root.monstername + " is paralyzed!");
_root.monsterstunned = 1;
}
}
if (henchman_has_tag("hold", o + 1)) {
_root.monsterheld = o + 1;
write(_root.monstername + " has been grabbed!");
}
}
} else if (hmnum == 2) {
setnumber("monster2hp", 0);
setnumber("monster2maxhp", 0);
write(("The " + _root.monster2name) + " is killed!", 1);
if (monster_has_tag("armed", 2)) {
write("You take its weapon!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) || (_root.weapon == "bludgeon")) && ((_root.characterclass == "Dungeon Robber") || (_root.characterclass != "Fighter"))) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("bludgeon");
}
if (monster_has_tag("well-armed", 2)) {
write("You take its sword!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) || (_root.weapon == "bludgeon")) && ((_root.characterclass == "Dungeon Robber") || (_root.characterclass != "Fighter"))) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("sword");
}
if (monster_has_tag("glands", 2) && (_root.weapon != "whip")) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_monster(2);
} else {
setnumber("monsterhp", 0);
setnumber("monstermaxhp", 0);
write(("The " + _root.monstername) + " is killed!", 1);
if (monster_has_tag("armed")) {
write("You take its weapon!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) && (_root.characterclass != "Wizard")) && (_root.characterclass != "Thief")) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("bludgeon");
}
if (monster_has_tag("well-armed")) {
write("You take its sword!");
add_equipment("sword");
}
if (monster_has_tag("glands") && (_root.weapon != "whip")) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_monster(1);
try_to_promote_monster();
}
} else {
write(henchname + " misses!", 1);
if (monster_has_tag("nauseating") || (monster_has_tag("nauseating", 2))) {
if ((!henchman_has_tag("undead", o + 1)) && (!henchman_has_tag("nauseating", o + 1))) {
write("The stench is appalling!");
var randy = Math.ceil(Math.random() * 6);
if (randy <= 2) {
write(henchname + " doubles over!");
if (o == 0) {
_root.henchmanstunned = 1;
}
if (o == 1) {
_root.henchman2stunned = 1;
}
}
}
}
}
n++;
}
o++;
}
}
try_to_promote_monster();
var mons = new Array();
var sanctuary1 = 0;
var sanctuary2 = 0;
if (_root.justhasted) {
if (Math.ceil(Math.random() * 2) == 1) {
sanctuary1 = 1;
sanctuary2 = 1;
write("You're too quick to be attacked!");
} else {
write("You're quick, but not quick enough to avoid all attacks!");
}
_root.justhasted = 0;
}
if (_root.sanctuary == 1) {
if (getnumber("monsterhp") > 0) {
var monstersave = 4;
var st = Math.ceil(Math.random() * 6);
write(((("d6 saving throw against Sanctuary: rolled a " + st) + " trying to roll under ") + monstersave) + ".");
if (st >= monstersave) {
write(("The " + _root.monstername) + " succeeded!");
sanctuary1 = 0;
} else {
write(("The " + _root.monstername) + " can't attack you!");
sanctuary1 = 1;
}
}
if (getnumber("monster2hp") > 0) {
var monstersave = 4;
var st = Math.ceil(Math.random() * 6);
write(((("d6 saving throw against Sanctuary: rolled a " + st) + " trying to roll under ") + monstersave) + ".");
if (st >= monstersave) {
write(("The " + _root.monster2name) + " succeeded!");
sanctuary2 = 0;
} else {
write(("The " + _root.monster2name) + " can't attack you!");
sanctuary2 = 1;
}
}
}
if (_root.monsterstunned == 1) {
_root.monsterstunned = 0;
write(("The " + _root.monstername) + " loses a turn!");
} else if (!sanctuary1) {
mons.push(1);
}
if (_root.monster2name) {
if (_root.monster2stunned == 1) {
_root.monster2stunned = 0;
write(("The " + _root.monster2name) + " loses a turn!");
} else if (!sanctuary2) {
mons.push(2);
}
}
if (monster_has_tag("loud")) {
write(("The " + _root.monstername) + " screams!");
if ((Math.ceil(Math.random() * 2) == 1) && (getnumber("monster2hp") == 0)) {
write("Attracted by the noise, a monster wanders over!");
var mydie = Math.ceil(Math.random() * 4);
if (mydie == 1) {
fight("Stirge", 3);
} else if (mydie == 2) {
fight("Boring Beetle", 3);
} else if (mydie == 3) {
fight("Carnivorous Ape", 3);
} else if (mydie == 4) {
fight("Giant Lizard", 3);
}
}
}
var n = 0;
while (n < mons.length) {
mymonsterhp = getnumber("monsterhp");
mymonsterhd = _root.monsterhd;
mymonstername = _root.monstername;
if (n == 1) {
mymonsterhp = getnumber("monster2hp");
mymonsterhd = _root.monster2hd;
mymonstername = _root.monster2name;
}
if (monster_has_tag("passive", n + 1)) {
} else {
if (monster_has_tag("retreat", n + 1)) {
if (n == 0) {
if (getnumber("monstermaxhp") > getnumber("monsterhp")) {
write(("The " + _root.monstername) + " retreats!");
if (_root.monstersource == "monsterandtreasure") {
_root.monstersource = "wandering";
write("It takes its treasure with it.");
}
clear_monster(1);
try_to_promote_monster();
}
} else if (getnumber("monster2maxhp") > getnumber("monster2hp")) {
write(("The " + _root.monster2name) + " retreats!");
if (_root.monstersource == "monsterandtreasure") {
_root.monstersource = "wandering";
write("It takes its treasure with it.");
}
clear_monster(2);
}
}
if (mymonsterhp > 0) {
var targetnumber = 0;
if (getnumber("henchmanhp") > 0) {
targetnumber++;
}
if (getnumber("henchman2hp") > 0) {
targetnumber++;
}
targetnumber = Math.ceil(Math.random() * (targetnumber + 1)) - 1;
var myheld = 0;
if ((_root.held == 1) && (n == 0)) {
targetnumber = 0;
myheld = 1;
}
if ((_root.held == 2) && (n == 1)) {
targetnumber = 0;
myheld = 1;
}
if ((_root.henchmanheld == 1) && (n == 0)) {
targetnumber = 1;
myheld = 1;
}
if ((_root.henchmanheld == 2) && (n == 1)) {
targetnumber = 1;
myheld = 1;
}
if ((_root.henchman2held == 1) && (n == 0)) {
targetnumber = 2;
myheld = 1;
}
if ((_root.henchman2held == 2) && (n == 1)) {
targetnumber = 2;
myheld = 1;
}
if ((_root.monsterheld == 2) && (o == 1)) {
hmnum = 2;
}
var monstertargs = new Array();
if (monster_has_tag("tail", n + 1)) {
monstertargs.push(0);
if (getnumber("henchmanhp") > 0) {
monstertargs.push(1);
}
} else if (monster_has_tag("area", n + 1)) {
monstertargs.push(0);
if (getnumber("henchman2hp") > 0) {
monstertargs.push(2);
}
if (getnumber("henchmanhp") > 0) {
monstertargs.push(1);
}
} else if (monster_has_tag("double", n + 1) && (getnumber("henchmanhp") > 0)) {
monstertargs.push(1);
} else {
monstertargs.push(targetnumber);
}
p = 0;
for ( ; p < monstertargs.length ; p++) {
targetnumber = monstertargs[p];
if (targetnumber == 0) {
var targetname = "you";
var targetac = getnumber("ac");
var targethp = getnumber("hp");
} else if (targetnumber == 1) {
var targetname = _root.henchmanname;
if (!targetname) {
continue;
}
var yourtargetname = _root.henchmanname;
if (_root.henchmanhd > 0) {
yourtargetname = targetname;
}
var targetac = getnumber("henchmanac");
var targethp = getnumber("henchmanhp");
} else if (targetnumber == 2) {
var targetname = _root.henchman2name;
if (!targetname) {
continue;
}
var yourtargetname = _root.henchman2name;
if (_root.henchman2hd > 0) {
yourtargetname = targetname;
}
var targetac = getnumber("henchman2ac");
var targethp = getnumber("henchman2hp");
}
var monsterattackroll = (Math.ceil(Math.random() * 20) + mymonsterhd);
var tailcomment = "";
if (monster_has_tag("tail", n + 1) && (targetnumber == 1)) {
tailcomment = " with its tail";
}
if (myheld == 0) {
write((((((((("The " + mymonstername) + " attacks ") + targetname) + tailcomment) + "! d20+") + mymonsterhd) + ": <b>") + monsterattackroll) + "</b>", 1);
} else {
write(mymonstername + " automatically hits!");
}
if ((monsterattackroll >= targetac) || (myheld)) {
var monsterdamageroll = Math.ceil(Math.random() * 6);
var damageexpression = "d6";
if (monster_has_tag("powerful", n + 1)) {
monsterdamageroll = monsterdamageroll + Math.ceil(Math.random() * 6);
damageexpression = "2d6";
}
if (monster_has_tag("vicious", n + 1)) {
monsterdamageroll++;
damageexpression = damageexpression + "+1";
}
if (monster_has_tag("unarmed", n + 1)) {
monsterdamageroll = 1;
damageexpression = 1;
}
if (monster_has_tag("rusty", n + 1)) {
monsterdamageroll = 0;
damageexpression = 0;
}
if (monster_has_tag("gaze", n + 1)) {
monsterdamageroll = 0;
damageexpression = 0;
}
write(((("It hits! " + damageexpression) + ": <b>") + monsterdamageroll) + "</b> damage!");
targethp = targethp - monsterdamageroll;
if (targetnumber == 0) {
if (targethp >= 1) {
setnumber("hp", targethp);
_root.hp.hpblood._alpha = int(100 - int((getnumber("hp") / getnumber("maxhp")) * 100));
if (monster_has_tag("sticky", n + 1)) {
_root.stuck = 1;
write("You're stuck! You can't escape!");
}
if (monster_has_tag("rusty", n + 1)) {
rust();
}
if (monster_has_tag("leveldrain", n + 1)) {
drainlevel();
}
if (monster_has_tag("gaze", n + 1)) {
write("Gaze attack!");
if (savingthrow()) {
write("You look away in time!");
} else {
write("You are turned to stone!");
setnumber("hp", 0);
_root.hp.hpblood._alpha = 0;
_root.accomplishments_killedby = "stoned by a " + mymonstername;
}
}
if (monster_has_tag("paralysis", n + 1)) {
if (savingthrow()) {
write("You are not paralyzed!");
} else {
write("You are paralyzed!");
_root.stunned = 1;
}
}
if (monster_has_tag("hold", n + 1)) {
_root.held = n + 1;
write("You've been grabbed!");
}
} else {
setnumber("hp", 0);
_root.hp.hpblood._alpha = 0;
write("You are killed!");
_root.accomplishments_killedby = "killed by a " + mymonstername;
}
} else if (targetnumber == 1) {
if (targethp >= 1) {
setnumber("henchmanhp", targethp);
_root.henchmanhp.hpblood._alpha = 100 - int((targethp / getnumber("henchmanmaxhp")) * 100);
if (monster_has_tag("rusty", n + 1) && (henchman_has_tag("armed") || henchman_has_tag("well-armed"))) {
_root.henchmantags.armed = 0;
_root.henchmantags["well-armed"] = 0;
_root.henchmantags.unarmed = 1;
write("Weapon rusted!");
}
if (monster_has_tag("gaze", n + 1)) {
write("Gaze attack!");
if (henchmansavingthrow()) {
write(_root.henchmanname + " looks away in time!");
} else {
write(_root.henchmanname + " is turned to stone!");
setnumber("henchmanhp", 0);
clear_henchman(1);
try_to_promote_henchman();
}
}
if (monster_has_tag("paralysis", n + 1)) {
if (henchmansavingthrow()) {
write(_root.henchmanname + " is not paralyzed!");
} else {
write(_root.henchmanname + " is paralyzed!");
_root.henchmanstunned = 1;
}
}
if (monster_has_tag("double", n + 1)) {
write("You're not sure who is who!");
if ((!Math.ceil(Math.random() * 2)) == 1) {
_root.henchmandoppelganger = 1;
}
}
if (monster_has_tag("hold", n + 1)) {
_root.henchmanheld = n + 1;
write(_root.henchmanname + " has been grabbed!");
}
} else {
setnumber("henchmanhp", 0);
_root.henchmanhp.hpblood._alpha = 0;
write(yourtargetname + " is killed!", 1);
if (henchman_has_tag("armed")) {
write("You take their weapon!");
if (((((_root.weapon == "dagger") || (_root.weapon == "")) || (_root.weapon == "fists")) && (_root.characterclass != "Wizard")) && (_root.characterclass != "Thief")) {
write("You can equip the weapon by opening your character sheet.");
}
add_equipment("bludgeon");
}
if (henchman_has_tag("well-armed")) {
write("You take their sword!");
add_equipment("sword");
}
if (henchman_has_tag("glands")) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_henchman(1);
try_to_promote_henchman();
}
} else if (targetnumber == 2) {
if (targethp >= 1) {
setnumber("henchman2hp", targethp);
_root.henchman2hp.hpblood._alpha = 100 - int((targethp / getnumber("henchman2maxhp")) * 100);
if (monster_has_tag("rusty", n + 1) && (henchman_has_tag("armed", 2) || henchman_has_tag("well-armed", 2))) {
_root.henchman2tags.armed = 0;
_root.henchman2tags["well-armed"] = 0;
_root.henchman2tags.unarmed = 1;
write("Weapon rusted!");
}
if (monster_has_tag("gaze", n + 1)) {
write("Gaze attack!");
if (henchmansavingthrow(2)) {
write(_root.henchman2name + " looks away in time!");
} else {
write(_root.henchman2name + " is turned to stone!");
setnumber("henchman2hp", 0);
clear_henchman(2);
}
}
if (monster_has_tag("paralysis", n + 1)) {
if (henchmansavingthrow(2)) {
write(_root.henchman2name + " is not paralyzed!");
} else {
write(_root.henchman2name + " is paralyzed!");
_root.henchman2stunned = 1;
}
}
if (monster_has_tag("hold", n + 1)) {
_root.henchman2held = n + 1;
write(_root.henchman2name + " has been grabbed!");
}
} else {
setnumber("henchman2hp", 0);
_root.henchman2hp.hpblood._alpha = 0;
write(yourtargetname + " is killed!", 1);
if (henchman_has_tag("armed", 2)) {
write("You take their weapon!");
add_equipment("bludgeon");
}
if (henchman_has_tag("well-armed", 2)) {
write("You take their sword!");
add_equipment("sword");
}
if (henchman_has_tag("glands", 2)) {
write("You take its glowing glands! You can sell these.");
add_equipment("fire_beetle_glands", 2);
}
clear_henchman(2);
}
}
} else {
write("It misses!", 1);
if (henchman_has_tag("nauseating") || (henchman_has_tag("nauseating", 2))) {
if ((!monster_has_tag("undead", n + 1)) && (!monster_has_tag("nauseating", n + 1))) {
write("The stench is appalling!");
var randy = Math.ceil(Math.random() * 6);
if (randy <= 2) {
write(mymonstername + " doubles over!");
if (n == 0) {
_root.monsterstunned = 1;
}
if (n == 1) {
_root.monster2stunned = 1;
}
}
}
}
}
}
}
}
n++;
}
attackchoice();
}
function attackchoice() {
if (getnumber("hp") > 0) {
savegame(0, "attackchoice");
}
var _local5 = getnumber("hp");
if (((_local5 > 0) && (getnumber("monsterhp") > 0)) && (getnumber("monster2hp") > 0)) {
var _local4 = ((("<b>(a)ttack</b> the " + _root.monstername) + " behind you? <b>a(t)tack</b> the ") + _root.monster2name) + " in front of you?";
add_to_key("a", "attack");
add_to_key("t", "attacktwo");
if (has_usable_item()) {
_local4 = _local4 + " <b>(u)se</b> an item? ";
add_to_key("u", "use_an_item");
}
if (has_spell()) {
_local4 = _local4 + "<b>(c)ast</b> a spell? ";
add_to_key("c", "cast_a_spell");
}
write(_local4);
} else if ((_local5 > 0) && ((getnumber("monsterhp") > 0) || (getnumber("monster2hp") > 0))) {
var _local4 = "";
if (getnumber("dungeonlevel") > 0) {
if (_root.stuck == 0) {
if (((_root.armor != "plate_mail") && (_root.armor != "+1_plate_mail")) || (monster_has_tag("immobile"))) {
_local4 = _local4 + "<b>(r)etreat</b>? ";
add_to_key("r", "retreat");
}
}
}
_local4 = _local4 + "<b>(a)ttack</b>? ";
add_to_key("a", "attack");
if (has_usable_item()) {
_local4 = _local4 + "<b>(u)se</b> an item? ";
add_to_key("u", "use_an_item");
}
if (has_spell()) {
_local4 = _local4 + "<b>(c)ast</b> a spell? ";
add_to_key("c", "cast_a_spell");
}
write(_local4);
} else if (_local5 > 0) {
levelup();
if (_root.haste) {
_root.haste = 0;
write("Haste ends.");
}
if (_root.sanctuary) {
_root.sanctuary = 0;
write("Sanctuary ends.");
}
if (_root.stuck) {
_root.stuck = 0;
write("You get unstuck.");
}
if (_root.held) {
_root.held = 0;
write("You free yourself.");
}
if (_root.henchmanheld) {
_root.henchmanheld = 0;
}
if (_root.henchman2held) {
_root.henchman2held = 0;
}
if (_root.henchmanstunned) {
_root.henchmanstunned = 0;
}
if (_root.henchman2stunned) {
_root.henchman2stunned = 0;
}
if (_root.intown == 1) {
town();
} else if (_root.monstersource == "wandering") {
_root.monstersource = "";
clear_monster();
useful_items();
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else if (_root.monstersource == "monster") {
_root.monstersource = "";
clear_monster();
useful_items();
add_to_master("move_to", "roomcontents");
add_to_master("move_to", "exits");
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "monsterandtreasure") {
add_to_master("move_to", "treasure");
clear_monster();
add_to_master("roll", "treasurein", 20);
run_master();
} else if (_root.monstersource == "takepassage") {
_root.monstersource = "";
clear_monster();
useful_items();
takepassage(_root.upcomingturn);
} else if (_root.monstersource == "door") {
_root.monstersource = "";
clear_monster();
useful_items();
var _local2 = "<b>(f)orce</b> it open";
var _local3 = "f";
if (_root.characterclass == "Thief") {
_local2 = "<b>(p)ick</b> the lock";
_local3 = "p";
}
if (_root.lastdoordirection == "left") {
if (_root.lost == 1) {
var _local6 = ("There is a door on the left side of the passage. " + _local2) + " or <b>(w)ander past</b>?";
add_to_key("w", "wander");
} else {
var _local6 = ("There is a door on the left side of of the passage. Could there be treasure on the other side? Will you " + _local2) + " or <b>(c)ontinue</b> down the passage?";
add_to_key("c", "explore");
}
add_to_key(_local3, "forcedoor", "left", _local3);
} else if (_root.lastdoordirection == "ahead") {
if (_root.lost == 1) {
var _local6 = ("There is a door at the end of the passage. " + _local2) + " or <b>(w)ander away</b>?";
add_to_key("w", "wander");
} else {
var _local6 = ("There is a door at the end of the passage. Could there be treasure on the other side? Will you " + _local2) + " or <b>(b)acktrack</b>?";
add_to_key("b", "backtrack");
}
add_to_key(_local3, "forcedoor", "ahead", _local3);
} else {
if (_root.lost == 1) {
var _local6 = ("There is a door on the right side of the passage. " + _local2) + " or <b>(w)ander past</b>?";
add_to_key("w", "wander");
} else {
var _local6 = ("There is a door on the right side of of the passage. Could there be treasure on the other side? Will you " + _local2) + " or <b>(c)ontinue</b> down the passage?";
add_to_key("c", "explore");
}
add_to_key(_local3, "forcedoor", "right", _local3);
}
write(_local6);
} else if (_root.monstersource == "deadend") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end();
} else if (_root.monstersource == "deadend1") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end(1);
} else if (_root.monstersource == "deadend2") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end(2);
} else if (_root.monstersource == "deadend3") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end(3);
} else if (_root.monstersource == "deadend4") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end(4);
} else if (_root.monstersource == "deadend5") {
_root.monstersource = "";
clear_monster();
useful_items();
dead_end(5);
} else if (_root.monstersource == "deadend6") {
add_to_master("move_to", "treasure");
clear_monster();
add_to_master("roll", "treasurein", 20);
run_master();
} else {
write("You killed the monster pursuing you.");
_root.monstersource = "";
clear_monster();
useful_items();
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
}
} else {
death();
}
}
function sneak() {
var _local2 = getnumber("monsterac");
if (monster_has_tag("alert")) {
_local2 = _local2 + 2;
write(_root.monstername + " is alert! Let's see if you can sneak by.");
}
var _local3 = Math.ceil(Math.random() * 20) + getnumber("sneakbonus");
if (_local3 >= _local2) {
write(((((("Sneak roll: " + _local3) + " (d20+") + getnumber("sneakbonus")) + " vs AC ") + _local2) + ": Success! You escape the monster.");
clear_monster();
if ((_root.monstersource == "wandering") || (_root.monstersource == "door")) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else if (_root.monstersource == "monster") {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "monsterandtreasure") {
add_to_master("move_to", "treasure", 0.7);
add_to_master("roll", "treasurein", 20);
run_master();
} else if (_root.monstersource == "takepassage") {
takepassage(_root.upcomingturn);
} else if (_root.monstersource == "deadend") {
write("You sneak back the way you came.");
backtrack();
} else if (_root.monstersource == "deadend1") {
write("You sneak back the way you came.");
backtrack();
} else if (_root.monstersource == "deadend2") {
write("You sneak back the way you came.");
backtrack();
} else if (_root.monstersource == "deadend3") {
write("You sneak back the way you came.");
backtrack();
} else if (_root.monstersource == "deadend4") {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "deadend5") {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "deadend6") {
_root.monstersource = "monsterandtreasure";
add_to_master("move_to", "treasure");
add_to_master("roll", "treasurein", 20);
run_master();
} else {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
}
} else {
write(((((("Sneak roll: " + _local3) + " (d20+") + getnumber("sneakbonus")) + " vs AC ") + _local2) + ": Failure! The monster notices you.");
attack(0, 1);
}
}
function cast_clw(dead_end_mode) {
if ((!_root.spells) > 0) {
write("You are out of spells.");
return(undefined);
}
if ((dead_end_mode == null) || (dead_end_mode == undefined)) {
dead_end_mode = 0;
}
_root.spells--;
if (getnumber("hp") < getnumber("maxhp")) {
var _local3 = Math.ceil(Math.random() * 8) + 1;
addnumber("hp", _local3);
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
write(("You healed up to " + getnumber("hp")) + " HP!");
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
} else {
write("You are already at full health!");
}
if (getnumber("henchmanhp") < getnumber("henchmanmaxhp")) {
if (!henchman_has_tag("undead")) {
var _local3 = Math.ceil(Math.random() * 8) + 1;
addnumber("henchmanhp", _local3);
if (getnumber("henchmanhp") > getnumber("henchmanmaxhp")) {
setnumber("henchmanhp", getnumber("henchmanmaxhp"));
}
write(((_root.henchmanname + " healed up to ") + getnumber("henchmanhp")) + " HP!");
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
}
} else if (getnumber("henchmanhp") > 0) {
write(_root.henchmanname + " is already at full health!");
}
if (getnumber("henchman2hp") < getnumber("henchman2maxhp")) {
if (!henchman_has_tag("undead", 2)) {
var _local3 = Math.ceil(Math.random() * 8) + 1;
addnumber("henchman2hp", _local3);
if (getnumber("henchman2hp") > getnumber("henchman2maxhp")) {
setnumber("henchman2hp", getnumber("henchman2maxhp"));
}
write(((_root.henchman2name + " healed up to ") + getnumber("henchman2hp")) + " HP!");
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
}
} else if (getnumber("henchman2hp") > 0) {
write(_root.henchman2name + " is already at full health!");
}
if (dead_end_mode > 0) {
dead_end(dead_end_mode);
} else {
movementphase();
}
}
function cast_a_spell() {
if (_root.spells == 1) {
write("You can cast 1 more spell on this expedition.");
} else {
write(("You can cast " + _root.spells) + " more spell on this expedition.");
if ((_root.spells == 0) && (!_root.intown)) {
write("Perhaps you should consider returning to the surface.");
}
}
if (memorized("cure_light_wounds")) {
var _local2 = "";
if ((getnumber("henchmanhp") < getnumber("henchmanmaxhp")) || (getnumber("henchman2hp") < getnumber("henchman2maxhp"))) {
_local2 = " and your followers";
}
write(("<b>(c)ure light wounds</b> on yourself" + _local2) + "?");
add_to_key("c", "cast_this_spell", "cure_light_wounds");
}
if (memorized("command")) {
write("<b>comman(d)</b> a creature to flee?");
add_to_key("d", "cast_this_spell", "command");
}
if (memorized("sanctuary")) {
write("<b>sanctuar(y)</b> to prevent the monster from attacking you?");
add_to_key("y", "cast_this_spell", "sanctuary");
}
if (memorized("charm")) {
write("<b>cha(r)m</b> to make an intelligent monster your ally?");
add_to_key("r", "cast_this_spell", "charm");
}
if (memorized("haste")) {
write("<b>(h)aste</b> to give you and allies double attacks?");
add_to_key("h", "cast_this_spell", "haste");
}
if (memorized("magic_missile")) {
write("<b>(m)agic missile</b> to do automatic 1d4+1 damage?");
add_to_key("m", "cast_this_spell", "magic_missile");
}
if (memorized("sleep")) {
write("<b>(s)leep</b> to put low-level monsters to sleep?");
add_to_key("s", "cast_this_spell", "sleep");
}
write("<b>(n)one?</b>");
add_to_key("n", "choosefight");
}
function cast_this_spell(spellname, noattack) {
_root.monsteraware = 0;
if (_root.spells < 0) {
write("You have no more spells to cast today!");
write("<b>(o)k!</b>");
add_to_key("o", "choosefight");
return(undefined);
}
var monsterhp = getnumber("monsterhp");
monster2hp = getnumber("monster2hp");
var monstersave = (10 - _root.monsterhd);
var monster2save = (10 - _root.monster2hd);
var monster1exists = monsterhp;
var monster2exists = monster2hp;
if (spellname == "cure_light_wounds") {
if (getnumber("hp") < getnumber("maxhp")) {
var healing = (Math.ceil(Math.random() * 8) + 1);
addnumber("hp", healing);
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
write(("You healed up to " + getnumber("hp")) + " HP!");
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
} else {
write("You are already at full health!");
}
if (getnumber("henchmanhp") < getnumber("henchmanmaxhp")) {
if (!henchman_has_tag("undead")) {
var healing = (Math.ceil(Math.random() * 8) + 1);
addnumber("henchmanhp", healing);
if (getnumber("henchmanhp") > getnumber("henchmanmaxhp")) {
setnumber("henchmanhp", getnumber("henchmanmaxhp"));
}
write(((_root.henchmanname + " healed up to ") + getnumber("henchmanhp")) + " HP!");
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
}
} else if (getnumber("henchmanhp") > 0) {
write(_root.henchmanname + " is already at full health!");
}
if (getnumber("henchman2hp") < getnumber("henchman2maxhp")) {
if (!henchman_has_tag("undead", 2)) {
var healing = (Math.ceil(Math.random() * 8) + 1);
addnumber("henchman2hp", healing);
if (getnumber("henchman2hp") > getnumber("henchman2maxhp")) {
setnumber("henchman2hp", getnumber("henchman2maxhp"));
}
write(((_root.henchman2name + " healed up to ") + getnumber("henchman2hp")) + " HP!");
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
}
} else if (getnumber("henchman2hp") > 0) {
write(_root.henchman2name + " is already at full health!");
}
} else if (spellname == "command") {
if (getnumber("monsterhp") > 0) {
if (monster_has_tag("intelligent") == 0) {
write("The monster can't understand your command.");
} else {
var st = Math.ceil(Math.random() * 6);
write(("d6 saving throw: rolled a " + st) + " trying to roll under 4.");
if (st >= 4) {
write(("The " + _root.monstername) + " ignores the spell!");
} else {
monster1exists = 0;
write(("The " + _root.monstername) + " flees at your command!");
clear_monster(1);
}
}
}
if (getnumber("monster2hp") > 0) {
var st = Math.ceil(Math.random() * 6);
write(("d6 saving throw: rolled a " + st) + " trying to roll under 4.");
if (st >= monstersave) {
write(("The " + _root.monster2name) + " ignores the spell!");
} else {
monster1exists = 0;
write(("The " + _root.monster2name) + " flees at your command!");
clear_monster(2);
}
}
} else if (spellname == "sanctuary") {
_root.sanctuary = 1;
write("A spell of peace surrounds you!");
} else if (spellname == "charm") {
var charmtarget = 0;
if (monster_has_tag("intelligent", 1)) {
charmtarget = 1;
var mymonstersave = 4;
var mymonstername = _root.monstername;
var mymonsterac = getnumber("monsterac");
var mymonsterhp = getnumber("monsterhp");
var mymonstermaxhp = getnumber("monstermaxhp");
var mymonsternumber = _root.monsternumber;
var mymonsterhd = _root.monsterhd;
var mymonstertags = _root.monstertags;
} else if ((getnumber("monster2hp") > 0) && (monster_has_tag("intelligent", 2))) {
charmtarget = 2;
var mymonstersave = 4;
var mymonstername = _root.monster2name;
var mymonsterac = getnumber("monster2ac");
var mymonsterhp = getnumber("monster2hp");
var mymonstermaxhp = getnumber("monster2maxhp");
var mymonsternumber = _root.monster2number;
var mymonsterhd = _root.monster2hd;
var mymonstertags = _root.monster2tags;
} else {
write("Only intelligent monsters can be charmed.");
}
if (charmtarget > 0) {
var st = Math.ceil(Math.random() * 6);
write(((("d6 saving throw: rolled a " + st) + " trying to roll under ") + mymonstersave) + ".");
if (st >= mymonstersave) {
write(("The " + mymonstername) + " ignores the spell!");
} else {
write("You have Charmed the monster!");
if (getnumber("henchmanhp") == 0) {
setnumber("henchmanhp", mymonsterhp);
setnumber("henchmanmaxhp", mymonstermaxhp);
setnumber("henchmanac", mymonsterac);
namepet(mymonstername, 1);
_root.henchmannumber = mymonsternumber;
_root.henchmanhd = mymonsterhd;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmantags = mymonstertags;
eval (((("_root.henchmanwhite.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
} else if ((getnumber("henchman2hp") == 0) && (chabonus())) {
write("Because of your great charisma, the monster will join you as a second henchman!");
setnumber("henchman2hp", mymonsterhp);
setnumber("henchman2maxhp", mymonstermaxhp);
setnumber("henchman2ac", mymonsterac);
namepet(mymonstername, 2);
_root.henchman2number = mymonsternumber;
_root.henchman2hd = mymonsterhd;
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.henchman2tags = mymonster2tags;
eval (((("_root.henchman2white.monster" + _root.henchman2hd) + "_") + _root.henchman2number) + "white")._alpha = 100;
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
} else {
write("You already have a henchman. The monster departs.");
}
if (charmtarget == 1) {
clear_monster(1);
monster1exists = 0;
}
if (charmtarget == 2) {
clear_monster(2);
monster2exists = 0;
}
}
}
} else if (spellname == "haste") {
write("You become quicker!");
_root.haste = 2;
_root.justhasted = 1;
} else if (spellname == "magic_missile") {
var mydamageroll = (Math.ceil(Math.random() * 4) + 1);
write(("You hit! 1d4+1: <b>" + mydamageroll) + "</b> damage!");
monsterhp = monsterhp - mydamageroll;
if (monsterhp >= 1) {
setnumber("monsterhp", monsterhp);
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
} else {
setnumber("monsterhp", 0);
}
} else if (spellname == "sleep") {
if (getnumber("monsterhp") > 0) {
if (monster_has_tag("mindless")) {
write(("The " + _root.monstername) + " can't sleep.");
} else if (_root.monsterhd > 4) {
write(("The " + _root.monstername) + " is too high level.");
} else {
monster1exists = 0;
write(("The " + _root.monstername) + " falls asleep!");
clear_monster(1);
}
}
if (getnumber("monster2hp") > 0) {
if (monster_has_tag("mindless", 2)) {
write(("The " + _root.monster2name) + " can't sleep.");
} else if (_root.monster2hd > 4) {
write(("The " + _root.monster2name) + " is too high level.");
} else {
monster2exists = 0;
write(("The " + _root.monster2name) + " falls asleep!");
clear_monster(2);
}
}
}
_root.spells--;
if ((getnumber("monsterhp") == 0) && (monster1exists)) {
if (_root.monstername != "") {
setnumber("monstermaxhp", 0);
write(("The " + _root.monstername) + " is killed!", 1);
var myxp = (_root.monsterhd * 10);
addnumber("xp", myxp);
write(("Earned " + myxp) + " XP!");
clear_monster(1);
}
}
if ((getnumber("monster2hp") == 0) && (monster2exists)) {
if (_root.monster2name != "") {
setnumber("monster2maxhp", 0);
var myxp = (_root.monster2hd * 10);
addnumber("xp", myxp);
write(("Earned " + myxp) + " XP!");
write(("The " + _root.monster2name) + " is killed!", 1);
clear_monster(2);
}
}
try_to_promote_monster();
if (!noattack) {
attack(0, 2);
}
}
function memorized(spellname) {
if (_root.characterclass == "Cleric") {
if ((((spellname == "animate_dead") || (spellname == "command")) || (spellname == "cure_light_wounds")) || (spellname == "sanctuary")) {
if (_root.spells > 0) {
return(1);
}
}
}
if (_root.characterclass == "Wizard") {
if ((((spellname == "magic_missile") || (spellname == "sleep")) || (spellname == "haste")) || (spellname == "charm")) {
if (has_item("scroll_of_" + spellname)) {
if (_root.spells > 0) {
return(1);
}
}
}
}
return(0);
}
function has_spell() {
if ((_root.characterclass == "Wizard") || (_root.characterclass == "Cleric")) {
return(1);
}
return(0);
}
function use_a_noncombat_item(dead_end_mode) {
if ((dead_end_mode == null) || (dead_end_mode == undefined)) {
dead_end_mode = 0;
}
write("Use:");
if (has_item("healing_potion")) {
write("<b>healing (p)otion</b> to heal 1d8+1 damage?");
add_to_key("p", "use_this_item", "healing_potion", "noncombat", dead_end_mode);
}
if ((has_item("scroll_of_cure_light_wounds") && (wisbonus())) && (((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
write("scroll of <b>(c)ure light wounds</b> to heal 1d8+1 damage?");
add_to_key("c", "use_this_item", "scroll_of_cure_light_wounds", "noncombat", dead_end_mode);
}
if (has_item("potion_of_treasure_finding")) {
write("potion of <b>(t)reasure finding</b> to head towards the nearest useful dungeon cache?");
add_to_key("t", "use_this_item", "potion_of_treasure_finding", "noncombat", dead_end_mode);
}
if (has_item("libram_of_improvement")) {
write("<b>(l)ibram of improvement</b> to improve one of your stats?");
add_to_key("l", "use_this_item", "libram_of_improvement", "noncombat", dead_end_mode);
}
if (has_item("amulet_of_recall")) {
write("<b>(a)mulet of recall</b>, to go back to town?");
add_to_key("a", "use_this_item", "amulet_of_recall", "noncombat", dead_end_mode);
}
write("<b>(n)one?</b>");
if (_root.intown == 1) {
add_to_key("n", "town");
} else if (dead_end_mode > 0) {
add_to_key("n", "dead_end", dead_end_mode);
} else {
add_to_key("n", "movementphase");
}
}
function use_an_item(dead_end_mode) {
write("Use:");
if ((has_item("blessed_symbol") && (wisbonus())) && ((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber"))) {
write("<b>(b)lessed symbol</b> against undead?");
add_to_key("b", "use_this_item", "blessed_symbol");
}
if (has_item("healing_potion")) {
write("<b>healing (p)otion</b> to heal 1d8+1 damage?");
add_to_key("p", "use_this_item", "healing_potion");
}
if (has_item("oil_flask")) {
write("<b>(o)il flask</b> to do 2d6 damage?");
add_to_key("o", "use_this_item", "oil_flask");
}
if (has_item("quickness_potion")) {
write("<b>(q)uickness potion</b> to give you double attacks?");
add_to_key("q", "use_this_item", "quickness_potion");
}
if (has_item("van_helsing_kit")) {
write("<b>(v)an helsing kit</b> to kill vampires, werewolves, or medusae?");
add_to_key("v", "use_this_item", "van_helsing_kit");
}
if (has_item("wand_of_magic_missiles") && ((_root.characterclass == "Wizard") || (_root.characterclass == "Dungeon Robber"))) {
write("<b>(w)and of magic missiles</b> (1d4+1 automatic damage, 1 in 20 chance of breaking)?");
add_to_key("w", "use_this_item", "wand_of_magic_missiles");
}
if ((has_item("scroll_of_cure_light_wounds") && (wisbonus())) && (((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
write("scroll of <b>(c)ure light wounds</b> to heal 1d8+1 damage?");
add_to_key("c", "use_this_item", "scroll_of_cure_light_wounds");
}
if ((has_item("scroll_of_command") && (wisbonus())) && (((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
write("<b>scroll of <b>comman(d)</b> to tell the monster to flee?");
add_to_key("d", "use_this_item", "scroll_of_command");
}
if ((has_item("scroll_of_sanctuary") && (wisbonus())) && (((_root.characterclass == "Cleric") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
write("<b>scroll of <b>sanctuar(y)</b> to prevent the monster from attacking you?");
add_to_key("y", "use_this_item", "scroll_of_sanctuary");
}
if ((has_item("scroll_of_charm") && (intbonus())) && (((_root.characterclass == "Wizard") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
if ((_root.characterclass == "Wizard") && (has_item("scroll_of_charm", 1) == 1)) {
write("<font color=\"#666666\">scroll of charm (needed for spells)</font>");
} else {
write("<b>scroll of <b>cha(r)m</b> to make an intelligent monster your ally?");
add_to_key("r", "use_this_item", "scroll_of_charm");
}
}
if ((has_item("scroll_of_haste") && (intbonus())) && (((_root.characterclass == "Wizard") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
if ((_root.characterclass == "Wizard") && (has_item("scroll_of_haste", 1) == 1)) {
write("<font color=\"#666666\">scroll of haste (needed for spells)</font>");
} else {
write("<b>scroll of <b>(h)aste</b> to give you and allies double attacks?");
add_to_key("h", "use_this_item", "scroll_of_haste");
}
}
if ((has_item("scroll_of_magic_missile") && (intbonus())) && (((_root.characterclass == "Wizard") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
if ((_root.characterclass == "Wizard") && (has_item("scroll_of_magic_missile", 1) == 1)) {
write("<font color=\"#666666\">scroll of magic missile (needed for spells)</font>");
} else {
write("<b>scroll of <b>(m)agic missile</b> to do automatic 1d4+1 damage?");
add_to_key("m", "use_this_item", "scroll_of_magic_missile");
}
}
if ((has_item("scroll_of_sleep") && (intbonus())) && (((_root.characterclass == "Wizard") || (_root.characterclass == "Dungeon Robber")) || (_root.characterclass == "Thief"))) {
if ((_root.characterclass == "Wizard") && (has_item("scroll_of_sleep", 1) == 1)) {
write("<font color=\"#666666\">scroll of sleep (needed for spells)</font>");
} else {
write("<b>scroll of <b>(s)leep</b> to put low-level monsters to sleep?");
add_to_key("s", "use_this_item", "scroll_of_sleep");
}
}
write("<b>(n)one?</b>");
add_to_key("n", "choosefight");
}
function use_this_item(this_item, combatmode, dead_end_mode) {
_root.monsteraware = 0;
var _local3 = getnumber("monsterhp");
monster2hp = getnumber("monster2hp");
var _local19 = getnumber("monstermaxhp");
monster2maxhp = getnumber("monster2maxhp");
var _local9 = getnumber("monsterac");
monster2ac = getnumber("monster2ac");
var _local11 = _local3;
var _local10 = monster2hp;
if ((dead_end_mode == null) || (dead_end_mode == undefined)) {
dead_end_mode = 0;
}
if (this_item == "blessed_symbol") {
if (has_item("blessed_symbol")) {
if (monster_has_tag("undead")) {
var _local15 = Math.ceil(Math.random() * 2);
if (_local15 == 1) {
clear_monster(1);
_local11 = 0;
write("The undead creature flees at the sight of the holy relic!");
} else {
write("The undead creature resists the urge to flee!");
}
} else {
write(("The " + _root.monstername) + " is unaffected by the symbol!");
}
if (getnumber("monster2hp") > 0) {
if (monster_has_tag("undead", 2)) {
var _local15 = Math.ceil(Math.random() * 2);
if (_local15 == 1) {
clear_monster(2);
_local10 = 0;
write("The undead creature flees at the sight of the holy relic!");
} else {
write("The undead creature resists the urge to flee!");
}
} else {
write(("The " + _root.monster2name) + " is unaffected by the symbol!");
}
}
}
}
if ((this_item == "healing_potion") && (has_item("healing_potion"))) {
if (getnumber("hp") < getnumber("maxhp")) {
add_equipment("healing_potion", -1);
var _local13 = Math.ceil(Math.random() * 8) + 1;
addnumber("hp", _local13);
if (getnumber("hp") > getnumber("maxhp")) {
setnumber("hp", getnumber("maxhp"));
}
write(("You healed up to " + getnumber("hp")) + " HP!");
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
} else {
write("You are already at full health!");
}
}
if ((this_item == "oil_flask") && (has_item("oil_flask"))) {
add_equipment("oil_flask", -1);
var _local5 = getnumber("attackbonus");
if (((_root.weapon == "+1_sword") || (_root.weapon == "+1_dagger")) || (_root.weapon == "+1_mace")) {
_local5--;
}
if (_root.sanctuary == 1) {
_root.sanctuary = 0;
write("Sanctuary ends!");
}
var _local14 = Math.ceil(Math.random() * 20) + _local5;
write(((((((("You attack the " + _root.monstername) + "! d20+") + _local5) + ": <b>") + _local14) + "</b> vs AC ") + _local9) + "!");
if (_local14 >= _local9) {
var _local12 = Math.ceil(Math.random() * 6) + Math.ceil(Math.random() * 6);
if (monster_has_tag("fiery", 1)) {
_local12 = 0;
}
write(("You hit! 2d6: <b>" + _local12) + "</b> damage!");
_local3 = _local3 - _local12;
if (_local3 >= 1) {
setnumber("monsterhp", _local3);
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
} else {
setnumber("monsterhp", 0);
}
}
if (getnumber("monster2hp") > 0) {
_local14 = Math.ceil(Math.random() * 20) + _local5;
write(((((((("You attack the " + _root.monster2name) + "! d20+") + _local5) + ": <b>") + _local14) + "</b> vs AC ") + monster2ac) + "!");
if (_local14 >= monster2ac) {
var _local12 = Math.ceil(Math.random() * 6) + Math.ceil(Math.random() * 6);
if (monster_has_tag("fiery", 2)) {
_local12 = 0;
}
write(("You hit! 2d6: <b>" + _local12) + "</b> damage!");
monster2hp = monster2hp - _local12;
if (monster2hp >= 1) {
setnumber("monster2hp", monster2hp);
_root.monster2hp.hpblood._alpha = 100 - int((getnumber("monster2hp") / getnumber("monster2maxhp")) * 100);
} else {
setnumber("monster2hp", 0);
}
}
}
}
if ((this_item == "quickness_potion") && (has_item("quickness_potion"))) {
_root.haste = 1;
add_equipment("quickness_potion", -1);
}
if ((this_item == "van_helsing_kit") && (has_item("van_helsing_kit"))) {
if (((_root.monstername == "Medusa") || (_root.monstername == "Werewolf")) || (_root.monstername == "Vampire")) {
if (_root.monstername == "Medusa") {
var _local16 = "mirror";
}
if (_root.monstername == "Werewolf") {
var _local16 = "wolfsbane";
}
if (_root.monstername == "Vampire") {
var _local16 = "stake";
}
var _local5 = getnumber("attackbonus");
if (((_root.weapon == "+1_sword") || (_root.weapon == "+1_dagger")) || (_root.weapon == "+1_mace")) {
_local5--;
}
if (_root.sanctuary == 1) {
_root.sanctuary = 0;
write("Sanctuary ends!");
}
var _local14 = Math.ceil(Math.random() * 20) + _local5;
write(((((((("You attack the " + _root.monstername) + " with your ") + _local16) + "! d20+") + _local5) + ": <b>") + _local14) + "</b> vs AC 10!");
if (_local14 >= 10) {
write("You hit!");
setnumber("monsterhp", 0);
}
} else if (((_root.monster2name == "Medusa") || (_root.monster2name == "Werewolf")) || (_root.monster2name == "Vampire")) {
if (_root.monster2name == "Medusa") {
var _local16 = "mirror";
}
if (_root.monster2name == "Werewolf") {
var _local16 = "wolfsbane";
}
if (_root.monster2name == "Vampire") {
var _local16 = "stake";
}
if (getnumber("monster2hp") > 0) {
var _local14 = Math.ceil(Math.random() * 20) + _local5;
write(((((((("You attack the " + _root.monster2name) + " with your ") + _local16) + "! d20+") + _local5) + ": <b>") + _local14) + "</b> vs AC 10!");
if (_local14 >= 10) {
write("You hit!");
setnumber("monster2hp", 0);
}
}
} else {
write("There are no medusae, vampires, or werewolves to fight with your monster-hunting supplies!");
}
}
if ((this_item == "wand_of_magic_missiles") && (has_item("wand_of_magic_missiles"))) {
var _local14 = Math.ceil(Math.random() * 20);
if (_root.sanctuary == 1) {
_root.sanctuary = 0;
write("Sanctuary ends!");
}
if (_local14 == 1) {
add_equipment("wand_of_magic_missiles", -1);
write("Your wand of magic missiles sputters and dies!");
} else {
var _local12 = Math.ceil(Math.random() * 4) + 1;
write(("You hit! 1d4+1: <b>" + _local12) + "</b> damage!");
_local3 = _local3 - _local12;
if (_local3 >= 1) {
setnumber("monsterhp", _local3);
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
} else {
setnumber("monsterhp", 0);
}
}
}
if ((this_item == "scroll_of_cure_light_wounds") && (has_item("scroll_of_cure_light_wounds"))) {
if (!wisbonus()) {
write("You are not wise enough to use this cleric scroll!");
} else {
add_equipment("scroll_of_cure_light_wounds", -1);
cast_this_spell("cure_light_wounds", 1);
}
}
if ((this_item == "scroll_of_command") && (has_item("scroll_of_command"))) {
if (!wisbonus()) {
write("You are not wise enough to use this cleric scroll!");
} else {
add_equipment("scroll_of_command", -1);
cast_this_spell("command", 1);
}
}
if ((this_item == "scroll_of_sanctuary") && (has_item("scroll_of_sanctuary"))) {
if (!wisbonus()) {
write("You are not wise enough to use this cleric scroll!");
} else {
add_equipment("scroll_of_sanctuary", -1);
cast_this_spell("sanctuary", 1);
}
}
if ((this_item == "scroll_of_charm") && (has_item("scroll_of_charm"))) {
if (!intbonus()) {
write("You are not intelligent enough to use this wizard scroll!");
} else {
add_equipment("scroll_of_charm", -1);
cast_this_spell("charm", 1);
}
}
if ((this_item == "scroll_of_haste") && (has_item("scroll_of_haste"))) {
if (!intbonus()) {
write("You are not intelligent enough to use this wizard scroll!");
} else {
add_equipment("scroll_of_haste", -1);
cast_this_spell("haste", 1);
}
}
if ((this_item == "scroll_of_magic_missile") && (has_item("scroll_of_magic_missile"))) {
if (!intbonus()) {
write("You are not intelligent enough to use this wizard scroll!");
} else {
add_equipment("scroll_of_magic_missile", -1);
cast_this_spell("magic_missile", 1);
}
}
if ((this_item == "scroll_of_sleep") && (has_item("scroll_of_sleep"))) {
if (!intbonus()) {
write("You are not intelligent enough to use this wizard scroll!");
} else {
add_equipment("scroll_of_sleep", -1);
cast_this_spell("sleep", 1);
}
}
if ((this_item == "potion_of_treasure_finding") && (has_item("potion_of_treasure_finding"))) {
add_equipment("potion_of_treasure_finding", -1);
_root.treasure_finding = 1;
if (_root.intown == 1) {
write("You quaff the potion of treasure finding! There's no treasure to be found in town.");
} else {
write("You quaff the potion of treasure finding! You feel lucky.");
}
}
if ((this_item == "libram_of_improvement") && (has_item("libram_of_improvement"))) {
add_equipment("libram_of_improvement", -1);
var _local18 = "";
var _local4 = Math.ceil(Math.random() * 6);
if ((_local4 == 1) && (_root.histr != "hi")) {
write("Your Strength, Attack and Damage permanently improve!");
_root.histr = "hi";
var _local17 = _root.weapon;
readyitem();
} else if ((_local4 == 2) && (_root.hiint != "hi")) {
write("Your Intelligence and navigation skills permanently improve!");
_root.hiint = "hi";
} else if ((_local4 == 3) && (_root.hidex != "hi")) {
write("Your Dexterity, AC and Sneak bonus permanently improve!");
_root.hidex = "hi";
addnumber("sneakbonus", 1);
addnumber("ac", 1);
} else if ((_local4 == 4) && (_root.hicon != "hi")) {
write("Your Constitution and HP permanently improve!");
_root.hicon = "hi";
var _local6 = 1;
_local6 = _local6 + int((getnumber("characterlevel") + 1) / 2);
addnumber("hp", _local6);
addnumber("maxhp", _local6);
} else if ((_local4 == 5) && (_root.hiwis != "hi")) {
write("Your Wisdom and Saving Throws permanently improve!");
_root.hiwis = "hi";
addnumber("savingthrow", -1);
} else if ((_local4 == 6) && (_root.hicha != "hi")) {
write("Your Charisma, Parley and maximum henchmen permanently improve!");
_root.hicha = "hi";
} else {
add_equipment("libram_of_unnecessary_improvement", 1);
write("You already know everything this book can teach you! Oh well, you can sell it for a pretty penny.");
}
}
if ((this_item == "amulet_of_recall") && (has_item("amulet_of_recall"))) {
write("You are teleported back to town.");
town();
return(undefined);
}
if (combatmode == "noncombat") {
if (_root.intown == 1) {
gotit("town", "(g)reat!", "g");
} else if (dead_end_mode > 0) {
dead_end(dead_end_mode);
} else {
gotit("movementphase", "(g)reat!", "g");
}
} else {
if ((((getnumber("monsterhp") == 0) && (_local11)) && (_root.monstername != undefined)) && (_root.monstername != "")) {
setnumber("monstermaxhp", 0);
write(("The " + _root.monstername) + " is killed!", 1);
var _local8 = _root.monsterhd * 10;
addnumber("xp", _local8);
write(("Earned " + _local8) + " XP!");
clear_monster(1);
}
if ((getnumber("monster2hp") == 0) && (_local10)) {
setnumber("monster2maxhp", 0);
write(("The " + _root.monster2name) + " is killed!", 1);
var _local8 = _root.monsterhd * 10;
addnumber("xp", _local8);
write(("Earned " + _local8) + " XP!");
clear_monster(2);
}
try_to_promote_monster();
attack(0, 2);
}
}
function parley(bribe) {
var reaction = (Math.ceil(Math.random() * 6) + Math.ceil(Math.random() * 6));
reaction = reaction + chabonus();
if (bribe) {
reaction = reaction + 2;
if (monster_has_tag("greedy")) {
reaction = reaction + 2;
write(_root.monstername + " can't resist gold!");
}
}
write(("Reaction roll: " + reaction) + "!");
if (reaction <= 5) {
write("Diplomacy fails!");
attack(0, 1);
} else if (reaction <= 8) {
if (bribe) {
pay(getnumber("dungeonlevel") * 10);
}
writestring = "The monster hesitates! Will you ";
if (monster_has_tag("intelligent")) {
writestring = writestring + "<b>(p)arley</b>, ";
add_to_key("p", "parley");
if (yourwealth >= (getnumber("dungeonlevel") * 10)) {
add_to_key("b", "bribe");
writestring = writestring + "<b>(b)ribe</b>, ";
}
if (getnumber("dungeonlevel") > 0) {
if (((_root.armor != "plate_mail") && (_root.armor != "+1_plate_mail")) || (monster_has_tag("immobile"))) {
writestring = writestring + "<b>(r)etreat</b>, ";
add_to_key("r", "retreat");
}
}
if (has_usable_item()) {
writestring = writestring + "<b>(u)se</b> an item, ";
add_to_key("u", "use_an_item");
}
if (has_spell()) {
writestring = writestring + "<b>(c)ast</b> a spell, ";
add_to_key("c", "cast_a_spell");
}
writestring = writestring + "<b>(a)ttack</b>?";
add_to_key("a", "attack");
write(writestring);
}
} else if (reaction <= 12) {
if (bribe) {
pay(getnumber("dungeonlevel") * 10);
}
write("The monster lets you pass!");
clear_monster();
} else {
if (bribe) {
pay(getnumber("dungeonlevel") * 10);
}
write("The monster wishes to become your henchman!");
if (getnumber("henchmanhp") == 0) {
setnumber("henchmanhp", getnumber("monsterhp"));
setnumber("henchmanmaxhp", getnumber("monstermaxhp"));
setnumber("henchmanac", getnumber("monsterac"));
namepet(_root.monstername, 1);
_root.henchmannumber = _root.monsternumber;
_root.henchmanhd = _root.monsterhd;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchmantags = _root.monstertags;
eval (((("_root.henchmanwhite.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
} else if ((getnumber("henchman2hp") == 0) && (chabonus())) {
write("Because of your great charisma, the monster agrees to serve as a second henchman!");
setnumber("henchman2hp", getnumber("monsterhp"));
setnumber("henchman2maxhp", getnumber("monstermaxhp"));
setnumber("henchman2ac", getnumber("monsterac"));
namepet(_root.monstername, 2);
_root.henchman2number = _root.monsternumber;
_root.henchman2hd = _root.monsterhd;
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.henchman2tags = _root.monstertags;
eval (((("_root.henchman2white.monster" + _root.henchman2hd) + "_") + _root.henchman2number) + "white")._alpha = 100;
} else {
write("You already have a henchman. The monster departs.");
}
clear_monster();
}
if (reaction >= 9) {
if ((_root.monstersource == "wandering") || (_root.monstersource == "door")) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else if ((_root.monstersource == "monster") || (_root.monstersource == "monsterandtreasure")) {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "takepassage") {
takepassage(_root.upcomingturn);
} else if (_root.intown == 1) {
town();
}
}
}
function retreat() {
var _local2 = " The monster pursues you.";
if (monster_has_tag("immobile")) {
_local2 = "";
}
write("You run away!" + _local2);
if (((_root.haste == 1) && (getnumber("henchmanhp") == 0)) || (_root.haste == 2)) {
write("You run with magical expedition and easily escape.");
clear_monster(1);
clear_monster(2);
}
lostme(2);
if ((_root.monstersource == "wandering") || (_root.monstersource == "door")) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else if ((_root.monstersource == "monster") || (_root.monstersource == "monsterandtreasure")) {
add_to_master("move_to", "exits", 0.7);
add_to_master("roll", "exits", 20);
run_master();
} else if (_root.monstersource == "takepassage") {
takepassage(_root.upcomingturn);
} else {
_root.monstersource = "wandering";
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
}
}
function clear_monster(monnum) {
if (((monnum == null) || (monnum == 0)) || (monnum == 1)) {
setnumber("monsterhp", 0);
setnumber("monstermaxhp", 0);
_root.monsterhp.hpblood._alpha = 0;
setnumber("monsterac", 0);
_root.monstername = "";
_root.monsterhd = 0;
_root.monsternumber = 0;
var n = 0;
while (n <= 5) {
var o = 0;
while (o <= 10) {
eval (((("_root.monsterwhite.monster" + o) + "_") + n) + "white")._alpha = 0;
o++;
}
n++;
}
_root.monsterwhite.monster5_5white._alpha = 0;
_root.monsterhp._alpha = 0;
_root.monsterstunned = 0;
_root.monsterheld = 0;
_root.monsterac._alpha = 0;
var monstertags = new Object();
_root.monstertags = monstertags;
}
if (((monnum == null) || (monnum == 0)) || (monnum == 2)) {
setnumber("monster2hp", 0);
setnumber("monster2ac", 0);
setnumber("monster2maxhp", 0);
_root.monster2hp.hpblood._alpha = 0;
_root.monster2name = "";
_root.monster2hd = 0;
_root.monster2number = 0;
var n = 1;
while (n <= 4) {
var o = 1;
while (o <= 10) {
eval (((("_root.monster2white.monster" + o) + "_") + n) + "white")._alpha = 0;
o++;
}
n++;
}
_root.monsterwhite.monster5_5white._alpha = 0;
_root.monster2hp._alpha = 0;
_root.monster2stunned = 0;
_root.monster2held = 0;
_root.monster2ac._alpha = 0;
var monster2tags = new Object();
_root.monster2tags = monster2tags;
}
if ((getnumber("monsterhp") == 0) && (getnumber("monster2hp") == 0)) {
if (_root.lost == 2) {
var randy = Math.ceil(Math.random() * 20);
var fixed = 0;
if (intbonus()) {
var randy2 = Math.ceil(Math.random() * 20);
if ((randy < getnumber("roomnumber")) && (randy2 > getnumber("roomnumber"))) {
randy = randy2;
fixed = 1;
}
if ((randy < getnumber("roomnumber")) && (randy2 < randy)) {
randy = randy2;
}
}
if (randy >= getnumber("roomnumber")) {
if (fixed == 1) {
write("You stop running. Due to your superior intelligence, you know exactly where you are.");
lostme(0);
} else {
write("You stop running. This area looks familiar.");
lostme(0);
}
} else {
write("You stop running. This area looks unfamiliar. You're lost!");
lostme(1);
}
turn(0);
}
}
}
function clear_henchman(monnum) {
if (((monnum == null) || (monnum == 0)) || (monnum == 1)) {
setnumber("henchmanhp", 0);
setnumber("henchmanmaxhp", 0);
_root.henchmanhp.hpblood._alpha = 0;
setnumber("henchmanac", 0);
_root.henchmanname = "";
_root.henchmanhd = 0;
_root.henchmanstunned = 0;
_root.henchmandoppelganger = 0;
_root.henchmanheld = 0;
_root.henchmannumber = 0;
_root.hname1.mytext.text = "";
_root.hname1._alpha = 0;
var n = 0;
while (n <= 5) {
var o = 0;
while (o <= 10) {
eval (((("_root.henchmanwhite.monster" + o) + "_") + n) + "white")._alpha = 0;
o++;
}
n++;
}
_root.henchmanhp._alpha = 0;
_root.henchmanac._alpha = 0;
var henchmantags = new Object();
_root.henchmantags = henchmantags;
}
if (((monnum == null) || (monnum == 0)) || (monnum == 2)) {
setnumber("henchman2hp", 0);
setnumber("henchman2ac", 0);
setnumber("henchman2maxhp", 0);
_root.henchman2hp.hpblood._alpha = 0;
_root.henchman2name = "";
_root.henchman2hd = 0;
_root.henchman2stunned = 0;
_root.henchman2doppelganger = 0;
_root.hname2.mytext.text = "";
_root.henchman2held = 0;
_root.henchman2number = 0;
_root.hname2._alpha = 0;
var n = 0;
while (n <= 5) {
var o = 0;
while (o <= 10) {
eval (((("_root.henchman2white.monster" + o) + "_") + n) + "white")._alpha = 0;
o++;
}
n++;
}
_root.henchman2hp._alpha = 0;
_root.henchman2ac._alpha = 0;
var henchman2tags = new Object();
_root.henchman2tags = henchman2tags;
}
}
function strbonus() {
ret = 0;
if (_root.histr == "hi") {
ret = 1;
}
if ((_root.readied.gauntlets_of_ogre_power == 1) || (_root.strengthspell == 1)) {
ret++;
}
return(ret);
}
function dexbonus() {
if (_root.hidex == "hi") {
return(1);
}
return(0);
}
function intbonus() {
if (_root.hiint == "hi") {
return(1);
}
return(0);
}
function conbonus() {
if (_root.hicon == "hi") {
return(1);
}
return(0);
}
function wisbonus() {
if (_root.hiwis == "hi") {
return(1);
}
return(0);
}
function chabonus() {
if (_root.hicha == "hi") {
return(1);
}
return(0);
}
function death() {
while (_root.masterlist.length > 0) {
remove_from_master();
}
write("\n<font color=\"#ff0000\"><b>You died!</b></font>\n");
var _local2 = ((((_root.charactername + ", a level ") + getnumber("characterlevel")) + " ") + _root.characterclass) + ".";
var _local3 = _root.accomplishments_killedby;
if (getnumber("dungeonlevel") == 0) {
var _local5 = _local3.substr(0, 1);
var _local6 = _local3.substr(1, _local3.length);
_local3 = _local5.toUpperCase() + _local6;
_local2 = _local2 + ((" " + _local3) + " in the coliseum.");
} else {
_local2 = _local2 + ((((" Descended to level " + _root.accomplishments_deepestlevel) + " of the dungeon and won ") + yourwealth()) + " GP");
if (_root.accomplishments_magicitem) {
_local2 = _local2 + (" and " + print_pretty(_root.accomplishments_magicitem, 0, "a"));
}
if (_root.accomplishments_toughestmonster) {
_local2 = _local2 + (". Defeated a " + _root.accomplishments_toughestmonster);
}
if (getnumber("dungeonlevel") < _root.accomplishments_deepestlevel) {
_local2 = _local2 + (". On the return to the surface, " + _root.accomplishments_killedby);
} else if (_local3 != null) {
_local3 = _root.accomplishments_killedby;
var _local5 = _local3.substr(0, 1);
var _local6 = _local3.substr(1, _local3.length);
_local3 = _local5.toUpperCase() + _local6;
_local2 = _local2 + (". " + _local3);
}
_local2 = _local2 + ((" on level " + getnumber("dungeonlevel")) + "!");
}
var _local4 = "";
if (_root.gender == "m") {
_local4 = "his ";
}
if (_root.gender == "f") {
_local4 = "her ";
}
if (_root.henchman2name) {
_local2 = _local2 + ((((((" Mourned by " + _local4) + "faithful companions ") + _root.henchmanname) + " and ") + _root.henchman2name) + ".");
} else if (_root.henchmanname) {
_local2 = _local2 + ((((" Mourned by " + _local4) + "faithful companion ") + _root.henchmanname) + ".");
}
_root.epitaph = _local2;
_root.savegames.data.save_zero = null;
if (_root.gamemode == "game3") {
deletesave(_root.characterid);
bury();
} else {
write("<b>(q)uit</b> to Load Game menu? or permanently <b>(r)etire</b> this character to the graveyard?");
add_to_key("q", "restart");
add_to_key("r", "bury");
}
_root.dungeonmap.village._alpha = 100;
move_to("start", 2);
_root.gameover = 1;
}
function bury() {
writeepitaph(_root.epitaph);
write(_root.epitaph + " REST IN PEACE", 5);
_root.epitaph = null;
deletesave(_root.characterid);
write("<b>(c)ontinue</b> to main menu");
add_to_key("c", "restart");
}
function deletecharacter() {
writeepitaph(_root.epitaph);
_root.epitaph = null;
deletesave(_root.characterid);
restart();
}
function writeepitaph(myepitaph) {
if (eval ("_root.savegames.data." + _root.gamemode).epitaphs == null) {
eval ("_root.savegames.data." + _root.gamemode).epitaphs = new Array();
}
eval ("_root.savegames.data." + _root.gamemode).epitaphs.push(myepitaph);
}
function forcedoor(mydirection, forcemode) {
if (((forcemode == "") || (forcemode == null)) || (forcemode == undefined)) {
forcemode = "f";
}
if (mydirection != null) {
_root.lastdoordirection = mydirection;
}
var _local2 = Math.ceil(Math.random() * 6);
if (forcemode == "f") {
_local2 = _local2 + strbonus();
}
if (forcemode == "p") {
_local2 = _local2 + 1;
}
if ((_local2 <= 3) && (getnumber("monsterhp") > 0)) {
write("You throw yourself against the door to escape the monster, but it doesn't budge!");
attack(0, 1);
} else if ((_local2 == 3) && (forcemode == "f")) {
_root.monstersource = "door";
write(("Roll: " + _local2) + "! Your banging on the door attracts a monster.");
_root.monsteraware = 1;
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local5 = getnumber("dungeonlevel");
if (_local5 > 10) {
_local5 = 10;
}
add_to_master("roll", ("monster" + _local5) + "_", 4);
run_master();
} else if ((_local2 <= 3) && (forcemode == "p")) {
write(("Roll: " + _local2) + "! Your can't pick this lock.");
if (mydirection == "left") {
write("Try to <b>(f)orce</b> it or <b>(c)ontinue</b> down the passage?");
add_to_key("f", "forcedoor", "left");
add_to_key("c", "explore");
} else if (mydirection == "ahead") {
write("Try to <b>(f)orce</b> it or <b>(b)acktrack</b>?");
add_to_key("b", "backtrack");
add_to_key("f", "forcedoor", "ahead");
} else if (mydirection == "right") {
write("Try to <b>(f)orce</b> it or <b>(c)ontinue</b> down the passage?");
add_to_key("f", "forcedoor", "right");
add_to_key("c", "explore");
}
} else if ((_local2 < 3) && (forcemode == "f")) {
write(("Roll: " + _local2) + "! Your loud attempts to open the door are unsuccessful.");
_root.monsteraware = 1;
if (mydirection == "left") {
write("Try to <b>(f)orce</b> it again or <b>(c)ontinue</b> down the passage?");
add_to_key("f", "forcedoor", "left");
add_to_key("c", "explore");
} else if (mydirection == "ahead") {
write("Try to <b>(f)orce</b> it again or <b>(b)acktrack</b>?");
add_to_key("b", "backtrack");
add_to_key("f", "forcedoor", "ahead");
} else if (mydirection == "right") {
write("Try to <b>(f)orce</b> it again or <b>(c)ontinue</b> down the passage?");
add_to_key("f", "forcedoor", "right");
add_to_key("c", "explore");
}
} else {
write(("Roll: " + _local2) + "! You open the door.");
add_to_master("move_to", "doors2", 0.9);
add_to_master("roll", "beyonddoor", 20);
run_master();
}
}
function mydirection(num) {
if (num == 4) {
return("rear");
}
if (num == -3) {
return("back left");
}
if (num == -2) {
return("left");
}
if (num == -1) {
return("front left");
}
if (num == 0) {
return("front");
}
if (num == 1) {
return("front right");
}
if (num == 2) {
return("right");
}
if (num == 3) {
return("back right");
}
}
function monster_has_tag(tag, monnum) {
if ((monnum == 0) || (monnum == null)) {
monnum = 1;
}
if (monnum == 1) {
if (_root.monstertags[tag] == 1) {
return(1);
}
if (_root.monstertags[tag] == undefined) {
return(0);
}
} else {
if (_root.monster2tags[tag] == 1) {
return(1);
}
if (_root.monster2tags[tag] == undefined) {
return(0);
}
}
return(0);
}
function henchman_has_tag(tag, monnum) {
if ((monnum == 0) || (monnum == null)) {
monnum = 1;
}
if (monnum == 1) {
if (_root.henchmantags[tag] == 1) {
return(1);
}
if (_root.henchmantags[tag] == undefined) {
return(0);
}
} else {
if (_root.henchman2tags[tag] == 1) {
return(1);
}
if (_root.henchman2tags[tag] == undefined) {
return(0);
}
}
return(0);
}
function usable_by_class(it) {
if (it.sell == undefined) {
return(1);
}
if (((((_root.characterclass == "Wizard") && (it.wizard == 0)) || ((_root.characterclass == "Fighter") && (it.fighter == 0))) || ((_root.characterclass == "Cleric") && (it.cleric == 0))) || ((_root.characterclass == "Thief") && (it.thief == 0))) {
return(0);
}
if ((_root.characterclass == "Dungeon Robber") && (it == "blessed_symbol")) {
if (!wisbonus()) {
return(0);
}
}
if ((_root.characterclass == "Dungeon Robber") || (_root.characterclass == "Thief")) {
var _local3 = it.itemname.split("_");
if (_local3[0] == "scroll") {
if ((it.wizard == 1) && (!intbonus())) {
return(0);
}
if ((it.cleric == 1) && (!wisbonus())) {
return(0);
}
}
}
return(1);
}
function make_item(itemname, sell, prereq, storetype, heavy, readyable, byclass, summary, junk, fake) {
var _local4 = new Object();
_root.itemlist[itemname] = _local4;
_root.itemlist[itemname].itemname = itemname;
_root.itemlist[itemname].sell = sell;
_root.itemlist[itemname].buy = sell * 2;
_root.itemlist[itemname].prereq = prereq;
_root.itemlist[itemname].storetype = storetype;
_root.itemlist[itemname].heavy = heavy;
_root.itemlist[itemname].readyable = readyable;
_root.itemlist[itemname].byclass = byclass;
if (byclass == "") {
_root.itemlist[itemname].byclass = "f:c:w:t";
}
_root.itemlist[itemname].byclass = _root.itemlist[itemname].byclass.split(":");
_root.itemlist[itemname].fighter = 0;
_root.itemlist[itemname].wizard = 0;
_root.itemlist[itemname].cleric = 0;
_root.itemlist[itemname].thief = 0;
var _local3 = 0;
while (_local3 < _root.itemlist[itemname].byclass.length) {
if (_root.itemlist[itemname].byclass[_local3] == "f") {
_root.itemlist[itemname].fighter = 1;
}
if (_root.itemlist[itemname].byclass[_local3] == "w") {
_root.itemlist[itemname].wizard = 1;
}
if (_root.itemlist[itemname].byclass[_local3] == "c") {
_root.itemlist[itemname].cleric = 1;
}
if (_root.itemlist[itemname].byclass[_local3] == "t") {
_root.itemlist[itemname].thief = 1;
}
_local3++;
}
_root.itemlist[itemname].summary = summary;
_root.itemlist[itemname].junk = junk;
_root.itemlist[itemname].fake = fake;
_local3 = 0;
while (_local3 < 100) {
if (_root.itemlist[_local3] == null) {
_root.itemlist[_local3] = _root.itemlist[itemname];
break;
}
_local3++;
}
}
function get_item(itemname) {
return(_root.itemlist[itemname]);
}
function is_heavy() {
_root.charsheet.burden.text = "Burden: Heavy";
if (_root.armor == "plate_mail") {
return(1);
}
n = 0;
while (n < 15) {
if (_root.possessions[n][0] != undefined) {
if (_root.itemlist[_root.possessions[n][0]].heavy == 1) {
return(1);
}
}
n++;
}
if (_root.holder != "sack") {
if (((((((getnumber("jewelry") + getnumber("gems")) + getnumber("pp")) + getnumber("gp")) + getnumber("ep")) + getnumber("sp")) + getnumber("cp")) > 100) {
return(1);
}
}
_root.charsheet.burden.text = "Burden: Light";
return(0);
}
function backuptoserver() {
var _local2 = new JSON();
var _local3 = _local2.stringify(_root.savegames.data);
if (_root.savegames.data.revision_number == null) {
_root.savegames.data.revision_number = 0;
}
_root.savegames.data.revision_number++;
}
function deletesave(myid) {
if (_root.savegames.data.save_zero.characterid == myid) {
_root.savegames.data.save_zero = null;
}
if (_root.savegames.data.save_one.characterid == myid) {
_root.savegames.data.save_one = null;
}
if (_root.savegames.data.save_two.characterid == myid) {
_root.savegames.data.save_two = null;
}
if (_root.savegames.data.save_three.characterid == myid) {
_root.savegames.data.save_three = null;
}
if (_root.savegames.data.save_four.characterid == myid) {
_root.savegames.data.save_four = null;
}
savehtml();
}
function save(destination) {
var _local1 = savegame(1, destination);
if (_local1 == -1) {
return(undefined);
}
write("Saved game!");
if (destination == "town") {
town();
}
}
function savegame(saveslot, savedestination) {
if ((saveslot == false) || (saveslot == null)) {
saveslot = 0;
}
if (_root.gamemode == "game3") {
saveslot = 1;
}
if ((getnumber("hp") == 0) || (getnumber("hp") == null)) {
return(undefined);
}
if (_root.gameover == 1) {
return(undefined);
}
if (savedestination == null) {
savedestination = "";
}
_root.savedestination = savedestination;
if (_root.savegames.data.save_zero == null) {
_root.savegames.data.save_zero = new Object();
}
if (_root.savegames.data.save_one == null) {
_root.savegames.data.save_one = new Object();
}
if (_root.savegames.data.save_two == null) {
_root.savegames.data.save_two = new Object();
}
if (_root.savegames.data.save_three == null) {
_root.savegames.data.save_three = new Object();
}
if (_root.savegames.data.save_four == null) {
_root.savegames.data.save_four = new Object();
}
if (saveslot == 1) {
_root.savenumber++;
if (_root.characterid == _root.savegames.data.save_one.characterid) {
saveslot = 1;
} else if (_root.characterid == _root.savegames.data.save_two.characterid) {
saveslot = 2;
} else if (_root.characterid == _root.savegames.data.save_three.characterid) {
saveslot = 3;
} else if (_root.characterid == _root.savegames.data.save_four.characterid) {
saveslot = 4;
} else if ((_root.savegames.data.save_one.characterid == null) || (_root.savegames.data.save_one.characterid == 0)) {
saveslot = 1;
} else if ((_root.savegames.data.save_two.characterid == null) || (_root.savegames.data.save_two.characterid == 0)) {
saveslot = 2;
} else if ((_root.savegames.data.save_three.characterid == null) || (_root.savegames.data.save_three.characterid == 0)) {
saveslot = 3;
} else if ((_root.savegames.data.save_four.characterid == null) || (_root.savegames.data.save_four.characterid == 0)) {
saveslot = 4;
} else {
write("<font color=\"#ff0000\"><b>WARNING:</b></font> Town is full. You can save in the Quicksave slot only. You won't be able to claim a house until another character retires or dies.");
saveslot = 0;
gotit("town");
return(-1);
}
}
var savename = "";
var savestring = "";
if (saveslot == 0) {
savename = "zero";
} else if (saveslot == 1) {
savename = "one";
} else if (saveslot == 2) {
savename = "two";
} else if (saveslot == 3) {
savename = "three";
} else if (saveslot == 4) {
savename = "four";
}
n = 0;
while (n < _root.tosave.length) {
var mything = eval ("_root." + tosave[n]);
if (typeof(mything) == "object") {
eval ("_root.savegames.data.save_" + savename)[_root.tosave[n]] = mything.copy();
} else {
eval ("_root.savegames.data.save_" + savename)[_root.tosave[n]] = mything;
}
n++;
}
if (saveslot > 0) {
savehtml();
}
}
function savehtml() {
var savestring = "";
for (proper in _root.savegames.data) {
if (proper != "save_zero") {
var mybasething = eval ("_root.savegames.data." + proper);
for (prope in mybasething) {
var mything = eval ("mybasething." + prope);
if (typeof(mything) == "object") {
var propcount = 0;
for (prop in mything) {
propcount++;
}
if (propcount == 0) {
savestring = savestring + (((("{{|}}" + proper) + "{{.}}") + prope) + "{{:}}null");
}
for (prop in mything) {
var mysubthing = eval ("mything." + prop);
if (typeof(mysubthing) == "object") {
for (pop in mysubthing) {
var mythingname = eval ("mysubthing." + pop);
if ((mythingname != "") && (mythingname != null)) {
if (typeof(eval ("mysubthing." + pop)) == "object") {
for (po in eval ("mysubthing." + pop)) {
var mythingthing = eval ((("mysubthing." + pop) + ".") + po);
savestring = savestring + ((((((((((("{{|}}" + proper) + "{{.}}") + prope) + "{{.}}") + prop) + "{{.}}") + pop) + "{{.}}") + po) + "{{:}}") + mythingthing);
}
} else {
savestring = savestring + ((((((((("{{|}}" + proper) + "{{.}}") + prope) + "{{.}}") + prop) + "{{.}}") + pop) + "{{:}}") + eval ("mysubthing." + pop));
}
}
}
} else {
savestring = savestring + ((((((("{{|}}" + proper) + "{{.}}") + prope) + "{{.}}") + prop) + "{{:}}") + mysubthing);
}
}
} else {
savestring = savestring + ((((("{{|}}" + proper) + "{{.}}") + prope) + "{{:}}") + mything);
}
}
}
}
savestring = escape(savestring);
flash.external.ExternalInterface.call(("savegame('" + savestring) + "')");
}
function loadgame(saveslot) {
if ((saveslot == false) || (saveslot == null)) {
saveslot = 0;
}
var savename = "";
var mything = "";
if (saveslot == 0) {
savename = "zero";
} else if (saveslot == 1) {
savename = "one";
} else if (saveslot == 2) {
savename = "two";
} else if (saveslot == 3) {
savename = "three";
} else if (saveslot == 4) {
savename = "four";
}
n = 0;
while (n < _root.tosave.length) {
var myth = _root.tosave[n];
if (typeof(eval ("_root.savegames.data.save_" + savename)[tosave[n]]) == "object") {
mything = eval ("_root.savegames.data.save_" + savename)[tosave[n]].copy();
for (pp in mything) {
}
} else {
mything = eval ("_root.savegames.data.save_" + savename)[tosave[n]];
}
_root[tosave[n]] = mything;
n++;
}
add_equipment();
_root.keymenu = new Array();
for (var i in _root.stats) {
setnumber(i, stats[i]);
}
if (getnumber("hp") == 0) {
setnumber("hp", 1);
}
if (_root.holder != "") {
_root.charsheet.myholder.text = _root.holder;
}
if (weapondamage == 1) {
_root.charsheet.weapondamage.text = weapondamage + weaponplus;
} else {
_root.charsheet.weapondamage.text = "1d" + weapondamage;
if (weaponplus) {
_root.charsheet.weapondamage.text = _root.charsheet.weapondamage.text + ("+" + weaponplus);
}
}
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
if (getnumber("henchmanhp") > 0) {
var henchhd = _root.henchmanhd;
eval (((("_root.henchmanwhite.monster" + henchhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.hname1._alpha = 100;
_root.henchmanhp.hpblood._alpha = 100 - int((getnumber("henchmanhp") / getnumber("henchmanmaxhp")) * 100);
_root.hname1.mytext.text = _root.henchmanname;
}
if (getnumber("henchman2hp") > 0) {
eval (((("_root.henchman2white.monster" + _root.henchman2hd) + "_") + _root.henchman2number) + "white")._alpha = 100;
_root.henchman2hp._alpha = 100;
_root.henchman2ac._alpha = 100;
_root.hname2._alpha = 100;
_root.henchman2hp.hpblood._alpha = 100 - int((getnumber("henchman2hp") / getnumber("henchman2maxhp")) * 100);
_root.hname2.mytext.text = _root.henchman2name;
}
if (getnumber("monsterhp") > 0) {
eval (((("_root.monsterwhite.monster" + _root.monsterhd) + "_") + _root.monsternumber) + "white")._alpha = 100;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
_root.monsterhp.hpblood._alpha = 100 - int((getnumber("monsterhp") / getnumber("monstermaxhp")) * 100);
}
if (getnumber("monster2hp") > 0) {
eval (((("_root.monster2white.monster" + _root.monster2hd) + "_") + _root.monster2number) + "white")._alpha = 100;
_root.monster2hp._alpha = 100;
_root.monster2ac._alpha = 100;
_root.monster2hp.hpblood._alpha = 100 - int((getnumber("monster2hp") / getnumber("monster2maxhp")) * 100);
}
write(("Welcome back to DUNGEON ROBBER, " + _root.charactername) + "!");
if (_root.savedestination == "town") {
town();
} else if (_root.savedestination == "attackchoice") {
attackchoice();
} else if (_root.savedestination == "choosefight") {
choosefight();
} else if (_root.savedestination == "movementphase") {
movementphase(1);
} else {
town();
}
}
function try_to_promote_monster() {
if ((getnumber("monster2hp") > 0) && (getnumber("monsterhp") == 0)) {
_root.monstername = _root.monster2name;
_root.monsterhd = _root.monster2hd;
_root.monsternumber = _root.monster2number;
_root.monstertags = _root.monster2tags;
setnumber("monsterhp", getnumber("monster2hp"));
setnumber("monsterac", getnumber("monster2ac"));
_root.monsterhp.hpblood._alpha = _root.monster2hp.hpblood._alpha;
_root.monsterhp._alpha = 100;
_root.monsterac._alpha = 100;
_root.monsterstunned = _root.monster2stunned;
_root.monsterheld = _root.monster2held;
clear_monster(2);
var n = 1;
while (n <= 10) {
var o = 1;
while (o <= 4) {
eval (((("_root.monsterwhite.monster" + o) + "_") + n) + "white")._alpha = 0;
o++;
}
n++;
}
eval (((("_root.monsterwhite.monster" + _root.monsterhd) + "_") + _root.monsternumber) + "white")._alpha = 100;
}
}
function try_to_promote_henchman() {
if (getnumber("henchmanhp") > 0) {
return(undefined);
}
if (getnumber("henchman2hp") > 0) {
setnumber("henchmanhp", getnumber("henchman2hp"));
setnumber("henchmanmaxhp", getnumber("henchman2maxhp"));
setnumber("henchmanac", getnumber("henchman2ac"));
_root.henchmanname = _root.henchman2name;
_root.hname1.mytext.text = _root.henchmanname;
_root.henchmannumber = _root.henchman2number;
_root.henchmanhd = _root.henchman2hd;
_root.henchmanhp._alpha = 100;
_root.henchmanac._alpha = 100;
_root.henchman2hp._alpha = 0;
_root.henchman2ac._alpha = 0;
_root.henchmanstunned = _root.henchman2stunned;
_root.henchmandoppelganger = _root.henchman2doppelganger;
_root.henchmanheld = _root.henchman2held;
clear_henchman(2);
_root.henchmanhp.hpblood._alpha = _root.henchman2hp.hpblood._alpha;
eval (((("_root.henchmanwhite.monster" + _root.henchmanhd) + "_") + _root.henchmannumber) + "white")._alpha = 100;
}
}
function stripTags($myString) {
while (((istart = $myString.indexOf("<"))) != -1) {
$myString = $myString.split($myString.substr(istart, ($myString.indexOf(">") - istart) + 1)).join("");
}
return($myString);
}
function setnumber(numbername, numbervalue) {
_root.stats[numbername] = numbervalue;
eval ((("_root." + numbername) + ".") + numbername).text = numbervalue;
eval ("_root.charsheet." + numbername).text = numbervalue;
}
function addnumber(numbername, numbervalue) {
var mynum = _root.stats[numbername];
if (mynum == null) {
mynum = 0;
}
mynum = mynum + numbervalue;
_root.stats[numbername] = mynum;
eval ((("_root." + numbername) + ".") + numbername).text = mynum;
eval ("_root.charsheet." + numbername).text = mynum;
}
function getnumber(numbername) {
var _local2 = _root.stats[numbername];
if ((((!_local2) || (_local2 == undefined)) || (_local2 == null)) || (_local2 == NaN)) {
_local2 = 0;
}
return(int(_local2));
}
function price_item(itemnumber) {
var _local2 = _root.possessions[itemnumber - 1][0];
if ((itemnumber == 0) || (_local2 == undefined)) {
_root.charsheet.posstext._alpha = 0;
_root.charsheet.posstext.mytext.text = "";
return(undefined);
}
itemnumber = _root.possessions[itemnumber - 1][1];
_root.charsheet.posstext._alpha = 100;
if (_root.instore) {
_root.charsheet.posstext.mytext.text = ("Sells for " + _root.itemlist[_local2].sell) + " GP.";
}
}
function explain_item(itemnumber) {
var _local2 = _root.possessions[itemnumber - 1][0];
if ((itemnumber == 0) || (_local2 == undefined)) {
_root.charsheet.posstext._alpha = 0;
_root.charsheet.posstext.mytext.text = "";
return(undefined);
}
itemnumber = _root.possessions[itemnumber - 1][1];
_root.charsheet.posstext._alpha = 100;
if (_root.instore) {
_root.charsheet.posstext.mytext.text = _root.itemlist[_local2].summary;
} else {
_root.charsheet.posstext.mytext.text = _root.itemlist[_local2].summary;
}
}
function stairsquestion(currentlocation) {
_root.fudgeroll = Math.ceil(Math.random() * 20);
var _local4 = "down";
if (currentlocation == "stairs") {
var _local3 = new Array(1, 9, 11, 12, 18, 19, 20);
} else {
var _local3 = new Array(1, 2, 3, 4, 5, 6, 7, 8);
}
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2] == _root.fudgeroll) {
_local4 = "up";
}
_local2++;
}
if (_local4 == "up") {
write("Stairs ahead seem to go up. Go <b>(u)p</b>? or <b>(s)tay</b> here?");
add_to_key("u", "stairsanswer", "up", currentlocation);
}
if (_local4 == "down") {
write("Stairs ahead seem to go down. Go <b>(d)own</b>? or <b>(s)tay</b> here?");
add_to_key("d", "stairsanswer", "down", currentlocation);
}
add_to_key("s", "stairsanswer", "no", currentlocation);
}
function stairsanswer(stairsdirection, currentlocation) {
_root.stairsdirection = stairsdirection;
add_to_master("roll", currentlocation, 20);
run_master();
}
function gotit(destination, gotittext, gotitletter) {
if ((!gotittext) || (gotittext == null)) {
gotittext = "(g)ot it!";
gotitletter = "g";
}
write(("<b>" + gotittext) + "</b>");
add_to_key(gotitletter, destination);
}
function levelbonus(myclass, divisor) {
if (!myclass) {
myclass = "dungeon robber";
}
if (!divisor) {
divisor = 1;
}
if (myclass == "dungeon robber") {
myclass = "Dungeon Robber";
}
if (myclass == "fighter") {
myclass = "Fighter";
}
if (myclass == "thief") {
myclass = "Thief";
}
if (myclass == "cleric") {
myclass = "Cleric";
}
if (myclass == "wizard") {
myclass = "Wizard";
}
var _local3 = 0;
if (myclass == _root.characterclass) {
_local3 = getnumber("characterlevel");
}
if (_local3 > 0) {
_local3 = int(_local3 / divisor);
}
return(_local3);
}
function mysave(t, p) {
return(savingthrow(t, p));
}
function savingthrow(thief, pole) {
if ((thief == undefined) || (thief == null)) {
thief = 0;
}
if ((pole == undefined) || (pole == null)) {
pole = 0;
}
var _local3 = getnumber("savingthrow");
var _local2 = "";
if (wisbonus()) {
_local2 = _local2 + "wisdom bonus";
}
if ((thief == 1) && (_root.characterclass == "Thief")) {
_local3 = _local3 - 1;
if (_local2 != "") {
_local2 = _local2 + ", ";
}
_local2 = _local2 + "thief class";
}
if ((pole == 1) && (_root.readied.ten_foot_pole == 1)) {
_local3 = _local3 - 1;
if (_local2 != "") {
_local2 = _local2 + ", ";
}
_local2 = _local2 + "ten foot pole";
}
if ((pole == -1) && (_root.readied.ten_foot_pole == 1)) {
if (_local2 != "") {
_local2 = _local2 + ", ";
}
_local2 = _local2 + "ten foot pole is a disadvantage";
} else if (pole == -1) {
_local3 = _local3 - 1;
if (_local2 != "") {
_local2 = _local2 + ", ";
}
_local2 = _local2 + "not having a ten foot pole is an advantage";
}
if (_local2 != "") {
_local2 = ("(bonuses: " + _local2) + ")";
}
write((("d6 saving throw: need " + _local3) + "+ ") + _local2, 1);
var _local5 = Math.ceil(Math.random() * 6);
if (_local5 >= _local3) {
write(("Rolled " + _local5) + "! Succeeded!");
return(1);
}
write(("Rolled " + _local5) + "! Failed!");
return(0);
}
function henchmansavingthrow(number) {
if (((number == 0) || (number == null)) || (number == undefined)) {
number = 1;
}
if ((number == 1) && (getnumber("henchmanhp") == 0)) {
return(undefined);
}
if ((number == 2) && (getnumber("henchman2hp") == 0)) {
return(undefined);
}
henchname = _root.henchmanname;
if (number == 2) {
henchname = _root.henchman2name;
}
var _local4 = 4;
write((henchname + " rolls a d6 saving throw: needs ") + _local4, 1);
var _local3 = Math.ceil(Math.random() * 6);
if (_local3 >= _local4) {
write(("Rolled " + _local3) + "! Succeeded!");
return(1);
}
write(("Rolled " + _local3) + "! Failed!");
return(0);
}
function damage(numberdice, typedice, deathmode) {
var _local5 = 0;
if (deathmode == "1") {
henchname = _root.henchmanname;
_local5 = 1;
if (getnumber("henchmanhp") == 0) {
return(undefined);
}
} else if (deathmode == "2") {
_local5 = 2;
henchname = _root.henchman2name;
if (getnumber("henchman2hp") == 0) {
return(undefined);
}
}
var _local3 = getnumber("hp");
if (_local5 == 1) {
_local3 = getnumber("henchmanhp");
}
if (_local5 == 2) {
_local3 = getnumber("henchman2hp");
}
var _local4 = 0;
n = 0;
while (n < numberdice) {
var _local2 = Math.ceil(Math.random() * typedice);
_local4 = _local4 + _local2;
n++;
}
if (_local5 == 0) {
write(_local4 + " damage!");
} else {
write(((henchname + " takes ") + _local4) + " damage!");
}
_local3 = _local3 - _local4;
if (_local5 == 0) {
if (_local3 >= 1) {
setnumber("hp", _local3);
_root.hp.hpblood._alpha = 100 - int((getnumber("hp") / getnumber("maxhp")) * 100);
} else {
setnumber("hp", 0);
_root.hp.hpblood._alpha = 0;
write("You are killed!");
_root.accomplishments_killedby = deathmode;
death();
}
} else if (_local5 == 1) {
if (_local3 >= 1) {
setnumber("henchmanhp", _local3);
_root.henchmanhp.hpblood._alpha = 100 - int((_local3 / getnumber("henchmanmaxhp")) * 100);
} else {
setnumber("henchmanhp", 0);
_root.henchmanhp.hpblood._alpha = 0;
write(henchname + " is killed!", 1);
clear_henchman(1);
try_to_promote_henchman();
}
} else if (_local5 == 2) {
if (_local3 >= 1) {
setnumber("henchman2hp", _local3);
_root.henchman2hp.hpblood._alpha = 100 - int((_local3 / getnumber("henchman2maxhp")) * 100);
} else {
setnumber("henchman2hp", 0);
_root.henchman2hp.hpblood._alpha = 0;
write(henchname + " is killed!", 1);
clear_henchman(2);
}
}
}
function blind(mydir) {
if (((mydir == "") || (mydir == undefined)) || (mydir == null)) {
mydir = "ahead";
}
lostme(1);
var _local5 = 0;
var _local3 = Math.ceil(Math.random() * 6);
if (_local3 <= 2) {
write("You bump into something!");
_local5 = 1;
}
if (_local3 <= 4) {
write(("You move " + mydir) + " blindly!");
}
if (_local3 == 5) {
write("Your vision clears! You are lost!");
}
if (_local3 == 6) {
write("Your vision clears! You've blundered into a monster!");
}
if (_local3 <= 4) {
var _local4 = "Blunder";
if ((_local5 == 0) || (mydir != "left")) {
_local4 = _local4 + " <b>(l)ef(t)</b>?";
add_to_key("l", "blind", "left");
add_to_key("t", "blind", "left");
}
if ((_local5 == 0) || (mydir != "right")) {
_local4 = _local4 + " <b>(r)ight</b>?";
add_to_key("r", "blind", "right");
}
if ((_local5 == 0) || (mydir != "ahead")) {
_local4 = _local4 + " <b>(a)head</b>?";
add_to_key("a", "blind", "ahead");
}
write(_local4);
} else if (_local3 == 5) {
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else {
_root.monstersource = "wandering";
if (getnumber("dungeonlevel") <= 5) {
add_to_master("move_to", "wanderingmonsters1");
} else if (getnumber("dungeonlevel") > 5) {
add_to_master("move_to", "wanderingmonsters2");
}
var _local6 = getnumber("dungeonlevel");
if (_local6 > 10) {
_local6 = 10;
}
add_to_master("roll", ("monster" + _local6) + "_", 4, 1);
run_master();
}
}
function rust() {
if (_root.shield == "shield") {
_root.shield = "";
add_equipment("shield", -1);
write("Your shield is rusted!");
readyitem();
} else if (_root.shield == "+1_shield") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.shield = "";
add_equipment("+1_shield", -1);
write("Your +1 shield is rusted!");
readyitem();
} else {
write("Your magic shield survives!");
}
} else if (_root.weapon == "+1_mace") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("+1_mace", -1);
write("Your magic mace is rusted!");
readyitem("fists");
} else {
write("Your magic mace survives!");
}
} else if (_root.weapon == "-1_mace") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("-1_mace", -1);
write("Your cursed mace is rusted!");
readyitem("fists");
} else {
write("Nuts! Your cursed mace survives!");
}
} else if (_root.weapon == "+1_dagger") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("+1_dagger", -1);
write("Your magic dagger is rusted!");
readyitem("fists");
} else {
write("Your magic dagger survives!");
}
} else if (_root.weapon == "-1_dagger") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("-1_dagger", -1);
write("Your cursed dagger is rusted!");
readyitem("fists");
} else {
write("Darn! Your cursed dagger survives!");
}
} else if (_root.weapon == "+1_sword") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("+1_sword", -1);
write("Your magic sword is rusted!");
readyitem("fists");
} else {
write("Your magic sword survives!");
}
} else if (_root.weapon == "-1_sword") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.weapon = "";
add_equipment("-1_sword", -1);
write("Your cursed sword is rusted!");
readyitem("fists");
} else {
write("Drat! Your cursed sword survives!");
}
} else if (_root.armor == "+1_chain_mail") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.armor = "";
add_equipment("+1_chain_mail", -1);
write("Your magic chain mail is rusted!");
readyitem();
} else {
write("Your magic chain mail survives!");
}
} else if (_root.armor == "+1_plate_mail") {
if (Math.ceil(Math.random() * 2) == 2) {
_root.armor = "";
add_equipment("+1_plate_mail", -1);
write("Your magic plate mail is rusted!");
readyitem();
} else {
write("Your magic plate mail survives!");
}
} else if (_root.weapon == "dagger") {
_root.weapon = "";
add_equipment("dagger", -1);
write("Your dagger is rusted!");
readyitem("fists");
} else if (_root.weapon == "sword") {
_root.weapon = "";
add_equipment("sword", -1);
write("Your sword is rusted!");
readyitem("fists");
} else if (_root.weapon == "bastard_sword") {
_root.weapon = "";
add_equipment("bastard_sword", -1);
write("Your bastard sword is rusted!");
readyitem("fists");
} else if (_root.weapon == "rapier") {
_root.weapon = "";
add_equipment("rapier", -1);
write("Your rapier is rusted!");
readyitem("fists");
} else if (_root.armor == "chain_mail") {
_root.armor = "";
add_equipment("chain_mail", -1);
write("Your chain mail is rusted!");
readyitem();
} else if (_root.armor == "plate_mail") {
_root.armor = "";
add_equipment("plate_mail", -1);
write("Your plate mail is rusted!");
readyitem();
} else if (has_item("plate_mail")) {
add_equipment("plate_mail", -1);
write("The plate mail in your backpack is rusted!");
} else if (has_item("chain_mail")) {
add_equipment("chain_mail", -1);
write("The chain mail in your backpack is rusted!");
} else if (has_item("dagger")) {
add_equipment("dagger", -1);
write("The dagger in your backpack is rusted!");
} else if (has_item("sword")) {
add_equipment("sword", -1);
write("The sword in your backpack is rusted!");
} else if (has_item("rapier")) {
add_equipment("rapier", -1);
write("The rapier in your backpack is rusted!");
} else if (has_item("bastard_sword")) {
add_equipment("bastard_sword", -1);
write("The bastard sword in your backpack is rusted!");
} else if (has_item("shield")) {
add_equipment("shield", -1);
write("The shield in your backpack is rusted!");
} else {
write("None of your stuff is rusted!");
}
}
function forcetheelevator() {
var _local2 = Math.ceil(Math.random() * 6);
_local2 = Math.ceil(Math.random() * 6) + levelbonus("thief");
_local2 = _local2 + strbonus();
if (_local2 >= 4) {
write("You open the door!");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
} else if (_root.forceelevator > 0) {
_root.forceelevator--;
write("You can't open the door! The elevator descends another level. <b>(f)orce door?</b>");
stairs(1);
add_to_key("f", "forceelevator");
} else {
write("You can't open the door! At least the elevator is not descending anymore. <b>(f)orce door?</b>");
add_to_key("f", "forceelevator");
}
}
function henchname(gender) {
var _local1 = new Array();
if ((gender == "lad") || (gender == null)) {
_local1.push("Marten");
_local1.push("Antony");
_local1.push("Eliot");
_local1.push("James");
_local1.push("Henry");
_local1.push("Dan");
_local1.push("Kevin");
_local1.push("Cristopher");
_local1.push("Stephen");
_local1.push("Donovan");
_local1.push("Gabriel");
_local1.push("Juris");
_local1.push("Minh");
_local1.push("Paul");
_local1.push("Padraig");
_local1.push("Richard");
_local1.push("Michael");
_local1.push("John");
_local1.push("Andrew");
}
if ((gender == "lass") || (gender == null)) {
_local1.push("Alison");
_local1.push("Janis");
_local1.push("Caoilfhionn");
_local1.push("Hannah");
_local1.push("Gwynhwyfar");
_local1.push("Tallis");
_local1.push("Sara");
_local1.push("Joanna");
_local1.push("Alejandra");
_local1.push("Elizabeth");
_local1.push("Laura");
_local1.push("Dahlia");
_local1.push("Fahmida");
_local1.push("Rachel");
_local1.push("Jacqueline");
_local1.push("Marcelyn");
_local1.push("Meg");
_local1.push("Amy");
}
var _local2 = _local1[Math.ceil(Math.random() * _local1.length) - 1];
if (_local2 == undefined) {
_local2 = "Cob";
}
return(_local2);
}
function namepet(monster, slot) {
if (((slot == undefined) || (slot == null)) || (slot == 0)) {
slot = 1;
}
var _local3 = petname(monster);
if (_local3) {
if (slot == 1) {
_root.henchmanname = _local3;
}
if (slot == 2) {
_root.henchman2name = _local3;
}
}
if (slot == 1) {
_root.hname1._alpha = 100;
_root.hname1.mytext.text = _local3;
}
if (slot == 2) {
_root.hname2._alpha = 100;
_root.hname2.mytext.text = _local3;
}
}
function petname(monster) {
var _local4 = "";
var _local2 = new Array();
if (monster == "Kobold") {
_local2.push("PunPun");
_local2.push("WobWob");
_local2.push("GupGup");
_local2.push("GrobGrob");
}
if (monster == "Fire Beetle") {
_local2.push("Flamey");
_local2.push("Tinder");
_local2.push("Ember");
_local2.push("Sparky");
}
if (monster == "Giant Rat") {
_local2.push("Willard");
_local2.push("Templeton");
_local2.push("Ratty");
_local2.push("Splinter");
}
if (monster == "Skeleton") {
_local2.push("Death's Blessing");
_local2.push("Heartless");
_local2.push("The Pale One");
_local2.push("Morty");
}
if (monster == "Centipede") {
_local2.push("Carlyle");
_local2.push("Centurion");
_local2.push("Creepy");
_local2.push("Crawly");
}
if (monster == "Orc") {
_local2.push("Hoopster");
_local2.push("Zurthak");
_local2.push("Venom-Eye");
_local2.push("Glug");
}
if (monster == "Troglodyte") {
_local2.push("Gorg");
_local2.push("Ugg");
_local2.push("Zog");
_local2.push("Brog");
}
if (monster == "Bugbear") {
_local2.push("H'ssh");
_local2.push("Z'ox");
_local2.push("T'zor");
_local2.push("K'shar");
}
if (monster == "Bandit") {
_local2.push("Jack");
_local2.push("Rob");
_local2.push("Snake");
_local2.push("Scar");
}
if (monster == "Ear Seeker") {
_local2.push("Snakey");
_local2.push("Wriggly");
_local2.push("Lowly");
_local2.push("Wormly");
}
if (monster == "Piercer") {
_local2.push("Rocky");
_local2.push("Rocky");
_local2.push("Rocky");
_local2.push("Rocky");
}
if (monster == "Giant Toad") {
_local2.push("Mr. Toad");
_local2.push("Prince Toadstool");
_local2.push("Croaker");
_local2.push("Kermie");
}
if (monster == "Hobgoblin") {
_local2.push("Agurtz");
_local2.push("Gazya");
_local2.push("Miraz");
_local2.push("Zigor");
}
if (monster == "Shrieker") {
_local2.push("Princess Toadstool");
_local2.push("Princess Toadstool");
_local2.push("Princess Toadstool");
_local2.push("Princess Toadstool");
}
if (monster == "Giant Spider") {
_local2.push("Argiope");
_local2.push("Aranea");
_local2.push("Attercop");
_local2.push("Neriene");
}
if (monster == "Werewolf") {
_local2.push("Jacob");
_local2.push("Bisclavret");
_local2.push("Melion");
_local2.push("Bertrand");
}
if (monster == "Stirge") {
_local2.push("Strix");
_local2.push("Stymphalia");
_local2.push("Noctilo");
_local2.push("Buzz");
}
if (monster == "Boring Beetle") {
_local2.push("John");
_local2.push("Paul");
_local2.push("George");
_local2.push("Ringo");
}
if (monster == "Carnivorous Ape") {
_local2.push("Kerchak");
_local2.push("Tublat");
_local2.push("Kala");
_local2.push("Terkoz");
}
if (monster == "Giant Lizard") {
_local2.push("Apollo");
_local2.push("Elizabeth");
_local2.push("Draco");
_local2.push("Ningizzida");
}
if (monster == "Gelatinous Cube") {
_local2.push("Lemon");
_local2.push("Orange");
_local2.push("Cherry");
_local2.push("Strawberry");
}
if (monster == "Rust Monster") {
_local2.push("Grist");
_local2.push("Entropy");
_local2.push("Dusty");
_local2.push("Rusty");
}
if (monster == "Minotaur") {
_local2.push("");
_local2.push("");
_local2.push("Baphomet");
_local2.push("Minos");
_local2.push("Ferdinand");
_local2.push("Shedu");
}
if (monster == "Medusa") {
_local2.push("Stheno");
_local2.push("Euryale");
_local2.push("Medusa");
_local2.push("Pythia");
}
if (monster == "Ghast") {
_local2.push("Ghastly");
_local2.push("Haunter");
_local2.push("Wormwood");
_local2.push("Betelgeuse");
}
if (monster == "Leucrotta") {
_local2.push("Rex");
_local2.push("King");
_local2.push("Blue");
_local2.push("Bandit");
}
if (monster == "Carrion Crawler") {
_local2.push("Carrie");
_local2.push("Crawly");
_local2.push("Greenie");
_local2.push("Bugsy");
}
if (monster == "Manticore") {
_local2.push("Man-Eater");
_local2.push("Devourer");
_local2.push("Hungerer");
_local2.push("Eater of Flesh");
}
if (monster == "Su Monster") {
_local2.push("Donald");
_local2.push("Travis");
_local2.push("Sneaky");
_local2.push("Sue");
}
if (monster == "Yellow Mold") {
_local2.push("Moldy");
_local2.push("Moldy");
_local2.push("Moldy");
_local2.push("Moldy");
}
if (monster == "Hill Giant") {
_local2.push("Biff");
_local2.push("Basher");
_local2.push("Grinder");
_local2.push("Smash");
}
if (monster == "Mind Flayer") {
_local2.push("Theander the Sage");
_local2.push("General Aulvorithus");
_local2.push("Keeper of Memories");
_local2.push("Lord Quahorvilus");
}
if (monster == "Doppelganger") {
_local2.push(_root.charactername);
_local2.push(_root.charactername + " II");
_local2.push(_root.charactername + " Jr.");
_local2.push("Evil " + _root.charactername);
}
if (monster == "Vampire") {
_local2.push("Vladimir");
_local2.push("Barnabas");
_local2.push("Strahd");
_local2.push("Varney");
}
if (monster == "Lurker Above") {
_local2.push("Lurky");
_local2.push("Lurky");
_local2.push("Lurky");
_local2.push("Lurky");
}
if (monster == "Purple Worm") {
_local2.push("Sarlacc");
_local2.push("Purple");
_local2.push("Lowly");
_local2.push("Wormy");
}
if (monster == "Mimic") {
_local2.push("Mimi");
_local2.push("Mimi");
_local2.push("Mimi");
_local2.push("Mimi");
}
if (monster == "Succubus") {
_local2.push("Lilith");
_local2.push("Qarinah");
_local2.push("Mohini");
_local2.push("Vandella");
}
if (monster == "Storm Giant") {
_local2.push("Gymir");
_local2.push("Brimir");
_local2.push("Bolthorn");
_local2.push("Aegir");
}
if (monster == "Dragon") {
_local2.push("Aegidius");
_local2.push("Valerius");
_local2.push("Sulpicius");
_local2.push("Tiberius");
}
if (_local2.length > 0) {
_local4 = _local2[Math.ceil(Math.random() * 4) - 1];
}
return(_local4);
}
function showmonsters(myalpha) {
if (((myalpha < 1) || (myalpha == null)) || (myalpha == undefined)) {
myalpha = 1;
}
if (getnumber("henchmanhp") > 0) {
_root.hname1._alpha = myalpha;
_root.henchmanwhite._alpha = myalpha;
_root.henchmanhp._alpha = myalpha;
_root.henchmanac._alpha = myalpha;
}
if (getnumber("henchman2hp") > 0) {
_root.hname2._alpha = myalpha;
_root.henchman2white._alpha = myalpha;
_root.henchman2hp._alpha = myalpha;
_root.henchman2ac._alpha = myalpha;
}
if (getnumber("monsterhp") > 0) {
_root.monsterwhite._alpha = myalpha;
_root.monsterhp._alpha = myalpha;
_root.monsterac._alpha = myalpha;
}
if (getnumber("monster2hp") > 0) {
_root.monster2white._alpha = myalpha;
_root.monster2hp._alpha = myalpha;
_root.monster2ac._alpha = myalpha;
}
}
stop();
Object.prototype.copy = function () {
var _local2;
var _local3 = new this.__proto__.constructor();
for (_local2 in this) {
if (typeof(this[_local2]) == "object") {
_local3[_local2] = this[_local2].copy();
} else {
_local3[_local2] = this[_local2];
}
}
return(_local3);
};
ASSetPropFlags(Object.prototype, "copy", 1);
var normtxt = new TextFormat(null, null, null, false, null);
var boldtxt = new TextFormat(null, null, null, true, null);
var greytext = new TextFormat(null, null, 6710886, false, null);
_root.boldtxt = boldtxt;
_root.normtxt = normtxt;
_root.greytxt = greytext;
if (_root.testmode == 1) {
_root.rerollorkeep.choosearoll._x = _root.rerollorkeep.choosearoll._x + 100;
_root.showtestmode.text = "T3ST";
}
tosave.push("gamemode");
tosave.push("spells");
tosave.push("characterid");
_root.savedestination = "";
tosave.push("savedestination");
_root.gameover = 0;
tosave.push("gameover");
_root.intown = 0;
tosave.push("intown");
_root.instore = 0;
tosave.push("instore");
_root.area = "";
tosave.push("area");
_root.currentscale = 1;
tosave.push("currentscale");
_root.targetscale = 1;
tosave.push("targetscale");
_root.originalheight = 4500;
tosave.push("originalheight");
_root.originalwidth = 3000;
tosave.push("originalwidth");
_root.fudgeroll = 0;
tosave.push("fudgeroll");
_root.currentlydiagonal = 0;
tosave.push("currentlydiagonal");
_root.cavedestination = "";
tosave.push("cavedestination");
_root.compassrose.letter.text = "N";
tosave.push("compassrose");
_root.stairsdirection = "";
tosave.push("stairsdirection");
_root.writebuffer = "";
setnumber("dungeonlevel", 1);
_root.direction = 0;
tosave.push("direction");
_root.roomorchamber = "";
tosave.push("roomorchamber");
_root.exitno = 0;
tosave.push("exitno");
_root.sqft = 0;
tosave.push("sqft");
tosave.push("stats");
_root.monstersource = "";
tosave.push("monstersource");
_root.monsteraware = 0;
tosave.push("monsteraware");
_root.secondtreasureroll = 0;
tosave.push("secondtreasureroll");
_root.stoprolling = 0;
tosave.push("stoprolling");
tosave.push("characterclass");
tosave.push("weapon");
_root.nextdestination = "";
tosave.push("nextdestination");
var turndir = new Array();
_root.turndir = turndir;
_root.upcomingturn = "";
tosave.push("upcomingturn");
_root.weapondamage = 1;
tosave.push("weapondamage");
_root.weaponplus = 0;
tosave.push("weaponplus");
_root.armor = "";
tosave.push("armor");
_root.shield = "";
tosave.push("shield");
_root.heavy = "";
tosave.push("heavy");
_root.overburdened = 0;
tosave.push("overburdened");
_root.fishedout = 0;
tosave.push("fishedout");
_root.strengthspell = 0;
tosave.push("strengthspell");
_root.holder = "";
tosave.push("holder");
_root.haste = 0;
tosave.push("haste");
_root.justhasted = 0;
tosave.push("justhasted");
_root.sanctuary = 0;
tosave.push("sanctuary");
_root.recoveredspellshere = 0;
tosave.push("recoveredspellshere");
_root.treasure_finding = 0;
tosave.push("treasure_finding");
_root.innrecruitlevel = 0;
tosave.push("innrecruitlevel");
_root.loan = 0;
tosave.push("loan");
var deadend = new Array(0, 0, 0);
_root.deadend = deadend;
tosave.push("deadend");
_root.forceelevator = 0;
tosave.push("forceelevator");
tosave.push("histr");
tosave.push("hiint");
tosave.push("hiwis");
tosave.push("hidex");
tosave.push("hicon");
tosave.push("hicha");
_root.charsheet.charactername.text = _root.charactername;
charactername = charactername.split(newline).join("");
charactername = stripTags(charactername);
tosave.push("charactername");
_root.savenumber = 0;
tosave.push("savenumber");
_root.accomplishments_deepestlevel = 1;
tosave.push("accomplishments_deepestlevel");
_root.accomplishments_toughestmonster = "";
tosave.push("accomplishments_toughestmonster");
_root.accomplishments_toughestmonsterlevel = 0;
tosave.push("accomplishments_toughestmonsterlevel");
_root.accomplishments_magicitem = "";
tosave.push("accomplishments_magicitem");
_root.accomplishments_killedby = "";
var possessions = new Array();
_root.possessions = possessions;
tosave.push("possessions");
var readied = new Object();
_root.readied = readied;
tosave.push("readied");
var cursed = new Object();
_root.cursed = cursed;
tosave.push("cursed");
clear_monster();
clear_henchman();
var keymenu = new Array();
_root.keymenu = keymenu;
tosave.push("keymenu");
Key.removeListener(keyListener);
var keyListener = null;
if ((keyListener == undefined) || (keyListener == null)) {
var keyListener = new Object();
keyListener.onKeyDown = function () {
_root.mytext.scroll = _root.mytext.maxscroll;
};
keyListener.onKeyUp = function () {
_root.mapexplanation._alpha = 0;
_root.mytext.scroll = _root.mytext.maxscroll;
if (_root.writebuffer != "") {
return(undefined);
}
if (_root.overburdened > 0) {
write("You can't do anything until you drop equipment!");
return(undefined);
}
var _local2 = Selection.getFocus();
if (((_local2 == "_level0.charsheet.charactername") || (_local2 == "_level0.hname1.mytext")) || (_local2 == "_level0.hname2.mytext")) {
if (_local2 == "_level0.hname1.mytext") {
_root.henchmanname = _root.hname1.mytext.text;
}
if (_local2 == "_level0.hname2.mytext") {
_root.henchman2name = _root.hname2.mytext.text;
}
if (Key.getCode() == 13) {
Selection.setFocus("faker");
}
if (_local2 == "_level0.hname1.mytext") {
_root.henchmanname = _root.hname1.mytext.text;
}
if (_local2 == "_level0.hname2.mytext") {
_root.henchman2name = _root.hname2.mytext.text;
}
return(undefined);
}
keyup(Key);
_root.mytext.scroll = _root.mytext.maxscroll;
};
Key.addListener(keyListener);
}
var itemlist = new Object();
_root.itemlist = itemlist;
make_item("dagger", 2, 1, "market", 0, 1, "f:w:t", "A weapon available to all but the poorest peasants. 1d4 damage.", 0);
make_item("+1_dagger", 500, "count", "smith", 0, 1, "f:w:t", "The best weapon usable by wizards. 1d4+1 damage.", 0);
make_item("-1_dagger", 1, 0, "smith", 0, 1, "f:w:t", "Cursed dagger. Can't be unreadied in the dungeon. 1d4-1 damage.", 0, "+1_dagger");
make_item("bludgeon", 4, 1, "market", 0, 1, "f:c", "A farmer's cudgel, a cleric's mace, or a chair leg. 1d6 damage.", 0);
make_item("+1_mace", 750, "bishop", "smith", 0, 1, "f:c", "The holy weapon of a cleric. 1d6+1 damage.", 0);
make_item("-1_mace", 1, 0, "smith", 0, 1, "f:c", "Cursed mace. Can't be unreadied in the dungeon. 1d6-1 damage.", 0, "+1_mace");
make_item("sword", 8, "mayor", "smith", 0, 1, "f", "A weapon associated with upper-class gentility. 1d8 damage.", 0);
make_item("bastard_sword", 100, "knight", "smith", 0, 1, "f", "An improbably massive sword. 1d10 damage.", 0);
make_item("rapier", 30, "gentleman", "market", 0, 1, "f:t", "A weapon associated with upper-upper-class gentility. 1d8 damage. Uses Dex instead of Str for its damage bonus.", 0);
make_item("+1_sword", 1000, "king", "smith", 0, 1, "f", "The legendary blade of kings and queens. 1d8+1 damage.", 0);
make_item("-1_sword", 1, 0, "smith", 0, 1, "f", "Cursed sword. Can't be unreadied in the dungeon. 1d8-1 damage.", 0, "+1_sword");
make_item("whip", 16, "duke", "market", 0, 1, "", "A weapon that can be used to train and capture beasts. 1d3 damage.", 0);
make_item("fishing_pole", 5, "merchant", "market", 0, 0, "", "If you find a pool or stream, you can fish for cave fish or other surprises.", 0);
make_item("+1_fishing_pole", 1000, "king", "royal_treasury", 0, 0, "", "Fish for cave fish or other surprises. Reduces risk of sea monster attack.", 0);
make_item("+2_fishing_pole", 2000, "king", "royal_treasury", 0, 0, "", "Fish for cave fish or other surprises. You'll never catch a sea monster!", 0);
make_item("shield", 5, "mayor", "smith", 0, 1, "f:c", "A common defense of town guardsmen. +1 AC.", 0);
make_item("+1_shield", 1000, "prince", "smith", 0, 1, "f:c", "The magical aegis used by guardsmen in royal palaces. +2 AC.", 0);
make_item("leather_armor", 3, "gentleman", "market", 0, 1, "f:c:t", "A suit of tanned hides. Whisper quiet. Prevents you from casting wizard spells. 12 AC.", 0);
make_item("+1_leather_armor", 1000, "duke", "market", 0, 1, "f:c:t", "The best armor available for those who wish to be sneaky. 13 AC.", 0);
make_item("chain_mail", 40, "mayor", "smith", 0, 1, "f:c", "The armor of medium infantry and town guards. Makes sneaking impossible. 14 AC.", 0);
make_item("+1_chain_mail", 1500, "prince", "smith", 0, 1, "f:c", "The shining armor of royal guards. AC 15.", 0);
make_item("plate_mail", 200, "knight", "smith", 1, 1, "f:c", "Knightly armor. You can't run or sneak in this armor, but knights do neither. AC 16.", 0);
make_item("+1_plate_mail", 2000, "king", "smith", 1, 1, "f:c", "The magical shining armor of the king's paladin guard. You can't run or sneak in it, but paladins do neither. AC 17.", 0);
make_item("bracers_AC_14", 1500, "count", "market", 0, 1, "", "These magical bracelets deflect attacks. They can even be worn by wizards. Can't be worn with other armor. AC 14.", 0);
make_item("food", 10, "yeoman", "market", 0, 0, "", "Eat it to heal or throw it behind you to distract beasts.", 0);
make_item("iron_rations_(10_food)", 100, "yeoman", "market", 0, 0, "", "Bulk food that will last you for a deep dungeon delve.", 0);
make_item("furniture", 20, 0, "market", 1, 0, "", "Take it home and sell it. Heavy.", 1);
make_item("statue", 100, 0, "market", 1, 0, "", "Heavy, but worth 100 GP.", 1);
make_item("tapestry", 200, 0, "market", 1, 0, "", "Heavy, but worth 100 GP.", 1);
make_item("gilded_chair", 300, 0, "market", 1, 0, "", "Fit to bear a king. Heavy.", 1);
make_item("gold_ewer", 250, 0, "market", 1, 0, "", "Fit to give a king or drown him in malmsey.", 0);
make_item("cloth-of-gold_hangings", 400, 0, "market", 1, 0, "", "You could make this into any number of gold suits. Heavy.", 1);
make_item("gold_statue", 500, 0, "", 1, 0, "", "Heavy, but worth 500 GP.", 1);
make_item("oil_flask", 10, "merchant", "market", 0, 0, "", "You can throw it in combat or behind you to stop pursuit. 2d6 damage.", 0);
make_item("sack", 1, "yeoman", "market", 0, 0, "", "Lets you run with giant amounts of treasure. You only need one.", 0);
make_item("ten_foot_pole", 1, 1, "market", 0, 1, "", "Lets you probe for traps.", 0);
make_item("healing_potion", 100, "bishop", "temple", 0, 0, "", "Heals 1d8 HP.", 0);
make_item("blessed_symbol", 25, "bishop", "temple", 0, 0, "c", "Allows you to Turn undead.", 0);
make_item("van_helsing_kit", 100, "bishop", "temple", 0, 0, "", "Mallet and stakes, wolfsbane, mirror. For you, werewolf, medusa, and vampire have AC 10 and 1 HP. Reusable.", 0);
make_item("scroll_of_cure_light_wounds", 150, "bishop", "temple", 0, 0, "c:t", "Cleric spell that heals 1d8 HP.", 0);
make_item("scroll_of_sanctuary", 150, "bishop", "temple", 0, 0, "c:t", "Cleric combat spell that forces monsters to make a saving throw to attack you. Ends when combat ends.", 0);
make_item("scroll_of_command", 150, "bishop", "temple", 0, 0, "c:t", "Cleric combat spell that forces intelligent monsters to flee. Level 6 or higher monsters get a saving throw.", 0);
make_item("scroll_of_animate_dead", 150, "bishop", "temple", 0, 0, "c:t", "Cleric spell, only usable in the graveyard, that gives you a skeleton henchman.", 0);
make_item("scroll_of_sleep", 150, "count", "wizard_college", 0, 0, "w:t", "Wizard combat spell that automatically defeats any creature of level 4 or lower.", 0);
make_item("scroll_of_charm", 150, "count", "wizard_college", 0, 0, "w:t", "Wizard combat spell that turns an intelligent creature into a henchman unless it makes a saving throw.", 0);
make_item("scroll_of_magic_missile", 150, "count", "wizard_college", 0, 0, "w:t", "Wizard combat spell that does 1d4+1 damage and needs no attack roll.", 0);
make_item("scroll_of_haste", 150, "count", "wizard_college", 0, 0, "w:t", "Wizard combat spell that gives you and your henchman two attacks per turn until the end of the battle.", 0);
make_item("fire_beetle_glands", 5, 0, "", 0, 0, "", "They glow. Worth 5 GP to alchemists.", 1);
make_item("jacinth_of_estimable_beauty", 500, 0, "", 0, 0, "", "Worth a lot, as gems go. 500 GP.", 1);
make_item("resplendant_sapphire", 1000, 0, "", 0, 0, "", "Larger and more valuable than your common gem. Worth 1000 GP.", 1);
make_item("magnificent_emerald", 1500, 0, "", 0, 0, "", "This would be the centerpiece of any elf-king's hoard. 1500 GP.", 1);
make_item("flawless_diamond", 2000, 0, "", 0, 0, "", "Nearly as big as the Ritz. Worth 2000 GP.", 1);
make_item("priceless_ruby", 2500, 0, "", 0, 0, "", "Not priceless, actually. The price is 2500 GP.", 1);
make_item("priceless_poetry", 2000, 0, "", 0, 0, "", "A towering monument to human achievement. Unless it was written by an orc. It is mostly about blood.", 1);
make_item("wand_of_magic_missiles", 500, "count", "wizard_college", 0, 0, "w", "Does 1d4+1 damage. Breaks on a 1, hits on a 2-20.", 0);
make_item("gauntlets_of_ogre_power", 750, "king", "royal_treasury", 0, 1, "", "Gives you high Strength.", 0);
make_item("boots_of_elvenkind", 500, "king", "royal_treasury", 0, 1, "", "Gives you +1 to Sneak rolls.", 0);
make_item("amulet_of_recall", 1000, 0, "royal_treasury", 0, 0, "", "Lets you return home at any time.", 0);
make_item("potion_of_treasure_finding", 500, 0, "royal_treasury", 0, 0, "", "You're likely to find one extra treasure.", 0);
make_item("ring_of_invisibility", 2000, "king", "royal_treasury", 0, 1, "", "Gives you +2 to Sneak rolls.", 0);
make_item("ring_of_protection", 750, "king", "royal_treasury", 0, 1, "", "+1 AC.", 0);
make_item("quickness_potion", 100, "count", "wizard_college", 0, 0, "", "Gives you two attacks per turn until the end of the battle.", 0);
make_item("libram_of_improvement", 750, 0, "", 0, 0, "", "Raises a random attribute. If you're already high in that attribute, you can sell it.", 0);
make_item("libram_of_unnecessary_improvement", 750, 0, "", 0, 0, "", "The advice in this book is beneath you. You can sell it for 750 GP.", 1);
if (_root.weapon && (!has_item(_root.weapon))) {
add_equipment(_root.weapon);
}
var myweapon = _root.weapon;
_root.weapon = "";
readyitem(myweapon);
if (_root.gamemode == "game1") {
}
if (_root.testmode == 1) {
addnumber("gems", 500);
}
if (_root.createcharacter == 1) {
if (_root.characterclass == "Wizard") {
var randy = Math.ceil(Math.random() * 4);
if (randy == 1) {
add_equipment("scroll_of_magic_missile");
} else if (randy == 2) {
add_equipment("scroll_of_sleep");
} else if (randy == 3) {
add_equipment("scroll_of_charm");
} else if (randy == 4) {
add_equipment("scroll_of_haste");
}
_root.spells = 1;
} else if (_root.characterclass == "Cleric") {
_root.spells = 1;
add_equipment("blessed_symbol");
}
}
setnumber("maxhp", getnumber("maxhp"));
setnumber("hp", getnumber("maxhp"));
setnumber("ac", 10 + dexbonus());
_root.stunned = 0;
tosave.push("stunned");
_root.stuck = 0;
tosave.push(stuck);
_root.held = 0;
tosave.push(held);
_root.treasuremap = 0;
tosave.push("treasuremap");
setnumber("savingthrow", 4);
if (wisbonus()) {
addnumber("savingthrow", -1);
}
setnumber("monsterhp", 0);
setnumber("monstermaxhp", 0);
setnumber("monsterac", 0);
_root.monstername = "";
tosave.push("monstername");
_root.monsternumber = 0;
tosave.push("monsternumber");
_root.monsterhd = 0;
tosave.push("monsterhd");
_root.monsterstunned = 0;
tosave.push("monsterstunned");
_root.monsterheld = 0;
tosave.push("monsterheld");
var monstertags = new Object();
_root.monstertags = monstertags;
tosave.push("monstertags");
setnumber("monster2hp", 0);
setnumber("monster2maxhp", 0);
setnumber("monster2ac", 0);
_root.monster2name = "";
tosave.push("monster2name");
_root.monster2number = 0;
tosave.push("monster2number");
_root.monster2hd = 0;
tosave.push("monster2hd");
_root.monster2stunned = 0;
tosave.push("monster2stunned");
_root.monster2held = 0;
tosave.push("monster2held");
var monster2tags = new Object();
_root.monster2tags = monster2tags;
tosave.push("monster2tags");
setnumber("henchmanhp", 0);
setnumber("henchmanmaxhp", 0);
setnumber("henchmanac", 0);
_root.henchmanname = "";
tosave.push("henchmanname");
_root.henchmannumber = 0;
tosave.push("henchmannumber");
_root.henchmanhd = 0;
tosave.push("henchmanhd");
_root.henchmanstunned = 0;
tosave.push("henchmanstunned");
_root.henchmandoppelganger = 0;
tosave.push("henchmandoppelganger");
_root.henchmanheld = 0;
tosave.push("henchmanheld");
var henchmantags = new Object();
_root.henchmantags = henchmantags;
tosave.push("henchmantags");
setnumber("henchman2hp", 0);
setnumber("henchman2maxhp", 0);
setnumber("henchman2ac", 0);
_root.henchman2name = "";
tosave.push("henchman2name");
_root.henchman2number = 0;
tosave.push("henchman2number");
_root.henchman2hd = 0;
tosave.push("henchman2hd");
_root.henchman2stunned = 0;
tosave.push("henchman2stunned");
_root.henchman2doppelganger = 0;
tosave.push("henchman2doppelganger");
_root.henchman2held = 0;
tosave.push("henchman2held");
var henchman2tags = new Object();
_root.henchman2tags = henchman2tags;
tosave.push("henchman2tags");
_root.gender = "";
tosave.push("gender");
setnumber("roomnumber", 0);
setnumber("characterlevel", 0);
setnumber("xp", 0);
setnumber("drainedxp", 0);
tosave.push("drainedxp");
setnumber("attackbonus", ((0 + strbonus()) + levelbonus("fighter")) + levelbonus("cleric", 2));
setnumber("sneakbonus", (0 + dexbonus()) + levelbonus("thief"));
_root.lost = 0;
tosave.push("lost");
_root.combatround = 0;
tosave.push("combatround");
_root.glint = 0;
tosave.push("glint");
_root.noglintpossible = 0;
tosave.push("noglintpossible");
_root.tosave = tosave;
var masterlist = new Array();
_root.masterlist = masterlist;
rerollorkeep.choosearoll.onChanged = function (textfield_txt) {
_root.fudgeroll = int(rerollorkeep.choosearoll.text);
};
jump_to("start");
if (_root.mysavegame) {
if (_root.mysavegame == 10) {
_root.mysavegame = 0;
}
loadgame(_root.mysavegame);
} else {
write(("<b>Welcome to DUNGEON ROBBER, " + _root.charactername) + "!</b>");
write("You enter the Dungeon of Ever-Changing Corridors! You know it's a bad idea to be down here. Hopefully you'll find some gold before a fearsome kobold or skeleton finds you.");
movementphase();
}
charsheet.xpexplanationbox.onRollOver = function () {
charsheet.xpexplanation._alpha = 100;
};
charsheet.xpexplanationbox.onRollOut = function () {
charsheet.xpexplanation._alpha = 0;
};
charsheet.containerexplanationbox.onRollOver = function () {
charsheet.containerexplanation._alpha = 100;
};
charsheet.containerexplanationbox.onRollOut = function () {
charsheet.containerexplanation._alpha = 0;
};
charsheet.burdenexplanationbox.onRollOver = function () {
charsheet.burdenexplanation._alpha = 100;
};
charsheet.burdenexplanationbox.onRollOut = function () {
charsheet.burdenexplanation._alpha = 0;
};
rerollorkeep.rerollbutton.onPress = function () {
_root.nomaster = 0;
_root.rerollorkeep._x = -500;
_root.mycur._alpha = 0;
if (_root.lastroll[1] == "mainloop") {
if (_root.lost >= 1) {
addnumber("roomnumber", 1);
} else {
addnumber("roomnumber", -1);
}
}
remove_from_master();
prepend_to_master(_root.lastroll[0], _root.lastroll[1], _root.lastroll[2]);
prepend_to_master(_root.lastmove[0], _root.lastmove[1], _root.lastmove[2]);
write("Rerolling!");
_root.mycur._alpha = 0;
run_master();
};
rerollorkeep.keepbutton.onPress = function () {
_root.rerollorkeep._x = -500;
eval ("_root." + mycur)._alpha = 0;
run_master();
};
charsheetbutton.onPress = function () {
if (is_heavy()) {
_root.heavy = 1;
} else {
_root.heavy = 0;
}
opencharsheet();
};
mapexplanation.onRelease = function () {
Selection.setFocus("faker");
if (_root.mapexplanation._alpha == 100) {
_root.mapexplanation._alpha = 0;
} else if (_root.intown == 0) {
_root.mapexplanation._alpha = 100;
}
};
charsheet.closebutton.onPress = function () {
opencharsheet();
};
dungeonmap.startcorridor.onPress = function () {
if (_root.area != "premadestartingarea") {
return(undefined);
}
add_to_master("switch_area_off");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
};
dungeonmap.startdoor.onPress = function () {
if (_root.area != "premadestartingarea") {
return(undefined);
}
add_to_master("switch_area_off");
add_to_master("move_to", "doors1");
add_to_master("roll", "doordirection", 20);
run_master();
};
dungeonmap.doorleftback.onPress = function () {
if (_root.area != "doorleft") {
return(undefined);
}
add_to_master("switch_area_off");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
};
dungeonmap.doorrightback.onPress = function () {
if (_root.area != "doorright") {
return(undefined);
}
add_to_master("switch_area_off");
add_to_master("move_to", "turndirection", 0.25);
add_to_master("roll", "mainloop", 20);
run_master();
};
dungeonmap.doorlefton.onPress = function () {
if (_root.area != "doorleft") {
return(undefined);
}
add_to_master("switch_area_off");
add_to_master("move_to", "doors2", 0.9);
_root.lastdoordirection = "left";
add_to_master("switch_area_on", "beyonddoor");
add_to_master("roll", "beyonddoor", 20);
turn(-2);
run_master();
};
dungeonmap.doorrighton.onPress = function () {
if (_root.area != "doorright") {
return(undefined);
}
add_to_master("switch_area_off");
_root.lastdoordirection = "right";
add_to_master("move_to", "doors2", 0.9);
add_to_master("roll", "beyonddoor", 20);
turn(2);
run_master();
};
charsheet.use1.onPress = function () {
use_item(1);
};
charsheet.use2.onPress = function () {
use_item(2);
};
charsheet.use3.onPress = function () {
use_item(3);
};
charsheet.use4.onPress = function () {
use_item(4);
};
charsheet.use5.onPress = function () {
use_item(5);
};
charsheet.use6.onPress = function () {
use_item(6);
};
charsheet.use7.onPress = function () {
use_item(7);
};
charsheet.use8.onPress = function () {
use_item(8);
};
charsheet.use9.onPress = function () {
use_item(9);
};
charsheet.use10.onPress = function () {
use_item(10);
};
charsheet.use11.onPress = function () {
use_item(11);
};
charsheet.use12.onPress = function () {
use_item(12);
};
charsheet.use13.onPress = function () {
use_item(13);
};
charsheet.use14.onPress = function () {
use_item(14);
};
charsheet.drop1.onPress = function () {
drop_item(1);
};
charsheet.drop2.onPress = function () {
drop_item(2);
};
charsheet.drop3.onPress = function () {
drop_item(3);
};
charsheet.drop4.onPress = function () {
drop_item(4);
};
charsheet.drop5.onPress = function () {
drop_item(5);
};
charsheet.drop6.onPress = function () {
drop_item(6);
};
charsheet.drop7.onPress = function () {
drop_item(7);
};
charsheet.drop8.onPress = function () {
drop_item(8);
};
charsheet.drop9.onPress = function () {
drop_item(9);
};
charsheet.drop10.onPress = function () {
drop_item(10);
};
charsheet.drop11.onPress = function () {
drop_item(11);
};
charsheet.drop12.onPress = function () {
drop_item(12);
};
charsheet.drop13.onPress = function () {
drop_item(13);
};
charsheet.drop14.onPress = function () {
drop_item(14);
};
charsheet.poss1.onRollOver = function () {
explain_item(1);
};
charsheet.poss1.onRollOut = function () {
explain_item(0);
};
charsheet.poss2.onRollOver = function () {
explain_item(2);
};
charsheet.poss2.onRollOut = function () {
explain_item(0);
};
charsheet.poss3.onRollOver = function () {
explain_item(3);
};
charsheet.poss3.onRollOut = function () {
explain_item(0);
};
charsheet.poss4.onRollOver = function () {
explain_item(4);
};
charsheet.poss4.onRollOut = function () {
explain_item(0);
};
charsheet.poss5.onRollOver = function () {
explain_item(5);
};
charsheet.poss5.onRollOut = function () {
explain_item(0);
};
charsheet.poss6.onRollOver = function () {
explain_item(6);
};
charsheet.poss6.onRollOut = function () {
explain_item(0);
};
charsheet.poss7.onRollOver = function () {
explain_item(7);
};
charsheet.poss7.onRollOut = function () {
explain_item(0);
};
charsheet.poss8.onRollOver = function () {
explain_item(8);
};
charsheet.poss8.onRollOut = function () {
explain_item(0);
};
charsheet.poss9.onRollOver = function () {
explain_item(9);
};
charsheet.poss9.onRollOut = function () {
explain_item(0);
};
charsheet.poss10.onRollOver = function () {
explain_item(10);
};
charsheet.poss10.onRollOut = function () {
explain_item(0);
};
charsheet.poss11.onRollOver = function () {
explain_item(11);
};
charsheet.poss11.onRollOut = function () {
explain_item(0);
};
charsheet.poss12.onRollOver = function () {
explain_item(12);
};
charsheet.poss12.onRollOut = function () {
explain_item(0);
};
charsheet.poss13.onRollOver = function () {
explain_item(13);
};
charsheet.poss13.onRollOut = function () {
explain_item(0);
};
charsheet.poss14.onRollOver = function () {
explain_item(14);
};
charsheet.poss14.onRollOut = function () {
explain_item(0);
};
charsheet.drop1.onRollOver = function () {
price_item(1);
};
charsheet.drop1.onRollOut = function () {
price_item(0);
};
charsheet.drop2.onRollOver = function () {
price_item(2);
};
charsheet.drop2.onRollOut = function () {
price_item(0);
};
charsheet.drop3.onRollOver = function () {
price_item(3);
};
charsheet.drop3.onRollOut = function () {
price_item(0);
};
charsheet.drop4.onRollOver = function () {
price_item(4);
};
charsheet.drop4.onRollOut = function () {
price_item(0);
};
charsheet.drop5.onRollOver = function () {
price_item(5);
};
charsheet.drop5.onRollOut = function () {
price_item(0);
};
charsheet.drop6.onRollOver = function () {
price_item(6);
};
charsheet.drop6.onRollOut = function () {
price_item(0);
};
charsheet.drop7.onRollOver = function () {
price_item(7);
};
charsheet.drop7.onRollOut = function () {
price_item(0);
};
charsheet.drop8.onRollOver = function () {
price_item(8);
};
charsheet.drop8.onRollOut = function () {
price_item(0);
};
charsheet.drop9.onRollOver = function () {
price_item(9);
};
charsheet.drop9.onRollOut = function () {
price_item(0);
};
charsheet.drop10.onRollOver = function () {
price_item(10);
};
charsheet.drop10.onRollOut = function () {
price_item(0);
};
charsheet.drop11.onRollOver = function () {
price_item(11);
};
charsheet.drop11.onRollOut = function () {
price_item(0);
};
charsheet.drop12.onRollOver = function () {
price_item(12);
};
charsheet.drop12.onRollOut = function () {
price_item(0);
};
charsheet.drop13.onRollOver = function () {
price_item(13);
};
charsheet.drop13.onRollOut = function () {
price_item(0);
};
charsheet.drop14.onRollOver = function () {
price_item(14);
};
charsheet.drop14.onRollOut = function () {
price_item(0);
};
add_equipment();
Symbol 9 MovieClip [BrdrShdw] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "shadowColor");
Symbol 11 MovieClip [BrdrFace] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "buttonColor");
Symbol 14 MovieClip [BrdrBlk] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "borderColor");
Symbol 16 MovieClip [BrdrHilght] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "highlightColor");
Symbol 19 MovieClip [Defaults] Frame 1
#initclip 28
Object.registerClass("Defaults", mx.skins.halo.Defaults);
#endinitclip
Symbol 20 MovieClip [UIObjectExtensions] Frame 1
#initclip 29
Object.registerClass("UIObjectExtensions", mx.core.ext.UIObjectExtensions);
#endinitclip
Symbol 21 MovieClip [UIObject] Frame 1
#initclip 30
Object.registerClass("UIObject", mx.core.UIObject);
#endinitclip
stop();
Symbol 24 Button
on (keyPress "<Tab>") {
this.tabHandler();
}
Symbol 25 MovieClip Frame 1
#initclip 31
Object.registerClass("FocusManager", mx.managers.FocusManager);
if (_root.focusManager == undefined) {
_root.createClassObject(mx.managers.FocusManager, "focusManager", mx.managers.DepthManager.highestDepth--);
}
#endinitclip
Symbol 26 MovieClip [FocusRect] Frame 1
#initclip 32
Object.registerClass("FocusRect", mx.skins.halo.FocusRect);
#endinitclip
Symbol 27 MovieClip [FocusManager] Frame 1
#initclip 33
Object.registerClass("FocusManager", mx.managers.FocusManager);
#endinitclip
stop();
Symbol 28 MovieClip [UIComponentExtensions] Frame 1
#initclip 34
Object.registerClass("UIComponentExtensions", mx.core.ext.UIComponentExtensions);
#endinitclip
Symbol 29 MovieClip [UIComponent] Frame 1
#initclip 35
Object.registerClass("UIComponent", mx.core.UIComponent);
#endinitclip
stop();
Symbol 30 MovieClip [SimpleButton] Frame 1
#initclip 36
Object.registerClass("SimpleButton", mx.controls.SimpleButton);
#endinitclip
stop();
Symbol 31 MovieClip [Border] Frame 1
#initclip 37
Object.registerClass("Border", mx.skins.Border);
#endinitclip
stop();
Symbol 32 MovieClip [RectBorder] Frame 1
#initclip 38
mx.skins.SkinElement.registerElement(mx.skins.RectBorder.symbolName, Object(mx.skins.RectBorder));
Object.registerClass("RectBorder", mx.skins.halo.RectBorder);
#endinitclip
stop();
Symbol 33 MovieClip [ButtonSkin] Frame 1
#initclip 39
Object.registerClass("ButtonSkin", mx.skins.halo.ButtonSkin);
#endinitclip
Symbol 34 MovieClip [Button] Frame 1
#initclip 40
Object.registerClass("Button", mx.controls.Button);
#endinitclip
stop();
Instance of Symbol 30 MovieClip [SimpleButton] in Symbol 34 MovieClip [Button] Frame 2
//component parameters
onClipEvent (initialize) {
selected = false;
toggle = false;
enabled = true;
visible = true;
minHeight = 0;
minWidth = 0;
}
Symbol 39 MovieClip [RadioThemeColor1] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "themeColor");
Symbol 43 MovieClip [RadioThemeColor2] Frame 1
mx.skins.ColoredSkinElement.setColorStyle(this, "themeColor");
Symbol 49 MovieClip [RadioButtonAssets] Frame 1
#initclip 41
mx.controls.RadioButton.prototype.adjustFocusRect = function () {
var _local4 = this._parent.focus_mc;
var _local2 = this.iconName;
var _local3 = this.getStyle("themeColor");
if (_local3 == undefined) {
_local3 = 8453965 /* 0x80FF4D */;
}
var _local5 = _local2._width + 4;
var _local6 = _local2._height + 4;
_local4.setSize(_local5, _local6, 8, 100, _local3);
var _local8 = _local2._x;
var _local7 = _local2._y;
_local4.move((this.x - 2) + _local8, (this.y + _local7) - 2);
};
#endinitclip
Symbol 50 MovieClip [RadioButton] Frame 1
#initclip 42
Object.registerClass("RadioButton", mx.controls.RadioButton);
#endinitclip
stop();
Instance of Symbol 34 MovieClip [Button] "foo" in Symbol 50 MovieClip [RadioButton] Frame 2
//component parameters
onClipEvent (initialize) {
icon = "";
label = "Button";
labelPlacement = "right";
selected = false;
toggle = false;
enabled = true;
visible = true;
minHeight = 0;
minWidth = 0;
}
Symbol 85 MovieClip Frame 1
var total;
var loaded;
if (!oldpercentloaded) {
var oldpercentloaded = 0;
}
if (!percentloaded) {
var percentloaded = 0;
}
var movediff = 0;
this.onEnterFrame = function () {
total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
percentloaded = int((loaded / total) * 20);
_root.veil._alpha = 100 - (percentloaded * 5);
loadingtext.text = (percentloaded * 5) + "% loaded...";
movediff = percentloaded - oldpercentloaded;
if (movediff > 0) {
_root.myloader.yellow._x = _root.myloader.yellow._x - (movediff * 2);
_root.myloader.yellow._y = _root.myloader.yellow._y - (movediff * 2);
oldpercentloaded = percentloaded;
}
if (loaded >= total) {
_root.loadinglozenge._alpha = 100;
if (_root.showsavezero == 1) {
_root.savezero._x = 60;
}
if (_root.startnewgamebutton >= 1) {
_root.saveone._x = 60;
}
if (_root.startnewgamebutton >= 2) {
_root.savetwo._x = 60;
}
if (_root.startnewgamebutton >= 3) {
_root.savethree._x = 60;
}
if (_root.startnewgamebutton >= 4) {
_root.savefour._x = 60;
}
stop();
}
};
Symbol 132 MovieClip Frame 1
stop();
loztext.text = "What the heck is this?";
_root.loadinglozenge.clo.onPress = function () {
_root.loadinglozenge.gotoAndStop(2);
};
Symbol 132 MovieClip Frame 2
stop();
_root.loadinglozenge.ope.onPress = function () {
_root.loadinglozenge.gotoAndStop(1);
};
Symbol 1305 MovieClip [__Packages.JSON] Frame 0
class JSON
{
var text;
function JSON () {
}
function stringify(arg) {
var _local4;
var _local3;
var _local7;
var _local2 = "";
var _local5;
switch (typeof(arg)) {
case "object" :
if (arg) {
if (arg instanceof Array) {
_local3 = 0;
while (_local3 < arg.length) {
_local5 = stringify(arg[_local3]);
if (_local2) {
_local2 = _local2 + ",";
}
_local2 = _local2 + _local5;
_local3++;
}
return(("[" + _local2) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local3 in arg) {
_local5 = arg[_local3];
if ((typeof(_local5) != "undefined") && (typeof(_local5) != "function")) {
_local5 = stringify(_local5);
if (_local2) {
_local2 = _local2 + ",";
}
_local2 = _local2 + ((stringify(_local3) + ":") + _local5);
}
}
return(("{" + _local2) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local7 = arg.length;
_local2 = "\"";
_local3 = 0;
while (_local3 < _local7) {
_local4 = arg.charAt(_local3);
if (_local4 >= " ") {
if ((_local4 == "\\") || (_local4 == "\"")) {
_local2 = _local2 + "\\";
}
_local2 = _local2 + _local4;
} else {
switch (_local4) {
case "\b" :
_local2 = _local2 + "\\b";
break;
case "\f" :
_local2 = _local2 + "\\f";
break;
case newline :
_local2 = _local2 + "\\n";
break;
case "\r" :
_local2 = _local2 + "\\r";
break;
case "\t" :
_local2 = _local2 + "\\t";
break;
default :
_local4 = _local4.charCodeAt();
_local2 = _local2 + (("\\u00" + Math.floor(_local4 / 16).toString(16)) + (_local4 % 16).toString(16));
}
}
_local3 = _local3 + 1;
}
return(_local2 + "\"");
case "boolean" :
return(String(arg));
}
return("null");
}
function white() {
while (ch) {
if (ch <= " ") {
next();
} else if (ch == "/") {
switch (next()) {
case "/" :
while ((next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
next();
for(;;){
if (ch) {
if (ch == "*") {
if (next() == "/") {
next();
// unexpected jump
}
} else {
next();
}
} else {
error("Unterminated comment");
}
};
break;
default :
error("Syntax error");
}
} else {
break;
}
}
}
function error(m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
}
function next() {
ch = text.charAt(at);
at = at + 1;
return(ch);
}
function str() {
var _local5;
var _local2 = "";
var _local4;
var _local3;
var _local6 = false;
if (ch == "\"") {
while (next()) {
if (ch == "\"") {
next();
return(_local2);
}
if (ch == "\\") {
switch (next()) {
case "b" :
_local2 = _local2 + "\b";
break;
case "f" :
_local2 = _local2 + "\f";
break;
case "n" :
_local2 = _local2 + newline;
break;
case "r" :
_local2 = _local2 + "\r";
break;
case "t" :
_local2 = _local2 + "\t";
break;
case "u" :
_local3 = 0;
_local5 = 0;
while (_local5 < 4) {
_local4 = parseInt(next(), 16);
if (!isFinite(_local4)) {
_local6 = true;
break;
}
_local3 = (_local3 * 16) + _local4;
_local5 = _local5 + 1;
}
if (_local6) {
_local6 = false;
break;
}
_local2 = _local2 + String.fromCharCode(_local3);
break;
default :
_local2 = _local2 + ch;
}
} else {
_local2 = _local2 + ch;
}
}
}
error("Bad string");
}
function arr() {
var _local2 = [];
if (ch == "[") {
next();
white();
if (ch == "]") {
next();
return(_local2);
}
while (ch) {
_local2.push(value());
white();
if (ch == "]") {
next();
return(_local2);
}
if (ch != ",") {
break;
}
next();
white();
}
}
error("Bad array");
}
function obj() {
var _local3;
var _local2 = {};
if (ch == "{") {
next();
white();
if (ch == "}") {
next();
return(_local2);
}
while (ch) {
_local3 = str();
white();
if (ch != ":") {
break;
}
next();
_local2[_local3] = value();
white();
if (ch == "}") {
next();
return(_local2);
}
if (ch != ",") {
break;
}
next();
white();
}
}
error("Bad object");
}
function num() {
var _local2 = "";
var _local3;
if (ch == "-") {
_local2 = "-";
next();
}
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
next();
}
if (ch == ".") {
_local2 = _local2 + ".";
next();
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
next();
}
}
if ((ch == "e") || (ch == "E")) {
_local2 = _local2 + ch;
next();
if ((ch == "-") || (ch == "+")) {
_local2 = _local2 + ch;
next();
}
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
next();
}
}
_local3 = Number(_local2);
if (!isFinite(_local3)) {
error("Bad number");
}
return(_local3);
}
function word() {
switch (ch) {
case "t" :
if (((next() == "r") && (next() == "u")) && (next() == "e")) {
next();
return(true);
}
break;
case "f" :
if ((((next() == "a") && (next() == "l")) && (next() == "s")) && (next() == "e")) {
next();
return(false);
}
break;
case "n" :
if (!(((next() == "u") && (next() == "l")) && (next() == "l"))) {
break;
}
next();
return(null);
}
error("Syntax error");
}
function value() {
white();
switch (ch) {
case "{" :
return(obj());
case "[" :
return(arr());
case "\"" :
return(str());
case "-" :
return(num());
}
return((((ch >= "0") && (ch <= "9")) ? (num()) : (word())));
}
function parse(_text) {
text = _text;
at = 0;
ch = " ";
return(value());
}
var ch = "";
var at = 0;
}
Symbol 1 MovieClip [__Packages.mx.core.UIObject] Frame 0
class mx.core.UIObject extends MovieClip
{
var _width, _height, _x, _y, _parent, _minHeight, _minWidth, _visible, dispatchEvent, _xscale, _yscale, methodTable, onEnterFrame, tfList, __width, __height, moveTo, lineTo, createTextField, attachMovie, buildDepthTable, findNextAvailableDepth, idNames, childrenCreated, _name, createAccessibilityImplementation, _endInit, validateNow, hasOwnProperty, initProperties, stylecache, className, ignoreClassStyleDeclaration, _tf, fontFamily, fontSize, color, marginLeft, marginRight, fontStyle, fontWeight, textAlign, textIndent, textDecoration, embedFonts, styleName, enabled;
function UIObject () {
super();
constructObject();
}
function get width() {
return(_width);
}
function get height() {
return(_height);
}
function get left() {
return(_x);
}
function get x() {
return(_x);
}
function get top() {
return(_y);
}
function get y() {
return(_y);
}
function get right() {
return(_parent.width - (_x + width));
}
function get bottom() {
return(_parent.height - (_y + height));
}
function getMinHeight(Void) {
return(_minHeight);
}
function setMinHeight(h) {
_minHeight = h;
}
function get minHeight() {
return(getMinHeight());
}
function set minHeight(h) {
setMinHeight(h);
//return(minHeight);
}
function getMinWidth(Void) {
return(_minWidth);
}
function setMinWidth(w) {
_minWidth = w;
}
function get minWidth() {
return(getMinWidth());
}
function set minWidth(w) {
setMinWidth(w);
//return(minWidth);
}
function setVisible(x, noEvent) {
if (x != _visible) {
_visible = x;
if (noEvent != true) {
dispatchEvent({type:(x ? "reveal" : "hide")});
}
}
}
function get visible() {
return(_visible);
}
function set visible(x) {
setVisible(x, false);
//return(visible);
}
function get scaleX() {
return(_xscale);
}
function set scaleX(x) {
_xscale = x;
//return(scaleX);
}
function get scaleY() {
return(_yscale);
}
function set scaleY(y) {
_yscale = y;
//return(scaleY);
}
function doLater(obj, fn) {
if (methodTable == undefined) {
methodTable = new Array();
}
methodTable.push({obj:obj, fn:fn});
onEnterFrame = doLaterDispatcher;
}
function doLaterDispatcher(Void) {
delete onEnterFrame;
if (invalidateFlag) {
redraw();
}
var _local3 = methodTable;
methodTable = new Array();
if (_local3.length > 0) {
var _local2;
while (_local2 = _local3.shift() , _local2 != undefined) {
_local2.obj[_local2.fn]();
}
}
}
function cancelAllDoLaters(Void) {
delete onEnterFrame;
methodTable = new Array();
}
function invalidate(Void) {
invalidateFlag = true;
onEnterFrame = doLaterDispatcher;
}
function invalidateStyle(Void) {
invalidate();
}
function redraw(bAlways) {
if (invalidateFlag || (bAlways)) {
invalidateFlag = false;
var _local2;
for (_local2 in tfList) {
tfList[_local2].draw();
}
draw();
dispatchEvent({type:"draw"});
}
}
function draw(Void) {
}
function move(x, y, noEvent) {
var _local3 = _x;
var _local2 = _y;
_x = x;
_y = y;
if (noEvent != true) {
dispatchEvent({type:"move", oldX:_local3, oldY:_local2});
}
}
function setSize(w, h, noEvent) {
var _local2 = __width;
var _local3 = __height;
__width = w;
__height = h;
size();
if (noEvent != true) {
dispatchEvent({type:"resize", oldWidth:_local2, oldHeight:_local3});
}
}
function size(Void) {
_width = __width;
_height = __height;
}
function drawRect(x1, y1, x2, y2) {
moveTo(x1, y1);
lineTo(x2, y1);
lineTo(x2, y2);
lineTo(x1, y2);
lineTo(x1, y1);
}
function createLabel(name, depth, text) {
createTextField(name, depth, 0, 0, 0, 0);
var _local2 = this[name];
_local2._color = textColorList;
_local2._visible = false;
_local2.__text = text;
if (tfList == undefined) {
tfList = new Object();
}
tfList[name] = _local2;
_local2.invalidateStyle();
invalidate();
_local2.styleName = this;
return(_local2);
}
function createObject(linkageName, id, depth, initobj) {
return(attachMovie(linkageName, id, depth, initobj));
}
function createClassObject(className, id, depth, initobj) {
var _local3 = className.symbolName == undefined;
if (_local3) {
Object.registerClass(className.symbolOwner.symbolName, className);
}
var _local4 = createObject(className.symbolOwner.symbolName, id, depth, initobj);
if (_local3) {
Object.registerClass(className.symbolOwner.symbolName, className.symbolOwner);
}
return(_local4);
}
function createEmptyObject(id, depth) {
return(createClassObject(mx.core.UIObject, id, depth));
}
function destroyObject(id) {
var _local2 = this[id];
if (_local2.getDepth() < 0) {
var _local4 = buildDepthTable();
var _local5 = findNextAvailableDepth(0, _local4, "up");
var _local3 = _local5;
_local2.swapDepths(_local3);
}
_local2.removeMovieClip();
delete this[id];
}
function getSkinIDName(tag) {
return(idNames[tag]);
}
function setSkin(tag, linkageName, initObj) {
if (_global.skinRegistry[linkageName] == undefined) {
mx.skins.SkinElement.registerElement(linkageName, mx.skins.SkinElement);
}
return(createObject(linkageName, getSkinIDName(tag), tag, initObj));
}
function createSkin(tag) {
var _local2 = getSkinIDName(tag);
createEmptyObject(_local2, tag);
return(this[_local2]);
}
function createChildren(Void) {
}
function _createChildren(Void) {
createChildren();
childrenCreated = true;
}
function constructObject(Void) {
if (_name == undefined) {
return(undefined);
}
init();
_createChildren();
createAccessibilityImplementation();
_endInit();
if (validateNow) {
redraw(true);
} else {
invalidate();
}
}
function initFromClipParameters(Void) {
var _local4 = false;
var _local2;
for (_local2 in clipParameters) {
if (hasOwnProperty(_local2)) {
_local4 = true;
this["def_" + _local2] = this[_local2];
delete this[_local2];
}
}
if (_local4) {
for (_local2 in clipParameters) {
var _local3 = this["def_" + _local2];
if (_local3 != undefined) {
this[_local2] = _local3;
}
}
}
}
function init(Void) {
__width = _width;
__height = _height;
if (initProperties == undefined) {
initFromClipParameters();
} else {
initProperties();
}
if (_global.cascadingStyles == true) {
stylecache = new Object();
}
}
function getClassStyleDeclaration(Void) {
var _local4 = this;
var _local3 = className;
while (_local3 != undefined) {
if (ignoreClassStyleDeclaration[_local3] == undefined) {
if (_global.styles[_local3] != undefined) {
return(_global.styles[_local3]);
}
}
_local4 = _local4.__proto__;
_local3 = _local4.className;
}
}
function setColor(color) {
}
function __getTextFormat(tf, bAll) {
var _local8 = stylecache.tf;
if (_local8 != undefined) {
var _local3;
for (_local3 in mx.styles.StyleManager.TextFormatStyleProps) {
if (bAll || (mx.styles.StyleManager.TextFormatStyleProps[_local3])) {
if (tf[_local3] == undefined) {
tf[_local3] = _local8[_local3];
}
}
}
return(false);
}
var _local6 = false;
for (var _local3 in mx.styles.StyleManager.TextFormatStyleProps) {
if (bAll || (mx.styles.StyleManager.TextFormatStyleProps[_local3])) {
if (tf[_local3] == undefined) {
var _local5 = _tf[_local3];
if (_local5 != undefined) {
tf[_local3] = _local5;
} else if ((_local3 == "font") && (fontFamily != undefined)) {
tf[_local3] = fontFamily;
} else if ((_local3 == "size") && (fontSize != undefined)) {
tf[_local3] = fontSize;
} else if ((_local3 == "color") && (color != undefined)) {
tf[_local3] = color;
} else if ((_local3 == "leftMargin") && (marginLeft != undefined)) {
tf[_local3] = marginLeft;
} else if ((_local3 == "rightMargin") && (marginRight != undefined)) {
tf[_local3] = marginRight;
} else if ((_local3 == "italic") && (fontStyle != undefined)) {
tf[_local3] = fontStyle == _local3;
} else if ((_local3 == "bold") && (fontWeight != undefined)) {
tf[_local3] = fontWeight == _local3;
} else if ((_local3 == "align") && (textAlign != undefined)) {
tf[_local3] = textAlign;
} else if ((_local3 == "indent") && (textIndent != undefined)) {
tf[_local3] = textIndent;
} else if ((_local3 == "underline") && (textDecoration != undefined)) {
tf[_local3] = textDecoration == _local3;
} else if ((_local3 == "embedFonts") && (embedFonts != undefined)) {
tf[_local3] = embedFonts;
} else {
_local6 = true;
}
}
}
}
if (_local6) {
var _local9 = styleName;
if (_local9 != undefined) {
if (typeof(_local9) != "string") {
_local6 = _local9.__getTextFormat(tf, true, this);
} else if (_global.styles[_local9] != undefined) {
_local6 = _global.styles[_local9].__getTextFormat(tf, true, this);
}
}
}
if (_local6) {
var _local10 = getClassStyleDeclaration();
if (_local10 != undefined) {
_local6 = _local10.__getTextFormat(tf, true, this);
}
}
if (_local6) {
if (_global.cascadingStyles) {
if (_parent != undefined) {
_local6 = _parent.__getTextFormat(tf, false);
}
}
}
if (_local6) {
_local6 = _global.style.__getTextFormat(tf, true, this);
}
return(_local6);
}
function _getTextFormat(Void) {
var _local2 = stylecache.tf;
if (_local2 != undefined) {
return(_local2);
}
_local2 = new TextFormat();
__getTextFormat(_local2, true);
stylecache.tf = _local2;
if (enabled == false) {
var _local3 = getStyle("disabledColor");
_local2.color = _local3;
}
return(_local2);
}
function getStyleName(Void) {
var _local2 = styleName;
if (_local2 != undefined) {
if (typeof(_local2) != "string") {
return(_local2.getStyleName());
}
return(_local2);
}
if (_parent != undefined) {
return(_parent.getStyleName());
}
return(undefined);
}
function getStyle(styleProp) {
var _local3;
_global.getStyleCounter++;
if (this[styleProp] != undefined) {
return(this[styleProp]);
}
var _local6 = styleName;
if (_local6 != undefined) {
if (typeof(_local6) != "string") {
_local3 = _local6.getStyle(styleProp);
} else {
var _local7 = _global.styles[_local6];
_local3 = _local7.getStyle(styleProp);
}
}
if (_local3 != undefined) {
return(_local3);
}
var _local7 = getClassStyleDeclaration();
if (_local7 != undefined) {
_local3 = _local7[styleProp];
}
if (_local3 != undefined) {
return(_local3);
}
if (_global.cascadingStyles) {
if (mx.styles.StyleManager.isInheritingStyle(styleProp) || (mx.styles.StyleManager.isColorStyle(styleProp))) {
var _local5 = stylecache;
if (_local5 != undefined) {
if (_local5[styleProp] != undefined) {
return(_local5[styleProp]);
}
}
if (_parent != undefined) {
_local3 = _parent.getStyle(styleProp);
} else {
_local3 = _global.style[styleProp];
}
if (_local5 != undefined) {
_local5[styleProp] = _local3;
}
return(_local3);
}
}
if (_local3 == undefined) {
_local3 = _global.style[styleProp];
}
return(_local3);
}
static function mergeClipParameters(o, p) {
for (var _local3 in p) {
o[_local3] = p[_local3];
}
return(true);
}
static var symbolName = "UIObject";
static var symbolOwner = mx.core.UIObject;
static var version = "2.0.2.127";
static var textColorList = {color:1, disabledColor:1};
var invalidateFlag = false;
var lineWidth = 1;
var lineColor = 0;
var tabEnabled = false;
var clipParameters = {visible:1, minHeight:1, minWidth:1, maxHeight:1, maxWidth:1, preferredHeight:1, preferredWidth:1};
}
Symbol 2 MovieClip [__Packages.mx.core.UIComponent] Frame 0
class mx.core.UIComponent extends mx.core.UIObject
{
var __width, __height, invalidate, stylecache, removeEventListener, dispatchEvent, drawFocus, addEventListener, _xscale, _yscale, _focusrect, watch, enabled;
function UIComponent () {
super();
}
function get width() {
return(__width);
}
function get height() {
return(__height);
}
function setVisible(x, noEvent) {
super.setVisible(x, noEvent);
}
function enabledChanged(id, oldValue, newValue) {
setEnabled(newValue);
invalidate();
delete stylecache.tf;
return(newValue);
}
function setEnabled(enabled) {
invalidate();
}
function getFocus() {
var selFocus = Selection.getFocus();
return(((selFocus === null) ? null : (eval (selFocus))));
}
function setFocus() {
Selection.setFocus(this);
}
function getFocusManager() {
var _local2 = this;
while (_local2 != undefined) {
if (_local2.focusManager != undefined) {
return(_local2.focusManager);
}
_local2 = _local2._parent;
}
return(undefined);
}
function onKillFocus(newFocus) {
removeEventListener("keyDown", this);
removeEventListener("keyUp", this);
dispatchEvent({type:"focusOut"});
drawFocus(false);
}
function onSetFocus(oldFocus) {
addEventListener("keyDown", this);
addEventListener("keyUp", this);
dispatchEvent({type:"focusIn"});
if (getFocusManager().bDrawFocus != false) {
drawFocus(true);
}
}
function findFocusInChildren(o) {
if (o.focusTextField != undefined) {
return(o.focusTextField);
}
if (o.tabEnabled == true) {
return(o);
}
return(undefined);
}
function findFocusFromObject(o) {
if (o.tabEnabled != true) {
if (o._parent == undefined) {
return(undefined);
}
if (o._parent.tabEnabled == true) {
o = o._parent;
} else if (o._parent.tabChildren) {
o = findFocusInChildren(o._parent);
} else {
o = findFocusFromObject(o._parent);
}
}
return(o);
}
function pressFocus() {
var _local3 = findFocusFromObject(this);
var _local2 = getFocus();
if (_local3 != _local2) {
_local2.drawFocus(false);
if (getFocusManager().bDrawFocus != false) {
_local3.drawFocus(true);
}
}
}
function releaseFocus() {
var _local2 = findFocusFromObject(this);
if (_local2 != getFocus()) {
_local2.setFocus();
}
}
function isParent(o) {
while (o != undefined) {
if (o == this) {
return(true);
}
o = o._parent;
}
return(false);
}
function size() {
}
function init() {
super.init();
_xscale = 100;
_yscale = 100;
_focusrect = _global.useFocusRect == false;
watch("enabled", enabledChanged);
if (enabled == false) {
setEnabled(false);
}
}
function dispatchValueChangedEvent(value) {
dispatchEvent({type:"valueChanged", value:value});
}
static var symbolName = "UIComponent";
static var symbolOwner = mx.core.UIComponent;
static var version = "2.0.2.127";
static var kStretch = 5000;
var focusEnabled = true;
var tabEnabled = true;
var origBorderStyles = {themeColor:16711680};
var clipParameters = {};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.core.UIComponent.prototype.clipParameters, mx.core.UIObject.prototype.clipParameters);
}
Symbol 3 MovieClip [__Packages.mx.controls.SimpleButton] Frame 0
class mx.controls.SimpleButton extends mx.core.UIComponent
{
static var emphasizedStyleDeclaration;
var preset, boundingBox_mc, useHandCursor, skinName, linkLength, iconName, destroyObject, __width, _width, __height, _height, __emphaticStyleName, styleName, enabled, invalidate, pressFocus, dispatchEvent, autoRepeat, interval, getStyle, releaseFocus, createLabel, invalidateStyle;
function SimpleButton () {
super();
}
function init(Void) {
super.init();
if (preset == undefined) {
boundingBox_mc._visible = false;
boundingBox_mc._width = (boundingBox_mc._height = 0);
}
useHandCursor = false;
}
function createChildren(Void) {
if (preset != undefined) {
var _local2 = this[idNames[preset]];
this[refNames[preset]] = _local2;
skinName = _local2;
if (falseOverSkin.length == 0) {
rolloverSkin = fus;
}
if (falseOverIcon.length == 0) {
rolloverIcon = fui;
}
initializing = false;
} else if (__state == true) {
setStateVar(true);
} else {
if (falseOverSkin.length == 0) {
rolloverSkin = fus;
}
if (falseOverIcon.length == 0) {
rolloverIcon = fui;
}
}
}
function setIcon(tag, linkageName) {
return(setSkin(tag + 8, linkageName));
}
function changeIcon(tag, linkageName) {
linkLength = linkageName.length;
var _local2 = stateNames[tag] + "Icon";
this[_local2] = linkageName;
this[idNames[tag + 8]] = _local2;
setStateVar(getState());
}
function changeSkin(tag, linkageName) {
var _local2 = stateNames[tag] + "Skin";
this[_local2] = linkageName;
this[idNames[tag]] = _local2;
setStateVar(getState());
}
function viewIcon(varName) {
var _local4 = varName + "Icon";
var _local3 = this[_local4];
if (typeof(_local3) == "string") {
var _local5 = _local3;
if (__emphasized) {
if (this[_local3 + "Emphasized"].length > 0) {
_local3 = _local3 + "Emphasized";
}
}
if (this[_local3].length == 0) {
return(undefined);
}
_local3 = setIcon(tagMap[_local5], this[_local3]);
if ((_local3 == undefined) && (_global.isLivePreview)) {
_local3 = setIcon(0, "ButtonIcon");
}
this[_local4] = _local3;
}
iconName._visible = false;
iconName = _local3;
iconName._visible = true;
}
function removeIcons() {
var _local3 = 0;
while (_local3 < 2) {
var _local2 = 8;
while (_local2 < 16) {
destroyObject(idNames[_local2]);
this[stateNames[_local2 - 8] + "Icon"] = "";
_local2++;
}
_local3++;
}
refresh();
}
function setSkin(tag, linkageName, initobj) {
var _local3 = super.setSkin(tag, linkageName, ((initobj != undefined) ? (initobj) : ({styleName:this})));
calcSize(tag, _local3);
return(_local3);
}
function calcSize(Void) {
__width = _width;
__height = _height;
}
function viewSkin(varName, initObj) {
var _local3 = varName + "Skin";
var _local2 = this[_local3];
if (typeof(_local2) == "string") {
var _local4 = _local2;
if (__emphasized) {
if (this[_local2 + "Emphasized"].length > 0) {
_local2 = _local2 + "Emphasized";
}
}
if (this[_local2].length == 0) {
return(undefined);
}
_local2 = setSkin(tagMap[_local4], this[_local2], ((initObj != undefined) ? (initObj) : ({styleName:this})));
this[_local3] = _local2;
}
skinName._visible = false;
skinName = _local2;
skinName._visible = true;
}
function showEmphasized(e) {
if (e && (!__emphatic)) {
if (emphasizedStyleDeclaration != undefined) {
__emphaticStyleName = styleName;
styleName = emphasizedStyleDeclaration;
}
__emphatic = true;
} else {
if (__emphatic) {
styleName = __emphaticStyleName;
}
__emphatic = false;
}
}
function refresh(Void) {
var _local2 = getState();
if (enabled == false) {
viewIcon("disabled");
viewSkin("disabled");
} else {
viewSkin(phase);
viewIcon(phase);
}
setView(phase == "down");
iconName.enabled = enabled;
}
function setView(offset) {
if (iconName == undefined) {
return(undefined);
}
var _local2 = (offset ? (btnOffset) : 0);
iconName._x = ((__width - iconName._width) / 2) + _local2;
iconName._y = ((__height - iconName._height) / 2) + _local2;
}
function setStateVar(state) {
if (state) {
if (trueOverSkin.length == 0) {
rolloverSkin = tus;
} else {
rolloverSkin = trs;
}
if (trueOverIcon.length == 0) {
rolloverIcon = tui;
} else {
rolloverIcon = tri;
}
upSkin = tus;
downSkin = tds;
disabledSkin = dts;
upIcon = tui;
downIcon = tdi;
disabledIcon = dti;
} else {
if (falseOverSkin.length == 0) {
rolloverSkin = fus;
} else {
rolloverSkin = frs;
}
if (falseOverIcon.length == 0) {
rolloverIcon = fui;
} else {
rolloverIcon = fri;
}
upSkin = fus;
downSkin = fds;
disabledSkin = dfs;
upIcon = fui;
downIcon = fdi;
disabledIcon = dfi;
}
__state = state;
}
function setState(state) {
if (state != __state) {
setStateVar(state);
invalidate();
}
}
function size(Void) {
refresh();
}
function draw(Void) {
if (initializing) {
initializing = false;
skinName.visible = true;
iconName.visible = true;
}
size();
}
function getState(Void) {
return(__state);
}
function setToggle(val) {
__toggle = val;
if (__toggle == false) {
setState(false);
}
}
function getToggle(Void) {
return(__toggle);
}
function set toggle(val) {
setToggle(val);
//return(toggle);
}
function get toggle() {
return(getToggle());
}
function set value(val) {
setSelected(val);
//return(value);
}
function get value() {
return(getSelected());
}
function set selected(val) {
setSelected(val);
//return(selected);
}
function get selected() {
return(getSelected());
}
function setSelected(val) {
if (__toggle) {
setState(val);
} else {
setState((initializing ? (val) : (__state)));
}
}
function getSelected() {
return(__state);
}
function setEnabled(val) {
if (enabled != val) {
super.setEnabled(val);
invalidate();
}
}
function onPress(Void) {
pressFocus();
phase = "down";
refresh();
dispatchEvent({type:"buttonDown"});
if (autoRepeat) {
interval = setInterval(this, "onPressDelay", getStyle("repeatDelay"));
}
}
function onPressDelay(Void) {
dispatchEvent({type:"buttonDown"});
if (autoRepeat) {
clearInterval(interval);
interval = setInterval(this, "onPressRepeat", getStyle("repeatInterval"));
}
}
function onPressRepeat(Void) {
dispatchEvent({type:"buttonDown"});
updateAfterEvent();
}
function onRelease(Void) {
releaseFocus();
phase = "rollover";
if (interval != undefined) {
clearInterval(interval);
delete interval;
}
if (getToggle()) {
setState(!getState());
} else {
refresh();
}
dispatchEvent({type:"click"});
}
function onDragOut(Void) {
phase = "up";
refresh();
dispatchEvent({type:"buttonDragOut"});
}
function onDragOver(Void) {
if (phase != "up") {
onPress();
return(undefined);
}
phase = "down";
refresh();
}
function onReleaseOutside(Void) {
releaseFocus();
phase = "up";
if (interval != undefined) {
clearInterval(interval);
delete interval;
}
}
function onRollOver(Void) {
phase = "rollover";
refresh();
}
function onRollOut(Void) {
phase = "up";
refresh();
}
function getLabel(Void) {
return(fui.text);
}
function setLabel(val) {
if (typeof(fui) == "string") {
createLabel("fui", 8, val);
fui.styleName = this;
} else {
fui.text = val;
}
var _local4 = fui._getTextFormat();
var _local2 = _local4.getTextExtent2(val);
fui._width = _local2.width + 5;
fui._height = _local2.height + 5;
iconName = fui;
setView(__state);
}
function get emphasized() {
return(__emphasized);
}
function set emphasized(val) {
__emphasized = val;
var _local2 = 0;
while (_local2 < 8) {
this[idNames[_local2]] = stateNames[_local2] + "Skin";
if (typeof(this[idNames[_local2 + 8]]) == "movieclip") {
this[idNames[_local2 + 8]] = stateNames[_local2] + "Icon";
}
_local2++;
}
showEmphasized(__emphasized);
setStateVar(__state);
invalidateStyle();
//return(emphasized);
}
function keyDown(e) {
if (e.code == 32) {
onPress();
}
}
function keyUp(e) {
if (e.code == 32) {
onRelease();
}
}
function onKillFocus(newFocus) {
super.onKillFocus();
if (phase != "up") {
phase = "up";
refresh();
}
}
static var symbolName = "SimpleButton";
static var symbolOwner = mx.controls.SimpleButton;
static var version = "2.0.2.127";
var className = "SimpleButton";
var style3dInset = 4;
var btnOffset = 1;
var __toggle = false;
var __state = false;
var __emphasized = false;
var __emphatic = false;
static var falseUp = 0;
static var falseDown = 1;
static var falseOver = 2;
static var falseDisabled = 3;
static var trueUp = 4;
static var trueDown = 5;
static var trueOver = 6;
static var trueDisabled = 7;
var falseUpSkin = "SimpleButtonUp";
var falseDownSkin = "SimpleButtonIn";
var falseOverSkin = "";
var falseDisabledSkin = "SimpleButtonUp";
var trueUpSkin = "SimpleButtonIn";
var trueDownSkin = "";
var trueOverSkin = "";
var trueDisabledSkin = "SimpleButtonIn";
var falseUpIcon = "";
var falseDownIcon = "";
var falseOverIcon = "";
var falseDisabledIcon = "";
var trueUpIcon = "";
var trueDownIcon = "";
var trueOverIcon = "";
var trueDisabledIcon = "";
var phase = "up";
var fui = "falseUpIcon";
var fus = "falseUpSkin";
var fdi = "falseDownIcon";
var fds = "falseDownSkin";
var frs = "falseOverSkin";
var fri = "falseOverIcon";
var dfi = "falseDisabledIcon";
var dfs = "falseDisabledSkin";
var tui = "trueUpIcon";
var tus = "trueUpSkin";
var tdi = "trueDownIcon";
var tds = "trueDownSkin";
var trs = "trueOverSkin";
var tri = "trueOverIcon";
var dts = "trueDisabledSkin";
var dti = "trueDisabledIcon";
var rolloverSkin = mx.controls.SimpleButton.prototype.frs;
var rolloverIcon = mx.controls.SimpleButton.prototype.fri;
var upSkin = mx.controls.SimpleButton.prototype.fus;
var downSkin = mx.controls.SimpleButton.prototype.fds;
var disabledSkin = mx.controls.SimpleButton.prototype.dfs;
var upIcon = mx.controls.SimpleButton.prototype.fui;
var downIcon = mx.controls.SimpleButton.prototype.fdi;
var disabledIcon = mx.controls.SimpleButton.prototype.dfi;
var initializing = true;
var idNames = ["fus", "fds", "frs", "dfs", "tus", "tds", "trs", "dts", "fui", "fdi", "fri", "dfi", "tui", "tdi", "tri", "dti"];
var stateNames = ["falseUp", "falseDown", "falseOver", "falseDisabled", "trueUp", "trueDown", "trueOver", "trueDisabled"];
var refNames = ["upSkin", "downSkin", "rolloverSkin", "disabledSkin"];
var tagMap = {falseUpSkin:0, falseDownSkin:1, falseOverSkin:2, falseDisabledSkin:3, trueUpSkin:4, trueDownSkin:5, trueOverSkin:6, trueDisabledSkin:7, falseUpIcon:0, falseDownIcon:1, falseOverIcon:2, falseDisabledIcon:3, trueUpIcon:4, trueDownIcon:5, trueOverIcon:6, trueDisabledIcon:7};
}
Symbol 4 MovieClip [__Packages.mx.controls.Button] Frame 0
class mx.controls.Button extends mx.controls.SimpleButton
{
var initializing, labelPath, initIcon, getState, enabled, phase, idNames, __width, __height, setState, invalidate, iconName, refresh, createLabel, _iconLinkageName, removeIcons, hitArea_mc, createEmptyObject;
function Button () {
super();
}
function init(Void) {
super.init();
}
function draw() {
if (initializing) {
labelPath.visible = true;
}
super.draw();
if (initIcon != undefined) {
_setIcon(initIcon);
}
delete initIcon;
}
function onRelease(Void) {
super.onRelease();
}
function createChildren(Void) {
super.createChildren();
}
function setSkin(tag, linkageName, initobj) {
return(super.setSkin(tag, linkageName, initobj));
}
function viewSkin(varName) {
var _local3 = (getState() ? "true" : "false");
_local3 = _local3 + (enabled ? (phase) : "disabled");
super.viewSkin(varName, {styleName:this, borderStyle:_local3});
}
function invalidateStyle(c) {
labelPath.invalidateStyle(c);
super.invalidateStyle(c);
}
function setColor(c) {
var _local2 = 0;
while (_local2 < 8) {
this[idNames[_local2]].redraw(true);
_local2++;
}
}
function setEnabled(enable) {
labelPath.enabled = enable;
super.setEnabled(enable);
}
function calcSize(tag, ref) {
if ((__width == undefined) || (__height == undefined)) {
return(undefined);
}
if (tag < 7) {
ref.setSize(__width, __height, true);
}
}
function size(Void) {
setState(getState());
setHitArea(__width, __height);
var _local3 = 0;
while (_local3 < 8) {
var _local4 = idNames[_local3];
if (typeof(this[_local4]) == "movieclip") {
this[_local4].setSize(__width, __height, true);
}
_local3++;
}
super.size();
}
function set labelPlacement(val) {
__labelPlacement = val;
invalidate();
//return(labelPlacement);
}
function get labelPlacement() {
return(__labelPlacement);
}
function getLabelPlacement(Void) {
return(__labelPlacement);
}
function setLabelPlacement(val) {
__labelPlacement = val;
invalidate();
}
function getBtnOffset(Void) {
if (getState()) {
var _local2 = btnOffset;
} else if (phase == "down") {
var _local2 = btnOffset;
} else {
var _local2 = 0;
}
return(_local2);
}
function setView(offset) {
var _local16 = (offset ? (btnOffset) : 0);
var _local12 = getLabelPlacement();
var _local7 = 0;
var _local6 = 0;
var _local9 = 0;
var _local8 = 0;
var _local5 = 0;
var _local4 = 0;
var _local3 = labelPath;
var _local2 = iconName;
var _local15 = _local3.textWidth;
var _local14 = _local3.textHeight;
var _local10 = (__width - borderW) - borderW;
var _local11 = (__height - borderW) - borderW;
if (_local2 != undefined) {
_local7 = _local2._width;
_local6 = _local2._height;
}
if ((_local12 == "left") || (_local12 == "right")) {
if (_local3 != undefined) {
_local9 = Math.min(_local10 - _local7, _local15 + 5);
_local3._width = _local9;
_local8 = Math.min(_local11, _local14 + 5);
_local3._height = _local8;
}
if (_local12 == "right") {
_local5 = _local7;
if (centerContent) {
_local5 = _local5 + (((_local10 - _local9) - _local7) / 2);
}
_local2._x = _local5 - _local7;
} else {
_local5 = (_local10 - _local9) - _local7;
if (centerContent) {
_local5 = _local5 / 2;
}
_local2._x = _local5 + _local9;
}
_local4 = 0;
_local2._y = _local4;
if (centerContent) {
_local2._y = (_local11 - _local6) / 2;
_local4 = (_local11 - _local8) / 2;
}
if (!centerContent) {
_local2._y = _local2._y + Math.max(0, (_local8 - _local6) / 2);
}
} else {
if (_local3 != undefined) {
_local9 = Math.min(_local10, _local15 + 5);
_local3._width = _local9;
_local8 = Math.min(_local11 - _local6, _local14 + 5);
_local3._height = _local8;
}
_local5 = (_local10 - _local9) / 2;
_local2._x = (_local10 - _local7) / 2;
if (_local12 == "top") {
_local4 = (_local11 - _local8) - _local6;
if (centerContent) {
_local4 = _local4 / 2;
}
_local2._y = _local4 + _local8;
} else {
_local4 = _local6;
if (centerContent) {
_local4 = _local4 + (((_local11 - _local8) - _local6) / 2);
}
_local2._y = _local4 - _local6;
}
}
var _local13 = borderW + _local16;
_local3._x = _local5 + _local13;
_local3._y = _local4 + _local13;
_local2._x = _local2._x + _local13;
_local2._y = _local2._y + _local13;
}
function set label(lbl) {
setLabel(lbl);
//return(label);
}
function setLabel(label) {
if (label == "") {
labelPath.removeTextField();
refresh();
return(undefined);
}
if (labelPath == undefined) {
var _local2 = createLabel("labelPath", 200, label);
_local2._width = _local2.textWidth + 5;
_local2._height = _local2.textHeight + 5;
if (initializing) {
_local2.visible = false;
}
} else {
delete labelPath.__text;
labelPath.text = label;
refresh();
}
}
function getLabel(Void) {
return(((labelPath.__text != undefined) ? (labelPath.__text) : (labelPath.text)));
}
function get label() {
return(getLabel());
}
function _getIcon(Void) {
return(_iconLinkageName);
}
function get icon() {
if (initializing) {
return(initIcon);
}
return(_iconLinkageName);
}
function _setIcon(linkage) {
if (initializing) {
if (linkage == "") {
return(undefined);
}
initIcon = linkage;
} else {
if (linkage == "") {
removeIcons();
return(undefined);
}
super.changeIcon(0, linkage);
super.changeIcon(1, linkage);
super.changeIcon(3, linkage);
super.changeIcon(4, linkage);
super.changeIcon(5, linkage);
_iconLinkageName = linkage;
refresh();
}
}
function set icon(linkage) {
_setIcon(linkage);
//return(icon);
}
function setHitArea(w, h) {
if (hitArea_mc == undefined) {
createEmptyObject("hitArea_mc", 100);
}
var _local2 = hitArea_mc;
_local2.clear();
_local2.beginFill(16711680);
_local2.drawRect(0, 0, w, h);
_local2.endFill();
_local2.setVisible(false);
}
static var symbolName = "Button";
static var symbolOwner = mx.controls.Button;
var className = "Button";
static var version = "2.0.2.127";
var btnOffset = 0;
var _color = "buttonColor";
var __label = "default value";
var __labelPlacement = "right";
var falseUpSkin = "ButtonSkin";
var falseDownSkin = "ButtonSkin";
var falseOverSkin = "ButtonSkin";
var falseDisabledSkin = "ButtonSkin";
var trueUpSkin = "ButtonSkin";
var trueDownSkin = "ButtonSkin";
var trueOverSkin = "ButtonSkin";
var trueDisabledSkin = "ButtonSkin";
var falseUpIcon = "";
var falseDownIcon = "";
var falseOverIcon = "";
var falseDisabledIcon = "";
var trueUpIcon = "";
var trueDownIcon = "";
var trueOverIcon = "";
var trueDisabledIcon = "";
var clipParameters = {labelPlacement:1, icon:1, toggle:1, selected:1, label:1};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.Button.prototype.clipParameters, mx.controls.SimpleButton.prototype.clipParameters);
var centerContent = true;
var borderW = 1;
}
Symbol 5 MovieClip [__Packages.mx.controls.RadioButton] Frame 0
class mx.controls.RadioButton extends mx.controls.Button
{
var setToggle, __value, selected, releaseFocus, phase, dispatchEvent, _parent, __data, setState, __state, getFocusManager;
function RadioButton () {
super();
}
function init(Void) {
setToggle(__toggle);
__value = this;
super.init();
}
function size(Void) {
super.size();
}
function onRelease() {
if (selected) {
return(undefined);
}
releaseFocus();
phase = "up";
setSelected(true);
dispatchEvent({type:"click"});
_parent[__groupName].dispatchEvent({type:"click"});
}
function setData(val) {
__data = val;
}
function set data(val) {
__data = val;
//return(data);
}
function getData(val) {
return(__data);
}
function get data() {
return(__data);
}
function onUnload() {
if (_parent[__groupName].selectedRadio == this) {
_parent[__groupName].selectedRadio = undefined;
}
_parent[__groupName].radioList[indexNumber] = null;
delete _parent[__groupName].radioList[indexNumber];
}
function setSelected(val) {
var _local2 = _parent[__groupName];
var _local4 = _local2.selectedRadio.__width;
var _local5 = _local2.selectedRadio.__height;
if (val) {
_local2.selectedRadio.setState(false);
_local2.selectedRadio = this;
} else if (_local2.selectedRadio == this) {
_local2.selectedRadio.setState(false);
_local2.selectedRadio = undefined;
}
setState(val);
}
function deleteGroupObj(groupName) {
delete _parent[groupName];
}
function getGroupName() {
return(__groupName);
}
function get groupName() {
return(__groupName);
}
function setGroupName(groupName) {
if ((groupName == undefined) || (groupName == "")) {
return(undefined);
}
delete _parent[__groupName].radioList[__data];
addToGroup(groupName);
__groupName = groupName;
}
function set groupName(groupName) {
setGroupName(groupName);
//return(this.groupName);
}
function addToGroup(groupName) {
if ((groupName == "") || (groupName == undefined)) {
return(undefined);
}
var _local2 = _parent[groupName];
if (_local2 == undefined) {
_local2 = (_parent[groupName] = new mx.controls.RadioButtonGroup());
_local2.__groupName = groupName;
}
_local2.addInstance(this);
if (__state) {
_local2.selectedRadio.setState(false);
_local2.selectedRadio = this;
}
}
function get emphasized() {
return(undefined);
}
function keyDown(e) {
switch (e.code) {
case 40 :
setNext();
break;
case 38 :
setPrev();
break;
case 37 :
setPrev();
break;
case 39 :
setNext();
}
}
function setNext() {
var _local2 = _parent[groupName];
if ((_local2.selectedRadio.indexNumber + 1) == _local2.radioList.length) {
return(undefined);
}
var _local4 = (_local2.selectedRadio ? (_local2.selectedRadio.indexNumber) : -1);
var _local3 = 1;
while (_local3 < _local2.radioList.length) {
if ((_local2.radioList[_local4 + _local3] != undefined) && (_local2.radioList[_local4 + _local3].enabled)) {
var _local5 = getFocusManager();
_local2.radioList[_local4 + _local3].selected = true;
_local5.setFocus(_local2.radioList[_local2.selectedRadio.indexNumber]);
_local2.dispatchEvent({type:"click"});
break;
}
_local3++;
}
}
function setPrev() {
var _local2 = _parent[groupName];
if (_local2.selectedRadio.indexNumber == 0) {
return(undefined);
}
var _local4 = (_local2.selectedRadio ? (_local2.selectedRadio.indexNumber) : 1);
var _local3 = 1;
while (_local3 < _local2.radioList.length) {
if ((_local2.radioList[_local4 - _local3] != undefined) && (_local2.radioList[_local4 - _local3].enabled)) {
var _local5 = getFocusManager();
_local2.radioList[_local4 - _local3].selected = true;
_local5.setFocus(_local2.radioList[_local2.selectedRadio.indexNumber]);
_local2.dispatchEvent({type:"click"});
break;
}
_local3++;
}
}
function set toggle(v) {
//return(toggle);
}
function get toggle() {
}
function set icon(v) {
//return(icon);
}
function get icon() {
}
static var symbolName = "RadioButton";
static var symbolOwner = mx.controls.RadioButton;
static var version = "2.0.2.127";
var className = "RadioButton";
var btnOffset = 0;
var __toggle = true;
var __label = "Radio Button";
var __labelPlacement = "right";
var ignoreClassStyleDeclaration = {Button:1};
var __groupName = "radioGroup";
var indexNumber = 0;
var offset = false;
var falseUpSkin = "";
var falseDownSkin = "";
var falseOverSkin = "";
var falseDisabledSkin = "";
var trueUpSkin = "";
var trueDownSkin = "";
var trueOverSkin = "";
var trueDisabledSkin = "";
var falseUpIcon = "RadioFalseUp";
var falseDownIcon = "RadioFalseDown";
var falseOverIcon = "RadioFalseOver";
var falseDisabledIcon = "RadioFalseDisabled";
var trueUpIcon = "RadioTrueUp";
var trueDownIcon = "";
var trueOverIcon = "";
var trueDisabledIcon = "RadioTrueDisabled";
var centerContent = false;
var borderW = 0;
var clipParameters = {labelPlacement:1, data:1, label:1, groupName:1, selected:1};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.RadioButton.prototype.clipParameters, mx.controls.Button.prototype.clipParameters);
}
Symbol 51 MovieClip [__Packages.mx.skins.SkinElement] Frame 0
class mx.skins.SkinElement extends MovieClip
{
var _visible, _x, _y, _width, _height;
function SkinElement () {
super();
}
static function registerElement(name, className) {
Object.registerClass(name, ((className == undefined) ? (mx.skins.SkinElement) : (className)));
_global.skinRegistry[name] = true;
}
function __set__visible(visible) {
_visible = visible;
}
function move(x, y) {
_x = x;
_y = y;
}
function setSize(w, h) {
_width = w;
_height = h;
}
}
Symbol 52 MovieClip [__Packages.mx.styles.CSSTextStyles] Frame 0
class mx.styles.CSSTextStyles
{
function CSSTextStyles () {
}
static function addTextStyles(o, bColor) {
o.addProperty("textAlign", function () {
return(this._tf.align);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.align = x;
});
o.addProperty("fontWeight", function () {
return(((this._tf.bold != undefined) ? ((this._tf.bold ? "bold" : "none")) : undefined));
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.bold = x == "bold";
});
if (bColor) {
o.addProperty("color", function () {
return(this._tf.color);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.color = x;
});
}
o.addProperty("fontFamily", function () {
return(this._tf.font);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.font = x;
});
o.addProperty("textIndent", function () {
return(this._tf.indent);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.indent = x;
});
o.addProperty("fontStyle", function () {
return(((this._tf.italic != undefined) ? ((this._tf.italic ? "italic" : "none")) : undefined));
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.italic = x == "italic";
});
o.addProperty("marginLeft", function () {
return(this._tf.leftMargin);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.leftMargin = x;
});
o.addProperty("marginRight", function () {
return(this._tf.rightMargin);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.rightMargin = x;
});
o.addProperty("fontSize", function () {
return(this._tf.size);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.size = x;
});
o.addProperty("textDecoration", function () {
return(((this._tf.underline != undefined) ? ((this._tf.underline ? "underline" : "none")) : undefined));
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.underline = x == "underline";
});
o.addProperty("embedFonts", function () {
return(this._tf.embedFonts);
}, function (x) {
if (this._tf == undefined) {
this._tf = new TextFormat();
}
this._tf.embedFonts = x;
});
}
}
Symbol 53 MovieClip [__Packages.mx.styles.StyleManager] Frame 0
class mx.styles.StyleManager
{
function StyleManager () {
}
static function registerInheritingStyle(styleName) {
inheritingStyles[styleName] = true;
}
static function isInheritingStyle(styleName) {
return(inheritingStyles[styleName] == true);
}
static function registerColorStyle(styleName) {
colorStyles[styleName] = true;
}
static function isColorStyle(styleName) {
return(colorStyles[styleName] == true);
}
static function registerColorName(colorName, colorValue) {
colorNames[colorName] = colorValue;
}
static function isColorName(colorName) {
return(colorNames[colorName] != undefined);
}
static function getColorName(colorName) {
return(colorNames[colorName]);
}
static var inheritingStyles = {color:true, direction:true, fontFamily:true, fontSize:true, fontStyle:true, fontWeight:true, textAlign:true, textIndent:true};
static var colorStyles = {barColor:true, trackColor:true, borderColor:true, buttonColor:true, color:true, dateHeaderColor:true, dateRollOverColor:true, disabledColor:true, fillColor:true, highlightColor:true, scrollTrackColor:true, selectedDateColor:true, shadowColor:true, strokeColor:true, symbolBackgroundColor:true, symbolBackgroundDisabledColor:true, symbolBackgroundPressedColor:true, symbolColor:true, symbolDisabledColor:true, themeColor:true, todayIndicatorColor:true, shadowCapColor:true, borderCapColor:true, focusColor:true};
static var colorNames = {black:0, white:16777215, red:16711680, green:65280, blue:255, magenta:16711935, yellow:16776960, cyan:65535, haloGreen:8453965, haloBlue:2881013, haloOrange:16761344};
static var TextFormatStyleProps = {font:true, size:true, color:true, leftMargin:false, rightMargin:false, italic:true, bold:true, align:true, indent:true, underline:false, embedFonts:false};
static var TextStyleMap = {textAlign:true, fontWeight:true, color:true, fontFamily:true, textIndent:true, fontStyle:true, lineHeight:true, marginLeft:true, marginRight:true, fontSize:true, textDecoration:true, embedFonts:true};
}
Symbol 54 MovieClip [__Packages.mx.styles.CSSStyleDeclaration] Frame 0
class mx.styles.CSSStyleDeclaration
{
var _tf;
function CSSStyleDeclaration () {
}
function __getTextFormat(tf, bAll) {
var _local5 = false;
if (_tf != undefined) {
var _local2;
for (_local2 in mx.styles.StyleManager.TextFormatStyleProps) {
if (bAll || (mx.styles.StyleManager.TextFormatStyleProps[_local2])) {
if (tf[_local2] == undefined) {
var _local3 = _tf[_local2];
if (_local3 != undefined) {
tf[_local2] = _local3;
} else {
_local5 = true;
}
}
}
}
} else {
_local5 = true;
}
return(_local5);
}
function getStyle(styleProp) {
var _local2 = this[styleProp];
var _local3 = mx.styles.StyleManager.getColorName(_local2);
return(((_local3 == undefined) ? (_local2) : (_local3)));
}
static function classConstruct() {
mx.styles.CSSTextStyles.addTextStyles(mx.styles.CSSStyleDeclaration.prototype, true);
return(true);
}
static var classConstructed = classConstruct();
static var CSSTextStylesDependency = mx.styles.CSSTextStyles;
}
Symbol 55 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 56 MovieClip [__Packages.mx.events.UIEventDispatcher] Frame 0
class mx.events.UIEventDispatcher extends mx.events.EventDispatcher
{
var dispatchQueue, owner, __sentLoadEvent, __origAddEventListener;
function UIEventDispatcher () {
super();
}
static function addKeyEvents(obj) {
if (obj.keyHandler == undefined) {
var _local1 = (obj.keyHandler = new Object());
_local1.owner = obj;
_local1.onKeyDown = _fEventDispatcher.onKeyDown;
_local1.onKeyUp = _fEventDispatcher.onKeyUp;
}
Key.addListener(obj.keyHandler);
}
static function removeKeyEvents(obj) {
Key.removeListener(obj.keyHandler);
}
static function addLoadEvents(obj) {
if (obj.onLoad == undefined) {
obj.onLoad = _fEventDispatcher.onLoad;
obj.onUnload = _fEventDispatcher.onUnload;
if (obj.getBytesTotal() == obj.getBytesLoaded()) {
obj.doLater(obj, "onLoad");
}
}
}
static function removeLoadEvents(obj) {
delete obj.onLoad;
delete obj.onUnload;
}
static function initialize(obj) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.UIEventDispatcher();
}
obj.addEventListener = _fEventDispatcher.__addEventListener;
obj.__origAddEventListener = _fEventDispatcher.addEventListener;
obj.removeEventListener = _fEventDispatcher.removeEventListener;
obj.dispatchEvent = _fEventDispatcher.dispatchEvent;
obj.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(mx.events.EventDispatcher, eventObj);
dispatchQueue(this, eventObj);
}
function onKeyDown(Void) {
owner.dispatchEvent({type:"keyDown", code:Key.getCode(), ascii:Key.getAscii(), shiftKey:Key.isDown(16), ctrlKey:Key.isDown(17)});
}
function onKeyUp(Void) {
owner.dispatchEvent({type:"keyUp", code:Key.getCode(), ascii:Key.getAscii(), shiftKey:Key.isDown(16), ctrlKey:Key.isDown(17)});
}
function onLoad(Void) {
if (__sentLoadEvent != true) {
dispatchEvent({type:"load"});
}
__sentLoadEvent = true;
}
function onUnload(Void) {
dispatchEvent({type:"unload"});
}
function __addEventListener(event, handler) {
__origAddEventListener(event, handler);
var _local3 = lowLevelEvents;
for (var _local5 in _local3) {
if (mx.events.UIEventDispatcher[_local5][event] != undefined) {
var _local2 = _local3[_local5][0];
mx.events.UIEventDispatcher[_local2](this);
}
}
}
function removeEventListener(event, handler) {
var _local6 = "__q_" + event;
mx.events.EventDispatcher._removeEventListener(this[_local6], event, handler);
if (this[_local6].length == 0) {
var _local2 = lowLevelEvents;
for (var _local5 in _local2) {
if (mx.events.UIEventDispatcher[_local5][event] != undefined) {
var _local3 = _local2[_local5][1];
mx.events.UIEventDispatcher[_local2[_local5][1]](this);
}
}
}
}
static var keyEvents = {keyDown:1, keyUp:1};
static var loadEvents = {load:1, unload:1};
static var lowLevelEvents = {keyEvents:["addKeyEvents", "removeKeyEvents"], loadEvents:["addLoadEvents", "removeLoadEvents"]};
static var _fEventDispatcher = undefined;
}
Symbol 57 MovieClip [__Packages.mx.controls.RadioButtonGroup] Frame 0
class mx.controls.RadioButtonGroup
{
var radioList, __groupName, selectedRadio;
function RadioButtonGroup () {
init();
mx.events.UIEventDispatcher.initialize(this);
}
function init(Void) {
radioList = new Array();
}
function setGroupName(groupName) {
if ((groupName == undefined) || (groupName == "")) {
return(undefined);
}
var _local6 = __groupName;
_parent[groupName] = this;
for (var _local5 in radioList) {
radioList[_local5].groupName = groupName;
var _local3 = radioList[_local5];
}
_local3.deleteGroupObj(_local6);
}
function getGroupName() {
return(__groupName);
}
function addInstance(instance) {
instance.indexNumber = indexNumber++;
radioList.push(instance);
}
function getValue() {
if (selectedRadio.data == "") {
return(selectedRadio.label);
}
return(selectedRadio.__data);
}
function getLabelPlacement() {
for (var _local3 in radioList) {
var _local2 = radioList[_local3].getLabelPlacement();
}
return(_local2);
}
function setLabelPlacement(pos) {
for (var _local3 in radioList) {
radioList[_local3].setLabelPlacement(pos);
}
}
function setEnabled(val) {
for (var _local3 in radioList) {
radioList[_local3].enabled = val;
}
}
function setSize(val, val1) {
for (var _local3 in radioList) {
radioList[_local3].setSize(val, val1);
}
}
function getEnabled() {
for (var _local4 in radioList) {
var _local2 = radioList[_local4].enabled;
var _local3 = t + (_local2 + 0);
}
if (_local3 == radioList.length) {
return(true);
}
if (_local3 == 0) {
return(false);
}
}
function setStyle(name, val) {
for (var _local4 in radioList) {
radioList[_local4].setStyle(name, val);
}
}
function setInstance(val) {
for (var _local3 in radioList) {
if (radioList[_local3] == val) {
radioList[_local3].selected = true;
}
}
}
function getInstance() {
return(selectedRadio);
}
function setValue(val) {
for (var _local4 in radioList) {
if ((radioList[_local4].__data == val) || (radioList[_local4].label == val)) {
var _local2 = _local4;
break;
}
}
if (_local2 != undefined) {
selectedRadio.setState(false);
selectedRadio.hitArea_mc._height = selectedRadio.__height;
selectedRadio.hitArea_mc._width = selectedRadio.__width;
selectedRadio = radioList[_local2];
selectedRadio.setState(true);
selectedRadio.hitArea_mc._height = (selectedRadio.hitArea_mc._width = 0);
}
}
function set groupName(groupName) {
if ((groupName == undefined) || (groupName == "")) {
return;
}
var _local6 = __groupName;
_parent[groupName] = this;
for (var _local5 in radioList) {
radioList[_local5].groupName = groupName;
var _local3 = radioList[_local5];
}
_local3.deleteGroupObj(_local6);
//return(this.groupName);
}
function get groupName() {
return(__groupName);
}
function set selectedData(val) {
for (var _local4 in radioList) {
if ((radioList[_local4].__data == val) || (radioList[_local4].label == val)) {
var _local2 = _local4;
break;
}
}
if (_local2 != undefined) {
selectedRadio.setState(false);
selectedRadio = radioList[_local2];
selectedRadio.setState(true);
}
//return(selectedData);
}
function get selectedData() {
if ((selectedRadio.data == "") || (selectedRadio.data == undefined)) {
return(selectedRadio.label);
}
return(selectedRadio.__data);
}
function get selection() {
return(selectedRadio);
}
function set selection(val) {
for (var _local3 in radioList) {
if (radioList[_local3] == val) {
radioList[_local3].selected = true;
}
}
//return(selection);
}
function set labelPlacement(pos) {
for (var _local3 in radioList) {
radioList[_local3].setLabelPlacement(pos);
}
//return(labelPlacement);
}
function get labelPlacement() {
for (var _local3 in radioList) {
var _local2 = radioList[_local3].getLabelPlacement();
}
return(_local2);
}
function set enabled(val) {
for (var _local3 in radioList) {
radioList[_local3].enabled = val;
}
//return(enabled);
}
function get enabled() {
var _local2 = 0;
for (var _local3 in radioList) {
_local2 = _local2 + radioList[_local3].enabled;
}
if (_local2 == 0) {
return(false);
}
if (_local2 == radioList.length) {
return(true);
}
}
static var symbolName = "RadioButtonGroup";
static var symbolOwner = mx.controls.RadioButtonGroup;
static var version = "2.0.2.127";
var className = "RadioButtonGroup";
var indexNumber = 0;
}
Symbol 58 MovieClip [__Packages.mx.skins.ColoredSkinElement] Frame 0
class mx.skins.ColoredSkinElement
{
var getStyle, _color, onEnterFrame;
function ColoredSkinElement () {
}
function setColor(c) {
if (c != undefined) {
var _local2 = new Color(this);
_local2.setRGB(c);
}
}
function draw(Void) {
setColor(getStyle(_color));
onEnterFrame = undefined;
}
function invalidateStyle(Void) {
onEnterFrame = draw;
}
static function setColorStyle(p, colorStyle) {
if (p._color == undefined) {
p._color = colorStyle;
}
p.setColor = mixins.setColor;
p.invalidateStyle = mixins.invalidateStyle;
p.draw = mixins.draw;
p.setColor(p.getStyle(colorStyle));
}
static var mixins = new mx.skins.ColoredSkinElement();
}
Symbol 59 MovieClip [__Packages.mx.core.ext.UIObjectExtensions] Frame 0
class mx.core.ext.UIObjectExtensions
{
function UIObjectExtensions () {
}
static function addGeometry(tf, ui) {
tf.addProperty("width", ui.__get__width, null);
tf.addProperty("height", ui.__get__height, null);
tf.addProperty("left", ui.__get__left, null);
tf.addProperty("x", ui.__get__x, null);
tf.addProperty("top", ui.__get__top, null);
tf.addProperty("y", ui.__get__y, null);
tf.addProperty("right", ui.__get__right, null);
tf.addProperty("bottom", ui.__get__bottom, null);
tf.addProperty("visible", ui.__get__visible, ui.__set__visible);
}
static function Extensions() {
if (bExtended == true) {
return(true);
}
bExtended = true;
var _local6 = mx.core.UIObject.prototype;
var _local9 = mx.skins.SkinElement.prototype;
addGeometry(_local9, _local6);
mx.events.UIEventDispatcher.initialize(_local6);
var _local13 = mx.skins.ColoredSkinElement;
mx.styles.CSSTextStyles.addTextStyles(_local6);
var _local5 = MovieClip.prototype;
_local5.getTopLevel = _local6.getTopLevel;
_local5.createLabel = _local6.createLabel;
_local5.createObject = _local6.createObject;
_local5.createClassObject = _local6.createClassObject;
_local5.createEmptyObject = _local6.createEmptyObject;
_local5.destroyObject = _local6.destroyObject;
_global.ASSetPropFlags(_local5, "getTopLevel", 1);
_global.ASSetPropFlags(_local5, "createLabel", 1);
_global.ASSetPropFlags(_local5, "createObject", 1);
_global.ASSetPropFlags(_local5, "createClassObject", 1);
_global.ASSetPropFlags(_local5, "createEmptyObject", 1);
_global.ASSetPropFlags(_local5, "destroyObject", 1);
_local5.__getTextFormat = _local6.__getTextFormat;
_local5._getTextFormat = _local6._getTextFormat;
_local5.getStyleName = _local6.getStyleName;
_local5.getStyle = _local6.getStyle;
_global.ASSetPropFlags(_local5, "__getTextFormat", 1);
_global.ASSetPropFlags(_local5, "_getTextFormat", 1);
_global.ASSetPropFlags(_local5, "getStyleName", 1);
_global.ASSetPropFlags(_local5, "getStyle", 1);
var _local7 = TextField.prototype;
addGeometry(_local7, _local6);
_local7.addProperty("enabled", function () {
return(this.__enabled);
}, function (x) {
this.__enabled = x;
this.invalidateStyle();
});
_local7.move = _local9.move;
_local7.setSize = _local9.setSize;
_local7.invalidateStyle = function () {
this.invalidateFlag = true;
};
_local7.draw = function () {
if (this.invalidateFlag) {
this.invalidateFlag = false;
var _local2 = this._getTextFormat();
this.setTextFormat(_local2);
this.setNewTextFormat(_local2);
this.embedFonts = _local2.embedFonts == true;
if (this.__text != undefined) {
if (this.text == "") {
this.text = this.__text;
}
delete this.__text;
}
this._visible = true;
}
};
_local7.setColor = function (color) {
this.textColor = color;
};
_local7.getStyle = _local5.getStyle;
_local7.__getTextFormat = _local6.__getTextFormat;
_local7.setValue = function (v) {
this.text = v;
};
_local7.getValue = function () {
return(this.text);
};
_local7.addProperty("value", function () {
return(this.getValue());
}, function (v) {
this.setValue(v);
});
_local7._getTextFormat = function () {
var _local2 = this.stylecache.tf;
if (_local2 != undefined) {
return(_local2);
}
_local2 = new TextFormat();
this.__getTextFormat(_local2);
this.stylecache.tf = _local2;
if (this.__enabled == false) {
if (this.enabledColor == undefined) {
var _local4 = this.getTextFormat();
this.enabledColor = _local4.color;
}
var _local3 = this.getStyle("disabledColor");
_local2.color = _local3;
} else if (this.enabledColor != undefined) {
if (_local2.color == undefined) {
_local2.color = this.enabledColor;
}
}
return(_local2);
};
_local7.getPreferredWidth = function () {
this.draw();
return(this.textWidth + 4);
};
_local7.getPreferredHeight = function () {
this.draw();
return(this.textHeight + 4);
};
TextFormat.prototype.getTextExtent2 = function (s) {
var _local3 = _root._getTextExtent;
if (_local3 == undefined) {
_root.createTextField("_getTextExtent", -2, 0, 0, 1000, 100);
_local3 = _root._getTextExtent;
_local3._visible = false;
}
_root._getTextExtent.text = s;
var _local4 = this.align;
this.align = "left";
_root._getTextExtent.setTextFormat(this);
this.align = _local4;
return({width:_local3.textWidth, height:_local3.textHeight});
};
if (_global.style == undefined) {
_global.style = new mx.styles.CSSStyleDeclaration();
_global.cascadingStyles = true;
_global.styles = new Object();
_global.skinRegistry = new Object();
if (_global._origWidth == undefined) {
_global.origWidth = Stage.width;
_global.origHeight = Stage.height;
}
}
var _local4 = _root;
while (_local4._parent != undefined) {
_local4 = _local4._parent;
}
_local4.addProperty("width", function () {
return(Stage.width);
}, null);
_local4.addProperty("height", function () {
return(Stage.height);
}, null);
_global.ASSetPropFlags(_local4, "width", 1);
_global.ASSetPropFlags(_local4, "height", 1);
return(true);
}
static var bExtended = false;
static var UIObjectExtended = Extensions();
static var UIObjectDependency = mx.core.UIObject;
static var SkinElementDependency = mx.skins.SkinElement;
static var CSSTextStylesDependency = mx.styles.CSSTextStyles;
static var UIEventDispatcherDependency = mx.events.UIEventDispatcher;
}
Symbol 60 MovieClip [__Packages.mx.skins.halo.Defaults] Frame 0
class mx.skins.halo.Defaults
{
var beginGradientFill, beginFill, moveTo, lineTo, curveTo, endFill;
function Defaults () {
}
static function setThemeDefaults() {
var _local2 = _global.style;
_local2.themeColor = 8453965 /* 0x80FF4D */;
_local2.disabledColor = 8684164 /* 0x848284 */;
_local2.modalTransparency = 0;
_local2.filled = true;
_local2.stroked = true;
_local2.strokeWidth = 1;
_local2.strokeColor = 0;
_local2.fillColor = 16777215 /* 0xFFFFFF */;
_local2.repeatInterval = 35;
_local2.repeatDelay = 500;
_local2.fontFamily = "_sans";
_local2.fontSize = 12;
_local2.selectionColor = 13500353 /* 0xCDFFC1 */;
_local2.rollOverColor = 14942166 /* 0xE3FFD6 */;
_local2.useRollOver = true;
_local2.backgroundDisabledColor = 14540253 /* 0xDDDDDD */;
_local2.selectionDisabledColor = 14540253 /* 0xDDDDDD */;
_local2.selectionDuration = 200;
_local2.openDuration = 250;
_local2.borderStyle = "inset";
_local2.color = 734012 /* 0x0B333C */;
_local2.textSelectedColor = 24371;
_local2.textRollOverColor = 2831164 /* 0x2B333C */;
_local2.textDisabledColor = 16777215 /* 0xFFFFFF */;
_local2.vGridLines = true;
_local2.hGridLines = false;
_local2.vGridLineColor = 6710886 /* 0x666666 */;
_local2.hGridLineColor = 6710886 /* 0x666666 */;
_local2.headerColor = 15395562 /* 0xEAEAEA */;
_local2.indentation = 17;
_local2.folderOpenIcon = "TreeFolderOpen";
_local2.folderClosedIcon = "TreeFolderClosed";
_local2.defaultLeafIcon = "TreeNodeIcon";
_local2.disclosureOpenIcon = "TreeDisclosureOpen";
_local2.disclosureClosedIcon = "TreeDisclosureClosed";
_local2.popupDuration = 150;
_local2.todayColor = 6710886 /* 0x666666 */;
_local2 = (_global.styles.ScrollSelectList = new mx.styles.CSSStyleDeclaration());
_local2.backgroundColor = 16777215 /* 0xFFFFFF */;
_local2.borderColor = 13290186 /* 0xCACACA */;
_local2.borderStyle = "inset";
_local2 = (_global.styles.ComboBox = new mx.styles.CSSStyleDeclaration());
_local2.borderStyle = "inset";
_local2 = (_global.styles.NumericStepper = new mx.styles.CSSStyleDeclaration());
_local2.textAlign = "center";
_local2 = (_global.styles.RectBorder = new mx.styles.CSSStyleDeclaration());
_local2.borderColor = 14015965 /* 0xD5DDDD */;
_local2.buttonColor = 7305079 /* 0x6F7777 */;
_local2.shadowColor = 15658734 /* 0xEEEEEE */;
_local2.highlightColor = 12897484 /* 0xC4CCCC */;
_local2.shadowCapColor = 14015965 /* 0xD5DDDD */;
_local2.borderCapColor = 9542041 /* 0x919999 */;
var _local4 = new Object();
_local4.borderColor = 16711680 /* 0xFF0000 */;
_local4.buttonColor = 16711680 /* 0xFF0000 */;
_local4.shadowColor = 16711680 /* 0xFF0000 */;
_local4.highlightColor = 16711680 /* 0xFF0000 */;
_local4.shadowCapColor = 16711680 /* 0xFF0000 */;
_local4.borderCapColor = 16711680 /* 0xFF0000 */;
mx.core.UIComponent.prototype.origBorderStyles = _local4;
var _local3;
_local3 = (_global.styles.TextInput = new mx.styles.CSSStyleDeclaration());
_local3.backgroundColor = 16777215 /* 0xFFFFFF */;
_local3.borderStyle = "inset";
_global.styles.TextArea = _global.styles.TextInput;
_local3 = (_global.styles.Window = new mx.styles.CSSStyleDeclaration());
_local3.borderStyle = "default";
_local3 = (_global.styles.windowStyles = new mx.styles.CSSStyleDeclaration());
_local3.fontWeight = "bold";
_local3 = (_global.styles.dataGridStyles = new mx.styles.CSSStyleDeclaration());
_local3.fontWeight = "bold";
_local3 = (_global.styles.Alert = new mx.styles.CSSStyleDeclaration());
_local3.borderStyle = "alert";
_local3 = (_global.styles.ScrollView = new mx.styles.CSSStyleDeclaration());
_local3.borderStyle = "inset";
_local3 = (_global.styles.View = new mx.styles.CSSStyleDeclaration());
_local3.borderStyle = "none";
_local3 = (_global.styles.ProgressBar = new mx.styles.CSSStyleDeclaration());
_local3.color = 11187123 /* 0xAAB3B3 */;
_local3.fontWeight = "bold";
_local3 = (_global.styles.AccordionHeader = new mx.styles.CSSStyleDeclaration());
_local3.fontWeight = "bold";
_local3.fontSize = "11";
_local3 = (_global.styles.Accordion = new mx.styles.CSSStyleDeclaration());
_local3.borderStyle = "solid";
_local3.backgroundColor = 16777215 /* 0xFFFFFF */;
_local3.borderColor = 9081738 /* 0x8A938A */;
_local3.headerHeight = 22;
_local3.marginLeft = (_local3.marginRight = (_local3.marginTop = (_local3.marginBottom = -1)));
_local3.verticalGap = -1;
_local3 = (_global.styles.DateChooser = new mx.styles.CSSStyleDeclaration());
_local3.borderColor = 9542041 /* 0x919999 */;
_local3.headerColor = 16777215 /* 0xFFFFFF */;
_local3 = (_global.styles.CalendarLayout = new mx.styles.CSSStyleDeclaration());
_local3.fontSize = 10;
_local3.textAlign = "right";
_local3.color = 2831164 /* 0x2B333C */;
_local3 = (_global.styles.WeekDayStyle = new mx.styles.CSSStyleDeclaration());
_local3.fontWeight = "bold";
_local3.fontSize = 11;
_local3.textAlign = "center";
_local3.color = 2831164 /* 0x2B333C */;
_local3 = (_global.styles.TodayStyle = new mx.styles.CSSStyleDeclaration());
_local3.color = 16777215 /* 0xFFFFFF */;
_local3 = (_global.styles.HeaderDateText = new mx.styles.CSSStyleDeclaration());
_local3.fontSize = 12;
_local3.fontWeight = "bold";
_local3.textAlign = "center";
}
function drawRoundRect(x, y, w, h, r, c, alpha, rot, gradient, ratios) {
if (typeof(r) == "object") {
var _local18 = r.br;
var _local16 = r.bl;
var _local15 = r.tl;
var _local10 = r.tr;
} else {
var _local10 = r;
var _local15 = _local10;
var _local16 = _local15;
var _local18 = _local16;
}
if (typeof(c) == "object") {
if (typeof(alpha) != "object") {
var _local9 = [alpha, alpha];
} else {
var _local9 = alpha;
}
if (ratios == undefined) {
ratios = [0, 255];
}
var _local14 = h * 0.7;
if (typeof(rot) != "object") {
var _local11 = {matrixType:"box", x:-_local14, y:_local14, w:w * 2, h:h * 4, r:rot * 0.0174532925199433 /* Math.PI/180 */};
} else {
var _local11 = rot;
}
if (gradient == "radial") {
beginGradientFill("radial", c, _local9, ratios, _local11);
} else {
beginGradientFill("linear", c, _local9, ratios, _local11);
}
} else if (c != undefined) {
beginFill(c, alpha);
}
r = _local18;
var _local13 = r - (r * 0.707106781186547);
var _local12 = r - (r * 0.414213562373095);
moveTo(x + w, (y + h) - r);
lineTo(x + w, (y + h) - r);
curveTo(x + w, (y + h) - _local12, (x + w) - _local13, (y + h) - _local13);
curveTo((x + w) - _local12, y + h, (x + w) - r, y + h);
r = _local16;
_local13 = r - (r * 0.707106781186547);
_local12 = r - (r * 0.414213562373095);
lineTo(x + r, y + h);
curveTo(x + _local12, y + h, x + _local13, (y + h) - _local13);
curveTo(x, (y + h) - _local12, x, (y + h) - r);
r = _local15;
_local13 = r - (r * 0.707106781186547);
_local12 = r - (r * 0.414213562373095);
lineTo(x, y + r);
curveTo(x, y + _local12, x + _local13, y + _local13);
curveTo(x + _local12, y, x + r, y);
r = _local10;
_local13 = r - (r * 0.707106781186547);
_local12 = r - (r * 0.414213562373095);
lineTo((x + w) - r, y);
curveTo((x + w) - _local12, y, (x + w) - _local13, y + _local13);
curveTo(x + w, y + _local12, x + w, y + r);
lineTo(x + w, (y + h) - r);
if (c != undefined) {
endFill();
}
}
static function classConstruct() {
mx.core.ext.UIObjectExtensions.Extensions();
setThemeDefaults();
mx.core.UIObject.prototype.drawRoundRect = mx.skins.halo.Defaults.prototype.drawRoundRect;
return(true);
}
static var classConstructed = classConstruct();
static var CSSStyleDeclarationDependency = mx.styles.CSSStyleDeclaration;
static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
static var UIObjectDependency = mx.core.UIObject;
}
Symbol 61 MovieClip [__Packages.mx.managers.DepthManager] Frame 0
class mx.managers.DepthManager
{
var _childCounter, createClassObject, createObject, _parent, swapDepths, _topmost, getDepth;
function DepthManager () {
MovieClip.prototype.createClassChildAtDepth = createClassChildAtDepth;
MovieClip.prototype.createChildAtDepth = createChildAtDepth;
MovieClip.prototype.setDepthTo = setDepthTo;
MovieClip.prototype.setDepthAbove = setDepthAbove;
MovieClip.prototype.setDepthBelow = setDepthBelow;
MovieClip.prototype.findNextAvailableDepth = findNextAvailableDepth;
MovieClip.prototype.shuffleDepths = shuffleDepths;
MovieClip.prototype.getDepthByFlag = getDepthByFlag;
MovieClip.prototype.buildDepthTable = buildDepthTable;
_global.ASSetPropFlags(MovieClip.prototype, "createClassChildAtDepth", 1);
_global.ASSetPropFlags(MovieClip.prototype, "createChildAtDepth", 1);
_global.ASSetPropFlags(MovieClip.prototype, "setDepthTo", 1);
_global.ASSetPropFlags(MovieClip.prototype, "setDepthAbove", 1);
_global.ASSetPropFlags(MovieClip.prototype, "setDepthBelow", 1);
_global.ASSetPropFlags(MovieClip.prototype, "findNextAvailableDepth", 1);
_global.ASSetPropFlags(MovieClip.prototype, "shuffleDepths", 1);
_global.ASSetPropFlags(MovieClip.prototype, "getDepthByFlag", 1);
_global.ASSetPropFlags(MovieClip.prototype, "buildDepthTable", 1);
}
static function sortFunction(a, b) {
if (a.getDepth() > b.getDepth()) {
return(1);
}
return(-1);
}
static function test(depth) {
if (depth == reservedDepth) {
return(false);
}
return(true);
}
static function createClassObjectAtDepth(className, depthSpace, initObj) {
var _local1;
switch (depthSpace) {
case kCursor :
_local1 = holder.createClassChildAtDepth(className, kTopmost, initObj);
break;
case kTooltip :
_local1 = holder.createClassChildAtDepth(className, kTop, initObj);
break;
}
return(_local1);
}
static function createObjectAtDepth(linkageName, depthSpace, initObj) {
var _local1;
switch (depthSpace) {
case kCursor :
_local1 = holder.createChildAtDepth(linkageName, kTopmost, initObj);
break;
case kTooltip :
_local1 = holder.createChildAtDepth(linkageName, kTop, initObj);
break;
}
return(_local1);
}
function createClassChildAtDepth(className, depthFlag, initObj) {
if (_childCounter == undefined) {
_childCounter = 0;
}
var _local3 = buildDepthTable();
var _local2 = getDepthByFlag(depthFlag, _local3);
var _local6 = "down";
if (depthFlag == kBottom) {
_local6 = "up";
}
var _local5;
if (_local3[_local2] != undefined) {
_local5 = _local2;
_local2 = findNextAvailableDepth(_local2, _local3, _local6);
}
var _local4 = createClassObject(className, "depthChild" + (_childCounter++), _local2, initObj);
if (_local5 != undefined) {
_local3[_local2] = _local4;
shuffleDepths(_local4, _local5, _local3, _local6);
}
if (depthFlag == kTopmost) {
_local4._topmost = true;
}
return(_local4);
}
function createChildAtDepth(linkageName, depthFlag, initObj) {
if (_childCounter == undefined) {
_childCounter = 0;
}
var _local3 = buildDepthTable();
var _local2 = getDepthByFlag(depthFlag, _local3);
var _local6 = "down";
if (depthFlag == kBottom) {
_local6 = "up";
}
var _local5;
if (_local3[_local2] != undefined) {
_local5 = _local2;
_local2 = findNextAvailableDepth(_local2, _local3, _local6);
}
var _local4 = createObject(linkageName, "depthChild" + (_childCounter++), _local2, initObj);
if (_local5 != undefined) {
_local3[_local2] = _local4;
shuffleDepths(_local4, _local5, _local3, _local6);
}
if (depthFlag == kTopmost) {
_local4._topmost = true;
}
return(_local4);
}
function setDepthTo(depthFlag) {
var _local2 = _parent.buildDepthTable();
var _local3 = _parent.getDepthByFlag(depthFlag, _local2);
if (_local2[_local3] != undefined) {
shuffleDepths(this, _local3, _local2, undefined);
} else {
swapDepths(_local3);
}
if (depthFlag == kTopmost) {
_topmost = true;
} else {
delete _topmost;
}
}
function setDepthAbove(targetInstance) {
if (targetInstance._parent != _parent) {
return(undefined);
}
var _local2 = targetInstance.getDepth() + 1;
var _local3 = _parent.buildDepthTable();
if ((_local3[_local2] != undefined) && (getDepth() < _local2)) {
_local2 = _local2 - 1;
}
if (_local2 > highestDepth) {
_local2 = highestDepth;
}
if (_local2 == highestDepth) {
_parent.shuffleDepths(this, _local2, _local3, "down");
} else if (_local3[_local2] != undefined) {
_parent.shuffleDepths(this, _local2, _local3, undefined);
} else {
swapDepths(_local2);
}
}
function setDepthBelow(targetInstance) {
if (targetInstance._parent != _parent) {
return(undefined);
}
var _local6 = targetInstance.getDepth() - 1;
var _local3 = _parent.buildDepthTable();
if ((_local3[_local6] != undefined) && (getDepth() > _local6)) {
_local6 = _local6 + 1;
}
var _local4 = lowestDepth + numberOfAuthortimeLayers;
var _local5;
for (_local5 in _local3) {
var _local2 = _local3[_local5];
if (_local2._parent != undefined) {
_local4 = Math.min(_local4, _local2.getDepth());
}
}
if (_local6 < _local4) {
_local6 = _local4;
}
if (_local6 == _local4) {
_parent.shuffleDepths(this, _local6, _local3, "up");
} else if (_local3[_local6] != undefined) {
_parent.shuffleDepths(this, _local6, _local3, undefined);
} else {
swapDepths(_local6);
}
}
function findNextAvailableDepth(targetDepth, depthTable, direction) {
var _local5 = lowestDepth + numberOfAuthortimeLayers;
if (targetDepth < _local5) {
targetDepth = _local5;
}
if (depthTable[targetDepth] == undefined) {
return(targetDepth);
}
var _local2 = targetDepth;
var _local1 = targetDepth;
if (direction == "down") {
while (depthTable[_local1] != undefined) {
_local1--;
}
return(_local1);
}
while (depthTable[_local2] != undefined) {
_local2++;
}
return(_local2);
}
function shuffleDepths(subject, targetDepth, depthTable, direction) {
var _local9 = lowestDepth + numberOfAuthortimeLayers;
var _local8 = _local9;
var _local5;
for (_local5 in depthTable) {
var _local7 = depthTable[_local5];
if (_local7._parent != undefined) {
_local9 = Math.min(_local9, _local7.getDepth());
}
}
if (direction == undefined) {
if (subject.getDepth() > targetDepth) {
direction = "up";
} else {
direction = "down";
}
}
var _local1 = new Array();
for (_local5 in depthTable) {
var _local7 = depthTable[_local5];
if (_local7._parent != undefined) {
_local1.push(_local7);
}
}
_local1.sort(sortFunction);
if (direction == "up") {
var _local3;
var _local11;
do {
if (_local1.length <= 0) {
break;
}
_local3 = _local1.pop();
} while (_local3 != subject);
do {
if (_local1.length <= 0) {
break;
}
_local11 = subject.getDepth();
_local3 = _local1.pop();
var _local4 = _local3.getDepth();
if (_local11 > (_local4 + 1)) {
if (_local4 >= 0) {
subject.swapDepths(_local4 + 1);
} else if ((_local11 > _local8) && (_local4 < _local8)) {
subject.swapDepths(_local8);
}
}
subject.swapDepths(_local3);
} while (_local4 != targetDepth);
} else if (direction == "down") {
var _local3;
do {
if (_local1.length <= 0) {
break;
}
_local3 = _local1.shift();
} while (_local3 != subject);
do {
if (_local1.length <= 0) {
break;
}
var _local11 = _local3.getDepth();
_local3 = _local1.shift();
var _local4 = _local3.getDepth();
if ((_local11 < (_local4 - 1)) && (_local4 > 0)) {
subject.swapDepths(_local4 - 1);
}
subject.swapDepths(_local3);
} while (_local4 != targetDepth);
}
}
function getDepthByFlag(depthFlag, depthTable) {
var _local2 = 0;
if ((depthFlag == kTop) || (depthFlag == kNotopmost)) {
var _local5 = 0;
var _local7 = false;
var _local8;
for (_local8 in depthTable) {
var _local9 = depthTable[_local8];
var _local3 = typeof(_local9);
if ((_local3 == "movieclip") || ((_local3 == "object") && (_local9.__getTextFormat != undefined))) {
if (_local9.getDepth() <= highestDepth) {
if (!_local9._topmost) {
_local2 = Math.max(_local2, _local9.getDepth());
} else if (!_local7) {
_local5 = _local9.getDepth();
_local7 = true;
} else {
_local5 = Math.min(_local5, _local9.getDepth());
}
}
}
}
_local2 = _local2 + 20;
if (_local7) {
if (_local2 >= _local5) {
_local2 = _local5 - 1;
}
}
} else if (depthFlag == kBottom) {
for (var _local8 in depthTable) {
var _local9 = depthTable[_local8];
var _local3 = typeof(_local9);
if ((_local3 == "movieclip") || ((_local3 == "object") && (_local9.__getTextFormat != undefined))) {
if (_local9.getDepth() <= highestDepth) {
_local2 = Math.min(_local2, _local9.getDepth());
}
}
}
_local2 = _local2 - 20;
} else if (depthFlag == kTopmost) {
for (var _local8 in depthTable) {
var _local9 = depthTable[_local8];
var _local3 = typeof(_local9);
if ((_local3 == "movieclip") || ((_local3 == "object") && (_local9.__getTextFormat != undefined))) {
if (_local9.getDepth() <= highestDepth) {
_local2 = Math.max(_local2, _local9.getDepth());
}
}
}
_local2 = _local2 + 100;
}
if (_local2 >= highestDepth) {
_local2 = highestDepth;
}
var _local6 = lowestDepth + numberOfAuthortimeLayers;
for (var _local9 in depthTable) {
var _local4 = depthTable[_local9];
if (_local4._parent != undefined) {
_local6 = Math.min(_local6, _local4.getDepth());
}
}
if (_local2 <= _local6) {
_local2 = _local6;
}
return(_local2);
}
function buildDepthTable(Void) {
var _local5 = new Array();
var _local4;
for (_local4 in this) {
var _local2 = this[_local4];
var _local3 = typeof(_local2);
if ((_local3 == "movieclip") || ((_local3 == "object") && (_local2.__getTextFormat != undefined))) {
if (_local2._parent == this) {
_local5[_local2.getDepth()] = _local2;
}
}
}
return(_local5);
}
static var reservedDepth = 1048575;
static var highestDepth = 1048574;
static var lowestDepth = -16383;
static var numberOfAuthortimeLayers = 383;
static var kCursor = 101;
static var kTooltip = 102;
static var kTop = 201;
static var kBottom = 202;
static var kTopmost = 203;
static var kNotopmost = 204;
static var holder = _root.createEmptyMovieClip("reserved", reservedDepth);
static var __depthManager = new mx.managers.DepthManager();
}
Symbol 62 MovieClip [__Packages.mx.managers.SystemManager] Frame 0
class mx.managers.SystemManager
{
static var _xAddEventListener, addEventListener, __addEventListener, _xRemoveEventListener, removeEventListener, __removeEventListener, form, __screen, dispatchEvent;
function SystemManager () {
}
static function init(Void) {
if (_initialized == false) {
_initialized = true;
mx.events.EventDispatcher.initialize(mx.managers.SystemManager);
Mouse.addListener(mx.managers.SystemManager);
Stage.addListener(mx.managers.SystemManager);
_xAddEventListener = addEventListener;
addEventListener = __addEventListener;
_xRemoveEventListener = removeEventListener;
removeEventListener = __removeEventListener;
}
}
static function addFocusManager(f) {
form = f;
f.focusManager.activate();
}
static function removeFocusManager(f) {
}
static function onMouseDown(Void) {
var _local1 = form;
_local1.focusManager._onMouseDown();
}
static function onResize(Void) {
var _local7 = Stage.width;
var _local6 = Stage.height;
var _local9 = _global.origWidth;
var _local8 = _global.origHeight;
var _local3 = Stage.align;
var _local5 = (_local9 - _local7) / 2;
var _local4 = (_local8 - _local6) / 2;
if (_local3 == "T") {
_local4 = 0;
} else if (_local3 == "B") {
_local4 = _local8 - _local6;
} else if (_local3 == "L") {
_local5 = 0;
} else if (_local3 == "R") {
_local5 = _local9 - _local7;
} else if (_local3 == "LT") {
_local4 = 0;
_local5 = 0;
} else if (_local3 == "TR") {
_local4 = 0;
_local5 = _local9 - _local7;
} else if (_local3 == "LB") {
_local4 = _local8 - _local6;
_local5 = 0;
} else if (_local3 == "RB") {
_local4 = _local8 - _local6;
_local5 = _local9 - _local7;
}
if (__screen == undefined) {
__screen = new Object();
}
__screen.x = _local5;
__screen.y = _local4;
__screen.width = _local7;
__screen.height = _local6;
_root.focusManager.relocate();
dispatchEvent({type:"resize"});
}
static function get screen() {
init();
if (__screen == undefined) {
onResize();
}
return(__screen);
}
static var _initialized = false;
static var idleFrames = 0;
static var isMouseDown = false;
static var forms = new Array();
}
Symbol 63 MovieClip [__Packages.mx.managers.FocusManager] Frame 0
class mx.managers.FocusManager extends mx.core.UIComponent
{
var __defaultPushButton, defPushButton, form, move, tabEnabled, _width, _height, _x, _y, _alpha, _parent, tabCapture, watch, lastMouse, _visible, lastFocus, doLater, lastSelFocus, cancelAllDoLaters, _searchKey, _lastTarget, _firstNode, _nextIsNext, _nextNode, _lastx, _prevNode, _needPrev, _foundList, _prevObj, _nextObj, _firstObj, _lastObj, _lastNode, lastTabFocus, findFocusFromObject;
function FocusManager () {
super();
}
function get defaultPushButton() {
return(__defaultPushButton);
}
function set defaultPushButton(x) {
if (x != __defaultPushButton) {
__defaultPushButton.__set__emphasized(false);
__defaultPushButton = x;
defPushButton = x;
x.__set__emphasized(true);
}
//return(defaultPushButton);
}
function getMaxTabIndex(o) {
var _local3 = 0;
var _local6;
for (_local6 in o) {
var _local2 = o[_local6];
if (_local2._parent == o) {
if (_local2.tabIndex != undefined) {
if (_local2.tabIndex > _local3) {
_local3 = _local2.tabIndex;
}
}
if (_local2.tabChildren == true) {
var _local4 = getMaxTabIndex(_local2);
if (_local4 > _local3) {
_local3 = _local4;
}
}
}
}
return(_local3);
}
function getNextTabIndex(Void) {
return(getMaxTabIndex(form) + 1);
}
function get nextTabIndex() {
return(getNextTabIndex());
}
function relocate(Void) {
var _local2 = mx.managers.SystemManager.__get__screen();
move(_local2.x - 1, _local2.y - 1);
}
function init(Void) {
super.init();
tabEnabled = false;
_width = (_height = 1);
_x = (_y = -1);
_alpha = 0;
_parent.focusManager = this;
_parent.tabChildren = true;
_parent.tabEnabled = false;
form = _parent;
_parent.addEventListener("hide", this);
_parent.addEventListener("reveal", this);
mx.managers.SystemManager.init();
mx.managers.SystemManager.addFocusManager(form);
tabCapture.tabIndex = 0;
watch("enabled", enabledChanged);
Selection.addListener(this);
lastMouse = new Object();
_global.ASSetPropFlags(_parent, "focusManager", 1);
_global.ASSetPropFlags(_parent, "tabChildren", 1);
_global.ASSetPropFlags(_parent, "tabEnabled", 1);
}
function enabledChanged(id, oldValue, newValue) {
_visible = newValue;
return(newValue);
}
function activate(Void) {
Key.addListener(this);
activated = (_visible = true);
if (lastFocus != undefined) {
bNeedFocus = true;
if (!mx.managers.SystemManager.isMouseDown) {
doLater(this, "restoreFocus");
}
}
}
function deactivate(Void) {
Key.removeListener(this);
activated = (_visible = false);
var _local2 = getSelectionFocus();
var _local3 = getActualFocus(_local2);
if (isOurFocus(_local3)) {
lastSelFocus = _local2;
lastFocus = _local3;
}
cancelAllDoLaters();
}
function isOurFocus(o) {
if (o.focusManager == this) {
return(true);
}
while (o != undefined) {
if (o.focusManager != undefined) {
return(false);
}
if (o._parent == _parent) {
return(true);
}
o = o._parent;
}
return(false);
}
function onSetFocus(o, n) {
if (n == null) {
if (activated) {
bNeedFocus = true;
}
} else {
var _local2 = getFocus();
if (isOurFocus(_local2)) {
bNeedFocus = false;
lastFocus = _local2;
lastSelFocus = n;
}
}
}
function restoreFocus(Void) {
var _local2 = lastSelFocus.hscroll;
if (_local2 != undefined) {
var _local5 = lastSelFocus.scroll;
var _local4 = lastSelFocus.background;
}
lastFocus.setFocus();
var _local3 = Selection;
Selection.setSelection(_local3.lastBeginIndex, _local3.lastEndIndex);
if (_local2 != undefined) {
lastSelFocus.scroll = _local5;
lastSelFocus.hscroll = _local2;
lastSelFocus.background = _local4;
}
}
function onUnload(Void) {
mx.managers.SystemManager.removeFocusManager(form);
}
function setFocus(o) {
if (o == null) {
Selection.setFocus(null);
} else if (o.setFocus == undefined) {
Selection.setFocus(o);
} else {
o.setFocus();
}
}
function getActualFocus(o) {
var _local1 = o._parent;
while (_local1 != undefined) {
if (_local1.focusTextField != undefined) {
while (_local1.focusTextField != undefined) {
o = _local1;
_local1 = _local1._parent;
if (_local1 == undefined) {
return(undefined);
}
if (_local1.focusTextField == undefined) {
return(o);
}
}
}
if (_local1.tabEnabled != true) {
return(o);
}
o = _local1;
_local1 = o._parent;
}
return(undefined);
}
function getSelectionFocus() {
var m = Selection.getFocus();
var o = eval (m);
return(o);
}
function getFocus(Void) {
var _local2 = getSelectionFocus();
return(getActualFocus(_local2));
}
function walkTree(p, index, groupName, dir, lookup, firstChild) {
var _local5 = true;
var _local11;
for (_local11 in p) {
var _local2 = p[_local11];
if ((((_local2._parent == p) && (_local2.enabled != false)) && (_local2._visible != false)) && ((_local2.tabEnabled == true) || ((_local2.tabEnabled != false) && ((((((((_local2.onPress != undefined) || (_local2.onRelease != undefined)) || (_local2.onReleaseOutside != undefined)) || (_local2.onDragOut != undefined)) || (_local2.onDragOver != undefined)) || (_local2.onRollOver != undefined)) || (_local2.onRollOut != undefined)) || (_local2 instanceof TextField))))) {
if (_local2._searchKey == _searchKey) {
continue;
}
_local2._searchKey = _searchKey;
if (_local2 != _lastTarget) {
if (((_local2.groupName != undefined) || (groupName != undefined)) && (_local2.groupName == groupName)) {
continue;
}
if ((_local2 instanceof TextField) && (_local2.selectable == false)) {
continue;
}
if (_local5 || (((_local2.groupName != undefined) && (_local2.groupName == _firstNode.groupName)) && (_local2.selected == true))) {
if (firstChild) {
_firstNode = _local2;
firstChild = false;
}
}
if (_nextIsNext == true) {
if ((((_local2.groupName != undefined) && (_local2.groupName == _nextNode.groupName)) && (_local2.selected == true)) || ((_nextNode == undefined) && ((_local2.groupName == undefined) || ((_local2.groupName != undefined) && (_local2.groupName != groupName))))) {
_nextNode = _local2;
}
}
if ((_local2.groupName == undefined) || (groupName != _local2.groupName)) {
if (((_lastx.groupName != undefined) && (_local2.groupName == _lastx.groupName)) && (_lastx.selected == true)) {
} else {
_lastx = _local2;
}
}
} else {
_prevNode = _lastx;
_needPrev = false;
_nextIsNext = true;
}
if (_local2.tabIndex != undefined) {
if (_local2.tabIndex == index) {
if (_foundList[_local2._name] == undefined) {
if (_needPrev) {
_prevObj = _local2;
_needPrev = false;
}
_nextObj = _local2;
}
}
if (dir && (_local2.tabIndex > index)) {
if (((_nextObj == undefined) || ((_nextObj.tabIndex > _local2.tabIndex) && (((_local2.groupName == undefined) || (_nextObj.groupName == undefined)) || (_local2.groupName != _nextObj.groupName)))) || ((((_nextObj.groupName != undefined) && (_nextObj.groupName == _local2.groupName)) && (_nextObj.selected != true)) && ((_local2.selected == true) || (_nextObj.tabIndex > _local2.tabIndex)))) {
_nextObj = _local2;
}
} else if ((!dir) && (_local2.tabIndex < index)) {
if (((_prevObj == undefined) || ((_prevObj.tabIndex < _local2.tabIndex) && (((_local2.groupName == undefined) || (_prevObj.groupName == undefined)) || (_local2.groupName != _prevObj.groupName)))) || ((((_prevObj.groupName != undefined) && (_prevObj.groupName == _local2.groupName)) && (_prevObj.selected != true)) && ((_local2.selected == true) || (_prevObj.tabIndex < _local2.tabIndex)))) {
_prevObj = _local2;
}
}
if (((_firstObj == undefined) || ((_local2.tabIndex < _firstObj.tabIndex) && (((_local2.groupName == undefined) || (_firstObj.groupName == undefined)) || (_local2.groupName != _firstObj.groupName)))) || ((((_firstObj.groupName != undefined) && (_firstObj.groupName == _local2.groupName)) && (_firstObj.selected != true)) && ((_local2.selected == true) || (_local2.tabIndex < _firstObj.tabIndex)))) {
_firstObj = _local2;
}
if (((_lastObj == undefined) || ((_local2.tabIndex > _lastObj.tabIndex) && (((_local2.groupName == undefined) || (_lastObj.groupName == undefined)) || (_local2.groupName != _lastObj.groupName)))) || ((((_lastObj.groupName != undefined) && (_lastObj.groupName == _local2.groupName)) && (_lastObj.selected != true)) && ((_local2.selected == true) || (_local2.tabIndex > _lastObj.tabIndex)))) {
_lastObj = _local2;
}
}
if (_local2.tabChildren) {
getTabCandidateFromChildren(_local2, index, groupName, dir, _local5 && (firstChild));
}
_local5 = false;
} else if (((_local2._parent == p) && (_local2.tabChildren == true)) && (_local2._visible != false)) {
if (_local2 == _lastTarget) {
if (_local2._searchKey == _searchKey) {
continue;
}
_local2._searchKey = _searchKey;
if (_prevNode == undefined) {
var _local3 = _lastx;
var _local7 = false;
while (_local3 != undefined) {
if (_local3 == _local2) {
_local7 = true;
break;
}
_local3 = _local3._parent;
}
if (_local7 == false) {
_prevNode = _lastx;
}
}
_needPrev = false;
if (_nextNode == undefined) {
_nextIsNext = true;
}
} else if (!((_local2.focusManager != undefined) && (_local2.focusManager._parent == _local2))) {
if (_local2._searchKey == _searchKey) {
continue;
}
_local2._searchKey = _searchKey;
getTabCandidateFromChildren(_local2, index, groupName, dir, _local5 && (firstChild));
}
_local5 = false;
}
}
_lastNode = _lastx;
if (lookup) {
if (p._parent != undefined) {
if (p != _parent) {
if ((_prevNode == undefined) && (dir)) {
_needPrev = true;
} else if ((_nextNode == undefined) && (!dir)) {
_nextIsNext = false;
}
_lastTarget = _lastTarget._parent;
getTabCandidate(p._parent, index, groupName, dir, true);
}
}
}
}
function getTabCandidate(o, index, groupName, dir, firstChild) {
var _local2;
var _local3 = true;
if (o == _parent) {
_local2 = o;
_local3 = false;
} else {
_local2 = o._parent;
if (_local2 == undefined) {
_local2 = o;
_local3 = false;
}
}
walkTree(_local2, index, groupName, dir, _local3, firstChild);
}
function getTabCandidateFromChildren(o, index, groupName, dir, firstChild) {
walkTree(o, index, groupName, dir, false, firstChild);
}
function getFocusManagerFromObject(o) {
while (o != undefined) {
if (o.focusManager != undefined) {
return(o.focusManager);
}
o = o._parent;
}
return(undefined);
}
function tabHandler(Void) {
bDrawFocus = true;
var _local5 = getSelectionFocus();
var _local4 = getActualFocus(_local5);
if (_local4 != _local5) {
_local5 = _local4;
}
if (getFocusManagerFromObject(_local5) != this) {
_local5 == undefined;
}
if (_local5 == undefined) {
_local5 = form;
} else if (_local5.tabIndex != undefined) {
if ((_foundList != undefined) || (_foundList.tabIndex != _local5.tabIndex)) {
_foundList = new Object();
_foundList.tabIndex = _local5.tabIndex;
}
_foundList[_local5._name] = _local5;
}
var _local3 = Key.isDown(16) != true;
_searchKey = getTimer();
_needPrev = true;
_nextIsNext = false;
_lastx = undefined;
_firstNode = undefined;
_lastNode = undefined;
_nextNode = undefined;
_prevNode = undefined;
_firstObj = undefined;
_lastObj = undefined;
_nextObj = undefined;
_prevObj = undefined;
_lastTarget = _local5;
var _local6 = _local5;
getTabCandidate(_local6, ((_local5.tabIndex == undefined) ? 0 : (_local5.tabIndex)), _local5.groupName, _local3, true);
var _local2;
if (_local3) {
if (_nextObj != undefined) {
_local2 = _nextObj;
} else {
_local2 = _firstObj;
}
} else if (_prevObj != undefined) {
_local2 = _prevObj;
} else {
_local2 = _lastObj;
}
if (_local2.tabIndex != _local5.tabIndex) {
_foundList = new Object();
_foundList.tabIndex = _local2.tabIndex;
_foundList[_local2._name] = _local2;
} else {
if (_foundList == undefined) {
_foundList = new Object();
_foundList.tabIndex = _local2.tabIndex;
}
_foundList[_local2._name] = _local2;
}
if (_local2 == undefined) {
if (_local3 == false) {
if (_nextNode != undefined) {
_local2 = _nextNode;
} else {
_local2 = _firstNode;
}
} else if ((_prevNode == undefined) || (_local5 == form)) {
_local2 = _lastNode;
} else {
_local2 = _prevNode;
}
}
if (_local2 == undefined) {
return(undefined);
}
lastTabFocus = _local2;
setFocus(_local2);
if (_local2.emphasized != undefined) {
if (defPushButton != undefined) {
_local5 = defPushButton;
defPushButton = _local2;
_local5.emphasized = false;
_local2.emphasized = true;
}
} else if ((defPushButton != undefined) && (defPushButton != __defaultPushButton)) {
_local5 = defPushButton;
defPushButton = __defaultPushButton;
_local5.emphasized = false;
__defaultPushButton.__set__emphasized(true);
}
}
function onKeyDown(Void) {
mx.managers.SystemManager.idleFrames = 0;
if (defaultPushButtonEnabled) {
if (Key.getCode() == 13) {
if (defaultPushButton != undefined) {
doLater(this, "sendDefaultPushButtonEvent");
}
}
}
}
function sendDefaultPushButtonEvent(Void) {
defPushButton.dispatchEvent({type:"click"});
}
function getMousedComponentFromChildren(x, y, o) {
for (var _local7 in o) {
var _local2 = o[_local7];
if (((_local2._visible && (_local2.enabled)) && (_local2._parent == o)) && (_local2._searchKey != _searchKey)) {
_local2._searchKey = _searchKey;
if (_local2.hitTest(x, y, true)) {
if ((_local2.onPress != undefined) || (_local2.onRelease != undefined)) {
return(_local2);
}
var _local3 = getMousedComponentFromChildren(x, y, _local2);
if (_local3 != undefined) {
return(_local3);
}
return(_local2);
}
}
}
return(undefined);
}
function mouseActivate(Void) {
if (!bNeedFocus) {
return(undefined);
}
_searchKey = getTimer();
var _local2 = getMousedComponentFromChildren(lastMouse.x, lastMouse.y, form);
if (_local2 instanceof mx.core.UIComponent) {
return(undefined);
}
_local2 = findFocusFromObject(_local2);
if (_local2 == lastFocus) {
return(undefined);
}
if (_local2 == undefined) {
doLater(this, "restoreFocus");
return(undefined);
}
var _local3 = _local2.hscroll;
if (_local3 != undefined) {
var _local6 = _local2.scroll;
var _local5 = _local2.background;
}
setFocus(_local2);
var _local4 = Selection;
Selection.setSelection(_local4.lastBeginIndex, _local4.lastEndIndex);
if (_local3 != undefined) {
_local2.scroll = _local6;
_local2.hscroll = _local3;
_local2.background = _local5;
}
}
function _onMouseDown(Void) {
bDrawFocus = false;
if (lastFocus != undefined) {
lastFocus.drawFocus(false);
}
mx.managers.SystemManager.idleFrames = 0;
var _local3 = Selection;
_local3.lastBeginIndex = Selection.getBeginIndex();
_local3.lastEndIndex = Selection.getEndIndex();
lastMouse.x = _root._xmouse;
lastMouse.y = _root._ymouse;
_root.localToGlobal(lastMouse);
}
function onMouseUp(Void) {
if (_visible) {
doLater(this, "mouseActivate");
}
}
function handleEvent(e) {
if (e.type == "reveal") {
mx.managers.SystemManager.activate(form);
} else {
mx.managers.SystemManager.deactivate(form);
}
}
static function enableFocusManagement() {
if (!initialized) {
initialized = true;
Object.registerClass("FocusManager", mx.managers.FocusManager);
if (_root.focusManager == undefined) {
_root.createClassObject(mx.managers.FocusManager, "focusManager", mx.managers.DepthManager.highestDepth--);
}
}
}
static var symbolName = "FocusManager";
static var symbolOwner = mx.managers.FocusManager;
static var version = "2.0.2.127";
var className = "FocusManager";
var bNeedFocus = false;
var bDrawFocus = false;
var defaultPushButtonEnabled = true;
var activated = true;
static var initialized = false;
static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
}
Symbol 64 MovieClip [__Packages.mx.skins.halo.FocusRect] Frame 0
class mx.skins.halo.FocusRect extends mx.skins.SkinElement
{
var boundingBox_mc, _xscale, _yscale, clear, beginFill, drawRoundRect, endFill, _visible;
function FocusRect () {
super();
boundingBox_mc._visible = false;
boundingBox_mc._width = (boundingBox_mc._height = 0);
}
function draw(o) {
o.adjustFocusRect();
}
function setSize(w, h, r, a, rectCol) {
_xscale = (_yscale = 100);
clear();
if (typeof(r) == "object") {
r.br = ((r.br > 2) ? (r.br - 2) : 0);
r.bl = ((r.bl > 2) ? (r.bl - 2) : 0);
r.tr = ((r.tr > 2) ? (r.tr - 2) : 0);
r.tl = ((r.tl > 2) ? (r.tl - 2) : 0);
beginFill(rectCol, a * 0.3);
drawRoundRect(0, 0, w, h, r);
drawRoundRect(2, 2, w - 4, h - 4, r);
endFill();
r.br = ((r.br > 1) ? (r.br + 1) : 0);
r.bl = ((r.bl > 1) ? (r.bl + 1) : 0);
r.tr = ((r.tr > 1) ? (r.tr + 1) : 0);
r.tl = ((r.tl > 1) ? (r.tl + 1) : 0);
beginFill(rectCol, a * 0.3);
drawRoundRect(1, 1, w - 2, h - 2, r);
r.br = ((r.br > 1) ? (r.br - 1) : 0);
r.bl = ((r.bl > 1) ? (r.bl - 1) : 0);
r.tr = ((r.tr > 1) ? (r.tr - 1) : 0);
r.tl = ((r.tl > 1) ? (r.tl - 1) : 0);
drawRoundRect(2, 2, w - 4, h - 4, r);
endFill();
} else {
var _local5;
if (r != 0) {
_local5 = r - 2;
} else {
_local5 = 0;
}
beginFill(rectCol, a * 0.3);
drawRoundRect(0, 0, w, h, r);
drawRoundRect(2, 2, w - 4, h - 4, _local5);
endFill();
beginFill(rectCol, a * 0.3);
if (r != 0) {
_local5 = r - 2;
r = r - 1;
} else {
_local5 = 0;
r = 0;
}
drawRoundRect(1, 1, w - 2, h - 2, r);
drawRoundRect(2, 2, w - 4, h - 4, _local5);
endFill();
}
}
function handleEvent(e) {
if (e.type == "unload") {
_visible = true;
} else if (e.type == "resize") {
e.target.adjustFocusRect();
} else if (e.type == "move") {
e.target.adjustFocusRect();
}
}
static function classConstruct() {
mx.core.UIComponent.prototype.drawFocus = function (focused) {
var _local2 = this._parent.focus_mc;
if (!focused) {
_local2._visible = false;
this.removeEventListener("unload", _local2);
this.removeEventListener("move", _local2);
this.removeEventListener("resize", _local2);
} else {
if (_local2 == undefined) {
_local2 = this._parent.createChildAtDepth("FocusRect", mx.managers.DepthManager.kTop);
_local2.tabEnabled = false;
this._parent.focus_mc = _local2;
} else {
_local2._visible = true;
}
_local2.draw(this);
if (_local2.getDepth() < this.getDepth()) {
_local2.setDepthAbove(this);
}
this.addEventListener("unload", _local2);
this.addEventListener("move", _local2);
this.addEventListener("resize", _local2);
}
};
mx.core.UIComponent.prototype.adjustFocusRect = function () {
var _local2 = this.getStyle("themeColor");
if (_local2 == undefined) {
_local2 = 8453965 /* 0x80FF4D */;
}
var _local3 = this._parent.focus_mc;
_local3.setSize(this.width + 4, this.height + 4, 0, 100, _local2);
_local3.move(this.x - 2, this.y - 2);
};
TextField.prototype.drawFocus = mx.core.UIComponent.prototype.drawFocus;
TextField.prototype.adjustFocusRect = mx.core.UIComponent.prototype.adjustFocusRect;
mx.skins.halo.FocusRect.prototype.drawRoundRect = mx.skins.halo.Defaults.prototype.drawRoundRect;
return(true);
}
static var classConstructed = classConstruct();
static var DefaultsDependency = mx.skins.halo.Defaults;
static var UIComponentDependency = mx.core.UIComponent;
}
Symbol 65 MovieClip [__Packages.mx.managers.OverlappedWindows] Frame 0
class mx.managers.OverlappedWindows
{
function OverlappedWindows () {
}
static function checkIdle(Void) {
if (mx.managers.SystemManager.idleFrames > 10) {
mx.managers.SystemManager.dispatchEvent({type:"idle"});
} else {
mx.managers.SystemManager.idleFrames++;
}
}
static function __addEventListener(e, o, l) {
if (e == "idle") {
if (mx.managers.SystemManager.interval == undefined) {
mx.managers.SystemManager.interval = setInterval(mx.managers.SystemManager.checkIdle, 100);
}
}
mx.managers.SystemManager._xAddEventListener(e, o, l);
}
static function __removeEventListener(e, o, l) {
if (e == "idle") {
if (mx.managers.SystemManager._xRemoveEventListener(e, o, l) == 0) {
clearInterval(mx.managers.SystemManager.interval);
}
} else {
mx.managers.SystemManager._xRemoveEventListener(e, o, l);
}
}
static function onMouseDown(Void) {
mx.managers.SystemManager.idleFrames = 0;
mx.managers.SystemManager.isMouseDown = true;
var _local5 = _root;
var _local3;
var _local8 = _root._xmouse;
var _local7 = _root._ymouse;
if (mx.managers.SystemManager.form.modalWindow == undefined) {
if (mx.managers.SystemManager.forms.length > 1) {
var _local6 = mx.managers.SystemManager.forms.length;
var _local4;
_local4 = 0;
while (_local4 < _local6) {
var _local2 = mx.managers.SystemManager.forms[_local4];
if (_local2._visible) {
if (_local2.hitTest(_local8, _local7)) {
if (_local3 == undefined) {
_local3 = _local2.getDepth();
_local5 = _local2;
} else if (_local3 < _local2.getDepth()) {
_local3 = _local2.getDepth();
_local5 = _local2;
}
}
}
_local4++;
}
if (_local5 != mx.managers.SystemManager.form) {
mx.managers.SystemManager.activate(_local5);
}
}
}
var _local9 = mx.managers.SystemManager.form;
_local9.focusManager._onMouseDown();
}
static function onMouseMove(Void) {
mx.managers.SystemManager.idleFrames = 0;
}
static function onMouseUp(Void) {
mx.managers.SystemManager.isMouseDown = false;
mx.managers.SystemManager.idleFrames = 0;
}
static function activate(f) {
if (mx.managers.SystemManager.form != undefined) {
if ((mx.managers.SystemManager.form != f) && (mx.managers.SystemManager.forms.length > 1)) {
var _local1 = mx.managers.SystemManager.form;
_local1.focusManager.deactivate();
}
}
mx.managers.SystemManager.form = f;
f.focusManager.activate();
}
static function deactivate(f) {
if (mx.managers.SystemManager.form != undefined) {
if ((mx.managers.SystemManager.form == f) && (mx.managers.SystemManager.forms.length > 1)) {
var _local5 = mx.managers.SystemManager.form;
_local5.focusManager.deactivate();
var _local3 = mx.managers.SystemManager.forms.length;
var _local1;
var _local2;
_local1 = 0;
while (_local1 < _local3) {
if (mx.managers.SystemManager.forms[_local1] == f) {
_local1 = _local1 + 1;
while (_local1 < _local3) {
if (mx.managers.SystemManager.forms[_local1]._visible == true) {
_local2 = mx.managers.SystemManager.forms[_local1];
}
_local1++;
}
mx.managers.SystemManager.form = _local2;
break;
}
if (mx.managers.SystemManager.forms[_local1]._visible == true) {
_local2 = mx.managers.SystemManager.forms[_local1];
}
_local1++;
}
_local5 = mx.managers.SystemManager.form;
_local5.focusManager.activate();
}
}
}
static function addFocusManager(f) {
mx.managers.SystemManager.forms.push(f);
mx.managers.SystemManager.activate(f);
}
static function removeFocusManager(f) {
var _local3 = mx.managers.SystemManager.forms.length;
var _local1;
_local1 = 0;
while (_local1 < _local3) {
if (mx.managers.SystemManager.forms[_local1] == f) {
if (mx.managers.SystemManager.form == f) {
mx.managers.SystemManager.deactivate(f);
}
mx.managers.SystemManager.forms.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
static function enableOverlappedWindows() {
if (!initialized) {
initialized = true;
mx.managers.SystemManager.checkIdle = checkIdle;
mx.managers.SystemManager.__addEventListener = __addEventListener;
mx.managers.SystemManager.__removeEventListener = __removeEventListener;
mx.managers.SystemManager.onMouseDown = onMouseDown;
mx.managers.SystemManager.onMouseMove = onMouseMove;
mx.managers.SystemManager.onMouseUp = onMouseUp;
mx.managers.SystemManager.activate = activate;
mx.managers.SystemManager.deactivate = deactivate;
mx.managers.SystemManager.addFocusManager = addFocusManager;
mx.managers.SystemManager.removeFocusManager = removeFocusManager;
}
}
static var initialized = false;
static var SystemManagerDependency = mx.managers.SystemManager;
}
Symbol 66 MovieClip [__Packages.mx.styles.CSSSetStyle] Frame 0
class mx.styles.CSSSetStyle
{
var styleName, stylecache, _color, setColor, invalidateStyle;
function CSSSetStyle () {
}
function _setStyle(styleProp, newValue) {
this[styleProp] = newValue;
if (mx.styles.StyleManager.TextStyleMap[styleProp] != undefined) {
if (styleProp == "color") {
if (isNaN(newValue)) {
newValue = mx.styles.StyleManager.getColorName(newValue);
this[styleProp] = newValue;
if (newValue == undefined) {
return(undefined);
}
}
}
_level0.changeTextStyleInChildren(styleProp);
return(undefined);
}
if (mx.styles.StyleManager.isColorStyle(styleProp)) {
if (isNaN(newValue)) {
newValue = mx.styles.StyleManager.getColorName(newValue);
this[styleProp] = newValue;
if (newValue == undefined) {
return(undefined);
}
}
if (styleProp == "themeColor") {
var _local7 = mx.styles.StyleManager.colorNames.haloBlue;
var _local6 = mx.styles.StyleManager.colorNames.haloGreen;
var _local8 = mx.styles.StyleManager.colorNames.haloOrange;
var _local4 = {};
_local4[_local7] = 12188666 /* 0xB9FBFA */;
_local4[_local6] = 13500353 /* 0xCDFFC1 */;
_local4[_local8] = 16766319 /* 0xFFD56F */;
var _local5 = {};
_local5[_local7] = 13958653 /* 0xD4FDFD */;
_local5[_local6] = 14942166 /* 0xE3FFD6 */;
_local5[_local8] = 16772787 /* 0xFFEEB3 */;
var _local9 = _local4[newValue];
var _local10 = _local5[newValue];
if (_local9 == undefined) {
_local9 = newValue;
}
if (_local10 == undefined) {
_local10 = newValue;
}
setStyle("selectionColor", _local9);
setStyle("rollOverColor", _local10);
}
_level0.changeColorStyleInChildren(styleName, styleProp, newValue);
} else {
if ((styleProp == "backgroundColor") && (isNaN(newValue))) {
newValue = mx.styles.StyleManager.getColorName(newValue);
this[styleProp] = newValue;
if (newValue == undefined) {
return(undefined);
}
}
_level0.notifyStyleChangeInChildren(styleName, styleProp, newValue);
}
}
function changeTextStyleInChildren(styleProp) {
var _local4 = getTimer();
var _local5;
for (_local5 in this) {
var _local2 = this[_local5];
if (_local2._parent == this) {
if (_local2.searchKey != _local4) {
if (_local2.stylecache != undefined) {
delete _local2.stylecache.tf;
delete _local2.stylecache[styleProp];
}
_local2.invalidateStyle(styleProp);
_local2.changeTextStyleInChildren(styleProp);
_local2.searchKey = _local4;
}
}
}
}
function changeColorStyleInChildren(sheetName, colorStyle, newValue) {
var _local6 = getTimer();
var _local7;
for (_local7 in this) {
var _local2 = this[_local7];
if (_local2._parent == this) {
if (_local2.searchKey != _local6) {
if (((_local2.getStyleName() == sheetName) || (sheetName == undefined)) || (sheetName == "_global")) {
if (_local2.stylecache != undefined) {
delete _local2.stylecache[colorStyle];
}
if (typeof(_local2._color) == "string") {
if (_local2._color == colorStyle) {
var _local4 = _local2.getStyle(colorStyle);
if (colorStyle == "color") {
if (stylecache.tf.color != undefined) {
stylecache.tf.color = _local4;
}
}
_local2.setColor(_local4);
}
} else if (_local2._color[colorStyle] != undefined) {
if (typeof(_local2) != "movieclip") {
_local2._parent.invalidateStyle();
} else {
_local2.invalidateStyle(colorStyle);
}
}
}
_local2.changeColorStyleInChildren(sheetName, colorStyle, newValue);
_local2.searchKey = _local6;
}
}
}
}
function notifyStyleChangeInChildren(sheetName, styleProp, newValue) {
var _local5 = getTimer();
var _local6;
for (_local6 in this) {
var _local2 = this[_local6];
if (_local2._parent == this) {
if (_local2.searchKey != _local5) {
if (((_local2.styleName == sheetName) || ((_local2.styleName != undefined) && (typeof(_local2.styleName) == "movieclip"))) || (sheetName == undefined)) {
if (_local2.stylecache != undefined) {
delete _local2.stylecache[styleProp];
delete _local2.stylecache.tf;
}
delete _local2.enabledColor;
_local2.invalidateStyle(styleProp);
}
_local2.notifyStyleChangeInChildren(sheetName, styleProp, newValue);
_local2.searchKey = _local5;
}
}
}
}
function setStyle(styleProp, newValue) {
if (stylecache != undefined) {
delete stylecache[styleProp];
delete stylecache.tf;
}
this[styleProp] = newValue;
if (mx.styles.StyleManager.isColorStyle(styleProp)) {
if (isNaN(newValue)) {
newValue = mx.styles.StyleManager.getColorName(newValue);
this[styleProp] = newValue;
if (newValue == undefined) {
return(undefined);
}
}
if (styleProp == "themeColor") {
var _local10 = mx.styles.StyleManager.colorNames.haloBlue;
var _local9 = mx.styles.StyleManager.colorNames.haloGreen;
var _local11 = mx.styles.StyleManager.colorNames.haloOrange;
var _local6 = {};
_local6[_local10] = 12188666 /* 0xB9FBFA */;
_local6[_local9] = 13500353 /* 0xCDFFC1 */;
_local6[_local11] = 16766319 /* 0xFFD56F */;
var _local7 = {};
_local7[_local10] = 13958653 /* 0xD4FDFD */;
_local7[_local9] = 14942166 /* 0xE3FFD6 */;
_local7[_local11] = 16772787 /* 0xFFEEB3 */;
var _local12 = _local6[newValue];
var _local13 = _local7[newValue];
if (_local12 == undefined) {
_local12 = newValue;
}
if (_local13 == undefined) {
_local13 = newValue;
}
setStyle("selectionColor", _local12);
setStyle("rollOverColor", _local13);
}
if (typeof(_color) == "string") {
if (_color == styleProp) {
if (styleProp == "color") {
if (stylecache.tf.color != undefined) {
stylecache.tf.color = newValue;
}
}
setColor(newValue);
}
} else if (_color[styleProp] != undefined) {
invalidateStyle(styleProp);
}
changeColorStyleInChildren(undefined, styleProp, newValue);
} else {
if ((styleProp == "backgroundColor") && (isNaN(newValue))) {
newValue = mx.styles.StyleManager.getColorName(newValue);
this[styleProp] = newValue;
if (newValue == undefined) {
return(undefined);
}
}
invalidateStyle(styleProp);
}
if (mx.styles.StyleManager.isInheritingStyle(styleProp) || (styleProp == "styleName")) {
var _local8;
var _local5 = newValue;
if (styleProp == "styleName") {
_local8 = ((typeof(newValue) == "string") ? (_global.styles[newValue]) : (_local5));
_local5 = _local8.themeColor;
if (_local5 != undefined) {
_local8.rollOverColor = (_local8.selectionColor = _local5);
}
}
notifyStyleChangeInChildren(undefined, styleProp, newValue);
}
}
static function enableRunTimeCSS() {
}
static function classConstruct() {
var _local2 = MovieClip.prototype;
var _local3 = mx.styles.CSSSetStyle.prototype;
mx.styles.CSSStyleDeclaration.prototype.setStyle = _local3._setStyle;
_local2.changeTextStyleInChildren = _local3.changeTextStyleInChildren;
_local2.changeColorStyleInChildren = _local3.changeColorStyleInChildren;
_local2.notifyStyleChangeInChildren = _local3.notifyStyleChangeInChildren;
_local2.setStyle = _local3.setStyle;
_global.ASSetPropFlags(_local2, "changeTextStyleInChildren", 1);
_global.ASSetPropFlags(_local2, "changeColorStyleInChildren", 1);
_global.ASSetPropFlags(_local2, "notifyStyleChangeInChildren", 1);
_global.ASSetPropFlags(_local2, "setStyle", 1);
var _local4 = TextField.prototype;
_local4.setStyle = _local2.setStyle;
_local4.changeTextStyleInChildren = _local3.changeTextStyleInChildren;
return(true);
}
static var classConstructed = classConstruct();
static var CSSStyleDeclarationDependency = mx.styles.CSSStyleDeclaration;
}
Symbol 67 MovieClip [__Packages.mx.core.ext.UIComponentExtensions] Frame 0
class mx.core.ext.UIComponentExtensions
{
function UIComponentExtensions () {
}
static function Extensions() {
if (bExtended == true) {
return(true);
}
bExtended = true;
TextField.prototype.setFocus = function () {
Selection.setFocus(this);
};
TextField.prototype.onSetFocus = function (oldFocus) {
if (this.tabEnabled != false) {
if (this.getFocusManager().bDrawFocus) {
this.drawFocus(true);
}
}
};
TextField.prototype.onKillFocus = function (oldFocus) {
if (this.tabEnabled != false) {
this.drawFocus(false);
}
};
TextField.prototype.drawFocus = mx.core.UIComponent.prototype.drawFocus;
TextField.prototype.getFocusManager = mx.core.UIComponent.prototype.getFocusManager;
mx.managers.OverlappedWindows.enableOverlappedWindows();
mx.styles.CSSSetStyle.enableRunTimeCSS();
mx.managers.FocusManager.enableFocusManagement();
}
static var bExtended = false;
static var UIComponentExtended = Extensions();
static var UIComponentDependency = mx.core.UIComponent;
static var FocusManagerDependency = mx.managers.FocusManager;
static var OverlappedWindowsDependency = mx.managers.OverlappedWindows;
}
Symbol 68 MovieClip [__Packages.mx.skins.Border] Frame 0
class mx.skins.Border extends mx.core.UIObject
{
function Border () {
super();
}
function init(Void) {
super.init();
}
static var symbolName = "Border";
static var symbolOwner = mx.skins.Border;
var className = "Border";
var tagBorder = 0;
var idNames = new Array("border_mc");
}
Symbol 69 MovieClip [__Packages.mx.skins.RectBorder] Frame 0
class mx.skins.RectBorder extends mx.skins.Border
{
var __width, __height, offset, __borderMetrics;
function RectBorder () {
super();
}
function get width() {
return(__width);
}
function get height() {
return(__height);
}
function init(Void) {
super.init();
}
function draw(Void) {
size();
}
function getBorderMetrics(Void) {
var _local2 = offset;
if (__borderMetrics == undefined) {
__borderMetrics = {left:_local2, top:_local2, right:_local2, bottom:_local2};
} else {
__borderMetrics.left = _local2;
__borderMetrics.top = _local2;
__borderMetrics.right = _local2;
__borderMetrics.bottom = _local2;
}
return(__borderMetrics);
}
function get borderMetrics() {
return(getBorderMetrics());
}
function drawBorder(Void) {
}
function size(Void) {
drawBorder();
}
function setColor(Void) {
drawBorder();
}
static var symbolName = "RectBorder";
static var symbolOwner = mx.skins.RectBorder;
static var version = "2.0.2.127";
var className = "RectBorder";
var borderStyleName = "borderStyle";
var borderColorName = "borderColor";
var shadowColorName = "shadowColor";
var highlightColorName = "highlightColor";
var buttonColorName = "buttonColor";
var backgroundColorName = "backgroundColor";
}
Symbol 70 MovieClip [__Packages.mx.skins.halo.RectBorder] Frame 0
class mx.skins.halo.RectBorder extends mx.skins.RectBorder
{
var offset, getStyle, borderStyleName, __borderMetrics, className, borderColorName, backgroundColorName, shadowColorName, highlightColorName, buttonColorName, __get__width, __get__height, clear, _color, drawRoundRect, beginFill, drawRect, endFill;
function RectBorder () {
super();
}
function init(Void) {
borderWidths.default = 3;
super.init();
}
function getBorderMetrics(Void) {
if (offset == undefined) {
var _local3 = getStyle(borderStyleName);
offset = borderWidths[_local3];
}
if ((getStyle(borderStyleName) == "default") || (getStyle(borderStyleName) == "alert")) {
__borderMetrics = {left:3, top:1, right:3, bottom:3};
return(__borderMetrics);
}
return(super.getBorderMetrics());
}
function drawBorder(Void) {
var _local6 = _global.styles[className];
if (_local6 == undefined) {
_local6 = _global.styles.RectBorder;
}
var _local5 = getStyle(borderStyleName);
var _local7 = getStyle(borderColorName);
if (_local7 == undefined) {
_local7 = _local6[borderColorName];
}
var _local8 = getStyle(backgroundColorName);
if (_local8 == undefined) {
_local8 = _local6[backgroundColorName];
}
var _local16 = getStyle("backgroundImage");
if (_local5 != "none") {
var _local14 = getStyle(shadowColorName);
if (_local14 == undefined) {
_local14 = _local6[shadowColorName];
}
var _local13 = getStyle(highlightColorName);
if (_local13 == undefined) {
_local13 = _local6[highlightColorName];
}
var _local12 = getStyle(buttonColorName);
if (_local12 == undefined) {
_local12 = _local6[buttonColorName];
}
var _local11 = getStyle(borderCapColorName);
if (_local11 == undefined) {
_local11 = _local6[borderCapColorName];
}
var _local10 = getStyle(shadowCapColorName);
if (_local10 == undefined) {
_local10 = _local6[shadowCapColorName];
}
}
offset = borderWidths[_local5];
var _local9 = offset;
var _local3 = __get__width();
var _local4 = __get__height();
clear();
_color = undefined;
if (_local5 == "none") {
} else if (_local5 == "inset") {
_color = colorList;
draw3dBorder(_local11, _local12, _local7, _local13, _local14, _local10);
} else if (_local5 == "outset") {
_color = colorList;
draw3dBorder(_local11, _local7, _local12, _local14, _local13, _local10);
} else if (_local5 == "alert") {
var _local15 = getStyle("themeColor");
drawRoundRect(0, 5, _local3, _local4 - 5, 5, 6184542, 10);
drawRoundRect(1, 4, _local3 - 2, _local4 - 5, 4, [6184542, 6184542], 10, 0, "radial");
drawRoundRect(2, 0, _local3 - 4, _local4 - 2, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(2, 0, _local3 - 4, _local4 - 2, 3, _local15, 50);
drawRoundRect(3, 1, _local3 - 6, _local4 - 4, 2, 16777215, 100);
} else if (_local5 == "default") {
drawRoundRect(0, 5, _local3, _local4 - 5, {tl:5, tr:5, br:0, bl:0}, 6184542, 10);
drawRoundRect(1, 4, _local3 - 2, _local4 - 5, {tl:4, tr:4, br:0, bl:0}, [6184542, 6184542], 10, 0, "radial");
drawRoundRect(2, 0, _local3 - 4, _local4 - 2, {tl:3, tr:3, br:0, bl:0}, [12897484, 11844796], 100, 0, "radial");
drawRoundRect(3, 1, _local3 - 6, _local4 - 4, {tl:2, tr:2, br:0, bl:0}, 16777215, 100);
} else if (_local5 == "dropDown") {
drawRoundRect(0, 0, _local3 + 1, _local4, {tl:4, tr:0, br:0, bl:4}, [13290186, 7895160], 100, -10, "linear");
drawRoundRect(1, 1, _local3 - 1, _local4 - 2, {tl:3, tr:0, br:0, bl:3}, 16777215, 100);
} else if (_local5 == "menuBorder") {
var _local15 = getStyle("themeColor");
drawRoundRect(4, 4, _local3 - 2, _local4 - 3, 0, [6184542, 6184542], 10, 0, "radial");
drawRoundRect(4, 4, _local3 - 1, _local4 - 2, 0, 6184542, 10);
drawRoundRect(0, 0, _local3 + 1, _local4, 0, [0, 14342874], 100, 250, "linear");
drawRoundRect(0, 0, _local3 + 1, _local4, 0, _local15, 50);
drawRoundRect(2, 2, _local3 - 3, _local4 - 4, 0, 16777215, 100);
} else if (_local5 == "comboNonEdit") {
} else {
beginFill(_local7);
drawRect(0, 0, _local3, _local4);
drawRect(1, 1, _local3 - 1, _local4 - 1);
endFill();
_color = borderColorName;
}
if (_local8 != undefined) {
beginFill(_local8);
drawRect(_local9, _local9, __get__width() - _local9, __get__height() - _local9);
endFill();
}
}
function draw3dBorder(c1, c2, c3, c4, c5, c6) {
var _local3 = __get__width();
var _local2 = __get__height();
beginFill(c1);
drawRect(0, 0, _local3, _local2);
drawRect(1, 0, _local3 - 1, _local2);
endFill();
beginFill(c2);
drawRect(1, 0, _local3 - 1, 1);
endFill();
beginFill(c3);
drawRect(1, _local2 - 1, _local3 - 1, _local2);
endFill();
beginFill(c4);
drawRect(1, 1, _local3 - 1, 2);
endFill();
beginFill(c5);
drawRect(1, _local2 - 2, _local3 - 1, _local2 - 1);
endFill();
beginFill(c6);
drawRect(1, 2, _local3 - 1, _local2 - 2);
drawRect(2, 2, _local3 - 2, _local2 - 2);
endFill();
}
static function classConstruct() {
mx.core.ext.UIObjectExtensions.Extensions();
_global.styles.rectBorderClass = mx.skins.halo.RectBorder;
_global.skinRegistry.RectBorder = true;
return(true);
}
static var symbolName = "RectBorder";
static var symbolOwner = mx.skins.halo.RectBorder;
static var version = "2.0.2.127";
var borderCapColorName = "borderCapColor";
var shadowCapColorName = "shadowCapColor";
var colorList = {highlightColor:0, borderColor:0, buttonColor:0, shadowColor:0, borderCapColor:0, shadowCapColor:0};
var borderWidths = {none:0, solid:1, inset:2, outset:2, alert:3, dropDown:2, menuBorder:2, comboNonEdit:2};
static var classConstructed = classConstruct();
static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
}
Symbol 71 MovieClip [__Packages.mx.skins.halo.ButtonSkin] Frame 0
class mx.skins.halo.ButtonSkin extends mx.skins.RectBorder
{
var __get__width, __get__height, getStyle, _parent, clear, drawRoundRect, __get__x, __get__y;
function ButtonSkin () {
super();
}
function init() {
super.init();
}
function size() {
drawHaloRect(__get__width(), __get__height());
}
function drawHaloRect(w, h) {
var _local6 = getStyle("borderStyle");
var _local4 = getStyle("themeColor");
var _local5 = _parent.emphasized;
clear();
switch (_local6) {
case "falseup" :
if (_local5) {
drawRoundRect(__get__x(), __get__y(), w, h, 5, 9542041, 100);
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 75);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16777215], 85, 0, "radial");
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, _local4, 75);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, 16316664, 100);
} else {
drawRoundRect(0, 0, w, h, 5, 9542041, 100);
drawRoundRect(1, 1, w - 2, h - 2, 4, [13291985, 16250871], 100, 0, "radial");
drawRoundRect(2, 2, w - 4, h - 4, 3, [9542041, 13818586], 100, 0, "radial");
drawRoundRect(3, 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(3, 4, w - 6, h - 7, 2, 16316664, 100);
}
break;
case "falsedown" :
drawRoundRect(__get__x(), __get__y(), w, h, 5, 9542041, 100);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16579836], 100, 0, "radial");
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, _local4, 50);
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 40);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, _local4, 20);
break;
case "falserollover" :
drawRoundRect(__get__x(), __get__y(), w, h, 5, 9542041, 100);
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 50);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16777215], 100, 0, "radial");
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, _local4, 50);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, 16316664, 100);
break;
case "falsedisabled" :
drawRoundRect(0, 0, w, h, 5, 13159628, 100);
drawRoundRect(1, 1, w - 2, h - 2, 4, 15921906, 100);
drawRoundRect(2, 2, w - 4, h - 4, 3, 13949401, 100);
drawRoundRect(3, 3, w - 6, h - 6, 2, 15921906, 100);
break;
case "trueup" :
drawRoundRect(__get__x(), __get__y(), w, h, 5, 10066329, 100);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16579836], 100, 0, "radial");
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, _local4, 50);
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 40);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, 16250871, 100);
break;
case "truedown" :
drawRoundRect(__get__x(), __get__y(), w, h, 5, 10066329, 100);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16579836], 100, 0, "radial");
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, _local4, 50);
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 40);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, _local4, 20);
break;
case "truerollover" :
drawRoundRect(__get__x(), __get__y(), w, h, 5, 9542041, 100);
drawRoundRect(__get__x(), __get__y(), w, h, 5, _local4, 50);
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, [3355443, 16777215], 100, 0, "radial");
drawRoundRect(__get__x() + 1, __get__y() + 1, w - 2, h - 2, 4, _local4, 40);
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, [0, 14342874], 100, 0, "radial");
drawRoundRect(__get__x() + 2, __get__y() + 2, w - 4, h - 4, 3, _local4, 40);
drawRoundRect(__get__x() + 3, __get__y() + 3, w - 6, h - 6, 2, 16777215, 100);
drawRoundRect(__get__x() + 3, __get__y() + 4, w - 6, h - 7, 2, 16316664, 100);
break;
case "truedisabled" :
drawRoundRect(0, 0, w, h, 5, 13159628, 100);
drawRoundRect(1, 1, w - 2, h - 2, 4, 15921906, 100);
drawRoundRect(2, 2, w - 4, h - 4, 3, 13949401, 100);
drawRoundRect(3, 3, w - 6, h - 6, 2, 15921906, 100);
}
}
static function classConstruct() {
mx.core.ext.UIObjectExtensions.Extensions();
_global.skinRegistry.ButtonSkin = true;
return(true);
}
static var symbolName = "ButtonSkin";
static var symbolOwner = mx.skins.halo.ButtonSkin;
var className = "ButtonSkin";
var backgroundColorName = "buttonColor";
static var classConstructed = classConstruct();
static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
}
Symbol 359 MovieClip Frame 1
stop();
_root.dungeonmap.village.nameplaque.lozenge.clo.onPress = function () {
_root.dungeonmap.village.nameplaque.lozenge.gotoAndStop(2);
};
Symbol 359 MovieClip Frame 2
stop();
_root.dungeonmap.village.nameplaque.lozenge.ope.onPress = function () {
_root.dungeonmap.village.nameplaque.lozenge.gotoAndStop(1);
};