Terraria.Player.HealEffect C# (CSharp) Method

HealEffect() public method

public HealEffect ( int healAmount, bool broadcast = true ) : void
healAmount int
broadcast bool
return void
        public void HealEffect(int healAmount, bool broadcast = true)
        {
            CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.HealLife, string.Concat((object)healAmount), false, false);
            if (!broadcast || Main.netMode != 1 || this.whoAmI != Main.myPlayer)
                return;
            NetMessage.SendData(35, -1, -1, "", this.whoAmI, (float)healAmount, 0.0f, 0.0f, 0, 0, 0);
        }

Usage Example

Example #1
0
        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);
                }
            }
        }
All Usage Examples Of Terraria.Player::HealEffect
Player