コード例 #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_PrimaryEffect   = (CustomAlchemy.EffectType)reader.ReadInt();
                m_SecondaryEffect = (CustomAlchemy.EffectType)reader.ReadInt();
                m_PositiveEffect  = reader.ReadBool();
                m_EffectPotency   = (CustomAlchemy.EffectPotencyType)reader.ReadInt();

                m_Identified = reader.ReadBool();
            }
        }
コード例 #2
0
        public static string GetPotionName(CustomAlchemy.EffectType primaryEffect, CustomAlchemy.EffectType secondaryEffect, bool positiveEffect, CustomAlchemy.EffectPotencyType effectArea)
        {
            string potionName = "";

            switch (effectArea)
            {
            case EffectPotencyType.SmallAoE: potionName += "Improved "; break;

            case EffectPotencyType.MediumAoE: potionName += "Greater "; break;

            case EffectPotencyType.LargeAoE: potionName += "Epic "; break;
            }

            if (positiveEffect)
            {
                switch (secondaryEffect)
                {
                case EffectType.IntelligenceIncrease: potionName += "Clever"; break;

                case EffectType.StamRegenIncrease: potionName += "Conditioning"; break;

                case EffectType.ManaRegenIncrease: potionName += "Sagacious"; break;

                case EffectType.SpellDamageDealtIncrease: potionName += "Sorcerous"; break;

                case EffectType.DexterityIncrease: potionName += "Agile"; break;

                case EffectType.SpellDamageResistIncrease: potionName += "Resisting"; break;

                case EffectType.AccuracyIncrease: potionName += "Accurate"; break;

                case EffectType.HitsRegenIncrease: potionName += "Regenerating"; break;

                case EffectType.MeleeDamageResistIncrease: potionName += "Fortifying"; break;

                case EffectType.MeleeDamageDealtIncrease: potionName += "Violent"; break;

                case EffectType.EvasionIncrease: potionName += "Evasive"; break;

                case EffectType.StrengthIncrease: potionName += "Enduring"; break;
                }
            }

            else
            {
                switch (secondaryEffect)
                {
                case EffectType.FrostDamage: potionName += "Freezing"; break;

                case EffectType.Entangle: potionName += "Entangling"; break;

                case EffectType.Petrify: potionName += "Petrifying"; break;

                case EffectType.FireDamage: potionName += "Fiery"; break;

                case EffectType.AbyssalDamage: potionName += "Abyssal"; break;

                case EffectType.Disease: potionName += "Diseased"; break;

                case EffectType.ShockDamage: potionName += "Shocking"; break;

                case EffectType.EvasionReduction: potionName += "Marking"; break;

                case EffectType.EarthDamage: potionName += "Crushing"; break;

                case EffectType.BleedDamage: potionName += "Bleeding"; break;

                case EffectType.Poison: potionName += "Poisoning"; break;

                case EffectType.AccuracyReduction: potionName += "Stunning"; break;
                }
            }

            potionName += " Potion of ";

            if (positiveEffect)
            {
                potionName += "the ";

                switch (primaryEffect)
                {
                case EffectType.IntelligenceIncrease: potionName += "Imp"; break;

                case EffectType.StamRegenIncrease: potionName += "Ostard"; break;

                case EffectType.ManaRegenIncrease: potionName += "Wyrm"; break;

                case EffectType.SpellDamageDealtIncrease: potionName += "Wisp"; break;

                case EffectType.DexterityIncrease: potionName += "Wolf"; break;

                case EffectType.SpellDamageResistIncrease: potionName += "Basilisk"; break;

                case EffectType.AccuracyIncrease: potionName += "Eagle"; break;

                case EffectType.HitsRegenIncrease: potionName += "Bat"; break;

                case EffectType.MeleeDamageResistIncrease: potionName += "Crab"; break;

                case EffectType.MeleeDamageDealtIncrease: potionName += "Sabertusk"; break;

                case EffectType.EvasionIncrease: potionName += "Mongoose"; break;

                case EffectType.StrengthIncrease: potionName += "Bear"; break;
                }
            }

            else
            {
                switch (primaryEffect)
                {
                case EffectType.FrostDamage: potionName += "Frost"; break;

                case EffectType.Entangle: potionName += "Entanglement"; break;

                case EffectType.Petrify: potionName += "Petrification"; break;

                case EffectType.FireDamage: potionName += "Flame"; break;

                case EffectType.AbyssalDamage: potionName += "Abyss"; break;

                case EffectType.Disease: potionName += "Disease"; break;

                case EffectType.ShockDamage: potionName += "Lightning"; break;

                case EffectType.EvasionReduction: potionName += "Marking"; break;

                case EffectType.EarthDamage: potionName += "Crushing"; break;

                case EffectType.BleedDamage: potionName += "Blood"; break;

                case EffectType.Poison: potionName += "Poison"; break;

                case EffectType.AccuracyReduction: potionName += "Stunning"; break;
                }
            }

            return(potionName);
        }
コード例 #3
0
        public static void ResolvePotion(PlayerMobile player, Mobile mobileTarget, CustomAlchemyPotion potion)
        {
            if (!SpecialAbilities.Exists(player))
            {
                return;
            }
            if (!SpecialAbilities.Exists(mobileTarget))
            {
                return;
            }

            bool positiveEffect = potion.PositiveEffect;

            CustomAlchemy.EffectType        primaryEffect   = potion.PrimaryEffect;
            CustomAlchemy.EffectType        secondaryEffect = potion.SecondaryEffect;
            CustomAlchemy.EffectPotencyType potencyType     = potion.EffectPotency;

            int throwSound = 0x5D3;
            int itemID     = potion.ItemID;
            int itemHue    = potion.Hue;

            int hitSound    = Utility.RandomList(0x38E, 0x38F, 0x390);
            int effectSound = 0x5D8;

            ConsumePotion(player, potion);

            SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 0.75, true, 0, false, "", "", "-1");

            Point3D location = player.Location;
            Map     map      = player.Map;

            Point3D targetLocation = mobileTarget.Location;
            Map     targetMap      = mobileTarget.Map;

            bool drinkPotion = false;

            if (positiveEffect && player == mobileTarget && potencyType == EffectPotencyType.Target)
            {
                drinkPotion = true;
            }

            if (drinkPotion)
            {
                player.Animate(34, 5, 1, true, false, 0);
                Effects.PlaySound(player.Location, player.Map, Utility.RandomList(0x4CC, 0x4CD, 0x030, 0x031));
            }

            else
            {
                player.Animate(31, 7, 1, true, false, 0);
                Effects.PlaySound(player.Location, player.Map, throwSound);
            }

            Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
            {
                if (!SpecialAbilities.Exists(player))
                {
                    return;
                }

                //Update Target Location if MobileTarget still Valid
                if (mobileTarget != null && !drinkPotion)
                {
                    if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap)
                    {
                        targetLocation = mobileTarget.Location;
                    }
                }

                double distance         = Utility.GetDistance(location, targetLocation);
                double destinationDelay = (double)distance * .04;

                IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 5), map);
                IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), targetMap);

                if (drinkPotion)
                {
                    destinationDelay = 0;
                }

                else
                {
                    Effects.SendMovingEffect(startLocation, endLocation, itemID, 10, 0, false, false, itemHue, 0);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                {
                    //Update Target Location if MobileTarget still Valid
                    if (mobileTarget != null && !drinkPotion)
                    {
                        if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap)
                        {
                            targetLocation = mobileTarget.Location;
                        }
                    }

                    int primaryEffectItemId = 0x3709;
                    int primaryEffectHue    = 0;
                    int primaryEffectSound  = 0x208;

                    int secondaryEffectItemId = 0x3709;
                    int secondaryEffectHue    = 0;
                    int secondaryEffectSound  = 0x208;

                    List <Point3D> m_EffectLocations = new List <Point3D>();

                    if (drinkPotion && SpecialAbilities.Exists(player))
                    {
                        m_EffectLocations.Add(player.Location);
                    }

                    else
                    {
                        int radius = 0;

                        switch (potencyType)
                        {
                        case EffectPotencyType.SmallAoE: radius = 2; break;

                        case EffectPotencyType.MediumAoE: radius = 4; break;

                        case EffectPotencyType.LargeAoE: radius = 6; break;
                        }

                        int minRange = -1 * radius;
                        int maxRange = radius + 1;

                        for (int a = minRange; a < maxRange; a++)
                        {
                            for (int b = minRange; b < maxRange; b++)
                            {
                                Point3D newLocation = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z);

                                if (!m_EffectLocations.Contains(newLocation))
                                {
                                    m_EffectLocations.Add(newLocation);
                                }
                            }
                        }
                    }

                    foreach (Point3D point in m_EffectLocations)
                    {
                        Effects.SendLocationParticles(EffectItem.Create(point, map, TimeSpan.FromSeconds(0.25)), primaryEffectItemId, 10, 30, primaryEffectHue, 0, 5029, 0);

                        //Effect
                    }

                    /*
                     * //Positive
                     * StrengthIncrease,
                     * DexterityIncrease,
                     * IntelligenceIncrease,
                     * HitsRegenIncrease,
                     * StamRegenIncrease,
                     * ManaRegenIncrease,
                     * MeleeDamageDealtIncrease,
                     * MeleeDamageResistIncrease,
                     * SpellDamageDealtIncrease,
                     * SpellDamageResistIncrease,
                     * AccuracyIncrease,
                     * EvasionIncrease,
                     *
                     * //Negative
                     * Entangle,
                     * Petrify,
                     * FireDamage,
                     * FrostDamage,
                     * AbyssalDamage,
                     * ShockDamage,
                     * EarthDamage,
                     * BleedDamage,
                     * Disease,
                     * Poison,
                     * AccuracyReduction,
                     * EvasionReduction
                     *
                     * Target,
                     * SmallAoE,
                     * MediumAoE,
                     * LargeAoE
                     */

                    if (drinkPotion)
                    {
                    }
                });
            });
        }