Inheritance: BaseMeleeWeapon
Exemple #1
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                Mobile mob = (Mobile)parent;

                BaseRanged ranged = mob.Weapon as BaseRanged;

                if (ranged != null)
                {
                    ranged.InvalidateProperties();
                }

                #region Mondain's Legacy Sets
                if (IsSetItem)
                {
                    m_SetEquipped = SetHelper.FullSetEquipped(mob, SetID, Pieces);

                    if (m_SetEquipped)
                    {
                        m_LastEquipped = true;
                        SetHelper.AddSetBonus(mob, SetID);
                    }
                }
                #endregion
            }
        }
Exemple #2
0
        public static bool CheckForString( Mobile from, string errorMsg, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            if ( !module.HasBowString )
            {
                return true;
            }
            else
            {
                if ( module.HasBowString && module.StringStrengthSelection == StringStrength.NoString )
                {
                    from.SendMessage( "" );
                    from.SendMessage( 33, "--------------------" );
                    from.SendMessage( "" );
                    from.SendMessage( 33, "The bow has an internal error and is now being fixed..." );
                    from.SendMessage( "" );
                    from.SendMessage( 33, "--------------------" );
                    from.SendMessage( "" );
                    module.HasBowString = false;
                    return true;
                }
                else
                {
                    from.SendMessage( "{0}", errorMsg );
                    return false;
                }
            }
        }
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile mob = (Mobile)parent;

                //m_Attributes.RemoveStatBonuses( mob );

                BaseRanged ranged = mob.Weapon as BaseRanged;

                if (ranged != null)
                {
                    ranged.InvalidateProperties();
                }

                string modName = this.Serial.ToString();

                mob.RemoveStatMod(modName + "Str");
                mob.RemoveStatMod(modName + "Dex");
                mob.RemoveStatMod(modName + "Int");

                mob.CheckStatTimers();

                #region Mondain's Legacy Sets
                if (IsSetItem && m_SetEquipped)
                {
                    SetHelper.RemoveSetBonus(mob, SetID, this);
                }
                #endregion
            }
        }
Exemple #4
0
        }                                                                   // WIZARD CHANGED TO FALSE

        public static bool HasFreeHand(Mobile m)
        {
            Item handOne = m.FindItemOnLayer(Layer.OneHanded);
            Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);

            if (handTwo is BaseWeapon)
            {
                handOne = handTwo;
            }

            if (handOne is BaseRanged)
            {
                BaseRanged ranged = (BaseRanged)handOne;

                if (ranged.Balanced)
                {
                    return(true);
                }
            }

            if ((handOne is PugilistGlove) ||
                (handOne is PugilistGloves) ||
                (handOne is LevelPugilistGloves) ||
                (handOne is LevelThrowingGloves) ||
                (handOne is GiftPugilistGloves) ||
                (handOne is GiftThrowingGloves) ||
                (handOne is ThrowingGloves))                            // WIZARD ADDED
            {
                return(true);
            }

            return(handOne == null || handTwo == null);
        }
Exemple #5
0
        public static bool HasFreeHand(Mobile m)
        {
            Item handOne = m.FindItemOnLayer(Layer.OneHanded);
            Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);
            Item helm    = m.FindItemOnLayer(Layer.Helm);

            if (helm is BaseArmor)
            {
                return(false);
            }

            if (handTwo is BaseWeapon)
            {
                handOne = handTwo;
            }

            if (handOne is BaseRanged)
            {
                BaseRanged ranged = (BaseRanged)handOne;

                if (ranged.Balanced)
                {
                    return(true);
                }
            }

            return((handOne == null || handTwo == null));
        }
Exemple #6
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                Mobile mob = (Mobile)parent;

                this.m_Attributes.AddStatBonuses(mob);
                this.m_AosSkillBonuses.AddTo(mob);

                BaseRanged ranged = mob.Weapon as BaseRanged;

                if (ranged != null)
                {
                    ranged.InvalidateProperties();
                }

                #region Mondain's Legacy Sets
                if (this.IsSetItem)
                {
                    this.m_SetEquipped = SetHelper.FullSetEquipped(mob, this.SetID, this.Pieces);

                    if (this.m_SetEquipped)
                    {
                        this.m_LastEquipped = true;
                        SetHelper.AddSetBonus(mob, this.SetID);
                    }
                }
                #endregion
            }
        }
Exemple #7
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                Mobile mob = (Mobile)parent;

                m_Attributes.AddStatBonuses(mob);
                m_AosSkillBonuses.AddTo(mob);

                BaseRanged ranged = mob.Weapon as BaseRanged;

                if (ranged != null)
                {
                    ranged.InvalidateProperties();
                }

                if (IsSetItem)
                {
                    m_SetEquipped = SetHelper.FullSetEquipped(mob, SetID, Pieces);

                    if (m_SetEquipped)
                    {
                        m_LastEquipped = true;
                        SetHelper.AddSetBonus(mob, SetID);
                    }
                }
            }
        }
        public static bool HasFreeHand(Mobile m)
        {
            Item handOne = m.FindItemOnLayer(Layer.OneHanded);
            Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);

            if (handTwo is BaseWeapon)
            {
                handOne = handTwo;
            }

            // Genova: suporte ao UO:ML.
            #region Mondain's Legacy
            if (handTwo is BaseRanged)
            {
                BaseRanged ranged = (BaseRanged)handTwo;

                if (ranged.Balanced)
                {
                    return(true);
                }
            }
            #endregion

            return(handOne == null || handTwo == null);
        }
Exemple #9
0
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile mob = (Mobile)parent;

                BaseRanged ranged = mob.Weapon as BaseRanged;

                if (ranged != null)
                {
                    ranged.InvalidateProperties();
                }

                string modName = this.Serial.ToString();

                mob.RemoveStatMod(modName + "Str");
                mob.RemoveStatMod(modName + "Dex");
                mob.RemoveStatMod(modName + "Int");

                mob.CheckStatTimers();

                if (IsSetItem ? m_SetEquipped : false)
                {
                    SetHelper.RemoveSetBonus(mob, SetID, this);
                }
            }
        }
Exemple #10
0
        public void Target(BaseRanged weapon)
        {
            if (!Caster.CanSee(weapon))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (!Caster.CanBeginAction(typeof(AncientEnchantSpell)))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.

            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(AncientEnchantSpell)))
                {
                    if (this.Scroll != null)
                        Scroll.Consume();
                    m_Hue = weapon.Hue;
                    m_Name = weapon.Name;
                    weapon.Name = "" + m_Name + " [enchanted]";
                    weapon.Hue = 1366;
                    weapon.Attributes.WeaponDamage += 10;
                    weapon.Attributes.AttackChance += 1000;

                    Caster.PlaySound(0x20C);
                    Caster.PlaySound(0x145);
                    Caster.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist);

                    IEntity from = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z), Caster.Map);
                    IEntity to = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z + 50), Caster.Map);
                    Effects.SendMovingParticles(from, to, 0x13B1, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);
                    StopTimer(Caster);

                    Timer t = new InternalTimer(Caster, weapon, m_Hue, m_Name);

                    m_Timers[Caster] = t;

                    t.Start();
                }
                else if (!Caster.CanBeginAction(typeof(AncientEnchantSpell)))
                {
                    DoFizzle();
                }
            }

            FinishSequence();
        }
Exemple #11
0
 protected override void OnTarget(Mobile from, object target)
 {
     if (m_Deed.Deleted || m_Deed.RootParent != from)
     {
         from.SendMessage("You cannot add velocity to that.");
         return;
     }
     if (target is BaseRanged)
     {
         BaseRanged item = (BaseRanged)target;
         if (item is BaseRanged)
         {
             ((BaseRanged)item).Velocity += 10;
             from.SendMessage("Velocity successfully added to item.");
             m_Deed.Delete();
         }
     }
     else
     {
         from.SendMessage("You cannot put velocity on that.");
     }
 }
        public void Shoot(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;

            if (bow == null)
            {
                return;
            }

            m_LastUse = DateTime.Now;

            from.Direction = from.GetDirectionTo(GetWorldLocation());
            bow.PlaySwingAnimation(from);
            from.MovingEffect(this, bow.EffectID, 18, 1, false, false);

            if (Utility.RandomBool())
            {
                from.PlaySound(bow.MissSound);
                return;
            }

            Effects.PlaySound(Location, Map, 0x2B1);
        }
Exemple #13
0
        public static void CheckSkill( Mobile from, BaseRanged rang, BaseRangedModule module )
        {
            double fletching = from.Skills[ SkillName.Fletching ].Base;

            if ( LucidNagual.DataCenter.DebugAdvancedArchery )
                Console.WriteLine( "AA Check: Fletching over 100." );

            int skillCode;

            if ( fletching > 100.0 && fletching < 105.0 )
                Conjunction( module, 0, 1 );

            else if ( fletching > 104.9 && fletching < 112 )
                Conjunction( module, 0, 2 );

            else if ( fletching > 111.9 && fletching < 119.9 )
                Conjunction( module, 0, 3 );

            else if ( fletching > 119.9 )
                Conjunction( module, 0, 4 );

            else
                return;
        }
Exemple #14
0
        public virtual bool BonusDamage( Mobile attacker, Mobile defender, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            attacker.SendMessage( "" );
            attacker.SendMessage( 0x35, "** Bonus Hit **" );
            attacker.SendMessage( "" );
            attacker.SendMessage( 0x35, "The strength of your bow and your immpecable skill have given you a perfect hit." );
            attacker.SendMessage( "" );

            defender.Say( "* Ouch, that hurt! *" );
            defender.PlaySound( 315 );

            if ( module.HasBowString )
            {
                if ( module.m_PullWeight == PoundsPerPull.Fourty )
                {
                    attacker.DoHarmful( defender );
                    AOS.Damage( defender, attacker, Utility.RandomMinMax( 2, 5 ), 100, 0, 0, 0, 0 );
                    return true;
                }
                else if ( module.m_PullWeight == PoundsPerPull.Sixty )
                {
                    attacker.DoHarmful( defender );
                    AOS.Damage( defender, attacker, Utility.RandomMinMax( 6, 10 ), 100, 0, 0, 0, 0 );
                    return true;
                }
                else if ( module.m_PullWeight == PoundsPerPull.Eighty )
                {
                    attacker.DoHarmful( defender );
                    AOS.Damage( defender, attacker, Utility.RandomMinMax( 11, 15 ), 100, 0, 0, 0, 0 );
                    return true;
                }
                else if ( module.m_PullWeight == PoundsPerPull.Hundred )
                {
                    attacker.DoHarmful( defender );
                    AOS.Damage( defender, attacker, Utility.RandomMinMax( 16, 20 ), 100, 0, 0, 0, 0 );
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
                return true;
        }
Exemple #15
0
        public virtual void CheckStringCondition( Mobile from, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            if ( module.HasBowString && module.StringStrengthSelection == StringStrength.NoString )
            {
                module.HasBowString = false;
            }

            if ( !module.HasBowString )
            {
                if ( module.StringStrengthSelection == StringStrength.NoString )
                {
                    module.HasBowString = false;
                    //from.SendMessage( "You need a string to use this bow. See a local fletcher to apply the string." );
                }
                else
                {
                    module.StringStrengthSelection = StringStrength.NoString;
                }
            }
        }
Exemple #16
0
            protected override void OnTarget(Mobile from, object o)
            {
                int    oInt  = 0;
                double oDo   = 0;
                int    oMods = 0;

                if (o is BaseWeapon || o is BaseArmor || o is BaseJewel || o is BaseHat)
                {
                    if (from.Skills[SkillName.ItemID].Base >= 100.0)
                    {
                        if (o is BaseWeapon)
                        {
                            BaseWeapon w = o as BaseWeapon;
                            if (o is BaseRanged)
                            {
                                BaseRanged r = o as BaseRanged;
                                if (r.Velocity > 0)
                                {
                                    oDo += (130 / 50) * r.Velocity; oMods += 1;
                                }
                                if (r.Balanced == true)
                                {
                                    oDo += 150; oMods += 1;
                                }
                                if (w.Attributes.DefendChance > 0)
                                {
                                    oDo += (130 / 25) * w.Attributes.DefendChance; oMods += 1;
                                }
                                if (w.Attributes.AttackChance > 0)
                                {
                                    oDo += (130 / 25) * w.Attributes.AttackChance; oMods += 1;
                                }
                                if (w.Attributes.Luck > 0)
                                {
                                    oDo += (100 / 120) * w.Attributes.Luck; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistPhysicalBonus > 0)
                                {
                                    oDo += (100 / 18) * w.WeaponAttributes.ResistPhysicalBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistFireBonus > 0)
                                {
                                    oDo += (100 / 18) * w.WeaponAttributes.ResistFireBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistColdBonus > 0)
                                {
                                    oDo += (100 / 18) * w.WeaponAttributes.ResistColdBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistPoisonBonus > 0)
                                {
                                    oDo += (100 / 18) * w.WeaponAttributes.ResistPoisonBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistEnergyBonus > 0)
                                {
                                    oDo += (100 / 18) * w.WeaponAttributes.ResistEnergyBonus; oMods += 1;
                                }
                            }
                            else if (o is BaseMeleeWeapon)
                            {
                                if (w.Attributes.DefendChance > 0)
                                {
                                    oDo += (130 / 15) * w.Attributes.DefendChance; oMods += 1;
                                }
                                if (w.Attributes.AttackChance > 0)
                                {
                                    oDo += (130 / 15) * w.Attributes.AttackChance; oMods += 1;
                                }
                                if (w.Attributes.Luck > 0)
                                {
                                    oDo += w.Attributes.Luck; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistPhysicalBonus > 0)
                                {
                                    oDo += (100 / 15) * w.WeaponAttributes.ResistPhysicalBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistFireBonus > 0)
                                {
                                    oDo += (100 / 15) * w.WeaponAttributes.ResistFireBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistColdBonus > 0)
                                {
                                    oDo += (100 / 15) * w.WeaponAttributes.ResistColdBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistPoisonBonus > 0)
                                {
                                    oDo += (100 / 15) * w.WeaponAttributes.ResistPoisonBonus; oMods += 1;
                                }
                                if (w.WeaponAttributes.ResistEnergyBonus > 0)
                                {
                                    oDo += (100 / 15) * w.WeaponAttributes.ResistEnergyBonus; oMods += 1;
                                }
                            }

                            if (w.Attributes.RegenHits > 0)
                            {
                                oDo += (50 * w.Attributes.RegenHits); oMods += 1;
                            }
                            if (w.Attributes.RegenStam > 0)
                            {
                                oDo += (33.33 * w.Attributes.RegenStam); oMods += 1;
                            }
                            if (w.Attributes.RegenMana > 0)
                            {
                                oDo += (50 * w.Attributes.RegenMana); oMods += 1;
                            }
                            if (w.Attributes.BonusStr > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusStr; oMods += 1;
                            }
                            if (w.Attributes.BonusDex > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusDex; oMods += 1;
                            }
                            if (w.Attributes.BonusInt > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusInt; oMods += 1;
                            }
                            if (w.Attributes.BonusHits > 0)
                            {
                                oDo += 22 * w.Attributes.BonusHits; oMods += 1;
                            }
                            if (w.Attributes.BonusStam > 0)
                            {
                                oDo += (100 / 8) * w.Attributes.BonusStam; oMods += 1;
                            }
                            if (w.Attributes.BonusMana > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusMana; oMods += 1;
                            }
                            if (w.Attributes.WeaponDamage > 0)
                            {
                                oDo += (2 * w.Attributes.WeaponDamage); oMods += 1;
                            }
                            if (w.Attributes.WeaponSpeed > 0)
                            {
                                oDo += (110 / 30) * w.Attributes.WeaponSpeed; oMods += 1;
                            }
                            if (w.Attributes.SpellDamage > 0)
                            {
                                oDo += (100 / 12) * w.Attributes.SpellDamage; oMods += 1;
                            }
                            if (w.Attributes.CastRecovery > 0)
                            {
                                oDo += (40 * w.Attributes.CastRecovery); oMods += 1;
                            }
                            if (w.Attributes.LowerManaCost > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.LowerManaCost; oMods += 1;
                            }
                            if (w.Attributes.LowerRegCost > 0)
                            {
                                oDo += (5 * w.Attributes.LowerRegCost); oMods += 1;
                            }
                            if (w.Attributes.ReflectPhysical > 0)
                            {
                                oDo += (100 / 15) * w.Attributes.ReflectPhysical; oMods += 1;
                            }
                            if (w.Attributes.EnhancePotions > 0)
                            {
                                oDo += (4 * w.Attributes.EnhancePotions); oMods += 1;
                            }
                            if (w.Attributes.SpellChanneling > 0)
                            {
                                oDo += 100; oMods += 1;
                                if (w.Attributes.CastSpeed == 0)
                                {
                                    oDo += 140; oMods += 1;
                                }
                                if (w.Attributes.CastSpeed == 1)
                                {
                                    oDo += 280; oMods += 1;
                                }
                            }
                            else if (w.Attributes.CastSpeed > 0)
                            {
                                oDo += (140 * w.Attributes.CastSpeed); oMods += 1;
                            }
                            if (w.Attributes.NightSight > 0)
                            {
                                oDo += 50; oMods += 1;
                            }

                            if (w.WeaponAttributes.LowerStatReq > 0)
                            {
                                oDo += w.WeaponAttributes.LowerStatReq; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLeechHits > 0)
                            {
                                oDo += (110 / 50) * w.WeaponAttributes.HitLeechHits; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLeechStam > 0)
                            {
                                oDo += 2 * w.WeaponAttributes.HitLeechStam; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLeechMana > 0)
                            {
                                oDo += (110 / 50) * w.WeaponAttributes.HitLeechMana; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLowerAttack > 0)
                            {
                                oDo += (110 / 50) * w.WeaponAttributes.HitLowerAttack; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLowerDefend > 0)
                            {
                                oDo += (130 / 50) * w.WeaponAttributes.HitLowerDefend; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitColdArea > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitColdArea); oMods += 1;
                            }
                            if (w.WeaponAttributes.HitFireArea > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitFireArea); oMods += 1;
                            }
                            if (w.WeaponAttributes.HitPoisonArea > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitPoisonArea); oMods += 1;
                            }
                            if (w.WeaponAttributes.HitEnergyArea > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitEnergyArea); oMods += 1;
                            }
                            if (w.WeaponAttributes.HitPhysicalArea > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitPhysicalArea); oMods += 1;
                            }
                            if (w.WeaponAttributes.HitMagicArrow > 0)
                            {
                                oDo += 2.4 * w.WeaponAttributes.HitMagicArrow; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitHarm > 0)
                            {
                                oDo += (110 / 50) * w.WeaponAttributes.HitHarm; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitFireball > 0)
                            {
                                oDo += 2.4 * w.WeaponAttributes.HitFireball; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitLightning > 0)
                            {
                                oDo += 2.4 * w.WeaponAttributes.HitLightning; oMods += 1;
                            }
                            if (w.WeaponAttributes.HitDispel > 0)
                            {
                                oDo += (2 * w.WeaponAttributes.HitDispel); oMods += 1;
                            }
                            if (w.WeaponAttributes.UseBestSkill > 0)
                            {
                                oDo += 150; oMods += 1;
                            }
                            if (w.WeaponAttributes.MageWeapon > 0)
                            {
                                oDo += (20 * w.WeaponAttributes.MageWeapon); oMods += 1;
                            }
                            if (w.WeaponAttributes.DurabilityBonus > 0)
                            {
                                oDo += w.WeaponAttributes.DurabilityBonus; oMods += 1;
                            }
                            if (w.Slayer == SlayerName.Silver || w.Slayer == SlayerName.Repond || w.Slayer == SlayerName.ReptilianDeath || w.Slayer == SlayerName.Exorcism || w.Slayer == SlayerName.ArachnidDoom || w.Slayer == SlayerName.ElementalBan || w.Slayer == SlayerName.Fey)
                            {
                                oDo += 130; oMods += 1;
                            }
                            else if (w.Slayer != SlayerName.None)
                            {
                                oDo += 110; oMods += 1;
                            }
                            if (w.Slayer2 == SlayerName.Silver || w.Slayer2 == SlayerName.Repond || w.Slayer2 == SlayerName.ReptilianDeath || w.Slayer2 == SlayerName.Exorcism || w.Slayer2 == SlayerName.ArachnidDoom || w.Slayer2 == SlayerName.ElementalBan || w.Slayer2 == SlayerName.Fey)
                            {
                                oDo += 130; oMods += 1;
                            }
                            else if (w.Slayer2 != SlayerName.None)
                            {
                                oDo += 110; oMods += 1;
                            }

                            if (w.SkillBonuses.GetBonus(0) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(0); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(1) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(1); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(2) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(2); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(3) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(3); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(4) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(4); oMods += 1;
                            }
                            oDo   = Math.Round(oDo, 1);
                            oInt += Convert.ToInt32(oDo);
                        }
                        if (o is BaseArmor)
                        {
                            BaseArmor w = o as BaseArmor;

                            if (w.Attributes.DefendChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.DefendChance; oMods += 1;
                            }
                            if (w.Attributes.AttackChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.AttackChance; oMods += 1;
                            }
                            if (w.Attributes.Luck > 0)
                            {
                                oDo += w.Attributes.Luck; oMods += 1;
                            }
                            if (w.Attributes.RegenHits > 0)
                            {
                                oDo += (50 * w.Attributes.RegenHits); oMods += 1;
                            }
                            if (w.Attributes.RegenStam > 0)
                            {
                                oDo += (33.33 * w.Attributes.RegenStam); oMods += 1;
                            }
                            if (w.Attributes.RegenMana > 0)
                            {
                                oDo += (50 * w.Attributes.RegenMana); oMods += 1;
                            }
                            if (w.Attributes.BonusStr > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusStr; oMods += 1;
                            }
                            if (w.Attributes.BonusDex > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusDex; oMods += 1;
                            }
                            if (w.Attributes.BonusInt > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusInt; oMods += 1;
                            }
                            if (w.Attributes.BonusHits > 0)
                            {
                                oDo += 22 * w.Attributes.BonusHits; oMods += 1;
                            }
                            if (w.Attributes.BonusStam > 0)
                            {
                                oDo += (100 / 8) * w.Attributes.BonusStam; oMods += 1;
                            }
                            if (w.Attributes.BonusMana > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusMana; oMods += 1;
                            }
                            if (w.Attributes.WeaponDamage > 0)
                            {
                                oDo += (2 * w.Attributes.WeaponDamage); oMods += 1;
                            }
                            if (w.Attributes.WeaponSpeed > 0)
                            {
                                oDo += (110 / 30) * w.Attributes.WeaponSpeed; oMods += 1;
                            }
                            if (w.Attributes.SpellDamage > 0)
                            {
                                oDo += (100 / 12) * w.Attributes.SpellDamage; oMods += 1;
                            }
                            if (w.Attributes.CastRecovery > 0)
                            {
                                oDo += (40 * w.Attributes.CastRecovery); oMods += 1;
                            }
                            if (w.Attributes.LowerManaCost > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.LowerManaCost; oMods += 1;
                            }
                            if (w.Attributes.LowerRegCost > 0)
                            {
                                oDo += (5 * w.Attributes.LowerRegCost); oMods += 1;
                            }
                            if (w.Attributes.ReflectPhysical > 0)
                            {
                                oDo += (100 / 15) * w.Attributes.ReflectPhysical; oMods += 1;
                            }
                            if (w.Attributes.EnhancePotions > 0)
                            {
                                oDo += (4 * w.Attributes.EnhancePotions); oMods += 1;
                            }
                            if (w.Attributes.SpellChanneling > 0)
                            {
                                oDo += 100; oMods += 1;
                                if (w.Attributes.CastSpeed == 0)
                                {
                                    oDo += 140; oMods += 1;
                                }
                                if (w.Attributes.CastSpeed == 1)
                                {
                                    oDo += 280; oMods += 1;
                                }
                            }
                            else if (w.Attributes.CastSpeed > 0)
                            {
                                oDo += (140 * w.Attributes.CastSpeed); oMods += 1;
                            }
                            if (w.Attributes.NightSight > 0)
                            {
                                oDo += 50; oMods += 1;
                            }

                            if (w.ArmorAttributes.LowerStatReq > 0)
                            {
                                oDo += w.ArmorAttributes.LowerStatReq; oMods += 1;
                            }
                            if (w.ArmorAttributes.MageArmor > 0)
                            {
                                oDo += 140; oMods += 1;
                            }
                            if (w.ArmorAttributes.DurabilityBonus > 0)
                            {
                                oDo += w.ArmorAttributes.DurabilityBonus; oMods += 1;
                            }

                            if (w.Quality != ArmorQuality.Exceptional)
                            {
                                if (w.PhysicalBonus > 0)
                                {
                                    oDo += (100 / 15) * w.PhysicalBonus; oMods += 1;
                                }
                                if (w.FireBonus > 0)
                                {
                                    oDo += (100 / 15) * w.FireBonus; oMods += 1;
                                }
                                if (w.ColdBonus > 0)
                                {
                                    oDo += (100 / 15) * w.ColdBonus; oMods += 1;
                                }
                                if (w.PoisonBonus > 0)
                                {
                                    oDo += (100 / 15) * w.PoisonBonus; oMods += 1;
                                }
                                if (w.EnergyBonus > 0)
                                {
                                    oDo += (100 / 15) * w.EnergyBonus; oMods += 1;
                                }
                            }

                            if (w.SkillBonuses.GetBonus(0) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(0); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(1) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(1); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(2) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(2); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(3) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(3); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(4) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(4); oMods += 1;
                            }
                            oDo   = Math.Round(oDo, 1);
                            oInt += Convert.ToInt32(oDo);
                        }

                        if (o is BaseJewel)
                        {
                            BaseJewel w = o as BaseJewel;

                            if (w.Attributes.DefendChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.DefendChance; oMods += 1;
                            }
                            if (w.Attributes.AttackChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.AttackChance; oMods += 1;
                            }
                            if (w.Attributes.Luck > 0)
                            {
                                oDo += w.Attributes.Luck; oMods += 1;
                            }
                            if (w.Attributes.RegenHits > 0)
                            {
                                oDo += (50 * w.Attributes.RegenHits); oMods += 1;
                            }
                            if (w.Attributes.RegenStam > 0)
                            {
                                oDo += (33.33 * w.Attributes.RegenStam); oMods += 1;
                            }
                            if (w.Attributes.RegenMana > 0)
                            {
                                oDo += (50 * w.Attributes.RegenMana); oMods += 1;
                            }
                            if (w.Attributes.BonusStr > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusStr; oMods += 1;
                            }
                            if (w.Attributes.BonusDex > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusDex; oMods += 1;
                            }
                            if (w.Attributes.BonusInt > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusInt; oMods += 1;
                            }
                            if (w.Attributes.BonusHits > 0)
                            {
                                oDo += 22 * w.Attributes.BonusHits; oMods += 1;
                            }
                            if (w.Attributes.BonusStam > 0)
                            {
                                oDo += (100 / 8) * w.Attributes.BonusStam; oMods += 1;
                            }
                            if (w.Attributes.BonusMana > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusMana; oMods += 1;
                            }
                            if (w.Attributes.WeaponDamage > 0)
                            {
                                oDo += (2 * w.Attributes.WeaponDamage); oMods += 1;
                            }
                            if (w.Attributes.WeaponSpeed > 0)
                            {
                                oDo += (110 / 30) * w.Attributes.WeaponSpeed; oMods += 1;
                            }
                            if (w.Attributes.SpellDamage > 0)
                            {
                                oDo += (100 / 12) * w.Attributes.SpellDamage; oMods += 1;
                            }
                            if (w.Attributes.CastRecovery > 0)
                            {
                                oDo += (40 * w.Attributes.CastRecovery); oMods += 1;
                            }
                            if (w.Attributes.LowerManaCost > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.LowerManaCost; oMods += 1;
                            }
                            if (w.Attributes.LowerRegCost > 0)
                            {
                                oDo += (5 * w.Attributes.LowerRegCost); oMods += 1;
                            }
                            if (w.Attributes.ReflectPhysical > 0)
                            {
                                oDo += (100 / 15) * w.Attributes.ReflectPhysical; oMods += 1;
                            }
                            if (w.Attributes.EnhancePotions > 0)
                            {
                                oDo += (4 * w.Attributes.EnhancePotions); oMods += 1;
                            }
                            if (w.Attributes.SpellChanneling > 0)
                            {
                                oDo += 100; oMods += 1;
                                if (w.Attributes.CastSpeed == 0)
                                {
                                    oDo += 140; oMods += 1;
                                }
                                if (w.Attributes.CastSpeed == 1)
                                {
                                    oDo += 280; oMods += 1;
                                }
                            }
                            else if (w.Attributes.CastSpeed > 0)
                            {
                                oDo += (140 * w.Attributes.CastSpeed); oMods += 1;
                            }
                            if (w.Attributes.NightSight > 0)
                            {
                                oDo += 50; oMods += 1;
                            }

                            if (w.Resistances.Physical > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Physical; oMods += 1;
                            }
                            if (w.Resistances.Fire > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Fire; oMods += 1;
                            }
                            if (w.Resistances.Cold > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Cold; oMods += 1;
                            }
                            if (w.Resistances.Poison > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Poison; oMods += 1;
                            }
                            if (w.Resistances.Energy > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Energy; oMods += 1;
                            }

                            if (w.SkillBonuses.GetBonus(0) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(0); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(1) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(1); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(2) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(2); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(3) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(3); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(4) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(4); oMods += 1;
                            }
                            oDo   = Math.Round(oDo, 1);
                            oInt += Convert.ToInt32(oDo);
                        }
                        if (o is BaseClothing)
                        {
                            BaseClothing w = o as BaseClothing;

                            if (w.Attributes.DefendChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.DefendChance; oMods += 1;
                            }
                            if (w.Attributes.AttackChance > 0)
                            {
                                oDo += (130 / 15) * w.Attributes.AttackChance; oMods += 1;
                            }
                            if (w.Attributes.Luck > 0)
                            {
                                oDo += w.Attributes.Luck; oMods += 1;
                            }
                            if (w.Attributes.RegenHits > 0)
                            {
                                oDo += (50 * w.Attributes.RegenHits); oMods += 1;
                            }
                            if (w.Attributes.RegenStam > 0)
                            {
                                oDo += (33.33 * w.Attributes.RegenStam); oMods += 1;
                            }
                            if (w.Attributes.RegenMana > 0)
                            {
                                oDo += (50 * w.Attributes.RegenMana); oMods += 1;
                            }
                            if (w.Attributes.BonusStr > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusStr; oMods += 1;
                            }
                            if (w.Attributes.BonusDex > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusDex; oMods += 1;
                            }
                            if (w.Attributes.BonusInt > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusInt; oMods += 1;
                            }
                            if (w.Attributes.BonusHits > 0)
                            {
                                oDo += 22 * w.Attributes.BonusHits; oMods += 1;
                            }
                            if (w.Attributes.BonusStam > 0)
                            {
                                oDo += (100 / 8) * w.Attributes.BonusStam; oMods += 1;
                            }
                            if (w.Attributes.BonusMana > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.BonusMana; oMods += 1;
                            }
                            if (w.Attributes.WeaponDamage > 0)
                            {
                                oDo += (2 * w.Attributes.WeaponDamage); oMods += 1;
                            }
                            if (w.Attributes.WeaponSpeed > 0)
                            {
                                oDo += (110 / 30) * w.Attributes.WeaponSpeed; oMods += 1;
                            }
                            if (w.Attributes.SpellDamage > 0)
                            {
                                oDo += (100 / 12) * w.Attributes.SpellDamage; oMods += 1;
                            }
                            if (w.Attributes.CastRecovery > 0)
                            {
                                oDo += (40 * w.Attributes.CastRecovery); oMods += 1;
                            }
                            if (w.Attributes.LowerManaCost > 0)
                            {
                                oDo += (110 / 8) * w.Attributes.LowerManaCost; oMods += 1;
                            }
                            if (w.Attributes.LowerRegCost > 0)
                            {
                                oDo += (5 * w.Attributes.LowerRegCost); oMods += 1;
                            }
                            if (w.Attributes.ReflectPhysical > 0)
                            {
                                oDo += (100 / 15) * w.Attributes.ReflectPhysical; oMods += 1;
                            }
                            if (w.Attributes.EnhancePotions > 0)
                            {
                                oDo += (4 * w.Attributes.EnhancePotions); oMods += 1;
                            }
                            if (w.Attributes.SpellChanneling > 0)
                            {
                                oDo += 100; oMods += 1;
                                if (w.Attributes.CastSpeed == 0)
                                {
                                    oDo += 140; oMods += 1;
                                }
                                if (w.Attributes.CastSpeed == 1)
                                {
                                    oDo += 280; oMods += 1;
                                }
                            }
                            else if (w.Attributes.CastSpeed > 0)
                            {
                                oDo += (140 * w.Attributes.CastSpeed); oMods += 1;
                            }
                            if (w.Attributes.NightSight > 0)
                            {
                                oDo += 50; oMods += 1;
                            }


                            if (w.Resistances.Physical > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Physical; oMods += 1;
                            }
                            if (w.Resistances.Fire > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Fire; oMods += 1;
                            }
                            if (w.Resistances.Cold > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Cold; oMods += 1;
                            }
                            if (w.Resistances.Poison > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Poison; oMods += 1;
                            }
                            if (w.Resistances.Energy > 0)
                            {
                                oDo += (100 / 15) * w.Resistances.Energy; oMods += 1;
                            }

                            if (w.SkillBonuses.GetBonus(0) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(0); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(1) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(1); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(2) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(2); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(3) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(3); oMods += 1;
                            }
                            if (w.SkillBonuses.GetBonus(4) > 0)
                            {
                                oDo += (140 / 15) * w.SkillBonuses.GetBonus(4); oMods += 1;
                            }
                            oDo   = Math.Round(oDo, 1);
                            oInt += Convert.ToInt32(oDo);
                        }

                        if (oInt > 0 && oInt <= 200)
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You conclude that item will magically unravel into: Magical Residue");
                            if (from.Skills[SkillName.Imbuing].Base >= 100.0)
                            {
                                from.LocalOverheadMessage(MessageType.Regular, 2499, true, String.Format("Item Intensity: {0}", oInt));
                            }
                        }

                        else if (oInt > 200 && oInt < 480)
                        {
                            if (from.Skills[SkillName.Imbuing].Base >= 45.0)
                            {
                                from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You conclude that item will magically unravel into: Enchanted Essence");
                                if (from.Skills[SkillName.Imbuing].Base >= 100.0)
                                {
                                    from.LocalOverheadMessage(MessageType.Regular, 2499, true, String.Format("Item Intensity: {0}", oInt));
                                }
                            }
                            else
                            {
                                from.LocalOverheadMessage(MessageType.Regular, 2499, true, "Your Imbuing skill is not high enough to identify the imbuing ingredient.");
                            }
                        }
                        else if (oInt >= 480)
                        {
                            if (from.Skills[SkillName.Imbuing].Base >= 95.0)
                            {
                                from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You conclude that item will magically unravel into: Relic Fragment");
                                if (from.Skills[SkillName.Imbuing].Base >= 100.0)
                                {
                                    from.LocalOverheadMessage(MessageType.Regular, 2499, true, String.Format("Item Intensity: {0}", oInt));
                                }
                            }
                            else
                            {
                                from.LocalOverheadMessage(MessageType.Regular, 2499, true, "Your Imbuing skill is not high enough to identify the imbuing ingredient.");
                            }
                        }
                        else
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You conclude that item cannot be magically unraveled. It appears to possess little to no magic.");
                        }
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You are uncertain.. your Item Identification skill isn't high enougth");
                    }
                }
                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 2499, true, "You conclude that item cannot be magically unraveled.");
                }
            }
 public InternalTarget( BaseRangedModule mod, BaseRanged ranged )
     : base(1, false, TargetFlags.None)
 {
     br_mod = mod;
     m_Ranged = ranged;
 }
Exemple #18
0
        public void Fire(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;

            if (bow == null)
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this."));
                //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this.");
                //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this.
                return;
            }

            if (DateTime.Now < (m_LastUse + UseDelay))
            {
                return;
            }

            Point3D worldLoc = GetWorldLocation();

            if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte.");                   // You would do better to stand in front of the archery butte.
                return;
            }

            if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot.");                   // You aren't properly lined up with the archery butte to get an accurate shot.
                return;
            }

            if (!from.InRange(worldLoc, 6))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot.");                   // You are too far away from the archery butte to get an accurate shot.
                return;
            }
            else if (from.InRange(worldLoc, 4))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too close to the target.");                   // You are too close to the target.
                return;
            }

            Container pack     = from.Backpack;
            Type      ammoType = bow.AmmoType;

            bool isArrow = (ammoType == typeof(Arrow));
            bool isBolt  = (ammoType == typeof(Bolt));
            bool isKnown = (isArrow || isBolt);

            if (pack == null || !pack.ConsumeTotal(ammoType, 1))
            {
                if (isArrow)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice.");                       // You do not have any arrows with which to practice.
                }
                else if (isBolt)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice.");                       // You do not have any crossbow bolts with which to practice.
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this."));
                }
                //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this.

                return;
            }

            m_LastUse = DateTime.Now;

            from.Direction = from.GetDirectionTo(GetWorldLocation());
            bow.PlaySwingAnimation(from);
            from.MovingEffect(this, bow.EffectID, 18, 1, false, false);

            ScoreEntry se = GetEntryFor(from);

            if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill))
            {
                from.PlaySound(bow.MissSound);

                PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name));
                //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether.

                se.Record(0);

                if (se.Count == 1)
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString()));
                }
                else
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));                     //1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );
                }
                if (0.4 >= Utility.RandomDouble())
                {
                    if (isArrow)
                    {
                        Item Ammo = new Arrow();
                        Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map);
                    }
                    else if (isBolt)
                    {
                        Item Ammo = new Bolt();
                        Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map);
                    }
                }
                return;
            }

            Effects.PlaySound(Location, Map, /*0x2B1*/ 564);

            double rand = Utility.RandomDouble();

            int area, score, splitScore;

            if (0.10 > rand)
            {
                area       = 0;           // bullseye
                score      = 50;
                splitScore = 100;
            }
            else if (0.25 > rand)
            {
                area       = 1;           // inner ring
                score      = 10;
                splitScore = 20;
            }
            else if (0.50 > rand)
            {
                area       = 2;           // middle ring
                score      = 5;
                splitScore = 15;
            }
            else
            {
                area       = 3;           // outer ring
                score      = 2;
                splitScore = 5;
            }

            bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble());

            if (split)
            {
                if (isArrow)
                {
                    switch (area)
                    {
                    case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break;

                    case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break;

                    case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break;

                    case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break;
                    }
                }
                else
                {
                    switch (area)
                    {
                    case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break;

                    case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break;

                    case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break;

                    case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break;
                    }
                }
                //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name );
            }
            else
            {
                switch (area)
                {
                case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break;

                case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break;

                case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break;

                case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break;
                }
                //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name );

                if (isArrow)
                {
                    ++m_Arrows;
                }
                else if (isBolt)
                {
                    ++m_Bolts;
                }
            }

            se.Record(split ? splitScore : score);

            /*if ( se.Count == 1 )
             *      PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() );
             * else
             *      PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/
            if (se.Count == 1)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString()));
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );
            }
        }
Exemple #19
0
 public StringerTarget( BaseRanged ranged )
     : base(1, false, TargetFlags.None)
 {
     it_Ranged = ranged;
 }
        public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes       primary   = weapon.Attributes;
            AosWeaponAttributes secondary = weapon.WeaponAttributes;

            m_Props.SetAll(false);

            if (weapon is BaseRanged)
            {
                m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon
            }
            else
            {
                m_Props.Set(25, true); // Only bows can be Balanced
                m_Props.Set(26, true); // Only bows have Velocity
            }

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

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

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

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

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

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

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

                    break;
                }

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

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

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

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

                    break;
                }

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

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

                    break;
                }

                case 3:
                    int dmgMin = primary.WeaponDamage;
                    int dmgMax = Math.Max(dmgMin, 50);
                    primary.WeaponDamage = 0;
                    ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, dmgMin, dmgMax);
                    break;

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

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

                case 6:
                    ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15);
                    break;

                case 7:
                    ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100);
                    break;

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

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

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

                case 11:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechHits)[1], 2);
                    break;

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

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

                case 14:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechMana)[1], 2);
                    break;

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

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

                case 17:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15);
                    break;

                case 18:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15);
                    break;

                case 19:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15);
                    break;

                case 20:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15);
                    break;

                case 21:
                    ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15);
                    break;

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

                case 23:
                    weapon.Slayer = GetRandomSlayer();
                    break;

                case 24:
                    GetElementalDamages(weapon);
                    break;

                case 25:
                    BaseRanged brb = weapon as BaseRanged;
                    brb.Balanced = true;
                    break;

                case 26:
                    BaseRanged brv = weapon as BaseRanged;
                    brv.Velocity = (Utility.RandomMinMax(2, 50));
                    break;
                }
            }
        }
Exemple #21
0
 public BaseRanged(Serial serial) : base(serial)
 {
     BRanged = this;
 }
		public BaseRanged( Serial serial ) : base( serial )
		{
			BRanged = this;
		}
Exemple #23
0
        public StarterBagWarrior()
        {
            Container cont;

            this.Name = "Starter Bag - Warrior";

            cont      = new Bag();
            cont.Name = "PowerScroll Bag";
            PlaceItemIn(cont, 30, 35, new PowerScroll(SkillName.Fencing, 105));
            PlaceItemIn(cont, 60, 35, new PowerScroll(SkillName.Swords, 105));
            PlaceItemIn(cont, 90, 35, new PowerScroll(SkillName.Macing, 105));
            PlaceItemIn(cont, 30, 68, new PowerScroll(SkillName.Archery, 105));
            PlaceItemIn(cont, 45, 68, new PowerScroll(SkillName.Parry, 105));
            PlaceItemIn(cont, 75, 68, new PowerScroll(SkillName.Chivalry, 105));
            PlaceItemIn(cont, 90, 68, new PowerScroll(SkillName.Tactics, 105));
            PlaceItemIn(cont, 30, 118, new PowerScroll(SkillName.Anatomy, 105));
            PlaceItemIn(cont, 60, 118, new PowerScroll(SkillName.Healing, 105));
            PlaceItemIn(this, 0, 0, cont);
            for (int i = 0; i < cont.Items.Count; i++)
            {
                cont.Items[i].LootType = LootType.Blessed;
            }

            cont      = new Bag();
            cont.Name = "Gear Bag";
            // Armor
            PlaceItemIn(cont, 30, 35, new PlateChest());
            PlaceItemIn(cont, 60, 35, new PlateGorget());
            PlaceItemIn(cont, 90, 35, new PlateArms());
            PlaceItemIn(cont, 30, 68, new PlateHelm());
            PlaceItemIn(cont, 45, 68, new PlateGloves());
            PlaceItemIn(cont, 75, 68, new PlateLegs());
            // Jewelry
            PlaceItemIn(cont, 90, 68, new GoldEarrings());
            PlaceItemIn(cont, 30, 118, new GoldBracelet());
            PlaceItemIn(cont, 60, 118, new GoldRing());
            PlaceItemIn(this, 50, 0, cont);
            for (int i = 0; i < cont.Items.Count; i++)
            {
                BaseArmor armor = cont.Items[i] as BaseArmor;
                BaseJewel jewel = cont.Items[i] as BaseJewel;
                if (jewel != null)
                {
                    jewel.Attributes.LowerRegCost = 12;
                    jewel.Attributes.AttackChance = 5;
                    jewel.Attributes.DefendChance = 5;
                    jewel.LootType    = LootType.Blessed;
                    jewel.Hue         = 1161;
                    jewel.Insured     = false;
                    jewel.TimesImbued = 50;
                }
                else if (armor != null)
                {
                    armor.Attributes.LowerRegCost   = 12;
                    armor.ArmorAttributes.MageArmor = 1;
                    armor.LootType       = LootType.Blessed;
                    armor.Hue            = 1157;
                    armor.Insured        = false;
                    armor.TimesImbued    = 50;
                    armor.StrRequirement = 0;
                    armor.Weight         = 0;
                }
            }

            cont      = new Bag();
            cont.Name = "Weapon Bag";
            // Weapons
            PlaceItemIn(cont, 30, 35, new CompositeBow());
            PlaceItemIn(cont, 60, 35, new Arrow(500));
            PlaceItemIn(cont, 90, 35, new RepeatingCrossbow());
            PlaceItemIn(cont, 30, 68, new Bolt(500));
            PlaceItemIn(cont, 45, 68, new ShortSpear());
            PlaceItemIn(cont, 75, 68, new Hatchet());
            PlaceItemIn(cont, 90, 68, new QuarterStaff());
            PlaceItemIn(cont, 30, 118, new BookOfChivalry((UInt64)0x3FF));
            PlaceItemIn(cont, 60, 118, new BookOfNinjitsu());
            PlaceItemIn(this, 100, 0, cont);

            for (int i = 0; i < cont.Items.Count; i++)
            {
                BaseRanged      bow   = cont.Items[i] as BaseRanged;
                BaseMeleeWeapon melee = cont.Items[i] as BaseMeleeWeapon;
                if (bow != null)
                {
                    bow.Attributes.WeaponSpeed = 35;
                    bow.Attributes.RegenHits   = 20;
                    bow.TimesImbued            = 50;
                    bow.DurabilityLevel        = WeaponDurabilityLevel.Regular;
                    bow.Hue         = 1161;
                    bow.LootType    = LootType.Blessed;
                    bow.TimesImbued = 50;
                }
                else if (melee != null)
                {
                    melee.Attributes.WeaponSpeed = 35;
                    melee.Attributes.RegenHits   = 20;
                    melee.TimesImbued            = 50;
                    melee.DurabilityLevel        = WeaponDurabilityLevel.Regular;
                    melee.Hue         = 1161;
                    melee.LootType    = LootType.Blessed;
                    melee.TimesImbued = 50;
                }
            }
        }
Exemple #24
0
            public InternalTimer(Mobile owner, BaseRanged weapon, int m_Hue, string m_WeaponName)
                : base(TimeSpan.FromSeconds(0))
            {
                m_Owner = owner;
                m_Weapon = weapon;
                m_weaponhue = m_Hue;
                m_Name = m_WeaponName;

                int val = (int)owner.Skills[SkillName.Magery].Value;

                if (val > 100)
                    val = 100;

                Delay = TimeSpan.FromSeconds(val);
                Priority = TimerPriority.TwoFiftyMS;
            }
Exemple #25
0
        public void Fire(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;

            if (bow == null)
            {
                SendLocalizedMessageTo(from, 500593);                   // You must practice with ranged weapons on this.
                return;
            }

            if (DateTime.Now < (m_LastUse + UseDelay))
            {
                return;
            }

            Point3D worldLoc = GetWorldLocation();

            if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y)
            {
                SendLocalizedMessageTo(from, 500596);                   // You would do better to stand in front of the archery butte.
                return;
            }

            if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X)
            {
                SendLocalizedMessageTo(from, 500597);                   // You aren't properly lined up with the archery butte to get an accurate shot.
                return;
            }

            if (!from.InRange(worldLoc, bow.MaxRange))
            {
                SendLocalizedMessageTo(from, 500598);                   // You are too far away from the archery butte to get an accurate shot.
                return;
            }
            else if (from.InRange(worldLoc, 4))
            {
                SendLocalizedMessageTo(from, 500599);                   // You are too close to the target.
                return;
            }

            Container pack     = from.Backpack;
            Type      ammoType = bow.AmmoType;

            bool isArrow = (ammoType == typeof(Arrow));
            bool isBolt  = (ammoType == typeof(Bolt));
            bool isKnown = (isArrow || isBolt);

            if (pack == null || !pack.ConsumeTotal(ammoType, 1))
            {
                if (isArrow)
                {
                    SendLocalizedMessageTo(from, 500594);                       // You do not have any arrows with which to practice.
                }
                else if (isBolt)
                {
                    SendLocalizedMessageTo(from, 500595);                       // You do not have any crossbow bolts with which to practice.
                }
                else
                {
                    SendLocalizedMessageTo(from, 500593);                       // You must practice with ranged weapons on this.
                }
                return;
            }

            m_LastUse = DateTime.Now;

            from.Direction = from.GetDirectionTo(GetWorldLocation());
            bow.PlaySwingAnimation(from);
            from.MovingEffect(this, bow.EffectID, 18, 1, false, false);

            if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill))
            {
                from.PlaySound(bow.MissSound);
                SendLocalizedMessageTo(from, 500604);                   // You miss the target altogether.
                return;
            }

            from.PlaySound(bow.HitSound);

            double rand = Utility.RandomDouble();

            int area;

            if (0.10 > rand)
            {
                area = 0;                 // bullseye
            }
            else if (0.25 > rand)
            {
                area = 1;                 // inner ring
            }
            else if (0.50 > rand)
            {
                area = 2;                 // middle ring
            }
            else
            {
                area = 3;                 // outer ring
            }
            bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.05) > Utility.RandomDouble());

            if (split)
            {
                SendLocalizedMessageTo(from, 1010027 + (isArrow ? 0 : 4) + area);
            }
            else
            {
                SendLocalizedMessageTo(from, 1010035 + area);

                if (isArrow)
                {
                    ++m_Arrows;
                }
                else if (isBolt)
                {
                    ++m_Bolts;
                }
            }
        }
Exemple #26
0
 private static void ApplyVelocityAttribute(BaseRanged ranged, int min, int max, int low, int high, int scale)
 {
     ranged.Velocity = Scale(min, max, low / scale, high / scale) * scale;
 }
Exemple #27
0
        public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes       primary   = weapon.Attributes;
            AosWeaponAttributes secondary = weapon.WeaponAttributes;

            m_Props.SetAll(false);

            #region Mondain's Legacy
            BaseRanged ranged = weapon as BaseRanged;
            #endregion

            if (weapon is BaseRanged)
            {
                m_Props.Set(2, true);                   // ranged weapons cannot be ubws or mageweapon
            }
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(25);

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

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

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

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

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

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

                    break;
                }

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

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

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

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

                    break;
                }

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

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

                    break;
                }

                case  3: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break;

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

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

                case  6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break;

                case  7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break;

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

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

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

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

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

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

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

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

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

                case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break;

                case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break;

                case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break;

                case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break;

                case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break;

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

                case 23: weapon.Slayer = GetRandomSlayer(); break;

                case 24: GetElementalDamages(weapon); break;

                    #region Mondain's Legacy
                case 25: ranged.Balanced = true; break;

                case 26: ranged.Velocity = Utility.RandomMinMax(10, 50); break;
                    #endregion
                }
            }
        }
Exemple #28
0
 public CrossbowTarget( BaseRanged ranged )
     : base(1, false, TargetFlags.None)
 {
     it_Ranged = ranged;
 }
Exemple #29
0
 public InternalTarget(BaseRanged bow) : base(1, false, TargetFlags.None)
 {
     it_Bow = bow;
 }
Exemple #30
0
        public virtual bool CheckStringDamage( Mobile attacker, Mobile defender, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            if ( module.HasBowString )
            {
                if ( module.StringStrengthSelection == StringStrength.VeryWeak )
                {
                    if ( .05 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    if ( .10 > Utility.Random( 1000 ) ) //1 in a 100 chances of breaking.
                    {
                        module.HasBowString = false;
                        module.StringStrengthSelection = StringStrength.NoString;
                        attacker.SendMessage( "Your string just broke." );
                    }
                    return true;
                }
                else if ( module.StringStrengthSelection == StringStrength.Weak )
                {
                    if ( .10 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    if ( .09 > Utility.Random( 1000 ) ) //1 in a 110 chances of breaking.
                    {
                        module.HasBowString = false;
                        module.StringStrengthSelection = StringStrength.NoString;
                        attacker.SendMessage( "Your string just broke." );
                    }
                    return true;
                }
                else if ( module.StringStrengthSelection == StringStrength.Sturdy )
                {
                    if ( .15 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    if ( .08 > Utility.Random( 1000 ) ) //1 in a 125 chances of breaking.
                    {
                        module.HasBowString = false;
                        module.StringStrengthSelection = StringStrength.NoString;
                        attacker.SendMessage( "Your string just broke." );
                    }
                    return true;
                }
                else if ( module.StringStrengthSelection == StringStrength.Strong )
                {
                    if ( .20 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    if ( .05 > Utility.Random( 1000 ) ) //1 in a 200 chances of breaking.
                    {
                        module.HasBowString = false;
                        module.StringStrengthSelection = StringStrength.NoString;
                        attacker.SendMessage( "Your string just broke." );
                    }
                }
                else if ( module.StringStrengthSelection == StringStrength.Dependable )
                {
                    if ( .25 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    if ( .03 > Utility.Random( 1000 ) ) //1 in a 333 chances of breaking.
                    {
                        module.HasBowString = false;
                        module.StringStrengthSelection = StringStrength.NoString;
                        attacker.SendMessage( "Your string just broke." );
                    }
                    return true;
                }
                else if ( module.StringStrengthSelection == StringStrength.Indestructable )
                {
                    if ( .33 > Utility.Random( 100 ) )
                    {
                        BonusDamage( attacker, defender, ranged );
                        return true;
                    }
                    //No chance of breaking.
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }

            return false;
        }
 public InternalTarget(BaseRanged bow, Type typeofammo) : base(1, false, TargetFlags.None)
 {
     Bow  = bow;
     ammo = typeofammo;
 }
Exemple #32
0
        public static void CutString( Mobile from, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            module.StringStrengthSelection = StringStrength.NoString;
            module.PullWeightSelection = PoundsPerPull.Zero;
            module.HasBowString = false;

            from.PlaySound( 0x248 );
            from.SendMessage( "You have just removed the string from your bow." );

            ranged.InvalidateProperties();
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            switch ( version )
            {
                    /*	case 2:
                    {
                        DefaultMaxLevel = reader.ReadInt();
                        MaxLevelsCap = reader.ReadInt();
                        EnableExpCap = reader.ReadBool();
                        DisplayExpProp = reader.ReadBool();
                        PointsPerLevel = reader.ReadInt();
                        DoubleArtifactCost = reader.ReadBool();
                        BlacksmithOnly = reader.ReadBool();
                        BlacksmithSkillRequired = reader.ReadDouble();
                        RewardBlacksmith = reader.ReadBool();
                        BlacksmithRewardAmt = reader.ReadInt();
                        m_Experience = reader.ReadInt();
                        m_Level = reader.ReadInt();
                        m_Points = reader.ReadInt();
                        m_MaxLevel = reader.ReadInt();
                        goto case 1;
                    }*/
                case 1:
                    {
                        m_Serial = reader.ReadInt();
                        m_Ranged = reader.ReadItem() as BaseRanged;
                        goto case 0;
                    }
                case 0:
                    {
                        m_HasBowString = reader.ReadBool();
                        m_Strength = ( StringStrength )reader.ReadEncodedInt();
                        m_PullWeight = ( PoundsPerPull )reader.ReadEncodedInt();
                        m_ArrowType = ( ArrowType )reader.ReadEncodedInt();
                        m_BoltType = ( BoltType )reader.ReadEncodedInt();
                        break;
                    }
            }
        }
        public void Fire(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;

            if (bow == null)
            {
                SendLocalizedMessageTo(from, 500593);                   // You must practice with ranged weapons on this.
                return;
            }

            if (DateTime.Now < (m_LastUse + UseDelay))
            {
                return;
            }

            Point3D worldLoc = GetWorldLocation();

            if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500596);                   // You would do better to stand in front of the archery butte.
                return;
            }

            if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500597);                   // You aren't properly lined up with the archery butte to get an accurate shot.
                return;
            }

            if (!from.InRange(worldLoc, 6))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500598);                   // You are too far away from the archery butte to get an accurate shot.
                return;
            }
            else if (from.InRange(worldLoc, 4))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599);                   // You are too close to the target.
                return;
            }

            Container pack     = from.Backpack;
            Type      ammoType = bow.AmmoType;

            bool isArrow = (ammoType == typeof(Arrow));
            bool isBolt  = (ammoType == typeof(Bolt));
            bool isKnown = (isArrow || isBolt);

            if (pack == null || !pack.ConsumeTotal(ammoType, 1))
            {
                if (isArrow)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500594);                       // You do not have any arrows with which to practice.
                }
                else if (isBolt)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500595);                       // You do not have any crossbow bolts with which to practice.
                }
                else
                {
                    SendLocalizedMessageTo(from, 500593);                       // You must practice with ranged weapons on this.
                }
                return;
            }

            m_LastUse = DateTime.Now;

            from.Direction = from.GetDirectionTo(GetWorldLocation());
            bow.PlaySwingAnimation(from);
            from.MovingEffect(this, bow.EffectID, 18, 1, false, false);

            ScoreEntry se = GetEntryFor(from);

            if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill))
            {
                from.PlaySound(bow.MissSound);

                PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name);                   // You miss the target altogether.

                se.Record(0);

                if (se.Count == 1)
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
                }
                else
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
                }

                return;
            }

            Effects.PlaySound(Location, Map, 0x2B1);

            double rand = Utility.RandomDouble();

            int area, score, splitScore;

            if (0.10 > rand)
            {
                area       = 0;           // bullseye
                score      = 50;
                splitScore = 100;
            }
            else if (0.25 > rand)
            {
                area       = 1;           // inner ring
                score      = 10;
                splitScore = 20;
            }
            else if (0.50 > rand)
            {
                area       = 2;           // middle ring
                score      = 5;
                splitScore = 15;
            }
            else
            {
                area       = 3;           // outer ring
                score      = 2;
                splitScore = 5;
            }

            bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble());

            if (split)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name);
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name);

                if (isArrow)
                {
                    ++m_Arrows;
                }
                else if (isBolt)
                {
                    ++m_Bolts;
                }
            }

            se.Record(split ? splitScore : score);

            if (se.Count == 1)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
            }
        }
Exemple #35
0
        public virtual void CheckStringError( Mobile from, BaseRanged ranged )
        {
            BaseRangedModule module = ranged.BaseRangedModule;

            if ( module.HasBowString && module.StringStrengthSelection == StringStrength.NoString )
            {
                from.SendMessage( "The bow has an internal error. The bow is now being fixed..." );
                module.HasBowString = false;
            }
        }