예제 #1
0
 /// <summary>
 /// Return wether the given Mechanic applies to the Owner
 /// </summary>
 public bool IsMechanic(SpellMechanic mechanic)
 {
     if (m_mechanics == null)
     {
         return(false);
     }
     return(m_mechanics[(int)mechanic] > 0);
 }
예제 #2
0
        // TODO: ModDamageTaken and ModDamageTakenPercent
        //public int GetDmgResistance(DamageType school)
        //{
        //    if (m_dmgResist == null) {
        //        return 0;
        //    }

        //    m_dmgResist[(int)school] += value;
        //}

        ///// <summary>
        ///// Adds resistance against certain damage
        ///// </summary>
        //public void SetDmgnNullifier(DamageType school, int value)
        //{
        //    if (m_dmgResist == null) {
        //        m_dmgResist = CreateDamageSchoolArr();
        //    }

        //    m_dmgResist[(int)school] += value;
        //}
        #endregion

        #region Mechanic Resistance
        /// <summary>
        /// Returns the resistance chance for the given SpellMechanic
        /// </summary>
        public int GetMechanicResistance(SpellMechanic mechanic)
        {
            if (m_mechanicResistances == null)
            {
                return(0);
            }
            return(m_mechanicResistances[(int)mechanic]);
        }
예제 #3
0
 /// <summary>
 /// Returns the duration modifier for a certain SpellMechanic
 /// </summary>
 public int GetMechanicDurationMod(SpellMechanic mechanic)
 {
     if (m_mechanicDurationMods == null || mechanic == SpellMechanic.None)
     {
         return(0);
     }
     return(m_mechanicDurationMods[(int)mechanic]);
 }
예제 #4
0
        /// <summary>
        /// whether this Unit completely resists a spell
        /// </summary>
        public bool CheckResist(Unit attacker, DamageSchool school, SpellMechanic mechanic)
        {
            if (Utility.Random(0f, 100f) <
                GetMechanicResistance(mechanic) -
                GetAttackerSpellHitChanceMod(school) +
                GetResistChancePct(attacker, school))
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        ///// <summary>
        ///// Adds immunity against given SpellMechanic-school
        ///// </summary>
        //public void IncMechImmunityCount( SpellMechanic mechanic )
        //{
        //    if ( m_mechanicImmunities == null )
        //    {
        //        m_mechanicImmunities = CreateMechanicsArr();
        //    }
        //    int val = m_mechanicImmunities[(int)mechanic];

        //    if ( val == 0 )
        //    {
        //        // new immunity: Gets rid of all Auras that use this Mechanic
        //        m_owner.Auras.RemoveWhere( ( aura ) =>
        //        {
        //            return aura.Spell.Mechanic == mechanic;
        //        } );
        //    }

        //    m_mechanicImmunities[(int)mechanic]++;
        //}

        /// <summary>
        /// Decreases immunity-count against given SpellMechanic-school
        /// </summary>
        public void DecMechImmunityCount(SpellMechanic mechanic)
        {
            if (m_mechanicImmunities == null)
            {
                return;
            }
            int val = m_mechanicImmunities[(int)mechanic];

            if (val > 0)
            {
                m_mechanicImmunities[(int)mechanic]--;
            }
        }
예제 #6
0
        /// <summary>
        /// Indicates wether the owner is immune against the given SpellMechanic
        /// </summary>
        public bool IsImmune(SpellMechanic mechanic)
        {
            if (IsInvulnerable)
            {
                return(true);
            }
            if (mechanic == SpellMechanic.None)
            {
                return(false);
            }

            return(m_mechanicImmunities != null && m_mechanicImmunities[(int)mechanic] > 0);
        }
예제 #7
0
파일: Stun.cs 프로젝트: ray2006/WCell
		protected internal override void Apply()
		{
			mechanic = SpellEffect.Mechanic;
			if (mechanic == SpellMechanic.None)
			{
				mechanic = SpellEffect.Spell.Mechanic;
				if (mechanic == SpellMechanic.None || mechanic == SpellMechanic.Invulnerable || mechanic == SpellMechanic.Invulnerable_2)
				{
					mechanic = SpellMechanic.Stunned;
				}
			}
			m_aura.Auras.Owner.IncMechanicCount(mechanic);
		}
예제 #8
0
        /// <summary>
        /// Changes the amount of resistance against certain SpellMechanics
        /// </summary>
        public void ModMechanicResistance(SpellMechanic mechanic, int delta)
        {
            if (m_mechanicResistances == null)
            {
                m_mechanicResistances = CreateMechanicsArr();
            }
            int val = m_mechanicResistances[(int)mechanic] + delta;

            if (val < 0)
            {
                val = 0;
            }
            m_mechanicResistances[(int)mechanic] = val;
        }
예제 #9
0
        /// <summary>
        /// Changes the duration-modifier for a certain SpellMechanic in %
        /// </summary>
        public void ModMechanicDurationMod(SpellMechanic mechanic, int delta)
        {
            if (m_mechanicDurationMods == null)
            {
                m_mechanicDurationMods = CreateMechanicsArr();
            }
            int val = m_mechanicDurationMods[(int)mechanic] + delta;

            if (val < 0)
            {
                val = 0;
            }
            m_mechanicDurationMods[(int)mechanic] = val;
        }
예제 #10
0
파일: Stun.cs 프로젝트: MeaNone/WCell
		protected override void Apply()
		{
			mechanic = SpellEffect.Mechanic;
			if (mechanic == SpellMechanic.None)
			{
				mechanic = m_aura.Spell.Mechanic;
				if (mechanic == SpellMechanic.None || mechanic == SpellMechanic.Invulnerable || mechanic == SpellMechanic.Invulnerable_2)
				{
					mechanic = SpellMechanic.Stunned;
				}
			}

			if (m_aura.Spell.SchoolMask == Constants.DamageSchoolMask.Frost)
				m_aura.Auras.Owner.IncMechanicCount(SpellMechanic.Frozen);

			m_aura.Auras.Owner.IncMechanicCount(mechanic);
		}
예제 #11
0
		/// <summary>
		/// Return whether the given Mechanic applies to the Unit
		/// </summary>
		public bool IsUnderInfluenceOf(SpellMechanic mechanic)
		{
			if (m_mechanics == null)
			{
				return false;
			}
			return m_mechanics[(int)mechanic] > 0;
		}
        // 239      3.3.0

        /// <inheritdoc />
        public SpellEntry(int spellId, uint category, uint dispel, SpellMechanic mechanic, SpellAtribute attributes, SpellAtributeEx attributesEx, SpellAtributeEx2 attributesEx2, SpellAtributeEx3 attributesEx3, SpellAtributeEx4 attributesEx4, SpellAtributeEx5 attributesEx5, SpellAtributeEx6 attributesEx6, SpellAtributeEx7 attributesEx7, ulong stances, ulong stancesNot, uint targets, CreatureTypeMask targetCreatureType, uint requiresSpellFocus, uint facingCasterFlags, AuraState casterAuraState, AuraState targetAuraState, AuraState casterAuraStateNot, AuraState targetAuraStateNot, uint casterAuraSpell, uint targetAuraSpell, uint excludeCasterAuraSpell, uint excludeTargetAuraSpell, uint castingTimeIndex, uint recoveryTime, uint categoryRecoveryTime, SpellInteruptFlags interruptFlags, SpellAuraInterruptFlags auraInterruptFlags, SpellChannelInterruptFlags channelInterruptFlags, ProcFlags procFlags, uint procChance, uint procCharges, uint maxLevel, uint baseLevel, uint spellLevel, uint durationIndex, SpellCostPower powerType, uint manaCost, uint manaCostPerlevel, uint manaPerSecond, uint manaPerSecondPerLevel, uint rangeIndex, float speed, uint modalNextSpell, uint stackAmount, RequiredReagentData reagentsRequired, ItemClassType equippedItemClass, int equippedItemSubClassMask, InventoryTypeMask equippedItemInventoryTypeMask, SpellEffectData spellEffectInformation, SpellVisualData spellVisual, uint spellIconId, uint activeIconId, uint spellPriority, LocalizedStringDBC <TStringType> spellName, LocalizedStringDBC <TStringType> rank, LocalizedStringDBC <TStringType> description, LocalizedStringDBC <TStringType> toolTip, uint manaCostPercentage, uint startRecoveryCategory, uint startRecoveryTime, uint maxTargetLevel, SpellFamilyName spellFamilyName, Flags96 <uint> spellFamilyFlags, uint maxAffectedTargets, SpellDamageClassType dmgClass, SpellPreventionType preventionType, uint stanceBarOrder, SpellEffectDataChunk <float> dmgMultiplier, uint minFactionId, uint minReputation, uint requiredAuraVision, SpellTotemDataChunk <uint> totemCategory, int areaGroupId, SpellSchoolMask schoolMask, uint runeCostId, uint spellMissileId, uint powerDisplayId, SpellEffectDataChunk <float> damageCoeficient, uint spellDescriptionVariableId, uint spellDifficultyId)
        {
            SpellId                = spellId;
            Category               = category;
            Dispel                 = dispel;
            Mechanic               = mechanic;
            Attributes             = attributes;
            AttributesEx           = attributesEx;
            AttributesEx2          = attributesEx2;
            AttributesEx3          = attributesEx3;
            AttributesEx4          = attributesEx4;
            AttributesEx5          = attributesEx5;
            AttributesEx6          = attributesEx6;
            AttributesEx7          = attributesEx7;
            Stances                = stances;
            StancesNot             = stancesNot;
            Targets                = targets;
            TargetCreatureType     = targetCreatureType;
            RequiresSpellFocus     = requiresSpellFocus;
            FacingCasterFlags      = facingCasterFlags;
            CasterAuraState        = casterAuraState;
            TargetAuraState        = targetAuraState;
            CasterAuraStateNot     = casterAuraStateNot;
            TargetAuraStateNot     = targetAuraStateNot;
            CasterAuraSpell        = casterAuraSpell;
            TargetAuraSpell        = targetAuraSpell;
            ExcludeCasterAuraSpell = excludeCasterAuraSpell;
            ExcludeTargetAuraSpell = excludeTargetAuraSpell;
            CastingTimeIndex       = castingTimeIndex;
            RecoveryTime           = recoveryTime;
            CategoryRecoveryTime   = categoryRecoveryTime;
            InterruptFlags         = interruptFlags;
            AuraInterruptFlags     = auraInterruptFlags;
            ChannelInterruptFlags  = channelInterruptFlags;
            ProcFlags              = procFlags;
            ProcChance             = procChance;
            ProcCharges            = procCharges;
            MaxLevel               = maxLevel;
            BaseLevel              = baseLevel;
            SpellLevel             = spellLevel;
            DurationIndex          = durationIndex;
            PowerType              = powerType;
            ManaCost               = manaCost;
            ManaCostPerlevel       = manaCostPerlevel;
            ManaPerSecond          = manaPerSecond;
            ManaPerSecondPerLevel  = manaPerSecondPerLevel;
            RangeIndex             = rangeIndex;
            Speed                         = speed;
            ModalNextSpell                = modalNextSpell;
            StackAmount                   = stackAmount;
            ReagentsRequired              = reagentsRequired;
            EquippedItemClass             = equippedItemClass;
            EquippedItemSubClassMask      = equippedItemSubClassMask;
            EquippedItemInventoryTypeMask = equippedItemInventoryTypeMask;
            SpellEffectInformation        = spellEffectInformation;
            SpellVisual                   = spellVisual;
            SpellIconID                   = spellIconId;
            ActiveIconID                  = activeIconId;
            SpellPriority                 = spellPriority;
            SpellName                     = spellName;
            Rank                       = rank;
            Description                = description;
            ToolTip                    = toolTip;
            ManaCostPercentage         = manaCostPercentage;
            StartRecoveryCategory      = startRecoveryCategory;
            StartRecoveryTime          = startRecoveryTime;
            MaxTargetLevel             = maxTargetLevel;
            SpellFamilyName            = spellFamilyName;
            SpellFamilyFlags           = spellFamilyFlags;
            MaxAffectedTargets         = maxAffectedTargets;
            DmgClass                   = dmgClass;
            PreventionType             = preventionType;
            StanceBarOrder             = stanceBarOrder;
            DmgMultiplier              = dmgMultiplier;
            MinFactionId               = minFactionId;
            MinReputation              = minReputation;
            RequiredAuraVision         = requiredAuraVision;
            TotemCategory              = totemCategory;
            AreaGroupId                = areaGroupId;
            SchoolMask                 = schoolMask;
            RuneCostID                 = runeCostId;
            SpellMissileID             = spellMissileId;
            PowerDisplayId             = powerDisplayId;
            DamageCoeficient           = damageCoeficient;
            SpellDescriptionVariableID = spellDescriptionVariableId;
            SpellDifficultyId          = spellDifficultyId;
        }
예제 #13
0
 /// <summary>
 /// Return wether the given Mechanic applies to the Owner
 /// </summary>
 public bool IsMechanic( SpellMechanic mechanic )
 {
     if ( m_mechanics == null )
     {
         return false;
     }
     return m_mechanics[(int)mechanic] > 0;
 }
예제 #14
0
		/// <summary>
		/// Changes the duration-modifier for a certain SpellMechanic in %
		/// </summary>
		public void ModMechanicDurationMod(SpellMechanic mechanic, int delta)
		{
			if (m_mechanicDurationMods == null)
				m_mechanicDurationMods = CreateMechanicsArr();
			int val = m_mechanicDurationMods[(int)mechanic] + delta;
			if (val < 0)
			{
				val = 0;
			}
			m_mechanicDurationMods[(int)mechanic] = val;
		}
예제 #15
0
		/// <summary>
		/// Changes the amount of resistance against certain SpellMechanics
		/// </summary>
		public void ModMechanicResistance(SpellMechanic mechanic, int delta)
		{
			if (m_mechanicResistances == null)
				m_mechanicResistances = CreateMechanicsArr();
			int val = m_mechanicResistances[(int)mechanic] + delta;
			if (val < 0)
			{
				val = 0;
			}
			m_mechanicResistances[(int)mechanic] = val;
		}
예제 #16
0
		/// <summary>
		/// Decreases immunity-count against given SpellMechanic-school
		/// </summary>
		public void DecMechImmunityCount(SpellMechanic mechanic)
		{
			if (m_mechanicImmunities == null)
			{
				return;
			}
			int val = m_mechanicImmunities[(int)mechanic];
			if (val > 0)
			{
				m_mechanicImmunities[(int)mechanic]--;
			}
		}
예제 #17
0
		/// <summary>
		/// Indicates whether the owner is immune against the given SpellMechanic
		/// </summary>
		public bool IsImmune(SpellMechanic mechanic)
		{
			if (mechanic == SpellMechanic.None)
			{
				return false;
			}

			return m_mechanicImmunities != null && m_mechanicImmunities[(int)mechanic] > 0;
		}
예제 #18
0
		/// <summary>
		/// Increase the mechnanic modifier count for the given SpellMechanic
		/// </summary>
		public void IncMechanicCount(SpellMechanic mechanic)
		{
			if (m_mechanics == null)
			{
				m_mechanics = CreateMechanicsArr();
			}

			var val = m_mechanics[(int)mechanic];
			if (val == 0)
			{
				// movement
				if (m_canMove && SpellConstants.MoveMechanics[(int)mechanic])
				{
					m_canMove = false;
					if (!IsPlayer)
					{
						// NPCs need to unset their target, or else the client will keep display them rotating
						Target = null;
					}
					UnitFlags |= UnitFlags.Stunned;

					// can't fly while stunned
					CancelTaxiFlight();

					if (this is Character)
					{
						MovementHandler.SendRooted((Character)this, 1);
					}
					//UnitFlags |= UnitFlags.Influenced;
					if (IsUsingSpell && SpellCast.Spell.InterruptFlags.HasFlag(InterruptFlags.OnStunned))
					{
						SpellCast.Cancel();
					}
				}

				// interaction
				if (m_canInteract && SpellConstants.InteractMechanics[(int)mechanic])
				{
					m_canInteract = false;
					//UnitFlags |= UnitFlags.UnInteractable;
				}

				// harmfulnes
				if (m_canHarm && SpellConstants.HarmPreventionMechanics[(int)mechanic])
				{
					SetCanHarmState();
				}

				// check if we can still cast spells
				if (m_canCastSpells && SpellConstants.SpellCastPreventionMechanics[(int)mechanic])
				{
					// check if we can still cast spells
					m_canCastSpells = false;
					if (IsUsingSpell && SpellCast.Spell.InterruptFlags.HasFlag(InterruptFlags.OnSilence))
					{
						SpellCast.Cancel();
					}
					if (!m_canDoPhysicalActivity && m_canHarm)
					{
						// no spells and no physical activities -> No harm
						SetCanHarmState();
					}
				}

				switch (mechanic)
				{
					case SpellMechanic.Frozen:
						AuraState |= AuraStateMask.Frozen;
						break;
					case SpellMechanic.Mounted:
						UnitFlags |= UnitFlags.Mounted;
						SpeedFactor += MountSpeedMod;
						m_auras.RemoveByFlag(AuraInterruptFlags.OnMount);
						break;
					case SpellMechanic.Silenced:
						UnitFlags |= UnitFlags.Silenced;
						break;
					case SpellMechanic.Fleeing:
						UnitFlags |= UnitFlags.Feared;
						break;
					case SpellMechanic.Disoriented:
						UnitFlags |= UnitFlags.Confused;
						break;
					case SpellMechanic.Invulnerable:
						UnitFlags |= UnitFlags.SelectableNotAttackable;
						break;
					case SpellMechanic.Enraged:
						AuraState |= AuraStateMask.Enraged;
						break;
				}
			}

			// change the value
			m_mechanics[(int)mechanic]++;
		}
예제 #19
0
		/// <summary>
		/// Decrease the mechnanic modifier count for the given SpellMechanic
		/// </summary>
		public void DecMechanicCount(SpellMechanic mechanic)
		{
			if (m_mechanics == null)
			{
				return;
			}
			int val = m_mechanics[(int)mechanic];
			if (val > 0)
			{
				// change the value
				m_mechanics[(int)mechanic] = val - 1;

				if (val == 1)
				{
					// All of this Mechanic's influences have been removed

					if (!m_canMove && SpellConstants.MoveMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.MoveMechanics))
					{
						m_canMove = true;
						UnitFlags &= ~UnitFlags.Stunned;
						m_lastMoveTime = Environment.TickCount;

						//UnitFlags &= ~UnitFlags.Influenced;
						if (this is Character)
							MovementHandler.SendUnrooted((Character)this);
					}

					if (!m_canInteract && SpellConstants.InteractMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.InteractMechanics))
					{
						m_canInteract = true;
						//UnitFlags &= ~UnitFlags.UnInteractable;
					}

					if (!m_canHarm && SpellConstants.HarmPreventionMechanics[(int)mechanic])
					{
						SetCanHarmState();
					}

					if (!m_canCastSpells && SpellConstants.SpellCastPreventionMechanics[(int)mechanic] &&
						!IsAnySetNoCheck(SpellConstants.SpellCastPreventionMechanics))
					{
						m_canCastSpells = true;
						if (!m_canDoPhysicalActivity && !m_canHarm)
						{
							// can do spells and no physical activities -> Can harm
							SetCanHarmState();
						}
					}

					switch (mechanic)
					{
						case SpellMechanic.Frozen:
							AuraState ^= AuraStateMask.Frozen;
							break;
						case SpellMechanic.Mounted:
							UnitFlags &= ~UnitFlags.Mounted;
							SpeedFactor -= MountSpeedMod;
							break;
						case SpellMechanic.Silenced:
							UnitFlags &= ~UnitFlags.Silenced;
							break;
						case SpellMechanic.Fleeing:
							UnitFlags &= ~UnitFlags.Feared;
							break;
						case SpellMechanic.Disoriented:
							UnitFlags &= ~UnitFlags.Confused;
							break;
						case SpellMechanic.Invulnerable:
							UnitFlags &= ~UnitFlags.SelectableNotAttackable;
							break;
						case SpellMechanic.Enraged:
							AuraState &= ~AuraStateMask.Enraged;
							break;
					}
				}
			}
		}
예제 #20
0
 public static bool IsNegative(this SpellMechanic mech)
 {
     return(NegativeMechanics[(int)mech]);
 }
예제 #21
0
		/// <summary>
		/// Adds immunity against given SpellMechanic-school
		/// </summary>
		public void IncMechImmunityCount(SpellMechanic mechanic, Spell exclude)
		{
			if (m_mechanicImmunities == null)
			{
				m_mechanicImmunities = CreateMechanicsArr();
			}

			var val = m_mechanicImmunities[(int)mechanic];
			if (val == 0)
			{
				// new immunity: Gets rid of all Auras that use this Mechanic
				Auras.RemoveWhere(aura => aura.Spell.Mechanic == mechanic &&
					aura.Spell != exclude &&
					(aura.Spell.TargetTriggerSpells == null || !aura.Spell.TargetTriggerSpells.Contains(exclude)) &&
					(aura.Spell.CasterTriggerSpells == null || !aura.Spell.CasterTriggerSpells.Contains(exclude)) &&
					((mechanic != SpellMechanic.Invulnerable && mechanic != SpellMechanic.Invulnerable_2) || !aura.Spell.Attributes.HasFlag(SpellAttributes.UnaffectedByInvulnerability)));
			}

			m_mechanicImmunities[(int)mechanic]++;
		}
예제 #22
0
		/// <summary>
		/// whether this Unit completely resists a spell
		/// </summary>
		public bool CheckResist(Unit attacker, DamageSchool school, SpellMechanic mechanic)
		{
			if (Utility.Random(0f, 100f) <
				GetMechanicResistance(mechanic) -
				GetAttackerSpellHitChanceMod(school) +
				GetResistChancePct(attacker, school))
				return true;

			return false;
		}
예제 #23
0
		// TODO: ModDamageTaken and ModDamageTakenPercent
		#endregion

		#region Mechanic Resistance
		/// <summary>
		/// Returns the resistance chance for the given SpellMechanic
		/// </summary>
		public int GetMechanicResistance(SpellMechanic mechanic)
		{
			if (m_mechanicResistances == null)
			{
				return 0;
			}
			return m_mechanicResistances[(int)mechanic];
		}
예제 #24
0
		/// <summary>
		/// Increase the mechnanic modifier count for the given SpellMechanic
		/// </summary>
		public void IncMechanicCount(SpellMechanic mechanic)
		{
			if (m_mechanics == null)
			{
				m_mechanics = CreateMechanicsArr();
			}

			var val = m_mechanics[(int)mechanic];
			if (val == 0)
			{
				// movement
				if (m_canMove && SpellConstants.MoveMechanics[(int)mechanic])
				{
					m_canMove = false;
					if (!IsPlayer)
					{
						// NPCs need to unset their target, or else the client will keep display them rotating
						Target = null;
					}
					UnitFlags |= UnitFlags.Stunned;

					// can't fly while stunned
					CancelTaxiFlight();

					if (this is Character)
					{
						MovementHandler.SendRooted((Character)this, 1);
					}
					//UnitFlags |= UnitFlags.Influenced;
					if (IsUsingSpell && SpellCast.Spell.InterruptFlags.Has(InterruptFlags.OnStunned))
					{
						SpellCast.Cancel();
					}
				}

				// interaction
				if (m_canInteract && SpellConstants.InteractMechanics[(int)mechanic])
				{
					m_canInteract = false;
					//UnitFlags |= UnitFlags.UnInteractable;
				}

				// harmfulnes
				if (m_canHarm && SpellConstants.HarmMechanics[(int)mechanic])
				{
					m_canHarm = false;
					if (IsUsingSpell && SpellCast.Spell.HasHarmfulEffects)
					{
						SpellCast.Cancel();
					}
				}

				// check if we can still cast spells
				if (m_canCastSpells && SpellConstants.SpellMechanics[(int)mechanic])
				{
					// check if we can still cast spells
					m_canCastSpells = false;
					UnitFlags |= UnitFlags.Silenced;
					if (IsUsingSpell && SpellCast.Spell.InterruptFlags.Has(InterruptFlags.OnSilence))
					{
						SpellCast.Cancel();
					}
				}

				if (mechanic == SpellMechanic.Frozen)
				{
					// Apply Frozen AuraState
					AuraState |= AuraStateMask.Frozen;
				}


				if (mechanic == SpellMechanic.Mounted)
				{
					// Now mounted
					UnitFlags |= UnitFlags.Mounted;
					SpeedFactor += MountSpeedMod;
					m_auras.RemoveByFlag(AuraInterruptFlags.OnMount);
				}
				else if (mechanic == SpellMechanic.Slowed)
				{
					UnitFlags |= UnitFlags.Pacified;
				}
				else if (mechanic == SpellMechanic.Disarmed)
				{
					UnitFlags |= UnitFlags.Disarmed;
					MainWeapon = GenericWeapon.Fists;
					OffHandWeapon = null;
					RangedWeapon = null;
				}
				else if (mechanic == SpellMechanic.Fleeing)
				{
					UnitFlags |= UnitFlags.Feared;
				}
				else if (mechanic == SpellMechanic.Disoriented)
				{
					UnitFlags |= UnitFlags.Confused;
				}
				else if (mechanic == SpellMechanic.Invulnerable)
				{
					UnitFlags |= UnitFlags.SelectableNotAttackable;
				}
			}

			// change the value
			m_mechanics[(int)mechanic]++;
		}
예제 #25
0
		/// <summary>
		/// Returns the duration modifier for a certain SpellMechanic
		/// </summary>
		public int GetMechanicDurationMod(SpellMechanic mechanic)
		{
			if (m_mechanicDurationMods == null || mechanic == SpellMechanic.None)
			{
				return 0;
			}
			return m_mechanicDurationMods[(int)mechanic];
		}
예제 #26
0
		/// <summary>
		/// Decrease the mechnanic modifier count for the given SpellMechanic
		/// </summary>
		public void DecMechanicCount(SpellMechanic mechanic)
		{
			if (m_mechanics == null)
			{
				return;
			}
			int val = m_mechanics[(int)mechanic];
			if (val > 0)
			{
				// change the value
				m_mechanics[(int)mechanic] = val - 1;

				if (val == 1)
				{
					// All of this Mechanic's influences have been removed

					if (!m_canMove && SpellConstants.MoveMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.MoveMechanics))
					{
						m_canMove = true;
						UnitFlags &= ~UnitFlags.Stunned;
						m_lastMoveTime = Environment.TickCount;

						//UnitFlags &= ~UnitFlags.Influenced;
						if (this is Character)
							MovementHandler.SendUnrooted((Character)this);
					}

					if (!m_canInteract && SpellConstants.InteractMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.InteractMechanics))
					{
						m_canInteract = true;
						//UnitFlags &= ~UnitFlags.UnInteractable;
					}

					if (!m_canHarm && SpellConstants.HarmMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.HarmMechanics))
					{
						m_canHarm = true;
					}

					if (!m_canCastSpells && SpellConstants.SpellMechanics[(int)mechanic] && !IsAnySetNoCheck(SpellConstants.SpellMechanics))
					{
						m_canCastSpells = true;
						UnitFlags &= ~UnitFlags.Silenced;
					}

					if (mechanic == SpellMechanic.Frozen)
					{
						// Remove Frozen AuraState
						AuraState ^= AuraStateMask.Frozen;
					}

					if (mechanic == SpellMechanic.Mounted)
					{
						UnitFlags &= ~UnitFlags.Mounted;
						SpeedFactor -= MountSpeedMod;
					}
					else if (mechanic == SpellMechanic.Disarmed && m_mechanics[(int)SpellMechanic.Disarmed] == 0)
					{
						UnitFlags &= ~UnitFlags.Disarmed;
						// TODO: Put weapons back in place
					}
					else if (mechanic == SpellMechanic.Slowed && m_mechanics[(int)SpellMechanic.Slowed] == 0)
					{
						UnitFlags &= ~UnitFlags.Pacified;
					}
					else if (mechanic == SpellMechanic.Fleeing && m_mechanics[(int)SpellMechanic.Horrified] == 0)
					{
						UnitFlags &= ~UnitFlags.Feared;
					}
					else if (mechanic == SpellMechanic.Disoriented && m_mechanics[(int)SpellMechanic.Disoriented] == 0)
					{
						UnitFlags &= ~UnitFlags.Confused;
					}
					else if (mechanic == SpellMechanic.Invulnerable && m_mechanics[(int)SpellMechanic.Invulnerable] == 0)
					{
						UnitFlags &= ~UnitFlags.SelectableNotAttackable;
					}
				}
			}
		}
예제 #27
0
		/// <summary>
		/// Adds immunity against given SpellMechanic-school
		/// </summary>
		public void IncMechImmunityCount(SpellMechanic mechanic)
		{
			if (m_mechanicImmunities == null)
			{
				m_mechanicImmunities = CreateMechanicsArr();
			}

			var val = m_mechanicImmunities[(int)mechanic];
			if (val == 0)
			{
				// new immunity: Gets rid of all Auras that use this Mechanic
				Auras.RemoveWhere(aura => aura.Spell.Mechanic == mechanic &&
					((mechanic != SpellMechanic.Invulnerable && mechanic != SpellMechanic.Invulnerable_2) || !aura.Spell.Attributes.Has(SpellAttributes.UnaffectedByInvulnerability)));
			}

			m_mechanicImmunities[(int)mechanic]++;
		}
예제 #28
0
		/// <summary>
		/// whether this Unit completely resists a spell
		/// </summary>
		public bool CheckResist(Unit attacker, DamageSchool school, SpellMechanic mechanic)
		{
			if (GetMechanicResistance(mechanic) +
				GetResistChance(attacker, school) > Utility.Random(0f, 100f))
				return true;

			return false;
		}