当前位置: 首页>>代码示例>>C#>>正文


C# GameLiving.ChangeMana方法代码示例

本文整理汇总了C#中GameLiving.ChangeMana方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.ChangeMana方法的具体用法?C# GameLiving.ChangeMana怎么用?C# GameLiving.ChangeMana使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameLiving的用法示例。


在下文中一共展示了GameLiving.ChangeMana方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

		/// <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);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:30,代码来源:MysticCrystalLoreAbility.cs

示例2: OnDirectEffect

        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);
        }
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:11,代码来源:Battlemaster.cs

示例3: OnDirectEffect

        /// <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);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:42,代码来源:PowerTransfer.cs

示例4: HealTarget

        /// <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;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:48,代码来源:PowerHealSpellHandler.cs

示例5: ApplyEffectOnTarget

        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);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:17,代码来源:Stormlord.cs

示例6: OnDirectEffect

		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);
		}
开发者ID:andyhebear,项目名称:DOLSharp,代码行数:10,代码来源:Convoker.cs


注:本文中的GameLiving.ChangeMana方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。