Exemplo n.º 1
0
		public static void SetValue( Mobile m, AosAttribute att, int value, string title )
		{
			if ( !EnhancementList.ContainsKey( m ) )
				AddMobile( m, title );

			if ( att == AosAttribute.BonusStr )
			{
				m.RemoveStatMod( "MagicalEnhancementStr" );
				m.AddStatMod( new StatMod( StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusDex )
			{
				m.RemoveStatMod( "MagicalEnhancementDex" );
				m.AddStatMod( new StatMod( StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero ) );
			}
			else if ( att == AosAttribute.BonusInt )
			{
				m.RemoveStatMod( "MagicalEnhancementInt" );
				m.AddStatMod( new StatMod( StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero ) );
			}

			if ( title != EnhancementList[m].Title )
				EnhancementList[m].Attributes[att] = value;
			else
				EnhancementList[m].Attributes[att] += value;
		}
Exemplo n.º 2
0
        public static void SetValue(Mobile m, AosAttribute att, int value, string title)
        {
            if (!EnhancementList.ContainsKey(m))
            {
                AddMobile(m, title);
            }

            if (att == AosAttribute.BonusStr)
            {
                m.RemoveStatMod("MagicalEnhancementStr");
                m.AddStatMod(new StatMod(StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero));
            }
            else if (att == AosAttribute.BonusDex)
            {
                m.RemoveStatMod("MagicalEnhancementDex");
                m.AddStatMod(new StatMod(StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero));
            }
            else if (att == AosAttribute.BonusInt)
            {
                m.RemoveStatMod("MagicalEnhancementInt");
                m.AddStatMod(new StatMod(StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero));
            }

            if (title != EnhancementList[m].Title)
            {
                EnhancementList[m].Attributes[att] = value;
            }
            else
            {
                EnhancementList[m].Attributes[att] += value;
            }
        }
Exemplo n.º 3
0
        public static int SavingThrowChance(Mobile m, AosAttribute attr)
        {
            if (IsActivePassive(m, PassiveSpell.SavingThrow))
            {
                int level = GetMasteryLevel(m, m.Skills.CurrentMastery);

                if (level <= 0)
                {
                    return(0);
                }

                switch (attr)
                {
                case AosAttribute.AttackChance: return(5);

                case AosAttribute.DefendChance: return(level > 1 ? 5 : 0);

                case AosAttribute.BonusStr: return(level > 2 ? 5 : 0);

                case AosAttribute.WeaponDamage: return(level > 2 ? 5 : 0);
                }
            }

            return(0);
        }
Exemplo n.º 4
0
 public XmlAosAttribute(AosAttribute attr, int value, int duration)
 {
     Attribute = attr;
     m_Value = value;
     Expiration = TimeSpan.FromMinutes(duration);
     Name = Attribute.ToString() + " " + (Value >= 0 ? ("+" + Value.ToString()) : (Value.ToString()));
 }
Exemplo n.º 5
0
 public int GetAttribute(AosAttribute attr)
 {
     foreach (ObjectProperty property in this.m_Props.Properties)
     {
         if (property.Number == attr)
         {
             string arguments = property.Arguments;
             switch (arguments)
             {
             case "":
             case " ":
                 return(1);
             }
             try
             {
                 return(int.Parse(arguments));
             }
             catch
             {
                 return(0);
             }
         }
     }
     return(0);
 }
Exemplo n.º 6
0
		public static int GetValue( Mobile m, AosAttribute att )
		{
			if ( EnhancementList.ContainsKey( m ) )
				return EnhancementList[m].Attributes[att];
			else
				return 0;
		}
Exemplo n.º 7
0
 public static int GetValue(Mobile m, AosAttribute att)
 {
     if (EnhancementList.ContainsKey(m))
     {
         return(EnhancementList[m].Attributes[att]);
     }
     return(0);
 }
Exemplo n.º 8
0
 public GiftAttributeInfo(AosAttribute attribute, string name, GiftAttributeCategory category, int xp, int maxvalue)
 {
     m_Attribute = attribute;
     m_Name      = name;
     m_Category  = category;
     m_XP        = xp;
     m_MaxValue  = maxvalue;
 }
 public AttributeInfo(AosAttribute attribute, string name, AttributeCategory category, int xp, int maxvalue)
 {
     this.m_Attribute = attribute;
     this.m_Name      = name;
     this.m_Category  = category;
     this.m_XP        = xp;
     this.m_MaxValue  = maxvalue;
 }
Exemplo n.º 10
0
        public static double GetWeight(this AosAttribute attr)
        {
            if (!AttrFactors.ContainsKey(attr))
            {
                AttrFactors.Add(attr, new AttributeFactors());
            }

            return(AttrFactors[attr].Weight);
        }
Exemplo n.º 11
0
        public static int GetInc(this AosAttribute attr)
        {
            if (!AttrFactors.ContainsKey(attr))
            {
                AttrFactors.Add(attr, new AttributeFactors());
            }

            return(AttrFactors[attr].Inc);
        }
Exemplo n.º 12
0
		private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, int scale )
		{
			if ( attr == AosAttribute.CastSpeed )
				attrs[attr] += Scale( min, max, low / scale, high / scale ) * scale;
			else
				attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;

			if ( attr == AosAttribute.SpellChanneling )
				attrs[AosAttribute.CastSpeed] -= 1;
		}
Exemplo n.º 13
0
 private static void ApplyAttribute(AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, int scale)
 {
     if (attr == AosAttribute.CastSpeed)
     {
         attrs[attr] += Scale(min, max, low / scale, high / scale) * scale;
     }
     else
     {
         attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
     }
 }
Exemplo n.º 14
0
        public static int GetValue(Mobile m, AosAttribute att)
        {
            if (EnhancementList.ContainsKey(m))
            {
                int value = 0;
                EnhancementList[m].ForEach(attrs => value += attrs.Attributes[att]);
                return(value);
            }

            return(0);
        }
Exemplo n.º 15
0
 public int this[AosAttribute attribute]
 {
     get
     {
         return(GetValue((int)attribute));
     }
     set
     {
         SetValue((int)attribute, value);
     }
 }
Exemplo n.º 16
0
 public static void RemoveAttribute(AosAttributes attrs, AosAttribute attr, int amount)
 {
     if (attr == AosAttribute.SpellChanneling && attrs.SpellChanneling > 0)
     {
         attrs[attr] = 0;
         attrs.CastSpeed++;
     }
     else
     {
         attrs[attr] = Math.Max(attrs[attr] - amount, 0);
     }
 }
Exemplo n.º 17
0
 public static void ApplyAttribute(AosAttributes attrs, AosAttribute attr, int amount)
 {
     if (attr == AosAttribute.SpellChanneling && attrs.SpellChanneling == 0)
     {
         attrs[attr] = 1;
         attrs.CastSpeed--;
     }
     else
     {
         attrs[attr] += amount;
     }
 }
Exemplo n.º 18
0
        public static void SetValue(Mobile m, AosAttribute att, int value, string title)
        {
            if (!EnhancementList.ContainsKey(m))
            {
                AddMobile(m);
            }

            if (att == AosAttribute.BonusStr)
            {
                m.RemoveStatMod("MagicalEnhancementStr");
                m.AddStatMod(new StatMod(StatType.Str, "MagicalEnhancementStr", value, TimeSpan.Zero));
            }
            else if (att == AosAttribute.BonusDex)
            {
                m.RemoveStatMod("MagicalEnhancementDex");
                m.AddStatMod(new StatMod(StatType.Dex, "MagicalEnhancementDex", value, TimeSpan.Zero));
            }
            else if (att == AosAttribute.BonusInt)
            {
                m.RemoveStatMod("MagicalEnhancementInt");
                m.AddStatMod(new StatMod(StatType.Int, "MagicalEnhancementInt", value, TimeSpan.Zero));
            }

            EnhancementAttributes match = null;

            for (var index = 0; index < EnhancementList[m].Count; index++)
            {
                var attrs = EnhancementList[m][index];

                if (attrs.Title == title)
                {
                    match = attrs;
                    break;
                }
            }

            if (match != null)
            {
                match.Attributes[att] = value;
            }
            else
            {
                match = new EnhancementAttributes(title);
                match.Attributes[att] = value;

                EnhancementList[m].Add(match);
            }

            m.CheckStatTimers();
            m.UpdateResistances();
            m.Delta(MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana);
        }
Exemplo n.º 19
0
        private static int ScaleAttribute(object o)
        {
            if (o is AosAttribute)
            {
                AosAttribute attr = (AosAttribute)o;

                if (attr == AosAttribute.Luck)
                {
                    return(10);
                }

                if (attr == AosAttribute.WeaponSpeed)
                {
                    return(5);
                }
            }
            else if (o is AosArmorAttribute)
            {
                AosArmorAttribute attr = (AosArmorAttribute)o;

                if (attr == AosArmorAttribute.LowerStatReq)
                {
                    return(10);
                }

                if (attr == AosArmorAttribute.DurabilityBonus)
                {
                    return(10);
                }
            }
            else if (o is AosWeaponAttribute)
            {
                AosWeaponAttribute attr = (AosWeaponAttribute)o;

                if (attr == AosWeaponAttribute.LowerStatReq)
                {
                    return(10);
                }

                if (attr == AosWeaponAttribute.DurabilityBonus)
                {
                    return(10);
                }
            }
            else if (o is SkillName)
            {
                return(5);
            }

            return(1);
        }
Exemplo n.º 20
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

            ArrayList items = m.Items;
            int value = 0;

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

                if (obj is BaseWeapon)
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseWeapon)obj).GetLuckBonus();
                }
                else if (obj is BaseArmor)
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseArmor)obj).GetLuckBonus();
                }
                else if (obj is BaseJewel)
                {
                    AosAttributes attrs = ((BaseJewel)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseClothing)
                {
                    AosAttributes attrs = ((BaseClothing)obj).Attributes;

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

            return value;
        }
Exemplo n.º 21
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
            {
                return(0);
            }

            return(0);

/*
 *                      ArrayList items = m.Items;
 *                      int value = 0;
 *
 *                      for ( int i = 0; i < items.Count; ++i )
 *                      {
 *                              object obj = items[i];
 *
 *                              if ( obj is BaseWeapon )
 *                              {
 *                                      AosAttributes attrs = ((BaseWeapon)obj).Attributes;
 *
 *                                      if ( attrs != null )
 *                                              value += attrs[attribute];
 *
 *                                      if ( attribute == AosAttribute.Luck )
 *                                              value += ((BaseWeapon)obj).GetLuckBonus();
 *                              }
 *                              else if ( obj is BaseArmor )
 *                              {
 *                                      AosAttributes attrs = ((BaseArmor)obj).Attributes;
 *
 *                                      if ( attrs != null )
 *                                              value += attrs[attribute];
 *
 *                                      if ( attribute == AosAttribute.Luck )
 *                                              value += ((BaseArmor)obj).GetLuckBonus();
 *                              }
 *                              else if ( obj is BaseJewel )
 *                              {
 *                                      AosAttributes attrs = ((BaseJewel)obj).Attributes;
 *
 *                                      if ( attrs != null )
 *                                              value += attrs[attribute];
 *                              }
 *                      }
 *
 *                      return value;
 */
        }
Exemplo n.º 22
0
        public static int GetModForAttribute(AosAttribute attr)
        {
            foreach (KeyValuePair <int, ImbuingDefinition> kvp in m_Table)
            {
                int mod = kvp.Key;
                ImbuingDefinition def = kvp.Value;

                if (def.Attribute is AosAttribute && (AosAttribute)def.Attribute == attr)
                {
                    return(mod);
                }
            }

            return(-1);
        }
Exemplo n.º 23
0
 public static void SetWeight(this AosAttribute attr, double weight)
 {
     if (!AttrFactors.ContainsKey(attr))
     {
         AttrFactors.Add(
             attr,
             new AttributeFactors
         {
             Weight = weight
         });
     }
     else
     {
         AttrFactors[attr].Weight = weight;
     }
 }
Exemplo n.º 24
0
 public static void SetMin(this AosAttribute attr, int min)
 {
     if (!AttrFactors.ContainsKey(attr))
     {
         AttrFactors.Add(
             attr,
             new AttributeFactors
         {
             Min = min
         });
     }
     else
     {
         AttrFactors[attr].Min = min;
     }
 }
Exemplo n.º 25
0
 public static void SetMax(this AosAttribute attr, int max)
 {
     if (!AttrFactors.ContainsKey(attr))
     {
         AttrFactors.Add(
             attr,
             new AttributeFactors
         {
             Max = max
         });
     }
     else
     {
         AttrFactors[attr].Max = max;
     }
 }
Exemplo n.º 26
0
 public static void SetInc(this AosAttribute attr, int inc)
 {
     if (!AttrFactors.ContainsKey(attr))
     {
         AttrFactors.Add(
             attr,
             new AttributeFactors
         {
             Inc = inc
         });
     }
     else
     {
         AttrFactors[attr].Inc = inc;
     }
 }
Exemplo n.º 27
0
        public static int GetAosAttributeBonus(Mobile from, AosAttribute type)
        {
            int sum = 0;

            for (var index = 0; index < Fountains.Count; index++)
            {
                var x = Fountains[index];

                if (x.Mobile == from && x.Type == EnumType.AosAttribute && Enum.GetName(typeof(AosAttribute), type) == x.TypeValue.ToString())
                {
                    sum += x.Value;
                }
            }

            return(sum);
        }
Exemplo n.º 28
0
        public static int GetChance(AosAttribute attr, AosAttributes itemAttrs)
        {
            int chance;

            switch (attr)
            {
            case AosAttribute.LowerWeight:                                  chance = itemAttrs[attr] / 40; break;

            case AosAttribute.WeaponDamage:                                 chance = itemAttrs[attr] / 4; break;

            case AosAttribute.Luck:                                                 chance = 10 + itemAttrs[attr] / 2; break;

            default:
                chance = itemAttrs[attr] / 2; break;
            }

            return(chance);
        }
Exemplo n.º 29
0
        public static int[] GetPropRange(AosAttribute attr)
        {
            switch (attr)
            {
            case AosAttribute.Luck: return(new int[] { 1, 100 });

            case AosAttribute.WeaponDamage: return(new int[] { 2, 50 });

            case AosAttribute.WeaponSpeed: return(new int[] { 5, 30 });

            case AosAttribute.LowerRegCost: return(new int[] { 1, 20 });

            case AosAttribute.EnhancePotions: return(new int[] { 5, 25 });

            case AosAttribute.AttackChance:
            case AosAttribute.DefendChance:
            case AosAttribute.ReflectPhysical: return(new int[] { 1, 15 });

            case AosAttribute.SpellDamage: return(new int[] { 1, 12 });

            case AosAttribute.BonusStr:
            case AosAttribute.BonusInt:
            case AosAttribute.BonusDex:
            case AosAttribute.BonusStam:
            case AosAttribute.BonusMana:
            case AosAttribute.LowerManaCost: return(new int[] { 1, 8 });

            case AosAttribute.BonusHits: return(new int[] { 1, 5 });

            case AosAttribute.CastRecovery:
            case AosAttribute.RegenStam: return(new int[] { 1, 3 });

            case AosAttribute.RegenHits:
            case AosAttribute.RegenMana: return(new int[] { 1, 2 });

            default:
            case AosAttribute.SpellChanneling:
            case AosAttribute.CastSpeed:
            case AosAttribute.Brittle:
            case AosAttribute.NightSight: return(new int[] { 1, 1 });
            }
        }
Exemplo n.º 30
0
		public static int GetValue( Mobile m, AosAttribute attribute )
		{
			int value = 0;

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

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

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

			return value;
		}
Exemplo n.º 31
0
        public static int GetValue(Mobile m, AosAttribute 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 IAosAttribute attributeItem)
                {
                    AosAttributes attrs = attributeItem.Attributes;

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

                    if (attribute == AosAttribute.Luck && attributeItem is BaseEquipment equipment)
                    {
                        value += equipment.GetLuckBonus();
                    }
                }
                else if (obj is BaseQuiver quiver)
                {
                    AosAttributes attrs = quiver.Attributes;

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

            return(value);
        }
Exemplo n.º 32
0
        public static int GetValue(Mobile m, AosAttribute attr)
        {
            if (m == null || m.Deleted)
                return 0;

            ArrayList attachments = XmlAttach.FindAttachments(m, typeof(XmlAosAttribute));
            int value = 0;

            if (attachments == null)
                return 0;

            if (attachments.Count > 0)
            {
                foreach (XmlAosAttribute att in attachments)
                {
                    if (att.Attribute == attr)
                        value += att.Value;
                }
            }
            return value;
        }
Exemplo n.º 33
0
        public static int GetValue(Mobile m, AosAttribute att)
        {
            if (m == null)
            {
                return(0);
            }

            if (EnhancementList.ContainsKey(m))
            {
                int value = 0;

                for (var index = 0; index < EnhancementList[m].Count; index++)
                {
                    var attrs = EnhancementList[m][index];

                    value += attrs.Attributes[att];
                }

                return(value);
            }

            return(0);
        }
Exemplo n.º 34
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
            {
                return(0);
            }

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

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

                if (obj is BaseWeapon)
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

                    if (attrs != null)
                    {
                        value += attrs[attribute];
                    }
                }
                else if (obj is BaseArmor)
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

            return(value);
        }
Exemplo n.º 35
0
 public int this[AosAttribute attribute]
 {
     get
     {
         return this.ExtendedGetValue((int)attribute);
     }
     set
     {
         this.SetValue((int)attribute, value);
     }
 }
Exemplo n.º 36
0
 public int GetAttribute(AosAttribute attr)
 {
     foreach (ObjectProperty property in this.m_Props.Properties)
     {
         if (property.Number == attr)
         {
             string arguments = property.Arguments;
             switch (arguments)
             {
                 case "":
                 case " ":
                     return 1;
             }
             try
             {
                 return int.Parse(arguments);
             }
             catch
             {
                 return 0;
             }
         }
     }
     return 0;
 }
Exemplo n.º 37
0
		public static int GetValue(Mobile m, AosAttribute attribute)
		{
			return 0; // some day this insanity will all be gone!
		}
Exemplo n.º 38
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

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

            #region Enhancement
            value += Enhancement.GetValue(m, attribute);
            #endregion

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

                if (obj is BaseWeapon)
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseWeapon)obj).GetLuckBonus();
                }
                else if (obj is BaseArmor)
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseArmor)obj).GetLuckBonus();
                }
                else if (obj is BaseJewel)
                {
                    AosAttributes attrs = ((BaseJewel)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseClothing)
                {
                    AosAttributes attrs = ((BaseClothing)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is Spellbook)
                {
                    AosAttributes attrs = ((Spellbook)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseQuiver)
                {
                    AosAttributes attrs = ((BaseQuiver)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseTalisman)
                {
                    AosAttributes attrs = ((BaseTalisman)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
				
                #region Mondain's Legacy
                if (attribute == AosAttribute.WeaponDamage)
                {
                    if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                        value += 10; // TODO check
                }
                else if (attribute == AosAttribute.SpellDamage)
                {
                    if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                        value += 5; // TODO check
                }
                else if (attribute == AosAttribute.CastSpeed)
                {
                    if (MonstrousInterredGrizzle.UnderCacophonicAttack(m) || LadyMelisande.UnderPutridNausea(m))
                        value -= 3; // TODO check
                }
                else if (attribute == AosAttribute.WeaponSpeed || LadyMelisande.UnderPutridNausea(m))
                {
                    if (MonstrousInterredGrizzle.UnderCacophonicAttack(m))
                        value -= 3; // TODO check
                }

                if (obj is ISetItem)
                { 
                    ISetItem item = (ISetItem)obj;

                    AosAttributes attrs = item.SetAttributes;
										
                    if (attrs != null && item.LastEquipped)
                        value += attrs[attribute];
                }
                #endregion
            }

            return value;
        }
Exemplo n.º 39
0
		public static bool HasAttribute(this Item item, AosAttribute attr, out int value)
		{
			return HasAttribute(item, "Attributes", (ulong)attr, out value);
		}
Exemplo n.º 40
0
        public static int GetValue( Mobile m, AosAttribute 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 IAosAttributes )
                {
                    AosAttributes attrs = ((IAosAttributes)obj).Attributes;

                    if( attrs != null )
                        value += attrs[attribute];
                }
                else if( obj is BaseQuiver )
                {
                    AosAttributes attrs = ((BaseQuiver)obj).Attributes;

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

            return value;
        }
Exemplo n.º 41
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

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

            #region Enhancement
            value += Enhancement.GetValue(m, attribute);
            #endregion

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

                if (obj is BaseWeapon)
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseWeapon)obj).GetLuckBonus();
                }
                else if (obj is BaseArmor)
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseArmor)obj).GetLuckBonus();
                }
                else if (obj is BaseJewel)
                {
                    AosAttributes attrs = ((BaseJewel)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseClothing)
                {
                    AosAttributes attrs = ((BaseClothing)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is Spellbook)
                {
                    AosAttributes attrs = ((Spellbook)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseQuiver)
                {
                    AosAttributes attrs = ((BaseQuiver)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseTalisman)
                {
                    AosAttributes attrs = ((BaseTalisman)obj).Attributes;

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

                if (obj is ISetItem)
                {
                    ISetItem item = (ISetItem)obj;

                    AosAttributes attrs = item.SetAttributes;

                    if (attrs != null && item.LastEquipped)
                        value += attrs[attribute];
                }
            }

            #region Malus/Buff Handler
            if (attribute == AosAttribute.WeaponDamage)
            {
                if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                    value += 35;

                // attacker gets 10% bonus when they're under divine fury
                if (DivineFurySpell.UnderEffect(m))
                    value += 10;

                // Horrific Beast transformation gives a +25% bonus to damage.
                if (TransformationSpellHelper.UnderTransformation(m, typeof(HorrificBeastSpell)))
                    value += 25;

                int defenseMasteryMalus = 0;
                int discordanceEffect = 0;

                // Defense Mastery gives a -50%/-80% malus to damage.
                if (Server.Items.DefenseMastery.GetMalus(m, ref defenseMasteryMalus))
                    value -= defenseMasteryMalus;

                // Discordance gives a -2%/-48% malus to damage.
                if (SkillHandlers.Discordance.GetEffect(m, ref discordanceEffect))
                    value -= discordanceEffect * 2;

                #region SA
                if (TransformationSpellHelper.UnderTransformation(m, typeof(Spells.Mystic.StoneFormSpell)))
                    value -= 10;
                #endregion

                #region High Seas
                if (BaseFishPie.IsUnderEffects(m, FishPieEffect.WeaponDam))
                    value += 5;
                #endregion
            }
            else if (attribute == AosAttribute.SpellDamage)
            {
                if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                    value += 15;

                if (PsychicAttack.Registry.ContainsKey(m))
                    value -= PsychicAttack.Registry[m].SpellDamageMalus;

                TransformContext context = TransformationSpellHelper.GetContext(m);

                if (context != null && context.Spell is ReaperFormSpell)
                    value += ((ReaperFormSpell)context.Spell).SpellDamageBonus;

                #region High Seas
                if (BaseFishPie.IsUnderEffects(m, FishPieEffect.SpellDamage))
                    value += 5;
                #endregion
            }
            else if (attribute == AosAttribute.CastSpeed)
            {
                if (MonstrousInterredGrizzle.UnderCacophonicAttack(m) || LadyMelisande.UnderPutridNausea(m))
                    value -= 5;

                if (EssenceOfWindSpell.IsDebuffed(m))
                    value -= EssenceOfWindSpell.GetFCMalus(m);

                #region SA
                if (Spells.Mystic.SleepSpell.IsUnderSleepEffects(m))
                    value -= 2;

                if (TransformationSpellHelper.UnderTransformation(m, typeof(Spells.Mystic.StoneFormSpell)))
                    value -= 2;
                #endregion
            }
            else if (attribute == AosAttribute.CastRecovery)
            {
                if (MonstrousInterredGrizzle.UnderCacophonicAttack(m))
                    value -= 5;

                value -= ThunderstormSpell.GetCastRecoveryMalus(m);

                #region SA
                if (Spells.Mystic.SleepSpell.IsUnderSleepEffects(m))
                    value -= 3;
                #endregion
            }
            else if (attribute == AosAttribute.WeaponSpeed)
            {
                if (MonstrousInterredGrizzle.UnderCacophonicAttack(m) || LadyMelisande.UnderPutridNausea(m))
                    value -= 60;

                if (Spells.Chivalry.DivineFurySpell.UnderEffect(m))
                    value += 10;

                value += HonorableExecution.GetSwingBonus(m);

                if (DualWield.Registry.Contains(m))
                    value += ((DualWield.DualWieldTimer)DualWield.Registry[m]).BonusSwingSpeed;

                TransformContext context = TransformationSpellHelper.GetContext(m);

                if (context != null && context.Spell is ReaperFormSpell)
                    value += ((ReaperFormSpell)context.Spell).SwingSpeedBonus;

                int discordanceEffect = 0;

                // Discordance gives a malus of -0/-28% to swing speed.
                if (SkillHandlers.Discordance.GetEffect(m, ref discordanceEffect))
                    value -= discordanceEffect;

                if (EssenceOfWindSpell.IsDebuffed(m))
                    value -= EssenceOfWindSpell.GetSSIMalus(m);

                #region SA
                if (Spells.Mystic.SleepSpell.IsUnderSleepEffects(m))
                    value -= 45;

                if (TransformationSpellHelper.UnderTransformation(m, typeof(Spells.Mystic.StoneFormSpell)))
                    value -= 10;

                if (MudPie.IsUnderEffects(m))
                    value -= 30;
                #endregion
            }
            else if (attribute == AosAttribute.AttackChance)
            {
                if (LadyMelisande.UnderPutridNausea(m))
                    value -= 60;

                if (Spells.Chivalry.DivineFurySpell.UnderEffect(m))
                    value += 10; // attacker gets 10% bonus when they're under divine fury

                if (BaseWeapon.CheckAnimal(m, typeof(GreyWolf)) || BaseWeapon.CheckAnimal(m, typeof(BakeKitsune)))
                    value += 20; // attacker gets 20% bonus when under Wolf or Bake Kitsune form

                if (HitLower.IsUnderAttackEffect(m))
                    value -= 25; // Under Hit Lower Attack effect -> 25% malus

                WeaponAbility ability = WeaponAbility.GetCurrentAbility(m);

                if (ability != null)
                    value += ability.AccuracyBonus;

                SpecialMove move = SpecialMove.GetCurrentMove(m);

                if (move != null)
                    value += move.GetAccuracyBonus(m);

                #region SA
                if (Spells.Mystic.SleepSpell.IsUnderSleepEffects(m))
                    value -= 45;

                if (m.Race == Race.Gargoyle)
                    value += 5;  //Gargoyles get a +5 HCI
                #endregion

                #region High Seas
                if (BaseFishPie.IsUnderEffects(m, FishPieEffect.HitChance))
                    value += 8;
                #endregion
            }
            else if (attribute == AosAttribute.DefendChance)
            {
                if (LadyMelisande.UnderPutridNausea(m))
                    value -= 60;

                if (Spells.Chivalry.DivineFurySpell.UnderEffect(m))
                    value -= 20; // defender loses 20% bonus when they're under divine fury

                if (HitLower.IsUnderDefenseEffect(m))
                    value -= 25; // Under Hit Lower Defense effect -> 25% malus

                int blockBonus = 0;
                int discordanceEffect = 0;
                int surpriseMalus = 0;

                if (Block.GetBonus(m, ref blockBonus))
                    value += blockBonus;

                if (SurpriseAttack.GetMalus(m, ref surpriseMalus))
                    value -= surpriseMalus;

                // Defender loses -0/-28% if under the effect of Discordance.
                if (SkillHandlers.Discordance.GetEffect(m, ref discordanceEffect))
                    value -= discordanceEffect;

                #region High Seas
                if (BaseFishPie.IsUnderEffects(m, FishPieEffect.DefChance))
                    value += 8;
                #endregion
            }
            else if (attribute == AosAttribute.RegenHits)
            {
                #region High Seas
                if (m is PlayerMobile && BaseFishPie.IsUnderEffects(m, FishPieEffect.HitsRegen))
                    value += 3;

                if (SurgeShield.IsUnderEffects(m, SurgeType.Hits))
                    value += 10;
                #endregion

                if (SearingWeaponContext.HasContext(m))
                    value -= m is PlayerMobile ? 20 : 60;
            }
            else if (attribute == AosAttribute.RegenStam)
            {
                #region High Seas
                if (m is PlayerMobile && BaseFishPie.IsUnderEffects(m, FishPieEffect.StamRegen))
                    value += 3;

                if (SurgeShield.IsUnderEffects(m, SurgeType.Stam))
                    value += 10;
                #endregion
            }
            else if (attribute == AosAttribute.RegenMana)
            {
                #region High Seas
                if (m is PlayerMobile && BaseFishPie.IsUnderEffects(m, FishPieEffect.ManaRegen))
                    value += 3;

                if (SurgeShield.IsUnderEffects(m, SurgeType.Mana))
                    value += 10;
                #endregion
            }
            #endregion

            return value;
        }
Exemplo n.º 42
0
		public static int GetValue( Mobile m, AosAttribute attribute )
		{
			if ( !Core.AOS )
				return 0;

return 0;
/*
			ArrayList items = m.Items;
			int value = 0;

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

				if ( obj is BaseWeapon )
				{
					AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

					if ( attribute == AosAttribute.Luck )
						value += ((BaseWeapon)obj).GetLuckBonus();
				}
				else if ( obj is BaseArmor )
				{
					AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

					if ( attribute == AosAttribute.Luck )
						value += ((BaseArmor)obj).GetLuckBonus();
				}
				else if ( obj is BaseJewel )
				{
					AosAttributes attrs = ((BaseJewel)obj).Attributes;

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

			return value;
*/			
		}
Exemplo n.º 43
0
		public int this[AosAttribute attribute]
		{
			get { return GetValue( (int)attribute ); }
			set { SetValue( (int)attribute, value ); }
		}
Exemplo n.º 44
0
 public XmlAosAttribute(AosAttribute attr, int value)
 {
     Attribute = attr;
     m_Value = value;
     Name = Attribute.ToString() + " " + (Value <= 0 == true ? ("+" + Value.ToString()) : (Value.ToString()));
 }
 public static void RemoveAttribute( AosAttributes attrs, AosAttribute attr, int amount )
 {
     if ( attr == AosAttribute.SpellChanneling && attrs.SpellChanneling > 0 )
     {
         attrs[attr] = 0;
         attrs.CastSpeed++;
     }
     else
         attrs[attr] = Math.Max( attrs[attr] - amount, 0 );
 }
Exemplo n.º 46
0
 private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high )
 {
     attrs[attr] = Scale( min, max, low, high );
 }
Exemplo n.º 47
0
 // Apply AoS Weapons Attributes
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseWeapon weapon, AosAttribute attribute, int minimum, int maximum )
 {
     CheckItem( from, weapon, ( weapon.Attributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, weapon, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( weapon.Attributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum );
     MarkWeapon( from, weapon );
 }
 public BonusAttribute( AosAttribute attr, int amount )
     : this((object)attr, amount)
 {
 }
Exemplo n.º 49
0
        public static int GetValue(Mobile m, AosAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

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

            #region Enhancement
            value += Enhancement.GetValue(m, attribute);
            #endregion

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

                if (obj is BaseWeapon)
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseWeapon)obj).GetLuckBonus();
                }
                else if (obj is BaseArmor)
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

                    if (attribute == AosAttribute.Luck)
                        value += ((BaseArmor)obj).GetLuckBonus();
                }
                else if (obj is BaseJewel)
                {
                    AosAttributes attrs = ((BaseJewel)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseClothing)
                {
                    AosAttributes attrs = ((BaseClothing)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is Spellbook)
                {
                    AosAttributes attrs = ((Spellbook)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseQuiver)
                {
                    AosAttributes attrs = ((BaseQuiver)obj).Attributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseTalisman)
                {
                    AosAttributes attrs = ((BaseTalisman)obj).Attributes;

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

                if (obj is ISetItem)
                {
                    ISetItem item = (ISetItem)obj;

                    AosAttributes attrs = item.SetAttributes;

                    if (attrs != null && item.LastEquipped)
                        value += attrs[attribute];
                }
            }

            #region Malus/Buff Handler
            if (attribute == AosAttribute.WeaponDamage)
            {
                if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                    value += 10; // TODO check
            }
            else if (attribute == AosAttribute.SpellDamage)
            {
                if (BaseMagicalFood.IsUnderInfluence(m, MagicalFood.WrathGrapes))
                    value += 5; // TODO check
            }
            else if (attribute == AosAttribute.CastSpeed)
            {
                if (MonstrousInterredGrizzle.UnderCacophonicAttack(m) || LadyMelisande.UnderPutridNausea(m))
                    value -= 3; // TODO check
            }
            else if (attribute == AosAttribute.WeaponSpeed || LadyMelisande.UnderPutridNausea(m))
            {
                if (MonstrousInterredGrizzle.UnderCacophonicAttack(m))
                    value -= 3; // TODO check
            }
            else if (attribute == AosAttribute.RegenHits)
            {
                if (SurgeShield.IsUnderEffects(m, SurgeType.Hits))
                    value += 10;

                if (SearingWeaponContext.HasContext(m))
                    value -= m is PlayerMobile ? 20 : 60;
            }
            else if (attribute == AosAttribute.RegenStam)
            {
                if (SurgeShield.IsUnderEffects(m, SurgeType.Stam))
                    value += 10;
            }
            else if (attribute == AosAttribute.RegenMana)
            {
                if (SurgeShield.IsUnderEffects(m, SurgeType.Mana))
                    value += 10;
            }
            #endregion

            return value;
        }
Exemplo n.º 50
0
		public static int GetValue( Mobile m, AosAttribute 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 )
				{
					AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

					if( attribute == AosAttribute.Luck )
						value += ((BaseWeapon)obj).GetLuckBonus();
				}
				else if( obj is BaseArmor )
				{
					AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

					if( attribute == AosAttribute.Luck )
						value += ((BaseArmor)obj).GetLuckBonus();
				}
				else if( obj is BaseJewel )
				{
					AosAttributes attrs = ((BaseJewel)obj).Attributes;

					if( attrs != null )
						value += attrs[attribute];
				}
				else if( obj is BaseClothing )
				{
					AosAttributes attrs = ((BaseClothing)obj).Attributes;

					if( attrs != null )
						value += attrs[attribute];
				}
				else if( obj is Spellbook )
				{
					AosAttributes attrs = ((Spellbook)obj).Attributes;

					if( attrs != null )
						value += attrs[attribute];
				}
				else if( obj is BaseQuiver )
				{
					AosAttributes attrs = ((BaseQuiver)obj).Attributes;

					if( attrs != null )
						value += attrs[attribute];
				}
				else if ( obj is BaseTalisman )
				{
					AosAttributes attrs = ((BaseTalisman)obj).Attributes;

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

			return value;
		}
 public static void ApplyAttribute( AosAttributes attrs, AosAttribute attr, int amount )
 {
     if ( attr == AosAttribute.SpellChanneling && attrs.SpellChanneling == 0 )
     {
         attrs[attr] = 1;
         attrs.CastSpeed--;
     }
     else
         attrs[attr] += amount;
 }
Exemplo n.º 52
0
		private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high )
		{
			ApplyAttribute( attrs, min, max, attr, low, high, 1 );
		}
Exemplo n.º 53
0
 public static void ApplyAttribute( Mobile from, BookOfSpellCrafts book, int craftId, BaseJewel jewel, AosAttribute attribute, int minimum, int maximum, int scale )
 {
     CheckItem( from, jewel, ( jewel.Attributes[ attribute ] == 0 ) );
     UseMagicJewels( from, book, jewel, SpellCraftConfig.MagicJewelRequirements[craftId] );
     int scalar = ComputeSkillScalar( from );
     ApplyAttribute( jewel.Attributes, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum, scale );
 }
Exemplo n.º 54
0
 public AttributeInfo(AosAttribute attribute, string name, AttributeCategory category, int xp, int maxvalue)
 {
     this.m_Attribute = attribute;
     this.m_Name = name;
     this.m_Category = category;
     this.m_XP = xp;
     this.m_MaxValue = maxvalue;
 }
Exemplo n.º 55
0
        public static int GetChance( AosAttribute attr, AosAttributes itemAttrs )
        {
            int chance;

            switch ( attr )
            {
                case AosAttribute.LowerWeight: 					chance = itemAttrs[attr] / 50; break;
                case AosAttribute.WeaponDamage:					chance = itemAttrs[attr] / 5; break;
                case AosAttribute.Luck: 						chance = 8 + itemAttrs[attr] / 2; break;
                default:
                    chance = itemAttrs[attr] / 2; break;
            }

            return chance;
        }
Exemplo n.º 56
0
        public static int GetModForAttribute(AosAttribute attr)
        {
            foreach (KeyValuePair<int, ImbuingDefinition> kvp in m_Table)
            {
                int mod = kvp.Key;
                ImbuingDefinition def = kvp.Value;

                if (def.Attribute is AosAttribute && (AosAttribute)def.Attribute == attr)
                    return mod;
            }

            return -1;
        }
Exemplo n.º 57
0
 private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, int scale )
 {
     attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
 }
Exemplo n.º 58
0
 private static void ApplyAttribute(AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high)
 {
     ApplyAttribute(attrs, min, max, attr, low, high, 1);
 }
Exemplo n.º 59
0
 public static int[] GetPropRange(AosAttribute attr)
 {
     switch (attr)
     {
         case AosAttribute.Luck: return new int[] { 1, 100 };
         case AosAttribute.WeaponDamage: return new int[] { 2, 50 };
         case AosAttribute.WeaponSpeed: return new int[] { 5, 30 };
         case AosAttribute.LowerRegCost: return new int[] { 1, 20 };
         case AosAttribute.EnhancePotions: return new int[] { 5, 25 };
         case AosAttribute.AttackChance:
         case AosAttribute.DefendChance:
         case AosAttribute.ReflectPhysical: return new int[] { 1, 15 };
         case AosAttribute.SpellDamage: return new int[] { 1, 12 };
         case AosAttribute.BonusStr:
         case AosAttribute.BonusInt:
         case AosAttribute.BonusDex:
         case AosAttribute.BonusStam:
         case AosAttribute.BonusMana:
         case AosAttribute.LowerManaCost: return new int[] { 1, 8 };
         case AosAttribute.BonusHits: return new int[] { 1, 5 };
         case AosAttribute.CastRecovery:
         case AosAttribute.RegenStam: return new int[] { 1, 3 };
         case AosAttribute.RegenHits:
         case AosAttribute.RegenMana: return new int[] { 1, 2 };
         default:
         case AosAttribute.SpellChanneling:
         case AosAttribute.CastSpeed:
         case AosAttribute.Brittle:
         case AosAttribute.NightSight: return new int[] { 1, 1 };
     }
 }