示例#1
0
文件: TRPG.cs 项目: StevenGann/TRPG
        /// <summary>
        /// Load all the items from file.
        /// Hardcoded items until file loading is added.
        /// </summary>
        private void LoadItems()
        {
            ItemsMaster = new List<Item>();
            WeaponsMaster = new List<Weapon>();
            MonstersMaster = new List<Monster>();

            List<Adjective> Adjectives = new List<Adjective>();
            Adjectives.Add(new Adjective("large", 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.5f, 1.75f, 1.5f, 1.0f, 1.1f, 0.9f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("small", 1.0f, 1.5f, 1.0f, 1.0f, 1.0f, 0.75f, 0.75f, 0.75f, 1.0f, 0.9f, 1.25f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("sharp", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.5f, 1.0f, 1.75f, 2.0f, 1.0f, 1.5f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("dull", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 0.75f, 1.0f, 0.9f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("polished", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 3.0f, 1.1f, 2.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("dirty", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f));
            Random RNG = new Random();

            Monster tempMonster;
            tempMonster = new Monster("Grue", "M_00", 10, 75);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Wraith", "M_01", 5, 150);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Wendigo", "M_02", 20, 50);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Vampire", "M_03", 10, 50);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Horta", "M_04", 15, 35);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Zombie", "M_05", 5, 25);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Skeleton", "M_06", 50, 50);
            MonstersMaster.Add(tempMonster);

            for (int i = 0; i < 10; i++)
            {
                Weapon tempWeapon;
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "sword", "W_00", 10, 10);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "knife", "W_01", 20, 2);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "club", "W_02", 7, 25);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "dagger", "W_03", 25, 5);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "saber", "W_04", 15, 7);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "stick", "W_05", 7, 1);
                WeaponsMaster.Add(tempWeapon);
            }

            Item tempItem;
            tempItem = new Item("Gold", "I_00", 1, 0);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Amulet", "I_01", 200, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Rock", "I_02", 0, 5);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Bone", "I_03", 0, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Skull", "I_04", 5, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Potion", "I_05", 10, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Poison", "I_06", 10, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Gem", "I_07", 100, 1);
            ItemsMaster.Add(tempItem);

            DataPack datapack = new DataPack(Directory.GetCurrentDirectory());
            datapack.AdjectivesMaster = Adjectives;
            datapack.ItemsMaster = ItemsMaster;
            datapack.MonstersMaster = MonstersMaster;
            datapack.WeaponsMaster = WeaponsMaster;
            datapack.Save();
        }
示例#2
0
文件: Form1.cs 项目: StevenGann/TRPG
 private void Form1_Load(object sender, EventArgs e)
 {
     datapack = new DataPack(Directory.GetCurrentDirectory());
     datapack.Load();
     buildItemsTree();
 }
示例#3
0
        /// <summary>
        /// Load all the items from file.
        /// Hardcoded items until file loading is added.
        /// </summary>
        private void LoadItems()
        {
            ItemsMaster    = new List <Item>();
            WeaponsMaster  = new List <Weapon>();
            MonstersMaster = new List <Monster>();

            List <Adjective> Adjectives = new List <Adjective>();

            Adjectives.Add(new Adjective("large", 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.5f, 1.75f, 1.5f, 1.0f, 1.1f, 0.9f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("small", 1.0f, 1.5f, 1.0f, 1.0f, 1.0f, 0.75f, 0.75f, 0.75f, 1.0f, 0.9f, 1.25f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("sharp", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.5f, 1.0f, 1.75f, 2.0f, 1.0f, 1.5f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("dull", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 0.75f, 1.0f, 0.9f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("polished", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 3.0f, 1.1f, 2.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f));
            Adjectives.Add(new Adjective("dirty", 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 1.0f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f));
            Random RNG = new Random();

            Monster tempMonster;

            tempMonster = new Monster("Grue", "M_00", 10, 75);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Wraith", "M_01", 5, 150);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Wendigo", "M_02", 20, 50);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Vampire", "M_03", 10, 50);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Horta", "M_04", 15, 35);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Zombie", "M_05", 5, 25);
            MonstersMaster.Add(tempMonster);
            tempMonster = new Monster("Skeleton", "M_06", 50, 50);
            MonstersMaster.Add(tempMonster);

            for (int i = 0; i < 10; i++)
            {
                Weapon tempWeapon;
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "sword", "W_00", 10, 10);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "knife", "W_01", 20, 2);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "club", "W_02", 7, 25);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "dagger", "W_03", 25, 5);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "saber", "W_04", 15, 7);
                WeaponsMaster.Add(tempWeapon);
                tempWeapon = new Weapon(Adjectives[RNG.Next(Adjectives.Count)], "stick", "W_05", 7, 1);
                WeaponsMaster.Add(tempWeapon);
            }

            Item tempItem;

            tempItem = new Item("Gold", "I_00", 1, 0);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Amulet", "I_01", 200, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Rock", "I_02", 0, 5);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Bone", "I_03", 0, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Skull", "I_04", 5, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Potion", "I_05", 10, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Poison", "I_06", 10, 1);
            ItemsMaster.Add(tempItem);
            tempItem = new Item("Gem", "I_07", 100, 1);
            ItemsMaster.Add(tempItem);

            DataPack datapack = new DataPack(Directory.GetCurrentDirectory());

            datapack.AdjectivesMaster = Adjectives;
            datapack.ItemsMaster      = ItemsMaster;
            datapack.MonstersMaster   = MonstersMaster;
            datapack.WeaponsMaster    = WeaponsMaster;
            datapack.Save();
        }