当前位置: 首页>>代码示例>>C#>>正文


C# Weapon.Is方法代码示例

本文整理汇总了C#中Weapon.Is方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.Is方法的具体用法?C# Weapon.Is怎么用?C# Weapon.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon.Is方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttackSource

            public AttackSource(string name, AttackSkill skill, Weapon weapon)
            {
                Name = name;

                if (weapon == null) // Spells get damage from gem local attributes.
                {
                    Nature = new DamageNature(skill.Nature);

                    foreach (var attr in skill.Local)
                    {
                        Damage damage = Damage.Create(skill.Nature, attr);
                        if (damage != null) Deals.Add(damage);
                    }

                    if (skill.Gem.Attributes.ContainsKey("Cast Time: # sec"))
                    {
                        CastTime = skill.Gem.Attributes["Cast Time: # sec"][0];
                        APS = 1 / CastTime;
                    }
                    else
                        APS = CastTime = 1; // Spell without Cast Time has cast time of 1 second.

                    if (skill.Gem.Attributes.ContainsKey("Critical Strike Chance: #%"))
                        CriticalChance = skill.Gem.Attributes["Critical Strike Chance: #%"][0];
                    else
                        CriticalChance = 0; // Spell without Critical Strike Chance has none.

                    Local = new AttributeSet(); // No local weapon attributes.
                }
                else
                {
                    if ((skill.Nature.WeaponType & weapon.Nature.WeaponType) == 0) // Skill can't be used.
                        // Override weapon type and form of skill with actual weapon (client shows damage of unuseable skills as well).
                        Nature = new DamageNature(skill.Nature) { Form = weapon.Nature.Form, WeaponHand = weapon.Hand, WeaponType = weapon.Nature.WeaponType };
                    else // Narrow down weapon type and form of skill gem to actual weapon (e.g. Frenzy).
                        Nature = new DamageNature(skill.Nature)
                        {
                            Form = skill.Nature.ChooseWeaponForm(weapon.Nature), // XXX: Choose between melee or projectile form according to weapon.
                            WeaponHand = weapon.Hand,
                            WeaponType = skill.Nature.WeaponType & weapon.Nature.WeaponType
                        };

                    // XXX: If source has no form, but skill has form defined, then force form of skill.
                    // This happens in form transition from melee to projectile with skills like Spectral Throw.
                    if (Nature.Form == DamageForm.Any && skill.Nature.Form != DamageForm.Any)
                        Nature.Form = skill.Nature.Form;

                    foreach (Damage damage in weapon.Deals)
                        Deals.Add(new Damage(damage) { Form = Nature.Form, Source = Nature.Source, WeaponHand = Nature.WeaponHand, WeaponType = Nature.WeaponType });

                    foreach (Damage.Added added in weapon.Added)
                        if (weapon.Is(added.Hand)) // Added damage may require specific hand.
                            added.Apply(this, 100);

                    APS = weapon.Attributes["Attacks per Second: #"][0];

                    if (weapon.Attributes.ContainsKey("Critical Strike Chance: #%"))
                        CriticalChance = weapon.Attributes["Critical Strike Chance: #%"][0];
                    else
                        CriticalChance = 0; // Weapon without Critical Strike Chance has none.

                    Local = weapon.Attributes;
                }
            }
开发者ID:Daendaralus,项目名称:PoESkillTree,代码行数:64,代码来源:Compute.cs

示例2: Initialize

        // Initializes structures.
        public static void Initialize(SkillTree skillTree, ItemAttributes itemAttrs)
        {
            Items = itemAttrs.Equip.ToList();

            MainHand = new Weapon(WeaponHand.Main, Items.Find(i => i.Class == ItemClass.MainHand));
            OffHand = new Weapon(WeaponHand.Off, Items.Find(i => i.Class == ItemClass.OffHand));

            // If main hand weapon has Counts as Dual Wielding modifier, then clone weapon to off hand.
            // @see http://pathofexile.gamepedia.com/Wings_of_Entropy
            if (MainHand.Attributes.ContainsKey("Counts as Dual Wielding"))
                OffHand = MainHand.Clone(WeaponHand.Off);

            IsDualWielding = MainHand.IsWeapon() && OffHand.IsWeapon();
            if (IsDualWielding)
            {
                // Set dual wielded bit on weapons.
                MainHand.Hand |= WeaponHand.DualWielded;
                OffHand.Hand |= WeaponHand.DualWielded;
            }
            IsWieldingShield = MainHand.Is(WeaponType.Shield) || OffHand.Is(WeaponType.Shield);
            IsWieldingStaff = MainHand.Is(WeaponType.Staff);

            Level = skillTree.Level;
            if (Level < 1) Level = 1;
            else if (Level > 100) Level = 100;

            Global = new AttributeSet();

            Tree = new AttributeSet(skillTree.SelectedAttributesWithoutImplicit);
            Global.Add(Tree);

            // Keystones.
            Acrobatics = Tree.ContainsKey("#% Chance to Dodge Attacks. #% less Armour and Energy Shield, #% less Chance to Block Spells and Attacks");
            AvatarOfFire = Tree.ContainsKey("Deal no Non-Fire Damage");
            BloodMagic = Tree.ContainsKey("Removes all mana. Spend Life instead of Mana for Skills");
            ChaosInoculation = Tree.ContainsKey("Maximum Life becomes #, Immune to Chaos Damage");
            IronGrip = Tree.ContainsKey("The increase to Physical Damage from Strength applies to Projectile Attacks as well as Melee Attacks");
            IronReflexes = Tree.ContainsKey("Converts all Evasion Rating to Armour. Dexterity provides no bonus to Evasion Rating");
            NecromanticAegis = Tree.ContainsKey("All bonuses from an equipped Shield apply to your Minions instead of you");
            ResoluteTechnique = Tree.ContainsKey("Never deal Critical Strikes");
            VaalPact = Tree.ContainsKey("Life Leech applies instantly at #% effectiveness. Life Regeneration has no effect.");
            ZealotsOath = Tree.ContainsKey("Life Regeneration applies to Energy Shield instead of Life");

            Equipment = new AttributeSet();
            foreach (ItemAttributes.Attribute attr in itemAttrs.NonLocalMods)
                Equipment.Add(attr.TextAttribute, new List<float>(attr.Value));

            if (NecromanticAegis && OffHand.IsShield())
            {
                // Remove all bonuses of shield from equipment set.
                // @see http://pathofexile.gamepedia.com/Necromantic_Aegis
                foreach (var attr in OffHand.Attributes)
                    Equipment.Remove(attr);
                // Remove all bonuses from shield itself.
                OffHand.Attributes.Clear();
            }

            Global.Add(Equipment);

            CoreAttributes();

            Implicit = new AttributeSet(SkillTree.ImplicitAttributes(Global, Level));
            Global.Add(Implicit);

            // Innate dual wielding bonuses.
            // @see http://pathofexile.gamepedia.com/Dual_wielding
            if (IsDualWielding)
            {
                Global["#% more Attack Speed"] = new List<float>() { 10 };
                Global["#% more Physical Damage with Weapons"] = new List<float>() { 20 };
            }
        }
开发者ID:Daendaralus,项目名称:PoESkillTree,代码行数:73,代码来源:Compute.cs


注:本文中的Weapon.Is方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。