示例#1
0
        /// <summary>
        /// Whether this effect can share targets with the given effect
        /// </summary>
        public bool SharesTargetsWith(SpellEffect b, bool aiCast)
        {
            // if a TargetDefinition is set, it overrides the default implicit targets
            var targetDef = GetTargetDefinition(aiCast);

            return((targetDef != null && targetDef.Equals(b.GetTargetDefinition(aiCast))) ||
                   (ImplicitTargetA == b.ImplicitTargetA && ImplicitTargetB == b.ImplicitTargetB));
        }
示例#2
0
        public SpellFailedReason FindAllTargets()
        {
            this.IsInitialized = true;
            WorldObject casterObject = this.Cast.CasterObject;

            if (casterObject == null)
            {
                SpellTargetCollection.log.Warn("Invalid SpellCast - Tried to find targets, without Caster set: {0}",
                                               (object)casterObject);
                return(SpellFailedReason.Error);
            }

            SpellEffect effect = this.FirstHandler.Effect;

            if (effect.Spell.IsPreventionDebuff)
            {
                SpellFailedReason spellFailedReason = SpellFailedReason.Ok;
                foreach (SpellEffectHandler handler in this.m_handlers)
                {
                    spellFailedReason = handler.ValidateAndInitializeTarget(casterObject);
                    if (spellFailedReason != SpellFailedReason.Ok)
                    {
                        return(spellFailedReason);
                    }
                }

                this.Add(casterObject);
                return(spellFailedReason);
            }

            SpellFailedReason spellFailedReason1 = SpellFailedReason.Ok;
            TargetDefinition  targetDefinition   = effect.GetTargetDefinition();

            if (targetDefinition != null)
            {
                SpellFailedReason failReason = SpellFailedReason.Ok;
                targetDefinition.Collect(this, ref failReason);
            }
            else
            {
                if (effect.ImplicitTargetA != ImplicitSpellTargetType.None)
                {
                    spellFailedReason1 = this.FindTargets(effect.ImplicitTargetA);
                    if (spellFailedReason1 != SpellFailedReason.Ok)
                    {
                        return(spellFailedReason1);
                    }
                }

                if (effect.ImplicitTargetB != ImplicitSpellTargetType.None)
                {
                    spellFailedReason1 = this.FindTargets(effect.ImplicitTargetB);
                }
            }

            return(spellFailedReason1);
        }
示例#3
0
        /// <summary>
        /// Whether this effect can share targets with the given effect
        /// </summary>
        public bool SharesTargetsWith(SpellEffect b)
        {
            TargetDefinition targetDefinition = GetTargetDefinition();

            if (targetDefinition != null && targetDefinition.Equals(b.GetTargetDefinition()))
            {
                return(true);
            }
            if (ImplicitTargetA == b.ImplicitTargetA)
            {
                return(ImplicitTargetB == b.ImplicitTargetB);
            }
            return(false);
        }
示例#4
0
		/// <summary>
		/// Whether this effect can share targets with the given effect
		/// </summary>
		public bool SharesTargetsWith(SpellEffect b, bool aiCast)
		{
			// if a TargetDefinition is set, it overrides the default implicit targets
			var targetDef = GetTargetDefinition(aiCast);
			return (targetDef != null && targetDef.Equals(b.GetTargetDefinition(aiCast))) ||
				(ImplicitTargetA == b.ImplicitTargetA && ImplicitTargetB == b.ImplicitTargetB);
		}