當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.HealEffect方法代碼示例

本文整理匯總了C#中Terraria.Player.HealEffect方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.HealEffect方法的具體用法?C# Player.HealEffect怎麽用?C# Player.HealEffect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Terraria.Player的用法示例。


在下文中一共展示了Player.HealEffect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ModifyHitNPC

        public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
        {
            Vector2 loc = player.itemLocation;
            loc.Y -= 20;

            Random rand = new Random();
            int r = rand.Next(0, 6);

            if (r == 0)
            {
                for (int i = 0; i < 9; i++)
                {
                    Dust.NewDust(loc, 50, 30, mod.DustType("Garnsworddust"), 0.0F, 0.0F, 0, default(Color), 4.5F);
                }

                damage += (int) (damage * 0.4);

                int healamount = (int)(damage * 0.33);
                player.HealEffect(healamount, true);

                if (player.statLife + healamount <= (player.statLifeMax + player.statLifeMax2))
                {
                    player.statLife += healamount;
                }
                else
                {
                    player.statLife = (player.statLifeMax + player.statLifeMax2);
                }
            }
        }
開發者ID:Garnetty97,項目名稱:Garnmod,代碼行數:30,代碼來源:Garnsword.cs

示例2: UseItem

        /// <summary>
        /// 
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public override bool? UseItem(Player p)
        {
            int heal = Math.Max(Main.rand.Next(90, 130), p.statLifeMax2 - p.statLife);

            p.statLife += heal;

            p.HealEffect(heal);

            return true;
        }
開發者ID:RainbowDashGaming,項目名稱:Terraria-Avalon-MODIFIED,代碼行數:15,代碼來源:Medicine+Bottle.cs

示例3: Activate

 /// <summary>
 /// Activates the tome skill.
 /// </summary>
 /// <param name="p">The <see cref="Player" /> that activated the skill.</param>
 /// <remarks>No NetMessages have to be sent, this method is called on all clients and the server.</remarks>
 public override void Activate(Player p)
 {
     if (p.direction == 1)
     {
         if (p.statMana > 20)
         {
             p.statLife += 20;
             p.statMana -= 20;
             p.HealEffect(20);
         }
     }
     else if (p.statLife > 20)
     {
         p.statMana += 20;
         p.statLife -= 5 ;
         p.ManaEffect(20);
     }
 }
開發者ID:RainbowDashGaming,項目名稱:Terraria-Avalon-MODIFIED,代碼行數:23,代碼來源:Tale+of+the+Dolt.cs

示例4: OnHitNPC

 public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
 {
     player.HealEffect(3);
     player.statLife += 3;
 }
開發者ID:ColinAV516,項目名稱:EnergyMod,代碼行數:5,代碼來源:LeechingSword.cs

示例5: Activate

        /// <summary>
        /// Activates the tome skill.
        /// </summary>
        /// <param name="p">The <see cref="Player" /> that activated the skill.</param>
        /// <remarks>No NetMessages have to be sent, this method is called on all clients and the server.</remarks>
        public override void Activate(Player p)
        {
            if (p.statMana < 30f* p.manaCost)
                return;
            p.statMana = (int)(p.statMana - 30f * p.manaCost);

            if (Main.rand.Next(5) == 0 && (p.wet || p.lavaWet))
            {
                if (p.wet)
                    p.breath += 50;
                if (p.lavaWet)
                    p.AddBuff(1, 180);
            }
            else if (Main.rand.Next(2) == 0)
            {
                p.statMana += 130;
                p.ManaEffect(130);
            }
            else
            {
                p.statLife += 100;
                p.HealEffect(100);
            }
        }
開發者ID:RainbowDashGaming,項目名稱:Terraria-Avalon-MODIFIED,代碼行數:29,代碼來源:Love+Up+and+Down.cs


注:本文中的Terraria.Player.HealEffect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。