Ejemplo n.º 1
0
        public BaseClothing( int itemID, Layer layer, int hue )
            : base(itemID)
        {
            Layer = layer;
            Hue = hue;

            m_Resource = DefaultResource;

            m_MagicalAttributes = new MagicalAttributes( this );
            m_ClothingAttributes = new ArmorAttributes( this );
            m_SkillBonuses = new SkillBonuses( this );
            m_Resistances = new ElementAttributes( this );
            m_AbsorptionAttributes = new AbsorptionAttributes( this );

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );
        }
Ejemplo n.º 2
0
        public BaseClothing(int itemID, Layer layer, int hue)
            : base(itemID)
        {
            Layer = layer;
            Hue   = hue;

            m_Resource = DefaultResource;

            m_MagicalAttributes    = new MagicalAttributes(this);
            m_ClothingAttributes   = new ArmorAttributes(this);
            m_SkillBonuses         = new SkillBonuses(this);
            m_Resistances          = new ElementAttributes(this);
            m_AbsorptionAttributes = new AbsorptionAttributes(this);

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
        }
Ejemplo n.º 3
0
        public virtual void AlterFrom(BaseClothing orig)
        {
            m_Altered = true;

            m_MagicalAttributes    = orig.Attributes;
            m_ClothingAttributes   = orig.ClothingAttributes;
            m_SkillBonuses         = orig.SkillBonuses;
            m_Resistances          = orig.Resistances;
            m_AbsorptionAttributes = orig.AbsorptionAttributes;

            Crafter     = orig.Crafter;
            Exceptional = orig.Exceptional;

            MaxHitPoints = orig.MaxHitPoints;
            HitPoints    = orig.HitPoints;
        }
Ejemplo n.º 4
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 9:
                    {
                        SaveFlag flags = (SaveFlag) reader.ReadEncodedInt();

                        if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                            m_Resource = (CraftResource) reader.ReadInt();
                        else
                            m_Resource = DefaultResource;

                        if ( GetSaveFlag( flags, SaveFlag.Attributes ) )
                            m_MagicalAttributes = new MagicalAttributes( this, reader );
                        else
                            m_MagicalAttributes = new MagicalAttributes( this );

                        if ( GetSaveFlag( flags, SaveFlag.ClothingAttributes ) )
                            m_ClothingAttributes = new ArmorAttributes( this, reader );
                        else
                            m_ClothingAttributes = new ArmorAttributes( this );

                        if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
                            m_SkillBonuses = new SkillBonuses( this, reader );
                        else
                            m_SkillBonuses = new SkillBonuses( this );

                        if ( GetSaveFlag( flags, SaveFlag.Resistances ) )
                            m_Resistances = new ElementAttributes( this, reader );
                        else
                            m_Resistances = new ElementAttributes( this );

                        if ( GetSaveFlag( flags, SaveFlag.MaxHitPoints ) )
                            m_MaxHitPoints = reader.ReadInt();

                        if ( GetSaveFlag( flags, SaveFlag.HitPoints ) )
                            m_HitPoints = reader.ReadInt();

                        if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                            m_Crafter = reader.ReadMobile();

                        if ( GetSaveFlag( flags, SaveFlag.Exceptional ) )
                            m_Exceptional = true;

                        if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
                            m_PlayerConstructed = true;

                        if ( GetSaveFlag( flags, SaveFlag.AbsorptionAttributes ) )
                            m_AbsorptionAttributes = new AbsorptionAttributes( this, reader );
                        else
                            m_AbsorptionAttributes = new AbsorptionAttributes( this );

                        if ( GetSaveFlag( flags, SaveFlag.Altered ) )
                            m_Altered = true;

                        break;
                    }
                case 8:
                    {
                        m_AbsorptionAttributes = new AbsorptionAttributes( this, reader );

                        m_MaxHitPoints = reader.ReadInt();
                        m_HitPoints = reader.ReadInt();

                        m_Resource = (CraftResource) reader.ReadInt();

                        m_MagicalAttributes = new MagicalAttributes( this, reader );
                        m_ClothingAttributes = new ArmorAttributes( this, reader );
                        m_SkillBonuses = new SkillBonuses( this, reader );
                        m_Resistances = new ElementAttributes( this, reader );

                        break;
                    }
            }

            Mobile parent = Parent as Mobile;

            if ( parent != null )
            {
                m_SkillBonuses.AddTo( parent );

                AddStatBonuses( parent );
                parent.CheckStatTimers();
            }
        }
Ejemplo n.º 5
0
        public virtual void AlterFrom( BaseClothing orig )
        {
            m_Altered = true;

            m_MagicalAttributes = orig.Attributes;
            m_ClothingAttributes = orig.ClothingAttributes;
            m_SkillBonuses = orig.SkillBonuses;
            m_Resistances = orig.Resistances;
            m_AbsorptionAttributes = orig.AbsorptionAttributes;

            Crafter = orig.Crafter;
            Exceptional = orig.Exceptional;

            MaxHitPoints = orig.MaxHitPoints;
            HitPoints = orig.HitPoints;
        }
Ejemplo n.º 6
0
 private static void ApplyAttribute( ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high, int scale )
 {
     attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
 }
Ejemplo n.º 7
0
 private static void ApplyAttribute( ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high )
 {
     attrs[attr] = Scale( min, max, low, high );
 }
Ejemplo n.º 8
0
        public static void ApplyAttributesTo(BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            MagicalAttributes primary   = hat.Attributes;
            ArmorAttributes   secondary = hat.ClothingAttributes;
            ElementAttributes resists   = hat.Resistances;

            m_Props.SetAll(false);

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

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

                switch (random)
                {
                case 0: ApplyAttribute(secondary, min, max, ArmorAttribute.LowerStatReq, 10, 100, 10); break;

                case 1: ApplyAttribute(secondary, min, max, ArmorAttribute.SelfRepair, 1, 5); break;

                case 2: ApplyAttribute(secondary, min, max, ArmorAttribute.DurabilityBonus, 10, 100, 10); break;

                case 3: ApplyAttribute(primary, min, max, MagicalAttribute.ReflectPhysical, 1, 15); break;

                case 4: ApplyAttribute(primary, min, max, MagicalAttribute.RegenHits, 1, 2); break;

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

                case 6: ApplyAttribute(primary, min, max, MagicalAttribute.RegenMana, 1, 2); break;

                case 7: ApplyAttribute(primary, min, max, MagicalAttribute.NightSight, 1, 1); break;

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

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

                case 10: ApplyAttribute(primary, min, max, MagicalAttribute.BonusMana, 1, 8); break;

                case 11: ApplyAttribute(primary, min, max, MagicalAttribute.LowerManaCost, 1, 8); break;

                case 12: ApplyAttribute(primary, min, max, MagicalAttribute.LowerRegCost, 1, 20); break;

                case 13: ApplyAttribute(primary, min, max, MagicalAttribute.Luck, 1, 100); break;

                case 14: ApplyAttribute(resists, min, max, ElementAttribute.Physical, 1, 15); break;

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

                case 16: ApplyAttribute(resists, min, max, ElementAttribute.Cold, 1, 15); break;

                case 17: ApplyAttribute(resists, min, max, ElementAttribute.Poison, 1, 15); break;

                case 18: ApplyAttribute(resists, min, max, ElementAttribute.Energy, 1, 15); break;
                }
            }
        }
Ejemplo n.º 9
0
        public static void ApplyAttributesTo(BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            MagicalAttributes primary     = armor.Attributes;
            ArmorAttributes   secondary   = armor.ArmorAttributes;
            ElementAttributes resistances = armor.Resistances;

            m_Props.SetAll(false);

            bool isShield   = (armor is BaseShield);
            int  baseCount  = (isShield ? 8 : 20);
            int  baseOffset = (isShield ? 0 : 4);

            if (!isShield && armor.Meditable)
            {
                m_Props.Set(4, true);                   // remove mage armor from possible properties
            }
            if (armor.PlayerConstructed)
            {
                m_Props.Set(2, true);                   // remove durability bonus from crafted armor
            }
            if (armor.MaterialType == ArmorMaterialType.Leather)
            {
                m_Props.Set(0, true);                   // remove lower stat requiments from leather armor
            }
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(baseCount);

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

                random += baseOffset;

                switch (random)
                {
                /* Begin Shields */
                case 0: ApplyAttribute(primary, min, max, MagicalAttribute.SpellChanneling, 1, 1); break;

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

                case 2: ApplyAttribute(primary, min, max, MagicalAttribute.AttackChance, 1, 15); break;

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

                /* Begin Armor */
                case 4: ApplyAttribute(secondary, min, max, ArmorAttribute.LowerStatReq, 10, 100, 10); break;

                case 5: ApplyAttribute(secondary, min, max, ArmorAttribute.SelfRepair, 1, 5); break;

                case 6: ApplyAttribute(secondary, min, max, ArmorAttribute.DurabilityBonus, 10, 100, 10); break;

                case 7: ApplyAttribute(primary, min, max, MagicalAttribute.ReflectPhysical, 1, 15); break;

                /* End Shields */
                case 8: ApplyAttribute(secondary, min, max, ArmorAttribute.MageArmor, 1, 1); break;

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

                case 10: ApplyAttribute(primary, min, max, MagicalAttribute.RegenStam, 1, 3); break;

                case 11: ApplyAttribute(primary, min, max, MagicalAttribute.RegenMana, 1, 2); break;

                case 12: ApplyAttribute(primary, min, max, MagicalAttribute.NightSight, 1, 1); break;

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

                case 14: ApplyAttribute(primary, min, max, MagicalAttribute.BonusStam, 1, 8); break;

                case 15: ApplyAttribute(primary, min, max, MagicalAttribute.BonusMana, 1, 8); break;

                case 16: ApplyAttribute(primary, min, max, MagicalAttribute.LowerManaCost, 1, 8); break;

                case 17: ApplyAttribute(primary, min, max, MagicalAttribute.LowerRegCost, 1, 20); break;

                case 18: ApplyAttribute(primary, min, max, MagicalAttribute.Luck, 1, 100); break;

                case 19:
                {
                    ApplyAttribute(resistances, min, max, ElementAttribute.Physical, 1, 15, armor.PhysicalBonus);
                    armor.PhysicalBonus = 0;
                    break;
                }

                case 20:
                {
                    ApplyAttribute(resistances, min, max, ElementAttribute.Fire, 1, 15, armor.FireBonus);
                    armor.FireBonus = 0;
                    break;
                }

                case 21:
                {
                    ApplyAttribute(resistances, min, max, ElementAttribute.Cold, 1, 15, armor.ColdBonus);
                    armor.ColdBonus = 0;
                    break;
                }

                case 22:
                {
                    ApplyAttribute(resistances, min, max, ElementAttribute.Poison, 1, 15, armor.PoisonBonus);
                    armor.PoisonBonus = 0;
                    break;
                }

                case 23:
                {
                    ApplyAttribute(resistances, min, max, ElementAttribute.Energy, 1, 15, armor.EnergyBonus);
                    armor.EnergyBonus = 0;
                    break;
                }
                    /* End Armor */
                }
            }
        }
Ejemplo n.º 10
0
 private static void ApplyAttribute(ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high, int scale)
 {
     attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
 }
Ejemplo n.º 11
0
 private static void ApplyAttribute(ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high)
 {
     attrs[attr] = Scale(min, max, low, high);
 }
Ejemplo n.º 12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 9:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                if (GetSaveFlag(flags, SaveFlag.Resource))
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                }
                else
                {
                    m_Resource = DefaultResource;
                }

                if (GetSaveFlag(flags, SaveFlag.Attributes))
                {
                    m_MagicalAttributes = new MagicalAttributes(this, reader);
                }
                else
                {
                    m_MagicalAttributes = new MagicalAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.ClothingAttributes))
                {
                    m_ClothingAttributes = new ArmorAttributes(this, reader);
                }
                else
                {
                    m_ClothingAttributes = new ArmorAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
                {
                    m_SkillBonuses = new SkillBonuses(this, reader);
                }
                else
                {
                    m_SkillBonuses = new SkillBonuses(this);
                }

                if (GetSaveFlag(flags, SaveFlag.Resistances))
                {
                    m_Resistances = new ElementAttributes(this, reader);
                }
                else
                {
                    m_Resistances = new ElementAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
                {
                    m_MaxHitPoints = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.HitPoints))
                {
                    m_HitPoints = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Crafter))
                {
                    m_Crafter = reader.ReadMobile();
                }

                if (GetSaveFlag(flags, SaveFlag.Exceptional))
                {
                    m_Exceptional = true;
                }

                if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
                {
                    m_PlayerConstructed = true;
                }

                if (GetSaveFlag(flags, SaveFlag.AbsorptionAttributes))
                {
                    m_AbsorptionAttributes = new AbsorptionAttributes(this, reader);
                }
                else
                {
                    m_AbsorptionAttributes = new AbsorptionAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.Altered))
                {
                    m_Altered = true;
                }

                break;
            }

            case 8:
            {
                m_AbsorptionAttributes = new AbsorptionAttributes(this, reader);

                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();

                m_Resource = (CraftResource)reader.ReadInt();

                m_MagicalAttributes  = new MagicalAttributes(this, reader);
                m_ClothingAttributes = new ArmorAttributes(this, reader);
                m_SkillBonuses       = new SkillBonuses(this, reader);
                m_Resistances        = new ElementAttributes(this, reader);

                break;
            }
            }

            Mobile parent = Parent as Mobile;

            if (parent != null)
            {
                m_SkillBonuses.AddTo(parent);

                AddStatBonuses(parent);
                parent.CheckStatTimers();
            }
        }