Scale() public static méthode

public static Scale ( Server.Mobile m, System.TimeSpan v ) : System.TimeSpan
m Server.Mobile
v System.TimeSpan
Résultat System.TimeSpan
        protected void ComputeDamage(Mobile from, out int damageMin, out int damageMax)
        {
            double alchemy = from.Skills[SkillName.Alchemy].Value;

            damageMin = (int)BasePotion.Scale(from, MinBaseDamage + alchemy / 11.0);
            damageMax = (int)BasePotion.Scale(from, MaxBaseDamage + alchemy / 13.0);
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendLocalizedMessage(502138);                   // That is too far away for you to use
                return;
            }
            else if (from != m_Caster)
            {
                // from.SendLocalizedMessage( ); //
                return;
            }

            BaseWeapon weapon = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;

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

            if (weapon != null)
            {
                from.SendLocalizedMessage(1080116);                   // You must have a free hand to use a Healing Stone.
            }
            else if (from.BeginAction(typeof(BaseHealPotion)))
            {
                from.Heal(Utility.RandomMinMax(BasePotion.Scale(from, 13), BasePotion.Scale(from, 16)));
                this.Consume();
                Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(ReleaseHealLock), from);
            }
            else
            {
                from.SendLocalizedMessage(1095172);                   // You must wait a few seconds before using another Healing Stone.
            }
        }
Exemple #3
0
        public virtual TimeSpan ComputeDuration(Mobile from)
        {
            double alchemy = from.Skills[SkillName.Alchemy].Value;
            double seconds = BasePotion.Scale(from, 20 + (alchemy / 10));

            return(TimeSpan.FromSeconds(seconds));
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendLocalizedMessage(502138); // That is too far away for you to use
                return;
            }
            else if (from != this.m_Caster)
            {
                // from.SendLocalizedMessage( ); //
                return;
            }

            BaseWeapon weapon = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;

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

            if (weapon != null)
            {
                from.SendLocalizedMessage(1080116); // You must have a free hand to use a Healing Stone.
            }
            else if (from.Hits >= from.HitsMax)
            {
                from.SendMessage("You are at full health,");
            }

            else if (from.BeginAction(typeof(BaseHealPotion)))
            {
                int healamount = Utility.RandomMinMax(BasePotion.Scale(from, 25), BasePotion.Scale(from, 35));

                if (healamount > m_Amount)
                {
                    healamount = m_Amount;
                }

                from.Heal(healamount);

                m_Amount -= healamount;

                if (m_Amount <= 0)
                {
                    this.Consume();
                }

                this.InvalidateProperties();

                Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(ReleaseHealLock), from);
            }
            else
            {
                from.SendLocalizedMessage(1095172); // You must wait a few seconds before using another Healing Stone.
            }
        }
Exemple #5
0
        public override void OnDoubleClick(Mobile from)
        {
            Faction faction = Faction.Find(from);

            if (!IsChildOf(from.Backpack))
            {
                // That is not in your backpack.
                from.SendLocalizedMessage(1042593);
            }
            else if (faction == null)
            {
                // You may not use this unless you are a faction member!
                from.SendLocalizedMessage(1010376, null, 0x25);
            }
            else if (m_CooldownTable.ContainsKey(from))
            {
                Timer cooldownTimer = m_CooldownTable[from];

                // You must wait ~1_seconds~ seconds before you can use this item.
                from.SendLocalizedMessage(1079263, (cooldownTimer.Next - DateTime.Now).Seconds.ToString());
            }
            else
            {
                for (int x = -5; x <= 5; x++)
                {
                    for (int y = -5; y <= 5; y++)
                    {
                        Point3D p    = new Point3D(from.Location.X + x, from.Location.Y + y, from.Location.Z);
                        int     dist = (int)Utility.GetDistanceToSqrt(from.Location, p);

                        if (dist <= 5)
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(0.2 * dist), new TimerCallback(
                                                delegate
                            {
                                Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.FixedXYZ, Serial.Zero, Serial.Zero, 0x3709, p, p, 20, 30, true, false, 1502, 4));
                            }
                                                ));
                        }
                    }
                }

                double alchemy = from.Skills[SkillName.Alchemy].Value;

                int damage = (int)BasePotion.Scale(from, 19 + alchemy / 5);

                foreach (Mobile to in from.GetMobilesInRange(5).ToArray())
                {
                    int distance = (int)from.GetDistanceToSqrt(to);

                    if (to != from && distance <= 5 && from.CanSee(to) && from.InLOS(to) && SpellHelper.ValidIndirectTarget(from, to) && from.CanBeHarmful(to) && !to.Hidden)
                    {
                        AOS.Damage(to, from, damage - distance, 0, 100, 0, 0, 0);
                    }
                }

                Consume();

                m_CooldownTable[from] = Timer.DelayCall(Cooldown, new TimerCallback(delegate { m_CooldownTable.Remove(from); }));
            }
        }