Base armor class.
Inheritance: Loot, IEquippable
コード例 #1
0
ファイル: TestArmor.cs プロジェクト: JonasGoldt/TDGD_TD
        public void ArmorEqualsAndHashCode()
        {
            Armor armor = new Armor(ArmorType.Unarmored, 5);

            //Using IsTrue/IsFalse to cover all paths (aren't covered, when using Equals)
            //Equal tests
            Assert.IsTrue(armor.Equals(armor));
            Assert.AreEqual(armor.GetHashCode(), armor.GetHashCode());

            object equal = new Armor(ArmorType.Unarmored, 5);
            Assert.IsTrue(armor.Equals(equal));
            Assert.AreEqual(equal.GetHashCode(), armor.GetHashCode());

            //Not equal tests
            Assert.IsFalse(armor.Equals(null));

            object notEqual = new object();
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());

            notEqual = new Armor(ArmorType.Medium, 5);
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());

            notEqual = new Armor(ArmorType.Unarmored, 3);
            Assert.IsFalse(armor.Equals(notEqual));
            Assert.AreNotEqual(notEqual.GetHashCode(), armor.GetHashCode());
        }
コード例 #2
0
    private static Armor CreateHat()
    {
        Armor armor = new Armor();

        string[] hatNames = new string[] {
            "Small Hat",
            "Mid Hat",
            "Large Hat"
                                            };

        //fill in all of the values for that item type
        armor.Name = hatNames[Random.Range(0, hatNames.Length)];

        //assign properties for the item
        armor.ArmorLevel = Random.Range(10, 50);

        //assign the icon for the weapon
        armor.Icon = Resources.Load(GameSetting2.HAT_ICON_PATH + armor.Name) as Texture2D;

        //assign the eqipment slot where this can be assigned
        armor.Slot = EquipmentSlot.Head;

        //return the melee weapon
        return armor;
    }
コード例 #3
0
ファイル: Armor.cs プロジェクト: JMounier/Aegina
 public Armor(Armor armor)
     : base(armor)
 {
     this.armorValue = armor.ArmorValue;
     this.exterieur = armor.exterieur;
     this.interieur = armor.interieur;
 }
コード例 #4
0
 public void AddArmor(string id)
 {
     Armor x = new Armor();
     x.ID = id;
     x.Description = "An Armor Set";
     Armors.Add(x);
 }
コード例 #5
0
    void Start()
    {
        Transform sliders = transform.Find ("Sliders");

        armor = GameObject.Find ("Player").GetComponent<CharacterStats> ().armor;

        wepControl = GameObject.Find ("Player").GetComponent<PlayerWepControl> ();
        spellControl = GameObject.Find ("Player").GetComponent<PlayerSpellControl> ();
        mover = GameObject.Find ("Player").GetComponent<PlayerMove> ();
        mouseLook = GameObject.Find ("Player").GetComponentInChildren<SimpleSmoothMouseLook> ();

        playerRenderer = GameObject.Find ("Player").transform.Find ("Graphics").GetComponent<Renderer> ();

        maxHealthSlider = sliders.Find ("MaxHealthSlider").GetComponent<Slider> ();
        healthRegenSlider = sliders.Find ("HealthRegenSlider").GetComponent<Slider> ();
        damageReductionSlider = sliders.Find ("DamageReductionSlider").GetComponent<Slider> ();
        maxManaSlider = sliders.Find ("MaxManaSlider").GetComponent<Slider> ();
        manaRegenSlider = sliders.Find ("ManaRegenSlider").GetComponent<Slider> ();
        damageSlider = sliders.Find ("DamageSlider").GetComponent<Slider> ();
        attackTimeSlider = sliders.Find ("AttackTimeSlider").GetComponent<Slider> ();
        knockbackSlider = sliders.Find ("KnockbackSlider").GetComponent<Slider> ();
        speedSlider = sliders.Find ("SpeedSlider").GetComponent<Slider> ();
        jumpSpeedSlider = sliders.Find ("JumpSpeedSlider").GetComponent<Slider> ();

        redSlider = transform.Find ("ColorCustomizers").Find ("RedSlider").GetComponent<Slider> ();
        greenSlider = transform.Find ("ColorCustomizers").Find ("GreenSlider").GetComponent<Slider> ();
        blueSlider = transform.Find ("ColorCustomizers").Find ("BlueSlider").GetComponent<Slider> ();

        colorImage = transform.Find ("ColorCustomizers").Find ("ColorImage").GetComponent<Image> ();

        pointsLeftTxt = transform.Find ("PointsLeft").GetComponent<Text>();
    }
コード例 #6
0
 void changeArmor(Armor armor)
 {
     if(armorSwitcher != null){
         armorSwitcher.changeAnimationLayer(armor.armorAnimationLayerName);
         armorSwitcher.switchArm(armor.armSprite);
     }
 }
コード例 #7
0
ファイル: TestArmor.cs プロジェクト: JonasGoldt/TDGD_TD
        public void HeavyArmorDamageRecalculation()
        {
            //Test with an amount of 0
            Armor heavy = new Armor(ArmorType.Heavy, 0);

            Assert.AreEqual(80, heavy.RecalculateDamage(Pierce));
            Assert.AreEqual(120, heavy.RecalculateDamage(Siege));
            Assert.AreEqual(90, heavy.RecalculateDamage(Magic));
            Assert.AreEqual(100, heavy.RecalculateDamage(Chaos));

            //Test with an amount of 10
            heavy = new Armor(ArmorType.Heavy, 10);

            Assert.AreEqual(64, heavy.RecalculateDamage(Pierce));
            Assert.AreEqual(111, heavy.RecalculateDamage(Siege));
            Assert.AreEqual(85, heavy.RecalculateDamage(Magic));
            Assert.AreEqual(93, heavy.RecalculateDamage(Chaos));

            //Test with a high amount
            heavy = new Armor(ArmorType.Heavy, 10000);

            Assert.IsTrue(heavy.RecalculateDamage(Pierce) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Siege) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Magic) > 0);
            Assert.IsTrue(heavy.RecalculateDamage(Chaos) > 0);
        }
コード例 #8
0
ファイル: Unit.cs プロジェクト: MalxMalx/Unit-2
 public void takeArmor(Armor someArmor)
 {
     if ( someArmor.Owner != null ) {
         throw new ArgumentException();
     }
     ownArmor = someArmor;
     ownArmor.Owner = this;
 }
コード例 #9
0
ファイル: Equip.cs プロジェクト: scozirge/AVentureCapital
 /// <summary>
 /// 穿上護甲
 /// </summary>
 void EquipArmor(Armor _armor)
 {
     //穿上裝備,如果返回false代表無法裝備
     if (!_armor.Equip())
         return;
     Equip(_armor, true);//穿上裝備
     AddArmorBuffer(_armor.BufferID);
 }
コード例 #10
0
 public Armor(Armor armor)
 {
     this.name = armor.name;
     this.type = armor.type;
     this.value = armor.value;
     this.armortype = armor.armortype;
     this.trait = armor.trait;
 }
コード例 #11
0
        public object Clone()
        {
            Armor armor = new Armor();

            armor.DmgBlock = this.DmgBlock;
            armor.Name = this.Name;

            return armor;
        }
コード例 #12
0
ファイル: Status.cs プロジェクト: NotYours180/Survival
	public void UpdateBonuses(Armor a, Weapon w) {
		if (a != null) {
			armorbonus = a.armorBonus;
		}
		if (w != null) {
			attackbonus = w.damageBonus;
			speedbonus = w.speedBonus;
		}
	}
コード例 #13
0
    public void AddItem(Item pItem)
    {
        pItems.Add(pItem);

        if (pItem.ItmType == Item.ItemType.Weapon && pEquipedWeapon == null)
            pEquipedWeapon = pItem as Weapon;
        else if (pItem.ItmType == Item.ItemType.Armor && pEquipedArmor == null)
            pEquipedArmor = pItem as Armor;
    }
コード例 #14
0
ファイル: Unit.cs プロジェクト: MalxMalx/Unit-2
 public Unit(string name = defaultName, double health = defaultHealth)
 {
     if ( health < 10 || health > 100 ) {
         throw new ArgumentException();
     }
     this.name = name;
     this.health = health;
     ownWeapon = NoWeapon;
     ownArmor = NoArmor;
 }
コード例 #15
0
ファイル: Inventory.cs プロジェクト: TheAlchemistStudio/DnD
 public bool addArmor(Armor a)
 {
     if(a.getWeight() + weight > weightLimit) {
         return false;
     } else {
         armors.Add(a);
         weight += a.getWeight();
         return true;
     }
 }
コード例 #16
0
 public void removeArmor()
 {
     if(isPrimarySlotOccupied()){
         primaryarmor.transform.parent = null;
         primaryarmor.disableAbility();
         primaryarmor.enableSprite();
         primaryarmor.drop(owner.getCollider());
         defaultArmor();
         primaryarmor = null;
     }
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: Tayum/di0d
        // Write program entries TO XML-file
        private static void DataToXML(Armor[] armorArr)
        {
            XmlSerializer serializerFromData = new XmlSerializer(armorArr.GetType());

            TextWriter writerToFile = new StreamWriter("..\\..\\ArmorSerialization\\Armor.xml");

            serializerFromData.Serialize(writerToFile, armorArr);

            // Close the writerToFile [StreamWriter]
            writerToFile.Close();
        }
コード例 #18
0
ファイル: Health.cs プロジェクト: JonasGoldt/TDGD_TD
        public Health(int amount, Killable owner, Armor armor)
        {
            if (amount <= 0) {
                throw new System.ArgumentException("Healthes with a negative amount aren't allowed");
            }

            MaxAmount = amount;
            Amount = amount;
            Owner = owner;
            Armor = armor;
        }
コード例 #19
0
ファイル: CharacterTests.cs プロジェクト: janhelke/chummer2
        public void ArmorTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Add ArmorValue 6 Armor to the character. Their total Armor should be 6 with a Encumbrance penalty of 0 since there is nothing with a +value.
            Armor objArmor = new Armor(objCharacter);
            objArmor.ArmorValue = "6";
            objCharacter.Armor.Add(objArmor);

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an Armor Mod to the Armor. This should bring the Armor value up to 8.
            ArmorMod objMod = new ArmorMod(objCharacter);
            objMod.ArmorValue = 2;
            objCharacter.Armor[0].ArmorMods.Add(objMod);

            Assert.AreEqual(8, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(8, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an additional +6 value Armor to the character. Their total Aromr should be 14 with an Encumbrance penalty of 2.
            Armor objPlusArmor = new Armor(objCharacter);
            objPlusArmor.ArmorValue = "+6";
            objCharacter.Armor.Add(objPlusArmor);

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(2, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 2.");

            // Increase the character's STR to 4. This should reduce the Armor Encumbrance penalty to 1.
            objCharacter.STR.Value = 4;

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the Armor Mod should reduce the Armor value down to 12.
            objCharacter.Armor[0].ArmorMods[0].Equipped = false;

            Assert.AreEqual(12, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(12, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the +value Armor should put the character back to Armor 6 with no Encumbrance penalty.
            objCharacter.Armor[1].Equipped = false;

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");
        }
コード例 #20
0
ファイル: Armor.cs プロジェクト: Gapti/INT-Marks
	public override Item Clone ()
	{
		Armor item = new Armor();
		base.CloneBase(item);

		//copy all vars before return
		item.Fits = Fits;
		item.ArmorValue = ArmorValue;
		item.DefenseValue = DefenseValue;

		return item;
	}
コード例 #21
0
ファイル: Sets.cs プロジェクト: mrvoorhe/redox-extensions
        public static bool TryParseArmorShortName(string shortName, out Armor armor)
        {
            int tmp;
            if (_armorShortCutNameToIdTable.TryGetValue(shortName, out tmp))
            {
                armor = (Armor)tmp;
                return true;
            }

            armor = Armor.Invalid;
            return false;
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: Tayum/di0d
        // Write program entries TO JSON-file
        private static string DataToJSON(Armor[] armorArr)
        {
            MemoryStream stream = new MemoryStream();
            DataContractJsonSerializer serializerFromData = new DataContractJsonSerializer(typeof(Armor[]));
            serializerFromData.WriteObject(stream, armorArr);

            stream.Position = 0;
            StreamReader readerFromStream = new StreamReader(stream);
            string jsonString = (readerFromStream.ReadToEnd());
            System.IO.File.WriteAllText("..\\..\\ArmorSerialization\\Armor.json", jsonString);
            return jsonString;
        }
コード例 #23
0
ファイル: StatsTest.cs プロジェクト: densjizz/Osiris
        public void CreateArmorAndApplyIt()
        {
            string Name = "";
            float Value = 10.0f;
            float dmgVal = 100;
            Armor a = new Armor(Name, Value);

            float reduced = a.ApplyArmor(dmgVal);

            Assert.IsTrue(a.Reduction == 0.375f);
            Assert.IsTrue(reduced == (62.5f));
        }
コード例 #24
0
        public Player(PlayerStats playerStats, Armor armor, Weapon weapon)
        {
            this.PlayerStats = playerStats;
            this.Armor = armor;
            this.Weapon = weapon;

            int totalAttackPower = playerStats.AttackPower + weapon.WeaponStats.AttackPower;
            int totalAccuracy = playerStats.Accuracy + weapon.WeaponStats.Accuracy;
            int totalDefence = playerStats.Defence + armor.Strength + weapon.WeaponStats.Defence;
            int totalAgility = playerStats.Agility - armor.Weight;

            this.TotalStats = new PlayerStats(totalAttackPower, totalAccuracy, totalDefence, playerStats.Stamina, totalAgility);
        }
コード例 #25
0
ファイル: Unit.cs プロジェクト: MalxMalx/Unit-1
    public Unit(string name = defaultName, int health = defaultHealth)
    {
        if ( health < minHealth || health > maxHealth ) {
            throw new ArgumentException();
        }
        this.name = name;
        this.health = health;

        Armor NoArmor = new Armor();
        Weapon NoWeapon = new Weapon();
        ownWeapon = NoWeapon;
        ownArmor = NoArmor;
    }
コード例 #26
0
ファイル: TestArmor.cs プロジェクト: JonasGoldt/TDGD_TD
        public void ArmorCreation()
        {
            Armor armor = new Armor(ArmorType.Unarmored, 5);
            Assert.AreEqual<ArmorType>(ArmorType.Unarmored, armor.Type);
            Assert.AreEqual<int>(5, armor.Amount);

            try {
                armor = new Armor(ArmorType.Unarmored, -3);
                Assert.Fail("Armors with a negative amount aren't allowed");
            } catch (ArgumentException) {
                //Do nothing
            }
        }
コード例 #27
0
ファイル: Character_Script.cs プロジェクト: FenuL/TestProject
 public Character_Script(string nm, int lvl, int str, int crd, int spt, int dex, int vit, int spd, int can, string wep, string arm)
 {
     controller = Game_Controller.controller;
     character_name = nm.TrimStart();
     level = lvl;
     strength = str;
     coordination = crd;
     spirit = spt;
     dexterity = dex;
     vitality = vit;
     speed = spd;
     aura_max = vitality * AURA_MULTIPLIER;
     aura_curr = aura_max;
     action_max = AP_MAX;
     action_curr = action_max;
     action_cost = 0;
     actions = new List<Actions>();
     canister_max = can;
     canister_curr = canister_max;
     state = States.Idle;
     foreach (Weapons weps in Enum.GetValues(typeof(Weapons)))
     {
         if (wep.TrimStart() == weps.ToString())
         {
             Weapon w = new Weapon(weps);
             Equip(w);
             break;
         }
     }
     foreach (Armors arms in Enum.GetValues(typeof(Armors)))
     {
         if (arm.TrimStart() == arms.ToString())
         {
             Armor a = new Armor(arms);
             Equip(a);
             break;
         }
     }
     //foreach (string s in acc)
     //{
     //    foreach (Weapons weps in Enum.GetValues(typeof(Weapons)))
     //    {
     //        if (wep == weps.ToString())
     //        {
     //            Weapon w = new Weapon(weps);
     //            Equip(w);
     //            break;
     //        }
     //    }
     //}
 }
コード例 #28
0
        private void HandleCraftInteraction(string[] commandWords, Person actor)
        {
            string craftItemType = commandWords[2];
            string craftItemName = commandWords[3];

            if (craftItemType == "armor")
            {
                bool hasIron = false;

                foreach (var item in actor.ListInventory())
                {
                    if (item.ItemType == ItemType.Iron)
                    {
                        hasIron = true;
                        break;
                    }
                }

                if (hasIron)
                {
                    var addedItem = new Armor(craftItemName);
                    this.AddToPerson(actor, addedItem);
                    addedItem.UpdateWithInteraction("craft");
                }
            }

            if (craftItemType == "weapon")
            {
                bool hasWood = false;
                bool hasIron = false;

                foreach (var item in actor.ListInventory())
                {
                    if (item.ItemType == ItemType.Wood)
                    {
                        hasWood = true;
                    }
                    else if (item.ItemType == ItemType.Iron)
                    {
                        hasIron = true;
                    }
                }

                if (hasWood && hasIron)
                {
                    var addedItem = new Weapon(craftItemName);
                    this.AddToPerson(actor, addedItem);
                    addedItem.UpdateWithInteraction("craft");
                }
            }
        }
コード例 #29
0
ファイル: HealthRework.cs プロジェクト: shawnmiller/Capstone
    public void ReceiveDamage(float amount)
    {
        if (armor == null) {
          armor = gameObject.GetComponent<Armor>();
        }

        healthUpdates |= Constants.RESOURCE_UPDATE_CURRENT;

        float damageMod = 1 - armor.armor;
        amount *= damageMod;

        currentHealth = Mathf.Max(0f, currentHealth-amount);
        if(currentHealth == 0f) { OnDeath(); }
    }
コード例 #30
0
ファイル: ItemFactory.cs プロジェクト: JeffM2501/CSC370
    public static Armor AddArmor(string name, string icon, string maleLayer, string femaleLayer, Equipment.EquipmentLocation location, int value )
    {
        Armor armor = new Armor();
        armor.Name = name;
        armor.InventoryIcon = Resources.Load(icon) as Texture;
        armor.MaleEquipmentLayer = maleLayer;
        armor.FemaleEquipmentLayer = femaleLayer;
        armor.Location = location;
        armor.ArmorValue = value;

        Equipments.Add(name, armor);

        return armor;
    }
コード例 #31
0
    public void PopulateCompareData(Item refItem)
    {
        if (refItem.MyItemType == ItemType.WEAPON)
        {
            Weapon    wepRef = (refItem as Weapon);
            Transform header = ComparedItemPanel.Find("Header");
            header.Find("Item_Sprite").GetComponent <Image>().sprite  = wepRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = wepRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = wepRef.LevelRequirement.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + wepRef.SkillRequired);

            Transform stats        = ComparedItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = wepRef.Might.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = wepRef.Dexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = wepRef.Intelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = 0.ToString();


            //Resists
            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (refItem.MyItemType == ItemType.CHESTPLATE || refItem.MyItemType == ItemType.PLATELEGS || refItem.MyItemType == ItemType.HELMET || refItem.MyItemType == ItemType.ROBE || refItem.MyItemType == ItemType.TROUSERS || refItem.MyItemType == ItemType.HAT || refItem.MyItemType == ItemType.CHAPS || refItem.MyItemType == ItemType.CHESTGUARD || refItem.MyItemType == ItemType.COIF)
        {
            Armor     armorRef = (refItem as Armor);
            Transform header   = ComparedItemPanel.Find("Header");
            header.Find("Item_Sprite").GetComponent <Image>().sprite  = armorRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = armorRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = armorRef.LevelRequirement.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + armorRef.SkillRequired);

            Transform stats        = ComparedItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = armorRef.Might.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = armorRef.Dexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = armorRef.Intelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = 0.ToString();

            //Resists
            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (refItem.MyItemType == ItemType.TOOL)
        {
            Tool      toolRef = (refItem as Tool);
            Transform header  = ComparedItemPanel.Find("Header");
            header.Find("Item_Sprite").GetComponent <Image>().sprite  = toolRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = toolRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = toolRef.LevelReq.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + toolRef.RequiredSkill.ToString());

            Transform stats        = ComparedItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusMight.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusDexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusIntelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusArmor.ToString();

            //Resists
            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (refItem.MyItemType == ItemType.RESOURCE)
        {
        }
        else if (refItem.MyItemType != ItemType.UNASSIGNED)
        {
        }
        else
        {
            print("Item unassigned item type, somehow.");
        }
    }
コード例 #32
0
        /// <summary>
        /// Draw a player's Details
        /// </summary>
        /// <param name="player">Players whose details have to be drawn</param>
        /// <param name="isSelected">Whether player is selected or not</param>
        private void DrawPlayerDetails(Player player, bool isSelected)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            Vector2 position            = new Vector2();
            Vector2 equipEffectPosition = new Vector2();
            Color   textColor;
            Color   nameColor, classColor, levelColor;
            string  text;
            int     length;

            if (isSelected)
            {
                textColor  = Color.Black;
                nameColor  = new Color(241, 173, 10);
                classColor = new Color(207, 131, 42);
                levelColor = new Color(151, 150, 148);
            }
            else
            {
                textColor  = Color.DarkGray;
                nameColor  = new Color(117, 88, 18);
                classColor = new Color(125, 78, 24);
                levelColor = new Color(110, 106, 99);
            }

            position    = currentTextPosition;
            position.Y -= 5f * ScaledVector2.ScaleFactor;
            if (isSelected)
            {
                spriteBatch.Draw(playerSelTexture, position, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            }
            else
            {
                spriteBatch.Draw(playerUnSelTexture, position, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            }
            position.Y += 5f * ScaledVector2.ScaleFactor;

            // Draw portrait
            portraitPosition.X = (position.X + 3f * ScaledVector2.ScaleFactor);
            portraitPosition.Y = (position.Y + 16f * ScaledVector2.ScaleFactor);
            spriteBatch.Draw(player.ActivePortraitTexture, portraitPosition, null,
                             Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            if (isGearUsed && isSelected)
            {
                spriteBatch.Draw(tickMarkTexture, position, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            }

            // Draw Player Name
            playerNamePosition.X = (position.X + 90f * ScaledVector2.ScaleFactor);
            playerNamePosition.X = (position.X + 90f * ScaledVector2.ScaleFactor);
            playerNamePosition.Y = (position.Y);
            spriteBatch.DrawString(Fonts.PlayerNameFont,
                                   player.Name.ToUpper(), playerNamePosition, nameColor);

            // Draw Player Class
            playerNamePosition.Y += 25f * ScaledVector2.ScaleFactor;
            spriteBatch.DrawString(Fonts.PlayerNameFont, player.CharacterClass.Name,
                                   playerNamePosition, classColor);

            // Draw Player Level
            playerNamePosition.Y += 26f * ScaledVector2.ScaleFactor;
            spriteBatch.DrawString(Fonts.PlayerNameFont, "LEVEL: " +
                                   player.CharacterLevel,
                                   playerNamePosition, levelColor);
            position    = currentTextPosition;
            position.X += (playerSelTexture.Width + 60f * ScaledVector2.ScaleFactor);
            DrawPlayerStats(player, isSelected, ref position);

            equipEffectPosition    = position;
            equipEffectPosition.X += 100 * ScaledVector2.ScaleFactor;
            equipEffectPosition.Y  = currentTextPosition.Y;

            text   = "Weapon Atk: (";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont, text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            // calculate weapon damage
            previewDamageRange        = new Int32Range();
            previewHealthDefenseRange = new Int32Range();
            previewMagicDefenseRange  = new Int32Range();
            if (isSelected && isUseAllowed && !isGearUsed)
            {
                if (usedGear is Equipment)
                {
                    Equipment equipment = usedGear as Equipment;
                    if (equipment is Weapon)
                    {
                        Weapon weapon = equipment as Weapon;
                        previewDamageRange = weapon.TargetDamageRange;
                        Weapon equippedWeapon = player.GetEquippedWeapon();
                        if (equippedWeapon != null)
                        {
                            previewDamageRange -= equippedWeapon.TargetDamageRange;
                            previewDamageRange -=
                                equippedWeapon.OwnerBuffStatistics.PhysicalOffense;
                            previewHealthDefenseRange -=
                                equippedWeapon.OwnerBuffStatistics.PhysicalDefense;
                            previewMagicDefenseRange -=
                                equippedWeapon.OwnerBuffStatistics.MagicalDefense;
                        }
                    }
                    else if (equipment is Armor)
                    {
                        Armor armor = usedGear as Armor;
                        previewHealthDefenseRange = armor.OwnerHealthDefenseRange;
                        previewMagicDefenseRange  = armor.OwnerMagicDefenseRange;
                        Armor equippedArmor = player.GetEquippedArmor(armor.Slot);
                        if (equippedArmor != null)
                        {
                            previewHealthDefenseRange -=
                                equippedArmor.OwnerHealthDefenseRange;
                            previewMagicDefenseRange -=
                                equippedArmor.OwnerMagicDefenseRange;
                            previewDamageRange -=
                                equippedArmor.OwnerBuffStatistics.PhysicalOffense;
                            previewHealthDefenseRange -=
                                equippedArmor.OwnerBuffStatistics.PhysicalDefense;
                            previewMagicDefenseRange -=
                                equippedArmor.OwnerBuffStatistics.MagicalDefense;
                        }
                    }
                    previewDamageRange        += equipment.OwnerBuffStatistics.PhysicalOffense;
                    previewHealthDefenseRange +=
                        equipment.OwnerBuffStatistics.PhysicalDefense;
                    previewMagicDefenseRange +=
                        equipment.OwnerBuffStatistics.MagicalDefense;
                }
            }

            Int32Range drawWeaponDamageRange = player.TargetDamageRange +
                                               previewDamageRange + player.CharacterStatistics.PhysicalOffense;

            text   = drawWeaponDamageRange.Minimum.ToString();
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewDamageRange.Minimum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            text   = ",";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont,
                                   text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            text   = drawWeaponDamageRange.Maximum.ToString();;
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewDamageRange.Maximum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            spriteBatch.DrawString(Fonts.DescriptionFont, ")", equipEffectPosition,
                                   Fonts.CountColor);

            equipEffectPosition.X  = position.X + 100f * ScaledVector2.ScaleFactor;
            equipEffectPosition.Y += Fonts.DescriptionFont.LineSpacing;
            text   = "Weapon Def: (";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont, text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            Int32Range drawHealthDefenseRange = player.HealthDefenseRange +
                                                previewHealthDefenseRange + player.CharacterStatistics.PhysicalDefense;

            text   = drawHealthDefenseRange.Minimum.ToString();
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewHealthDefenseRange.Minimum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            text   = ",";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont, text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            text   = drawHealthDefenseRange.Maximum.ToString();
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewHealthDefenseRange.Maximum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            spriteBatch.DrawString(Fonts.DescriptionFont, ")", equipEffectPosition,
                                   Fonts.CountColor);


            equipEffectPosition.X  = position.X + 100f * ScaledVector2.ScaleFactor;
            equipEffectPosition.Y += Fonts.DescriptionFont.LineSpacing;
            text   = "Spell Def: (";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont, text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            Int32Range drawMagicDefenseRange = player.MagicDefenseRange +
                                               previewMagicDefenseRange + player.CharacterStatistics.MagicalDefense;

            text   = drawMagicDefenseRange.Minimum.ToString();
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewMagicDefenseRange.Minimum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            text   = ",";
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            spriteBatch.DrawString(Fonts.DescriptionFont, text, equipEffectPosition,
                                   Fonts.CountColor);
            equipEffectPosition.X += length;

            text   = drawMagicDefenseRange.Maximum.ToString();
            length = (int)Fonts.DescriptionFont.MeasureString(text).X;

            textColor = GetRangeColor(previewMagicDefenseRange.Maximum, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, text,
                                   equipEffectPosition, textColor);
            equipEffectPosition.X += length;

            spriteBatch.DrawString(Fonts.DescriptionFont, ")", equipEffectPosition,
                                   Fonts.CountColor);

            currentTextPosition.Y = position.Y + 3f * ScaledVector2.ScaleFactor;

            spriteBatch.Draw(lineTexture, currentTextPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            currentTextPosition.Y += 20f * ScaledVector2.ScaleFactor;
        }
コード例 #33
0
    public Equipment Generate()
    {
        Armor armor = Resources.Load("Prefabs/Equipment/Armor/" + armorName) as Armor;

        return(armor);
    }
コード例 #34
0
ファイル: GameManager.cs プロジェクト: F1r3w0lf/VRHololense2
    void generatePlayers()
    {
        UserPlayer player;

        player = ((GameObject)Instantiate(UserPlayerPrefab, new Vector3(0 - Mathf.Floor(mapSize / 2), 0.5f, -0 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <UserPlayer>();
        player.gridPosition = new Vector2(0, 0);
        player.playerName   = "Bob";
        player.headArmor    = Armor.FromKey(ArmorKey.LeatherCap);
        player.chestArmor   = Armor.FromKey(ArmorKey.MagicianCloak);
        player.handWeapons.Add(Weapon.FromKey(WeaponKey.LongSword));

        players.Add(player);

        player = ((GameObject)Instantiate(UserPlayerPrefab, new Vector3((mapSize - 1) - Mathf.Floor(mapSize / 2), 0.5f, -(mapSize - 1) + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <UserPlayer>();
        player.gridPosition = new Vector2(mapSize - 1, mapSize - 1);
        player.playerName   = "Kyle";
        player.chestArmor   = Armor.FromKey(ArmorKey.LeatherVest);
        player.handWeapons.Add(Weapon.FromKey(WeaponKey.ShortSword));
        player.handWeapons.Add(Weapon.FromKey(WeaponKey.ShortSword));

        players.Add(player);

        player = ((GameObject)Instantiate(UserPlayerPrefab, new Vector3(4 - Mathf.Floor(mapSize / 2), 0.5f, -5 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <UserPlayer>();
        player.gridPosition = new Vector2(4, 5);
        player.playerName   = "Lars";
        player.chestArmor   = Armor.FromKey(ArmorKey.IronPlate);
        player.handWeapons.Add(Weapon.FromKey(WeaponKey.Warhammer));

        players.Add(player);

        player = ((GameObject)Instantiate(UserPlayerPrefab, new Vector3(8 - Mathf.Floor(mapSize / 2), 0.5f, -8 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <UserPlayer>();
        player.gridPosition = new Vector2(8, 8);
        player.playerName   = "Olivia";
        player.chestArmor   = Armor.FromKey(ArmorKey.MagicianCloak);
        player.handWeapons.Add(Weapon.FromKey(WeaponKey.LongBow));

        players.Add(player);

        AIPlayer aiplayer = ((GameObject)Instantiate(AIPlayerPrefab, new Vector3(6 - Mathf.Floor(mapSize / 2), 1.5f, -4 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <AIPlayer>();

        aiplayer.gridPosition = new Vector2(6, 4);
        aiplayer.playerName   = "Bot1";
        aiplayer.chestArmor   = Armor.FromKey(ArmorKey.IronHelmet);
        aiplayer.handWeapons.Add(Weapon.FromKey(WeaponKey.LongSword));

        players.Add(aiplayer);

        aiplayer = ((GameObject)Instantiate(AIPlayerPrefab, new Vector3(8 - Mathf.Floor(mapSize / 2), 1.5f, -4 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <AIPlayer>();
        aiplayer.gridPosition = new Vector2(8, 4);
        aiplayer.playerName   = "Bot2";
        aiplayer.handWeapons.Add(Weapon.FromKey(WeaponKey.LongSword));

        players.Add(aiplayer);

        aiplayer = ((GameObject)Instantiate(AIPlayerPrefab, new Vector3(12 - Mathf.Floor(mapSize / 2), 1.5f, -1 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <AIPlayer>();
        aiplayer.gridPosition = new Vector2(12, 1);
        aiplayer.playerName   = "Bot3";
        aiplayer.chestArmor   = Armor.FromKey(ArmorKey.LeatherVest);
        aiplayer.handWeapons.Add(Weapon.FromKey(WeaponKey.ShortBow));

        players.Add(aiplayer);

        aiplayer = ((GameObject)Instantiate(AIPlayerPrefab, new Vector3(18 - Mathf.Floor(mapSize / 2), 1.5f, -8 + Mathf.Floor(mapSize / 2)), Quaternion.Euler(new Vector3()), gameObject.transform)).GetComponent <AIPlayer>();
        aiplayer.gridPosition = new Vector2(18, 8);
        aiplayer.playerName   = "Bot4";
        aiplayer.handWeapons.Add(Weapon.FromKey(WeaponKey.LongSword));

        players.Add(aiplayer);
    }
コード例 #35
0
 public QuestRewardViewModel(Armor armor)
 {
     Content = armor.Name;
 }
コード例 #36
0
    public void AddArmorByID(int ID)
    {
        Armor armor = wIM.GetArmor(ID);

        armorInventory.Add(armor);
    }
コード例 #37
0
 public void AddArmor(Armor armor)
 {
     armorInventory.Add(armor);
 }
コード例 #38
0
    public void EnemyDeath(EnemyData data, bool suicide = false)
    {
        QuickPopUp.QuickPopUpAllowed = true;
        BattleUiLerper.StartReverseLerp();


        StartCoroutine(_EnemyDeath());

        IEnumerator _EnemyDeath()
        {
            Followers.Remove(data);
            AttackArea.SetActive(false);

            if (Player.Health.Value <= 0)
            {
                OnPlayerDeath();
                yield break;
            }

            if (data.OneAndDoneAttacker && suicide)
            {
                PlayerAnimations.Instance.ResetAttack();

                yield return(new WaitForSeconds(1)); // Wait for suicide animation to complete

                PlayerAnimations.Instance.Spin(() => {
                    _Done(new List <Item>());
                });
                yield break;
            }

            SoundManager.Instance.PlaySound(SoundManager.Instance.Celebrate, 0.8f);

            bool celebrateDone = false;
            bool bubblesDone   = false;

            List <Item> items = data.Drops.GetItems(true);

            foreach (Item item in items)
            {
                if (item is Weapon)
                {
                    Weapon weapon = item as Weapon;
                    weapon.Level = data.Level;
                }
                if (item is Armor)
                {
                    Armor armor = item as Armor;
                    armor.Level = data.Level;
                }
                if (item is Headgear)
                {
                    Headgear hg = item as Headgear;
                    hg.Level = data.Level;
                }
            }

            // Wait for player celebration to be done and all items to be picked up
            PlayerAnimations.Instance.ResetAttack();
            PlayerAnimations.Instance.Celebrate(() => {
                celebrateDone = true;
                if (bubblesDone && celebrateDone)
                {
                    _Done(items);
                }
            });

            ItemDropBubbleManager.Instance.AddItems(items, null, () => {
                bubblesDone = true;
                if (bubblesDone && celebrateDone)
                {
                    _Done(items);
                }
            });
        }

        void _Done(List <Item> items)
        {
            PlayerAnimations.Instance.Spin(() => {
                // Enable world to be interactable again
                // Turn off enemy fight.
                EnemyDisplay.Instance.gameObject.SetActive(false);
                // Call combat end event (nah)

                DeadEnemyController.Instance.AddDeadEnemy(
                    EnemyDisplay.Instance.RectTransform.anchoredPosition.x,
                    EnemyDisplay.Instance.RectTransform.anchoredPosition.y,
                    data);

                GameEventHandler.Singleton.OnEnemyKilled(data);
                Inventory.AddItems(items);
                World.Enable();

                PlayerClickController.Instance.SetEnabled(true);

                // Note: If the boss quest is to fight a chicken and you kill any chicken (not just the boss) then the quest gets completed
                if (CurrentQuest.Value is BossQuest quest && quest.Enemy.ID == data.ID)
                {
                    quest.Finish();
                }

                Fighting = false;
            });
        }
    }
コード例 #39
0
        /// <summary>
        /// 类型:方法
        /// 名称:GetCharacter
        /// 作者:taixihuase
        /// 作用:尝试从数据库获取玩家游戏角色信息
        /// 编写日期:2015/7/24
        /// </summary>
        /// <param name="character"></param>
        /// <returns></returns>
        public CharacterCollection.CharacterReturn GetCharacter(Character character)
        {
            CharacterCollection.CharacterReturn characterReturn = new CharacterCollection.CharacterReturn();

            if (character.Nickname == "abcd" || character.Nickname == "efgh")
            {
                #region 测试用例

                character.Position.SetPosition(10, 20, 30);
                int[] exp = new int[DataConstraint.CharacterMaxLevel];
                exp[0] = 0;
                for (int i = 1; i < exp.Length; i++)
                {
                    exp[i] = exp[i - 1] + 10;
                }
                character.Experience.SetEachLevelDemand(exp);
                character.Experience.SetExperience(0, 0, 0, 0);
                character.Experience.GainExperience(0);

                character.Occupation.UpdateOccupation(OccupationCode.Warrior, "战士");
                character.Occupation.BaseHitPoint     = 50;
                character.Occupation.BaseLifeRecovery = 5;
                character.Occupation.BaseMana         = 10;
                character.Occupation.BaseManaRecovery = 1;
                character.Occupation.Apply(character.Attribute);

                Weapon w = new Weapon(1, 2, "刀", OccupationCode.Warrior | OccupationCode.Paladin, 1, true, 1,
                                      DataConstraint.EquipmentMaxDurability, 0, 200, 200, Weapon.WeaponType.Null,
                                      Weapon.WeaponAttackType.Physical,
                                      Weapon.WeaponElementType.Null);

                character.Weapons.Add(1, w);
                w.UpdateAttackLimit(100, 200, null, null);
                w.UpdateFixedAttribute(AttributeCode.Attack_Physical, 100);
                w.UpdateFixedAttribute(AttributeCode.Attack_Percent_Both, 10);
                w.Upgrade();
                w.Upgrade();
                w.Upgrade(AttributeCode.Attack_Percent_Both, 90);
                w.UpdateElementAttribute(Weapon.WeaponElementType.Lightning);
                w.UpgradeElementAttribute(0);
                w.UpgradeElementEnhanceAttribute(300);
                w.UpgradeElementExtraAttribute(10, 2);

                Armor a = new Armor(10, 20, "头盔", OccupationCode.Warrior, 1, true, 1,
                                    DataConstraint.EquipmentMaxDurability, Armor.ArmorType.Helmet);

                character.Armors.Add(1, a);
                a.UpdateDefensePoints(1000, 2000);
                a.UpdateFixedAttribute(AttributeCode.Life_Increase, 1000);
                a.Upgrade();
                a.Upgrade(AttributeCode.Life_Increase_Percent, 50);

                Jewel j = new Jewel(100, 200, "戒指", OccupationCode.Common, 1, false, 1,
                                    DataConstraint.EquipmentMaxDurability, Jewel.JewelType.Ring, Jewel.JewelAttributeType.Null);

                character.Jewels.Add(1, j);
                j.UpdateFixedAttribute(AttributeCode.Resistance_All, 22222);
                j.UpdateRandomAttribute(AttributeCode.Attr_Strength, 1234);

                #endregion

                characterReturn.ReturnCode = Success;
                characterReturn.DebugMessage.Append("成功获取角色数据");
            }
            else
            {
                characterReturn.ReturnCode = CharacterNotFound;
                characterReturn.DebugMessage.Append("当前账号尚未创建角色");
            }

            return(characterReturn);
        }
コード例 #40
0
ファイル: Game.cs プロジェクト: Will1400/MoriaMinesGame
        private void AddItemsToRooms()
        {
            // Create items
            #region Items
            Flashlight wetFlashlight      = new Flashlight("Wet Flashlight", "Commonly found in ponds of water.", false, 0, -3, 70, 40);
            Flashlight standardFlashlight = new Flashlight("Flashlight", "Your average flashlight from the local store.", false, 2, -1, 60, 60);
            Flashlight highTechFlashlight = new Flashlight("High Tech Flashlight", "The best flashlight", true, 10, 2, 100, 100);

            Sword rustySword = new Sword(1, 3, "Sword", "Bit rusty but still functional", false, 2);

            Potion healingPotion = new Potion(2, false, "Heals you for some life", "Healing Potion", 3, "Healing", 25);

            Armor armor = new Armor(rnd.Next(5, 10), 1, false, "Protects you from some damage", "Armor");
            #endregion
            // Add items to rooms
            for (int i = 0; i < rooms.Count - 1; i++)
            {
                if (i != 0)
                {
                    // 25% chance to add a item to the room
                    if (rnd.Next(1, 4) == 1)
                    {
                        Room currentRoom = rooms[i];

                        switch (rnd.Next(0, 5))
                        {
                        case 0:
                            currentRoom.Item = rustySword;
                            if (currentRoom.Item is Sword sword)
                            {
                                sword.Damage = rnd.Next(2, 10);
                            }
                            break;

                        case 1:
                            if (rnd.Next(1, 11) == 10)
                            {
                                currentRoom.Item = highTechFlashlight;
                            }
                            else
                            {
                                currentRoom.Item = standardFlashlight;
                            }
                            break;

                        case 2:
                            currentRoom.Item = wetFlashlight;
                            break;

                        case 3:
                            currentRoom.Item = healingPotion;
                            break;

                        case 4:
                            armor.ArmorValue = rnd.Next(1, 10);
                            currentRoom.Item = armor;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
コード例 #41
0
 public ArmorV1_0(Armor a) :
     base(a.ID, a.COST, a.MAX_HP)
 {
 }
コード例 #42
0
ファイル: UnitActions.cs プロジェクト: koehlera99/AKxNet
 public void EquipArmor(Armor armor)
 {
     UnEquipArmor(armor.ArmorSlot);
     armor.IsEquiped = true;
     EquipedArmor.Add(armor.ArmorSlot, armor);
 }
コード例 #43
0
 public SteelArmorBuilder()
 {
     armor = new Armor("Steel Armor");
 }
コード例 #44
0
        /// <summary>
        /// Update the information for the selected Armor Mod.
        /// </summary>
        private void UpdateSelectedArmor()
        {
            // Retireve the information for the selected Accessory.
            XmlNode objXmlMod = _objXmlDocument.SelectSingleNode("/chummer/mods/mod[id = \"" + lstMod.SelectedValue + "\"]");

            TreeNode        objTreeNode  = new TreeNode();
            List <Weapon>   lstWeapons   = new List <Weapon>();
            List <TreeNode> lstTreeNodes = new List <TreeNode>();
            ArmorMod        objMod       = new ArmorMod(_objCharacter);

            objMod.Create(objXmlMod, objTreeNode, Convert.ToInt32(nudRating.Value), lstWeapons, lstTreeNodes, true, false);

            // If an Armor Cost has been given, create a dummy Armor and assign it as the Mod's parent so that the cost can be used.
            if (_intArmorCost != 0)
            {
                Armor objArmor = new Armor(_objCharacter);
                objArmor.Cost = _intArmorCost;
                objMod.Parent = objArmor;
            }

            // Extract the Avil and Cost values from the Cyberware info since these may contain formulas and/or be based off of the Rating.
            // This is done using XPathExpression.
            XPathNavigator nav = _objXmlDocument.CreateNavigator();

            if (objMod.ArmorValue < 0)
            {
                lblArmor.Text = objMod.ArmorValue.ToString();
            }
            else
            {
                lblArmor.Text = "+" + objMod.ArmorValue.ToString();
            }

            nudRating.Maximum = Convert.ToDecimal(objMod.MaxRating, GlobalOptions.Instance.CultureInfo);
            if (nudRating.Maximum == 1)
            {
                nudRating.Enabled = false;
            }
            else
            {
                nudRating.Enabled = true;
            }

            lblAvail.Text = objMod.TotalAvail;

            // Cost.
            string strCost = objXmlMod["cost"].InnerText.Replace("Rating", nudRating.Value.ToString());

            strCost = strCost.Replace("Armor Cost", _intArmorCost.ToString());
            XPathExpression xprCost = nav.Compile(strCost);

            // Apply any markup.
            double dblCost = Convert.ToDouble(objMod.TotalCost, GlobalOptions.Instance.CultureInfo);

            dblCost *= 1 + (Convert.ToDouble(nudMarkup.Value, GlobalOptions.Instance.CultureInfo) / 100.0);

            lblCost.Text = String.Format("{0:###,###,##0¥}", dblCost);

            int intCost = Convert.ToInt32(dblCost);

            lblTest.Text = _objCharacter.AvailTest(intCost, lblAvail.Text);

            // Capacity.
            lblCapacity.Text = objMod.CalculatedCapacity;

            if (chkFreeItem.Checked)
            {
                lblCost.Text = String.Format("{0:###,###,##0¥}", 0);
            }

            string strBook = objMod.Source;
            string strPage = objMod.Page;

            lblSource.Text = strBook + " " + strPage;

            tipTooltip.SetToolTip(lblSource, _objCharacter.Options.LanguageBookLong(objMod.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + strPage);
        }
コード例 #45
0
        public override void ClearItems()
        {
            if (Armor != null)
            {
                List <Item> list = new List <Item>(Armor.Where(i => i != null && !i.Deleted));

                foreach (Item armor in list)
                {
                    armor.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Armor);
                Armor = null;
            }

            if (DestroyedArmor != null)
            {
                List <Item> list = new List <Item>(DestroyedArmor.Where(i => i != null && !i.Deleted));

                foreach (Item dest in list)
                {
                    dest.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(DestroyedArmor);
                DestroyedArmor = null;
            }

            if (Spawn != null)
            {
                List <BaseCreature> list = new List <BaseCreature>(Spawn.Where(s => s != null && !s.Deleted));

                foreach (BaseCreature spawn in list)
                {
                    spawn.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Spawn);
                Spawn = null;
            }

            if (Items != null)
            {
                List <Item> list = new List <Item>(Items.Where(i => i != null && !i.Deleted));

                foreach (Item item in list)
                {
                    item.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Items);
                Items = null;
            }
        }
コード例 #46
0
 public ArmorCombination(Armor headArmor, Armor neckArmor, Armor shouldersArmor, Armor backArmor, Armor chestArmor, Armor wristArmor, Armor handsArmor, Armor waistArmor, Armor legsArmor, Armor feetArmor, Armor fingerArmor, Armor finger2Armor, Armor trinketArmor, Armor trinket2Armor)
 {
     HeadArmor      = headArmor;
     NeckArmor      = neckArmor;
     ShouldersArmor = shouldersArmor;
     BackArmor      = backArmor;
     ChestArmor     = chestArmor;
     WristArmor     = wristArmor;
     HandsArmor     = handsArmor;
     WaistArmor     = waistArmor;
     LegsArmor      = legsArmor;
     FeetArmor      = feetArmor;
     FingerArmor    = fingerArmor;
     Finger2Armor   = finger2Armor;
     TrinketArmor   = trinketArmor;
     Trinket2Armor  = trinket2Armor;
     Rating         = 0f;
 }
コード例 #47
0
        /// <summary>
        /// Draw a Player's stats
        /// </summary>
        /// <param name="player">Player whose stats have to be drawn</param>
        /// <param name="isSelected">Whether player is selected or not</param>
        /// <param name="position">Position as to
        /// where to start drawing the stats</param>
        private void DrawPlayerStats(Player player, bool isSelected,
                                     ref Vector2 position)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            Color  color;
            string detail1, detail2;
            float  length1, length2;

            StatisticsValue playersStatisticsModifier = new StatisticsValue();

            if (isSelected && isUseAllowed && !isGearUsed)
            {
                playersStatisticsModifier = previewStatisticsModifier;
                if (usedGear is Armor)
                {
                    Armor armor         = usedGear as Armor;
                    Armor existingArmor = player.GetEquippedArmor(armor.Slot);
                    if (existingArmor != null)
                    {
                        playersStatisticsModifier -= existingArmor.OwnerBuffStatistics;
                    }
                }
                else if (usedGear is Weapon)
                {
                    Weapon weapon         = usedGear as Weapon;
                    Weapon existingWeapon = player.GetEquippedWeapon();
                    if (existingWeapon != null)
                    {
                        playersStatisticsModifier -= existingWeapon.OwnerBuffStatistics;
                    }
                }
            }

            // Calculate HP and MP string Length
            detail1 = "HP: " + player.CurrentStatistics.HealthPoints + "/" +
                      player.CharacterStatistics.HealthPoints;
            length1 = Fonts.DescriptionFont.MeasureString(detail1).X;
            detail2 = "MP: " + player.CurrentStatistics.MagicPoints + "/" +
                      player.CharacterStatistics.MagicPoints;
            length2 = Fonts.DescriptionFont.MeasureString(detail2).X;

            StatisticsValue drawCurrentStatistics   = player.CurrentStatistics;
            StatisticsValue drawCharacterStatistics = player.CharacterStatistics;

            if (isSelected)
            {
                drawCurrentStatistics   += playersStatisticsModifier;
                drawCharacterStatistics += playersStatisticsModifier;
            }

            // Draw the character Health Points
            color = GetStatColor(playersStatisticsModifier.HealthPoints, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "HP: " +
                                   drawCurrentStatistics.HealthPoints + "/" +
                                   drawCharacterStatistics.HealthPoints,
                                   position, color);

            // Draw the character Mana Points
            position.Y += Fonts.DescriptionFont.LineSpacing;
            color       = GetStatColor(playersStatisticsModifier.MagicPoints, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "MP: " +
                                   drawCurrentStatistics.MagicPoints + "/" +
                                   drawCharacterStatistics.MagicPoints,
                                   position, color);

            // Draw the physical offense
            position.X += 150f * ScaledVector2.ScaleFactor;
            position.Y -= Fonts.DescriptionFont.LineSpacing;
            color       = GetStatColor(playersStatisticsModifier.PhysicalOffense, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "PO: " +
                                   drawCurrentStatistics.PhysicalOffense, position, color);

            // Draw the physical defense
            position.Y += Fonts.DescriptionFont.LineSpacing;
            color       = GetStatColor(playersStatisticsModifier.PhysicalDefense, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "PD: " +
                                   drawCurrentStatistics.PhysicalDefense, position, color);

            // Draw the Magic offense
            position.Y += Fonts.DescriptionFont.LineSpacing;
            color       = GetStatColor(playersStatisticsModifier.MagicalOffense, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "MO: " +
                                   drawCurrentStatistics.MagicalOffense, position, color);

            // Draw the Magical defense
            position.Y += Fonts.DescriptionFont.LineSpacing;
            color       = GetStatColor(playersStatisticsModifier.MagicalDefense, isSelected);
            spriteBatch.DrawString(Fonts.DescriptionFont, "MD: " +
                                   drawCurrentStatistics.MagicalDefense, position, color);


            position.Y += Fonts.DescriptionFont.LineSpacing;
        }
コード例 #48
0
ファイル: Player.cs プロジェクト: HashiY/Akumajou-Dorakyura
 public void AddArmor(Armor item)
 {
     armor   = item;
     defense = armor.defense;
 }
コード例 #49
0
    public void PopulateHoverData(Item refItem)
    {
        if (refItem == null)
        {
            return;
        }

        if (refItem.MyItemType == ItemType.WEAPON)
        {
            Weapon    wepRef = (refItem as Weapon);
            Transform header = HoveredItemPanel.Find("Header");
            if (wepRef == null)
            {
                return;
            }

            header.Find("Item_Sprite").GetComponent <Image>().sprite  = wepRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = wepRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = wepRef.LevelRequirement.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + wepRef.SkillRequired);

            Transform stats        = HoveredItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = wepRef.Might.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = wepRef.Dexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = wepRef.Intelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = 0.ToString();

            //Resistances:
            //Fire, Ice
            //Explosive, Shock
            //Poison, Void
            //Arcane, Spectral

            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (Player_Equipment_Script.ArmorItemTypes.Contains(refItem.MyItemType))
        {
            Armor     armorRef = (refItem as Armor);
            Transform header   = HoveredItemPanel.Find("Header");
            header.Find("Item_Sprite").GetComponent <Image>().sprite  = armorRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = armorRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = armorRef.LevelRequirement.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + armorRef.SkillRequired);

            Transform stats        = HoveredItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = armorRef.Might.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = armorRef.Dexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = armorRef.Intelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = 0.ToString();

            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (refItem.MyItemType == ItemType.TOOL)
        {
            print("Hit Tool population");
            Tool      toolRef = (refItem as Tool);
            Transform header  = HoveredItemPanel.Find("Header");
            header.Find("Item_Sprite").GetComponent <Image>().sprite  = toolRef.Icon;
            header.Find("Item_Name").GetComponent <Text>().text       = toolRef.ItemName;
            header.Find("Item_Level").GetComponent <Text>().text      = "";
            header.Find("Required_Level").GetComponent <Text>().text  = toolRef.LevelReq.ToString();
            header.Find("Skill_Sprite").GetComponent <Image>().sprite = Resources.Load <Sprite>("SkillIcons/" + toolRef.RequiredSkill.ToString());

            Transform stats        = HoveredItemPanel.Find("Stats");
            Transform mightSection = stats.Find("Column").GetChild(0);
            mightSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[mightSection.name];
            mightSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusMight.ToString();


            Transform dexSection = stats.Find("Column").GetChild(1);
            dexSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[dexSection.name];
            dexSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusDexterity.ToString();

            Transform intSection = stats.Find("Column").GetChild(2);
            intSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            intSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusIntelligence.ToString();

            Transform armorSection = stats.Find("Column").GetChild(3);
            armorSection.GetChild(0).GetComponent <Image>().sprite = StatIcons[intSection.name];
            armorSection.GetChild(1).GetComponent <Text>().text    = toolRef.BonusArmor.ToString();

            //Resists
            Transform leftResistColumn  = stats.Find("Column1");
            Transform rightResistColumn = stats.Find("Column2");

            for (int i = 0; i < 4; i++)
            {
                leftResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite  = StatIcons[leftResistColumn.GetChild(i).name];
                rightResistColumn.GetChild(i).GetChild(0).GetComponent <Image>().sprite = StatIcons[rightResistColumn.GetChild(i).name];
                leftResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text     = 0.ToString();
                rightResistColumn.GetChild(i).GetChild(1).GetComponent <Text>().text    = 0.ToString();
            }
        }
        else if (refItem.MyItemType == ItemType.RESOURCE)
        {
        }
        else if (refItem.MyItemType != ItemType.UNASSIGNED)
        {
        }
        else
        {
            print("Item unassigned item type, somehow.");
        }
    }
コード例 #50
0
ファイル: Armor.cs プロジェクト: mancypelosi/lc_unity
    // List of all armor
    public List <Armor> ArmorList()
    {
        List <Armor> armorList = new List <Armor>();

        Armor armor;

        /***************/
        /*** TIER 0 ***/
        /*************/

        // Create base head armor
        armor = new Armor
        {
            itemId        = 0001,
            name          = "Loose Cap",
            spritePath    = "Icons/helm",
            rarity        = Rarity.Common,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Head,
            strength      = 1,
            dexterity     = 1,
            intelligence  = 1,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create base chest armor
        armor = new Armor
        {
            itemId        = 0002,
            name          = "Loose Shirt",
            spritePath    = "Icons/chest",
            rarity        = Rarity.Common,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Chest,
            strength      = 1,
            dexterity     = 1,
            intelligence  = 1,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create base glove armor
        armor = new Armor
        {
            itemId        = 0003,
            name          = "Loose Gloves",
            spritePath    = "Icons/gloves2",
            rarity        = Rarity.Common,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Gloves,
            strength      = 1,
            dexterity     = 1,
            intelligence  = 1,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create base legs armor
        armor = new Armor
        {
            itemId        = 0004,
            name          = "Loose Legs",
            spritePath    = "Icons/legs",
            rarity        = Rarity.Common,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Legs,
            strength      = 1,
            dexterity     = 1,
            intelligence  = 1,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create base boots armor
        armor = new Armor
        {
            itemId        = 0005,
            name          = "Loose Boots",
            spritePath    = "Icons/boots2",
            rarity        = Rarity.Common,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Boots,
            strength      = 1,
            dexterity     = 1,
            intelligence  = 1,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        /***************/
        /*** TIER 1 ***/
        /*************/

        // Create leather head armor
        armor = new Armor
        {
            itemId        = 1001,
            name          = "Leather Helm",
            spritePath    = "Icons/helm",
            rarity        = Rarity.Uncommon,
            buyValue      = 20,
            sellValue     = 10,
            requiredLevel = 1,
            armorType     = ArmorType.Head,
            strength      = 2,
            dexterity     = 2,
            intelligence  = 2,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create leather chest armor
        armor = new Armor
        {
            itemId        = 1002,
            name          = "Leather Chest",
            spritePath    = "Icons/chest",
            rarity        = Rarity.Uncommon,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Chest,
            strength      = 2,
            dexterity     = 2,
            intelligence  = 2,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create leather gloves armor
        armor = new Armor
        {
            itemId        = 1003,
            name          = "Leather Gloves",
            spritePath    = "Icons/gloves2",
            rarity        = Rarity.Uncommon,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Gloves,
            strength      = 2,
            dexterity     = 2,
            intelligence  = 2,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create leather legs armor
        armor = new Armor
        {
            itemId        = 1004,
            name          = "Leather Legs",
            spritePath    = "Icons/legs",
            rarity        = Rarity.Uncommon,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Legs,
            strength      = 2,
            dexterity     = 2,
            intelligence  = 2,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        // Create leather boots armor
        armor = new Armor
        {
            itemId        = 1005,
            name          = "Leather Boots",
            spritePath    = "Icons/boots2",
            rarity        = Rarity.Uncommon,
            buyValue      = 10,
            sellValue     = 5,
            requiredLevel = 1,
            armorType     = ArmorType.Boots,
            strength      = 2,
            dexterity     = 2,
            intelligence  = 2,
            critChance    = 0,
            critDamage    = 0,
        };
        armorList.Add(armor);

        /********************/
        /*** LEGENDARIES ***/
        /******************/

        return(armorList);
    }
コード例 #51
0
ファイル: SlotScript.cs プロジェクト: x3n0r/U3DRPG
    /// <summary>
    /// Whem the slot is clicked
    /// </summary>
    /// <param name="eventData"></param>
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (InventoryScript.MyInstance.FromSlot == null && !IsEmpty) //If we don't have something to move
            {
                if (HandScript.MyInstance.MyMoveable != null)
                {
                    if (HandScript.MyInstance.MyMoveable is Bag)
                    {
                        if (MyItem is Bag)
                        {
                            InventoryScript.MyInstance.SwapBags(HandScript.MyInstance.MyMoveable as Bag, MyItem as Bag);
                        }
                    }
                    else if (HandScript.MyInstance.MyMoveable is Armor)
                    {
                        if (MyItem is Armor && (MyItem as Armor).MyArmorType == (HandScript.MyInstance.MyMoveable as Armor).MyArmorType)
                        {
                            (MyItem as Armor).Equip();

                            HandScript.MyInstance.Drop();
                        }
                    }
                }
                else
                {
                    HandScript.MyInstance.TakeMoveable(MyItem as IMoveable);
                    InventoryScript.MyInstance.FromSlot = this;
                }
            }
            else if (InventoryScript.MyInstance.FromSlot == null && IsEmpty)
            {
                if (HandScript.MyInstance.MyMoveable is Bag)
                {
                    //Dequips a bag from the inventory
                    Bag bag = (Bag)HandScript.MyInstance.MyMoveable;

                    //Makes sure we cant dequip it into itself and that we have enough space for the items from the dequipped bag
                    if (bag.MyBagScript != MyBag && InventoryScript.MyInstance.MyEmptySlotCount - bag.Slots > 0)
                    {
                        AddItem(bag);
                        bag.MyBagButton.RemoveBag();
                        HandScript.MyInstance.Drop();
                    }
                }
                else if (HandScript.MyInstance.MyMoveable is Armor)
                {
                    Armor armor = (Armor)HandScript.MyInstance.MyMoveable;
                    AddItem(armor);
                    CharacterPanel.MyInstance.MySlectedButton.DequipArmor();
                    HandScript.MyInstance.Drop();
                }
            }
            else if (InventoryScript.MyInstance.FromSlot != null)//If we have something to move
            {
                //We will try to do diffrent things to place the item back into the inventory
                if (PutItemBack() || MergeItems(InventoryScript.MyInstance.FromSlot) || SwapItems(InventoryScript.MyInstance.FromSlot) || AddItems(InventoryScript.MyInstance.FromSlot.MyItems))
                {
                    HandScript.MyInstance.Drop();
                    InventoryScript.MyInstance.FromSlot = null;
                }
            }
        }
        if (eventData.button == PointerEventData.InputButton.Right && HandScript.MyInstance.MyMoveable == null)//If we rightclick on the slot
        {
            UseItem();
        }
    }
コード例 #52
0
    public static Armor FromKey(ArmorKey key)
    {
        Armor ret = new Armor();

        switch (key)
        {
        //head
        case ArmorKey.LeatherCap:
            ret = new Armor()
            {
                type = ArmorSlotType.Head,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 1,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0,
                alterMovementPerActionPoint = 0
            };
            break;

        case ArmorKey.IronHelmet:
            ret = new Armor()
            {
                type = ArmorSlotType.Head,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 3,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = -0.15f,
                alterMovementPerActionPoint = -1
            };
            break;

        case ArmorKey.MagicianHat:
            ret = new Armor()
            {
                type = ArmorSlotType.Head,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 0,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0.15f,
                alterMovementPerActionPoint = 1
            };
            break;

        //chest
        case ArmorKey.LeatherVest:
            ret = new Armor()
            {
                type = ArmorSlotType.Chest,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 2,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0,
                alterMovementPerActionPoint = -1
            };
            break;

        case ArmorKey.IronPlate:
            ret = new Armor()
            {
                type = ArmorSlotType.Chest,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 3,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = -0.15f,
                alterMovementPerActionPoint = -2
            };
            break;

        case ArmorKey.MagicianCloak:
            ret = new Armor()
            {
                type = ArmorSlotType.Chest,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 0,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0.15f,
                alterMovementPerActionPoint = 2
            };
            break;

        //gauntlets
        case ArmorKey.LeatherGauntlet:
            ret = new Armor()
            {
                type = ArmorSlotType.Gauntlet,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 1,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0,
                alterMovementPerActionPoint = 0
            };
            break;

        case ArmorKey.IronGauntlet:
            ret = new Armor()
            {
                type = ArmorSlotType.Gauntlet,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 3,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = -0.15f,
                alterMovementPerActionPoint = 0
            };
            break;

        case ArmorKey.MagicianRing:
            ret = new Armor()
            {
                type = ArmorSlotType.Gauntlet,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 0,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0.15f,
                alterMovementPerActionPoint = 1
            };
            break;
        //legs

        case ArmorKey.LeatherBoots:
            ret = new Armor()
            {
                type = ArmorSlotType.Leg,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 1,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0,
                alterMovementPerActionPoint = 0
            };
            break;

        case ArmorKey.IronBoots:
            ret = new Armor()
            {
                type = ArmorSlotType.Leg,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 3,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = -0.15f,
                alterMovementPerActionPoint = -2
            };
            break;

        case ArmorKey.MagicianBoots:
            ret = new Armor()
            {
                type = ArmorSlotType.Leg,

                alterAttackChance           = 0,
                alterAttackRange            = 0,
                alterDamageReduction        = 0,
                alterDamageBase             = 0,
                alterDamageRollSides        = 0,
                alterEvade                  = 0.15f,
                alterMovementPerActionPoint = 2
            };
            break;
        }
        return(ret);
    }
コード例 #53
0
        /// <summary>
        /// Builds the list of Armors to render in the active tab.
        /// </summary>
        /// <param name="objXmlArmorList">XmlNodeList of Armors to render.</param>
        private void BuildArmorList(XmlNodeList objXmlArmorList)
        {
            switch (tabControl.SelectedIndex)
            {
            case 1:
                DataTable tabArmor = new DataTable("armor");
                tabArmor.Columns.Add("ArmorGuid");
                tabArmor.Columns.Add("ArmorName");
                tabArmor.Columns.Add("Armor");
                tabArmor.Columns["Armor"].DataType = typeof(Int32);
                tabArmor.Columns.Add("Capacity");
                tabArmor.Columns["Capacity"].DataType = typeof(Int32);
                tabArmor.Columns.Add("Avail");
                tabArmor.Columns.Add("Special");
                tabArmor.Columns.Add("Source");
                tabArmor.Columns.Add("Cost");
                tabArmor.Columns["Cost"].DataType = typeof(Int32);

                // Populate the Armor list.
                foreach (XmlNode objXmlArmor in objXmlArmorList)
                {
                    if (Backend.Shared_Methods.SelectionShared.CheckAvailRestriction(objXmlArmor, _objCharacter, chkHideOverAvailLimit.Checked,
                                                                                     Convert.ToInt32(nudRating.Value)))
                    {
                        TreeNode      objNode    = new TreeNode();
                        Armor         objArmor   = new Armor(_objCharacter);
                        List <Weapon> lstWeapons = new List <Weapon>();
                        objArmor.Create(objXmlArmor, objNode, null, 0, lstWeapons, true, true, true);

                        string  strArmorGuid   = objArmor.SourceID.ToString();
                        string  strArmorName   = objArmor.DisplayName;
                        int     intArmor       = objArmor.TotalArmor;
                        decimal decCapacity    = Convert.ToDecimal(objArmor.CalculatedCapacity, GlobalOptions.CultureInfo);
                        string  strAvail       = objArmor.Avail;
                        string  strAccessories = string.Empty;
                        foreach (ArmorMod objMod in objArmor.ArmorMods)
                        {
                            if (strAccessories.Length > 0)
                            {
                                strAccessories += "\n";
                            }
                            strAccessories += objMod.DisplayName;
                        }
                        foreach (Gear objGear in objArmor.Gear)
                        {
                            if (strAccessories.Length > 0)
                            {
                                strAccessories += "\n";
                            }
                            strAccessories += objGear.DisplayName;
                        }
                        string  strSource = objArmor.Source + " " + objArmor.Page;
                        decimal decCost   = objArmor.Cost;

                        tabArmor.Rows.Add(strArmorGuid, strArmorName, intArmor, decCapacity, strAvail, strAccessories,
                                          strSource, decCost);
                    }
                }

                DataSet set = new DataSet("armor");
                set.Tables.Add(tabArmor);

                dgvArmor.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                dgvArmor.DataSource       = set;
                dgvArmor.DataMember       = "armor";
                break;

            default:
                List <ListItem> lstArmors = new List <ListItem>();
                foreach (XmlNode objXmlArmor in objXmlArmorList)
                {
                    if (Backend.Shared_Methods.SelectionShared.CheckAvailRestriction(objXmlArmor, _objCharacter, chkHideOverAvailLimit.Checked,
                                                                                     Convert.ToInt32(nudRating.Value)))
                    {
                        ListItem objItem = new ListItem();
                        objItem.Value = objXmlArmor["id"]?.InnerText;
                        objItem.Name  = objXmlArmor["translate"]?.InnerText ?? objXmlArmor["name"]?.InnerText;

                        if (objXmlArmor["category"] != null)
                        {
                            ListItem objFoundItem =
                                _lstCategory.Find(objFind => objFind.Value == objXmlArmor["category"].InnerText);
                            if (objFoundItem != null)
                            {
                                objItem.Name += " [" + objFoundItem.Name + "]";
                            }
                            lstArmors.Add(objItem);
                        }
                    }
                }
                SortListItem objSort = new SortListItem();
                lstArmors.Sort(objSort.Compare);
                lstArmor.BeginUpdate();
                lstArmor.DataSource    = null;
                lstArmor.ValueMember   = "Value";
                lstArmor.DisplayMember = "Name";
                lstArmor.DataSource    = lstArmors;
                lstArmor.EndUpdate();
                break;
            }
        }
コード例 #54
0
        private void UpdateArmorInfo()
        {
            // Get the information for the selected piece of Armor.
            XmlNode objXmlArmor = _objXmlDocument.SelectSingleNode("/chummer/armors/armor[id = \"" + lstArmor.SelectedValue + "\"]");

            if (objXmlArmor == null)
            {
                return;
            }
            // Create the Armor so we can show its Total Avail (some Armor includes Chemical Seal which adds +6 which wouldn't be factored in properly otherwise).
            Armor         objArmor   = new Armor(_objCharacter);
            TreeNode      objNode    = new TreeNode();
            List <Weapon> lstWeapons = new List <Weapon>();

            objArmor.Create(objXmlArmor, objNode, null, 0, lstWeapons, true, true, true);

            // Check for a Variable Cost.
            XmlElement xmlCostElement = objXmlArmor["cost"];

            if (xmlCostElement != null)
            {
                decimal decItemCost = 0.0m;
                if (chkFreeItem.Checked)
                {
                    lblCost.Text = $"{0:###,###,##0.##¥}";
                    decItemCost  = 0;
                }
                else if (xmlCostElement.InnerText.StartsWith("Variable"))
                {
                    decimal decMin;
                    decimal decMax  = decimal.MaxValue;
                    string  strCost = xmlCostElement.InnerText.TrimStart("Variable", true).Trim("()".ToCharArray());
                    if (strCost.Contains('-'))
                    {
                        string[] strValues = strCost.Split('-');
                        decMin = Convert.ToDecimal(strValues[0], GlobalOptions.InvariantCultureInfo);
                        decMax = Convert.ToDecimal(strValues[1], GlobalOptions.InvariantCultureInfo);
                    }
                    else
                    {
                        decMin = Convert.ToDecimal(strCost.FastEscape('+'), GlobalOptions.InvariantCultureInfo);
                    }

                    if (decMax == decimal.MaxValue)
                    {
                        lblCost.Text = $"{decMin:###,###,##0.##¥+}";
                    }
                    else
                    {
                        lblCost.Text = $"{decMin:###,###,##0.##} - {decMax:###,###,##0.##¥}";
                    }

                    decItemCost = decMin;
                }
                else if (xmlCostElement.InnerText.Contains("Rating"))
                {
                    XPathNavigator  nav     = _objXmlDocument.CreateNavigator();
                    XPathExpression xprCost =
                        nav.Compile(xmlCostElement.InnerText.Replace("Rating",
                                                                     nudRating.Value.ToString(GlobalOptions.InvariantCultureInfo)));
                    decItemCost  = (Convert.ToDecimal(nav.Evaluate(xprCost), GlobalOptions.InvariantCultureInfo));
                    decItemCost *= 1 + (nudMarkup.Value / 100.0m);
                    if (chkBlackMarketDiscount.Checked)
                    {
                        decItemCost *= 0.9m;
                    }
                    lblCost.Text = $"{decItemCost:###,###,##0.##¥}";
                }
                else
                {
                    decItemCost *= 1 + (nudMarkup.Value / 100.0m);
                    if (chkBlackMarketDiscount.Checked)
                    {
                        decItemCost *= 0.9m;
                    }
                    lblCost.Text = $"{decItemCost:###,###,##0.##¥}";
                }

                lblCapacity.Text = objXmlArmor["armorcapacity"]?.InnerText;

                lblTest.Text = _objCharacter.AvailTest(decItemCost, lblAvail.Text);

                string strBook = _objCharacter.Options.LanguageBookShort(objXmlArmor["source"]?.InnerText);
                string strPage = objXmlArmor["page"]?.InnerText;
                if (objXmlArmor["altpage"] != null)
                {
                    strPage = objXmlArmor["altpage"].InnerText;
                }
                lblSource.Text = strBook + " " + strPage;


                tipTooltip.SetToolTip(lblSource,
                                      _objCharacter.Options.LanguageBookLong(objXmlArmor["source"]?.InnerText) + " " +
                                      LanguageManager.GetString("String_Page") + " " + strPage);
            }
        }
コード例 #55
0
ファイル: Character.cs プロジェクト: jslawski/499FinalProject
 void DropArmor(Armor armorToBeDropped)
 {
     print("<color=red>DropArmor() not implemented yet.</color>");
 }
コード例 #56
0
        public List <BaseItem> GetAllItemsInNpcBag(byte bag, int npcId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag);

            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId);

            characterIdParameter.DbType = DbType.Int32;

            List <BaseItem> items = new List <BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_REFERENCEID    = reader.GetOrdinal(DbNames.ITEM_REFID);
            int ordinalITEM_BTYPE          = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND          = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID       = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_CLASS          = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT         = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_PRICE          = reader.GetOrdinal(DbNames.ITEM_PRICE);
            int ordinalITEM_LEVEL          = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX            = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR            = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA            = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE            = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_DURABILITY     = reader.GetOrdinal(DbNames.ITEM_DURABILITY);
            int ordinalITEM_DAMAGE         = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE        = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING   = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED    = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE    = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE     = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA     = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN      = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN      = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL       = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID        = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE      = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE  = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID    = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA  = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_MAXIMBUETRIES  = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_BAG            = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT           = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX          = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY          = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);



                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace ||
                    BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon)
                    {
                        b = new Hammer();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                    }



                    Equipment e = b as Equipment;
                    e.RequiredLevel     = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength  = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina   = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy    = reader.GetInt16(ordinalITEM_ENE);
                    e.Durability        = reader.GetInt32(ordinalITEM_DURABILITY);
                    e.MaxDurability     = e.Durability;
                    e.Damage            = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence           = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating      = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed       = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange       = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife        = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana        = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen      = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen      = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical          = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.MaxImbueTries     = reader.GetByte(ordinalITEM_MAXIMBUETRIES);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance   = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp   = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID       = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel    = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData     = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ReferenceID   = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID      = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag           = reader.GetByte(ordinalITEM_BAG);
                b.Slot          = reader.GetByte(ordinalITEM_SLOT);
                b.bType         = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind         = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount        = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX         = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY         = reader.GetByte(ordinalITEM_SIZEY);
                b.Price         = reader.GetInt32(ordinalITEM_PRICE);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return(items);
        }
コード例 #57
0
ファイル: InventoryManager.cs プロジェクト: Kagamins/ProjectV
 void AddItemArmor(Armor addedarmor)
 {
     GameInformation.InventoryArmors.Add(addedarmor);
 }
コード例 #58
0
        static void Main(string[] args)
        {
            int    fr, dex, agi, cons, intel, will, per, car;
            string name;

            Console.WriteLine("Criação de personagem para Daemon");
            Console.WriteLine("Nome do personagem:");
            name = Console.ReadLine();

            Console.WriteLine("Escolha uma classe: ");
            Console.WriteLine("1 - Tanque (FR 15, DEX 14, AGI 14, CONS 18, INT 10, WILL 10, PER 9, CAR 11)");
            Console.WriteLine("2 - Arqueiro (FR 12, DEX 17, AGI 16, CONS 11, INT 10, WILL 12, PER 14, CAR 9)");
            Console.WriteLine("3 - Mago (FR 9, DEX 13, AGI 12, CONS 10, INT 18, WILL 16, PER 12, CAR 11)");
            Console.WriteLine();
            int classChoice = int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            switch (classChoice)
            {
            case 1:
                fr    = 15;
                dex   = 14;
                agi   = 14;
                cons  = 18;
                intel = 10;
                will  = 10;
                per   = 9;
                car   = 11;
                break;

            case 2:
                fr    = 12;
                dex   = 17;
                agi   = 16;
                cons  = 11;
                intel = 10;
                will  = 12;
                per   = 14;
                car   = 9;
                break;

            case 3:
                fr    = 9;
                dex   = 13;
                agi   = 12;
                cons  = 10;
                intel = 18;
                will  = 16;
                per   = 12;
                car   = 11;
                break;

            default:
                fr    = 15;
                dex   = 14;
                agi   = 14;
                cons  = 18;
                intel = 10;
                will  = 10;
                per   = 9;
                car   = 11;
                break;
            }

            PlayerCharacter playerCharacter = new PlayerCharacter(name, 19, fr, dex, agi, cons, intel, will, per, car);

            Console.WriteLine("Personagem escolhido: ");
            Console.WriteLine();
            Console.WriteLine(playerCharacter.ToString());
            Console.WriteLine("--------------------------");
            Console.WriteLine("Pontos de perícia: " + ((playerCharacter.Intelligence * 5) + (playerCharacter.Age * 10)));
            Console.WriteLine("--------------------------");

            playerCharacter.CombatSkills.Add(new CombatSkill("Briga", playerCharacter.getMod(playerCharacter.Agility), playerCharacter.getMod(playerCharacter.Agility)));
            playerCharacter.CombatSkills.Add(new CombatSkill("Arcos", playerCharacter.getMod(playerCharacter.Dexterity), 0));
            playerCharacter.CombatSkills.Add(new CombatSkill("Escudos", 0, playerCharacter.getMod(playerCharacter.Constitution)));
            playerCharacter.CombatSkills.Add(new CombatSkill("Espadas", playerCharacter.getMod(playerCharacter.Dexterity), playerCharacter.getMod(playerCharacter.Dexterity)));

            Console.WriteLine("PERÍCIAS DE COMBATE");
            foreach (CombatSkill skill in playerCharacter.CombatSkills)
            {
                Console.WriteLine(skill.ToString());
            }

            Console.WriteLine("--------------------------");

            playerCharacter.CommonSkills.Add(new Skill("Esquiva", playerCharacter.getMod(playerCharacter.Agility)));
            playerCharacter.CommonSkills.Add(new Skill("Observação", playerCharacter.getMod(playerCharacter.Perception)));
            playerCharacter.CommonSkills.Add(new Skill("Intimidação", playerCharacter.getMod(playerCharacter.useGreaterMod(playerCharacter.Charisma, playerCharacter.Constitution))));

            Console.WriteLine("PERÍCIAS");
            foreach (Skill skill in playerCharacter.CommonSkills)
            {
                Console.WriteLine(skill.ToString());
            }

            Console.WriteLine();
            Console.WriteLine("--------------------------");
            Console.WriteLine("ITENS");

            List <Damage> weaponDamageList = new List <Damage>();
            Damage        weaponDamage     = new Damage(DamageType.Cinetic, 1, 10);

            weaponDamageList.Add(weaponDamage);
            weaponDamage = new Damage(DamageType.Fire, 1, 7);
            weaponDamageList.Add(weaponDamage);
            List <DamageType> weaponDamageTypeList1 = new List <DamageType>();

            weaponDamageTypeList1.Add(DamageType.Fire);
            Weapon fireLongSword = new Weapon(0142, "Espada Longa", weaponDamageTypeList1, -5, weaponDamageList);

            Console.WriteLine(fireLongSword.ToString());

            List <Damage> secondWeaponDamageList = new List <Damage>();

            weaponDamage = new Damage(DamageType.Cinetic, 3, 8);
            secondWeaponDamageList.Add(weaponDamage);
            weaponDamage = new Damage(DamageType.Cold, 2, 5);
            secondWeaponDamageList.Add(weaponDamage);
            int[] reach = { 80, 200 };

            List <DamageType> weaponDamageTypeList2 = new List <DamageType>();

            weaponDamageTypeList2.Add(DamageType.Cold);

            Weapon frostLongBow = new Weapon(0315, "Arco Longo", weaponDamageTypeList2, -9, reach, secondWeaponDamageList);

            Console.WriteLine(frostLongBow.ToString());

            List <Damage> protectionIndexList = new List <Damage>();
            Damage        protectionIndex     = new Damage(DamageType.Cinetic, 3);

            protectionIndexList.Add(protectionIndex);
            protectionIndex = new Damage(DamageType.Wind, 2);
            protectionIndexList.Add(protectionIndex);

            List <DamageType> ipType = new List <DamageType>();

            ipType.Add(DamageType.Wind);

            Armor galeChainShirt = new Armor(8214, "Cota de Malha", ipType, -4, -3, protectionIndexList);

            /*
             * List<DamageType> armorDamageTypeList1 = new List<DamageType>();
             * armorDamageTypeList1.Add(DamageType.Wind);
             */
            // Armor galeChainShirt = new Armor(2310, "do Vendaval", "Cota de Malha", -4, -3, new List<Damage>(protectionIndexList));
            Console.WriteLine(galeChainShirt.ToString());
        }
コード例 #59
0
    public void RefreshUI()
    {
        if (_init == false)
        {
            return;
        }

        // 전체 가림
        Get <Image>((int)Images.Slot_Helmet).enabled = false;
        Get <Image>((int)Images.Slot_Armor).enabled  = false;
        Get <Image>((int)Images.Slot_Boots).enabled  = false;
        Get <Image>((int)Images.Slot_Weapon).enabled = false;
        Get <Image>((int)Images.Slot_Shield).enabled = false;

        // 착용 채움
        foreach (Item item in Managers.Inven.Items.Values)
        {
            if (item.Equipped == false)
            {
                continue;
            }

            ItemData itemData = null;
            Managers.Data.ItemDict.TryGetValue(item.TemplateId, out itemData);
            Sprite icon = Managers.Resource.Load <Sprite>(itemData.iconPath);

            if (item.ItemType == ItemType.Weapon)
            {
                Get <Image>((int)Images.Slot_Weapon).enabled = true;
                Get <Image>((int)Images.Slot_Weapon).sprite  = icon;
            }
            else if (item.ItemType == ItemType.Armor)
            {
                Armor armor = (Armor)item;
                switch (armor.ArmorType)
                {
                case ArmorType.Helmet:
                    Get <Image>((int)Images.Slot_Helmet).enabled = true;
                    Get <Image>((int)Images.Slot_Helmet).sprite  = icon;
                    break;

                case ArmorType.Armor:
                    Get <Image>((int)Images.Slot_Armor).enabled = true;
                    Get <Image>((int)Images.Slot_Armor).sprite  = icon;
                    break;

                case ArmorType.Boots:
                    Get <Image>((int)Images.Slot_Boots).enabled = true;
                    Get <Image>((int)Images.Slot_Boots).sprite  = icon;
                    break;
                }
            }
        }

        // 텍스트 처리
        MyPlayerController player = Managers.Object.MyPlayer;

        player.RefreshAdditionalStat();

        Get <Text>((int)Texts.NameText).text         = player.name;
        Get <Text>((int)Texts.AttackValueText).text  = $"{player.Stat.Attack} (+{player.WeaponDamage})";
        Get <Text>((int)Texts.DefenceValueText).text = $"0 (+{player.ArmorDefence})";
    }
コード例 #60
0
        public static void CustomArmorService(IUserInterfaceWindow window)
        {
            Debug.Log("Custom Armor service.");

            PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
            ItemHelper   itemHelper   = DaggerfallUnity.Instance.ItemHelper;

            if (playerEntity.Level < 9)
            {
                DaggerfallUI.MessageBox("Sorry I have not yet sourced enough rare materials to make you armor.");
                return;
            }
            ItemCollection armorItems = new ItemCollection();
            Array          armorTypes = itemHelper.GetEnumArray(ItemGroups.Armor);

            foreach (ArmorMaterialTypes material in customArmorMaterials)
            {
                if (playerEntity.Level < 9 ||
                    (playerEntity.Level < 12 && material >= ArmorMaterialTypes.Adamantium) ||
                    (playerEntity.Level < 15 && material >= ArmorMaterialTypes.Orcish) ||
                    (playerEntity.Level < 18 && material >= ArmorMaterialTypes.Daedric))
                {
                    break;
                }

                for (int i = 0; i < armorTypes.Length; i++)
                {
                    Armor        armorType    = (Armor)armorTypes.GetValue(i);
                    ItemTemplate itemTemplate = itemHelper.GetItemTemplate(ItemGroups.Armor, i);
                    int          vs           = 0;
                    int          vf           = 0;
                    switch (armorType)
                    {
                    case Armor.Cuirass:
                    case Armor.Left_Pauldron:
                    case Armor.Right_Pauldron:
                        vs = 1;
                        vf = 3;
                        break;

                    case Armor.Greaves:
                        vs = 2;
                        vf = 5;
                        break;

                    case Armor.Gauntlets:
                        vs = 1;
                        vf = 1;
                        break;

                    case Armor.Boots:
                    case Armor.Helm:
                        vs = 1;
                        vf = itemTemplate.variants - 1;
                        break;

                    default:
                        continue;
                    }
                    for (int v = vs; v <= vf; v++)
                    {
                        armorItems.AddItem(ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, armorType, material, v));
                    }
                }
                int[] customItemTemplates = itemHelper.GetCustomItemsForGroup(ItemGroups.Armor);
                for (int i = 0; i < customItemTemplates.Length; i++)
                {
                    DaggerfallUnityItem item = ItemBuilder.CreateItem(ItemGroups.Armor, customItemTemplates[i]);
                    ItemBuilder.ApplyArmorSettings(item, playerEntity.Gender, playerEntity.Race, material);
                    armorItems.AddItem(item);
                }
            }

            DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)
                                                UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, null });

            tradeWindow.MerchantItems = armorItems;
            DaggerfallUI.UIManager.PushWindow(tradeWindow);
        }