49784 {
49785
49786
49787
49788
49789
49790
49791
49792
49793
49794
49795
49796
49797
49798
49799
49800
49801
49802
49803
49804
49805
49806
49807
49808
49809
49810
49811
49812
49813
49814
49815
49816
49817
49818
49819
49820
49821
49822
49823
49824
49825
49826
49827
49828
49829
49830
49831
49832
49833
49834
49835
49836
49837
49838
49839
49840
49841
49842
49843
49844
49845
49846
49847
49848
49849
49850
49851
49852
49853
49854
49855
49856
49857
49858
49859
49860
49861
49862
49863
49864
49865
49866
49867
49868
49869
49870
49871
49872
49873
49874
49875
49876
49877
49878
49879
49880
49881
49882
49883
49884
49885
49886
49887
49888
49889
49890
49891
49892
49893
49894
49895
49896
49897
49898
49899
49900
49901
49902
49903
49904
49905
49906
49907
49908
49909
49910
49911
49912
49913
49914
49915
49916
49917
49918
49919
49920
49921
49922
49923
49924
49925
49926
49927
49928
49929
49930
49931
49932
49933
49934
49935
49936
49937
49938
49939
49940
49941
49942
49943
49944
49945
49946
49947
49948
49949
49950
49951
49952
49953
49954
49955
49956
49957
49958
49959
49960
49961
49962
49963
49964
49965
49966
49967
49968
49969
49970
49971
49972
49973
49974
49975
49976
49977
49978
49979
49980
49981
49982
49983
49984
49985
49986
49987
49988
49989
49990
49991
49992
49993
49994
49995
49996
49997
49998
49999
50000
50001
50002
50003
50004
50005
50006
50007
50008
50009
50010
50011
50012
50013
50014
50015
50016
50017
50018
50019
50020
50021
50022
50023
50024
50025
50026
50027
50028
50029
50030
50031
50032
50033
50034
50035
50036
50037
50038
50039
50040
50041
50042
50043
50044
50045
50046
50047
50048
50049
50050
50051
50052
50053
50054
50055
50056
50057
50058
50059
50060
50061
50063 {
50065 }
50067 {
50070 {
50072 }
50073 }
50075 {
50076 int num = (int)(
base.Center.X / 16
f);
50079 {
50081 if (tile !=
null && tile.active() && (
TileID.
Sets.
Platforms[tile.type] || tile.type == 380))
50082 {
50084 return;
50085 }
50086 }
50087 }
50090 {
50092 {
50095 }
50096 for (int i = 0; i < 255; i++)
50097 {
50098 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost)
50099 {
50100 center = base.Center - Main.player[i].Center;
50102 {
50104 return;
50105 }
50106 }
50107 }
50108 }
50111 {
50112 try
50113 {
50119 {
50121 }
50122 if (
num24 > Main.maxTilesX)
50123 {
50124 num24 = Main.maxTilesX;
50125 }
50127 {
50129 }
50130 if (
num26 > Main.maxTilesY)
50131 {
50132 num26 = Main.maxTilesY;
50133 }
50134 Vector2
vector =
default(Vector2);
50136 {
50138 {
50139 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])
50140 {
50141 continue;
50142 }
50146 {
50147 continue;
50148 }
50150 {
50152 Vector2 value =
vector +
new Vector2(8
f, 8
f);
50153 if (Vector2.Distance(
base.Center, value) <
num27)
50154 {
50155 base.Center +=
velocity.SafeNormalize(Vector2.Zero) * -4
f;
50156 }
50159 }
50161 velocity.Y = -0.2f;
50163 }
50164 }
50165 }
50166 catch
50167 {
50168 }
50169 }
50171 {
50172 Point
p =
base.Center.ToTileCoordinates();
50173 if (
WorldGen.SolidOrSlopedTile(Framing.GetTileSafely(
p.X,
p.Y)))
50174 {
50175 Vector2 v =
p.ToWorldCoordinates() -
base.Center;
50176 base.Center += v.SafeNormalize(Vector2.Zero) * -4
f;
50177 }
50178 }
50180 {
50182 Vector2
v2 =
DirectionTo(player.Center).SafeNormalize(Vector2.UnitX * (
float)player.direction);
50188 if (Main.rand.Next(3) == 0)
50189 {
50190 Dust dust = Dust.NewDustPerfect(
base.Center +
vector2 * 10
f, 59,
vector2 * 2
f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0,
default(Color), 2
f);
50191 dust.noGravity = true;
50192 if (Main.rand.Next(3) == 0)
50193 {
50194 dust.velocity *= 1.5f;
50195 dust.noGravity = false;
50197 }
50198 }
50199 if (Main.rand.Next(3) == 0)
50200 {
50203 }
50204 if (Main.rand.Next(15) == 0)
50205 {
50206 Dust
dust2 = Dust.NewDustPerfect(
base.Center +
vector2 * 10
f, 88,
vector2 * 3
f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0,
default(Color), 2
f);
50207 dust2.noGravity = true;
50208 if (Main.rand.Next(3) == 0)
50209 {
50210 dust2.velocity *= 1.5f;
50211 }
50212 }
50213 bool flag2 = Main.rand.Next(30) == 0;
50215 {
50217 }
50219 {
50220 float num2 = (float)
Math.PI * 2
f * Main.rand.NextFloat();
50222 {
50227 center =
default(Vector2);
50230 dust5.noGravity = true;
50231 dust5.fadeIn = 1.6f;
50232 }
50233 }
50235 {
50238 {
50240 }
50241 }
50242 }
50244 {
50248 {
50250 }
50253 {
50255 }
50257 {
50261 {
50263 }
50264 }
50265 }
50267 {
50269 }
50272 {
50274 }
50275 else if (
type == 784 ||
type == 805)
50276 {
50277 num5 = ((Main.rand.Next(3) == 0) ? 6 : Dust.dustWater());
50278 }
50279 else if (
type == 787 ||
type == 806)
50280 {
50281 num5 = ((Main.rand.Next(3) == 0) ? 6 : 35);
50282 }
50283 else if (
type == 790 ||
type == 807)
50284 {
50285 num5 = ((Main.rand.Next(3) == 0) ? 6 : 152);
50286 }
50288 {
50290 {
50292 }
50294 {
50297 }
50300 {
50303 }
50305 {
50307 }
50309 {
50310 position.X +=
width / 2;
50311 position.Y +=
height / 2;
50314 position.X -=
width / 2;
50315 position.Y -=
height / 2;
50320 }
50321 }
50323 {
50324 position.X +=
width / 2;
50325 position.Y +=
height / 2;
50328 position.X -=
width / 2;
50329 position.Y -=
height / 2;
50330 }
50332 {
50334 }
50335 else
50336 {
50338 {
50340 }
50342 {
50345 {
50347 }
50348 else
50349 {
50352 {
50354 }
50355 }
50356 for (
int l = 0;
l < 2;
l++)
50357 {
50361 {
50362 num6 = velocity.X * 0.5f;
50363 num7 = velocity.Y * 0.5f;
50364 }
50366 {
50367 continue;
50368 }
50369 if (Main.rand.Next(2) == 0)
50370 {
50372 Main.dust[
num8].scale *= 1.4f + (float)Main.rand.Next(10) * 0.1f;
50374 obj2.velocity *= 0.2f;
50375 Main.dust[
num8].noGravity =
true;
50376 if (Main.dust[
num8].type == 152)
50377 {
50378 Main.dust[
num8].scale *= 0.5f;
50381 }
50382 else if (Main.dust[
num8].type == 35)
50383 {
50384 Main.dust[
num8].scale *= 0.5f;
50387 }
50388 else if (Main.dust[
num8].type == Dust.dustWater())
50389 {
50390 Main.dust[
num8].scale *= 0.65f;
50393 }
50395 {
50397 if (
dust3.dustIndex != 6000)
50398 {
50400 dust3.velocity = Main.rand.NextVector2Circular(3
f, 3
f);
50401 dust3.noGravity = true;
50402 }
50403 if (
dust3.dustIndex != 6000)
50404 {
50406 dust3.velocity = ((float)
Math.PI * 2
f * ((
float)
timeLeft / 20
f)).ToRotationVector2() * 3
f;
50407 dust3.noGravity = true;
50408 }
50409 }
50410 }
50411 if (Main.rand.Next(2) == 0)
50412 {
50414 Main.dust[
num9].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.1f;
50416 obj6.velocity *= 0.05f;
50417 }
50418 }
50423 {
50425 }
50426 bool flag3 =
false;
50429 {
50431 for (
int m = 0;
m < 200;
m++)
50432 {
50433 if (Main.npc[
m].CanBeChasedBy(
this))
50434 {
50435 float num11 = Main.npc[
m].position.X + (float)(Main.npc[
m].width / 2);
50436 float num13 = Main.npc[
m].position.Y + (float)(Main.npc[
m].height / 2);
50439 {
50444 }
50445 }
50446 }
50447 }
50449 {
50450 x = position.X + (float)(
width / 2) + velocity.X * 100
f;
50451 y = position.Y + (float)(
height / 2) + velocity.Y * 100
f;
50452 }
50455 {
50457 }
50458 Vector2
value2 = (
new Vector2(x, y) -
base.Center).SafeNormalize(-Vector2.UnitY) *
num15;
50460 }
50462 {
50464 {
50465 for (
int n = 0;
n < 2;
n++)
50466 {
50470 {
50471 num16 = velocity.X * 0.5f;
50472 num17 = velocity.Y * 0.5f;
50473 }
50475 Main.dust[
num18].scale *= 2
f + (float)Main.rand.Next(10) * 0.1f;
50477 obj7.velocity *= 0.2f;
50478 Main.dust[
num18].noGravity =
true;
50479 if (Main.dust[
num18].type == 152)
50480 {
50481 Main.dust[
num18].scale *= 0.5f;
50484 }
50485 else if (Main.dust[
num18].type == 35)
50486 {
50487 Main.dust[
num18].scale *= 0.5f;
50490 }
50491 else if (Main.dust[
num18].type == Dust.dustWater())
50492 {
50493 Main.dust[
num18].scale *= 0.65f;
50495 obj10.velocity +=
velocity * 0.1f;
50496 }
50498 {
50500 if (
dust4.dustIndex != 6000)
50501 {
50503 dust4.velocity = Main.rand.NextVector2Circular(3
f, 3
f);
50504 dust4.noGravity = true;
50505 }
50506 if (
dust4.dustIndex != 6000)
50507 {
50509 dust4.velocity = ((float)
Math.PI * 2
f * ((
float)
timeLeft / 20
f)).ToRotationVector2() * 3
f;
50510 dust4.noGravity = true;
50511 }
50512 }
50514 Main.dust[
num18].fadeIn = 1
f + (float)Main.rand.Next(5) * 0.1f;
50516 obj11.velocity *= 0.05f;
50517 }
50518 }
50520 {
50522 }
50523 }
50525 {
50527 Main.dust[
num19].scale *= 1
f + (float)Main.rand.Next(10) * 0.1f;
50529 obj12.velocity *= 0.2f;
50530 Main.dust[
num19].noGravity =
true;
50531 }
50533 {
50534 if ((
double)velocity.X > -0.2 && (double)
velocity.X < 0.2 && (
double)velocity.Y > -0.2 && (double)
velocity.Y < 0.2)
50535 {
50538 {
50540 }
50541 }
50542 else
50543 {
50546 Main.dust[
num20].scale *= 1.6f + (float)Main.rand.Next(5) * 0.1f;
50548 obj13.velocity *= 0.05f;
50549 Main.dust[
num20].noGravity =
true;
50550 }
50551 }
50553 {
50554 if (Main.rand.Next(25) == 0)
50555 {
50557 dust6.noGravity = true;
50558 dust6.velocity *= 0
f;
50559 dust6.scale = 1.3f;
50560 }
50561 if (Main.rand.Next(5) == 0)
50562 {
50564 dust7.noGravity = true;
50565 dust7.velocity *= 0
f;
50566 dust7.scale = 1.3f;
50567 }
50569 {
50571 frame = Main.rand.Next(4);
50572 }
50573 }
50575 {
50577 Main.dust[
num21].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
50578 Main.dust[
num21].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
50579 Main.dust[
num21].noGravity =
true;
50584 center =
default(Vector2);
50588 {
50590 }
50592 {
50593 num22 = Dust.dustWater();
50594 }
50596 {
50598 }
50600 {
50602 }
50604 {
50606 }
50608 dust8.scale = 1
f + (float)Main.rand.Next(5) * 0.1f;
50609 dust8.noGravity = true;
50613 center =
default(Vector2);
50615 }
50616 else if (
type == 681)
50617 {
50619 dust9.scale = 1
f + (float)Main.rand.Next(5) * 0.1f;
50620 dust9.noGravity = true;
50624 center =
default(Vector2);
50626 }
50627 }
50630 {
50632 {
50635 }
50636 else
50637 {
50640 }
50641 }
50643 {
50645 {
50647 }
50648 }
50650 {
50651 velocity.Y += 0.2f;
50653 if ((
double)velocity.X > -0.1 && (double)
velocity.X < 0.1)
50654 {
50656 }
50657 if ((
double)velocity.Y > -0.1 && (double)
velocity.Y < 0.1)
50658 {
50660 }
50661 }
50663 {
50665 {
50667 {
50668 velocity.X *= 0.95f;
50669 }
50670 velocity.Y += 0.2f;
50671 }
50672 }
50674 {
50677 {
50678 velocity.X *= 0.97f;
50680 {
50681 velocity.X *= 0.99f;
50682 }
50683 if ((
double)velocity.X > -0.01 && (double)
velocity.X < 0.01)
50684 {
50687 }
50688 }
50689 velocity.Y += 0.2f;
50691 {
50694 }
50695 }
50697 {
50699 }
50701 {
50703 }
50704 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Vector2 position
The position of this Entity in world coordinates.
int width
The width of this Entity's hitbox, in pixels.
Vector2 DirectionTo(Vector2 Destination)
int height
The height of this Entity's hitbox, in pixels.
static readonly SoundStyle Item10
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
Point GetScarabBombDigDirectionSnap8()
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
int alpha
How transparent to draw this projectile. 0 to 255. 255 is completely transparent. ExampleBulletsets...
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
int frame
The frame number in the spritesheet that this projectile will be drawn with. Assign in M:Terraria....
float knockBack
This will always be set in Projectile.NewProjectile based on the weapons knockback and player stat mo...
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
bool hostile
If True, this projectile will hurt players and friendly NPCs (F:Terraria.NPC.friendly) Defaults to ...
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.