Ejemplo n.º 1
0
        public override void OnMiss(Mobile attacker, Mobile defender)
        {
            double arrowChance = 0.4;

            if (!ArenaFight.AllowFreeConsume(attacker, typeof(Arrow)))
            {
                if (attacker.Player && arrowChance >= Utility.RandomDouble())
                {
                    Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map);
                }
            }

            base.OnMiss(attacker, defender);
        }
Ejemplo n.º 2
0
        public static bool PlayDrinkEffect(Mobile mobile)
        {
            mobile.RevealingAction();
            mobile.PlaySound(0x2D6);

            bool freeConsume = false;
            bool dropBottle  = true;

            PlayerMobile player = mobile as PlayerMobile;

            if (ArenaFight.AllowFreeConsume(player, typeof(BasePotion)))
            {
                freeConsume = true;
                dropBottle  = false;
            }

            //Water Aspect
            AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(mobile);

            if (aspectArmorProfile != null)
            {
                if (aspectArmorProfile.m_Aspect == AspectEnum.Water)
                {
                    double waterAspectChance = AspectGear.WaterChanceForPotionNoConsume * (AspectGear.WaterChanceForPotionNoConsumePerTier * (double)aspectArmorProfile.m_TierLevel);

                    if (Utility.RandomDouble() <= waterAspectChance)
                    {
                        freeConsume = true;
                        dropBottle  = false;

                        //TEST: Add Aspect Visual
                    }
                }
            }

            if (dropBottle)
            {
                mobile.AddToBackpack(new Bottle());
            }

            if (mobile.Body.IsHuman /*&& !m.Mounted*/)
            {
                mobile.Animate(34, 5, 1, true, false, 0);
            }

            return(freeConsume);
        }
Ejemplo n.º 3
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            double arrowChance = 0.4;

            if (!ArenaFight.AllowFreeConsume(attacker, typeof(Arrow)))
            {
                if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && arrowChance >= Utility.RandomDouble())
                {
                    defender.AddToBackpack(Ammo);
                }
            }

            base.OnHit(attacker, defender, damageBonus);

            if (!(attacker is PlayerMobile && defender is PlayerMobile))
            {
                AttemptWeaponPoison(attacker, defender);
            }
        }
Ejemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bandage.Deleted)
                {
                    return;
                }

                if (targeted is Mobile)
                {
                    Mobile target = targeted as Mobile;

                    if (target.Hidden)
                    {
                        from.SendMessage("That cannot be seen.");
                        return;
                    }

                    else if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range))
                    {
                        PlayerMobile playerTarget = targeted as PlayerMobile;

                        if (BandageContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            if (!ArenaFight.AllowFreeConsume(from, typeof(Bandage)))
                            {
                                m_Bandage.Consume();
                            }
                        }
                    }

                    else
                    {
                        from.SendLocalizedMessage(500295); // You are too far away to do that.
                    }
                }

                else
                {
                    from.SendLocalizedMessage(500970); // Bandages can not be used on that.
                }
            }
Ejemplo n.º 5
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            Container pack = attacker.Backpack;

            if (attacker.Player)
            {
                if (!ArenaFight.AllowFreeConsume(attacker, typeof(Arrow)))
                {
                    if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                    {
                        attacker.StealthAttackActive = false;
                        attacker.StealthAttackReady  = false;

                        return(false);
                    }
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            // 12/8/13 Xiani - Nullifying an explosion when in an ArenaRegion.

            //TEST: CHECK THIS
            if (from.CombatProhibited)
            {
                return;
            }

            //TEST: CHECK THIS
            if (!ArenaFight.AllowFreeConsume(from, typeof(BasePotion)))
            {
                Consume();
            }

            for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
            {
                Mobile      m    = (Mobile)m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                {
                    Target.Cancel(m);
                }
            }

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

            IPooledEnumerable eable     = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange(loc, ExplosionRange) : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
            ArrayList         toExplode = new ArrayList();

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }

                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableContainer)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableStatic)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            int baseDamage = Utility.RandomMinMax(min, max);

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o       = toExplode[i];
                double divisor = 0;

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }

                        int damage = baseDamage;

                        damage += alchemyBonus;

                        if (m is PlayerMobile)
                        {
                            if (m.InRange(loc, 0))
                            {
                                divisor = 1;
                            }
                            else if (m.InRange(loc, 1))
                            {
                                divisor = 2;
                            }
                            else if (m.InRange(loc, 2))
                            {
                                divisor = 4;
                            }

                            damage = (int)(damage / divisor);

                            if (damage > 40)
                            {
                                damage = 40;
                            }
                        }

                        else
                        {
                            damage = (int)((double)damage * CreatureDamageScalar);
                        }

                        AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                    }
                }

                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }

                else if (o is BreakableContainer)
                {
                    BreakableContainer breakableContainer = (BreakableContainer)o;

                    if (breakableContainer.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableContainer.ObjectBreakingDeviceDamageScalar);

                    breakableContainer.ReceiveDamage(from, baseDamage, BreakableContainer.InteractionType.ObjectBreakingDevice);
                }

                else if (o is BreakableStatic)
                {
                    BreakableStatic breakableStatic = (BreakableStatic)o;

                    if (breakableStatic.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableStatic.ObjectBreakingDeviceDamageScalar);

                    breakableStatic.ReceiveDamage(from, baseDamage, BreakableStatic.InteractionType.ObjectBreakingDevice);
                }
            }
        }