Beispiel #1
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (living is GamePlayer && !string.IsNullOrEmpty(message))
     {
         living.MessageToSelf(message, type);
     }
 }
Beispiel #2
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (living is GamePlayer && message != null && message.Length > 0)
     {
         living.MessageToSelf(message, type);
     }
 }
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            SendEffectAnimation(target, m_spell.ClientEffect, boltDuration: 0, noSound: false, success: 1);

            var mesmerizeEffect = target.FindEffectOnTarget("Mesmerize");

            if (mesmerizeEffect != null)
            {
                mesmerizeEffect.Cancel(false);
            }

            var speedDecreaseEffect = target.FindEffectOnTarget("SpeedDecrease");

            if (speedDecreaseEffect != null)
            {
                speedDecreaseEffect.Cancel(false);
            }


            bool targetIsGameplayer = target is GamePlayer;
            var  necroPet           = target as NecromancerPet;

            if (targetIsGameplayer || necroPet != null)
            {
                int powerRendValue;

                if (targetIsGameplayer)
                {
                    powerRendValue = (int)(target.MaxMana * Spell.Value * GetVariance());
                    if (powerRendValue > target.Mana)
                    {
                        powerRendValue = target.Mana;
                    }
                    target.Mana -= powerRendValue;
                    target.MessageToSelf(string.Format(m_spell.Message2, powerRendValue), eChatType.CT_Spell);
                }
                else
                {
                    powerRendValue = (int)(necroPet.Owner.MaxMana * Spell.Value * GetVariance());
                    if (powerRendValue > necroPet.Owner.Mana)
                    {
                        powerRendValue = necroPet.Owner.Mana;
                    }
                    necroPet.Owner.Mana -= powerRendValue;
                    necroPet.Owner.MessageToSelf(string.Format(m_spell.Message2, powerRendValue), eChatType.CT_Spell);
                }

                MessageToCaster(string.Format(m_spell.Message1, powerRendValue), eChatType.CT_Spell);
            }
        }
Beispiel #4
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (message != null && message.Length > 0)
     {
         living.MessageToSelf(message, type);
     }
 }