public virtual void OnTarget(Mobile from, object obj)
        {
            if (Deleted)
            {
                return;
            }

            SwampDragon pet = obj as SwampDragon;

            if (pet == null || pet.HasBarding)
            {
                from.SendLocalizedMessage(1053025);                   // That is not an unarmored swamp dragon.
            }
            else if (!pet.Controlled || pet.ControlMaster != from)
            {
                from.SendLocalizedMessage(1053026);                   // You can only put barding on a tamed swamp dragon that you own.
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1060640);                   // The item must be in your backpack to use it.
            }
            else
            {
                pet.BardingExceptional = Exceptional;
                pet.BardingCrafter     = Crafter;
                pet.BardingHP          = pet.BardingMaxHP;
                pet.BardingResource    = Resource;
                pet.HasBarding         = true;
                pet.Hue = Hue;

                Delete();

                from.SendLocalizedMessage(1053027);                   // You place the barding on your swamp dragon.  Use a bladed item on your dragon to remove the armor.
            }
        }
Example #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        if (weap.MaxHitPoints != 0)
                        {
                            int hp = (int)(weap.HitPoints / (double)weap.MaxHitPoints * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }

                        int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                        int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                        if (damage < 3)
                        {
                            damage = 0;
                        }
                        else
                        {
                            damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                        }

                        /*
                         * else if ( damage < 6 )
                         * damage = 1;
                         * else if ( damage < 11 )
                         * damage = 2;
                         * else if ( damage < 16 )
                         * damage = 3;
                         * else if ( damage < 21 )
                         * damage = 4;
                         * else if ( damage < 26 )
                         * damage = 5;
                         * else
                         * damage = 6;
                         * */

                        WeaponType type = weap.Type;

                        if (type == WeaponType.Ranged)
                        {
                            from.SendLocalizedMessage(1038224 + (damage * 9));
                        }
                        else if (type == WeaponType.Piercing)
                        {
                            from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Slashing)
                        {
                            from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Bashing)
                        {
                            from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                        }
                        else
                        {
                            from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                        }

                        if (weap.Poison != null && weap.PoisonCharges > 0)
                        {
                            from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (targeted is BaseArmor)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        if (arm.MaxHitPoints != 0)
                        {
                            int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }

                        from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));

                        /*
                         * if ( arm.ArmorRating < 1 )
                         * from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
                         * else if ( arm.ArmorRating < 6 )
                         * from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
                         * else if ( arm.ArmorRating < 11 )
                         * from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
                         * else if ( arm.ArmorRating < 16 )
                         * from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
                         * else if ( arm.ArmorRating < 21 )
                         * from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
                         * else if ( arm.ArmorRating < 26 )
                         * from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
                         * else if ( arm.ArmorRating < 31 )
                         * from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
                         * else
                         * from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
                         * */
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                {
                    SwampDragon pet = (SwampDragon)targeted;

                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                        if (perc < 0)
                        {
                            perc = 0;
                        }
                        else if (perc > 4)
                        {
                            perc = 4;
                        }

                        pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500352); // This is neither weapon nor armor.
                }
            }
Example #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IEntity entity = targeted as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.ArmsLore, from.Skills[SkillName.ArmsLore].Value))
                {
                    return;
                }

                if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                {
                    // Alan mod: show exact durability points if succeeded
                    if (targeted is BaseWeapon)
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        from.SendMessage("This weapon has " + weap.HitPoints + "/" + weap.MaxHitPoints + " durability.");

                        int damage = (weap.DamageMax + weap.DamageMin) / 2;

                        if (weap.Quality == WeaponQuality.Exceptional)
                        {
                            damage += (int)(damage * 0.2);
                        }

                        if (weap.DamageLevel > WeaponDamageLevel.Regular)
                        {
                            damage += (int)((2.0 * (int)weap.DamageLevel) - 1.0);
                        }

                        int hand = (weap.Layer == Layer.OneHanded ? 0 : 1);

                        if (damage < 3)
                        {
                            damage = 0;
                        }
                        else
                        {
                            damage = ((Math.Min(damage, 30) - 1) / 5) + 1;
                        }

                        //damage = (int)Math.Ceiling( Math.Min( damage, 30 ) / 5.0 );

                        /*
                         * else if ( damage < 6 )
                         * damage = 1;
                         * else if ( damage < 11 )
                         * damage = 2;
                         * else if ( damage < 16 )
                         * damage = 3;
                         * else if ( damage < 21 )
                         * damage = 4;
                         * else if ( damage < 26 )
                         * damage = 5;
                         * else
                         * damage = 6;
                         * */

                        WeaponType type = weap.Type;

                        damage *= 9;

                        if (type == WeaponType.Ranged)
                        {
                            from.SendLocalizedMessage(1038224 + damage);
                        }
                        else if (type == WeaponType.Piercing)
                        {
                            from.SendLocalizedMessage(1038218 + hand + damage);
                        }
                        else if (type == WeaponType.Slashing)
                        {
                            from.SendLocalizedMessage(1038220 + hand + damage);
                        }
                        else if (type == WeaponType.Bashing)
                        {
                            from.SendLocalizedMessage(1038222 + hand + damage);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1038216 + hand + damage);
                        }

                        if (weap.Poison != null && weap.PoisonCharges > 0)
                        {
                            from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it.
                        }

                        /*				if ( weap is GlacialStaff && from.Skills[SkillName.ArmsLore].Value >= 90.0 )
                         *              {
                         *                  GlacialStaff staff = (GlacialStaff)weap;
                         *                  int spells = 0; //Assume it has Ice Ball
                         *
                         *                  if ( staff.GetFlag( GlacialSpells.Freeze ) )
                         *                  {
                         *                      spells++;
                         *                      if ( staff.GetFlag( GlacialSpells.IceStrike ) )
                         *                          spells++;
                         *                  }
                         *
                         *                  from.SendLocalizedMessage( 1038213 + spells );
                         *              }
                         *          }*/
                    }
                    else if (targeted is BaseArmor)
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        from.SendMessage("This armor has " + arm.HitPoints + "/" + arm.MaxHitPoints + " durability.");

                        from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating(null), 35) / 5.0));
                    }
                    else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                    {
                        SwampDragon pet = (SwampDragon)targeted;

                        int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                        if (perc < 0)
                        {
                            perc = 0;
                        }
                        else if (perc > 4)
                        {
                            perc = 4;
                        }

                        pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500352); // This is neither weapon nor armor.
                    }
                }
                else
                {
                    //from.SendLocalizedMessage(500353); // You are not certain...

                    // Alan mod: on failure, show the regular (dumb) general durability values
                    if (targeted is BaseWeapon)
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        if (weap.MaxHitPoints != 0)
                        {
                            int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }
                    }
                    else if (targeted is BaseArmor)
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        if (arm.MaxHitPoints != 0)
                        {
                            int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }
                    }
                    else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                    {
                        SwampDragon pet = (SwampDragon)targeted;

                        int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                        if (perc < 0)
                        {
                            perc = 0;
                        }
                        else if (perc > 4)
                        {
                            perc = 4;
                        }

                        pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500352); // This is neither weapon nor armor.
                    }
                }
            }
Example #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        if (weap.MaxHitPoints != 0)
                        {
                            int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }

                        int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                        int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                        if (damage < 3)
                        {
                            damage = 0;
                        }
                        else
                        {
                            damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                        }

                        WeaponType type = weap.Type;

                        if (type == WeaponType.Ranged)
                        {
                            from.SendLocalizedMessage(1038224 + (damage * 9));
                        }
                        else if (type == WeaponType.Piercing)
                        {
                            from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Slashing)
                        {
                            from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Bashing)
                        {
                            from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                        }
                        else
                        {
                            from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                        }

                        if (weap.Poison != null && weap.PoisonCharges > 0)
                        {
                            from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (targeted is BaseArmor)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        if (arm.MaxHitPoints != 0)
                        {
                            int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            from.SendLocalizedMessage(1038285 + hp);
                        }

                        from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                {
                    SwampDragon pet = (SwampDragon)targeted;

                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                        if (perc < 0)
                        {
                            perc = 0;
                        }
                        else if (perc > 4)
                        {
                            perc = 4;
                        }

                        pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500352); // This is neither weapon nor armor.
                }
            }
 protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is BaseCreature)
     {
         BaseCreature bc = (BaseCreature)targ;
         if (from.InRange(bc, 1))
         {
             if (bc.ControlMaster != from)
             {
                 from.SendMessage("You can only put a bridle on your own animal!");
             }
             else
             {
                 if (targ is WildHorse)
                 {
                     Horse h = new Horse();
                     h.Body = bc.Body;
                     ConvertAnimal(bc, h);
                     br.Consume();
                 }
                 else if (targ is Llama)
                 {
                     RidableLlama rl = new RidableLlama();
                     ConvertAnimal(bc, rl);
                     br.Consume();
                 }
                 else if (targ is WildDesertOstard)
                 {
                     DesertOstard dost = new DesertOstard();
                     ConvertAnimal(bc, dost);
                     br.Consume();
                 }
                 else if (targ is WildFireSteed)
                 {
                     FireSteed fs = new FireSteed();
                     ConvertAnimal(bc, fs);
                     br.Consume();
                 }
                 else if (targ is WildForestOstard)
                 {
                     ForestOstard fost = new ForestOstard();
                     ConvertAnimal(bc, fost);
                     br.Consume();
                 }
                 else if (targ is WildFrenziedOstard)
                 {
                     FrenziedOstard fzost = new FrenziedOstard();
                     ConvertAnimal(bc, fzost);
                     br.Consume();
                 }
                 else if (targ is WildHiryu)
                 {
                     Hiryu hi = new Hiryu();
                     ConvertAnimal(bc, hi);
                     br.Consume();
                 }
                 else if (targ is WildLesserHiryu)
                 {
                     LesserHiryu lh = new LesserHiryu();
                     ConvertAnimal(bc, lh);
                     br.Consume();
                 }
                 else if (targ is WildNightmare)
                 {
                     Nightmare nm = new Nightmare();
                     ConvertAnimal(bc, nm);
                     br.Consume();
                 }
                 else if (targ is WildRidgeback)
                 {
                     Ridgeback rb = new Ridgeback();
                     ConvertAnimal(bc, rb);
                     br.Consume();
                 }
                 else if (targ is WildSavageRidgeback)
                 {
                     SavageRidgeback sr = new SavageRidgeback();
                     ConvertAnimal(bc, sr);
                     br.Consume();
                 }
                 else if (targ is WildSilverSteed)
                 {
                     SilverSteed ss = new SilverSteed();
                     ConvertAnimal(bc, ss);
                     br.Consume();
                 }
                 else if (targ is WildSwampDragon)
                 {
                     SwampDragon sd = new SwampDragon();
                     ConvertAnimal(bc, sd);
                     br.Consume();
                 }
                 else
                 {
                     from.SendMessage("You can't put a bridle on that.");
                 }
             }
         }
         else
         {
             from.SendMessage("That's too far away");
         }
     }
     else
     {
         from.SendMessage("You can't put a bridle on that.");
     }
 }
Example #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        if (weap.MaxHitPoints != 0)
                        {
                            int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            //from.SendLocalizedMessage( 1038285 + hp );
                            switch (hp)
                            {
                            case 0: from.SendAsciiMessage("It looks like it is about to fall apart."); break;

                            case 1: from.SendAsciiMessage("It looks rather flimsy and not at all trustworthy."); break;

                            case 2: from.SendAsciiMessage("It looks somewhat badly damaged."); break;

                            case 3: from.SendAsciiMessage("It looks rather battered."); break;

                            case 4: from.SendAsciiMessage("It looks like it has been well-used."); break;

                            case 5: from.SendAsciiMessage("It looks to have suffered some wear and tear."); break;

                            case 6: from.SendAsciiMessage("It looks to be in fairly good condition."); break;

                            case 7: from.SendAsciiMessage("It looks fairly new, with just a few nicks and scratches."); break;

                            case 8: from.SendAsciiMessage("It looks almost new."); break;

                            case 9: from.SendAsciiMessage("It looks unused."); break;
                            }
                        }

                        int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                        int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                        if (damage < 3)
                        {
                            damage = 0;
                        }
                        else
                        {
                            damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                        }

                        /*
                         * else if ( damage < 6 )
                         * damage = 1;
                         * else if ( damage < 11 )
                         * damage = 2;
                         * else if ( damage < 16 )
                         * damage = 3;
                         * else if ( damage < 21 )
                         * damage = 4;
                         * else if ( damage < 26 )
                         * damage = 5;
                         * else
                         * damage = 6;
                         * */

                        WeaponType type = weap.Type;

                        if (type == WeaponType.Ranged)
                        {
                            switch (damage)
                            {
                            case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you shot someone with it at long range."); break;

                            case 1: from.SendAsciiMessage("This weapon would do minimal damage when you shot someone with it at long range."); break;

                            case 2: from.SendAsciiMessage("This weapon would do some damage when you shot someone with it at long range."); break;

                            case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you shot someone with it at long range."); break;

                            case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you shot someone with it at long range."); break;

                            case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you shot someone with it at long range."); break;

                            case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you shot someone with it at long range."); break;
                            }
                            //from.SendLocalizedMessage(1038224 + (damage * 9));
                        }
                        else if (type == WeaponType.Piercing)
                        {
                            switch (hand)
                            {
                            case 0:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you stabbed with it at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you stabbed with it at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you stabbed with it at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you stabbed with it at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you stabbed with it at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you stabbed with it at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you stabbed with it at short range."); break;
                                }
                                break;

                            case 1:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you stabbed with it two-handed at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you stabbed with it two-handed at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you stabbed with it two-handed at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you stabbed with it two-handed at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you stabbed with it two-handed at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you stabbed with it two-handed at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you stabbed with it two-handed at short range."); break;
                                }
                                break;
                            }
                            //from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Slashing)
                        {
                            switch (hand)
                            {
                            case 0:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you slashed with it at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you slashed with it at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you slashed with it at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you slashed with it at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you slashed with it at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you slashed with it at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you slashed with it at short range."); break;
                                }
                                break;

                            case 1:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you slashed with it two-handed at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you slashed with it two-handed at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you slashed with it two-handed at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you slashed with it two-handed at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you slashed with it two-handed at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you slashed with it two-handed at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you slashed with it two-handed at short range."); break;
                                }
                                break;
                            }
                            //from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                        }
                        else if (type == WeaponType.Bashing)
                        {
                            switch (hand)
                            {
                            case 0:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you bashed with it at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you bashed with it at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you bashed with it at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you bashed with it at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you bashed with it at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you bashed with it at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you bashed with it at short range."); break;
                                }
                                break;

                            case 1:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you bashed with it two-handed at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you bashed with it two-handed at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you bashed with it two-handed at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you bashed with it two-handed at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you bashed with it two-handed at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you bashed with it two-handed at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you bashed with it two-handed at short range."); break;
                                }
                                break;
                            }
                            //from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                        }
                        else
                        {
                            switch (hand)
                            {
                            case 0:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you hit with it at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you hit with it at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you hit with it at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you hit with it at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you hit with it at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you hit with it at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you hit with it at short range."); break;
                                }
                                break;

                            case 1:
                                switch (damage)
                                {
                                case 0: from.SendAsciiMessage("This weapon might scratch your opponent slightly when you hit with it two-handed at short range."); break;

                                case 1: from.SendAsciiMessage("This weapon would do minimal damage when you hit with it two-handed at short range."); break;

                                case 2: from.SendAsciiMessage("This weapon would do some damage when you hit with it two-handed at short range."); break;

                                case 3: from.SendAsciiMessage("This weapon would probably hurt your opponent a fair amount when you hit with it two-handed at short range."); break;

                                case 4: from.SendAsciiMessage("This weapon would inflict quite a lot of damage and pain when you hit with it two-handed at short range."); break;

                                case 5: from.SendAsciiMessage("This weapon would be a superior weapon when you hit with it two-handed at short range."); break;

                                case 6: from.SendAsciiMessage("This weapon would be extraordinarily deadly when you hit with it two-handed at short range."); break;
                                }
                                break;
                            }
                            //from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                        }

                        if (weap.Poison != null && weap.PoisonCharges > 0)
                        {
                            from.SendAsciiMessage("It appears to have poison smeared on it.");                               // It appears to have poison smeared on it.
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You are not certain...");                           // You are not certain...
                    }
                }
                else if (targeted is BaseArmor)
                {
                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        if (arm.MaxHitPoints != 0)
                        {
                            int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                            if (hp < 0)
                            {
                                hp = 0;
                            }
                            else if (hp > 9)
                            {
                                hp = 9;
                            }

                            //from.SendLocalizedMessage( 1038285 + hp );
                            switch (hp)
                            {
                            case 0: from.SendAsciiMessage("It looks like it is about to fall apart."); break;

                            case 1: from.SendAsciiMessage("It looks rather flimsy and not at all trustworthy."); break;

                            case 2: from.SendAsciiMessage("It looks somewhat badly damaged."); break;

                            case 3: from.SendAsciiMessage("It looks rather battered."); break;

                            case 4: from.SendAsciiMessage("It looks like it has been well-used."); break;

                            case 5: from.SendAsciiMessage("It looks to have suffered some wear and tear."); break;

                            case 6: from.SendAsciiMessage("It looks to be in fairly good condition."); break;

                            case 7: from.SendAsciiMessage("It looks fairly new, with just a few nicks and scratches."); break;

                            case 8: from.SendAsciiMessage("It looks almost new."); break;

                            case 9: from.SendAsciiMessage("It looks unused."); break;
                            }
                        }


                        //from.SendLocalizedMessage( 1038295 + (int)Math.Ceiling( Math.Min( arm.ArmorRating, 35 ) / 5.0 ) );
                        switch ((int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0))
                        {
                        case 0: from.SendAsciiMessage("This armor offers no defense against attackers."); break;

                        case 1: from.SendAsciiMessage("This armor provides almost no protection."); break;

                        case 2: from.SendAsciiMessage("This armor provides very little protection."); break;

                        case 3: from.SendAsciiMessage("This armor offers some protection against blows."); break;

                        case 4: from.SendAsciiMessage("This armor serves as sturdy protection."); break;

                        case 5: from.SendAsciiMessage("This armor is a superior defense against attack."); break;

                        case 6: from.SendAsciiMessage("This armor offers excellent protection."); break;

                        case 7: from.SendAsciiMessage("This armor is superbly crafted to provide maximum protection."); break;
                        }

                        /*
                         * if ( arm.ArmorRating < 1 )
                         *      from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
                         * else if ( arm.ArmorRating < 6 )
                         *      from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
                         * else if ( arm.ArmorRating < 11 )
                         *      from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
                         * else if ( arm.ArmorRating < 16 )
                         *      from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
                         * else if ( arm.ArmorRating < 21 )
                         *      from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
                         * else if ( arm.ArmorRating < 26 )
                         *      from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
                         * else if ( arm.ArmorRating < 31 )
                         *      from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
                         * else
                         *      from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
                         * */
                    }
                    else
                    {
                        from.SendAsciiMessage("You are not certain...");
                        //from.SendLocalizedMessage( 500353 ); // You are not certain...
                    }
                }
                else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                {
                    SwampDragon pet = (SwampDragon)targeted;

                    if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                    {
                        int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                        if (perc < 0)
                        {
                            perc = 0;
                        }
                        else if (perc > 4)
                        {
                            perc = 4;
                        }

                        pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                    }
                    else
                    {
                        from.SendAsciiMessage("You are not certain...");
                        //from.SendLocalizedMessage( 500353 ); // You are not certain...
                    }
                }
                else
                {
                    from.SendAsciiMessage("This is neither weapon nor armor.");
                    //from.SendLocalizedMessage( 500352 ); // This is neither weapon nor armor.
                }
            }
Example #7
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (this.m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, this.m_Item);
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, this.m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendLocalizedMessage(500493); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendLocalizedMessage(500491); // You put some kindling into your backpack.
                            from.SendLocalizedMessage(500492); // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }
Example #8
0
        public static int Damage(bool directDamage, Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chao, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chao);

            switch (Utility.RandomMinMax(1, 5))
            {
            case 1: phys += chao; break;

            case 2: fire += chao; break;

            case 3: cold += chao; break;

            case 4: pois += chao; break;

            case 5: nrgy += chao; break;
            }

            chao = 0;

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = fire = cold = pois = nrgy = 0;
                phys    = 100;
            }

            if (m_ArmorPierce)
            {
                double delta = 0.6;                 // is this correct?

                resPhys -= (int)(delta * resPhys);
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            int absorbed;

            #region Damage Eater
            int dmgEater = Math.Min((int)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.DamageEater), 18);

            int physEater = dmgEater;
            int fireEater = dmgEater;
            int coldEater = dmgEater;
            int poisEater = dmgEater;
            int nrgyEater = dmgEater;

            if (!m_ArmorIgnore)
            {
                physEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticEater), dmgEater), 30);
                fireEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireEater), dmgEater), 30);
                coldEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdEater), dmgEater), 30);
                poisEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonEater), dmgEater), 30);
                nrgyEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyEater), dmgEater), 30);
            }

            absorbed  = damage * phys * (100 - resPhys) * physEater;
            absorbed += damage * fire * (100 - resFire) * fireEater;
            absorbed += damage * cold * (100 - resCold) * coldEater;
            absorbed += damage * pois * (100 - resPois) * poisEater;
            absorbed += damage * nrgy * (100 - resNrgy) * nrgyEater;

            absorbed /= 1000000;

            if (m is PlayerMobile)
            {
                ((PlayerMobile)m).EatDamage(absorbed);
            }
            #endregion

            if (!m_ArmorIgnore)
            {
                #region Resonance
                if (m.Spell is Spell && m.Spell.IsCasting)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        double chance = 0.0;

                        switch (i)
                        {
                        case 0: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticResonance) / phys; break;

                        case 1: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireResonance) / fire; break;

                        case 2: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdResonance) / cold; break;

                        case 3: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonResonance) / pois; break;

                        case 4: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyResonance) / nrgy; break;
                        }

                        if (chance > Utility.RandomDouble())
                        {
                            ((Spell)m.Spell).Resonates = true;
                            break;
                        }
                    }
                }
                #endregion
            }

            #region Dragon Barding
            if ((from == null || !from.IsPlayer) && m.IsPlayer && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = m.GetMagicalAttribute(MagicalAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        int rpd_damage = Scale((damage * phys * (100 - from.PhysicalResistance)) / 10000, reflectPhys);
                        if (m is PlayerMobile && from is PlayerMobile && directDamage)
                        {
                            rpd_damage = Math.Min(rpd_damage, 35);
                        }
                        from.Damage(rpd_damage, m);
                    }
                }
            }

            if (from is BaseCreature)
            {
                Mobile master = ((BaseCreature)from).ControlMaster;

                if (master != null)
                {
                    master.RevealingAction();
                }

                #region Talismans
                BaseTalisman talis = BaseTalisman.GetTalisman(m);

                if (talis != null && talis.ProtectionTalis != NPC_Name.None && talis.ProtectionValue > 0)
                {
                    if (ProtectionKillerEntry.IsProtectionKiller(talis.ProtectionTalis, from))
                    {
                        totalDamage = totalDamage - ((totalDamage * talis.ProtectionValue) / 100);
                    }
                }
                #endregion
            }

            if (from != null)
            {
                Item cloak     = from.FindItemOnLayer(Layer.Cloak);
                Item twohanded = from.FindItemOnLayer(Layer.TwoHanded);

                if (directDamage && cloak is BaseQuiver && twohanded is BaseRanged)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;
                    totalDamage += (int)(totalDamage * quiver.DamageModifier * 0.01);
                }
            }

            if (m is PlayerMobile && from is PlayerMobile && directDamage)
            {
                totalDamage = Math.Min(totalDamage, 35);
            }

            /* TODO: El efecto del Attunement debería ir despues de aplicar el Blood Oath.
             * Según parece, en OSI los Necro-Arcanists lo usan mucho en PvP, de manera que
             * el daño recibido se refleja al atacante por Blood Oath, pero luego es
             * absorbido por el Attunement en el defensor.
             */
            if (directDamage)
            {
                Spells.Spellweaving.AttunementSpell.TryAbsorb(m, ref totalDamage);
            }

            if (from != null)
            {
                SpellHelper.DoLeech(totalDamage, from, m);
            }

            m.Damage(totalDamage, from);

            return(totalDamage);
        }
Example #9
0
        public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive, int armorIgnore)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
                return 0;


            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
                Mobiles.MeerMage.StopEffect(m, true);

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return damage;
            }
            bool Stalker = false;
            TeiravonMobile TavMobile;
            double var = 1;
            if (from != null && from is TeiravonMobile)
            {
                TavMobile = from as TeiravonMobile;
                var = .9 - (TavMobile.PlayerLevel * .01);
                if (TavMobile.HasFeat(TeiravonMobile.Feats.StalkingPrey))
                    Stalker = true;
            }

            if (from != null && Spells.Third.BlessSpell.narindun.Contains(from))
            {
                if (Utility.Random(1000) == 1000)
                {
                    Revenant rev = new Revenant(from, m, TimeSpan.FromSeconds(15));

                    if (BaseCreature.Summon(rev, false, from, m.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0)))
                        rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist);
                }
            }

            if (from !=null && Spells.Third.BlessSpell.narindun.Contains(m))
            {
                if (Utility.Random(1000) == 1000)
                {
                    Revenant rev = new Revenant(m, from, TimeSpan.FromSeconds(15));

                    if (BaseCreature.Summon(rev, false, m, from.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0)))
                        rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist);
                }
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (Spells.Third.BlessSpell.saerin.Contains(m))
                resPhys = 95;

            if (armorIgnore > 0 )
            {
                double f = (100 - armorIgnore) / 100.0;
                resPhys =(int)(resPhys * f);
                resFire = (int)(resFire * f);
                resCold = (int)(resCold * f);
                resPois = (int)(resPois * f);
                resNrgy = (int)(resNrgy * f);
            }
            if (from != null && IsTracking(from, m) && Stalker)
            {
                resPhys = (int)(resPhys * var);
                resFire = (int)(resFire * var);
                resCold = (int)(resCold * var);
                resPois = (int)(resPois * var);
                resNrgy = (int)(resNrgy * var);
            }

            if (m_ArmorIgnore)
                resPhys = resFire = resCold = resPois = resNrgy = 0;

            if (Spells.Third.BlessSpell.saerin.Contains(m) && resPhys < 50)
                resPhys = 50;

            int totalDamage;



            totalDamage = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
                totalDamage = 1;

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
                totalDamage = m.Hits;

            if (from != null)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - resPhys)) / 10000, reflectPhys), m);
                    }
                }
            }

            if (from != null && Spells.Third.BlessSpell.valar.Contains(m))
            {
                ArrayList TargList = new ArrayList();

                foreach (Mobile x in m.GetMobilesInRange(2))
                {
                    if (x != m && x.AccessLevel <= m.AccessLevel && !x.Blessed)
                        TargList.Add(x);

                }

                if (TargList.Count > 0)
                {
                    m.FixedParticles(0x376A, 9, 32, 5005, 2634, 2, EffectLayer.Waist);
                    totalDamage = totalDamage / TargList.Count;
                    for (int i = 0; i < TargList.Count; ++i)
                    {
                        Mobile dude = TargList[i] as Mobile;
                        dude.Damage(totalDamage, from);
                    }
                }
            }

            if (m is TeiravonMobile)
            {
                TeiravonMobile tav = m as TeiravonMobile;
                if (((tav.IsOrc() && tav.HasFeat(TeiravonMobile.Feats.Tuffness) || tav.HasFeat(TeiravonMobile.Feats.PhysicalResistance)) && from != null && from != tav))
                {
                    double reduce = (((double)(100 - Utility.RandomMinMax(0, 5)) - (double)(tav.PlayerLevel / 1.75)) / (double)100);

                    int temp = totalDamage;

                    totalDamage = (int)((double)totalDamage * (double)reduce);

                    if (temp - totalDamage < 1)
                        totalDamage -= 1;

                    if (totalDamage < 0)
                        totalDamage = 0;

                    if (Utility.RandomMinMax(1, 20) > 19)
                    {
                        totalDamage = 0;
                        tav.SendMessage("Your tough skin deflects the attack!");
                        from.SendMessage("{0} deflects the attack!", tav.Name);
                    }

                }
            }

            if (Spells.Third.BlessSpell.kamalini.Contains(m) && (((DateTime)Spells.Third.BlessSpell.kamalini[m] + TimeSpan.FromSeconds(3)).CompareTo(DateTime.Now)) < 0)
            {
                IPooledEnumerable eable = m.GetMobilesInRange(2);
                ArrayList targets = new ArrayList();
                int total = 0;
                foreach (Mobile t in eable)
                {
                    if (t.AccessLevel > m.AccessLevel || t.Blessed || t == m)
                        continue;
                    targets.Add(t);
                }
                eable.Free();

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile x = (Mobile)targets[i];
                    total += (int)(x.Hits * .03);
                }
                if (total > 2)
                {
                    m.Heal(Utility.RandomMinMax((int)(total * .75), total));
                    m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
                    m.PlaySound(0x1F2);
                    Spells.Third.BlessSpell.kamalini[m] = DateTime.Now;
                }
            }
            m.Damage(totalDamage, from);
            return totalDamage;
        }
Example #10
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                if (targeted is Item)
                {
                    Item item = targeted as Item;

                    if (item.IsLockedDown || (item.RootParent is Container && (!item.Movable || !((Container)item.RootParent).LiftOverride)))
                    {
                        from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                        return;
                    }
                }

                if (((ICarvable)targeted).Carve(from, m_Item) && Siege.SiegeShard)
                {
                    Siege.CheckUsesRemaining(from, m_Item);
                }
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;

                    if (Siege.SiegeShard && m_Item is IUsesRemaining)
                    {
                        Siege.CheckUsesRemaining(from, m_Item);
                    }
                }
            }
            else
            {
                if (targeted is Mobile)
                {
                    ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500450, from.NetState); // You can only skin dead creatures.
                    return;
                }
                else if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16) // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem.
                                    obj.Complete();

                                    if (Siege.SiegeShard && m_Item is IUsesRemaining)
                                    {
                                        Siege.CheckUsesRemaining(from, m_Item);
                                    }

                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendMessage("Voce nao pode cortar nada ali"); // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendMessage("Voce nao pode cortar nada ali"); // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendMessage("Nao tem madeira suficiente aqui"); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendMessage("Voce colocou alguns galhos secos em sua mochila"); // You put some kindling into your backpack.
                        }
                        else
                        {
                            from.SendMessage("Nao cabe mais em sua mochila");  // You can't place any kindling into your backpack!

                            item.Delete();
                        }

                        if (Siege.SiegeShard && m_Item is IUsesRemaining)
                        {
                            Siege.CheckUsesRemaining(from, m_Item);
                        }
                    }
                }
            }
        }
Example #11
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is Container)
            {
                Container body = (Container)targeted;

                if (body.ItemID >= 0x4B5A && body.ItemID <= 0x4BAB)
                {
                    body.ItemID = Utility.RandomList(0xECA, 0xECB, 0xECC, 0xECD, 0xECE, 0xECF, 0xED0, 0xED1, 0xED2);
                    body.Hue    = 0;

                    from.CriminalAction(true);
                    Misc.Titles.AwardKarma(from, -50, true);

                    body.DropItem(new BodyPart(0x1D9F));
                    body.DropItem(new BodyPart(0x1DA4));
                    body.DropItem(new BodyPart(0x1DA2));
                    body.DropItem(new BodyPart(0x1DA3));
                    body.DropItem(new BodyPart(0x1DA1));
                    body.DropItem(new BodyPart(0x1DA0));

                    from.SendMessage("You hack up the body into bloody pieces.");
                }
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                       // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendMessage("There is not enough here to harvest.");
                        //from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        if (tileID == 0x4D96 || tileID == 0x4D9A)                           // apples
                        {
                            Item item = new Apple();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put an apple into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any apples into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4DA6 || tileID == 0x4DAA)                           // pears
                        {
                            Item item = new Pear();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a pear into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any pears into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4D9E || tileID == 0x4DA2)                           // peaches
                        {
                            Item item = new Peach();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a peach into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any peaches into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4CDA || tileID == 0x4CDB || tileID == 0x4CDC || tileID == 0x4CDD || tileID == 0x4CDE || tileID == 0x4CDF)                           // acorns
                        {
                            Item item = new Acorn();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put an acorn into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any acorns into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4CA8 || tileID == 0x4CAA || tileID == 0x4CAB)                           // bananas
                        {
                            Item item = new Banana();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a banana into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any bananas into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4C95)                           // coconut
                        {
                            Item item = new Coconut();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a coconut into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any coconuts into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4C96)                           // dates
                        {
                            Item item = new Dates();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put some dates into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any dates into your backpack!");
                                item.Delete();
                            }
                        }
                        else
                        {
                            Item item = new Kindling();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendLocalizedMessage(500491);                                   // You put some kindling into your backpack.
                                from.SendLocalizedMessage(500492);                                   // An axe would probably get you more wood.
                            }
                            else
                            {
                                from.SendLocalizedMessage(500490);                                   // You can't place any kindling into your backpack!

                                item.Delete();
                            }
                        }
                    }
                }
            }
        }
Example #12
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                       // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else if (targeted is Head)
            {
                Head targ = (Head)targeted;

                if (from.Karma > -1500)
                {
                    from.SendMessage("Vous n'avez pas le profil d'un dépeceur de crâne...");
                    return;
                }

                if (from.Dex <= Utility.Random(110))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté le dépeçage");
                    targ.Delete();
                    return;
                }

                from.SendMessage("Vous achevez d'enlever la chair du crâne.");
                from.AddToBackpack(new Skull());
                targ.Consume();
            }
            else if (targeted is Pumpkin)
            {
                Pumpkin targ = (Pumpkin)targeted;

                if (from.Dex <= Utility.Random(100))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté votre tracé");
                    targ.Consume();
                    return;
                }

                int karma = 0;

                if (from.Karma > 100)
                {
                    karma++;
                }
                else if (from.Karma < -100)
                {
                    karma--;
                }

                int chance = Utility.Random(4) + karma;

                if (chance >= 2)
                {
                    from.AddToBackpack(new SmileyPumpkin());
                }
                else
                {
                    from.AddToBackpack(new EvilPumpkin());
                }

                from.SendMessage("Vous taillez la citrouille selon votre humeur");
                targ.Consume();
            }
            else
            {
                if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16)                       // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036);                                       // You slice a red cap mushroom from its stem.
                                    obj.Complete();
                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendLocalizedMessage(500493);                           // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        if (map.Season == (int)ServerSeasons.Season.Spring && Utility.RandomDouble() < 0.33)
                        {
                            from.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "De la sève se met à couler du tronc, souhaitez-vous la recueillir?", from.NetState);
                            from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnSelectTarget));
                            return;
                        }

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendLocalizedMessage(500491);                               // You put some kindling into your backpack.
                            from.SendLocalizedMessage(500492);                               // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage(500490);                               // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }
Example #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item examine = (Item)targeted;

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    if (targeted is UnidentifiedItem)
                    {
                        UnidentifiedItem relic = (UnidentifiedItem)targeted;

                        if (relic.IDAttempt > 5)
                        {
                            from.SendMessage("Only a vendor can identify this item now as too many attempts were made.");
                        }
                        else if (relic.SkillRequired != "ArmsLore")
                        {
                            from.SendMessage("You are using the wrong skill to figure this out.");
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, -5, 120))
                        {
                            Container   pack  = (Container)relic;
                            List <Item> items = new List <Item>();
                            foreach (Item item in pack.Items)
                            {
                                items.Add(item);
                            }
                            foreach (Item item in items)
                            {
                                from.AddToBackpack(item);
                            }

                            from.SendMessage("You successfully identify the item.");
                            relic.Delete();
                        }
                        else
                        {
                            relic.IDAttempt = relic.IDAttempt + 1;
                            from.SendMessage("You can't seem to identify this item.");
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (Server.Misc.RelicItems.IsRelicItem(examine) == true)
                    {
                        from.SendMessage(Server.Misc.RelicItems.IdentifyRelicValue(from, from, examine));
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is BaseWeapon)
                    {
                        if (((BaseWeapon)targeted).Identified == true)
                        {
                            BaseWeapon weap = (BaseWeapon)targeted;

                            if (weap.MaxHitPoints != 0)
                            {
                                int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                            int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                            if (damage < 3)
                            {
                                damage = 0;
                            }
                            else
                            {
                                damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                            }

                            WeaponType type = weap.Type;

                            if (type == WeaponType.Ranged)
                            {
                                from.SendLocalizedMessage(1038224 + (damage * 9));
                            }
                            else if (type == WeaponType.Piercing)
                            {
                                from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Slashing)
                            {
                                from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Bashing)
                            {
                                from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                            }
                            else
                            {
                                from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                            }

                            if (weap.Poison != null && weap.PoisonCharges > 0)
                            {
                                from.SendLocalizedMessage(1038284);                                   // It appears to have poison smeared on it.
                            }
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            ((BaseWeapon)targeted).Identified = true;
                            BaseWeapon weap = (BaseWeapon)targeted;

                            if (weap.MaxHitPoints != 0)
                            {
                                int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                            int hand   = (weap.Layer == Layer.OneHanded ? 0 : 1);

                            if (damage < 3)
                            {
                                damage = 0;
                            }
                            else
                            {
                                damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
                            }

                            WeaponType type = weap.Type;

                            if (type == WeaponType.Ranged)
                            {
                                from.SendLocalizedMessage(1038224 + (damage * 9));
                            }
                            else if (type == WeaponType.Piercing)
                            {
                                from.SendLocalizedMessage(1038218 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Slashing)
                            {
                                from.SendLocalizedMessage(1038220 + hand + (damage * 9));
                            }
                            else if (type == WeaponType.Bashing)
                            {
                                from.SendLocalizedMessage(1038222 + hand + (damage * 9));
                            }
                            else
                            {
                                from.SendLocalizedMessage(1038216 + hand + (damage * 9));
                            }

                            if (weap.Poison != null && weap.PoisonCharges > 0)
                            {
                                from.SendLocalizedMessage(1038284);                                   // It appears to have poison smeared on it.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is BaseArmor)
                    {
                        if (((BaseArmor)targeted).Identified == true)
                        {
                            BaseArmor arm = (BaseArmor)targeted;

                            if (arm.MaxHitPoints != 0)
                            {
                                int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }
                        }
                        else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            ((BaseArmor)targeted).Identified = true;
                            BaseArmor arm = (BaseArmor)targeted;

                            if (arm.MaxHitPoints != 0)
                            {
                                int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                                if (hp < 0)
                                {
                                    hp = 0;
                                }
                                else if (hp > 9)
                                {
                                    hp = 9;
                                }

                                from.SendLocalizedMessage(1038285 + hp);
                            }

                            from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));

                            /*
                             * if ( arm.ArmorRating < 1 )
                             *      from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
                             * else if ( arm.ArmorRating < 6 )
                             *      from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
                             * else if ( arm.ArmorRating < 11 )
                             *      from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
                             * else if ( arm.ArmorRating < 16 )
                             *      from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
                             * else if ( arm.ArmorRating < 21 )
                             *      from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
                             * else if ( arm.ArmorRating < 26 )
                             *      from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
                             * else if ( arm.ArmorRating < 31 )
                             *      from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
                             * else
                             *      from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
                             * */
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
                    {
                        SwampDragon pet = (SwampDragon)targeted;

                        if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100))
                        {
                            int perc = (4 * pet.BardingHP) / pet.BardingMaxHP;

                            if (perc < 0)
                            {
                                perc = 0;
                            }
                            else if (perc > 4)
                            {
                                perc = 4;
                            }

                            pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState);
                        }
                        else
                        {
                            from.SendLocalizedMessage(500353);                               // You are not certain...
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    else
                    {
                        from.SendLocalizedMessage(500352);                           // This is neither weapon nor armor.
                    }
                }
            }
Example #14
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0: phys += chaos; break;

                case 1: fire += chaos; break;

                case 2: cold += chaos; break;

                case 3: pois += chaos; break;

                case 4: nrgy += chaos; break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage = 0;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35);                         // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70);                         // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance))) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Example #15
0
        public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = 0;
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - resPhys)) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Example #16
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else if (targeted is StaticTarget)
            {
                int itemID = ((StaticTarget)targeted).ItemID;

                if (itemID == 0xD15 || itemID == 0xD16) // red mushroom
                {
                    PlayerMobile player = from as PlayerMobile;

                    if (player != null)
                    {
                        QuestSystem qs = player.Quest;

                        if (qs is WitchApprenticeQuest)
                        {
                            FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                            if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                            {
                                player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem.
                                obj.Complete();
                            }
                        }
                    }
                }

                else
                {
                    HarvestSystem     system = Lumberjacking.System;
                    HarvestDefinition def    = Lumberjacking.System.Definition;

                    int     tileID;
                    Map     map;
                    Point3D loc;

                    if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                    {
                        from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                    }
                    else if (!def.Validate(tileID))
                    {
                        from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                    }
                    else
                    {
                        HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                        if (bank == null)
                        {
                            return;
                        }

                        if (bank.Current < 5)
                        {
                            from.SendLocalizedMessage(500493); // There's not enough wood here to harvest.
                        }
                        else
                        {
                            bank.Consume(def, 5);

                            Item item = new Kindling();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendLocalizedMessage(500491); // You put some kindling into your backpack.
                                from.SendLocalizedMessage(500492); // An axe would probably get you more wood.
                            }
                            else
                            {
                                from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack!

                                item.Delete();
                            }
                        }
                    }
                }
            }
        }
Example #17
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                     // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16)                     // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036);                                     // You slice a red cap mushroom from its stem.
                                    obj.Complete();
                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;


                if (!system.GetHarvestDetails(from, m_Item, targeted, out int tileID, out Map map, out Point3D loc))
                {
                    from.SendLocalizedMessage(500494);                     // You can't use a bladed item on that!
                }