Пример #1
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            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);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            sdiBonus -= Block.GetSpellReduction(target);

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

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

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

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

            damage = AOS.Scale(damage, evalScale);

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

            #region Skill Mastery
            SkillMasterySpell spell = SkillMasterySpell.GetHarmfulSpell(Caster, typeof(TribulationSpell));

            if (spell != null)
            {
                spell.AbsorbDamage(ref damage);
            }
            #endregion

            return(damage / 100);
        }
Пример #2
0
        //Création d'une copie
        public static void ToogleCopie(Spell spell, Mobile Caster, Mobile from)
        {
            TimeSpan duration = TimeSpan.FromSeconds(0);

            SpellHelper.Summon(new Copie(Caster, from), Caster, 0x217, duration, false, false);
        }
Пример #3
0
        public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats)
        {
            Map map = caster.Map;

            if (map == null)
            {
                return;
            }

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if (scaleDuration)
            {
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);
            }

            if (scaleStats)
            {
                creature.RawStr = (int)(creature.RawStr * scale);
                creature.Hits   = creature.HitsMax;

                creature.RawDex = (int)(creature.RawDex * scale);
                creature.Stam   = creature.StamMax;

                creature.RawInt = (int)(creature.RawInt * scale);
                creature.Mana   = creature.ManaMax;
            }

            Point3D p = new Point3D(caster);

            if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);
                return;
            }


            /*
             * int offset = Utility.Random( 8 ) * 2;
             *
             * for( int i = 0; i < m_Offsets.Length; i += 2 )
             * {
             *      int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length];
             *      int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
             *
             *      if( map.CanSpawnMobile( x, y, caster.Z ) )
             *      {
             *              BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration );
             *              return;
             *      }
             *      else
             *      {
             *              int z = map.GetAverageZ( x, y );
             *
             *              if( map.CanSpawnMobile( x, y, z ) )
             *              {
             *                      BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration );
             *                      return;
             *              }
             *      }
             * }
             * */

            creature.Delete();
            caster.SendLocalizedMessage(501942);               // That location is blocked.
        }
Пример #4
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);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), (int)SpellHelper.AdjustValue(Caster, 2 + Caster.Skills[CastSkill].Value / 50, true));

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

                    eable.Free();
                }

                //double damage = GetNewAosDamage(15, 1, 5, true);

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

                        Disturb(m);

                        if (CheckResisted(m))
                        {
                            //damage *= 0.75;

                            m.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }

                        Caster.DoHarmful(m);
                        //SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);

                        Effects.SendBoltEffect(m, true, 0);
                    }
                }
            }

            FinishSequence();
        }
Пример #5
0
        public override void OnCast()
        {
            if (Caster == null || Caster.Deleted || !Caster.Alive)
            {
                return;
            }

            foreach (Item itema in Caster.GetItemsInRange(1 + (int)(Caster.Skills[SkillName.ArtMagique].Base / 10)))
            {
                if (itema != null && itema is Corpse)
                {
                    Corpse c = (Corpse)itema;

                    if (c != null && c.Owner != null && c.Owner is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)(c.Owner);

                        if (pm.MortEngine.MortCurrentState == MortState.Assomage)
                        {
                            //pm.AddFatigue(-100);

                            SpellHelper.Turn(Caster, pm);

                            pm.PlaySound(0x214);
                            Effects.SendTargetEffect(pm, 0x376A, 10, 16);

                            if (pm.MortEngine.TimerEvanouie != null)
                            {
                                pm.MortEngine.TimerEvanouie.Stop();
                                pm.MortEngine.TimerEvanouie = null;
                            }

                            if (pm.MortEngine.TimerMort != null)
                            {
                                pm.MortEngine.TimerMort.Stop();
                                pm.MortEngine.TimerMort = null;
                            }

                            pm.Location = c.Location;
                            pm.MortEngine.EndroitMort  = c.Location;
                            pm.MortEngine.RisqueDeMort = false;
                            pm.MortEngine.Mort         = false;
                            pm.Frozen = false;

                            pm.Direction = c.Direction;
                            pm.MoveToWorld(c.Location, c.Map);
                            pm.Animate(21, 5, 1, false, false, 0);

                            pm.Resurrect();

                            if (c != null)
                            {
                                ArrayList list = new ArrayList();

                                foreach (Item item in c.Items)
                                {
                                    list.Add(item);
                                }

                                foreach (Item item in list)
                                {
                                    if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair)
                                    {
                                        item.Delete();
                                    }

                                    if (item is RaceSkin || c.EquipItems.Contains(item))
                                    {
                                        if (!pm.EquipItem(item))
                                        {
                                            pm.AddToBackpack(item);
                                        }
                                    }
                                    else
                                    {
                                        pm.AddToBackpack(item);
                                    }
                                }
                            }

                            pm.CheckRaceSkin();
                            pm.CheckStatTimers();

                            pm.MortEngine.MortCurrentState = MortState.Ebranle;
                        }
                    }
                }
            }
        }
Пример #6
0
 public virtual IEnumerable <IDamageable> AcquireIndirectTargets(IPoint3D pnt, int range)
 {
     return(SpellHelper.AcquireIndirectTargets(Caster, pnt, Caster.Map, range));
 }
Пример #7
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);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

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

                TimeSpan duration = TimeSpan.FromSeconds(0);

                int itemID = eastToWest ? 0x3946 : 0x3956;

                for (int i = -3; i <= 3; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051);
                }
            }

            FinishSequence();
        }
Пример #8
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                TimeSpan duration = TimeSpan.FromSeconds(0);
                double   amount   = 1;

                //Calcul du bonus donné par le sort (niveau * bonus_donne)
                if (Caster is PlayerMobile)
                {
                    //amount += (double)(((PlayerMobile)Caster).GetAptitudeValue(Aptitude.Composition) * bonus_donne);
                }

                DateTime endtime = DateTime.Now + duration;

                ArrayList m_target = new ArrayList();

                Map map = Caster.Map;

                Party party = Engines.PartySystem.Party.Get(Caster);

                //Définition des cibles du sort
                m_target.Add(Caster);

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(portee))
                    {
                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            if (party != null && party.Count > 0)
                            {
                                for (int k = 0; k < party.Members.Count; ++k)
                                {
                                    PartyMemberInfo pmi    = (PartyMemberInfo)party.Members[k];
                                    Mobile          member = pmi.Mobile;
                                    if (member.Serial == m.Serial)
                                    {
                                        m_target.Add(m);
                                    }
                                }
                            }
                        }
                    }
                }

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

                    StopTimer(targ);

                    m_FanfareTable[targ] = amount;

                    Timer t = new FanfareTimer(targ, amount, DateTime.Now + duration);
                    m_Timers[targ] = t;
                    t.Start();

                    Effects.SendTargetParticles(targ, 14170, 10, 20, 5013, 1945, 0, EffectLayer.Head); //ID, speed, dura, effect, hue, render, layer
                    targ.PlaySound(483);
                }
            }

            FinishSequence();
        }
Пример #9
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, Mobile target)
        {
            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);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            if (m_Caster is PlayerMobile && m_Caster.Race == Race.Gargoyle)
            {
                double perc = ((double)m_Caster.Hits / (double)m_Caster.HitsMax) * 100;

                perc  = 100 - perc;
                perc /= 20;

                if (perc > 4)
                {
                    sdiBonus += 12;
                }
                else if (perc >= 3)
                {
                    sdiBonus += 9;
                }
                else if (perc >= 2)
                {
                    sdiBonus += 6;
                }
                else if (perc >= 1)
                {
                    sdiBonus += 3;
                }
            }

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

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

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            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);
        }
Пример #10
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);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), (int)SpellHelper.AdjustValue(Caster, 1 + Caster.Skills[CastSkill].Value / 25, true));

                    foreach (Mobile m in eable)
                    {
                        if (m is BaseCreature && ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead && Caster.CanBeHarmful(m, false) && !(Caster.Party == m.Party))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    BaseCreature bc = m as BaseCreature;

                    if (bc == null)
                    {
                        continue;
                    }

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

                    dispelChance = SpellHelper.AdjustValue(Caster, dispelChance);

                    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
                    {
                        Effects.SendTargetEffect(m, 0x3779, 10, 20);
                        Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                    }
                }
            }

            FinishSequence();
        }
Пример #11
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);

                Effects.SendLocationEffect(p, Caster.Map, 14120, 20, 10, 1441, 0); //p, map, item, duration, speed, hue, render
                Effects.PlaySound(p, Caster.Map, 494);                             //p map sound

                foreach (Mobile m in Caster.Map.GetMobilesInRange(new Point3D(p), (int)SpellHelper.AdjustValue(Caster, 10 + Caster.Skills[CastSkill].Base / 4, true)))
                {
                    if (m != null && !(m is BaseVendor) && m is BaseCreature && ((BaseCreature)m).DefaultAI == AIType.AI_Animal)
                    {
                        ((BaseCreature)m).TargetLocation = new Point2D((IPoint2D)p);
                        Effects.SendTargetParticles(m, 14120, 10, 20, 5013, 1441, 0, EffectLayer.CenterFeet); //ID, speed, dura, effect, hue, render, layer
                        m.PlaySound(494);
                    }
                }
            }

            FinishSequence();
        }
Пример #12
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            bool eastToWest         = (m_Item.ItemID == 0x3915);
                            IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1)));

                            foreach (Mobile m in eable)
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            eable.Free();

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                caster.DoHarmful(m);

                                m_Item.ApplyPoisonTo(m);
                                m.PlaySound(0x474);
                            }
                        }
                    }
                }