Exemplo n.º 1
0
        public bool DoAgility(Mobile from)
        {
            //Plume : Addiction
            if (from is PlayerMobile)
            {
                PlayerMobile drinker = from as PlayerMobile;

                double CurrentAddiction = drinker.CalculateAgilityAddiction(this)[0];
                double GlobalAddiction  = drinker.CalculateAgilityAddiction(this)[1];
                int    DexScalar        = (int)Math.Floor(Math.Sqrt(CurrentAddiction));
                double DurationScalar   = GlobalAddiction * 0.95;

                if (GlobalAddiction > 100)
                {
                    drinker.SendMessage("Votre corps ne supporte plus ce traitement");
                    drinker.Dex--;
                    this.Consume();
                    return(false);
                }

                if (Spells.SpellHelper.AddStatOffset(from, StatType.Dex, Scale(from, DexOffset - Math.Min(DexOffset, DexScalar)), Duration - TimeSpan.FromSeconds(DurationScalar)))
                {
                    from.FixedEffect(0x375A, 10, 15);
                    from.PlaySound(0x1E7);
                    return(true);
                }
                drinker.IncAddiction(this);
            }

            if (Spells.SpellHelper.AddStatOffset(from, StatType.Dex, Scale(from, DexOffset), Duration))
            {
                from.FixedEffect(0x375A, 10, 15);
                from.PlaySound(0x1E7);
                return(true);
            }

            from.SendLocalizedMessage(502173);               // You are already under a similar effect.
            return(false);
        }