/// <summary>
		/// Action
		/// </summary>
		/// <param name="living"></param>
		public override void Execute(GameLiving living)
		{
			if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED | INCOMBAT)) return;

			int heal = 0;
			switch (Level)
			{
				case 1: heal = 25; break;
				case 2: heal = 60; break;
				case 3: heal = 100; break;
			}
			int healed = living.ChangeMana(living, GameLiving.eManaChangeType.Spell, living.MaxMana * heal / 100);

			SendCasterSpellEffectAndCastMessage(living, 7009, healed > 0);

			GamePlayer player = living as GamePlayer;
			if (player != null)
			{
				if (healed > 0) player.Out.SendMessage("You gain " + healed + " mana.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				if (heal > healed)
				{
					player.Out.SendMessage("You have full mana.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				}
			}
			if (healed > 0) DisableSkill(living);
		}
Beispiel #2
0
        /// <summary>
        /// Use a percentage of the damage to refill caster's power.
        /// </summary>
        /// <param name="ad">Attack data.</param>
        public virtual void DrainPower(AttackData ad)
        {
            if (ad == null || !Caster.IsAlive)
            {
                return;
            }

            GameLiving owner = Owner();

            if (owner == null)
            {
                return;
            }

            int powerGain = (ad.Damage + ad.CriticalDamage) * Spell.LifeDrainReturn / 100;

            powerGain = owner.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, powerGain);

            if (powerGain > 0)
            {
                MessageToOwner($"Your summon channels {powerGain} power to you!", eChatType.CT_Spell);
            }
            else
            {
                MessageToOwner("You cannot absorb any more power.", eChatType.CT_SpellResisted);
            }
        }
Beispiel #3
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness);

            if (target == null)
            {
                return;
            }

            if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }

            neweffect.Start(target);
            int mana = (int)Spell.Damage;

            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, -mana);

            if (target is GamePlayer)
            {
                ((GamePlayer)target).Out.SendMessage($"{Caster.Name} steals you {mana} points of power!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            }

            StealMana(target, mana);

            // target.StartInterruptTimer(SPELL_INTERRUPT_DURATION, AttackData.eAttackType.Spell, Caster);
        }
Beispiel #4
0
        /// <summary>
        /// Heals hit points of one target and sends needed messages, no spell effects
        /// </summary>
        /// <param name="target"></param>
        /// <param name="amount">amount of hit points to heal</param>
        /// <returns>true if heal was done</returns>
        public virtual bool HealTarget(GameLiving target, int amount)
        {
            if (target == null || target.ObjectState != GameObject.eObjectState.Active)
            {
                return(false);
            }

            // we can't heal people we can attack
            if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true))
            {
                return(false);
            }

            if (!target.IsAlive)
            {
                // "You cannot heal the dead!" sshot550.tga
                MessageToCaster($"{target.GetName(0, true)} is dead!", eChatType.CT_SpellResisted);
                return(false);
            }

            int heal = target.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, amount);

            if (heal == 0)
            {
                if (Spell.Pulse == 0)
                {
                    if (target == Caster)
                    {
                        MessageToCaster("Your power is full.", eChatType.CT_SpellResisted);
                    }
                    else
                    {
                        MessageToCaster($"{target.GetName(0, true)} power is full.", eChatType.CT_SpellResisted);
                    }
                }

                return(false);
            }

            if (Caster == target)
            {
                MessageToCaster($"You restore {heal} power points.", eChatType.CT_Spell);
                if (heal < amount)
                {
                    MessageToCaster("Your power is full.", eChatType.CT_Spell);
                }
            }
            else
            {
                MessageToCaster($"You restore {target.GetName(0, false)} for {heal} power points!", eChatType.CT_Spell);
                MessageToLiving(target, $"Your power was restored by {Caster.GetName(0, false)} for {heal} points.", eChatType.CT_Spell);
                if (heal < amount)
                {
                    MessageToCaster($"{target.GetName(0, true)} mana is full.", eChatType.CT_Spell);
                }
            }

            return(true);
        }
Beispiel #5
0
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED))
            {
                return;
            }

            int heal = 0;

            if (ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
            {
                switch (Level)
                {
                case 1: heal = 25; break;

                case 2: heal = 35; break;

                case 3: heal = 50; break;

                case 4: heal = 65; break;

                case 5: heal = 80; break;
                }
            }
            else
            {
                switch (Level)
                {
                case 1: heal = 25; break;

                case 2: heal = 60; break;

                case 3: heal = 100; break;
                }
            }

            int healed = living.ChangeMana(living, GameLiving.eManaChangeType.Spell, living.MaxMana * heal / 100);

            SendCasterSpellEffectAndCastMessage(living, 7009, healed > 0);

            if (living is GamePlayer player)
            {
                if (healed > 0)
                {
                    player.Out.SendMessage($"You gain {healed} mana.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }

                if (heal > healed)
                {
                    player.Out.SendMessage("You have full mana.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }
            }

            if (healed > 0)
            {
                DisableSkill(living);
            }
        }
Beispiel #6
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            //spell damage shood be 50-100 (thats the amount power tapped on use) i recommend 90 i think thats it but cood be wrong
            int mana = (int)(Spell.Damage);
            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
Beispiel #7
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            // Calculate the amount of power to transfer from the owner.
            // TODO: Effectiveness plays a part here.

            GamePlayer owner = Owner();

            if (owner == null)
            {
                return;
            }

            int powerTransfer = (int)Math.Min(Spell.Value, owner.Mana);
            int powerDrained  = -owner.ChangeMana(owner, GameLiving.eManaChangeType.Spell, -powerTransfer);

            if (powerDrained <= 0)
            {
                return;
            }

            int powerHealed = target.ChangeMana(owner, GameLiving.eManaChangeType.Spell, powerDrained);

            if (powerHealed <= 0)
            {
                SendEffectAnimation(target, 0, false, 0);
                owner.Out.SendMessage(String.Format("{0} is at full power already!",
                                                    target.Name), eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            }
            else
            {
                SendEffectAnimation(target, 0, false, 1);
                owner.Out.SendMessage(String.Format("You transfer {0} power to {1}!",
                                                    powerHealed, target.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

                if (target is GamePlayer)
                {
                    (target as GamePlayer).Out.SendMessage(String.Format("{0} transfers {1} power to you!",
                                                                         owner.Name, powerHealed), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }
            }
        }
Beispiel #8
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }
            //spell damage shood be 50-100 (thats the ammmount power tapped on use)
            int mana = (int)(Spell.Damage);

            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));
            //~yemla~Power rend shouldn't inrupt if im correct? A.k ML9 Perfector Power Drainging Ward Please more info on it.
            //target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
Beispiel #9
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            //spell damage shood be 50-100 (thats the amount power tapped on use) i recommend 90 i think thats it but cood be wrong
            int mana = (int)(Spell.Damage);

            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
        /// <summary>
        /// Execute direct effect.
        /// </summary>
        /// <param name="target">Target power is transferred to.</param>
        /// <param name="effectiveness">Effectiveness of the spell (0..1, equalling 0-100%).</param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            // Calculate the amount of power to transfer from the owner.
            // TODO: Effectiveness plays a part here.

            GamePlayer owner = Owner();
            if (owner == null)
                return;

            int powerTransfer = (int)Math.Min(Spell.Value, owner.Mana);
            int powerDrained = -owner.ChangeMana(owner, GameLiving.eManaChangeType.Spell, -powerTransfer);

            if (powerDrained <= 0)
                return;

            int powerHealed = target.ChangeMana(owner, GameLiving.eManaChangeType.Spell, powerDrained);

            if (powerHealed <= 0)
            {
                SendEffectAnimation(target, 0, false, 0);
                owner.Out.SendMessage(String.Format("{0} is at full power already!",
                    target.Name), eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
            }
            else
            {
                SendEffectAnimation(target, 0, false, 1);
                owner.Out.SendMessage(String.Format("You transfer {0} power to {1}!",
                    powerHealed, target.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

                if (target is GamePlayer)
                    (target as GamePlayer).Out.SendMessage(String.Format("{0} transfers {1} power to you!",
                        owner.Name, powerHealed), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
            }
        }
        /// <summary>
        /// Heals hit points of one target and sends needed messages, no spell effects
        /// </summary>
        /// <param name="target"></param>
        /// <param name="amount">amount of hit points to heal</param>
        /// <returns>true if heal was done</returns>
        public virtual bool HealTarget(GameLiving target, int amount)
        {
            if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false;

            // we can't heal people we can attack
            if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true))
                return false;

            if (!target.IsAlive)
            {
                //"You cannot heal the dead!" sshot550.tga
                MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted);
                return false;
            }

            int heal = target.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, amount);

            if (heal == 0)
            {
                if (Spell.Pulse == 0)
                {
                    if (target == m_caster) MessageToCaster("Your power is full.", eChatType.CT_SpellResisted);
                    else MessageToCaster(target.GetName(0, true) + " power is full.", eChatType.CT_SpellResisted);
                }
                return false;
            }

            if (m_caster == target)
            {
                MessageToCaster("You restore " + heal + " power points.", eChatType.CT_Spell);
                if (heal < amount)
                    MessageToCaster("Your power is full.", eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You restore " + target.GetName(0, false) + " for " + heal + " power points!", eChatType.CT_Spell);
                MessageToLiving(target, "Your power was restored by " + m_caster.GetName(0, false) + " for " + heal + " points.", eChatType.CT_Spell);
                if (heal < amount)
                    MessageToCaster(target.GetName(0, true) + " mana is full.", eChatType.CT_Spell);
            }
            return true;
        }
Beispiel #12
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness);
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;
            neweffect.Start(target);
            int mana = (int)(Spell.Damage);
            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));

            if (target is GamePlayer)
            {
                ((GamePlayer)target).Out.SendMessage(m_caster.Name + " steals you " + mana + " points of power!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            }

            StealMana(target, mana);
            // target.StartInterruptTimer(SPELL_INTERRUPT_DURATION, AttackData.eAttackType.Spell, Caster);
        }
Beispiel #13
0
		public override void OnDirectEffect(GameLiving target, double effectiveness)
		{
			if (target == null) return;
			if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;
			//spell damage shood be 50-100 (thats the ammmount power tapped on use)
			int mana = (int)(Spell.Damage);
			target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));
			//~yemla~Power rend shouldn't inrupt if im correct? A.k ML9 Perfector Power Drainging Ward Please more info on it.
			//target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
		}