Exemple #1
0
        public static int GetValue(Mobile m, MagicalAttribute attribute)
        {
            int value = 0;

            foreach (var item in m.GetEquippedItems())
            {
                if (item is IMagicalItem)
                {
                    MagicalAttributes attrs = ((IMagicalItem)item).Attributes;

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

                if (item is IMagicalBonus)
                {
                    value += ((IMagicalBonus)item).GetAttributeBonus(attribute);
                }
            }

            return(value);
        }
Exemple #2
0
        public virtual int GetMagicalAttribute( MagicalAttribute attr )
        {
            int value = MagicalAttributes.GetValue( this, attr );

            if ( m_AttributeMods != null )
            {
                for ( int i = 0; i < m_AttributeMods.Count; i++ )
                {
                    AttributeMod mod = m_AttributeMods[i];

                    if ( mod.Attribute == attr )
                        value += mod.Offset;
                }
            }

            return value;
        }
Exemple #3
0
 public AttributeMod( MagicalAttribute attr, int offset )
 {
     m_Attribute = attr;
     m_Offset = offset;
 }
Exemple #4
0
 private static void ApplyAttribute( MagicalAttributes attrs, int min, int max, MagicalAttribute attr, int low, int high, int scale )
 {
     if ( attr == MagicalAttribute.CastSpeed )
         attrs[attr] += Scale( min, max, low / scale, high / scale ) * scale;
     else
         attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
 }
Exemple #5
0
 private static void ApplyAttribute( MagicalAttributes attrs, int min, int max, MagicalAttribute attr, int low, int high )
 {
     ApplyAttribute( attrs, min, max, attr, low, high, 1 );
 }
Exemple #6
0
        public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            MagicalAttributes primary     = weapon.Attributes;
            WeaponAttributes  secondary   = weapon.WeaponAttributes;
            ElementAttributes resistances = weapon.Resistances;

            m_Props.SetAll(false);

            if (weapon is BaseRanged || weapon is BaseThrowing)
            {
                m_Props.Set(2, true);                   // ranged weapons cannot be ubws or mageweapon
            }

            if (!(weapon is BaseRanged))
            {
                m_Props.Set(28, true);                   // Solo los arcos pueden llevar la propiedad Balanced
                m_Props.Set(29, true);                   // Solo los arcos pueden llevar la propiedad Velocity
            }

            if (isRunicTool)
            {
                m_Props.Set(16, true);                   // Lower requirements don't spawn from runic tools
            }
            bool isRunicToolRanged = isRunicTool && weapon is BaseRanged;

            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(30);

                if (random == -1)
                {
                    break;
                }

                switch (random)
                {
                case 0:
                {
                    switch (Utility.Random(5))
                    {
                    case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.HitPhysicalArea, 2, 50, 2); break;

                    case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.HitFireArea, 2, 50, 2); break;

                    case 2: ApplyAttribute(secondary, min, max, WeaponAttribute.HitColdArea, 2, 50, 2); break;

                    case 3: ApplyAttribute(secondary, min, max, WeaponAttribute.HitPoisonArea, 2, 50, 2); break;

                    case 4: ApplyAttribute(secondary, min, max, WeaponAttribute.HitEnergyArea, 2, 50, 2); break;
                    }

                    break;
                }

                case 1:
                {
                    switch (Utility.Random(4))
                    {
                    case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.HitMagicArrow, 2, 50, 2); break;

                    case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.HitHarm, 2, 50, 2); break;

                    case 2: ApplyAttribute(secondary, min, max, WeaponAttribute.HitFireball, 2, 50, 2); break;

                    case 3: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLightning, 2, 50, 2); break;
                    }

                    break;
                }

                case 2:
                {
                    switch (Utility.Random(2))
                    {
                    case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.UseBestSkill, 1, 1); break;

                    case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.MageWeapon, 1, 10); break;
                    }

                    break;
                }

                case 3:
                {
                    MagicalAttribute attr = MagicalAttribute.WeaponDamage;
                    int oldValue          = primary[attr];

                    ApplyAttribute(primary, min, max, attr, 1, 50);

                    if (oldValue >= primary[attr])
                    {
                        primary[attr] = oldValue;
                        i--;
                    }

                    break;
                }

                case 4: ApplyAttribute(primary, min, max, MagicalAttribute.DefendChance, 1, isRunicToolRanged ? 25 : 15); break;

                case 5: ApplyAttribute(primary, min, max, MagicalAttribute.CastSpeed, 1, 1); break;

                case 6: ApplyAttribute(primary, min, max, MagicalAttribute.AttackChance, 1, isRunicToolRanged ? 25 : 15); break;

                case 7: ApplyAttribute(primary, min, max, MagicalAttribute.Luck, 1, isRunicToolRanged ? 120 : 100); break;

                case 8: ApplyAttribute(primary, min, max, MagicalAttribute.WeaponSpeed, 5, 30, 5); break;

                case 9: ApplyAttribute(primary, min, max, MagicalAttribute.SpellChanneling, 1, 1); break;

                case 10: ApplyAttribute(secondary, min, max, WeaponAttribute.HitDispel, 2, 50, 2); break;

                case 11: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechHits, 2, 50, 2); break;

                case 12: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLowerAttack, 2, 50, 2); break;

                case 13: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLowerDefend, 2, 50, 2); break;

                case 14: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechMana, 2, 50, 2); break;

                case 15: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechStam, 2, 50, 2); break;

                case 16: ApplyAttribute(secondary, min, max, WeaponAttribute.LowerStatReq, 10, 100, 10); break;

                case 17: ApplyAttribute(resistances, min, max, ElementAttribute.Physical, 1, 15); break;

                case 18: ApplyAttribute(resistances, min, max, ElementAttribute.Fire, 1, 15); break;

                case 19: ApplyAttribute(resistances, min, max, ElementAttribute.Cold, 1, 15); break;

                case 20: ApplyAttribute(resistances, min, max, ElementAttribute.Poison, 1, 15); break;

                case 21: ApplyAttribute(resistances, min, max, ElementAttribute.Energy, 1, 15); break;

                case 22: ApplyAttribute(secondary, min, max, WeaponAttribute.DurabilityBonus, 10, 100, 10); i--; break;

                case 23: SlayerName slayer = GetRandomSlayer();
                    if (weapon.Slayer == SlayerName.None)
                    {
                        weapon.Slayer = slayer;
                    }
                    else
                    {
                        weapon.Slayer2 = slayer;
                    }
                    break;

                case 24: AssignElementalDamage(weapon, ElementAttribute.Fire); i--; break;

                case 25: AssignElementalDamage(weapon, ElementAttribute.Cold); i--; break;

                case 26: AssignElementalDamage(weapon, ElementAttribute.Poison); i--; break;

                case 27: AssignElementalDamage(weapon, ElementAttribute.Energy); i--; break;

                case 28: ApplyAttribute(secondary, min, max, WeaponAttribute.Balanced, 1, 1); break;

                case 29: ApplyAttribute(secondary, min, max, WeaponAttribute.Velocity, 10, 50, 1); break;
                }
            }
        }
Exemple #7
0
 private static void ApplyAttribute(MagicalAttributes attrs, int min, int max, MagicalAttribute attr, int low, int high, int scale)
 {
     if (attr == MagicalAttribute.CastSpeed)
     {
         attrs[attr] += Scale(min, max, low / scale, high / scale) * scale;
     }
     else
     {
         attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
     }
 }
Exemple #8
0
 private static void ApplyAttribute(MagicalAttributes attrs, int min, int max, MagicalAttribute attr, int low, int high)
 {
     ApplyAttribute(attrs, min, max, attr, low, high, 1);
 }
Exemple #9
0
 public OtherMagicalAttrInfo(MagicalAttribute attr, int min, int max)
 {
     m_Attribute    = attr;
     m_MinIntensity = min;
     m_MaxIntensity = max;
 }
Exemple #10
0
 public int this[MagicalAttribute attribute]
 {
     get { return(GetValue((int)attribute)); }
     set { SetValue((int)attribute, value); }
 }