Пример #1
0
        public static bool SetCurrentAbility(Mobile m, WeaponAbility a)
        {
            if (!Core.AOS)
            {
                ClearCurrentAbility(m);
                return(false);
            }

            TAVFlourish flourish = (TAVFlourish)XmlAttach.FindAttachmentOnMobile(m, typeof(TAVFlourish), "flourish");

            bool f = (flourish == null && m is TeiravonMobile && ((TeiravonMobile)m).ChargedMissileReady);

            if (!IsWeaponAbility(m, a, f))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a != null && !a.Validate(m))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a == null)
            {
                m_Table.Remove(m);
            }
            else
            {
                m_Table[m] = a;
            }

            return(true);
        }
Пример #2
0
 public override void OnRemoved(object parent)
 {
     try
     {
         if (parent is Mobile)
         {
             Mobile from = parent as Mobile;
             XmlAttach.FindAttachmentOnMobile(from, typeof(LokaiSkillMod), string.Format("{0}{1}{2}", Skill.ToString(), from.Name, Serial.Value)).Delete();
             LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from);
             skills.OnLokaiSkillChange(skills[Skill]);
         }
     }
     catch { base.OnRemoved(parent); }
 }
Пример #3
0
        public override void OnCast()
        {
            XmlData x = (XmlData)XmlAttach.FindAttachmentOnMobile(Caster, typeof(XmlData), "Cryomancer");

            if (x != null && CheckSequence())
            {
                if (SpellHelper.CheckTown(Caster.Location, Caster) && CheckSequence())
                {
                    DoBlizzard(Caster);
                    Effects.PlaySound(Caster.Location, Caster.Map, 0x016);
                    return;
                }
            }
            else
            {
                Caster.Target = new InternalTarget(this);
            }
        }
Пример #4
0
			protected override void OnTick()
			{
				if ( m_Attacker.HarmfulCheck( m_Defender ) )
				{
					double damage;

					if ( Core.AOS )
					{
						damage = m_Spell.GetNewAosDamage( 38, 1, 5, m_Attacker.Player && m_Defender.Player );
					}
					else
					{
						damage = Utility.Random( 23, 22 );

						if ( m_Spell.CheckResisted( m_Target ) )
						{
							damage *= 0.75;

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

						damage *= m_Spell.GetDamageScalar( m_Target );
					}

                   			XmlData x = (XmlData)XmlAttach.FindAttachmentOnMobile(m_Attacker, typeof(XmlData), "Cryomancer");
            			        
					if (x != null)
              				{
                  			    	m_Target.FixedParticles(0x3728, 20, 10, 5044, EffectLayer.Head);
                 			    	m_Target.PlaySound(0x5C6);

                    			    	SpellHelper.Damage(m_Spell, m_Target, damage, 0, 0, 100, 0, 0);
                    			}

                    			else
					{
						m_Target.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
						m_Target.PlaySound( 0x307 );

						SpellHelper.Damage( m_Spell, m_Target, damage, 0, 100, 0, 0, 0 );
					}
				}
			}
        protected override void OnTarget(Mobile from, object targ)
        {
            if (!(targ is Mobile))
            {
                from.SendMessage("You can only target mounts without bags with this.");
            }
            else
            {
                if (!(targ is BaseMount) || targ is PackAnimal)
                {
                    from.SendMessage("you can't put a saddlebag on that.");
                }
                else if (XmlAttach.FindAttachmentOnMobile(horsie, typeof(XmlData), "saddlebag") != null)
                {
                    from.SendMessage("That already has a bag on it.");
                }
                else
                {
                    horsie = (BaseMount)targ;
                    XmlAttach.AttachTo(horsie, new XmlData("saddlebag"));

                    Container pack = horsie.Backpack;

                    if (pack != null)
                    {
                        pack.Delete();
                    }

                    pack         = new StrongBackpack();
                    pack.Movable = false;

                    horsie.AddItem(pack);


                    bags.Delete();
                    from.SendMessage("You put the saddlebags on the {0}", horsie.ToString());
                }
            }
        }
Пример #6
0
        public virtual bool CheckWeaponSkill(Mobile from)
        {
            BaseWeapon weapon = from.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return(false);
            }

            Skill  skill    = from.Skills[weapon.Skill];
            double reqSkill = GetRequiredSkill(from);

            if (skill != null && skill.Base >= reqSkill)
            {
                return(true);
            }

            /* <UBWS> */
            if (weapon.WeaponAttributes.UseBestSkill > 0 && (from.Skills[SkillName.Swords].Base >= reqSkill || from.Skills[SkillName.Macing].Base >= reqSkill || from.Skills[SkillName.Fencing].Base >= reqSkill))
            {
                return(true);
            }
            /* </UBWS> */

            TAVFlourish flourish = (TAVFlourish)XmlAttach.FindAttachmentOnMobile(from, typeof(TAVFlourish), "flourish");

            bool f = (flourish != null);

            bool t = (from is TeiravonMobile && ((TeiravonMobile)from).ChargedMissileReady);

            if (f && t)
            {
                return(true);
            }

            from.SendLocalizedMessage(1060182, reqSkill.ToString());               // You need ~1_SKILL_REQUIREMENT~ weapon skill to perform that attack
            //from.SendMessage("flourish? {0} ; Ready? {1}",f,t);
            return(false);
        }
Пример #7
0
        public static WeaponAbility GetCurrentAbility(Mobile m)
        {
            if (!Core.AOS)
            {
                ClearCurrentAbility(m);
                return(null);
            }

            TAVFlourish flourish = (TAVFlourish)XmlAttach.FindAttachmentOnMobile(m, typeof(TAVFlourish), "flourish");

            bool          f = (flourish != null && m is TeiravonMobile && ((TeiravonMobile)m).ChargedMissileReady);
            WeaponAbility a;

            if (f)
            {
                a = flourish.WeaponAbility;
            }
            else
            {
                a = (WeaponAbility)m_Table[m];
            }


            if (!IsWeaponAbility(m, a, f))
            {
                ClearCurrentAbility(m);
                return(null);
            }

            if (a != null && !a.Validate(m))
            {
                ClearCurrentAbility(m);
                return(null);
            }

            return(a);
        }
Пример #8
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                if (Caster is TeiravonMobile && (((TeiravonMobile)Caster).IsCleric() || ((TeiravonMobile)Caster).IsDarkCleric() || ((TeiravonMobile)Caster).IsPaladin()) && ((TeiravonMobile)Caster).Faith != TeiravonMobile.Deity.None)
                {
                    TeiravonMobile Cleric = Caster as TeiravonMobile;

                    SpellHelper.Turn(Caster, m);

                    SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

                    if (m is TeiravonMobile && ((TeiravonMobile)m).m_CloakOfDarkness)
                    {
                        return;
                    }

                    double damage;
                    switch (Cleric.Faith)
                    {
                    case TeiravonMobile.Deity.Adalia:
                    {
                        damage = GetNewAosDamage(10, 1, 5, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);
                        m.Stam -= (int)damage;
                        m.FixedParticles(0x37B9, 10, 30, 5013, 1153, 4, EffectLayer.Waist);
                        m.PlaySound(0x470);
                    }
                    break;

                    case TeiravonMobile.Deity.Cultist:
                    {
                        damage = GetNewAosDamage(5, 1, 5, true);
                        SpellHelper.Damage(this, Caster, damage);
                        damage = GetNewAosDamage(25, 5, 10, true);
                        SpellHelper.Damage(this, m, damage, 20, 20, 20, 20, 20);

                        m.FixedParticles(0x37C3, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        Caster.FixedParticles(0x37C3, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        m.PlaySound(0x44E);
                    }
                    break;

                    case TeiravonMobile.Deity.Gruumsh:
                    {
                        int hpMissing = (int)((Caster.HitsMax - Caster.Hits) * .2);
                        damage = GetNewAosDamage(10 + hpMissing, 1, 5, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);

                        Caster.FixedParticles(0x36FE, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        m.PlaySound(0x056);
                    }
                    break;

                    case TeiravonMobile.Deity.Jareth:
                    {
                        damage = GetNewAosDamage(1, 2, 2, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage);

                        Caster.MovingEffect(m, 0x1CEE, 10, 30, false, false, 1886, 0);
                        m.PlaySound(0x3AC);
                    }
                    break;

                    case TeiravonMobile.Deity.Kamalini:
                    {
                        damage = GetNewAosDamage(22, 1, 5, Caster.Player && m.Player);
                        if (!m.InRange(Caster, 4))
                        {
                            damage *= 0.25;         // 1/4 damage at > 4 tile range
                        }
                        else if (!m.InRange(Caster, 2))
                        {
                            damage *= 0.50;         // 1/2 damage at 2 tile range
                        }
                        SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                        Caster.Heal((int)damage * (1 - m.ColdResistance / 100));
                        Caster.PrivateOverheadMessage(MessageType.Spell, 495, false, damage.ToString(), Caster.NetState);

                        Caster.FixedParticles(0x373A, 10, 30, 5013, 157, 4, EffectLayer.Waist);
                        m.FixedParticles(0x374A, 10, 30, 5013, 157, 4, EffectLayer.Waist);
                        m.PlaySound(0x4B2);
                    }
                    break;

                    case TeiravonMobile.Deity.Kinarugi:
                    {
                        damage = GetNewAosDamage(1, 2, 3, Caster.Player && m.Player);
                        int duration = GetNewAosDamage(8, 1, 3, Caster.Player && m.Player);
                        if (!MortalStrike.IsWounded(m))
                        {
                            MortalStrike.BeginWound(m, TimeSpan.FromSeconds(duration));
                        }

                        Timer m_Timer = new KinTimer(this, Caster, m, duration, (int)damage);
                        m_Timer.Start();

                        m.LocalOverheadMessage(MessageType.Spell, 250, false, duration.ToString());
                        m.FixedParticles(0x3789, 10, 30, 5013, 1888, 2, EffectLayer.Waist);
                        m.PlaySound(0x4B2);
                    }
                    break;

                    case TeiravonMobile.Deity.Lloth:
                    {
                        damage = GetNewAosDamage(10, 1, 5, Caster.Player && m.Player);

                        TavWebbing webbing = XmlAttach.FindAttachmentOnMobile(m, typeof(TavWebbing), "web") as TavWebbing;

                        if (webbing != null)
                        {
                            webbing.Expiration = TimeSpan.FromSeconds(3);
                            webbing.DoWebbing();
                        }
                        else
                        {
                            TavWebbing newweb = new TavWebbing(5);
                            newweb.Name = "web";
                            XmlAttach.AttachTo(m, newweb);
                        }
                        int web = Utility.RandomMinMax(3811, 3814);
                        Caster.MovingParticles(m, web, 12, 5, false, false, 0x377a, 0x377a, -1);
                        SpellHelper.Damage(this, m, damage, 50, 0, 0, 50, 0);
                        Spiderling spiderling = new Spiderling(Caster, m, TimeSpan.FromSeconds(5));
                        spiderling.Combatant = m;
                        Spells.Necromancy.AnimateDeadSpell.Register(Caster, spiderling);
                        spiderling.MoveToWorld(m.Location, m.Map);
                        spiderling.YellowHealthbar = true;
                        Caster.PlaySound(0x21B);
                    }
                    break;

                    case TeiravonMobile.Deity.Narindun:
                    {
                        SlayerEntry atkSlayer = SlayerGroup.GetEntryByName(SlayerName.DaemonDismissal);
                        int         val       = atkSlayer.Slays(m) ? 45 : 15;
                        damage = GetNewAosDamage(val, 1, 5, Caster.Player & m.Player);

                        SpellHelper.Damage(this, m, damage, 0, 0, 50, 0, 50);
                        m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
                        m.PlaySound(0x0FC);
                    }
                    break;

                    case TeiravonMobile.Deity.Occido:
                    {
                        int         val     = 0;
                        ArrayList   targets = new ArrayList();
                        SlayerEntry undead  = SlayerGroup.GetEntryByName(SlayerName.Silver);
                        foreach (Mobile u in m.GetMobilesInRange(5))
                        {
                            if (undead.Slays(u) || (u is TeiravonMobile && ((TeiravonMobile)u).IsUndead()))
                            {
                                val++;
                                targets.Add(u);
                            }
                        }
                        if (val > 0)
                        {
                            for (int i = 0; i < targets.Count; ++i)
                            {
                                Mobile x = (Mobile)targets[i];
                                Effects.SendMovingEffect(x, m, Utility.Random(0x1AE0, 4), 30, 10, false, false, 2004, 3);
                            }
                        }
                        val   *= 3;
                        damage = GetNewAosDamage(5 + val, 1, 5, Caster.Player & m.Player);

                        SpellHelper.Damage(this, m, damage, 0, 0, 50, 0, 50);
                        m.FixedParticles(0x1F1F, 10, 30, 5013, 2562, 3, EffectLayer.Waist);
                        m.PlaySound(0x44E);
                    }
                    break;

                    case TeiravonMobile.Deity.Saerin:
                    {
                        int rock = Utility.RandomMetalHue();
                        m.FixedParticles(0x2565, 15, 15, 5013, rock, 1, EffectLayer.Waist);
                        damage = GetNewAosDamage(15, 1, 5, Caster.Player & m.Player);
                        SpellHelper.Damage(this, m, damage, 100, 0, 0, 0, 0);
                        int           sound = Utility.RandomMinMax(0x3B8, 0x3BE);
                        ResistanceMod mod   = new ResistanceMod(ResistanceType.Physical, -15);
                        m.AddResistanceMod(mod);
                        m.PlaySound(sound);
                        SaerTimer timer = new SaerTimer(m, mod);
                        timer.Start();
                        if (m.PhysicalResistance <= 0)
                        {
                            m.Animate(21, 5, 1, false, false, 0);
                            m.Freeze(TimeSpan.FromSeconds(.5));
                        }
                    }
                    break;

                    case TeiravonMobile.Deity.Talathas:
                    {
                        BaseWeapon weap = Caster.Weapon as BaseWeapon;
                        weap.OnHit(Caster, m);
                        Caster.NextCombatTime = DateTime.Now;
                        int effect = weap is Fists ? 0x36FE : weap.ItemID;
                        m.FixedParticles(effect, 10, 30, 5013, 2360, 2, EffectLayer.Waist);
                    }
                    break;

                    case TeiravonMobile.Deity.Valar:
                    {
                        string  name    = Utility.Random(100).ToString();
                        StatMod themmod = new StatMod(StatType.Dex, "ValarDrain", (int)(m.Dex * -.33), TimeSpan.FromSeconds(15));
                        StatMod castmod = new StatMod(StatType.Dex, "ValarDrain", (int)(m.Dex * .33), TimeSpan.FromSeconds(15));
                        m.AddStatMod(themmod);
                        Caster.AddStatMod(castmod);
                        damage = GetNewAosDamage(15, 1, 5, Caster.Player & m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 0, 0, 50, 50);

                        m.FixedParticles(0x374A, 10, 30, 5013, 2364, 3, EffectLayer.Waist);
                        m.MovingParticles(Caster, 0x36E4, 10, 10, false, false, 2367, 3, 0x035, 0x36FE, 0x035, 0);
                        m.PlaySound(0x456);
                    }
                    break;
                    }
                }
                else
                {
                    SpellHelper.Turn(Caster, m);

                    SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

                    double damage;

                    if (Core.AOS)
                    {
                        damage = GetNewAosDamage(17, 1, 5, Caster.Player && m.Player);
                    }
                    else
                    {
                        damage = Utility.Random(1, 15);

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

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

                        damage *= GetDamageScalar(m);
                    }

                    /*
                     *              if ( !m.InRange( Caster, 2 ) )
                     *                  damage *= 0.25; // 1/4 damage at > 2 tile range
                     *              else if ( !m.InRange( Caster, 1 ) )
                     *                  damage *= 0.50; // 1/2 damage at 2 tile range
                     */
                    if (Core.AOS)
                    {
                        m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
                        m.PlaySound(0x0FC);
                    }
                    else
                    {
                        m.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist);
                        m.PlaySound(0x1F1);
                    }

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

            FinishSequence();
        }
Пример #9
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                Mobile source = Caster;


                SpellHelper.Turn(source, m);

                SpellHelper.CheckReflect((int)this.Circle, ref source, ref m);

                double damage;

                if (Caster is TeiravonMobile)
                {
                    TeiravonMobile tav = Caster as TeiravonMobile;

                    if (tav.IsAeromancer())
                    {
                        damage = GetNewAosDamage(19, 1, 5, Caster.Player && m.Player);
                        source.MovingParticles(m, 0x3728, 12, 0, false, false, 9502, 4019, 0x160);
                        source.PlaySound(0x5C7);

                        SpellHelper.Damage(this, m, damage, 0, 0, 50, 0, 50);
                        new Gust(tav, m).MoveToWorld(m.Location, m.Map);
                        FinishSequence();
                        return;
                    }
                    if (tav.IsGeomancer())
                    {
                        damage = GetNewAosDamage(21, 1, 5, Caster.Player && m.Player);
                        int randRock = Utility.RandomList(0x1364, 0x1365, 0x1366, 0x1366);
                        source.MovingParticles(m, randRock, 12, 0, false, false, 0x1E00, 0x1E00, 0x13B);
                        source.PlaySound(0x5BF);

                        SpellHelper.GeoDamage(this, m, damage);
                        m.Freeze(TimeSpan.FromSeconds(1));
                        FinishSequence();
                        return;
                    }

                    if (tav.IsAquamancer())
                    {
                        XmlData x = (XmlData)XmlAttach.FindAttachmentOnMobile(Caster, typeof(XmlData), "Cryomancer");
                        if (x != null && CheckSequence())
                        {
                            damage = GetNewAosDamage(20, 1, 5, Caster.Player && m.Player);
                            source.MovingParticles(m, 0x3678, 12, 5, false, false, 0x377a, 0x377a, 0x390);
                            source.PlaySound(0x390);

                            SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                            FinishSequence();
                            m.Send(SpeedMode.Walk);


                            TavChill chill = XmlAttach.FindAttachmentOnMobile(m, typeof(TavChill), "chill") as TavChill;

                            if (chill != null)
                            {
                                chill.Expiration = TimeSpan.FromSeconds(3);
                                chill.DoChill();
                            }
                            else
                            {
                                TavChill newchill = new TavChill(5);
                                newchill.Name = "chill";
                                XmlAttach.AttachTo(m, newchill);
                            }
                            return;
                        }
                        else
                        {
                            damage = GetNewAosDamage(25, 1, 5, Caster.Player && m.Player);
                            source.MovingParticles(m, 0x34FF, 12, 5, false, false, 0x377a, 0x377a, 0x027);
                            source.PlaySound(0x026);

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

                    if (tav.IsPyromancer())
                    {
                        damage = GetNewAosDamage(5, 1, 5, Caster.Player && m.Player);
                        source.MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
                        source.PlaySound(Core.AOS ? 0x15E : 0x44B);

                        SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
                        int   burntimes = 2 + Utility.Random(5);
                        Timer m_Timer   = new IgniteTimer(tav, m, 1, burntimes, DateTime.Now + TimeSpan.FromSeconds(0.5));
                        m_Timer.Start();
                        FinishSequence();
                        return;
                    }
                }

                if (Core.AOS)
                {
                    damage = GetNewAosDamage(19, 1, 5, Caster.Player && m.Player);
                }
                else
                {
                    damage = Utility.Random(10, 7);

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

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

                    damage *= GetDamageScalar(m);
                }

                source.MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
                source.PlaySound(Core.AOS ? 0x15E : 0x44B);

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

            FinishSequence();
        }
Пример #10
0
        public bool Cast()
        {
            bool GoblinHarm   = false;
            bool TalathasHarm = false;

            if (m_Caster.Player)
            {
                TeiravonMobile m_Person = (TeiravonMobile)m_Caster;

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Jareth)
                {
                    GoblinHarm = true;
                }

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Talathas)
                {
                    TalathasHarm = true;
                }
                //m_Person.SendMessage( "Type: {0}", this /*, m_Caster.Spell.GetType() */ );

                if (!m_Person.Magicable && !(m_Scroll is BaseWand) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast spells.");
                    return(false);
                }
//				else if ( (this is NecromancerSpell) && !m_Person.IsNecromancer() )
//				{
//					m_Caster.SendMessage( "Only necromancers can cast that." );
//					return false;
//				}
                else if ((this is PaladinSpell) && m_Person.Skills.Chivalry.Base < 25.0)
                {
                    m_Caster.SendMessage("Only a true paladin can cast that.");
                    return(false);
                }
                else if ((this is NecromancerSpell) && !m_Person.HasFeat(TeiravonMobile.Feats.NecroSpellbook))
                {
                    m_Caster.SendMessage("You have not learned advanced necromancy.");
                    return(false);
                }
                else if (!(this is NecromancerSpell) && !(this is PaladinSpell) && !m_Person.CanCast(m_Info.Name) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast this spell!");
                    return(false);
                }

                if (m_Person.Mounted)
                {
                    int fallchance = 0;

                    if (m_Person.RidingSkill == 0)
                    {
                        fallchance = 20;
                    }
                    else if (m_Person.RidingSkill == 1)
                    {
                        fallchance = 10;
                    }
                    else if (m_Person.RidingSkill == 2)
                    {
                        fallchance = 5;
                    }

                    if (fallchance > Utility.RandomMinMax(1, 100))
                    {
                        m_Person.OnDoubleClick(m_Person);
                        m_Person.Damage(Utility.RandomMinMax(1, 10), m_Person);
                        m_Person.SendMessage("You fall off your mount while casting");
                    }
                }
            }

            m_StartCastTime = DateTime.Now;

            if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!m_Caster.CheckAlive())
            {
                return(false);
            }
            else if (XmlAttach.FindAttachmentOnMobile(m_Caster, typeof(XmlData), "silenced") != null)
            {
                m_Caster.SendMessage("You cannot cast spells right now.");
                return(false);
            }
            else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendLocalizedMessage(502643);                   // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime)
            {
                m_Caster.SendLocalizedMessage(502644);                   // You must wait for that spell to have an effect.
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    m_State        = SpellState.Casting;
                    m_Caster.Spell = this;

                    if (RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    //SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    if (GoblinHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.25);
                    }

                    if (TalathasHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.5);
                    }

                    if (m_Caster.Body.IsHuman)
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (m_Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (m_Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    OnBeginCast();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana
            }

            return(false);
        }
Пример #11
0
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                XmlData x = (XmlData)XmlAttach.FindAttachmentOnMobile(Caster, typeof(XmlData), "Cryomancer");
                if (x != null)
                {
                    if (map != null)
                    {
                        foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
                        {
                            if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)))
                            {
                                targets.Add(m);
                            }
                        }
                    }
                    DoIceNova(GetNewAosDamage(30, 1, 12, false), Caster, targets);
                }
                else
                {
                    if (map != null)
                    {
                        foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
                        {
                            if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)))
                            {
                                targets.Add(m);
                            }
                        }
                    }

                    Caster.PlaySound(0x2F3);

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

                        int damage;

                        if (Core.AOS)
                        {
                            damage = m.Hits / 4;

                            if (damage < 10)
                            {
                                damage = 10;
                            }
                            else if (damage > 100)
                            {
                                damage = 100;
                            }

                            damage = GetNewAosDamage(damage, 1, 5, m.Player);
                        }
                        else
                        {
                            damage = (m.Hits * 6) / 10;

                            if (!m.Player && damage < 10)
                            {
                                damage = 10;
                            }
                            else if (damage > 75)
                            {
                                damage = 75;
                            }
                        }

                        Caster.DoHarmful(m);
                        SpellHelper.Damage(TimeSpan.Zero, m, Caster, damage, 100, 0, 0, 0, 0);
                    }
                }
            }
            FinishSequence();
        }