예제 #1
0
 /// <summary>
 /// adds an active monster effect
 /// </summary>
 /// <param name="effect"></param>
 public void AddMonsterEffect(ITemporaryEffect effect)
 {
     lock (effectlock) {
         monstereffects.Add(effect);
         effect.Initialize();
     }
 }
예제 #2
0
        /// <summary>
        /// adds an active player effect
        /// </summary>
        /// <param name="playerid">id of player</param>
        /// <param name="effect">effect to add</param>
        public void AddPlayerEffect(long playerid, ITemporaryEffect effect)
        {
            lock (effectlock) {
                List <ITemporaryEffect> effects;
                if (!playereffects.TryGetValue(playerid, out effects))
                {
                    playereffects[playerid] = effects = new List <ITemporaryEffect>();
                }

                effects.RemoveAll(e => e.GetType() == effect.GetType());
                effects.Add(effect);
                effect.Initialize();
            }
        }