Inheritance: ISpell
Exemple #1
0
		public static TimeSpan GetDamageDelayForSpell( Spell sp )
		{
			if( !sp.DelayedDamage )
				return TimeSpan.Zero;

			return OldDamageDelay;
		}
		public static TimeSpan GetDamageDelayForSpell( Spell sp )
		{
			if( !sp.DelayedDamage )
				return TimeSpan.Zero;

			return (Core.AOS ? AosDamageDelay : OldDamageDelay);
		}
		public bool AllowSpellCast( Mobile from, Spell spell )
		{
			if ( !m_StartedBeginCountdown )
				return true;

            if (spell == null) return false;

            Type spellType = spell.GetType();
            foreach (Type alwaysdisallowed in m_AlwaysDisallowedSpells)
            {
                if (alwaysdisallowed == spellType)
                    return false;
            }

			DuelPlayer pl = Find( from );

			if ( pl == null || pl.Eliminated )
				return true;

			if ( CantDoAnything( from ) )
				return false;

			string title = null, option = null;

            if( spell is MagerySpell )
			{
				switch( ((MagerySpell)spell).Circle )
				{
					case SpellCircle.First: title = "1st Circle"; break;
					case SpellCircle.Second: title = "2nd Circle"; break;
					case SpellCircle.Third: title = "3rd Circle"; break;
					case SpellCircle.Fourth: title = "4th Circle"; break;
					case SpellCircle.Fifth: title = "5th Circle"; break;
					case SpellCircle.Sixth: title = "6th Circle"; break;
					case SpellCircle.Seventh: title = "7th Circle"; break;
					case SpellCircle.Eighth: title = "8th Circle"; break;
				}

				option = spell.Name;
			}
			else
			{
				title = "Other Spell";
				option = spell.Name;
			}

			if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
				return true;

			from.SendMessage( "The dueling ruleset prevents you from casting this spell." );
			return false;
		}
		public static TimeSpan GetDamageDelayForSpell(Spell sp)
		{
			if (sp == null)
			{
				return TimeSpan.Zero;
			}

			if (!sp.DelayedDamage)
			{
				return TimeSpan.Zero;
			}

			return OldDamageDelay;
		}
Exemple #5
0
        public static void Damage(Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois, int nrgy, DFAlgorithm dfa)
        {
            TimeSpan ts = GetDamageDelayForSpell(spell);

            Damage(spell, ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy, dfa);
        }
Exemple #6
0
        public static void Damage(Spell spell, Mobile target, double damage)
        {
            TimeSpan ts = GetDamageDelayForSpell(spell);

            Damage(spell, ts, target, spell.Caster, damage);
        }
Exemple #7
0
            public AnimTimer( Spell spell, int count )
                : base(TimeSpan.Zero, AnimateDelay - TimeSpan.FromSeconds(0.25), count)
            {
                m_Spell = spell;

                Priority = TimerPriority.FiftyMS;
            }
 public HailstormTimer(Mobile caster, Spell spell, List<Mobile> toEffect, Rectangle2D area)
     : base(TimeSpan.FromMilliseconds(100.0), TimeSpan.FromMilliseconds(100.0))
 {
     m_ToEffect = toEffect;
     m_EffectArea = area;
     m_Caster = caster;
     m_Map = caster.Map;
     m_Spell = spell;
     Start();
 }
		public bool AllowSpellCast( Mobile from, Spell spell )
		{
			if ( !m_StartedBeginCountdown )
				return true;

			DuelPlayer pl = Find( from );

			if ( pl == null || pl.Eliminated )
				return true;

			if ( CantDoAnything( from ) )
				return false;

			if ( spell is Server.Spells.Fourth.RecallSpell )
				from.SendMessage( "You may not cast this spell." );

			string title = null, option = null;

			if( spell is ArcanistSpell )
			{
				title = "Spellweaving";
				option = spell.Name;
			}
			else if ( spell is PaladinSpell )
			{
				title = "Chivalry";
				option = spell.Name;
			}
			else if ( spell is NecromancerSpell )
			{
				title = "Necromancy";
				option = spell.Name;
			}
			else if ( spell is NinjaSpell )
			{
				title = "Ninjitsu";
				option = spell.Name;
			}
			else if ( spell is SamuraiSpell )
			{
				title = "Bushido";
				option = spell.Name;
			}
			else if( spell is MagerySpell )
			{
				switch( ((MagerySpell)spell).Circle )
				{
					case SpellCircle.First: title = "1st Circle"; break;
					case SpellCircle.Second: title = "2nd Circle"; break;
					case SpellCircle.Third: title = "3rd Circle"; break;
					case SpellCircle.Fourth: title = "4th Circle"; break;
					case SpellCircle.Fifth: title = "5th Circle"; break;
					case SpellCircle.Sixth: title = "6th Circle"; break;
					case SpellCircle.Seventh: title = "7th Circle"; break;
					case SpellCircle.Eighth: title = "8th Circle"; break;
				}

				option = spell.Name;
			}
			else
			{
				title = "Other Spell";
				option = spell.Name;
			}

			if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
				return true;

			from.SendMessage( "The dueling ruleset prevents you from casting this spell." );
			return false;
		}
Exemple #10
0
        public static void Damage(Spell spell, Mobile target, double damage)
        {
            TimeSpan ts = GetDamageDelayForSpell(spell);

            Damage(spell, ts, target, spell.Caster, damage);
        }
		/// <summary>
		///     Checks for any triggers existing on "thisMob", returns true if a trigger signalled to override the
		///     handler that it came from
		/// </summary>
		/// <returns>true if a trigger execution signalled to override the handler that called Trigger</returns>
		public static bool Trigger(
			IEntity thisObj,
			Mobile trigMob,
			TriggerName trigName,
			Item item = null,
			string spoken = null,
			Spell spell = null,
			int damage = 0,
			object targeted = null,
			SkillName skillName = SkillName.Spellweaving,
			double skillValue = 0.0) // spellweaving is just a placeholder
		{
			var scripts = XmlAttach.GetScripts(thisObj);
			bool result = false;

			if (scripts != null)
			{
				TriggerObject trigObject = new TriggerObject
				{
					TrigName = trigName,
					This = thisObj,
					TrigMob = trigMob,
					TrigItem = item,
					Spell = spell,
					Damage = damage,
					Speech = spoken,
					Targeted = targeted,
					SkillName = skillName,
					SkillValue = skillValue
				};

				int count = 0;

				foreach (XmlScript script in scripts)
				{
					count++;

					// make sure each script has its own TriggerObjects
					if (script.Execute(count < scripts.Count ? trigObject.Dupe() : trigObject, true))
					{
						// returns true if there is an override
						result = true;
					}
				}
			}

			return result;
		}
Exemple #12
0
            public CastTimer(Spell spell, TimeSpan castDelay) : base(castDelay)
            {
                m_Spell = spell;

                Priority = TimerPriority.TwentyFiveMS;
            }
Exemple #13
0
            public AnimTimer(Spell spell, int count) : base(TimeSpan.Zero, AnimateDelay, count)
            {
                m_Spell = spell;

                Priority = TimerPriority.FiftyMS;
            }
Exemple #14
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);
        }
Exemple #15
0
        public static void Damage(Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois, int nrgy, DFAlgorithm dfa)
        {
            TimeSpan ts = GetDamageDelayForSpell(spell);

            Damage(spell, ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy, dfa);
        }
Exemple #16
0
            public SpellDamageTimer(Spell s, Mobile target, Mobile from, int damage, TimeSpan delay)
                : base(delay)
            {
                this.m_Target = target;
                this.m_From = from;
                this.m_Damage = damage;
                this.m_Spell = s;

                if (this.m_Spell != null && this.m_Spell.DelayedDamage && !this.m_Spell.DelayedDamageStacking)
                    this.m_Spell.StartDelayedDamageContext(target, this);

                this.Priority = TimerPriority.TwentyFiveMS;
            }
Exemple #17
0
        public static bool CheckCast(Mobile caster, Spell spell)
        {
            if (Factions.Sigil.ExistsOn(caster))
            {
                caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
                return false;
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
                return false;
            }
            else if (AnimalForm.UnderTransformation(caster))
            {
                caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
                return false;
            }

            return true;
        }
 public HordeMinionsEyesSpellTarget( Spell spell )
     : base(10, false, TargetFlags.None)
 {
     m_Spell = spell;
 }
Exemple #19
0
		public static bool OnCast( Mobile caster, Spell spell )
		{
			ITransformationSpell transformSpell = spell as ITransformationSpell;

			if( transformSpell == null )
				return false;

			if( !caster.CanBeginAction( typeof( PolymorphSpell ) ) )
			{
				caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
			}
			else if ( DisguiseTimers.IsDisguised( caster ) )
			{
				caster.SendLocalizedMessage( 1061631 ); // You can't do that while disguised.
				return false;
			}
			else if( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) )
			{
				spell.DoFizzle();
			}
			else if( spell.CheckSequence() )
			{
				TransformContext context = GetContext( caster );
				Type ourType = spell.GetType();

				bool wasTransformed = (context != null);
				bool ourTransform = (wasTransformed && context.Type == ourType);

				if( wasTransformed )
				{
					RemoveContext( caster, context, ourTransform );

					if( ourTransform )
					{
						caster.PlaySound( 0xFA );
						caster.FixedParticles( 0x3728, 1, 13, 5042, EffectLayer.Waist );
					}
				}

				if( !ourTransform )
				{
					if( !((Body)transformSpell.Body).IsHuman )
					{
						Mobiles.IMount mt = caster.Mount;

						if( mt != null )
							mt.Rider = null;
					}

					caster.BodyMod = transformSpell.Body;
					caster.HueMod = transformSpell.Hue;

					transformSpell.DoEffect( caster );

					Timer timer = new TransformTimer( caster, transformSpell );
					timer.Start();

					AddContext( caster, new TransformContext( timer, ourType, transformSpell ) );
					return true;
				}
			}

			return false;
		}
			public static bool ISDIRECTDAMAGESPELL(TriggerObject trigObject, Spell spell)
			{
				if (spell == null)
				{
					return false;
				}

				return spell is MagicArrowSpell || spell is HarmSpell || spell is FireballSpell || spell is LightningSpell ||
					   spell is MindBlastSpell || spell is EnergyBoltSpell || spell is ExplosionSpell || spell is FlameStrikeSpell ||
					   spell is MeteorSwarmSpell || spell is ChainLightningSpell;
			}
Exemple #21
0
        private TimeSpan GetDelay(Spell spell)
        {
            if (SmartAI || (spell is DispelSpell))
            {
                return TimeSpan.FromSeconds(m_Mobile.ActiveSpeed);
            }
            else
            {
                double del = ScaleBySkill(3.0, SkillName.Magery);
                double min = 6.0 - (del * 0.75);
                double max = 6.0 - (del * 1.25);

                return TimeSpan.FromSeconds(min + ((max - min) * Utility.RandomDouble()));
            }
        }
			public static bool ISOFFENSIVESPELL(TriggerObject trigObject, Spell spell)
			{
				if (spell == null)
				{
					return false;
				}

				return spell is MagicArrowSpell || spell is ClumsySpell || spell is FeeblemindSpell || spell is WeakenSpell ||
					   spell is HarmSpell || spell is FireballSpell || spell is PoisonSpell || spell is LightningSpell ||
					   spell is ManaDrainSpell || spell is MindBlastSpell || spell is ParalyzeSpell || spell is EnergyBoltSpell ||
					   spell is ExplosionSpell || spell is MassCurseSpell || spell is FlameStrikeSpell || spell is MeteorSwarmSpell ||
					   spell is ChainLightningSpell;
			}
Exemple #23
0
			public AnimTimer( Spell spell, int count ) : base( TimeSpan.Zero, AnimateDelay, count )
			{
				m_Spell = spell;

				Priority = TimerPriority.FiftyMS;
			}
			public static bool CHECKBSPELLSEQUENCE(TriggerObject trigObject, Spell spell, Mobile target, bool allowDead)
			{
				return spell != null && spell.CheckBSequence(target, allowDead);
			}
Exemple #25
0
		public void Cast( Spell spell )
		{
			bool m = Movable;

			Movable = false;
			spell.Cast();
			Movable = m;
		}
			public static bool CHECKSPELLSEQUENCE(TriggerObject trigObject, Spell spell)
			{
				return spell != null && spell.CheckSequence();
			}
Exemple #27
0
            public CastTimer( Spell spell, TimeSpan castDelay )
                : base(castDelay)
            {
                m_Spell = spell;

                Priority = TimerPriority.TwentyFiveMS;
            }
Exemple #28
0
        public static bool CheckCast( Mobile caster, Spell spell )
        {
            if( !caster.CanBeginAction(typeof(Spells.Seventh.PolymorphSpell)) )
            {
                caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
                return false;
            }

            return true;
        }
Exemple #29
0
        public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage)
        {
            int iDamage = (int)damage;

            if (delay == TimeSpan.Zero)
            {
                if (from is BaseCreature)
                    ((BaseCreature)from).AlterSpellDamageTo(target, ref iDamage);

                if (target is BaseCreature)
                    ((BaseCreature)target).AlterSpellDamageFrom(from, ref iDamage);

                target.Damage(iDamage, from);
            }
            else
            {
                new SpellDamageTimer(spell, target, from, iDamage, delay).Start();
            }

            if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
            {
                BaseCreature c = (BaseCreature)target;

                c.OnHarmfulSpell(from);
                c.OnDamagedBySpell(from);
            }
        }
Exemple #30
0
        public static void Damage( Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois, int nrgy )
        {
            TimeSpan ts = GetDamageDelayForSpell(spell);

            if (target is Player)
            {
                Monk mk = Perk.GetByType<Monk>((Player)target);
                if (mk != null && mk.ParrySpell())
                {
                    return;
                }

                Warlock wlk = Perk.GetByType<Warlock>((Player)target);
                if (wlk != null && wlk.ParrySpell())
                {
                    return;
                }
            }

            if (spell.Caster is Player)
            {
                Warlock wlk = Perk.GetByType<Warlock>((Player)spell.Caster);
                if (wlk != null && wlk.Overclock())
                {
                    damage += (int)(damage * .33);
                }
            }

            Damage(spell, ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy, DFAlgorithm.Standard);
        }
Exemple #31
0
        public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage, int phys, int fire, int cold, int pois, int nrgy, DFAlgorithm dfa)
        {
            int iDamage = (int)damage;

            if (delay == TimeSpan.Zero)
            {
                if (from is BaseCreature)
                    ((BaseCreature)from).AlterSpellDamageTo(target, ref iDamage);

                if (target is BaseCreature)
                    ((BaseCreature)target).AlterSpellDamageFrom(from, ref iDamage);

                WeightOverloading.DFA = dfa;

                int damageGiven = AOS.Damage(target, from, iDamage, phys, fire, cold, pois, nrgy);

                if (from != null) // sanity check
                {
                    DoLeech(damageGiven, from, target);
                }

                WeightOverloading.DFA = DFAlgorithm.Standard;
            }
            else
            {
                new SpellDamageTimerAOS(spell, target, from, iDamage, phys, fire, cold, pois, nrgy, delay, dfa).Start();
            }

            if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
            {
                BaseCreature c = (BaseCreature)target;

                c.OnHarmfulSpell(from);
                c.OnDamagedBySpell(from);
            }
        }
Exemple #32
0
        public void Cast(Spell spell)
        {
            bool m = this.Movable;

            this.Movable = false;
            spell.Cast();
            this.Movable = m;
        }
Exemple #33
0
            public SpellDamageTimerAOS(Spell s, Mobile target, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, TimeSpan delay, DFAlgorithm dfa)
                : base(delay)
            {
                this.m_Target = target;
                this.m_From = from;
                this.m_Damage = damage;
                this.m_Phys = phys;
                this.m_Fire = fire;
                this.m_Cold = cold;
                this.m_Pois = pois;
                this.m_Nrgy = nrgy;
                this.m_DFA = dfa;
                this.m_Spell = s;
                if (this.m_Spell != null && this.m_Spell.DelayedDamage && !this.m_Spell.DelayedDamageStacking)
                    this.m_Spell.StartDelayedDamageContext(target, this);

                this.Priority = TimerPriority.TwentyFiveMS;
            }
Exemple #34
0
 public NightSightTarget( Spell spell )
     : base(12, false, TargetFlags.Beneficial)
 {
     m_Spell = spell;
 }
Exemple #35
0
        public static bool OnCast(Mobile caster, Spell spell)
        {
            ITransformationSpell transformSpell = spell as ITransformationSpell;

            if (transformSpell == null)
                return false;

            if (Factions.Sigil.ExistsOn(caster))
            {
                caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
            }
            else if (DisguiseTimers.IsDisguised(caster))
            {
                caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
                return false;
            }
            else if (AnimalForm.UnderTransformation(caster))
            {
                caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
            }
            else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || (caster.IsBodyMod && GetContext(caster) == null))
            {
                spell.DoFizzle();
            }
            else if (spell.CheckSequence())
            {
                TransformContext context = GetContext(caster);
                Type ourType = spell.GetType();

                bool wasTransformed = (context != null);
                bool ourTransform = (wasTransformed && context.Type == ourType);

                if (wasTransformed)
                {
                    RemoveContext(caster, context, ourTransform);

                    if (ourTransform)
                    {
                        caster.PlaySound(0xFA);
                        caster.FixedParticles(0x3728, 1, 13, 5042, EffectLayer.Waist);
                    }
                }

                if (!ourTransform)
                {
                    List<ResistanceMod> mods = new List<ResistanceMod>();

                    if (transformSpell.PhysResistOffset != 0)
                        mods.Add(new ResistanceMod(ResistanceType.Physical, transformSpell.PhysResistOffset));

                    if (transformSpell.FireResistOffset != 0)
                        mods.Add(new ResistanceMod(ResistanceType.Fire, transformSpell.FireResistOffset));

                    if (transformSpell.ColdResistOffset != 0)
                        mods.Add(new ResistanceMod(ResistanceType.Cold, transformSpell.ColdResistOffset));

                    if (transformSpell.PoisResistOffset != 0)
                        mods.Add(new ResistanceMod(ResistanceType.Poison, transformSpell.PoisResistOffset));

                    if (transformSpell.NrgyResistOffset != 0)
                        mods.Add(new ResistanceMod(ResistanceType.Energy, transformSpell.NrgyResistOffset));

                    if (!((Body)transformSpell.Body).IsHuman)
                    {
                        Mobiles.IMount mt = caster.Mount;

                        if (mt != null)
                            mt.Rider = null;
                    }

                    caster.BodyMod = transformSpell.Body;
                    caster.HueMod = transformSpell.Hue;

                    for (int i = 0; i < mods.Count; ++i)
                        caster.AddResistanceMod(mods[i]);

                    transformSpell.DoEffect(caster);

                    Timer timer = new TransformTimer(caster, transformSpell);
                    timer.Start();

                    AddContext(caster, new TransformContext(timer, mods, ourType, transformSpell));
                    return true;
                }
            }

            return false;
        }
Exemple #36
0
 public TempeteTarget(Spell spell)
     : base(12, true, TargetFlags.Beneficial)
 {
     m_Spell = spell;
 }