Ejemplo n.º 1
0
        public override Items.Item getDrop()
        {
            Classes.Items.Type itemType = (Classes.Items.Type)((Level % 12) / 2 + ((Level % 12) % 2) + ((Level % 12 == 0) ? 6 : 0));
            int grade = 0;
            for (int i = 0; i < Level; i += 12)
                grade = i / 12;

            Item itemToDrop = null;
            switch (rGen.Next(1, 5))
            {
                case 1:
                    itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion");
                    break;
                case 2:
                    itemToDrop = new Armor(itemType, grade, "Some " + itemType + "+" + grade + " armor! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " armor");
                    break;
                case 3:
                    WeaponType wepType = (Classes.Items.WeaponType)rGen.Next(1, 4);
                    itemToDrop = new Weapon(itemType, wepType, grade, "A " + itemType + "+" + grade + " " + wepType + "! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " " + wepType);
                    break;
                case 4:
                    itemToDrop = new Consumable(grade, itemType, "A " + itemType + "+" + grade + " health potion! Enjoy it!", (grade == 0 ? "" : "+" + grade + " ") + itemType + " health potion");
                    break;
            }
            return itemToDrop;
        }
Ejemplo n.º 2
0
 public int CompareTo(Weapon item)
 {
     int ret = (Grade - item.Grade) + ((int)ItemType - (int)item.ItemType) + (StrengthModifier - item.StrengthModifier) + (IntelligenceModifier - item.IntelligenceModifier) + (DexterityModifier - item.DexterityModifier);
     return ret;
 }
Ejemplo n.º 3
0
        public void CharacterCreation()
        {
            numUnusedStatPoints = 10;

            Console.Write("Enter your character's name: ");
            Name = Console.ReadLine();

            assignStats();

            if (Strength > Intelligence && Strength > Dexterity)
            {
                EquippedWeapon = new Weapon(Items.Type.Bronze, WeaponType.Sword, 0, "A starting sword.", "Basic Sword");
            }
            else if (Intelligence > Strength && Intelligence > Dexterity)
            {
                EquippedWeapon = new Weapon(Items.Type.Bronze, WeaponType.Staff, 0, "A starting staff.", "Basic Staff");
            }
            else if (Dexterity > Intelligence && Dexterity > Strength)
            {
                EquippedWeapon = new Weapon(Items.Type.Bronze, WeaponType.Bow, 0, "A starting bow.", "Basic Bow");
            }
            else
            {
                EquippedWeapon = new Weapon(Items.Type.Bronze, WeaponType.Sword, 0, "A starting sword.", "Basic S");
            }

            EquippedArmor = new Armor(Items.Type.Bronze, 0, "A starting set of armor.", "Basic Armor.");
        }
Ejemplo n.º 4
0
        private void sellWeapon_Click(object sender, RoutedEventArgs e)
        {
            if (inGameScreen.Shop1.weaponBox.HasItems && inGameScreen.Shop1.weaponBox.SelectedIndex >= 0)
            {
                int selectedIndex = inGameScreen.Shop1.weaponBox.SelectedIndex;
                Weapon item = new Weapon(p1.weaponInventory[selectedIndex].ItemType, p1.weaponInventory[selectedIndex].type, p1.weaponInventory[selectedIndex].Grade, p1.weaponInventory[selectedIndex].ItemDescription, p1.weaponInventory[selectedIndex].ItemName);
                int val = (int)(0.5 * ItemValue(item.Grade, item.ItemType));
                p1.CurrentGold += val;

                if(p1.weaponInventory[selectedIndex].Equals(p1.EquippedWeapon))
                {
                    p1.EquippedWeapon = new Weapon(0, 0, 0, "", "");
                }

                p1.RemoveItemFromInventory(p1.weaponInventory[selectedIndex]);
            }
            inGameScreen.Shop1.weaponBox.SelectedIndex = 0;
        }