Terraria.Player.ClearBuff C# (CSharp) Method

ClearBuff() public method

public ClearBuff ( int type ) : void
type int
return void
        public void ClearBuff(int type)
        {
            for (int b = 0; b < 22; ++b)
            {
                if (this.buffType[b] == type)
                    this.DelBuff(b);
            }
        }

Usage Example

Example #1
0
 public void Dismount(Player mountedPlayer)
 {
     if (!this._active)
     {
         return;
     }
     this._active = false;
     mountedPlayer.ClearBuff(this._data.buff);
     if (this._type == 6)
     {
         mountedPlayer.ClearBuff(this._data.extraBuff);
         mountedPlayer.cartFlip           = false;
         mountedPlayer.fullRotation       = 0f;
         mountedPlayer.fullRotationOrigin = Vector2.Zero;
         mountedPlayer.lastBoost          = Vector2.Zero;
     }
     if (Main.netMode != 2)
     {
         for (int i = 0; i < 100; i++)
         {
             if (this._type == 6)
             {
                 if (i % 10 == 0)
                 {
                     int type = Main.rand.Next(61, 64);
                     int num  = Gore.NewGore(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), Vector2.Zero, type, 1f);
                     Main.gore[num].alpha    = 100;
                     Main.gore[num].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
                 }
             }
             else
             {
                 int num2 = Dust.NewDust(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), mountedPlayer.width + 40, mountedPlayer.height, this._data.spawnDust, 0f, 0f, 0, default(Color), 1f);
                 Main.dust[num2].scale += (float)Main.rand.Next(-10, 21) * 0.01f;
                 if (Main.rand.Next(2) == 0)
                 {
                     Main.dust[num2].scale    *= 1.3f;
                     Main.dust[num2].noGravity = true;
                 }
                 else
                 {
                     Main.dust[num2].velocity *= 0.5f;
                 }
                 Main.dust[num2].velocity += mountedPlayer.velocity * 0.8f;
             }
         }
     }
     this.Reset();
     mountedPlayer.position.Y = mountedPlayer.position.Y + (float)mountedPlayer.height;
     mountedPlayer.height     = 42;
     mountedPlayer.position.Y = mountedPlayer.position.Y - (float)mountedPlayer.height;
     if (mountedPlayer.whoAmi == Main.myPlayer)
     {
         NetMessage.SendData(13, -1, -1, "", mountedPlayer.whoAmi, 0f, 0f, 0f, 0);
     }
 }
All Usage Examples Of Terraria.Player::ClearBuff
Player