70258 {
70259
70260
70261
70262
70263
70264
70265
70266
70267
70268
70269
70270
70271
70272
70273
70274
70275
70276
70277
70278
70279
70280
70281
70282
70283
70284
70285
70286
70287
70288
70289
70290
70291
70292
70293
70294
70295
70296
70297
70298
70299
70300
70301
70302
70303
70304
70305
70306
70307
70308
70309
70310
70311
70312
70313
70314
70315
70316
70317
70318
70319
70320
70321
70322
70323
70324
70325
70326
70327
70328
70329
70330
70331
70332
70333
70334
70335
70336
70337
70338
70339
70340
70341
70342
70343
70344
70345
70346
70347
70348
70349
70350
70351
70352
70353
70354
70355
70356
70357
70358
70359
70360
70361
70362
70363
70364
70365
70366
70367
70368
70369
70370
70371
70372
70373
70374
70375
70376
70377
70378
70379
70380
70381
70382
70383
70384
70385
70386
70387
70388
70389
70390
70391
70392
70393
70394
70395
70396
70397
70398
70399
70400
70401
70402
70403
70404
70405
70406
70407
70408
70409
70410
70411
70412
70413
70414
70415
70416
70417
70418
70419
70420
70421
70422
70423
70424
70425
70426
70427
70428
70429
70430
70431
70432
70433
70434
70435
70436
70437
70438
70439
70440
70441
70442
70443
70444
70445
70446
70447
70448
70449
70450
70451
70452
70453
70454
70455
70456
70457
70458
70459
70460
70461
70462
70463
70464
70465
70466
70467
70468
70469
70470
70471
70472
70473
70474
70475
70476
70477
70478
70479
70480
70481
70482
70483
70484
70485
70486
70487
70488
70489
70490
70491
70492
70493
70494
70495
70496
70497
70498
70499
70500
70501
70502
70503
70504
70505
70506
70507
70508
70509
70510
70511
70512
70513
70514
70515
70516
70517
70518
70519
70520
70521
70522
70523
70524
70525
70526
70527
70528
70529
70530
70531
70532
70533
70534
70535
70536
70537
70538
70539
70540
70541
70542
70543
70544
70545
70546
70547
70548
70549
70550
70551
70552
70553
70554
70555
70556
70557
70558
70559
70560
70561
70562
70563
70564
70565
70566
70567
70568
70569
70570
70571
70572
70573
70574
70575
70576
70577
70578
70579
70580
70581
70582
70583
70584
70585
70586
70587
70588
70589
70590
70591
70592
70593
70594
70595
70596
70597
70598
70599
70600
70601
70602
70603
70604
70605
70606
70607
70608
70609
70610
70611
70612
70613
70614
70615
70616
70617
70618
70619
70620
70621
70622
70623
70624
70625
70626
70627
70628
70629
70630
70631
70632
70633
70634
70635
70636
70637
70638
70639
70640
70641
70642
70643
70644
70645
70646
70647
70648
70649
70650
70651
70652
70653
70654
70655
70656
70657
70658
70659
70660
70661
70662
70663
70664
70665
70666
70667
70668
70669
70670
70671
70672
70673
70674
70675
70676
70677
70678
70679
70680
70681
70682
70683
70684
70685
70686
70687
70688
70689
70690
70691
70692
70693
70694
70695
70696
70697
70698
70699
70700
70701
70702
70703
70704
70705
70706
70707
70708
70709
70710
70711
70712
70713
70714
70715
70716
70717
70718
70719
70720
70721
70722
70723
70724
70725
70726
70727
70728
70729
70730
70731
70732
70733
70734
70735
70736
70737
70738
70739
70740
70741
70742
70743
70744
70745
70746
70747
70748
70749
70750
70755 float num45 = 0.69f;
70757 {
70758 if (Main.player[
owner].dead)
70759 {
70760 Main.player[
owner].abigailMinion =
false;
70761 }
70762 if (Main.player[
owner].abigailMinion)
70763 {
70765 }
70767 num12 = Main.player[
owner].ownedProjectileCounts[970] - 1;
70772 }
70774 {
70776 }
70778 {
70779 if (Main.player[
owner].dead)
70780 {
70781 Main.player[
owner].hornetMinion =
false;
70782 }
70783 if (Main.player[
owner].hornetMinion)
70784 {
70786 }
70787 }
70789 {
70790 if (Main.player[
owner].dead)
70791 {
70792 Main.player[
owner].impMinion =
false;
70793 }
70794 if (Main.player[
owner].impMinion)
70795 {
70797 }
70798 }
70800 {
70801 if (Main.player[
owner].dead)
70802 {
70803 Main.player[
owner].sharknadoMinion =
false;
70804 }
70805 if (Main.player[
owner].sharknadoMinion)
70806 {
70808 }
70809 }
70811 {
70812 if (Main.player[
owner].dead)
70813 {
70814 Main.player[
owner].UFOMinion =
false;
70815 }
70816 if (Main.player[
owner].UFOMinion)
70817 {
70819 }
70820 }
70822 {
70823 if (Main.player[
owner].dead)
70824 {
70825 Main.player[
owner].stardustMinion =
false;
70826 }
70827 if (Main.player[
owner].stardustMinion)
70828 {
70830 }
70831 Lighting.AddLight(
base.Center, 0.2f, 0.6f, 0.7f);
70833 {
70835 }
70836 }
70838 {
70840 {
70844 {
70846 Main.dust[
num48].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f;
70848 obj.velocity /= 2.5f;
70849 Main.dust[
num48].noGravity =
true;
70850 Main.dust[
num48].noLight =
true;
70851 Main.dust[
num48].frame.Y = 80;
70852 }
70854 {
70855 return;
70856 }
70866 }
70868 {
70870 }
70872 {
70874 }
70875 }
70878 {
70880 {
70884 {
70886 {
70887 for (int i = 0; i < 3; i++)
70888 {
70890 obj2.noGravity = true;
70891 obj2.position =
base.Center;
70892 obj2.velocity *= 3
f;
70895 }
70896 }
70899 {
70901 for (
int j = 0; (float)
j <
num50;
j++)
70902 {
70904 obj3.noGravity = true;
70906 Vector2
unitY = Vector2.UnitY;
70911 obj3.fadeIn =
num49 / 2
f;
70912 obj3.scale =
num49;
70913 }
70914 }
70915 }
70917 {
70918 return;
70919 }
70928 for (
int k = 0; (float)
k <
num51;
k++)
70929 {
70931 dust.noGravity = true;
70932 dust.position = base.Center -
velocity * 5
f;
70933 dust.velocity *= 3
f;
70936 if (Main.rand.Next(3) != 0)
70937 {
70940 dust.velocity /= 8
f;
70941 }
70942 }
70943 for (
int l = 0; (float)
l <
num51;
l++)
70944 {
70946 dust2.noGravity = true;
70947 dust2.position =
base.Center;
70948 dust2.velocity *= 3
f;
70951 if (Main.rand.Next(3) != 0)
70952 {
70955 dust2.velocity /= 8
f;
70956 }
70957 }
70960 }
70962 {
70964 }
70966 {
70968 }
70969 }
70971 {
70973 }
70975 {
70977 }
70978 float num2 = 0.05f;
70981 {
70984 }
70985 for (
int m = 0;
m < 1000;
m++)
70986 {
70988 {
70989 if (
position.X < Main.projectile[
m].position.X)
70990 {
70991 velocity.X -=
num2;
70992 }
70993 else
70994 {
70995 velocity.X +=
num2;
70996 }
70997 if (
position.Y < Main.projectile[
m].position.Y)
70998 {
70999 velocity.Y -=
num2;
71000 }
71001 else
71002 {
71003 velocity.Y +=
num2;
71004 }
71005 }
71006 }
71010 {
71012 }
71014 {
71016 }
71019 {
71021 }
71026 {
71028 }
71030 {
71033 {
71036 {
71038 }
71039 }
71040 else
71041 {
71044 {
71046 }
71047 }
71048 }
71050 {
71052 Vector2
vector2 =
default(Vector2);
71055 {
71057 }
71060 {
71061 Vector2
vector3 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size *
vector2;
71065 {
71070 }
71071 }
71073 {
71074 for (
int n = 0;
n < 200;
n++)
71075 {
71077 if (
nPC.CanBeChasedBy(
this))
71078 {
71082 {
71087 }
71088 }
71089 }
71090 }
71091 }
71092 else
71093 {
71096 {
71099 if (
num9 <
num10 && !
flag && ((
type != 963) ? Collision.CanHitLine(
position,
width,
height,
ownerMinionAttackTargetNPC2.position,
ownerMinionAttackTargetNPC2.width,
ownerMinionAttackTargetNPC2.height) : Collision.CanHit(
base.Center, 1, 1,
ownerMinionAttackTargetNPC2.Center, 1, 1)))
71100 {
71105 }
71106 }
71108 {
71110 {
71112 if (
nPC2.CanBeChasedBy(
this))
71113 {
71115 if (!(
num13 >=
num4) && ((
type != 963) ? Collision.CanHitLine(
position,
width,
height,
nPC2.position,
nPC2.width,
nPC2.height) : Collision.CanHit(
base.Center, 1, 1,
nPC2.Center, 1, 1)))
71116 {
71121 }
71122 }
71123 }
71124 }
71125 }
71128 {
71130 }
71132 {
71134 }
71136 {
71138 }
71140 {
71142 }
71144 if (Vector2.Distance(player.Center,
base.Center) > (float)
num14)
71145 {
71148 }
71150 {
71152 }
71153 bool flag2 =
false;
71155 {
71157 }
71159 {
71161 {
71163 }
71164 else
71165 {
71168 {
71170 }
71171 }
71172 }
71173 if (
type == 963 && ((Vector2)(
ref velocity)).Length() > 0.1f && Main.rand.Next(1500) == 0)
71174 {
71176 }
71177 bool flag3 =
false;
71179 {
71181 }
71183 {
71184 if (
ai[0] == 2
f &&
type == 963)
71185 {
71187 }
71190 {
71192 }
71194 {
71196 }
71198 {
71202 {
71205 {
71207 }
71208 }
71209 }
71211 }
71213 {
71215 float num15 = ((Vector2)(
ref v)).Length();
71216 v = v.SafeNormalize(Vector2.Zero);
71218 {
71219 v =
vector - Vector2.UnitY * 80
f;
71220 int num16 = (int)v.Y / 16;
71222 {
71224 }
71225 Tile tile = Main.tile[(int)v.X / 16,
num16];
71226 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
71227 {
71228 v += Vector2.UnitY * 16
f;
71229 tile = Main.tile[(int)v.X / 16, (int)v.Y / 16];
71230 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
71231 {
71232 v += Vector2.UnitY * 16
f;
71233 }
71234 }
71236 num15 = ((Vector2)(
ref v)).Length();
71237 v = v.SafeNormalize(Vector2.Zero);
71239 {
71245 return;
71246 }
71247 }
71249 {
71251 Vector2
vector5 = base.Center - v;
71253 {
71255 }
71258 int num17 = (int)v.Y / 16;
71260 {
71262 }
71264 if (
tile2 !=
null &&
tile2.active() && Main.tileSolid[
tile2.type] && !Main.tileSolidTop[
tile2.type])
71265 {
71266 v += Vector2.UnitY * 16
f;
71267 tile2 = Main.tile[(int)v.X / 16, (
int)v.Y / 16];
71268 if (
tile2 !=
null &&
tile2.active() && Main.tileSolid[
tile2.type] && !Main.tileSolidTop[
tile2.type])
71269 {
71270 v += Vector2.UnitY * 16
f;
71271 }
71272 }
71274 num15 = ((Vector2)(
ref v)).Length();
71275 v = v.SafeNormalize(Vector2.Zero);
71277 {
71283 return;
71284 }
71285 }
71287 {
71289 {
71293 }
71294 else
71295 {
71297 }
71298 }
71300 {
71304 velocity.X = (velocity.X *
num20 + v.X) / (
num20 + 1
f);
71305 velocity.Y = (velocity.Y *
num20 + v.Y) / (
num20 + 1
f);
71306 }
71307 else if (
type == 963)
71308 {
71310 {
71314 }
71315 else
71316 {
71320 }
71321 }
71322 else if (
type == 423 ||
type == 613)
71323 {
71325 {
71328 {
71330 }
71333 if (
Math.Abs(v.X) >
Math.Abs(v.Y))
71334 {
71335 velocity.X = (velocity.X * 10
f + v.X) / 11
f;
71336 }
71337 }
71338 else
71339 {
71341 }
71342 }
71343 else if (
type == 375)
71344 {
71346 {
71349 velocity.X = (velocity.X * 40
f + v.X) / 41
f;
71350 velocity.Y = (velocity.Y * 40
f + v.Y) / 41
f;
71351 }
71352 else
71353 {
71355 }
71356 }
71358 {
71359 velocity.Y -= 0.1f;
71360 }
71361 }
71362 else
71363 {
71364 if (
type != 963 && !Collision.CanHitLine(
base.Center, 1, 1, Main.player[
owner].Center, 1, 1))
71365 {
71367 }
71370 {
71372 }
71374 {
71376 }
71378 {
71380 }
71382 Vector2
v2 = player.Center -
center2 +
new Vector2(0
f, -60
f);
71384 {
71385 v2 +=
new Vector2(0
f, 40
f);
71386 }
71388 {
71389 v2 +=
new Vector2((
float)(-40 * Main.player[
owner].direction), 40
f);
71390 }
71392 {
71398 {
71399 if (Main.projectile[
num27].active && Main.projectile[
num27].owner ==
owner && Main.projectile[
num27].type ==
type)
71400 {
71402 }
71403 }
71404 v2.X -= 10 * Main.player[
owner].direction;
71405 v2.X -=
num26 * 40 * Main.player[
owner].direction;
71407 }
71410 {
71412 }
71414 {
71416 }
71418 {
71420 }
71422 {
71425 }
71427 {
71428 position.X = Main.player[
owner].Center.X - (float)(
width / 2);
71429 position.Y = Main.player[
owner].Center.Y - (float)(
width / 2);
71430 }
71432 {
71434 {
71435 v2 =
v2.SafeNormalize(Vector2.Zero);
71437 {
71439 }
71442 }
71443 else
71444 {
71447 }
71448 }
71449 else if (
type == 407)
71450 {
71452 {
71453 v2 =
v2.SafeNormalize(Vector2.Zero);
71455 v2 *=
new Vector2(1.25
f, 0.65
f);
71457 }
71458 else
71459 {
71461 {
71462 velocity.X = -0.15f;
71463 velocity.Y = -0.05f;
71464 }
71466 }
71467 }
71469 {
71470 v2 =
v2.SafeNormalize(Vector2.Zero);
71473 }
71474 else
71475 {
71477 {
71478 velocity.X = -0.15f;
71479 velocity.Y = -0.05f;
71480 }
71482 }
71484 {
71485 float x = Main.player[
owner].velocity.X;
71486 float y = Main.player[
owner].velocity.Y;
71487 if ((
velocity.X < 0
f && x >= 0
f) || (velocity.X >= 0
f && x < 0
f))
71488 {
71489 velocity.X *= 0.95f;
71490 }
71491 else
71492 {
71493 velocity.X += x * 0.125f;
71494 }
71495 if ((
velocity.Y < 0
f && y >= 0
f) || (velocity.Y >= 0
f && y < 0
f))
71496 {
71497 velocity.Y *= 0.95f;
71498 }
71499 else
71500 {
71501 velocity.Y += y * 0.125f;
71502 }
71504 {
71506 }
71507 }
71508 }
71512 {
71514 {
71517 }
71519 {
71521 }
71522 }
71524 {
71526 {
71529 {
71531 }
71535 {
71538 }
71540 {
71541 case 0:
71542 case 1:
71543 case 2:
71545 break;
71546 case 3:
71547 case 5:
71548 case 7:
71550 break;
71551 default:
71553 break;
71554 }
71555 if (Main.rand.Next(2) == 0)
71556 {
71557 float num30 = 1.1f + Main.rand.NextFloat() * 0.3f;
71558 float num31 = 1.4f + Main.rand.NextFloat() * 0.4f;
71562 Main.dust[
num33].velocity =
vector6 * 0.0125f + Utils.RotatedBy(
new Vector2(1
f, 0
f),
num32, Vector2.Zero);
71563 Main.dust[
num33].noGravity =
true;
71564 }
71565 }
71566 else
71567 {
71569 {
71572 }
71574 {
71578 {
71580 }
71581 }
71582 }
71583 }
71585 {
71587 {
71589 }
71591 if (
ai[1] > 0
f &&
ai[1] < 16
f)
71592 {
71594 }
71595 if (Main.rand.Next(6) == 0)
71596 {
71599 obj4.velocity *= 0.3f;
71600 Main.dust[
num35].noGravity =
true;
71601 Main.dust[
num35].noLight =
true;
71602 }
71603 }
71605 {
71608 {
71610 }
71612 if (Main.rand.Next(5) == 0)
71613 {
71616 obj5.velocity *= 0.3f;
71617 Main.dust[
num37].noGravity =
true;
71618 Main.dust[
num37].noLight =
true;
71619 }
71620 }
71622 {
71625 {
71627 }
71629 }
71631 {
71633 }
71635 {
71637 }
71639 {
71642 {
71644 }
71645 }
71647 {
71649 {
71650 ai[1] += Main.rand.Next(1, 4);
71651 }
71653 if (Main.player[
owner].strongBees)
71654 {
71656 }
71658 {
71661 }
71662 }
71663 else if (
type == 375)
71664 {
71666 {
71668 if (Main.rand.Next(3) == 0)
71669 {
71671 }
71672 }
71674 {
71677 }
71678 }
71679 else if (
type == 407)
71680 {
71682 {
71684 if (Main.rand.Next(3) != 0)
71685 {
71687 }
71688 }
71690 {
71693 }
71694 }
71695 else if (
type == 423)
71696 {
71698 {
71700 if (Main.rand.Next(3) != 0)
71701 {
71703 }
71704 }
71706 {
71709 }
71710 }
71711 else if (
type == 613)
71712 {
71714 {
71716 if (Main.rand.Next(3) != 0)
71717 {
71719 }
71720 }
71722 {
71725 }
71726 }
71728 {
71729 return;
71730 }
71734 {
71737 }
71738 else if (
type == 375)
71739 {
71742 }
71743 else if (
type == 407)
71744 {
71747 }
71748 else if (
type == 423)
71749 {
71752 }
71753 else if (
type == 613)
71754 {
71757 }
71759 {
71760 return;
71761 }
71763 {
71765 {
71767 }
71769 {
71771 }
71772 }
71774 {
71775 return;
71776 }
71778 {
71780 {
71781 velocity += (
vector - base.Center - Vector2.UnitY * 80
f).SafeNormalize(Vector2.Zero);
71782 }
71785 {
71787 if (Main.myPlayer ==
owner)
71788 {
71790 v3 =
v3.SafeNormalize(Vector2.Zero);
71794 }
71795 }
71796 }
71797 else if (
ai[1] == 0
f &&
type == 613)
71798 {
71801 {
71802 return;
71803 }
71805 if (Main.myPlayer ==
owner)
71806 {
71808 v4 =
v4.SafeNormalize(Vector2.Zero);
71810 int num42 =
NewProjectile(
GetProjectileSource_FromThis(),
base.Center.X,
base.Center.Y,
v4.X,
v4.Y,
num41,
damage,
knockBack, Main.myPlayer, 0
f,
num5);
71811 Main.projectile[
num42].timeLeft = 300;
71812 Main.projectile[
num42].netUpdate =
true;
71815 }
71817 {
71819 _ = ((float)Main.rand.NextDouble() * ((float)
Math.PI * 2
f)).ToRotationVector2() * (float)Main.rand.Next(24, 41) / 8
f;
71822 Vector2
vector7 = (dust3.position -
base.Center).SafeNormalize(Vector2.Zero);
71825 {
71827 }
71828 else
71829 {
71830 dust3.velocity = 2
f *
vector7 * (float)Main.rand.Next(45, 91) / 10
f;
71831 }
71832 dust3.noGravity = true;
71833 dust3.scale = 0.7f + Main.rand.NextFloat();
71834 }
71835 }
71836 else if (
ai[1] == 0
f)
71837 {
71840 if (Main.myPlayer ==
owner)
71841 {
71842 v5 =
v5.SafeNormalize(Vector2.Zero);
71845 Main.projectile[
num47].timeLeft = 300;
71846 Main.projectile[
num47].netUpdate =
true;
71848 }
71849 }
71850 }
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 ...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
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 readonly SoundStyle AbigailAttack
static readonly SoundStyle AbigailCry
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...
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...
IEntitySource GetProjectileSource_FromThis()
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...
bool tileCollide
If true, the projectile will collide with tiles, usually bouncing or killing the tile depending on M:...
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...
int extraUpdates
Additional update steps per tick. Useful for really fast projectiles such as Shadowbeam Staff....
NPC OwnerMinionAttackTargetNPC
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.
float scale
Scales how large the projectile will be drawn. Will also affect the hitbox (F:Terraria....
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...