public void CheckDrowning()
{
bool flag = Collision.DrownCollision(this.position, this.width, this.height, this.gravDir);
if (this.armor[0].itemId == 250)
flag = true;
if (this.inventory[this.selectedItem].itemId == 186)
{
try
{
int index1 = (int)(((double)this.position.X + (double)(this.width / 2) + (double)(6 * this.direction)) / 16.0);
int num = 0;
if ((double)this.gravDir == -1.0)
num = this.height;
int index2 = (int)(((double)this.position.Y + (double)num - 44.0 * (double)this.gravDir) / 16.0);
if ((int)Main.tile[index1, index2].liquid < 128)
{
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index2].active() && Main.tileSolid[(int)Main.tile[index1, index2].type])
{
if (!Main.tileSolidTop[(int)Main.tile[index1, index2].type])
goto label_13;
}
flag = false;
}
}
catch
{
}
}
label_13:
if (this.gills)
flag = false;
if (Main.myPlayer == this.whoAmI)
{
if (this.merman)
flag = false;
if (flag)
{
++this.breathCD;
int num = 7;
if (this.inventory[this.selectedItem].itemId == 186)
num *= 2;
if (this.accDivingHelm)
num *= 4;
if (this.breathCD >= num)
{
this.breathCD = 0;
--this.breath;
if (this.breath == 0)
Main.PlaySound(23, -1, -1, 1);
if (this.breath <= 0)
{
this.lifeRegenTime = 0;
this.breath = 0;
this.statLife -= 2;
if (this.statLife <= 0)
{
this.statLife = 0;
this.KillMe(10.0, 0, false, Lang.deathMsg(-1, -1, -1, 1));
}
}
}
}
else
{
this.breath += 3;
if (this.breath > this.breathMax)
this.breath = this.breathMax;
this.breathCD = 0;
}
}
if (!flag || Main.rand.Next(20) != 0 || (this.lavaWet || this.honeyWet))
return;
int num1 = 0;
if ((double)this.gravDir == -1.0)
num1 += this.height - 12;
if (this.inventory[this.selectedItem].itemId == 186)
Dust.NewDust(new Vector2((float)((double)this.position.X + (double)(10 * this.direction) + 4.0), (float)((double)this.position.Y + (double)num1 - 54.0 * (double)this.gravDir)), this.width - 8, 8, 34, 0.0f, 0.0f, 0, new Color(), 1.2f);
else
Dust.NewDust(new Vector2(this.position.X + (float)(12 * this.direction), (float)((double)this.position.Y + (double)num1 + 4.0 * (double)this.gravDir)), this.width - 8, 8, 34, 0.0f, 0.0f, 0, new Color(), 1.2f);
}