Exemplo n.º 1
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int debuff = living.DebuffCategory[(int)property];

            if (debuff > 0)
            {
                GameSpellEffect nsreduction = SpellHandler.FindEffectOnTarget(living, "NearsightReduction");
                if (nsreduction != null)
                {
                    debuff *= (int)(1.00 - nsreduction.Spell.Value * 0.01);
                }
            }

            int item = Math.Max(0, 100 - debuff + Math.Min(10, living.ItemBonus[(int)property])); // http://www.camelotherald.com/more/1325.shtml

            int ra = 0;

            if (living.RangedAttackType == GameLiving.eRangedAttackType.Long)
            {
                ra = 50;

                IGameEffect effect = living.EffectList.GetOfType <TrueshotEffect>();
                effect?.Cancel(false);
            }

            return(item + ra);
        }
Exemplo n.º 2
0
        public void GetOfType_FreshList_ReturnNull()
        {
            var owner      = NewFakeLiving();
            var effectList = new GameEffectList(owner);

            IGameEffect actual = effectList.GetOfType <GameSpellEffect>();

            Assert.AreEqual(null, actual);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Find Static Effect by Effect Type
        /// </summary>
        /// <param name="target">Living to find effect on</param>
        /// <param name="effectType">Effect Type to find (Exact Type Match)</param>
        /// <returns>First occurence of IGameEffect in target's effect list or null</returns>
        public static IGameEffect FindStaticEffectOnTarget(this GameLiving target, Type effectType)
        {
            IGameEffect effect = null;

            lock (target.EffectList)
            {
                effect = target.StaticEffectsOnTarget(effectType).FirstOrDefault();
            }
            return(effect);
        }
Exemplo n.º 4
0
		/// <summary>
		/// Called when an effect changed
		/// </summary>
		public override void OnEffectsChanged(IGameEffect changedEffect)
		{
			if (changedEffect.Icon == 0)
				return;
			lock (m_changedEffects) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
			{
				if (!m_changedEffects.Contains(changedEffect))
					m_changedEffects.Add(changedEffect);
			}
			base.OnEffectsChanged(changedEffect);
		}
Exemplo n.º 5
0
        public void GetOfType_ListWithOneItemOfGivenType_ReturnListWithThatOneItem()
        {
            GameEffectList effectList = NewGameEffectList();
            var            effect     = new GameSpellEffect(null, 0, 0);

            effectList.Add(effect);

            IGameEffect actual = effectList.GetOfType <GameSpellEffect>();

            Assert.IsNotNull(actual);
        }
        /// <summary>
        /// Create the pet and transfer stats.
        /// </summary>
        /// <param name="target">Target that gets the effect</param>
        /// <param name="effectiveness">Factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            base.ApplyEffectOnTarget(target, effectiveness);

            (Caster as GamePlayer)?.Shade(true);

            // Cancel RR5 Call of Darkness if on caster.
            IGameEffect callOfDarkness = FindStaticEffectOnTarget(Caster, typeof(CallOfDarknessEffect));

            callOfDarkness?.Cancel(false);
        }
 /// <summary>
 /// Stop the effect on target
 /// </summary>
 public override void Stop()
 {
     if (m_player.HasAbility(Abilities.Camouflage))
     {
         IGameEffect camouflage = m_player.EffectList.GetOfType <CamouflageEffect>();
         if (camouflage != null)
         {
             camouflage.Cancel(false);
         }
     }
     m_player.EffectList.Remove(this);
 }
Exemplo n.º 8
0
		/// <summary>
		/// add a new effect to the effectlist, it does not start the effect
		/// </summary>
		/// <param name="effect">The effect to add to the list</param>
		/// <returns>true if the effect was added</returns>
		public override bool Add(IGameEffect effect)
		{
			if (!base.Add(effect)) return false;

			// no timer has to be updated like with top icons so it only
			// makes sence to update group window icons on add/remove
			GamePlayer player = m_owner as GamePlayer;
			if (player != null && player.Group != null)
			{
				player.Group.UpdateMember(player, true, false);
			}

			return true;
		}
Exemplo n.º 9
0
 /// <summary>
 /// Called when an effect changed
 /// </summary>
 public override void OnEffectsChanged(IGameEffect changedEffect)
 {
     if (changedEffect.Icon == 0)
     {
         return;
     }
     lock (m_changedEffects)             // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
     {
         if (!m_changedEffects.Contains(changedEffect))
         {
             m_changedEffects.Add(changedEffect);
         }
     }
     base.OnEffectsChanged(changedEffect);
 }
Exemplo n.º 10
0
        /// <summary>
        /// remove effect
        /// </summary>
        /// <param name="effect">The effect to remove from the list</param>
        /// <returns>true if the effect was removed</returns>
        public override bool Remove(IGameEffect effect)
        {
            if (!base.Remove(effect))
            {
                return(false);
            }

            // no timer has to be updated like with top icons so it only
            // makes sence to update group window icons on add/remove
            GamePlayer player = m_owner as GamePlayer;

            if (player != null && player.Group != null)
            {
                player.Group.UpdateMember(player, true, false);
            }
            return(true);
        }
Exemplo n.º 11
0
		/// <summary>
		/// Add Effect to Player and Update Player Group if Any
		/// </summary>
		/// <param name="effect"></param>
		/// <returns></returns>
		public override bool Add(IGameEffect effect)
		{
			if(base.Add(effect))
			{
				var player = m_owner as GamePlayer;
				if (player != null)
				{
					if (player.Group != null)
					{
						player.Group.UpdateMember(player, true, false);
					}
				}
				
				return true;
			}
			
			return false;
		}
Exemplo n.º 12
0
        /// <summary>
        /// Remove Effect from Player and Update Player Group if Any
        /// </summary>
        /// <param name="effect"></param>
        /// <returns></returns>
        public override bool Remove(IGameEffect effect)
        {
            if (base.Remove(effect))
            {
                var player = m_owner as GamePlayer;
                if (player != null)
                {
                    if (player.Group != null)
                    {
                        player.Group.UpdateMember(player, true, false);
                    }
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 13
0
            /// <summary>
            /// Called on every timer tick
            /// </summary>
            protected override void OnTick()
            {
                GamePlayer player = (GamePlayer)m_actionSource;

                IGameEffect found = null;

                lock (player.EffectList)
                {
                    foreach (IGameEffect effect in player.EffectList)
                    {
                        if (effect.InternalID == _effectId)
                        {
                            found = effect;
                            break;
                        }
                    }
                }

                found?.Cancel(true);
            }
Exemplo n.º 14
0
        private void PlayerAction(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

            if (player == null)
            {
                return;
            }

            MessageToLiving(player, "You are moving. Your concentration fades!", eChatType.CT_SpellResisted);
            GameSpellEffect effect = FindEffectOnTarget(m_target, "Loockout");

            effect?.Cancel(false);

            IGameEffect effect2 = FindStaticEffectOnTarget(Caster, typeof(LoockoutOwner));

            effect2?.Cancel(false);

            OnEffectExpires(effect, true);
        }
Exemplo n.º 15
0
            /// <summary>
            /// Called on every timer tick
            /// </summary>
            protected override void OnTick()
            {
                GamePlayer player = (GamePlayer)m_actionSource;

                IGameEffect found = null;

                lock (player.EffectList)
                {
                    foreach (IGameEffect effect in player.EffectList)
                    {
                        if (effect is GameSpellEffect && ((GameSpellEffect)effect).Spell.InternalID == m_effectId)
                        {
                            found = effect;
                            break;
                        }
                    }
                }
                if (found != null)
                {
                    found.Cancel(true);
                }
            }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            // no berserk for ranged weapons
            IGameEffect berserk = living.EffectList.GetOfType <BerserkEffect>();

            if (berserk != null)
            {
                return(100);
            }

            // base 10% chance of critical for all with melee weapons plus ra bonus
            int chance = 10 + living.BuffBonusCategory4[(int)property] + living.AbilityBonus[(int)property];

            if (living is GameNPC npc && npc.Brain is AI.Brain.IControlledBrain)
            {
                GamePlayer player = ((AI.Brain.IControlledBrain)npc.Brain)?.GetPlayerOwner();
                if (player != null)
                {
                    RealmAbilities.WildMinionAbility ab = player.GetAbility <RealmAbilities.WildMinionAbility>();
                    if (ab != null)
                    {
                        chance += ab.Amount;
                    }

                    if (npc is NecromancerPet)
                    {
                        RealmAbilities.MasteryOfPain mop = player.GetAbility <RealmAbilities.MasteryOfPain>();
                        if (mop != null)
                        {
                            chance += mop.Amount;
                        }
                    }
                }
            }

            // 50% hardcap
            return(Math.Min(chance, 50));
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            // no berserk for ranged weapons
            IGameEffect berserk = living.EffectList.GetOfType <BerserkEffect>();

            if (berserk != null)
            {
                return(100);
            }

            // base 10% chance of critical for all with melee weapons plus ra bonus
            int chance = living.BuffBonusCategory4[(int)property] + living.AbilityBonus[(int)property];

            if (living is NecromancerPet necroPet)
            {
                if (necroPet.Brain is IControlledBrain necroPetBrain && necroPetBrain.GetPlayerOwner() is GamePlayer necro &&
                    necro.GetAbility <RealmAbilities.MasteryOfPain>() is RealmAbilities.MasteryOfPain raMoP)
                {
                    chance += raMoP.Amount;
                }
            }
            else if (living is GamePet pet)
            {
                if (pet.Brain is IControlledBrain petBrain && petBrain.GetPlayerOwner() is GamePlayer player &&
                    player.GetAbility <RealmAbilities.WildMinionAbility>() is RealmAbilities.WildMinionAbility raWM)
                {
                    chance += raWM.Amount;
                }
            }
            else             // not a pet
            {
                chance += 10;
            }

            //50% hardcap
            return(Math.Min(chance, 50));
        }
Exemplo n.º 18
0
 public static void Add(IGameEffect gameEffect)
 {
     GameEffects.AddLast(gameEffect);
 }