Server.AosWeaponAttributes.GetValue C# (CSharp) Méthode

GetValue() public static méthode

public static GetValue ( Server.Mobile m, AosWeaponAttribute attribute ) : int
m Server.Mobile
attribute AosWeaponAttribute
Résultat int
        public static int GetValue( Mobile m, AosWeaponAttribute attribute )
        {
            if( !Core.AOS )
                return 0;

            List<Item> items = m.Items;
            int value = 0;

            for( int i = 0; i < items.Count; ++i )
            {
                Item obj = items[i];

                if( obj is BaseWeapon )
                {
                    AosWeaponAttributes attrs = ((BaseWeapon)obj).WeaponAttributes;

                    if( attrs != null )
                        value += attrs[attribute];
                }

                else if ( obj is ElvenGlasses )
                {
                    AosWeaponAttributes attrs = ((ElvenGlasses)obj).WeaponAttributes;

                    if( attrs != null )
                        value += attrs[attribute];
                }
            }

            return value;
        }

Usage Example

        public static void IncreaseBattleLust(Mobile m, int damage)
        {
            if (damage < 30)
            {
                return;
            }
            else if (AosWeaponAttributes.GetValue(m, AosWeaponAttribute.BattleLust) == 0)
            {
                return;
            }
            else if (m_Table.ContainsKey(m))
            {
                if (m_Table[m].CanGain)
                {
                    if (m_Table[m].Bonus < 16)
                    {
                        m_Table[m].Bonus++;
                    }

                    m_Table[m].CanGain = false;
                }
            }
            else
            {
                BattleLustTimer blt = new BattleLustTimer(m, 1);
                blt.Start();
                m_Table.Add(m, blt);
                m.SendLocalizedMessage(1113748); // The damage you received fuels your battle fury.
            }
        }