Exemplo n.º 1
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            // Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
            TransformContext context = TransformationSpellHelper.GetContext(defender);

            if ((context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell))) ||
                (defender is BaseCreature && ((BaseCreature)defender).BleedImmune))
            {
                attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack!
                return;
            }

            attacker.SendLocalizedMessage(1060159); // Your target is bleeding!
            defender.SendLocalizedMessage(1060160); // You are bleeding!

            if (defender is PlayerMobile)
            {
                defender.LocalOverheadMessage(MessageType.Regular, 0x21, 1060757);                   // You are bleeding profusely
                defender.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, defender.Name); // ~1_NAME~ is bleeding profusely
            }

            bool blooddrinker = CheckBloodDrink(attacker);

            defender.PlaySound(0x133);
            defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist);

            BeginBleed(defender, attacker, blooddrinker);
        }
Exemplo n.º 2
0
        public override void Detonate(Mobile m)
        {
            int dam = Utility.RandomMinMax(MinDamage, MaxDamage);

            if (DeploymentType == DeploymentType.Tripwire)
            {
                dam *= 2;
            }

            AOS.Damage(m, Owner, dam, 100, 0, 0, 0, 0);
            Effects.SendLocationEffect(m.Location, m.Map, 0x11AD, 25, 10);
            Effects.PlaySound(m.Location, m.Map, 0x218);

            TransformContext context = TransformationSpellHelper.GetContext(m);

            if (context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell)) || m is BaseCreature bc && bc.BleedImmune)
            {
                return;
            }

            m.SendLocalizedMessage(1060160); // You are bleeding!
            BleedAttack.BeginBleed(m, Owner, false);

            base.Detonate(m);
        }
Exemplo n.º 3
0
        public override int GetSpellDamageBonus(bool inPvP)
        {
            int damageBonus = base.GetSpellDamageBonus(inPvP);

            int inscribeSkill = Skills[SkillName.Inscribe].Fixed;
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(this, AosAttribute.SpellDamage);

            // PvP spell damage increase cap of 15% from an items magic property
            if (inPvP && sdiBonus > 15)
            {
                sdiBonus = 15;
            }

            damageBonus += sdiBonus;

            TransformContext context = TransformationSpellHelper.GetContext(this);

            if (context != null && context.Spell is ReaperFormSpell spell)
            {
                damageBonus += spell.SpellDamageBonus;
            }

            return(damageBonus);
        }
Exemplo n.º 4
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                Point3D loc = m.Location;
                loc.Z += 50;

                m.PlaySound(0x211);
                m.FixedParticles(0x3779, 1, 30, 0x26EC, 0x3, 0x3, EffectLayer.Waist);

                Effects.SendMovingParticles(new Entity(Serial.Zero, loc, m.Map), new Entity(Serial.Zero, m.Location, m.Map), 0xF5F, 1, 0, true, false, 0x21, 0x3F, 0x251D, 0, 0, EffectLayer.Head, 0);

                double percentage    = 0.05 * FocusLevel;
                double inscribeSkill = GetInscribeSkill(Caster);
                int    damage;

                if (!m.Player && (((double)m.Hits / (double)m.HitsMax) < percentage))
                {
                    damage = 300;
                }
                else
                {
                    int minDamage = (int)Caster.Skills.Spellweaving.Value / 5;
                    int maxDamage = (int)Caster.Skills.Spellweaving.Value / 3;
                    damage = Utility.RandomMinMax(minDamage, maxDamage);
                }

                int damageBonus          = 0;
                int sdiBonus             = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
                int intBonus             = Caster.Int / 10;
                int inscribeBonus        = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
                TransformContext context = TransformationSpellHelper.GetContext(Caster);
                if (context != null && context.Spell is ReaperFormSpell)
                {
                    damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }
                if (m.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
                {
                    sdiBonus = 15 + ((int)inscribeSkill) / 10;
                }
                damageBonus += Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(m, m.Player);
                damageBonus += inscribeBonus + intBonus;

                damage *= damageBonus + 100;
                damage /= 100;

                int[] types = new int[4];
                types[Utility.Random(types.Length)] = 100;

                SpellHelper.Damage(this, m, damage, 0, types[0], types[1], types[2], types[3]);                         //Chaos damage.  Random elemental damage
            }

            FinishSequence();
        }
Exemplo n.º 5
0
        public void Target(Point3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                int    level = GetFocusLevel(Caster);
                double skill = Caster.Skills[CastSkill].Value;

                int tiles  = 2 + level;
                int damage = 15 + level;

                int damageBonus = 0;

                double           inscribeSkill          = GetInscribeSkill(Caster);
                int              inscribeBonus          = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
                int              intBonus               = Caster.Int / 10;
                int              ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, false);
                int              sdiBonus               = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
                TransformContext context = TransformationSpellHelper.GetContext(Caster);
                if (context != null && context.Spell is ReaperFormSpell)
                {
                    damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }

                damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus;
                int pvmDamage = damage * (100 + sdiBonus + damageBonus);
                pvmDamage /= 100;

                int duration = (int)Math.Max(1, skill / 24) + level;

                for (int x = p.X - tiles; x <= p.X + tiles; x += tiles)
                {
                    for (int y = p.Y - tiles; y <= p.Y + tiles; y += tiles)
                    {
                        if (p.X == x && p.Y == y)
                        {
                            continue;
                        }

                        Point3D p3d = new Point3D(x, y, Caster.Map.GetAverageZ(x, y));

                        if (Caster.Map.CanFit(p3d, 12, true, false))
                        {
                            new FireItem(duration).MoveToWorld(p3d, Caster.Map);
                        }
                    }
                }

                Effects.PlaySound(p, Caster.Map, 0x5CF);

                new InternalTimer(Caster, p, pvmDamage, tiles, duration).Start();
            }

            FinishSequence();
        }
Exemplo n.º 6
0
        public static void OnLogin(Mobile m)
        {
            TransformContext context = TransformationSpellHelper.GetContext(m);

            if (context?.Type == typeof(ReaperFormSpell))
            {
                m.Send(SpeedControl.WalkSpeed);
            }
        }
Exemplo n.º 7
0
        public static void OnLogin(LoginEventArgs e)
        {
            TransformContext context = TransformationSpellHelper.GetContext(e.Mobile);

            if (context != null && context.Type == typeof(ReaperFormSpell))
            {
                e.Mobile.Send(SpeedControl.WalkSpeed);
            }
        }
Exemplo n.º 8
0
        public BuffType GetRandomBuff(Mobile target)
        {
            List <BuffType> buffs = new List <BuffType>();

            if (MagicReflectSpell.HasReflect(target))
            {
                buffs.Add(BuffType.MagicReflect);
            }

            if (ReactiveArmorSpell.HasArmor(target))
            {
                buffs.Add(BuffType.ReactiveArmor);
            }

            if (ProtectionSpell.HasProtection(target))
            {
                buffs.Add(BuffType.Protection);
            }

            TransformContext context = TransformationSpellHelper.GetContext(target);

            if (context != null && context.Type != typeof(AnimalForm))
            {
                buffs.Add(BuffType.Transformation);
            }

            StatMod mod = target.GetStatMod("[Magic] Str Offset");

            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.StrBonus);
            }

            mod = target.GetStatMod("[Magic] Dex Offset");
            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.DexBonus);
            }

            mod = target.GetStatMod("[Magic] Int Offset");
            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.IntBonus);
            }

            if (buffs.Count == 0)
            {
                return(BuffType.None);
            }

            BuffType type = buffs[Utility.Random(buffs.Count)];

            buffs.Clear();

            return(type);
        }
Exemplo n.º 9
0
        public virtual double GetSlayerDamageScalar(Mobile defender)
        {
            Spellbook atkBook = Spellbook.FindEquippedSpellbook(m_Caster);

            double scalar = 1.0;

            if (atkBook != null)
            {
                SlayerEntry atkSlayer  = SlayerGroup.GetEntryByName(atkBook.Slayer);
                SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2);

                if (atkSlayer != null && atkSlayer.Slays(defender) || atkSlayer2 != null && atkSlayer2.Slays(defender))
                {
                    defender.FixedEffect(0x37B9, 10, 5);    //TODO: Confirm this displays on OSIs
                    scalar = 2.0;
                }


                TransformContext context = TransformationSpellHelper.GetContext(defender);

                if ((atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof(HorrificBeastSpell))
                {
                    scalar += .25; // Every necromancer transformation other than horrific beast take an additional 25% damage
                }
                if (scalar != 1.0)
                {
                    return(scalar);
                }
            }

            ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender);

            if (defISlayer == null)
            {
                defISlayer = defender.Weapon as ISlayer;
            }

            if (defISlayer != null)
            {
                SlayerEntry defSlayer  = SlayerGroup.GetEntryByName(defISlayer.Slayer);
                SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName(defISlayer.Slayer2);

                if (defSlayer != null && defSlayer.Group.OppositionSuperSlays(m_Caster) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays(m_Caster))
                {
                    scalar = 2.0;
                }
            }

            return(scalar);
        }
Exemplo n.º 10
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            base.OnHit(attacker, defender, damageBonus);

            if (attacker != null && defender != null)
            {
                // No special effects 90% of the time for players
                if (attacker.Player && attacker.AccessLevel == AccessLevel.Player && Utility.RandomDouble() < 0.90)
                {
                    return;
                }

                // Always bleed.
                if (!BleedAttack.IsBleeding(defender))
                {
                    // Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
                    TransformContext context = TransformationSpellHelper.GetContext(defender);

                    if ((context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell))) ||
                        (defender is BaseCreature && ((BaseCreature)defender).BleedImmune))
                    {
                        return;
                    }
                    else if (defender is PlayerMobile)
                    {
                        defender.LocalOverheadMessage(MessageType.Regular, 0x21, 1060757);                           // You are bleeding profusely
                        defender.NonlocalOverheadMessage(MessageType.Regular, 0x21, 1060758, defender.Name);         // ~1_NAME~ is bleeding profusely
                    }

                    defender.PlaySound(0x133);
                    defender.FixedParticles(0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist);

                    BleedAttack.BeginBleed(defender, attacker, true);
                }

                // 20% chance of Mortal Strike, costs 10 stam each use but cannot be used if you have < 80 stam.
                if (Utility.RandomDouble() > 0.80 && attacker.Stam > 79 && !MortalStrike.IsWounded(defender))
                {
                    MortalStrike.BeginWound(defender, TimeSpan.FromSeconds(6.0));

                    attacker.SendLocalizedMessage(1060086);                       // You deliver a mortal wound!
                    defender.SendLocalizedMessage(1060087);                       // You have been mortally wounded!

                    defender.PlaySound(0x1E1);
                    defender.FixedParticles(0x37B9, 244, 25, 9944, 31, 0, EffectLayer.Waist);

                    attacker.Stam -= 15;
                }
            }
        }
Exemplo n.º 11
0
        public void CheckCancelMorph(Mobile m)
        {
            if (m == null)
            {
                return;
            }

            double minSkill, maxSkill;

            TransformContext context = TransformationSpellHelper.GetContext(m);

            if (context != null)
            {
                Spell spell = context.Spell as Spell;
                spell.GetCastSkills(out minSkill, out maxSkill);

                if (m.Skills[spell.CastSkill].Value < minSkill)
                {
                    TransformationSpellHelper.RemoveContext(m, context, true);
                }
            }

            if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1)
            {
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(PolymorphSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
            }

            if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1)
            {
                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).SetHairMods(-1, -1);
                }
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(IncognitoSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
                BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
            }
            return;
        }
Exemplo n.º 12
0
            public InternalTimer(Mobile m, Mobile from) : base(TimeSpan.FromSeconds(0.0))
            {
                m_Mobile = m;
                m_From   = from;
                m_loc    = m_Mobile.Location;
                map      = m_Mobile.Map;
                double alchemyBonus = 0;
                double sdi          = 0;
                int    dmgInc       = 0;

                if ((((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned) && ((BaseCreature)from).ControlMaster != null)
                {
                    Mobile master = (((BaseCreature)from).ControlMaster);
                    alchemyBonus = AosAttributes.GetValue(master, AosAttribute.EnhancePotions);
                    sdi          = AosAttributes.GetValue(master, AosAttribute.SpellDamage);
                    dmgInc       = AosAttributes.GetValue(master, AosAttribute.WeaponDamage);
                    //if (alchemyBonus > 50)
                    //    alchemyBonus = 50;
                    sdi += ArcaneEmpowermentSpell.GetSpellBonus(master, false);

                    TransformContext context = TransformationSpellHelper.GetContext(master);

                    if (context != null && context.Spell is ReaperFormSpell)
                    {
                        sdi += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                    }

                    sdi          += (int)(master.Skills.Inscribe.Fixed + (1000 * (int)(master.Skills.Inscribe.Fixed / 100))) / 100;
                    alchemyBonus += master.Skills.Alchemy.Fixed / 330 * 10;
                    sdi          += m.Int / 10;

                    exploDamage = (int)(((master.Skills[SkillName.Alchemy].Value / 2.5)) * (1 + (alchemyBonus + sdi) / 100));
                    minDamage   = (int)master.Skills[SkillName.Carpentry].Value;
                    minDamage  += (int)master.Skills[SkillName.ArmsLore].Value;
                    minDamage  /= 6;
                    minDamage  *= (100 + dmgInc);
                    minDamage  /= 100;
                }
                else
                {
                    minDamage   = 20;
                    exploDamage = 20;
                }
                Priority = TimerPriority.TwoFiftyMS;
            }
Exemplo n.º 13
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar)
        {
            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            // PvP spell damage increase cap of 15% from an item’s magic property
            if (playerVsPlayer && sdiBonus > 15)
            {
                sdiBonus = 15;
            }

            damageBonus += sdiBonus;

            TransformContext context = TransformationSpellHelper.GetContext(Caster);

            if (context != null && context.Spell is ReaperFormSpell)
            {
                damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
            }

            damage = AOS.Scale(damage, 100 + damageBonus);

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Exemplo n.º 14
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            // Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
            TransformContext context = TransformationSpellHelper.GetContext(defender);

            if (context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell)) || defender is BaseCreature bc && bc.BleedImmune || Spells.Mysticism.StoneFormSpell.CheckImmunity(defender))
            {
                attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack!
                return;
            }

            BeginBleed(defender, attacker);
        }
Exemplo n.º 15
0
        public override void OnCarve(Mobile from, Corpse corpse, Item with)
        {
            if (corpse.Carved)
            {
                base.OnCarve(from, corpse, with);
            }

            TransformContext context = TransformationSpellHelper.GetContext(from);

            if (context != null && context.Spell is NecromancerSpell && Utility.RandomDouble() < 0.3)
            {
                corpse.DropItem(new GlowingOre(Utility.Random(2, 3)));
                from.SendMessage("Le Wisp se fige à votre toucher");
            }
            else if (Utility.RandomDouble() < .1)
            {
                corpse.DropItem(new GlowingOre());
                from.SendMessage("Seulement une partie du wisp se fige. Vous ne deviez pas être assez effrayant...");
            }
            base.OnCarve(from, corpse, with);
        }
Exemplo n.º 16
0
        public bool CheckForDispelEvil()
        {
            if (this.m_Mobile.Debug)
            {
                this.m_Mobile.Say(1154, "Checking to dispel evil");
            }

            if (this.m_Mobile.Skills[SkillName.Chivalry].Value < 35.0 || this.m_Mobile.Mana <= 9)
            {
                return(false);
            }

            bool cast = false;
            IPooledEnumerable eable = m_Mobile.GetMobilesInRange(4);

            foreach (Mobile m in eable)
            {
                if (m != null)
                {
                    if (m is BaseCreature && ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead)
                    {
                        cast = true;
                    }
                    else if (m is BaseCreature && !((BaseCreature)m).Controlled && ((BaseCreature)m).Karma < 0)
                    {
                        cast = true;
                    }
                    else if (TransformationSpellHelper.GetContext(m) != null)
                    {
                        cast = true;
                    }
                }
            }

            eable.Free();
            return(cast);
        }
Exemplo n.º 17
0
        public override int GetAttackSpeedBonus()
        {
            int bonus = base.GetAttackSpeedBonus();

            if (Core.SE)
            {
                /*
                 * This is likely true for Core.AOS as well... both guides report the same
                 * formula, and both are wrong.
                 * The old formula left in for AOS for legacy & because we aren't quite 100%
                 * Sure that AOS has THIS formula
                 */
                bonus += AosAttributes.GetValue(this, AosAttribute.WeaponSpeed);

                if (Spells.Chivalry.DivineFurySpell.UnderEffect(this))
                {
                    bonus += 10;
                }

                // Bonus granted by successful use of Honorable Execution.
                bonus += HonorableExecution.GetSwingBonus(this);

                if (DualWield.Registry.Contains(this))
                {
                    bonus += ((DualWield.DualWieldTimer)DualWield.Registry[this]).BonusSwingSpeed;
                }

                if (Feint.Registry.Contains(this))
                {
                    bonus -= ((Feint.FeintTimer)Feint.Registry[this]).SwingSpeedReduction;
                }

                TransformContext context = TransformationSpellHelper.GetContext(this);

                if (context != null && context.Spell is ReaperFormSpell reaperSpell)
                {
                    bonus += reaperSpell.SwingSpeedBonus;
                }

                int discordanceEffect = 0;

                // Discordance gives a malus of -0/-28% to swing speed.
                if (SkillHandlers.Discordance.GetEffect(this, ref discordanceEffect))
                {
                    bonus -= discordanceEffect;
                }

                if (EssenceOfWindSpell.IsDebuffed(this))
                {
                    bonus -= EssenceOfWindSpell.GetSSIMalus(this);
                }

                if (bonus > 60)
                {
                    bonus = 60;
                }
            }
            else if (Core.AOS)
            {
                bonus += AosAttributes.GetValue(this, AosAttribute.WeaponSpeed);

                if (Spells.Chivalry.DivineFurySpell.UnderEffect(this))
                {
                    bonus += 10;
                }

                int discordanceEffect = 0;

                // Discordance gives a malus of -0/-28% to swing speed.
                if (SkillHandlers.Discordance.GetEffect(this, ref discordanceEffect))
                {
                    bonus -= discordanceEffect;
                }
            }

            return(bonus);
        }
Exemplo n.º 18
0
        public void Target(Mobile m)
        {
            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent asfter AoS

                /* Temporarily causes intense physical pain to the target, dealing direct damage.
                 * After 10 seconds the spell wears off, and if the target is still alive,
                 * some of the Hit Points lost through Pain Spike are restored.
                 */

                m.FixedParticles(0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head);
                m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head);
                m.PlaySound(0x210);

                double damage                 = ((GetDamageSkill(Caster) - GetResistSkill(m)) / 10) + (m.Player ? 18 : 30);
                double sdiBonus               = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100;
                double inscribeSkill          = GetInscribeSkill(Caster);
                int    ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player);

                sdiBonus += ArcaneEmpowermentBonus;
                // PvP spell damage increase cap of 15% from an item’s magic property
                if (m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
                {
                    sdiBonus = 15 + ((int)inscribeSkill) / 10;
                }

                if (Scroll != null)//doesn't appear to work
                {
                    sdiBonus += (int)inscribeSkill / 10;
                }

                TransformContext context = TransformationSpellHelper.GetContext(Caster);

                if (context != null && context.Spell is ReaperFormSpell)
                {
                    sdiBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }

                damage = AOS.Scale((int)damage, (int)(100 + sdiBonus));

                m.CheckSkill(SkillName.MagicResist, 0.0, 120.0);        //Skill check for gain

                if (damage < 1)
                {
                    damage = 1;
                }

                TimeSpan buffTime = TimeSpan.FromSeconds(10.0);

                if (m_Table.Contains(m))
                {
                    damage = Utility.RandomMinMax(3, 7);
                    Timer t = m_Table[m] as Timer;

                    if (t != null)
                    {
                        t.Delay += TimeSpan.FromSeconds(2.0);

                        buffTime = t.Next - DateTime.UtcNow;
                    }
                }
                else
                {
                    new InternalTimer(m, damage).Start();
                }

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));

                Misc.WeightOverloading.DFA = Misc.DFAlgorithm.PainSpike;
                m.Damage((int)damage, Caster);
                SpellHelper.DoLeech((int)damage, Caster, m);
                Misc.WeightOverloading.DFA = Misc.DFAlgorithm.Standard;

                //SpellHelper.Damage( this, m, damage, 100, 0, 0, 0, 0, Misc.DFAlgorithm.PainSpike );
                HarmfulSpell(m);
            }

            FinishSequence();
        }
Exemplo n.º 19
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0x5C6);

                int range       = 5 + FocusLevel;
                int damage      = 25 + FocusLevel;
                int damageBonus = 0;

                double           inscribeSkill          = GetInscribeSkill(Caster);
                int              inscribeBonus          = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
                int              intBonus               = Caster.Int / 10;
                int              ArcaneEmpowermentBonus = 0;
                int              sdiBonus               = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
                TransformContext context = TransformationSpellHelper.GetContext(Caster);
                if (context != null && context.Spell is ReaperFormSpell)
                {
                    damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }

                damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus;

                double skill = Caster.Skills[SkillName.Spellweaving].Value;

                TimeSpan duration = TimeSpan.FromSeconds((int)(skill / 24) + FocusLevel);

                int fcMalus  = FocusLevel + 1;
                int ssiMalus = 2 * (FocusLevel + 1);

                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in Caster.GetMobilesInRange(range))
                {
                    if (Caster != m && Caster.InLOS(m) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }
                }

                for (int i = 0; i < targets.Count; i++)
                {
                    Mobile m = targets[i];

                    Caster.DoHarmful(m);
                    ArcaneEmpowermentBonus += Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player);

                    if (m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
                    {
                        sdiBonus = 15 + ((int)inscribeSkill) / 10;
                    }

                    SpellHelper.Damage(this, m, damage * (100 + damageBonus + sdiBonus + ArcaneEmpowermentBonus) / 100, 0, 0, 100, 0, 0);

                    if (!CheckResisted(m))                              //No message on resist
                    {
                        m_Table[m] = new EssenceOfWindInfo(m, fcMalus, ssiMalus, duration);

                        BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EssenceOfWind, 1075802, duration, m, String.Format("{0}\t{1}", fcMalus.ToString(), ssiMalus.ToString())));
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 20
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                /* Creates a withering frost around the Caster,
                 * which deals Cold Damage to all valid targets in a radius of 5 tiles.
                 */

                Map map = Caster.Map;

                if (map != null)
                {
                    List <Mobile> targets = new List <Mobile>();

                    BaseCreature cbc       = Caster as BaseCreature;
                    bool         isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned);

                    int damageBonus = 0;

                    double           inscribeSkill          = GetInscribeSkill(Caster);
                    int              inscribeBonus          = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
                    int              intBonus               = Caster.Int / 10;
                    int              ArcaneEmpowermentBonus = 0;
                    int              sdiBonus               = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
                    TransformContext context = TransformationSpellHelper.GetContext(Caster);
                    if (context != null && context.Spell is ReaperFormSpell)
                    {
                        damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                    }

                    damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus;


                    foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5))
                    {
                        if (Caster != m && Caster.InLOS(m) && (SpellHelper.ValidIndirectTarget(Caster, m)) && Caster.CanBeHarmful(m, false))
                        {
                            if (isMonster)
                            {
                                if (m is BaseCreature)
                                {
                                    BaseCreature bc = (BaseCreature)m;

                                    if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team)
                                    {
                                        continue;
                                    }
                                }
                                else if (!m.Player)
                                {
                                    continue;
                                }
                            }

                            targets.Add(m);
                        }
                    }

                    Effects.PlaySound(Caster.Location, map, 0x1FB);
                    Effects.PlaySound(Caster.Location, map, 0x10B);
                    Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);

                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = targets[i];

                        Caster.DoHarmful(m);
                        m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                        double damage = Utility.RandomMinMax(30, 35);

                        damage *= (300 + (m.Karma / 100) + (GetDamageSkill(Caster) * 10));
                        damage /= 1000;

                        // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE)
                        if (Core.SE && m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
                        {
                            sdiBonus = 15 + ((int)inscribeSkill) / 10;
                        }

                        damage *= (100 + sdiBonus + damageBonus);
                        damage /= 100;

                        // TODO: cap?
                        //if ( damage > 40 )
                        //	damage = 40;

                        SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 21
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8);

                    foreach (Mobile m in eable)
                    {
                        if ((m is BaseCreature) && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false) ||
                            TransformationSpellHelper.UnderTransformation(m) || !m.CanBeginAction(typeof(PolymorphSpell)) ||
                            AnimalForm.UnderTransformation(Caster) || (TransformationSpellHelper.GetContext(m) != null))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];

                    BaseCreature bc = m as BaseCreature;
                    if (TransformationSpellHelper.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            Caster.DoHarmful(m);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                            Caster.DoHarmful(m);
                        }
                    }
                    else if (!m.CanBeginAction(typeof(PolymorphSpell)))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            PolymorphSpell.EndPolymorph(m);
                            //TransformationSpellHelper.RemoveContext(m, true);
                            Caster.DoHarmful(m);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (AnimalForm.UnderTransformation(Caster))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            AnimalForm.RemoveContext(m, true);
                            Caster.DoHarmful(m);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (TransformationSpellHelper.GetContext(m) != null)
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Caster.DoHarmful(m);
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else
                    {
                        if (bc == null)
                        {
                            continue;
                        }

                        double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;

                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            Caster.DoHarmful(m);

                            m.FixedEffect(0x3779, 10, 20);
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 22
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0xF5);
                Caster.PlaySound(0x299);
                Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                int    dispelSkill = ComputePowerValue(2);
                double chiv        = Caster.Skills.Chivalry.Value;

                foreach (var m in AcquireIndirectTargets(Caster.Location, 8).OfType <Mobile>())
                {
                    if (m is BaseCreature bc)
                    {
                        bool dispellable = bc.Summoned && !bc.IsAnimatedDead;

                        if (dispellable)
                        {
                            double dispelChance = (50.0 + ((100 * (chiv - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;
                            dispelChance *= dispelSkill / 100.0;

                            if (dispelChance > Utility.RandomDouble())
                            {
                                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                                Effects.PlaySound(m, m.Map, 0x201);

                                m.Delete();
                                continue;
                            }
                        }

                        bool evil = !bc.Controlled && bc.Karma < 0;

                        if (evil)
                        {
                            // TODO: Is this right?
                            double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
                            fleeChance /= 1000000;

                            if (fleeChance > Utility.RandomDouble())
                            {
                                // guide says 2 seconds, it's longer
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

                    TransformContext context = TransformationSpellHelper.GetContext(m);
                    if (context != null && context.Spell is NecromancerSpell)   //Trees are not evil!	TODO: OSI confirm?
                    {
                        // transformed ..
                        double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));

                        if (drainChance > Utility.RandomDouble())
                        {
                            int drain = (5 * dispelSkill) / 100;

                            m.Stam -= drain;
                            m.Mana -= drain;
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 23
0
        public override void OnCast()
        {
            if (this.CheckSequence())
            {
                List <Mobile>     targets = new List <Mobile>();
                IPooledEnumerable eable   = Caster.GetMobilesInRange(8);

                foreach (Mobile m in eable)
                {
                    if (this.Caster != m && SpellHelper.ValidIndirectTarget(this.Caster, m) && this.Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }
                }
                eable.Free();

                this.Caster.PlaySound(0xF5);
                this.Caster.PlaySound(0x299);
                this.Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                int dispelSkill = this.ComputePowerValue(2);

                double chiv = this.Caster.Skills.Chivalry.Value;

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile       m  = targets[i];
                    BaseCreature bc = m as BaseCreature;

                    if (bc != null)
                    {
                        bool dispellable = bc.Summoned && !bc.IsAnimatedDead;

                        if (dispellable)
                        {
                            double dispelChance = (50.0 + ((100 * (chiv - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;
                            dispelChance *= dispelSkill / 100.0;

                            if (dispelChance > Utility.RandomDouble())
                            {
                                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                                Effects.PlaySound(m, m.Map, 0x201);

                                m.Delete();
                                continue;
                            }
                        }

                        bool evil = !bc.Controlled && bc.Karma < 0;

                        if (evil)
                        {
                            // TODO: Is this right?
                            double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
                            fleeChance /= 1000000;

                            if (fleeChance > Utility.RandomDouble())
                            {
                                // guide says 2 seconds, it's longer
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

                    TransformContext context = TransformationSpellHelper.GetContext(m);
                    if (context != null && context.Spell is NecromancerSpell)   //Trees are not evil!	TODO: OSI confirm?
                    {
                        // transformed ..
                        double drainChance = 0.5 * (this.Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));

                        if (drainChance > Utility.RandomDouble())
                        {
                            int drain = (5 * dispelSkill) / 100;

                            m.Stam -= drain;
                            m.Mana -= drain;
                        }
                    }
                }
            }

            this.FinishSequence();
        }
Exemplo n.º 24
0
        public BuffType GetRandomBuff(Mobile target)
        {
            List <BuffType> buffs = new List <BuffType>();

            if (MagicReflectSpell.HasReflect(target))
            {
                buffs.Add(BuffType.MagicReflect);
            }

            if (ReactiveArmorSpell.HasArmor(target))
            {
                buffs.Add(BuffType.ReactiveArmor);
            }

            if (ProtectionSpell.HasProtection(target))
            {
                buffs.Add(BuffType.Protection);
            }

            TransformContext context = TransformationSpellHelper.GetContext(target);

            if (context != null && context.Type != typeof(AnimalForm))
            {
                buffs.Add(BuffType.Transformation);
            }

            StatMod mod = target.GetStatMod("[Magic] Str Buff");

            if (mod != null)
            {
                buffs.Add(BuffType.StrBonus);
            }

            mod = target.GetStatMod("[Magic] Dex Buff");
            if (mod != null)
            {
                buffs.Add(BuffType.DexBonus);
            }

            mod = target.GetStatMod("[Magic] Int Buff");
            if (mod != null)
            {
                buffs.Add(BuffType.IntBonus);
            }

            if (EodonianPotion.IsUnderEffects(target, PotionEffect.Barrab))
            {
                buffs.Add(BuffType.BarrabHemolymph);
            }

            if (EodonianPotion.IsUnderEffects(target, PotionEffect.Urali))
            {
                buffs.Add(BuffType.UraliTrance);
            }

            if (buffs.Count == 0)
            {
                return(BuffType.None);
            }

            BuffType type = buffs[Utility.Random(buffs.Count)];

            buffs.Clear();

            return(type);
        }
Exemplo n.º 25
0
        private void ExplodePunch(Mobile target)
        {
            double alchemyBonus = 0;
            double sdi          = 0;
            int    dmgInc       = 0;
            int    exploDamage  = 20;

            if ((Controlled || Summoned) && ControlMaster != null)
            {
                Mobile master = ControlMaster;
                alchemyBonus = AosAttributes.GetValue(master, AosAttribute.EnhancePotions);
                sdi          = AosAttributes.GetValue(master, AosAttribute.SpellDamage);
                //if (alchemyBonus > 50)
                //    alchemyBonus = 50;
                sdi          += (int)(master.Skills.Inscribe.Fixed + (1000 * (int)(master.Skills.Inscribe.Fixed / 100))) / 100;
                alchemyBonus += master.Skills.Alchemy.Fixed / 330 * 10;
                sdi          += master.Int / 10;
                sdi          += ArcaneEmpowermentSpell.GetSpellBonus(master, false);

                TransformContext context = TransformationSpellHelper.GetContext(master);

                if (context != null && context.Spell is ReaperFormSpell)
                {
                    sdi += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }
                exploDamage = (int)(((master.Skills[SkillName.Alchemy].Value / 2.5)) * (1 + (alchemyBonus + sdi) / 100));
            }


            if (target == null)
            {
                return;
            }

            Point3D m_loc = target.Location;
            Map     map   = target.Map;

            int ExpRange = 0;

            if (ControlMaster != null)
            {
                ExpRange += (int)(ControlMaster.Skills[SkillName.Tinkering].Value + ControlMaster.Skills[SkillName.Alchemy].Value) / 50;
                if (Utility.RandomDouble() > AosAttributes.GetValue(ControlMaster, AosAttribute.EnhancePotions))
                {
                    ExpRange += 1;
                }
                if (Utility.RandomDouble() > AosAttributes.GetValue(ControlMaster, AosAttribute.SpellDamage))
                {
                    ExpRange += 1;
                }
            }
            target.PlaySound(0x11D);

            if ((Map)map != null)
            {
                IPooledEnumerable eable = (IPooledEnumerable)map.GetMobilesInRange(m_loc, ExpRange);

                foreach (object o in eable)
                {
                    if ((o is Mobile) && (o != this) && (target == null || (SpellHelper.ValidIndirectTarget(this, (Mobile)o) && CanBeHarmful((Mobile)o, false))) &&
                        ((Mobile)o).InLOS(target))
                    {
                        if (o is PlayerMobile)
                        {
                            AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage / 4), 0, 100, 0, 0, 0);
                        }
                        else if (o is BaseCreature && Controlled)
                        {
                            if (ControlMaster != ((BaseCreature)o).ControlMaster)
                            {
                                AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage), 0, 100, 0, 0, 0);
                            }
                            else if (o is BaseCreature)
                            {
                                AOS.Damage((Mobile)o, this, Utility.RandomMinMax(0, exploDamage), 0, 100, 0, 0, 0);
                            }
                        }
                        DoHarmful((Mobile)o);
                    }
                }
            }
        }
Exemplo n.º 26
0
        public void Target(Mobile m)
        {
            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m );	//Irrelevent after AoS

                /* Temporarily chokes off the air suply of the target with poisonous fumes.
                 * The target is inflicted with poison damage over time.
                 * The amount of damage dealt each "hit" is based off of the caster's Spirit Speak skill and the Target's current Stamina.
                 * The less Stamina the target has, the more damage is done by Strangle.
                 * Duration of the effect is Spirit Speak skill level / 10 rounds, with a minimum number of 4 rounds.
                 * The first round of damage is dealt after 5 seconds, and every next round after that comes 1 second sooner than the one before, until there is only 1 second between rounds.
                 * The base damage of the effect lies between (Spirit Speak skill level / 10) - 2 and (Spirit Speak skill level / 10) + 1.
                 * Base damage is multiplied by the following formula: (3 - (target's current Stamina / target's maximum Stamina) * 2).
                 * Example:
                 * For a target at full Stamina the damage multiplier is 1,
                 * for a target at 50% Stamina the damage multiplier is 2 and
                 * for a target at 20% Stamina the damage multiplier is 2.6
                 */

                if (m.Spell != null)
                {
                    m.Spell.OnCasterHurt();
                }

                m.PlaySound(0x22F);
                m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head);
                m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255);

                if (!m_Table.Contains(m))
                {
                    Timer t = new InternalTimer(m, Caster);
                    t.Start();

                    m_Table[m] = t;
                }

                HarmfulSpell(m);
            }

            //Calculations for the buff bar
            double spiritlevel = Caster.Skills[SkillName.SpiritSpeak].Value / 10;

            if (spiritlevel < 4)
            {
                spiritlevel = 4;
            }
            int d_MinDamage = 4;
            int d_MaxDamage = ((int)spiritlevel + 1) * 3;

            int damageBonus = 0;

            double           inscribeSkill          = GetInscribeSkill(Caster);
            int              inscribeBonus          = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
            int              intBonus               = Caster.Int / 10;
            int              ArcaneEmpowermentBonus = 0;
            int              sdiBonus               = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
            TransformContext context = TransformationSpellHelper.GetContext(Caster);

            if (context != null && context.Spell is ReaperFormSpell)
            {
                damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
            }

            damageBonus += inscribeBonus + intBonus + ArcaneEmpowermentBonus;

            if (Core.SE && m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
            {
                sdiBonus = 15 + ((int)inscribeSkill) / 10;
            }

            d_MinDamage *= (100 + sdiBonus + damageBonus);
            d_MinDamage /= 100;

            d_MaxDamage *= (100 + sdiBonus + damageBonus);
            d_MaxDamage /= 100;

            string args = String.Format("{0}\t{1}", d_MinDamage, d_MaxDamage);

            int i_Count    = (int)spiritlevel;
            int i_MaxCount = i_Count;
            int i_HitDelay = 5;
            int i_Length   = i_HitDelay;

            while (i_Count > 1)
            {
                --i_Count;
                if (i_HitDelay > 1)
                {
                    if (i_MaxCount < 5)
                    {
                        --i_HitDelay;
                    }
                    else
                    {
                        int delay = (int)(Math.Ceiling((1.0 + (5 * i_Count)) / i_MaxCount));

                        if (delay <= 5)
                        {
                            i_HitDelay = delay;
                        }
                        else
                        {
                            i_HitDelay = 5;
                        }
                    }
                }
                i_Length += i_HitDelay;
            }
            TimeSpan t_Duration = TimeSpan.FromSeconds(i_Length);

            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args.ToString()));

            FinishSequence();
        }
Exemplo n.º 27
0
 public bool CanDispel(Mobile m)
 {
     return((TransformationSpellHelper.GetContext(m) != null) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(m) ||
            TransformationSpellHelper.UnderTransformation(m) ||
            (m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful(m, false) && !((BaseCreature)m).IsAnimatedDead));
 }
Exemplo n.º 28
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0xF5);
                Caster.PlaySound(0x299);
                Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                int dispelSkill = ComputePowerValue(2);

                double chiv = Caster.Skills.Chivalry.Value;

                IEnumerable <Mobile> targets = Caster.GetMobilesInRange(8)
                                               .Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false));

                foreach (Mobile m in targets)
                {
                    if (m is BaseCreature bc)
                    {
                        if (bc.Summoned && !bc.IsAnimatedDead)
                        {
                            double dispelChance = (50.0 + 100 * (chiv - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
                            dispelChance *= dispelSkill / 100.0;

                            if (dispelChance > Utility.RandomDouble())
                            {
                                Effects.SendLocationParticles(
                                    EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                                Effects.PlaySound(m, m.Map, 0x201);

                                m.Delete();
                                continue;
                            }
                        }

                        bool evil = !bc.Controlled && bc.Karma < 0;

                        if (evil)
                        {
                            // TODO: Is this right?
                            double fleeChance = (100 - Math.Sqrt(m.Fame / 2.0)) * chiv * dispelSkill;
                            fleeChance /= 1000000;

                            if (fleeChance > Utility.RandomDouble())
                            {
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

                    TransformContext context = TransformationSpellHelper.GetContext(m);
                    if (context?.Spell is NecromancerSpell) // Trees are not evil! TODO: OSI confirm?
                    {
                        // transformed ..

                        double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));

                        if (drainChance > Utility.RandomDouble())
                        {
                            int drain = 5 * dispelSkill / 100;

                            m.Stam -= drain;
                            m.Mana -= drain;
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 29
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Mobile)
                {
                    Mobile       m  = (Mobile)o;
                    BaseCreature bc = m as BaseCreature;

                    if (!from.CanSee(m))
                    {
                        from.SendLocalizedMessage(500237);                           // Target can not be seen.
                    }
                    else if (TransformationSpellHelper.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            from.DoHarmful(m);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                            from.DoHarmful(m);
                        }
                    }
                    else if (!m.CanBeginAction(typeof(PolymorphSpell)))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            //TransformationSpellHelper.RemoveContext(m, true);
                            PolymorphSpell.EndPolymorph(m);
                            from.DoHarmful(m);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (AnimalForm.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            AnimalForm.RemoveContext(m, true);
                            from.DoHarmful(m);
                        }
                        else
                        {
                            from.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (TransformationSpellHelper.GetContext(m) != null)
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            from.DoHarmful(m);
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            from.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (bc == null || !bc.IsDispellable)
                    {
                        from.SendLocalizedMessage(1005049);                           // That cannot be dispelled.
                    }
                    else if (m_Owner.CheckHSequence(m))
                    {
                        SpellHelper.Turn(from, m);

                        double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;

                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084);                               // The creature resisted the attempt to dispel it!
                        }
                    }
                }
            }
Exemplo n.º 30
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0x5CE);

                double skill = Caster.Skills[SkillName.Spellweaving].Value;

                int damage = Math.Max(11, 10 + (int)(skill / 24)) + FocusLevel;

                int damageBonus = 0;

                double           inscribeSkill             = GetInscribeSkill(Caster);
                int              inscribeBonus             = (int)(inscribeSkill + (100 * (int)(inscribeSkill / 100))) / 10;
                int              intBonus                  = Caster.Int / 10;
                int              pvpArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, true);
                int              pvmArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, false);
                int              sdiBonus                  = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);
                TransformContext context = TransformationSpellHelper.GetContext(Caster);
                if (context != null && context.Spell is ReaperFormSpell)
                {
                    damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }

                damageBonus += inscribeBonus + intBonus;

                int pvmDamage = damage * (100 + sdiBonus + damageBonus + pvmArcaneEmpowermentBonus);
                pvmDamage /= 100;

                if (sdiBonus > 15 + ((int)inscribeSkill) / 10)
                {
                    sdiBonus = 15 + ((int)inscribeSkill) / 10;
                }

                int pvpDamage = damage * (100 + sdiBonus + damageBonus + pvpArcaneEmpowermentBonus);
                pvpDamage /= 100;

                int      range    = 2 + FocusLevel;
                TimeSpan duration = TimeSpan.FromSeconds(5 + FocusLevel);

                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in Caster.GetMobilesInRange(range))
                {
                    if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }

                for (int i = 0; i < targets.Count; i++)
                {
                    Mobile m = targets[i];

                    Caster.DoHarmful(m);

                    Spell oldSpell = m.Spell as Spell;

                    SpellHelper.Damage(this, m, (m.Player && Caster.Player) ? pvpDamage : pvmDamage, 0, 0, 0, 0, 100);

                    if (oldSpell != null && oldSpell != m.Spell)
                    {
                        if (!CheckResisted(m))
                        {
                            m_Table[m] = Timer.DelayCall <Mobile>(duration, DoExpire, m);

                            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m)));
                        }
                    }
                }
            }

            FinishSequence();
        }