Ejemplo n.º 1
0
        public override void AlterMeleeDamageFrom(Mobile from, ref int damage)
        {
            int discordanceEffect = 0;

            if (from is PlayerMobile && Discordance.GetEffect(this, ref discordanceEffect))
            {
                var weapon = from.FindItemOnLayer(Layer.FirstValid) as BaseWeapon;

                if (weapon == null)
                {
                    weapon = from.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
                }

                if (weapon != null && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal)
                {
                    damage /= 2;
                }
                else //Wooden Weapons = garbage?
                {
                    damage = 0;
                }
            }
            else
            {
                damage = 0;
            }
        }
Ejemplo n.º 2
0
 public bool IsDiscordable(Mobile m)
 {
     return(IsTargeteable(m) && !Discordance.IsDiscorded(m) && m.InRange(this, BaseInstrument.GetBardRange(this, SkillName.Discordance)));
 }
Ejemplo n.º 3
0
        private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */
        {
            var defWeapon = defender.Weapon as BaseWeapon;

            var atkSkill = defender.Skills.Ninjitsu;
            // Skill defSkill = defender.Skills[defWeapon.Skill];

            var atSkillValue  = attacker.Skills.Ninjitsu.Value;
            var defSkillValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0;

            if (defSkillValue <= -20.0)
            {
                defSkillValue = -19.9;
            }

            double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);

            if (DivineFurySpell.UnderEffect(attacker))
            {
                attackValue += 10;
            }

            if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) ||
                AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune)))
            {
                attackValue += 20;
            }

            if (HitLower.IsUnderAttackEffect(attacker))
            {
                attackValue -= 25;
            }

            if (attackValue > 45)
            {
                attackValue = 45;
            }

            attackValue = (atSkillValue + 20.0) * (100 + attackValue);

            double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance);

            if (DivineFurySpell.UnderEffect(defender))
            {
                defenseValue -= 20;
            }

            if (HitLower.IsUnderDefenseEffect(defender))
            {
                defenseValue -= 25;
            }

            var refBonus = 0;

            if (Block.GetBonus(defender, ref refBonus))
            {
                defenseValue += refBonus;
            }

            if (Discordance.GetEffect(attacker, ref refBonus))
            {
                defenseValue -= refBonus;
            }

            if (defenseValue > 45)
            {
                defenseValue = 45;
            }

            defenseValue = (defSkillValue + 20.0) * (100 + defenseValue);

            var chance = attackValue / (defenseValue * 2.0);

            if (chance < 0.02)
            {
                chance = 0.02;
            }

            return(attacker.CheckSkill(atkSkill.SkillName, chance));
        }
Ejemplo n.º 4
0
/*
 *              public override void AlterSpellDamageFrom( Mobile from, ref int damage )
 *              {
 *                      damage = 0;
 *              }
 */
/*
 *              public override void AlterAbilityDamageFrom( Mobile from, ref int damage )
 *              {
 *                      AlterMeleeDamageFrom( from, ref damage );
 *              }
 */

        public override void OnGotMeleeAttack(Mobile attacker)
        {
            FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
            PlaySound(0x2F4);

            int discordanceEffect = 0;

            if (attacker is PlayerMobile && Discordance.GetEffect(this, ref discordanceEffect))
            {
                attacker.SendAsciiMessage("The creature's magnetic field is weak.");
            }
            else if (attacker != null)
            {
                attacker.SendAsciiMessage("The creature's magnetic field repels your attack.");

                if (attacker.AccessLevel == AccessLevel.Player && attacker.InRange(Location, 2) &&
                    0.15 > Utility.RandomDouble())
                {
                    var items = new List <Item>();

                    for (int i = 0; i < attacker.Items.Count; i++)
                    {
                        Item item = attacker.Items[i];

                        if (item.Movable && item.LootType != LootType.Blessed && item.LootType != LootType.Newbied &&
                            item.BlessedFor == null)
                        {
                            var resource = CraftResource.None;

                            if (item is BaseWeapon)
                            {
                                resource = ((BaseWeapon)item).Resource;
                            }
                            else if (item is BaseArmor)
                            {
                                resource = ((BaseArmor)item).Resource;
                            }
                            else if (item is BaseJewel)
                            {
                                resource = CraftResource.Iron;
                            }
                            else if (item is BaseClothing)
                            {
                                resource = ((BaseClothing)item).Resource;
                            }
                            else
                            {
                                continue;
                            }

                            if (CraftResources.GetType(resource) == CraftResourceType.Metal)
                            {
                                items.Add(item);
                            }
                        }
                    }

                    if (items.Count > 0)
                    {
                        Item todrop = items[Utility.Random(items.Count)];

                        if (todrop is IDurability)
                        {
                            var dura = (IDurability)todrop;
                            if (dura.MaxHitPoints > 0) //It is not invulnerable
                            {
                                int maxpts = dura.MaxHitPoints / 10;
                                int points = Math.Min(maxpts, dura.HitPoints);

                                dura.HitPoints -= points;
                                if (dura.HitPoints == 0)
                                {
                                    dura.MaxHitPoints -= maxpts - points;
                                }

                                if (dura.MaxHitPoints <= 0)
                                {
                                    attacker.SendMessage("The creature's magnetic field destroyed your {0}.",
                                                         todrop.GetDisplayName(attacker.NetState, false));
                                    todrop.Delete();
                                }
                                else
                                {
                                    attacker.SendMessage(
                                        "The creature's magnetic field attracted your {0}, and damaged it in the process.",
                                        todrop.GetDisplayName(attacker.NetState, false));
                                    todrop.MoveToWorld(Location, Map);
                                }
                            }
                        }
                        else
                        {
                            attacker.SendMessage("The creature's magnetic field attracted your {0}.",
                                                 todrop.GetDisplayName(attacker.NetState, false));
                            todrop.MoveToWorld(Location, Map);
                        }

                        FixedParticles(0, 10, 0, 0x2530, EffectLayer.Waist);
                    }
                }
            }

            base.OnGotMeleeAttack(attacker);
        }