51256 {
51257
51258
51259
51260
51261
51262
51263
51264
51265
51266
51267
51268
51269
51270
51271
51272
51273
51274
51275
51276
51277
51278
51279
51280
51281
51282
51283
51284
51285
51286
51287
51288
51289
51290
51291
51292
51293
51294
51295
51296
51297
51298
51299
51300
51301
51302
51303
51304
51305
51306
51307
51308
51309
51310
51311
51312
51313
51314
51315
51316
51317
51318
51319
51320
51321
51322
51323
51324
51325
51326
51327
51328
51329
51330
51331
51332
51333
51334
51335
51336
51337
51338
51339
51340
51341
51342
51343
51344
51345
51346
51347
51348
51349
51350
51351
51352
51353
51354
51355
51356
51357
51358
51359
51360
51361
51362
51363
51364
51365
51366
51367
51368
51369
51370
51371
51372
51373
51374
51375
51376
51377
51378
51379
51380
51381
51382
51383
51384
51385
51386
51387
51388
51389
51390
51391
51392
51393
51394
51395
51396
51397
51398
51399
51400
51401
51402
51403
51404
51405
51406
51407
51408
51409
51410
51411
51412
51413
51414
51415
51416
51417
51418
51419
51420
51421
51422
51423
51424
51425
51426
51427
51428
51429
51430
51431
51432
51433
51434
51435
51436
51437
51438
51439
51440
51441
51442
51443
51444
51445
51446
51447
51448
51449
51450
51451
51452
51453
51454
51455
51456
51457
51458
51459
51460
51461
51462
51463
51464
51465
51466
51467
51468
51469
51470
51471
51472
51473
51474
51475
51476
51477
51478
51479
51480
51481
51482
51483
51484
51485
51486
51487
51488
51489
51490
51491
51492
51493
51494
51495
51496
51497
51498
51499
51500
51501
51502
51503
51504
51505
51506
51507
51508
51509
51510
51511
51512
51513
51514
51515
51516
51517
51518
51519
51520
51521
51522
51523
51524
51525
51526
51527
51528
51529
51530
51531
51532
51533
51534
51535
51536
51537
51538
51539
51540
51541
51542
51543
51544
51545
51546
51547
51548
51549
51550
51551
51552
51553
51554
51555
51556
51557
51558
51559
51560
51561
51562
51563
51564
51565
51566
51567
51568
51569
51570
51571
51572
51573
51574
51575
51576
51577
51578
51579
51580
51581
51582
51583
51584
51585
51586
51587
51588
51589
51590
51591
51592
51593
51594 bool expertMode = Main.expertMode;
51595 float num = (expertMode ? 1.2f : 1
f);
51602 {
51605 }
51607 {
51610 }
51611 else
51612 {
51615 }
51616 int num12 = (expertMode ? 40 : 60);
51617 float num23 = (expertMode ? 0.55f : 0.45f);
51618 float num34 = (expertMode ? 8.5f : 7.5f);
51620 {
51624 }
51626 {
51627 num23 = (expertMode ? 0.6f : 0.5f);
51628 num34 = (expertMode ? 10
f : 8
f);
51629 num12 = (expertMode ? 40 : 20);
51630 }
51632 {
51634 }
51635 int num36 = (expertMode ? 28 : 30);
51636 float num37 = (expertMode ? 17
f : 16
f);
51638 {
51641 }
51643 {
51644 num36 = (expertMode ? 27 : 30);
51645 if (expertMode)
51646 {
51648 }
51649 }
51652 float num40 = 0.3f;
51666 if (
target < 0 ||
target == 255 || player.dead || !player.active || Vector2.Distance(player.Center,
center) > 5600
f)
51667 {
51669 player = Main.player[
target];
51671 }
51672 if (player.dead || Vector2.Distance(player.Center,
center) > 5600
f)
51673 {
51674 velocity.Y -= 0.4f;
51677 {
51679 }
51680 else
51681 {
51683 }
51685 }
51686 bool flag6 = player.position.Y < 800
f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400
f && player.position.X < (
float)(Main.maxTilesX * 16 - 6400));
51688 {
51693 }
51696 {
51700 if (Main.netMode != 1)
51701 {
51704 }
51705 }
51708 {
51710 }
51712 {
51714 }
51716 {
51718 }
51720 {
51722 }
51724 {
51726 }
51728 {
51730 }
51732 {
51734 }
51735 float num15 = 0.04f;
51736 if (
ai[0] == 1
f ||
ai[0] == 6
f)
51737 {
51739 }
51741 {
51743 }
51745 {
51747 }
51749 {
51751 }
51753 {
51755 }
51757 {
51759 {
51761 }
51762 else
51763 {
51765 }
51766 }
51768 {
51770 {
51772 }
51773 else
51774 {
51776 }
51777 }
51779 {
51781 }
51783 {
51785 }
51787 {
51789 }
51791 {
51793 }
51794 if (
ai[0] != -1
f &&
ai[0] < 9
f)
51795 {
51797 {
51799 }
51800 else
51801 {
51803 }
51805 {
51807 }
51809 {
51811 }
51812 }
51814 {
51819 {
51822 }
51824 {
51828 {
51830 }
51832 {
51834 }
51836 {
51838 }
51839 }
51840 if (
ai[2] == (
float)(
num3 - 30))
51841 {
51843 for (
int i = 0; i <
num17; i++)
51844 {
51848 Main.dust[
num18].noGravity =
true;
51849 Main.dust[
num18].noLight =
true;
51851 }
51853 }
51856 {
51861 }
51862 }
51863 else if (
ai[0] == 0
f && !player.dead)
51864 {
51866 {
51868 }
51871 {
51872 velocity.X +=
num23;
51874 {
51875 velocity.X +=
num23;
51876 }
51877 }
51879 {
51880 velocity.X -=
num23;
51882 {
51883 velocity.X -=
num23;
51884 }
51885 }
51887 {
51888 velocity.Y +=
num23;
51890 {
51891 velocity.Y +=
num23;
51892 }
51893 }
51895 {
51896 velocity.Y -=
num23;
51898 {
51899 velocity.Y -=
num23;
51900 }
51901 }
51904 {
51906 {
51908 }
51911 {
51913 }
51915 }
51918 {
51920 switch ((
int)
ai[3])
51921 {
51922 case 0:
51923 case 1:
51924 case 2:
51925 case 3:
51926 case 4:
51927 case 5:
51928 case 6:
51929 case 7:
51930 case 8:
51931 case 9:
51933 break;
51934 case 10:
51937 break;
51938 case 11:
51941 break;
51942 }
51944 {
51946 }
51948 {
51950 }
51952 {
51953 case 1:
51960 {
51963 {
51965 }
51967 }
51968 break;
51969 case 2:
51973 break;
51974 case 3:
51979 {
51981 }
51982 break;
51983 case 4:
51987 break;
51988 }
51990 }
51991 }
51992 else if (
ai[0] == 1
f)
51993 {
51996 {
51998 Vector2
vector17 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)
Math.PI / 2
f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
52000 Main.dust[
num22].noGravity =
true;
52001 Main.dust[
num22].noLight =
true;
52003 obj.velocity /= 4
f;
52006 }
52009 {
52015 }
52016 }
52017 else if (
ai[0] == 2
f)
52018 {
52020 {
52022 }
52025 {
52026 velocity.X +=
num40;
52028 {
52029 velocity.X +=
num40;
52030 }
52031 }
52033 {
52034 velocity.X -=
num40;
52036 {
52037 velocity.X -=
num40;
52038 }
52039 }
52041 {
52042 velocity.Y +=
num40;
52044 {
52045 velocity.Y +=
num40;
52046 }
52047 }
52049 {
52050 velocity.Y -=
num40;
52052 {
52053 velocity.Y -=
num40;
52054 }
52055 }
52057 {
52059 }
52061 {
52063 if (Main.netMode != 1)
52064 {
52067 }
52068 }
52071 {
52074 {
52076 }
52078 }
52081 {
52086 }
52087 }
52088 else if (
ai[0] == 3
f)
52089 {
52092 if (
ai[2] == (
float)(
num3 - 30))
52093 {
52095 }
52096 if (Main.netMode != 1 &&
ai[2] == (
float)(
num3 - 30))
52097 {
52101 }
52103 if (
ai[2] >= (
float)
num3)
52104 {
52109 }
52110 }
52111 else if (
ai[0] == 4
f)
52112 {
52116 if (
ai[2] == (
float)(
num4 - 60))
52117 {
52119 }
52121 if (
ai[2] >= (
float)
num4)
52122 {
52128 }
52129 }
52130 else if (
ai[0] == 5
f && !player.dead)
52131 {
52133 {
52135 }
52138 {
52139 velocity.X +=
num23;
52141 {
52142 velocity.X +=
num23;
52143 }
52144 }
52146 {
52147 velocity.X -=
num23;
52149 {
52150 velocity.X -=
num23;
52151 }
52152 }
52154 {
52155 velocity.Y +=
num23;
52157 {
52158 velocity.Y +=
num23;
52159 }
52160 }
52162 {
52163 velocity.Y -=
num23;
52165 {
52166 velocity.Y -=
num23;
52167 }
52168 }
52171 {
52173 {
52175 }
52178 {
52180 }
52182 }
52185 {
52187 switch ((
int)
ai[3])
52188 {
52189 case 0:
52190 case 1:
52191 case 2:
52192 case 3:
52193 case 4:
52194 case 5:
52196 break;
52197 case 6:
52200 break;
52201 case 7:
52204 break;
52205 }
52207 {
52209 }
52211 {
52213 }
52215 {
52216 case 1:
52223 {
52226 {
52228 }
52230 }
52231 break;
52232 case 2:
52236 {
52239 {
52241 }
52243 }
52247 break;
52248 case 3:
52252 break;
52253 case 4:
52257 break;
52258 }
52260 }
52261 }
52262 else if (
ai[0] == 6
f)
52263 {
52266 {
52268 Vector2
vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)
Math.PI / 2
f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
52270 Main.dust[
num28].noGravity =
true;
52271 Main.dust[
num28].noLight =
true;
52273 obj3.velocity /= 4
f;
52276 }
52279 {
52285 }
52286 }
52287 else if (
ai[0] == 7
f)
52288 {
52290 {
52292 }
52293 if (
ai[2] % (
float)
num8 == 0
f)
52294 {
52296 if (Main.netMode != 1)
52297 {
52302 Main.npc[
num29].netUpdate =
true;
52303 Main.npc[
num29].ai[3] = (float)Main.rand.Next(80, 121) / 100
f;
52304 }
52305 }
52309 if (
ai[2] >= (
float)
num7)
52310 {
52315 }
52316 }
52317 else if (
ai[0] == 8
f)
52318 {
52321 if (
ai[2] == (
float)(
num3 - 30))
52322 {
52324 }
52325 if (Main.netMode != 1 &&
ai[2] == (
float)(
num3 - 30))
52326 {
52327 Projectile.NewProjectile(
GetSpawnSource_ForProjectile(),
center.X,
center.Y, 0
f, 0
f, 385, 0, 0
f, Main.myPlayer, 1
f,
target + 1,
flag6 ? 1 : 0);
52328 }
52330 if (
ai[2] >= (
float)
num3)
52331 {
52336 }
52337 }
52338 else if (
ai[0] == 9
f)
52339 {
52341 if (
ai[2] < (
float)(
num5 - 90))
52342 {
52344 {
52346 }
52347 else
52348 {
52350 }
52352 {
52354 }
52356 {
52358 }
52359 }
52360 else if (
alpha < 255)
52361 {
52364 {
52366 }
52367 }
52370 if (
ai[2] == (
float)(
num5 - 60))
52371 {
52373 }
52375 if (
ai[2] >= (
float)
num5)
52376 {
52382 }
52383 }
52384 else if (
ai[0] == 10
f && !player.dead)
52385 {
52388 {
52391 {
52393 }
52394 }
52396 {
52398 }
52403 {
52405 {
52407 for (
int l = 0;
l <
oldPos.Length;
l++)
52408 {
52410 }
52411 }
52414 {
52416 }
52418 }
52421 {
52423 switch ((
int)
ai[3])
52424 {
52425 case 0:
52426 case 2:
52427 case 3:
52428 case 5:
52429 case 6:
52430 case 7:
52432 break;
52433 case 1:
52434 case 4:
52435 case 8:
52437 break;
52438 }
52440 {
52441 case 1:
52448 {
52451 {
52453 }
52455 }
52456 break;
52457 case 2:
52461 break;
52462 case 3:
52466 break;
52467 }
52469 }
52470 }
52471 else if (
ai[0] == 11
f)
52472 {
52476 {
52478 }
52481 {
52483 Vector2
vector13 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)
Math.PI / 2
f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
52485 Main.dust[
num33].noGravity =
true;
52486 Main.dust[
num33].noLight =
true;
52488 obj5.velocity /= 4
f;
52491 }
52494 {
52500 }
52501 }
52502 else if (
ai[0] == 12
f)
52503 {
52507 {
52510 {
52512 }
52513 }
52516 if (
ai[2] == (
float)(
num6 / 2))
52517 {
52519 }
52520 if (Main.netMode != 1 &&
ai[2] == (
float)(
num6 / 2))
52521 {
52523 {
52525 }
52526 Vector2
vector14 = player.Center +
new Vector2(0
f -
ai[1], -200
f);
52531 {
52533 {
52535 for (
int n = 0;
n <
oldPos.Length;
n++)
52536 {
52538 }
52539 }
52542 {
52544 }
52546 }
52547 }
52549 if (
ai[2] >= (
float)
num6)
52550 {
52556 {
52558 }
52560 }
52561 }
52562 else if (
ai[0] == 13
f)
52563 {
52565 {
52567 }
52571 if (
ai[2] >= (
float)
num7)
52572 {
52578 }
52579 }
52581 }
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 ...
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.
int defense
How resistant to damage this NPC is. The List of NPCs wiki pagecan be useful for finding appropriat...
int damage
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done...
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
void EncourageDespawn(int despawnTime)
int lifeMax
The maximum life of this NPC.
void TargetClosest(bool faceTarget=true)
int defDefense
Stores the value of F:Terraria.NPC.defense at the end of SetDefaults. Useful for scaling defense in A...
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
int alpha
0 is opaque, and 255 is transparent. Note that this is the opposite of how alpha is typically express...
IEntitySource GetSpawnSourceForNPCFromNPCAI()
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
int defDamage
Stores the value of F:Terraria.NPC.damage at the end of SetDefaults. Useful for scaling damage in AI ...
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
IEntitySource GetSpawnSource_ForProjectile()
void SimpleFlyMovement(Vector2 desiredVelocity, float moveSpeed)