38765 {
38767 {
38769 }
38771 {
38774 {
38776 }
38777 }
38779 {
38780 int num = (int)(
base.Center.X / 16f);
38781 int num2 = (int)(
base.Center.Y / 16f);
38783 {
38785 if (tile !=
null && tile.active() && (
TileID.
Sets.
Platforms[tile.type] || tile.type == 380))
38786 {
38788 return;
38789 }
38790 }
38791 }
38793 {
38795 {
38798 }
38799 for (
int i = 0;
i < 255;
i++)
38800 {
38801 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost && (
base.Center - Main.player[i].Center).Length() < 40f)
38802 {
38804 return;
38805 }
38806 }
38807 }
38808 bool flag = false;
38810 {
38811 try
38812 {
38818 {
38820 }
38821 if (
num4 > Main.maxTilesX)
38822 {
38823 num4 = Main.maxTilesX;
38824 }
38826 {
38828 }
38829 if (
num6 > Main.maxTilesY)
38830 {
38831 num6 = Main.maxTilesY;
38832 }
38835 {
38837 {
38838 if (Main.tile[
j,
k] ==
null || !Main.tile[
j,
k].nactive() || !Main.tileSolid[Main.tile[
j,
k].type] || Main.tileSolidTop[Main.tile[
j,
k].type])
38839 {
38840 continue;
38841 }
38845 {
38846 continue;
38847 }
38849 {
38853 {
38855 }
38858 }
38859 velocity.X = 0f;
38860 velocity.Y = -0.2f;
38861 flag = true;
38862 }
38863 }
38864 }
38865 catch
38866 {
38867 }
38868 }
38869 if (flag &&
type == 911)
38870 {
38871 Point p =
base.Center.ToTileCoordinates();
38872 if (
WorldGen.SolidOrSlopedTile(Framing.GetTileSafely(p.
X, p.
Y)))
38873 {
38874 Vector2 v = p.ToWorldCoordinates() -
base.Center;
38875 base.Center += v.SafeNormalize(
Vector2.
Zero) * -4f;
38876 }
38877 }
38878 if (flag &&
type == 773)
38879 {
38887 if (Main.rand.Next(3) == 0)
38888 {
38889 Dust dust = Dust.NewDustPerfect(
base.Center +
vector2 * 10f, 59,
vector2 * 2f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0,
default(
Color), 2f);
38890 dust.noGravity = true;
38891 if (Main.rand.Next(3) == 0)
38892 {
38893 dust.velocity *= 1.5f;
38894 dust.noGravity = false;
38895 dust.scale /= 2f;
38896 }
38897 }
38898 if (Main.rand.Next(3) == 0)
38899 {
38902 }
38903 if (Main.rand.Next(15) == 0)
38904 {
38905 Dust
dust2 = Dust.NewDustPerfect(
base.Center +
vector2 * 10f, 88,
vector2 * 3f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0,
default(
Color), 2f);
38906 dust2.noGravity = true;
38907 if (Main.rand.Next(3) == 0)
38908 {
38909 dust2.velocity *= 1.5f;
38910 }
38911 }
38912 bool flag2 = Main.rand.Next(30) == 0;
38914 {
38916 }
38918 {
38919 float num10 = (float)
Math.
PI * 2f * Main.rand.NextFloat();
38921 {
38926 dust3.noGravity = true;
38927 dust3.fadeIn = 1.6f;
38928 }
38929 }
38931 {
38934 {
38936 }
38937 }
38938 }
38940 {
38944 {
38946 }
38949 {
38951 }
38953 {
38957 {
38959 }
38960 }
38961 }
38963 {
38965 }
38968 {
38970 }
38971 else if (
type == 784 ||
type == 805)
38972 {
38973 num13 = ((Main.rand.Next(3) == 0) ? 6 : Dust.dustWater());
38974 }
38975 else if (
type == 787 ||
type == 806)
38976 {
38977 num13 = ((Main.rand.Next(3) == 0) ? 6 : 35);
38978 }
38979 else if (
type == 790 ||
type == 807)
38980 {
38981 num13 = ((Main.rand.Next(3) == 0) ? 6 : 152);
38982 }
38984 {
38986 {
38987 velocity.Y = 10f;
38988 }
38990 {
38993 }
38996 {
38999 }
39001 {
39003 }
39005 {
39006 position.X +=
width / 2;
39007 position.Y +=
height / 2;
39010 position.X -=
width / 2;
39011 position.Y -=
height / 2;
39016 }
39017 }
39019 {
39020 position.X +=
width / 2;
39021 position.Y +=
height / 2;
39024 position.X -=
width / 2;
39025 position.Y -=
height / 2;
39026 }
39028 {
39030 }
39031 else
39032 {
39034 {
39036 }
39038 {
39041 {
39043 }
39044 else
39045 {
39048 {
39050 }
39051 }
39052 for (
int l = 0;
l < 2;
l++)
39053 {
39057 {
39058 num14 = velocity.X * 0.5f;
39059 num15 = velocity.Y * 0.5f;
39060 }
39062 {
39063 continue;
39064 }
39065 if (Main.rand.Next(2) == 0)
39066 {
39068 Main.dust[
num16].scale *= 1.4f + (float)Main.rand.Next(10) * 0.1f;
39069 Main.dust[
num16].velocity *= 0.2f;
39070 Main.dust[
num16].noGravity =
true;
39071 if (Main.dust[
num16].type == 152)
39072 {
39073 Main.dust[
num16].scale *= 0.5f;
39075 }
39076 else if (Main.dust[
num16].type == 35)
39077 {
39078 Main.dust[
num16].scale *= 0.5f;
39080 }
39081 else if (Main.dust[
num16].type == Dust.dustWater())
39082 {
39083 Main.dust[
num16].scale *= 0.65f;
39085 }
39087 {
39089 if (
dust4.dustIndex != 6000)
39090 {
39092 dust4.velocity = Main.rand.NextVector2Circular(3f, 3f);
39093 dust4.noGravity = true;
39094 }
39095 if (
dust4.dustIndex != 6000)
39096 {
39098 dust4.velocity = ((float)
Math.
PI * 2f * ((
float)
timeLeft / 20f)).ToRotationVector2() * 3f;
39099 dust4.noGravity = true;
39100 }
39101 }
39102 }
39103 if (Main.rand.Next(2) == 0)
39104 {
39106 Main.dust[
num17].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.1f;
39107 Main.dust[
num17].velocity *= 0.05f;
39108 }
39109 }
39112 float num18 = 600f;
39114 {
39116 }
39117 bool flag3 =
false;
39120 {
39122 for (
int m = 0;
m < 200;
m++)
39123 {
39124 if (Main.npc[
m].CanBeChasedBy(
this))
39125 {
39126 float num19 = Main.npc[
m].position.X + (float)(Main.npc[
m].width / 2);
39127 float num20 = Main.npc[
m].position.Y + (float)(Main.npc[
m].height / 2);
39130 {
39135 }
39136 }
39137 }
39138 }
39140 {
39141 x = position.X + (float)(
width / 2) + velocity.X * 100f;
39142 y = position.Y + (float)(
height / 2) + velocity.Y * 100f;
39143 }
39146 {
39148 }
39151 }
39153 {
39155 {
39156 for (
int n = 0;
n < 2;
n++)
39157 {
39161 {
39162 num23 = velocity.X * 0.5f;
39163 num24 = velocity.Y * 0.5f;
39164 }
39166 Main.dust[
num25].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
39167 Main.dust[
num25].velocity *= 0.2f;
39168 Main.dust[
num25].noGravity =
true;
39169 if (Main.dust[
num25].type == 152)
39170 {
39171 Main.dust[
num25].scale *= 0.5f;
39173 }
39174 else if (Main.dust[
num25].type == 35)
39175 {
39176 Main.dust[
num25].scale *= 0.5f;
39178 }
39179 else if (Main.dust[
num25].type == Dust.dustWater())
39180 {
39181 Main.dust[
num25].scale *= 0.65f;
39183 }
39185 {
39187 if (
dust5.dustIndex != 6000)
39188 {
39190 dust5.velocity = Main.rand.NextVector2Circular(3f, 3f);
39191 dust5.noGravity = true;
39192 }
39193 if (
dust5.dustIndex != 6000)
39194 {
39196 dust5.velocity = ((float)
Math.
PI * 2f * ((
float)
timeLeft / 20f)).ToRotationVector2() * 3f;
39197 dust5.noGravity = true;
39198 }
39199 }
39201 Main.dust[
num25].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
39202 Main.dust[
num25].velocity *= 0.05f;
39203 }
39204 }
39206 {
39208 }
39209 }
39211 {
39213 Main.dust[
num26].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
39214 Main.dust[
num26].velocity *= 0.2f;
39215 Main.dust[
num26].noGravity =
true;
39216 }
39218 {
39219 if ((
double)velocity.X > -0.2 && (double)
velocity.
X < 0.2 && (
double)velocity.Y > -0.2 && (double)
velocity.
Y < 0.2)
39220 {
39223 {
39225 }
39226 }
39227 else
39228 {
39231 Main.dust[
num27].scale *= 1.6f + (float)Main.rand.Next(5) * 0.1f;
39232 Main.dust[
num27].velocity *= 0.05f;
39233 Main.dust[
num27].noGravity =
true;
39234 }
39235 }
39237 {
39238 if (Main.rand.Next(25) == 0)
39239 {
39241 dust6.noGravity = true;
39242 dust6.velocity *= 0f;
39243 dust6.scale = 1.3f;
39244 }
39245 if (Main.rand.Next(5) == 0)
39246 {
39248 dust7.noGravity = true;
39249 dust7.velocity *= 0f;
39250 dust7.scale = 1.3f;
39251 }
39253 {
39255 frame = Main.rand.Next(4);
39256 }
39257 }
39259 {
39261 Main.dust[
num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
39262 Main.dust[
num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
39263 Main.dust[
num28].noGravity =
true;
39267 {
39269 }
39271 {
39272 num29 = Dust.dustWater();
39273 }
39275 {
39277 }
39279 {
39281 }
39283 {
39285 }
39287 dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39288 dust8.noGravity = true;
39290 }
39291 else if (
type == 681)
39292 {
39294 dust9.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39295 dust9.noGravity = true;
39297 }
39298 }
39301 {
39303 {
39306 }
39307 else
39308 {
39311 }
39312 }
39314 {
39316 {
39318 }
39319 }
39321 {
39322 velocity.Y += 0.2f;
39324 if ((
double)velocity.X > -0.1 && (double)
velocity.
X < 0.1)
39325 {
39326 velocity.X = 0f;
39327 }
39328 if ((
double)velocity.Y > -0.1 && (double)
velocity.
Y < 0.1)
39329 {
39330 velocity.Y = 0f;
39331 }
39332 }
39334 {
39336 {
39338 {
39339 velocity.X *= 0.95f;
39340 }
39341 velocity.Y += 0.2f;
39342 }
39343 }
39345 {
39348 {
39349 velocity.X *= 0.97f;
39351 {
39352 velocity.X *= 0.99f;
39353 }
39354 if ((
double)velocity.X > -0.01 && (double)
velocity.
X < 0.01)
39355 {
39356 velocity.X = 0f;
39358 }
39359 }
39360 velocity.Y += 0.2f;
39362 {
39365 }
39366 }
39368 {
39370 }
39372 {
39374 }
39375 }
static float Clamp(float value, float min, float max)
static double Atan2(double y, double x)
static double Abs(double value)
static int Sign(decimal value)
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 DirectionTo(Vector2 Destination)
static readonly LegacySoundStyle Item10
Point GetScarabBombDigDirectionSnap8()
static float Distance(Vector2 value1, Vector2 value2)
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)