Example #1
0
        /// <summary>
        /// Trigger all spells that might be triggered by the given Spell
        /// </summary>
        /// <param name="spell"></param>
        internal void TriggerSpellsFor(SpellCast cast)
        {
            if (m_TargetTriggers == null)
            {
                return;
            }

            int val;
            var spell = cast.Spell;

            for (var i = 0; i < m_TargetTriggers.Count; i++)
            {
                var triggerHandler = m_TargetTriggers[i];
                var effect         = triggerHandler.SpellEffect;
                if (effect.EffectType == SpellEffectType.TriggerSpellFromTargetWithCasterAsTarget)
                {
                    continue;
                }
                if (spell.SpellClassSet == effect.Spell.SpellClassSet &&
                    effect.MatchesSpell(spell) &&
                    (((val = effect.CalcEffectValue(Owner)) >= 100) || Utility.Random(0, 101) <= val) &&
                    spell != effect.TriggerSpell)                       // prevent inf loops
                {
                    var caster = triggerHandler.Aura.CasterUnit;
                    if (caster != null)
                    {
                        //cast.Trigger(effect.TriggerSpell, cast.Targets.MakeArray());
                        cast.Trigger(effect.TriggerSpell);
                    }
                }
            }
        }
 void RunSpell(Unit target, uint spellId)
 {
     if(Util.Utility.Random(0,101)>Cast.Spell.ProcChance)
         return;
    
     Spell spell = SpellHandler.Get(spellId);
     
     if (spell != null)
     {
         Vector3 loc = target.Position;
         SpellCast.Trigger(m_cast.CasterUnit, spell, ref loc, target);
     }
 }
        private void RunSpell(Unit target, uint spellId)
        {
            if ((long)Utility.Random(0, 101) > (long)this.Cast.Spell.ProcChance)
            {
                return;
            }
            Spell spell = SpellHandler.Get(spellId);

            if (spell == null)
            {
                return;
            }
            Vector3 position = target.Position;

            SpellCast.Trigger((WorldObject)this.m_cast.CasterUnit, spell, ref position, (WorldObject)target);
        }
Example #4
0
        /// <summary>
        /// Trigger all spells that might be triggered by the given Spell
        /// </summary>
        /// <param name="spell"></param>
        internal void TriggerSpellsFor(SpellCast cast)
        {
            if (this.m_TargetTriggers == null)
            {
                return;
            }
            Spell spell = cast.Spell;

            for (int index = 0; index < this.m_TargetTriggers.Count; ++index)
            {
                AddTargetTriggerHandler targetTrigger = this.m_TargetTriggers[index];
                SpellEffect             spellEffect   = targetTrigger.SpellEffect;
                int num;
                if (spellEffect.EffectType != SpellEffectType.TriggerSpellFromTargetWithCasterAsTarget &&
                    spell.SpellClassSet == spellEffect.Spell.SpellClassSet && spellEffect.MatchesSpell(spell) &&
                    (((num = spellEffect.CalcEffectValue(this.Owner)) >= 100 || Utility.Random(0, 101) <= num) &&
                     (spell != spellEffect.TriggerSpell && targetTrigger.Aura.CasterUnit != null)))
                {
                    cast.Trigger(spellEffect.TriggerSpell, new WorldObject[0]);
                }
            }
        }
Example #5
0
		/// <summary>
		/// Trigger all spells that might be triggered by the given Spell
		/// </summary>
		/// <param name="spell"></param>
		public void TriggerSpellsFor(SpellCast cast)
		{
			int val;
			var spell = cast.Spell;
			for (var i = 0; i < TargetTriggers.Count; i++)
			{
				var triggerHandler = TargetTriggers[i];
				var effect = triggerHandler.SpellEffect;
				if (spell.SpellClassSet == effect.Spell.SpellClassSet &&
					spell.MatchesMask(effect.AffectMask) &&
					(((val = effect.CalcEffectValue(Owner)) >= 100) || Utility.Random(0, 101) <= val) &&
					spell != effect.TriggerSpell)	// prevent inf loops
				{
					var caster = triggerHandler.Aura.Caster;
					if (caster != null)
					{
						//cast.Trigger(effect.TriggerSpell, cast.Targets.MakeArray());
						cast.Trigger(effect.TriggerSpell);
					}
				}
			}
		}