14237 {
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14643 {
14645 {
14648 vector.Y /= 0.8f;
14651 }
14652 }
14653 else if (
type == 973)
14654 {
14655 Vector2 v = targetRect.ClosestPointInRect(
base.Center) -
base.Center;
14656 v.SafeNormalize(Vector2.UnitX);
14658 if (((Vector2)(
ref v)).Length() <
num12 && Collision.CanHit(
base.Center, 0, 0, ((Rectangle)(
ref targetRect)).Center.ToVector2(), 0, 0))
14659 {
14660 return true;
14661 }
14662 }
14663 else
14664 {
14666 {
14667 if (!((Rectangle)(
ref myRect)).Intersects(targetRect))
14668 {
14669 return false;
14670 }
14671 return Collision.CanHit(
base.Center, 0, 0, ((Rectangle)(
ref targetRect)).Center.ToVector2(), 0, 0);
14672 }
14674 {
14679 {
14680 return true;
14681 }
14682 }
14683 else
14684 {
14686 {
14692 {
14693 return true;
14694 }
14697 {
14700 {
14701 return true;
14702 }
14703 }
14704 return false;
14705 }
14707 {
14709 {
14710 Rectangle value = Utils.CenteredRectangle(
base.Center +
new Vector2((
float)(
direction * 40), 0
f),
new Vector2(80
f, 40
f));
14711 if (((Rectangle)(
ref targetRect)).Intersects(value))
14712 {
14713 return true;
14714 }
14715 }
14716 }
14717 else
14718 {
14720 {
14723 for (
int i = 14; i <
oldPos.Length; i += 15)
14724 {
14727 {
14733 {
14734 return true;
14735 }
14736 }
14737 }
14742 {
14743 return true;
14744 }
14745 return false;
14746 }
14748 {
14750 {
14755 if (((Rectangle)(
ref rectangle)).Intersects(targetRect))
14756 {
14757 return true;
14758 }
14759 }
14760 }
14761 else
14762 {
14764 {
14771 {
14772 return true;
14773 }
14774 return false;
14775 }
14777 {
14782 Vector2
vector8 =
f4.ToRotationVector2();
14786 {
14787 return true;
14788 }
14789 return false;
14790 }
14792 {
14796 Vector2
vector9 =
f5.ToRotationVector2();
14800 {
14801 return true;
14802 }
14803 return false;
14804 }
14806 {
14815 {
14816 return true;
14817 }
14819 {
14820 return true;
14821 }
14823 {
14824 return true;
14825 }
14826 return false;
14827 }
14828 if (
type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
14829 {
14830 ((Rectangle)(
ref targetRect)).
Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
14831 }
14832 else
14833 {
14835 {
14838 for (
int j = 0;
j <
num7;
j += 2)
14839 {
14842 {
14845 if (((Rectangle)(
ref hitbox2)).Intersects(targetRect))
14846 {
14847 return true;
14848 }
14849 }
14850 }
14851 return false;
14852 }
14854 {
14856 for (
int k = 0;
k <
num8;
k++)
14857 {
14860 {
14862 {
14864 if (((Rectangle)(
ref val)).Intersects(targetRect))
14865 {
14866 return true;
14867 }
14868 }
14869 }
14870 }
14871 return false;
14872 }
14874 {
14878 {
14881 if (((Rectangle)(
ref myRect)).Intersects(targetRect))
14882 {
14883 return true;
14884 }
14885 }
14886 return false;
14887 }
14888 if (
type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
14889 {
14890 ((Rectangle)(
ref targetRect)).
Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
14891 }
14892 else if (
type == 963 &&
ai[0] >= 2
f)
14893 {
14894 ((Rectangle)(
ref targetRect)).
Inflate(30, 30);
14895 }
14896 else if (
type == 758)
14897 {
14899 {
14901 if (((Rectangle)(
ref val)).Intersects(targetRect))
14902 {
14903 return true;
14904 }
14905 }
14906 }
14907 else if (
type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
14908 {
14909 ((Rectangle)(
ref targetRect)).
Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
14910 }
14911 else if (
type == 607)
14912 {
14915 }
14916 else if (
type == 661)
14917 {
14918 if (Vector2.Distance(((Rectangle)(
ref myRect)).Center.ToVector2(), ((Rectangle)(
ref targetRect)).Center.ToVector2()) > 500
f || !Collision.CanHitLine(((Rectangle)(
ref myRect)).Center.ToVector2(), 0, 0, ((Rectangle)(
ref targetRect)).Center.ToVector2(), 0, 0))
14919 {
14920 return false;
14921 }
14922 }
14923 else
14924 {
14926 {
14927 if (((Rectangle)(
ref myRect)).Intersects(targetRect) && targetRect.Distance(
base.Center) < (
float)(
height / 2 - 20))
14928 {
14930 {
14931 return true;
14932 }
14933 if (
AI_137_CanHit(targetRect.TopLeft() +
new Vector2((
float)(targetRect.Width / 2), 0
f)))
14934 {
14935 return true;
14936 }
14937 }
14938 return false;
14939 }
14941 {
14944 {
14950 {
14952 }
14954 {
14956 if (((Rectangle)(
ref val)).Intersects(targetRect))
14957 {
14958 return true;
14959 }
14960 }
14962 {
14963 return true;
14964 }
14965 }
14966 }
14967 }
14968 }
14969 }
14970 }
14971 }
14972 }
14975 {
14976 return flag.GetValueOrDefault();
14977 }
14978 if (((Rectangle)(
ref myRect)).Intersects(targetRect))
14979 {
14980 return true;
14981 }
14983 {
14986 {
14987 return true;
14988 }
14989 return false;
14990 }
14992 {
14997 {
14999 }
15001 {
15003 }
15005 {
15006 return true;
15007 }
15008 return false;
15009 }
15011 {
15016 {
15017 return true;
15018 }
15019 return false;
15020 }
15022 {
15025 {
15026 return true;
15027 }
15028 return false;
15029 }
15031 {
15034 {
15035 return true;
15036 }
15037 return false;
15038 }
15040 {
15043 {
15044 return true;
15045 }
15046 return false;
15047 }
15049 {
15052 {
15053 return true;
15054 }
15055 return false;
15056 }
15058 {
15061 {
15062 return true;
15063 }
15064 return false;
15065 }
15067 {
15069 Vector2
vector3 =
velocity.SafeNormalize(Vector2.UnitY).RotatedBy(-1.5707963705062866) *
scale;
15071 {
15072 return true;
15073 }
15074 return false;
15075 }
15077 {
15080 {
15081 return true;
15082 }
15083 return false;
15084 }
15086 {
15089 {
15090 return true;
15091 }
15092 return false;
15093 }
15095 {
15099 {
15101 }
15104 {
15106 }
15110 {
15111 return true;
15112 }
15113 return false;
15114 }
15116 {
15118 {
15121 if (((Rectangle)(
ref myRect)).Intersects(targetRect))
15122 {
15123 return true;
15124 }
15125 }
15126 return false;
15127 }
15129 {
15131 {
15133 {
15136 if (((Rectangle)(
ref myRect)).Intersects(targetRect))
15137 {
15138 return true;
15139 }
15140 }
15141 }
15142 }
15143 else if (
type == 464 &&
ai[1] != 1
f)
15144 {
15145 Vector2
val2 = Utils.RotatedBy(
new Vector2(0
f, -720
f),
velocity.ToRotation());
15149 {
15150 float num20 = (float)
num19 * ((
float)Math.PI * 2
f) / 6
f;
15152 if (((Rectangle)(
ref val)).Intersects(targetRect))
15153 {
15154 return true;
15155 }
15156 }
15157 }
15158 return false;
15159 }
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.
int height
The height of this Entity's hitbox, in pixels.
static bool[] IsAWhip
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile will use whip ...
static ? bool Colliding(Projectile projectile, Rectangle projHitbox, Rectangle targetHitbox)
This serves as the central class from which projectile-related functions are carried out....
HallowBossPelletStormInfo AI_172_GetPelletStormInfo(int stormIndex)
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] oldRot
Holds the value of F:Terraria.Projectile.rotation from previous updates from newest to oldest....
int aiStyle
Selects which vanilla code to use for the AI method. Vanilla projectile AI styles are enumerated in t...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
int penetrate
The remaining number of npc can this projectile hit before dying. (Or tile bounces)....
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
static void FillWhipControlPoints(Projectile proj, List< Vector2 > controlPoints)
Vector2[] oldPos
Holds the value of F:Terraria.Entity.position from previous updates from newest to oldest....
static Rectangle _lanceHitboxBounds
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool AI_019_Spears_GetExtensionHitbox(out Rectangle extensionBox)
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
int AI_172_GetPelletStormsCount()
List< Vector2 > WhipPointsForCollision
bool AI_137_CanHit(Vector2 targetPosition)
float scale
Scales how large the projectile will be drawn. Will also affect the hitbox (F:Terraria....