JustPaste.it

// Action script...

// [Action in Frame 1]
function beginBattle() {
    monSubLoc = Math.floor(Math.random() * 2 + 1);
    NonExLevel = Math.round(Math.pow(currentLocation, 1 + currentLocation * 1.000000E-02));
    GenerateMonster(Math.round(Math.pow(currentLocation, 1 + currentLocation * 1.000000E-01)), NonExLevel);
    healthBar._alpha = 100;
    manaBar._alpha = 100;
    enemyHealthBar._alpha = 100;
    enemyManaBar._alpha = 100;
    enemyHealth = MonsterLevel * 3 + 4;
    enemyMana = MonsterLevel * 2;
    enemyHealthMax = MonsterLevel * 3 + 4;
    enemyManaMax = MonsterLevel * 2;
    if (enemyHealth < 1) {
        enemyHealth = 1;
        enemyHealthMax = 1;
    }
    if (enemyMana < 0) {
        enemyMana = 0;
        enemyManaMax = 0;
    }
    enemyPoison = false;
    enemySlow = false;
    manaTimer = 0;
    enemySpeed = 10;
    Health = HealthMax;
    Mana = ManaMax;
    EnemyProgressNow = 0;
    fighting = true;
    regenTimer = 0;
    Save(currentSaveFile, "Combat");
    Save(currentSaveFile, "CombatBegin");
}
function travelTo(travelLocation) {
    i = 0;
    if (characterClass == "Knight" || characterClass == "Paladin" || characterClass == "Cowboy" || characterClass == "Cowgirl") {
        i = (Extra + ExtraModifier + ExtraModifier2) / 5;
    }
    if (travelLocation == 0) {
        Progress("Traveling to " + LocationArray[travelLocation][0], (currentLocation * 10 + 50) / (SpellsArray[12][1] + 1 + i));
    }
    else {
        Progress("Traveling to " + LocationArray[travelLocation][0], (travelLocation * 10 + 50) / (SpellsArray[12][1] + 1));
    }
    travelingTo = travelLocation;
    Traveling = true;
}
function Capitalize(word) {
    firstLetter = word.slice(0, 1);
    rest = word.slice(1);
    firstLetter = firstLetter.toUpperCase();
    word = firstLetter + rest;
    return (word);
}
function Pluralize(word) {
    lastLetter = word.slice(word.length - 1);
    last2Letters = word.slice(word.length - 2);
    if (word == "Jabberwock") {
        word = word + "y";
    }
    else if (word == "Orc Shaman") {
        word = "Orc Shamen";
    }
    else if (word == "Snowman") {
        word = "Snowmen";
    }
    else if (word == "Trophy" || word == "Ruby") {
        word = word.slice(0, word.length - 1);
        word = word + "ies";
    }
    else if (last2Letters == "us") {
        word = word.slice(0, word.length - 2);
        word = word + "i";
    }
    else if (lastLetter == "x" || lastLetter == "z" || lastLetter == "s" || last2Letters == "ch" || last2Letters == "sh") {
        word = word + "es";
    }
    else if (lastLetter == "f" && word != "Hippogriff") {
        word = word.slice(0, word.length - 1);
        word = word + "ves";
    }
    else {
        word = word + "s";
    }
    return (word);
}
function Article(word) {
    firstLetter = word.slice(0, 1);
    firstLetter = firstLetter.toLowerCase();
    if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" || firstLetter == "u") {
        word = "an " + word;
    }
    else {
        word = "a " + word;
    }
    return (word);
}
function GenerateMonster(Level2, Level) {
    Level = Math.round(Level * 1.500000E+00) + 1;
    Level = Level + Math.round(Math.random() * 3 - 3);
    i5 = "x";
    Modifier4 = 0;
    while (i5 != "xxx") {
        Modifier1 = Math.round(Math.random() * Level);
        if (Modifier1 > 48) {
            Modifier1 = 48;
        }
        Monster = Level - Modifier1;
        if (questType == "kill" && Math.random() < 5.000000E-01) {
            Monster = questTarget;
            Modifier1 = Level - Monster;
            monSubLoc = qmonSubLoc;
        }
        if (questType == "boss" && boss == true) {
            Monster = questTarget;
            Level = Math.round(Level * 1.500000E+00);
            Modifier1 = Level - Monster;
            monSubLoc = qmonSubLoc;
        }
        if (Modifier1 > 47) {
            i = Modifier1 - 47;
            Modifier1 = 47;
            Monster = Monster + i;
        }
        if (Modifier1 < 0) {
            Modifier1 = 0;
        }
        if (Monster > 34) {
            i = Math.floor(Math.random() * 42);
            Modifier2 = i;
            if (Modifier2 == Modifier - 6) {
                ++Modifier2;
            }
            Monster = Monster - i;
            if (Monster > 34) {
                i = Math.floor(Math.random() * 42);
                Modifier3 = i;
                if (Modifier3 == Modifier1 - 6 || Modifier3 == Modifier2) {
                    ++Modifier3;
                }
                if (Modifier3 == Modifier1 - 6 || Modifier3 == Modifier2) {
                    ++Modifier3;
                }
                Monster = Monster - i;
            }
            else {
                Modifier3 = 0;
            }
        }
        else {
            Modifier2 = 0;
            Modifier3 = 0;
        }
        if (Monster < 0) {
            Monster = 0;
        }
        i5 = "xxx";
        if (Monster > 34) {
            i5 = "x";
            Modifier4 = Modifier4 + 1;
            Level = Math.floor(Level / 2);
        }
    }
    MonsterLevel = Level2;
}
function RomanNumeral(number) {
    if (number < 10000) {
        new_num = number;
        thousands = Math.floor(new_num / 1000);
        new_num = new_num - thousands * 1000;
        hundreds = Math.floor(new_num / 100);
        new_num = new_num - hundreds * 100;
        tens = Math.floor(new_num / 10);
        new_num = new_num - tens * 10;
        ones = Math.floor(new_num / 1);
        var _loc1 = new Array(thousands, hundreds, tens, ones);
        numeral = thousands_numerals[_loc1[0]] + hundreds_numerals[_loc1[1]] + tens_numerals[_loc1[2]] + ones_numerals[_loc1[3]];
        return (numeral);
    }
    else {
        return (number);
    }
}
function obtainSpell(spellIncriment) {
    i2 = 0;
    if (Math.random() < 3.330000E-01 && Level > 1) {
        for (i = 0; i < 14; i++) {
            i2 = Math.max(SpellsArray[i][1], i2);
        }
        var _loc1 = new Array();
        i3 = 0;
        for (i = 0; i < 14; i++) {
            if (SpellsArray[i][1] == i2) {
                _loc1[i3] = i;
                ++i3;
            }
        }
        SpellChoice = _loc1[Math.floor(Math.random() * i3)];
        SpellsArray[SpellChoice][1] = SpellsArray[SpellChoice][1] + spellIncriment;
    }
    else if (Math.random() < 5.000000E-01 && Level > 1) {
        i3 = 0;
        _loc1 = new Array();
        for (i = 0; i < 14; i++) {
            if (SpellsArray[i][1] > 0) {
                _loc1[i3] = i;
                ++i3;
            }
        }
        SpellChoice = _loc1[Math.floor(Math.random() * i3)];
        SpellsArray[SpellChoice][1] = SpellsArray[SpellChoice][1] + spellIncriment;
    }
    else {
        SpellChoice = Math.floor(Math.random() * 14);
        SpellsArray[SpellChoice][1] = SpellsArray[SpellChoice][1] + spellIncriment;
    }
    if (SpellChoice == 0) {
        StrMod = StrMod + spellIncriment;
    }
    if (SpellChoice == 1) {
        ConMod = ConMod + spellIncriment;
        HealthMax = 8 + (Con + ConMod) * 3;
    }
    if (SpellChoice == 2) {
        DexMod = DexMod + spellIncriment;
    }
    if (SpellChoice == 3) {
        ChaMod = ChaMod + spellIncriment;
    }
    if (SpellChoice == 4) {
        IntMod = IntMod + spellIncriment;
    }
    if (SpellChoice == 5) {
        WisMod = WisMod + spellIncriment;
        ManaMax = Math.floor(4 + (Wis + WisMod) * 1.500000E+00);
    }
    i2 = 1;
    for (i = 0; i < 14; i++) {
        if (SpellsArray[i][1] > 0) {
            if (i2 <= 8) {
                SpellText.Spells[i2].text = SpellsArray[i][0] + " " + RomanNumeral(SpellsArray[i][1]);
                SpellText.Spells[i2].setTextFormat(spellFormat);
            }
            else {
                i3 = i2 - 8;
                SpellText.Spells[i3].text = SpellsArray[i][0] + " " + RomanNumeral(SpellsArray[i][1]) + ", " + SpellText.Spells[i3].text;
                SpellText.Spells[i3].setTextFormat(spellFormat);
            }
            ++i2;
        }
    }
}
function displayItems() {
    i2 = 1;
    for (i = 0; i < 5; i++) {
        if (inventoryArray[i][0] > 0) {
            itemNameNumber = inventoryArray[i][1] - 1;
            InventoryText.Inventory[i2].text = itemsArray[itemNameNumber] + " (" + inventoryArray[i][0] + ")";
            InventoryText.Inventory[i2].setTextFormat(spellFormat);
            ++i2;
        }
    }
    for (i = i2; i <= 5; i++) {
        InventoryText.Inventory[i].text = "";
    }
}
function Progress(Name, Amount) {
    progressText = Name;
    ProgressNow = 0;
    ProgressEnd = Amount;
}
function Save(SaveFile, SaveType) {
    saveString = "s" + SaveFile + "_";
    if (SaveType == "Start") {
        _root.savefile.data[saveString + "StrUp"] = StrUp;
        _root.savefile.data[saveString + "ConUp"] = ConUp;
        _root.savefile.data[saveString + "DexUp"] = DexUp;
        _root.savefile.data[saveString + "ChaUp"] = ChaUp;
        _root.savefile.data[saveString + "IntUp"] = IntUp;
        _root.savefile.data[saveString + "WisUp"] = WisUp;
        _root.savefile.data[saveString + "characterName"] = characterName;
        _root.savefile.data[saveString + "characterRace"] = characterRace;
        _root.savefile.data[saveString + "characterClass"] = characterClass;
        _root.savefile.data[saveString + "characterGender"] = characterGender;
    }
    if (SaveType == "Level") {
        _root.savefile.data[saveString + "Str"] = Str;
        _root.savefile.data[saveString + "Con"] = Con;
        _root.savefile.data[saveString + "Dex"] = Dex;
        _root.savefile.data[saveString + "Cha"] = Cha;
        _root.savefile.data[saveString + "Int"] = Int;
        _root.savefile.data[saveString + "Wis"] = Wis;
        _root.savefile.data[saveString + "StrEx"] = StrEx;
        _root.savefile.data[saveString + "ConEx"] = ConEx;
        _root.savefile.data[saveString + "DexEx"] = DexEx;
        _root.savefile.data[saveString + "ChaEx"] = ChaEx;
        _root.savefile.data[saveString + "IntEx"] = IntEx;
        _root.savefile.data[saveString + "WisEx"] = WisEx;
        _root.savefile.data[saveString + "StrMod"] = StrMod;
        _root.savefile.data[saveString + "ConMod"] = ConMod;
        _root.savefile.data[saveString + "DexMod"] = DexMod;
        _root.savefile.data[saveString + "ChaMod"] = ChaMod;
        _root.savefile.data[saveString + "IntMod"] = IntMod;
        _root.savefile.data[saveString + "WisMod"] = WisMod;
        _root.savefile.data[saveString + "HealthMax"] = HealthMax;
        _root.savefile.data[saveString + "ManaMax"] = ManaMax;
        _root.savefile.data[saveString + "ExpLevel"] = ExpLevel;
        _root.savefile.data[saveString + "Level"] = Level;
        _root.savefile.data[saveString + "SkillLevel"] = SkillLevel;
        for (i = 0; i < 14; i++) {
            _root.savefile.data[saveString + "Spell" + i] = SpellsArray[i][1];
        }
    }
    if (SaveType == "CombatBegin") {
        _root.savefile.data[saveString + "monSubLoc"] = monSubLoc;
        _root.savefile.data[saveString + "enemyHealthMax"] = enemyHealthMax;
        _root.savefile.data[saveString + "enemyManaMax"] = enemyManaMax;
        _root.savefile.data[saveString + "Monster"] = Monster;
        _root.savefile.data[saveString + "Modifier1"] = Modifier1;
        _root.savefile.data[saveString + "Modifier2"] = Modifier2;
        _root.savefile.data[saveString + "Modifier3"] = Modifier3;
        _root.savefile.data[saveString + "Modifier4"] = Modifier4;
        _root.savefile.data[saveString + "MonsterLevel"] = MonsterLevel;
    }
    if (SaveType == "Combat") {
        _root.savefile.data[saveString + "boss"] = boss;
        _root.savefile.data[saveString + "bossend"] = bossend;
        _root.savefile.data[saveString + "fighting"] = fighting;
        _root.savefile.data[saveString + "regenTimer"] = regenTimer;
        _root.savefile.data[saveString + "poisonTimer"] = poisonTimer;
        _root.savefile.data[saveString + "manaTimer"] = manaTimer;
        _root.savefile.data[saveString + "enemySpeed"] = enemySpeed;
        _root.savefile.data[saveString + "enemyHealth"] = enemyHealth;
        _root.savefile.data[saveString + "enemyMana"] = enemyMana;
        _root.savefile.data[saveString + "enemyPoison"] = enemyPoison;
        _root.savefile.data[saveString + "EnemyProgressNow"] = EnemyProgressNow;
        _root.savefile.data[saveString + "Health"] = Health;
        _root.savefile.data[saveString + "Mana"] = Mana;
    }
    if (SaveType == "Travel") {
        _root.savefile.data[saveString + "currentLocation"] = currentLocation;
        _root.savefile.data[saveString + "subLocation"] = subLocation;
    }
    if (SaveType == "Kill") {
        _root.savefile.data[saveString + "Exp"] = Exp;
        _root.savefile.data[saveString + "deathCount"] = deathCount;
        _root.savefile.data[saveString + "SkillLevel"] = SkillLevel;
        _root.savefile.data[saveString + "questCompletion"] = questCompletion;
        _root.savefile.data[saveString + "Gold"] = Gold;
        for (i = 0; i < 5; i++) {
            _root.savefile.data[saveString + "inventory" + i + "quantity"] = inventoryArray[i][0];
            _root.savefile.data[saveString + "inventory" + i + "quality"] = inventoryArray[i][1];
        }
    }
    if (SaveType == "Quest") {
        _root.savefile.data[saveString + "Exp"] = Exp;
        _root.savefile.data[saveString + "questType"] = questType;
        _root.savefile.data[saveString + "questEnd"] = questEnd;
        _root.savefile.data[saveString + "questCompletion"] = questCompletion;
        _root.savefile.data[saveString + "questTarget"] = questTarget;
        _root.savefile.data[saveString + "questLevel"] = questLevel;
        _root.savefile.data[saveString + "QuestLocation"] = QuestLocation;
        _root.savefile.data[saveString + "qmonSubLoc"] = qmonSubLoc;
        _root.savefile.data[saveString + "Gold"] = Gold;
    }
    if (SaveType == "Shopping") {
        _root.savefile.data[saveString + "Weapon"] = Weapon;
        _root.savefile.data[saveString + "WeaponModifier"] = WeaponModifier;
        _root.savefile.data[saveString + "WeaponModifierNumber"] = WeaponModifierNumber;
        _root.savefile.data[saveString + "Armor"] = Armor;
        _root.savefile.data[saveString + "ArmorModifier"] = ArmorModifier;
        _root.savefile.data[saveString + "ArmorModifierNumber"] = ArmorModifierNumber;
        _root.savefile.data[saveString + "Extra"] = Extra;
        _root.savefile.data[saveString + "ExtraModifier"] = ExtraModifier;
        _root.savefile.data[saveString + "ExtraModifier2"] = ExtraModifier2;
        _root.savefile.data[saveString + "Gold"] = Gold;
    }
    if (SaveType == "BuyingTypes") {
        _root.savefile.data[saveString + "purchaseableWeapon"] = purchaseableWeapon;
        _root.savefile.data[saveString + "purchaseableWeaponModifier"] = purchaseableWeaponModifier;
        _root.savefile.data[saveString + "purchaseableWeaponModifierNumber"] = purchaseableWeaponModifierNumber;
        _root.savefile.data[saveString + "purchaseableArmor"] = purchaseableArmor;
        _root.savefile.data[saveString + "purchaseableArmorModifier"] = purchaseableArmorModifier;
        _root.savefile.data[saveString + "purchaseableArmorModifierNumber"] = purchaseableArmorModifierNumber;
        _root.savefile.data[saveString + "purchaseableExtra"] = purchaseableExtra;
        _root.savefile.data[saveString + "purchaseableExtraModifier"] = purchaseableExtraModifier;
        _root.savefile.data[saveString + "purchaseableExtraModifier2"] = purchaseableExtraModifier2;
        _root.savefile.data[saveString + "weaponCost"] = weaponCost;
        _root.savefile.data[saveString + "armorCost"] = armorCost;
    }
    if (SaveType == "Sell") {
        for (i = 0; i < 5; i++) {
            _root.savefile.data[saveString + "inventory" + i + "quantity"] = inventoryArray[i][0];
            _root.savefile.data[saveString + "inventory" + i + "quality"] = inventoryArray[i][1];
        }
        _root.savefile.data[saveString + "Gold"] = Gold;
    }
}
function Kill() {
    deathCount = deathCount + 1;
    if (deathCount == 100) {
        deathCount = 0;
        ++SkillLevel;
    }
    healthBar._alpha = 0;
    manaBar._alpha = 0;
    enemyHealthBar._alpha = 0;
    enemyManaBar._alpha = 0;
    fighting = false;
    if (questType == "boss") {
        if (boss == true) {
            travelTo(0);
            subLocation = "none";
            boss = false;
            bossend = true;
        }
        else {
            questCompletion = questCompletion + 1;
        }
    }
    if (questType == "collect" && Math.random() < 5.000000E-01) {
        questCompletion = questCompletion + 1;
        itemLoot = questTarget;
    }
    else {
        itemLoot = "";
    }
    if (questType == "kill" && Monster == questTarget) {
        questCompletion = questCompletion + 1;
    }
    if (questType == "find" || questType == "deliver") {
        searching = true;
    }
    if (Math.random() < 0.4 * (1 + SpellsArray[10][1] / 10)) {
        itemLoot2 = Math.floor(Math.random() * 5 - 1);
        ++inventoryArray[itemLoot2 + 1][0];
        inventoryArray[itemLoot2 + 1][1] = currentLocation + itemLoot2 + 1;
        displayItems();
    }
    else {
        itemLoot2 = 4;
    }
    expGain = Math.round((Math.random() * MonsterLevel + MonsterLevel) * 10 * (1 + SpellsArray[11][1] * 1.000000E-01));
    if (expGain < 1) {
        expGain = 1;
    }
    RewardTimer = 30;
    Exp = Exp + expGain;
    rewardType = "Monster Loot:";
    Save(currentSaveFile, "Kill");
}
function createButton(xLoc, yLoc, Text, Name) {
    _root.createEmptyMovieClip(Name, _root.getNextHighestDepth());
    _root[Name]._x = xLoc;
    _root[Name]._y = yLoc;
    _root[Name].createEmptyMovieClip("button", _root[Name].getNextHighestDepth());
    with (_root[Name].button) {
        _x = 0;
        _y = 0;
        lineStyle(2);
        beginFill(11184810, 100);
        lineTo(100, 0);
        lineTo(100, 20);
        lineTo(0, 20);
        lineTo(0, 0);
        endFill();
    }
    _root[Name].createEmptyMovieClip("buttonCover", _root[Name].getNextHighestDepth());
    _root[Name].buttonCover._x = 0;
    _root[Name].buttonCover._y = 0;
    _root[Name].buttonCover.lineStyle(2);
    _root[Name].buttonCover.beginFill(10066329, 100);
    _root[Name].buttonCover.lineTo(100, 0);
    _root[Name].buttonCover.lineTo(100, 20);
    _root[Name].buttonCover.lineTo(0, 20);
    _root[Name].buttonCover.lineTo(0, 0);
    _root[Name].buttonCover.endFill();
    _root[Name].onRollOver = function () {
        this.buttonCover._alpha = 100;
    };
    _root[Name].onRollOut = function () {
        this.buttonCover._alpha = 0;
    };
    _root[Name].onDragOver = function () {
        this.buttonCover._alpha = 100;
    };
    _root[Name].onDragOut = function () {
        this.buttonCover._alpha = 0;
    };
    _root[Name].buttonCover._alpha = 0;
    _root[Name].createTextField("buttonText", _root[Name].getNextHighestDepth(), 0, 0, 100, 20);
    with (_root[Name].buttonText) {
        selectable = false;
        text = Text;
        setTextFormat(progressFormat);
    }
}
var kongregate = _global.kongregate;
kongregate.services.connect();
Loading = true;
ProgressNow = 0;
ProgressEnd = 1;
NextProgress = false;
i = 0;
i2 = 0;
i3 = 3;
for (i = 0; i < 100; i++) {
    i2 = i2 + i3;
    i3 = i3 * 7.500000E-01;
}
var ClassArray = [["Necromancer", 1.000000E-01, 1.000000E-01, 3.000000E-01, 1.000000E-01, 7.000000E-01, 7.000000E-01], ["Wizard", 0, 1.000000E-01, 3.000000E-01, 2.000000E-01, 8.000000E-01, 6.000000E-01], ["Bard", 2.000000E-01, 2.000000E-01, 6.000000E-01, 1.600000E+00, 3.000000E-01, 3.000000E-01], ["Knight", 1.200000E+00, 1.000000E+00, 1.200000E+00, 3.000000E-01, 1.000000E-01, 2.000000E-01], ["Ranger", 8.000000E-01, 6.000000E-01, 2.400000E+00, 3.000000E-01, 2.000000E-01, 2.000000E-01], ["Archeologist", 6.000000E-01, 1.200000E+00, 8.000000E-01, 3.000000E-01, 1.200000E+00, 3.000000E-01], ["Paladin", 6.000000E-01, 1.200000E+00, 8.000000E-01, 1.000000E+00, 1.000000E-01, 3.000000E-01], ["Rogue", 6.000000E-01, 1.000000E-01, 4.800000E+00, 6.000000E-01, 2.000000E-01, 3.000000E-01], ["Priest", 2.000000E-01, 2.000000E-01, 3.000000E-01, 4.000000E-01, 6.000000E-01, 3.000000E-01], ["Cowboy", 1.000000E+00, 6.000000E-01, 1.600000E+00, 3.000000E-01, 4.000000E-01, 3.000000E-01]];
var RaceArray = [["Dwarf", 4.000000E-01, 5.000000E-01, 2.000000E-01, 2.000000E-01, 4.000000E-01, 3.000000E-01], ["Human", 4.000000E-01, 3.000000E-01, 3.000000E-01, 4.000000E-01, 3.000000E-01, 3.000000E-01], ["Elf", 3.000000E-01, 2.000000E-01, 4.000000E-01, 3.000000E-01, 4.000000E-01, 4.000000E-01], ["Gnome", 2.000000E-01, 4.000000E-01, 3.000000E-01, 4.000000E-01, 3.000000E-01, 4.000000E-01], ["Half-Orc", 5.000000E-01, 5.000000E-01, 4.000000E-01, 2.000000E-01, 2.000000E-01, 2.000000E-01], ["Hobbit", 2.000000E-01, 2.000000E-01, 5.000000E-01, 3.000000E-01, 4.000000E-01, 4.000000E-01], ["High Elf", 3.000000E-01, 2.000000E-01, 3.000000E-01, 5.000000E-01, 3.000000E-01, 4.000000E-01], ["Half-Elf", 3.000000E-01, 3.000000E-01, 4.000000E-01, 3.000000E-01, 3.000000E-01, 4.000000E-01]];
var meleeWeaponArray = ["none", "stick", "dagger", "club", "shortsword", "axe", "spear", "scimitar", "flail", "scythe", "morning star", "longsword", "broadsword", "lance", "bastard sword", "beam sword", "chainsword", "frozen sword", "crystal sword", "laser cutter", "daikatana", "dual scimitars", "blackheart blade", "mana sword"];
var meleeWeaponModifier = ["very old ", "wooden ", "unbalanced ", "dull ", "old ", "", "sharp ", "masterwork ", "flaming ", "frosty ", "silver ", "venomed ", "dancing ", "gold ", "vorpal ", "platinum ", "epic "];
var armorArray = ["none", "lace", "canvas", "leather", "studded leather", "hide", "chain shirt", "ringmail", "scale mail", "chainmail", "banded mail", "splint mail", "half plate", "full plate", "diamond mail", "plasma"];
var armorModifierArray = ["cursed ", "dented ", "rusty ", "torn ", "smelly ", "", "spiked ", "tough ", "shiny ", "mystic ", "silver ", "golden ", "mithril ", "dragon ", "holy ", "impressive ", "epic "];
var spellbookArray = ["none", "scroll", "parchment", "text", "manuscript", "novel", "manual", "book", "spellbook", "spellbook", "spellbook", "magicbook", "grimore", "tome", "opus", "necronomicon"];
var spellbookModifier = ["torn ", "stained ", "old ", "ragged ", "thin ", "wrinkled ", "dusty ", "dull ", "", "mottled ", "cloth ", "canvas ", "leather ", "dog eared ", "vellum ", "hard cover ", "glittering ", "shining ", "glowing ", "ancient ", "thick ", "fascinating ", "jewel-encrusted ", "entrancing ", "enchanted ", "runic ", "demonic ", "divine ", "impressive ", "necromatic ", "epic "];
var spellbookModifier2 = ["", "tan ", "light brown ", "white ", "dark brown ", "yellow ", "red ", "orange ", "blue ", "light green ", "violet ", "turquoise ", "dark blue ", "plaid ", "black ", "copper ", "invisible ", "bronze ", "silver ", "gold ", "platinum "];
var mountArray = ["none", "donkey", "mule", "pony", "zebra", "grey horse", "brown horse", "black horse", "hippogriff", "giant owl", "giant eagle", "pegasus", "unicorn", "griffon", "sphinx", "pegicorn", "jabberwock", "copper dragon", "silver dragon", "gold dragon", "platinum dragon"];
var mountModifier = ["pathetic ", "small ", "unsteady ", "smelly ", "", "trained ", "armored ", "gifted ", "undead ", "heroic ", "amazing ", "magical ", "elite ", "robotic ", "ultimate", "epic ", "sarcastic", "nignog", "half-breed", "skeletal", "slutty", "promiscuous", "flying", "legendary", "faithful", "untamed", "battle-ready", "weapons-grade"];
var mountModifier2 = ["", "trained ", "armored ", "gifted ", "undead ", "heroic ", "amazing ", "magical ", "elite ", "robotic ", "ultamite ", "epic "];
var rangedWeaponArray = ["none", "sling", "hand crossbow", "self bow", "flatbow", "shortbow", "light crossbow", "longbow", "heavy crossbow", "composite shortbow", "compound bow", "composite longbow", "repeating crossbow", "heavy repeating crossbow", "pistol", "uzi", "blaster", "rapid-fire blaster", "machine gun", "bazooka", "blowgun", "needler", "gauss rifle", "bolter", "rapid-fire laser", "minigun", "EM pulse cannon", "sniper rifle"];
var rangedWeaponModifier = ["very old ", "dull ", "old ", "wooden ", "", "bone ", "reflex ", "deflex ", "decurve ", "recurve ", "balanced ", "glowing ", "shining ", "holy ", "masterwork ", "cable-backed ", "enchanted ", "epic "];
var ammoArray = ["none", "rocks", "bolts", "arrows", "arrows", "arrows", "bolts", "arrows", "bolts", "arrows", "arrows", "arrows", "bolts", "bolts", "bullets", "bullets", "batteries", "batteries", "clip", "rockets", "needles", "needles", "EM bullets", "shells", "battery clip", "magazine", "charges", "bullets"];
var ammoModifier = ["paper ", "wooden ", "", "oak ", "raw ", "bone ", "glass ", "mica ", "copper ", "bronze ", "metal ", "silver ", "golden ", "diamond ", "ether "];
var ammoModifier2 = ["", "heavy ", "light ", "sharp ", "envenomed ", "static ", "acid coated ", "dark ", "masterwork ", "enchanted", "flaming ", "invisible ", "ice ", "explosive ", "epic "];
var instrumentArray = ["none", "triangle", "fife", "harmonica", "lute", "shawm", "pan flute", "recorder", "cowbell", "bongos", "mandolin", "piccalo", "violin", "trumpet", "tuba", "accordian", "piano", "harp", "guitar", "vibraphone", "stradivarius"];
var instrumentModifier = ["old ", "dull ", "wooden ", "common ", "", "clean ", "bronze ", "magnificent ", "masterwork ", "silver ", "enchanted ", "gold ", "electric ", "enchanted", "rock n roll", "mana", "magnetic"];
var instrumentModifier2 = ["", "clean", "bronze", "magnificent", "masterwork", "silver", "enchanted", "gold", "electric", "epic", "epic clean", "epic bronze", "epic magnificent", "epic masterwork", "epic silver", "epic enchanted", "epic gold", "epic eletric", "best in the world", "best in the world bronze", "best in the world silver", "best in the world gold", "best in the world electric"];
var itemsArray = ["Trash", "Rock", "Shell", "Acorn", "Vine", "Skull", "Bow", "Amethyst", "Wallet", "Medal", "Potion", "Topaz", "Purse", "Ring", "Platinum Coin", "Onyx", "Dubloon", "Treasure Map", "Crown", "Ruby", "Pearl", "Crystal", "Gold Nugget", "Saffire", "Idol", "Emerald", "Trophy", "Diamond", "Crystal Skull", "Trident", "Dark Ruby", "Artifact", "Jade Monkey", "Star Dust", "Radioactive Decay", "Alien Egg", "Infernal Orb", "Tardis", "Centrillion Dollar Bill", "Chocolate Bar", "+9999 Sword", "Penis", "Spaceship", "Pokeball", "Mango", "UnDeFiNeDlUlZ", "Liquid Happiness", "Machine Gun", "Trapezoid", "Rainbow", "Cheesecake", "Potion of Immortality", "Greg", "Circle", "Blue Spaceship", "Googolplex Dollar Bill", "Petrified Remains of Bahamut", "Triangle", "Pizza", "Impossible Figure", "Streaming Evil", "Balor\'s Armpit", "Magical Lizard", "Rhombus", "Solid Gold Deathstar", "Orb of Irony", "+Infinity Sword", "Octagon", "Steroids", "Last Item in the Game"];
var Monster1Array = ["Rat", "Kobold", "Goblin", "Dire Rat", "Hobgoblin", "Orc", "Gnoll", "Harpy", "Bugbear", "Centaur", "Kobold Mage", "Kobold Mage", "Ogre", "Ogre", "Orc Berzerker", "Orc Berzerker", "Minotaur", "Minotaur", "Harpy Archer", "Harpy Archer", "Goblin King", "Goblin King", "Goblin King", "Orc Shaman", "Orc Shaman", "Orc Shaman", "Hobgoblin King", "Hobgoblin King", "Hobgoblin King", "Ogre Mage", "Ogre Sorcerer", "Ogre Wizard", "Ogre Warlock", "Chimera", "Chimera"];
var Monster2Array = ["Rat", "Bat", "Spider", "Newt", "Dire Rat", "Vampire Bat", "Mole", "Centipede", "Monitor Lizard", "Green Slime", "Dire Bat", "Dire Bat", "Piercer", "Piercer", "Mind Flayer", "Mind Flayer", "Stone Golem", "Stone Golem", "Behemoth", "Behemoth", "Silver Golem", "Gold Golem", "Iron Golem", "Purple Worm", "Purple Worm", "Purple Worm", "Demon", "Demon", "Demon", "Cave Dragon", "Black Dragon", "Black Dragon", "Black Dragon", "Dungeon Lord", "Dungeon Master"];
var Monster3Array = ["Ant", "Forest Spider", "Wasp", "Snake", "Fox", "Wolf", "Bear", "Drow", "Gorilla", "Violet Fungus", "Tiger", "Tiger", "Hippogriff", "Hippogriff", "Panther", "Mountain Lion", "Owlbear", "Owlbear", "Troll", "Troll", "Unicorn", "Unicorn", "Unicorn", "Treant", "Ent", "Treant", "Jabberwock", "Jabberwock", "Jabberwock", "Green Dragon", "Green Dragon", "Rune Dragon", "Guardian Dragon", "Titan", "Titan"];
var Monster4Array = ["Fish", "Turtle", "Crab", "Mermaid", "Man-o-war", "Octopus", "Water Elemental", "Squid", "Naga", "Angler", "Sea Cat", "Sea Cat", "Shark", "Shark", "Three-Headed Hydra", "Water Demon", "Four-Headed Hydra", "Water Demon", "Elasmosaurus", "Elasmosaurus", "Couatl", "Couatl", "Couatl", "Kraken", "Kraken", "Kraken", "Water Dragon", "Sea Dragon", "Sea Dragon", "Dragon Turtle", "Dragon Turtle", "Nessie", "Dragon Turtle", "Leviathan", "Leviathan"];
var Monster5Array = ["Zombie Rat", "Zombie Kobold", "Skeleton", "Skeleton Archer", "Ghoul", "Death Skull", "Ghast", "Drougr", "Wraith", "Shadow", "Gargoyle", "Gargoyle", "Wight", "Wight", "Ghost", "Ghost", "Necromancer", "Undead Necromancer", "Phantom", "Phantom", "Revenant", "Revenant", "Revenant", "Vampire", "Vampire", "Vampire", "Flesh Golem", "Abomination", "Abomination", "Lich", "Lich", "Lich", "Lich", "Skeletal Dragon", "Zombie Dragon"];
var Monster6Array = ["Rock", "Scarab", "Camel", "Rattlesnake", "Scorpion", "Asp", "Cowboy", "Sand Elemental", "Cobra", "Gila Monster", "Mummy", "Mummy", "Scarab Swarm", "Locust Swarm", "Sphinx", "Sphinx", "Cactus Golem", "Cactus Monster", "Mummy Lord", "Mummy Lord", "Medusa", "Medusa", "Medusa", "Sandworm", "Sandworm", "Sandworm", "Sandworm", "Dune Worm", "Roc", "Roc", "Roc", "Sand Dragon", "Blue Dragon", "Blue Dragon", "Blue Dragon", "Egyptian God"];
var Monster7Array = ["Wimp", "Homunculus", "Lemure", "Lemure", "Imp", "Imp", "Water Demon", "Water Demon", "Fire Demon", "Fire Demon", "Horned Devil", "Horned Devil", "Erinys", "Erinys", "Barbed Devil", "Barbed Devil", "Vrock", "Vrock", "Marilith", "Marilith", "Hezrou", "Chain Devil", "Chain Devil", "Bone Devil", "Bone Devil", "Succubus", "Succubus", "Ice Devil", "Ice Devil", "Nalfeshnee", "Nalfeshnee", "Pit Fiend", "Pit Fiend", "Balor", "Balrog"];
var Monster8Array = ["Flame", "Flame", "Fire Wisp", "Red Ooze", "Explosive Red Ooze", "Magmin", "Charmander", "Ember Moth", "Hell Hound", "Burning Skeleton", "Fire Elemental", "Fire Elemental", "Fire Demon", "Fire Demon", "Wyvern", "Wyvern", "Magma Golem", "Magma Golem", "Pyromancer", "Fire Giant", "Fire Giant", "Salamander", "Salamander", "Salamander", "Ash Worm", "Volcano Worm", "Volcano Worm", "Phoenix", "Phoenix", "Phoenix", "Red Dragon", "Red Dragon", "Red Dragon", "Hellfire Wyrm", "Efreet", "Efreet"];
var Monster9Array = ["Alien Egg", "Alien Egg", "Alien Egg Nest", "Alien Egg Nest", "Alien Spawn", "Alien Spawn", "Alien Spawn", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien", "Alien Ship", "Alien Ship", "Alien Ship", "Alien Queen"];
var Monster10Array = ["Icicle", "Icicle", "Ice Wisp", "Snowy Ooze", "Cold Ooze", "Snowman", "Glalie", "Winter Wolf", "Cold Skeleton", "Ice Mephit", "Ice Elemental", "Ice Elemental", "Ice Golem", "Ice Golem", "Ice Demon", "Ice Demon", "Immoth", "Immoth", "Cyromancer", "Frost Salamander", "Frost Salamander", "Frost Salamander", "Frost Giant", "Frost Giant", "Frost Giant", "Snow Worm", "Frost Worm", "Frost Worm", "Cyrohydra", "Cyrohydra", "Cyrohydra", "Ice Dragon", "White Dragon", "White Dragon", "Silver Dragon", "Frostbite", "Frostbite"];
var MonstersArray = [0, Monster1Array, Monster2Array, Monster3Array, Monster4Array, Monster5Array, Monster6Array, Monster7Array, Monster8Array, Monster9Array, Monster10Array];
var MonsterModifierArray = ["Pathetic ", "Sick ", "Young ", "Sleepy ", "Preadolescent ", "", "Blue ", "Rabid ", "Bloody ", "Gory ", "Diseased ", "Naughty ", "Wealthy ", "Giant ", "Greater ", "Cruel ", "Spiked ", "Teenage ", "Two-Headed ", "Gruesome ", "Battle-", "Monstrous ", "Ravenous ", "Dark ", "Golden ", "Flaming ", "Mutant ", "Superior ", "Brutal ", "Three-Headed ", "Incredible ", "Dangerous ", "Fearsome ", "Mystic ", "Devilish ", "Really Old ", "Hellish ", "Massive ", "Dreadful ", "Diabolical ", "Demonic ", "Chaotic ", "Deceptively Evil ", "Titanic ", "Gargantuan ", "Robitic ", "Cyborg ", "Ninja ", "Supreme "];
var MonsterModifierArray2 = ["", "Blue ", "Rabid ", "Bloody ", "Gory ", "Diseased ", "Naughty ", "Wealthy ", "Giant ", "Greater ", "Cruel ", "Spiked ", "Teenage ", "Two-Headed ", "Gruesome ", "Insidious ", "Monstrous ", "Ravenous ", "Dark ", "Golden ", "Flaming ", "Mutant ", "Superior ", "Brutal ", "Three-Headed ", "Impressive ", "Dangerous ", "Fearsome ", "Enchanted ", "Devilish ", "Elder ", "Hellish ", "Massive ", "Dreadful ", "Diabolical ", "Demonic ", "Chaotic ", "Elite ", "Titanic ", "Enormous ", "Robitic ", "Cyborg ", "Ninja ", "Epic "];
var MonsterModifierArray3 = ["", "Pair of ", "Group of ", "Gang of ", "Pack of ", "Team of ", "Force of ", "Army of ", "Legion of ", "Large Army of ", "Huge Army of "];
LocationArray = [["Town", 0, 0], ["Plains", 1, 1], ["Tavern Cellar", 2, 2], ["Crystal Forest", 3, 3], ["Crystal Lake", 4, 4], ["The Graveyard", 5, 5], ["Sandy Desert", 6, 6], ["Orcish Cave", 1, 2], ["Dread Hills", 1, 1], ["Crystal River", 3, 4], ["Oasis", 3, 6], ["Dark Cave", 2, 2], ["Catacombs", 2, 5], ["Orcish Ship", 1, 4], ["Enchanted Forest", 3, 3], ["Cold Mountain", 10, 10], ["Dead Forest", 3, 5], ["Sandy Beach", 4, 6], ["Ice Cave", 10, 2], ["Ocean", 4, 4], ["Battlefield", 1, 5], ["Desert Cave", 2, 6], ["Undead Citadel", 5, 5], ["Forest Camp", 1, 3], ["Deep Sea Cave", 2, 4], ["Forgotten Desert", 6, 6], ["Ancient Pyramid", 5, 6], ["North Pole", 4, 10], ["Desert Camp", 1, 6], ["Ancient Forest Ruins", 2, 3], ["The Abyss", 4, 5], ["Demonic Fortress", 7, 8], ["Active Volcano", 2, 8], ["Chaos Valley", 1, 3], ["The Castle", 6, 7], ["Frozen Throne", 10, 5], ["Planet X", 9, 9], ["Somewhere", 1, 2], ["Planet Y", 9, 9], ["Nowhere", 5, 6], ["Planet Z", 9, 9], ["The Edge", 7, 9], ["Planet XY", 9, 9], ["Corrupted Hedge", 3, 5], ["Planet XZ", 9, 9], ["The Rainbow", 1, 2], ["Planet YZ", 9, 9], ["Avernus", 8, 7], ["Dis", 5, 8], ["Minauros", 5, 7], ["Phlegethos", 8, 7], ["Stygia", 10, 7], ["Malbolge", 2, 7], ["Maladomini", 7, 5], ["Cania", 5, 10], ["Nessus", 7, 7], ["Planet XYZ", 9, 9], ["The Silver Gazebo", 10, 3], ["The End", 9, 7], ["The End", 9, 7], ["The End", 9, 7]];
var SpellsArray = [["Enlarge Muscles", 0], ["Resistance", 0], ["Quicken", 0], ["Hypnosis", 0], ["Concentration", 0], ["Forseeing", 0], ["Fireball", 0], ["Heal", 0], ["Poison", 0], ["Ice Arrow", 0], ["Sixth Sense", 0], ["Learning", 0], ["Teleportation", 0], ["Regeneration", 0]];
var QuestPersonArray = ["barkeep", "maid", "shady person", "bearded man", "little boy", "drunk person"];
var QuestObjectArray = ["puppy", "crystal", "tire", "artifact", "trinket", "coin", "mug", "toothpick", "jar", "arm", "pancake", "trombone", "shingle", "couch", "leaf", "candy", "gear", "wrench", "scrap", "racket", "napkin", "crowbar", "lunch", "basket", "doll", "nut", "pencil", "fang", "rock", "spoon", "towel", "candle", "soap", "liver", "heart", "kidney", "cricket", "eggplant", "soup", "gristle"];
var QuestObjectDescribe = ["sacred ", "mystic ", "ancient ", "glowing ", "valuable ", "golden ", "incredible "];
_root.createEmptyMovieClip("progressBar", _root.getNextHighestDepth());
progressBar._x = 125;
progressBar._y = 300;
progressBar.createEmptyMovieClip("Bar", progressBar.getNextHighestDepth());
progressBar.Bar.lineStyle(1, 0, 0);
progressBar.Bar.beginFill(10066329);
progressBar.Bar.lineTo(0, 20);
progressBar.Bar.lineTo(300, 20);
progressBar.Bar.lineTo(300, 0);
progressBar.Bar.lineTo(0, 0);
progressBar.Bar.endFill();
progressBar.createEmptyMovieClip("Box", progressBar.getNextHighestDepth());
progressBar.Box.lineStyle(2);
progressBar.Box.lineTo(300, 0);
progressBar.Box.lineTo(300, 20);
progressBar.Box.lineTo(0, 20);
progressBar.Box.lineTo(0, 0);
progressBar.Box.endFill();
_root.createTextField("ProgressTextBox", _root.getNextHighestDepth(), -225, 298, 1000, 30);
ProgressTextBox.selectable = false;
_root.createEmptyMovieClip("questBar", _root.getNextHighestDepth());
questBar._x = 175;
questBar._y = 330;
questBar.createEmptyMovieClip("Bar", questBar.getNextHighestDepth());
questBar.Bar.lineStyle(1, 0, 0);
questBar.Bar.beginFill(16744192);
questBar.Bar.lineTo(0, 20);
questBar.Bar.lineTo(200, 20);
questBar.Bar.lineTo(200, 0);
questBar.Bar.lineTo(0, 0);
questBar.Bar.endFill();
questBar.createEmptyMovieClip("Box", questBar.getNextHighestDepth());
questBar.Box.lineStyle(2);
questBar.Box.lineTo(200, 0);
questBar.Box.lineTo(200, 20);
questBar.Box.lineTo(0, 20);
questBar.Box.lineTo(0, 0);
questBar.Box.endFill();
_root.createTextField("QuestTextBox", _root.getNextHighestDepth(), -225, 328, 1000, 30);
QuestTextBox.selectable = false;
_root.createEmptyMovieClip("expBar", _root.getNextHighestDepth());
expBar._x = 150;
expBar._y = 375;
expBar.createEmptyMovieClip("Bar", expBar.getNextHighestDepth());
expBar.Bar.lineStyle(1, 0, 0);
expBar.Bar.beginFill(65535);
expBar.Bar.lineTo(0, 20);
expBar.Bar.lineTo(250, 20);
expBar.Bar.lineTo(250, 0);
expBar.Bar.lineTo(0, 0);
expBar.Bar.endFill();
expBar.createEmptyMovieClip("Box", expBar.getNextHighestDepth());
expBar.Box.lineStyle(2);
expBar.Box.lineTo(250, 0);
expBar.Box.lineTo(250, 20);
expBar.Box.lineTo(0, 20);
expBar.Box.lineTo(0, 0);
expBar.Box.endFill();
_root.createTextField("ExpTextBox", _root.getNextHighestDepth(), -225, 373, 1000, 30);
ExpTextBox.selectable = false;
_root.createEmptyMovieClip("healthBar", _root.getNextHighestDepth());
healthBar._x = 75;
healthBar._y = 250;
healthBar.createEmptyMovieClip("Bar", healthBar.getNextHighestDepth());
healthBar.Bar.lineStyle(1, 0, 0);
healthBar.Bar.beginFill(65280);
healthBar.Bar.lineTo(0, 20);
healthBar.Bar.lineTo(100, 20);
healthBar.Bar.lineTo(100, 0);
healthBar.Bar.lineTo(0, 0);
healthBar.Bar.endFill();
healthBar.createEmptyMovieClip("Box", healthBar.getNextHighestDepth());
healthBar.Box.lineStyle(2, 30464);
healthBar.Box.lineTo(100, 0);
healthBar.Box.lineTo(100, 20);
healthBar.Box.lineTo(0, 20);
healthBar.Box.lineTo(0, 0);
healthBar.Box.endFill();
healthBar._alpha = 0;
_root.createTextField("HealthTextBox", _root.getNextHighestDepth(), 75, 248, 100, 30);
HealthTextBox.selectable = false;
_root.createEmptyMovieClip("manaBar", _root.getNextHighestDepth());
manaBar._x = 75;
manaBar._y = 275;
manaBar.createEmptyMovieClip("Bar", manaBar.getNextHighestDepth());
manaBar.Bar.lineStyle(1, 119, 0);
manaBar.Bar.beginFill(1118719);
manaBar.Bar.lineTo(0, 20);
manaBar.Bar.lineTo(100, 20);
manaBar.Bar.lineTo(100, 0);
manaBar.Bar.lineTo(0, 0);
manaBar.Bar.endFill();
manaBar.createEmptyMovieClip("Box", manaBar.getNextHighestDepth());
manaBar.Box.lineStyle(2, 119);
manaBar.Box.lineTo(100, 0);
manaBar.Box.lineTo(100, 20);
manaBar.Box.lineTo(0, 20);
manaBar.Box.lineTo(0, 0);
manaBar.Box.endFill();
manaBar._alpha = 0;
_root.createTextField("ManaTextBox", _root.getNextHighestDepth(), 75, 273, 100, 30);
ManaTextBox.selectable = false;
_root.createEmptyMovieClip("enemyHealthBar", _root.getNextHighestDepth());
enemyHealthBar._x = 375;
enemyHealthBar._y = 250;
enemyHealthBar.createEmptyMovieClip("Bar", enemyHealthBar.getNextHighestDepth());
enemyHealthBar.Bar.lineStyle(1, 0, 0);
enemyHealthBar.Bar.beginFill(65280);
enemyHealthBar.Bar.lineTo(0, 20);
enemyHealthBar.Bar.lineTo(100, 20);
enemyHealthBar.Bar.lineTo(100, 0);
enemyHealthBar.Bar.lineTo(0, 0);
enemyHealthBar.Bar.endFill();
enemyHealthBar.createEmptyMovieClip("Box", enemyHealthBar.getNextHighestDepth());
enemyHealthBar.Box.lineStyle(2, 30464);
enemyHealthBar.Box.lineTo(100, 0);
enemyHealthBar.Box.lineTo(100, 20);
enemyHealthBar.Box.lineTo(0, 20);
enemyHealthBar.Box.lineTo(0, 0);
enemyHealthBar.Box.endFill();
enemyHealthBar._alpha = 0;
_root.createTextField("EnemyHealthTextBox", _root.getNextHighestDepth(), 375, 248, 100, 30);
EnemyHealthTextBox.selectable = false;
_root.createEmptyMovieClip("enemyManaBar", _root.getNextHighestDepth());
enemyManaBar._x = 375;
enemyManaBar._y = 275;
enemyManaBar.createEmptyMovieClip("Bar", enemyManaBar.getNextHighestDepth());
enemyManaBar.Bar.lineStyle(1, 119, 0);
enemyManaBar.Bar.beginFill(1118719);
enemyManaBar.Bar.lineTo(0, 20);
enemyManaBar.Bar.lineTo(100, 20);
enemyManaBar.Bar.lineTo(100, 0);
enemyManaBar.Bar.lineTo(0, 0);
enemyManaBar.Bar.endFill();
enemyManaBar.createEmptyMovieClip("Box", enemyManaBar.getNextHighestDepth());
enemyManaBar.Box.lineStyle(2, 119);
enemyManaBar.Box.lineTo(100, 0);
enemyManaBar.Box.lineTo(100, 20);
enemyManaBar.Box.lineTo(0, 20);
enemyManaBar.Box.lineTo(0, 0);
enemyManaBar.Box.endFill();
enemyManaBar._alpha = 0;
_root.createTextField("EnemyManaTextBox", _root.getNextHighestDepth(), 375, 273, 100, 30);
EnemyManaTextBox.selectable = false;
_root.createEmptyMovieClip("enemyBar", _root.getNextHighestDepth());
enemyBar._x = 180;
enemyBar._y = 275;
enemyBar.createEmptyMovieClip("Bar", enemyBar.getNextHighestDepth());
enemyBar.Bar.lineStyle(1, 0, 0);
enemyBar.Bar.beginFill(11241608);
enemyBar.Bar.lineTo(0, 20);
enemyBar.Bar.lineTo(190, 20);
enemyBar.Bar.lineTo(190, 0);
enemyBar.Bar.lineTo(0, 0);
enemyBar.Bar.endFill();
enemyBar.createEmptyMovieClip("Box", enemyBar.getNextHighestDepth());
enemyBar.Box.lineStyle(2);
enemyBar.Box.lineTo(190, 0);
enemyBar.Box.lineTo(190, 20);
enemyBar.Box.lineTo(0, 20);
enemyBar.Box.lineTo(0, 0);
enemyBar.Box.endFill();
enemyBar._alpha = 0;
_root.createTextField("EnemyTextBox", _root.getNextHighestDepth(), -225, 328, 1000, 30);
EnemyTextBox.selectable = false;
var spellFormat = new TextFormat();
spellFormat.align = "right";
spellFormat.color = 4194304;
spellFormat.size = 12;
var rewardFormat = new TextFormat();
rewardFormat.align = "center";
rewardFormat.color = 11579392;
rewardFormat.size = 16;
var progressFormat = new TextFormat();
progressFormat.size = 16;
progressFormat.align = "center";
var biggerFormat = new TextFormat();
biggerFormat.size = 20;
biggerFormat.align = "center";
_root.createTextField("TitleText", _root.getNextHighestDepth(), 0, 0, 1000, 20);
TitleText.selectable = false;
_root.createTextField("StrText", _root.getNextHighestDepth(), 0, 28, 1000, 20);
StrText.selectable = false;
_root.createTextField("ConText", _root.getNextHighestDepth(), 0, 42, 1000, 20);
ConText.selectable = false;
_root.createTextField("DexText", _root.getNextHighestDepth(), 0, 56, 1000, 20);
DexText.selectable = false;
_root.createTextField("ChaText", _root.getNextHighestDepth(), 0, 70, 1000, 20);
ChaText.selectable = false;
_root.createTextField("IntText", _root.getNextHighestDepth(), 0, 84, 1000, 20);
IntText.selectable = false;
_root.createTextField("WisText", _root.getNextHighestDepth(), 0, 98, 1000, 20);
WisText.selectable = false;
_root.createTextField("HealthText", _root.getNextHighestDepth(), 0, 112, 1000, 20);
HealthText.selectable = false;
_root.createTextField("ManaText", _root.getNextHighestDepth(), 0, 126, 1000, 20);
ManaText.selectable = false;
_root.createTextField("GoldText", _root.getNextHighestDepth(), 0, 154, 1000, 20);
GoldText.selectable = false;
_root.createTextField("WeaponText", _root.getNextHighestDepth(), 0, 182, 1000, 20);
WeaponText.selectable = false;
_root.createTextField("ArmorText", _root.getNextHighestDepth(), 0, 196, 1000, 20);
ArmorText.selectable = false;
_root.createTextField("ExtraText", _root.getNextHighestDepth(), 0, 210, 1000, 20);
ExtraText.selectable = false;
_root.createTextField("LocationText", _root.getNextHighestDepth(), 0, 378, 1000, 20);
LocationText.selectable = false;
_root.createTextField("QuestText", _root.getNextHighestDepth(), 0, 350, 1000, 20);
QuestText.selectable = false;
_root.createTextField("EnemyText", _root.getNextHighestDepth(), -225, 220, 1000, 40);
EnemyText.selectable = false;
_root.createEmptyMovieClip("SpellText", _root.getNextHighestDepth());
SpellText._x = 550;
SpellText.Spells = new Array();
SpellText.Spells = [SpellText.createTextField("SpellTitle", SpellText.getNextHighestDepth(), -1000, 0, 1000, 20), SpellText.createTextField("SpellText1", SpellText.getNextHighestDepth(), -1000, 14, 1000, 20), SpellText.createTextField("SpellText2", SpellText.getNextHighestDepth(), -1000, 28, 1000, 20), SpellText.createTextField("SpellText3", SpellText.getNextHighestDepth(), -1000, 42, 1000, 20), SpellText.createTextField("SpellText4", SpellText.getNextHighestDepth(), -1000, 56, 1000, 20), SpellText.createTextField("SpellText5", SpellText.getNextHighestDepth(), -1000, 70, 1000, 20), SpellText.createTextField("SpellText6", SpellText.getNextHighestDepth(), -1000, 84, 1000, 20), SpellText.createTextField("SpellText7", SpellText.getNextHighestDepth(), -1000, 98, 1000, 20), SpellText.createTextField("SpellText8", SpellText.getNextHighestDepth(), -1000, 112, 1000, 20)];
for (i = 0; i <= 8; i++) {
    SpellText.Spells[i].selectable = false;
}
SpellText.Spells[0].text = "Spells:  ";
SpellText.Spells[0].setTextFormat(spellFormat);
_root.createEmptyMovieClip("InventoryText", _root.getNextHighestDepth());
InventoryText._x = 550;
InventoryText.Inventory = new Array();
InventoryText.Inventory = [InventoryText.createTextField("ItemTitle", InventoryText.getNextHighestDepth(), -1000, 140, 1000, 20), InventoryText.createTextField("ItemText1", InventoryText.getNextHighestDepth(), -1000, 154, 1000, 20), InventoryText.createTextField("ItemText2", InventoryText.getNextHighestDepth(), -1000, 168, 1000, 20), InventoryText.createTextField("ItemText3", InventoryText.getNextHighestDepth(), -1000, 182, 1000, 20), InventoryText.createTextField("ItemText4", InventoryText.getNextHighestDepth(), -1000, 196, 1000, 20), InventoryText.createTextField("ItemText5", InventoryText.getNextHighestDepth(), -1000, 210, 1000, 20)];
for (i = 0; i < 5; i++) {
    InventoryText.Inventory[i].selectable = false;
}
InventoryText.Inventory[0].text = "Inventory:  ";
InventoryText.Inventory[0].setTextFormat(spellFormat);
_root.createTextField("DodgeText1", _root.getNextHighestDepth(), 50, 300, 75, 40);
DodgeText1.selectable = false;
_root.createTextField("DodgeText2", _root.getNextHighestDepth(), 425, 300, 75, 40);
DodgeText2.selectable = false;
_root.createEmptyMovieClip("RewardText", _root.getNextHighestDepth());
RewardText._x = 275;
RewardText._y = 120;
RewardText.createTextField("textBox1", RewardText.getNextHighestDepth(), -500, 0, 1000, 40);
RewardText.textBox1.selectable = false;
RewardText.createTextField("textBox2", RewardText.getNextHighestDepth(), -500, 20, 1000, 40);
RewardText.textBox2.selectable = false;
RewardText.createTextField("textBox3", RewardText.getNextHighestDepth(), -500, 40, 1000, 40);
RewardText.textBox3.selectable = false;
RewardText.createTextField("textBox4", RewardText.getNextHighestDepth(), -500, 60, 1000, 40);
RewardText.textBox4.selectable = false;
RewardText._visible = false;
RewardTimer = 0;
var ones_numerals = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
var tens_numerals = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"];
var hundreds_numerals = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"];
var thousands_numerals = ["", "M", "MM", "MMM", "MMMM", "MMMMM", "MMMMMM", "MMMMMMM", "MMMMMMMM", "MMMMMMMMM"];
var savefile = SharedObject.getLocal("Idepic");
Traveling = false;
searching = false;
DodgeTimer1 = 0;
DodgeTimer2 = 0;
enemySlow = false;
enemyPoison = false;
attack = "none";
var menu = ["New Character (Ladder v1.7)", "Load Character", "", ""];
currentMenu = "Main";
drawMenu = true;
action = 100;
_root.createEmptyMovieClip("menuButtons", _root.getNextHighestDepth());
menuButtons._x = 175;
menuButtons._y = 200;
ccbd = false;
buttons = [[menuButtons.createTextField("menuButton1Text", menuButtons.getNextHighestDepth(), 0, 0, 200, 100), menuButtons.createEmptyMovieClip("menuButtonCover1", menuButtons.getNextHighestDepth()), menuButtons.createEmptyMovieClip("menuButton1", menuButtons.getNextHighestDepth())], [menuButtons.createTextField("menuButton2Text", menuButtons.getNextHighestDepth(), 0, 40, 200, 100), menuButtons.createEmptyMovieClip("menuButtonCover2", menuButtons.getNextHighestDepth()), menuButtons.createEmptyMovieClip("menuButton2", menuButtons.getNextHighestDepth())], [menuButtons.createTextField("menuButton3Text", menuButtons.getNextHighestDepth(), 0, 80, 200, 100), menuButtons.createEmptyMovieClip("menuButtonCover3", menuButtons.getNextHighestDepth()), menuButtons.createEmptyMovieClip("menuButton3", menuButtons.getNextHighestDepth())], [menuButtons.createTextField("menuButton4Text", menuButtons.getNextHighestDepth(), 0, 120, 200, 100), menuButtons.createEmptyMovieClip("menuButtonCover4", menuButtons.getNextHighestDepth()), menuButtons.createEmptyMovieClip("menuButton4", menuButtons.getNextHighestDepth())]];
for (i = 0; i <= 3; i++) {
    buttons[i][2]._x = 0;
    buttons[i][2]._y = 40 * i;
    buttons[i][2].lineStyle(2);
    buttons[i][2].beginFill(11184810, 100);
    buttons[i][2].lineTo(200, 0);
    buttons[i][2].lineTo(200, 40);
    buttons[i][2].lineTo(0, 40);
    buttons[i][2].lineTo(0, 0);
    buttons[i][2].endFill();
    buttons[i][1]._x = 0;
    buttons[i][1]._y = 40 * i;
    buttons[i][1].lineStyle(2);
    buttons[i][1].beginFill(10066329, 100);
    buttons[i][1].lineTo(200, 0);
    buttons[i][1].lineTo(200, 40);
    buttons[i][1].lineTo(0, 40);
    buttons[i][1].lineTo(0, 0);
    buttons[i][1].endFill();
    buttons[i][0].selectable = false;
}
Screen = "Menu";
buttons[2][1]._x = -1000;
buttons[2][2]._x = -1000;
buttons[3][1]._x = -1000;
buttons[3][2]._x = -1000;
onEnterFrame = function () {
    if (Screen == "Playing") {
        ++manaTimer;
        if (manaTimer >= 20) {
            manaTimer = 0;
            Mana = Mana + (1 + Math.round(ManaMax / 50));
            if (Mana > ManaMax) {
                Mana = ManaMax;
            }
        }
        regenTimer = regenTimer + 1;
        if (regenTimer > 33 && fighting == true) {
            Health = Health + SpellsArray[13][1];
            regenTimer = 0;
            if (Health > HealthMax) {
                Health = HealthMax;
            }
        }
        poisonTimer = poisonTimer + 1;
        if (poisonTimer > 15) {
            poisonTimer = 0;
            if (enemyPoison == true && fighting == true) {
                enemyHealth = enemyHealth - SpellsArray[8][1];
            }
        }
        DodgeTimer2 = DodgeTimer2 - 1;
        if (DodgeTimer2 < 1) {
            DodgeText2.text = "";
        }
        DodgeTimer1 = DodgeTimer1 - 1;
        if (DodgeTimer1 < 1) {
            DodgeText1.text = "";
        }
        RewardTimer = RewardTimer - 1;
        RewardText.textBox1.text = rewardType;
        if (itemLoot2 != 4) {
            RewardText.textBox2.text = itemsArray[currentLocation + itemLoot2];
        }
        else {
            RewardText.textBox2.text = "";
        }
        if (itemLoot2 == 5) {
            RewardText.textBox2.text = goldLoot + " Gold";
        }
        RewardText.textBox3.text = Capitalize(itemLoot);
        RewardText.textBox4.text = "You got " + expGain + " exp.";
        RewardText.textBox1.setTextFormat(rewardFormat);
        RewardText.textBox2.setTextFormat(rewardFormat);
        RewardText.textBox3.setTextFormat(rewardFormat);
        RewardText.textBox4.setTextFormat(rewardFormat);
        if (RewardTimer < 0) {
            RewardText._visible = false;
        }
        else {
            RewardText._visible = true;
        }
        TitleText.text = characterName + " The Level " + Level + " " + characterRace + " " + characterClass;
        StrText.text = "Str: " + (Str + StrMod);
        ConText.text = "Con: " + (Con + ConMod);
        DexText.text = "Dex: " + (Dex + DexMod);
        ChaText.text = "Cha: " + (Cha + ChaMod);
        IntText.text = "Int: " + (Int + IntMod);
        WisText.text = "Wis: " + (Wis + WisMod);
        if (StrMod > 0) {
            StrText.text = StrText.text + (" (+" + StrMod + ")");
        }
        if (ConMod > 0) {
            ConText.text = ConText.text + (" (+" + ConMod + ")");
        }
        if (DexMod > 0) {
            DexText.text = DexText.text + (" (+" + DexMod + ")");
        }
        if (ChaMod > 0) {
            ChaText.text = ChaText.text + (" (+" + ChaMod + ")");
        }
        if (IntMod > 0) {
            IntText.text = IntText.text + (" (+" + IntMod + ")");
        }
        if (WisMod > 0) {
            WisText.text = WisText.text + (" (+" + WisMod + ")");
        }
        HealthText.text = "Health: " + HealthMax;
        ManaText.text = "Mana: " + ManaMax;
        GoldText.text = "Gold: " + Gold;
        if (characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Rogue") {
            if (WeaponModifierNumber > 0) {
                WeaponText.text = "Weapon: +" + WeaponModifierNumber + " " + Capitalize(rangedWeaponModifier[WeaponModifier] + rangedWeaponArray[Weapon]);
            }
            else {
                WeaponText.text = "Weapon: " + Capitalize(rangedWeaponModifier[WeaponModifier] + rangedWeaponArray[Weapon]);
            }
        }
        else if (WeaponModifierNumber > 0) {
            WeaponText.text = "Weapon: +" + WeaponModifierNumber + " " + Capitalize(meleeWeaponModifier[WeaponModifier] + meleeWeaponArray[Weapon]);
        }
        else {
            WeaponText.text = "Weapon: " + Capitalize(meleeWeaponModifier[WeaponModifier] + meleeWeaponArray[Weapon]);
        }
        if (Weapon == 0) {
            WeaponText.text = "Weapon: None";
        }
        if (ArmorModifierNumber > 0) {
            ArmorText.text = "Armor: +" + ArmorModifierNumber + " " + Capitalize(armorModifierArray[ArmorModifier] + armorArray[Armor]);
        }
        else {
            ArmorText.text = "Armor: " + Capitalize(armorModifierArray[ArmorModifier] + armorArray[Armor]);
        }
        if (Armor == 0) {
            ArmorText.text = "Armor: None";
        }
        if (characterClass == "Wizard" || characterClass == "Priest" || characterClass == "Necromancer") {
            if (Extra == 0) {
                ExtraText.text = "Spellbook: None";
            }
            else {
                ExtraText.text = "Spellbook: " + Capitalize(spellbookModifier2[ExtraModifier2] + spellbookModifier[ExtraModifier] + spellbookArray[Extra]);
            }
        }
        if (characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Knight" || characterClass == "Paladin") {
            if (Extra == 0) {
                ExtraText.text = "Mount: None";
            }
            else {
                ExtraText.text = "Mount: " + Capitalize(mountModifier2[ExtraModifier2] + mountModifier[ExtraModifier] + mountArray[Extra]);
            }
        }
        if (characterClass == "Bard") {
            if (Extra == 0) {
                ExtraText.text = "Instrument: None";
            }
            else {
                ExtraText.text = "Instrument: " + Capitalize(instrumentModifier2[ExtraModifier2] + instrumentModifier[ExtraModifier] + instrumentArray[Extra]);
            }
        }
        if (characterClass == "Ranger" || characterClass == "Rogue" || characterClass == "Archeologist") {
            if (Extra == 0) {
                ExtraText.text = "Ammo: None";
            }
            else if (ammoModifier2 > 0) {
                ExtraText.text = "Ammo: +" + ExtraModifier2 + " " + Capitalize(ammoModifier2[ExtraModifier] + ammoModifier[Extra] + ammoArray[Weapon]);
            }
            else {
                ExtraText.text = "Missile: " + Capitalize(ammoModifier2[ExtraModifier] + ammoModifier[Extra] + ammoArray[Weapon]);
            }
        }
        LocationText.text = "Location: " + LocationArray[currentLocation][0];
        if (currentLocation == 5.000000E-01) {
            LocationText.text = "Location: Old Man\'s Cottage";
        }
        if (questType == "boss") {
            QuestText.text = "Quest: Kill the Boss " + MonstersArray[LocationArray[QuestLocation][qmonSubLoc]][questTarget] + ".";
        }
        else if (questType == "find") {
            QuestText.text = "Quest: Find the " + questTarget + ".";
        }
        else if (questType == "deliver") {
            QuestText.text = "Quest: Deliver the " + questTarget + ".";
        }
        else if (questType == "kill") {
            QuestText.text = "Quest: Kill " + questEnd + " " + Pluralize(MonstersArray[LocationArray[QuestLocation][qmonSubLoc]][questTarget]) + ".";
        }
        else if (questType == "collect") {
            QuestText.text = "Quest: Collect " + questEnd + " " + Pluralize(questTarget) + ".";
        }
        else {
            QuestText.text = "Quest: None";
        }
        if (fighting == true) {
            if (Modifier4 > 0) {
                endOfMonsterText = Pluralize(MonstersArray[LocationArray[currentLocation][monSubLoc]][Monster]);
            }
            else {
                endOfMonsterText = MonstersArray[LocationArray[currentLocation][monSubLoc]][Monster];
            }
            EnemyText.text = "You\'re fighting " + Article(MonsterModifierArray3[Modifier4] + MonsterModifierArray[Modifier1] + MonsterModifierArray2[Modifier2] + MonsterModifierArray2[Modifier3] + endOfMonsterText);
            if (boss == true) {
                EnemyText.text = EnemyText.text + " Boss";
            }
            EnemyText.setTextFormat(progressFormat);
        }
        else {
            EnemyText.text = "";
        }
        if (Traveling == true) {
            LocationText.text = "Traveling";
        }
        progressBar.Bar._width = ProgressNow / ProgressEnd * 300;
        ProgressTextBox.text = progressText;
        if (searching == true) {
            if (questType == "find") {
                ProgressTextBox.text = "Searching";
            }
            else {
                ProgressTextBox.text = "Delivering";
            }
            progressBar.Bar._width = 300;
        }
        ProgressTextBox.setTextFormat(progressFormat);
        if (questType == "deliver" || questType == "find") {
            i = Math.round(questCompletion / questEnd * 100);
            QuestTextBox.text = i + "%";
        }
        else {
            QuestTextBox.text = questCompletion + "/" + questEnd;
        }
        questBar.Bar._width = questCompletion / questEnd * 200;
        QuestTextBox.setTextFormat(progressFormat);
        if (questType == "none") {
            QuestTextBox.text = "";
            questBar._alpha = 0;
        }
        else {
            questBar._alpha = 100;
        }
        expBar.Bar._width = Exp / ExpLevel * 250;
        i = Math.round(Exp / ExpLevel * 100);
        ExpTextBox.text = Exp + "/" + ExpLevel + " Exp (" + i + "%)";
        ExpTextBox.setTextFormat(progressFormat);
        if (fighting == true) {
            healthBar.Bar._width = Health / HealthMax * 100;
            HealthTextBox.text = Health + "/" + HealthMax;
            HealthTextBox.setTextFormat(progressFormat);
            manaBar.Bar._width = Mana / ManaMax * 100;
            ManaTextBox.text = Mana + "/" + ManaMax;
            ManaTextBox.setTextFormat(progressFormat);
            enemyHealthBar.Bar._width = enemyHealth / enemyHealthMax * 100;
            EnemyHealthTextBox.text = enemyHealth + "/" + enemyHealthMax;
            EnemyHealthTextBox.setTextFormat(progressFormat);
            enemyManaBar.Bar._width = enemyMana / enemyManaMax * 100;
            EnemyManaTextBox.text = enemyMana + "/" + enemyManaMax;
            EnemyManaTextBox.setTextFormat(progressFormat);
            enemyBar.Bar._width = EnemyProgressNow / (enemySpeed + 1) * 190;
            enemyBar._alpha = 100;
        }
        else {
            HealthTextBox.text = "";
            ManaTextBox.text = "";
            EnemyHealthTextBox.text = "";
            EnemyManaTextBox.text = "";
            enemyBar._alpha = 0;
        }
        if (Exp >= ExpLevel) {
            Exp = Exp - ExpLevel;
            Level = Level + 1;
            SkillLevel = SkillLevel + 1;
            ExpLevel = ExpLevel * 3;
            StrEx = StrEx * StrUp;
            ConEx = ConEx * ConUp;
            DexEx = DexEx * DexUp;
            ChaEx = ChaEx * ChaUp;
            IntEx = IntEx * IntUp;
            WisEx = WisEx * WisUp;
            lastInt = Int;
            Str = Math.round(StrEx);
            Con = Math.round(ConEx);
            Dex = Math.round(DexEx);
            Cha = Math.round(ChaEx);
            Int = Math.round(IntEx);
            Wis = Math.round(WisEx);
            totalSpells = Int - lastInt;
            i99 = 0;
            spellIncriment = Math.ceil(totalSpells / 20);
            if (spellIncriment != 0) {
                while (i99 < totalSpells) {
                    obtainSpell(spellIncriment);
                    i99 = i99 + spellIncriment;
                }
            }
            if (characterClass == "Knight" || characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Paladin") {
                HealthMax = 8 + (Con + ConMod) * 3 + Extra + ExtraModifier + ExtraModifier2;
            }
            else {
                HealthMax = 8 + (Con + ConMod) * 3;
            }
            ManaMax = Math.floor(4 + (Wis + WisMod) * 1.500000E+00);
            Save(currentSaveFile, "Level");
        }
        ProgressNow = ProgressNow + 1;
        if (ProgressNow > ProgressEnd) {
            NextProgress = true;
            if (Selling == true) {
                if (subLocation == "sell1") {
                    Gold = Gold + Math.round(Math.pow(inventoryArray[0][0] * inventoryArray[0][1], 1 + inventoryArray[0][0] * inventoryArray[0][1] * 1.000000E-05));
                    inventoryArray[0][0] = 0;
                }
                if (subLocation == "sell2") {
                    Gold = Gold + Math.round(Math.pow(inventoryArray[1][0] * inventoryArray[1][1], 1 + inventoryArray[1][0] * inventoryArray[1][1] * 1.000000E-04));
                    inventoryArray[1][0] = 0;
                }
                if (subLocation == "sell3") {
                    Gold = Gold + Math.round(Math.pow(inventoryArray[2][0] * inventoryArray[2][1], 1 + inventoryArray[2][0] * inventoryArray[2][1] * 1.000000E-04));
                    inventoryArray[2][0] = 0;
                }
                if (subLocation == "sell4") {
                    Gold = Gold + Math.round(Math.pow(inventoryArray[3][0] * inventoryArray[3][1], 1 + inventoryArray[3][0] * inventoryArray[3][1] * 1.000000E-04));
                    inventoryArray[3][0] = 0;
                }
                if (subLocation == "shop0") {
                    Gold = Gold + Math.round(Math.pow(inventoryArray[4][0] * inventoryArray[4][1], 1 + inventoryArray[4][0] * inventoryArray[4][1] * 1.000000E-04));
                    inventoryArray[4][0] = 0;
                }
                Save(currentSaveFile, "Sell");
                displayItems();
            }
            Selling = false;
            Save(currentSaveFile, "Travel");
            currentLocation = travelingTo;
            if (subLocation == "shop2") {
                Gold = Gold - weaponCost;
                Weapon = purchaseableWeapon;
                WeaponModifier = purchaseableWeaponModifier;
                WeaponModifierNumber = purchaseableWeaponModifierNumber;
                Save(currentSaveFile, "Shopping");
            }
            if (subLocation == "shop2.7") {
                Gold = Gold - armorCost;
                Armor = purchaseableArmor;
                ArmorModifier = purchaseableArmorModifier;
                ArmorModifierNumber = purchaseableArmorModifierNumber;
                Save(currentSaveFile, "Shopping");
            }
            if (subLocation == "shop3") {
                Gold = Gold - extraCost;
                if (characterClass == "Wizard" || characterClass == "Necromancer" || characterClass == "Priest") {
                    for (i99 = 0; i99 < purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2); i99++) {
                        obtainSpell(1);
                    }
                }
                if (characterClass == "Bard") {
                    ChaMod = ChaMod + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2));
                    obtainSpell(1);
                }
                if (characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Knight" || characterClass == "Paladin") {
                    i99 = 0;
                    if (i99 < purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2)) {
                        ConMod = ConMod + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2));
                        StrMod = StrMod + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2));
                    }
                }
                if (characterClass == "Ranger" || characterClass == "Rogue" || characterClass == "Archeologist") {
                    DexMod = DexMod + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2 - (Extra + ExtraModifier + ExtraModifier2));
                }
                Extra = purchaseableExtra;
                ExtraModifier = purchaseableExtraModifier;
                ExtraModifier2 = purchaseableExtraModifier2;
                Save(currentSaveFile, "Shopping");
                Save(currentSaveFile, "Level");
            }
            if (fighting == true) {
                Save(currentSaveFile, "Combat");
                if (attack == "attack") {
                    attack = "none";
                    dodgeLevel = Math.pow(9.700000E-01, MonsterLevel / (Dex + DexMod) * 10);
                    if (dodgeLevel < 5.000000E-02) {
                        dodgeLevel = 5.000000E-02;
                        trace ("-y");
                    }
                    if (dodgeLevel > 9.500000E-01) {
                        dodgeLevel = 9.500000E-01;
                        trace ("+y");
                    }
                    if (Math.random() > dodgeLevel) {
                        DodgeText2.text = "Dodge";
                        DodgeText2.setTextFormat(progressFormat);
                        DodgeTimer2 = 10;
                    }
                    else {
                        enemyHealth = enemyHealth - Math.round(((Str + StrMod) * 2 + Weapon + WeaponModifier + WeaponModifierNumber) / 2);
                    }
                }
                if (attack == "fireball") {
                    attack = "none";
                    Mana = Mana - (5 + SpellsArray[6][1]);
                    enemyHealth = enemyHealth - (SpellsArray[6][1] * 10 + SpellsArray[4][1] * 2);
                }
                if (attack == "poison") {
                    attack = "none";
                    Mana = Mana - (5 + SpellsArray[8][1]);
                    enemyHealth = enemyHealth - (SpellsArray[8][1] * 2 + SpellsArray[4][1]);
                    enemyPoison = true;
                    poisonTimer = 0;
                }
                if (attack == "ice") {
                    attack = "none";
                    i2 = 28 + 14 * Math.pow(9.000000E-01, SpellsArray[9][1]) * -1;
                    trace ("Spell Level is " + SpellsArray[9][1] + " and final result is " + i2);
                    enemySpeed = i2;
                    enemySlow = true;
                    Mana = Mana - (5 + SpellsArray[9][1]);
                    enemyHealth = enemyHealth - (SpellsArray[9][1] * 2 + SpellsArray[4][1]);
                }
                if (attack == "heal") {
                    attack = "none";
                    Mana = Mana - (5 + SpellsArray[7][1]);
                    Health = Health + (SpellsArray[7][1] * 2 + Math.round(SpellsArray[4][1] * 4.000000E-01));
                    if (Health > HealthMax) {
                        Health = HealthMax;
                    }
                }
            }
        }
        if (searching == true) {
            questCompletion = questCompletion + 1;
            if (questCompletion >= questEnd) {
                questCompletion = questEnd;
                travelTo(0);
                subLocation = "none";
                searching = false;
            }
            else if (Math.random() < 6.000000E-02) {
                searching = false;
                ProgressNow = 0;
                beginBattle();
            }
        }
        if (NextProgress == true) {
            kongregate.stats.submit("Level", Level);
            NextProgress = false;
            Traveling = false;
            if (fighting == true) {
                if (enemyHealth <= 0) {
                    Kill();
                }
                if (questCompletion >= questEnd && boss == false) {
                    if (questType == "boss") {
                        if (boss == false && bossend == false) {
                            boss = true;
                            beginBattle();
                        }
                    }
                    else {
                        travelTo(0);
                        subLocation = "none";
                    }
                }
                else {
                    if (Math.random() < 8.000000E-01 && SpellsArray[7][1] * 2 + Math.round(SpellsArray[4][1] * 4.000000E-01) >= HealthMax / 8 && Mana > 4 + SpellsArray[7][1] && Health <= HealthMax / 2 && SpellsArray[7][1] > 0) {
                        Progress("Heal", 12);
                        attack = "heal";
                    }
                    else if (Math.random() < 7.000000E-01 && SpellsArray[9][1] * 10 + SpellsArray[4][1] * 2 > Math.round(((Str + StrMod) * 2 + Weapon + WeaponModifier + WeaponModifierNumber) / 2 * Math.pow(9.800000E-01, MonsterLevel / (Dex + DexMod) * 10)) && Mana > 4 + SpellsArray[9][1] && enemySlow == false && SpellsArray[9][1] > 0) {
                        Progress("Ice Arrow", 12);
                        attack = "ice";
                    }
                    else if (Math.random() < 8.000000E-01 && SpellsArray[8][1] * 10 + SpellsArray[4][1] * 2 > Math.round(((Str + StrMod) * 2 + Weapon + WeaponModifier + WeaponModifierNumber) / 2 * Math.pow(9.800000E-01, MonsterLevel / (Dex + DexMod) * 10)) && Mana > 4 + SpellsArray[8][1] && enemyPoison == false && SpellsArray[8][1] > 0) {
                        Progress("Poison", 12);
                        attack = "poison";
                    }
                    else if (Math.random() < 9.000000E-01 && SpellsArray[6][1] * 10 + SpellsArray[4][1] * 2 > Math.round(((Str + StrMod) * 2 + Weapon + WeaponModifier + WeaponModifierNumber) / 2 * Math.pow(9.800000E-01, MonsterLevel / (Dex + DexMod) * 10)) && Mana > 4 + SpellsArray[6][1] && SpellsArray[6][1] > 0) {
                        Progress("Fireball", 12);
                        attack = "fireball";
                    }
                    else {
                        Progress("Attacking", 10);
                        attack = "attack";
                    }
                    Save(currentSaveFile, "Combat");
                }
            }
            if (currentLocation > 5.000000E-01 && fighting == false && searching == false && Traveling == false && boss == false && bossend == false && questCompletion < questEnd) {
                if (questType == "boss" || questType == "collect" || questType == "kill") {
                    beginBattle();
                }
                if (questType == "deliver" || questType == "find") {
                    searching = true;
                }
            }
            if (currentLocation == 0 && subLocation == "shop3") {
                travelTo(QuestLocation);
                Save(currentSaveFile, "Travel");
                subLocation = "none1";
            }
            if (currentLocation == 0 && (subLocation == "shop2.6" || subLocation == "shop2.7")) {
                if (extraCost <= Gold) {
                    if (characterClass == "Wizard" || characterClass == "Priest" || characterClass == "Necromancer") {
                        Progress("Purchasing " + Article(spellbookModifier2[purchaseableExtraModifier2] + spellbookModifier[purchaseableExtraModifier] + spellbookArray[purchaseableExtra]), 20);
                    }
                    if (characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Paladin" || characterClass == "Knight") {
                        Progress("Purchasing " + Article(mountModifier2[purchaseableExtraModifier2] + mountModifier[purchaseableExtraModifier] + mountArray[purchaseableExtra]), 20);
                    }
                    if (characterClass == "Bard") {
                        Progress("Purchasing " + Article(instrumentModifier2[purchaseableExtraModifier2] + instrumentModifier[purchaseableExtraModifier] + instrumentArray[purchaseableExtra]), 20);
                    }
                    if (characterClass == "Ranger" || characterClass == "Archeologist" || characterClass == "Rogue") {
                        if (ExtraModifier2 > 0) {
                            Progress("Purchasing a +" + purchaseableExtraModifier2 + " " + ammoModifier2[purchaseableExtraModifier] + ammoModifier[purchaseableExtra] + ammoArray[Weapon], 20);
                        }
                        else {
                            Progress("Purchasing " + Article(ammoModifier2[purchaseableExtraModifier] + ammoModifier[purchaseableExtra] + ammoArray[Weapon]), 20);
                        }
                    }
                    Save(currentSaveFile, "Travel");
                    subLocation = "shop3";
                }
                else {
                    travelTo(QuestLocation);
                    Save(currentSaveFile, "Travel");
                    subLocation = "none1";
                }
            }
            if (currentLocation == 0 && (subLocation == "shop2" || subLocation == "shop2.5")) {
                if (armorCost <= Gold) {
                    if (purchaseableArmorModifierNumber > 0) {
                        Progress("Purchasing a +" + purchaseableArmorModifierNumber + " " + armorModifierArray[purchaseableArmorModifier] + armorArray[purchaseableArmor], 20);
                    }
                    else {
                        Progress("Purchasing " + Article(armorModifierArray[purchaseableArmorModifier] + armorArray[purchaseableArmor]), 20);
                    }
                    Save(currentSaveFile, "Travel");
                    subLocation = "shop2.7";
                }
                else {
                    travelTo(QuestLocation);
                    Save(currentSaveFile, "Travel");
                    subLocation = "shop2.6";
                }
            }
            if (currentLocation == 0 && subLocation == "shop") {
                if (weaponCost <= Gold) {
                    if (characterClass == "Rogue" || characterClass == "Cowboy" || characterClass == "Cowgirl") {
                        if (purchaseableWeaponModifierNumber > 0) {
                            Progress("Purchasing a +" + purchaseableWeaponModifierNumber + " " + rangedWeaponModifier[purchaseableWeaponModifier] + rangedWeaponArray[purchaseableWeapon], 20);
                        }
                        else {
                            Progress("Purchasing " + Article(rangedWeaponModifier[purchaseableWeaponModifier] + rangedWeaponArray[purchaseableWeapon]), 20);
                        }
                    }
                    else if (purchaseableWeaponModifierNumber > 0) {
                        Progress("Purchasing a +" + purchaseableWeaponModifierNumber + " " + meleeWeaponModifier[purchaseableWeaponModifier] + meleeWeaponArray[purchaseableWeapon], 20);
                    }
                    else {
                        Progress("Purchasing " + Article(meleeWeaponModifier[purchaseableWeaponModifier] + meleeWeaponArray[purchaseableWeapon]), 20);
                    }
                    Save(currentSaveFile, "Travel");
                    subLocation = "shop2";
                }
                else {
                    NextProgress = true;
                    Save(currentSaveFile, "Travel");
                    subLocation = "shop2.5";
                }
            }
            if (currentLocation == 0 && subLocation == "shop0") {
                i = Weapon + WeaponModifier + WeaponModifierNumber + Math.floor(Math.random() * Level + 1);
                purchaseableWeapon = Math.floor(Math.random() * i);
                if (purchaseableWeapon == 0) {
                    purchaseableWeapon = 1;
                }
                purchaseableWeaponModifier = i - purchaseableWeapon;
                purchaseableWeaponModifierNumber = 0;
                if (purchaseableWeapon > 15) {
                    i = purchaseableWeapon - 15;
                    i = i + Math.floor(Math.random() * 10 + 1);
                    purchaseableWeaponModifierNumber = i;
                    purchaseableWeapon = purchaseableWeapon - i;
                }
                if (purchaseableWeaponModifier > 16) {
                    i = purchaseableWeaponModifier - 16;
                    i = i + Math.floor(Math.random() * 10 + 1);
                    purchaseableWeaponModifierNumber = purchaseableWeaponModifierNumber + i;
                    purchaseableWeaponModifier = purchaseableWeaponModifier - i;
                }
                i = Armor + ArmorModifier + ArmorModifierNumber + Math.floor(Math.random() * Level + 1);
                purchaseableArmor = Math.floor(Math.random() * i);
                if (purchaseableArmor == 0) {
                    purchaseableArmor = 1;
                }
                purchaseableArmorModifier = i - purchaseableArmor;
                purchaseableArmorModifierNumber = 0;
                if (purchaseableArmor > 15) {
                    i = purchaseableArmor - 15;
                    i = i + Math.floor(Math.random() * 10 + 1);
                    purchaseableArmorModifierNumber = i;
                    purchaseableArmor = purchaseableArmor - i;
                }
                if (purchaseableArmorModifier > 16) {
                    i = purchaseableArmorModifier - 16;
                    i = i + Math.floor(Math.random() * 10 + 1);
                    purchaseableArmorModifierNumber = purchaseableArmorModifierNumber + i;
                    purchaseableArmorModifier = purchaseableArmorModifier - i;
                }
                purchaseableExtraModifier2 = 0;
                if (characterClass == "Wizard" || characterClass == "Necromancer" || characterClass == "Priest") {
                    i = Extra + ExtraModifier + ExtraModifier2 + Math.floor(Math.random() * Level + 1);
                    purchaseableExtra = Math.floor(Math.random() * i);
                    if (purchaseableExtra == 0) {
                        purchaseableExtra = 1;
                    }
                    purchaseableExtraModifier = i - purchaseableExtra;
                    if (purchaseableExtra > 15) {
                        i = purchaseableExtra - 15;
                        i = i + Math.floor(Math.random() * 10 + 1);
                        purchaseableExtraModifier = purchaseableExtraModifier + i;
                        purchaseableExtra = purchaseableExtra - i;
                    }
                    if (purchaseableExtraModifier > 30) {
                        i = purchaseableExtraModifier - 30;
                        i = i + Math.floor(Math.random() * 20 + 1);
                        purchaseableExtraModifier2 = purchaseableExtraModifier2 + 1;
                        purchaseableExtraModifier = purchaseableExtraModifier - i;
                    }
                    extraCost = Math.round((purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * Math.round(Math.pow(4, 1 + (purchaseableWeapon + purchaseableExtraModifier + purchaseableExtraModifier2) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                }
                if (characterClass == "Knight" || characterClass == "Cowboy" || characterClass == "Cowgirl" || characterClass == "Paladin") {
                    i = Extra + ExtraModifier + ExtraModifier2 + Math.floor(Math.random() * Level + 1);
                    purchaseableExtra = Math.floor(Math.random() * i);
                    if (purchaseableExtra == 0) {
                        purchaseableExtra = 1;
                    }
                    purchaseableExtraModifier = i - purchaseableExtra;
                    if (purchaseableExtraModifier > 15) {
                        i = purchaseableExtraModifier - 15;
                        i = i + Math.floor(Math.random() * 10 + 1);
                        purchaseableExtra = purchaseableExtra + i;
                        purchaseableExtraModifier = purchaseableExtraModifier - i;
                    }
                    if (purchaseableExtra > 20) {
                        i = purchaseableExtra - 20;
                        i = i + Math.floor(Math.random() * 15 + 1);
                        purchaseableExtraModifier2 = purchaseableExtraModifier2 + i;
                        purchaseableExtra = purchaseableExtra - i;
                    }
                    extraCost = 4 * Math.round((purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * Math.round(Math.pow(4, 1 + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                }
                if (characterClass == "Bard") {
                    i = Extra + ExtraModifier + ExtraModifier2 + Math.floor(Math.random() * Level + 1);
                    purchaseableExtra = Math.floor(Math.random() * i);
                    if (purchaseableExtra == 0) {
                        purchaseableExtra = 1;
                    }
                    purchaseableExtraModifier = i - purchaseableExtra;
                    if (purchaseableExtraModifier > 12) {
                        i = purchaseableExtraModifier - 12;
                        i = i + Math.floor(Math.random() * 10 + 1);
                        purchaseableExtra = purchaseableExtra + i;
                        purchaseableExtraModifier = purchaseableExtraModifier - i;
                    }
                    if (purchaseableExtra > 20) {
                        i = purchaseableExtra - 20;
                        i = i + Math.floor(Math.random() * 15 + 1);
                        purchaseableExtraModifier2 = purchaseableExtraModifier2 + i;
                        purchaseableExtra = purchaseableExtra - i;
                    }
                    if (purchaseableExtraModifier2 > 22) {
                        i = purchaseableExtra - 22;
                        purchaseableExtraModifier2 = purchaseableExtraModifier2 - i;
                        i = Math.ceil(i / 2);
                        purchaseableExtra = purchaseableExtra + i;
                        purchaseableExtraModifier = purchaseableExtraModifier + i;
                    }
                    extraCost = 2 * Math.round((purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * Math.round(Math.pow(4, 1 + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                }
                if (characterClass == "Archeologist" || characterClass == "Ranger" || characterClass == "Rogue") {
                    i = Extra + ExtraModifier + ExtraModifier2 + Math.floor(Math.random() * Level + 1);
                    purchaseableExtra = Math.floor(Math.random() * i);
                    if (purchaseableExtra == 0) {
                        purchaseableExtra = 1;
                    }
                    purchaseableExtraModifier = i - purchaseableExtra;
                    if (purchaseableExtraModifier > 13) {
                        i = purchaseableExtraModifier - 13;
                        i = i + Math.floor(Math.random() * 10 + 1);
                        purchaseableExtra = purchaseableExtra + i;
                        purchaseableExtraModifier = purchaseableExtraModifier - i;
                    }
                    if (purchaseableExtra > 14) {
                        i = purchaseableExtra - 14;
                        i = i + Math.floor(Math.random() * 10 + 1);
                        purchaseableExtraModifier2 = purchaseableExtraModifier2 + i;
                        purchaseableExtra = purchaseableExtra - i;
                    }
                    extraCost = 2 * Math.round((purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier) * Math.round(Math.pow(4, 1 + (purchaseableExtra + purchaseableExtraModifier + purchaseableExtraModifier2) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                }
                weaponCost = Math.round((purchaseableWeapon + purchaseableWeaponModifier + purchaseableWeaponModifierNumber) * Math.round(Math.pow(4, 1 + (purchaseableWeapon + purchaseableWeaponModifier + purchaseableWeaponModifierNumber) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                armorCost = Math.round((purchaseableArmor + purchaseableArmorModifier + purchaseableArmorModifierNumber) * Math.round(Math.pow(4, 1 + (purchaseableArmor + purchaseableArmorModifier + purchaseableArmorModifierNumber) * 1.000000E-01) / (1 + (Cha + ChaMod) * 2.000000E-01)));
                Save(currentSaveFile, "Travel");
                if (weaponCost <= Gold) {
                    Progress("Walking to the shop.", 40);
                    subLocation = "shop";
                }
                else if (armorCost <= Gold) {
                    Progress("Walking to the shop.", 40);
                    subLocation = "shop2.5";
                }
                else if (extraCost <= Gold) {
                    Progress("Walking to the shop.", 40);
                    subLocation = "shop2.6";
                }
                else {
                    travelTo(QuestLocation);
                    subLocation = "none1";
                }
                Save(currentSaveFile, "BuyingTypes");
            }
            if (currentLocation == 0 && subLocation == "sell4") {
                if (inventoryArray[4][0] > 0) {
                    if (inventoryArray[4][0] > 1) {
                        Progress("Selling " + Pluralize(itemsArray[inventoryArray[4][1] - 1]), 10);
                    }
                    else {
                        Progress("Selling " + itemsArray[inventoryArray[4][1] - 1], 10);
                    }
                    subLocation = "shop0";
                    Selling = true;
                }
                else {
                    subLocation = "shop0";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "sell3") {
                if (inventoryArray[3][0] > 0) {
                    if (inventoryArray[3][0] > 1) {
                        Progress("Selling " + Pluralize(itemsArray[inventoryArray[3][1] - 1]), 10);
                    }
                    else {
                        Progress("Selling " + itemsArray[inventoryArray[3][1] - 1], 10);
                    }
                    subLocation = "sell4";
                    Selling = true;
                }
                else {
                    subLocation = "sell4";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "sell2") {
                if (inventoryArray[2][0] > 0) {
                    if (inventoryArray[2][0] > 1) {
                        Progress("Selling " + Pluralize(itemsArray[inventoryArray[2][1] - 1]), 10);
                    }
                    else {
                        Progress("Selling " + itemsArray[inventoryArray[2][1] - 1], 10);
                    }
                    subLocation = "sell3";
                    Selling = true;
                }
                else {
                    subLocation = "sell3";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "sell1") {
                if (inventoryArray[1][0] > 0) {
                    if (inventoryArray[1][0] > 1) {
                        Progress("Selling " + Pluralize(itemsArray[inventoryArray[1][1] - 1]), 10);
                    }
                    else {
                        Progress("Selling " + itemsArray[inventoryArray[1][1] - 1], 10);
                    }
                    subLocation = "sell2";
                    Selling = true;
                }
                else {
                    subLocation = "sell2";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "sell0") {
                if (inventoryArray[0][0] > 0) {
                    if (inventoryArray[0][0] > 1) {
                        Progress("Selling " + Pluralize(itemsArray[inventoryArray[0][1] - 1]), 10);
                    }
                    else {
                        Progress("Selling " + itemsArray[inventoryArray[0][1] - 1], 10);
                    }
                    subLocation = "sell1";
                    Selling = true;
                }
                else {
                    subLocation = "sell1";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "tavern2") {
                i = Math.floor(Math.random() * 5 + 1);
                if (i == 4 && Level >= 15) {
                    i = Math.floor(Math.random() * 4 + 1);
                }
                if (i == 1) {
                    questType = "boss";
                    questTarget = Math.round(Math.random() * SkillLevel * 1.600000E+00 + 1) + 1;
                    if (questTarget > 34) {
                        questTarget = Math.floor(Math.random() * 30 + 5);
                    }
                    questEnd = Level + 5;
                }
                if (i == 2) {
                    questType = "find";
                    questTarget = QuestObjectDescribe[Math.floor(Math.random() * 7)] + QuestObjectArray[Math.floor(Math.random() * 40)];
                    questEnd = (Level * 15 + 50) * 2;
                }
                if (i == 3) {
                    questType = "deliver";
                    questTarget = QuestObjectArray[Math.floor(Math.random() * 40)];
                    questEnd = (Level * 15 + 50) * 2;
                }
                if (i == 5) {
                    questType = "kill";
                    questTarget = Math.round(Math.random() * SkillLevel * 1.500000E+00 + 1);
                    if (questTarget > 49) {
                        questTarget = Math.floor(Math.random() * 30 + 5);
                    }
                    questEnd = (Level + 5) * 2;
                }
                if (i == 4) {
                    questType = "collect";
                    questTarget = QuestObjectArray[Math.floor(Math.random() * 40)];
                    questEnd = Level + 5;
                }
                bossend = false;
                qmonSubLoc = Math.floor(Math.random() * 2 + 1);
                QuestLocation = SkillLevel + Math.floor(Math.random() * 2);
                questLevel = Level;
                questCompletion = 0;
                Save(currentSaveFile, "Travel");
                Save(currentSaveFile, "Quest");
                i2 = 0;
                for (i = 0; i < 5; i++) {
                    if (inventoryArray[i][0] > 0) {
                        i2 = 1;
                    }
                }
                if (i2 == 1) {
                    Progress("Walking to the Market", 40);
                    subLocation = "sell0";
                }
                else {
                    subLocation = "shop0";
                    NextProgress = true;
                }
            }
            if (currentLocation == 0 && subLocation == "tavern") {
                if (questCompletion == questEnd) {
                    questType = "none";
                    questCompletion = 0;
                    questMonsterLevel = Math.round(Math.pow(questLevel, 1 + questLevel * 1.000000E-01));
                    goldLoot = Math.round(Math.pow(Math.random() * questLevel + questLevel + (Math.random() * QuestLocation + QuestLocation) * 5, 1 + questLevel * 1.000000E-03));
                    expGain = Math.round(Math.random() * questMonsterLevel + questMonsterLevel + (Math.random() * QuestLocation + QuestLocation) * 5 * (1 + SpellsArray[11][1] * 1.000000E-01));
                    rewardType = "Quest Reward:";
                    itemLoot = "";
                    itemLoot2 = 5;
                    RewardTimer = 30;
                    Gold = Gold + goldLoot;
                    Exp = Exp + expGain;
                }
                Progress("Obtaining quest from " + QuestPersonArray[Math.floor(Math.random() * 6)] + ".", 30);
                Save(currentSaveFile, "Travel");
                subLocation = "tavern2";
            }
            if (currentLocation == 0 && subLocation == "none") {
                Progress("Walking to the tavern.", 40);
                Save(currentSaveFile, "Travel");
                subLocation = "tavern";
            }
            if (currentLocation == 0 && subLocation == "dead") {
                Progress("Reviving", 100);
                subLocation = "none";
                Save(currentSaveFile, "Travel");
            }
            if (progressText == "You begin your journey.") {
                travelTo(0);
            }
            if (progressText == "...to defeat the great evil in the castle to the north.") {
                Progress("You begin your journey.", 100);
            }
            if (progressText == "He tells you of your quest.") {
                Progress("...to defeat the great evil in the castle to the north.", 76);
            }
            if (progressText == "He says that you are the destined one.") {
                Progress("He tells you of your quest.", 60);
            }
            if (progressText == "An old man stands in front of you.") {
                Progress("He says that you are the destined one.", 74);
            }
        }
        EnemyProgressNow = EnemyProgressNow + 1;
        if (EnemyProgressNow > enemySpeed && fighting == true) {
            EnemyDamage = Math.round((MonsterLevel * Math.random() + MonsterLevel) / (Armor + ArmorModifier + ArmorModifierNumber + 1));
            if (EnemyDamage < 1) {
                EnemyDamage = 1;
            }
            EnemyProgressNow = 0;
            dodgeLevel = Math.pow(9.500000E-01, (Dex + DexMod) / MonsterLevel * 5);
            if (dodgeLevel < 5.000000E-02) {
                dodgeLevel = 5.000000E-02;
                trace ("-e");
            }
            if (dodgeLevel > 9.500000E-01) {
                dodgeLevel = 9.500000E-01;
                trace ("+e");
            }
            if (Math.random() > dodgeLevel) {
                DodgeText1.text = "Dodge";
                DodgeText1.setTextFormat(progressFormat);
                DodgeTimer1 = 10;
            }
            else {
                Health = Health - EnemyDamage;
                if (Health <= 0 && fighting == true) {
                    questType = "none";
                    questCompletion = 0;
                    fighting = false;
                    SkillLevel = SkillLevel - 1;
                    if (SkillLevel == 0) {
                        SkillLevel = 1;
                    }
                    travelTo(0);
                    subLocation = "dead";
                    healthBar._alpha = 0;
                    manaBar._alpha = 0;
                    enemyHealthBar._alpha = 0;
                    enemyManaBar._alpha = 0;
                    boss = false;
                    Save(currentSaveFile, "Quest");
                    Save(currentSaveFile, "Level");
                }
            }
        }
    }
    else {
        progressBar._visible = false;
        expBar._visible = false;
        SpellText._visible = false;
        InventoryText._visible = false;
        questBar._visible = false;
    }
    if (Screen == "CreatingCharacter") {
        if (ccbd == false) {
            ccbd = true;
            _root.createEmptyMovieClip("characterCreationTexts", _root.getNextHighestDepth());
            characterCreationTexts.createTextField("text1", 0, 40, 30, 100, 40);
            characterCreationTexts.text1.text = "Class";
            characterCreationTexts.text1.setTextFormat(progressFormat);
            characterCreationTexts.text1.selectable = false;
            characterCreationTexts.createTextField("text2", 1, 200, 30, 100, 40);
            characterCreationTexts.text2.text = "Race";
            characterCreationTexts.text2.setTextFormat(progressFormat);
            characterCreationTexts.text2.selectable = false;
            characterCreationTexts.createTextField("text3", 2, 360, 30, 100, 40);
            characterCreationTexts.text3.text = "Gender";
            characterCreationTexts.text3.setTextFormat(progressFormat);
            characterCreationTexts.text3.selectable = false;
            characterCreationTexts.createTextField("text4", 4, 360, 120, 100, 40);
            characterCreationTexts.text4.text = "Name";
            characterCreationTexts.text4.setTextFormat(progressFormat);
            characterCreationTexts.text4.selectable = false;
            characterCreationTexts.createTextField("inputText", 5, 310, 150, 200, 26);
            characterCreationTexts.inputText.border = true;
            characterCreationTexts.inputText.type = "input";
            characterCreationTexts.inputText.maxChars = 14;
            characterCreationTexts.inputText.variable = "currentNameTyped";
            characterCreationTexts.currentNameTyped = "Johnson";
            characterCreationTexts.inputText.setTextFormat(biggerFormat);
            currentClassSelection = 0;
            currentRaceSelection = 0;
            currentGenderSelection = "Male";
            for (i = 0; i < 10; i++) {
                createButton(40, i * 25 + 60, ClassArray[i][0], "classButton" + i);
                _root["classButton" + i].thisSelection = i;
                _root["classButton" + i].onPress = function () {
                    currentClassSelection = this.thisSelection;
                };
                if (i < 8) {
                    createButton(200, i * 25 + 60, RaceArray[i][0], "raceButton" + i);
                    _root["raceButton" + i].thisSelection = i;
                    _root["raceButton" + i].onPress = function () {
                        currentRaceSelection = this.thisSelection;
                    };
                }
                if (i < 3) {
                    _root.createEmptyMovieClip("arrow" + i, _root.getNextHighestDepth());
                    with (_root["arrow" + i]) {
                        lineStyle(0, 0, 0);
                        beginFill(255, 100);
                        lineTo(35, 10);
                        lineTo(0, 20);
                        lineTo(10, 10);
                        lineTo(0, 0);
                        endFill();
                        beginFill(26367, 100);
                        lineTo(25, 10);
                        lineTo(0, 20);
                        lineTo(10, 10);
                        lineTo(0, 0);
                        endFill();
                        lineStyle(1, 153);
                        lineTo(35, 10);
                        lineTo(0, 20);
                        lineTo(10, 10);
                        lineTo(0, 0);
                    }
                }
            }
            arrow0._x = 5;
            arrow1._x = 165;
            arrow2._x = 325;
            createButton(360, 60, "Male", "genderButton0");
            _root.genderButton0.onPress = function () {
                currentGenderSelection = "Male";
                ClassArray[9][0] = "Cowboy";
                _root.classButton9.buttonText.text = "Cowboy";
                _root.classButton9.buttonText.setTextFormat(progressFormat);
                Monster7Array[25] = "Succubus";
                Monster7Array[26] = "Succubus";
            };
            createButton(360, 85, "Female", "genderButton1");
            _root.genderButton1.onPress = function () {
                currentGenderSelection = "Female";
                ClassArray[9][0] = "Cowgirl";
                _root.classButton9.buttonText.text = "Cowgirl";
                _root.classButton9.buttonText.setTextFormat(progressFormat);
                Monster7Array[25] = "Incubus";
                Monster7Array[26] = "Incubus";
            };
            createButton(225, 300, "Confirm", "confirmButton");
            createButton(225, 350, "Back", "BackButton");
            confirmButton.onPress = function () {
                Screen = "Playing";
                ccbd = false;
                progressBar._visible = true;
                expBar._visible = true;
                SpellText._visible = true;
                InventoryText._visible = true;
                questBar._visible = true;
                currentSaveFile = characterCreating;
                characterClass = ClassArray[currentClassSelection][0];
                characterRace = RaceArray[currentRaceSelection][0];
                characterGender = currentGenderSelection;
                characterName = characterCreationTexts.currentNameTyped;
                StrUp = 1 + (ClassArray[currentClassSelection][1] + RaceArray[currentRaceSelection][1]) / 2;
                ConUp = 1 + (ClassArray[currentClassSelection][2] + RaceArray[currentRaceSelection][2]) / 2;
                DexUp = 1 + (ClassArray[currentClassSelection][3] + RaceArray[currentRaceSelection][3]) / 2;
                ChaUp = 1 + (ClassArray[currentClassSelection][4] + RaceArray[currentRaceSelection][4]) / 2;
                IntUp = 1 + (ClassArray[currentClassSelection][5] + RaceArray[currentRaceSelection][5]) / 2;
                WisUp = 1 + (ClassArray[currentClassSelection][6] + RaceArray[currentRaceSelection][6]) / 2;
                Str = 1;
                Con = 1;
                Dex = 1;
                Cha = 1;
                Int = 1;
                Wis = 1;
                StrEx = 1;
                ConEx = 1;
                DexEx = 1;
                ChaEx = 1;
                IntEx = 1;
                WisEx = 1;
                StrMod = 0;
                ConMod = 0;
                DexMod = 0;
                ChaMod = 0;
                IntMod = 0;
                WisMod = 0;
                HealthMax = 1;
                ManaMax = 1;
                Exp = 50;
                ExpLevel = 50;
                Level = 0;
                SkillLevel = 0;
                questType = "none";
                questCompletion = 0;
                questEnd = 1;
                Weapon = 0;
                WeaponModifier = 0;
                WeaponModifierNumber = 0;
                Armor = 0;
                ArmorModifier = 0;
                ArmorModifierNumber = 0;
                Extra = 0;
                ExtraModifier = 0;
                ExtraModifier2 = 0;
                deathCount = 0;
                Gold = 30;
                currentLocation = 5.000000E-01;
                travelingTo = 5.000000E-01;
                subLocation = "none";
                fighting = false;
                boss = false;
                bossend = false;
                _root.inventoryArray = new Array(new Array(0, 0), new Array(0, 0), new Array(0, 0), new Array(0, 0), new Array(0, 0));
                obtainSpell(1);
                Save(currentSaveFile, "Start");
                Save(currentSaveFile, "Level");
                Save(currentSaveFile, "Combat");
                Save(currentSaveFile, "Travel");
                Save(currentSaveFile, "Kill");
                Save(currentSaveFile, "Quest");
                Save(currentSaveFile, "Shopping");
                Progress("An old man stands in front of you.", 80);
                removeMovieClip (_root.characterCreationTexts);
                removeMovieClip (_root.arrow0);
                removeMovieClip (_root.arrow1);
                removeMovieClip (_root.arrow2);
                removeMovieClip (_root.genderButton0);
                removeMovieClip (_root.genderButton1);
                for (i = 0; i < 10; i++) {
                    removeMovieClip (_root["classButton" + i]);
                    removeMovieClip (_root["raceButton" + i]);
                }
                removeMovieClip (_root.BackButton);
                removeMovieClip (_root.confirmButton);
            };
            BackButton.onPress = function () {
                ccbd = false;
                _root.Screen = "Menu";
                _root.currentMenu = "chooseFile";
                _root.drawMenu = true;
                removeMovieClip (_root.characterCreationTexts);
                removeMovieClip (_root.arrow0);
                removeMovieClip (_root.arrow1);
                removeMovieClip (_root.arrow2);
                removeMovieClip (_root.genderButton0);
                removeMovieClip (_root.genderButton1);
                for (i = 0; i < 10; i++) {
                    removeMovieClip (_root["classButton" + i]);
                    removeMovieClip (_root["raceButton" + i]);
                }
                removeMovieClip (_root.confirmButton);
                removeMovieClip (_root.BackButton);
            };
        }
        arrow0._y = currentClassSelection * 25 + 60;
        arrow1._y = currentRaceSelection * 25 + 60;
        if (currentGenderSelection == "Male") {
            arrow2._y = 60;
        }
        else {
            arrow2._y = 85;
        }
    }
    if (Screen == "Menu" && Loading == false) {
        if (drawMenu == true) {
            menuButtons._visible = true;
            if (action == 0 && currentMenu == "Main") {
                currentMenu = "chooseFile";
                menu = ["File 1", "File 2", "File 3", "Back"];
                action = 100;
                buttons[2][1]._x = 0;
                buttons[2][2]._x = 0;
                buttons[3][1]._x = 0;
                buttons[3][2]._x = 0;
            }
            if (action == 1 && currentMenu == "Main") {
                currentMenu = "Load";
                menu = ["File 1", "File 2", "File 3", "Back"];
                action = 100;
                buttons[2][1]._x = 0;
                buttons[2][2]._x = 0;
                buttons[3][1]._x = 0;
                buttons[3][2]._x = 0;
            }
            if (action == 3 && (currentMenu == "chooseFile" || currentMenu == "Load")) {
                currentMenu = "Main";
                menu = ["New Character (Ladder v1.7)", "Load Character", "", ""];
                action = 100;
                buttons[2][1]._x = -1000;
                buttons[2][2]._x = -1000;
                buttons[3][1]._x = -1000;
                buttons[3][2]._x = -1000;
            }
            if (action < 3 && currentMenu == "chooseFile") {
                currentMenu = "none";
                characterCreating = action + 1;
                Screen = "CreatingCharacter";
                action = 100;
            }
            if (action < 3 && currentMenu == "Load") {
                ++action;
                saveString = "s" + action + "_";
                if (_root.savefile.data[saveString + "characterName"] != undefined) {
                    currentMenu = "none";
                    Screen = "Playing";
                    progressBar._visible = true;
                    expBar._visible = true;
                    SpellText._visible = true;
                    InventoryText._visible = true;
                    questBar._visible = true;
                    currentSaveFile = action;
                    action = 100;
                    characterClass = _root.savefile.data[saveString + "characterClass"];
                    characterRace = _root.savefile.data[saveString + "characterRace"];
                    characterName = _root.savefile.data[saveString + "characterName"];
                    characterGender = _root.savefile.data[saveString + "characterGender"];
                    if (characterGender == "Female") {
                        ClassArray[9][0] = "Cowgirl";
                        Monster7Array[25] = "Incubus";
                        Monster7Array[26] = "Incubus";
                    }
                    StrUp = _root.savefile.data[saveString + "StrUp"];
                    ConUp = _root.savefile.data[saveString + "ConUp"];
                    DexUp = _root.savefile.data[saveString + "DexUp"];
                    ChaUp = _root.savefile.data[saveString + "ChaUp"];
                    IntUp = _root.savefile.data[saveString + "IntUp"];
                    WisUp = _root.savefile.data[saveString + "WisUp"];
                    Str = _root.savefile.data[saveString + "Str"];
                    Con = _root.savefile.data[saveString + "Con"];
                    Dex = _root.savefile.data[saveString + "Dex"];
                    Cha = _root.savefile.data[saveString + "Cha"];
                    Int = _root.savefile.data[saveString + "Int"];
                    Wis = _root.savefile.data[saveString + "Wis"];
                    StrEx = _root.savefile.data[saveString + "StrEx"];
                    ConEx = _root.savefile.data[saveString + "ConEx"];
                    DexEx = _root.savefile.data[saveString + "DexEx"];
                    ChaEx = _root.savefile.data[saveString + "ChaEx"];
                    IntEx = _root.savefile.data[saveString + "IntEx"];
                    WisEx = _root.savefile.data[saveString + "WisEx"];
                    StrMod = _root.savefile.data[saveString + "StrMod"];
                    ConMod = _root.savefile.data[saveString + "ConMod"];
                    DexMod = _root.savefile.data[saveString + "DexMod"];
                    ChaMod = _root.savefile.data[saveString + "ChaMod"];
                    IntMod = _root.savefile.data[saveString + "IntMod"];
                    WisMod = _root.savefile.data[saveString + "WisMod"];
                    HealthMax = _root.savefile.data[saveString + "HealthMax"];
                    ManaMax = _root.savefile.data[saveString + "ManaMax"];
                    Exp = _root.savefile.data[saveString + "Exp"];
                    ExpLevel = _root.savefile.data[saveString + "ExpLevel"];
                    Level = _root.savefile.data[saveString + "Level"];
                    SkillLevel = _root.savefile.data[saveString + "SkillLevel"];
                    questType = _root.savefile.data[saveString + "questType"];
                    questCompletion = _root.savefile.data[saveString + "questCompletion"];
                    questEnd = _root.savefile.data[saveString + "questEnd"];
                    questTarget = _root.savefile.data[saveString + "questTarget"];
                    questLevel = _root.savefile.data[saveString + "questLevel"];
                    QuestLocation = _root.savefile.data[saveString + "QuestLocation"];
                    qmonSubLoc = _root.savefile.data[saveString + "qmonSubLoc"];
                    Weapon = _root.savefile.data[saveString + "Weapon"];
                    WeaponModifier = _root.savefile.data[saveString + "WeaponModifier"];
                    WeaponModifierNumber = _root.savefile.data[saveString + "WeaponModifierNumber"];
                    Armor = _root.savefile.data[saveString + "Armor"];
                    ArmorModifier = _root.savefile.data[saveString + "ArmorModifier"];
                    ArmorModifierNumber = _root.savefile.data[saveString + "ArmorModifierNumber"];
                    Extra = _root.savefile.data[saveString + "Extra"];
                    ExtraModifier = _root.savefile.data[saveString + "ExtraModifier"];
                    ExtraModifier2 = _root.savefile.data[saveString + "ExtraModifier2"];
                    purchaseableWeapon = _root.savefile.data[saveString + "purchaseableWeapon"];
                    purchaseableWeaponModifier = _root.savefile.data[saveString + "purchaseableWeaponModifier"];
                    purchaseableWeaponModifierNumber = _root.savefile.data[saveString + "purchaseableWeaponModifierNumber"];
                    purchaseableArmor = _root.savefile.data[saveString + "purchaseableArmor"];
                    purchaseableArmorModifier = _root.savefile.data[saveString + "purchaseableArmorModifier"];
                    purchaseableArmorModifierNumber = _root.savefile.data[saveString + "purchaseableArmorModifierNumber"];
                    purchaseableExtra = _root.savefile.data[saveString + "purchaseableExtra"];
                    purchaseableExtraModifier = _root.savefile.data[saveString + "purchaseableExtraModifier"];
                    purchaseableExtraModifier2 = _root.savefile.data[saveString + "purchaseableExtraModifier2"];
                    weaponCost = _root.savefile.data[saveString + "weaponCost"];
                    armorCost = _root.savefile.data[saveString + "armorCost"];
                    deathCount = _root.savefile.data[saveString + "deathCount"];
                    Gold = _root.savefile.data[saveString + "Gold"];
                    currentLocation = _root.savefile.data[saveString + "currentLocation"];
                    travelingTo = _root.savefile.data[saveString + "currentLocation"];
                    subLocation = _root.savefile.data[saveString + "subLocation"];
                    fighting = _root.savefile.data[saveString + "fighting"];
                    boss = _root.savefile.data[saveString + "boss"];
                    bossend = _root.savefile.data[saveString + "bossend"];
                    monSubLoc = _root.savefile.data[saveString + "monSubLoc"];
                    enemyHealthMax = _root.savefile.data[saveString + "enemyHealthMax"];
                    enemyManaMax = _root.savefile.data[saveString + "enemyManaMax"];
                    Monster = _root.savefile.data[saveString + "Monster"];
                    Modifier1 = _root.savefile.data[saveString + "Modifier1"];
                    Modifier2 = _root.savefile.data[saveString + "Modifier2"];
                    Modifier3 = _root.savefile.data[saveString + "Modifier3"];
                    Modifier4 = _root.savefile.data[saveString + "Modifier4"];
                    MonsterLevel = _root.savefile.data[saveString + "MonsterLevel"];
                    Health = _root.savefile.data[saveString + "Health"];
                    Mana = _root.savefile.data[saveString + "Mana"];
                    enemySpeed = _root.savefile.data[saveString + "enemySpeed"];
                    enemyHealth = _root.savefile.data[saveString + "enemyHealth"];
                    enemyMana = _root.savefile.data[saveString + "enemyMana"];
                    enemyPoison = _root.savefile.data[saveString + "enemyPoison"];
                    EnemyProgressNow = _root.savefile.data[saveString + "EnemyProgressNow"];
                    if (fighting == true) {
                        healthBar._alpha = 100;
                        manaBar._alpha = 100;
                        enemyHealthBar._alpha = 100;
                        enemyManaBar._alpha = 100;
                    }
                    for (i = 0; i < 14; i++) {
                        SpellsArray[i][1] = _root.savefile.data[saveString + "Spell" + i];
                    }
                    _root.inventoryArray = new Array(new Array(0, 0), new Array(0, 0), new Array(0, 0), new Array(0, 0), new Array(0, 0));
                    for (i = 0; i < 5; i++) {
                        inventoryArray[i][0] = _root.savefile.data[saveString + "inventory" + i + "quantity"];
                        inventoryArray[i][1] = _root.savefile.data[saveString + "inventory" + i + "quality"];
                    }
                    i2 = 1;
                    for (i = 0; i < 14; i++) {
                        if (SpellsArray[i][1] > 0) {
                            if (i2 <= 8) {
                                SpellText.Spells[i2].text = SpellsArray[i][0] + " " + RomanNumeral(SpellsArray[i][1]);
                                SpellText.Spells[i2].setTextFormat(spellFormat);
                            }
                            else {
                                i3 = i2 - 8;
                                SpellText.Spells[i3].text = SpellsArray[i][0] + " " + RomanNumeral(SpellsArray[i][1]) + ", " + SpellText.Spells[i3].text;
                                SpellText.Spells[i3].setTextFormat(spellFormat);
                            }
                            ++i2;
                        }
                    }
                    displayItems();
                }
            }
            drawMenu = false;
            for (i = 0; i <= 3; i++) {
                if (menu[i] != "none") {
                    buttons[i][2]._visible = true;
                    buttons[i][1]._visible = true;
                    buttons[i][1]._alpha = 0;
                    buttons[i][1].onRollOver = function () {
                        this._alpha = 100;
                    };
                    buttons[i][1].onRollOut = function () {
                        this._alpha = 0;
                    };
                    buttons[i][1].onDragOver = function () {
                        this._alpha = 100;
                    };
                    buttons[i][1].onDragOut = function () {
                        this._alpha = 0;
                    };
                    buttons[i][0].text = menu[i];
                    buttons[i][0].setTextFormat(progressFormat);
                    buttons[i][1].Send = i;
                    buttons[i][1].onRelease = function () {
                        drawMenu = true;
                        action = this.Send;
                    };
                    continue;
                }
                buttons[i][2]._visible = false;
                delete buttons[i][1].onRollOver;
                delete buttons[i][1].onRollOut;
                delete buttons[i][1].onDragOver;
                delete buttons[i][1].onDragOut;
                buttons[i][1]._visible = false;
                buttons[i][0].text = "";
            }
        }
    }
    else {
        menuButtons._visible = false;
    }
    if (Loading == true) {
        _root.PercentLoaded = Math.round(_root.getBytesLoaded() / _root.getBytesTotal() * 100);
        if (_root.PercentLoaded < 100) {
            _root.progressBar.Bar._width = _root.PercentLoaded * 3;
            progressBar._visible = true;
        }
        else {
            Loading = false;
            progressBar._visible = false;
        }
    }
};