Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NPC.cs
Go to the documentation of this file.
1using System;
8using Terraria.Chat;
10using Terraria.Enums;
22using Terraria.ID;
26
27namespace Terraria;
28
29public class NPC : Entity
30{
31 private const int NPC_TARGETS_START = 300;
32
34
35 public bool ForcePartyHatOn;
36
37 public float waterMovementSpeed = 0.5f;
38
39 public float lavaMovementSpeed = 0.5f;
40
41 public float honeyMovementSpeed = 0.25f;
42
43 public float shimmerMovementSpeed = 0.375f;
44
45 public static readonly int[,,,] MoonLordAttacksArray = InitializeMoonLordAttacks();
46
47 public static readonly int[,] MoonLordAttacksArray2 = InitializeMoonLordAttacks2();
48
49 public static int MoonLordFightingDistance = 4500;
50
51 public static int MoonLordCountdown = 0;
52
53 public static int MaxMoonLordCountdown = 3600;
54
55 public const int NaturalMoonlordCountdownTime = 3600;
56
57 public const int ItemMoonlordCountdownTime = 720;
58
59 public int teleportStyle;
60
61 public float teleportTime;
62
63 public static int immuneTime = 20;
64
65 public static int maxAI = 4;
66
67 public int netSpam;
68
69 public static int goldCritterChance = 400;
70
71 public static int[] killCount = new int[NPCID.Count];
72
73 public static float totalInvasionPoints = 0f;
74
75 public static float waveKills = 0f;
76
77 public static int waveNumber = 0;
78
79 public const float nameOverIncrement = 0.025f;
80
81 public const float nameOverDistance = 350f;
82
83 public float nameOver;
84
85 public bool SpawnedFromStatue;
86
88
89 public bool dripping;
90
91 public bool drippingSlime;
92
94
95 public static readonly int AFKTimeNeededForNoWorms = 300;
96
97 public static bool[] ShimmeredTownNPCs = new bool[NPCID.Count];
98
99 public int altTexture;
100
102
104
105 public short catchItem;
106
107 public short releaseOwner = 255;
108
109 public int rarity;
110
111 public static bool taxCollector = false;
112
113 public bool[] playerInteraction = new bool[256];
114
115 public int lastInteraction = 255;
116
117 public float takenDamageMultiplier = 1f;
118
119 public static bool freeCake = false;
120
121 private static int spawnSpaceX = 3;
122
123 private static int spawnSpaceY = 3;
124
125 public float gfxOffY;
126
127 public float stepSpeed;
128
129 private static float gravity = 0.3f;
130
131 public bool teleporting;
132
133 private static int maxAttack = 20;
134
135 private static int[] attackNPC = new int[maxAttack];
136
137 public bool stairFall;
138
139 public static int fireFlyFriendly = 0;
140
141 public static int fireFlyChance = 0;
142
143 public static int fireFlyMultiple = 0;
144
145 public static int butterflyChance = 0;
146
147 public static int stinkBugChance = 0;
148
149 private int netStream;
150
151 private int[] streamPlayer = new int[255];
152
153 private bool needsUniqueInfoUpdate = true;
154
155 public Vector2[] oldPos = new Vector2[10];
156
157 public float[] oldRot = new float[10];
158
159 public bool setFrameSize;
160
161 public static int golemBoss = -1;
162
163 public static int plantBoss = -1;
164
165 public static int crimsonBoss = -1;
166
167 public static int deerclopsBoss = -1;
168
169 public int netSkip;
170
171 public bool netAlways;
172
173 public int realLife = -1;
174
175 private string _givenName = "";
176
177 public static int sWidth = 1920;
178
179 public static int sHeight = 1080;
180
181 private static int spawnRangeX = (int)((double)(sWidth / 16) * 0.7);
182
183 private static int spawnRangeY = (int)((double)(sHeight / 16) * 0.7);
184
185 public static int safeRangeX = (int)((double)(sWidth / 16) * 0.52);
186
187 public static int safeRangeY = (int)((double)(sHeight / 16) * 0.52);
188
189 private static int activeRangeX = (int)((double)sWidth * 2.1);
190
191 private static int activeRangeY = (int)((double)sHeight * 2.1);
192
193 private static int townRangeX = sWidth;
194
195 private static int townRangeY = sHeight;
196
197 public float npcSlots = 1f;
198
199 private static bool noSpawnCycle = false;
200
201 private static int activeTime = 750;
202
203 private static int defaultSpawnRate = 600;
204
205 private static int defaultMaxSpawns = 5;
206
208
209 public bool dontCountMe;
210
211 public static readonly int maxBuffs = 20;
212
213 public int[] buffType = new int[maxBuffs];
214
215 public int[] buffTime = new int[maxBuffs];
216
217 public bool[] buffImmune = new bool[BuffID.Count];
218
219 public bool canDisplayBuffs = true;
220
221 public bool midas;
222
223 public bool ichor;
224
225 public bool onFire;
226
227 public bool onFire2;
228
229 public bool onFire3;
230
231 public bool onFrostBurn;
232
233 public bool onFrostBurn2;
234
235 public bool poisoned;
236
238
239 public bool venom;
240
241 public bool shadowFlame;
242
243 public bool soulDrain;
244
245 public bool shimmering;
246
247 public int lifeRegen;
248
249 public int lifeRegenCount;
250
252
253 public bool confused;
254
255 public bool loveStruck;
256
257 public bool stinky;
258
259 public bool dryadWard;
260
261 public bool immortal;
262
263 public bool chaseable = true;
264
265 public bool canGhostHeal = true;
266
267 public bool javelined;
268
269 public bool tentacleSpiked;
270
271 public bool bloodButchered;
272
273 public bool celled;
274
275 public bool dryadBane;
276
277 public bool daybreak;
278
280
281 public bool betsysCurse;
282
283 public bool oiled;
284
285 public static bool savedTaxCollector = false;
286
287 public static bool savedGoblin = false;
288
289 public static bool savedWizard = false;
290
291 public static bool savedMech = false;
292
293 public static bool savedAngler = false;
294
295 public static bool savedStylist = false;
296
297 public static bool savedBartender = false;
298
299 public static bool savedGolfer = false;
300
301 public static bool boughtCat = false;
302
303 public static bool boughtDog = false;
304
305 public static bool boughtBunny = false;
306
307 public static bool unlockedSlimeBlueSpawn = false;
308
309 public static bool unlockedSlimeGreenSpawn = false;
310
311 public static bool unlockedSlimeOldSpawn = false;
312
313 public static bool unlockedSlimePurpleSpawn = false;
314
315 public static bool unlockedSlimeRainbowSpawn = false;
316
317 public static bool unlockedSlimeRedSpawn = false;
318
319 public static bool unlockedSlimeYellowSpawn = false;
320
321 public static bool unlockedSlimeCopperSpawn = false;
322
323 public static bool unlockedMerchantSpawn = false;
324
325 public static bool unlockedDemolitionistSpawn = false;
326
327 public static bool unlockedPartyGirlSpawn = false;
328
329 public static bool unlockedDyeTraderSpawn = false;
330
331 public static bool unlockedTruffleSpawn = false;
332
333 public static bool unlockedArmsDealerSpawn = false;
334
335 public static bool unlockedNurseSpawn = false;
336
337 public static bool unlockedPrincessSpawn = false;
338
339 public static bool combatBookWasUsed = false;
340
341 public static bool combatBookVolumeTwoWasUsed = false;
342
343 public static bool peddlersSatchelWasUsed = false;
344
345 public static bool downedBoss1 = false;
346
347 public static bool downedBoss2 = false;
348
349 public static bool downedBoss3 = false;
350
351 public static bool downedQueenBee = false;
352
353 public static bool downedSlimeKing = false;
354
355 public static bool downedGoblins = false;
356
357 public static bool downedFrost = false;
358
359 public static bool downedPirates = false;
360
361 public static bool downedClown = false;
362
363 public static bool downedPlantBoss = false;
364
365 public static bool downedGolemBoss = false;
366
367 public static bool downedMartians = false;
368
369 public static bool downedFishron = false;
370
371 public static bool downedHalloweenTree = false;
372
373 public static bool downedHalloweenKing = false;
374
375 public static bool downedChristmasIceQueen = false;
376
377 public static bool downedChristmasTree = false;
378
379 public static bool downedChristmasSantank = false;
380
381 public static bool downedAncientCultist = false;
382
383 public static bool downedMoonlord = false;
384
385 public static bool downedTowerSolar = false;
386
387 public static bool downedTowerVortex = false;
388
389 public static bool downedTowerNebula = false;
390
391 public static bool downedTowerStardust = false;
392
393 public static bool downedEmpressOfLight = false;
394
395 public static bool downedQueenSlime = false;
396
397 public static bool downedDeerclops = false;
398
399 public static int ShieldStrengthTowerSolar = 0;
400
401 public static int ShieldStrengthTowerVortex = 0;
402
403 public static int ShieldStrengthTowerNebula = 0;
404
405 public static int ShieldStrengthTowerStardust = 0;
406
407 public static int LunarShieldPowerNormal = 100;
408
409 public static int LunarShieldPowerMax = 100;
410
411 public static bool TowerActiveSolar = false;
412
413 public static bool TowerActiveVortex = false;
414
415 public static bool TowerActiveNebula = false;
416
417 public static bool TowerActiveStardust = false;
418
419 public static bool LunarApocalypseIsUp = false;
420
421 public static bool downedMechBossAny = false;
422
423 public static bool downedMechBoss1 = false;
424
425 public static bool downedMechBoss2 = false;
426
427 public static bool downedMechBoss3 = false;
428
429 public static bool[] npcsFoundForCheckActive = new bool[NPCID.Count];
430
431 public static int[] lazyNPCOwnedProjectileSearchArray = new int[200];
432
433 private static int spawnRate = defaultSpawnRate;
434
435 private static int maxSpawns = defaultMaxSpawns;
436
437 public int soundDelay;
438
440
441 public int[] immune = new int[256];
442
443 public int directionY = 1;
444
445 public int type;
446
447 public float[] ai = new float[maxAI];
448
449 public float[] localAI = new float[maxAI];
450
451 public int aiAction;
452
453 public int aiStyle;
454
455 public bool justHit;
456
457 public int timeLeft;
458
459 public int target = -1;
460
461 public int damage;
462
463 public int defense;
464
465 public int defDamage;
466
467 public int defDefense;
468
469 public bool coldDamage;
470
471 public bool trapImmune;
472
474
476
477 public int life;
478
479 public int lifeMax;
480
482
483 public double frameCounter;
484
486
487 public Color color;
488
489 public int alpha;
490
491 public bool hide;
492
493 public float scale = 1f;
494
495 public float knockBackResist = 1f;
496
497 public int oldDirectionY;
498
499 public int oldTarget;
500
501 public float rotation;
502
503 public bool noGravity;
504
505 public bool noTileCollide;
506
507 public bool netUpdate;
508
509 public bool netUpdate2;
510
511 public bool collideX;
512
513 public bool collideY;
514
515 public bool boss;
516
517 public int spriteDirection = -1;
518
519 public bool behindTiles;
520
521 public bool lavaImmune;
522
523 public float value;
524
525 public int extraValue;
526
527 public bool dontTakeDamage;
528
530
531 public int netID;
532
534
535 public float strengthMultiplier = 1f;
536
537 public bool townNPC;
538
539 public static bool travelNPC = false;
540
541 public bool homeless;
542
543 public int homeTileX = -1;
544
545 public int homeTileY = -1;
546
547 public int housingCategory;
548
549 public bool oldHomeless;
550
551 public int oldHomeTileX = -1;
552
553 public int oldHomeTileY = -1;
554
555 public bool friendly;
556
557 public bool closeDoor;
558
559 public int doorX;
560
561 public int doorY;
562
563 public int friendlyRegen;
564
565 public int breath;
566
567 public const int breathMax = 200;
568
569 public int breathCounter;
570
572
574
575 public bool despawnEncouraged;
576
577 private bool netShimmer;
578
579 public static int[,] cavernMonsterType = new int[2, 3];
580
581 public static int mechQueen = -1;
582
583 public static int brainOfGravity = -1;
584
585 public static bool empressRageMode = false;
586
587 private static readonly int[] _deerclopsAttack1Frames = new int[12]
588 {
589 12, 13, 14, 13, 14, 13, 14, 13, 14, 15,
590 16, 17
591 };
592
593 private static readonly int[] _deerclopsAttack2Frames = new int[13]
594 {
595 12, 15, 16, 17, 17, 17, 17, 13, 18, 18,
596 18, 18, 12
597 };
598
599 private static readonly int[] _deerclopsAttack3Frames = new int[16]
600 {
601 19, 20, 21, 22, 21, 22, 21, 22, 23, 24,
602 23, 24, 23, 24, 20, 19
603 };
604
605 public static int[] MoonEventRequiredPointsPerWaveLookup = new int[21]
606 {
607 0, 25, 40, 50, 80, 100, 160, 180, 200, 250,
608 300, 375, 450, 525, 675, 850, 1025, 1325, 1550, 2000,
609 0
610 };
611
612 private static bool EoCKilledToday;
613
614 private static bool WoFKilledToday;
615
616 public static bool fairyLog = false;
617
618 private static bool dayTimeHax;
619
620 private static bool rainingHax;
621
622 private static float cloudAlphaHax;
623
624 private static int ignorePlayerInteractions = 0;
625
626 public static int ladyBugGoodLuckTime = 43200;
627
628 public static int ladyBugBadLuckTime = -10800;
629
630 private static int ladyBugRainTime = 1800;
631
633
634 public static int offSetDelayTime = 60;
635
636 public static bool PreventJojaColaDialog = false;
637
638 public static int RerollDryadText = 0;
639
640 public bool CanTalk
641 {
642 get
643 {
644 if (isLikeATownNPC && aiStyle == 7 && velocity.Y == 0f)
645 {
646 return !NPCID.Sets.IsTownPet[type];
647 }
648 return false;
649 }
650 }
651
652 public bool CanBeTalkedTo
653 {
654 get
655 {
656 if (isLikeATownNPC && aiStyle == 7)
657 {
658 return velocity.Y == 0f;
659 }
660 return false;
661 }
662 }
663
664 public bool HasValidTarget
665 {
666 get
667 {
668 if (!HasPlayerTarget || !Main.player[target].active || Main.player[target].dead || Main.player[target].ghost)
669 {
671 {
672 return Main.npc[TranslatedTargetIndex].active;
673 }
674 return false;
675 }
676 return true;
677 }
678 }
679
680 public bool HasPlayerTarget
681 {
682 get
683 {
684 if (target >= 0)
685 {
686 return target < 255;
687 }
688 return false;
689 }
690 }
691
692 public bool HasNPCTarget
693 {
694 get
695 {
696 if (target >= 300)
697 {
698 return target < 500;
699 }
700 return false;
701 }
702 }
703
705
707 {
708 get
709 {
710 if (HasNPCTarget)
711 {
712 return target - 300;
713 }
714 return target;
715 }
716 }
717
718 public int WhoAmIToTargettingIndex => whoAmI + 300;
719
721 {
722 get
723 {
724 if (townNpcVariationIndex == 1)
725 {
727 }
728 return false;
729 }
730 }
731
733
734 public string FullName
735 {
736 get
737 {
738 if (!HasGivenName)
739 {
740 return TypeName;
741 }
742 return Language.GetTextValue("Game.NPCTitle", _givenName, TypeName);
743 }
744 }
745
746 public bool HasGivenName => _givenName.Length != 0;
747
748 public string GivenOrTypeName
749 {
750 get
751 {
752 if (!HasGivenName)
753 {
754 return TypeName;
755 }
756 return _givenName;
757 }
758 }
759
760 public string GivenName
761 {
762 get
763 {
764 return _givenName;
765 }
766 set
767 {
768 _givenName = value ?? "";
769 }
770 }
771
772 public static bool downedTowers
773 {
774 get
775 {
777 {
778 return downedTowerStardust;
779 }
780 return false;
781 }
782 }
783
784 public static int ShieldStrengthTowerMax
785 {
786 get
787 {
788 int num = LunarShieldPowerNormal;
789 if (downedMoonlord)
790 {
791 num /= 2;
792 }
793 return num;
794 }
795 }
796
797 public static bool TowersDefeated
798 {
799 get
800 {
802 {
803 return TowerActiveStardust;
804 }
805 return false;
806 }
807 }
808
809 public float Opacity
810 {
811 get
812 {
813 return 1f - (float)alpha / 255f;
814 }
815 set
816 {
817 alpha = (int)MathHelper.Clamp((1f - value) * 255f, 0f, 255f);
818 }
819 }
820
821 public bool isLikeATownNPC
822 {
823 get
824 {
825 if (type == 453)
826 {
827 return true;
828 }
829 return townNPC;
830 }
831 }
832
833 public static bool IsMechQueenUp
834 {
835 get
836 {
837 if (mechQueen >= 0 && mechQueen < 200)
838 {
839 if (Main.npc[mechQueen].active && Main.npc[mechQueen].type == 127)
840 {
841 return true;
842 }
843 mechQueen = -1;
844 return false;
845 }
846 return false;
847 }
848 }
849
850 public static bool TooWindyForButterflies => Math.Abs(Main.windSpeedTarget) >= 0.4f;
851
853 {
854 get
855 {
856 if (lifeMax <= 5 && damage == 0 && type != 594)
857 {
858 return type != 686;
859 }
860 return false;
861 }
862 }
863
865 {
866 if (!HasValidTarget)
867 {
868 return default(NPCAimedTarget);
869 }
871 {
873 }
875 }
876
877 public static int[,,,] InitializeMoonLordAttacks()
878 {
879 int[,,,] array = null;
880 if (MoonLordAttacksArray != null)
881 {
883 for (int i = 0; i < array.GetLength(0); i++)
884 {
885 for (int j = 0; j < array.GetLength(1); j++)
886 {
887 for (int k = 0; k < array.GetLength(2); k++)
888 {
889 for (int l = 0; l < array.GetLength(3); l++)
890 {
891 array[i, j, k, l] = 0;
892 }
893 }
894 }
895 }
896 }
897 else
898 {
899 array = new int[3, 3, 2, 5];
900 }
901 array[0, 0, 0, 0] = 0;
902 array[0, 0, 1, 0] = 50;
903 array[0, 0, 0, 1] = 1;
904 array[0, 0, 1, 1] = 70;
905 array[0, 0, 0, 2] = 2;
906 array[0, 0, 1, 2] = 330;
907 array[0, 0, 0, 3] = 0;
908 array[0, 0, 1, 3] = 60;
909 array[0, 0, 0, 4] = 3;
910 array[0, 0, 1, 4] = 90;
911 array[0, 1, 0, 0] = 1;
912 array[0, 1, 1, 0] = 70;
913 array[0, 1, 0, 1] = 0;
914 array[0, 1, 1, 1] = 50;
915 array[0, 1, 0, 2] = 3;
916 array[0, 1, 1, 2] = 90;
917 array[0, 1, 0, 3] = 0;
918 array[0, 1, 1, 3] = 60;
919 array[0, 1, 0, 4] = 2;
920 array[0, 1, 1, 4] = 330;
921 array[0, 2, 0, 0] = 3;
922 array[0, 2, 1, 0] = 180;
923 array[0, 2, 0, 1] = 0;
924 array[0, 2, 1, 1] = 30;
925 array[0, 2, 0, 2] = 2;
926 array[0, 2, 1, 2] = 435;
927 array[0, 2, 0, 3] = 3;
928 array[0, 2, 1, 3] = 180;
929 array[0, 2, 0, 4] = 1;
930 array[0, 2, 1, 4] = 375;
931 array[1, 0, 0, 0] = 0;
932 array[1, 0, 1, 0] = 0;
933 array[1, 0, 0, 1] = 0;
934 array[1, 0, 1, 1] = 0;
935 array[1, 0, 0, 2] = 0;
936 array[1, 0, 1, 2] = 0;
937 array[1, 0, 0, 3] = 0;
938 array[1, 0, 1, 3] = 0;
939 array[1, 0, 0, 4] = 0;
940 array[1, 0, 1, 4] = 0;
941 array[1, 1, 0, 0] = 0;
942 array[1, 1, 1, 0] = 0;
943 array[1, 1, 0, 1] = 0;
944 array[1, 1, 1, 1] = 0;
945 array[1, 1, 0, 2] = 0;
946 array[1, 1, 1, 2] = 0;
947 array[1, 1, 0, 3] = 0;
948 array[1, 1, 1, 3] = 0;
949 array[1, 1, 0, 4] = 0;
950 array[1, 1, 1, 4] = 0;
951 array[1, 2, 0, 0] = 0;
952 array[1, 2, 1, 0] = 0;
953 array[1, 2, 0, 1] = 0;
954 array[1, 2, 1, 1] = 0;
955 array[1, 2, 0, 2] = 0;
956 array[1, 2, 1, 2] = 0;
957 array[1, 2, 0, 3] = 0;
958 array[1, 2, 1, 3] = 0;
959 array[1, 2, 0, 4] = 0;
960 array[1, 2, 1, 4] = 0;
961 array[2, 0, 0, 0] = 0;
962 array[2, 0, 1, 0] = 0;
963 array[2, 0, 0, 1] = 0;
964 array[2, 0, 1, 1] = 0;
965 array[2, 0, 0, 2] = 0;
966 array[2, 0, 1, 2] = 0;
967 array[2, 0, 0, 3] = 0;
968 array[2, 0, 1, 3] = 0;
969 array[2, 0, 0, 4] = 0;
970 array[2, 0, 1, 4] = 0;
971 array[2, 1, 0, 0] = 0;
972 array[2, 1, 1, 0] = 0;
973 array[2, 1, 0, 1] = 0;
974 array[2, 1, 1, 1] = 0;
975 array[2, 1, 0, 2] = 0;
976 array[2, 1, 1, 2] = 0;
977 array[2, 1, 0, 3] = 0;
978 array[2, 1, 1, 3] = 0;
979 array[2, 1, 0, 4] = 0;
980 array[2, 1, 1, 4] = 0;
981 array[2, 2, 0, 0] = 0;
982 array[2, 2, 1, 0] = 0;
983 array[2, 2, 0, 1] = 0;
984 array[2, 2, 1, 1] = 0;
985 array[2, 2, 0, 2] = 0;
986 array[2, 2, 1, 2] = 0;
987 array[2, 2, 0, 3] = 0;
988 array[2, 2, 1, 3] = 0;
989 array[2, 2, 0, 4] = 0;
990 array[2, 2, 1, 4] = 0;
992 return array;
993 }
994
995 public static int[,] InitializeMoonLordAttacks2()
996 {
997 int[,] array = null;
998 if (MoonLordAttacksArray2 != null)
999 {
1001 for (int i = 0; i < array.GetLength(0); i++)
1002 {
1003 for (int j = 0; j < array.GetLength(1); j++)
1004 {
1005 array[i, j] = 0;
1006 }
1007 }
1008 }
1009 else
1010 {
1011 array = new int[2, 10];
1012 }
1013 array[0, 0] = 0;
1014 array[1, 0] = 90;
1015 array[0, 1] = 1;
1016 array[1, 1] = 90;
1017 array[0, 2] = 0;
1018 array[1, 2] = 90;
1019 array[0, 3] = 2;
1020 array[1, 3] = 135;
1021 array[0, 4] = 0;
1022 array[1, 4] = 90;
1023 array[0, 5] = 3;
1024 array[1, 5] = 200;
1025 array[0, 6] = 0;
1026 array[1, 6] = 90;
1027 array[0, 7] = 4;
1028 array[1, 7] = 375;
1029 array[0, 8] = 0;
1030 array[1, 8] = 90;
1031 array[0, 9] = 2;
1032 array[1, 9] = 135;
1033 return array;
1034 }
1035
1036 public static string GetFullnameByID(int npcID)
1037 {
1038 for (int i = 0; i < 200; i++)
1039 {
1040 if (Main.npc[i].active && Main.npc[i].type == npcID)
1041 {
1042 return Main.npc[i].FullName;
1043 }
1044 }
1045 return Lang.GetNPCNameValue(npcID);
1046 }
1047
1048 public static bool BusyWithAnyInvasionOfSorts()
1049 {
1051 {
1052 return DD2Event.Ongoing;
1053 }
1054 return true;
1055 }
1056
1058 {
1059 return (int)(normalDamage * Main.GameModeInfo.EnemyDamageMultiplier * strengthMultiplier);
1060 }
1061
1063 {
1064 float amount = (Main.expertMode ? 1 : 0);
1065 if (Main.GameModeInfo.IsJourneyMode)
1066 {
1067 amount = MathHelper.Clamp(strengthMultiplier - 1f, 0f, 1f);
1068 }
1070 }
1071
1073 {
1074 float amount = (Main.expertMode ? 1 : 0);
1075 if (Main.GameModeInfo.IsJourneyMode)
1076 {
1077 amount = MathHelper.Clamp(strengthMultiplier - 1f, 0f, 1f);
1078 }
1080 }
1081
1083 {
1084 float amount = (Main.expertMode ? 1 : 0);
1085 if (Main.GameModeInfo.IsJourneyMode)
1086 {
1087 amount = MathHelper.Clamp(strengthMultiplier - 1f, 0f, 1f);
1088 }
1090 }
1091
1093 {
1094 float percent = (Main.masterMode ? 1f : (Main.expertMode ? 0.5f : 0f));
1095 if (Main.GameModeInfo.IsJourneyMode)
1096 {
1098 percent /= 2f;
1099 }
1101 }
1102
1103 public static bool SpawnAllowed_Demolitionist()
1104 {
1106 {
1107 return true;
1108 }
1109 for (int i = 0; i < 255; i++)
1110 {
1111 Player player = Main.player[i];
1112 if (!player.active)
1113 {
1114 continue;
1115 }
1116 for (int j = 0; j < 58; j++)
1117 {
1118 Item item = player.inventory[j];
1119 if (item != null && item.stack > 0 && ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[item.type])
1120 {
1121 return true;
1122 }
1123 }
1124 }
1125 return false;
1126 }
1127
1128 public static bool SpawnAllowed_ArmsDealer()
1129 {
1131 {
1132 return true;
1133 }
1134 for (int i = 0; i < 255; i++)
1135 {
1136 Player player = Main.player[i];
1137 if (!player.active)
1138 {
1139 continue;
1140 }
1141 for (int j = 0; j < 58; j++)
1142 {
1143 Item item = player.inventory[j];
1144 if (item != null && item.stack > 0 && (item.ammo == AmmoID.Bullet || item.useAmmo == AmmoID.Bullet))
1145 {
1146 return true;
1147 }
1148 }
1149 }
1150 return false;
1151 }
1152
1153 public static bool SpawnAllowed_DyeTrader()
1154 {
1156 {
1157 return true;
1158 }
1159 for (int i = 0; i < 255; i++)
1160 {
1161 Player player = Main.player[i];
1162 if (!player.active)
1163 {
1164 continue;
1165 }
1166 for (int j = 0; j < 58; j++)
1167 {
1168 Item item = player.inventory[j];
1169 if (item != null && item.stack > 0 && (item.dye > 0 || (item.type >= 1107 && item.type <= 1120) || (item.type >= 3385 && item.type <= 3388)))
1170 {
1171 return true;
1172 }
1173 }
1174 for (int k = 0; k < 10; k++)
1175 {
1176 Item item2 = player.dye[k];
1177 if (item2 != null && item2.stack > 0 && item2.dye > 0)
1178 {
1179 return true;
1180 }
1181 }
1182 for (int l = 0; l < 5; l++)
1183 {
1184 Item item3 = player.miscDyes[l];
1185 if (item3 != null && item3.stack > 0 && item3.dye > 0)
1186 {
1187 return true;
1188 }
1189 }
1190 }
1191 return false;
1192 }
1193
1194 public static bool SpawnAllowed_Nurse()
1195 {
1197 {
1198 return true;
1199 }
1200 for (int i = 0; i < 255; i++)
1201 {
1202 Player player = Main.player[i];
1203 if (player.active && player.statLifeMax / 20 > 5)
1204 {
1205 return true;
1206 }
1207 }
1208 return false;
1209 }
1210
1211 public static bool SpawnAllowed_Merchant()
1212 {
1214 {
1215 return true;
1216 }
1217 double num = 5000.0;
1218 int num2 = 0;
1219 for (int i = 0; i < 255; i++)
1220 {
1221 Player player = Main.player[i];
1222 if (!player.active)
1223 {
1224 continue;
1225 }
1226 for (int j = 0; j < 58; j++)
1227 {
1228 Item item = player.inventory[j];
1229 if (item != null && item.stack > 0)
1230 {
1231 if (item.type == 71)
1232 {
1233 num2 += item.stack;
1234 }
1235 if (item.type == 72)
1236 {
1237 num2 += item.stack * 100;
1238 }
1239 if (item.type == 73)
1240 {
1241 num2 += item.stack * 10000;
1242 }
1243 if (item.type == 74)
1244 {
1245 num2 += item.stack * 1000000;
1246 }
1247 if ((double)num2 >= num)
1248 {
1249 return true;
1250 }
1251 }
1252 }
1253 }
1254 return false;
1255 }
1256
1257 public static void ClearFoundActiveNPCs()
1258 {
1259 for (int i = 0; i < npcsFoundForCheckActive.Length; i++)
1260 {
1261 npcsFoundForCheckActive[i] = false;
1262 }
1263 }
1264
1265 public static void UpdateFoundActiveNPCs()
1266 {
1267 for (int i = 0; i < 200; i++)
1268 {
1269 NPC nPC = Main.npc[i];
1270 if (nPC.active && nPC.type >= 0 && nPC.type < NPCID.Count)
1271 {
1272 npcsFoundForCheckActive[nPC.type] = true;
1273 }
1274 }
1276 }
1277
1279 {
1280 for (int i = 0; i < npcsFoundForCheckActive.Length; i++)
1281 {
1282 npcsFoundForCheckActive[i] = false;
1283 }
1284 }
1285
1286 public static void UpdateRGBPeriheralProbe()
1287 {
1288 int highestTierBossOrEvent = 0;
1289 bool zoneOverworldHeight = Main.LocalPlayer.ZoneOverworldHeight;
1291 {
1293 }
1295 {
1297 }
1299 {
1301 }
1303 {
1305 }
1306 if (npcsFoundForCheckActive[266])
1307 {
1309 }
1310 if (npcsFoundForCheckActive[222])
1311 {
1313 }
1315 {
1317 }
1318 if (npcsFoundForCheckActive[113])
1319 {
1321 }
1323 {
1325 }
1326 if (npcsFoundForCheckActive[657])
1327 {
1329 }
1331 {
1333 }
1334 if (npcsFoundForCheckActive[134])
1335 {
1337 }
1338 if (npcsFoundForCheckActive[127])
1339 {
1341 }
1343 {
1345 }
1346 if (npcsFoundForCheckActive[262])
1347 {
1349 }
1350 if (npcsFoundForCheckActive[245])
1351 {
1353 }
1354 if (npcsFoundForCheckActive[636])
1355 {
1357 }
1359 {
1361 }
1362 if (DD2Event.Ongoing)
1363 {
1365 }
1367 {
1369 }
1370 if (npcsFoundForCheckActive[439])
1371 {
1373 }
1374 if (npcsFoundForCheckActive[370])
1375 {
1377 }
1378 if (npcsFoundForCheckActive[398])
1379 {
1381 }
1382 CommonConditions.Boss.HighestTierBossOrEvent = highestTierBossOrEvent;
1383 }
1384
1386 {
1388 }
1389
1391 {
1392 if (timeLeft > despawnTime)
1393 {
1395 }
1396 despawnEncouraged = true;
1397 }
1398
1400 {
1401 if (timeLeft < despawnTime)
1402 {
1404 }
1405 despawnEncouraged = false;
1406 }
1407
1408 public static bool WouldBeEncouragedToDespawn(int aistyle, int type)
1409 {
1410 if (aistyle == 4)
1411 {
1412 return Main.dayTime;
1413 }
1414 return false;
1415 }
1416
1417 public static string getNewNPCName(int npcType)
1418 {
1420 }
1421
1422 private static string getNewNPCNameInner(int npcType)
1423 {
1424 return npcType switch
1425 {
1426 17 => Language.RandomFromCategory("MerchantNames", WorldGen.genRand).Value,
1427 18 => Language.RandomFromCategory("NurseNames", WorldGen.genRand).Value,
1428 19 => Language.RandomFromCategory("ArmsDealerNames", WorldGen.genRand).Value,
1429 20 => Language.RandomFromCategory("DryadNames", WorldGen.genRand).Value,
1430 22 => Language.RandomFromCategory("GuideNames", WorldGen.genRand).Value,
1431 38 => Language.RandomFromCategory("DemolitionistNames", WorldGen.genRand).Value,
1432 54 => Language.RandomFromCategory("ClothierNames", WorldGen.genRand).Value,
1433 107 => Language.RandomFromCategory("GoblinTinkererNames", WorldGen.genRand).Value,
1434 108 => Language.RandomFromCategory("WizardNames", WorldGen.genRand).Value,
1435 124 => Language.RandomFromCategory("MechanicNames", WorldGen.genRand).Value,
1436 160 => Language.RandomFromCategory("TruffleNames", WorldGen.genRand).Value,
1437 178 => Language.RandomFromCategory("SteampunkerNames", WorldGen.genRand).Value,
1438 207 => Language.RandomFromCategory("DyeTraderNames", WorldGen.genRand).Value,
1439 208 => Language.RandomFromCategory("PartyGirlNames", WorldGen.genRand).Value,
1440 209 => Language.RandomFromCategory("CyborgNames", WorldGen.genRand).Value,
1441 227 => Language.RandomFromCategory("PainterNames", WorldGen.genRand).Value,
1442 228 => Language.RandomFromCategory("WitchDoctorNames", WorldGen.genRand).Value,
1443 229 => Language.RandomFromCategory("PirateNames", WorldGen.genRand).Value,
1444 353 => Language.RandomFromCategory("StylistNames", WorldGen.genRand).Value,
1445 368 => Language.RandomFromCategory("TravelingMerchantNames", WorldGen.genRand).Value,
1446 369 => Language.RandomFromCategory("AnglerNames", WorldGen.genRand).Value,
1447 453 => Language.RandomFromCategory("SkeletonMerchantNames", WorldGen.genRand).Value,
1448 441 => Language.RandomFromCategory("TaxCollectorNames", WorldGen.genRand).Value,
1449 550 => Language.RandomFromCategory("BartenderNames", WorldGen.genRand).Value,
1450 588 => Language.RandomFromCategory("GolferNames", WorldGen.genRand).Value,
1451 633 => Language.RandomFromCategory("BestiaryGirlNames", WorldGen.genRand).Value,
1452 663 => Language.RandomFromCategory("PrincessNames", WorldGen.genRand).Value,
1453 637 => Language.RandomFromCategory("CatNames_Siamese", WorldGen.genRand).Value,
1454 638 => Language.RandomFromCategory("DogNames_Labrador", WorldGen.genRand).Value,
1455 656 => Language.RandomFromCategory("BunnyNames_White", WorldGen.genRand).Value,
1456 670 => Language.RandomFromCategory("SlimeNames_Blue", WorldGen.genRand).Value,
1457 678 => Language.RandomFromCategory("SlimeNames_Green", WorldGen.genRand).Value,
1458 679 => Language.RandomFromCategory("SlimeNames_Old", WorldGen.genRand).Value,
1459 680 => Language.RandomFromCategory("SlimeNames_Purple", WorldGen.genRand).Value,
1460 681 => Language.RandomFromCategory("SlimeNames_Rainbow", WorldGen.genRand).Value,
1461 682 => Language.RandomFromCategory("SlimeNames_Red", WorldGen.genRand).Value,
1462 683 => Language.RandomFromCategory("SlimeNames_Yellow", WorldGen.genRand).Value,
1463 684 => Language.RandomFromCategory("SlimeNames_Copper", WorldGen.genRand).Value,
1464 _ => "",
1465 };
1466 }
1467
1469 {
1471 }
1472
1473 public void GetLifeStats(out int statLife, out int statLifeMax)
1474 {
1475 statLife = life;
1476 statLifeMax = lifeMax;
1477 if (realLife != -1)
1478 {
1479 statLife = Main.npc[realLife].life;
1480 statLifeMax = Main.npc[realLife].lifeMax;
1481 }
1482 }
1483
1484 public float GetLifePercent()
1485 {
1486 GetLifeStats(out var statLife, out var statLifeMax);
1487 return (float)statLife / (float)statLifeMax;
1488 }
1489
1491 {
1492 if (!HasGivenName)
1493 {
1494 return GetTypeNetName();
1495 }
1496 return NetworkText.FromKey("Game.NPCTitle", GetGivenNetName(), GetTypeNetName());
1497 }
1498
1500 {
1501 if (!HasGivenName)
1502 {
1503 return GetTypeNetName();
1504 }
1505 return GetGivenNetName();
1506 }
1507
1509 {
1511 }
1512
1513 public static void setNPCName(string newName, int npcType, bool resetExtras = false)
1514 {
1515 bool flag = false;
1516 for (int i = 0; i < 200; i++)
1517 {
1518 if (!Main.npc[i].active || Main.npc[i].type != npcType)
1519 {
1520 continue;
1521 }
1522 if (flag)
1523 {
1524 Main.npc[i].GivenName = getNewNPCName(npcType);
1525 Main.npc[i].needsUniqueInfoUpdate = true;
1526 continue;
1527 }
1528 Main.npc[i].GivenName = newName;
1529 if (!resetExtras)
1530 {
1531 break;
1532 }
1533 flag = true;
1534 }
1535 }
1536
1537 public static string firstNPCName(int npcType)
1538 {
1539 for (int i = 0; i < 200; i++)
1540 {
1541 if (Main.npc[i].active && Main.npc[i].type == npcType)
1542 {
1543 return Main.npc[i].GivenOrTypeName;
1544 }
1545 }
1546 return getNewNPCName(npcType);
1547 }
1548
1549 public static string GetFirstNPCNameOrNull(int npcType)
1550 {
1551 for (int i = 0; i < 200; i++)
1552 {
1553 if (Main.npc[i].active && Main.npc[i].type == npcType)
1554 {
1555 return Main.npc[i].GivenOrTypeName;
1556 }
1557 }
1558 return null;
1559 }
1560
1561 public static bool MechSpawn(float x, float y, int type)
1562 {
1563 int num = 0;
1564 int num2 = 0;
1565 int num3 = 0;
1566 for (int i = 0; i < 200; i++)
1567 {
1568 if (!Main.npc[i].active)
1569 {
1570 continue;
1571 }
1572 bool flag = false;
1573 if (Main.npc[i].type == type)
1574 {
1575 flag = true;
1576 }
1577 else if (type == 74 || type == 297 || type == 298)
1578 {
1579 if (Main.npc[i].type == 74 || Main.npc[i].type == 297 || Main.npc[i].type == 298)
1580 {
1581 flag = true;
1582 }
1583 }
1584 else if (type == 46 || type == 540 || type == 303 || type == 337)
1585 {
1586 if (Main.npc[i].type == 46 || Main.npc[i].type == 540 || Main.npc[i].type == 303 || Main.npc[i].type == 337)
1587 {
1588 flag = true;
1589 }
1590 }
1591 else if (type == 362 || type == 364)
1592 {
1593 if (Main.npc[i].type == 362 || Main.npc[i].type == 363 || Main.npc[i].type == 364 || Main.npc[i].type == 365)
1594 {
1595 flag = true;
1596 }
1597 }
1598 else if (type == 602)
1599 {
1600 if (Main.npc[i].type == 602 || Main.npc[i].type == 603)
1601 {
1602 flag = true;
1603 }
1604 }
1605 else if (type == 608)
1606 {
1607 if (Main.npc[i].type == 608 || Main.npc[i].type == 609)
1608 {
1609 flag = true;
1610 }
1611 }
1612 else if (type == 616 || type == 617)
1613 {
1614 if (Main.npc[i].type == 616 || Main.npc[i].type == 617)
1615 {
1616 flag = true;
1617 }
1618 }
1619 else if (type == 55 && Main.npc[i].type == 230)
1620 {
1621 flag = true;
1622 }
1623 else if (NPCID.Sets.IsDragonfly[type] && NPCID.Sets.IsDragonfly[Main.npc[i].type])
1624 {
1625 flag = true;
1626 }
1627 if (flag)
1628 {
1629 num++;
1630 Vector2 vector = new Vector2(x, y);
1631 float num4 = Main.npc[i].position.X - vector.X;
1632 float num5 = Main.npc[i].position.Y - vector.Y;
1633 float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5);
1634 if (num6 < 200f)
1635 {
1636 num2++;
1637 }
1638 if (num6 < 600f)
1639 {
1640 num3++;
1641 }
1642 }
1643 }
1644 if (num2 >= 3 || num3 >= 6 || num >= 10)
1645 {
1646 return false;
1647 }
1648 return true;
1649 }
1650
1651 public static int TypeToDefaultHeadIndex(int type)
1652 {
1653 return type switch
1654 {
1655 0 => 0,
1656 17 => 2,
1657 18 => 3,
1658 19 => 6,
1659 20 => 5,
1660 22 => 1,
1661 38 => 4,
1662 54 => 7,
1663 107 => 9,
1664 108 => 10,
1665 124 => 8,
1666 142 => 11,
1667 160 => 12,
1668 178 => 13,
1669 207 => 14,
1670 208 => 15,
1671 209 => 16,
1672 227 => 17,
1673 228 => 18,
1674 229 => 19,
1675 353 => 20,
1676 368 => 21,
1677 369 => 22,
1678 441 => 23,
1679 550 => 24,
1680 588 => 25,
1681 633 => 26,
1682 663 => 45,
1683 637 => 27,
1684 638 => 33,
1685 656 => 39,
1686 670 => 46,
1687 678 => 47,
1688 679 => 48,
1689 680 => 49,
1690 681 => 50,
1691 682 => 51,
1692 683 => 52,
1693 684 => 53,
1694 _ => -1,
1695 };
1696 }
1697
1699 {
1700 int result = NPCID.Sets.BossHeadTextures[type];
1701 switch (type)
1702 {
1703 case 4:
1704 if (ai[0] >= 2f)
1705 {
1706 result = 1;
1707 }
1708 break;
1709 case 266:
1710 if (ai[0] < 0f)
1711 {
1712 result = -1;
1713 }
1714 break;
1715 case 262:
1716 if (life <= lifeMax / 2)
1717 {
1718 result = 12;
1719 }
1720 break;
1721 case 125:
1722 if (ai[0] >= 3f)
1723 {
1724 result = 16;
1725 }
1726 break;
1727 case 126:
1728 if (ai[0] >= 3f)
1729 {
1730 result = 21;
1731 }
1732 break;
1733 case 439:
1734 if (ai[0] == 5f && alpha == 255)
1735 {
1736 result = -1;
1737 }
1738 break;
1739 case 440:
1740 if (ai[0] != 5f || alpha == 255)
1741 {
1742 result = -1;
1743 }
1744 break;
1745 }
1746 return result;
1747 }
1748
1749 public float GetBossHeadRotation()
1750 {
1751 float result = 0f;
1752 switch (type)
1753 {
1754 case 68:
1755 case 262:
1756 result = rotation;
1757 break;
1758 case 35:
1759 case 127:
1760 if (ai[1] == 1f || ai[1] == 2f)
1761 {
1762 result = rotation;
1763 }
1764 break;
1765 case 345:
1766 if (ai[0] == 2f)
1767 {
1768 result = rotation;
1769 }
1770 break;
1771 }
1772 return result;
1773 }
1774
1776 {
1777 SpriteEffects result = SpriteEffects.None;
1778 int num = type;
1779 if (num == 491 && spriteDirection == 1)
1780 {
1781 result = SpriteEffects.FlipHorizontally;
1782 }
1783 return result;
1784 }
1785
1786 public int BannerID()
1787 {
1788 if (netID >= -10)
1789 {
1790 return netID;
1791 }
1792 return type;
1793 }
1794
1796 {
1797 bool flag = false;
1798 int num = NPCID.FromNetId(id);
1799 SetDefaults(0);
1800 switch (id)
1801 {
1802 case -1:
1803 SetDefaults_ForNetId(num, 0.6f);
1804 flag = true;
1805 damage = 45;
1806 defense = 10;
1807 life = 90;
1808 knockBackResist *= 1.2f;
1809 value = 100f;
1810 break;
1811 case -2:
1812 SetDefaults_ForNetId(num, 0.9f);
1813 flag = true;
1814 damage = 45;
1815 defense = 20;
1816 life = 90;
1817 knockBackResist *= 1.2f;
1818 value = 100f;
1819 break;
1820 case -3:
1821 SetDefaults_ForNetId(num, 0.9f);
1822 flag = true;
1823 damage = 6;
1824 defense = 0;
1825 life = 14;
1826 knockBackResist *= 1.2f;
1827 color = new Color(0, 220, 40, 100);
1828 value = 3f;
1829 break;
1830 case -4:
1831 SetDefaults_ForNetId(num, 0.6f);
1832 flag = true;
1833 damage = 5;
1834 defense = 5;
1835 life = 150;
1836 knockBackResist *= 1.4f;
1837 color = new Color(250, 30, 90, 90);
1838 value = 10000f;
1839 rarity = 2;
1840 break;
1841 case -5:
1842 SetDefaults_ForNetId(num, 0.9f);
1843 flag = true;
1844 damage = 13;
1845 defense = 4;
1846 life = 30;
1847 knockBackResist *= 0.95f;
1848 alpha = 120;
1849 color = new Color(0, 0, 0, 50);
1850 value = 10f;
1851 break;
1852 case -6:
1853 SetDefaults_ForNetId(num, 1.05f);
1854 flag = true;
1855 damage = 15;
1856 defense = 4;
1857 life = 45;
1858 color = new Color(0, 0, 0, 50);
1859 value = 20f;
1860 break;
1861 case -7:
1862 SetDefaults_ForNetId(num, 1.2f);
1863 flag = true;
1864 damage = 12;
1865 defense = 6;
1866 life = 40;
1867 knockBackResist *= 0.9f;
1868 color = new Color(200, 0, 255, 150);
1869 value = 10f;
1870 break;
1871 case -8:
1872 SetDefaults_ForNetId(num, 1.025f);
1873 flag = true;
1874 damage = 12;
1875 defense = 4;
1876 life = 35;
1877 color = new Color(255, 30, 0, 100);
1878 value = 8f;
1879 break;
1880 case -9:
1881 SetDefaults_ForNetId(num, 1.2f);
1882 flag = true;
1883 damage = 15;
1884 defense = 7;
1885 life = 45;
1886 color = new Color(255, 255, 0, 100);
1887 value = 10f;
1888 break;
1889 case -10:
1890 SetDefaults_ForNetId(num, 1.1f);
1891 flag = true;
1892 damage = 18;
1893 defense = 6;
1894 life = 60;
1895 color = new Color(143, 215, 93, 100);
1896 value = 500f;
1897 break;
1898 case -11:
1899 {
1900 float num5 = 0.85f;
1901 if (Main.remixWorld)
1902 {
1903 num5 *= 1.3f;
1904 }
1906 flag = false;
1907 defense = (int)((float)defense * scale);
1908 damage = (int)((float)damage * scale);
1909 life = (int)((float)life * scale);
1910 value = (int)(value * scale);
1911 npcSlots *= scale;
1912 knockBackResist *= 2f - scale;
1913 break;
1914 }
1915 case -12:
1916 {
1917 float num4 = 1.15f;
1919 {
1920 num4 *= 1.3f;
1921 }
1923 flag = false;
1924 defense = (int)((float)defense * scale);
1925 damage = (int)((float)damage * scale);
1926 life = (int)((float)life * scale);
1927 value = (int)(value * scale);
1928 npcSlots *= scale;
1929 knockBackResist *= 2f - scale;
1930 break;
1931 }
1932 case -13:
1934 flag = false;
1935 defense = (int)((float)defense * scale);
1936 damage = (int)((float)damage * scale);
1937 life = (int)((float)life * scale);
1938 value = (int)(value * scale);
1939 break;
1940 case -14:
1941 SetDefaults_ForNetId(num, spawnparams, 1.15f);
1942 flag = false;
1943 defense = (int)((float)defense * scale);
1944 damage = (int)((double)((float)damage * scale) * 1.1);
1945 life = (int)((double)((float)life * scale) * 1.1);
1946 value = (int)(value * scale);
1947 npcSlots = 2f;
1948 knockBackResist *= 2f - scale;
1949 break;
1950 case -15:
1951 SetDefaults_ForNetId(num, spawnparams, 1.15f);
1952 flag = false;
1953 defense = (int)((float)defense * scale);
1954 damage = (int)((double)((float)damage * scale) * 1.1);
1955 life = 400;
1956 value = (int)(value * scale);
1957 npcSlots = 2f;
1958 knockBackResist *= 2f - scale;
1959 height = 44;
1960 break;
1961 case -16:
1962 SetDefaults_ForNetId(num, spawnparams, 0.85f);
1963 flag = false;
1964 defense = (int)((float)defense * scale);
1965 damage = (int)((float)damage * scale);
1966 life = (int)((float)life * scale);
1967 value = (int)(value * scale);
1968 npcSlots *= scale;
1969 knockBackResist *= 2f - scale;
1970 break;
1971 case -17:
1973 flag = false;
1974 defense = (int)((float)defense * scale);
1975 damage = (int)((float)damage * scale);
1976 life = (int)((float)life * scale);
1977 value = (int)(value * scale);
1978 npcSlots *= scale;
1979 knockBackResist *= 2f - scale;
1980 break;
1981 case -18:
1983 flag = false;
1984 defense = (int)((float)defense * scale);
1985 damage = (int)((float)damage * scale);
1986 life = (int)((float)life * scale);
1987 value = (int)(value * scale);
1988 npcSlots *= scale;
1989 knockBackResist *= 2f - scale;
1990 break;
1991 case -19:
1993 flag = false;
1994 defense = (int)((float)defense * scale);
1995 damage = (int)((float)damage * scale);
1996 life = (int)((float)life * scale);
1997 value = (int)(value * scale);
1998 npcSlots *= scale;
1999 knockBackResist *= 2f - scale;
2000 break;
2001 case -20:
2002 SetDefaults_ForNetId(num, 1.1f);
2003 defense = (int)((float)defense * scale);
2004 damage = (int)((float)damage * scale);
2005 life = (int)((float)life * scale);
2006 value = (int)(value * scale);
2007 npcSlots *= scale;
2008 knockBackResist *= 2f - scale;
2009 break;
2010 case -21:
2012 flag = false;
2013 defense = (int)((float)defense * scale);
2014 damage = (int)((float)damage * scale);
2015 life = (int)((float)life * scale);
2016 value = (int)(value * scale);
2017 npcSlots *= scale;
2018 knockBackResist *= 2f - scale;
2019 break;
2020 case -22:
2021 {
2022 float num3 = 0.85f;
2023 if (Main.remixWorld)
2024 {
2025 num3 *= 1.3f;
2026 }
2028 flag = false;
2029 defense = (int)((float)defense * scale);
2030 damage = (int)((float)damage * scale);
2031 life = (int)((float)life * scale);
2032 value = (int)(value * scale);
2033 npcSlots *= scale;
2034 knockBackResist *= 2f - scale;
2035 break;
2036 }
2037 case -23:
2038 {
2039 float num2 = 1.15f;
2040 if (Main.remixWorld)
2041 {
2042 num2 *= 1.3f;
2043 }
2045 flag = false;
2046 defense = (int)((float)defense * scale);
2047 damage = (int)((float)damage * scale);
2048 life = (int)((float)life * scale);
2049 value = (int)(value * scale);
2050 npcSlots *= scale;
2051 knockBackResist *= 2f - scale;
2052 break;
2053 }
2054 case -24:
2055 SetDefaults_ForNetId(num, spawnparams, 0.85f);
2056 flag = false;
2057 defense = (int)((float)defense * scale);
2058 damage = (int)((float)damage * scale);
2059 life = (int)((float)life * scale);
2060 value = (int)(value * scale);
2061 npcSlots *= scale;
2062 knockBackResist *= 2f - scale;
2063 break;
2064 case -25:
2065 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2066 flag = false;
2067 defense = (int)((float)defense * scale);
2068 damage = (int)((float)damage * scale);
2069 life = (int)((float)life * scale);
2070 value = (int)(value * scale);
2071 npcSlots *= scale;
2072 knockBackResist *= 2f - scale;
2073 break;
2074 case -26:
2076 flag = false;
2077 defense = (int)((float)defense * scale);
2078 damage = (int)((float)damage * scale);
2079 life = (int)((float)life * scale);
2080 value = (int)(value * scale);
2081 npcSlots *= scale;
2082 knockBackResist *= 2f - scale;
2083 break;
2084 case -27:
2086 flag = false;
2087 defense = (int)((float)defense * scale);
2088 damage = (int)((float)damage * scale);
2089 life = (int)((float)life * scale);
2090 value = (int)(value * scale);
2091 npcSlots *= scale;
2092 knockBackResist *= 2f - scale;
2093 break;
2094 case -28:
2095 SetDefaults_ForNetId(num, spawnparams, 0.85f);
2096 flag = false;
2097 defense = (int)((float)defense * scale);
2098 damage = (int)((float)damage * scale);
2099 life = (int)((float)life * scale);
2100 value = (int)(value * scale);
2101 npcSlots *= scale;
2102 knockBackResist *= 2f - scale;
2103 break;
2104 case -29:
2105 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2106 flag = false;
2107 defense = (int)((float)defense * scale);
2108 damage = (int)((float)damage * scale);
2109 life = (int)((float)life * scale);
2110 value = (int)(value * scale);
2111 npcSlots *= scale;
2112 knockBackResist *= 2f - scale;
2113 break;
2114 case -30:
2115 SetDefaults_ForNetId(num, spawnparams, 0.93f);
2116 flag = false;
2117 defense = (int)((float)defense * scale);
2118 damage = (int)((float)damage * scale);
2119 life = (int)((float)life * scale);
2120 value = (int)(value * scale);
2121 npcSlots *= scale;
2122 knockBackResist *= 2f - scale;
2123 break;
2124 case -31:
2125 SetDefaults_ForNetId(num, spawnparams, 1.13f);
2126 flag = false;
2127 defense = (int)((float)defense * scale);
2128 damage = (int)((float)damage * scale);
2129 life = (int)((float)life * scale);
2130 value = (int)(value * scale);
2131 npcSlots *= scale;
2132 knockBackResist *= 2f - scale;
2133 break;
2134 case -32:
2135 SetDefaults_ForNetId(num, spawnparams, 0.89f);
2136 flag = false;
2137 defense = (int)((float)defense * scale);
2138 damage = (int)((float)damage * scale);
2139 life = (int)((float)life * scale);
2140 value = (int)(value * scale);
2141 npcSlots *= scale;
2142 knockBackResist *= 2f - scale;
2143 break;
2144 case -33:
2145 SetDefaults_ForNetId(num, spawnparams, 1.11f);
2146 flag = false;
2147 defense = (int)((float)defense * scale);
2148 damage = (int)((float)damage * scale);
2149 life = (int)((float)life * scale);
2150 value = (int)(value * scale);
2151 npcSlots *= scale;
2152 knockBackResist *= 2f - scale;
2153 break;
2154 case -34:
2155 SetDefaults_ForNetId(num, spawnparams, 0.87f);
2156 flag = false;
2157 defense = (int)((float)defense * scale);
2158 damage = (int)((float)damage * scale);
2159 life = (int)((float)life * scale);
2160 value = (int)(value * scale);
2161 npcSlots *= scale;
2162 knockBackResist *= 2f - scale;
2163 break;
2164 case -35:
2165 SetDefaults_ForNetId(num, spawnparams, 1.13f);
2166 flag = false;
2167 defense = (int)((float)defense * scale);
2168 damage = (int)((float)damage * scale);
2169 life = (int)((float)life * scale);
2170 value = (int)(value * scale);
2171 npcSlots *= scale;
2172 knockBackResist *= 2f - scale;
2173 break;
2174 case -36:
2175 SetDefaults_ForNetId(num, spawnparams, 0.92f);
2176 flag = false;
2177 defense = (int)((float)defense * scale);
2178 damage = (int)((float)damage * scale);
2179 life = (int)((float)life * scale);
2180 value = (int)(value * scale);
2181 npcSlots *= scale;
2182 knockBackResist *= 2f - scale;
2183 break;
2184 case -37:
2185 SetDefaults_ForNetId(num, spawnparams, 1.08f);
2186 flag = false;
2187 defense = (int)((float)defense * scale);
2188 damage = (int)((float)damage * scale);
2189 life = (int)((float)life * scale);
2190 value = (int)(value * scale);
2191 npcSlots *= scale;
2192 knockBackResist *= 2f - scale;
2193 break;
2194 case -38:
2195 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2196 flag = false;
2197 defense = (int)((float)defense * scale);
2198 damage = (int)((float)damage * scale);
2199 life = (int)((float)life * scale);
2200 value = (int)(value * scale);
2201 npcSlots *= scale;
2202 knockBackResist *= 2f - scale;
2203 break;
2204 case -39:
2206 flag = false;
2207 defense = (int)((float)defense * scale);
2208 damage = (int)((float)damage * scale);
2209 life = (int)((float)life * scale);
2210 value = (int)(value * scale);
2211 npcSlots *= scale;
2212 knockBackResist *= 2f - scale;
2213 break;
2214 case -40:
2216 flag = false;
2217 defense = (int)((float)defense * scale);
2218 damage = (int)((float)damage * scale);
2219 life = (int)((float)life * scale);
2220 value = (int)(value * scale);
2221 npcSlots *= scale;
2222 knockBackResist *= 2f - scale;
2223 break;
2224 case -41:
2225 SetDefaults_ForNetId(num, spawnparams, 0.85f);
2226 flag = false;
2227 defense = (int)((float)defense * scale);
2228 damage = (int)((float)damage * scale);
2229 life = (int)((float)life * scale);
2230 value = (int)(value * scale);
2231 npcSlots *= scale;
2232 knockBackResist *= 2f - scale;
2233 break;
2234 case -42:
2236 flag = false;
2237 defense = (int)((float)defense * scale);
2238 damage = (int)((float)damage * scale);
2239 life = (int)((float)life * scale);
2240 value = (int)(value * scale);
2241 npcSlots *= scale;
2242 knockBackResist *= 2f - scale;
2243 break;
2244 case -43:
2245 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2246 flag = false;
2247 defense = (int)((float)defense * scale);
2248 damage = (int)((float)damage * scale);
2249 life = (int)((float)life * scale);
2250 value = (int)(value * scale);
2251 npcSlots *= scale;
2252 knockBackResist *= 2f - scale;
2253 break;
2254 case -44:
2255 SetDefaults_ForNetId(num, spawnparams, 0.87f);
2256 flag = false;
2257 defense = (int)((float)defense * scale);
2258 damage = (int)((float)damage * scale);
2259 life = (int)((float)life * scale);
2260 value = (int)(value * scale);
2261 npcSlots *= scale;
2262 knockBackResist *= 2f - scale;
2263 break;
2264 case -45:
2265 SetDefaults_ForNetId(num, spawnparams, 1.05f);
2266 flag = false;
2267 defense = (int)((float)defense * scale);
2268 damage = (int)((float)damage * scale);
2269 life = (int)((float)life * scale);
2270 value = (int)(value * scale);
2271 npcSlots *= scale;
2272 knockBackResist *= 2f - scale;
2273 break;
2274 case -46:
2276 flag = false;
2277 defense = (int)((float)defense * scale);
2278 damage = (int)((float)damage * scale);
2279 life = (int)((float)life * scale);
2280 value = (int)(value * scale);
2281 npcSlots *= scale;
2282 knockBackResist *= 2f - scale;
2283 break;
2284 case -47:
2286 flag = false;
2287 defense = (int)((float)defense * scale);
2288 damage = (int)((float)damage * scale);
2289 life = (int)((float)life * scale);
2290 value = (int)(value * scale);
2291 npcSlots *= scale;
2292 knockBackResist *= 2f - scale;
2293 break;
2294 case -48:
2295 SetDefaults_ForNetId(num, spawnparams, 0.93f);
2296 flag = false;
2297 defense = (int)((float)defense * scale);
2298 damage = (int)((float)damage * scale);
2299 life = (int)((float)life * scale);
2300 value = (int)(value * scale);
2301 npcSlots *= scale;
2302 knockBackResist *= 2f - scale;
2303 break;
2304 case -49:
2305 SetDefaults_ForNetId(num, spawnparams, 1.07f);
2306 flag = false;
2307 defense = (int)((float)defense * scale);
2308 damage = (int)((float)damage * scale);
2309 life = (int)((float)life * scale);
2310 value = (int)(value * scale);
2311 npcSlots *= scale;
2312 knockBackResist *= 2f - scale;
2313 break;
2314 case -50:
2315 SetDefaults_ForNetId(num, spawnparams, 0.87f);
2316 flag = false;
2317 defense = (int)((float)defense * scale);
2318 damage = (int)((float)damage * scale);
2319 life = (int)((float)life * scale);
2320 value = (int)(value * scale);
2321 npcSlots *= scale;
2322 knockBackResist *= 2f - scale;
2323 break;
2324 case -51:
2325 SetDefaults_ForNetId(num, spawnparams, 1.13f);
2326 flag = false;
2327 defense = (int)((float)defense * scale);
2328 damage = (int)((float)damage * scale);
2329 life = (int)((float)life * scale);
2330 value = (int)(value * scale);
2331 npcSlots *= scale;
2332 knockBackResist *= 2f - scale;
2333 break;
2334 case -52:
2335 SetDefaults_ForNetId(num, spawnparams, 0.85f);
2336 flag = false;
2337 defense = (int)((float)defense * scale);
2338 damage = (int)((float)damage * scale);
2339 life = (int)((float)life * scale);
2340 value = (int)(value * scale);
2341 npcSlots *= scale;
2342 knockBackResist *= 2f - scale;
2343 break;
2344 case -53:
2345 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2346 flag = false;
2347 defense = (int)((float)defense * scale);
2348 damage = (int)((float)damage * scale);
2349 life = (int)((float)life * scale);
2350 value = (int)(value * scale);
2351 npcSlots *= scale;
2352 knockBackResist *= 2f - scale;
2353 break;
2354 case -54:
2356 flag = false;
2357 defense = (int)((float)defense * scale);
2358 damage = (int)((float)damage * scale);
2359 life = (int)((float)life * scale);
2360 value = (int)(value * scale);
2361 npcSlots *= scale;
2362 knockBackResist *= 2f - scale;
2363 break;
2364 case -55:
2366 flag = false;
2367 defense = (int)((float)defense * scale);
2368 damage = (int)((float)damage * scale);
2369 life = (int)((float)life * scale);
2370 value = (int)(value * scale);
2371 npcSlots *= scale;
2372 knockBackResist *= 2f - scale;
2373 break;
2374 case -56:
2375 SetDefaults_ForNetId(num, spawnparams, 0.85f);
2376 flag = false;
2377 defense = (int)((float)defense * scale);
2378 damage = (int)((float)damage * scale);
2379 life = (int)((float)life * scale);
2380 value = (int)(value * scale);
2381 npcSlots *= scale;
2382 knockBackResist *= 2f - scale;
2383 break;
2384 case -57:
2385 SetDefaults_ForNetId(num, spawnparams, 1.25f);
2386 flag = false;
2387 defense = (int)((float)defense * scale);
2388 damage = (int)((float)damage * scale);
2389 life = (int)((float)life * scale);
2390 value = (int)(value * scale);
2391 npcSlots *= scale;
2392 knockBackResist *= 2f - scale;
2393 break;
2394 case -58:
2396 flag = false;
2397 defense = (int)((float)defense * scale);
2398 damage = (int)((float)damage * scale);
2399 life = (int)((float)life * scale);
2400 value = (int)(value * scale);
2401 npcSlots *= scale;
2402 knockBackResist *= 2f - scale;
2403 break;
2404 case -59:
2405 SetDefaults_ForNetId(num, spawnparams, 1.15f);
2406 flag = false;
2407 defense = (int)((float)defense * scale);
2408 damage = (int)((float)damage * scale);
2409 life = (int)((float)life * scale);
2410 value = (int)(value * scale);
2411 npcSlots *= scale;
2412 knockBackResist *= 2f - scale;
2413 break;
2414 case -60:
2415 SetDefaults_ForNetId(num, spawnparams, 0.92f);
2416 flag = false;
2417 defense = (int)((float)defense * scale);
2418 damage = (int)((float)damage * scale);
2419 life = (int)((float)life * scale);
2420 value = (int)(value * scale);
2421 npcSlots *= scale;
2422 knockBackResist *= 2f - scale;
2423 break;
2424 case -61:
2426 flag = false;
2427 defense = (int)((float)defense * scale);
2428 damage = (int)((float)damage * scale);
2429 life = (int)((float)life * scale);
2430 value = (int)(value * scale);
2431 npcSlots *= scale;
2432 knockBackResist *= 2f - scale;
2433 break;
2434 case -62:
2435 SetDefaults_ForNetId(num, spawnparams, 0.78f);
2436 flag = false;
2437 defense = (int)((float)defense * scale);
2438 damage = (int)((float)damage * scale);
2439 life = (int)((float)life * scale);
2440 value = (int)(value * scale);
2441 npcSlots *= scale;
2442 knockBackResist *= 2f - scale;
2443 break;
2444 case -63:
2445 SetDefaults_ForNetId(num, spawnparams, 1.16f);
2446 flag = false;
2447 defense = (int)((float)defense * scale);
2448 damage = (int)((float)damage * scale);
2449 life = (int)((float)life * scale);
2450 value = (int)(value * scale);
2451 npcSlots *= scale;
2452 knockBackResist *= 2f - scale;
2453 break;
2454 case -64:
2455 SetDefaults_ForNetId(num, spawnparams, 0.87f);
2456 flag = false;
2457 defense = (int)((float)defense * scale);
2458 damage = (int)((float)damage * scale);
2459 life = (int)((float)life * scale);
2460 value = (int)(value * scale);
2461 npcSlots *= scale;
2462 knockBackResist *= 2f - scale;
2463 break;
2464 case -65:
2465 SetDefaults_ForNetId(num, spawnparams, 1.21f);
2466 flag = false;
2467 defense = (int)((float)defense * scale);
2468 damage = (int)((float)damage * scale);
2469 life = (int)((float)life * scale);
2470 value = (int)(value * scale);
2471 npcSlots *= scale;
2472 knockBackResist *= 2f - scale;
2473 break;
2474 default:
2475 return;
2476 }
2477 netID = id;
2478 lifeMax = life;
2479 defDamage = damage;
2481 if (flag)
2482 {
2483 ScaleStats(spawnparams.playerCountForMultiplayerDifficultyOverride, spawnparams.gameModeData, spawnparams.strengthMultiplierOverride);
2484 life = lifeMax;
2485 }
2486 }
2487
2489 {
2490 bool[] array = new bool[playerInteraction.Length];
2491 for (int i = 0; i < playerInteraction.Length; i++)
2492 {
2493 array[i] = playerInteraction[i];
2494 }
2496 for (int j = 0; j < playerInteraction.Length; j++)
2497 {
2499 }
2500 }
2501
2503 {
2505 {
2506 playerCountForMultiplayerDifficultyOverride = 1,
2507 sizeScaleOverride = scaleOverride,
2508 strengthMultiplierOverride = 1f
2509 });
2510 }
2511
2516
2518 {
2519 netShimmer = true;
2521 }
2522
2524 {
2525 if (spawnparams.gameModeData == null)
2526 {
2527 spawnparams.gameModeData = Main.GameModeInfo;
2528 }
2529 if (Main.getGoodWorld && spawnparams.sizeScaleOverride.HasValue)
2530 {
2531 spawnparams.sizeScaleOverride = (spawnparams.sizeScaleOverride + spawnparams.sizeScaleOverride * spawnparams.sizeScaleOverride) / 2f;
2532 }
2533 if (Type < 0)
2534 {
2536 return;
2537 }
2539 honeyMovementSpeed = 0.25f;
2540 netOffset *= 0f;
2541 altTexture = 0;
2543 nameOver = 0f;
2545 extraValue = 0;
2546 for (int i = 0; i < playerInteraction.Length; i++)
2547 {
2548 playerInteraction[i] = false;
2549 }
2550 rarity = 0;
2551 dontCountMe = false;
2552 releaseOwner = 255;
2553 catchItem = 0;
2554 needsUniqueInfoUpdate = true;
2555 netStream = 32;
2556 netID = 0;
2557 netAlways = false;
2558 netSpam = 0;
2559 SpawnedFromStatue = false;
2562 if (netShimmer)
2563 {
2565 netShimmer = false;
2566 }
2568 strengthMultiplier = 1f;
2569 int num = 10;
2570 if (Type >= 0)
2571 {
2573 }
2574 if (num != oldPos.Length)
2575 {
2576 Array.Resize(ref oldPos, num);
2577 Array.Resize(ref oldRot, num);
2578 }
2579 for (int j = 0; j < oldPos.Length; j++)
2580 {
2581 oldRot[j] = 0f;
2582 oldPos[j].X = 0f;
2583 oldPos[j].Y = 0f;
2584 }
2585 for (int k = 0; k < maxBuffs; k++)
2586 {
2587 buffTime[k] = 0;
2588 buffType[k] = 0;
2589 }
2590 for (int l = 0; l < BuffID.Count; l++)
2591 {
2592 buffImmune[l] = false;
2593 }
2594 setFrameSize = false;
2595 netSkip = -2;
2596 realLife = -1;
2597 lifeRegen = 0;
2599 lifeRegenCount = 0;
2600 markedByScytheWhip = false;
2601 poisoned = false;
2602 soulDrain = false;
2603 venom = false;
2604 shadowFlame = false;
2605 canDisplayBuffs = true;
2606 onFire = false;
2607 midas = false;
2608 ichor = false;
2609 onFrostBurn = false;
2610 onFrostBurn2 = false;
2611 shimmering = false;
2612 confused = false;
2613 loveStruck = false;
2615 stinky = false;
2616 dryadWard = false;
2617 onFire2 = false;
2618 onFire3 = false;
2619 justHit = false;
2620 dontTakeDamage = false;
2622 npcSlots = 1f;
2623 lavaImmune = false;
2624 lavaWet = false;
2625 wetCount = 0;
2626 wet = false;
2627 townNPC = false;
2628 homeless = false;
2629 homeTileX = -1;
2630 homeTileY = -1;
2631 housingCategory = 0;
2632 friendly = false;
2633 behindTiles = false;
2634 boss = false;
2635 noTileCollide = false;
2636 rotation = 0f;
2637 active = true;
2638 alpha = 0;
2639 color = default(Color);
2640 collideX = false;
2641 collideY = false;
2642 direction = 0;
2644 frameCounter = 0.0;
2645 netUpdate = true;
2646 netUpdate2 = false;
2647 knockBackResist = 1f;
2648 GivenName = "";
2649 noGravity = false;
2650 scale = 1f;
2651 HitSound = null;
2652 DeathSound = null;
2653 spriteDirection = -1;
2654 target = 255;
2655 oldTarget = target;
2656 targetRect = default(Rectangle);
2658 type = Type;
2659 value = 0f;
2660 coldDamage = false;
2661 trapImmune = false;
2662 hide = false;
2663 immortal = false;
2664 chaseable = true;
2665 breath = 200;
2666 breathCounter = 0;
2667 reflectsProjectiles = false;
2668 canGhostHeal = true;
2669 javelined = false;
2670 tentacleSpiked = false;
2671 bloodButchered = false;
2672 daybreak = false;
2673 celled = false;
2674 dryadBane = false;
2675 betsysCurse = false;
2676 oiled = false;
2677 despawnEncouraged = false;
2678 for (int m = 0; m < maxAI; m++)
2679 {
2680 ai[m] = 0f;
2681 }
2682 for (int n = 0; n < maxAI; n++)
2683 {
2684 localAI[n] = 0f;
2685 }
2686 if (type == 1)
2687 {
2688 width = 24;
2689 height = 18;
2690 aiStyle = 1;
2691 damage = 7;
2692 defense = 2;
2693 lifeMax = 25;
2696 alpha = 175;
2697 color = new Color(0, 80, 255, 100);
2698 value = 25f;
2699 }
2700 else if (type == 2)
2701 {
2702 width = 30;
2703 height = 32;
2704 aiStyle = 2;
2705 damage = 18;
2706 defense = 2;
2707 lifeMax = 60;
2709 knockBackResist = 0.8f;
2711 value = 75f;
2712 }
2713 else if (type == 3)
2714 {
2715 width = 18;
2716 height = 40;
2717 aiStyle = 3;
2718 damage = 14;
2719 defense = 6;
2720 lifeMax = 45;
2723 knockBackResist = 0.5f;
2724 value = 60f;
2725 }
2726 else if (type == 430)
2727 {
2728 width = 18;
2729 height = 40;
2730 aiStyle = 3;
2731 damage = 14;
2732 defense = 6;
2733 lifeMax = 45;
2736 knockBackResist = 0.5f;
2737 value = 60f;
2738 }
2739 else if (type == 431)
2740 {
2741 width = 18;
2742 height = 40;
2743 aiStyle = 3;
2744 damage = 16;
2745 defense = 8;
2746 lifeMax = 50;
2749 knockBackResist = 0.45f;
2750 value = 80f;
2751 }
2752 else if (type == 432)
2753 {
2754 width = 18;
2755 height = 40;
2756 aiStyle = 3;
2757 damage = 16;
2758 defense = 8;
2759 lifeMax = 50;
2762 knockBackResist = 0.45f;
2763 value = 65f;
2764 }
2765 else if (type == 433)
2766 {
2767 width = 18;
2768 height = 40;
2769 aiStyle = 3;
2770 damage = 13;
2771 defense = 6;
2772 lifeMax = 40;
2775 knockBackResist = 0.55f;
2776 value = 55f;
2777 }
2778 else if (type == 434)
2779 {
2780 width = 18;
2781 height = 40;
2782 aiStyle = 3;
2783 damage = 13;
2784 defense = 8;
2785 lifeMax = 45;
2788 knockBackResist = 0.45f;
2789 value = 80f;
2790 }
2791 else if (type == 435)
2792 {
2793 width = 18;
2794 height = 40;
2795 aiStyle = 3;
2796 damage = 16;
2797 defense = 4;
2798 lifeMax = 45;
2801 knockBackResist = 0.55f;
2802 value = 70f;
2803 }
2804 else if (type == 436)
2805 {
2806 width = 18;
2807 height = 40;
2808 aiStyle = 3;
2809 damage = 12;
2810 defense = 4;
2811 lifeMax = 38;
2814 knockBackResist = 0.6f;
2815 value = 65f;
2816 }
2817 else if (type == 4)
2818 {
2819 width = 100;
2820 height = 110;
2821 aiStyle = 4;
2822 damage = 15;
2823 defense = 12;
2824 lifeMax = 2800;
2827 knockBackResist = 0f;
2828 noGravity = true;
2829 noTileCollide = true;
2831 boss = true;
2832 value = 30000f;
2833 npcSlots = 5f;
2834 }
2835 else if (type == 5)
2836 {
2837 width = 20;
2838 height = 20;
2839 aiStyle = 5;
2840 damage = 12;
2841 defense = 0;
2842 lifeMax = 8;
2845 noGravity = true;
2846 noTileCollide = true;
2847 }
2848 else if (type == 6)
2849 {
2850 npcSlots = 1f;
2851 width = 30;
2852 height = 30;
2853 aiStyle = 5;
2854 damage = 22;
2855 defense = 8;
2856 lifeMax = 40;
2859 noGravity = true;
2860 knockBackResist = 0.5f;
2861 value = 90f;
2862 if (Main.remixWorld)
2863 {
2864 scale *= 1.3f;
2865 damage = (int)((float)damage * scale);
2866 defense = (int)((float)defense * scale);
2867 lifeMax = (int)((float)lifeMax * scale);
2868 value = (int)(value * scale);
2869 }
2870 else if (Main.getGoodWorld)
2871 {
2872 scale *= 1.3f;
2873 }
2874 }
2875 else if (type == 7)
2876 {
2877 npcSlots = 3.5f;
2878 width = 22;
2879 height = 22;
2880 aiStyle = 6;
2881 damage = 31;
2882 defense = 2;
2883 lifeMax = 100;
2886 noGravity = true;
2887 noTileCollide = true;
2888 knockBackResist = 0f;
2889 behindTiles = true;
2890 value = 140f;
2891 netAlways = true;
2892 if (Main.remixWorld)
2893 {
2894 scale *= 1.3f;
2895 damage = (int)((float)damage * scale);
2896 defense = (int)((float)defense * scale);
2897 lifeMax = (int)((float)lifeMax * scale);
2898 value = (int)(value * scale);
2899 }
2900 }
2901 else if (type == 8)
2902 {
2903 width = 22;
2904 height = 22;
2905 aiStyle = 6;
2906 netAlways = true;
2907 damage = 16;
2908 defense = 6;
2909 lifeMax = 100;
2912 noGravity = true;
2913 noTileCollide = true;
2914 knockBackResist = 0f;
2915 behindTiles = true;
2916 value = 140f;
2917 dontCountMe = true;
2918 if (Main.remixWorld)
2919 {
2920 scale *= 1.3f;
2921 damage = (int)((float)damage * scale);
2922 defense = (int)((float)defense * scale);
2923 lifeMax = (int)((float)lifeMax * scale);
2924 value = (int)(value * scale);
2925 }
2926 }
2927 else if (type == 9)
2928 {
2929 width = 22;
2930 height = 22;
2931 aiStyle = 6;
2932 netAlways = true;
2933 damage = 13;
2934 defense = 10;
2935 lifeMax = 100;
2938 noGravity = true;
2939 noTileCollide = true;
2940 knockBackResist = 0f;
2941 behindTiles = true;
2942 value = 140f;
2943 dontCountMe = true;
2944 if (Main.remixWorld)
2945 {
2946 scale *= 1.3f;
2947 damage = (int)((float)damage * scale);
2948 defense = (int)((float)defense * scale);
2949 lifeMax = (int)((float)lifeMax * scale);
2950 value = (int)(value * scale);
2951 }
2952 }
2953 else if (type == 10)
2954 {
2955 width = 14;
2956 height = 14;
2957 aiStyle = 6;
2958 netAlways = true;
2959 damage = 8;
2960 defense = 0;
2961 lifeMax = 30;
2964 noGravity = true;
2965 noTileCollide = true;
2966 knockBackResist = 0f;
2967 behindTiles = true;
2968 value = 40f;
2969 }
2970 else if (type == 11)
2971 {
2972 width = 14;
2973 height = 14;
2974 aiStyle = 6;
2975 netAlways = true;
2976 damage = 4;
2977 defense = 4;
2978 lifeMax = 30;
2981 noGravity = true;
2982 noTileCollide = true;
2983 knockBackResist = 0f;
2984 behindTiles = true;
2985 value = 40f;
2986 dontCountMe = true;
2987 }
2988 else if (type == 12)
2989 {
2990 width = 14;
2991 height = 14;
2992 aiStyle = 6;
2993 netAlways = true;
2994 damage = 4;
2995 defense = 6;
2996 lifeMax = 30;
2999 noGravity = true;
3000 noTileCollide = true;
3001 knockBackResist = 0f;
3002 behindTiles = true;
3003 value = 40f;
3004 dontCountMe = true;
3005 }
3006 else if (type == 13)
3007 {
3008 npcSlots = 5f;
3009 width = 38;
3010 height = 38;
3011 aiStyle = 6;
3012 netAlways = true;
3013 damage = 22;
3014 defense = 2;
3015 lifeMax = 150;
3018 noGravity = true;
3019 noTileCollide = true;
3020 knockBackResist = 0f;
3021 behindTiles = true;
3022 value = 800f;
3023 scale = 1f;
3024 alpha = 255;
3025 }
3026 else if (type == 14)
3027 {
3028 width = 38;
3029 height = 38;
3030 aiStyle = 6;
3031 netAlways = true;
3032 damage = 13;
3033 defense = 4;
3034 lifeMax = 150;
3037 noGravity = true;
3038 noTileCollide = true;
3039 knockBackResist = 0f;
3040 behindTiles = true;
3041 value = 800f;
3042 scale = 1f;
3043 dontCountMe = true;
3044 alpha = 255;
3045 }
3046 else if (type == 15)
3047 {
3048 width = 38;
3049 height = 38;
3050 aiStyle = 6;
3051 netAlways = true;
3052 damage = 11;
3053 defense = 8;
3054 lifeMax = 150;
3057 noGravity = true;
3058 noTileCollide = true;
3059 knockBackResist = 0f;
3060 behindTiles = true;
3061 value = 800f;
3062 scale = 1f;
3063 dontCountMe = true;
3064 alpha = 255;
3065 }
3066 else if (type == 16)
3067 {
3068 npcSlots = 2f;
3069 width = 36;
3070 height = 24;
3071 aiStyle = 1;
3072 damage = 20;
3073 defense = 7;
3074 lifeMax = 90;
3077 alpha = 120;
3078 color = new Color(0, 0, 0, 50);
3079 value = 75f;
3080 scale = 1.25f;
3081 knockBackResist = 0.6f;
3082 }
3083 else if (type == 17)
3084 {
3085 townNPC = true;
3086 friendly = true;
3087 width = 18;
3088 height = 40;
3089 aiStyle = 7;
3090 damage = 10;
3091 defense = 15;
3092 lifeMax = 250;
3095 knockBackResist = 0.5f;
3096 }
3097 else if (type == 18)
3098 {
3099 townNPC = true;
3100 friendly = true;
3101 width = 18;
3102 height = 40;
3103 aiStyle = 7;
3104 damage = 10;
3105 defense = 15;
3106 lifeMax = 250;
3109 knockBackResist = 0.5f;
3110 }
3111 else if (type == 19)
3112 {
3113 townNPC = true;
3114 friendly = true;
3115 width = 18;
3116 height = 40;
3117 aiStyle = 7;
3118 damage = 10;
3119 defense = 15;
3120 lifeMax = 250;
3123 knockBackResist = 0.5f;
3124 }
3125 else if (type == 20)
3126 {
3127 townNPC = true;
3128 friendly = true;
3129 width = 18;
3130 height = 40;
3131 aiStyle = 7;
3132 damage = 10;
3133 defense = 15;
3134 lifeMax = 250;
3137 knockBackResist = 0.5f;
3138 }
3139 else if (type == 21)
3140 {
3141 width = 18;
3142 height = 40;
3143 aiStyle = 3;
3144 damage = 20;
3145 defense = 8;
3146 lifeMax = 60;
3149 knockBackResist = 0.5f;
3150 value = 100f;
3151 }
3152 else if (type == 22)
3153 {
3154 townNPC = true;
3155 friendly = true;
3156 width = 18;
3157 height = 40;
3158 aiStyle = 7;
3159 damage = 10;
3160 defense = 15;
3161 lifeMax = 250;
3164 knockBackResist = 0.5f;
3165 }
3166 else if (type == 23)
3167 {
3168 width = 22;
3169 height = 22;
3170 aiStyle = 5;
3171 damage = 40;
3172 defense = 6;
3173 lifeMax = 26;
3176 noGravity = true;
3177 noTileCollide = true;
3178 value = 80f;
3179 knockBackResist = 0.4f;
3180 }
3181 else if (type == 24)
3182 {
3183 npcSlots = 3f;
3184 width = 18;
3185 height = 40;
3186 aiStyle = 8;
3187 damage = 30;
3188 defense = 16;
3189 lifeMax = 70;
3192 knockBackResist = 0.5f;
3193 lavaImmune = true;
3194 value = 350f;
3195 }
3196 else if (type == 25)
3197 {
3198 width = 16;
3199 height = 16;
3200 aiStyle = 9;
3201 damage = 30;
3202 defense = 0;
3203 lifeMax = 1;
3206 noGravity = true;
3207 noTileCollide = true;
3208 knockBackResist = 0f;
3209 alpha = 100;
3210 }
3211 else if (type == 31)
3212 {
3213 width = 18;
3214 height = 40;
3215 aiStyle = 3;
3216 damage = 26;
3217 defense = 8;
3218 lifeMax = 80;
3221 knockBackResist = 0.8f;
3222 value = 130f;
3223 }
3224 else if (type == 32)
3225 {
3226 width = 18;
3227 height = 40;
3228 aiStyle = 8;
3229 damage = 20;
3230 defense = 2;
3231 lifeMax = 50;
3234 knockBackResist = 0.6f;
3235 value = 140f;
3236 npcSlots = 2f;
3237 }
3238 else if (type == 33)
3239 {
3240 width = 16;
3241 height = 16;
3242 aiStyle = 9;
3243 damage = 20;
3244 defense = 0;
3245 lifeMax = 1;
3248 noGravity = true;
3249 noTileCollide = true;
3250 alpha = 255;
3251 knockBackResist = 0f;
3252 }
3253 else if (type == 34)
3254 {
3255 width = 26;
3256 height = 28;
3257 aiStyle = 10;
3258 damage = 35;
3259 defense = 6;
3260 lifeMax = 40;
3263 noGravity = true;
3264 noTileCollide = true;
3265 value = 150f;
3266 knockBackResist = 0.2f;
3267 npcSlots = 0.75f;
3268 }
3269 else if (type == 35)
3270 {
3271 width = 80;
3272 height = 102;
3273 aiStyle = 11;
3274 damage = 32;
3275 defense = 10;
3276 lifeMax = 4400;
3279 noGravity = true;
3280 noTileCollide = true;
3281 value = 50000f;
3282 knockBackResist = 0f;
3283 boss = true;
3284 npcSlots = 6f;
3285 }
3286 else if (type == 36)
3287 {
3288 width = 52;
3289 height = 52;
3290 aiStyle = 12;
3291 damage = 20;
3292 defense = 14;
3293 lifeMax = 600;
3296 noGravity = true;
3297 noTileCollide = true;
3298 knockBackResist = 0f;
3299 }
3300 else if (type == 37)
3301 {
3302 townNPC = true;
3303 friendly = true;
3304 width = 18;
3305 height = 40;
3306 aiStyle = 7;
3307 damage = 10;
3308 defense = 15;
3309 lifeMax = 250;
3312 knockBackResist = 0.5f;
3313 }
3314 else if (type == 38)
3315 {
3316 townNPC = true;
3317 friendly = true;
3318 width = 18;
3319 height = 40;
3320 aiStyle = 7;
3321 damage = 10;
3322 defense = 15;
3323 lifeMax = 250;
3326 knockBackResist = 0.5f;
3327 }
3328 else if (type == 39)
3329 {
3330 npcSlots = 6f;
3331 width = 22;
3332 height = 22;
3333 aiStyle = 6;
3334 netAlways = true;
3335 damage = 36;
3336 defense = 12;
3337 lifeMax = 300;
3340 noGravity = true;
3341 noTileCollide = true;
3342 knockBackResist = 0f;
3343 behindTiles = true;
3344 value = 1200f;
3345 if (Main.getGoodWorld)
3346 {
3347 lifeMax += 100;
3348 defense += 2;
3349 damage += 4;
3350 scale = 1.1f;
3351 if (Main.remixWorld)
3352 {
3353 lifeMax += 50;
3354 scale *= 1.2f;
3355 defense += 4;
3356 }
3357 }
3358 }
3359 else if (type == 40)
3360 {
3361 width = 22;
3362 height = 22;
3363 aiStyle = 6;
3364 netAlways = true;
3365 damage = 20;
3366 defense = 18;
3367 lifeMax = 300;
3370 noGravity = true;
3371 noTileCollide = true;
3372 knockBackResist = 0f;
3373 behindTiles = true;
3374 value = 1200f;
3375 dontCountMe = true;
3376 if (Main.getGoodWorld)
3377 {
3378 lifeMax += 100;
3379 defense += 2;
3380 damage += 4;
3381 scale = 1.1f;
3382 if (Main.remixWorld)
3383 {
3384 lifeMax += 50;
3385 scale *= 1.2f;
3386 defense += 4;
3387 }
3388 }
3389 }
3390 else if (type == 41)
3391 {
3392 width = 22;
3393 height = 22;
3394 aiStyle = 6;
3395 netAlways = true;
3396 damage = 16;
3397 defense = 18;
3398 lifeMax = 300;
3401 noGravity = true;
3402 noTileCollide = true;
3403 knockBackResist = 0f;
3404 behindTiles = true;
3405 value = 1200f;
3406 dontCountMe = true;
3407 if (Main.getGoodWorld)
3408 {
3409 lifeMax += 100;
3410 defense += 2;
3411 damage += 4;
3412 scale = 1.1f;
3413 if (Main.remixWorld)
3414 {
3415 lifeMax += 50;
3416 scale *= 1.2f;
3417 defense += 4;
3418 }
3419 }
3420 }
3421 else if (type == 42)
3422 {
3423 width = 34;
3424 height = 32;
3425 aiStyle = 5;
3426 damage = 26;
3427 defense = 12;
3428 lifeMax = 48;
3430 knockBackResist = 0.5f;
3432 value = 200f;
3433 noGravity = true;
3434 }
3435 else if (type == 43)
3436 {
3437 noGravity = true;
3438 noTileCollide = true;
3439 width = 30;
3440 height = 30;
3441 aiStyle = 13;
3442 damage = 34;
3443 defense = 10;
3444 lifeMax = 110;
3446 knockBackResist = 0f;
3448 value = 350f;
3449 }
3450 else if (type == 44)
3451 {
3452 width = 18;
3453 height = 40;
3454 aiStyle = 3;
3455 damage = 22;
3456 defense = 9;
3457 lifeMax = 70;
3460 knockBackResist = 0.5f;
3461 value = 250f;
3462 rarity = 1;
3463 }
3464 else if (type == 45)
3465 {
3466 width = 18;
3467 height = 40;
3468 aiStyle = 8;
3469 damage = 20;
3470 defense = 4;
3471 lifeMax = 200;
3474 knockBackResist = 0.6f;
3475 value = 5000f;
3476 rarity = 4;
3477 }
3478 else if (type == 46 || type == 303 || type == 337 || type == 540)
3479 {
3480 width = 18;
3481 height = 20;
3482 aiStyle = 7;
3483 damage = 0;
3484 defense = 0;
3485 lifeMax = 5;
3488 catchItem = 2019;
3489 }
3490 else if (type == 47)
3491 {
3492 width = 18;
3493 height = 20;
3494 aiStyle = 3;
3495 damage = 20;
3496 defense = 4;
3497 lifeMax = 70;
3500 value = 500f;
3501 }
3502 else if (type == 48)
3503 {
3504 width = 24;
3505 height = 34;
3506 aiStyle = 14;
3507 damage = 25;
3508 defense = 8;
3509 lifeMax = 100;
3511 knockBackResist = 0.6f;
3513 value = 300f;
3514 }
3515 else if (type == 49)
3516 {
3517 npcSlots = 0.5f;
3518 width = 22;
3519 height = 18;
3520 aiStyle = 14;
3521 damage = 13;
3522 defense = 2;
3523 lifeMax = 16;
3525 knockBackResist = 0.8f;
3527 value = 90f;
3528 }
3529 else if (type == 50)
3530 {
3531 boss = true;
3532 width = 98;
3533 height = 92;
3534 aiStyle = 15;
3535 damage = 40;
3536 defense = 10;
3537 lifeMax = 2000;
3538 knockBackResist = 0f;
3541 alpha = 30;
3542 value = 10000f;
3543 scale = 1.25f;
3545 npcSlots = 5f;
3546 }
3547 else if (type == 51)
3548 {
3549 npcSlots = 0.5f;
3550 width = 22;
3551 height = 18;
3552 aiStyle = 14;
3553 damage = 20;
3554 defense = 4;
3555 lifeMax = 34;
3557 knockBackResist = 0.8f;
3559 value = 80f;
3560 }
3561 else if (type == 52)
3562 {
3563 width = 18;
3564 height = 40;
3565 aiStyle = 3;
3566 damage = 20;
3567 defense = 10;
3568 lifeMax = 500;
3571 knockBackResist = 0.5f;
3572 value = 1000f;
3573 rarity = 2;
3574 }
3575 else if (type == 53)
3576 {
3577 width = 18;
3578 height = 40;
3579 aiStyle = 3;
3580 damage = 14;
3581 defense = 8;
3582 lifeMax = 200;
3585 knockBackResist = 0.5f;
3586 value = 1000f;
3587 rarity = 2;
3588 }
3589 else if (type == 54)
3590 {
3591 townNPC = true;
3592 friendly = true;
3593 width = 18;
3594 height = 40;
3595 aiStyle = 7;
3596 damage = 10;
3597 defense = 15;
3598 lifeMax = 250;
3601 knockBackResist = 0.5f;
3602 }
3603 else if (type == 55)
3604 {
3605 noGravity = true;
3606 width = 20;
3607 height = 18;
3608 aiStyle = 16;
3609 damage = 0;
3610 defense = 0;
3611 lifeMax = 5;
3614 knockBackResist = 0.5f;
3615 catchItem = 261;
3616 }
3617 else if (type == 56)
3618 {
3619 noTileCollide = true;
3620 noGravity = true;
3621 width = 30;
3622 height = 30;
3623 aiStyle = 13;
3624 damage = 25;
3625 defense = 10;
3626 lifeMax = 60;
3628 knockBackResist = 0f;
3630 value = 90f;
3631 }
3632 else if (type == 57)
3633 {
3634 noGravity = true;
3635 width = 18;
3636 height = 20;
3637 aiStyle = 16;
3638 damage = 30;
3639 defense = 6;
3640 lifeMax = 100;
3643 value = 500f;
3644 }
3645 else if (type == 58)
3646 {
3647 npcSlots = 0.5f;
3648 noGravity = true;
3649 width = 18;
3650 height = 20;
3651 aiStyle = 16;
3652 damage = 25;
3653 defense = 2;
3654 lifeMax = 30;
3657 value = 50f;
3658 }
3659 else if (type == 59)
3660 {
3661 width = 24;
3662 height = 18;
3663 aiStyle = 1;
3664 damage = 15;
3665 defense = 10;
3666 lifeMax = 50;
3669 scale = 1.1f;
3670 alpha = 50;
3671 lavaImmune = true;
3672 value = 120f;
3673 if (Main.remixWorld)
3674 {
3675 damage = 7;
3676 defense = 2;
3677 lifeMax = 25;
3678 value = 25f;
3679 }
3680 }
3681 else if (type == 60)
3682 {
3683 npcSlots = 0.5f;
3684 width = 22;
3685 height = 18;
3686 aiStyle = 14;
3687 damage = 35;
3688 defense = 8;
3689 lifeMax = 46;
3691 knockBackResist = 0.8f;
3693 value = 120f;
3694 scale = 1.1f;
3695 lavaImmune = true;
3696 }
3697 else if (type == 61)
3698 {
3699 width = 36;
3700 height = 36;
3701 aiStyle = 17;
3702 damage = 15;
3703 defense = 4;
3704 lifeMax = 40;
3705 knockBackResist = 0.8f;
3708 value = 60f;
3709 }
3710 else if (type == 62)
3711 {
3712 npcSlots = 2f;
3713 width = 28;
3714 height = 48;
3715 aiStyle = 14;
3716 damage = 32;
3717 defense = 8;
3718 lifeMax = 120;
3720 knockBackResist = 0.8f;
3722 value = 300f;
3723 lavaImmune = true;
3724 }
3725 else if (type == 63)
3726 {
3727 noGravity = true;
3728 width = 26;
3729 height = 26;
3730 aiStyle = 18;
3731 damage = 25;
3732 defense = 4;
3733 lifeMax = 34;
3736 value = 100f;
3737 alpha = 20;
3738 }
3739 else if (type == 64)
3740 {
3741 noGravity = true;
3742 width = 26;
3743 height = 26;
3744 aiStyle = 18;
3745 damage = 30;
3746 defense = 6;
3747 lifeMax = 70;
3750 value = 100f;
3751 alpha = 20;
3752 }
3753 else if (type == 65)
3754 {
3755 noGravity = true;
3756 width = 100;
3757 height = 24;
3758 aiStyle = 16;
3759 damage = 40;
3760 defense = 2;
3761 lifeMax = 300;
3764 value = 400f;
3765 knockBackResist = 0.7f;
3766 }
3767 else if (type == 66)
3768 {
3769 npcSlots = 2f;
3770 width = 28;
3771 height = 48;
3772 aiStyle = 14;
3773 damage = 32;
3774 defense = 8;
3775 lifeMax = 140;
3777 knockBackResist = 0.8f;
3779 value = 1000f;
3780 lavaImmune = true;
3781 rarity = 1;
3782 }
3783 else if (type == 67)
3784 {
3785 width = 28;
3786 height = 20;
3787 aiStyle = 3;
3788 damage = 20;
3789 defense = 10;
3790 lifeMax = 40;
3793 value = 60f;
3794 }
3795 else if (type == 68)
3796 {
3797 width = 80;
3798 height = 102;
3799 aiStyle = 11;
3800 damage = 1000;
3801 defense = 9999;
3802 lifeMax = 9999;
3805 noGravity = true;
3806 noTileCollide = true;
3807 knockBackResist = 0f;
3808 }
3809 else if (type == 69)
3810 {
3811 width = 24;
3812 height = 24;
3813 aiStyle = 19;
3814 damage = 10;
3815 defense = 6;
3816 lifeMax = 45;
3819 knockBackResist = 0f;
3820 value = 60f;
3821 behindTiles = true;
3822 }
3823 else if (type == 70)
3824 {
3825 npcSlots = 0.3f;
3826 width = 34;
3827 height = 34;
3828 aiStyle = 20;
3829 damage = 32;
3830 defense = 100;
3831 lifeMax = 100;
3834 knockBackResist = 0f;
3835 noGravity = true;
3836 noTileCollide = true;
3837 dontTakeDamage = true;
3838 scale = 1.5f;
3839 }
3840 else if (type == 71)
3841 {
3842 npcSlots = 2f;
3843 width = 36;
3844 height = 24;
3845 aiStyle = 1;
3846 damage = 30;
3847 defense = 7;
3848 lifeMax = 150;
3851 alpha = 60;
3852 value = 150f;
3853 scale = 1.25f;
3854 knockBackResist = 0.6f;
3855 rarity = 1;
3856 }
3857 else if (type == 72)
3858 {
3859 npcSlots = 0.3f;
3860 width = 34;
3861 height = 34;
3862 aiStyle = 21;
3863 damage = 24;
3864 defense = 100;
3865 lifeMax = 100;
3866 alpha = 100;
3867 behindTiles = true;
3870 knockBackResist = 0f;
3871 noGravity = true;
3872 dontTakeDamage = true;
3873 scale = 1.2f;
3874 }
3875 else if (type == 73)
3876 {
3877 scale = 0.95f;
3878 width = 18;
3879 height = 40;
3880 aiStyle = 3;
3881 damage = 20;
3882 defense = 6;
3883 lifeMax = 80;
3886 knockBackResist = 0.7f;
3887 value = 200f;
3888 rarity = 1;
3889 }
3890 else if (type == 74 || type == 297 || type == 298)
3891 {
3892 width = 14;
3893 height = 14;
3894 aiStyle = 24;
3895 damage = 0;
3896 defense = 0;
3897 lifeMax = 5;
3899 knockBackResist = 0.8f;
3901 if (type == 74)
3902 {
3903 catchItem = 2015;
3904 }
3905 if (type == 297)
3906 {
3907 catchItem = 2016;
3908 }
3909 if (type == 298)
3910 {
3911 catchItem = 2017;
3912 }
3913 npcSlots = 0.4f;
3914 }
3915 else if (type == 75)
3916 {
3917 noGravity = true;
3918 width = 20;
3919 height = 20;
3920 aiStyle = 22;
3921 damage = 55;
3922 defense = 20;
3923 lifeMax = 150;
3925 knockBackResist = 0.6f;
3927 value = 350f;
3928 }
3929 else if (type == 77)
3930 {
3931 width = 18;
3932 height = 40;
3933 aiStyle = 3;
3934 damage = 40;
3935 defense = 28;
3936 lifeMax = 260;
3939 knockBackResist = 0.4f;
3940 value = 400f;
3941 }
3942 else if (type == 78)
3943 {
3944 width = 18;
3945 height = 40;
3946 aiStyle = 3;
3947 damage = 50;
3948 defense = 16;
3949 lifeMax = 130;
3952 knockBackResist = 0.6f;
3953 value = 600f;
3954 }
3955 else if (type == 79)
3956 {
3957 width = 18;
3958 height = 40;
3959 aiStyle = 3;
3960 damage = 60;
3961 defense = 18;
3962 lifeMax = 180;
3965 knockBackResist = 0.5f;
3966 value = 700f;
3967 }
3968 else if (type == 80)
3969 {
3970 width = 18;
3971 height = 40;
3972 aiStyle = 3;
3973 damage = 55;
3974 defense = 18;
3975 lifeMax = 200;
3978 knockBackResist = 0.55f;
3979 value = 700f;
3980 }
3981 else if (type == 81)
3982 {
3983 width = 40;
3984 height = 30;
3985 aiStyle = 1;
3986 damage = 55;
3987 defense = 20;
3988 lifeMax = 170;
3991 alpha = 55;
3992 value = 400f;
3993 scale = 1.1f;
3994 }
3995 else if (type == 82)
3996 {
3997 noGravity = true;
3998 noTileCollide = true;
3999 width = 24;
4000 height = 44;
4001 aiStyle = 22;
4002 damage = 65;
4003 defense = 16;
4004 lifeMax = 160;
4007 alpha = 100;
4008 value = 500f;
4009 knockBackResist = 0.7f;
4010 if (Main.remixWorld)
4011 {
4012 scale *= 1.2f;
4013 damage = (int)((float)damage * scale);
4014 defense = (int)((float)defense * scale);
4015 lifeMax = (int)((float)lifeMax * scale);
4016 value = (int)(value * scale);
4017 }
4018 }
4019 else if (type == 83)
4020 {
4021 width = 40;
4022 height = 40;
4023 aiStyle = 23;
4024 damage = 80;
4025 defense = 18;
4026 lifeMax = 200;
4029 value = 1000f;
4030 knockBackResist = 0.4f;
4031 }
4032 else if (type == 84)
4033 {
4034 width = 40;
4035 height = 40;
4036 aiStyle = 23;
4037 damage = 80;
4038 defense = 18;
4039 lifeMax = 200;
4042 value = 1000f;
4043 knockBackResist = 0.4f;
4044 }
4045 else if (type == 85)
4046 {
4047 width = 24;
4048 height = 24;
4049 aiStyle = 25;
4050 damage = 80;
4051 defense = 30;
4052 lifeMax = 500;
4055 value = 100000f;
4056 knockBackResist = 0.3f;
4057 rarity = 4;
4058 if (Main.remixWorld && !Main.hardMode)
4059 {
4060 damage = 30;
4061 defense = 12;
4062 lifeMax = 300;
4063 value = Item.buyPrice(0, 2);
4064 }
4065 }
4066 else if (type == 86)
4067 {
4068 width = 46;
4069 height = 42;
4070 aiStyle = 26;
4071 damage = 65;
4072 defense = 30;
4073 lifeMax = 400;
4076 knockBackResist = 0.3f;
4077 value = 1000f;
4078 }
4079 else if (type == 87)
4080 {
4081 noTileCollide = true;
4082 npcSlots = 5f;
4083 width = 32;
4084 height = 32;
4085 aiStyle = 6;
4086 netAlways = true;
4087 damage = 80;
4088 defense = 10;
4089 lifeMax = 4000;
4092 noGravity = true;
4093 knockBackResist = 0f;
4094 value = 10000f;
4095 scale = 1f;
4096 }
4097 else if (type == 88)
4098 {
4099 noTileCollide = true;
4100 width = 32;
4101 height = 32;
4102 aiStyle = 6;
4103 netAlways = true;
4104 damage = 40;
4105 defense = 20;
4106 lifeMax = 4000;
4109 noGravity = true;
4110 knockBackResist = 0f;
4111 value = 10000f;
4112 scale = 1f;
4113 dontCountMe = true;
4114 }
4115 else if (type == 89)
4116 {
4117 noTileCollide = true;
4118 width = 32;
4119 height = 32;
4120 aiStyle = 6;
4121 netAlways = true;
4122 damage = 40;
4123 defense = 20;
4124 lifeMax = 4000;
4127 noGravity = true;
4128 knockBackResist = 0f;
4129 value = 2000f;
4130 scale = 1f;
4131 dontCountMe = true;
4132 }
4133 else if (type == 90)
4134 {
4135 noTileCollide = true;
4136 width = 32;
4137 height = 32;
4138 aiStyle = 6;
4139 netAlways = true;
4140 damage = 40;
4141 defense = 20;
4142 lifeMax = 4000;
4145 noGravity = true;
4146 knockBackResist = 0f;
4147 value = 10000f;
4148 scale = 1f;
4149 dontCountMe = true;
4150 }
4151 else if (type == 91)
4152 {
4153 noTileCollide = true;
4154 width = 32;
4155 height = 32;
4156 aiStyle = 6;
4157 netAlways = true;
4158 damage = 40;
4159 defense = 20;
4160 lifeMax = 4000;
4163 noGravity = true;
4164 knockBackResist = 0f;
4165 value = 10000f;
4166 scale = 1f;
4167 dontCountMe = true;
4168 }
4169 else if (type == 92)
4170 {
4171 noTileCollide = true;
4172 width = 32;
4173 height = 32;
4174 aiStyle = 6;
4175 netAlways = true;
4176 damage = 40;
4177 defense = 20;
4178 lifeMax = 4000;
4181 noGravity = true;
4182 knockBackResist = 0f;
4183 value = 10000f;
4184 scale = 1f;
4185 dontCountMe = true;
4186 }
4187 else if (type == 93)
4188 {
4189 npcSlots = 0.5f;
4190 width = 26;
4191 height = 20;
4192 aiStyle = 14;
4193 damage = 45;
4194 defense = 16;
4195 lifeMax = 100;
4197 knockBackResist = 0.75f;
4199 value = 400f;
4200 }
4201 else if (type == 94)
4202 {
4203 npcSlots = 1f;
4204 width = 44;
4205 height = 44;
4206 aiStyle = 5;
4207 damage = 60;
4208 defense = 32;
4209 lifeMax = 230;
4212 noGravity = true;
4213 knockBackResist = 0.55f;
4214 value = 500f;
4215 }
4216 else if (type == 95)
4217 {
4218 width = 22;
4219 height = 22;
4220 aiStyle = 6;
4221 netAlways = true;
4222 damage = 45;
4223 defense = 10;
4224 lifeMax = 200;
4227 noGravity = true;
4228 noTileCollide = true;
4229 knockBackResist = 0f;
4230 behindTiles = true;
4231 scale = 0.9f;
4232 value = 300f;
4233 }
4234 else if (type == 96)
4235 {
4236 width = 22;
4237 height = 22;
4238 aiStyle = 6;
4239 netAlways = true;
4240 damage = 28;
4241 defense = 20;
4242 lifeMax = 200;
4245 noGravity = true;
4246 noTileCollide = true;
4247 knockBackResist = 0f;
4248 behindTiles = true;
4249 scale = 0.9f;
4250 value = 300f;
4251 dontCountMe = true;
4252 }
4253 else if (type == 97)
4254 {
4255 width = 22;
4256 height = 22;
4257 aiStyle = 6;
4258 netAlways = true;
4259 damage = 26;
4260 defense = 30;
4261 lifeMax = 200;
4264 noGravity = true;
4265 noTileCollide = true;
4266 knockBackResist = 0f;
4267 behindTiles = true;
4268 scale = 0.9f;
4269 value = 300f;
4270 dontCountMe = true;
4271 }
4272 else if (type == 98)
4273 {
4274 npcSlots = 3.5f;
4275 width = 22;
4276 height = 22;
4277 aiStyle = 6;
4278 netAlways = true;
4279 damage = 70;
4280 defense = 36;
4281 lifeMax = 500;
4284 noGravity = true;
4285 noTileCollide = true;
4286 knockBackResist = 0f;
4287 behindTiles = true;
4288 value = 700f;
4289 }
4290 else if (type == 99)
4291 {
4292 width = 22;
4293 height = 22;
4294 aiStyle = 6;
4295 netAlways = true;
4296 damage = 55;
4297 defense = 40;
4298 lifeMax = 500;
4301 noGravity = true;
4302 noTileCollide = true;
4303 knockBackResist = 0f;
4304 behindTiles = true;
4305 value = 700f;
4306 dontCountMe = true;
4307 }
4308 else if (type == 100)
4309 {
4310 width = 22;
4311 height = 22;
4312 aiStyle = 6;
4313 netAlways = true;
4314 damage = 40;
4315 defense = 44;
4316 lifeMax = 500;
4319 noGravity = true;
4320 noTileCollide = true;
4321 knockBackResist = 0f;
4322 behindTiles = true;
4323 value = 700f;
4324 dontCountMe = true;
4325 }
4326 else if (type == 101)
4327 {
4328 noGravity = true;
4329 noTileCollide = true;
4330 behindTiles = true;
4331 width = 30;
4332 height = 30;
4333 aiStyle = 13;
4334 damage = 70;
4335 defense = 30;
4336 lifeMax = 320;
4338 knockBackResist = 0.2f;
4340 value = 600f;
4341 }
4342 else if (type == 102)
4343 {
4344 npcSlots = 0.5f;
4345 noGravity = true;
4346 width = 18;
4347 height = 20;
4348 aiStyle = 16;
4349 damage = 80;
4350 defense = 22;
4351 lifeMax = 90;
4354 value = 500f;
4355 }
4356 else if (type == 103)
4357 {
4358 noGravity = true;
4359 width = 26;
4360 height = 26;
4361 aiStyle = 18;
4362 damage = 80;
4363 defense = 30;
4364 lifeMax = 120;
4367 value = 800f;
4368 alpha = 20;
4369 }
4370 else if (type == 104)
4371 {
4372 width = 18;
4373 height = 40;
4374 aiStyle = 3;
4375 damage = 70;
4376 defense = 38;
4377 lifeMax = 350;
4380 knockBackResist = 0.4f;
4381 value = 1000f;
4382 }
4383 else if (type == 105)
4384 {
4385 friendly = true;
4386 width = 18;
4387 height = 34;
4388 aiStyle = 0;
4389 damage = 10;
4390 defense = 15;
4391 lifeMax = 250;
4394 knockBackResist = 0.5f;
4395 rarity = 1;
4396 }
4397 else if (type == 106)
4398 {
4399 friendly = true;
4400 width = 18;
4401 height = 40;
4402 aiStyle = 0;
4403 damage = 10;
4404 defense = 15;
4405 lifeMax = 250;
4408 knockBackResist = 0.5f;
4409 rarity = 1;
4410 }
4411 else if (type == 107)
4412 {
4413 townNPC = true;
4414 friendly = true;
4415 width = 18;
4416 height = 40;
4417 aiStyle = 7;
4418 damage = 10;
4419 defense = 15;
4420 lifeMax = 250;
4423 knockBackResist = 0.5f;
4424 }
4425 else if (type == 108)
4426 {
4427 townNPC = true;
4428 friendly = true;
4429 width = 18;
4430 height = 40;
4431 aiStyle = 7;
4432 damage = 10;
4433 defense = 15;
4434 lifeMax = 250;
4437 knockBackResist = 0.5f;
4438 }
4439 else if (type == 109)
4440 {
4441 width = 34;
4442 height = 78;
4443 aiStyle = 3;
4444 damage = 60;
4445 defense = 25;
4446 lifeMax = 800;
4449 knockBackResist = 0.2f;
4450 value = 10000f;
4451 rarity = 1;
4452 }
4453 else if (type == 110)
4454 {
4455 width = 18;
4456 height = 40;
4457 aiStyle = 3;
4458 damage = 45;
4459 defense = 14;
4460 lifeMax = 210;
4463 knockBackResist = 0.55f;
4464 value = 400f;
4465 }
4466 else if (type == 112)
4467 {
4468 width = 16;
4469 height = 16;
4470 aiStyle = 9;
4471 damage = 65;
4472 defense = 0;
4473 lifeMax = 1;
4474 HitSound = null;
4476 noGravity = true;
4477 noTileCollide = true;
4478 knockBackResist = 0f;
4479 scale = 0.9f;
4480 alpha = 80;
4481 }
4482 else if (type == 113)
4483 {
4484 npcSlots = 10f;
4485 width = 100;
4486 height = 100;
4487 aiStyle = 27;
4488 damage = 50;
4489 defense = 12;
4490 lifeMax = 8000;
4493 noGravity = true;
4494 noTileCollide = true;
4495 behindTiles = true;
4496 knockBackResist = 0f;
4497 scale = 1.2f;
4498 boss = true;
4499 value = 80000f;
4500 }
4501 else if (type == 114)
4502 {
4503 width = 100;
4504 height = 100;
4505 aiStyle = 28;
4506 damage = 50;
4507 defense = 0;
4508 lifeMax = 8000;
4511 noGravity = true;
4512 noTileCollide = true;
4513 behindTiles = true;
4514 knockBackResist = 0f;
4515 scale = 1.2f;
4516 value = 80000f;
4517 }
4518 else if (type == 115)
4519 {
4520 width = 30;
4521 height = 30;
4522 aiStyle = 29;
4523 damage = 30;
4524 defense = 10;
4525 lifeMax = 240;
4528 noGravity = true;
4529 behindTiles = true;
4530 noTileCollide = true;
4531 knockBackResist = 1.1f;
4532 }
4533 else if (type == 116)
4534 {
4535 width = 30;
4536 height = 32;
4537 aiStyle = 2;
4538 damage = 30;
4539 defense = 6;
4540 lifeMax = 80;
4542 knockBackResist = 0.8f;
4544 }
4545 else if (type == 117)
4546 {
4547 width = 14;
4548 height = 14;
4549 aiStyle = 6;
4550 netAlways = true;
4551 damage = 26;
4552 defense = 2;
4553 lifeMax = 60;
4556 noGravity = true;
4557 noTileCollide = true;
4558 knockBackResist = 0f;
4559 behindTiles = true;
4560 }
4561 else if (type == 118)
4562 {
4563 width = 14;
4564 height = 14;
4565 aiStyle = 6;
4566 netAlways = true;
4567 damage = 22;
4568 defense = 6;
4569 lifeMax = 60;
4570 if (Main.getGoodWorld)
4571 {
4572 damage += 10;
4573 defense += 14;
4574 lifeMax *= 3;
4575 }
4578 noGravity = true;
4579 noTileCollide = true;
4580 knockBackResist = 0f;
4581 behindTiles = true;
4582 }
4583 else if (type == 119)
4584 {
4585 width = 14;
4586 height = 14;
4587 aiStyle = 6;
4588 netAlways = true;
4589 damage = 18;
4590 defense = 10;
4591 lifeMax = 60;
4594 noGravity = true;
4595 noTileCollide = true;
4596 knockBackResist = 0f;
4597 behindTiles = true;
4598 }
4599 else if (type == 120)
4600 {
4601 width = 18;
4602 height = 40;
4603 aiStyle = 3;
4604 damage = 40;
4605 defense = 30;
4606 lifeMax = 370;
4609 knockBackResist = 0.4f;
4610 value = 600f;
4611 }
4612 else if (type == 121)
4613 {
4614 width = 40;
4615 height = 30;
4616 aiStyle = 14;
4617 damage = 45;
4618 defense = 20;
4619 lifeMax = 60;
4621 alpha = 55;
4622 knockBackResist = 0.8f;
4623 scale = 1.1f;
4624 }
4625 else if (type == 122)
4626 {
4627 noGravity = true;
4628 width = 20;
4629 height = 20;
4630 aiStyle = 22;
4631 damage = 60;
4632 defense = 22;
4633 lifeMax = 220;
4635 knockBackResist = 0.8f;
4637 value = 600f;
4638 }
4639 else if (type == 123)
4640 {
4641 friendly = true;
4642 width = 18;
4643 height = 34;
4644 aiStyle = 0;
4645 damage = 10;
4646 defense = 15;
4647 lifeMax = 250;
4650 knockBackResist = 0.5f;
4651 scale = 0.9f;
4652 rarity = 1;
4653 }
4654 else if (type == 124)
4655 {
4656 townNPC = true;
4657 friendly = true;
4658 width = 18;
4659 height = 40;
4660 aiStyle = 7;
4661 damage = 10;
4662 defense = 15;
4663 lifeMax = 250;
4666 knockBackResist = 0.5f;
4667 }
4668 else if (type == 125)
4669 {
4670 width = 100;
4671 height = 110;
4672 aiStyle = 30;
4673 defense = 10;
4674 damage = 45;
4675 lifeMax = 20000;
4678 knockBackResist = 0f;
4679 noGravity = true;
4680 noTileCollide = true;
4682 boss = true;
4683 value = 120000f;
4684 npcSlots = 5f;
4685 }
4686 else if (type == 126)
4687 {
4688 width = 100;
4689 height = 110;
4690 aiStyle = 31;
4691 defense = 10;
4692 damage = 50;
4693 lifeMax = 23000;
4696 knockBackResist = 0f;
4697 noGravity = true;
4698 noTileCollide = true;
4700 boss = true;
4701 value = 120000f;
4702 npcSlots = 5f;
4703 }
4704 else if (type == 127)
4705 {
4706 width = 80;
4707 height = 102;
4708 aiStyle = 32;
4709 damage = 47;
4710 defense = 24;
4711 lifeMax = 28000;
4714 noGravity = true;
4715 noTileCollide = true;
4716 value = 120000f;
4717 knockBackResist = 0f;
4718 boss = true;
4719 npcSlots = 6f;
4720 }
4721 else if (type == 128)
4722 {
4723 width = 52;
4724 height = 52;
4725 aiStyle = 35;
4726 damage = 30;
4727 defense = 23;
4728 lifeMax = 7000;
4731 noGravity = true;
4732 noTileCollide = true;
4733 knockBackResist = 0f;
4734 netAlways = true;
4735 }
4736 else if (type == 129)
4737 {
4738 width = 52;
4739 height = 52;
4740 aiStyle = 33;
4741 damage = 56;
4742 defense = 38;
4743 lifeMax = 9000;
4746 noGravity = true;
4747 noTileCollide = true;
4748 knockBackResist = 0f;
4749 netAlways = true;
4750 }
4751 else if (type == 130)
4752 {
4753 width = 52;
4754 height = 52;
4755 aiStyle = 34;
4756 damage = 52;
4757 defense = 34;
4758 lifeMax = 9000;
4761 noGravity = true;
4762 noTileCollide = true;
4763 knockBackResist = 0f;
4764 netAlways = true;
4765 }
4766 else if (type == 131)
4767 {
4768 width = 52;
4769 height = 52;
4770 aiStyle = 36;
4771 damage = 29;
4772 defense = 20;
4773 lifeMax = 6000;
4776 noGravity = true;
4777 noTileCollide = true;
4778 knockBackResist = 0f;
4779 netAlways = true;
4780 }
4781 else if (type == 132)
4782 {
4783 width = 18;
4784 height = 40;
4785 aiStyle = 3;
4786 damage = 15;
4787 defense = 5;
4788 lifeMax = 40;
4791 knockBackResist = 0.5f;
4792 value = 65f;
4793 }
4794 else if (type == 133)
4795 {
4796 width = 30;
4797 height = 32;
4798 aiStyle = 2;
4799 damage = 40;
4800 defense = 20;
4801 lifeMax = 300;
4803 knockBackResist = 0.8f;
4805 value = 500f;
4806 }
4807 else if (type == 134)
4808 {
4809 npcSlots = 5f;
4810 width = 38;
4811 height = 38;
4812 aiStyle = 37;
4813 defense = 0;
4814 damage = 70;
4815 lifeMax = 80000;
4818 noGravity = true;
4819 noTileCollide = true;
4820 knockBackResist = 0f;
4821 behindTiles = true;
4822 value = 120000f;
4823 scale = 1.25f;
4824 boss = true;
4825 netAlways = true;
4826 alpha = 255;
4827 }
4828 else if (type == 135)
4829 {
4830 npcSlots = 5f;
4831 width = 38;
4832 height = 38;
4833 aiStyle = 37;
4834 damage = 55;
4835 defense = 30;
4836 lifeMax = 80000;
4839 noGravity = true;
4840 noTileCollide = true;
4841 knockBackResist = 0f;
4842 behindTiles = true;
4843 netAlways = true;
4844 scale = 1.25f;
4845 dontCountMe = true;
4846 alpha = 255;
4847 }
4848 else if (type == 136)
4849 {
4850 npcSlots = 5f;
4851 width = 38;
4852 height = 38;
4853 aiStyle = 37;
4854 damage = 40;
4855 defense = 35;
4856 lifeMax = 80000;
4859 noGravity = true;
4860 noTileCollide = true;
4861 knockBackResist = 0f;
4862 behindTiles = true;
4863 scale = 1.25f;
4864 netAlways = true;
4865 dontCountMe = true;
4866 alpha = 255;
4867 }
4868 else if (type == 139)
4869 {
4870 npcSlots = 1f;
4871 width = 30;
4872 height = 30;
4873 aiStyle = 5;
4874 damage = 50;
4875 defense = 20;
4876 lifeMax = 200;
4879 noGravity = true;
4880 knockBackResist = 0.8f;
4881 noTileCollide = true;
4882 }
4883 else if (type == 137)
4884 {
4885 width = 26;
4886 height = 20;
4887 aiStyle = 14;
4888 damage = 75;
4889 defense = 30;
4890 lifeMax = 200;
4892 knockBackResist = 0.75f;
4894 value = 500f;
4895 }
4896 else if (type == 138)
4897 {
4898 width = 24;
4899 height = 18;
4900 aiStyle = 1;
4901 damage = 70;
4902 defense = 30;
4903 lifeMax = 180;
4906 alpha = 100;
4907 value = 400f;
4908 knockBackResist = 0.85f;
4909 scale = 1.05f;
4910 }
4911 else if (type == 140)
4912 {
4913 width = 18;
4914 height = 40;
4915 aiStyle = 3;
4916 damage = 55;
4917 defense = 28;
4918 lifeMax = 260;
4921 knockBackResist = 0.4f;
4922 value = 400f;
4923 }
4924 else if (type == 141)
4925 {
4926 width = 34;
4927 height = 28;
4928 aiStyle = 1;
4929 damage = 50;
4930 defense = 18;
4931 lifeMax = 150;
4934 alpha = 55;
4935 value = 400f;
4936 scale = 1.1f;
4937 knockBackResist = 0.8f;
4938 }
4939 else if (type == 142)
4940 {
4941 townNPC = true;
4942 friendly = true;
4943 width = 18;
4944 height = 40;
4945 aiStyle = 7;
4946 damage = 10;
4947 defense = 15;
4948 lifeMax = 250;
4951 knockBackResist = 0.5f;
4952 }
4953 else if (type == 143)
4954 {
4955 width = 26;
4956 height = 40;
4957 aiStyle = 38;
4958 damage = 50;
4959 defense = 20;
4960 lifeMax = 200;
4963 knockBackResist = 0.6f;
4964 value = 400f;
4965 coldDamage = true;
4966 }
4967 else if (type == 144)
4968 {
4969 width = 26;
4970 height = 40;
4971 aiStyle = 38;
4972 damage = 65;
4973 defense = 26;
4974 lifeMax = 240;
4977 knockBackResist = 0.6f;
4978 value = 400f;
4979 coldDamage = true;
4980 }
4981 else if (type == 145)
4982 {
4983 width = 26;
4984 height = 40;
4985 aiStyle = 38;
4986 damage = 55;
4987 defense = 22;
4988 lifeMax = 220;
4991 knockBackResist = 0.6f;
4992 value = 400f;
4993 coldDamage = true;
4994 }
4995 else if (type == 147)
4996 {
4997 width = 24;
4998 height = 18;
4999 aiStyle = 1;
5000 damage = 8;
5001 defense = 4;
5002 lifeMax = 30;
5005 alpha = 50;
5006 value = 50f;
5007 coldDamage = true;
5008 }
5009 else if (type == 148)
5010 {
5011 width = 16;
5012 height = 34;
5013 aiStyle = 7;
5014 damage = 0;
5015 defense = 0;
5016 lifeMax = 5;
5019 catchItem = 2205;
5020 }
5021 else if (type == 149)
5022 {
5023 width = 16;
5024 height = 34;
5025 aiStyle = 7;
5026 damage = 0;
5027 defense = 0;
5028 lifeMax = 5;
5031 catchItem = 2205;
5032 }
5033 else if (type == 150)
5034 {
5035 npcSlots = 0.5f;
5036 width = 22;
5037 height = 22;
5038 aiStyle = 14;
5039 damage = 18;
5040 defense = 6;
5041 lifeMax = 30;
5043 knockBackResist = 0.8f;
5045 value = 250f;
5046 coldDamage = true;
5047 }
5048 else if (type == 151)
5049 {
5050 npcSlots = 0.5f;
5051 width = 22;
5052 height = 22;
5053 aiStyle = 14;
5054 damage = 50;
5055 defense = 16;
5056 lifeMax = 160;
5058 knockBackResist = 0.6f;
5060 value = 400f;
5061 scale = 1.15f;
5062 lavaImmune = true;
5063 }
5064 else if (type == 152)
5065 {
5066 npcSlots = 0.5f;
5067 width = 38;
5068 height = 34;
5069 aiStyle = 14;
5070 damage = 80;
5071 defense = 24;
5072 lifeMax = 220;
5074 knockBackResist = 0.65f;
5076 value = 400f;
5077 }
5078 else if (type == 153)
5079 {
5080 npcSlots = 2f;
5081 width = 46;
5082 height = 32;
5083 aiStyle = 39;
5084 damage = 80;
5085 defense = 30;
5086 lifeMax = 470;
5088 knockBackResist = 0.3f;
5090 value = 500f;
5091 noGravity = false;
5092 }
5093 else if (type == 154)
5094 {
5095 npcSlots = 1.5f;
5096 width = 46;
5097 height = 32;
5098 aiStyle = 39;
5099 damage = 55;
5100 defense = 28;
5101 lifeMax = 400;
5103 knockBackResist = 0.3f;
5105 value = 450f;
5106 noGravity = false;
5107 coldDamage = true;
5108 }
5109 else if (type == 155)
5110 {
5111 width = 46;
5112 height = 30;
5113 aiStyle = 26;
5114 damage = 65;
5115 defense = 30;
5116 lifeMax = 300;
5119 knockBackResist = 0.3f;
5120 value = 1000f;
5121 }
5122 else if (type == 156)
5123 {
5124 npcSlots = 2f;
5125 width = 28;
5126 height = 48;
5127 aiStyle = 14;
5128 damage = 50;
5129 defense = 40;
5130 lifeMax = 600;
5132 knockBackResist = 0.5f;
5134 value = 1200f;
5135 lavaImmune = true;
5136 }
5137 else if (type == 157)
5138 {
5139 npcSlots = 0.5f;
5140 noGravity = true;
5141 width = 74;
5142 height = 20;
5143 aiStyle = 16;
5144 damage = 75;
5145 defense = 30;
5146 lifeMax = 200;
5149 value = 500f;
5150 }
5151 else if (type == 160)
5152 {
5153 townNPC = true;
5154 friendly = true;
5155 width = 18;
5156 height = 40;
5157 aiStyle = 7;
5158 damage = 10;
5159 defense = 15;
5160 lifeMax = 250;
5163 knockBackResist = 0.5f;
5164 }
5165 else if (type == 161)
5166 {
5167 width = 18;
5168 height = 40;
5169 aiStyle = 3;
5170 damage = 16;
5171 defense = 8;
5172 lifeMax = 50;
5175 knockBackResist = 0.45f;
5176 value = 80f;
5177 }
5178 else if (type == 163)
5179 {
5180 width = 50;
5181 height = 20;
5182 aiStyle = 3;
5183 damage = 90;
5184 defense = 40;
5185 lifeMax = 350;
5188 knockBackResist = 0.25f;
5189 value = 500f;
5190 npcSlots = 0.5f;
5192 }
5193 else if (type == 238)
5194 {
5195 noGravity = true;
5196 width = 36;
5197 height = 36;
5198 aiStyle = 40;
5199 damage = 100;
5200 defense = 40;
5201 lifeMax = 350;
5204 knockBackResist = 0.25f;
5205 value = 500f;
5207 npcSlots = 0.5f;
5208 }
5209 else if (type == 164)
5210 {
5211 width = 50;
5212 height = 20;
5213 aiStyle = 3;
5214 damage = 30;
5215 defense = 10;
5216 lifeMax = 80;
5219 knockBackResist = 0.25f;
5220 value = 100f;
5222 npcSlots = 0.5f;
5223 }
5224 else if (type == 165)
5225 {
5226 noGravity = true;
5227 width = 36;
5228 height = 36;
5229 aiStyle = 40;
5230 damage = 30;
5231 defense = 10;
5232 lifeMax = 80;
5235 knockBackResist = 0.25f;
5236 value = 100f;
5238 npcSlots = 0.5f;
5239 }
5240 else if (type == 167)
5241 {
5242 width = 18;
5243 height = 40;
5244 aiStyle = 3;
5245 damage = 24;
5246 defense = 10;
5247 lifeMax = 70;
5250 knockBackResist = 0.5f;
5251 value = 200f;
5252 }
5253 else if (type == 168)
5254 {
5255 width = 16;
5256 height = 34;
5257 aiStyle = 3;
5258 damage = 20;
5259 defense = 4;
5260 lifeMax = 70;
5263 value = 500f;
5264 }
5265 else if (type == 169)
5266 {
5267 noGravity = true;
5268 width = 18;
5269 height = 40;
5270 aiStyle = 22;
5271 damage = 55;
5272 defense = 20;
5273 lifeMax = 200;
5275 knockBackResist = 0.6f;
5277 value = 1500f;
5278 coldDamage = true;
5279 }
5280 else if (type == 170)
5281 {
5282 width = 44;
5283 height = 36;
5284 aiStyle = 2;
5285 damage = 70;
5286 defense = 16;
5287 lifeMax = 210;
5290 knockBackResist = 0.5f;
5291 value = 2000f;
5292 }
5293 else if (type == 171)
5294 {
5295 width = 44;
5296 height = 36;
5297 aiStyle = 2;
5298 damage = 70;
5299 defense = 16;
5300 lifeMax = 210;
5303 knockBackResist = 0.5f;
5304 value = 2000f;
5305 }
5306 else if (type == 172)
5307 {
5308 width = 18;
5309 height = 40;
5310 aiStyle = 8;
5311 damage = 200;
5312 defense = 30;
5313 lifeMax = 600;
5316 knockBackResist = 0.3f;
5317 value = 5000f;
5318 rarity = 4;
5319 }
5320 else if (type == 173)
5321 {
5322 npcSlots = 1f;
5323 width = 30;
5324 height = 30;
5325 aiStyle = 5;
5326 damage = 22;
5327 defense = 8;
5328 lifeMax = 40;
5331 noGravity = true;
5332 knockBackResist = 0.5f;
5333 value = 90f;
5334 if (Main.remixWorld)
5335 {
5336 scale *= 1.3f;
5337 damage = (int)((float)damage * scale);
5338 defense = (int)((float)defense * scale);
5339 lifeMax = (int)((float)lifeMax * scale);
5340 value = (int)(value * scale);
5341 }
5342 }
5343 else if (type == 174)
5344 {
5345 npcSlots = 1f;
5346 width = 52;
5347 height = 26;
5348 aiStyle = 41;
5349 damage = 65;
5350 defense = 26;
5351 lifeMax = 220;
5354 knockBackResist = 0.3f;
5355 value = 450f;
5356 }
5357 else if (type == 175)
5358 {
5359 noGravity = true;
5360 noTileCollide = true;
5361 width = 30;
5362 height = 30;
5363 aiStyle = 13;
5364 damage = 100;
5365 defense = 30;
5366 lifeMax = 300;
5368 knockBackResist = 0.25f;
5370 value = 650f;
5371 }
5372 else if (type == 176)
5373 {
5374 width = 34;
5375 height = 32;
5376 aiStyle = 5;
5377 damage = 70;
5378 defense = 22;
5379 lifeMax = 220;
5381 knockBackResist = 0.5f;
5383 value = 600f;
5384 noGravity = true;
5385 npcSlots = 1.5f;
5386 }
5387 else if (type == 177)
5388 {
5389 npcSlots = 1f;
5390 width = 58;
5391 height = 44;
5392 aiStyle = 41;
5393 damage = 80;
5394 defense = 26;
5395 lifeMax = 300;
5398 knockBackResist = 0.5f;
5399 value = 500f;
5400 }
5401 else if (type == 178)
5402 {
5403 townNPC = true;
5404 friendly = true;
5405 width = 18;
5406 height = 40;
5407 aiStyle = 7;
5408 damage = 10;
5409 defense = 15;
5410 lifeMax = 250;
5413 knockBackResist = 0.5f;
5414 }
5415 else if (type == 179)
5416 {
5417 width = 40;
5418 height = 40;
5419 aiStyle = 23;
5420 damage = 80;
5421 defense = 18;
5422 lifeMax = 200;
5425 value = 1000f;
5426 knockBackResist = 0.4f;
5427 }
5428 else if (type == 180)
5429 {
5430 width = 44;
5431 height = 36;
5432 aiStyle = 2;
5433 damage = 70;
5434 defense = 16;
5435 lifeMax = 210;
5438 knockBackResist = 0.5f;
5439 value = 2000f;
5440 }
5441 else if (type == 181)
5442 {
5443 width = 18;
5444 height = 44;
5445 aiStyle = 3;
5446 damage = 25;
5447 defense = 10;
5448 lifeMax = 70;
5451 knockBackResist = 0.4f;
5452 value = 200f;
5453 if (Main.remixWorld)
5454 {
5455 scale *= 1.1f;
5456 damage = (int)((double)((float)damage * scale) * 1.2);
5457 defense = (int)((double)((float)defense * scale) * 1.2);
5458 lifeMax = (int)((double)((float)lifeMax * scale) * 1.2);
5459 value = (int)((double)(value * scale) * 1.2);
5460 }
5461 }
5462 else if (type == 182)
5463 {
5464 noGravity = true;
5465 noTileCollide = true;
5466 width = 24;
5467 height = 62;
5468 aiStyle = 22;
5469 damage = 65;
5470 defense = 18;
5471 lifeMax = 240;
5474 alpha = 100;
5475 value = 500f;
5476 knockBackResist = 0.7f;
5477 }
5478 else if (type == 183)
5479 {
5480 width = 40;
5481 height = 30;
5482 aiStyle = 1;
5483 damage = 60;
5484 defense = 26;
5485 lifeMax = 200;
5488 alpha = 55;
5489 value = 400f;
5490 scale = 1.1f;
5491 }
5492 else if (type == 184)
5493 {
5494 width = 24;
5495 height = 18;
5496 aiStyle = 1;
5497 damage = 12;
5498 defense = 8;
5499 lifeMax = 60;
5500 scale = 1.1f;
5503 alpha = 50;
5504 value = 200f;
5505 coldDamage = true;
5506 }
5507 else if (type == 185)
5508 {
5509 width = 28;
5510 height = 28;
5511 aiStyle = 3;
5512 damage = 26;
5513 defense = 12;
5514 lifeMax = 70;
5517 knockBackResist = 1.1f;
5518 value = 200f;
5519 coldDamage = true;
5520 }
5521 else if (type == 186)
5522 {
5523 width = 18;
5524 height = 40;
5525 aiStyle = 3;
5526 damage = 16;
5527 defense = 8;
5528 lifeMax = 50;
5531 knockBackResist = 0.45f;
5532 value = 65f;
5533 }
5534 else if (type == 187)
5535 {
5536 width = 18;
5537 height = 40;
5538 aiStyle = 3;
5539 damage = 13;
5540 defense = 6;
5541 lifeMax = 40;
5544 knockBackResist = 0.55f;
5545 value = 55f;
5546 }
5547 else if (type == 188)
5548 {
5549 width = 18;
5550 height = 40;
5551 aiStyle = 3;
5552 damage = 13;
5553 defense = 8;
5554 lifeMax = 45;
5557 knockBackResist = 0.45f;
5558 value = 80f;
5559 }
5560 else if (type == 189)
5561 {
5562 width = 18;
5563 height = 40;
5564 aiStyle = 3;
5565 damage = 16;
5566 defense = 4;
5567 lifeMax = 45;
5570 knockBackResist = 0.55f;
5571 value = 70f;
5572 }
5573 else if (type == 190)
5574 {
5575 width = 30;
5576 height = 32;
5577 aiStyle = 2;
5578 damage = 18;
5579 defense = 4;
5580 lifeMax = 65;
5582 knockBackResist = 0.7f;
5584 value = 75f;
5585 }
5586 else if (type == 191)
5587 {
5588 width = 30;
5589 height = 32;
5590 aiStyle = 2;
5591 damage = 16;
5592 defense = 2;
5593 lifeMax = 60;
5595 knockBackResist = 0.85f;
5597 value = 75f;
5598 }
5599 else if (type == 192)
5600 {
5601 width = 30;
5602 height = 32;
5603 aiStyle = 2;
5604 damage = 18;
5605 defense = 2;
5606 lifeMax = 50;
5608 knockBackResist = 0.8f;
5610 value = 75f;
5611 }
5612 else if (type == 193)
5613 {
5614 width = 30;
5615 height = 32;
5616 aiStyle = 2;
5617 damage = 20;
5618 defense = 0;
5619 lifeMax = 60;
5621 knockBackResist = 0.8f;
5623 value = 75f;
5624 }
5625 else if (type == 194)
5626 {
5627 width = 30;
5628 height = 32;
5629 aiStyle = 2;
5630 damage = 14;
5631 defense = 4;
5632 lifeMax = 60;
5634 knockBackResist = 0.8f;
5636 value = 75f;
5637 }
5638 else if (type == 195)
5639 {
5640 width = 18;
5641 height = 40;
5642 aiStyle = 42;
5643 damage = 10;
5644 defense = 30;
5645 lifeMax = 250;
5648 knockBackResist = 0.5f;
5649 rarity = 2;
5650 value = Item.buyPrice(0, 2);
5651 }
5652 else if (type == 196)
5653 {
5654 width = 18;
5655 height = 40;
5656 aiStyle = 3;
5657 damage = 35;
5658 defense = 16;
5659 lifeMax = 300;
5662 knockBackResist = 0.4f;
5663 value = Item.buyPrice(0, 2);
5664 rarity = 2;
5665 }
5666 else if (type == 197)
5667 {
5668 width = 18;
5669 height = 40;
5670 aiStyle = 3;
5671 damage = 50;
5672 defense = 28;
5673 lifeMax = 280;
5676 knockBackResist = 0.45f;
5677 value = 500f;
5678 }
5679 else if (type == 198)
5680 {
5681 width = 18;
5682 height = 40;
5683 aiStyle = 3;
5684 damage = 38;
5685 defense = 20;
5686 lifeMax = 400;
5689 knockBackResist = 0.4f;
5690 value = 650f;
5691 }
5692 else if (type == 199)
5693 {
5694 width = 42;
5695 height = 30;
5696 aiStyle = 3;
5697 damage = 60;
5698 defense = 30;
5699 lifeMax = 400;
5702 knockBackResist = 0f;
5703 value = 650f;
5704 }
5705 else if (type == 200)
5706 {
5707 width = 18;
5708 height = 40;
5709 aiStyle = 3;
5710 damage = 12;
5711 defense = 4;
5712 lifeMax = 38;
5715 knockBackResist = 0.6f;
5716 value = 65f;
5717 }
5718 else if (type == 201)
5719 {
5720 width = 18;
5721 height = 40;
5722 aiStyle = 3;
5723 damage = 20;
5724 defense = 12;
5725 lifeMax = 55;
5728 knockBackResist = 0.5f;
5729 value = 130f;
5730 }
5731 else if (type == 202)
5732 {
5733 width = 18;
5734 height = 40;
5735 aiStyle = 3;
5736 damage = 18;
5737 defense = 8;
5738 lifeMax = 65;
5741 knockBackResist = 0.5f;
5742 value = 120f;
5743 }
5744 else if (type == 203)
5745 {
5746 width = 18;
5747 height = 40;
5748 aiStyle = 3;
5749 damage = 22;
5750 defense = 8;
5751 lifeMax = 60;
5754 knockBackResist = 0.5f;
5755 value = 110f;
5756 }
5757 else if (type == 204)
5758 {
5759 width = 24;
5760 height = 18;
5761 aiStyle = 1;
5762 damage = 28;
5763 defense = 8;
5764 lifeMax = 65;
5765 scale = 1.15f;
5768 alpha = 50;
5769 value = 300f;
5770 }
5771 else if (type == 205)
5772 {
5773 width = 40;
5774 height = 40;
5775 aiStyle = 5;
5776 damage = 70;
5777 defense = 28;
5778 lifeMax = 1000;
5780 knockBackResist = 0.4f;
5782 value = 600f;
5783 noGravity = true;
5784 rarity = 2;
5785 }
5786 else if (type == 206)
5787 {
5788 width = 18;
5789 height = 40;
5790 aiStyle = 3;
5791 damage = 60;
5792 defense = 30;
5793 lifeMax = 280;
5796 knockBackResist = 0.5f;
5797 value = 500f;
5798 coldDamage = true;
5799 }
5800 else if (type == 207)
5801 {
5802 townNPC = true;
5803 friendly = true;
5804 width = 18;
5805 height = 40;
5806 aiStyle = 7;
5807 damage = 10;
5808 defense = 15;
5809 lifeMax = 250;
5812 knockBackResist = 0.5f;
5813 }
5814 else if (type == 208)
5815 {
5816 townNPC = true;
5817 friendly = true;
5818 width = 18;
5819 height = 40;
5820 aiStyle = 7;
5821 damage = 10;
5822 defense = 15;
5823 lifeMax = 250;
5826 knockBackResist = 0.5f;
5827 }
5828 else if (type == 209)
5829 {
5830 townNPC = true;
5831 friendly = true;
5832 width = 18;
5833 height = 40;
5834 aiStyle = 7;
5835 damage = 10;
5836 defense = 15;
5837 lifeMax = 250;
5840 knockBackResist = 0.5f;
5841 }
5842 else if (type == 210)
5843 {
5844 width = 12;
5845 height = 12;
5846 aiStyle = 5;
5847 damage = 20;
5848 defense = 5;
5849 lifeMax = 20;
5851 knockBackResist = 0.5f;
5853 noGravity = true;
5854 }
5855 else if (type == 211)
5856 {
5857 width = 8;
5858 height = 8;
5859 aiStyle = 5;
5860 damage = 15;
5861 defense = 2;
5862 lifeMax = 10;
5864 knockBackResist = 0.5f;
5866 noGravity = true;
5867 }
5868 else if (type == 212)
5869 {
5870 width = 18;
5871 height = 40;
5872 aiStyle = 3;
5873 damage = 35;
5874 defense = 17;
5875 lifeMax = 300;
5878 knockBackResist = 0.4f;
5879 value = 700f;
5880 }
5881 else if (type == 213)
5882 {
5883 width = 18;
5884 height = 40;
5885 aiStyle = 3;
5886 damage = 50;
5887 defense = 22;
5888 lifeMax = 450;
5891 knockBackResist = 0.2f;
5892 value = 1000f;
5893 }
5894 else if (type == 214)
5895 {
5896 width = 18;
5897 height = 40;
5898 aiStyle = 3;
5899 damage = 30;
5900 defense = 14;
5901 lifeMax = 225;
5904 knockBackResist = 0.3f;
5905 value = 1000f;
5906 }
5907 else if (type == 215)
5908 {
5909 width = 18;
5910 height = 40;
5911 aiStyle = 3;
5912 damage = 35;
5913 defense = 20;
5914 lifeMax = 350;
5917 knockBackResist = 0.35f;
5918 value = 1500f;
5919 }
5920 else if (type == 216)
5921 {
5922 width = 18;
5923 height = 40;
5924 aiStyle = 3;
5925 damage = 70;
5926 defense = 30;
5927 lifeMax = 3000;
5930 knockBackResist = 0f;
5931 value = 50000f;
5932 rarity = 1;
5933 }
5934 else if (type == 217)
5935 {
5936 width = 28;
5937 height = 20;
5938 aiStyle = 3;
5939 damage = 20;
5940 defense = 10;
5941 lifeMax = 40;
5944 value = 60f;
5945 rarity = 1;
5946 }
5947 else if (type == 218)
5948 {
5949 width = 28;
5950 height = 20;
5951 aiStyle = 3;
5952 damage = 20;
5953 defense = 10;
5954 lifeMax = 40;
5957 value = 60f;
5958 rarity = 1;
5959 }
5960 else if (type == 219)
5961 {
5962 width = 28;
5963 height = 20;
5964 aiStyle = 3;
5965 damage = 20;
5966 defense = 10;
5967 lifeMax = 40;
5970 value = 60f;
5971 rarity = 1;
5972 }
5973 else if (type == 220)
5974 {
5975 width = 28;
5976 height = 20;
5977 aiStyle = 3;
5978 damage = 20;
5979 defense = 10;
5980 lifeMax = 40;
5983 value = 60f;
5984 rarity = 2;
5985 }
5986 else if (type == 221)
5987 {
5988 noGravity = true;
5989 width = 26;
5990 height = 26;
5991 aiStyle = 18;
5992 damage = 20;
5993 defense = 2;
5994 lifeMax = 30;
5997 value = 100f;
5998 alpha = 20;
5999 rarity = 1;
6000 }
6001 else if (type == 222)
6002 {
6003 width = 66;
6004 height = 66;
6005 aiStyle = 43;
6006 damage = 30;
6007 defense = 8;
6008 lifeMax = 3400;
6011 knockBackResist = 0f;
6012 noGravity = true;
6013 noTileCollide = true;
6015 boss = true;
6016 value = 50000f;
6017 npcSlots = 7f;
6018 }
6019 else if (type == 223)
6020 {
6021 width = 18;
6022 height = 40;
6023 aiStyle = 3;
6024 damage = 16;
6025 defense = 8;
6026 lifeMax = 50;
6029 knockBackResist = 0.45f;
6030 value = 70f;
6031 }
6032 else if (type == 224)
6033 {
6034 width = 32;
6035 height = 18;
6036 aiStyle = 44;
6037 damage = 9;
6038 defense = 4;
6039 lifeMax = 20;
6041 knockBackResist = 0.8f;
6043 value = 300f;
6044 }
6045 if (type == 225)
6046 {
6047 width = 38;
6048 height = 26;
6049 aiStyle = 1;
6050 damage = 10;
6051 defense = 5;
6052 lifeMax = 35;
6055 knockBackResist = 0.75f;
6056 value = 200f;
6057 }
6058 else if (type == 226)
6059 {
6060 npcSlots = 0.5f;
6061 width = 34;
6062 height = 50;
6063 aiStyle = 14;
6064 damage = 85;
6065 defense = 28;
6066 lifeMax = 260;
6068 knockBackResist = 0.65f;
6070 value = 400f;
6071 }
6072 else if (type == 227)
6073 {
6074 townNPC = true;
6075 friendly = true;
6076 width = 18;
6077 height = 40;
6078 aiStyle = 7;
6079 damage = 10;
6080 defense = 15;
6081 lifeMax = 250;
6084 knockBackResist = 0.5f;
6085 }
6086 else if (type == 228)
6087 {
6088 townNPC = true;
6089 friendly = true;
6090 width = 18;
6091 height = 40;
6092 aiStyle = 7;
6093 damage = 10;
6094 defense = 15;
6095 lifeMax = 250;
6098 knockBackResist = 0.5f;
6099 }
6100 else if (type == 229)
6101 {
6102 townNPC = true;
6103 friendly = true;
6104 width = 18;
6105 height = 40;
6106 aiStyle = 7;
6107 damage = 10;
6108 defense = 15;
6109 lifeMax = 250;
6112 knockBackResist = 0.5f;
6113 }
6114 else if (type == 230)
6115 {
6116 width = 18;
6117 height = 20;
6118 aiStyle = 7;
6119 damage = 0;
6120 defense = 0;
6121 lifeMax = 5;
6124 catchItem = 261;
6125 }
6126 else if (type == 231)
6127 {
6128 width = 34;
6129 height = 32;
6130 aiStyle = 5;
6131 damage = 22;
6132 defense = 16;
6133 lifeMax = 50;
6135 knockBackResist = 0.3f;
6137 value = 200f;
6138 noGravity = true;
6139 }
6140 else if (type == 232)
6141 {
6142 width = 34;
6143 height = 32;
6144 aiStyle = 5;
6145 damage = 28;
6146 defense = 12;
6147 lifeMax = 42;
6149 knockBackResist = 0.6f;
6151 value = 200f;
6152 noGravity = true;
6153 }
6154 else if (type == 233)
6155 {
6156 width = 34;
6157 height = 32;
6158 aiStyle = 5;
6159 damage = 30;
6160 defense = 14;
6161 lifeMax = 38;
6163 knockBackResist = 0.45f;
6165 value = 200f;
6166 noGravity = true;
6167 }
6168 else if (type == 234)
6169 {
6170 width = 34;
6171 height = 32;
6172 aiStyle = 5;
6173 damage = 32;
6174 defense = 6;
6175 lifeMax = 42;
6177 knockBackResist = 0.55f;
6179 value = 200f;
6180 noGravity = true;
6181 }
6182 else if (type == 235)
6183 {
6184 width = 34;
6185 height = 32;
6186 aiStyle = 5;
6187 damage = 34;
6188 defense = 4;
6189 lifeMax = 38;
6191 knockBackResist = 0.6f;
6193 value = 200f;
6194 noGravity = true;
6195 }
6196 else if (type == 236)
6197 {
6198 width = 50;
6199 height = 20;
6200 aiStyle = 3;
6201 damage = 100;
6202 defense = 28;
6203 lifeMax = 400;
6206 knockBackResist = 0.25f;
6207 value = 1000f;
6209 npcSlots = 0.75f;
6210 }
6211 else if (type == 237)
6212 {
6213 noGravity = true;
6214 width = 36;
6215 height = 36;
6216 aiStyle = 40;
6217 damage = 100;
6218 defense = 28;
6219 lifeMax = 400;
6222 knockBackResist = 0.25f;
6223 value = 1000f;
6225 npcSlots = 0.75f;
6226 }
6227 else if (type == 239)
6228 {
6229 width = 50;
6230 height = 20;
6231 aiStyle = 3;
6232 damage = 30;
6233 defense = 8;
6234 lifeMax = 60;
6237 knockBackResist = 0.5f;
6238 value = 130f;
6240 }
6241 else if (type == 240)
6242 {
6243 noGravity = true;
6244 width = 36;
6245 height = 36;
6246 aiStyle = 40;
6247 damage = 30;
6248 defense = 8;
6249 lifeMax = 60;
6252 knockBackResist = 0.5f;
6253 value = 130f;
6255 }
6256 else if (type == 241)
6257 {
6258 npcSlots = 0.5f;
6259 noGravity = true;
6260 width = 18;
6261 height = 20;
6262 aiStyle = 16;
6263 damage = 50;
6264 defense = 20;
6265 lifeMax = 150;
6268 value = 500f;
6269 }
6270 else if (type == 242)
6271 {
6272 noGravity = true;
6273 width = 26;
6274 height = 26;
6275 aiStyle = 18;
6276 damage = 75;
6277 defense = 20;
6278 lifeMax = 150;
6281 value = 800f;
6282 alpha = 20;
6283 }
6284 else if (type == 243)
6285 {
6286 width = 30;
6287 height = 114;
6288 aiStyle = 3;
6289 damage = 60;
6290 defense = 32;
6291 lifeMax = 4000;
6294 knockBackResist = 0.05f;
6295 value = Item.buyPrice(0, 1, 50);
6296 coldDamage = true;
6297 rarity = 2;
6298 }
6299 else if (type == 244)
6300 {
6301 width = 60;
6302 height = 42;
6303 aiStyle = 1;
6304 damage = 85;
6305 defense = 26;
6306 lifeMax = 400;
6309 alpha = 175;
6310 value = Item.buyPrice(0, 0, 20);
6311 knockBackResist = 0.3f;
6312 rarity = 1;
6313 }
6314 else if (type == 245)
6315 {
6316 width = 140;
6317 height = 140;
6318 aiStyle = 45;
6319 damage = 72;
6320 defense = 26;
6321 lifeMax = 15000;
6324 knockBackResist = 0f;
6325 value = Item.buyPrice(0, 15);
6326 alpha = 255;
6327 boss = true;
6328 npcSlots = 5f;
6329 }
6330 else if (type == 246)
6331 {
6332 noGravity = true;
6333 width = 70;
6334 height = 70;
6335 aiStyle = 46;
6336 damage = 64;
6337 defense = 20;
6338 lifeMax = 25000;
6340 DeathSound = null;
6341 knockBackResist = 0f;
6342 alpha = 255;
6343 }
6344 else if (type == 247 || type == 248)
6345 {
6346 noGravity = true;
6347 width = 40;
6348 height = 30;
6349 aiStyle = 47;
6350 damage = 59;
6351 defense = 28;
6352 lifeMax = 10000;
6355 alpha = 255;
6356 knockBackResist = 0f;
6357 }
6358 else if (type == 249)
6359 {
6360 noGravity = true;
6361 width = 70;
6362 height = 70;
6363 aiStyle = 48;
6364 damage = 80;
6365 defense = 32;
6366 lifeMax = 16000;
6369 knockBackResist = 0f;
6370 dontTakeDamage = true;
6371 }
6372 else if (type == 250)
6373 {
6374 width = 34;
6375 height = 26;
6376 aiStyle = 49;
6377 damage = 50;
6378 defense = 24;
6379 lifeMax = 300;
6382 knockBackResist = 0.3f;
6383 value = 300f;
6384 }
6385 else if (type == 251)
6386 {
6387 width = 18;
6388 height = 40;
6389 aiStyle = 3;
6390 damage = 50;
6391 defense = 30;
6392 lifeMax = 1000;
6395 knockBackResist = 0.3f;
6396 value = Item.buyPrice(0, 0, 50);
6397 rarity = 2;
6398 }
6399 else if (type == 252)
6400 {
6401 noGravity = true;
6402 npcSlots = 0.5f;
6403 width = 32;
6404 height = 32;
6405 aiStyle = 5;
6406 damage = 80;
6407 defense = 12;
6408 lifeMax = 100;
6410 knockBackResist = 0.7f;
6412 value = 500f;
6413 }
6414 else if (type == 254)
6415 {
6416 width = 18;
6417 height = 40;
6418 aiStyle = 3;
6419 damage = 40;
6420 defense = 10;
6421 lifeMax = 180;
6424 knockBackResist = 0.4f;
6425 value = 1000f;
6426 }
6427 else if (type == 255)
6428 {
6429 width = 18;
6430 height = 40;
6431 aiStyle = 3;
6432 damage = 38;
6433 defense = 16;
6434 lifeMax = 220;
6437 knockBackResist = 0.3f;
6438 value = 1200f;
6439 }
6440 else if (type == 256)
6441 {
6442 noGravity = true;
6443 width = 26;
6444 height = 26;
6445 aiStyle = 18;
6446 damage = 90;
6447 defense = 20;
6448 lifeMax = 140;
6451 value = 1200f;
6452 alpha = 20;
6453 npcSlots = 0.3f;
6454 }
6455 else if (type == 257)
6456 {
6457 width = 44;
6458 height = 34;
6459 aiStyle = 3;
6460 damage = 38;
6461 defense = 24;
6462 lifeMax = 230;
6465 knockBackResist = 0.3f;
6466 value = 1300f;
6467 npcSlots = 0.3f;
6468 }
6469 else if (type == 258)
6470 {
6471 width = 30;
6472 height = 24;
6473 aiStyle = 3;
6474 damage = 60;
6475 defense = 16;
6476 lifeMax = 220;
6479 knockBackResist = 0.3f;
6480 value = 1500f;
6481 npcSlots = 0.3f;
6482 }
6483 else if (type == 259)
6484 {
6485 noGravity = true;
6486 noTileCollide = true;
6487 width = 20;
6488 height = 20;
6489 aiStyle = 13;
6490 damage = 24;
6491 defense = 4;
6492 lifeMax = 90;
6494 knockBackResist = 0f;
6496 value = 350f;
6497 npcSlots = 0.3f;
6498 }
6499 else if (type == 260)
6500 {
6501 noGravity = true;
6502 noTileCollide = true;
6503 width = 36;
6504 height = 36;
6505 aiStyle = 13;
6506 damage = 70;
6507 defense = 20;
6508 lifeMax = 300;
6510 knockBackResist = 0f;
6512 value = 1250f;
6513 npcSlots = 0.3f;
6514 }
6515 else if (type == 261)
6516 {
6517 width = 12;
6518 height = 12;
6519 aiStyle = 50;
6520 damage = 80;
6521 defense = 0;
6522 lifeMax = 1;
6525 noGravity = true;
6526 noTileCollide = true;
6527 knockBackResist = 0f;
6528 npcSlots = 0f;
6529 }
6530 else if (type == 262)
6531 {
6532 noTileCollide = true;
6533 width = 86;
6534 height = 86;
6535 aiStyle = 51;
6536 damage = 50;
6537 defense = 14;
6538 lifeMax = 30000;
6541 knockBackResist = 0f;
6542 value = Item.buyPrice(0, 15);
6543 noGravity = true;
6544 boss = true;
6545 npcSlots = 16f;
6546 }
6547 else if (type == 263)
6548 {
6549 noTileCollide = true;
6550 noGravity = true;
6551 width = 40;
6552 height = 40;
6553 aiStyle = 52;
6554 damage = 60;
6555 defense = 24;
6556 lifeMax = 4000;
6557 dontTakeDamage = true;
6560 }
6561 else if (type == 264)
6562 {
6563 width = 24;
6564 height = 24;
6565 aiStyle = 53;
6566 damage = 60;
6567 defense = 20;
6568 lifeMax = 1000;
6571 noGravity = true;
6572 noTileCollide = true;
6573 }
6574 else if (type == 265)
6575 {
6576 width = 18;
6577 height = 18;
6578 aiStyle = 50;
6579 damage = 70;
6580 defense = 0;
6581 lifeMax = 1;
6584 noGravity = true;
6585 noTileCollide = true;
6586 knockBackResist = 0f;
6587 npcSlots = 0f;
6588 }
6589 else if (type == 266)
6590 {
6591 dontTakeDamage = true;
6592 width = 160;
6593 height = 110;
6594 aiStyle = 54;
6595 damage = 30;
6596 defense = 14;
6597 lifeMax = 1250;
6600 knockBackResist = 0.45f;
6601 noGravity = true;
6602 noTileCollide = true;
6604 boss = true;
6605 value = 50000f;
6606 npcSlots = 6f;
6607 }
6608 else if (type == 267)
6609 {
6610 width = 30;
6611 height = 30;
6612 aiStyle = 55;
6613 damage = 20;
6614 defense = 10;
6615 lifeMax = 100;
6618 noGravity = true;
6619 noTileCollide = true;
6620 knockBackResist = 0.8f;
6621 }
6622 else if (type == 268)
6623 {
6624 noGravity = true;
6625 width = 28;
6626 height = 56;
6627 aiStyle = 22;
6628 damage = 55;
6629 defense = 20;
6630 lifeMax = 340;
6633 knockBackResist = 0.6f;
6634 value = 450f;
6635 }
6636 else if (type == 269)
6637 {
6638 width = 18;
6639 height = 40;
6640 aiStyle = 3;
6641 damage = 70;
6642 defense = 34;
6643 lifeMax = 550;
6646 knockBackResist = 0.3f;
6647 value = 1000f;
6648 }
6649 else if (type == 270)
6650 {
6651 width = 18;
6652 height = 40;
6653 aiStyle = 3;
6654 damage = 55;
6655 defense = 50;
6656 lifeMax = 400;
6659 knockBackResist = 0.2f;
6660 value = 1000f;
6661 }
6662 else if (type == 271)
6663 {
6664 width = 18;
6665 height = 40;
6666 aiStyle = 3;
6667 damage = 70;
6668 defense = 40;
6669 lifeMax = 450;
6672 knockBackResist = 0.25f;
6673 value = 1000f;
6674 }
6675 else if (type == 272)
6676 {
6677 width = 18;
6678 height = 40;
6679 aiStyle = 3;
6680 damage = 75;
6681 defense = 28;
6682 lifeMax = 400;
6685 knockBackResist = 0.35f;
6686 value = 1000f;
6687 }
6688 else if (type == 273)
6689 {
6690 width = 18;
6691 height = 40;
6692 aiStyle = 3;
6693 damage = 45;
6694 defense = 50;
6695 lifeMax = 500;
6698 knockBackResist = 0.15f;
6699 value = 1000f;
6700 }
6701 else if (type == 274)
6702 {
6703 width = 18;
6704 height = 40;
6705 aiStyle = 3;
6706 damage = 65;
6707 defense = 34;
6708 lifeMax = 350;
6711 knockBackResist = 0.4f;
6712 value = 1000f;
6713 }
6714 else if (type == 275)
6715 {
6716 width = 18;
6717 height = 40;
6718 aiStyle = 3;
6719 damage = 45;
6720 defense = 50;
6721 lifeMax = 550;
6724 knockBackResist = 0.15f;
6725 value = 1000f;
6726 }
6727 else if (type == 276)
6728 {
6729 width = 18;
6730 height = 40;
6731 aiStyle = 3;
6732 damage = 85;
6733 defense = 54;
6734 lifeMax = 500;
6737 knockBackResist = 0.2f;
6738 value = 1000f;
6739 }
6740 else if (type == 277)
6741 {
6742 width = 18;
6743 height = 40;
6744 aiStyle = 3;
6745 damage = 70;
6746 defense = 32;
6747 lifeMax = 400;
6750 knockBackResist = 0.4f;
6751 value = 1000f;
6752 }
6753 else if (type == 278)
6754 {
6755 width = 18;
6756 height = 40;
6757 aiStyle = 3;
6758 damage = 65;
6759 defense = 48;
6760 lifeMax = 450;
6763 knockBackResist = 0.3f;
6764 value = 1000f;
6765 }
6766 else if (type == 279)
6767 {
6768 width = 18;
6769 height = 40;
6770 aiStyle = 3;
6771 damage = 40;
6772 defense = 54;
6773 lifeMax = 500;
6776 knockBackResist = 0.2f;
6777 value = 1000f;
6778 }
6779 else if (type == 280)
6780 {
6781 width = 18;
6782 height = 40;
6783 aiStyle = 3;
6784 damage = 75;
6785 defense = 34;
6786 lifeMax = 500;
6789 knockBackResist = 0.4f;
6790 value = 1000f;
6791 }
6792 else if (type == 281)
6793 {
6794 width = 18;
6795 height = 40;
6796 aiStyle = 8;
6797 damage = 40;
6798 defense = 20;
6799 lifeMax = 400;
6802 knockBackResist = 0.6f;
6803 value = 1500f;
6804 npcSlots = 2f;
6805 }
6806 else if (type == 282)
6807 {
6808 width = 18;
6809 height = 40;
6810 aiStyle = 8;
6811 damage = 35;
6812 defense = 28;
6813 lifeMax = 450;
6816 knockBackResist = 0.5f;
6817 value = 1500f;
6818 npcSlots = 2f;
6819 }
6820 else if (type == 283)
6821 {
6822 width = 18;
6823 height = 40;
6824 aiStyle = 8;
6825 damage = 50;
6826 defense = 18;
6827 lifeMax = 300;
6830 knockBackResist = 0.55f;
6831 value = 1500f;
6832 npcSlots = 2f;
6833 }
6834 else if (type == 284)
6835 {
6836 width = 18;
6837 height = 40;
6838 aiStyle = 8;
6839 damage = 35;
6840 defense = 24;
6841 lifeMax = 450;
6844 knockBackResist = 0.5f;
6845 value = 1500f;
6846 npcSlots = 2f;
6847 }
6848 else if (type == 285)
6849 {
6850 width = 18;
6851 height = 40;
6852 aiStyle = 8;
6853 damage = 50;
6854 defense = 12;
6855 lifeMax = 200;
6858 knockBackResist = 0.7f;
6859 value = 1500f;
6860 npcSlots = 2f;
6861 }
6862 else if (type == 286)
6863 {
6864 width = 18;
6865 height = 40;
6866 aiStyle = 8;
6867 damage = 60;
6868 defense = 10;
6869 lifeMax = 250;
6872 knockBackResist = 0.65f;
6873 value = 1500f;
6874 npcSlots = 2f;
6875 }
6876 else if (type == 287)
6877 {
6878 width = 18;
6879 height = 40;
6880 aiStyle = 3;
6881 damage = 90;
6882 defense = 42;
6883 lifeMax = 1000;
6886 knockBackResist = 0.3f;
6887 value = 2000f;
6888 rarity = 1;
6889 }
6890 else if (type == 288)
6891 {
6892 width = 20;
6893 height = 20;
6894 aiStyle = 56;
6895 damage = 70;
6896 defense = 30;
6897 lifeMax = 200;
6898 knockBackResist = 0.2f;
6901 value = 500f;
6902 noTileCollide = true;
6903 noGravity = true;
6904 }
6905 else if (type == 289)
6906 {
6907 width = 44;
6908 height = 44;
6909 aiStyle = 10;
6910 damage = 60;
6911 defense = 20;
6912 lifeMax = 400;
6915 noGravity = true;
6916 noTileCollide = true;
6917 value = 150f;
6918 knockBackResist = 0.2f;
6919 npcSlots = 0.75f;
6920 }
6921 else if (type == 290)
6922 {
6923 width = 34;
6924 height = 62;
6925 aiStyle = 3;
6926 damage = 100;
6927 defense = 50;
6928 lifeMax = 5000;
6931 knockBackResist = 0f;
6932 value = 50000f;
6933 rarity = 2;
6934 }
6935 else if (type == 291)
6936 {
6937 width = 18;
6938 height = 40;
6939 aiStyle = 3;
6940 damage = 60;
6941 defense = 28;
6942 lifeMax = 400;
6945 knockBackResist = 0.4f;
6946 value = 1000f;
6947 rarity = 1;
6948 }
6949 else if (type == 292)
6950 {
6951 width = 18;
6952 height = 40;
6953 aiStyle = 3;
6954 damage = 60;
6955 defense = 28;
6956 lifeMax = 400;
6959 knockBackResist = 0.4f;
6960 value = 1000f;
6961 rarity = 1;
6962 }
6963 else if (type == 293)
6964 {
6965 width = 18;
6966 height = 40;
6967 aiStyle = 3;
6968 damage = 60;
6969 defense = 28;
6970 lifeMax = 400;
6973 knockBackResist = 0.4f;
6974 value = 1000f;
6975 rarity = 1;
6976 }
6977 else if (type == 294)
6978 {
6979 width = 18;
6980 height = 40;
6981 aiStyle = 3;
6982 damage = 34;
6983 defense = 6;
6984 lifeMax = 70;
6987 knockBackResist = 0.9f;
6988 value = 130f;
6989 }
6990 else if (type == 295)
6991 {
6992 width = 18;
6993 height = 40;
6994 aiStyle = 3;
6995 damage = 28;
6996 defense = 12;
6997 lifeMax = 70;
7000 knockBackResist = 0.7f;
7001 value = 130f;
7002 }
7003 else if (type == 296)
7004 {
7005 width = 18;
7006 height = 40;
7007 aiStyle = 3;
7008 damage = 24;
7009 defense = 14;
7010 lifeMax = 120;
7013 knockBackResist = 0.6f;
7014 value = 130f;
7015 }
7016 else if (type == 299)
7017 {
7018 width = 18;
7019 height = 20;
7020 aiStyle = 7;
7021 damage = 0;
7022 defense = 0;
7023 lifeMax = 5;
7026 catchItem = 2018;
7027 }
7028 else if (type == 300)
7029 {
7030 width = 14;
7031 height = 12;
7032 aiStyle = 7;
7033 damage = 0;
7034 defense = 0;
7035 lifeMax = 5;
7038 npcSlots = 0.25f;
7039 catchItem = 2003;
7040 }
7041 else if (type == 301)
7042 {
7043 width = 36;
7044 height = 26;
7045 aiStyle = 17;
7046 damage = 12;
7047 defense = 2;
7048 lifeMax = 35;
7050 knockBackResist = 0.85f;
7052 value = 50f;
7053 }
7054 if (type == 302)
7055 {
7056 width = 24;
7057 height = 18;
7058 aiStyle = 1;
7059 damage = 7;
7060 defense = 2;
7061 lifeMax = 25;
7064 value = 25f;
7065 }
7066 else if (type == 304)
7067 {
7068 width = 34;
7069 height = 28;
7070 aiStyle = 1;
7071 damage = 80;
7072 defense = 20;
7073 lifeMax = 175;
7076 value = 500f;
7077 scale = 1.1f;
7078 knockBackResist = 0.5f;
7079 npcSlots = 0.3f;
7080 }
7081 else if (type >= 305 && type <= 314)
7082 {
7083 width = 18;
7084 height = 40;
7085 aiStyle = 3;
7088 value = 1200f;
7089 npcSlots = 0.5f;
7090 if (type == 305 || type == 310)
7091 {
7092 damage = 60;
7093 defense = 18;
7094 lifeMax = 500;
7095 knockBackResist = 0.4f;
7096 }
7097 else if (type == 306 || type == 311)
7098 {
7099 damage = 52;
7100 defense = 14;
7101 lifeMax = 400;
7102 knockBackResist = 0.2f;
7103 scale = 1.05f;
7104 }
7105 else if (type == 307 || type == 312)
7106 {
7107 damage = 78;
7108 defense = 16;
7109 lifeMax = 600;
7110 knockBackResist = 0.25f;
7111 scale = 0.9f;
7112 }
7113 else if (type == 308 || type == 313)
7114 {
7115 damage = 66;
7116 defense = 14;
7117 lifeMax = 650;
7118 knockBackResist = 0.35f;
7119 scale = 0.95f;
7120 }
7121 else if (type == 309 || type == 314)
7122 {
7123 damage = 52;
7124 defense = 26;
7125 lifeMax = 450;
7126 knockBackResist = 0.5f;
7127 scale = 1.1f;
7128 }
7129 }
7130 else if (type == 315)
7131 {
7132 width = 74;
7133 height = 70;
7134 aiStyle = 26;
7135 damage = 130;
7136 defense = 40;
7137 lifeMax = 5000;
7140 knockBackResist = 0f;
7141 value = 10000f;
7142 }
7143 else if (type == 316)
7144 {
7145 noGravity = true;
7146 noTileCollide = true;
7147 width = 24;
7148 height = 44;
7149 aiStyle = 22;
7150 damage = 15;
7151 defense = 4;
7152 lifeMax = 50;
7155 alpha = 100;
7156 value = 90f;
7157 knockBackResist = 0.5f;
7158 }
7159 else if (type == 317)
7160 {
7161 width = 30;
7162 height = 32;
7163 aiStyle = 2;
7164 damage = 16;
7165 defense = 6;
7166 lifeMax = 75;
7168 knockBackResist = 0.7f;
7170 value = 100f;
7171 }
7172 else if (type == 318)
7173 {
7174 width = 30;
7175 height = 32;
7176 aiStyle = 2;
7177 damage = 20;
7178 defense = 4;
7179 lifeMax = 60;
7181 knockBackResist = 0.65f;
7183 value = 100f;
7184 }
7185 else if (type == 319)
7186 {
7187 width = 18;
7188 height = 40;
7189 aiStyle = 3;
7190 damage = 20;
7191 defense = 6;
7192 lifeMax = 40;
7195 knockBackResist = 0.6f;
7196 value = 85f;
7197 scale = 0.9f;
7198 }
7199 else if (type == 320)
7200 {
7201 width = 18;
7202 height = 40;
7203 aiStyle = 3;
7204 damage = 15;
7205 defense = 8;
7206 lifeMax = 60;
7209 knockBackResist = 0.5f;
7210 value = 105f;
7211 scale = 1.05f;
7212 }
7213 else if (type == 321)
7214 {
7215 width = 18;
7216 height = 40;
7217 aiStyle = 3;
7218 damage = 20;
7219 defense = 14;
7220 lifeMax = 34;
7223 knockBackResist = 0.3f;
7224 value = 120f;
7225 scale = 1.1f;
7226 }
7227 else if (type == 322)
7228 {
7229 width = 18;
7230 height = 40;
7231 aiStyle = 3;
7232 damage = 23;
7233 defense = 0;
7234 lifeMax = 115;
7237 knockBackResist = 0.65f;
7238 value = 130f;
7239 }
7240 else if (type == 323)
7241 {
7242 width = 18;
7243 height = 40;
7244 aiStyle = 3;
7245 damage = 18;
7246 defense = 10;
7247 lifeMax = 65;
7250 knockBackResist = 0.5f;
7251 value = 120f;
7252 }
7253 else if (type == 324)
7254 {
7255 width = 18;
7256 height = 40;
7257 aiStyle = 3;
7258 damage = 22;
7259 defense = 10;
7260 lifeMax = 70;
7263 knockBackResist = 0.4f;
7264 value = 130f;
7265 scale = 1.05f;
7266 }
7267 else if (type == 325)
7268 {
7269 width = 164;
7270 height = 154;
7271 aiStyle = 57;
7272 damage = 120;
7273 defense = 34;
7274 lifeMax = 14000;
7277 knockBackResist = 0f;
7278 value = 10000f;
7279 npcSlots = 3f;
7280 }
7281 else if (type == 326)
7282 {
7283 width = 18;
7284 height = 40;
7285 aiStyle = 3;
7286 damage = 100;
7287 defense = 32;
7288 lifeMax = 1200;
7291 knockBackResist = 0.2f;
7292 value = 2000f;
7293 }
7294 else if (type == 327)
7295 {
7296 width = 100;
7297 height = 100;
7298 aiStyle = 58;
7299 damage = 50;
7300 defense = 40;
7301 lifeMax = 26000;
7304 noGravity = true;
7305 noTileCollide = true;
7306 value = 50000f;
7307 knockBackResist = 0f;
7308 npcSlots = 5f;
7309 }
7310 else if (type == 328)
7311 {
7312 width = 80;
7313 height = 80;
7314 aiStyle = 59;
7315 damage = 65;
7316 defense = 14;
7317 lifeMax = 5000;
7320 noGravity = true;
7321 noTileCollide = true;
7322 knockBackResist = 0f;
7323 dontTakeDamage = true;
7324 npcSlots = 0f;
7325 dontCountMe = true;
7326 }
7327 else if (type == 329)
7328 {
7329 width = 46;
7330 height = 30;
7331 aiStyle = 26;
7332 damage = 80;
7333 defense = 38;
7334 lifeMax = 1800;
7337 knockBackResist = 0.3f;
7338 value = 3000f;
7339 }
7340 else if (type == 330)
7341 {
7342 noGravity = true;
7343 noTileCollide = true;
7344 width = 24;
7345 height = 44;
7346 aiStyle = 22;
7347 damage = 90;
7348 defense = 44;
7349 lifeMax = 1250;
7352 alpha = 100;
7353 value = 4500f;
7354 knockBackResist = 0.4f;
7355 }
7356 else if (type == 331)
7357 {
7358 width = 18;
7359 height = 40;
7360 aiStyle = 3;
7361 damage = 14;
7362 defense = 6;
7363 lifeMax = 45;
7366 knockBackResist = 0.5f;
7367 value = 60f;
7368 }
7369 else if (type == 332)
7370 {
7371 width = 18;
7372 height = 40;
7373 aiStyle = 3;
7374 damage = 14;
7375 defense = 6;
7376 lifeMax = 45;
7379 knockBackResist = 0.5f;
7380 value = 60f;
7381 }
7382 if (type == 333)
7383 {
7384 width = 24;
7385 height = 18;
7386 aiStyle = 1;
7387 damage = 7;
7388 defense = 2;
7389 lifeMax = 25;
7392 value = 25f;
7393 }
7394 if (type == 334)
7395 {
7396 width = 24;
7397 height = 18;
7398 aiStyle = 1;
7399 damage = 6;
7400 defense = 2;
7401 lifeMax = 23;
7404 scale = 0.9f;
7405 value = 25f;
7406 }
7407 if (type == 335)
7408 {
7409 width = 24;
7410 height = 18;
7411 aiStyle = 1;
7412 damage = 8;
7413 defense = 3;
7414 lifeMax = 29;
7415 scale = 1.05f;
7418 value = 25f;
7419 }
7420 if (type == 336)
7421 {
7422 width = 24;
7423 height = 18;
7424 aiStyle = 1;
7425 damage = 5;
7426 defense = 1;
7427 lifeMax = 22;
7428 scale = 0.85f;
7431 value = 25f;
7432 }
7433 else if (type >= 338 && type <= 340)
7434 {
7435 width = 18;
7436 height = 40;
7437 aiStyle = 3;
7440 value = 1200f;
7441 npcSlots = 0.5f;
7442 if (type == 338)
7443 {
7444 damage = 65;
7445 defense = 18;
7446 lifeMax = 600;
7447 knockBackResist = 0.4f;
7448 }
7449 else if (type == 339)
7450 {
7451 damage = 52;
7452 defense = 24;
7453 lifeMax = 700;
7454 knockBackResist = 0.2f;
7455 scale = 1.05f;
7456 }
7457 else if (type == 340)
7458 {
7459 damage = 78;
7460 defense = 14;
7461 lifeMax = 500;
7462 knockBackResist = 0.25f;
7463 scale = 0.9f;
7464 }
7465 }
7466 else if (type == 341)
7467 {
7468 width = 24;
7469 height = 24;
7470 aiStyle = 25;
7471 damage = 100;
7472 defense = 32;
7473 lifeMax = 900;
7476 value = Item.buyPrice(0, 0, 20);
7477 knockBackResist = 0.25f;
7478 }
7479 else if (type == 342)
7480 {
7481 width = 18;
7482 height = 40;
7483 aiStyle = 3;
7484 damage = 90;
7485 defense = 26;
7486 lifeMax = 750;
7489 knockBackResist = 0.2f;
7490 value = 1800f;
7491 }
7492 else if (type == 343)
7493 {
7494 width = 38;
7495 height = 78;
7496 aiStyle = 3;
7497 damage = 140;
7498 defense = 50;
7499 lifeMax = 3500;
7502 knockBackResist = 0f;
7503 value = 3000f;
7504 npcSlots = 2f;
7505 coldDamage = true;
7506 }
7507 else if (type == 344)
7508 {
7509 width = 172;
7510 height = 130;
7511 aiStyle = 57;
7512 damage = 110;
7513 defense = 38;
7514 lifeMax = 13000;
7517 knockBackResist = 0f;
7518 value = 10000f;
7519 npcSlots = 3f;
7520 }
7521 else if (type == 345)
7522 {
7523 width = 130;
7524 height = 140;
7525 aiStyle = 60;
7526 damage = 120;
7527 defense = 38;
7528 lifeMax = 34000;
7531 knockBackResist = 0f;
7532 value = 50000f;
7533 noTileCollide = true;
7534 noGravity = true;
7535 npcSlots = 5f;
7536 coldDamage = true;
7537 }
7538 else if (type == 346)
7539 {
7540 width = 112;
7541 height = 140;
7542 aiStyle = 61;
7543 damage = 120;
7544 defense = 56;
7545 lifeMax = 18000;
7548 knockBackResist = 0f;
7549 value = 10000f;
7550 npcSlots = 4f;
7551 }
7552 else if (type == 347)
7553 {
7554 width = 50;
7555 height = 50;
7556 aiStyle = 62;
7557 damage = 60;
7558 defense = 28;
7559 lifeMax = 1200;
7561 knockBackResist = 0.4f;
7563 value = 1000f;
7564 noTileCollide = true;
7565 noGravity = true;
7566 npcSlots = 1.5f;
7567 }
7568 else if (type == 348)
7569 {
7570 width = 28;
7571 height = 76;
7572 aiStyle = 3;
7573 damage = 80;
7574 defense = 26;
7575 lifeMax = 1800;
7578 knockBackResist = 0.4f;
7579 value = 1500f;
7580 npcSlots = 1.5f;
7581 }
7582 else if (type == 349)
7583 {
7584 width = 28;
7585 height = 76;
7586 aiStyle = 3;
7587 damage = 100;
7588 defense = 42;
7589 lifeMax = 1800;
7592 knockBackResist = 0.1f;
7593 value = 1500f;
7594 npcSlots = 1.5f;
7595 }
7596 else if (type == 350)
7597 {
7598 width = 18;
7599 height = 40;
7600 aiStyle = 3;
7601 damage = 70;
7602 defense = 30;
7603 lifeMax = 900;
7606 knockBackResist = 0.45f;
7607 value = 900f;
7608 }
7609 else if (type == 351)
7610 {
7611 width = 18;
7612 height = 90;
7613 aiStyle = 3;
7614 damage = 100;
7615 defense = 40;
7616 lifeMax = 2500;
7619 knockBackResist = 0.1f;
7620 value = 3000f;
7621 npcSlots = 1.75f;
7622 }
7623 else if (type == 352)
7624 {
7625 width = 54;
7626 height = 54;
7627 aiStyle = 63;
7628 damage = 75;
7629 defense = 8;
7630 lifeMax = 450;
7633 value = 500f;
7634 knockBackResist = 0.4f;
7635 noGravity = true;
7636 noTileCollide = true;
7637 npcSlots = 2f;
7638 coldDamage = true;
7639 }
7640 else if (type == 353)
7641 {
7642 townNPC = true;
7643 friendly = true;
7644 width = 18;
7645 height = 40;
7646 aiStyle = 7;
7647 damage = 10;
7648 defense = 15;
7649 lifeMax = 250;
7652 knockBackResist = 0.5f;
7653 }
7654 else if (type == 354)
7655 {
7656 friendly = true;
7657 width = 18;
7658 height = 34;
7659 aiStyle = 0;
7660 damage = 10;
7661 defense = 15;
7662 lifeMax = 250;
7665 knockBackResist = 0.5f;
7666 scale = 0.9f;
7667 rarity = 1;
7668 }
7669 else if (type == 355)
7670 {
7671 width = 10;
7672 height = 10;
7673 aiStyle = 64;
7674 damage = 0;
7675 defense = 0;
7676 lifeMax = 5;
7679 npcSlots = 0.2f;
7680 noGravity = true;
7681 catchItem = 1992;
7682 }
7683 else if (type == 356)
7684 {
7685 width = 10;
7686 height = 10;
7687 aiStyle = 65;
7688 damage = 0;
7689 defense = 0;
7690 lifeMax = 5;
7693 npcSlots = 0.25f;
7694 noGravity = true;
7695 catchItem = 1994;
7696 }
7697 else if (type == 357)
7698 {
7699 width = 10;
7700 height = 4;
7701 aiStyle = 66;
7702 damage = 0;
7703 defense = 0;
7704 lifeMax = 5;
7707 npcSlots = 0.1f;
7708 catchItem = 2002;
7709 friendly = true;
7710 }
7711 else if (type == 358)
7712 {
7713 width = 12;
7714 height = 12;
7715 aiStyle = 64;
7716 damage = 0;
7717 defense = 0;
7718 lifeMax = 5;
7721 npcSlots = 0.2f;
7722 noGravity = true;
7723 catchItem = 2004;
7724 }
7725 else if (type == 359)
7726 {
7727 width = 12;
7728 height = 12;
7729 aiStyle = 67;
7730 damage = 0;
7731 defense = 0;
7732 lifeMax = 5;
7735 npcSlots = 0.5f;
7736 noGravity = true;
7737 catchItem = 2006;
7738 }
7739 else if (type == 360)
7740 {
7741 width = 14;
7742 height = 14;
7743 aiStyle = 67;
7744 damage = 0;
7745 defense = 0;
7746 lifeMax = 5;
7749 npcSlots = 0.5f;
7750 noGravity = true;
7751 catchItem = 2007;
7752 }
7753 else if (type == 361)
7754 {
7755 width = 12;
7756 height = 10;
7757 aiStyle = 7;
7758 damage = 0;
7759 defense = 0;
7760 lifeMax = 5;
7763 catchItem = 2121;
7764 }
7765 else if (type == 362)
7766 {
7767 width = 22;
7768 height = 26;
7769 aiStyle = 7;
7770 damage = 0;
7771 defense = 0;
7772 lifeMax = 5;
7775 catchItem = 2122;
7776 }
7777 else if (type == 363)
7778 {
7779 width = 28;
7780 height = 22;
7781 aiStyle = 68;
7782 damage = 0;
7783 defense = 0;
7784 lifeMax = 5;
7787 catchItem = 2122;
7788 }
7789 else if (type == 364)
7790 {
7791 width = 22;
7792 height = 26;
7793 aiStyle = 7;
7794 damage = 0;
7795 defense = 0;
7796 lifeMax = 5;
7799 catchItem = 2123;
7800 }
7801 else if (type == 365)
7802 {
7803 width = 28;
7804 height = 22;
7805 aiStyle = 68;
7806 damage = 0;
7807 defense = 0;
7808 lifeMax = 5;
7811 catchItem = 2123;
7812 }
7813 else if (type == 366 || type == 367)
7814 {
7815 width = 26;
7816 height = 18;
7817 aiStyle = 7;
7818 damage = 0;
7819 defense = 0;
7820 lifeMax = 5;
7823 catchItem = (short)(2156 + type - 366);
7824 }
7825 else if (type == 368)
7826 {
7827 townNPC = true;
7828 friendly = true;
7829 width = 18;
7830 height = 40;
7831 aiStyle = 7;
7832 damage = 10;
7833 defense = 15;
7834 lifeMax = 250;
7837 knockBackResist = 0.5f;
7838 }
7839 else if (type == 369)
7840 {
7841 townNPC = true;
7842 friendly = true;
7843 width = 18;
7844 height = 40;
7845 aiStyle = 7;
7846 damage = 10;
7847 defense = 15;
7848 lifeMax = 250;
7851 knockBackResist = 0.5f;
7852 }
7853 else if (type == 370)
7854 {
7855 width = 150;
7856 height = 100;
7857 aiStyle = 69;
7858 damage = 100;
7859 defense = 50;
7860 lifeMax = 60000;
7861 knockBackResist = 0f;
7862 noTileCollide = true;
7863 noGravity = true;
7864 npcSlots = 10f;
7867 value = 250000f;
7868 boss = true;
7869 netAlways = true;
7871 }
7872 else if (type == 371)
7873 {
7874 width = 36;
7875 height = 36;
7876 aiStyle = 70;
7877 damage = 100;
7878 defense = 0;
7879 lifeMax = 1;
7882 noGravity = true;
7883 noTileCollide = true;
7884 knockBackResist = 0f;
7885 alpha = 255;
7886 }
7887 else if (type == 372)
7888 {
7889 noGravity = true;
7890 width = 120;
7891 height = 24;
7892 aiStyle = 71;
7893 damage = 100;
7894 defense = 100;
7895 lifeMax = 100;
7898 knockBackResist = 0f;
7899 alpha = 255;
7900 }
7901 else if (type == 373)
7902 {
7903 noGravity = true;
7904 width = 100;
7905 height = 24;
7906 aiStyle = 71;
7907 damage = 120;
7908 defense = 100;
7909 lifeMax = 100;
7912 knockBackResist = 0f;
7913 alpha = 255;
7914 }
7915 else if (type == 374)
7916 {
7917 width = 20;
7918 height = 10;
7919 aiStyle = 66;
7920 damage = 0;
7921 defense = 0;
7922 lifeMax = 5;
7925 npcSlots = 0.15f;
7926 catchItem = 2673;
7927 rarity = 4;
7929 }
7930 else if (type == 375)
7931 {
7932 width = 10;
7933 height = 10;
7934 aiStyle = 6;
7935 damage = 0;
7936 defense = 0;
7937 lifeMax = 5;
7940 noGravity = true;
7941 noTileCollide = true;
7942 knockBackResist = 0f;
7943 behindTiles = true;
7944 npcSlots = 0.15f;
7945 catchItem = 2673;
7946 rarity = 4;
7948 }
7949 else if (type == 376)
7950 {
7951 friendly = true;
7952 width = 34;
7953 height = 8;
7954 aiStyle = 0;
7955 damage = 10;
7956 defense = 15;
7957 lifeMax = 250;
7960 knockBackResist = 0.5f;
7961 scale = 0.9f;
7962 rarity = 1;
7963 }
7964 else if (type == 377)
7965 {
7966 width = 14;
7967 height = 10;
7968 aiStyle = 1;
7969 damage = 0;
7970 defense = 0;
7971 lifeMax = 5;
7974 friendly = true;
7975 catchItem = 2740;
7976 npcSlots = 0.1f;
7977 }
7978 else if (type == 378)
7979 {
7980 npcSlots = 1f;
7981 width = 20;
7982 height = 26;
7983 aiStyle = 41;
7984 damage = 120;
7985 defense = 30;
7986 lifeMax = 200;
7989 knockBackResist = 0.5f;
7990 value = 450f;
7991 }
7992 else if (type >= 379 && type <= 380)
7993 {
7994 width = 18;
7995 height = 40;
7996 aiStyle = 3;
7997 damage = 45;
7998 defense = 14;
7999 lifeMax = 210;
8002 knockBackResist = 0.55f;
8003 value = 1000f;
8004 npcSlots = 0f;
8005 lavaImmune = true;
8006 netAlways = true;
8007 chaseable = false;
8008 }
8009 else if (type >= 381 && type <= 382)
8010 {
8011 width = 18;
8012 height = 40;
8013 aiStyle = 3;
8014 damage = 50;
8015 defense = 25;
8016 lifeMax = 350;
8019 knockBackResist = 0.35f;
8020 value = 1000f;
8021 }
8022 else if (type == 383)
8023 {
8024 lifeMax = 300;
8025 defense = 50;
8026 damage = 75;
8027 width = 18;
8028 height = 40;
8029 aiStyle = 3;
8032 value = 1200f;
8033 knockBackResist = 0.25f;
8034 }
8035 else if (type == 384)
8036 {
8037 lifeMax = 1000;
8038 width = 18;
8039 defense = 20;
8040 height = 40;
8041 aiStyle = 72;
8044 npcSlots = 0f;
8045 noTileCollide = true;
8046 canGhostHeal = false;
8047 }
8048 else if (type == 385)
8049 {
8050 lifeMax = 750;
8051 defense = 30;
8052 damage = 80;
8053 width = 18;
8054 height = 40;
8055 aiStyle = 3;
8058 value = 600f;
8059 knockBackResist = 0f;
8060 npcSlots = 0.75f;
8061 }
8062 else if (type == 386)
8063 {
8064 lifeMax = 400;
8065 defense = 34;
8066 damage = 40;
8067 width = 18;
8068 height = 40;
8069 aiStyle = 3;
8072 value = 1200f;
8073 knockBackResist = 0.4f;
8074 }
8075 else if (type == 387)
8076 {
8077 width = 20;
8078 height = 50;
8079 aiStyle = 73;
8080 damage = 10;
8081 defense = 40;
8082 lifeMax = 200;
8085 knockBackResist = 0f;
8086 canGhostHeal = false;
8087 }
8088 else if (type == 388)
8089 {
8090 width = 40;
8091 height = 30;
8092 aiStyle = 74;
8093 damage = 60;
8094 defense = 16;
8095 lifeMax = 300;
8097 knockBackResist = 0.4f;
8099 value = 1000f;
8100 noTileCollide = true;
8101 noGravity = true;
8102 npcSlots = 1.5f;
8103 canGhostHeal = false;
8104 }
8105 else if (type == 389)
8106 {
8107 lifeMax = 600;
8108 defense = 38;
8109 damage = 75;
8110 width = 18;
8111 height = 40;
8112 aiStyle = 3;
8115 value = 1200f;
8116 npcSlots = 0.5f;
8117 knockBackResist = 0.3f;
8118 }
8119 else if (type == 390)
8120 {
8121 damage = 65;
8122 defense = 30;
8123 lifeMax = 350;
8124 width = 18;
8125 height = 40;
8126 aiStyle = 75;
8129 value = 1200f;
8130 npcSlots = 0.5f;
8131 }
8132 else if (type == 391)
8133 {
8134 lifeMax = 600;
8135 defense = 30;
8136 damage = 85;
8137 width = 60;
8138 height = 40;
8139 aiStyle = 3;
8142 value = 1200f;
8143 npcSlots = 0.5f;
8144 knockBackResist = 0.1f;
8145 }
8146 else if (type == 392)
8147 {
8148 lifeMax = 100;
8149 defense = 100;
8150 damage = 50;
8151 width = 150;
8152 height = 80;
8153 aiStyle = 75;
8156 value = 0f;
8157 npcSlots = 0f;
8158 knockBackResist = 0f;
8159 noGravity = true;
8160 noTileCollide = true;
8161 dontTakeDamage = true;
8162 netAlways = true;
8163 }
8164 else if (type == 393)
8165 {
8166 lifeMax = 5000;
8167 defense = 20;
8168 damage = 60;
8169 width = 40;
8170 height = 16;
8171 aiStyle = 75;
8174 value = 0f;
8175 npcSlots = 1f;
8176 knockBackResist = 0f;
8177 noGravity = true;
8178 noTileCollide = true;
8179 netAlways = true;
8180 }
8181 else if (type == 394)
8182 {
8183 lifeMax = 3500;
8184 defense = 20;
8185 damage = 60;
8186 width = 46;
8187 height = 36;
8188 aiStyle = 75;
8191 value = 0f;
8192 npcSlots = 1f;
8193 knockBackResist = 0f;
8194 noGravity = true;
8195 noTileCollide = true;
8196 netAlways = true;
8197 }
8198 else if (type == 395)
8199 {
8200 lifeMax = 10000;
8201 defense = 0;
8202 damage = 80;
8203 width = 120;
8204 height = 90;
8205 aiStyle = 76;
8208 value = 0f;
8209 npcSlots = 6f;
8210 knockBackResist = 0f;
8211 noGravity = true;
8212 noTileCollide = true;
8213 dontTakeDamage = true;
8214 boss = true;
8215 netAlways = true;
8216 }
8217 else if (type == 399)
8218 {
8219 defense = 5;
8220 damage = 5;
8221 lifeMax = 500;
8222 aiStyle = 80;
8223 width = 42;
8224 height = 72;
8225 value = 0f;
8226 knockBackResist = 0f;
8229 npcSlots = 0f;
8230 noGravity = true;
8232 chaseable = false;
8233 netAlways = true;
8234 rarity = 1;
8235 }
8236 else if (type == 396)
8237 {
8238 lifeMax = 45000;
8239 defense = 50;
8240 damage = 0;
8241 width = 38;
8242 height = 56;
8243 aiStyle = 79;
8246 value = 0f;
8247 npcSlots = 6f;
8248 knockBackResist = 0f;
8249 noGravity = true;
8250 noTileCollide = true;
8251 boss = true;
8252 hide = true;
8253 netAlways = true;
8254 }
8255 else if (type == 397)
8256 {
8257 lifeMax = 25000;
8258 defense = 40;
8259 damage = 0;
8260 width = 46;
8261 height = 66;
8262 aiStyle = 78;
8265 value = 0f;
8266 npcSlots = 6f;
8267 knockBackResist = 0f;
8268 noGravity = true;
8269 noTileCollide = true;
8270 boss = true;
8271 hide = true;
8272 netAlways = true;
8273 }
8274 else if (type == 398)
8275 {
8276 lifeMax = 50000;
8277 defense = 70;
8278 damage = 0;
8279 width = 46;
8280 height = 66;
8281 aiStyle = 77;
8283 DeathSound = null;
8284 value = 1000000f;
8285 npcSlots = 6f;
8286 knockBackResist = 0f;
8287 noGravity = true;
8288 noTileCollide = true;
8289 dontTakeDamage = true;
8290 boss = true;
8291 behindTiles = true;
8292 hide = true;
8293 netAlways = true;
8294 }
8295 else if (type == 400)
8296 {
8297 defense = 0;
8298 damage = 60;
8299 lifeMax = 100;
8300 aiStyle = 81;
8301 width = 60;
8302 height = 60;
8303 value = 0f;
8304 knockBackResist = 0f;
8307 npcSlots = 0f;
8308 noGravity = true;
8309 dontTakeDamage = true;
8310 noTileCollide = true;
8311 netAlways = true;
8312 }
8313 else if (type == 401)
8314 {
8315 lifeMax = 400;
8316 defense = 0;
8317 damage = 0;
8318 width = 30;
8319 height = 30;
8320 aiStyle = 82;
8323 value = 0f;
8324 npcSlots = 0f;
8325 knockBackResist = 0f;
8326 noGravity = true;
8327 noTileCollide = true;
8328 hide = true;
8329 }
8330 else if (type == 437)
8331 {
8332 lifeMax = 400;
8333 defense = 0;
8334 damage = 0;
8335 width = 54;
8336 height = 54;
8337 aiStyle = 83;
8340 value = 0f;
8341 npcSlots = 0f;
8342 knockBackResist = 0f;
8343 noGravity = true;
8344 noTileCollide = true;
8345 dontTakeDamage = true;
8346 netAlways = true;
8347 chaseable = false;
8348 }
8349 else if (type == 438)
8350 {
8351 lifeMax = 400;
8352 defense = 0;
8353 damage = 0;
8354 width = 22;
8355 height = 40;
8356 aiStyle = 83;
8359 value = 0f;
8360 npcSlots = 0f;
8361 knockBackResist = 0f;
8362 lavaImmune = true;
8363 netAlways = true;
8364 chaseable = false;
8365 }
8366 else if (type == 439)
8367 {
8368 width = 24;
8369 height = 50;
8370 aiStyle = 84;
8371 damage = 50;
8372 defense = 42;
8373 lifeMax = 32000;
8374 knockBackResist = 0f;
8375 noTileCollide = true;
8376 noGravity = true;
8377 npcSlots = 10f;
8380 value = 100000f;
8381 boss = true;
8382 netAlways = true;
8384 }
8385 else if (type == 440)
8386 {
8387 width = 24;
8388 height = 50;
8389 aiStyle = 84;
8390 damage = 0;
8391 defense = 35;
8392 lifeMax = 10000;
8393 knockBackResist = 0f;
8394 noTileCollide = true;
8395 noGravity = true;
8396 npcSlots = 0f;
8399 netAlways = true;
8401 chaseable = false;
8402 }
8403 else if (type == 442)
8404 {
8405 width = 14;
8406 height = 14;
8407 aiStyle = 24;
8408 damage = 0;
8409 defense = 0;
8410 lifeMax = 5;
8412 knockBackResist = 0.8f;
8414 catchItem = 2889;
8415 npcSlots = 0.4f;
8416 rarity = 3;
8417 }
8418 else if (type == 443)
8419 {
8420 width = 18;
8421 height = 20;
8422 aiStyle = 7;
8423 damage = 0;
8424 defense = 0;
8425 lifeMax = 5;
8428 catchItem = 2890;
8429 rarity = 3;
8430 }
8431 else if (type == 444)
8432 {
8433 width = 10;
8434 height = 10;
8435 aiStyle = 65;
8436 damage = 0;
8437 defense = 0;
8438 lifeMax = 5;
8441 npcSlots = 0.25f;
8442 noGravity = true;
8443 catchItem = 2891;
8444 rarity = 3;
8445 }
8446 else if (type == 445)
8447 {
8448 width = 12;
8449 height = 10;
8450 aiStyle = 7;
8451 damage = 0;
8452 defense = 0;
8453 lifeMax = 5;
8456 catchItem = 2892;
8457 rarity = 3;
8458 }
8459 else if (type == 446)
8460 {
8461 width = 14;
8462 height = 10;
8463 aiStyle = 1;
8464 damage = 0;
8465 defense = 0;
8466 lifeMax = 5;
8469 friendly = true;
8470 catchItem = 2893;
8471 npcSlots = 0.1f;
8472 rarity = 3;
8473 }
8474 else if (type == 447)
8475 {
8476 width = 14;
8477 height = 12;
8478 aiStyle = 7;
8479 damage = 0;
8480 defense = 0;
8481 lifeMax = 5;
8484 npcSlots = 0.25f;
8485 catchItem = 2894;
8486 rarity = 3;
8487 }
8488 else if (type == 448)
8489 {
8490 width = 10;
8491 height = 4;
8492 aiStyle = 66;
8493 damage = 0;
8494 defense = 0;
8495 lifeMax = 5;
8498 npcSlots = 0.1f;
8499 catchItem = 2895;
8500 friendly = true;
8501 rarity = 3;
8502 }
8503 else if (type == 449)
8504 {
8505 width = 18;
8506 height = 40;
8507 aiStyle = 3;
8508 damage = 20;
8509 defense = 8;
8510 lifeMax = 60;
8513 knockBackResist = 0.5f;
8514 value = 100f;
8515 }
8516 else if (type == 450)
8517 {
8518 width = 18;
8519 height = 40;
8520 aiStyle = 3;
8521 damage = 20;
8522 defense = 12;
8523 lifeMax = 55;
8526 knockBackResist = 0.5f;
8527 value = 130f;
8528 }
8529 else if (type == 451)
8530 {
8531 width = 18;
8532 height = 40;
8533 aiStyle = 3;
8534 damage = 18;
8535 defense = 8;
8536 lifeMax = 65;
8539 knockBackResist = 0.5f;
8540 value = 120f;
8541 }
8542 else if (type == 452)
8543 {
8544 width = 18;
8545 height = 40;
8546 aiStyle = 3;
8547 damage = 22;
8548 defense = 8;
8549 lifeMax = 60;
8552 knockBackResist = 0.5f;
8553 value = 110f;
8554 }
8555 else if (type == 453)
8556 {
8557 friendly = true;
8558 width = 18;
8559 height = 40;
8560 aiStyle = 7;
8561 damage = 10;
8562 defense = 30;
8563 lifeMax = 250;
8566 knockBackResist = 0.5f;
8567 npcSlots = 7f;
8568 rarity = 1;
8569 }
8570 else if (type == 454)
8571 {
8572 noTileCollide = true;
8573 npcSlots = 5f;
8574 width = 32;
8575 height = 32;
8576 aiStyle = 6;
8577 netAlways = true;
8578 damage = 100;
8579 defense = 15;
8580 lifeMax = 10000;
8583 noGravity = true;
8584 knockBackResist = 0f;
8585 value = 0f;
8586 scale = 1f;
8587 alpha = 255;
8588 }
8589 else if (type == 459)
8590 {
8591 noTileCollide = true;
8592 width = 32;
8593 height = 32;
8594 aiStyle = 6;
8595 netAlways = true;
8596 damage = 50;
8597 defense = 30;
8598 lifeMax = 10000;
8601 noGravity = true;
8602 knockBackResist = 0f;
8603 value = 0f;
8604 scale = 1f;
8605 alpha = 255;
8606 dontCountMe = true;
8607 }
8608 else if (type == 455 || type == 456 || type == 457 || type == 458)
8609 {
8610 noTileCollide = true;
8611 width = 32;
8612 height = 32;
8613 aiStyle = 6;
8614 netAlways = true;
8615 damage = 50;
8616 defense = 30;
8617 lifeMax = 10000;
8620 noGravity = true;
8621 knockBackResist = 0f;
8622 value = 0f;
8623 scale = 1f;
8624 alpha = 255;
8625 dontCountMe = true;
8626 }
8627 else if (type == 464)
8628 {
8629 width = 18;
8630 height = 20;
8631 aiStyle = 3;
8632 damage = 21;
8633 defense = 5;
8634 lifeMax = 75;
8637 value = 500f;
8638 }
8639 else if (type == 465)
8640 {
8641 noGravity = true;
8642 width = 18;
8643 height = 20;
8644 aiStyle = 16;
8645 damage = 31;
8646 defense = 7;
8647 lifeMax = 110;
8650 value = 500f;
8651 }
8652 else if (type == 470)
8653 {
8654 width = 16;
8655 height = 34;
8656 aiStyle = 3;
8657 damage = 21;
8658 defense = 5;
8659 lifeMax = 75;
8662 value = 500f;
8663 }
8664 else if (type == 473 || type == 474 || type == 475 || type == 476)
8665 {
8666 width = 28;
8667 height = 44;
8668 aiStyle = 87;
8669 damage = 90;
8670 defense = 34;
8671 lifeMax = 3500;
8674 value = 30000f;
8675 knockBackResist = 0.1f;
8676 rarity = 5;
8677 }
8678 else if (type == 480)
8679 {
8680 width = 18;
8681 height = 40;
8682 aiStyle = 3;
8683 damage = 30;
8684 defense = 20;
8685 lifeMax = 400;
8688 knockBackResist = 0.15f;
8689 value = 1000f;
8690 rarity = 1;
8691 }
8692 else if (type == 481)
8693 {
8694 width = 18;
8695 height = 40;
8696 aiStyle = 3;
8697 damage = 22;
8698 defense = 10;
8699 lifeMax = 70;
8702 knockBackResist = 0.4f;
8703 value = 300f;
8704 }
8705 else if (type == 482)
8706 {
8707 width = 28;
8708 height = 48;
8709 aiStyle = 3;
8710 damage = 30;
8711 defense = 18;
8712 lifeMax = 110;
8715 knockBackResist = 0.35f;
8716 value = 500f;
8717 }
8718 else if (type == 483)
8719 {
8720 npcSlots = 0.5f;
8721 width = 20;
8722 height = 30;
8723 aiStyle = 91;
8724 damage = 24;
8725 defense = 8;
8726 lifeMax = 40;
8728 knockBackResist = 0.6f;
8730 value = 1000f;
8731 }
8732 else if (type >= 484 && type <= 487)
8733 {
8734 width = 10;
8735 height = 4;
8736 aiStyle = 66;
8737 damage = 0;
8738 defense = 0;
8739 lifeMax = 5;
8742 npcSlots = 0.1f;
8743 catchItem = (short)(3191 + type - 484);
8744 friendly = true;
8745 }
8746 else if (type == 488)
8747 {
8748 width = 18;
8749 height = 40;
8750 aiStyle = 92;
8751 damage = 0;
8752 defense = 0;
8753 lifeMax = 1000;
8756 knockBackResist = 0f;
8757 value = 0f;
8758 immortal = true;
8759 netAlways = true;
8760 }
8761 else if (type == 489)
8762 {
8763 width = 18;
8764 height = 40;
8765 aiStyle = 3;
8766 damage = 20;
8767 defense = 8;
8768 lifeMax = 75;
8771 knockBackResist = 0.4f;
8772 value = 150f;
8773 }
8774 else if (type == 490)
8775 {
8776 noGravity = true;
8777 width = 28;
8778 height = 30;
8779 aiStyle = 22;
8780 damage = 28;
8781 defense = 14;
8782 lifeMax = 50;
8784 knockBackResist = 0.6f;
8786 value = 150f;
8787 }
8788 else if (type == 491)
8789 {
8790 noGravity = true;
8791 width = 350;
8792 height = 120;
8793 aiStyle = 93;
8794 damage = 0;
8795 defense = 100;
8796 lifeMax = 50;
8798 knockBackResist = 0f;
8800 value = 0f;
8801 dontTakeDamage = true;
8802 netAlways = true;
8803 }
8804 else if (type == 492)
8805 {
8806 lifeMax = 2000;
8807 defense = 20;
8808 damage = 30;
8809 width = 30;
8810 height = 30;
8811 aiStyle = 75;
8814 value = 0f;
8815 npcSlots = 1f;
8816 knockBackResist = 0f;
8817 noGravity = true;
8818 noTileCollide = true;
8819 hide = true;
8820 netAlways = true;
8821 }
8822 else if (type >= 494 && type <= 495)
8823 {
8824 width = 28;
8825 height = 22;
8826 aiStyle = 3;
8827 damage = 28;
8828 defense = 6;
8829 lifeMax = 50;
8832 value = 120f;
8833 }
8834 else if (type >= 496 && type <= 497)
8835 {
8836 width = 28;
8837 height = 22;
8838 aiStyle = 39;
8839 damage = 16;
8840 defense = 12;
8841 lifeMax = 50;
8844 knockBackResist = 0.75f;
8845 value = 120f;
8846 }
8847 else if (type >= 498 && type <= 506)
8848 {
8849 width = 24;
8850 height = 44;
8851 aiStyle = 3;
8852 damage = 18;
8853 defense = 10;
8854 lifeMax = 65;
8857 knockBackResist = 0.45f;
8858 value = 120f;
8859 }
8860 else if (type == 441)
8861 {
8862 townNPC = true;
8863 friendly = true;
8864 width = 18;
8865 height = 40;
8866 aiStyle = 7;
8867 damage = 10;
8868 defense = 15;
8869 lifeMax = 250;
8872 knockBackResist = 0.5f;
8873 }
8874 else if (type == 513)
8875 {
8876 npcSlots = 4f;
8877 width = 22;
8878 height = 22;
8879 aiStyle = 6;
8880 damage = 18;
8881 defense = 0;
8882 lifeMax = 60;
8885 noGravity = true;
8886 noTileCollide = true;
8887 knockBackResist = 0f;
8888 behindTiles = true;
8889 value = 130f;
8890 }
8891 else if (type == 514)
8892 {
8893 width = 22;
8894 height = 22;
8895 aiStyle = 6;
8896 netAlways = true;
8897 damage = 7;
8898 defense = 12;
8899 lifeMax = 60;
8902 noGravity = true;
8903 noTileCollide = true;
8904 knockBackResist = 0f;
8905 behindTiles = true;
8906 value = 130f;
8907 dontCountMe = true;
8908 npcSlots = 0f;
8909 }
8910 else if (type == 515)
8911 {
8912 width = 22;
8913 height = 22;
8914 aiStyle = 6;
8915 netAlways = true;
8916 damage = 7;
8917 defense = 14;
8918 lifeMax = 60;
8921 noGravity = true;
8922 noTileCollide = true;
8923 knockBackResist = 0f;
8924 behindTiles = true;
8925 value = 130f;
8926 dontCountMe = true;
8927 npcSlots = 0f;
8928 }
8929 else if (type == 510)
8930 {
8931 npcSlots = 5f;
8932 width = 34;
8933 height = 34;
8934 aiStyle = 6;
8935 damage = 58;
8936 defense = 18;
8937 lifeMax = 500;
8940 noGravity = true;
8941 noTileCollide = true;
8942 knockBackResist = 0f;
8943 behindTiles = true;
8944 value = 700f;
8945 }
8946 else if (type == 511)
8947 {
8948 width = 34;
8949 height = 34;
8950 aiStyle = 6;
8951 netAlways = true;
8952 damage = 54;
8953 defense = 28;
8954 lifeMax = 500;
8957 noGravity = true;
8958 noTileCollide = true;
8959 knockBackResist = 0f;
8960 behindTiles = true;
8961 value = 700f;
8962 dontCountMe = true;
8963 npcSlots = 0f;
8964 }
8965 else if (type == 512)
8966 {
8967 width = 34;
8968 height = 34;
8969 aiStyle = 6;
8970 netAlways = true;
8971 damage = 50;
8972 defense = 34;
8973 lifeMax = 500;
8976 noGravity = true;
8977 noTileCollide = true;
8978 knockBackResist = 0f;
8979 behindTiles = true;
8980 value = 700f;
8981 dontCountMe = true;
8982 npcSlots = 0f;
8983 }
8984 else if (type == 508)
8985 {
8986 width = 50;
8987 height = 31;
8988 aiStyle = 3;
8989 damage = 38;
8990 defense = 16;
8991 lifeMax = 110;
8994 knockBackResist = 0.4f;
8995 value = 175f;
8996 }
8997 else if (type == 509)
8998 {
8999 width = 40;
9000 height = 31;
9001 aiStyle = 44;
9002 damage = 34;
9003 defense = 12;
9004 lifeMax = 90;
9005 knockBackResist = 0.3f;
9008 value = 195f;
9009 }
9010 else if (type == 580)
9011 {
9012 width = 26;
9013 height = 26;
9014 aiStyle = 3;
9015 damage = 25;
9016 defense = 10;
9017 lifeMax = 80;
9020 knockBackResist = 0.5f;
9021 value = 80f;
9022 npcSlots = 0.8f;
9023 }
9024 else if (type == 581)
9025 {
9026 width = 30;
9027 height = 22;
9028 aiStyle = 44;
9029 damage = 29;
9030 defense = 8;
9031 lifeMax = 60;
9032 knockBackResist = 0.5f;
9035 value = 90f;
9036 npcSlots = 0.8f;
9037 }
9038 else if (type >= 524 && type <= 527)
9039 {
9040 width = 24;
9041 height = 44;
9042 aiStyle = 3;
9043 damage = 50;
9044 defense = 26;
9045 lifeMax = 180;
9048 knockBackResist = 0.6f;
9049 value = 500f;
9050 npcSlots = 0.5f;
9051 switch (type)
9052 {
9053 case 525:
9054 lifeMax += 70;
9055 defense += 4;
9056 damage += 10;
9057 knockBackResist -= 0.1f;
9058 value += 150f;
9059 break;
9060 case 526:
9061 lifeMax += 40;
9062 defense += 6;
9063 damage += 14;
9064 knockBackResist -= 0.1f;
9065 value += 150f;
9066 break;
9067 case 527:
9068 lifeMax += 120;
9069 defense += 6;
9070 damage += 4;
9071 knockBackResist -= 0.2f;
9072 value += 250f;
9073 break;
9074 }
9075 }
9076 else if (type >= 528 && type <= 529)
9077 {
9078 width = 24;
9079 height = 44;
9080 aiStyle = 3;
9081 damage = 52;
9082 defense = 28;
9083 lifeMax = 350;
9086 knockBackResist = 0.35f;
9087 value = 600f;
9088 }
9089 else if (type == 530)
9090 {
9091 width = 50;
9092 height = 20;
9093 aiStyle = 3;
9094 damage = 66;
9095 defense = 24;
9096 lifeMax = 320;
9099 knockBackResist = 0.5f;
9100 value = 600f;
9102 }
9103 else if (type == 531)
9104 {
9105 noGravity = true;
9106 width = 36;
9107 height = 36;
9108 aiStyle = 40;
9109 damage = 66;
9110 defense = 24;
9111 lifeMax = 320;
9114 knockBackResist = 0.5f;
9115 value = 600f;
9117 }
9118 else if (type == 532)
9119 {
9120 width = 32;
9121 height = 31;
9122 aiStyle = 3;
9123 damage = 65;
9124 defense = 34;
9125 lifeMax = 270;
9128 knockBackResist = 0.3f;
9129 value = 800f;
9130 npcSlots = 0.75f;
9131 }
9132 else if (type == 533)
9133 {
9134 width = 28;
9135 height = 62;
9136 aiStyle = 8;
9137 damage = 40;
9138 defense = 20;
9139 lifeMax = 220;
9142 knockBackResist = 0f;
9143 value = 1200f;
9144 npcSlots = 2f;
9145 }
9146 else if (type == 493)
9147 {
9148 lifeMax = 20000;
9149 defense = 20;
9150 damage = 0;
9151 width = 130;
9152 height = 270;
9153 aiStyle = 94;
9156 value = 0f;
9157 knockBackResist = 0f;
9158 noGravity = true;
9159 noTileCollide = true;
9160 npcSlots = 0f;
9161 }
9162 else if (type == 402)
9163 {
9164 noTileCollide = true;
9165 npcSlots = 1f;
9166 width = 32;
9167 height = 32;
9168 aiStyle = 6;
9169 netAlways = true;
9170 damage = 80;
9171 defense = 10;
9172 lifeMax = 1200;
9175 noGravity = true;
9176 knockBackResist = 0f;
9177 value = 0f;
9178 scale = 1f;
9179 }
9180 else if (type == 405)
9181 {
9182 width = 44;
9183 height = 44;
9184 aiStyle = 85;
9185 damage = 120;
9186 defense = 50;
9187 lifeMax = 300;
9190 knockBackResist = 0.3f;
9191 noGravity = true;
9192 npcSlots = 2f;
9193 }
9194 else if (type == 406)
9195 {
9196 width = 22;
9197 height = 22;
9198 aiStyle = 95;
9199 damage = 70;
9200 defense = 0;
9201 lifeMax = 300;
9204 knockBackResist = 0.4f;
9205 noGravity = true;
9206 }
9207 else if (type == 411)
9208 {
9209 width = 22;
9210 height = 56;
9211 aiStyle = 3;
9212 damage = 80;
9213 defense = 34;
9214 lifeMax = 700;
9217 knockBackResist = 0.4f;
9218 }
9219 else if (type == 409)
9220 {
9221 width = 34;
9222 height = 42;
9223 aiStyle = 3;
9224 damage = 70;
9225 defense = 40;
9226 lifeMax = 800;
9229 knockBackResist = 0.4f;
9230 npcSlots = 3f;
9231 }
9232 else if (type == 410)
9233 {
9234 width = 22;
9235 height = 22;
9236 aiStyle = 26;
9237 damage = 80;
9238 defense = 10;
9239 lifeMax = 200;
9242 knockBackResist = 0.3f;
9243 npcSlots = 0.5f;
9244 }
9245 else if (type == 407)
9246 {
9247 width = 40;
9248 height = 60;
9249 aiStyle = 96;
9250 damage = 70;
9251 defense = 38;
9252 lifeMax = 1500;
9255 noGravity = true;
9256 knockBackResist = 0.03f;
9257 npcSlots = 3f;
9258 }
9259 else if (type == 507)
9260 {
9261 lifeMax = 20000;
9262 defense = 20;
9263 damage = 0;
9264 width = 130;
9265 height = 270;
9266 aiStyle = 94;
9269 value = 0f;
9270 knockBackResist = 0f;
9271 noGravity = true;
9272 noTileCollide = true;
9273 npcSlots = 0f;
9274 }
9275 else if (type == 423)
9276 {
9277 width = 50;
9278 height = 44;
9279 aiStyle = 26;
9280 damage = 90;
9281 defense = 46;
9282 lifeMax = 850;
9285 knockBackResist = 0.2f;
9286 npcSlots = 1f;
9287 }
9288 else if (type == 421)
9289 {
9290 width = 44;
9291 height = 44;
9292 aiStyle = 85;
9293 damage = 70;
9294 defense = 34;
9295 lifeMax = 330;
9298 knockBackResist = 0.5f;
9299 noGravity = true;
9300 npcSlots = 1f;
9301 }
9302 else if (type == 424)
9303 {
9304 width = 22;
9305 height = 56;
9306 aiStyle = 3;
9307 damage = 80;
9308 defense = 30;
9309 lifeMax = 700;
9312 knockBackResist = 0.6f;
9313 npcSlots = 2f;
9314 }
9315 else if (type == 420)
9316 {
9317 width = 40;
9318 height = 40;
9319 aiStyle = 97;
9320 damage = 75;
9321 defense = 20;
9322 lifeMax = 1300;
9325 knockBackResist = 0.5f;
9326 noTileCollide = true;
9327 noGravity = true;
9328 npcSlots = 3f;
9329 }
9330 else if (type == 422)
9331 {
9332 lifeMax = 20000;
9333 defense = 20;
9334 damage = 0;
9335 width = 130;
9336 height = 270;
9337 aiStyle = 94;
9340 value = 0f;
9341 knockBackResist = 0f;
9342 noGravity = true;
9343 noTileCollide = true;
9344 npcSlots = 0f;
9345 }
9346 else if (type == 425)
9347 {
9348 width = 30;
9349 height = 56;
9350 aiStyle = 3;
9351 damage = 100;
9352 defense = 40;
9353 lifeMax = 800;
9356 knockBackResist = 0.4f;
9357 }
9358 else if (type == 429)
9359 {
9360 width = 22;
9361 height = 56;
9362 aiStyle = 3;
9363 damage = 90;
9364 defense = 34;
9365 lifeMax = 700;
9368 knockBackResist = 0.6f;
9369 npcSlots = 2f;
9370 }
9371 else if (type == 428)
9372 {
9373 width = 24;
9374 height = 26;
9375 aiStyle = 3;
9376 damage = 50;
9377 defense = 6;
9378 lifeMax = 200;
9381 }
9382 else if (type == 427)
9383 {
9384 width = 40;
9385 height = 28;
9386 aiStyle = 3;
9387 damage = 75;
9388 defense = 20;
9389 lifeMax = 500;
9392 knockBackResist = 0.5f;
9393 npcSlots = 0.5f;
9394 }
9395 else if (type == 426)
9396 {
9397 width = 50;
9398 height = 62;
9399 aiStyle = 3;
9400 damage = 100;
9401 defense = 44;
9402 lifeMax = 1000;
9405 knockBackResist = 0.3f;
9406 }
9407 else if (type == 517)
9408 {
9409 lifeMax = 20000;
9410 defense = 20;
9411 damage = 0;
9412 width = 130;
9413 height = 270;
9414 aiStyle = 94;
9417 value = 0f;
9418 knockBackResist = 0f;
9419 noGravity = true;
9420 noTileCollide = true;
9421 npcSlots = 0f;
9422 }
9423 else if (type == 412)
9424 {
9425 width = 20;
9426 height = 20;
9427 aiStyle = 6;
9428 netAlways = true;
9429 damage = 120;
9430 defense = 1000;
9431 lifeMax = 10000;
9434 noGravity = true;
9435 noTileCollide = true;
9436 knockBackResist = 0f;
9437 dontTakeDamage = true;
9438 npcSlots = 2f;
9439 }
9440 else if (type == 413)
9441 {
9442 width = 20;
9443 height = 20;
9444 aiStyle = 6;
9445 netAlways = true;
9446 damage = 80;
9447 defense = 1000;
9448 lifeMax = 10000;
9451 noGravity = true;
9452 noTileCollide = true;
9453 knockBackResist = 0f;
9454 dontCountMe = true;
9455 dontTakeDamage = true;
9456 npcSlots = 0f;
9457 }
9458 else if (type == 414)
9459 {
9460 width = 20;
9461 height = 20;
9462 aiStyle = 6;
9463 netAlways = true;
9464 damage = 50;
9465 defense = 0;
9466 lifeMax = 10000;
9469 noGravity = true;
9470 noTileCollide = true;
9471 knockBackResist = 0f;
9472 dontCountMe = true;
9474 npcSlots = 0f;
9475 }
9476 else if (type == 415)
9477 {
9478 lifeMax = 800;
9479 defense = 32;
9480 damage = 55;
9481 width = 60;
9482 height = 40;
9483 aiStyle = 3;
9486 knockBackResist = 0.2f;
9487 }
9488 else if (type == 416)
9489 {
9490 damage = 80;
9491 defense = 28;
9492 lifeMax = 800;
9493 width = 18;
9494 height = 40;
9495 aiStyle = 75;
9498 knockBackResist = 0.2f;
9499 }
9500 else if (type == 518)
9501 {
9502 lifeMax = 1000;
9503 defense = 28;
9504 damage = 80;
9505 width = 22;
9506 height = 56;
9507 aiStyle = 3;
9510 knockBackResist = 0.4f;
9511 }
9512 else if (type == 417)
9513 {
9514 npcSlots = 2f;
9515 width = 46;
9516 height = 52;
9517 aiStyle = 39;
9518 damage = 80;
9519 defense = 34;
9520 lifeMax = 700;
9522 knockBackResist = 0f;
9524 }
9525 else if (type == 418)
9526 {
9527 width = 38;
9528 height = 38;
9529 aiStyle = 74;
9530 damage = 70;
9531 defense = 26;
9532 lifeMax = 600;
9535 noGravity = true;
9536 noTileCollide = true;
9537 knockBackResist = 0.2f;
9538 }
9539 else if (type == 419)
9540 {
9541 lifeMax = 800;
9542 defense = 30;
9543 damage = 90;
9544 width = 22;
9545 height = 56;
9546 aiStyle = 3;
9549 knockBackResist = 0.4f;
9550 }
9551 else if (type == 516)
9552 {
9553 width = 26;
9554 height = 26;
9555 aiStyle = 9;
9556 damage = 100;
9557 defense = 0;
9558 lifeMax = 1;
9559 HitSound = null;
9560 DeathSound = null;
9561 noGravity = true;
9562 noTileCollide = false;
9563 alpha = 0;
9564 knockBackResist = 0f;
9565 }
9566 else if (type == 519)
9567 {
9568 width = 26;
9569 height = 26;
9570 aiStyle = 99;
9571 damage = 120;
9572 defense = 0;
9573 lifeMax = 1;
9574 HitSound = null;
9575 DeathSound = null;
9576 noGravity = true;
9577 noTileCollide = false;
9578 alpha = 0;
9579 knockBackResist = 0f;
9580 }
9581 else if (type == 162)
9582 {
9583 width = 18;
9584 height = 40;
9585 aiStyle = 3;
9586 damage = 65;
9587 defense = 18;
9588 lifeMax = 350;
9591 knockBackResist = 0.3f;
9592 value = 600f;
9593 }
9594 else if (type == 166)
9595 {
9596 width = 18;
9597 height = 40;
9598 aiStyle = 3;
9599 damage = 70;
9600 defense = 26;
9601 lifeMax = 450;
9604 knockBackResist = 0.2f;
9605 value = 1000f;
9606 }
9607 else if (type == 253)
9608 {
9609 noGravity = true;
9610 noTileCollide = true;
9611 width = 24;
9612 height = 44;
9613 aiStyle = 22;
9614 damage = 80;
9615 defense = 22;
9616 lifeMax = 700;
9619 alpha = 100;
9620 value = 1500f;
9621 knockBackResist = 0.6f;
9622 }
9623 else if (type == 158)
9624 {
9625 npcSlots = 2f;
9626 width = 22;
9627 height = 22;
9628 aiStyle = 14;
9629 damage = 60;
9630 defense = 32;
9631 lifeMax = 750;
9633 knockBackResist = 0.75f;
9635 value = 5000f;
9636 }
9637 else if (type == 159)
9638 {
9639 npcSlots = 2f;
9640 width = 18;
9641 height = 40;
9642 aiStyle = 3;
9643 damage = 80;
9644 defense = 24;
9645 lifeMax = 750;
9648 knockBackResist = 0.4f;
9649 value = 5000f;
9650 }
9651 else if (type == 460)
9652 {
9653 width = 18;
9654 height = 40;
9655 aiStyle = 3;
9656 damage = 70;
9657 defense = 30;
9658 lifeMax = 700;
9661 knockBackResist = 0.25f;
9662 value = 1000f;
9663 }
9664 else if (type == 461)
9665 {
9666 width = 18;
9667 height = 40;
9668 aiStyle = 3;
9669 damage = 60;
9670 defense = 22;
9671 lifeMax = 400;
9674 knockBackResist = 0.3f;
9675 value = 1000f;
9676 }
9677 else if (type == 462)
9678 {
9679 width = 20;
9680 height = 24;
9681 aiStyle = 3;
9682 damage = 70;
9683 defense = 14;
9684 lifeMax = 270;
9687 knockBackResist = 0.7f;
9688 value = 600f;
9689 npcSlots = 0.5f;
9690 }
9691 else if (type == 463)
9692 {
9693 width = 18;
9694 height = 40;
9695 aiStyle = 3;
9696 damage = 100;
9697 defense = 34;
9698 lifeMax = 4000;
9701 knockBackResist = 0.1f;
9702 value = 3000f;
9703 }
9704 else if (type == 466)
9705 {
9706 width = 18;
9707 height = 40;
9708 aiStyle = 3;
9709 damage = 70;
9710 defense = 40;
9711 lifeMax = 550;
9714 knockBackResist = 0.5f;
9715 value = 1500f;
9716 }
9717 else if (type == 467)
9718 {
9719 width = 22;
9720 height = 22;
9721 aiStyle = 85;
9722 damage = 100;
9723 defense = 80;
9724 lifeMax = 350;
9727 value = 900f;
9728 knockBackResist = 0.7f;
9729 noGravity = true;
9730 }
9731 else if (type == 469)
9732 {
9733 width = 38;
9734 height = 26;
9735 aiStyle = 3;
9736 damage = 68;
9737 defense = 28;
9738 lifeMax = 600;
9741 knockBackResist = 0.35f;
9742 value = 1300f;
9743 }
9744 else if (type == 468)
9745 {
9746 width = 18;
9747 height = 40;
9748 aiStyle = 3;
9749 damage = 65;
9750 defense = 24;
9751 lifeMax = 500;
9754 knockBackResist = 0.6f;
9755 value = 1300f;
9756 }
9757 else if (type == 477)
9758 {
9759 noGravity = true;
9760 netAlways = true;
9761 width = 80;
9762 height = 50;
9763 aiStyle = 88;
9764 damage = 80;
9765 defense = 30;
9766 lifeMax = 6000;
9769 value = 50000f;
9770 knockBackResist = 0.2f;
9771 rarity = 1;
9772 }
9773 else if (type == 478)
9774 {
9775 width = 34;
9776 height = 34;
9777 aiStyle = 89;
9778 damage = 0;
9779 defense = 30;
9780 lifeMax = 200;
9783 value = 0f;
9784 knockBackResist = 0.7f;
9785 npcSlots = 0f;
9786 }
9787 else if (type == 479)
9788 {
9789 width = 46;
9790 height = 30;
9791 aiStyle = 90;
9792 damage = 50;
9793 defense = 14;
9794 lifeMax = 700;
9797 knockBackResist = 0.3f;
9798 value = 0f;
9799 npcSlots = 0.1f;
9800 }
9801 else if (type == 26)
9802 {
9803 scale = 0.9f;
9804 width = 18;
9805 height = 38;
9806 aiStyle = 3;
9807 damage = 12;
9808 defense = 4;
9809 lifeMax = 60;
9812 knockBackResist = 0.8f;
9813 value = 100f;
9814 }
9815 else if (type == 27)
9816 {
9817 scale = 0.95f;
9818 width = 18;
9819 height = 38;
9820 aiStyle = 3;
9821 damage = 20;
9822 defense = 6;
9823 lifeMax = 80;
9826 knockBackResist = 0.7f;
9827 value = 200f;
9828 }
9829 else if (type == 28)
9830 {
9831 scale = 1.1f;
9832 width = 18;
9833 height = 38;
9834 aiStyle = 3;
9835 damage = 25;
9836 defense = 8;
9837 lifeMax = 110;
9840 knockBackResist = 0.5f;
9841 value = 150f;
9842 }
9843 else if (type == 29)
9844 {
9845 width = 18;
9846 height = 38;
9847 aiStyle = 8;
9848 damage = 20;
9849 defense = 2;
9850 lifeMax = 40;
9853 knockBackResist = 0.6f;
9854 value = 200f;
9855 }
9856 else if (type == 30)
9857 {
9858 width = 16;
9859 height = 16;
9860 aiStyle = 9;
9861 damage = 20;
9862 defense = 0;
9863 lifeMax = 1;
9866 noGravity = true;
9867 noTileCollide = true;
9868 alpha = 100;
9869 knockBackResist = 0f;
9870 }
9871 else if (type == 111)
9872 {
9873 scale = 0.95f;
9874 width = 18;
9875 height = 38;
9876 aiStyle = 3;
9877 damage = 20;
9878 defense = 6;
9879 lifeMax = 80;
9882 knockBackResist = 0.7f;
9883 value = 200f;
9884 }
9885 else if (type == 471)
9886 {
9887 width = 18;
9888 height = 38;
9889 aiStyle = 3;
9890 damage = 80;
9891 defense = 26;
9892 lifeMax = 2000;
9895 knockBackResist = 0.15f;
9896 value = 5000f;
9897 rarity = 1;
9898 }
9899 else if (type == 472)
9900 {
9901 width = 40;
9902 height = 24;
9903 aiStyle = 86;
9904 damage = 50;
9905 defense = 18;
9906 lifeMax = 180;
9909 knockBackResist = 0f;
9910 value = 0f;
9911 npcSlots = 0.1f;
9912 }
9913 else if (type == 520)
9914 {
9915 width = 34;
9916 height = 110;
9917 aiStyle = 3;
9918 damage = 60;
9919 defense = 40;
9920 lifeMax = 2000;
9923 knockBackResist = 0f;
9924 }
9925 else if (type == 521)
9926 {
9927 width = 60;
9928 height = 60;
9929 aiStyle = 86;
9930 damage = 90;
9931 defense = 30;
9932 lifeMax = 2000;
9935 knockBackResist = 0f;
9936 }
9937 else if (type == 522)
9938 {
9939 width = 26;
9940 height = 26;
9941 aiStyle = 100;
9942 damage = 120;
9943 defense = 0;
9944 lifeMax = 400;
9945 HitSound = null;
9946 DeathSound = null;
9947 noGravity = true;
9948 noTileCollide = true;
9949 alpha = 0;
9950 knockBackResist = 0f;
9951 }
9952 else if (type == 523)
9953 {
9954 width = 42;
9955 height = 42;
9956 aiStyle = 101;
9957 damage = 30;
9958 defense = 0;
9959 lifeMax = 500;
9962 noGravity = true;
9963 noTileCollide = true;
9964 alpha = 0;
9965 knockBackResist = 0f;
9966 chaseable = false;
9967 alpha = 255;
9968 canGhostHeal = false;
9969 }
9970 else if (type == 534)
9971 {
9972 width = 18;
9973 height = 40;
9974 aiStyle = 3;
9975 damage = 14;
9976 defense = 20;
9977 lifeMax = 400;
9980 knockBackResist = 0.3f;
9981 value = 0f;
9982 lavaImmune = true;
9983 netAlways = true;
9984 rarity = 2;
9985 }
9986 else if (type == 535)
9987 {
9988 width = 24;
9989 height = 18;
9990 aiStyle = 1;
9991 damage = 14;
9992 defense = 5;
9993 lifeMax = 50;
9994 scale = 1.1f;
9997 alpha = 0;
9998 value = 40f;
9999 }
10000 else if (type == 536)
10001 {
10002 width = 18;
10003 height = 40;
10004 aiStyle = 3;
10005 damage = 14;
10006 defense = 8;
10007 lifeMax = 200;
10010 knockBackResist = 0.5f;
10011 value = 1000f;
10012 rarity = 2;
10013 }
10014 else if (type == 537)
10015 {
10016 npcSlots = 2f;
10017 width = 30;
10018 height = 24;
10019 aiStyle = 1;
10020 damage = 15;
10021 defense = 5;
10022 lifeMax = 50;
10025 alpha = 50;
10026 color = new Color(255, 250, 0, 0) * 0.2f;
10027 value = 75f;
10028 knockBackResist = 0.7f;
10029 }
10030 else if (type == 538)
10031 {
10032 width = 18;
10033 height = 20;
10034 aiStyle = 7;
10035 damage = 0;
10036 defense = 0;
10037 lifeMax = 5;
10040 catchItem = 3563;
10041 }
10042 else if (type == 539)
10043 {
10044 width = 18;
10045 height = 20;
10046 aiStyle = 7;
10047 damage = 0;
10048 defense = 0;
10049 lifeMax = 5;
10052 catchItem = 3564;
10053 rarity = 3;
10054 }
10055 else if (type == 541)
10056 {
10057 width = 30;
10058 height = 76;
10059 aiStyle = 102;
10060 damage = 40;
10061 defense = 30;
10062 lifeMax = 5000;
10065 knockBackResist = 0.05f;
10066 value = Item.buyPrice(0, 1, 50);
10067 rarity = 2;
10068 }
10069 else if (type == 542)
10070 {
10071 noGravity = true;
10072 width = 100;
10073 height = 24;
10074 aiStyle = 103;
10075 damage = 50;
10076 defense = 20;
10077 lifeMax = 360;
10080 value = 400f;
10081 knockBackResist = 0.9f;
10082 behindTiles = true;
10083 }
10084 else if (type == 543)
10085 {
10086 noGravity = true;
10087 width = 100;
10088 height = 24;
10089 aiStyle = 103;
10090 damage = 60;
10091 defense = 24;
10092 lifeMax = 380;
10095 value = 400f;
10096 knockBackResist = 0.8f;
10097 behindTiles = true;
10098 }
10099 else if (type == 544)
10100 {
10101 noGravity = true;
10102 width = 100;
10103 height = 24;
10104 aiStyle = 103;
10105 damage = 64;
10106 defense = 22;
10107 lifeMax = 400;
10110 value = 400f;
10111 knockBackResist = 0.8f;
10112 behindTiles = true;
10113 }
10114 else if (type == 545)
10115 {
10116 noGravity = true;
10117 width = 100;
10118 height = 24;
10119 aiStyle = 103;
10120 damage = 54;
10121 defense = 26;
10122 lifeMax = 450;
10125 value = 400f;
10126 knockBackResist = 0.7f;
10127 behindTiles = true;
10128 }
10129 else if (type == 546)
10130 {
10131 width = 30;
10132 height = 30;
10133 aiStyle = 26;
10134 damage = 30;
10135 defense = 6;
10136 lifeMax = 50;
10139 knockBackResist = 0.8f;
10140 value = 100f;
10141 }
10142 else if (type == 547)
10143 {
10144 width = 16;
10145 height = 16;
10146 aiStyle = 104;
10147 defense = 10;
10148 lifeMax = 10;
10151 knockBackResist = 1f;
10152 noGravity = true;
10153 noTileCollide = true;
10154 }
10155 else if (type == 548)
10156 {
10157 width = 40;
10158 height = 40;
10159 aiStyle = 105;
10160 defense = 14;
10161 lifeMax = 1000;
10164 knockBackResist = 0f;
10165 friendly = true;
10166 npcSlots = 0f;
10167 hide = true;
10169 {
10170 defense = 18;
10171 lifeMax = 3000;
10172 }
10174 {
10175 defense = 20;
10176 lifeMax = 5000;
10177 }
10178 if (Main.masterMode)
10179 {
10180 lifeMax *= 3;
10181 }
10182 else if (Main.expertMode)
10183 {
10184 lifeMax *= 2;
10185 }
10186 lavaImmune = true;
10188 netAlways = true;
10189 }
10190 else if (type == 549)
10191 {
10192 lifeMax = 5;
10193 defense = 20;
10194 damage = 0;
10195 width = 78;
10196 height = 130;
10197 aiStyle = 106;
10200 value = 0f;
10201 knockBackResist = 0f;
10202 noGravity = true;
10203 noTileCollide = true;
10204 npcSlots = 0f;
10205 behindTiles = true;
10206 dontTakeDamage = true;
10207 lavaImmune = true;
10209 netAlways = true;
10210 }
10211 else if (type == 552)
10212 {
10213 lifeMax = 30;
10214 defense = 14;
10215 damage = 18;
10216 width = 18;
10217 height = 40;
10218 aiStyle = 107;
10221 knockBackResist = 0.2f;
10222 value = 0f;
10223 npcSlots = 0f;
10224 lavaImmune = true;
10226 netAlways = true;
10227 }
10228 else if (type == 553)
10229 {
10230 lifeMax = 170;
10231 defense = 20;
10232 damage = 46;
10233 width = 18;
10234 height = 40;
10235 aiStyle = 107;
10238 knockBackResist = 0.2f;
10239 value = 0f;
10240 npcSlots = 0f;
10241 lavaImmune = true;
10243 netAlways = true;
10244 }
10245 else if (type == 554)
10246 {
10247 lifeMax = 560;
10248 defense = 28;
10249 damage = 70;
10250 width = 18;
10251 height = 40;
10252 aiStyle = 107;
10255 knockBackResist = 0.15f;
10256 value = 0f;
10257 npcSlots = 0f;
10258 lavaImmune = true;
10260 netAlways = true;
10261 }
10262 else if (type == 561)
10263 {
10264 lifeMax = 60;
10265 defense = 18;
10266 damage = 30;
10267 width = 26;
10268 height = 52;
10269 aiStyle = 107;
10272 knockBackResist = 0.1f;
10273 value = 0f;
10274 npcSlots = 0f;
10275 lavaImmune = true;
10277 netAlways = true;
10278 }
10279 else if (type == 562)
10280 {
10281 lifeMax = 300;
10282 defense = 28;
10283 damage = 60;
10284 width = 26;
10285 height = 52;
10286 aiStyle = 107;
10289 knockBackResist = 0.1f;
10290 value = 0f;
10291 npcSlots = 0f;
10292 lavaImmune = true;
10294 netAlways = true;
10295 }
10296 else if (type == 563)
10297 {
10298 lifeMax = 1000;
10299 defense = 38;
10300 damage = 80;
10301 width = 26;
10302 height = 52;
10303 aiStyle = 107;
10306 knockBackResist = 0.05f;
10307 value = 0f;
10308 npcSlots = 0f;
10309 lavaImmune = true;
10311 netAlways = true;
10312 }
10313 else if (type == 555)
10314 {
10315 lifeMax = 50;
10316 defense = 16;
10317 damage = 26;
10318 width = 18;
10319 height = 40;
10320 aiStyle = 107;
10323 knockBackResist = 0.2f;
10324 value = 0f;
10325 npcSlots = 0f;
10326 lavaImmune = true;
10328 netAlways = true;
10329 }
10330 else if (type == 556)
10331 {
10332 lifeMax = 200;
10333 defense = 26;
10334 damage = 55;
10335 width = 18;
10336 height = 40;
10337 aiStyle = 107;
10340 knockBackResist = 0.2f;
10341 value = 0f;
10342 npcSlots = 0f;
10343 lavaImmune = true;
10345 netAlways = true;
10346 }
10347 else if (type == 557)
10348 {
10349 lifeMax = 700;
10350 defense = 34;
10351 damage = 75;
10352 width = 18;
10353 height = 40;
10354 aiStyle = 107;
10357 knockBackResist = 0.15f;
10358 value = 0f;
10359 npcSlots = 0f;
10360 lavaImmune = true;
10362 netAlways = true;
10363 }
10364 else if (type == 558)
10365 {
10366 width = 38;
10367 height = 38;
10368 aiStyle = 108;
10369 damage = 30;
10370 defense = 4;
10371 lifeMax = 60;
10374 noGravity = true;
10375 noTileCollide = true;
10376 knockBackResist = 0.2f;
10377 npcSlots = 0f;
10378 lavaImmune = true;
10380 netAlways = true;
10381 }
10382 else if (type == 559)
10383 {
10384 width = 38;
10385 height = 38;
10386 aiStyle = 108;
10387 damage = 75;
10388 defense = 16;
10389 lifeMax = 180;
10392 noGravity = true;
10393 noTileCollide = true;
10394 knockBackResist = 0.2f;
10395 npcSlots = 0f;
10396 lavaImmune = true;
10398 netAlways = true;
10399 }
10400 else if (type == 560)
10401 {
10402 width = 38;
10403 height = 38;
10404 aiStyle = 108;
10405 damage = 100;
10406 defense = 30;
10407 lifeMax = 600;
10410 noGravity = true;
10411 noTileCollide = true;
10412 knockBackResist = 0.05f;
10413 npcSlots = 0f;
10414 lavaImmune = true;
10416 netAlways = true;
10417 }
10418 else if (type == 550)
10419 {
10420 townNPC = true;
10421 friendly = true;
10422 width = 18;
10423 height = 40;
10424 aiStyle = 7;
10425 damage = 10;
10426 defense = 15;
10427 lifeMax = 250;
10430 knockBackResist = 0.5f;
10431 }
10432 else if (type == 576)
10433 {
10434 lifeMax = 5000;
10435 defense = 34;
10436 damage = 70;
10437 width = 96;
10438 height = 124;
10439 aiStyle = 107;
10442 knockBackResist = 0f;
10443 value = 0f;
10444 npcSlots = 0f;
10445 lavaImmune = true;
10447 netAlways = true;
10448 }
10449 else if (type == 577)
10450 {
10451 lifeMax = 13000;
10452 defense = 40;
10453 damage = 90;
10454 width = 96;
10455 height = 124;
10456 aiStyle = 107;
10459 knockBackResist = 0f;
10460 value = 0f;
10461 npcSlots = 0f;
10462 lavaImmune = true;
10464 netAlways = true;
10465 }
10466 else if (type == 568)
10467 {
10468 lifeMax = 500;
10469 defense = 30;
10470 damage = 50;
10471 width = 18;
10472 height = 40;
10473 aiStyle = 107;
10476 knockBackResist = 0.15f;
10477 value = 0f;
10478 npcSlots = 0f;
10479 lavaImmune = true;
10481 netAlways = true;
10482 }
10483 else if (type == 569)
10484 {
10485 lifeMax = 1400;
10486 defense = 40;
10487 damage = 80;
10488 width = 18;
10489 height = 40;
10490 aiStyle = 107;
10493 knockBackResist = 0.05f;
10494 value = 0f;
10495 npcSlots = 0f;
10496 lavaImmune = true;
10498 netAlways = true;
10499 }
10500 else if (type == 566)
10501 {
10502 lifeMax = 25;
10503 defense = 12;
10504 damage = 18;
10505 width = 18;
10506 height = 40;
10507 aiStyle = 107;
10510 knockBackResist = 0.3f;
10511 value = 0f;
10512 npcSlots = 0f;
10513 lavaImmune = true;
10515 netAlways = true;
10516 }
10517 else if (type == 567)
10518 {
10519 lifeMax = 480;
10520 defense = 22;
10521 damage = 70;
10522 width = 18;
10523 height = 40;
10524 aiStyle = 107;
10527 knockBackResist = 0.2f;
10528 value = 0f;
10529 npcSlots = 0f;
10530 lavaImmune = true;
10532 netAlways = true;
10533 }
10534 else if (type == 572)
10535 {
10536 lifeMax = 260;
10537 defense = 26;
10538 damage = 60;
10539 width = 18;
10540 height = 40;
10541 aiStyle = 107;
10544 knockBackResist = 0.2f;
10545 value = 0f;
10546 npcSlots = 0f;
10547 lavaImmune = true;
10549 netAlways = true;
10550 }
10551 else if (type == 573)
10552 {
10553 lifeMax = 800;
10554 defense = 32;
10555 damage = 80;
10556 width = 18;
10557 height = 40;
10558 aiStyle = 107;
10561 knockBackResist = 0.1f;
10562 value = 0f;
10563 npcSlots = 0f;
10564 lavaImmune = true;
10566 netAlways = true;
10567 }
10568 else if (type == 570)
10569 {
10570 lifeMax = 900;
10571 defense = 30;
10572 damage = 60;
10573 width = 42;
10574 height = 58;
10575 aiStyle = 107;
10578 knockBackResist = 0f;
10579 value = 0f;
10580 npcSlots = 0f;
10581 lavaImmune = true;
10583 netAlways = true;
10584 }
10585 else if (type == 571)
10586 {
10587 lifeMax = 3000;
10588 defense = 40;
10589 damage = 90;
10590 width = 42;
10591 height = 58;
10592 aiStyle = 107;
10595 knockBackResist = 0f;
10596 value = 0f;
10597 npcSlots = 0f;
10598 lavaImmune = true;
10600 netAlways = true;
10601 }
10602 else if (type == 564)
10603 {
10604 lifeMax = 800;
10605 defense = 18;
10606 damage = 40;
10607 width = 34;
10608 height = 62;
10609 aiStyle = 109;
10612 knockBackResist = 0f;
10613 value = 0f;
10614 npcSlots = 0f;
10615 noGravity = true;
10616 lavaImmune = true;
10618 netAlways = true;
10619 }
10620 else if (type == 565)
10621 {
10622 lifeMax = 4000;
10623 defense = 38;
10624 damage = 90;
10625 width = 34;
10626 height = 62;
10627 aiStyle = 109;
10630 knockBackResist = 0f;
10631 value = 0f;
10632 npcSlots = 0f;
10633 noGravity = true;
10634 lavaImmune = true;
10636 netAlways = true;
10637 }
10638 else if (type == 574)
10639 {
10640 width = 38;
10641 height = 38;
10642 aiStyle = 108;
10643 damage = 50;
10644 defense = 16;
10645 lifeMax = 170;
10648 noGravity = true;
10649 noTileCollide = true;
10650 knockBackResist = 0.4f;
10651 npcSlots = 0f;
10652 lavaImmune = true;
10654 netAlways = true;
10655 }
10656 else if (type == 575)
10657 {
10658 width = 38;
10659 height = 38;
10660 aiStyle = 108;
10661 damage = 80;
10662 defense = 32;
10663 lifeMax = 580;
10666 noGravity = true;
10667 noTileCollide = true;
10668 knockBackResist = 0.25f;
10669 npcSlots = 0f;
10670 lavaImmune = true;
10672 netAlways = true;
10673 }
10674 else if (type == 551)
10675 {
10676 damage = 80;
10677 defense = 38;
10678 lifeMax = 50000;
10679 width = 190;
10680 height = 90;
10681 aiStyle = 110;
10684 knockBackResist = 0f;
10685 value = 0f;
10686 noGravity = true;
10687 noTileCollide = true;
10688 npcSlots = 0f;
10689 lavaImmune = true;
10691 netAlways = true;
10692 }
10693 else if (type == 578)
10694 {
10695 width = 30;
10696 height = 24;
10697 aiStyle = 111;
10698 damage = 80;
10699 defense = 36;
10700 lifeMax = 500;
10703 noGravity = true;
10704 noTileCollide = true;
10705 knockBackResist = 0.8f;
10706 npcSlots = 0f;
10707 lavaImmune = true;
10709 netAlways = true;
10710 }
10711 else if (type == 579)
10712 {
10713 friendly = true;
10714 width = 34;
10715 height = 8;
10716 aiStyle = 0;
10717 damage = 10;
10718 defense = 15;
10719 lifeMax = 250;
10722 knockBackResist = 0.5f;
10723 scale = 1f;
10724 rarity = 1;
10725 }
10726 else if (type == 582)
10727 {
10728 width = 18;
10729 height = 18;
10730 aiStyle = 3;
10731 damage = 10;
10732 defense = 2;
10733 lifeMax = 30;
10736 knockBackResist = 0.75f;
10737 value = 40f;
10738 npcSlots = 0.4f;
10739 }
10740 else if (type == 583 || type == 584 || type == 585)
10741 {
10742 width = 18;
10743 height = 20;
10744 aiStyle = 112;
10745 damage = 0;
10746 defense = 0;
10747 lifeMax = 5;
10750 switch (type)
10751 {
10752 case 583:
10753 catchItem = 4068;
10754 break;
10755 case 584:
10756 catchItem = 4069;
10757 break;
10758 case 585:
10759 catchItem = 4070;
10760 break;
10761 }
10762 noGravity = true;
10763 rarity = 2;
10764 }
10765 else if (type == 586)
10766 {
10767 width = 18;
10768 height = 40;
10769 aiStyle = 3;
10770 damage = 40;
10771 defense = 20;
10772 lifeMax = 400;
10775 knockBackResist = 0f;
10776 value = 1000f;
10777 alpha = 255;
10778 rarity = 1;
10779 }
10780 else if (type == 587)
10781 {
10782 width = 32;
10783 height = 18;
10784 aiStyle = 44;
10785 damage = 35;
10786 defense = 18;
10787 lifeMax = 300;
10789 knockBackResist = 0f;
10791 value = 1000f;
10792 alpha = 255;
10793 rarity = 1;
10794 }
10795 else if (type == 588)
10796 {
10797 townNPC = true;
10798 friendly = true;
10799 width = 18;
10800 height = 40;
10801 aiStyle = 7;
10802 damage = 10;
10803 defense = 15;
10804 lifeMax = 250;
10807 knockBackResist = 0.5f;
10808 }
10809 else if (type == 589)
10810 {
10811 friendly = true;
10812 width = 18;
10813 height = 34;
10814 aiStyle = 0;
10815 damage = 10;
10816 defense = 15;
10817 lifeMax = 250;
10820 knockBackResist = 0.5f;
10821 rarity = 1;
10822 }
10823 else if (type == 590 || type == 591)
10824 {
10825 width = 18;
10826 height = 40;
10827 aiStyle = 3;
10828 damage = 14;
10829 defense = 6;
10830 lifeMax = 45;
10833 knockBackResist = 0.5f;
10834 value = 60f;
10835 }
10836 else if (type == 592)
10837 {
10838 noGravity = true;
10839 width = 20;
10840 height = 18;
10841 aiStyle = 16;
10842 damage = 0;
10843 defense = 0;
10844 lifeMax = 5;
10847 knockBackResist = 0.5f;
10848 catchItem = 4274;
10849 rarity = 3;
10850 }
10851 else if (type == 593)
10852 {
10853 width = 18;
10854 height = 20;
10855 aiStyle = 7;
10856 damage = 0;
10857 defense = 0;
10858 lifeMax = 5;
10861 catchItem = 4274;
10862 rarity = 3;
10863 }
10864 else if (type == 594)
10865 {
10866 width = 20;
10867 height = 20;
10868 aiStyle = 113;
10869 damage = 0;
10870 defense = 0;
10871 knockBackResist = 0.3f;
10872 lifeMax = 1;
10874 value = 0f;
10875 noGravity = true;
10876 }
10877 else if (type >= 595 && type <= 601)
10878 {
10879 timeLeft *= 3;
10880 width = 10;
10881 height = 10;
10882 aiStyle = 114;
10883 damage = 0;
10884 defense = 0;
10885 lifeMax = 5;
10888 npcSlots = 0.25f;
10889 noGravity = true;
10890 int num2 = type;
10891 if (num2 == 601)
10892 {
10893 rarity = 3;
10894 }
10895 catchItem = (short)(type - 595 + 4334);
10896 }
10897 else if (type == 602)
10898 {
10899 width = 22;
10900 height = 26;
10901 aiStyle = 7;
10902 damage = 0;
10903 defense = 0;
10904 lifeMax = 5;
10907 catchItem = 4359;
10908 }
10909 else if (type == 603)
10910 {
10911 width = 28;
10912 height = 22;
10913 aiStyle = 68;
10914 damage = 0;
10915 defense = 0;
10916 lifeMax = 5;
10919 catchItem = 4359;
10920 }
10921 else if (type == 604 || type == 605)
10922 {
10923 width = 10;
10924 height = 10;
10925 aiStyle = 115;
10926 damage = 0;
10927 defense = 0;
10928 lifeMax = 5;
10931 npcSlots = 0.25f;
10932 noGravity = true;
10933 int num2 = type;
10934 if (num2 == 605)
10935 {
10936 rarity = 3;
10937 }
10938 catchItem = (short)(type - 604 + 4361);
10939 }
10940 else if (type == 606)
10941 {
10942 width = 10;
10943 height = 4;
10944 aiStyle = 66;
10945 damage = 0;
10946 defense = 0;
10947 lifeMax = 5;
10950 npcSlots = 0.1f;
10951 catchItem = 4363;
10952 friendly = true;
10953 }
10954 else if (type == 607)
10955 {
10956 noGravity = true;
10957 width = 20;
10958 height = 18;
10959 aiStyle = 16;
10960 damage = 0;
10961 defense = 0;
10962 lifeMax = 5;
10965 knockBackResist = 0.5f;
10966 catchItem = 4373;
10967 }
10968 else if (type == 608)
10969 {
10970 width = 22;
10971 height = 26;
10972 aiStyle = 7;
10973 damage = 0;
10974 defense = 0;
10975 lifeMax = 5;
10978 catchItem = 4374;
10979 }
10980 else if (type == 609)
10981 {
10982 width = 28;
10983 height = 22;
10984 aiStyle = 68;
10985 damage = 0;
10986 defense = 0;
10987 lifeMax = 5;
10990 catchItem = 4374;
10991 }
10992 else if (type == 610)
10993 {
10994 width = 14;
10995 height = 12;
10996 aiStyle = 7;
10997 damage = 0;
10998 defense = 0;
10999 lifeMax = 5;
11002 npcSlots = 0.25f;
11003 catchItem = 4375;
11004 }
11005 else if (type == 611)
11006 {
11007 width = 18;
11008 height = 34;
11009 aiStyle = 24;
11010 damage = 0;
11011 defense = 0;
11012 lifeMax = 5;
11014 knockBackResist = 0.8f;
11016 catchItem = 4395;
11017 npcSlots = 0.4f;
11018 }
11019 else if (type == 612 || type == 613)
11020 {
11021 width = 10;
11022 height = 10;
11023 aiStyle = 116;
11024 damage = 0;
11025 defense = 0;
11026 lifeMax = 5;
11029 npcSlots = 0.25f;
11030 int num2 = type;
11031 if (num2 == 613)
11032 {
11033 rarity = 3;
11034 }
11035 catchItem = (short)(type - 612 + 4418);
11036 waterMovementSpeed = 1f;
11037 lavaMovementSpeed = 1f;
11038 honeyMovementSpeed = 1f;
11039 }
11040 else if (type == 614)
11041 {
11042 width = 18;
11043 height = 20;
11044 aiStyle = 7;
11045 damage = 0;
11046 defense = 0;
11047 lifeMax = 5;
11049 DeathSound = null;
11050 catchItem = 1338;
11051 }
11052 else if (type == 615)
11053 {
11054 noGravity = true;
11055 width = 20;
11056 height = 18;
11057 aiStyle = 16;
11058 damage = 0;
11059 defense = 0;
11060 lifeMax = 5;
11063 knockBackResist = 0.5f;
11064 }
11065 else if (type == 616 || type == 617)
11066 {
11067 width = 22;
11068 height = 20;
11069 aiStyle = 7;
11070 damage = 0;
11071 defense = 0;
11072 lifeMax = 5;
11075 knockBackResist = 0.5f;
11076 catchItem = (short)(type - 616 + 4464);
11077 }
11078 else if (type == 618)
11079 {
11080 noGravity = true;
11081 width = 100;
11082 height = 100;
11083 aiStyle = 117;
11084 damage = 55;
11085 defense = 24;
11086 lifeMax = 7000;
11089 knockBackResist = 0f;
11090 value = Item.buyPrice(0, 2);
11091 noTileCollide = true;
11092 rarity = 1;
11093 }
11094 else if (type == 619)
11095 {
11096 npcSlots = 1f;
11097 width = 44;
11098 height = 44;
11099 aiStyle = 5;
11100 damage = 60;
11101 defense = 16;
11102 lifeMax = 750;
11105 noGravity = true;
11106 knockBackResist = 0f;
11107 value = 500f;
11108 alpha = 255;
11109 }
11110 else if (type == 620)
11111 {
11112 lifeMax = 5000;
11113 defense = 30;
11114 damage = 70;
11115 width = 34;
11116 height = 58;
11117 aiStyle = 107;
11120 knockBackResist = 0f;
11121 value = Item.buyPrice(0, 0, 75);
11122 npcSlots = 0f;
11123 lavaImmune = true;
11125 netAlways = true;
11126 alpha = 255;
11127 rarity = 1;
11128 }
11129 else if (type == 621)
11130 {
11131 npcSlots = 5f;
11132 width = 28;
11133 height = 28;
11134 aiStyle = 6;
11135 damage = 90;
11136 defense = 0;
11137 lifeMax = 6000;
11140 noGravity = true;
11141 noTileCollide = true;
11142 knockBackResist = 0f;
11143 behindTiles = true;
11144 value = Item.buyPrice(0, 0, 75);
11145 alpha = 255;
11146 rarity = 1;
11147 }
11148 else if (type == 622)
11149 {
11150 width = 28;
11151 height = 28;
11152 aiStyle = 6;
11153 netAlways = true;
11154 damage = 60;
11155 defense = 30;
11156 lifeMax = 6000;
11159 noGravity = true;
11160 noTileCollide = true;
11161 knockBackResist = 0f;
11162 behindTiles = true;
11163 dontCountMe = true;
11164 npcSlots = 0f;
11165 alpha = 255;
11166 }
11167 else if (type == 623)
11168 {
11169 width = 28;
11170 height = 28;
11171 aiStyle = 6;
11172 netAlways = true;
11173 damage = 50;
11174 defense = 40;
11175 lifeMax = 6000;
11178 noGravity = true;
11179 noTileCollide = true;
11180 knockBackResist = 0f;
11181 behindTiles = true;
11182 dontCountMe = true;
11183 npcSlots = 0f;
11184 alpha = 255;
11185 }
11186 else if (type == 624)
11187 {
11188 width = 14;
11189 height = 30;
11190 aiStyle = 3;
11191 damage = 10;
11192 defense = 0;
11193 lifeMax = 25;
11196 knockBackResist = 1f;
11197 rarity = 1;
11198 }
11199 else if (type == 625)
11200 {
11201 width = 22;
11202 height = 20;
11203 aiStyle = 7;
11204 damage = 0;
11205 defense = 0;
11206 lifeMax = 5;
11209 knockBackResist = 0.5f;
11210 }
11211 else if (type == 626 || type == 627)
11212 {
11213 width = 16;
11214 height = 20;
11215 aiStyle = 118;
11216 damage = 0;
11217 defense = 0;
11218 lifeMax = 5;
11221 knockBackResist = 1f;
11222 int num2 = type;
11223 if (num2 == 627)
11224 {
11225 rarity = 3;
11226 }
11227 catchItem = 4480;
11228 if (type == 627)
11229 {
11230 catchItem = 4482;
11231 }
11232 }
11233 else if (type == 628)
11234 {
11235 width = 22;
11236 height = 40;
11237 aiStyle = 119;
11238 damage = 15;
11239 defense = 0;
11240 lifeMax = 50;
11243 knockBackResist = 0f;
11244 value = 50f;
11245 }
11246 else if (type == 629)
11247 {
11248 width = 24;
11249 height = 24;
11250 aiStyle = 25;
11251 damage = 80;
11252 defense = 30;
11253 lifeMax = 500;
11256 value = 100000f;
11257 knockBackResist = 0.3f;
11258 rarity = 4;
11259 coldDamage = true;
11260 if (Main.remixWorld && !Main.hardMode)
11261 {
11262 damage = 30;
11263 defense = 12;
11264 lifeMax = 300;
11265 value = Item.buyPrice(0, 2);
11266 }
11267 }
11268 else if (type == 630)
11269 {
11270 width = 18;
11271 height = 40;
11272 aiStyle = 3;
11273 damage = 60;
11274 defense = 18;
11275 lifeMax = 180;
11278 knockBackResist = 0.5f;
11279 value = 700f;
11280 }
11281 else if (type == 631)
11282 {
11283 width = 36;
11284 height = 48;
11285 scale = 1.1f;
11286 aiStyle = 3;
11287 damage = 85;
11288 defense = 35;
11289 lifeMax = 1000;
11292 knockBackResist = 0.1f;
11293 value = 25000f;
11294 }
11295 else if (type == 632)
11296 {
11297 width = 18;
11298 height = 40;
11299 aiStyle = 3;
11300 damage = 14;
11301 defense = 6;
11302 lifeMax = 45;
11305 knockBackResist = 0.5f;
11306 value = 60f;
11307 }
11308 else if (type == 633)
11309 {
11310 townNPC = true;
11311 friendly = true;
11312 width = 18;
11313 height = 40;
11314 aiStyle = 7;
11315 damage = 10;
11316 defense = 15;
11317 lifeMax = 250;
11320 knockBackResist = 0.5f;
11321 }
11322 else if (type == 634)
11323 {
11324 npcSlots = 0.5f;
11325 width = 22;
11326 height = 18;
11327 aiStyle = 14;
11328 damage = 13;
11329 defense = 2;
11330 lifeMax = 16;
11332 knockBackResist = 0.8f;
11334 value = 90f;
11335 }
11336 else if (type == 635)
11337 {
11338 width = 18;
11339 height = 40;
11340 aiStyle = 3;
11341 damage = 20;
11342 defense = 8;
11343 lifeMax = 60;
11346 knockBackResist = 0.5f;
11347 value = 100f;
11348 }
11349 else if (type == 636)
11350 {
11351 noGravity = true;
11352 width = 100;
11353 height = 100;
11354 aiStyle = 120;
11355 damage = 80;
11356 defense = 50;
11357 lifeMax = 70000;
11360 knockBackResist = 0f;
11361 value = 250000f;
11362 noTileCollide = true;
11363 boss = true;
11364 Opacity = 0f;
11365 dontTakeDamage = true;
11366 npcSlots = 16f;
11367 }
11368 else if (type == 637 || type == 638)
11369 {
11370 townNPC = true;
11371 friendly = true;
11372 width = 18;
11373 height = 28;
11374 if (type == 637)
11375 {
11376 height = 20;
11377 }
11378 aiStyle = 7;
11379 damage = 10;
11380 defense = 15;
11381 lifeMax = 250;
11384 knockBackResist = 0.5f;
11385 housingCategory = 1;
11386 }
11387 else if (type >= 639 && type <= 645)
11388 {
11389 width = 18;
11390 height = 20;
11391 aiStyle = 7;
11392 damage = 0;
11393 defense = 0;
11394 lifeMax = 5;
11397 catchItem = (short)(4831 + (type - 639));
11398 }
11399 else if (type >= 646 && type <= 652)
11400 {
11401 width = 18;
11402 height = 20;
11403 aiStyle = 7;
11404 damage = 0;
11405 defense = 0;
11406 lifeMax = 5;
11409 catchItem = (short)(4838 + (type - 646));
11410 }
11411 else if (type == 653)
11412 {
11413 width = 10;
11414 height = 10;
11415 aiStyle = 65;
11416 damage = 0;
11417 defense = 0;
11418 lifeMax = 5;
11421 npcSlots = 0.25f;
11422 noGravity = true;
11423 lavaImmune = true;
11424 catchItem = 4845;
11425 }
11426 else if (type == 654)
11427 {
11428 width = 10;
11429 height = 10;
11430 aiStyle = 64;
11431 damage = 0;
11432 defense = 0;
11433 lifeMax = 5;
11436 npcSlots = 0.2f;
11437 noGravity = true;
11438 lavaImmune = true;
11439 catchItem = 4847;
11440 }
11441 else if (type == 655)
11442 {
11443 width = 14;
11444 height = 14;
11445 aiStyle = 67;
11446 damage = 0;
11447 defense = 0;
11448 lifeMax = 5;
11451 npcSlots = 0.5f;
11452 noGravity = true;
11453 lavaImmune = true;
11454 catchItem = 4849;
11455 }
11456 else if (type == 656)
11457 {
11458 townNPC = true;
11459 friendly = true;
11460 width = 18;
11461 height = 20;
11462 aiStyle = 7;
11463 damage = 10;
11464 defense = 15;
11465 lifeMax = 250;
11468 knockBackResist = 0.5f;
11469 housingCategory = 1;
11470 }
11471 else if (type == 657)
11472 {
11473 width = 114;
11474 height = 100;
11475 aiStyle = 121;
11476 damage = 60;
11477 defense = 26;
11478 lifeMax = 18000;
11481 lavaImmune = true;
11482 knockBackResist = 0f;
11483 value = 60000f;
11484 boss = true;
11485 npcSlots = 5f;
11486 }
11487 else if (type == 658 || type == 659)
11488 {
11489 width = 24;
11490 height = 18;
11491 aiStyle = 1;
11492 damage = 40;
11493 defense = 35;
11494 lifeMax = 150;
11495 scale = 1f;
11498 }
11499 else if (type == 660)
11500 {
11501 width = 40;
11502 height = 30;
11503 aiStyle = 14;
11504 damage = 50;
11505 defense = 30;
11506 lifeMax = 120;
11509 knockBackResist = 0.8f;
11510 scale = 1f;
11511 }
11512 else if (type == 661)
11513 {
11514 width = 10;
11515 height = 10;
11516 aiStyle = 65;
11517 damage = 0;
11518 defense = 0;
11519 lifeMax = 5;
11522 npcSlots = 0.25f;
11523 noGravity = true;
11524 lavaImmune = true;
11525 catchItem = 4961;
11526 rarity = 4;
11527 }
11528 else if (type == 662)
11529 {
11530 width = 18;
11531 height = 40;
11532 aiStyle = 122;
11533 damage = 75;
11534 defense = 22;
11535 lifeMax = 500;
11538 knockBackResist = 0.2f;
11539 value = 0f;
11540 noTileCollide = true;
11541 lavaImmune = true;
11542 trapImmune = true;
11543 noGravity = true;
11544 }
11545 else if (type == 663)
11546 {
11547 townNPC = true;
11548 friendly = true;
11549 width = 18;
11550 height = 40;
11551 aiStyle = 7;
11552 damage = 10;
11553 defense = 15;
11554 lifeMax = 250;
11557 knockBackResist = 0.5f;
11558 }
11559 else if (type == 664)
11560 {
11561 lifeMax = 20;
11562 boss = true;
11563 }
11564 else if (type == 665)
11565 {
11566 width = 16;
11567 height = 16;
11568 aiStyle = 9;
11569 damage = 20;
11570 defense = 0;
11571 lifeMax = 1;
11574 noGravity = true;
11575 noTileCollide = true;
11576 alpha = 100;
11577 knockBackResist = 0f;
11578 }
11579 else if (type == 666)
11580 {
11581 width = 16;
11582 height = 16;
11583 aiStyle = 9;
11584 damage = 65;
11585 defense = 0;
11586 lifeMax = 1;
11587 HitSound = null;
11589 noGravity = true;
11590 noTileCollide = true;
11591 knockBackResist = 0f;
11592 scale = 0.9f;
11593 alpha = 80;
11594 }
11595 else if (type == 667)
11596 {
11597 width = 24;
11598 height = 18;
11599 aiStyle = 1;
11600 damage = 5;
11601 defense = 5;
11602 lifeMax = 300;
11603 knockBackResist *= 1.4f;
11604 rarity = 2;
11605 scale = 1f;
11606 value = Item.buyPrice(0, 15);
11609 }
11610 else if (type == 668)
11611 {
11612 width = 60;
11613 height = 154;
11614 aiStyle = 123;
11615 damage = 20;
11616 defense = 10;
11617 lifeMax = 7000;
11620 knockBackResist = 0f;
11621 boss = true;
11622 noGravity = true;
11623 noTileCollide = true;
11624 value = Item.buyPrice(0, 5);
11625 npcSlots = 10f;
11626 coldDamage = true;
11627 }
11628 else if (type == 669)
11629 {
11630 width = 10;
11631 height = 10;
11632 aiStyle = 115;
11633 damage = 0;
11634 defense = 0;
11635 lifeMax = 5;
11638 npcSlots = 0.25f;
11639 noGravity = true;
11640 catchItem = 5132;
11641 }
11642 else if (type == 670)
11643 {
11644 townNPC = true;
11645 friendly = true;
11646 width = 18;
11647 height = 20;
11648 aiStyle = 7;
11649 damage = 10;
11650 defense = 15;
11651 lifeMax = 250;
11654 knockBackResist = 0.5f;
11655 housingCategory = 1;
11656 }
11657 else if (type == 671)
11658 {
11659 width = 14;
11660 height = 14;
11661 aiStyle = 24;
11662 damage = 0;
11663 defense = 0;
11664 lifeMax = 5;
11666 knockBackResist = 0.8f;
11668 catchItem = 5212;
11669 npcSlots = 1f;
11670 }
11671 else if (type == 672)
11672 {
11673 width = 14;
11674 height = 14;
11675 aiStyle = 24;
11676 damage = 0;
11677 defense = 0;
11678 lifeMax = 5;
11680 knockBackResist = 0.8f;
11682 catchItem = 5300;
11683 npcSlots = 1f;
11684 }
11685 else if (type == 673)
11686 {
11687 width = 14;
11688 height = 14;
11689 aiStyle = 24;
11690 damage = 0;
11691 defense = 0;
11692 lifeMax = 5;
11694 knockBackResist = 0.8f;
11696 catchItem = 5311;
11697 npcSlots = 1f;
11698 }
11699 else if (type == 674)
11700 {
11701 width = 14;
11702 height = 14;
11703 aiStyle = 24;
11704 damage = 0;
11705 defense = 0;
11706 lifeMax = 5;
11708 knockBackResist = 0.8f;
11710 catchItem = 5312;
11711 npcSlots = 1f;
11712 }
11713 else if (type == 675)
11714 {
11715 width = 14;
11716 height = 14;
11717 aiStyle = 24;
11718 damage = 0;
11719 defense = 0;
11720 lifeMax = 5;
11722 knockBackResist = 0.8f;
11724 catchItem = 5313;
11725 npcSlots = 1f;
11726 }
11727 else if (type == 676)
11728 {
11729 width = 24;
11730 height = 18;
11731 aiStyle = 1;
11732 damage = 20;
11733 defense = 5;
11734 lifeMax = 80;
11735 scale = 1f;
11736 value = Item.buyPrice(0, 0, 1, 50);
11739 }
11740 else if (type == 677)
11741 {
11742 width = 10;
11743 height = 10;
11744 aiStyle = 64;
11745 damage = 0;
11746 defense = 0;
11747 lifeMax = 5;
11750 npcSlots = 0.2f;
11751 noGravity = true;
11752 catchItem = 5350;
11753 noTileCollide = true;
11754 }
11755 else if (type == 678 || type == 679 || type == 680 || type == 681 || type == 682 || type == 683 || type == 684)
11756 {
11757 townNPC = true;
11758 friendly = true;
11759 width = 18;
11760 height = 20;
11761 aiStyle = 7;
11762 damage = 10;
11763 defense = 15;
11764 lifeMax = 250;
11767 knockBackResist = 0.5f;
11768 housingCategory = 1;
11769 }
11770 else if (type == 685)
11771 {
11772 width = 30;
11773 height = 28;
11774 aiStyle = 1;
11775 damage = 0;
11776 defense = 10;
11777 knockBackResist = 0.3f;
11778 lifeMax = 250;
11781 value = 0f;
11782 rarity = 2;
11783 friendly = true;
11784 }
11785 else if (type == 686)
11786 {
11787 width = 20;
11788 height = 20;
11789 aiStyle = 125;
11790 damage = 0;
11791 defense = 0;
11792 knockBackResist = 0.3f;
11793 lifeMax = 1;
11795 value = 0f;
11796 rarity = 2;
11797 noGravity = true;
11798 noTileCollide = true;
11800 }
11801 else if (type == 687)
11802 {
11803 width = 18;
11804 height = 20;
11805 aiStyle = 7;
11806 damage = 0;
11807 defense = 0;
11808 lifeMax = 5;
11809 rarity = 2;
11812 catchItem = 2121;
11813 }
11814 if (Main.dedServ)
11815 {
11816 frame = default(Rectangle);
11817 }
11818 else if (TextureAssets.Npc[type] != null && TextureAssets.Npc[type].IsLoaded)
11819 {
11820 frame = new Rectangle(0, 0, TextureAssets.Npc[type].Width(), TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]);
11821 }
11822 else
11823 {
11824 setFrameSize = true;
11825 }
11826 if (spawnparams.sizeScaleOverride.HasValue)
11827 {
11828 int num3 = (int)((float)width * scale);
11829 int num4 = (int)((float)height * scale);
11830 position.X += num3 / 2;
11831 position.Y += num4;
11832 scale = spawnparams.sizeScaleOverride.Value;
11833 width = (int)((float)width * scale);
11834 height = (int)((float)height * scale);
11835 if (height == 16 || height == 32)
11836 {
11837 height++;
11838 }
11839 position.X -= width / 2;
11840 position.Y -= height;
11841 }
11842 else
11843 {
11844 width = (int)((float)width * scale);
11845 height = (int)((float)height * scale);
11846 }
11847 life = lifeMax;
11848 defDamage = damage;
11850 netID = type;
11852 {
11853 nPCDebuffImmunityData.ApplyToNPC(this);
11854 }
11855 else
11856 {
11857 for (int num5 = 0; num5 < buffImmune.Length; num5++)
11858 {
11859 buffImmune[num5] = false;
11860 }
11861 }
11863 if (Main.zenithWorld)
11864 {
11866 }
11867 if (Main.getGoodWorld)
11868 {
11870 }
11871 else if (Main.tenthAnniversaryWorld)
11872 {
11874 }
11875 if (type >= 0 && type < NPCID.Count && Main.npcCatchable[type])
11876 {
11878 friendly = true;
11879 }
11880 ScaleStats(spawnparams.playerCountForMultiplayerDifficultyOverride, spawnparams.gameModeData, spawnparams.strengthMultiplierOverride);
11881 life = lifeMax;
11882 }
11883
11885 {
11886 float num = scale;
11887 float num2 = 0.5f;
11888 switch (type)
11889 {
11890 case 4:
11891 scale *= num2;
11892 break;
11893 case 13:
11894 case 14:
11895 case 15:
11896 scale *= num2;
11897 break;
11898 case 266:
11899 case 267:
11900 scale *= num2;
11901 break;
11902 case 35:
11903 case 36:
11904 scale *= num2;
11905 break;
11906 case 222:
11907 scale *= num2;
11908 break;
11909 case 113:
11910 case 114:
11911 case 115:
11912 case 116:
11913 scale *= num2;
11914 break;
11915 case 134:
11916 case 135:
11917 case 136:
11918 case 139:
11919 scale *= num2;
11920 break;
11921 case 125:
11922 case 126:
11923 scale *= num2;
11924 break;
11925 case 127:
11926 case 128:
11927 case 129:
11928 case 130:
11929 case 131:
11930 scale *= num2;
11931 break;
11932 case 370:
11933 scale *= num2;
11934 break;
11935 case 636:
11936 scale *= num2;
11937 break;
11938 case 422:
11939 case 493:
11940 case 507:
11941 case 517:
11942 scale *= num2;
11943 break;
11944 }
11946 {
11947 scale = num;
11948 return;
11949 }
11950 width = (int)((float)width * scale);
11951 height = (int)((float)height * scale);
11952 }
11953
11955 {
11956 int num = type;
11957 if ((uint)(num - 125) <= 6u || num == 139)
11958 {
11959 lifeMax = (int)((float)lifeMax * 0.8f);
11960 }
11961 }
11962
11963 private void getGoodAdjustments()
11964 {
11965 float num = scale;
11966 if (type == 13)
11967 {
11968 scale *= 1.35f;
11969 defense += 2;
11970 }
11971 else if (type == 14)
11972 {
11973 scale *= 1.4f;
11974 defense += 2;
11975 }
11976 else if (type == 15)
11977 {
11978 scale *= 1.4f;
11979 defense += 2;
11980 }
11981 else if (type == 35)
11982 {
11983 scale *= 1.25f;
11984 }
11985 else if (type == 36)
11986 {
11987 scale *= 1.15f;
11988 }
11989 else if (type == 113)
11990 {
11991 scale *= 0.65f;
11992 lifeMax = (int)((double)lifeMax * 1.5);
11993 defense += 3;
11994 }
11995 else if (type == 114)
11996 {
11997 scale *= 0.65f;
11998 lifeMax = (int)((double)lifeMax * 1.5);
11999 defense += 3;
12000 }
12001 else if (type == 115)
12002 {
12003 scale *= 1.4f;
12004 }
12005 else if (type == 116)
12006 {
12007 scale *= 1.4f;
12008 }
12009 else if (type == 222)
12010 {
12011 scale *= 1.2f;
12012 }
12013 else if (type == 245)
12014 {
12015 canDisplayBuffs = false;
12016 scale *= 0.5f;
12017 }
12018 else if (type == 246)
12019 {
12020 canDisplayBuffs = false;
12021 scale *= 0.5f;
12022 }
12023 else if (type == 247 || type == 248)
12024 {
12025 canDisplayBuffs = false;
12026 scale *= 0.5f;
12027 }
12028 else if (type == 249)
12029 {
12030 scale *= 0.5f;
12031 }
12032 else if (type == 262)
12033 {
12034 scale *= 1.3f;
12035 }
12036 else if (type == 266)
12037 {
12038 defense = (int)((double)defense * 1.5);
12039 damage = (int)((double)damage * 1.2);
12040 scale *= 1.1f;
12041 }
12042 else if (type == 125)
12043 {
12044 scale *= 0.8f;
12045 }
12046 else if (type == 126)
12047 {
12048 scale *= 0.8f;
12049 }
12050 else if (type == 127)
12051 {
12052 scale *= 1.1f;
12053 }
12054 else if (type == 128)
12055 {
12056 scale *= 1.1f;
12057 }
12058 else if (type == 129)
12059 {
12060 scale *= 1.1f;
12061 }
12062 else if (type == 130)
12063 {
12064 scale *= 1.1f;
12065 }
12066 else if (type == 131)
12067 {
12068 scale *= 1.1f;
12069 }
12070 else if (type == 134)
12071 {
12072 scale *= 1.3f;
12073 }
12074 else if (type == 135)
12075 {
12076 scale *= 1.3f;
12077 }
12078 else if (type == 136)
12079 {
12080 scale *= 1.3f;
12081 }
12082 else
12083 {
12084 if (type != 139)
12085 {
12086 return;
12087 }
12088 scale *= 1.6f;
12089 }
12091 {
12092 scale = num;
12093 return;
12094 }
12095 width = (int)((float)width * scale);
12096 height = (int)((float)height * scale);
12097 }
12098
12100 {
12101 waterMovementSpeed = 1f;
12102 lavaMovementSpeed = 1f;
12103 honeyMovementSpeed = 1f;
12104 }
12105
12107 {
12109 int num = unifiedRandom.Next(3);
12110 int num2 = unifiedRandom.Next(3);
12111 while (num == num2)
12112 {
12113 num = unifiedRandom.Next(3);
12114 }
12115 for (int i = 0; i < 2; i++)
12116 {
12117 int num3 = num;
12118 if (i == 1)
12119 {
12120 num3 = num2;
12121 }
12122 for (int j = 0; j < 3; j++)
12123 {
12124 switch (num3)
12125 {
12126 case 0:
12127 cavernMonsterType[i, j] = unifiedRandom.Next(494, 496);
12128 break;
12129 case 1:
12130 cavernMonsterType[i, j] = unifiedRandom.Next(496, 498);
12131 break;
12132 default:
12133 cavernMonsterType[i, j] = unifiedRandom.Next(498, 507);
12134 break;
12135 }
12136 }
12137 }
12138 }
12139
12141 {
12142 NPCSpawnParams result = default(NPCSpawnParams);
12143 result.sizeScaleOverride = -1f;
12144 result.playerCountForMultiplayerDifficultyOverride = statsAreScaledForThisManyPlayers;
12145 result.strengthMultiplierOverride = strengthMultiplier;
12146 return result;
12147 }
12148
12149 public void ScaleStats(int? activePlayersCount, GameModeData gameModeData, float? strengthOverride)
12150 {
12151 if ((!NPCID.Sets.NeedsExpertScaling.IndexInRange(type) || !NPCID.Sets.NeedsExpertScaling[type]) && (lifeMax <= 5 || damage == 0 || friendly || townNPC))
12152 {
12153 return;
12154 }
12155 float num = 1f;
12156 if (strengthOverride.HasValue)
12157 {
12158 num = strengthOverride.Value;
12159 }
12160 else if (gameModeData.IsJourneyMode)
12161 {
12163 if (power != null && power.GetIsUnlocked())
12164 {
12165 num = power.StrengthMultiplierToGiveNPCs;
12166 }
12167 }
12168 float num2 = num;
12169 if (gameModeData.IsJourneyMode && Main.getGoodWorld)
12170 {
12171 num += 1f;
12172 }
12174 if (nPCStrengthHelper.IsExpertMode)
12175 {
12177 }
12178 ScaleStats_ApplyGameMode(gameModeData);
12179 if (Main.getGoodWorld && nPCStrengthHelper.ExtraDamageForGetGoodWorld)
12180 {
12181 damage += damage / 3;
12182 }
12183 if (nPCStrengthHelper.IsExpertMode)
12184 {
12185 int num3 = 1;
12188 float bossAdjustment = 1f;
12189 if (nPCStrengthHelper.IsMasterMode)
12190 {
12191 bossAdjustment = 0.85f;
12192 }
12194 }
12197 if ((type < 0 || !NPCID.Sets.ProjectileNPC[type]) && lifeMax < 6)
12198 {
12199 lifeMax = 6;
12200 }
12201 life = lifeMax;
12202 defDamage = damage;
12204 }
12205
12207 {
12208 if (strength == 1f)
12209 {
12210 return;
12211 }
12212 int num;
12213 if (type >= 0)
12214 {
12215 num = (NPCID.Sets.ProjectileNPC[type] ? 1 : 0);
12216 if (num != 0)
12217 {
12218 goto IL_0034;
12219 }
12220 }
12221 else
12222 {
12223 num = 0;
12224 }
12225 lifeMax = (int)((float)lifeMax * strength);
12226 goto IL_0034;
12227 IL_0034:
12228 damage = (int)((float)damage * strength);
12229 float num2 = 1f;
12230 float num3 = 2f;
12231 float num4 = 3f;
12232 if (Main.getGoodWorld)
12233 {
12234 num2 += 1f;
12235 num3 += 1f;
12236 num4 += 1f;
12237 }
12238 if (num == 0)
12239 {
12240 float num5 = GameModeData.NormalMode.EnemyMoneyDropMultiplier;
12241 float num6 = GameModeData.ExpertMode.EnemyMoneyDropMultiplier;
12242 if (Main.getGoodWorld)
12243 {
12244 num5 += 1f;
12245 num6 += 1f;
12246 }
12247 float num7 = Utils.Remap(strength, num2, num3, num5, num6);
12248 value = (int)(value * num7);
12249 }
12250 float knockbackToEnemiesMultiplier = GameModeData.NormalMode.KnockbackToEnemiesMultiplier;
12251 float knockbackToEnemiesMultiplier2 = GameModeData.MasterMode.KnockbackToEnemiesMultiplier;
12254 }
12255
12256 public static float GetBalance()
12257 {
12259 return balance;
12260 }
12261
12262 public float GetMyBalance()
12263 {
12265 {
12266 return 1f;
12267 }
12269 return balance;
12270 }
12271
12272 public static int GetActivePlayerCount()
12273 {
12274 if (Main.netMode == 0)
12275 {
12276 return 1;
12277 }
12278 int num = 0;
12279 for (int i = 0; i < 255; i++)
12280 {
12281 if (Main.player[i] != null && Main.player[i].active)
12282 {
12283 num++;
12284 }
12285 }
12286 return num;
12287 }
12288
12290 {
12291 bool flag = type >= 0 && NPCID.Sets.ProjectileNPC[type];
12293 if (Main.getGoodWorld)
12294 {
12295 if ((type == 24 || type == 25) && AnyNPCs(113))
12296 {
12297 flag2 = false;
12298 }
12299 if ((type == 32 || type == 33) && AnyNPCs(35))
12300 {
12301 flag2 = false;
12302 }
12303 if (type == 6 && AnyNPCs(13))
12304 {
12305 flag2 = false;
12306 }
12307 }
12308 if (flag2 && Main.hardMode && !boss && lifeMax < 1000)
12309 {
12310 int num = damage + defense + lifeMax / 4;
12311 if (num == 0)
12312 {
12313 num = 1;
12314 }
12315 int num2 = 80;
12316 if (downedPlantBoss)
12317 {
12318 num2 += 20;
12319 }
12320 if (num < num2)
12321 {
12322 float num3 = num2 / num;
12323 damage = (int)((double)((float)damage * num3) * 0.9);
12324 if (!flag)
12325 {
12326 defense = (int)((float)defense * num3);
12327 lifeMax = (int)((double)((float)lifeMax * num3) * 1.1);
12328 value = (int)((double)(value * num3) * 0.8);
12329 }
12330 }
12331 }
12332 if (type == 210 || type == 211)
12333 {
12334 damage = (int)((float)damage * 0.6f);
12335 lifeMax = (int)((float)lifeMax * 0.8f);
12336 defense = (int)((float)defense * 0.8f);
12337 }
12338 }
12339
12340 private void ScaleStats_ApplyGameMode(GameModeData gameModeData)
12341 {
12342 bool num = type >= 0 && NPCID.Sets.ProjectileNPC[type];
12343 int num2 = 0;
12344 if (!gameModeData.IsJourneyMode && Main.getGoodWorld)
12345 {
12346 num2++;
12347 }
12348 if (!num)
12349 {
12350 value = (int)(value * (gameModeData.EnemyMoneyDropMultiplier + (float)num2));
12351 lifeMax = (int)((float)lifeMax * (gameModeData.EnemyMaxLifeMultiplier + (float)num2));
12352 }
12353 damage = (int)((float)damage * (gameModeData.EnemyDamageMultiplier + (float)num2));
12355 }
12356
12358 {
12359 int num = numPlayers - 1;
12360 if (type == 5)
12361 {
12362 lifeMax = (int)((float)lifeMax * 0.75f * bossAdjustment);
12363 }
12364 if (type == 4)
12365 {
12366 lifeMax = (int)((double)lifeMax * 0.65 * (double)balance * (double)bossAdjustment);
12367 }
12368 if (type >= 13 && type <= 15)
12369 {
12370 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12371 if (type == 13)
12372 {
12373 damage = (int)((double)damage * 1.1);
12374 }
12375 if (type == 14)
12376 {
12377 damage = (int)((double)damage * 0.8);
12378 }
12379 if (type == 15)
12380 {
12381 damage = (int)((double)damage * 0.8);
12382 }
12383 scale *= 1.2f;
12384 defense += 2;
12385 }
12386 if (type == 266 || type == 267)
12387 {
12388 lifeMax = (int)((double)lifeMax * 0.85 * (double)balance * (double)bossAdjustment);
12389 damage = (int)((double)damage * 0.9);
12390 scale *= 1.05f;
12391 for (float num2 = 1f; num2 < balance; num2 += 0.34f)
12392 {
12393 if ((double)knockBackResist < 0.1)
12394 {
12395 knockBackResist = 0f;
12396 break;
12397 }
12398 knockBackResist *= 0.8f;
12399 }
12400 }
12401 if (type == 50)
12402 {
12403 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12404 damage = (int)((double)damage * 0.8);
12405 }
12406 if (type == 471)
12407 {
12408 lifeMax = (int)((double)lifeMax * 0.85 * (double)(balance * 2f + 1f) / 3.0);
12409 }
12410 if (type == 472)
12411 {
12412 lifeMax = (int)((double)lifeMax * 0.85 * (double)(balance + 1f) / 2.0);
12413 damage = (int)((double)damage * 0.8);
12414 }
12415 if (type == 222)
12416 {
12417 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12418 damage = (int)((double)damage * 0.9);
12419 }
12420 if (type == 210 || type == 211)
12421 {
12422 lifeMax = (int)((double)lifeMax * 0.75);
12423 }
12424 if (type == 35)
12425 {
12426 lifeMax = (int)((float)lifeMax * balance * bossAdjustment);
12427 damage = (int)((double)damage * 1.1);
12428 }
12429 else if (type == 36)
12430 {
12431 lifeMax = (int)((double)lifeMax * 1.3 * (double)balance * (double)bossAdjustment);
12432 damage = (int)((double)damage * 1.1);
12433 }
12434 if (type == 668)
12435 {
12436 lifeMax = (int)((double)lifeMax * 0.85 * (double)balance * (double)bossAdjustment);
12437 damage = damage;
12438 }
12439 if (type == 113 || type == 114)
12440 {
12441 defense += 6;
12442 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12443 damage = (int)((double)damage * 1.5);
12444 }
12445 else if (type == 115)
12446 {
12447 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance);
12448 if (numPlayers > 4)
12449 {
12450 knockBackResist = 0f;
12451 }
12452 else if (numPlayers > 1)
12453 {
12454 knockBackResist *= 1f - boost;
12455 }
12456 defense += 6;
12457 }
12458 else if (type == 116)
12459 {
12460 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance);
12461 if (numPlayers > 4)
12462 {
12463 knockBackResist = 0f;
12464 }
12465 else if (numPlayers > 1)
12466 {
12467 knockBackResist *= 1f - boost;
12468 }
12469 }
12470 else if (type == 117 || type == 118 || type == 119)
12471 {
12472 lifeMax = (int)((double)lifeMax * 0.8);
12473 }
12474 if (type == 657)
12475 {
12476 lifeMax = (int)((float)lifeMax * 0.8f * balance * bossAdjustment);
12477 }
12478 if (type >= 658 && type <= 660)
12479 {
12480 lifeMax = (int)((float)lifeMax * 0.75f * balance * bossAdjustment);
12481 }
12482 if (type >= 134 && type <= 136)
12483 {
12484 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12485 if (type == 134)
12486 {
12487 damage *= 2;
12488 }
12489 if (type == 135)
12490 {
12491 damage = (int)((double)damage * 0.85);
12492 }
12493 if (type == 136)
12494 {
12495 damage = (int)((double)damage * 0.85);
12496 }
12497 scale *= 1.05f;
12498 }
12499 else if (type == 139)
12500 {
12501 lifeMax = (int)((double)lifeMax * 0.75 * (double)(balance * 2f + 1f) / 3.0);
12502 damage = (int)((double)damage * 0.8);
12503 scale *= 1.05f;
12504 }
12505 if (type >= 127 && type <= 131)
12506 {
12507 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12508 damage = (int)((double)damage * 0.85);
12509 }
12510 if (type >= 125 && type <= 126)
12511 {
12512 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12513 damage = (int)((double)damage * 0.85);
12514 }
12515 if (type == 262)
12516 {
12517 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12518 damage = (int)((double)damage * 1.15);
12519 }
12520 else if (type == 264)
12521 {
12522 lifeMax = (int)((float)lifeMax * balance * bossAdjustment);
12523 damage = (int)((double)damage * 1.15);
12524 }
12525 if (type == 636)
12526 {
12527 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
12528 damage = (int)((double)damage * 1.15);
12529 }
12530 if (type >= 245 && type <= 249)
12531 {
12532 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12533 damage = (int)((double)damage * 0.8);
12534 }
12535 if (type == 370)
12536 {
12537 lifeMax = (int)((double)lifeMax * 0.65 * (double)balance * (double)bossAdjustment);
12538 damage = (int)((double)damage * 0.7);
12539 }
12540 else if (type == 371 || type == 372 || type == 373)
12541 {
12542 if (type != 371)
12543 {
12544 lifeMax = (int)((double)lifeMax * 0.75);
12545 }
12546 damage = (int)((double)damage * 0.75);
12547 }
12548 if (type == 439 || type == 440 || (type >= 454 && type <= 459) || type == 522 || type == 523)
12549 {
12550 if (type != 522)
12551 {
12552 lifeMax = (int)((float)lifeMax * 0.75f * balance * bossAdjustment);
12553 }
12554 damage = (int)((double)damage * 0.75);
12555 }
12556 if (type == 397 || type == 396 || type == 398)
12557 {
12558 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12559 damage = (int)((double)damage * 0.75);
12560 }
12561 if (type == 551)
12562 {
12563 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
12564 damage = (int)((double)damage * 0.65);
12565 }
12567 {
12568 int num3 = 7;
12569 float num4 = (balance * (float)(num3 - 1) + 1f) / (float)num3;
12570 lifeMax = (int)((float)lifeMax * num4 * bossAdjustment);
12571 }
12572 float num5 = 1f + (float)num * 0.2f;
12573 switch (type)
12574 {
12575 case 305:
12576 case 306:
12577 case 307:
12578 case 308:
12579 case 309:
12580 case 310:
12581 case 311:
12582 case 312:
12583 case 313:
12584 case 314:
12585 case 326:
12586 case 329:
12587 case 330:
12588 lifeMax = (int)((double)lifeMax * 0.75 * (double)num5);
12589 damage = (int)((double)damage * 0.75);
12590 break;
12591 case 315:
12592 case 325:
12593 case 327:
12594 lifeMax = (int)((double)lifeMax * 0.65 * (double)bossAdjustment);
12595 damage = (int)((double)damage * 0.75);
12596 break;
12597 }
12598 switch (type)
12599 {
12600 case 338:
12601 case 339:
12602 case 340:
12603 case 341:
12604 case 342:
12605 case 343:
12606 case 347:
12607 case 348:
12608 case 349:
12609 case 350:
12610 case 351:
12611 case 352:
12612 lifeMax = (int)((double)lifeMax * 0.75 * (double)num5);
12613 damage = (int)((double)damage * 0.75);
12614 break;
12615 case 344:
12616 case 345:
12617 case 346:
12618 lifeMax = (int)((double)lifeMax * 0.65 * (double)bossAdjustment);
12619 damage = (int)((double)damage * 0.75);
12620 break;
12621 }
12622 if (Main.getGoodWorld)
12623 {
12624 if (type == 6 && AnyNPCs(13))
12625 {
12626 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
12627 defense += 2;
12628 }
12629 if (type == 32 && AnyNPCs(35))
12630 {
12631 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
12632 defense += 6;
12633 }
12634 if (type == 24 && AnyNPCs(113))
12635 {
12636 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
12637 defense += 10;
12638 }
12639 }
12641 defDamage = damage;
12642 life = lifeMax;
12643 }
12644
12645 public static void GetStatScalingFactors(int numPlayers, out float balance, out float boost)
12646 {
12647 balance = 1f;
12648 boost = 0.35f;
12649 for (int i = 1; i < numPlayers; i++)
12650 {
12651 balance += boost;
12652 boost += (1f - boost) / 3f;
12653 }
12654 if (balance > 8f)
12655 {
12656 balance = (balance * 2f + 8f) / 3f;
12657 }
12658 if (balance > 1000f)
12659 {
12660 balance = 1000f;
12661 }
12662 }
12663
12664 public static bool GetNPCLocation(int i, bool seekHead, bool averageDirection, out int index, out Vector2 pos)
12665 {
12666 int num = Main.npc[i].type;
12667 int num2 = -1;
12668 int num3 = -1;
12669 switch (num)
12670 {
12671 case 13:
12672 num3 = 15;
12673 num2 = 0;
12674 break;
12675 case 14:
12676 case 15:
12677 num3 = 13;
12678 num2 = 1;
12679 break;
12680 case 134:
12681 num3 = 136;
12682 num2 = 0;
12683 break;
12684 case 135:
12685 case 136:
12686 num3 = 134;
12687 num2 = 1;
12688 break;
12689 case 454:
12690 num3 = 459;
12691 num2 = 0;
12692 break;
12693 case 455:
12694 case 456:
12695 case 457:
12696 case 458:
12697 case 459:
12698 num3 = 454;
12699 num2 = 1;
12700 break;
12701 case 98:
12702 num3 = 100;
12703 num2 = 0;
12704 break;
12705 case 99:
12706 case 100:
12707 num3 = 98;
12708 num2 = 1;
12709 break;
12710 case 39:
12711 num3 = 41;
12712 num2 = 0;
12713 break;
12714 case 40:
12715 case 41:
12716 num3 = 39;
12717 num2 = 1;
12718 break;
12719 case 510:
12720 num3 = 512;
12721 num2 = 0;
12722 break;
12723 case 511:
12724 case 512:
12725 num3 = 510;
12726 num2 = 1;
12727 break;
12728 case 621:
12729 num3 = 623;
12730 num2 = 0;
12731 break;
12732 case 622:
12733 case 623:
12734 num3 = 621;
12735 num2 = 1;
12736 break;
12737 case 513:
12738 num3 = 515;
12739 num2 = 0;
12740 break;
12741 case 514:
12742 case 515:
12743 num3 = 513;
12744 num2 = 1;
12745 break;
12746 case 87:
12747 num3 = 92;
12748 num2 = 0;
12749 break;
12750 case 88:
12751 case 89:
12752 case 90:
12753 case 91:
12754 case 92:
12755 num3 = 87;
12756 num2 = 1;
12757 break;
12758 case 117:
12759 num3 = 119;
12760 num2 = 0;
12761 break;
12762 case 118:
12763 case 119:
12764 num3 = 117;
12765 num2 = 1;
12766 break;
12767 case 7:
12768 num3 = 9;
12769 num2 = 0;
12770 break;
12771 case 8:
12772 case 9:
12773 num3 = 7;
12774 num2 = 1;
12775 break;
12776 case 95:
12777 num3 = 97;
12778 num2 = 0;
12779 break;
12780 case 96:
12781 case 97:
12782 num3 = 95;
12783 num2 = 1;
12784 break;
12785 case 10:
12786 num3 = 12;
12787 num2 = 0;
12788 break;
12789 case 11:
12790 case 12:
12791 num3 = 10;
12792 num2 = 1;
12793 break;
12794 }
12795 if (num2 != -1)
12796 {
12797 if (seekHead && num2 == 1)
12798 {
12799 index = -1;
12800 pos = Vector2.Zero;
12801 return false;
12802 }
12803 Vector2 center = Main.npc[i].Center;
12804 int num4 = -1;
12805 float num5 = -1f;
12806 int num6 = -1;
12808 int num7 = (int)Main.npc[i].ai[num2];
12809 int num8 = 0;
12810 while (num7 >= 0 && num7 < 200 && ++num8 < 100 && Main.npc[num7].active)
12811 {
12812 if (!averageDirection && (num6 == -1 || Main.npc[num7].Distance(center2) < num5))
12813 {
12814 num5 = Main.npc[num7].Distance(center2);
12815 num6 = num7;
12816 }
12817 if (Main.npc[num7].type == num3)
12818 {
12819 num4 = num7;
12820 break;
12821 }
12822 num7 = (int)Main.npc[num7].ai[num2];
12823 }
12824 if (num4 >= 0)
12825 {
12826 if (!averageDirection)
12827 {
12828 pos = Main.npc[num6].Center;
12829 index = num6;
12830 }
12831 else
12832 {
12833 center += Main.npc[num4].Center;
12834 pos = center / 2f;
12835 index = num4;
12836 }
12837 return true;
12838 }
12839 pos = Vector2.Zero;
12840 index = -1;
12841 return false;
12842 }
12843 pos = Main.npc[i].Center;
12844 index = i;
12845 return true;
12846 }
12847
12849 {
12851 for (int i = 0; i < 1000; i++)
12852 {
12853 Projectile projectile = Main.projectile[i];
12854 if (projectile.active && projectile.owner == Main.myPlayer && isAnNPCAttachedExplosive[projectile.type] && projectile.IsAttachedTo(this))
12855 {
12856 projectile.Kill();
12857 }
12858 }
12859 }
12860
12862 {
12863 int num = (int)base.Center.X / 16;
12864 int num2 = (int)base.Center.Y / 16;
12865 int num3 = 0;
12866 bool flag = false;
12867 float num4 = 20f;
12868 if (Math.Abs(num * 16 - targetTileX * 16) + Math.Abs(num2 * 16 - targetTileY * 16) > 2000)
12869 {
12870 num3 = 100;
12871 flag = false;
12872 }
12873 while (!flag && num3 < 100)
12874 {
12875 num3++;
12878 {
12879 if ((i >= num2 - 1 && i <= num2 + 1 && num5 >= num - 1 && num5 <= num + 1) || (!teleportInAir && !Main.tile[num5, i].nactive()))
12880 {
12881 continue;
12882 }
12883 bool flag2 = true;
12884 if ((type == 32 || (type >= 281 && type <= 286)) && !Main.wallDungeon[Main.tile[num5, i - 1].wall])
12885 {
12886 if (!AnyNPCs(35))
12887 {
12888 flag2 = false;
12889 }
12890 }
12891 else if (Main.tile[num5, i - 1].lava())
12892 {
12893 flag2 = false;
12894 }
12895 if (!flag2 || (!teleportInAir && !Main.tileSolid[Main.tile[num5, i].type]))
12896 {
12897 continue;
12898 }
12899 bool flag3 = false;
12901 {
12902 continue;
12903 }
12904 Rectangle rectangle = new Rectangle(num5 * 16, i * 16, 16, 16);
12906 for (int j = 0; j < Main.player.Length; j++)
12907 {
12908 Player player = Main.player[j];
12909 if (player != null && player.active && !player.DeadOrGhost)
12910 {
12911 Rectangle value = player.Hitbox;
12912 Rectangle value2 = value.Modified((int)(player.velocity.X * num4), (int)(player.velocity.Y * num4), 0, 0);
12914 if (value2.Intersects(rectangle))
12915 {
12916 flag2 = false;
12917 flag = false;
12918 break;
12919 }
12920 }
12921 }
12922 if (flag2)
12923 {
12924 chosenTile = new Vector2(num5, i);
12925 flag = true;
12926 }
12927 break;
12928 }
12929 }
12930 return flag;
12931 }
12932
12933 public static void TransformElderSlime(int npcIndex)
12934 {
12935 if (Main.netMode == 1)
12936 {
12937 NetMessage.SendData(140, -1, -1, null, 2, npcIndex);
12938 }
12939 else if (!unlockedSlimeOldSpawn && Main.npc.IndexInRange(npcIndex))
12940 {
12941 NPC nPC = Main.npc[npcIndex];
12942 if (nPC.type == 685)
12943 {
12944 unlockedSlimeOldSpawn = true;
12946 Vector2 vector = nPC.velocity;
12947 nPC.Transform(679);
12948 nPC.netUpdate = true;
12949 nPC.velocity = vector;
12951 {
12952 PositionInWorld = nPC.Center,
12953 MovementVector = Vector2.Zero,
12954 UniqueInfoPiece = 2
12955 });
12956 }
12957 }
12958 }
12959
12960 public static void TransformCopperSlime(int npcIndex)
12961 {
12962 if (Main.netMode == 1)
12963 {
12964 NetMessage.SendData(140, -1, -1, null, 1, npcIndex);
12965 }
12966 else if (!unlockedSlimeCopperSpawn && Main.npc.IndexInRange(npcIndex))
12967 {
12968 NPC nPC = Main.npc[npcIndex];
12969 if (nPC.type >= 0 && nPC.type < NPCID.Count && NPCID.Sets.CanConvertIntoCopperSlimeTownNPC[nPC.type])
12970 {
12973 Vector2 vector = nPC.velocity;
12974 nPC.Transform(684);
12975 nPC.netUpdate = true;
12976 nPC.velocity = vector;
12978 {
12979 PositionInWorld = nPC.Center,
12980 MovementVector = Vector2.Zero,
12981 UniqueInfoPiece = 1
12982 });
12983 }
12984 }
12985 }
12986
12987 public static void HaveDryadDoStardewAnimation()
12988 {
12989 for (int i = 0; i < 200; i++)
12990 {
12991 NPC nPC = Main.npc[i];
12992 if (!nPC.active || nPC.type != 20)
12993 {
12994 continue;
12995 }
12996 nPC.localAI[2] = 480f;
12997 nPC.ai[0] = 24f;
12998 nPC.ai[1] = 480f;
12999 nPC.ai[2] = 0f;
13000 nPC.localAI[3] = 0f;
13001 nPC.netUpdate = true;
13002 nPC.direction = 1;
13003 nPC.spriteDirection = 1;
13004 Vector2 vector = nPC.Bottom + new Vector2(100f, 0f);
13005 Point p = vector.ToTileCoordinates();
13006 p.Y = Utils.Clamp(p.Y - 10, 10, Main.maxTilesY - 10);
13007 int y = p.Y;
13008 int num = 15;
13009 int num2 = p.Y + num;
13010 bool flag = false;
13011 for (int j = p.Y; j < num2; j++)
13012 {
13013 Tile tile = Main.tile[p.X, j];
13014 p.Y = j;
13015 if (tile.active() && Main.tileSolid[tile.type])
13016 {
13017 if (j == y)
13018 {
13019 flag = true;
13020 }
13021 break;
13022 }
13023 }
13024 Vector2 vector2 = new Vector2(0f, -52f);
13025 Vector2 vector3 = p.ToWorldCoordinates(8f, 0f);
13026 if (flag)
13027 {
13028 vector3 = vector;
13029 }
13031 break;
13032 }
13033 }
13034
13035 private void AI_047_GolemFist()
13036 {
13037 float num = GetMyBalance();
13038 if (Main.getGoodWorld)
13039 {
13040 num += 3f;
13041 }
13042 if ((!Main.player[target].ZoneLihzhardTemple && !Main.player[target].ZoneJungle) || (double)Main.player[target].Center.Y < Main.worldSurface * 16.0)
13043 {
13044 num *= 2f;
13045 }
13046 if (golemBoss < 0)
13047 {
13048 StrikeNPCNoInteraction(9999, 0f, 0);
13049 return;
13050 }
13051 if (alpha > 0)
13052 {
13053 alpha -= 10;
13054 if (alpha < 0)
13055 {
13056 alpha = 0;
13057 }
13058 ai[1] = 0f;
13059 }
13060 Player player = Main.player[target];
13062 Vector2 vector = nPC.Center + nPC.velocity + new Vector2(0f, -9f * scale);
13063 vector.X += (float)((type == 247) ? (-84) : 78) * scale;
13064 Vector2 vector2 = vector - base.Center;
13065 float num2 = vector2.Length();
13066 if (ai[0] == 0f)
13067 {
13068 noTileCollide = true;
13069 float num3 = 14f;
13070 if (life < lifeMax / 2)
13071 {
13072 num3 += 3f;
13073 }
13074 if (life < lifeMax / 4)
13075 {
13076 num3 += 3f;
13077 }
13078 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
13079 {
13080 num3 += 8f;
13081 }
13082 num3 *= (num + 3f) / 4f;
13083 if (num3 > 32f)
13084 {
13085 num3 = 32f;
13086 }
13087 float x = vector2.X;
13088 float y = vector2.Y;
13089 float num4 = num2;
13090 if (num4 < 12f + num3)
13091 {
13092 rotation = 0f;
13093 velocity.X = x;
13094 velocity.Y = y;
13095 float num5 = num;
13096 ai[1] += num5;
13097 if (life < lifeMax / 2)
13098 {
13099 ai[1] += num5;
13100 }
13101 if (life < lifeMax / 4)
13102 {
13103 ai[1] += num5;
13104 }
13105 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
13106 {
13107 ai[1] += 10f * num5;
13108 }
13109 if (ai[1] >= 60f)
13110 {
13111 TargetClosest();
13112 if ((type == 247 && base.Center.X + 100f > Main.player[target].Center.X) || (type == 248 && base.Center.X - 100f < Main.player[target].Center.X))
13113 {
13114 ai[1] = 0f;
13115 ai[0] = 1f;
13116 }
13117 else
13118 {
13119 ai[1] = 0f;
13120 }
13121 }
13122 }
13123 else
13124 {
13125 num4 = num3 / num4;
13126 velocity.X = x * num4;
13127 velocity.Y = y * num4;
13128 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
13129 if (type == 247)
13130 {
13131 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
13132 }
13133 }
13134 }
13135 else if (ai[0] == 1f)
13136 {
13137 ai[1] += 1f;
13138 base.Center = vector;
13139 rotation = 0f;
13141 if (ai[1] <= 15f)
13142 {
13143 for (int i = 0; i < 1; i++)
13144 {
13145 Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f);
13146 Vector2 vector4 = vector3 * -1f * 0.05f;
13147 Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f);
13148 Dust dust = Dust.NewDustPerfect(base.Center + vector4 + vector3 + vector5, 228, vector4);
13149 dust.fadeIn = 1.5f;
13150 dust.scale = 0.5f;
13151 if (Main.getGoodWorld)
13152 {
13153 dust.noLight = true;
13154 }
13155 dust.noGravity = true;
13156 }
13157 }
13158 if (ai[1] >= 30f)
13159 {
13160 noTileCollide = true;
13161 collideX = false;
13162 collideY = false;
13163 ai[0] = 2f;
13164 ai[1] = 0f;
13165 float num6 = 12f;
13166 if (life < lifeMax / 2)
13167 {
13168 num6 += 4f;
13169 }
13170 if (life < lifeMax / 4)
13171 {
13172 num6 += 4f;
13173 }
13174 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
13175 {
13176 num6 += 10f;
13177 }
13178 num6 *= (num + 3f) / 4f;
13179 if (num6 > 48f)
13180 {
13181 num6 = 48f;
13182 }
13183 Vector2 vector6 = new Vector2(base.Center.X, base.Center.Y);
13184 float num7 = Main.player[target].Center.X - vector6.X;
13185 float num8 = Main.player[target].Center.Y - vector6.Y;
13186 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
13187 num9 = num6 / num9;
13188 velocity.X = num7 * num9;
13189 velocity.Y = num8 * num9;
13190 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
13191 if (type == 247)
13192 {
13193 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
13194 }
13195 }
13196 }
13197 else if (ai[0] == 2f)
13198 {
13199 if (Main.netMode != 1 && Main.getGoodWorld)
13200 {
13201 for (int j = (int)(position.X / 16f) - 1; (float)j < (position.X + (float)width) / 16f + 1f; j++)
13202 {
13203 for (int k = (int)(position.Y / 16f) - 1; (float)k < (position.Y + (float)width) / 16f + 1f; k++)
13204 {
13205 if (Main.tile[j, k].type == 4)
13206 {
13207 Main.tile[j, k].active(active: false);
13208 if (Main.netMode == 2)
13209 {
13211 }
13212 }
13213 }
13214 }
13215 }
13216 ai[1] += 1f;
13217 if (ai[1] == 1f)
13218 {
13220 }
13221 if (Main.rand.Next(2) == 0)
13222 {
13223 Vector2 vector7 = velocity * 0.5f;
13224 Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f);
13225 Dust.NewDustPerfect(base.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f;
13226 }
13227 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
13228 {
13229 if (velocity.X > 0f && base.Center.X > player.Center.X)
13230 {
13231 noTileCollide = false;
13232 }
13233 if (velocity.X < 0f && base.Center.X < player.Center.X)
13234 {
13235 noTileCollide = false;
13236 }
13237 }
13238 else
13239 {
13240 if (velocity.Y > 0f && base.Center.Y > player.Center.Y)
13241 {
13242 noTileCollide = false;
13243 }
13244 if (velocity.Y < 0f && base.Center.Y < player.Center.Y)
13245 {
13246 noTileCollide = false;
13247 }
13248 }
13249 if (num2 > 700f || collideX || collideY)
13250 {
13251 noTileCollide = true;
13252 ai[0] = 0f;
13253 }
13254 }
13255 else
13256 {
13257 if (ai[0] != 3f)
13258 {
13259 return;
13260 }
13261 noTileCollide = true;
13262 float num10 = 0.4f;
13263 Vector2 vector9 = new Vector2(base.Center.X, base.Center.Y);
13264 float num11 = Main.player[target].Center.X - vector9.X;
13265 float num12 = Main.player[target].Center.Y - vector9.Y;
13266 float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
13267 num13 = 12f / num13;
13268 num11 *= num13;
13269 num12 *= num13;
13270 if (velocity.X < num11)
13271 {
13272 velocity.X += num10;
13273 if (velocity.X < 0f && num11 > 0f)
13274 {
13275 velocity.X += num10 * 2f;
13276 }
13277 }
13278 else if (velocity.X > num11)
13279 {
13280 velocity.X -= num10;
13281 if (velocity.X > 0f && num11 < 0f)
13282 {
13283 velocity.X -= num10 * 2f;
13284 }
13285 }
13286 if (velocity.Y < num12)
13287 {
13288 velocity.Y += num10;
13289 if (velocity.Y < 0f && num12 > 0f)
13290 {
13291 velocity.Y += num10 * 2f;
13292 }
13293 }
13294 else if (velocity.Y > num12)
13295 {
13296 velocity.Y -= num10;
13297 if (velocity.Y > 0f && num12 < 0f)
13298 {
13299 velocity.Y -= num10 * 2f;
13300 }
13301 }
13302 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
13303 if (type == 247)
13304 {
13305 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
13306 }
13307 }
13308 }
13309
13310 private void AI_045_Golem()
13311 {
13312 golemBoss = whoAmI;
13313 float num = GetMyBalance();
13314 if (Main.getGoodWorld)
13315 {
13316 num += 2f;
13317 }
13318 if ((!Main.player[target].ZoneLihzhardTemple && !Main.player[target].ZoneJungle) || (double)Main.player[target].Center.Y < Main.worldSurface * 16.0)
13319 {
13320 num *= 2f;
13321 }
13322 if (localAI[0] == 0f)
13323 {
13324 localAI[0] = 1f;
13325 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X - 84, (int)base.Center.Y - 9, 247);
13326 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + 78, (int)base.Center.Y - 9, 248);
13327 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X - 3, (int)base.Center.Y - 57, 246);
13328 }
13329 if (target >= 0 && Main.player[target].dead)
13330 {
13331 TargetClosest();
13332 if (Main.player[target].dead)
13333 {
13334 noTileCollide = true;
13335 }
13336 }
13337 if (alpha > 0)
13338 {
13339 alpha -= 10;
13340 if (alpha < 0)
13341 {
13342 alpha = 0;
13343 }
13344 ai[1] = 0f;
13345 }
13346 bool flag = false;
13347 bool flag2 = false;
13348 bool flag3 = false;
13349 dontTakeDamage = false;
13350 for (int i = 0; i < 200; i++)
13351 {
13352 if (Main.npc[i].active && Main.npc[i].type == 246)
13353 {
13354 flag = true;
13355 }
13356 if (Main.npc[i].active && Main.npc[i].type == 247)
13357 {
13358 flag2 = true;
13359 }
13360 if (Main.npc[i].active && Main.npc[i].type == 248)
13361 {
13362 flag3 = true;
13363 }
13364 }
13365 dontTakeDamage = flag;
13366 if (Main.netMode != 1 && Main.getGoodWorld && velocity.Y > 0f)
13367 {
13368 for (int j = (int)(position.X / 16f); (float)j < (position.X + (float)width) / 16f; j++)
13369 {
13370 for (int k = (int)(position.Y / 16f); (float)k < (position.Y + (float)width) / 16f; k++)
13371 {
13372 if (Main.tile[j, k].type == 4)
13373 {
13374 Main.tile[j, k].active(active: false);
13375 if (Main.netMode == 2)
13376 {
13378 }
13379 }
13380 }
13381 }
13382 }
13384 if (!Main.getGoodWorld)
13385 {
13386 if (!flag2)
13387 {
13388 int num2 = Dust.NewDust(new Vector2(base.Center.X - 80f * scale, base.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100);
13389 Main.dust[num2].alpha += Main.rand.Next(100);
13390 Main.dust[num2].velocity *= 0.2f;
13391 Main.dust[num2].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f;
13392 Main.dust[num2].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f;
13393 if (Main.rand.Next(10) == 0)
13394 {
13395 num2 = Dust.NewDust(new Vector2(base.Center.X - 80f * scale, base.Center.Y - 9f), 8, 8, 6);
13396 if (Main.rand.Next(20) != 0)
13397 {
13398 Main.dust[num2].noGravity = true;
13399 Main.dust[num2].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
13400 Main.dust[num2].velocity.Y -= 1f;
13401 }
13402 }
13403 }
13404 if (!flag3)
13405 {
13406 int num3 = Dust.NewDust(new Vector2(base.Center.X + 62f * scale, base.Center.Y - 9f), 8, 8, 31, 0f, 0f, 100);
13407 Main.dust[num3].alpha += Main.rand.Next(100);
13408 Main.dust[num3].velocity *= 0.2f;
13409 Main.dust[num3].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f;
13410 Main.dust[num3].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f;
13411 if (Main.rand.Next(10) == 0)
13412 {
13413 num3 = Dust.NewDust(new Vector2(base.Center.X + 62f * scale, base.Center.Y - 9f), 8, 8, 6);
13414 if (Main.rand.Next(20) != 0)
13415 {
13416 Main.dust[num3].noGravity = true;
13417 Main.dust[num3].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
13418 Main.dust[num3].velocity.Y -= 1f;
13419 }
13420 }
13421 }
13422 }
13424 if (noTileCollide && !Main.player[target].dead)
13425 {
13426 if (velocity.Y > 0f && base.Bottom.Y > Main.player[target].Top.Y)
13427 {
13428 noTileCollide = false;
13429 }
13431 {
13432 noTileCollide = false;
13433 }
13434 }
13435 if (ai[0] == 0f)
13436 {
13437 if (velocity.Y == 0f)
13438 {
13439 velocity.X *= 0.8f;
13440 float num4 = 1f;
13441 if (ai[1] > 0f)
13442 {
13443 if (!flag2)
13444 {
13445 num4 += 2f;
13446 }
13447 if (!flag3)
13448 {
13449 num4 += 2f;
13450 }
13451 if (!flag)
13452 {
13453 num4 += 2f;
13454 }
13455 if (life < lifeMax)
13456 {
13457 num4 += 1f;
13458 }
13459 if (life < lifeMax / 2)
13460 {
13461 num4 += 4f;
13462 }
13463 if (life < lifeMax / 3)
13464 {
13465 num4 += 8f;
13466 }
13467 num4 *= num;
13468 if (Main.getGoodWorld)
13469 {
13470 num4 += 100f;
13471 }
13472 }
13473 ai[1] += num4;
13474 if (ai[1] >= 300f)
13475 {
13476 ai[1] = -20f;
13477 frameCounter = 0.0;
13478 }
13479 else if (ai[1] == -1f)
13480 {
13481 noTileCollide = true;
13482 TargetClosest();
13483 velocity.X = 4 * direction;
13484 if (life < lifeMax)
13485 {
13486 velocity.Y = -12.1f * (num + 9f) / 10f;
13487 if ((double)velocity.Y < -19.1)
13488 {
13489 velocity.Y = -19.1f;
13490 }
13491 }
13492 else
13493 {
13494 velocity.Y = -12.1f;
13495 }
13496 ai[0] = 1f;
13497 ai[1] = 0f;
13498 }
13499 }
13500 }
13501 else if (ai[0] == 1f)
13502 {
13503 if (velocity.Y == 0f)
13504 {
13506 ai[0] = 0f;
13507 for (int l = (int)position.X - 20; l < (int)position.X + width + 40; l += 20)
13508 {
13509 for (int m = 0; m < 4; m++)
13510 {
13511 int num5 = Dust.NewDust(new Vector2(position.X - 20f, position.Y + (float)height), width + 20, 4, 31, 0f, 0f, 100, default(Color), 1.5f);
13512 Main.dust[num5].velocity *= 0.2f;
13513 }
13514 int num6 = Gore.NewGore(new Vector2(l - 20, position.Y + (float)height - 8f), default(Vector2), Main.rand.Next(61, 64));
13515 Main.gore[num6].velocity *= 0.4f;
13516 }
13517 }
13518 else
13519 {
13520 TargetClosest();
13521 if (position.X < Main.player[target].position.X && position.X + (float)width > Main.player[target].position.X + (float)Main.player[target].width)
13522 {
13523 velocity.X *= 0.9f;
13524 if (base.Bottom.Y < Main.player[target].position.Y)
13525 {
13526 velocity.Y += 0.2f * (num + 1f) / 2f;
13527 }
13528 }
13529 else
13530 {
13531 if (direction < 0)
13532 {
13533 velocity.X -= 0.2f;
13534 }
13535 else if (direction > 0)
13536 {
13537 velocity.X += 0.2f;
13538 }
13539 float num7 = 3f;
13540 if (life < lifeMax)
13541 {
13542 num7 += 1f;
13543 }
13544 if (life < lifeMax / 2)
13545 {
13546 num7 += 1f;
13547 }
13548 if (life < lifeMax / 4)
13549 {
13550 num7 += 1f;
13551 }
13552 num7 *= (num + 1f) / 2f;
13553 if (velocity.X < 0f - num7)
13554 {
13555 velocity.X = 0f - num7;
13556 }
13557 if (velocity.X > num7)
13558 {
13559 velocity.X = num7;
13560 }
13561 }
13562 }
13563 }
13564 if (target <= 0 || target == 255 || Main.player[target].dead)
13565 {
13566 TargetClosest();
13567 }
13568 int num8 = 3000;
13569 if (Math.Abs(base.Center.X - Main.player[target].Center.X) + Math.Abs(base.Center.Y - Main.player[target].Center.Y) > (float)num8)
13570 {
13571 TargetClosest();
13572 if (Math.Abs(base.Center.X - Main.player[target].Center.X) + Math.Abs(base.Center.Y - Main.player[target].Center.Y) > (float)num8)
13573 {
13574 active = false;
13575 }
13576 }
13577 }
13578
13579 public static bool SpawnMechQueen(int onWhichPlayer)
13580 {
13581 if (AnyNPCs(127) || AnyNPCs(134) || AnyNPCs(125) || AnyNPCs(126))
13582 {
13583 return false;
13584 }
13586 {
13587 return false;
13588 }
13589 if (Main.netMode == 1)
13590 {
13591 NetMessage.SendData(61, -1, -1, null, onWhichPlayer, -16f);
13592 }
13593 else
13594 {
13595 mechQueen = -2;
13597 mechQueen = FindFirstNPC(127);
13598 NewNPC(GetBossSpawnSource(onWhichPlayer), (int)Main.npc[mechQueen].Center.X, (int)Main.npc[mechQueen].Center.Y, 125, 1);
13599 NewNPC(GetBossSpawnSource(onWhichPlayer), (int)Main.npc[mechQueen].Center.X, (int)Main.npc[mechQueen].Center.Y, 126, 1);
13600 int num = NewNPC(GetBossSpawnSource(onWhichPlayer), (int)Main.npc[mechQueen].Center.X, (int)Main.npc[mechQueen].Center.Y, 134, 1);
13601 NewNPC(GetBossSpawnSource(onWhichPlayer), (int)Main.npc[mechQueen].Center.X, (int)Main.npc[mechQueen].Center.Y, 139, 1, 0f, 0f, num, -1f);
13602 NewNPC(GetBossSpawnSource(onWhichPlayer), (int)Main.npc[mechQueen].Center.X, (int)Main.npc[mechQueen].Center.Y, 139, 1, 0f, 0f, num, 1f);
13603 }
13604 return true;
13605 }
13606
13607 public void AI()
13608 {
13609 //IL_50abb: Unknown result type (might be due to invalid IL or missing references)
13610 //IL_50889: Unknown result type (might be due to invalid IL or missing references)
13611 //IL_50896: Unknown result type (might be due to invalid IL or missing references)
13612 //IL_5089b: Unknown result type (might be due to invalid IL or missing references)
13613 //IL_4fcdb: Unknown result type (might be due to invalid IL or missing references)
13614 //IL_50b04: Unknown result type (might be due to invalid IL or missing references)
13615 //IL_50ae5: Unknown result type (might be due to invalid IL or missing references)
13616 //IL_50aea: Unknown result type (might be due to invalid IL or missing references)
13617 //IL_508c4: Unknown result type (might be due to invalid IL or missing references)
13618 //IL_508ee: Unknown result type (might be due to invalid IL or missing references)
13619 //IL_508f3: Unknown result type (might be due to invalid IL or missing references)
13620 if (aiStyle == 0)
13621 {
13622 if (Main.netMode != 1)
13623 {
13624 for (int i = 0; i < 255; i++)
13625 {
13626 if (Main.player[i].active && Main.player[i].talkNPC == whoAmI)
13627 {
13628 if (type == 589)
13629 {
13631 }
13632 if (type == 105)
13633 {
13635 }
13636 if (type == 106)
13637 {
13639 }
13640 if (type == 123)
13641 {
13643 }
13644 if (type == 354)
13645 {
13647 }
13648 if (type == 376)
13649 {
13651 }
13652 if (type == 579)
13653 {
13655 }
13656 }
13657 }
13658 }
13659 if (type != 376 && type != 579)
13660 {
13661 TargetClosest();
13663 }
13664 if (type == 376 || type == 579)
13665 {
13666 if (wet || Main.tile[(int)(base.Center.X / 16f), (int)(position.Y - 4f) / 16].liquid > 0)
13667 {
13668 velocity.Y = -0.4f;
13669 int num = 1;
13670 if (base.Center.X / 16f > (float)(Main.maxTilesX / 2))
13671 {
13672 num = -1;
13673 }
13674 int num2 = 12;
13675 int num3 = (int)base.Center.X / 16;
13676 int j = (int)base.Center.Y / 16;
13677 bool flag = false;
13678 if (num > 0)
13679 {
13680 for (int k = num3; k < num3 + num2; k++)
13681 {
13682 if (WorldGen.SolidTile(k, j))
13683 {
13684 flag = true;
13685 }
13686 }
13687 }
13688 else
13689 {
13690 for (int l = num3; l > num3 - num2; l--)
13691 {
13692 if (WorldGen.SolidTile(l, j))
13693 {
13694 flag = true;
13695 }
13696 }
13697 }
13698 if (type == 579)
13699 {
13700 flag = true;
13701 }
13702 if (flag)
13703 {
13704 velocity.X *= 0.99f;
13705 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
13706 {
13707 velocity.X = 0f;
13708 }
13709 return;
13710 }
13711 velocity.X += (float)num * 0.01f;
13712 if (velocity.X > 0.2f)
13713 {
13714 velocity.X *= 0.95f;
13715 }
13716 if (velocity.X < -0.2f)
13717 {
13718 velocity.X *= 0.95f;
13719 }
13720 }
13721 else
13722 {
13723 velocity.X *= 0.93f;
13724 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
13725 {
13726 velocity.X = 0f;
13727 }
13728 }
13729 }
13730 else
13731 {
13732 velocity.X *= 0.93f;
13733 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
13734 {
13735 velocity.X = 0f;
13736 }
13737 }
13738 return;
13739 }
13740 if (aiStyle == 1)
13741 {
13742 AI_001_Slimes();
13743 return;
13744 }
13745 if (aiStyle == 2)
13746 {
13748 return;
13749 }
13750 if (aiStyle == 3)
13751 {
13753 return;
13754 }
13755 if (aiStyle == 4)
13756 {
13757 bool flag2 = false;
13758 if (Main.expertMode && (double)life < (double)lifeMax * 0.12)
13759 {
13760 flag2 = true;
13761 }
13762 bool flag3 = false;
13763 if (Main.expertMode && (double)life < (double)lifeMax * 0.04)
13764 {
13765 flag3 = true;
13766 }
13767 float num4 = 20f;
13768 if (flag3)
13769 {
13770 num4 = 10f;
13771 }
13772 if (target < 0 || target == 255 || Main.player[target].dead || !Main.player[target].active)
13773 {
13774 TargetClosest();
13775 }
13776 bool dead = Main.player[target].dead;
13777 float num5 = position.X + (float)(width / 2) - Main.player[target].position.X - (float)(Main.player[target].width / 2);
13778 float num6 = position.Y + (float)height - 59f - Main.player[target].position.Y - (float)(Main.player[target].height / 2);
13779 float num7 = (float)Math.Atan2(num6, num5) + 1.57f;
13780 if (num7 < 0f)
13781 {
13782 num7 += 6.283f;
13783 }
13784 else if ((double)num7 > 6.283)
13785 {
13786 num7 -= 6.283f;
13787 }
13788 float num8 = 0f;
13789 if (this.ai[0] == 0f && this.ai[1] == 0f)
13790 {
13791 num8 = 0.02f;
13792 }
13793 if (this.ai[0] == 0f && this.ai[1] == 2f && this.ai[2] > 40f)
13794 {
13795 num8 = 0.05f;
13796 }
13797 if (this.ai[0] == 3f && this.ai[1] == 0f)
13798 {
13799 num8 = 0.05f;
13800 }
13801 if (this.ai[0] == 3f && this.ai[1] == 2f && this.ai[2] > 40f)
13802 {
13803 num8 = 0.08f;
13804 }
13805 if (this.ai[0] == 3f && this.ai[1] == 4f && this.ai[2] > num4)
13806 {
13807 num8 = 0.15f;
13808 }
13809 if (this.ai[0] == 3f && this.ai[1] == 5f)
13810 {
13811 num8 = 0.05f;
13812 }
13813 if (Main.expertMode)
13814 {
13815 num8 *= 1.5f;
13816 }
13817 if (flag3 && Main.expertMode)
13818 {
13819 num8 = 0f;
13820 }
13821 if (rotation < num7)
13822 {
13823 if ((double)(num7 - rotation) > 3.1415)
13824 {
13825 rotation -= num8;
13826 }
13827 else
13828 {
13829 rotation += num8;
13830 }
13831 }
13832 else if (rotation > num7)
13833 {
13834 if ((double)(rotation - num7) > 3.1415)
13835 {
13836 rotation += num8;
13837 }
13838 else
13839 {
13840 rotation -= num8;
13841 }
13842 }
13843 if (rotation > num7 - num8 && rotation < num7 + num8)
13844 {
13845 rotation = num7;
13846 }
13847 if (rotation < 0f)
13848 {
13849 rotation += 6.283f;
13850 }
13851 else if ((double)rotation > 6.283)
13852 {
13853 rotation -= 6.283f;
13854 }
13855 if (rotation > num7 - num8 && rotation < num7 + num8)
13856 {
13857 rotation = num7;
13858 }
13859 if (Main.rand.Next(5) == 0)
13860 {
13861 int num9 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
13862 Main.dust[num9].velocity.X *= 0.5f;
13863 Main.dust[num9].velocity.Y *= 0.1f;
13864 }
13865 reflectsProjectiles = false;
13866 if (Main.IsItDay() || dead)
13867 {
13868 velocity.Y -= 0.04f;
13869 EncourageDespawn(10);
13870 return;
13871 }
13872 if (this.ai[0] == 0f)
13873 {
13874 if (this.ai[1] == 0f)
13875 {
13876 float num10 = 5f;
13877 float num11 = 0.04f;
13878 if (Main.expertMode)
13879 {
13880 num11 = 0.15f;
13881 num10 = 7f;
13882 }
13883 if (Main.getGoodWorld)
13884 {
13885 num11 += 0.05f;
13886 num10 += 1f;
13887 }
13888 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
13889 float num12 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector.X;
13890 float num13 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 200f - vector.Y;
13891 float num14 = (float)Math.Sqrt(num12 * num12 + num13 * num13);
13892 float num15 = num14;
13893 num14 = num10 / num14;
13894 num12 *= num14;
13895 num13 *= num14;
13896 if (velocity.X < num12)
13897 {
13898 velocity.X += num11;
13899 if (velocity.X < 0f && num12 > 0f)
13900 {
13901 velocity.X += num11;
13902 }
13903 }
13904 else if (velocity.X > num12)
13905 {
13906 velocity.X -= num11;
13907 if (velocity.X > 0f && num12 < 0f)
13908 {
13909 velocity.X -= num11;
13910 }
13911 }
13912 if (velocity.Y < num13)
13913 {
13914 velocity.Y += num11;
13915 if (velocity.Y < 0f && num13 > 0f)
13916 {
13917 velocity.Y += num11;
13918 }
13919 }
13920 else if (velocity.Y > num13)
13921 {
13922 velocity.Y -= num11;
13923 if (velocity.Y > 0f && num13 < 0f)
13924 {
13925 velocity.Y -= num11;
13926 }
13927 }
13928 this.ai[2] += 1f;
13929 float num16 = 600f;
13930 if (Main.expertMode)
13931 {
13932 num16 *= 0.35f;
13933 }
13934 if (this.ai[2] >= num16)
13935 {
13936 this.ai[1] = 1f;
13937 this.ai[2] = 0f;
13938 this.ai[3] = 0f;
13939 target = 255;
13940 netUpdate = true;
13941 }
13942 else if ((position.Y + (float)height < Main.player[target].position.Y && num15 < 500f) || (Main.expertMode && num15 < 500f))
13943 {
13944 if (!Main.player[target].dead)
13945 {
13946 this.ai[3] += 1f;
13947 }
13948 float num17 = 110f;
13949 if (Main.expertMode)
13950 {
13951 num17 *= 0.4f;
13952 }
13953 if (Main.getGoodWorld)
13954 {
13955 num17 *= 0.8f;
13956 }
13957 if (this.ai[3] >= num17)
13958 {
13959 this.ai[3] = 0f;
13960 rotation = num7;
13961 float num18 = 5f;
13962 if (Main.expertMode)
13963 {
13964 num18 = 6f;
13965 }
13966 float num19 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector.X;
13967 float num20 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector.Y;
13968 float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20);
13969 num21 = num18 / num21;
13971 Vector2 vector3 = default(Vector2);
13972 vector3.X = num19 * num21;
13973 vector3.Y = num20 * num21;
13974 vector2.X += vector3.X * 10f;
13975 vector2.Y += vector3.Y * 10f;
13976 if (Main.netMode != 1)
13977 {
13978 int num22 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector2.X, (int)vector2.Y, 5);
13979 Main.npc[num22].velocity.X = vector3.X;
13980 Main.npc[num22].velocity.Y = vector3.Y;
13981 if (Main.netMode == 2 && num22 < 200)
13982 {
13983 NetMessage.SendData(23, -1, -1, null, num22);
13984 }
13985 }
13986 SoundEngine.PlaySound(3, (int)vector2.X, (int)vector2.Y);
13987 for (int m = 0; m < 10; m++)
13988 {
13989 Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f);
13990 }
13991 }
13992 }
13993 }
13994 else if (this.ai[1] == 1f)
13995 {
13996 rotation = num7;
13997 float num23 = 6f;
13998 if (Main.expertMode)
13999 {
14000 num23 = 7f;
14001 }
14002 if (Main.getGoodWorld)
14003 {
14004 num23 += 1f;
14005 }
14006 Vector2 vector4 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14007 float num24 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector4.X;
14008 float num25 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector4.Y;
14009 float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25);
14010 num26 = num23 / num26;
14011 velocity.X = num24 * num26;
14012 velocity.Y = num25 * num26;
14013 this.ai[1] = 2f;
14014 netUpdate = true;
14015 if (netSpam > 10)
14016 {
14017 netSpam = 10;
14018 }
14019 }
14020 else if (this.ai[1] == 2f)
14021 {
14022 this.ai[2] += 1f;
14023 if (this.ai[2] >= 40f)
14024 {
14025 velocity *= 0.98f;
14026 if (Main.expertMode)
14027 {
14028 velocity *= 0.985f;
14029 }
14030 if (Main.getGoodWorld)
14031 {
14032 velocity *= 0.99f;
14033 }
14034 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
14035 {
14036 velocity.X = 0f;
14037 }
14038 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
14039 {
14040 velocity.Y = 0f;
14041 }
14042 }
14043 else
14044 {
14045 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
14046 }
14047 int num27 = 150;
14048 if (Main.expertMode)
14049 {
14050 num27 = 100;
14051 }
14052 if (Main.getGoodWorld)
14053 {
14054 num27 -= 15;
14055 }
14056 if (this.ai[2] >= (float)num27)
14057 {
14058 this.ai[3] += 1f;
14059 this.ai[2] = 0f;
14060 target = 255;
14061 rotation = num7;
14062 if (this.ai[3] >= 3f)
14063 {
14064 this.ai[1] = 0f;
14065 this.ai[3] = 0f;
14066 }
14067 else
14068 {
14069 this.ai[1] = 1f;
14070 }
14071 }
14072 }
14073 float num28 = 0.5f;
14074 if (Main.expertMode)
14075 {
14076 num28 = 0.65f;
14077 }
14078 if ((float)life < (float)lifeMax * num28)
14079 {
14080 this.ai[0] = 1f;
14081 this.ai[1] = 0f;
14082 this.ai[2] = 0f;
14083 this.ai[3] = 0f;
14084 netUpdate = true;
14085 if (netSpam > 10)
14086 {
14087 netSpam = 10;
14088 }
14089 }
14090 return;
14091 }
14092 if (this.ai[0] == 1f || this.ai[0] == 2f)
14093 {
14094 if (this.ai[0] == 1f || this.ai[3] == 1f)
14095 {
14096 this.ai[2] += 0.005f;
14097 if ((double)this.ai[2] > 0.5)
14098 {
14099 this.ai[2] = 0.5f;
14100 }
14101 }
14102 else
14103 {
14104 this.ai[2] -= 0.005f;
14105 if (this.ai[2] < 0f)
14106 {
14107 this.ai[2] = 0f;
14108 }
14109 }
14110 rotation += this.ai[2];
14111 this.ai[1] += 1f;
14112 if (Main.getGoodWorld)
14113 {
14114 reflectsProjectiles = true;
14115 }
14116 int num29 = 20;
14117 if (Main.getGoodWorld && life < lifeMax / 3)
14118 {
14119 num29 = 10;
14120 }
14121 if (Main.expertMode && this.ai[1] % (float)num29 == 0f)
14122 {
14123 float num30 = 5f;
14124 Vector2 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14125 float num31 = Main.rand.Next(-200, 200);
14126 float num32 = Main.rand.Next(-200, 200);
14127 if (Main.getGoodWorld)
14128 {
14129 num31 *= 3f;
14130 num32 *= 3f;
14131 }
14132 float num33 = (float)Math.Sqrt(num31 * num31 + num32 * num32);
14133 num33 = num30 / num33;
14135 Vector2 vector7 = default(Vector2);
14136 vector7.X = num31 * num33;
14137 vector7.Y = num32 * num33;
14138 vector6.X += vector7.X * 10f;
14139 vector6.Y += vector7.Y * 10f;
14140 if (Main.netMode != 1)
14141 {
14142 int num34 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector6.X, (int)vector6.Y, 5);
14143 Main.npc[num34].velocity.X = vector7.X;
14144 Main.npc[num34].velocity.Y = vector7.Y;
14145 if (Main.netMode == 2 && num34 < 200)
14146 {
14147 NetMessage.SendData(23, -1, -1, null, num34);
14148 }
14149 }
14150 for (int n = 0; n < 10; n++)
14151 {
14152 Dust.NewDust(vector6, 20, 20, 5, vector7.X * 0.4f, vector7.Y * 0.4f);
14153 }
14154 }
14155 if (this.ai[1] >= 100f)
14156 {
14157 if (this.ai[3] == 1f)
14158 {
14159 this.ai[3] = 0f;
14160 this.ai[1] = 0f;
14161 }
14162 else
14163 {
14164 this.ai[0] += 1f;
14165 this.ai[1] = 0f;
14166 if (this.ai[0] == 3f)
14167 {
14168 this.ai[2] = 0f;
14169 }
14170 else
14171 {
14172 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
14173 for (int num35 = 0; num35 < 2; num35++)
14174 {
14175 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8);
14176 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7);
14177 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6);
14178 }
14179 for (int num36 = 0; num36 < 20; num36++)
14180 {
14181 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
14182 }
14183 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
14184 }
14185 }
14186 }
14187 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
14188 velocity.X *= 0.98f;
14189 velocity.Y *= 0.98f;
14190 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
14191 {
14192 velocity.X = 0f;
14193 }
14194 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
14195 {
14196 velocity.Y = 0f;
14197 }
14198 return;
14199 }
14200 defense = 0;
14201 int num37 = 23;
14202 int num38 = 18;
14203 if (Main.expertMode)
14204 {
14205 if (flag2)
14206 {
14207 defense = -15;
14208 }
14209 if (flag3)
14210 {
14211 num38 = 20;
14212 defense = -30;
14213 }
14214 }
14217 if (this.ai[1] == 0f && flag2)
14218 {
14219 this.ai[1] = 5f;
14220 }
14221 if (this.ai[1] == 0f)
14222 {
14223 float num39 = 6f;
14224 float num40 = 0.07f;
14225 Vector2 vector8 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14226 float num41 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector8.X;
14227 float num42 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 120f - vector8.Y;
14228 float num43 = (float)Math.Sqrt(num41 * num41 + num42 * num42);
14229 if (num43 > 400f && Main.expertMode)
14230 {
14231 num39 += 1f;
14232 num40 += 0.05f;
14233 if (num43 > 600f)
14234 {
14235 num39 += 1f;
14236 num40 += 0.05f;
14237 if (num43 > 800f)
14238 {
14239 num39 += 1f;
14240 num40 += 0.05f;
14241 }
14242 }
14243 }
14244 if (Main.getGoodWorld)
14245 {
14246 num39 += 1f;
14247 num40 += 0.1f;
14248 }
14249 num43 = num39 / num43;
14250 num41 *= num43;
14251 num42 *= num43;
14252 if (velocity.X < num41)
14253 {
14254 velocity.X += num40;
14255 if (velocity.X < 0f && num41 > 0f)
14256 {
14257 velocity.X += num40;
14258 }
14259 }
14260 else if (velocity.X > num41)
14261 {
14262 velocity.X -= num40;
14263 if (velocity.X > 0f && num41 < 0f)
14264 {
14265 velocity.X -= num40;
14266 }
14267 }
14268 if (velocity.Y < num42)
14269 {
14270 velocity.Y += num40;
14271 if (velocity.Y < 0f && num42 > 0f)
14272 {
14273 velocity.Y += num40;
14274 }
14275 }
14276 else if (velocity.Y > num42)
14277 {
14278 velocity.Y -= num40;
14279 if (velocity.Y > 0f && num42 < 0f)
14280 {
14281 velocity.Y -= num40;
14282 }
14283 }
14284 this.ai[2] += 1f;
14285 if (this.ai[2] >= 200f)
14286 {
14287 this.ai[1] = 1f;
14288 this.ai[2] = 0f;
14289 this.ai[3] = 0f;
14290 if (Main.expertMode && (double)life < (double)lifeMax * 0.35)
14291 {
14292 this.ai[1] = 3f;
14293 }
14294 target = 255;
14295 netUpdate = true;
14296 }
14297 if (Main.expertMode && flag3)
14298 {
14299 TargetClosest();
14300 netUpdate = true;
14301 this.ai[1] = 3f;
14302 this.ai[2] = 0f;
14303 this.ai[3] -= 1000f;
14304 }
14305 }
14306 else if (this.ai[1] == 1f)
14307 {
14308 SoundEngine.PlaySound(36, (int)position.X, (int)position.Y, 0);
14309 rotation = num7;
14310 float num44 = 6.8f;
14311 if (Main.expertMode && this.ai[3] == 1f)
14312 {
14313 num44 *= 1.15f;
14314 }
14315 if (Main.expertMode && this.ai[3] == 2f)
14316 {
14317 num44 *= 1.3f;
14318 }
14319 if (Main.getGoodWorld)
14320 {
14321 num44 *= 1.2f;
14322 }
14323 Vector2 vector9 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14324 float num45 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector9.X;
14325 float num46 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector9.Y;
14326 float num47 = (float)Math.Sqrt(num45 * num45 + num46 * num46);
14327 num47 = num44 / num47;
14328 velocity.X = num45 * num47;
14329 velocity.Y = num46 * num47;
14330 this.ai[1] = 2f;
14331 netUpdate = true;
14332 if (netSpam > 10)
14333 {
14334 netSpam = 10;
14335 }
14336 }
14337 else if (this.ai[1] == 2f)
14338 {
14339 float num48 = 40f;
14340 this.ai[2] += 1f;
14341 if (Main.expertMode)
14342 {
14343 num48 = 50f;
14344 }
14345 if (this.ai[2] >= num48)
14346 {
14347 velocity *= 0.97f;
14348 if (Main.expertMode)
14349 {
14350 velocity *= 0.98f;
14351 }
14352 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
14353 {
14354 velocity.X = 0f;
14355 }
14356 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
14357 {
14358 velocity.Y = 0f;
14359 }
14360 }
14361 else
14362 {
14363 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
14364 }
14365 int num49 = 130;
14366 if (Main.expertMode)
14367 {
14368 num49 = 90;
14369 }
14370 if (this.ai[2] >= (float)num49)
14371 {
14372 this.ai[3] += 1f;
14373 this.ai[2] = 0f;
14374 target = 255;
14375 rotation = num7;
14376 if (this.ai[3] >= 3f)
14377 {
14378 this.ai[1] = 0f;
14379 this.ai[3] = 0f;
14380 if (Main.expertMode && Main.netMode != 1 && (double)life < (double)lifeMax * 0.5)
14381 {
14382 this.ai[1] = 3f;
14383 this.ai[3] += Main.rand.Next(1, 4);
14384 }
14385 netUpdate = true;
14386 if (netSpam > 10)
14387 {
14388 netSpam = 10;
14389 }
14390 }
14391 else
14392 {
14393 this.ai[1] = 1f;
14394 }
14395 }
14396 }
14397 else if (this.ai[1] == 3f)
14398 {
14399 if (this.ai[3] == 4f && flag2 && base.Center.Y > Main.player[target].Center.Y)
14400 {
14401 TargetClosest();
14402 this.ai[1] = 0f;
14403 this.ai[2] = 0f;
14404 this.ai[3] = 0f;
14405 netUpdate = true;
14406 if (netSpam > 10)
14407 {
14408 netSpam = 10;
14409 }
14410 }
14411 else if (Main.netMode != 1)
14412 {
14413 TargetClosest();
14414 float num50 = 20f;
14415 Vector2 vector10 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14416 float num51 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector10.X;
14417 float num52 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector10.Y;
14418 float num53 = Math.Abs(Main.player[target].velocity.X) + Math.Abs(Main.player[target].velocity.Y) / 4f;
14419 num53 += 10f - num53;
14420 if (num53 < 5f)
14421 {
14422 num53 = 5f;
14423 }
14424 if (num53 > 15f)
14425 {
14426 num53 = 15f;
14427 }
14428 if (this.ai[2] == -1f && !flag3)
14429 {
14430 num53 *= 4f;
14431 num50 *= 1.3f;
14432 }
14433 if (flag3)
14434 {
14435 num53 *= 2f;
14436 }
14437 num51 -= Main.player[target].velocity.X * num53;
14438 num52 -= Main.player[target].velocity.Y * num53 / 4f;
14439 num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
14440 num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
14441 if (flag3)
14442 {
14443 num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
14444 num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
14445 }
14446 float num54 = (float)Math.Sqrt(num51 * num51 + num52 * num52);
14447 float num55 = num54;
14448 num54 = num50 / num54;
14449 velocity.X = num51 * num54;
14450 velocity.Y = num52 * num54;
14451 velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f;
14452 velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f;
14453 if (flag3)
14454 {
14455 velocity.X += (float)Main.rand.Next(-50, 51) * 0.1f;
14456 velocity.Y += (float)Main.rand.Next(-50, 51) * 0.1f;
14457 float num56 = Math.Abs(velocity.X);
14458 float num57 = Math.Abs(velocity.Y);
14459 if (base.Center.X > Main.player[target].Center.X)
14460 {
14461 num57 *= -1f;
14462 }
14463 if (base.Center.Y > Main.player[target].Center.Y)
14464 {
14465 num56 *= -1f;
14466 }
14467 velocity.X = num57 + velocity.X;
14468 velocity.Y = num56 + velocity.Y;
14470 velocity *= num50;
14471 velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f;
14472 velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f;
14473 }
14474 else if (num55 < 100f)
14475 {
14476 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
14477 {
14478 float num58 = Math.Abs(velocity.X);
14479 float num59 = Math.Abs(velocity.Y);
14480 if (base.Center.X > Main.player[target].Center.X)
14481 {
14482 num59 *= -1f;
14483 }
14484 if (base.Center.Y > Main.player[target].Center.Y)
14485 {
14486 num58 *= -1f;
14487 }
14488 velocity.X = num59;
14489 velocity.Y = num58;
14490 }
14491 }
14492 else if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
14493 {
14494 float num60 = (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) / 2f;
14495 float num61 = num60;
14496 if (base.Center.X > Main.player[target].Center.X)
14497 {
14498 num61 *= -1f;
14499 }
14500 if (base.Center.Y > Main.player[target].Center.Y)
14501 {
14502 num60 *= -1f;
14503 }
14504 velocity.X = num61;
14505 velocity.Y = num60;
14506 }
14507 this.ai[1] = 4f;
14508 netUpdate = true;
14509 if (netSpam > 10)
14510 {
14511 netSpam = 10;
14512 }
14513 }
14514 }
14515 else if (this.ai[1] == 4f)
14516 {
14517 if (this.ai[2] == 0f)
14518 {
14519 SoundEngine.PlaySound(36, (int)position.X, (int)position.Y, -1);
14520 }
14521 float num62 = num4;
14522 this.ai[2] += 1f;
14523 if (this.ai[2] == num62 && Vector2.Distance(position, Main.player[target].position) < 200f)
14524 {
14525 this.ai[2] -= 1f;
14526 }
14527 if (this.ai[2] >= num62)
14528 {
14529 velocity *= 0.95f;
14530 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
14531 {
14532 velocity.X = 0f;
14533 }
14534 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
14535 {
14536 velocity.Y = 0f;
14537 }
14538 }
14539 else
14540 {
14541 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
14542 }
14543 float num63 = num62 + 13f;
14544 if (this.ai[2] >= num63)
14545 {
14546 netUpdate = true;
14547 if (netSpam > 10)
14548 {
14549 netSpam = 10;
14550 }
14551 this.ai[3] += 1f;
14552 this.ai[2] = 0f;
14553 if (this.ai[3] >= 5f)
14554 {
14555 this.ai[1] = 0f;
14556 this.ai[3] = 0f;
14558 {
14559 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
14560 this.ai[0] = 2f;
14561 this.ai[1] = 0f;
14562 this.ai[2] = 0f;
14563 this.ai[3] = 1f;
14564 netUpdate = true;
14565 }
14566 }
14567 else
14568 {
14569 this.ai[1] = 3f;
14570 }
14571 }
14572 }
14573 else if (this.ai[1] == 5f)
14574 {
14575 float num64 = 600f;
14576 float num65 = 9f;
14577 float num66 = 0.3f;
14578 Vector2 vector11 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
14579 float num67 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector11.X;
14580 float num68 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) + num64 - vector11.Y;
14581 float num69 = (float)Math.Sqrt(num67 * num67 + num68 * num68);
14582 num69 = num65 / num69;
14583 num67 *= num69;
14584 num68 *= num69;
14585 if (velocity.X < num67)
14586 {
14587 velocity.X += num66;
14588 if (velocity.X < 0f && num67 > 0f)
14589 {
14590 velocity.X += num66;
14591 }
14592 }
14593 else if (velocity.X > num67)
14594 {
14595 velocity.X -= num66;
14596 if (velocity.X > 0f && num67 < 0f)
14597 {
14598 velocity.X -= num66;
14599 }
14600 }
14601 if (velocity.Y < num68)
14602 {
14603 velocity.Y += num66;
14604 if (velocity.Y < 0f && num68 > 0f)
14605 {
14606 velocity.Y += num66;
14607 }
14608 }
14609 else if (velocity.Y > num68)
14610 {
14611 velocity.Y -= num66;
14612 if (velocity.Y > 0f && num68 < 0f)
14613 {
14614 velocity.Y -= num66;
14615 }
14616 }
14617 this.ai[2] += 1f;
14618 if (this.ai[2] >= 70f)
14619 {
14620 TargetClosest();
14621 this.ai[1] = 3f;
14622 this.ai[2] = -1f;
14623 this.ai[3] = Main.rand.Next(-3, 1);
14624 netUpdate = true;
14625 }
14626 }
14627 if (flag3 && this.ai[1] == 5f)
14628 {
14629 this.ai[1] = 3f;
14630 }
14631 return;
14632 }
14633 if (aiStyle == 5)
14634 {
14636 return;
14637 }
14638 if (aiStyle == 6)
14639 {
14640 AI_006_Worms();
14641 return;
14642 }
14643 if (aiStyle == 7)
14644 {
14646 return;
14647 }
14648 if (aiStyle == 8)
14649 {
14650 TargetClosest();
14651 velocity.X *= 0.93f;
14652 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
14653 {
14654 velocity.X = 0f;
14655 }
14656 if (this.ai[0] == 0f)
14657 {
14658 this.ai[0] = 500f;
14659 }
14660 if (type == 172)
14661 {
14662 if (alpha < 255)
14663 {
14664 alpha++;
14665 }
14666 if (justHit)
14667 {
14668 alpha = 0;
14669 }
14670 }
14671 if (this.ai[2] != 0f && this.ai[3] != 0f)
14672 {
14674 if (type == 172)
14675 {
14676 alpha = 255;
14677 }
14679 for (int num70 = 0; num70 < 50; num70++)
14680 {
14681 if (type == 29 || type == 45)
14682 {
14683 int num71 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 100, default(Color), Main.rand.Next(1, 3));
14684 Dust dust = Main.dust[num71];
14685 dust.velocity *= 3f;
14686 if (Main.dust[num71].scale > 1f)
14687 {
14688 Main.dust[num71].noGravity = true;
14689 }
14690 }
14691 else if (type == 32)
14692 {
14693 int num72 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, 0f, 0f, 100, default(Color), 1.5f);
14694 Dust dust = Main.dust[num72];
14695 dust.velocity *= 3f;
14696 Main.dust[num72].noGravity = true;
14697 }
14698 else if (type == 283 || type == 284)
14699 {
14700 int num73 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 173);
14701 Dust dust = Main.dust[num73];
14702 dust.velocity *= 2f;
14703 Main.dust[num73].scale = 1.4f;
14704 }
14705 else if (type == 285 || type == 286)
14706 {
14707 int num74 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.5f);
14708 Dust dust = Main.dust[num74];
14709 dust.velocity *= 3f;
14710 Main.dust[num74].noGravity = true;
14711 }
14712 else if (type == 281 || type == 282)
14713 {
14714 int num75 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.5f);
14715 Dust dust = Main.dust[num75];
14716 dust.velocity *= 3f;
14717 Main.dust[num75].noGravity = true;
14718 }
14719 else if (type == 172)
14720 {
14721 int num76 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 106, 0f, 0f, 100, default(Color), 2.5f);
14722 Dust dust = Main.dust[num76];
14723 dust.velocity *= 3f;
14724 Main.dust[num76].noGravity = true;
14725 }
14726 else if (type == 533)
14727 {
14728 int num77 = Dust.NewDust(position, width, height, 27, 0f, 0f, 100, default(Color), 2.5f);
14729 Dust dust = Main.dust[num77];
14730 dust.velocity *= 3f;
14731 Main.dust[num77].noGravity = true;
14732 }
14733 else
14734 {
14735 int num78 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
14736 Dust dust = Main.dust[num78];
14737 dust.velocity *= 3f;
14738 Main.dust[num78].noGravity = true;
14739 }
14740 }
14742 position.X = this.ai[2] * 16f - (float)(width / 2) + 8f;
14743 position.Y = this.ai[3] * 16f - (float)height;
14744 netOffset *= 0f;
14745 velocity.X = 0f;
14746 velocity.Y = 0f;
14747 this.ai[2] = 0f;
14748 this.ai[3] = 0f;
14750 for (int num79 = 0; num79 < 50; num79++)
14751 {
14752 if (type == 29 || type == 45)
14753 {
14754 int num80 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 100, default(Color), Main.rand.Next(1, 3));
14755 Dust dust = Main.dust[num80];
14756 dust.velocity *= 3f;
14757 if (Main.dust[num80].scale > 1f)
14758 {
14759 Main.dust[num80].noGravity = true;
14760 }
14761 }
14762 else if (type == 32)
14763 {
14764 int num81 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, 0f, 0f, 100, default(Color), 1.5f);
14765 Dust dust = Main.dust[num81];
14766 dust.velocity *= 3f;
14767 Main.dust[num81].noGravity = true;
14768 }
14769 else if (type == 172)
14770 {
14771 int num82 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 106, 0f, 0f, 100, default(Color), 2.5f);
14772 Dust dust = Main.dust[num82];
14773 dust.velocity *= 3f;
14774 Main.dust[num82].noGravity = true;
14775 }
14776 else if (type == 283 || type == 284)
14777 {
14778 int num83 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 173);
14779 Dust dust = Main.dust[num83];
14780 dust.velocity *= 2f;
14781 Main.dust[num83].scale = 1.4f;
14782 }
14783 else if (type == 285 || type == 286)
14784 {
14785 int num84 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.5f);
14786 Dust dust = Main.dust[num84];
14787 dust.velocity *= 3f;
14788 Main.dust[num84].noGravity = true;
14789 }
14790 else if (type == 281 || type == 282)
14791 {
14792 int num85 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.5f);
14793 Dust dust = Main.dust[num85];
14794 dust.velocity *= 3f;
14795 Main.dust[num85].noGravity = true;
14796 }
14797 else if (type == 533)
14798 {
14799 int num86 = Dust.NewDust(position, width, height, 27, 0f, 0f, 100, default(Color), 2.5f);
14800 Dust dust = Main.dust[num86];
14801 dust.velocity *= 3f;
14802 Main.dust[num86].noGravity = true;
14803 }
14804 else
14805 {
14806 int num87 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
14807 Dust dust = Main.dust[num87];
14808 dust.velocity *= 3f;
14809 Main.dust[num87].noGravity = true;
14810 }
14811 }
14812 }
14813 this.ai[0] += 1f;
14814 if (type == 283 || type == 284)
14815 {
14816 if (this.ai[0] == 100f || this.ai[0] == 150f || this.ai[0] == 200f || this.ai[0] == 250f || this.ai[0] == 300f)
14817 {
14818 this.ai[1] = 30f;
14819 netUpdate = true;
14820 }
14821 if (this.ai[0] >= 450f)
14822 {
14823 this.ai[0] = 700f;
14824 }
14825 }
14826 else if (type == 172)
14827 {
14828 if (this.ai[0] == 75f || this.ai[0] == 150f || this.ai[0] == 225f || this.ai[0] == 300f || this.ai[0] == 375f || this.ai[0] == 450f)
14829 {
14830 this.ai[1] = 30f;
14831 netUpdate = true;
14832 }
14833 }
14834 else if (type == 533)
14835 {
14836 if (this.ai[0] == 180f)
14837 {
14838 this.ai[1] = 181f;
14839 netUpdate = true;
14840 }
14841 }
14842 else if (type == 281 || type == 282)
14843 {
14844 if (this.ai[0] == 100f || this.ai[0] == 120f || this.ai[0] == 140f || this.ai[0] == 200f || this.ai[0] == 220f || this.ai[0] == 240f || this.ai[0] == 300f || this.ai[0] == 320f || this.ai[0] == 340f)
14845 {
14846 this.ai[1] = 30f;
14847 netUpdate = true;
14848 }
14849 if (this.ai[0] >= 540f)
14850 {
14851 this.ai[0] = 700f;
14852 }
14853 }
14854 else
14855 {
14856 if (Main.getGoodWorld && type == 24 && AnyNPCs(113))
14857 {
14858 this.ai[0] += 1f;
14859 if (this.ai[0] % 2f == 1f)
14860 {
14861 this.ai[0] -= 1f;
14862 }
14863 }
14864 if (this.ai[0] == 100f || this.ai[0] == 200f || this.ai[0] == 300f)
14865 {
14866 this.ai[1] = 30f;
14867 netUpdate = true;
14868 }
14869 }
14870 if ((type == 285 || type == 286) && this.ai[0] > 400f)
14871 {
14872 this.ai[0] = 650f;
14873 }
14874 if (type == 533 && this.ai[0] >= 360f)
14875 {
14876 this.ai[0] = 650f;
14877 }
14878 if (this.ai[0] >= 650f && Main.netMode != 1)
14879 {
14880 this.ai[0] = 1f;
14881 int targetTileX = (int)Main.player[target].Center.X / 16;
14882 int targetTileY = (int)Main.player[target].Center.Y / 16;
14885 {
14886 this.ai[1] = 20f;
14887 this.ai[2] = chosenTile.X;
14888 this.ai[3] = chosenTile.Y;
14889 }
14890 netUpdate = true;
14891 }
14892 if (this.ai[1] > 0f)
14893 {
14894 this.ai[1] -= 1f;
14895 if (type == 533)
14896 {
14897 if (this.ai[1] % 30f == 0f && this.ai[1] / 30f < 5f)
14898 {
14900 if (Main.netMode != 1)
14901 {
14902 Point point = base.Center.ToTileCoordinates();
14903 Point point2 = Main.player[target].Center.ToTileCoordinates();
14904 Vector2 vector12 = Main.player[target].Center - base.Center;
14905 int num88 = 6;
14906 int num89 = 6;
14907 int num90 = 0;
14908 int num91 = 2;
14909 int num92 = 0;
14910 bool flag4 = false;
14911 if (vector12.Length() > 2000f)
14912 {
14913 flag4 = true;
14914 }
14915 while (!flag4 && num92 < 50)
14916 {
14917 num92++;
14918 int num93 = Main.rand.Next(point2.X - num88, point2.X + num88 + 1);
14919 int num94 = Main.rand.Next(point2.Y - num88, point2.Y + num88 + 1);
14921 {
14922 bool flag5 = true;
14923 if (flag5 && Main.tile[num93, num94].lava())
14924 {
14925 flag5 = false;
14926 }
14928 {
14929 flag5 = false;
14930 }
14931 if (flag5)
14932 {
14933 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), num93 * 16 + 8, num94 * 16 + 8, 0f, 0f, 596, 0, 1f, Main.myPlayer, target);
14934 flag4 = true;
14935 break;
14936 }
14937 }
14938 }
14939 }
14940 }
14941 }
14942 else if (this.ai[1] == 25f)
14943 {
14944 if (type >= 281 && type <= 286)
14945 {
14946 if (Main.netMode != 1)
14947 {
14948 float num95 = 6f;
14949 if (type == 285 || type == 286)
14950 {
14951 num95 = 8f;
14952 }
14953 if (type == 281 || type == 282)
14954 {
14955 num95 = 4f;
14956 }
14957 Vector2 vector13 = new Vector2(position.X + (float)width * 0.5f, position.Y);
14958 float num96 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector13.X;
14959 float num97 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector13.Y;
14960 if (type == 283 || type == 284)
14961 {
14962 num96 += (float)Main.rand.Next(-30, 31);
14963 num97 += (float)Main.rand.Next(-30, 31);
14964 num96 -= Main.player[target].velocity.X * 10f;
14965 num97 -= Main.player[target].velocity.Y * 10f;
14966 }
14967 float num98 = (float)Math.Sqrt(num96 * num96 + num97 * num97);
14968 num98 = num95 / num98;
14969 num96 *= num98;
14970 num97 *= num98;
14971 int num99 = 30;
14972 int num100 = 290;
14973 if (type == 285 || type == 286)
14974 {
14975 num100 = 291;
14976 num99 = 40;
14977 }
14978 if (type == 281 || type == 282)
14979 {
14980 num100 = 293;
14981 num99 = 40;
14982 }
14985 Main.projectile[num101].timeLeft = 300;
14986 if (num100 == 291)
14987 {
14988 Main.projectile[num101].ai[0] = Main.player[target].Center.X;
14989 Main.projectile[num101].ai[1] = Main.player[target].Center.Y;
14990 Main.projectile[num101].netUpdate = true;
14991 }
14992 localAI[0] = 0f;
14993 }
14994 }
14995 else
14996 {
14997 if (type != 172)
14998 {
15000 }
15001 if (Main.netMode != 1)
15002 {
15003 if (type == 29)
15004 {
15005 NewNPC(GetSpawnSourceForProjectileNPC(), (int)position.X + width / 2, (int)position.Y - 8, 30);
15006 }
15007 else if (type == 45)
15008 {
15009 NewNPC(GetSpawnSourceForProjectileNPC(), (int)position.X + width / 2, (int)position.Y - 8, 665);
15010 }
15011 else if (type == 32)
15012 {
15013 NewNPC(GetSpawnSourceForProjectileNPC(), (int)position.X + width / 2, (int)position.Y - 8, 33);
15014 }
15015 else if (type == 172)
15016 {
15017 float num102 = 10f;
15018 Vector2 vector14 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15019 float num103 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector14.X + (float)Main.rand.Next(-10, 11);
15020 float num104 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector14.Y + (float)Main.rand.Next(-10, 11);
15021 float num105 = (float)Math.Sqrt(num103 * num103 + num104 * num104);
15022 num105 = num102 / num105;
15023 num103 *= num105;
15024 num104 *= num105;
15025 int num106 = 40;
15026 int num107 = 129;
15028 Main.projectile[num108].timeLeft = 300;
15029 localAI[0] = 0f;
15030 }
15031 else
15032 {
15033 NewNPC(GetSpawnSourceForProjectileNPC(), (int)position.X + width / 2 + direction * 8, (int)position.Y + 20, 25);
15034 }
15035 }
15036 }
15037 }
15038 }
15040 if (type == 29 || type == 45)
15041 {
15042 if (Main.rand.Next(5) == 0)
15043 {
15044 int num109 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 27, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.5f);
15045 Main.dust[num109].noGravity = true;
15046 Main.dust[num109].velocity.X *= 0.5f;
15047 Main.dust[num109].velocity.Y = -2f;
15048 }
15049 }
15050 else if (type == 32)
15051 {
15052 if (Main.rand.Next(3) != 0)
15053 {
15054 int num110 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 172, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 0.9f);
15055 Main.dust[num110].noGravity = true;
15056 Main.dust[num110].velocity.X *= 0.3f;
15057 Main.dust[num110].velocity.Y *= 0.2f;
15058 Main.dust[num110].velocity.Y -= 1f;
15059 }
15060 }
15061 else if (type == 172)
15062 {
15063 int num111 = 1;
15064 if (alpha == 255)
15065 {
15066 num111 = 2;
15067 }
15068 for (int num112 = 0; num112 < num111; num112++)
15069 {
15070 if (Main.rand.Next(255) > 255 - alpha)
15071 {
15072 int num113 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 106, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.2f);
15073 Main.dust[num113].noGravity = true;
15074 Main.dust[num113].velocity.X *= 0.1f + (float)Main.rand.Next(30) * 0.01f;
15075 Main.dust[num113].velocity.Y *= 0.1f + (float)Main.rand.Next(30) * 0.01f;
15076 Dust dust = Main.dust[num113];
15077 dust.scale *= 1f + (float)Main.rand.Next(6) * 0.1f;
15078 }
15079 }
15080 }
15081 else if (type == 283 || type == 284)
15082 {
15083 if (Main.rand.Next(2) == 0)
15084 {
15085 int num114 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 173);
15086 Main.dust[num114].velocity.X *= 0.5f;
15087 Main.dust[num114].velocity.Y *= 0.5f;
15088 }
15089 }
15090 else if (type == 285 || type == 286)
15091 {
15092 if (Main.rand.Next(2) == 0)
15093 {
15094 int num115 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 174, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
15095 Main.dust[num115].noGravity = true;
15096 Dust dust = Main.dust[num115];
15097 dust.velocity *= 0.4f;
15098 Main.dust[num115].velocity.Y -= 0.7f;
15099 }
15100 }
15101 else if (type == 281 || type == 282)
15102 {
15103 if (Main.rand.Next(2) == 0)
15104 {
15105 int num116 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 175, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 0.1f);
15106 Main.dust[num116].noGravity = true;
15107 Dust dust = Main.dust[num116];
15108 dust.velocity *= 0.5f;
15109 Main.dust[num116].fadeIn = 1.2f;
15110 }
15111 }
15112 else if (type == 533)
15113 {
15114 Lighting.AddLight(base.Top, 0.6f, 0.6f, 0.3f);
15115 }
15116 else if (Main.rand.Next(2) == 0)
15117 {
15118 int num117 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
15119 Main.dust[num117].noGravity = true;
15120 Main.dust[num117].velocity.X *= 1f;
15121 Main.dust[num117].velocity.Y *= 1f;
15122 }
15124 return;
15125 }
15126 if (aiStyle == 9)
15127 {
15128 if (type == 516)
15129 {
15130 if (alpha < 220)
15131 {
15132 alpha += 40;
15133 }
15134 if (this.ai[0] == 0f)
15135 {
15136 this.ai[0] = 1f;
15137 Vector2 vector15 = Main.player[target].Center - base.Center;
15138 vector15.Normalize();
15139 if (vector15.HasNaNs())
15140 {
15142 }
15143 vector15 = vector15.RotatedByRandom(1.5707963705062866).RotatedBy(-0.7853981852531433);
15144 if (vector15.Y > 0.2f)
15145 {
15146 vector15.Y = 0.2f;
15147 }
15148 velocity = vector15 * (6f + Main.rand.NextFloat() * 4f);
15149 }
15150 if (collideX || collideY || Distance(Main.player[target].Center) < 20f)
15151 {
15153 }
15154 }
15155 if (target == 255)
15156 {
15157 TargetClosest();
15158 float num118 = 6f;
15159 if (type == 25)
15160 {
15161 num118 = 5f;
15162 }
15163 if (type == 112 || type == 666)
15164 {
15165 num118 = 7f;
15166 }
15167 if (Main.getGoodWorld)
15168 {
15169 if (type == 33 && AnyNPCs(35))
15170 {
15171 num118 = 10f;
15172 }
15173 if (type == 25 && AnyNPCs(113))
15174 {
15175 num118 = 14f;
15176 }
15177 if (type == 666)
15178 {
15179 num118 = 10f;
15180 }
15181 }
15182 Vector2 vector16 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15183 float num119 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector16.X;
15184 float num120 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector16.Y;
15185 float num121 = (float)Math.Sqrt(num119 * num119 + num120 * num120);
15186 num121 = num118 / num121;
15187 velocity.X = num119 * num121;
15188 velocity.Y = num120 * num121;
15189 }
15191 {
15192 if (type == 33 && AnyNPCs(35))
15193 {
15194 dontTakeDamage = true;
15195 }
15196 else if (type == 25 && AnyNPCs(113))
15197 {
15198 dontTakeDamage = true;
15199 }
15200 else if (type == 666 && (double)(base.Center.Y / 16f) < Main.worldSurface)
15201 {
15202 dontTakeDamage = true;
15203 }
15204 }
15205 if (type == 112 || type == 666)
15206 {
15207 damage = defDamage;
15208 if (type == 666)
15209 {
15211 }
15212 this.ai[0] += 1f;
15213 if (this.ai[0] > 3f)
15214 {
15215 this.ai[0] = 3f;
15216 }
15217 if (this.ai[0] == 2f)
15218 {
15219 position += velocity;
15220 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 9);
15221 for (int num122 = 0; num122 < 20; num122++)
15222 {
15223 int num123 = Dust.NewDust(new Vector2(position.X, position.Y + 2f) + netOffset, width, height, 18, 0f, 0f, 100, default(Color), 1.8f);
15224 Dust dust = Main.dust[num123];
15225 dust.velocity *= 1.3f;
15226 dust = Main.dust[num123];
15227 dust.velocity += velocity;
15228 Main.dust[num123].noGravity = true;
15229 }
15230 }
15231 }
15232 if ((type == 112 || type == 666) && Collision.SolidCollision(position, width, height))
15233 {
15234 _ = Main.netMode;
15235 _ = 1;
15236 StrikeNPCNoInteraction(9999, 0f, 0);
15237 }
15238 EncourageDespawn(100);
15239 if (type == 516)
15240 {
15241 rotation += 0.1f * (float)direction;
15242 float num124 = 15f;
15243 float num125 = 1f / 12f;
15244 Vector2 center = base.Center;
15245 Vector2 center2 = Main.player[target].Center;
15247 vector17.Normalize();
15248 if (vector17.HasNaNs())
15249 {
15250 vector17 = new Vector2(direction, 0f);
15251 }
15252 velocity = (velocity * (num124 - 1f) + vector17 * (velocity.Length() + num125)) / num124;
15253 if (velocity.Length() < 6f)
15254 {
15255 velocity *= 1.05f;
15256 }
15257 return;
15258 }
15260 for (int num126 = 0; num126 < 2; num126++)
15261 {
15262 if (type == 30 || type == 665)
15263 {
15264 alpha = 255;
15265 for (int num127 = 0; num127 < 2; num127++)
15266 {
15267 int num128 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 27, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.3f);
15268 Main.dust[num128].noGravity = true;
15269 Dust dust = Main.dust[num128];
15270 dust.velocity *= 0.3f;
15271 Main.dust[num128].velocity.X -= velocity.X * 0.2f;
15272 Main.dust[num128].velocity.Y -= velocity.Y * 0.2f;
15273 }
15274 }
15275 else if (type == 33)
15276 {
15277 for (int num129 = 0; num129 < 3; num129++)
15278 {
15279 float num130 = velocity.X / 3f * (float)num126;
15280 float num131 = velocity.Y / 3f * (float)num126;
15281 int num132 = 2;
15282 int num133 = Dust.NewDust(new Vector2(position.X + (float)num132, position.Y + (float)num132), width - num132 * 2, height - num132 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
15283 Main.dust[num133].noGravity = true;
15284 Dust dust = Main.dust[num133];
15285 dust.velocity *= 0.1f;
15286 dust = Main.dust[num133];
15287 dust.velocity += velocity * 0.5f;
15288 Main.dust[num133].position.X -= num130;
15289 Main.dust[num133].position.Y -= num131;
15290 }
15291 if (Main.rand.Next(5) == 0)
15292 {
15293 int num134 = 2;
15294 int num135 = Dust.NewDust(new Vector2(position.X + (float)num134, position.Y + (float)num134), width - num134 * 2, height - num134 * 2, 172, 0f, 0f, 100, default(Color), 0.6f);
15295 Dust dust = Main.dust[num135];
15296 dust.velocity *= 0.25f;
15297 dust = Main.dust[num135];
15298 dust.velocity += velocity * 0.5f;
15299 }
15300 }
15301 else if (type == 112 || type == 666)
15302 {
15303 int num136 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 18, velocity.X * 0.1f, velocity.Y * 0.1f, 80, default(Color), 1.3f);
15304 Dust dust = Main.dust[num136];
15305 dust.velocity *= 0.3f;
15306 Main.dust[num136].noGravity = true;
15307 }
15308 else
15309 {
15310 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.3f, 0.1f);
15311 int num137 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
15312 Main.dust[num137].noGravity = true;
15313 Main.dust[num137].velocity.X *= 0.3f;
15314 Main.dust[num137].velocity.Y *= 0.3f;
15315 }
15316 }
15317 rotation += 0.4f * (float)direction;
15319 return;
15320 }
15321 if (aiStyle == 10)
15322 {
15323 float num138 = 1f;
15324 float num139 = 0.011f;
15325 TargetClosest();
15326 Vector2 vector18 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15327 float num140 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector18.X;
15328 float num141 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector18.Y;
15329 float num142 = (float)Math.Sqrt(num140 * num140 + num141 * num141);
15330 float num143 = num142;
15331 this.ai[1] += 1f;
15332 if (this.ai[1] > 600f)
15333 {
15334 num139 *= 8f;
15335 num138 = 4f;
15336 if (this.ai[1] > 650f)
15337 {
15338 this.ai[1] = 0f;
15339 }
15340 }
15341 else if (num143 < 250f)
15342 {
15343 this.ai[0] += 0.9f;
15344 if (this.ai[0] > 0f)
15345 {
15346 velocity.Y += 0.019f;
15347 }
15348 else
15349 {
15350 velocity.Y -= 0.019f;
15351 }
15352 if (this.ai[0] < -100f || this.ai[0] > 100f)
15353 {
15354 velocity.X += 0.019f;
15355 }
15356 else
15357 {
15358 velocity.X -= 0.019f;
15359 }
15360 if (this.ai[0] > 200f)
15361 {
15362 this.ai[0] = -200f;
15363 }
15364 }
15365 if (num143 > 350f)
15366 {
15367 num138 = 5f;
15368 num139 = 0.3f;
15369 }
15370 else if (num143 > 300f)
15371 {
15372 num138 = 3f;
15373 num139 = 0.2f;
15374 }
15375 else if (num143 > 250f)
15376 {
15377 num138 = 1.5f;
15378 num139 = 0.1f;
15379 }
15380 num142 = num138 / num142;
15381 num140 *= num142;
15382 num141 *= num142;
15383 if (Main.player[target].dead)
15384 {
15385 num140 = (float)direction * num138 / 2f;
15386 num141 = (0f - num138) / 2f;
15387 }
15388 if (velocity.X < num140)
15389 {
15390 velocity.X += num139;
15391 }
15392 else if (velocity.X > num140)
15393 {
15394 velocity.X -= num139;
15395 }
15396 if (velocity.Y < num141)
15397 {
15398 velocity.Y += num139;
15399 }
15400 else if (velocity.Y > num141)
15401 {
15402 velocity.Y -= num139;
15403 }
15404 if (num140 > 0f)
15405 {
15406 spriteDirection = -1;
15407 rotation = (float)Math.Atan2(num141, num140);
15408 }
15409 if (num140 < 0f)
15410 {
15411 spriteDirection = 1;
15412 rotation = (float)Math.Atan2(num141, num140) + 3.14f;
15413 }
15414 if (type != 289)
15415 {
15416 return;
15417 }
15418 if (justHit)
15419 {
15420 this.ai[2] = 0f;
15421 this.ai[3] = 0f;
15422 }
15423 vector18 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15424 num140 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector18.X;
15425 num141 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector18.Y;
15426 num142 = (float)Math.Sqrt(num140 * num140 + num141 * num141);
15427 if (num142 <= 500f)
15428 {
15429 this.ai[2] += 1f;
15430 if (this.ai[3] == 0f)
15431 {
15432 if (this.ai[2] > 120f)
15433 {
15434 this.ai[2] = 0f;
15435 this.ai[3] = 1f;
15436 netUpdate = true;
15437 }
15438 return;
15439 }
15440 if (this.ai[2] > 40f)
15441 {
15442 this.ai[3] = 0f;
15443 }
15444 if (Main.netMode != 1 && this.ai[2] == 20f)
15445 {
15446 float num144 = 6f;
15447 int num145 = 25;
15448 int num146 = 299;
15449 num142 = num144 / num142;
15450 num140 *= num142;
15451 num141 *= num142;
15453 }
15454 }
15455 else
15456 {
15457 this.ai[2] = 0f;
15458 this.ai[3] = 0f;
15459 }
15460 return;
15461 }
15462 if (aiStyle == 11)
15463 {
15464 reflectsProjectiles = false;
15466 if (this.ai[0] == 0f && Main.netMode != 1)
15467 {
15468 TargetClosest();
15469 this.ai[0] = 1f;
15470 if (type != 68)
15471 {
15472 int num148 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 36, whoAmI);
15473 Main.npc[num148].ai[0] = -1f;
15474 Main.npc[num148].ai[1] = whoAmI;
15475 Main.npc[num148].target = target;
15476 Main.npc[num148].netUpdate = true;
15477 num148 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 36, whoAmI);
15478 Main.npc[num148].ai[0] = 1f;
15479 Main.npc[num148].ai[1] = whoAmI;
15480 Main.npc[num148].ai[3] = 150f;
15481 Main.npc[num148].target = target;
15482 Main.npc[num148].netUpdate = true;
15483 }
15484 }
15485 if ((type == 68 || Main.netMode == 1) && localAI[0] == 0f)
15486 {
15487 localAI[0] = 1f;
15488 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
15489 }
15490 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 2000f || Math.Abs(position.Y - Main.player[target].position.Y) > 2000f)
15491 {
15492 TargetClosest();
15493 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 2000f || Math.Abs(position.Y - Main.player[target].position.Y) > 2000f)
15494 {
15495 this.ai[1] = 3f;
15496 }
15497 }
15498 if ((type == 68 || Main.IsItDay()) && this.ai[1] != 3f && this.ai[1] != 2f)
15499 {
15500 this.ai[1] = 2f;
15501 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
15502 }
15503 int num149 = 0;
15504 if (Main.expertMode)
15505 {
15506 for (int num150 = 0; num150 < 200; num150++)
15507 {
15508 if (Main.npc[num150].active && Main.npc[num150].type == type + 1)
15509 {
15510 num149++;
15511 }
15512 }
15513 defense += num149 * 25;
15514 if ((num149 < 2 || (double)life < (double)lifeMax * 0.75) && this.ai[1] == 0f)
15515 {
15516 float num151 = 80f;
15517 if (num149 == 0)
15518 {
15519 num151 /= 2f;
15520 }
15521 if (Main.getGoodWorld)
15522 {
15523 num151 *= 0.8f;
15524 }
15525 if (Main.netMode != 1 && this.ai[2] % num151 == 0f)
15526 {
15527 Vector2 center3 = base.Center;
15528 float num152 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - center3.X;
15529 float num153 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - center3.Y;
15530 float num154 = (float)Math.Sqrt(num152 * num152 + num153 * num153);
15531 if (Collision.CanHit(center3, 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height))
15532 {
15533 float num155 = 3f;
15534 if (num149 == 0)
15535 {
15536 num155 += 2f;
15537 }
15538 float num156 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - center3.X + (float)Main.rand.Next(-20, 21);
15539 float num157 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - center3.Y + (float)Main.rand.Next(-20, 21);
15540 float num158 = (float)Math.Sqrt(num156 * num156 + num157 * num157);
15541 num158 = num155 / num158;
15542 num156 *= num158;
15543 num157 *= num158;
15544 Vector2 vector19 = new Vector2(num156 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num157 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f);
15545 vector19.Normalize();
15546 vector19 *= num155;
15547 vector19 += velocity;
15548 num156 = vector19.X;
15549 num157 = vector19.Y;
15551 int num159 = 270;
15552 center3 += vector19 * 5f;
15554 Main.projectile[num160].timeLeft = 300;
15555 }
15556 }
15557 }
15558 }
15559 if (this.ai[1] == 0f)
15560 {
15561 damage = defDamage;
15562 this.ai[2] += 1f;
15563 if (this.ai[2] >= 800f)
15564 {
15565 this.ai[2] = 0f;
15566 this.ai[1] = 1f;
15567 TargetClosest();
15568 netUpdate = true;
15569 }
15570 rotation = velocity.X / 15f;
15571 float num161 = 0.02f;
15572 float num162 = 2f;
15573 float num163 = 0.05f;
15574 float num164 = 8f;
15575 if (Main.expertMode)
15576 {
15577 num161 = 0.03f;
15578 num162 = 4f;
15579 num163 = 0.07f;
15580 num164 = 9.5f;
15581 }
15582 if (Main.getGoodWorld)
15583 {
15584 num161 += 0.01f;
15585 num162 += 1f;
15586 num163 += 0.05f;
15587 num164 += 2f;
15588 }
15589 if (position.Y > Main.player[target].position.Y - 250f)
15590 {
15591 if (velocity.Y > 0f)
15592 {
15593 velocity.Y *= 0.98f;
15594 }
15595 velocity.Y -= num161;
15596 if (velocity.Y > num162)
15597 {
15598 velocity.Y = num162;
15599 }
15600 }
15601 else if (position.Y < Main.player[target].position.Y - 250f)
15602 {
15603 if (velocity.Y < 0f)
15604 {
15605 velocity.Y *= 0.98f;
15606 }
15607 velocity.Y += num161;
15608 if (velocity.Y < 0f - num162)
15609 {
15610 velocity.Y = 0f - num162;
15611 }
15612 }
15613 if (position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2))
15614 {
15615 if (velocity.X > 0f)
15616 {
15617 velocity.X *= 0.98f;
15618 }
15619 velocity.X -= num163;
15620 if (velocity.X > num164)
15621 {
15622 velocity.X = num164;
15623 }
15624 }
15625 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2))
15626 {
15627 if (velocity.X < 0f)
15628 {
15629 velocity.X *= 0.98f;
15630 }
15631 velocity.X += num163;
15632 if (velocity.X < 0f - num164)
15633 {
15634 velocity.X = 0f - num164;
15635 }
15636 }
15637 }
15638 else if (this.ai[1] == 1f)
15639 {
15640 if (Main.getGoodWorld)
15641 {
15642 if (num149 > 0)
15643 {
15644 reflectsProjectiles = true;
15645 }
15646 else if (Main.netMode != 1 && this.ai[2] % 200f == 0f && CountNPCS(32) < 6)
15647 {
15648 int num165 = 1;
15649 for (int num166 = 0; num166 < num165; num166++)
15650 {
15651 int num167 = 1000;
15652 for (int num168 = 0; num168 < num167; num168++)
15653 {
15654 int num169 = (int)(base.Center.X / 16f) + Main.rand.Next(-50, 51);
15655 int num170;
15656 for (num170 = (int)(base.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++)
15657 {
15658 }
15659 num170--;
15661 {
15662 int num171 = NewNPC(GetSpawnSourceForNaturalSpawn(), num169 * 16 + 8, num170 * 16, 32);
15663 if (Main.netMode == 2 && num171 < 200)
15664 {
15665 NetMessage.SendData(23, -1, -1, null, num171);
15666 }
15667 break;
15668 }
15669 }
15670 }
15671 }
15672 }
15673 defense -= 10;
15674 this.ai[2] += 1f;
15675 if (this.ai[2] == 2f)
15676 {
15677 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
15678 }
15679 if (this.ai[2] >= 400f)
15680 {
15681 this.ai[2] = 0f;
15682 this.ai[1] = 0f;
15683 }
15684 rotation += (float)direction * 0.3f;
15685 Vector2 vector20 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15686 float num172 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector20.X;
15687 float num173 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector20.Y;
15688 float num174 = (float)Math.Sqrt(num172 * num172 + num173 * num173);
15689 float num175 = 1.5f;
15691 if (Main.expertMode)
15692 {
15693 num175 = 3.5f;
15694 if (num174 > 150f)
15695 {
15696 num175 *= 1.05f;
15697 }
15698 if (num174 > 200f)
15699 {
15700 num175 *= 1.1f;
15701 }
15702 if (num174 > 250f)
15703 {
15704 num175 *= 1.1f;
15705 }
15706 if (num174 > 300f)
15707 {
15708 num175 *= 1.1f;
15709 }
15710 if (num174 > 350f)
15711 {
15712 num175 *= 1.1f;
15713 }
15714 if (num174 > 400f)
15715 {
15716 num175 *= 1.1f;
15717 }
15718 if (num174 > 450f)
15719 {
15720 num175 *= 1.1f;
15721 }
15722 if (num174 > 500f)
15723 {
15724 num175 *= 1.1f;
15725 }
15726 if (num174 > 550f)
15727 {
15728 num175 *= 1.1f;
15729 }
15730 if (num174 > 600f)
15731 {
15732 num175 *= 1.1f;
15733 }
15734 switch (num149)
15735 {
15736 case 0:
15737 num175 *= 1.1f;
15738 break;
15739 case 1:
15740 num175 *= 1.05f;
15741 break;
15742 }
15743 }
15744 if (Main.getGoodWorld)
15745 {
15746 num175 *= 1.3f;
15747 }
15748 num174 = num175 / num174;
15749 velocity.X = num172 * num174;
15750 velocity.Y = num173 * num174;
15751 }
15752 else if (this.ai[1] == 2f)
15753 {
15754 damage = 1000;
15755 defense = 9999;
15756 rotation += (float)direction * 0.3f;
15757 Vector2 vector21 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15758 float num176 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector21.X;
15759 float num177 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector21.Y;
15760 float num178 = (float)Math.Sqrt(num176 * num176 + num177 * num177);
15761 num178 = 8f / num178;
15762 velocity.X = num176 * num178;
15763 velocity.Y = num177 * num178;
15764 }
15765 else if (this.ai[1] == 3f)
15766 {
15767 velocity.Y += 0.1f;
15768 if (velocity.Y < 0f)
15769 {
15770 velocity.Y *= 0.95f;
15771 }
15772 velocity.X *= 0.95f;
15773 EncourageDespawn(50);
15774 }
15775 if (this.ai[1] != 2f && this.ai[1] != 3f && type != 68 && (num149 != 0 || !Main.expertMode))
15776 {
15777 int num179 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) - 15f - velocity.X * 5f, position.Y + (float)height - 2f), 30, 10, 5, (0f - velocity.X) * 0.2f, 3f, 0, default(Color), 2f);
15778 Main.dust[num179].noGravity = true;
15779 Main.dust[num179].velocity.X *= 1.3f;
15780 Main.dust[num179].velocity.X += velocity.X * 0.4f;
15781 Main.dust[num179].velocity.Y += 2f + velocity.Y;
15782 for (int num180 = 0; num180 < 2; num180++)
15783 {
15784 num179 = Dust.NewDust(new Vector2(position.X, position.Y + 120f), width, 60, 5, velocity.X, velocity.Y, 0, default(Color), 2f);
15785 Main.dust[num179].noGravity = true;
15786 Dust dust = Main.dust[num179];
15787 dust.velocity -= velocity;
15788 Main.dust[num179].velocity.Y += 5f;
15789 }
15790 }
15791 return;
15792 }
15793 if (aiStyle == 12)
15794 {
15795 spriteDirection = -(int)this.ai[0];
15796 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 11)
15797 {
15798 this.ai[2] += 10f;
15799 if (this.ai[2] > 50f || Main.netMode != 2)
15800 {
15801 life = -1;
15802 HitEffect();
15803 active = false;
15804 }
15805 }
15806 if (this.ai[2] == 0f || this.ai[2] == 3f)
15807 {
15808 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
15809 {
15810 EncourageDespawn(10);
15811 }
15812 if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
15813 {
15814 if (position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
15815 {
15816 if (velocity.Y > 0f)
15817 {
15818 velocity.Y *= 0.96f;
15819 }
15820 velocity.Y -= 0.07f;
15821 if (velocity.Y > 6f)
15822 {
15823 velocity.Y = 6f;
15824 }
15825 }
15826 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
15827 {
15828 if (velocity.Y < 0f)
15829 {
15830 velocity.Y *= 0.96f;
15831 }
15832 velocity.Y += 0.07f;
15833 if (velocity.Y < -6f)
15834 {
15835 velocity.Y = -6f;
15836 }
15837 }
15838 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
15839 {
15840 if (velocity.X > 0f)
15841 {
15842 velocity.X *= 0.96f;
15843 }
15844 velocity.X -= 0.1f;
15845 if (velocity.X > 8f)
15846 {
15847 velocity.X = 8f;
15848 }
15849 }
15850 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
15851 {
15852 if (velocity.X < 0f)
15853 {
15854 velocity.X *= 0.96f;
15855 }
15856 velocity.X += 0.1f;
15857 if (velocity.X < -8f)
15858 {
15859 velocity.X = -8f;
15860 }
15861 }
15862 }
15863 else
15864 {
15865 this.ai[3] += 1f;
15866 if (Main.expertMode)
15867 {
15868 this.ai[3] += 0.5f;
15869 }
15870 if (this.ai[3] >= 300f)
15871 {
15872 this.ai[2] += 1f;
15873 this.ai[3] = 0f;
15874 netUpdate = true;
15875 }
15876 if (Main.expertMode)
15877 {
15878 if (position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f)
15879 {
15880 if (velocity.Y > 0f)
15881 {
15882 velocity.Y *= 0.96f;
15883 }
15884 velocity.Y -= 0.04f;
15885 if (velocity.Y > 3f)
15886 {
15887 velocity.Y = 3f;
15888 }
15889 }
15890 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f)
15891 {
15892 if (velocity.Y < 0f)
15893 {
15894 velocity.Y *= 0.96f;
15895 }
15896 velocity.Y += 0.04f;
15897 if (velocity.Y < -3f)
15898 {
15899 velocity.Y = -3f;
15900 }
15901 }
15902 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
15903 {
15904 if (velocity.X > 0f)
15905 {
15906 velocity.X *= 0.96f;
15907 }
15908 velocity.X -= 0.07f;
15909 if (velocity.X > 8f)
15910 {
15911 velocity.X = 8f;
15912 }
15913 }
15914 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
15915 {
15916 if (velocity.X < 0f)
15917 {
15918 velocity.X *= 0.96f;
15919 }
15920 velocity.X += 0.07f;
15921 if (velocity.X < -8f)
15922 {
15923 velocity.X = -8f;
15924 }
15925 }
15926 }
15927 if (position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f)
15928 {
15929 if (velocity.Y > 0f)
15930 {
15931 velocity.Y *= 0.96f;
15932 }
15933 velocity.Y -= 0.04f;
15934 if (velocity.Y > 3f)
15935 {
15936 velocity.Y = 3f;
15937 }
15938 }
15939 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f)
15940 {
15941 if (velocity.Y < 0f)
15942 {
15943 velocity.Y *= 0.96f;
15944 }
15945 velocity.Y += 0.04f;
15946 if (velocity.Y < -3f)
15947 {
15948 velocity.Y = -3f;
15949 }
15950 }
15951 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
15952 {
15953 if (velocity.X > 0f)
15954 {
15955 velocity.X *= 0.96f;
15956 }
15957 velocity.X -= 0.07f;
15958 if (velocity.X > 8f)
15959 {
15960 velocity.X = 8f;
15961 }
15962 }
15963 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
15964 {
15965 if (velocity.X < 0f)
15966 {
15967 velocity.X *= 0.96f;
15968 }
15969 velocity.X += 0.07f;
15970 if (velocity.X < -8f)
15971 {
15972 velocity.X = -8f;
15973 }
15974 }
15975 }
15976 Vector2 vector22 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15977 float num181 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector22.X;
15978 float num182 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector22.Y;
15979 float num183 = (float)Math.Sqrt(num181 * num181 + num182 * num182);
15980 rotation = (float)Math.Atan2(num182, num181) + 1.57f;
15981 }
15982 else if (this.ai[2] == 1f)
15983 {
15984 Vector2 vector23 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
15985 float num184 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector23.X;
15986 float num185 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector23.Y;
15987 float num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185);
15988 rotation = (float)Math.Atan2(num185, num184) + 1.57f;
15989 velocity.X *= 0.95f;
15990 velocity.Y -= 0.1f;
15991 if (Main.expertMode)
15992 {
15993 velocity.Y -= 0.06f;
15994 if (velocity.Y < -13f)
15995 {
15996 velocity.Y = -13f;
15997 }
15998 }
15999 else if (velocity.Y < -8f)
16000 {
16001 velocity.Y = -8f;
16002 }
16003 if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f)
16004 {
16005 TargetClosest();
16006 this.ai[2] = 2f;
16007 vector23 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16008 num184 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector23.X;
16009 num185 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector23.Y;
16010 num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185);
16011 num186 = ((!Main.expertMode) ? (18f / num186) : (21f / num186));
16012 velocity.X = num184 * num186;
16013 velocity.Y = num185 * num186;
16014 netUpdate = true;
16015 }
16016 }
16017 else if (this.ai[2] == 2f)
16018 {
16019 if (position.Y > Main.player[target].position.Y || velocity.Y < 0f)
16020 {
16021 this.ai[2] = 3f;
16022 }
16023 }
16024 else if (this.ai[2] == 4f)
16025 {
16026 Vector2 vector24 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16027 float num187 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector24.X;
16028 float num188 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector24.Y;
16029 float num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188);
16030 rotation = (float)Math.Atan2(num188, num187) + 1.57f;
16031 velocity.Y *= 0.95f;
16032 velocity.X += 0.1f * (0f - this.ai[0]);
16033 if (Main.expertMode)
16034 {
16035 velocity.X += 0.07f * (0f - this.ai[0]);
16036 if (velocity.X < -12f)
16037 {
16038 velocity.X = -12f;
16039 }
16040 else if (velocity.X > 12f)
16041 {
16042 velocity.X = 12f;
16043 }
16044 }
16045 else if (velocity.X < -8f)
16046 {
16047 velocity.X = -8f;
16048 }
16049 else if (velocity.X > 8f)
16050 {
16051 velocity.X = 8f;
16052 }
16053 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f)
16054 {
16055 TargetClosest();
16056 this.ai[2] = 5f;
16057 vector24 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16058 num187 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector24.X;
16059 num188 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector24.Y;
16060 num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188);
16061 num189 = ((!Main.expertMode) ? (17f / num189) : (22f / num189));
16062 velocity.X = num187 * num189;
16063 velocity.Y = num188 * num189;
16064 netUpdate = true;
16065 }
16066 }
16067 else if (this.ai[2] == 5f && ((velocity.X > 0f && position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2)) || (velocity.X < 0f && position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2))))
16068 {
16069 this.ai[2] = 0f;
16070 }
16071 return;
16072 }
16073 if (aiStyle == 13)
16074 {
16075 if (this.ai[0] < 0f || this.ai[0] >= (float)Main.maxTilesX || this.ai[1] < 0f || this.ai[1] >= (float)Main.maxTilesX)
16076 {
16077 return;
16078 }
16079 if (Main.tile[(int)this.ai[0], (int)this.ai[1]] == null)
16080 {
16081 Main.tile[(int)this.ai[0], (int)this.ai[1]] = new Tile();
16082 }
16083 if (!Main.tile[(int)this.ai[0], (int)this.ai[1]].active())
16084 {
16085 life = -1;
16086 HitEffect();
16087 active = false;
16088 return;
16089 }
16090 FixExploitManEaters.ProtectSpot((int)this.ai[0], (int)this.ai[1]);
16091 TargetClosest();
16092 float num190 = 0.035f;
16093 float num191 = 150f;
16094 if (type == 43)
16095 {
16096 num191 = ((!Main.getGoodWorld) ? 250f : 350f);
16097 }
16098 if (type == 101)
16099 {
16100 num191 = 175f;
16101 }
16102 if (type == 259)
16103 {
16104 num191 = 100f;
16105 }
16106 if (type == 175)
16107 {
16108 num191 = 500f;
16109 num190 = 0.05f;
16110 }
16111 if (type == 260)
16112 {
16113 num191 = 350f;
16114 num190 = 0.15f;
16115 }
16116 this.ai[2] += 1f;
16117 if (this.ai[2] > 300f)
16118 {
16119 num191 = (int)((double)num191 * 1.3);
16120 if (this.ai[2] > 450f)
16121 {
16122 this.ai[2] = 0f;
16123 }
16124 }
16125 Vector2 vector25 = new Vector2(this.ai[0] * 16f + 8f, this.ai[1] * 16f + 8f);
16126 float num192 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - (float)(width / 2) - vector25.X;
16127 float num193 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - (float)(height / 2) - vector25.Y;
16128 float num194 = (float)Math.Sqrt(num192 * num192 + num193 * num193);
16129 if (num194 > num191)
16130 {
16131 num194 = num191 / num194;
16132 num192 *= num194;
16133 num193 *= num194;
16134 }
16135 if (position.X < this.ai[0] * 16f + 8f + num192)
16136 {
16137 velocity.X += num190;
16138 if (velocity.X < 0f && num192 > 0f)
16139 {
16140 velocity.X += num190 * 1.5f;
16141 }
16142 }
16143 else if (position.X > this.ai[0] * 16f + 8f + num192)
16144 {
16145 velocity.X -= num190;
16146 if (velocity.X > 0f && num192 < 0f)
16147 {
16148 velocity.X -= num190 * 1.5f;
16149 }
16150 }
16151 if (position.Y < this.ai[1] * 16f + 8f + num193)
16152 {
16153 velocity.Y += num190;
16154 if (velocity.Y < 0f && num193 > 0f)
16155 {
16156 velocity.Y += num190 * 1.5f;
16157 }
16158 }
16159 else if (position.Y > this.ai[1] * 16f + 8f + num193)
16160 {
16161 velocity.Y -= num190;
16162 if (velocity.Y > 0f && num193 < 0f)
16163 {
16164 velocity.Y -= num190 * 1.5f;
16165 }
16166 }
16167 if (type == 43)
16168 {
16169 if (Main.getGoodWorld)
16170 {
16171 if ((double)velocity.X > 3.5)
16172 {
16173 velocity.X = 3.5f;
16174 }
16175 if ((double)velocity.X < -3.5)
16176 {
16177 velocity.X = -3.5f;
16178 }
16179 if ((double)velocity.Y > 3.5)
16180 {
16181 velocity.Y = 3.5f;
16182 }
16183 if ((double)velocity.Y < -3.5)
16184 {
16185 velocity.Y = -3.5f;
16186 }
16187 }
16188 else
16189 {
16190 if (velocity.X > 3f)
16191 {
16192 velocity.X = 3f;
16193 }
16194 if (velocity.X < -3f)
16195 {
16196 velocity.X = -3f;
16197 }
16198 if (velocity.Y > 3f)
16199 {
16200 velocity.Y = 3f;
16201 }
16202 if (velocity.Y < -3f)
16203 {
16204 velocity.Y = -3f;
16205 }
16206 }
16207 }
16208 else if (type == 175)
16209 {
16210 if (velocity.X > 4f)
16211 {
16212 velocity.X = 4f;
16213 }
16214 if (velocity.X < -4f)
16215 {
16216 velocity.X = -4f;
16217 }
16218 if (velocity.Y > 4f)
16219 {
16220 velocity.Y = 4f;
16221 }
16222 if (velocity.Y < -4f)
16223 {
16224 velocity.Y = -4f;
16225 }
16226 }
16227 else
16228 {
16229 if (velocity.X > 2f)
16230 {
16231 velocity.X = 2f;
16232 }
16233 if (velocity.X < -2f)
16234 {
16235 velocity.X = -2f;
16236 }
16237 if (velocity.Y > 2f)
16238 {
16239 velocity.Y = 2f;
16240 }
16241 if (velocity.Y < -2f)
16242 {
16243 velocity.Y = -2f;
16244 }
16245 }
16246 if (type == 259 || type == 260)
16247 {
16248 rotation = (float)Math.Atan2(num193, num192) + 1.57f;
16249 }
16250 else
16251 {
16252 if (num192 > 0f)
16253 {
16254 spriteDirection = 1;
16255 rotation = (float)Math.Atan2(num193, num192);
16256 }
16257 if (num192 < 0f)
16258 {
16259 spriteDirection = -1;
16260 rotation = (float)Math.Atan2(num193, num192) + 3.14f;
16261 }
16262 }
16263 if (collideX)
16264 {
16265 netUpdate = true;
16266 velocity.X = oldVelocity.X * -0.7f;
16267 if (velocity.X > 0f && velocity.X < 2f)
16268 {
16269 velocity.X = 2f;
16270 }
16271 if (velocity.X < 0f && velocity.X > -2f)
16272 {
16273 velocity.X = -2f;
16274 }
16275 }
16276 if (collideY)
16277 {
16278 netUpdate = true;
16279 velocity.Y = oldVelocity.Y * -0.7f;
16280 if (velocity.Y > 0f && velocity.Y < 2f)
16281 {
16282 velocity.Y = 2f;
16283 }
16284 if (velocity.Y < 0f && velocity.Y > -2f)
16285 {
16286 velocity.Y = -2f;
16287 }
16288 }
16289 if (Main.netMode == 1)
16290 {
16291 return;
16292 }
16293 if (type == 101 && !Main.player[target].DeadOrGhost)
16294 {
16295 if (justHit)
16296 {
16297 localAI[0] = 0f;
16298 }
16299 localAI[0] += 1f;
16300 if (localAI[0] >= 120f)
16301 {
16303 {
16304 float num195 = 10f;
16305 vector25 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16306 num192 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector25.X + (float)Main.rand.Next(-10, 11);
16307 num193 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector25.Y + (float)Main.rand.Next(-10, 11);
16308 num194 = (float)Math.Sqrt(num192 * num192 + num193 * num193);
16309 num194 = num195 / num194;
16310 num192 *= num194;
16311 num193 *= num194;
16313 int num196 = 96;
16315 Main.projectile[num197].timeLeft = 300;
16316 localAI[0] = 0f;
16317 }
16318 else
16319 {
16320 localAI[0] = 100f;
16321 }
16322 }
16323 }
16324 if (type != 260 || Main.player[target].DeadOrGhost)
16325 {
16326 return;
16327 }
16328 if (justHit)
16329 {
16330 localAI[0] = 0f;
16331 }
16332 localAI[0] += 1f;
16333 if (!(localAI[0] >= 150f))
16334 {
16335 return;
16336 }
16338 {
16339 float num198 = 14f;
16340 vector25 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16341 num192 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector25.X + (float)Main.rand.Next(-10, 11);
16342 float num199 = Math.Abs(num192 * 0.1f);
16343 if (num193 > 0f)
16344 {
16345 num199 = 0f;
16346 }
16347 num193 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector25.Y + (float)Main.rand.Next(-10, 11) - num199;
16348 num194 = (float)Math.Sqrt(num192 * num192 + num193 * num193);
16349 num194 = num198 / num194;
16350 num192 *= num194;
16351 num193 *= num194;
16352 int num200 = NewNPC(GetSpawnSourceForProjectileNPC(), (int)base.Center.X, (int)base.Center.Y, 261);
16353 Main.npc[num200].velocity.X = num192;
16354 Main.npc[num200].velocity.Y = num193;
16355 Main.npc[num200].netUpdate = true;
16356 localAI[0] = 0f;
16357 }
16358 else
16359 {
16360 localAI[0] = 250f;
16361 }
16362 return;
16363 }
16364 if (aiStyle == 14)
16365 {
16366 noGravity = true;
16367 if (collideX)
16368 {
16369 velocity.X = oldVelocity.X * -0.5f;
16370 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
16371 {
16372 velocity.X = 2f;
16373 }
16374 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
16375 {
16376 velocity.X = -2f;
16377 }
16378 }
16379 if (collideY)
16380 {
16381 velocity.Y = oldVelocity.Y * -0.5f;
16382 if (velocity.Y > 0f && velocity.Y < 1f)
16383 {
16384 velocity.Y = 1f;
16385 }
16386 if (velocity.Y < 0f && velocity.Y > -1f)
16387 {
16388 velocity.Y = -1f;
16389 }
16390 }
16391 if (type == 226)
16392 {
16393 int num201 = 1;
16394 int num202 = 1;
16395 if (velocity.X < 0f)
16396 {
16397 num201 = -1;
16398 }
16399 if (velocity.Y < 0f)
16400 {
16401 num202 = -1;
16402 }
16403 TargetClosest();
16404 if (!Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16405 {
16406 direction = num201;
16408 }
16409 }
16410 else
16411 {
16412 TargetClosest();
16413 }
16414 if (type == 158)
16415 {
16416 if ((double)position.Y < Main.worldSurface * 16.0 && Main.IsItDay() && !Main.eclipse)
16417 {
16418 directionY = -1;
16419 direction *= -1;
16420 }
16421 if (direction == -1 && velocity.X > -7f)
16422 {
16423 velocity.X -= 0.2f;
16424 if (velocity.X > 4f)
16425 {
16426 velocity.X -= 0.1f;
16427 }
16428 else if (velocity.X > 0f)
16429 {
16430 velocity.X += 0.05f;
16431 }
16432 if (velocity.X < -7f)
16433 {
16434 velocity.X = -7f;
16435 }
16436 }
16437 else if (direction == 1 && velocity.X < 7f)
16438 {
16439 velocity.X += 0.2f;
16440 if (velocity.X < -4f)
16441 {
16442 velocity.X += 0.1f;
16443 }
16444 else if (velocity.X < 0f)
16445 {
16446 velocity.X -= 0.05f;
16447 }
16448 if (velocity.X > 7f)
16449 {
16450 velocity.X = 7f;
16451 }
16452 }
16453 if (directionY == -1 && velocity.Y > -7f)
16454 {
16455 velocity.Y -= 0.2f;
16456 if (velocity.Y > 4f)
16457 {
16458 velocity.Y -= 0.1f;
16459 }
16460 else if (velocity.Y > 0f)
16461 {
16462 velocity.Y += 0.05f;
16463 }
16464 if (velocity.Y < -7f)
16465 {
16466 velocity.Y = -7f;
16467 }
16468 }
16469 else if (directionY == 1 && velocity.Y < 7f)
16470 {
16471 velocity.Y += 0.2f;
16472 if (velocity.Y < -4f)
16473 {
16474 velocity.Y += 0.1f;
16475 }
16476 else if (velocity.Y < 0f)
16477 {
16478 velocity.Y -= 0.05f;
16479 }
16480 if (velocity.Y > 7f)
16481 {
16482 velocity.Y = 7f;
16483 }
16484 }
16485 }
16486 else if (type == 226)
16487 {
16488 if (direction == -1 && velocity.X > -4f)
16489 {
16490 velocity.X -= 0.2f;
16491 if (velocity.X > 4f)
16492 {
16493 velocity.X -= 0.1f;
16494 }
16495 else if (velocity.X > 0f)
16496 {
16497 velocity.X += 0.05f;
16498 }
16499 if (velocity.X < -4f)
16500 {
16501 velocity.X = -4f;
16502 }
16503 }
16504 else if (direction == 1 && velocity.X < 4f)
16505 {
16506 velocity.X += 0.2f;
16507 if (velocity.X < -4f)
16508 {
16509 velocity.X += 0.1f;
16510 }
16511 else if (velocity.X < 0f)
16512 {
16513 velocity.X -= 0.05f;
16514 }
16515 if (velocity.X > 4f)
16516 {
16517 velocity.X = 4f;
16518 }
16519 }
16520 if (directionY == -1 && (double)velocity.Y > -2.5)
16521 {
16522 velocity.Y -= 0.1f;
16523 if ((double)velocity.Y > 2.5)
16524 {
16525 velocity.Y -= 0.05f;
16526 }
16527 else if (velocity.Y > 0f)
16528 {
16529 velocity.Y += 0.03f;
16530 }
16531 if ((double)velocity.Y < -2.5)
16532 {
16533 velocity.Y = -2.5f;
16534 }
16535 }
16536 else if (directionY == 1 && (double)velocity.Y < 2.5)
16537 {
16538 velocity.Y += 0.1f;
16539 if ((double)velocity.Y < -2.5)
16540 {
16541 velocity.Y += 0.05f;
16542 }
16543 else if (velocity.Y < 0f)
16544 {
16545 velocity.Y -= 0.03f;
16546 }
16547 if ((double)velocity.Y > 2.5)
16548 {
16549 velocity.Y = 2.5f;
16550 }
16551 }
16552 }
16553 else if (type == 660)
16554 {
16555 float num203 = 0.1f;
16556 float num204 = 0.04f;
16557 float num205 = 4f;
16558 float num206 = 1.5f;
16559 int num207 = type;
16560 if (num207 == 660)
16561 {
16562 num203 = 0.35f;
16563 num204 = 0.3f;
16564 num205 = 6f;
16565 num206 = 5f;
16566 }
16567 if (direction == -1 && velocity.X > 0f - num205)
16568 {
16569 velocity.X -= num203;
16570 if (velocity.X > num205)
16571 {
16572 velocity.X -= num203;
16573 }
16574 else if (velocity.X > 0f)
16575 {
16576 velocity.X += num203 * 0.5f;
16577 }
16578 if (velocity.X < 0f - num205)
16579 {
16580 velocity.X = 0f - num205;
16581 }
16582 }
16583 else if (direction == 1 && velocity.X < num205)
16584 {
16585 velocity.X += num203;
16586 if (velocity.X < 0f - num205)
16587 {
16588 velocity.X += num203;
16589 }
16590 else if (velocity.X < 0f)
16591 {
16592 velocity.X -= num203 * 0.5f;
16593 }
16594 if (velocity.X > num205)
16595 {
16596 velocity.X = num205;
16597 }
16598 }
16599 if (directionY == -1 && velocity.Y > 0f - num206)
16600 {
16601 velocity.Y -= num204;
16602 if (velocity.Y > num206)
16603 {
16604 velocity.Y -= num204;
16605 }
16606 else if (velocity.Y > 0f)
16607 {
16608 velocity.Y += num204 * 0.75f;
16609 }
16610 if (velocity.Y < 0f - num206)
16611 {
16612 velocity.Y = 0f - num206;
16613 }
16614 }
16615 else if (directionY == 1 && velocity.Y < num206)
16616 {
16617 velocity.Y += num204;
16618 if (velocity.Y < 0f - num206)
16619 {
16620 velocity.Y += num204;
16621 }
16622 else if (velocity.Y < 0f)
16623 {
16624 velocity.Y -= num204 * 0.75f;
16625 }
16626 if (velocity.Y > num206)
16627 {
16628 velocity.Y = num206;
16629 }
16630 }
16631 }
16632 else
16633 {
16634 if (direction == -1 && velocity.X > -4f)
16635 {
16636 velocity.X -= 0.1f;
16637 if (velocity.X > 4f)
16638 {
16639 velocity.X -= 0.1f;
16640 }
16641 else if (velocity.X > 0f)
16642 {
16643 velocity.X += 0.05f;
16644 }
16645 if (velocity.X < -4f)
16646 {
16647 velocity.X = -4f;
16648 }
16649 }
16650 else if (direction == 1 && velocity.X < 4f)
16651 {
16652 velocity.X += 0.1f;
16653 if (velocity.X < -4f)
16654 {
16655 velocity.X += 0.1f;
16656 }
16657 else if (velocity.X < 0f)
16658 {
16659 velocity.X -= 0.05f;
16660 }
16661 if (velocity.X > 4f)
16662 {
16663 velocity.X = 4f;
16664 }
16665 }
16666 if (directionY == -1 && (double)velocity.Y > -1.5)
16667 {
16668 velocity.Y -= 0.04f;
16669 if ((double)velocity.Y > 1.5)
16670 {
16671 velocity.Y -= 0.05f;
16672 }
16673 else if (velocity.Y > 0f)
16674 {
16675 velocity.Y += 0.03f;
16676 }
16677 if ((double)velocity.Y < -1.5)
16678 {
16679 velocity.Y = -1.5f;
16680 }
16681 }
16682 else if (directionY == 1 && (double)velocity.Y < 1.5)
16683 {
16684 velocity.Y += 0.04f;
16685 if ((double)velocity.Y < -1.5)
16686 {
16687 velocity.Y += 0.05f;
16688 }
16689 else if (velocity.Y < 0f)
16690 {
16691 velocity.Y -= 0.03f;
16692 }
16693 if ((double)velocity.Y > 1.5)
16694 {
16695 velocity.Y = 1.5f;
16696 }
16697 }
16698 }
16699 if (type == 49 || type == 51 || type == 60 || type == 62 || type == 66 || type == 93 || type == 137 || type == 150 || type == 151 || type == 152 || type == 634)
16700 {
16701 if (wet)
16702 {
16703 if (velocity.Y > 0f)
16704 {
16705 velocity.Y *= 0.95f;
16706 }
16707 velocity.Y -= 0.5f;
16708 if (velocity.Y < -4f)
16709 {
16710 velocity.Y = -4f;
16711 }
16712 TargetClosest();
16713 }
16714 if (type == 60)
16715 {
16716 if (direction == -1 && velocity.X > -4f)
16717 {
16718 velocity.X -= 0.1f;
16719 if (velocity.X > 4f)
16720 {
16721 velocity.X -= 0.07f;
16722 }
16723 else if (velocity.X > 0f)
16724 {
16725 velocity.X += 0.03f;
16726 }
16727 if (velocity.X < -4f)
16728 {
16729 velocity.X = -4f;
16730 }
16731 }
16732 else if (direction == 1 && velocity.X < 4f)
16733 {
16734 velocity.X += 0.1f;
16735 if (velocity.X < -4f)
16736 {
16737 velocity.X += 0.07f;
16738 }
16739 else if (velocity.X < 0f)
16740 {
16741 velocity.X -= 0.03f;
16742 }
16743 if (velocity.X > 4f)
16744 {
16745 velocity.X = 4f;
16746 }
16747 }
16748 if (directionY == -1 && (double)velocity.Y > -1.5)
16749 {
16750 velocity.Y -= 0.04f;
16751 if ((double)velocity.Y > 1.5)
16752 {
16753 velocity.Y -= 0.03f;
16754 }
16755 else if (velocity.Y > 0f)
16756 {
16757 velocity.Y += 0.02f;
16758 }
16759 if ((double)velocity.Y < -1.5)
16760 {
16761 velocity.Y = -1.5f;
16762 }
16763 }
16764 else if (directionY == 1 && (double)velocity.Y < 1.5)
16765 {
16766 velocity.Y += 0.04f;
16767 if ((double)velocity.Y < -1.5)
16768 {
16769 velocity.Y += 0.03f;
16770 }
16771 else if (velocity.Y < 0f)
16772 {
16773 velocity.Y -= 0.02f;
16774 }
16775 if ((double)velocity.Y > 1.5)
16776 {
16777 velocity.Y = 1.5f;
16778 }
16779 }
16780 }
16781 else
16782 {
16783 if (direction == -1 && velocity.X > -4f)
16784 {
16785 velocity.X -= 0.1f;
16786 if (velocity.X > 4f)
16787 {
16788 velocity.X -= 0.1f;
16789 }
16790 else if (velocity.X > 0f)
16791 {
16792 velocity.X += 0.05f;
16793 }
16794 if (velocity.X < -4f)
16795 {
16796 velocity.X = -4f;
16797 }
16798 }
16799 else if (direction == 1 && velocity.X < 4f)
16800 {
16801 velocity.X += 0.1f;
16802 if (velocity.X < -4f)
16803 {
16804 velocity.X += 0.1f;
16805 }
16806 else if (velocity.X < 0f)
16807 {
16808 velocity.X -= 0.05f;
16809 }
16810 if (velocity.X > 4f)
16811 {
16812 velocity.X = 4f;
16813 }
16814 }
16815 if (directionY == -1 && (double)velocity.Y > -1.5)
16816 {
16817 velocity.Y -= 0.04f;
16818 if ((double)velocity.Y > 1.5)
16819 {
16820 velocity.Y -= 0.05f;
16821 }
16822 else if (velocity.Y > 0f)
16823 {
16824 velocity.Y += 0.03f;
16825 }
16826 if ((double)velocity.Y < -1.5)
16827 {
16828 velocity.Y = -1.5f;
16829 }
16830 }
16831 else if (directionY == 1 && (double)velocity.Y < 1.5)
16832 {
16833 velocity.Y += 0.04f;
16834 if ((double)velocity.Y < -1.5)
16835 {
16836 velocity.Y += 0.05f;
16837 }
16838 else if (velocity.Y < 0f)
16839 {
16840 velocity.Y -= 0.03f;
16841 }
16842 if ((double)velocity.Y > 1.5)
16843 {
16844 velocity.Y = 1.5f;
16845 }
16846 }
16847 }
16848 }
16849 if (type == 48 && wet)
16850 {
16851 if (velocity.Y > 0f)
16852 {
16853 velocity.Y *= 0.95f;
16854 }
16855 velocity.Y -= 0.5f;
16856 if (velocity.Y < -4f)
16857 {
16858 velocity.Y = -4f;
16859 }
16860 TargetClosest();
16861 }
16862 if (type == 158 && Main.netMode != 1)
16863 {
16864 Vector2 vector26 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16865 float num208 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector26.X;
16866 float num209 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector26.Y;
16867 float num210 = (float)Math.Sqrt(num208 * num208 + num209 * num209);
16868 if (num210 < 200f && position.Y + (float)height < Main.player[target].position.Y + (float)Main.player[target].height && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16869 {
16870 Transform(159);
16871 }
16872 }
16873 this.ai[1] += 1f;
16874 if (type == 158)
16875 {
16876 this.ai[1] += 1f;
16877 }
16878 if (this.ai[1] > 200f)
16879 {
16880 if (!Main.player[target].wet && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16881 {
16882 this.ai[1] = 0f;
16883 }
16884 float num211 = 0.2f;
16885 float num212 = 0.1f;
16886 float num213 = 4f;
16887 float num214 = 1.5f;
16888 if (type == 48 || type == 62 || type == 66)
16889 {
16890 num211 = 0.12f;
16891 num212 = 0.07f;
16892 num213 = 3f;
16893 num214 = 1.25f;
16894 }
16895 if (this.ai[1] > 1000f)
16896 {
16897 this.ai[1] = 0f;
16898 }
16899 this.ai[2] += 1f;
16900 if (this.ai[2] > 0f)
16901 {
16902 if (velocity.Y < num214)
16903 {
16904 velocity.Y += num212;
16905 }
16906 }
16907 else if (velocity.Y > 0f - num214)
16908 {
16909 velocity.Y -= num212;
16910 }
16911 if (this.ai[2] < -150f || this.ai[2] > 150f)
16912 {
16913 if (velocity.X < num213)
16914 {
16915 velocity.X += num211;
16916 }
16917 }
16918 else if (velocity.X > 0f - num213)
16919 {
16920 velocity.X -= num211;
16921 }
16922 if (this.ai[2] > 300f)
16923 {
16924 this.ai[2] = -300f;
16925 }
16926 }
16927 if (Main.netMode == 1)
16928 {
16929 return;
16930 }
16931 if (type == 48)
16932 {
16933 this.ai[0] += 1f;
16934 if (this.ai[0] == 30f || this.ai[0] == 60f || this.ai[0] == 90f)
16935 {
16936 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16937 {
16938 float num215 = 6f;
16939 Vector2 vector27 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16940 float num216 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector27.X + (float)Main.rand.Next(-100, 101);
16941 float num217 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector27.Y + (float)Main.rand.Next(-100, 101);
16942 float num218 = (float)Math.Sqrt(num216 * num216 + num217 * num217);
16943 num218 = num215 / num218;
16944 num216 *= num218;
16945 num217 *= num218;
16946 int num219 = 15;
16947 int num220 = 38;
16949 Main.projectile[num221].timeLeft = 300;
16950 }
16951 }
16952 else if (this.ai[0] >= (float)(400 + Main.rand.Next(400)))
16953 {
16954 this.ai[0] = 0f;
16955 }
16956 }
16957 if (type == 62 || type == 66)
16958 {
16959 this.ai[0] += 1f;
16960 if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f)
16961 {
16962 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16963 {
16964 float num222 = 0.2f;
16965 Vector2 vector28 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16966 float num223 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector28.X + (float)Main.rand.Next(-100, 101);
16967 float num224 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector28.Y + (float)Main.rand.Next(-100, 101);
16968 float num225 = (float)Math.Sqrt(num223 * num223 + num224 * num224);
16969 num225 = num222 / num225;
16970 num223 *= num225;
16971 num224 *= num225;
16972 int num226 = 21;
16973 int num227 = 44;
16975 Main.projectile[num228].timeLeft = 300;
16976 }
16977 }
16978 else if (this.ai[0] >= (float)(300 + Main.rand.Next(300)))
16979 {
16980 this.ai[0] = 0f;
16981 }
16982 }
16983 if (type != 156)
16984 {
16985 return;
16986 }
16987 this.ai[0] += 1f;
16988 if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f || this.ai[0] == 100f)
16989 {
16990 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
16991 {
16992 float num229 = 0.2f;
16993 Vector2 vector29 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
16994 float num230 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector29.X + (float)Main.rand.Next(-50, 51);
16995 float num231 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector29.Y + (float)Main.rand.Next(-50, 51);
16996 float num232 = (float)Math.Sqrt(num230 * num230 + num231 * num231);
16997 num232 = num229 / num232;
16998 num230 *= num232;
16999 num231 *= num232;
17000 int num233 = 80;
17001 int num234 = 115;
17002 vector29 += velocity * 5f;
17003 int num235 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector29.X + num230 * 100f, vector29.Y + num231 * 100f, num230, num231, num234, num233, 0f, Main.myPlayer);
17004 Main.projectile[num235].timeLeft = 300;
17005 }
17006 }
17007 else if (this.ai[0] >= (float)(250 + Main.rand.Next(250)))
17008 {
17009 this.ai[0] = 0f;
17010 }
17011 return;
17012 }
17013 if (aiStyle == 15)
17014 {
17015 float num236 = 1f;
17016 float num237 = 1f;
17017 bool flag6 = false;
17018 bool flag7 = false;
17019 bool flag8 = false;
17020 float num238 = 2f;
17021 if (Main.getGoodWorld)
17022 {
17023 num238 -= 1f - (float)life / (float)lifeMax;
17024 num237 *= num238;
17025 }
17026 aiAction = 0;
17027 if (this.ai[3] == 0f && life > 0)
17028 {
17029 this.ai[3] = lifeMax;
17030 }
17031 if (localAI[3] == 0f)
17032 {
17033 localAI[3] = 1f;
17034 flag6 = true;
17035 if (Main.netMode != 1)
17036 {
17037 this.ai[0] = -100f;
17038 TargetClosest();
17039 netUpdate = true;
17040 }
17041 }
17042 int num239 = 3000;
17043 if (Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > (float)num239)
17044 {
17045 TargetClosest();
17046 if (Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > (float)num239)
17047 {
17048 EncourageDespawn(10);
17049 if (Main.player[target].Center.X < base.Center.X)
17050 {
17051 direction = 1;
17052 }
17053 else
17054 {
17055 direction = -1;
17056 }
17057 if (Main.netMode != 1 && this.ai[1] != 5f)
17058 {
17059 netUpdate = true;
17060 this.ai[2] = 0f;
17061 this.ai[0] = 0f;
17062 this.ai[1] = 5f;
17063 localAI[1] = Main.maxTilesX * 16;
17064 localAI[2] = Main.maxTilesY * 16;
17065 }
17066 }
17067 }
17068 if (!Main.player[target].dead && timeLeft > 10 && this.ai[2] >= 300f && this.ai[1] < 5f && velocity.Y == 0f)
17069 {
17070 this.ai[2] = 0f;
17071 this.ai[0] = 0f;
17072 this.ai[1] = 5f;
17073 if (Main.netMode != 1)
17074 {
17075 TargetClosest(faceTarget: false);
17076 Point point3 = base.Center.ToTileCoordinates();
17077 Point point4 = Main.player[target].Center.ToTileCoordinates();
17078 Vector2 vector30 = Main.player[target].Center - base.Center;
17079 int num240 = 10;
17080 int num241 = 0;
17081 int num242 = 7;
17082 int num243 = 0;
17083 bool flag9 = false;
17084 if (localAI[0] >= 360f || vector30.Length() > 2000f)
17085 {
17086 if (localAI[0] >= 360f)
17087 {
17088 localAI[0] = 360f;
17089 }
17090 flag9 = true;
17091 num243 = 100;
17092 }
17093 while (!flag9 && num243 < 100)
17094 {
17095 num243++;
17096 int num244 = Main.rand.Next(point4.X - num240, point4.X + num240 + 1);
17097 int num245 = Main.rand.Next(point4.Y - num240, point4.Y + 1);
17098 if ((num245 >= point4.Y - num242 && num245 <= point4.Y + num242 && num244 >= point4.X - num242 && num244 <= point4.X + num242) || (num245 >= point3.Y - num241 && num245 <= point3.Y + num241 && num244 >= point3.X - num241 && num244 <= point3.X + num241) || Main.tile[num244, num245].nactive())
17099 {
17100 continue;
17101 }
17102 int num246 = num245;
17103 int num247 = 0;
17104 if (Main.tile[num244, num246].nactive() && Main.tileSolid[Main.tile[num244, num246].type] && !Main.tileSolidTop[Main.tile[num244, num246].type])
17105 {
17106 num247 = 1;
17107 }
17108 else
17109 {
17110 for (; num247 < 150 && num246 + num247 < Main.maxTilesY; num247++)
17111 {
17112 int num248 = num246 + num247;
17113 if (Main.tile[num244, num248].nactive() && Main.tileSolid[Main.tile[num244, num248].type] && !Main.tileSolidTop[Main.tile[num244, num248].type])
17114 {
17115 num247--;
17116 break;
17117 }
17118 }
17119 }
17120 num245 += num247;
17121 bool flag10 = true;
17122 if (flag10 && Main.tile[num244, num245].lava())
17123 {
17124 flag10 = false;
17125 }
17126 if (flag10 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
17127 {
17128 flag10 = false;
17129 }
17130 if (flag10)
17131 {
17132 localAI[1] = num244 * 16 + 8;
17133 localAI[2] = num245 * 16 + 16;
17134 flag9 = true;
17135 break;
17136 }
17137 }
17138 if (num243 >= 100)
17139 {
17141 localAI[1] = bottom.X;
17142 localAI[2] = bottom.Y;
17143 }
17144 }
17145 }
17146 if (!Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0) || Math.Abs(base.Top.Y - Main.player[target].Bottom.Y) > 160f)
17147 {
17148 this.ai[2]++;
17149 if (Main.netMode != 1)
17150 {
17151 localAI[0]++;
17152 }
17153 }
17154 else if (Main.netMode != 1)
17155 {
17156 localAI[0]--;
17157 if (localAI[0] < 0f)
17158 {
17159 localAI[0] = 0f;
17160 }
17161 }
17162 if (timeLeft < 10 && (this.ai[0] != 0f || this.ai[1] != 0f))
17163 {
17164 this.ai[0] = 0f;
17165 this.ai[1] = 0f;
17166 netUpdate = true;
17167 flag7 = false;
17168 }
17169 Dust dust;
17170 if (this.ai[1] == 5f)
17171 {
17172 flag7 = true;
17173 aiAction = 1;
17174 this.ai[0]++;
17175 num236 = MathHelper.Clamp((60f - this.ai[0]) / 60f, 0f, 1f);
17176 num236 = 0.5f + num236 * 0.5f;
17177 if (this.ai[0] >= 60f)
17178 {
17179 flag8 = true;
17180 }
17181 if (this.ai[0] == 60f)
17182 {
17183 Gore.NewGore(base.Center + new Vector2(-40f, -height / 2), velocity, 734);
17184 }
17185 if (this.ai[0] >= 60f && Main.netMode != 1)
17186 {
17187 base.Bottom = new Vector2(localAI[1], localAI[2]);
17188 this.ai[1] = 6f;
17189 this.ai[0] = 0f;
17190 netUpdate = true;
17191 }
17192 if (Main.netMode == 1 && this.ai[0] >= 120f)
17193 {
17194 this.ai[1] = 6f;
17195 this.ai[0] = 0f;
17196 }
17197 if (!flag8)
17198 {
17199 for (int num249 = 0; num249 < 10; num249++)
17200 {
17201 int num250 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 150, new Color(78, 136, 255, 80), 2f);
17202 Main.dust[num250].noGravity = true;
17203 dust = Main.dust[num250];
17204 dust.velocity *= 0.5f;
17205 }
17206 }
17207 }
17208 else if (this.ai[1] == 6f)
17209 {
17210 flag7 = true;
17211 aiAction = 0;
17212 this.ai[0]++;
17213 num236 = MathHelper.Clamp(this.ai[0] / 30f, 0f, 1f);
17214 num236 = 0.5f + num236 * 0.5f;
17215 if (this.ai[0] >= 30f && Main.netMode != 1)
17216 {
17217 this.ai[1] = 0f;
17218 this.ai[0] = 0f;
17219 netUpdate = true;
17220 TargetClosest();
17221 }
17222 if (Main.netMode == 1 && this.ai[0] >= 60f)
17223 {
17224 this.ai[1] = 0f;
17225 this.ai[0] = 0f;
17226 TargetClosest();
17227 }
17228 for (int num251 = 0; num251 < 10; num251++)
17229 {
17230 int num252 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 150, new Color(78, 136, 255, 80), 2f);
17231 Main.dust[num252].noGravity = true;
17232 dust = Main.dust[num252];
17233 dust.velocity *= 2f;
17234 }
17235 }
17237 if (velocity.Y == 0f)
17238 {
17239 velocity.X *= 0.8f;
17240 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
17241 {
17242 velocity.X = 0f;
17243 }
17244 if (!flag7)
17245 {
17246 this.ai[0] += 2f;
17247 if ((double)life < (double)lifeMax * 0.8)
17248 {
17249 this.ai[0] += 1f;
17250 }
17251 if ((double)life < (double)lifeMax * 0.6)
17252 {
17253 this.ai[0] += 1f;
17254 }
17255 if ((double)life < (double)lifeMax * 0.4)
17256 {
17257 this.ai[0] += 2f;
17258 }
17259 if ((double)life < (double)lifeMax * 0.2)
17260 {
17261 this.ai[0] += 3f;
17262 }
17263 if ((double)life < (double)lifeMax * 0.1)
17264 {
17265 this.ai[0] += 4f;
17266 }
17267 if (this.ai[0] >= 0f)
17268 {
17269 netUpdate = true;
17270 TargetClosest();
17271 if (this.ai[1] == 3f)
17272 {
17273 velocity.Y = -13f;
17274 velocity.X += 3.5f * (float)direction;
17275 this.ai[0] = -200f;
17276 this.ai[1] = 0f;
17277 }
17278 else if (this.ai[1] == 2f)
17279 {
17280 velocity.Y = -6f;
17281 velocity.X += 4.5f * (float)direction;
17282 this.ai[0] = -120f;
17283 this.ai[1] += 1f;
17284 }
17285 else
17286 {
17287 velocity.Y = -8f;
17288 velocity.X += 4f * (float)direction;
17289 this.ai[0] = -120f;
17290 this.ai[1] += 1f;
17291 }
17292 }
17293 else if (this.ai[0] >= -30f)
17294 {
17295 aiAction = 1;
17296 }
17297 }
17298 }
17299 else if (target < 255)
17300 {
17301 float num253 = 3f;
17302 if (Main.getGoodWorld)
17303 {
17304 num253 = 6f;
17305 }
17306 if ((direction == 1 && velocity.X < num253) || (direction == -1 && velocity.X > 0f - num253))
17307 {
17308 if ((direction == -1 && (double)velocity.X < 0.1) || (direction == 1 && (double)velocity.X > -0.1))
17309 {
17310 velocity.X += 0.2f * (float)direction;
17311 }
17312 else
17313 {
17314 velocity.X *= 0.93f;
17315 }
17316 }
17317 }
17318 int num254 = Dust.NewDust(position, width, height, 4, velocity.X, velocity.Y, 255, new Color(0, 80, 255, 80), scale * 1.2f);
17319 Main.dust[num254].noGravity = true;
17320 dust = Main.dust[num254];
17321 dust.velocity *= 0.5f;
17322 if (life <= 0)
17323 {
17324 return;
17325 }
17326 float num255 = (float)life / (float)lifeMax;
17327 num255 = num255 * 0.5f + 0.75f;
17328 num255 *= num236;
17329 num255 *= num237;
17330 if (num255 != scale || flag6)
17331 {
17332 position.X += width / 2;
17333 position.Y += height;
17334 scale = num255;
17335 width = (int)(98f * scale);
17336 height = (int)(92f * scale);
17337 position.X -= width / 2;
17338 position.Y -= height;
17339 }
17340 if (Main.netMode == 1)
17341 {
17342 return;
17343 }
17344 int num256 = (int)((double)lifeMax * 0.05);
17345 if (!((float)(life + num256) < this.ai[3]))
17346 {
17347 return;
17348 }
17349 this.ai[3] = life;
17350 int num257 = Main.rand.Next(1, 4);
17351 for (int num258 = 0; num258 < num257; num258++)
17352 {
17353 int x = (int)(position.X + (float)Main.rand.Next(width - 32));
17354 int y = (int)(position.Y + (float)Main.rand.Next(height - 32));
17355 int num259 = 1;
17356 if (Main.expertMode && Main.rand.Next(4) == 0)
17357 {
17358 num259 = 535;
17359 }
17361 Main.npc[num260].SetDefaults(num259);
17362 Main.npc[num260].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
17363 Main.npc[num260].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
17364 Main.npc[num260].ai[0] = -1000 * Main.rand.Next(3);
17365 Main.npc[num260].ai[1] = 0f;
17366 if (Main.netMode == 2 && num260 < 200)
17367 {
17368 NetMessage.SendData(23, -1, -1, null, num260);
17369 }
17370 }
17371 return;
17372 }
17373 if (aiStyle == 16)
17374 {
17375 if (direction == 0)
17376 {
17377 TargetClosest();
17378 }
17379 if (type == 615)
17380 {
17381 if (this.ai[2] == 0f)
17382 {
17383 int num261 = Main.rand.Next(300, 1200);
17384 if ((this.ai[3] += 1f) >= (float)num261)
17385 {
17386 this.ai[2] = Main.rand.Next(1, 3);
17387 if (this.ai[2] == 1f && !Collision.CanHitLine(position, width, height, new Vector2(position.X, position.Y - 128f), width, height))
17388 {
17389 this.ai[2] = 2f;
17390 }
17391 if (this.ai[2] == 2f)
17392 {
17393 TargetClosest();
17394 }
17395 this.ai[3] = 0f;
17396 netUpdate = true;
17397 }
17398 }
17399 if (this.ai[2] == 1f)
17400 {
17401 if (collideY || collideX)
17402 {
17403 this.ai[2] = 0f;
17404 this.ai[3] = 0f;
17405 netUpdate = true;
17406 }
17407 else if (wet)
17408 {
17409 velocity.Y -= 0.4f;
17410 if (velocity.Y < -6f)
17411 {
17412 velocity.Y = -6f;
17413 }
17414 rotation = velocity.Y * (float)direction * 0.3f;
17415 if (rotation < (float)Math.PI * -2f / 5f)
17416 {
17417 rotation = (float)Math.PI * -2f / 5f;
17418 }
17419 if (rotation > (float)Math.PI * 2f / 5f)
17420 {
17421 rotation = (float)Math.PI * 2f / 5f;
17422 }
17423 if (this.ai[3] == 1f)
17424 {
17425 this.ai[2] = 0f;
17426 this.ai[3] = 0f;
17427 netUpdate = true;
17428 }
17429 }
17430 else
17431 {
17432 rotation += (float)direction * 0.2f;
17433 this.ai[3] = 1f;
17434 velocity.Y += 0.3f;
17435 if (velocity.Y > 10f)
17436 {
17437 velocity.Y = 10f;
17438 }
17439 }
17440 return;
17441 }
17442 if (this.ai[2] == 2f)
17443 {
17444 if (collideY || collideX)
17445 {
17446 this.ai[2] = 0f;
17447 this.ai[3] = 0f;
17448 netUpdate = true;
17449 }
17450 else if (wet)
17451 {
17452 velocity.Y -= 0.4f;
17453 if (velocity.Y < -6f)
17454 {
17455 velocity.Y = -6f;
17456 }
17457 rotation = velocity.Y * (float)direction * 0.3f;
17458 if (rotation < (float)Math.PI * -2f / 5f)
17459 {
17460 rotation = (float)Math.PI * -2f / 5f;
17461 }
17462 if (rotation > (float)Math.PI * 2f / 5f)
17463 {
17464 rotation = (float)Math.PI * 2f / 5f;
17465 }
17466 if (Collision.GetWaterLine(base.Top.ToTileCoordinates(), out var waterLineHeight))
17467 {
17468 float y2 = waterLineHeight + 0f - position.Y;
17469 velocity.Y = y2;
17470 velocity.Y = MathHelper.Clamp(velocity.Y, -2f, 0.5f);
17471 rotation = -(float)Math.PI / 5f * (float)direction;
17472 velocity.X *= 0.95f;
17473 if (this.ai[3] == 0f)
17474 {
17475 netUpdate = true;
17476 }
17477 this.ai[3]++;
17478 if (this.ai[3] >= 300f)
17479 {
17480 this.ai[2] = 0f;
17481 this.ai[3] = 0f;
17482 netUpdate = true;
17483 velocity.Y = 4f;
17484 }
17485 if (this.ai[3] == 60f && Main.rand.Next(2) == 0)
17486 {
17487 SoundEngine.PlaySound(45, (int)position.X, (int)position.Y);
17488 }
17489 }
17490 }
17491 else
17492 {
17493 this.ai[2] = 0f;
17494 this.ai[3] = 0f;
17495 netUpdate = true;
17496 velocity.Y += 0.3f;
17497 if (velocity.Y > 10f)
17498 {
17499 velocity.Y = 10f;
17500 }
17501 }
17502 return;
17503 }
17504 }
17505 if (wet)
17506 {
17507 bool flag11 = false;
17508 if (type != 55 && type != 592 && type != 607 && type != 615)
17509 {
17510 TargetClosest(faceTarget: false);
17511 if (Main.player[target].wet && !Main.player[target].dead && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
17512 {
17513 flag11 = true;
17514 }
17515 }
17516 int num262 = (int)base.Center.X / 16;
17517 int num263 = (int)(position.Y + (float)height) / 16;
17518 if (Main.tile[num262, num263].topSlope())
17519 {
17520 if (Main.tile[num262, num263].leftSlope())
17521 {
17522 direction = -1;
17523 velocity.X = Math.Abs(velocity.X) * -1f;
17524 }
17525 else
17526 {
17527 direction = 1;
17528 velocity.X = Math.Abs(velocity.X);
17529 }
17530 }
17531 else if (Main.tile[num262, num263 + 1].topSlope())
17532 {
17533 if (Main.tile[num262, num263 + 1].leftSlope())
17534 {
17535 direction = -1;
17536 velocity.X = Math.Abs(velocity.X) * -1f;
17537 }
17538 else
17539 {
17540 direction = 1;
17541 velocity.X = Math.Abs(velocity.X);
17542 }
17543 }
17544 if (!flag11)
17545 {
17546 if (collideX)
17547 {
17548 velocity.X *= -1f;
17549 direction *= -1;
17550 netUpdate = true;
17551 }
17552 if (collideY)
17553 {
17554 netUpdate = true;
17555 if (velocity.Y > 0f)
17556 {
17557 velocity.Y = Math.Abs(velocity.Y) * -1f;
17558 directionY = -1;
17559 this.ai[0] = -1f;
17560 }
17561 else if (velocity.Y < 0f)
17562 {
17563 velocity.Y = Math.Abs(velocity.Y);
17564 directionY = 1;
17565 this.ai[0] = 1f;
17566 }
17567 }
17568 }
17569 if (type == 102)
17570 {
17571 Lighting.AddLight((int)(position.X + (float)(width / 2) + (float)(direction * (width + 8))) / 16, (int)(position.Y + 2f) / 16, 0.07f, 0.04f, 0.025f);
17572 }
17573 if (flag11)
17574 {
17575 TargetClosest();
17576 if (type == 157)
17577 {
17578 if (velocity.X > 0f && direction < 0)
17579 {
17580 velocity.X *= 0.95f;
17581 }
17582 if (velocity.X < 0f && direction > 0)
17583 {
17584 velocity.X *= 0.95f;
17585 }
17586 velocity.X += (float)direction * 0.25f;
17587 velocity.Y += (float)directionY * 0.2f;
17588 if (velocity.X > 8f)
17589 {
17590 velocity.X = 7f;
17591 }
17592 if (velocity.X < -8f)
17593 {
17594 velocity.X = -7f;
17595 }
17596 if (velocity.Y > 5f)
17597 {
17598 velocity.Y = 4f;
17599 }
17600 if (velocity.Y < -5f)
17601 {
17602 velocity.Y = -4f;
17603 }
17604 }
17605 else if (type == 65 || type == 102)
17606 {
17607 velocity.X += (float)direction * 0.15f;
17608 velocity.Y += (float)directionY * 0.15f;
17609 if (velocity.X > 5f)
17610 {
17611 velocity.X = 5f;
17612 }
17613 if (velocity.X < -5f)
17614 {
17615 velocity.X = -5f;
17616 }
17617 if (velocity.Y > 3f)
17618 {
17619 velocity.Y = 3f;
17620 }
17621 if (velocity.Y < -3f)
17622 {
17623 velocity.Y = -3f;
17624 }
17625 }
17626 else
17627 {
17628 velocity.X += (float)direction * 0.1f;
17629 velocity.Y += (float)directionY * 0.1f;
17630 if (velocity.X > 3f)
17631 {
17632 velocity.X = 3f;
17633 }
17634 if (velocity.X < -3f)
17635 {
17636 velocity.X = -3f;
17637 }
17638 if (velocity.Y > 2f)
17639 {
17640 velocity.Y = 2f;
17641 }
17642 if (velocity.Y < -2f)
17643 {
17644 velocity.Y = -2f;
17645 }
17646 }
17647 }
17648 else
17649 {
17650 if (type == 157)
17651 {
17652 if (Main.player[target].position.Y > position.Y)
17653 {
17654 directionY = 1;
17655 }
17656 else
17657 {
17658 directionY = -1;
17659 }
17660 velocity.X += (float)direction * 0.2f;
17661 if (velocity.X < -2f || velocity.X > 2f)
17662 {
17663 velocity.X *= 0.95f;
17664 }
17665 if (this.ai[0] == -1f)
17666 {
17667 float num264 = -0.6f;
17668 if (directionY < 0)
17669 {
17670 num264 = -1f;
17671 }
17672 if (directionY > 0)
17673 {
17674 num264 = -0.2f;
17675 }
17676 velocity.Y -= 0.02f;
17677 if (velocity.Y < num264)
17678 {
17679 this.ai[0] = 1f;
17680 }
17681 }
17682 else
17683 {
17684 float num265 = 0.6f;
17685 if (directionY < 0)
17686 {
17687 num265 = 0.2f;
17688 }
17689 if (directionY > 0)
17690 {
17691 num265 = 1f;
17692 }
17693 velocity.Y += 0.02f;
17694 if (velocity.Y > num265)
17695 {
17696 this.ai[0] = -1f;
17697 }
17698 }
17699 }
17700 else
17701 {
17702 velocity.X += (float)direction * 0.1f;
17703 float num266 = 1f;
17704 if (type == 615)
17705 {
17706 num266 = 3f;
17707 }
17708 if (velocity.X < 0f - num266 || velocity.X > num266)
17709 {
17710 velocity.X *= 0.95f;
17711 }
17712 if (this.ai[0] == -1f)
17713 {
17714 velocity.Y -= 0.01f;
17715 if ((double)velocity.Y < -0.3)
17716 {
17717 this.ai[0] = 1f;
17718 }
17719 }
17720 else
17721 {
17722 velocity.Y += 0.01f;
17723 if ((double)velocity.Y > 0.3)
17724 {
17725 this.ai[0] = -1f;
17726 }
17727 }
17728 }
17729 int num267 = (int)(position.X + (float)(width / 2)) / 16;
17730 int num268 = (int)(position.Y + (float)(height / 2)) / 16;
17731 if (Main.tile[num267, num268 - 1] == null)
17732 {
17733 Main.tile[num267, num268 - 1] = new Tile();
17734 }
17735 if (Main.tile[num267, num268 + 1] == null)
17736 {
17737 Main.tile[num267, num268 + 1] = new Tile();
17738 }
17739 if (Main.tile[num267, num268 + 2] == null)
17740 {
17741 Main.tile[num267, num268 + 2] = new Tile();
17742 }
17743 if (Main.tile[num267, num268 - 1].liquid > 128)
17744 {
17745 if (Main.tile[num267, num268 + 1].active())
17746 {
17747 this.ai[0] = -1f;
17748 }
17749 else if (Main.tile[num267, num268 + 2].active())
17750 {
17751 this.ai[0] = -1f;
17752 }
17753 }
17754 if (type != 157 && ((double)velocity.Y > 0.4 || (double)velocity.Y < -0.4))
17755 {
17756 velocity.Y *= 0.95f;
17757 }
17758 }
17759 }
17760 else
17761 {
17762 if (velocity.Y == 0f)
17763 {
17764 if (type == 65)
17765 {
17766 velocity.X *= 0.94f;
17767 if ((double)velocity.X > -0.2 && (double)velocity.X < 0.2)
17768 {
17769 velocity.X = 0f;
17770 }
17771 }
17772 else if (Main.netMode != 1)
17773 {
17774 velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
17775 velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
17776 netUpdate = true;
17777 }
17778 }
17779 velocity.Y += 0.3f;
17780 if (velocity.Y > 10f)
17781 {
17782 velocity.Y = 10f;
17783 }
17784 this.ai[0] = 1f;
17785 }
17786 rotation = velocity.Y * (float)direction * 0.1f;
17787 if ((double)rotation < -0.2)
17788 {
17789 rotation = -0.2f;
17790 }
17791 if ((double)rotation > 0.2)
17792 {
17793 rotation = 0.2f;
17794 }
17795 return;
17796 }
17797 if (aiStyle == 17)
17798 {
17799 noGravity = true;
17800 if (this.ai[0] == 0f)
17801 {
17802 noGravity = false;
17803 TargetClosest();
17804 if (Main.netMode != 1)
17805 {
17806 if (velocity.X != 0f || velocity.Y < 0f || (double)velocity.Y > 0.3)
17807 {
17808 this.ai[0] = 1f;
17809 netUpdate = true;
17810 }
17811 else
17812 {
17813 Rectangle rectangle = new Rectangle((int)Main.player[target].position.X, (int)Main.player[target].position.Y, Main.player[target].width, Main.player[target].height);
17814 if (new Rectangle((int)position.X - 100, (int)position.Y - 100, width + 200, height + 200).Intersects(rectangle) || life < lifeMax)
17815 {
17816 this.ai[0] = 1f;
17817 velocity.Y -= 6f;
17818 netUpdate = true;
17819 }
17820 }
17821 }
17822 }
17823 else if (!Main.player[target].dead)
17824 {
17825 if (collideX)
17826 {
17827 velocity.X = oldVelocity.X * -0.5f;
17828 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
17829 {
17830 velocity.X = 2f;
17831 }
17832 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
17833 {
17834 velocity.X = -2f;
17835 }
17836 }
17837 if (collideY)
17838 {
17839 velocity.Y = oldVelocity.Y * -0.5f;
17840 if (velocity.Y > 0f && velocity.Y < 1f)
17841 {
17842 velocity.Y = 1f;
17843 }
17844 if (velocity.Y < 0f && velocity.Y > -1f)
17845 {
17846 velocity.Y = -1f;
17847 }
17848 }
17849 TargetClosest();
17850 if (direction == -1 && velocity.X > -3f)
17851 {
17852 velocity.X -= 0.1f;
17853 if (velocity.X > 3f)
17854 {
17855 velocity.X -= 0.1f;
17856 }
17857 else if (velocity.X > 0f)
17858 {
17859 velocity.X -= 0.05f;
17860 }
17861 if (velocity.X < -3f)
17862 {
17863 velocity.X = -3f;
17864 }
17865 }
17866 else if (direction == 1 && velocity.X < 3f)
17867 {
17868 velocity.X += 0.1f;
17869 if (velocity.X < -3f)
17870 {
17871 velocity.X += 0.1f;
17872 }
17873 else if (velocity.X < 0f)
17874 {
17875 velocity.X += 0.05f;
17876 }
17877 if (velocity.X > 3f)
17878 {
17879 velocity.X = 3f;
17880 }
17881 }
17882 float num269 = Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2)));
17883 float num270 = Main.player[target].position.Y - (float)(height / 2);
17884 if (num269 > 50f)
17885 {
17886 num270 -= 100f;
17887 }
17888 if (position.Y < num270)
17889 {
17890 velocity.Y += 0.05f;
17891 if (velocity.Y < 0f)
17892 {
17893 velocity.Y += 0.01f;
17894 }
17895 }
17896 else
17897 {
17898 velocity.Y -= 0.05f;
17899 if (velocity.Y > 0f)
17900 {
17901 velocity.Y -= 0.01f;
17902 }
17903 }
17904 if (velocity.Y < -3f)
17905 {
17906 velocity.Y = -3f;
17907 }
17908 if (velocity.Y > 3f)
17909 {
17910 velocity.Y = 3f;
17911 }
17912 }
17913 if (wet)
17914 {
17915 if (velocity.Y > 0f)
17916 {
17917 velocity.Y *= 0.95f;
17918 }
17919 velocity.Y -= 0.5f;
17920 if (velocity.Y < -4f)
17921 {
17922 velocity.Y = -4f;
17923 }
17924 TargetClosest();
17925 }
17926 return;
17927 }
17928 if (aiStyle == 18)
17929 {
17930 bool flag12 = false;
17931 if (wet && this.ai[1] == 1f)
17932 {
17933 flag12 = true;
17934 }
17935 else
17936 {
17937 dontTakeDamage = false;
17938 }
17939 if (Main.expertMode && (type == 63 || type == 64 || type == 103 || type == 242))
17940 {
17941 if (wet)
17942 {
17943 if (target >= 0 && Main.player[target].wet && !Main.player[target].dead && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && (Main.player[target].Center - base.Center).Length() < 150f)
17944 {
17945 if (this.ai[1] == 0f)
17946 {
17947 this.ai[2] += 2f;
17948 }
17949 else
17950 {
17951 this.ai[2] -= 0.25f;
17952 }
17953 }
17954 if (flag12)
17955 {
17956 dontTakeDamage = true;
17957 this.ai[2] += 1f;
17958 if (this.ai[2] >= 120f)
17959 {
17960 this.ai[1] = 0f;
17961 }
17962 }
17963 else
17964 {
17965 this.ai[2] += 1f;
17966 if (this.ai[2] >= 420f)
17967 {
17968 this.ai[1] = 1f;
17969 this.ai[2] = 0f;
17970 }
17971 }
17972 }
17973 else
17974 {
17975 this.ai[1] = 0f;
17976 this.ai[2] = 0f;
17977 }
17978 }
17979 float num271 = 1f;
17980 if (flag12)
17981 {
17982 num271 += 0.5f;
17983 }
17984 if (type == 63)
17985 {
17986 Lighting.AddLight((int)(position.X + (float)(height / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.05f * num271, 0.15f * num271, 0.4f * num271);
17987 }
17988 else if (type == 103)
17989 {
17990 Lighting.AddLight((int)(position.X + (float)(height / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.05f * num271, 0.45f * num271, 0.1f * num271);
17991 }
17992 else if (type != 221 && type != 242)
17993 {
17994 Lighting.AddLight((int)(position.X + (float)(height / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.35f * num271, 0.05f * num271, 0.2f * num271);
17995 }
17996 if (direction == 0)
17997 {
17998 TargetClosest();
17999 }
18000 if (flag12)
18001 {
18002 return;
18003 }
18004 if (wet)
18005 {
18006 int num272 = (int)base.Center.X / 16;
18007 int num273 = (int)(position.Y + (float)height) / 16;
18008 if (Main.tile[num272, num273].topSlope())
18009 {
18010 if (Main.tile[num272, num273].leftSlope())
18011 {
18012 direction = -1;
18013 velocity.X = Math.Abs(velocity.X) * -1f;
18014 }
18015 else
18016 {
18017 direction = 1;
18018 velocity.X = Math.Abs(velocity.X);
18019 }
18020 }
18021 else if (Main.tile[num272, num273 + 1].topSlope())
18022 {
18023 if (Main.tile[num272, num273 + 1].leftSlope())
18024 {
18025 direction = -1;
18026 velocity.X = Math.Abs(velocity.X) * -1f;
18027 }
18028 else
18029 {
18030 direction = 1;
18031 velocity.X = Math.Abs(velocity.X);
18032 }
18033 }
18034 if (collideX)
18035 {
18036 velocity.X *= -1f;
18037 direction *= -1;
18038 }
18039 if (collideY)
18040 {
18041 if (velocity.Y > 0f)
18042 {
18043 velocity.Y = Math.Abs(velocity.Y) * -1f;
18044 directionY = -1;
18045 this.ai[0] = -1f;
18046 }
18047 else if (velocity.Y < 0f)
18048 {
18049 velocity.Y = Math.Abs(velocity.Y);
18050 directionY = 1;
18051 this.ai[0] = 1f;
18052 }
18053 }
18054 bool flag13 = false;
18055 if (!friendly)
18056 {
18057 TargetClosest(faceTarget: false);
18058 if (Main.player[target].wet && !Main.player[target].dead && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
18059 {
18060 flag13 = true;
18061 }
18062 }
18063 if (flag13)
18064 {
18065 localAI[2] = 1f;
18066 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
18067 velocity *= 0.98f;
18068 float num274 = 0.2f;
18069 if (type == 103)
18070 {
18071 velocity *= 0.98f;
18072 num274 = 0.6f;
18073 }
18074 if (type == 221)
18075 {
18076 velocity *= 0.99f;
18077 num274 = 1f;
18078 }
18079 if (type == 242)
18080 {
18081 velocity *= 0.995f;
18082 num274 = 3f;
18083 }
18084 if (velocity.X > 0f - num274 && velocity.X < num274 && velocity.Y > 0f - num274 && velocity.Y < num274)
18085 {
18086 if (type == 221)
18087 {
18088 localAI[0] = 1f;
18089 }
18090 TargetClosest();
18091 float num275 = 7f;
18092 if (type == 103)
18093 {
18094 num275 = 9f;
18095 }
18096 Vector2 vector31 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
18097 float num276 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector31.X;
18098 float num277 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector31.Y;
18099 float num278 = (float)Math.Sqrt(num276 * num276 + num277 * num277);
18100 num278 = num275 / num278;
18101 num276 *= num278;
18102 num277 *= num278;
18103 velocity.X = num276;
18104 velocity.Y = num277;
18105 }
18106 return;
18107 }
18108 localAI[2] = 0f;
18109 velocity.X += (float)direction * 0.02f;
18110 rotation = velocity.X * 0.4f;
18111 if (velocity.X < -1f || velocity.X > 1f)
18112 {
18113 velocity.X *= 0.95f;
18114 }
18115 if (this.ai[0] == -1f)
18116 {
18117 velocity.Y -= 0.01f;
18118 if (velocity.Y < -1f)
18119 {
18120 this.ai[0] = 1f;
18121 }
18122 }
18123 else
18124 {
18125 velocity.Y += 0.01f;
18126 if (velocity.Y > 1f)
18127 {
18128 this.ai[0] = -1f;
18129 }
18130 }
18131 int num279 = (int)(position.X + (float)(width / 2)) / 16;
18132 int num280 = (int)(position.Y + (float)(height / 2)) / 16;
18133 if (Main.tile[num279, num280 - 1] == null)
18134 {
18135 Main.tile[num279, num280 - 1] = new Tile();
18136 }
18137 if (Main.tile[num279, num280 + 1] == null)
18138 {
18139 Main.tile[num279, num280 + 1] = new Tile();
18140 }
18141 if (Main.tile[num279, num280 + 2] == null)
18142 {
18143 Main.tile[num279, num280 + 2] = new Tile();
18144 }
18145 if (Main.tile[num279, num280 - 1].liquid > 128)
18146 {
18147 if (Main.tile[num279, num280 + 1].active())
18148 {
18149 this.ai[0] = -1f;
18150 }
18151 else if (Main.tile[num279, num280 + 2].active())
18152 {
18153 this.ai[0] = -1f;
18154 }
18155 }
18156 else
18157 {
18158 this.ai[0] = 1f;
18159 }
18160 if ((double)velocity.Y > 1.2 || (double)velocity.Y < -1.2)
18161 {
18162 velocity.Y *= 0.99f;
18163 }
18164 return;
18165 }
18166 rotation += velocity.X * 0.1f;
18167 if (velocity.Y == 0f)
18168 {
18169 velocity.X *= 0.98f;
18170 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
18171 {
18172 velocity.X = 0f;
18173 }
18174 }
18175 velocity.Y += 0.2f;
18176 if (velocity.Y > 10f)
18177 {
18178 velocity.Y = 10f;
18179 }
18180 this.ai[0] = 1f;
18181 return;
18182 }
18183 if (aiStyle == 19)
18184 {
18185 TargetClosest();
18186 float num281 = 12f;
18187 Vector2 vector32 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
18188 float num282 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector32.X;
18189 float num283 = Main.player[target].position.Y - vector32.Y;
18190 float num284 = (float)Math.Sqrt(num282 * num282 + num283 * num283);
18191 num284 = num281 / num284;
18192 num282 *= num284;
18193 num283 *= num284;
18194 bool flag14 = false;
18195 if (directionY < 0)
18196 {
18197 rotation = (float)(Math.Atan2(num283, num282) + 1.57);
18198 flag14 = ((!((double)rotation < -1.2) && !((double)rotation > 1.2)) ? true : false);
18199 if ((double)rotation < -0.8)
18200 {
18201 rotation = -0.8f;
18202 }
18203 else if ((double)rotation > 0.8)
18204 {
18205 rotation = 0.8f;
18206 }
18207 if (velocity.X != 0f)
18208 {
18209 velocity.X *= 0.9f;
18210 if ((double)velocity.X > -0.1 || (double)velocity.X < 0.1)
18211 {
18212 netUpdate = true;
18213 velocity.X = 0f;
18214 }
18215 }
18216 }
18217 if (this.ai[0] > 0f)
18218 {
18219 if (this.ai[0] == 200f)
18220 {
18222 }
18223 this.ai[0] -= 1f;
18224 }
18225 if (Main.netMode != 1 && flag14 && this.ai[0] == 0f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
18226 {
18227 this.ai[0] = 200f;
18228 int num285 = 10;
18229 int num286 = 31;
18231 Main.projectile[num287].ai[0] = 2f;
18232 Main.projectile[num287].timeLeft = 300;
18233 Main.projectile[num287].friendly = false;
18234 NetMessage.SendData(27, -1, -1, null, num287);
18235 netUpdate = true;
18236 }
18237 try
18238 {
18239 int num288 = (int)position.X / 16;
18240 int num289 = (int)(position.X + (float)(width / 2)) / 16;
18241 int num290 = (int)(position.X + (float)width) / 16;
18242 int num291 = (int)(position.Y + (float)height) / 16;
18243 bool flag15 = false;
18244 if (Main.tile[num288, num291] == null)
18245 {
18246 Main.tile[num288, num291] = new Tile();
18247 }
18248 if (Main.tile[num289, num291] == null)
18249 {
18250 Main.tile[num288, num291] = new Tile();
18251 }
18252 if (Main.tile[num290, num291] == null)
18253 {
18254 Main.tile[num288, num291] = new Tile();
18255 }
18256 if ((Main.tile[num288, num291].nactive() && Main.tileSolid[Main.tile[num288, num291].type]) || (Main.tile[num289, num291].nactive() && Main.tileSolid[Main.tile[num289, num291].type]) || (Main.tile[num290, num291].nactive() && Main.tileSolid[Main.tile[num290, num291].type]))
18257 {
18258 flag15 = true;
18259 }
18260 if (flag15)
18261 {
18262 noGravity = true;
18263 noTileCollide = true;
18264 velocity.Y = -0.2f;
18265 return;
18266 }
18267 noGravity = false;
18268 noTileCollide = false;
18269 if (Main.rand.Next(2) == 0)
18270 {
18272 int num292 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height - 8f), width + 8, 24, 32, 0f, velocity.Y / 2f);
18273 Main.dust[num292].velocity.X *= 0.4f;
18274 Main.dust[num292].velocity.Y *= -1f;
18275 if (Main.rand.Next(2) == 0)
18276 {
18277 Main.dust[num292].noGravity = true;
18278 Dust dust = Main.dust[num292];
18279 dust.scale += 0.2f;
18280 }
18282 }
18283 return;
18284 }
18285 catch
18286 {
18287 return;
18288 }
18289 }
18290 if (aiStyle == 20)
18291 {
18292 if (this.ai[0] == 0f)
18293 {
18294 if (Main.netMode != 1)
18295 {
18296 TargetClosest();
18297 direction *= -1;
18298 directionY *= -1;
18299 position.Y += height / 2 + 8;
18300 this.ai[1] = position.X + (float)(width / 2);
18301 this.ai[2] = position.Y + (float)(height / 2);
18302 if (direction == 0)
18303 {
18304 direction = 1;
18305 }
18306 if (directionY == 0)
18307 {
18308 directionY = 1;
18309 }
18310 this.ai[3] = 1f + (float)Main.rand.Next(15) * 0.1f;
18311 velocity.Y = (float)(directionY * 6) * this.ai[3];
18312 this.ai[0] += 1f;
18313 netUpdate = true;
18314 }
18315 else
18316 {
18317 this.ai[1] = position.X + (float)(width / 2);
18318 this.ai[2] = position.Y + (float)(height / 2);
18319 }
18320 return;
18321 }
18322 float num293 = 6f * this.ai[3];
18323 float num294 = 0.2f * this.ai[3];
18324 float num295 = num293 / num294 / 2f;
18325 if (this.ai[0] >= 1f && this.ai[0] < (float)(int)num295)
18326 {
18327 velocity.Y = (float)directionY * num293;
18328 this.ai[0] += 1f;
18329 return;
18330 }
18331 if (this.ai[0] >= (float)(int)num295)
18332 {
18333 velocity.Y = 0f;
18334 directionY *= -1;
18335 velocity.X = num293 * (float)direction;
18336 this.ai[0] = -1f;
18337 return;
18338 }
18339 if (directionY > 0)
18340 {
18341 if (velocity.Y >= num293)
18342 {
18343 directionY *= -1;
18344 velocity.Y = num293;
18345 }
18346 }
18347 else if (directionY < 0 && velocity.Y <= 0f - num293)
18348 {
18349 directionY *= -1;
18350 velocity.Y = 0f - num293;
18351 }
18352 if (direction > 0)
18353 {
18354 if (velocity.X >= num293)
18355 {
18356 direction *= -1;
18357 velocity.X = num293;
18358 }
18359 }
18360 else if (direction < 0 && velocity.X <= 0f - num293)
18361 {
18362 direction *= -1;
18363 velocity.X = 0f - num293;
18364 }
18365 velocity.X += num294 * (float)direction;
18366 velocity.Y += num294 * (float)directionY;
18367 }
18368 else if (aiStyle == 21)
18369 {
18370 if (this.ai[0] == 0f)
18371 {
18372 TargetClosest();
18373 directionY = 1;
18374 this.ai[0] = 1f;
18375 }
18376 int num296 = 6;
18377 if (this.ai[1] == 0f)
18378 {
18379 rotation += (float)(direction * directionY) * 0.13f;
18380 if (collideY)
18381 {
18382 this.ai[0] = 2f;
18383 }
18384 if (!collideY && this.ai[0] == 2f)
18385 {
18387 this.ai[1] = 1f;
18388 this.ai[0] = 1f;
18389 }
18390 if (collideX)
18391 {
18393 this.ai[1] = 1f;
18394 }
18395 }
18396 else
18397 {
18398 rotation -= (float)(direction * directionY) * 0.13f;
18399 if (collideX)
18400 {
18401 this.ai[0] = 2f;
18402 }
18403 if (!collideX && this.ai[0] == 2f)
18404 {
18406 this.ai[1] = 0f;
18407 this.ai[0] = 1f;
18408 }
18409 if (collideY)
18410 {
18412 this.ai[1] = 0f;
18413 }
18414 }
18415 velocity.X = num296 * direction;
18416 velocity.Y = num296 * directionY;
18417 float num297 = (float)(270 - Main.mouseTextColor) / 400f;
18418 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.9f, 0.3f + num297, 0.2f);
18419 }
18420 else if (aiStyle == 22)
18421 {
18422 bool flag16 = false;
18423 bool flag17 = type == 330 && !Main.pumpkinMoon;
18424 if (type == 253 && !Main.eclipse)
18425 {
18426 flag17 = true;
18427 }
18428 if (type == 490 && Main.dayTime)
18429 {
18430 flag17 = true;
18431 }
18432 if (justHit)
18433 {
18434 this.ai[2] = 0f;
18435 }
18436 if (type == 316 && (Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > 3000f))
18437 {
18438 TargetClosest();
18439 if (Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > 3000f)
18440 {
18441 EncourageDespawn(10);
18442 flag16 = true;
18443 flag17 = true;
18444 }
18445 }
18446 if (flag17)
18447 {
18448 if (velocity.X == 0f)
18449 {
18450 velocity.X = (float)Main.rand.Next(-1, 2) * 1.5f;
18451 netUpdate = true;
18452 }
18453 }
18454 else if (this.ai[2] >= 0f)
18455 {
18456 int num298 = 16;
18457 bool flag18 = false;
18458 bool flag19 = false;
18459 if (position.X > this.ai[0] - (float)num298 && position.X < this.ai[0] + (float)num298)
18460 {
18461 flag18 = true;
18462 }
18463 else if ((velocity.X < 0f && direction > 0) || (velocity.X > 0f && direction < 0))
18464 {
18465 flag18 = true;
18466 }
18467 num298 += 24;
18468 if (position.Y > this.ai[1] - (float)num298 && position.Y < this.ai[1] + (float)num298)
18469 {
18470 flag19 = true;
18471 }
18472 if (flag18 && flag19)
18473 {
18474 this.ai[2] += 1f;
18475 if (this.ai[2] >= 30f && num298 == 16)
18476 {
18477 flag16 = true;
18478 }
18479 if (this.ai[2] >= 60f)
18480 {
18481 this.ai[2] = -200f;
18482 direction *= -1;
18483 velocity.X *= -1f;
18484 collideX = false;
18485 }
18486 }
18487 else
18488 {
18489 this.ai[0] = position.X;
18490 this.ai[1] = position.Y;
18491 this.ai[2] = 0f;
18492 }
18493 TargetClosest();
18494 }
18495 else if (type == 253)
18496 {
18497 TargetClosest();
18498 this.ai[2] += 2f;
18499 }
18500 else
18501 {
18502 if (type == 330)
18503 {
18504 this.ai[2] += 0.1f;
18505 }
18506 else
18507 {
18508 this.ai[2] += 1f;
18509 }
18510 if (Main.player[target].position.X + (float)(Main.player[target].width / 2) > position.X + (float)(width / 2))
18511 {
18512 direction = -1;
18513 }
18514 else
18515 {
18516 direction = 1;
18517 }
18518 }
18519 int num299 = (int)((position.X + (float)(width / 2)) / 16f) + direction * 2;
18520 int num300 = (int)((position.Y + (float)height) / 16f);
18521 bool flag20 = true;
18522 bool flag21 = false;
18523 int num301 = 3;
18524 if (type == 122)
18525 {
18526 if (justHit)
18527 {
18528 this.ai[3] = 0f;
18529 localAI[1] = 0f;
18530 }
18531 if (Main.netMode != 1 && this.ai[3] == 32f && !Main.player[target].npcTypeNoAggro[type])
18532 {
18533 float num302 = 7f;
18534 Vector2 vector33 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
18535 float num303 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector33.X;
18536 float num304 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector33.Y;
18537 float num305 = (float)Math.Sqrt(num303 * num303 + num304 * num304);
18538 float num306 = num305;
18539 num305 = num302 / num305;
18540 num303 *= num305;
18541 num304 *= num305;
18542 float num307 = 0.0125f;
18543 Vector2 vector34 = new Vector2(num303, num304).RotatedByRandom(num307 * ((float)Math.PI * 2f));
18544 num303 = vector34.X;
18545 num304 = vector34.Y;
18546 int num308 = 25;
18547 int num309 = 84;
18549 }
18550 num301 = 8;
18551 if (this.ai[3] > 0f)
18552 {
18553 this.ai[3] += 1f;
18554 if (this.ai[3] >= 64f)
18555 {
18556 this.ai[3] = 0f;
18557 }
18558 }
18559 if (Main.netMode != 1 && this.ai[3] == 0f)
18560 {
18561 localAI[1] += 1f;
18562 if (localAI[1] > 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && !Main.player[target].npcTypeNoAggro[type])
18563 {
18564 localAI[1] = 0f;
18565 this.ai[3] = 1f;
18566 netUpdate = true;
18567 }
18568 }
18569 }
18570 else if (type == 75)
18571 {
18572 num301 = 4;
18574 if (Main.rand.Next(6) == 0)
18575 {
18576 int num311 = Dust.NewDust(position, width, height, 55, 0f, 0f, 200, this.color);
18577 Dust dust = Main.dust[num311];
18578 dust.velocity *= 0.3f;
18579 }
18580 if (Main.rand.Next(40) == 0)
18581 {
18582 SoundEngine.PlaySound(27, (int)position.X, (int)position.Y);
18583 }
18585 }
18586 else if (type == 169)
18587 {
18589 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0.6f, 0.75f);
18590 alpha = 30;
18591 if (Main.rand.Next(3) == 0)
18592 {
18593 int num312 = Dust.NewDust(position, width, height, 92, 0f, 0f, 200);
18594 Dust dust = Main.dust[num312];
18595 dust.velocity *= 0.3f;
18596 Main.dust[num312].noGravity = true;
18597 }
18599 if (justHit)
18600 {
18601 this.ai[3] = 0f;
18602 localAI[1] = 0f;
18603 }
18604 float num313 = 5f;
18605 Vector2 vector35 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
18606 float num314 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector35.X;
18607 float num315 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector35.Y;
18608 float num316 = (float)Math.Sqrt(num314 * num314 + num315 * num315);
18609 float num317 = num316;
18610 num316 = num313 / num316;
18611 num314 *= num316;
18612 num315 *= num316;
18613 if (num314 > 0f)
18614 {
18615 direction = 1;
18616 }
18617 else
18618 {
18619 direction = -1;
18620 }
18622 if (direction < 0)
18623 {
18624 rotation = (float)Math.Atan2(0f - num315, 0f - num314);
18625 }
18626 else
18627 {
18628 rotation = (float)Math.Atan2(num315, num314);
18629 }
18630 if (Main.netMode != 1 && this.ai[3] == 16f)
18631 {
18632 int num318 = 45;
18633 int num319 = 128;
18635 }
18636 num301 = 10;
18637 if (this.ai[3] > 0f)
18638 {
18639 this.ai[3] += 1f;
18640 if (this.ai[3] >= 64f)
18641 {
18642 this.ai[3] = 0f;
18643 }
18644 }
18645 if (Main.netMode != 1 && this.ai[3] == 0f)
18646 {
18647 localAI[1] += 1f;
18648 if (localAI[1] > 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
18649 {
18650 localAI[1] = 0f;
18651 this.ai[3] = 1f;
18652 netUpdate = true;
18653 }
18654 }
18655 }
18656 else if (type == 268)
18657 {
18658 rotation = velocity.X * 0.1f;
18659 num301 = ((!(Main.player[target].Center.Y < base.Center.Y)) ? 6 : 12);
18660 if (Main.netMode != 1 && !confused)
18661 {
18662 this.ai[3] += 1f;
18663 if (justHit)
18664 {
18665 this.ai[3] = -45f;
18666 localAI[1] = 0f;
18667 }
18668 if (Main.netMode != 1 && this.ai[3] >= (float)(60 + Main.rand.Next(60)))
18669 {
18670 this.ai[3] = 0f;
18671 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
18672 {
18673 float num321 = 10f;
18674 Vector2 vector36 = new Vector2(position.X + (float)width * 0.5f - 4f, position.Y + (float)height * 0.7f);
18675 float num322 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector36.X;
18676 float num323 = Math.Abs(num322) * 0.1f;
18677 float num324 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector36.Y - num323;
18678 num322 += (float)Main.rand.Next(-10, 11);
18679 num324 += (float)Main.rand.Next(-30, 21);
18680 float num325 = (float)Math.Sqrt(num322 * num322 + num324 * num324);
18681 float num326 = num325;
18682 num325 = num321 / num325;
18683 num322 *= num325;
18684 num324 *= num325;
18685 int num327 = 40;
18686 int num328 = 288;
18688 }
18689 }
18690 }
18691 }
18692 if (type == 490)
18693 {
18694 num301 = 4;
18695 if (target >= 0)
18696 {
18697 float num330 = (Main.player[target].Center - base.Center).Length();
18698 num330 /= 70f;
18699 if (num330 > 8f)
18700 {
18701 num330 = 8f;
18702 }
18703 num301 += (int)num330;
18704 }
18705 }
18706 if (position.Y + (float)height > Main.player[target].position.Y)
18707 {
18708 if (type == 330)
18709 {
18710 flag20 = false;
18711 }
18712 else
18713 {
18714 for (int num331 = num300; num331 < num300 + num301; num331++)
18715 {
18716 if (Main.tile[num299, num331] == null)
18717 {
18718 Main.tile[num299, num331] = new Tile();
18719 }
18720 if ((Main.tile[num299, num331].nactive() && Main.tileSolid[Main.tile[num299, num331].type]) || Main.tile[num299, num331].liquid > 0)
18721 {
18722 if (num331 <= num300 + 1)
18723 {
18724 flag21 = true;
18725 }
18726 flag20 = false;
18727 break;
18728 }
18729 }
18730 }
18731 }
18732 if (Main.player[target].npcTypeNoAggro[type])
18733 {
18734 bool flag22 = false;
18735 for (int num332 = num300; num332 < num300 + num301 - 2; num332++)
18736 {
18737 if (Main.tile[num299, num332] == null)
18738 {
18739 Main.tile[num299, num332] = new Tile();
18740 }
18741 if ((Main.tile[num299, num332].nactive() && Main.tileSolid[Main.tile[num299, num332].type]) || Main.tile[num299, num332].liquid > 0)
18742 {
18743 flag22 = true;
18744 break;
18745 }
18746 }
18747 directionY = (!flag22).ToDirectionInt();
18748 }
18749 if (type == 169 || type == 268)
18750 {
18751 for (int num333 = num300 - 3; num333 < num300; num333++)
18752 {
18753 if (Main.tile[num299, num333] == null)
18754 {
18755 Main.tile[num299, num333] = new Tile();
18756 }
18757 if ((Main.tile[num299, num333].nactive() && Main.tileSolid[Main.tile[num299, num333].type] && !TileID.Sets.Platforms[Main.tile[num299, num333].type]) || Main.tile[num299, num333].liquid > 0)
18758 {
18759 flag21 = false;
18760 flag16 = true;
18761 break;
18762 }
18763 }
18764 }
18765 if (flag16)
18766 {
18767 flag21 = false;
18768 flag20 = true;
18769 if (type == 268)
18770 {
18771 velocity.Y += 2f;
18772 }
18773 }
18774 if (flag20)
18775 {
18776 if (type == 75 || type == 169)
18777 {
18778 velocity.Y += 0.2f;
18779 if (velocity.Y > 2f)
18780 {
18781 velocity.Y = 2f;
18782 }
18783 }
18784 else if (type == 490)
18785 {
18786 velocity.Y += 0.03f;
18787 if ((double)velocity.Y > 0.75)
18788 {
18789 velocity.Y = 0.75f;
18790 }
18791 }
18792 else
18793 {
18794 velocity.Y += 0.1f;
18795 if (type == 316 && flag17)
18796 {
18797 velocity.Y -= 0.05f;
18798 if (velocity.Y > 6f)
18799 {
18800 velocity.Y = 6f;
18801 }
18802 }
18803 else if (velocity.Y > 3f)
18804 {
18805 velocity.Y = 3f;
18806 }
18807 }
18808 }
18809 else
18810 {
18811 if (type == 75 || type == 169)
18812 {
18814 {
18815 velocity.Y -= 0.2f;
18816 }
18817 }
18818 else if (type == 490)
18819 {
18821 {
18822 velocity.Y -= 0.075f;
18823 }
18824 if (velocity.Y < -0.75f)
18825 {
18826 velocity.Y = -0.75f;
18827 }
18828 }
18830 {
18831 velocity.Y -= 0.1f;
18832 }
18833 if (velocity.Y < -4f)
18834 {
18835 velocity.Y = -4f;
18836 }
18837 }
18838 if (type == 75 && wet)
18839 {
18840 velocity.Y -= 0.2f;
18841 if (velocity.Y < -2f)
18842 {
18843 velocity.Y = -2f;
18844 }
18845 }
18846 if (collideX)
18847 {
18848 velocity.X = oldVelocity.X * -0.4f;
18849 if (direction == -1 && velocity.X > 0f && velocity.X < 1f)
18850 {
18851 velocity.X = 1f;
18852 }
18853 if (direction == 1 && velocity.X < 0f && velocity.X > -1f)
18854 {
18855 velocity.X = -1f;
18856 }
18857 }
18858 if (collideY)
18859 {
18860 velocity.Y = oldVelocity.Y * -0.25f;
18861 if (velocity.Y > 0f && velocity.Y < 1f)
18862 {
18863 velocity.Y = 1f;
18864 }
18865 if (velocity.Y < 0f && velocity.Y > -1f)
18866 {
18867 velocity.Y = -1f;
18868 }
18869 }
18870 float num334 = 2f;
18871 if (type == 75)
18872 {
18873 num334 = 3f;
18874 }
18875 if (type == 253)
18876 {
18877 num334 = 4f;
18878 }
18879 if (type == 490)
18880 {
18881 num334 = 1.5f;
18882 }
18883 if (type == 330)
18884 {
18885 alpha = 0;
18886 num334 = 4f;
18887 if (!flag17)
18888 {
18889 TargetClosest();
18890 }
18891 else
18892 {
18893 EncourageDespawn(10);
18894 }
18896 {
18897 velocity.X *= 0.9f;
18898 }
18899 if (direction > 0 && velocity.X < 0f)
18900 {
18901 velocity.X *= 0.9f;
18902 }
18903 }
18904 if (direction == -1 && velocity.X > 0f - num334)
18905 {
18906 velocity.X -= 0.1f;
18907 if (velocity.X > num334)
18908 {
18909 velocity.X -= 0.1f;
18910 }
18911 else if (velocity.X > 0f)
18912 {
18913 velocity.X += 0.05f;
18914 }
18915 if (velocity.X < 0f - num334)
18916 {
18917 velocity.X = 0f - num334;
18918 }
18919 }
18920 else if (direction == 1 && velocity.X < num334)
18921 {
18922 velocity.X += 0.1f;
18923 if (velocity.X < 0f - num334)
18924 {
18925 velocity.X += 0.1f;
18926 }
18927 else if (velocity.X < 0f)
18928 {
18929 velocity.X -= 0.05f;
18930 }
18931 if (velocity.X > num334)
18932 {
18933 velocity.X = num334;
18934 }
18935 }
18936 num334 = ((type != 490) ? 1.5f : 1f);
18937 if (directionY == -1 && velocity.Y > 0f - num334)
18938 {
18939 velocity.Y -= 0.04f;
18940 if (velocity.Y > num334)
18941 {
18942 velocity.Y -= 0.05f;
18943 }
18944 else if (velocity.Y > 0f)
18945 {
18946 velocity.Y += 0.03f;
18947 }
18948 if (velocity.Y < 0f - num334)
18949 {
18950 velocity.Y = 0f - num334;
18951 }
18952 }
18953 else if (directionY == 1 && velocity.Y < num334)
18954 {
18955 velocity.Y += 0.04f;
18956 if (velocity.Y < 0f - num334)
18957 {
18958 velocity.Y += 0.05f;
18959 }
18960 else if (velocity.Y < 0f)
18961 {
18962 velocity.Y -= 0.03f;
18963 }
18964 if (velocity.Y > num334)
18965 {
18966 velocity.Y = num334;
18967 }
18968 }
18969 if (type == 122)
18970 {
18971 Lighting.AddLight((int)position.X / 16, (int)position.Y / 16, 0.4f, 0f, 0.25f);
18972 }
18973 }
18974 else if (aiStyle == 23)
18975 {
18976 noGravity = true;
18977 noTileCollide = true;
18978 if (type == 83)
18979 {
18980 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.2f, 0.05f, 0.3f);
18981 }
18982 else if (type == 179)
18983 {
18984 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.3f, 0.15f, 0.05f);
18985 }
18986 else
18987 {
18988 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.05f, 0.2f, 0.3f);
18989 }
18990 if (target < 0 || target == 255 || Main.player[target].dead)
18991 {
18992 TargetClosest();
18993 }
18994 if (this.ai[0] == 0f)
18995 {
18996 float num335 = 9f;
18997 Vector2 vector37 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
18998 float num336 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector37.X;
18999 float num337 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector37.Y;
19000 float num338 = (float)Math.Sqrt(num336 * num336 + num337 * num337);
19001 float num339 = num338;
19002 num338 = num335 / num338;
19003 num336 *= num338;
19004 num337 *= num338;
19005 velocity.X = num336;
19006 velocity.Y = num337;
19007 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
19008 this.ai[0] = 1f;
19009 this.ai[1] = 0f;
19010 netUpdate = true;
19011 }
19012 else if (this.ai[0] == 1f)
19013 {
19014 if (justHit)
19015 {
19016 this.ai[0] = 2f;
19017 this.ai[1] = 0f;
19018 }
19019 velocity *= 0.99f;
19020 this.ai[1] += 1f;
19021 if (this.ai[1] >= 100f)
19022 {
19023 netUpdate = true;
19024 this.ai[0] = 2f;
19025 this.ai[1] = 0f;
19026 velocity.X = 0f;
19027 velocity.Y = 0f;
19028 }
19029 else
19030 {
19031 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
19032 }
19033 }
19034 else
19035 {
19036 if (justHit)
19037 {
19038 this.ai[0] = 2f;
19039 this.ai[1] = 0f;
19040 }
19041 velocity *= 0.96f;
19042 this.ai[1] += 1f;
19043 float num340 = this.ai[1] / 120f;
19044 num340 = 0.1f + num340 * 0.4f;
19045 rotation += num340 * (float)direction;
19046 if (this.ai[1] >= 120f)
19047 {
19048 netUpdate = true;
19049 this.ai[0] = 0f;
19050 this.ai[1] = 0f;
19051 }
19052 }
19053 }
19054 else if (aiStyle == 24)
19055 {
19056 noGravity = true;
19057 if (type == 611)
19058 {
19059 if (localAI[0] == 0f)
19060 {
19061 TargetClosest();
19062 this.ai[0] = 1f;
19063 localAI[0] = 1f;
19064 netUpdate = true;
19065 }
19066 else if (this.ai[0] == 1f && Main.cloudAlpha == 0f && !Main.dayTime)
19067 {
19068 for (int num341 = 0; num341 < 200; num341++)
19069 {
19070 if (num341 == whoAmI || !Main.npc[num341].active)
19071 {
19072 continue;
19073 }
19074 if (Main.npc[num341].townNPC)
19075 {
19076 if (Math.Abs(base.Center.X - Main.npc[num341].Center.X) < 96f)
19077 {
19078 float num342 = Main.npc[num341].Center.Y - base.Center.Y;
19079 if (num342 > 32f && num342 < 320f && !Collision.CanHit(this, Main.npc[num341]))
19080 {
19081 this.ai[0] = 2f;
19082 }
19083 }
19084 }
19085 else if (Main.npc[num341].type == type && Main.npc[num341].ai[0] != 1f && Math.Abs(base.Center.X - Main.npc[num341].Center.X) < 320f)
19086 {
19087 this.ai[0] = 1f;
19088 break;
19089 }
19090 }
19091 }
19092 }
19093 if (this.ai[0] == 0f)
19094 {
19095 noGravity = false;
19096 if (type == 611 && (Main.cloudAlpha > 0f || Main.dayTime))
19097 {
19098 this.ai[0] = 1f;
19099 }
19100 TargetClosest();
19101 if (Main.netMode != 1)
19102 {
19103 if (releaseOwner != 255 || velocity.X != 0f || velocity.Y < 0f || (double)velocity.Y > 0.3)
19104 {
19105 this.ai[0] = 1f;
19106 netUpdate = true;
19108 }
19109 else if (type != 611)
19110 {
19111 Rectangle rectangle2 = new Rectangle((int)Main.player[target].position.X, (int)Main.player[target].position.Y, Main.player[target].width, Main.player[target].height);
19112 if (new Rectangle((int)position.X - 100, (int)position.Y - 100, width + 200, height + 200).Intersects(rectangle2) || life < lifeMax)
19113 {
19114 this.ai[0] = 1f;
19115 velocity.Y -= 6f;
19116 netUpdate = true;
19118 }
19119 }
19120 }
19121 }
19122 else if (this.ai[0] == 2f)
19123 {
19124 velocity.X *= 0.98f;
19125 if (velocity.Y == 0f)
19126 {
19127 this.ai[0] = 0f;
19128 velocity.X = 0f;
19129 }
19130 velocity.Y += 0.05f;
19131 if (velocity.Y > 2f)
19132 {
19133 velocity.Y = 2f;
19134 }
19135 }
19136 else if (!Main.player[target].dead)
19137 {
19138 float num343 = 3f;
19139 if (type == 671 || type == 672 || type == 673 || type == 674 || type == 675)
19140 {
19141 num343 = 4f;
19142 }
19143 if (collideX)
19144 {
19145 direction *= -1;
19146 velocity.X = oldVelocity.X * -0.5f;
19147 if (direction == -1 && velocity.X > 0f && velocity.X < num343 - 1f)
19148 {
19149 velocity.X = num343 - 1f;
19150 }
19151 if (direction == 1 && velocity.X < 0f && velocity.X > 0f - num343 + 1f)
19152 {
19153 velocity.X = 0f - num343 + 1f;
19154 }
19155 }
19156 if (collideY)
19157 {
19158 velocity.Y = oldVelocity.Y * -0.5f;
19159 if (velocity.Y > 0f && velocity.Y < 1f)
19160 {
19161 velocity.Y = 1f;
19162 }
19163 if (velocity.Y < 0f && velocity.Y > -1f)
19164 {
19165 velocity.Y = -1f;
19166 }
19167 }
19168 if (direction == -1 && velocity.X > 0f - num343)
19169 {
19170 velocity.X -= 0.1f;
19171 if (velocity.X > num343)
19172 {
19173 velocity.X -= 0.1f;
19174 }
19175 else if (velocity.X > 0f)
19176 {
19177 velocity.X -= 0.05f;
19178 }
19179 if (velocity.X < 0f - num343)
19180 {
19181 velocity.X = 0f - num343;
19182 }
19183 }
19184 else if (direction == 1 && velocity.X < num343)
19185 {
19186 velocity.X += 0.1f;
19187 if (velocity.X < 0f - num343)
19188 {
19189 velocity.X += 0.1f;
19190 }
19191 else if (velocity.X < 0f)
19192 {
19193 velocity.X += 0.05f;
19194 }
19195 if (velocity.X > num343)
19196 {
19197 velocity.X = num343;
19198 }
19199 }
19200 int num344 = (int)((position.X + (float)(width / 2)) / 16f) + direction;
19201 int num345 = (int)((position.Y + (float)height) / 16f);
19202 bool flag23 = true;
19203 int num346 = 15;
19204 bool flag24 = false;
19205 for (int num347 = num345; num347 < num345 + num346; num347++)
19206 {
19208 {
19209 continue;
19210 }
19211 if (Main.tile[num344, num347] == null)
19212 {
19213 Main.tile[num344, num347] = new Tile();
19214 }
19215 if ((Main.tile[num344, num347].nactive() && Main.tileSolid[Main.tile[num344, num347].type]) || Main.tile[num344, num347].liquid > 0)
19216 {
19217 if (num347 < num345 + 5)
19218 {
19219 flag24 = true;
19220 }
19221 flag23 = false;
19222 break;
19223 }
19224 }
19225 if (flag23)
19226 {
19227 velocity.Y += 0.05f;
19228 }
19229 else
19230 {
19231 velocity.Y -= 0.1f;
19232 }
19233 if (flag24)
19234 {
19235 velocity.Y -= 0.2f;
19236 }
19237 if (velocity.Y > 2f)
19238 {
19239 velocity.Y = 2f;
19240 }
19241 if (velocity.Y < -4f)
19242 {
19243 velocity.Y = -4f;
19244 }
19245 }
19246 if (wet)
19247 {
19248 this.ai[1] = 0f;
19249 if (velocity.Y > 0f)
19250 {
19251 velocity.Y *= 0.95f;
19252 }
19253 velocity.Y -= 0.5f;
19254 if (velocity.Y < -4f)
19255 {
19256 velocity.Y = -4f;
19257 }
19258 TargetClosest();
19259 }
19260 }
19261 else if (aiStyle == 25)
19262 {
19263 bool flag25 = type == 341 && !Main.snowMoon;
19264 if (this.ai[3] == 0f)
19265 {
19266 position.X += 8f;
19267 if (position.Y / 16f > (float)Main.UnderworldLayer)
19268 {
19269 this.ai[3] = 3f;
19270 }
19271 else if ((double)(position.Y / 16f) > Main.worldSurface)
19272 {
19273 TargetClosest();
19274 this.ai[3] = 2f;
19275 }
19276 else
19277 {
19278 this.ai[3] = 1f;
19279 }
19280 }
19281 if (type == 341 || type == 629)
19282 {
19283 this.ai[3] = 1f;
19284 }
19285 if (this.ai[0] == 0f)
19286 {
19287 if (!flag25)
19288 {
19289 TargetClosest();
19290 }
19291 if (Main.netMode == 1)
19292 {
19293 return;
19294 }
19295 if (velocity.X != 0f || velocity.Y < 0f || (double)velocity.Y > 0.3)
19296 {
19297 this.ai[0] = 1f;
19298 netUpdate = true;
19299 return;
19300 }
19301 Rectangle rectangle3 = new Rectangle((int)Main.player[target].position.X, (int)Main.player[target].position.Y, Main.player[target].width, Main.player[target].height);
19302 if (new Rectangle((int)position.X - 100, (int)position.Y - 100, width + 200, height + 200).Intersects(rectangle3) || life < lifeMax)
19303 {
19304 this.ai[0] = 1f;
19305 netUpdate = true;
19306 }
19307 }
19308 else if (velocity.Y == 0f)
19309 {
19310 this.ai[2] += 1f;
19311 int num348 = 20;
19312 if (this.ai[1] == 0f)
19313 {
19314 num348 = 12;
19315 }
19316 if (this.ai[2] < (float)num348)
19317 {
19318 velocity.X *= 0.9f;
19319 return;
19320 }
19321 this.ai[2] = 0f;
19322 if (!flag25)
19323 {
19324 TargetClosest();
19325 }
19326 if (direction == 0)
19327 {
19328 direction = -1;
19329 }
19331 this.ai[1] += 1f;
19332 if (this.ai[1] == 2f)
19333 {
19334 velocity.X = (float)direction * 2.5f;
19335 velocity.Y = -8f;
19336 this.ai[1] = 0f;
19337 }
19338 else
19339 {
19340 velocity.X = (float)direction * 3.5f;
19341 velocity.Y = -4f;
19342 }
19343 netUpdate = true;
19344 }
19345 else if (direction == 1 && velocity.X < 1f)
19346 {
19347 velocity.X += 0.1f;
19348 }
19349 else if (direction == -1 && velocity.X > -1f)
19350 {
19351 velocity.X -= 0.1f;
19352 }
19353 }
19354 else if (aiStyle == 26)
19355 {
19357 }
19358 else if (aiStyle == 27)
19359 {
19360 if (position.X < 160f || position.X > (float)((Main.maxTilesX - 10) * 16))
19361 {
19362 active = false;
19363 }
19364 if (localAI[0] == 0f)
19365 {
19366 localAI[0] = 1f;
19367 Main.wofDrawAreaBottom = -1;
19368 Main.wofDrawAreaTop = -1;
19369 }
19370 if (Main.getGoodWorld && Main.netMode != 1 && Main.rand.Next(180) == 0 && CountNPCS(24) < 4)
19371 {
19372 int num349 = 1;
19373 for (int num350 = 0; num350 < num349; num350++)
19374 {
19375 int num351 = 1000;
19376 for (int num352 = 0; num352 < num351; num352++)
19377 {
19378 int num353 = (int)(base.Center.X / 16f);
19379 int num354 = (int)(base.Center.Y / 16f);
19380 if (target >= 0)
19381 {
19382 num353 = (int)(Main.player[target].Center.X / 16f);
19383 num354 = (int)(Main.player[target].Center.Y / 16f);
19384 }
19385 num353 += Main.rand.Next(-50, 51);
19386 for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++)
19387 {
19388 }
19389 num354--;
19391 {
19392 int num355 = NewNPC(GetSpawnSourceForNaturalSpawn(), num353 * 16 + 8, num354 * 16, 24);
19393 if (Main.netMode == 2 && num355 < 200)
19394 {
19395 NetMessage.SendData(23, -1, -1, null, num355);
19396 }
19397 break;
19398 }
19399 }
19400 }
19401 }
19402 this.ai[1] += 1f;
19403 if (this.ai[2] == 0f)
19404 {
19405 if ((double)life < (double)lifeMax * 0.5)
19406 {
19407 this.ai[1] += 1f;
19408 }
19409 if ((double)life < (double)lifeMax * 0.2)
19410 {
19411 this.ai[1] += 1f;
19412 }
19413 if (this.ai[1] > 2700f)
19414 {
19415 this.ai[2] = 1f;
19416 }
19417 }
19418 int num356 = 60;
19419 if (this.ai[2] > 0f && this.ai[1] > (float)num356)
19420 {
19421 int num357 = 3;
19422 if ((double)life < (double)lifeMax * 0.3)
19423 {
19424 num357++;
19425 }
19426 this.ai[2] += 1f;
19427 this.ai[1] = 0f;
19428 if (this.ai[2] > (float)num357)
19429 {
19430 this.ai[2] = 0f;
19431 }
19432 if (Main.netMode != 1 && CountNPCS(117) < 10)
19433 {
19434 int num358 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)(height / 2) + 20f), 117, 1);
19435 Main.npc[num358].velocity.X = direction * 8;
19436 }
19437 }
19438 localAI[3] += 1f;
19439 if (localAI[3] >= (float)(600 + Main.rand.Next(1000)))
19440 {
19441 localAI[3] = -Main.rand.Next(200);
19442 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 10);
19443 }
19444 int num359 = Main.UnderworldLayer + 10;
19445 int num360 = num359 + 70;
19446 Main.wofNPCIndex = whoAmI;
19447 int num361 = (int)(position.X / 16f);
19448 int num362 = (int)((position.X + (float)width) / 16f);
19449 int num363 = (int)((position.Y + (float)(height / 2)) / 16f);
19450 int num364 = 0;
19451 int num365 = num363 + 7;
19453 {
19454 num365++;
19455 if (num365 > Main.maxTilesY - 10)
19456 {
19457 num365 = Main.maxTilesY - 10;
19458 break;
19459 }
19460 if (num365 < num359)
19461 {
19462 continue;
19463 }
19464 for (int num366 = num361; num366 <= num362; num366++)
19465 {
19466 try
19467 {
19469 {
19470 num364++;
19471 }
19472 }
19473 catch
19474 {
19475 num364 += 15;
19476 }
19477 }
19478 }
19479 num365 += 4;
19480 if (Main.wofDrawAreaBottom == -1)
19481 {
19482 Main.wofDrawAreaBottom = num365 * 16;
19483 }
19484 else if (Main.wofDrawAreaBottom > num365 * 16)
19485 {
19487 if (Main.wofDrawAreaBottom < num365 * 16)
19488 {
19489 Main.wofDrawAreaBottom = num365 * 16;
19490 }
19491 }
19492 else if (Main.wofDrawAreaBottom < num365 * 16)
19493 {
19495 if (Main.wofDrawAreaBottom > num365 * 16)
19496 {
19497 Main.wofDrawAreaBottom = num365 * 16;
19498 }
19499 }
19500 num364 = 0;
19501 num365 = num363 - 7;
19502 while (num364 < 15 && num365 < Main.maxTilesY - 10)
19503 {
19504 num365--;
19505 if (num365 <= 10)
19506 {
19507 num365 = 10;
19508 break;
19509 }
19510 if (num365 > num360)
19511 {
19512 continue;
19513 }
19514 if (num365 < num359)
19515 {
19516 num365 = num359;
19517 break;
19518 }
19519 for (int num367 = num361; num367 <= num362; num367++)
19520 {
19521 try
19522 {
19524 {
19525 num364++;
19526 }
19527 }
19528 catch
19529 {
19530 num364 += 15;
19531 }
19532 }
19533 }
19534 num365 -= 4;
19535 if (Main.wofDrawAreaTop == -1)
19536 {
19537 Main.wofDrawAreaTop = num365 * 16;
19538 }
19539 else if (Main.wofDrawAreaTop > num365 * 16)
19540 {
19542 if (Main.wofDrawAreaTop < num365 * 16)
19543 {
19544 Main.wofDrawAreaTop = num365 * 16;
19545 }
19546 }
19547 else if (Main.wofDrawAreaTop < num365 * 16)
19548 {
19550 if (Main.wofDrawAreaTop > num365 * 16)
19551 {
19552 Main.wofDrawAreaTop = num365 * 16;
19553 }
19554 }
19555 Main.wofDrawAreaTop = (int)MathHelper.Clamp(Main.wofDrawAreaTop, (float)num359 * 16f, (float)num360 * 16f);
19556 Main.wofDrawAreaBottom = (int)MathHelper.Clamp(Main.wofDrawAreaBottom, (float)num359 * 16f, (float)num360 * 16f);
19558 {
19559 Main.wofDrawAreaTop = Main.wofDrawAreaBottom - 160;
19560 }
19561 else if (Main.wofDrawAreaBottom < Main.wofDrawAreaTop + 160)
19562 {
19563 Main.wofDrawAreaBottom = Main.wofDrawAreaTop + 160;
19564 }
19565 float num368 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - height / 2;
19566 if (position.Y > num368 + 1f)
19567 {
19568 velocity.Y = -1f;
19569 }
19570 else if (position.Y < num368 - 1f)
19571 {
19572 velocity.Y = 1f;
19573 }
19574 velocity.Y = 0f;
19575 position.Y = num368;
19576 float num369 = 1.5f;
19577 if ((double)life < (double)lifeMax * 0.75)
19578 {
19579 num369 += 0.25f;
19580 }
19581 if ((double)life < (double)lifeMax * 0.5)
19582 {
19583 num369 += 0.4f;
19584 }
19585 if ((double)life < (double)lifeMax * 0.25)
19586 {
19587 num369 += 0.5f;
19588 }
19589 if ((double)life < (double)lifeMax * 0.1)
19590 {
19591 num369 += 0.6f;
19592 }
19593 if ((double)life < (double)lifeMax * 0.66 && Main.expertMode)
19594 {
19595 num369 += 0.3f;
19596 }
19597 if ((double)life < (double)lifeMax * 0.33 && Main.expertMode)
19598 {
19599 num369 += 0.3f;
19600 }
19601 if ((double)life < (double)lifeMax * 0.05 && Main.expertMode)
19602 {
19603 num369 += 0.6f;
19604 }
19605 if ((double)life < (double)lifeMax * 0.035 && Main.expertMode)
19606 {
19607 num369 += 0.6f;
19608 }
19609 if ((double)life < (double)lifeMax * 0.025 && Main.expertMode)
19610 {
19611 num369 += 0.6f;
19612 }
19613 if (Main.expertMode)
19614 {
19615 num369 *= 1.35f;
19616 num369 += 0.35f;
19617 }
19618 if (Main.getGoodWorld)
19619 {
19620 num369 *= 1.1f;
19621 num369 += 0.2f;
19622 }
19623 if (velocity.X == 0f)
19624 {
19625 TargetClosest();
19626 if (Main.player[target].dead)
19627 {
19628 float num370 = float.PositiveInfinity;
19629 int num371 = 0;
19630 for (int num372 = 0; num372 < 255; num372++)
19631 {
19632 Player player = Main.player[target];
19633 if (player.active)
19634 {
19635 float num373 = Distance(player.Center);
19636 if (num370 > num373)
19637 {
19638 num370 = num373;
19639 num371 = ((base.Center.X < player.Center.X) ? 1 : (-1));
19640 }
19641 }
19642 }
19643 direction = num371;
19644 }
19645 velocity.X = direction;
19646 }
19647 if (velocity.X < 0f)
19648 {
19649 velocity.X = 0f - num369;
19650 direction = -1;
19651 }
19652 else
19653 {
19654 velocity.X = num369;
19655 direction = 1;
19656 }
19657 if (Main.player[target].dead || !Main.player[target].gross)
19658 {
19660 }
19661 if (Main.player[target].dead)
19662 {
19663 localAI[1] += 1f / 180f;
19664 if (localAI[1] >= 1f)
19665 {
19666 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 10);
19667 life = 0;
19668 active = false;
19669 if (Main.netMode != 1)
19670 {
19671 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
19672 }
19673 return;
19674 }
19675 }
19676 else
19677 {
19678 localAI[1] = MathHelper.Clamp(localAI[1] - 1f / 30f, 0f, 1f);
19679 }
19681 Vector2 vector38 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
19682 float num374 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector38.X;
19683 float num375 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector38.Y;
19684 float num376 = (float)Math.Sqrt(num374 * num374 + num375 * num375);
19685 float num377 = num376;
19686 num374 *= num376;
19687 num375 *= num376;
19688 if (direction > 0)
19689 {
19690 if (Main.player[target].position.X + (float)(Main.player[target].width / 2) > position.X + (float)(width / 2))
19691 {
19692 rotation = (float)Math.Atan2(0f - num375, 0f - num374) + 3.14f;
19693 }
19694 else
19695 {
19696 rotation = 0f;
19697 }
19698 }
19699 else if (Main.player[target].position.X + (float)(Main.player[target].width / 2) < position.X + (float)(width / 2))
19700 {
19701 rotation = (float)Math.Atan2(num375, num374) + 3.14f;
19702 }
19703 else
19704 {
19705 rotation = 0f;
19706 }
19707 if (Main.expertMode && Main.netMode != 1)
19708 {
19709 int num378 = (int)(1f + (float)life / (float)lifeMax * 10f);
19710 num378 *= num378;
19711 if (num378 < 400)
19712 {
19713 num378 = (num378 * 19 + 400) / 20;
19714 }
19715 if (num378 < 60)
19716 {
19717 num378 = (num378 * 3 + 60) / 4;
19718 }
19719 if (num378 < 20)
19720 {
19721 num378 = (num378 + 20) / 2;
19722 }
19723 num378 = (int)((double)num378 * 0.7);
19724 if (Main.rand.Next(num378) == 0)
19725 {
19726 int num379 = 0;
19727 float[] array = new float[10];
19728 for (int num380 = 0; num380 < 200; num380++)
19729 {
19730 if (num379 < 10 && Main.npc[num380].active && Main.npc[num380].type == 115)
19731 {
19732 array[num379] = Main.npc[num380].ai[0];
19733 num379++;
19734 }
19735 }
19736 int maxValue = 1 + num379 * 2;
19737 if (num379 < 10 && Main.rand.Next(maxValue) <= 1)
19738 {
19739 int num381 = -1;
19740 for (int num382 = 0; num382 < 1000; num382++)
19741 {
19742 int num383 = Main.rand.Next(10);
19743 float num384 = (float)num383 * 0.1f - 0.05f;
19744 bool flag26 = true;
19745 for (int num385 = 0; num385 < num379; num385++)
19746 {
19747 if (num384 == array[num385])
19748 {
19749 flag26 = false;
19750 break;
19751 }
19752 }
19753 if (flag26)
19754 {
19755 num381 = num383;
19756 break;
19757 }
19758 }
19759 if (num381 >= 0)
19760 {
19761 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)position.X, (int)num368, 115, whoAmI, (float)num381 * 0.1f - 0.05f);
19762 }
19763 }
19764 }
19765 }
19766 if (Main.netMode != 1 && localAI[0] == 1f)
19767 {
19768 localAI[0] = 2f;
19769 float num386 = (base.Center.Y + (float)Main.wofDrawAreaTop) / 2f;
19770 int num387 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)position.X, (int)num386, 114, whoAmI, 1f);
19771 float num388 = (base.Center.Y + (float)Main.wofDrawAreaBottom) / 2f;
19773 float num389 = (base.Center.Y + (float)Main.wofDrawAreaBottom) / 2f;
19774 for (int num390 = 0; num390 < 11; num390++)
19775 {
19776 num387 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)position.X, (int)num389, 115, whoAmI, (float)num390 * 0.1f - 0.05f);
19777 }
19778 }
19779 }
19780 else if (aiStyle == 28)
19781 {
19782 if (Main.wofNPCIndex < 0)
19783 {
19784 active = false;
19785 return;
19786 }
19788 if (Main.npc[Main.wofNPCIndex].life > 0)
19789 {
19790 life = Main.npc[Main.wofNPCIndex].life;
19791 }
19792 TargetClosest();
19793 position.X = Main.npc[Main.wofNPCIndex].position.X;
19794 direction = Main.npc[Main.wofNPCIndex].direction;
19796 float num391 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2;
19797 num391 = ((!(this.ai[0] > 0f)) ? ((num391 + (float)Main.wofDrawAreaBottom) / 2f) : ((num391 + (float)Main.wofDrawAreaTop) / 2f));
19798 num391 -= (float)(height / 2);
19799 if (position.Y > num391 + 1f)
19800 {
19801 velocity.Y = -1f;
19802 }
19803 else if (position.Y < num391 - 1f)
19804 {
19805 velocity.Y = 1f;
19806 }
19807 else
19808 {
19809 velocity.Y = 0f;
19810 position.Y = num391;
19811 }
19812 if (velocity.Y > 5f)
19813 {
19814 velocity.Y = 5f;
19815 }
19816 if (velocity.Y < -5f)
19817 {
19818 velocity.Y = -5f;
19819 }
19820 Vector2 vector39 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
19821 float num392 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector39.X;
19822 float num393 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector39.Y;
19823 float num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393);
19824 float num395 = num394;
19825 num392 *= num394;
19826 num393 *= num394;
19827 bool flag27 = true;
19828 if (direction > 0)
19829 {
19830 if (Main.player[target].position.X + (float)(Main.player[target].width / 2) > position.X + (float)(width / 2))
19831 {
19832 rotation = (float)Math.Atan2(0f - num393, 0f - num392) + 3.14f;
19833 }
19834 else
19835 {
19836 rotation = 0f;
19837 flag27 = false;
19838 }
19839 }
19840 else if (Main.player[target].position.X + (float)(Main.player[target].width / 2) < position.X + (float)(width / 2))
19841 {
19842 rotation = (float)Math.Atan2(num393, num392) + 3.14f;
19843 }
19844 else
19845 {
19846 rotation = 0f;
19847 flag27 = false;
19848 }
19849 if (Main.netMode == 1)
19850 {
19851 return;
19852 }
19853 int num396 = 4;
19854 localAI[1] += 1f;
19855 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75)
19856 {
19857 localAI[1] += 1f;
19858 num396++;
19859 }
19860 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5)
19861 {
19862 localAI[1] += 1f;
19863 num396++;
19864 }
19865 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25)
19866 {
19867 localAI[1] += 1f;
19868 num396 += 2;
19869 }
19870 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
19871 {
19872 localAI[1] += 2f;
19873 num396 += 3;
19874 }
19875 if (Main.expertMode)
19876 {
19877 localAI[1] += 0.5f;
19878 num396++;
19879 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
19880 {
19881 localAI[1] += 2f;
19882 num396 += 3;
19883 }
19884 }
19885 if (localAI[2] == 0f)
19886 {
19887 if (localAI[1] > 600f)
19888 {
19889 localAI[2] = 1f;
19890 localAI[1] = 0f;
19891 }
19892 }
19893 else
19894 {
19895 if (!(localAI[1] > 45f) || !Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
19896 {
19897 return;
19898 }
19899 localAI[1] = 0f;
19900 localAI[2] += 1f;
19901 if (localAI[2] >= (float)num396)
19902 {
19903 localAI[2] = 0f;
19904 }
19905 if (flag27)
19906 {
19907 float num397 = 9f;
19908 int num398 = 11;
19909 int num399 = 83;
19910 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5)
19911 {
19912 num398++;
19913 num397 += 1f;
19914 }
19915 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25)
19916 {
19917 num398++;
19918 num397 += 1f;
19919 }
19920 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1)
19921 {
19922 num398 += 2;
19923 num397 += 2f;
19924 }
19925 vector39 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
19926 num392 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector39.X;
19927 num393 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector39.Y;
19928 num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393);
19929 num394 = num397 / num394;
19930 num392 *= num394;
19931 num393 *= num394;
19932 vector39.X += num392;
19933 vector39.Y += num393;
19935 }
19936 }
19937 }
19938 else if (aiStyle == 29)
19939 {
19940 if (justHit)
19941 {
19942 this.ai[1] = 10f;
19943 }
19944 if (Main.wofNPCIndex < 0)
19945 {
19946 active = false;
19947 return;
19948 }
19949 TargetClosest();
19950 float num401 = 0.1f;
19951 float num402 = 300f;
19952 damage = defDamage;
19953 int num403 = 0;
19954 if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5)
19955 {
19956 num403 = 60;
19957 defense = 30;
19958 if (!Main.expertMode)
19959 {
19960 num402 = 700f;
19961 }
19962 else
19963 {
19964 num401 += 0.066f;
19965 }
19966 }
19967 else if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75)
19968 {
19969 num403 = 45;
19970 defense = 20;
19971 if (!Main.expertMode)
19972 {
19973 num402 = 500f;
19974 }
19975 else
19976 {
19977 num401 += 0.033f;
19978 }
19979 }
19980 if (num403 > 0)
19981 {
19983 }
19984 if (Main.expertMode)
19985 {
19987 if (whoAmI % 4 == 0)
19988 {
19989 num402 *= 1.75f;
19990 }
19991 if (whoAmI % 4 == 1)
19992 {
19993 num402 *= 1.5f;
19994 }
19995 if (whoAmI % 4 == 2)
19996 {
19997 num402 *= 1.25f;
19998 }
19999 if (whoAmI % 3 == 0)
20000 {
20001 num402 *= 1.5f;
20002 }
20003 if (whoAmI % 3 == 1)
20004 {
20005 num402 *= 1.25f;
20006 }
20007 num402 *= 0.75f;
20008 }
20009 float num404 = Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2);
20010 float y3 = Main.npc[Main.wofNPCIndex].position.Y;
20011 float num405 = Main.wofDrawAreaBottom - Main.wofDrawAreaTop;
20012 y3 = (float)Main.wofDrawAreaTop + num405 * this.ai[0];
20013 this.ai[2] += 1f;
20014 if (this.ai[2] > 100f)
20015 {
20016 num402 = (int)(num402 * 1.3f);
20017 if (this.ai[2] > 200f)
20018 {
20019 this.ai[2] = 0f;
20020 }
20021 }
20023 float num406 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - (float)(width / 2) - vector40.X;
20024 float num407 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - (float)(height / 2) - vector40.Y;
20025 float num408 = (float)Math.Sqrt(num406 * num406 + num407 * num407);
20026 if (this.ai[1] == 0f)
20027 {
20028 if (num408 > num402)
20029 {
20030 num408 = num402 / num408;
20031 num406 *= num408;
20032 num407 *= num408;
20033 }
20034 if (position.X < num404 + num406)
20035 {
20036 velocity.X += num401;
20037 if (velocity.X < 0f && num406 > 0f)
20038 {
20039 velocity.X += num401 * 2.5f;
20040 }
20041 }
20042 else if (position.X > num404 + num406)
20043 {
20044 velocity.X -= num401;
20045 if (velocity.X > 0f && num406 < 0f)
20046 {
20047 velocity.X -= num401 * 2.5f;
20048 }
20049 }
20050 if (position.Y < y3 + num407)
20051 {
20052 velocity.Y += num401;
20053 if (velocity.Y < 0f && num407 > 0f)
20054 {
20055 velocity.Y += num401 * 2.5f;
20056 }
20057 }
20058 else if (position.Y > y3 + num407)
20059 {
20060 velocity.Y -= num401;
20061 if (velocity.Y > 0f && num407 < 0f)
20062 {
20063 velocity.Y -= num401 * 2.5f;
20064 }
20065 }
20066 float num409 = 4f;
20067 if (Main.expertMode && Main.wofNPCIndex >= 0)
20068 {
20069 float num410 = 1.5f;
20070 float num411 = Main.npc[Main.wofNPCIndex].life / Main.npc[Main.wofNPCIndex].lifeMax;
20071 if ((double)num411 < 0.75)
20072 {
20073 num410 += 0.7f;
20074 }
20075 if ((double)num411 < 0.5)
20076 {
20077 num410 += 0.7f;
20078 }
20079 if ((double)num411 < 0.25)
20080 {
20081 num410 += 0.9f;
20082 }
20083 if ((double)num411 < 0.1)
20084 {
20085 num410 += 0.9f;
20086 }
20087 num410 *= 1.25f;
20088 num410 += 0.3f;
20089 num409 += num410 * 0.35f;
20090 if (base.Center.X < Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X > 0f)
20091 {
20092 num409 += 6f;
20093 }
20094 if (base.Center.X > Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X < 0f)
20095 {
20096 num409 += 6f;
20097 }
20098 }
20099 if (velocity.X > num409)
20100 {
20101 velocity.X = num409;
20102 }
20103 if (velocity.X < 0f - num409)
20104 {
20105 velocity.X = 0f - num409;
20106 }
20107 if (velocity.Y > num409)
20108 {
20109 velocity.Y = num409;
20110 }
20111 if (velocity.Y < 0f - num409)
20112 {
20113 velocity.Y = 0f - num409;
20114 }
20115 }
20116 else if (this.ai[1] > 0f)
20117 {
20118 this.ai[1] -= 1f;
20119 }
20120 else
20121 {
20122 this.ai[1] = 0f;
20123 }
20124 if (num406 > 0f)
20125 {
20126 spriteDirection = 1;
20127 rotation = (float)Math.Atan2(num407, num406);
20128 }
20129 if (num406 < 0f)
20130 {
20131 spriteDirection = -1;
20132 rotation = (float)Math.Atan2(num407, num406) + 3.14f;
20133 }
20134 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.3f, 0.2f, 0.1f);
20135 }
20136 else if (aiStyle == 30)
20137 {
20138 if (target < 0 || target == 255 || Main.player[target].dead || !Main.player[target].active)
20139 {
20140 TargetClosest();
20141 }
20142 bool dead2 = Main.player[target].dead;
20143 float num412 = position.X + (float)(width / 2) - Main.player[target].position.X - (float)(Main.player[target].width / 2);
20144 float num413 = position.Y + (float)height - 59f - Main.player[target].position.Y - (float)(Main.player[target].height / 2);
20145 float num414 = (float)Math.Atan2(num413, num412) + 1.57f;
20146 if (num414 < 0f)
20147 {
20148 num414 += 6.283f;
20149 }
20150 else if ((double)num414 > 6.283)
20151 {
20152 num414 -= 6.283f;
20153 }
20154 float num415 = 0.1f;
20155 if (rotation < num414)
20156 {
20157 if ((double)(num414 - rotation) > 3.1415)
20158 {
20159 rotation -= num415;
20160 }
20161 else
20162 {
20163 rotation += num415;
20164 }
20165 }
20166 else if (rotation > num414)
20167 {
20168 if ((double)(rotation - num414) > 3.1415)
20169 {
20170 rotation += num415;
20171 }
20172 else
20173 {
20174 rotation -= num415;
20175 }
20176 }
20177 if (rotation > num414 - num415 && rotation < num414 + num415)
20178 {
20179 rotation = num414;
20180 }
20181 if (rotation < 0f)
20182 {
20183 rotation += 6.283f;
20184 }
20185 else if ((double)rotation > 6.283)
20186 {
20187 rotation -= 6.283f;
20188 }
20189 if (rotation > num414 - num415 && rotation < num414 + num415)
20190 {
20191 rotation = num414;
20192 }
20193 if (Main.rand.Next(5) == 0)
20194 {
20195 int num416 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
20196 Main.dust[num416].velocity.X *= 0.5f;
20197 Main.dust[num416].velocity.Y *= 0.1f;
20198 }
20199 if (Main.netMode != 1 && !Main.IsItDay() && !dead2 && timeLeft < 10)
20200 {
20201 for (int num417 = 0; num417 < 200; num417++)
20202 {
20203 if (num417 != whoAmI && Main.npc[num417].active && (Main.npc[num417].type == 125 || Main.npc[num417].type == 126))
20204 {
20205 DiscourageDespawn(Main.npc[num417].timeLeft - 1);
20206 }
20207 }
20208 }
20210 if (IsMechQueenUp)
20211 {
20213 Vector2 mechQueenCenter = nPC.GetMechQueenCenter();
20214 Vector2 vector42 = new Vector2(-150f, -250f);
20215 vector42 *= 0.75f;
20216 float num418 = nPC.velocity.X * 0.025f;
20219 }
20220 reflectsProjectiles = false;
20221 if (Main.IsItDay() || dead2)
20222 {
20223 velocity.Y -= 0.04f;
20224 EncourageDespawn(10);
20225 return;
20226 }
20227 if (this.ai[0] == 0f)
20228 {
20229 if (this.ai[1] == 0f)
20230 {
20231 float num419 = 7f;
20232 float num420 = 0.1f;
20233 if (Main.expertMode)
20234 {
20235 num419 = 8.25f;
20236 num420 = 0.115f;
20237 }
20238 if (Main.getGoodWorld)
20239 {
20240 num419 *= 1.15f;
20241 num420 *= 1.15f;
20242 }
20243 int num421 = 1;
20244 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)Main.player[target].width)
20245 {
20246 num421 = -1;
20247 }
20248 Vector2 vector43 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20249 float num422 = Main.player[target].position.X + (float)(Main.player[target].width / 2) + (float)(num421 * 300) - vector43.X;
20250 float num423 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 300f - vector43.Y;
20251 if (IsMechQueenUp)
20252 {
20253 num419 = 14f;
20254 num422 = vector41.X;
20255 num423 = vector41.Y;
20256 num422 -= vector43.X;
20257 num423 -= vector43.Y;
20258 }
20259 float num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423);
20260 float num425 = num424;
20261 if (IsMechQueenUp)
20262 {
20263 if (num424 > num419)
20264 {
20265 num424 = num419 / num424;
20266 num422 *= num424;
20267 num423 *= num424;
20268 }
20269 float num426 = 60f;
20270 velocity.X = (velocity.X * (num426 - 1f) + num422) / num426;
20271 velocity.Y = (velocity.Y * (num426 - 1f) + num423) / num426;
20272 }
20273 else
20274 {
20275 num424 = num419 / num424;
20276 num422 *= num424;
20277 num423 *= num424;
20278 if (velocity.X < num422)
20279 {
20280 velocity.X += num420;
20281 if (velocity.X < 0f && num422 > 0f)
20282 {
20283 velocity.X += num420;
20284 }
20285 }
20286 else if (velocity.X > num422)
20287 {
20288 velocity.X -= num420;
20289 if (velocity.X > 0f && num422 < 0f)
20290 {
20291 velocity.X -= num420;
20292 }
20293 }
20294 if (velocity.Y < num423)
20295 {
20296 velocity.Y += num420;
20297 if (velocity.Y < 0f && num423 > 0f)
20298 {
20299 velocity.Y += num420;
20300 }
20301 }
20302 else if (velocity.Y > num423)
20303 {
20304 velocity.Y -= num420;
20305 if (velocity.Y > 0f && num423 < 0f)
20306 {
20307 velocity.Y -= num420;
20308 }
20309 }
20310 }
20311 int num427 = 600;
20312 int num428 = 60;
20313 if (IsMechQueenUp)
20314 {
20315 num427 = 1200;
20316 num428 = ((!npcsFoundForCheckActive[135]) ? 90 : 120);
20317 }
20318 this.ai[2] += 1f;
20319 if (this.ai[2] >= (float)num427)
20320 {
20321 this.ai[1] = 1f;
20322 this.ai[2] = 0f;
20323 this.ai[3] = 0f;
20324 target = 255;
20325 netUpdate = true;
20326 }
20327 else if (position.Y + (float)height < Main.player[target].position.Y && num425 < 400f)
20328 {
20329 if (!Main.player[target].dead)
20330 {
20331 this.ai[3] += 1f;
20332 if (Main.expertMode && (double)life < (double)lifeMax * 0.9)
20333 {
20334 this.ai[3] += 0.3f;
20335 }
20336 if (Main.expertMode && (double)life < (double)lifeMax * 0.8)
20337 {
20338 this.ai[3] += 0.3f;
20339 }
20340 if (Main.expertMode && (double)life < (double)lifeMax * 0.7)
20341 {
20342 this.ai[3] += 0.3f;
20343 }
20344 if (Main.expertMode && (double)life < (double)lifeMax * 0.6)
20345 {
20346 this.ai[3] += 0.3f;
20347 }
20348 if (Main.getGoodWorld)
20349 {
20350 this.ai[3] += 0.5f;
20351 }
20352 }
20353 if (this.ai[3] >= (float)num428)
20354 {
20355 this.ai[3] = 0f;
20356 vector43 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20357 num422 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector43.X;
20358 num423 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector43.Y;
20359 if (Main.netMode != 1)
20360 {
20361 float num429 = 9f;
20363 int num430 = 83;
20364 if (Main.expertMode)
20365 {
20366 num429 = 10.5f;
20367 }
20368 num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423);
20369 num424 = num429 / num424;
20370 num422 *= num424;
20371 num423 *= num424;
20372 num422 += (float)Main.rand.Next(-40, 41) * 0.08f;
20373 num423 += (float)Main.rand.Next(-40, 41) * 0.08f;
20374 vector43.X += num422 * 15f;
20375 vector43.Y += num423 * 15f;
20377 }
20378 }
20379 }
20380 }
20381 else if (this.ai[1] == 1f)
20382 {
20383 rotation = num414;
20384 float num432 = 12f;
20385 if (Main.expertMode)
20386 {
20387 num432 = 15f;
20388 }
20389 if (Main.getGoodWorld)
20390 {
20391 num432 += 2f;
20392 }
20393 Vector2 vector44 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20394 float num433 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector44.X;
20395 float num434 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector44.Y;
20396 float num435 = (float)Math.Sqrt(num433 * num433 + num434 * num434);
20397 num435 = num432 / num435;
20398 velocity.X = num433 * num435;
20399 velocity.Y = num434 * num435;
20400 this.ai[1] = 2f;
20401 }
20402 else if (this.ai[1] == 2f)
20403 {
20404 this.ai[2] += 1f;
20405 if (this.ai[2] >= 25f)
20406 {
20407 velocity.X *= 0.96f;
20408 velocity.Y *= 0.96f;
20409 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
20410 {
20411 velocity.X = 0f;
20412 }
20413 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
20414 {
20415 velocity.Y = 0f;
20416 }
20417 }
20418 else
20419 {
20420 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
20421 }
20422 if (this.ai[2] >= 70f)
20423 {
20424 this.ai[3] += 1f;
20425 this.ai[2] = 0f;
20426 target = 255;
20427 rotation = num414;
20428 if (this.ai[3] >= 4f)
20429 {
20430 this.ai[1] = 0f;
20431 this.ai[3] = 0f;
20432 }
20433 else
20434 {
20435 this.ai[1] = 1f;
20436 }
20437 }
20438 }
20439 if ((double)life < (double)lifeMax * 0.4)
20440 {
20441 this.ai[0] = 1f;
20442 this.ai[1] = 0f;
20443 this.ai[2] = 0f;
20444 this.ai[3] = 0f;
20445 netUpdate = true;
20446 }
20447 return;
20448 }
20449 if (this.ai[0] == 1f || this.ai[0] == 2f)
20450 {
20451 if (IsMechQueenUp)
20452 {
20453 reflectsProjectiles = true;
20454 }
20455 if (this.ai[0] == 1f)
20456 {
20457 this.ai[2] += 0.005f;
20458 if ((double)this.ai[2] > 0.5)
20459 {
20460 this.ai[2] = 0.5f;
20461 }
20462 }
20463 else
20464 {
20465 this.ai[2] -= 0.005f;
20466 if (this.ai[2] < 0f)
20467 {
20468 this.ai[2] = 0f;
20469 }
20470 }
20471 rotation += this.ai[2];
20472 this.ai[1] += 1f;
20473 if (this.ai[1] >= 100f)
20474 {
20475 this.ai[0] += 1f;
20476 this.ai[1] = 0f;
20477 if (this.ai[0] == 3f)
20478 {
20479 this.ai[2] = 0f;
20480 }
20481 else
20482 {
20483 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
20484 for (int num436 = 0; num436 < 2; num436++)
20485 {
20486 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143);
20487 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7);
20488 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6);
20489 }
20490 for (int num437 = 0; num437 < 20; num437++)
20491 {
20492 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
20493 }
20494 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
20495 }
20496 }
20497 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
20498 velocity.X *= 0.98f;
20499 velocity.Y *= 0.98f;
20500 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
20501 {
20502 velocity.X = 0f;
20503 }
20504 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
20505 {
20506 velocity.Y = 0f;
20507 }
20508 return;
20509 }
20510 damage = (int)((double)defDamage * 1.5);
20511 defense = defDefense + 10;
20513 if (this.ai[1] == 0f)
20514 {
20515 float num438 = 8f;
20516 float num439 = 0.15f;
20517 if (Main.expertMode)
20518 {
20519 num438 = 9.5f;
20520 num439 = 0.175f;
20521 }
20522 if (Main.getGoodWorld)
20523 {
20524 num438 *= 1.15f;
20525 num439 *= 1.15f;
20526 }
20527 Vector2 vector45 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20528 float num440 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector45.X;
20529 float num441 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 300f - vector45.Y;
20530 if (IsMechQueenUp)
20531 {
20532 num438 = 14f;
20533 num440 = vector41.X;
20534 num441 = vector41.Y;
20535 num440 -= vector45.X;
20536 num441 -= vector45.Y;
20537 }
20538 float num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441);
20539 if (IsMechQueenUp)
20540 {
20541 if (num442 > num438)
20542 {
20543 num442 = num438 / num442;
20544 num440 *= num442;
20545 num441 *= num442;
20546 }
20547 velocity.X = (velocity.X * 4f + num440) / 5f;
20548 velocity.Y = (velocity.Y * 4f + num441) / 5f;
20549 }
20550 else
20551 {
20552 num442 = num438 / num442;
20553 num440 *= num442;
20554 num441 *= num442;
20555 if (velocity.X < num440)
20556 {
20557 velocity.X += num439;
20558 if (velocity.X < 0f && num440 > 0f)
20559 {
20560 velocity.X += num439;
20561 }
20562 }
20563 else if (velocity.X > num440)
20564 {
20565 velocity.X -= num439;
20566 if (velocity.X > 0f && num440 < 0f)
20567 {
20568 velocity.X -= num439;
20569 }
20570 }
20571 if (velocity.Y < num441)
20572 {
20573 velocity.Y += num439;
20574 if (velocity.Y < 0f && num441 > 0f)
20575 {
20576 velocity.Y += num439;
20577 }
20578 }
20579 else if (velocity.Y > num441)
20580 {
20581 velocity.Y -= num439;
20582 if (velocity.Y > 0f && num441 < 0f)
20583 {
20584 velocity.Y -= num439;
20585 }
20586 }
20587 }
20588 int num443 = 300;
20589 if (IsMechQueenUp)
20590 {
20591 num443 = 1200;
20592 }
20593 this.ai[2] += 1f;
20594 if (this.ai[2] >= (float)num443)
20595 {
20596 this.ai[1] = 1f;
20597 this.ai[2] = 0f;
20598 this.ai[3] = 0f;
20599 TargetClosest();
20600 netUpdate = true;
20601 }
20602 vector45 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20603 num440 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector45.X;
20604 num441 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector45.Y;
20605 rotation = (float)Math.Atan2(num441, num440) - 1.57f;
20606 if (Main.netMode == 1)
20607 {
20608 return;
20609 }
20610 localAI[1] += 1f;
20611 if ((double)life < (double)lifeMax * 0.75)
20612 {
20613 localAI[1] += 1f;
20614 }
20615 if ((double)life < (double)lifeMax * 0.5)
20616 {
20617 localAI[1] += 1f;
20618 }
20619 if ((double)life < (double)lifeMax * 0.25)
20620 {
20621 localAI[1] += 1f;
20622 }
20623 if ((double)life < (double)lifeMax * 0.1)
20624 {
20625 localAI[1] += 2f;
20626 }
20627 if (localAI[1] > 180f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
20628 {
20629 localAI[1] = 0f;
20630 float num444 = 8.5f;
20632 int num445 = 100;
20633 if (Main.expertMode)
20634 {
20635 num444 = 10f;
20636 }
20637 num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441);
20638 num442 = num444 / num442;
20639 num440 *= num442;
20640 num441 *= num442;
20641 vector45.X += num440 * 15f;
20642 vector45.Y += num441 * 15f;
20644 }
20645 return;
20646 }
20647 int num447 = 1;
20648 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)Main.player[target].width)
20649 {
20650 num447 = -1;
20651 }
20652 float num448 = 8f;
20653 float num449 = 0.2f;
20654 if (Main.expertMode)
20655 {
20656 num448 = 9.5f;
20657 num449 = 0.25f;
20658 }
20659 if (Main.getGoodWorld)
20660 {
20661 num448 *= 1.15f;
20662 num449 *= 1.15f;
20663 }
20664 Vector2 vector46 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20665 float num450 = Main.player[target].position.X + (float)(Main.player[target].width / 2) + (float)(num447 * 340) - vector46.X;
20666 float num451 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector46.Y;
20667 float num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451);
20668 num452 = num448 / num452;
20669 num450 *= num452;
20670 num451 *= num452;
20671 if (velocity.X < num450)
20672 {
20673 velocity.X += num449;
20674 if (velocity.X < 0f && num450 > 0f)
20675 {
20676 velocity.X += num449;
20677 }
20678 }
20679 else if (velocity.X > num450)
20680 {
20681 velocity.X -= num449;
20682 if (velocity.X > 0f && num450 < 0f)
20683 {
20684 velocity.X -= num449;
20685 }
20686 }
20687 if (velocity.Y < num451)
20688 {
20689 velocity.Y += num449;
20690 if (velocity.Y < 0f && num451 > 0f)
20691 {
20692 velocity.Y += num449;
20693 }
20694 }
20695 else if (velocity.Y > num451)
20696 {
20697 velocity.Y -= num449;
20698 if (velocity.Y > 0f && num451 < 0f)
20699 {
20700 velocity.Y -= num449;
20701 }
20702 }
20703 vector46 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20704 num450 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector46.X;
20705 num451 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector46.Y;
20706 rotation = (float)Math.Atan2(num451, num450) - 1.57f;
20707 if (Main.netMode != 1)
20708 {
20709 localAI[1] += 1f;
20710 if ((double)life < (double)lifeMax * 0.75)
20711 {
20712 localAI[1] += 0.5f;
20713 }
20714 if ((double)life < (double)lifeMax * 0.5)
20715 {
20716 localAI[1] += 0.75f;
20717 }
20718 if ((double)life < (double)lifeMax * 0.25)
20719 {
20720 localAI[1] += 1f;
20721 }
20722 if ((double)life < (double)lifeMax * 0.1)
20723 {
20724 localAI[1] += 1.5f;
20725 }
20726 if (Main.expertMode)
20727 {
20728 localAI[1] += 1.5f;
20729 }
20730 if (localAI[1] > 60f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
20731 {
20732 localAI[1] = 0f;
20733 float num453 = 9f;
20735 int num454 = 100;
20736 num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451);
20737 num452 = num453 / num452;
20738 num450 *= num452;
20739 num451 *= num452;
20740 vector46.X += num450 * 15f;
20741 vector46.Y += num451 * 15f;
20743 }
20744 }
20745 this.ai[2] += 1f;
20746 if (this.ai[2] >= 180f)
20747 {
20748 this.ai[1] = 0f;
20749 this.ai[2] = 0f;
20750 this.ai[3] = 0f;
20751 TargetClosest();
20752 netUpdate = true;
20753 }
20754 }
20755 else if (aiStyle == 31)
20756 {
20757 if (target < 0 || target == 255 || Main.player[target].dead || !Main.player[target].active)
20758 {
20759 TargetClosest();
20760 }
20761 bool dead3 = Main.player[target].dead;
20762 float num456 = position.X + (float)(width / 2) - Main.player[target].position.X - (float)(Main.player[target].width / 2);
20763 float num457 = position.Y + (float)height - 59f - Main.player[target].position.Y - (float)(Main.player[target].height / 2);
20764 float num458 = (float)Math.Atan2(num457, num456) + 1.57f;
20765 if (num458 < 0f)
20766 {
20767 num458 += 6.283f;
20768 }
20769 else if ((double)num458 > 6.283)
20770 {
20771 num458 -= 6.283f;
20772 }
20773 float num459 = 0.15f;
20774 if (IsMechQueenUp && this.ai[0] == 3f && this.ai[1] == 0f)
20775 {
20776 num459 *= 0.25f;
20777 }
20778 if (rotation < num458)
20779 {
20780 if ((double)(num458 - rotation) > 3.1415)
20781 {
20782 rotation -= num459;
20783 }
20784 else
20785 {
20786 rotation += num459;
20787 }
20788 }
20789 else if (rotation > num458)
20790 {
20791 if ((double)(rotation - num458) > 3.1415)
20792 {
20793 rotation += num459;
20794 }
20795 else
20796 {
20797 rotation -= num459;
20798 }
20799 }
20800 if (rotation > num458 - num459 && rotation < num458 + num459)
20801 {
20802 rotation = num458;
20803 }
20804 if (rotation < 0f)
20805 {
20806 rotation += 6.283f;
20807 }
20808 else if ((double)rotation > 6.283)
20809 {
20810 rotation -= 6.283f;
20811 }
20812 if (rotation > num458 - num459 && rotation < num458 + num459)
20813 {
20814 rotation = num458;
20815 }
20816 if (Main.rand.Next(5) == 0)
20817 {
20818 int num460 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
20819 Main.dust[num460].velocity.X *= 0.5f;
20820 Main.dust[num460].velocity.Y *= 0.1f;
20821 }
20822 if (Main.netMode != 1 && !Main.IsItDay() && !dead3 && timeLeft < 10)
20823 {
20824 for (int num461 = 0; num461 < 200; num461++)
20825 {
20826 if (num461 != whoAmI && Main.npc[num461].active && (Main.npc[num461].type == 125 || Main.npc[num461].type == 126))
20827 {
20828 DiscourageDespawn(Main.npc[num461].timeLeft - 1);
20829 }
20830 }
20831 }
20833 if (IsMechQueenUp)
20834 {
20836 Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter();
20837 Vector2 vector48 = new Vector2(150f, -250f);
20838 vector48 *= 0.75f;
20839 float num462 = nPC2.velocity.X * 0.025f;
20842 }
20843 reflectsProjectiles = false;
20844 if (Main.IsItDay() || dead3)
20845 {
20846 velocity.Y -= 0.04f;
20847 EncourageDespawn(10);
20848 return;
20849 }
20850 if (this.ai[0] == 0f)
20851 {
20852 if (this.ai[1] == 0f)
20853 {
20854 TargetClosest();
20855 float num463 = 12f;
20856 float num464 = 0.4f;
20857 if (Main.getGoodWorld)
20858 {
20859 num463 *= 1.15f;
20860 num464 *= 1.15f;
20861 }
20862 int num465 = 1;
20863 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)Main.player[target].width)
20864 {
20865 num465 = -1;
20866 }
20867 Vector2 vector49 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20868 float num466 = Main.player[target].position.X + (float)(Main.player[target].width / 2) + (float)(num465 * 400) - vector49.X;
20869 float num467 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector49.Y;
20870 if (IsMechQueenUp)
20871 {
20872 num463 = 14f;
20873 num466 = vector47.X;
20874 num467 = vector47.Y;
20875 num466 -= vector49.X;
20876 num467 -= vector49.Y;
20877 }
20878 float num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467);
20879 float num469 = num468;
20880 if (IsMechQueenUp)
20881 {
20882 if (num468 > num463)
20883 {
20884 num468 = num463 / num468;
20885 num466 *= num468;
20886 num467 *= num468;
20887 }
20888 velocity.X = (velocity.X * 4f + num466) / 5f;
20889 velocity.Y = (velocity.Y * 4f + num467) / 5f;
20890 }
20891 else
20892 {
20893 num468 = num463 / num468;
20894 num466 *= num468;
20895 num467 *= num468;
20896 if (velocity.X < num466)
20897 {
20898 velocity.X += num464;
20899 if (velocity.X < 0f && num466 > 0f)
20900 {
20901 velocity.X += num464;
20902 }
20903 }
20904 else if (velocity.X > num466)
20905 {
20906 velocity.X -= num464;
20907 if (velocity.X > 0f && num466 < 0f)
20908 {
20909 velocity.X -= num464;
20910 }
20911 }
20912 if (velocity.Y < num467)
20913 {
20914 velocity.Y += num464;
20915 if (velocity.Y < 0f && num467 > 0f)
20916 {
20917 velocity.Y += num464;
20918 }
20919 }
20920 else if (velocity.Y > num467)
20921 {
20922 velocity.Y -= num464;
20923 if (velocity.Y > 0f && num467 < 0f)
20924 {
20925 velocity.Y -= num464;
20926 }
20927 }
20928 }
20929 int num470 = 600;
20930 if (IsMechQueenUp)
20931 {
20932 num470 = 1200;
20933 }
20934 this.ai[2] += 1f;
20935 if (this.ai[2] >= (float)num470)
20936 {
20937 this.ai[1] = 1f;
20938 this.ai[2] = 0f;
20939 this.ai[3] = 0f;
20940 target = 255;
20941 netUpdate = true;
20942 }
20943 else
20944 {
20945 if (!Main.player[target].dead)
20946 {
20947 this.ai[3] += 1f;
20948 if (Main.expertMode && (double)life < (double)lifeMax * 0.8)
20949 {
20950 this.ai[3] += 0.6f;
20951 }
20952 if (Main.getGoodWorld)
20953 {
20954 this.ai[3] += 0.4f;
20955 }
20956 }
20957 if (this.ai[3] >= 60f)
20958 {
20959 this.ai[3] = 0f;
20960 vector49 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
20961 num466 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector49.X;
20962 num467 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector49.Y;
20963 if (Main.netMode != 1)
20964 {
20965 float num471 = 12f;
20967 int num472 = 96;
20968 if (Main.expertMode)
20969 {
20970 num471 = 14f;
20971 }
20972 num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467);
20973 num468 = num471 / num468;
20974 num466 *= num468;
20975 num467 *= num468;
20976 num466 += (float)Main.rand.Next(-40, 41) * 0.05f;
20977 num467 += (float)Main.rand.Next(-40, 41) * 0.05f;
20978 vector49.X += num466 * 4f;
20979 vector49.Y += num467 * 4f;
20981 }
20982 }
20983 }
20984 }
20985 else if (this.ai[1] == 1f)
20986 {
20987 rotation = num458;
20988 float num474 = 13f;
20989 if (Main.expertMode)
20990 {
20991 if ((double)life < (double)lifeMax * 0.9)
20992 {
20993 num474 += 0.5f;
20994 }
20995 if ((double)life < (double)lifeMax * 0.8)
20996 {
20997 num474 += 0.5f;
20998 }
20999 if ((double)life < (double)lifeMax * 0.7)
21000 {
21001 num474 += 0.55f;
21002 }
21003 if ((double)life < (double)lifeMax * 0.6)
21004 {
21005 num474 += 0.6f;
21006 }
21007 if ((double)life < (double)lifeMax * 0.5)
21008 {
21009 num474 += 0.65f;
21010 }
21011 }
21012 if (Main.getGoodWorld)
21013 {
21014 num474 *= 1.2f;
21015 }
21016 Vector2 vector50 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21017 float num475 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector50.X;
21018 float num476 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector50.Y;
21019 float num477 = (float)Math.Sqrt(num475 * num475 + num476 * num476);
21020 num477 = num474 / num477;
21021 velocity.X = num475 * num477;
21022 velocity.Y = num476 * num477;
21023 this.ai[1] = 2f;
21024 }
21025 else if (this.ai[1] == 2f)
21026 {
21027 this.ai[2] += 1f;
21028 if (this.ai[2] >= 8f)
21029 {
21030 velocity.X *= 0.9f;
21031 velocity.Y *= 0.9f;
21032 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
21033 {
21034 velocity.X = 0f;
21035 }
21036 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
21037 {
21038 velocity.Y = 0f;
21039 }
21040 }
21041 else
21042 {
21043 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
21044 }
21045 if (this.ai[2] >= 42f)
21046 {
21047 this.ai[3] += 1f;
21048 this.ai[2] = 0f;
21049 target = 255;
21050 rotation = num458;
21051 if (this.ai[3] >= 10f)
21052 {
21053 this.ai[1] = 0f;
21054 this.ai[3] = 0f;
21055 }
21056 else
21057 {
21058 this.ai[1] = 1f;
21059 }
21060 }
21061 }
21062 if ((double)life < (double)lifeMax * 0.4)
21063 {
21064 this.ai[0] = 1f;
21065 this.ai[1] = 0f;
21066 this.ai[2] = 0f;
21067 this.ai[3] = 0f;
21068 netUpdate = true;
21069 }
21070 return;
21071 }
21072 if (this.ai[0] == 1f || this.ai[0] == 2f)
21073 {
21074 if (IsMechQueenUp)
21075 {
21076 reflectsProjectiles = true;
21077 }
21078 if (this.ai[0] == 1f)
21079 {
21080 this.ai[2] += 0.005f;
21081 if ((double)this.ai[2] > 0.5)
21082 {
21083 this.ai[2] = 0.5f;
21084 }
21085 }
21086 else
21087 {
21088 this.ai[2] -= 0.005f;
21089 if (this.ai[2] < 0f)
21090 {
21091 this.ai[2] = 0f;
21092 }
21093 }
21094 rotation += this.ai[2];
21095 this.ai[1] += 1f;
21096 if (this.ai[1] >= 100f)
21097 {
21098 this.ai[0] += 1f;
21099 this.ai[1] = 0f;
21100 if (this.ai[0] == 3f)
21101 {
21102 this.ai[2] = 0f;
21103 }
21104 else
21105 {
21106 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
21107 for (int num478 = 0; num478 < 2; num478++)
21108 {
21109 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144);
21110 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7);
21111 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6);
21112 }
21113 for (int num479 = 0; num479 < 20; num479++)
21114 {
21115 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
21116 }
21117 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
21118 }
21119 }
21120 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
21121 velocity.X *= 0.98f;
21122 velocity.Y *= 0.98f;
21123 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
21124 {
21125 velocity.X = 0f;
21126 }
21127 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
21128 {
21129 velocity.Y = 0f;
21130 }
21131 return;
21132 }
21134 damage = (int)((double)defDamage * 1.5);
21135 defense = defDefense + 18;
21136 if (this.ai[1] == 0f)
21137 {
21138 float num480 = 4f;
21139 float num481 = 0.1f;
21140 int num482 = 1;
21141 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)Main.player[target].width)
21142 {
21143 num482 = -1;
21144 }
21145 Vector2 vector51 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21146 float num483 = Main.player[target].position.X + (float)(Main.player[target].width / 2) + (float)(num482 * 180) - vector51.X;
21147 float num484 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector51.Y;
21148 float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484);
21149 if (!IsMechQueenUp)
21150 {
21151 if (Main.expertMode)
21152 {
21153 if (num485 > 300f)
21154 {
21155 num480 += 0.5f;
21156 }
21157 if (num485 > 400f)
21158 {
21159 num480 += 0.5f;
21160 }
21161 if (num485 > 500f)
21162 {
21163 num480 += 0.55f;
21164 }
21165 if (num485 > 600f)
21166 {
21167 num480 += 0.55f;
21168 }
21169 if (num485 > 700f)
21170 {
21171 num480 += 0.6f;
21172 }
21173 if (num485 > 800f)
21174 {
21175 num480 += 0.6f;
21176 }
21177 }
21178 if (Main.getGoodWorld)
21179 {
21180 num480 *= 1.15f;
21181 num481 *= 1.15f;
21182 }
21183 num485 = num480 / num485;
21184 num483 *= num485;
21185 num484 *= num485;
21186 if (velocity.X < num483)
21187 {
21188 velocity.X += num481;
21189 if (velocity.X < 0f && num483 > 0f)
21190 {
21191 velocity.X += num481;
21192 }
21193 }
21194 else if (velocity.X > num483)
21195 {
21196 velocity.X -= num481;
21197 if (velocity.X > 0f && num483 < 0f)
21198 {
21199 velocity.X -= num481;
21200 }
21201 }
21202 if (velocity.Y < num484)
21203 {
21204 velocity.Y += num481;
21205 if (velocity.Y < 0f && num484 > 0f)
21206 {
21207 velocity.Y += num481;
21208 }
21209 }
21210 else if (velocity.Y > num484)
21211 {
21212 velocity.Y -= num481;
21213 if (velocity.Y > 0f && num484 < 0f)
21214 {
21215 velocity.Y -= num481;
21216 }
21217 }
21218 }
21219 int num486 = 400;
21220 if (IsMechQueenUp)
21221 {
21222 num486 = 1200;
21223 }
21224 this.ai[2] += 1f;
21225 if (this.ai[2] >= (float)num486)
21226 {
21227 this.ai[1] = 1f;
21228 this.ai[2] = 0f;
21229 this.ai[3] = 0f;
21230 target = 255;
21231 netUpdate = true;
21232 }
21233 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
21234 {
21235 localAI[2] += 1f;
21236 if (localAI[2] > 22f)
21237 {
21238 localAI[2] = 0f;
21240 }
21241 if (Main.netMode != 1)
21242 {
21243 localAI[1] += 1f;
21244 if ((double)life < (double)lifeMax * 0.75)
21245 {
21246 localAI[1] += 1f;
21247 }
21248 if ((double)life < (double)lifeMax * 0.5)
21249 {
21250 localAI[1] += 1f;
21251 }
21252 if ((double)life < (double)lifeMax * 0.25)
21253 {
21254 localAI[1] += 1f;
21255 }
21256 if ((double)life < (double)lifeMax * 0.1)
21257 {
21258 localAI[1] += 2f;
21259 }
21260 if (localAI[1] > 8f)
21261 {
21262 localAI[1] = 0f;
21263 float num487 = 6f;
21265 int num488 = 101;
21266 vector51 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21267 num483 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector51.X;
21268 num484 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector51.Y;
21269 num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484);
21270 num485 = num487 / num485;
21271 num483 *= num485;
21272 num484 *= num485;
21273 num484 += (float)Main.rand.Next(-40, 41) * 0.01f;
21274 num483 += (float)Main.rand.Next(-40, 41) * 0.01f;
21275 num484 += velocity.Y * 0.5f;
21276 num483 += velocity.X * 0.5f;
21277 vector51.X -= num483 * 1f;
21278 vector51.Y -= num484 * 1f;
21279 if (IsMechQueenUp)
21280 {
21281 Vector2 vector52 = (rotation + (float)Math.PI / 2f).ToRotationVector2() * num487 + velocity * 0.5f;
21282 num483 = vector52.X;
21283 num484 = vector52.Y;
21284 vector51 = base.Center - vector52 * 3f;
21285 }
21287 }
21288 }
21289 }
21290 if (IsMechQueenUp)
21291 {
21292 num480 = 14f;
21293 num483 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector51.X;
21294 num484 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 300f - vector51.Y;
21295 num483 = vector47.X;
21296 num484 = vector47.Y;
21297 num483 -= vector51.X;
21298 num484 -= vector51.Y;
21299 num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484);
21300 if (num485 > num480)
21301 {
21302 num485 = num480 / num485;
21303 num483 *= num485;
21304 num484 *= num485;
21305 }
21306 int num490 = 60;
21307 velocity.X = (velocity.X * (float)(num490 - 1) + num483) / (float)num490;
21308 velocity.Y = (velocity.Y * (float)(num490 - 1) + num484) / (float)num490;
21309 }
21310 }
21311 else if (this.ai[1] == 1f)
21312 {
21313 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
21314 rotation = num458;
21315 float num491 = 14f;
21316 if (Main.expertMode)
21317 {
21318 num491 += 2.5f;
21319 }
21320 Vector2 vector53 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21321 float num492 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector53.X;
21322 float num493 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector53.Y;
21323 float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493);
21324 num494 = num491 / num494;
21325 velocity.X = num492 * num494;
21326 velocity.Y = num493 * num494;
21327 this.ai[1] = 2f;
21328 }
21329 else
21330 {
21331 if (this.ai[1] != 2f)
21332 {
21333 return;
21334 }
21335 this.ai[2] += 1f;
21336 if (Main.expertMode)
21337 {
21338 this.ai[2] += 0.5f;
21339 }
21340 if (this.ai[2] >= 50f)
21341 {
21342 velocity.X *= 0.93f;
21343 velocity.Y *= 0.93f;
21344 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
21345 {
21346 velocity.X = 0f;
21347 }
21348 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
21349 {
21350 velocity.Y = 0f;
21351 }
21352 }
21353 else
21354 {
21355 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
21356 }
21357 if (this.ai[2] >= 80f)
21358 {
21359 this.ai[3] += 1f;
21360 this.ai[2] = 0f;
21361 target = 255;
21362 rotation = num458;
21363 if (this.ai[3] >= 6f)
21364 {
21365 this.ai[1] = 0f;
21366 this.ai[3] = 0f;
21367 }
21368 else
21369 {
21370 this.ai[1] = 1f;
21371 }
21372 }
21373 }
21374 }
21375 else if (aiStyle == 32)
21376 {
21377 damage = defDamage;
21379 if (this.ai[3] != 0f)
21380 {
21381 mechQueen = whoAmI;
21382 }
21383 reflectsProjectiles = false;
21384 if (this.ai[0] == 0f && Main.netMode != 1)
21385 {
21386 TargetClosest();
21387 this.ai[0] = 1f;
21388 int num495 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 128, whoAmI);
21389 Main.npc[num495].ai[0] = -1f;
21390 Main.npc[num495].ai[1] = whoAmI;
21391 Main.npc[num495].target = target;
21392 Main.npc[num495].netUpdate = true;
21393 num495 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 129, whoAmI);
21394 Main.npc[num495].ai[0] = 1f;
21395 Main.npc[num495].ai[1] = whoAmI;
21396 Main.npc[num495].target = target;
21397 Main.npc[num495].netUpdate = true;
21398 num495 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 130, whoAmI);
21399 Main.npc[num495].ai[0] = -1f;
21400 Main.npc[num495].ai[1] = whoAmI;
21401 Main.npc[num495].target = target;
21402 Main.npc[num495].ai[3] = 150f;
21403 Main.npc[num495].netUpdate = true;
21404 num495 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 131, whoAmI);
21405 Main.npc[num495].ai[0] = 1f;
21406 Main.npc[num495].ai[1] = whoAmI;
21407 Main.npc[num495].target = target;
21408 Main.npc[num495].netUpdate = true;
21409 Main.npc[num495].ai[3] = 150f;
21410 }
21411 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 6000f || Math.Abs(position.Y - Main.player[target].position.Y) > 6000f)
21412 {
21413 TargetClosest();
21414 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 6000f || Math.Abs(position.Y - Main.player[target].position.Y) > 6000f)
21415 {
21416 this.ai[1] = 3f;
21417 }
21418 }
21419 if (Main.IsItDay() && this.ai[1] != 3f && this.ai[1] != 2f)
21420 {
21421 this.ai[1] = 2f;
21422 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
21423 }
21424 if (this.ai[1] == 0f)
21425 {
21426 this.ai[2] += 1f;
21427 if (this.ai[2] >= 600f)
21428 {
21429 this.ai[2] = 0f;
21430 this.ai[1] = 1f;
21431 TargetClosest();
21432 netUpdate = true;
21433 }
21434 if (IsMechQueenUp)
21435 {
21436 rotation = rotation.AngleLerp(velocity.X / 15f * 0.5f, 0.75f);
21437 }
21438 else
21439 {
21440 rotation = velocity.X / 15f;
21441 }
21442 float num496 = 0.1f;
21443 float num497 = 2f;
21444 float num498 = 0.1f;
21445 float num499 = 8f;
21446 int num500 = 200;
21447 int num501 = 500;
21448 float num502 = 0f;
21449 int num503 = ((!(Main.player[target].Center.X < base.Center.X)) ? 1 : (-1));
21450 if (IsMechQueenUp)
21451 {
21452 num502 = -450f * (float)num503;
21453 num500 = 300;
21454 num501 = 350;
21455 }
21456 if (Main.expertMode)
21457 {
21458 num496 = 0.03f;
21459 num497 = 4f;
21460 num498 = 0.07f;
21461 num499 = 9.5f;
21462 }
21463 if (position.Y > Main.player[target].position.Y - (float)num500)
21464 {
21465 if (velocity.Y > 0f)
21466 {
21467 velocity.Y *= 0.98f;
21468 }
21469 velocity.Y -= num496;
21470 if (velocity.Y > num497)
21471 {
21472 velocity.Y = num497;
21473 }
21474 }
21475 else if (position.Y < Main.player[target].position.Y - (float)num501)
21476 {
21477 if (velocity.Y < 0f)
21478 {
21479 velocity.Y *= 0.98f;
21480 }
21481 velocity.Y += num496;
21482 if (velocity.Y < 0f - num497)
21483 {
21484 velocity.Y = 0f - num497;
21485 }
21486 }
21487 if (position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2) + 100f + num502)
21488 {
21489 if (velocity.X > 0f)
21490 {
21491 velocity.X *= 0.98f;
21492 }
21493 velocity.X -= num498;
21494 if (velocity.X > num499)
21495 {
21496 velocity.X = num499;
21497 }
21498 }
21499 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2) - 100f + num502)
21500 {
21501 if (velocity.X < 0f)
21502 {
21503 velocity.X *= 0.98f;
21504 }
21505 velocity.X += num498;
21506 if (velocity.X < 0f - num499)
21507 {
21508 velocity.X = 0f - num499;
21509 }
21510 }
21511 }
21512 else if (this.ai[1] == 1f)
21513 {
21514 defense *= 2;
21515 damage *= 2;
21516 this.ai[2] += 1f;
21517 if (this.ai[2] == 2f)
21518 {
21519 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
21520 }
21521 if (this.ai[2] >= 400f)
21522 {
21523 this.ai[2] = 0f;
21524 this.ai[1] = 0f;
21525 }
21526 if (IsMechQueenUp)
21527 {
21528 rotation = rotation.AngleLerp(velocity.X / 15f * 0.5f, 0.75f);
21529 }
21530 else
21531 {
21532 rotation += (float)direction * 0.3f;
21533 }
21534 Vector2 vector54 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21535 float num504 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector54.X;
21536 float num505 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector54.Y;
21537 float num506 = (float)Math.Sqrt(num504 * num504 + num505 * num505);
21538 float num507 = 2f;
21539 if (Main.expertMode)
21540 {
21541 num507 = 6f;
21542 if (num506 > 150f)
21543 {
21544 num507 *= 1.05f;
21545 }
21546 if (num506 > 200f)
21547 {
21548 num507 *= 1.1f;
21549 }
21550 if (num506 > 250f)
21551 {
21552 num507 *= 1.1f;
21553 }
21554 if (num506 > 300f)
21555 {
21556 num507 *= 1.1f;
21557 }
21558 if (num506 > 350f)
21559 {
21560 num507 *= 1.1f;
21561 }
21562 if (num506 > 400f)
21563 {
21564 num507 *= 1.1f;
21565 }
21566 if (num506 > 450f)
21567 {
21568 num507 *= 1.1f;
21569 }
21570 if (num506 > 500f)
21571 {
21572 num507 *= 1.1f;
21573 }
21574 if (num506 > 550f)
21575 {
21576 num507 *= 1.1f;
21577 }
21578 if (num506 > 600f)
21579 {
21580 num507 *= 1.1f;
21581 }
21582 }
21583 if (IsMechQueenUp)
21584 {
21585 float num508 = (npcsFoundForCheckActive[135] ? 0.6f : 0.75f);
21586 num507 *= num508;
21587 }
21588 num506 = num507 / num506;
21589 velocity.X = num504 * num506;
21590 velocity.Y = num505 * num506;
21591 if (IsMechQueenUp)
21592 {
21593 float num509 = Vector2.Distance(base.Center, Main.player[target].Center);
21594 if (num509 < 0.1f)
21595 {
21596 num509 = 0f;
21597 }
21598 if (num509 < num507)
21599 {
21600 velocity = velocity.SafeNormalize(Vector2.Zero) * num509;
21601 }
21602 }
21603 }
21604 else if (this.ai[1] == 2f)
21605 {
21606 damage = 1000;
21607 defense = 9999;
21608 if (IsMechQueenUp)
21609 {
21610 rotation = rotation.AngleLerp(velocity.X / 15f * 0.5f, 0.75f);
21611 }
21612 else
21613 {
21614 rotation += (float)direction * 0.3f;
21615 }
21616 Vector2 vector55 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21617 float num510 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector55.X;
21618 float num511 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector55.Y;
21619 float num512 = (float)Math.Sqrt(num510 * num510 + num511 * num511);
21620 float num513 = 10f;
21621 num513 += num512 / 100f;
21622 if (num513 < 8f)
21623 {
21624 num513 = 8f;
21625 }
21626 if (num513 > 32f)
21627 {
21628 num513 = 32f;
21629 }
21630 num512 = num513 / num512;
21631 velocity.X = num510 * num512;
21632 velocity.Y = num511 * num512;
21633 }
21634 else
21635 {
21636 if (this.ai[1] != 3f)
21637 {
21638 return;
21639 }
21640 if (IsMechQueenUp)
21641 {
21642 int num514 = FindFirstNPC(125);
21643 if (num514 >= 0)
21644 {
21645 Main.npc[num514].EncourageDespawn(5);
21646 }
21647 num514 = FindFirstNPC(126);
21648 if (num514 >= 0)
21649 {
21650 Main.npc[num514].EncourageDespawn(5);
21651 }
21652 if (!AnyNPCs(125) && !AnyNPCs(126))
21653 {
21654 num514 = FindFirstNPC(134);
21655 if (num514 >= 0)
21656 {
21657 Main.npc[num514].Transform(136);
21658 }
21660 }
21661 velocity.Y += 0.1f;
21662 if (velocity.Y < 0f)
21663 {
21664 velocity.Y *= 0.95f;
21665 }
21666 velocity.X *= 0.95f;
21667 if (velocity.Y > 13f)
21668 {
21669 velocity.Y = 13f;
21670 }
21671 }
21672 else
21673 {
21674 EncourageDespawn(500);
21675 velocity.Y += 0.1f;
21676 if (velocity.Y < 0f)
21677 {
21678 velocity.Y *= 0.95f;
21679 }
21680 velocity.X *= 0.95f;
21681 }
21682 }
21683 }
21684 else if (aiStyle == 33)
21685 {
21686 Vector2 vector56 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21687 float num515 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector56.X;
21688 float num516 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector56.Y;
21689 float num517 = (float)Math.Sqrt(num515 * num515 + num516 * num516);
21690 if (this.ai[2] != 99f)
21691 {
21692 if (num517 > 800f)
21693 {
21694 this.ai[2] = 99f;
21695 }
21696 }
21697 else if (num517 < 400f)
21698 {
21699 this.ai[2] = 0f;
21700 }
21701 spriteDirection = -(int)this.ai[0];
21702 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
21703 {
21704 this.ai[2] += 10f;
21705 if (this.ai[2] > 50f || Main.netMode != 2)
21706 {
21707 life = -1;
21708 HitEffect();
21709 active = false;
21710 }
21711 }
21712 if (this.ai[2] == 99f)
21713 {
21714 if (position.Y > Main.npc[(int)this.ai[1]].position.Y)
21715 {
21716 if (velocity.Y > 0f)
21717 {
21718 velocity.Y *= 0.96f;
21719 }
21720 velocity.Y -= 0.1f;
21721 if (velocity.Y > 8f)
21722 {
21723 velocity.Y = 8f;
21724 }
21725 }
21726 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y)
21727 {
21728 if (velocity.Y < 0f)
21729 {
21730 velocity.Y *= 0.96f;
21731 }
21732 velocity.Y += 0.1f;
21733 if (velocity.Y < -8f)
21734 {
21735 velocity.Y = -8f;
21736 }
21737 }
21738 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
21739 {
21740 if (velocity.X > 0f)
21741 {
21742 velocity.X *= 0.96f;
21743 }
21744 velocity.X -= 0.5f;
21745 if (velocity.X > 12f)
21746 {
21747 velocity.X = 12f;
21748 }
21749 }
21750 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
21751 {
21752 if (velocity.X < 0f)
21753 {
21754 velocity.X *= 0.96f;
21755 }
21756 velocity.X += 0.5f;
21757 if (velocity.X < -12f)
21758 {
21759 velocity.X = -12f;
21760 }
21761 }
21762 }
21763 else if (this.ai[2] == 0f || this.ai[2] == 3f)
21764 {
21765 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
21766 {
21767 EncourageDespawn(10);
21768 }
21769 if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
21770 {
21771 TargetClosest();
21772 if (Main.player[target].dead)
21773 {
21774 velocity.Y += 0.1f;
21775 if (velocity.Y > 16f)
21776 {
21777 velocity.Y = 16f;
21778 }
21779 }
21780 else
21781 {
21782 Vector2 vector57 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21783 float num518 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector57.X;
21784 float num519 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector57.Y;
21785 float num520 = (float)Math.Sqrt(num518 * num518 + num519 * num519);
21786 num520 = 7f / num520;
21787 num518 *= num520;
21788 num519 *= num520;
21789 rotation = (float)Math.Atan2(num519, num518) - 1.57f;
21790 if (velocity.X > num518)
21791 {
21792 if (velocity.X > 0f)
21793 {
21794 velocity.X *= 0.97f;
21795 }
21796 velocity.X -= 0.05f;
21797 }
21798 if (velocity.X < num518)
21799 {
21800 if (velocity.X < 0f)
21801 {
21802 velocity.X *= 0.97f;
21803 }
21804 velocity.X += 0.05f;
21805 }
21806 if (velocity.Y > num519)
21807 {
21808 if (velocity.Y > 0f)
21809 {
21810 velocity.Y *= 0.97f;
21811 }
21812 velocity.Y -= 0.05f;
21813 }
21814 if (velocity.Y < num519)
21815 {
21816 if (velocity.Y < 0f)
21817 {
21818 velocity.Y *= 0.97f;
21819 }
21820 velocity.Y += 0.05f;
21821 }
21822 }
21823 this.ai[3] += 1f;
21824 if (this.ai[3] >= 600f)
21825 {
21826 this.ai[2] = 0f;
21827 this.ai[3] = 0f;
21828 netUpdate = true;
21829 }
21830 }
21831 else
21832 {
21833 this.ai[3] += 1f;
21834 if (this.ai[3] >= 300f)
21835 {
21836 this.ai[2] += 1f;
21837 this.ai[3] = 0f;
21838 netUpdate = true;
21839 }
21840 if (position.Y > Main.npc[(int)this.ai[1]].position.Y + 320f)
21841 {
21842 if (velocity.Y > 0f)
21843 {
21844 velocity.Y *= 0.96f;
21845 }
21846 velocity.Y -= 0.04f;
21847 if (velocity.Y > 3f)
21848 {
21849 velocity.Y = 3f;
21850 }
21851 }
21852 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y + 260f)
21853 {
21854 if (velocity.Y < 0f)
21855 {
21856 velocity.Y *= 0.96f;
21857 }
21858 velocity.Y += 0.04f;
21859 if (velocity.Y < -3f)
21860 {
21861 velocity.Y = -3f;
21862 }
21863 }
21864 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
21865 {
21866 if (velocity.X > 0f)
21867 {
21868 velocity.X *= 0.96f;
21869 }
21870 velocity.X -= 0.3f;
21871 if (velocity.X > 12f)
21872 {
21873 velocity.X = 12f;
21874 }
21875 }
21876 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 250f)
21877 {
21878 if (velocity.X < 0f)
21879 {
21880 velocity.X *= 0.96f;
21881 }
21882 velocity.X += 0.3f;
21883 if (velocity.X < -12f)
21884 {
21885 velocity.X = -12f;
21886 }
21887 }
21888 }
21889 Vector2 vector58 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21890 float num521 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector58.X;
21891 float num522 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector58.Y;
21892 float num523 = (float)Math.Sqrt(num521 * num521 + num522 * num522);
21893 rotation = (float)Math.Atan2(num522, num521) + 1.57f;
21894 }
21895 else if (this.ai[2] == 1f)
21896 {
21897 Vector2 vector59 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21898 float num524 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector59.X;
21899 float num525 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector59.Y;
21900 float num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525);
21901 rotation = (float)Math.Atan2(num525, num524) + 1.57f;
21902 velocity.X *= 0.95f;
21903 velocity.Y -= 0.1f;
21904 if (velocity.Y < -8f)
21905 {
21906 velocity.Y = -8f;
21907 }
21908 if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f)
21909 {
21910 TargetClosest();
21911 this.ai[2] = 2f;
21912 vector59 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21913 num524 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector59.X;
21914 num525 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector59.Y;
21915 num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525);
21916 num526 = 22f / num526;
21917 velocity.X = num524 * num526;
21918 velocity.Y = num525 * num526;
21919 netUpdate = true;
21920 }
21921 }
21922 else if (this.ai[2] == 2f)
21923 {
21924 if (position.Y > Main.player[target].position.Y || velocity.Y < 0f)
21925 {
21926 this.ai[2] = 3f;
21927 }
21928 }
21929 else if (this.ai[2] == 4f)
21930 {
21931 TargetClosest();
21932 Vector2 vector60 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21933 float num527 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector60.X;
21934 float num528 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector60.Y;
21935 float num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528);
21936 num529 = 7f / num529;
21937 num527 *= num529;
21938 num528 *= num529;
21939 if (velocity.X > num527)
21940 {
21941 if (velocity.X > 0f)
21942 {
21943 velocity.X *= 0.97f;
21944 }
21945 velocity.X -= 0.05f;
21946 }
21947 if (velocity.X < num527)
21948 {
21949 if (velocity.X < 0f)
21950 {
21951 velocity.X *= 0.97f;
21952 }
21953 velocity.X += 0.05f;
21954 }
21955 if (velocity.Y > num528)
21956 {
21957 if (velocity.Y > 0f)
21958 {
21959 velocity.Y *= 0.97f;
21960 }
21961 velocity.Y -= 0.05f;
21962 }
21963 if (velocity.Y < num528)
21964 {
21965 if (velocity.Y < 0f)
21966 {
21967 velocity.Y *= 0.97f;
21968 }
21969 velocity.Y += 0.05f;
21970 }
21971 this.ai[3] += 1f;
21972 if (this.ai[3] >= 600f)
21973 {
21974 this.ai[2] = 0f;
21975 this.ai[3] = 0f;
21976 netUpdate = true;
21977 }
21978 vector60 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21979 num527 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector60.X;
21980 num528 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector60.Y;
21981 num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528);
21982 rotation = (float)Math.Atan2(num528, num527) + 1.57f;
21983 }
21984 else if (this.ai[2] == 5f && ((velocity.X > 0f && position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2)) || (velocity.X < 0f && position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2))))
21985 {
21986 this.ai[2] = 0f;
21987 }
21988 }
21989 else if (aiStyle == 34)
21990 {
21991 spriteDirection = -(int)this.ai[0];
21992 Vector2 vector61 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
21993 float num530 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector61.X;
21994 float num531 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector61.Y;
21995 float num532 = (float)Math.Sqrt(num530 * num530 + num531 * num531);
21996 if (this.ai[2] != 99f)
21997 {
21998 if (num532 > 800f)
21999 {
22000 this.ai[2] = 99f;
22001 }
22002 }
22003 else if (num532 < 400f)
22004 {
22005 this.ai[2] = 0f;
22006 }
22007 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
22008 {
22009 this.ai[2] += 10f;
22010 if (this.ai[2] > 50f || Main.netMode != 2)
22011 {
22012 life = -1;
22013 HitEffect();
22014 active = false;
22015 }
22016 }
22017 if (this.ai[2] == 99f)
22018 {
22019 if (position.Y > Main.npc[(int)this.ai[1]].position.Y)
22020 {
22021 if (velocity.Y > 0f)
22022 {
22023 velocity.Y *= 0.96f;
22024 }
22025 velocity.Y -= 0.1f;
22026 if (velocity.Y > 8f)
22027 {
22028 velocity.Y = 8f;
22029 }
22030 }
22031 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y)
22032 {
22033 if (velocity.Y < 0f)
22034 {
22035 velocity.Y *= 0.96f;
22036 }
22037 velocity.Y += 0.1f;
22038 if (velocity.Y < -8f)
22039 {
22040 velocity.Y = -8f;
22041 }
22042 }
22043 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
22044 {
22045 if (velocity.X > 0f)
22046 {
22047 velocity.X *= 0.96f;
22048 }
22049 velocity.X -= 0.5f;
22050 if (velocity.X > 12f)
22051 {
22052 velocity.X = 12f;
22053 }
22054 }
22055 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
22056 {
22057 if (velocity.X < 0f)
22058 {
22059 velocity.X *= 0.96f;
22060 }
22061 velocity.X += 0.5f;
22062 if (velocity.X < -12f)
22063 {
22064 velocity.X = -12f;
22065 }
22066 }
22067 }
22068 else if (this.ai[2] == 0f || this.ai[2] == 3f)
22069 {
22070 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
22071 {
22072 EncourageDespawn(10);
22073 }
22074 if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
22075 {
22076 TargetClosest();
22077 TargetClosest();
22078 if (Main.player[target].dead)
22079 {
22080 velocity.Y += 0.1f;
22081 if (velocity.Y > 16f)
22082 {
22083 velocity.Y = 16f;
22084 }
22085 }
22086 else
22087 {
22088 Vector2 vector62 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22089 float num533 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector62.X;
22090 float num534 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector62.Y;
22091 float num535 = (float)Math.Sqrt(num533 * num533 + num534 * num534);
22092 num535 = 12f / num535;
22093 num533 *= num535;
22094 num534 *= num535;
22095 rotation = (float)Math.Atan2(num534, num533) - 1.57f;
22096 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 2f)
22097 {
22098 rotation = (float)Math.Atan2(num534, num533) - 1.57f;
22099 velocity.X = num533;
22100 velocity.Y = num534;
22101 netUpdate = true;
22102 }
22103 else
22104 {
22105 velocity *= 0.97f;
22106 }
22107 this.ai[3] += 1f;
22108 if (this.ai[3] >= 600f)
22109 {
22110 this.ai[2] = 0f;
22111 this.ai[3] = 0f;
22112 netUpdate = true;
22113 }
22114 }
22115 }
22116 else
22117 {
22118 this.ai[3] += 1f;
22119 if (this.ai[3] >= 600f)
22120 {
22121 this.ai[2] += 1f;
22122 this.ai[3] = 0f;
22123 netUpdate = true;
22124 }
22125 if (position.Y > Main.npc[(int)this.ai[1]].position.Y + 300f)
22126 {
22127 if (velocity.Y > 0f)
22128 {
22129 velocity.Y *= 0.96f;
22130 }
22131 velocity.Y -= 0.1f;
22132 if (velocity.Y > 3f)
22133 {
22134 velocity.Y = 3f;
22135 }
22136 }
22137 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f)
22138 {
22139 if (velocity.Y < 0f)
22140 {
22141 velocity.Y *= 0.96f;
22142 }
22143 velocity.Y += 0.1f;
22144 if (velocity.Y < -3f)
22145 {
22146 velocity.Y = -3f;
22147 }
22148 }
22149 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 250f)
22150 {
22151 if (velocity.X > 0f)
22152 {
22153 velocity.X *= 0.94f;
22154 }
22155 velocity.X -= 0.3f;
22156 if (velocity.X > 9f)
22157 {
22158 velocity.X = 9f;
22159 }
22160 }
22161 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
22162 {
22163 if (velocity.X < 0f)
22164 {
22165 velocity.X *= 0.94f;
22166 }
22167 velocity.X += 0.2f;
22168 if (velocity.X < -8f)
22169 {
22170 velocity.X = -8f;
22171 }
22172 }
22173 }
22174 Vector2 vector63 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22175 float num536 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector63.X;
22176 float num537 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector63.Y;
22177 float num538 = (float)Math.Sqrt(num536 * num536 + num537 * num537);
22178 rotation = (float)Math.Atan2(num537, num536) + 1.57f;
22179 }
22180 else if (this.ai[2] == 1f)
22181 {
22182 if (velocity.Y > 0f)
22183 {
22184 velocity.Y *= 0.9f;
22185 }
22186 Vector2 vector64 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22187 float num539 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 280f * this.ai[0] - vector64.X;
22188 float num540 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector64.Y;
22189 float num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540);
22190 rotation = (float)Math.Atan2(num540, num539) + 1.57f;
22191 velocity.X = (velocity.X * 5f + Main.npc[(int)this.ai[1]].velocity.X) / 6f;
22192 velocity.X += 0.5f;
22193 velocity.Y -= 0.5f;
22194 if (velocity.Y < -9f)
22195 {
22196 velocity.Y = -9f;
22197 }
22198 if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 280f)
22199 {
22200 TargetClosest();
22201 this.ai[2] = 2f;
22202 vector64 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22203 num539 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector64.X;
22204 num540 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector64.Y;
22205 num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540);
22206 num541 = 20f / num541;
22207 velocity.X = num539 * num541;
22208 velocity.Y = num540 * num541;
22209 netUpdate = true;
22210 }
22211 }
22212 else if (this.ai[2] == 2f)
22213 {
22214 if (position.Y > Main.player[target].position.Y || velocity.Y < 0f)
22215 {
22216 if (this.ai[3] >= 4f)
22217 {
22218 this.ai[2] = 3f;
22219 this.ai[3] = 0f;
22220 }
22221 else
22222 {
22223 this.ai[2] = 1f;
22224 this.ai[3] += 1f;
22225 }
22226 }
22227 }
22228 else if (this.ai[2] == 4f)
22229 {
22230 Vector2 vector65 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22231 float num542 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector65.X;
22232 float num543 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector65.Y;
22233 float num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543);
22234 rotation = (float)Math.Atan2(num543, num542) + 1.57f;
22235 velocity.Y = (velocity.Y * 5f + Main.npc[(int)this.ai[1]].velocity.Y) / 6f;
22236 velocity.X += 0.5f;
22237 if (velocity.X > 12f)
22238 {
22239 velocity.X = 12f;
22240 }
22241 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f)
22242 {
22243 TargetClosest();
22244 this.ai[2] = 5f;
22245 vector65 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22246 num542 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector65.X;
22247 num543 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector65.Y;
22248 num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543);
22249 num544 = 17f / num544;
22250 velocity.X = num542 * num544;
22251 velocity.Y = num543 * num544;
22252 netUpdate = true;
22253 }
22254 }
22255 else if (this.ai[2] == 5f && position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2) - 100f)
22256 {
22257 if (this.ai[3] >= 4f)
22258 {
22259 this.ai[2] = 0f;
22260 this.ai[3] = 0f;
22261 }
22262 else
22263 {
22264 this.ai[2] = 4f;
22265 this.ai[3] += 1f;
22266 }
22267 }
22268 }
22269 else if (aiStyle == 35)
22270 {
22271 spriteDirection = -(int)this.ai[0];
22272 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
22273 {
22274 this.ai[2] += 10f;
22275 if (this.ai[2] > 50f || Main.netMode != 2)
22276 {
22277 life = -1;
22278 HitEffect();
22279 active = false;
22280 }
22281 }
22282 if (this.ai[2] == 0f)
22283 {
22284 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
22285 {
22286 EncourageDespawn(10);
22287 }
22288 if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
22289 {
22290 localAI[0] += 2f;
22291 if (position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
22292 {
22293 if (velocity.Y > 0f)
22294 {
22295 velocity.Y *= 0.96f;
22296 }
22297 velocity.Y -= 0.07f;
22298 if (velocity.Y > 6f)
22299 {
22300 velocity.Y = 6f;
22301 }
22302 }
22303 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
22304 {
22305 if (velocity.Y < 0f)
22306 {
22307 velocity.Y *= 0.96f;
22308 }
22309 velocity.Y += 0.07f;
22310 if (velocity.Y < -6f)
22311 {
22312 velocity.Y = -6f;
22313 }
22314 }
22315 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
22316 {
22317 if (velocity.X > 0f)
22318 {
22319 velocity.X *= 0.96f;
22320 }
22321 velocity.X -= 0.1f;
22322 if (velocity.X > 8f)
22323 {
22324 velocity.X = 8f;
22325 }
22326 }
22327 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
22328 {
22329 if (velocity.X < 0f)
22330 {
22331 velocity.X *= 0.96f;
22332 }
22333 velocity.X += 0.1f;
22334 if (velocity.X < -8f)
22335 {
22336 velocity.X = -8f;
22337 }
22338 }
22339 }
22340 else
22341 {
22342 this.ai[3] += 1f;
22343 if (this.ai[3] >= 1100f)
22344 {
22345 localAI[0] = 0f;
22346 this.ai[2] = 1f;
22347 this.ai[3] = 0f;
22348 netUpdate = true;
22349 }
22350 if (position.Y > Main.npc[(int)this.ai[1]].position.Y - 150f)
22351 {
22352 if (velocity.Y > 0f)
22353 {
22354 velocity.Y *= 0.96f;
22355 }
22356 velocity.Y -= 0.04f;
22357 if (velocity.Y > 3f)
22358 {
22359 velocity.Y = 3f;
22360 }
22361 }
22362 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 150f)
22363 {
22364 if (velocity.Y < 0f)
22365 {
22366 velocity.Y *= 0.96f;
22367 }
22368 velocity.Y += 0.04f;
22369 if (velocity.Y < -3f)
22370 {
22371 velocity.Y = -3f;
22372 }
22373 }
22374 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 200f)
22375 {
22376 if (velocity.X > 0f)
22377 {
22378 velocity.X *= 0.96f;
22379 }
22380 velocity.X -= 0.2f;
22381 if (velocity.X > 8f)
22382 {
22383 velocity.X = 8f;
22384 }
22385 }
22386 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 160f)
22387 {
22388 if (velocity.X < 0f)
22389 {
22390 velocity.X *= 0.96f;
22391 }
22392 velocity.X += 0.2f;
22393 if (velocity.X < -8f)
22394 {
22395 velocity.X = -8f;
22396 }
22397 }
22398 }
22399 Vector2 vector66 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22400 float num545 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector66.X;
22401 float num546 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector66.Y;
22402 float num547 = (float)Math.Sqrt(num545 * num545 + num546 * num546);
22403 rotation = (float)Math.Atan2(num546, num545) + 1.57f;
22404 if (Main.netMode != 1)
22405 {
22406 localAI[0] += 1f;
22407 if (localAI[0] > 140f)
22408 {
22409 localAI[0] = 0f;
22410 float num548 = 12f;
22411 int num549 = 0;
22412 int num550 = 102;
22413 num547 = num548 / num547;
22414 num545 = (0f - num545) * num547;
22415 num546 = (0f - num546) * num547;
22416 num545 += (float)Main.rand.Next(-40, 41) * 0.01f;
22417 num546 += (float)Main.rand.Next(-40, 41) * 0.01f;
22418 vector66.X += num545 * 4f;
22419 vector66.Y += num546 * 4f;
22421 }
22422 }
22423 }
22424 else
22425 {
22426 if (this.ai[2] != 1f)
22427 {
22428 return;
22429 }
22430 this.ai[3] += 1f;
22431 if (this.ai[3] >= 300f)
22432 {
22433 localAI[0] = 0f;
22434 this.ai[2] = 0f;
22435 this.ai[3] = 0f;
22436 netUpdate = true;
22437 }
22438 Vector2 vector67 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22439 float num552 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector67.X;
22440 float num553 = Main.npc[(int)this.ai[1]].position.Y - vector67.Y;
22441 num553 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 80f - vector67.Y;
22442 float num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553);
22443 num554 = 6f / num554;
22444 num552 *= num554;
22445 num553 *= num554;
22446 if (velocity.X > num552)
22447 {
22448 if (velocity.X > 0f)
22449 {
22450 velocity.X *= 0.9f;
22451 }
22452 velocity.X -= 0.04f;
22453 }
22454 if (velocity.X < num552)
22455 {
22456 if (velocity.X < 0f)
22457 {
22458 velocity.X *= 0.9f;
22459 }
22460 velocity.X += 0.04f;
22461 }
22462 if (velocity.Y > num553)
22463 {
22464 if (velocity.Y > 0f)
22465 {
22466 velocity.Y *= 0.9f;
22467 }
22468 velocity.Y -= 0.08f;
22469 }
22470 if (velocity.Y < num553)
22471 {
22472 if (velocity.Y < 0f)
22473 {
22474 velocity.Y *= 0.9f;
22475 }
22476 velocity.Y += 0.08f;
22477 }
22478 TargetClosest();
22479 vector67 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22480 num552 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector67.X;
22481 num553 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector67.Y;
22482 num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553);
22483 rotation = (float)Math.Atan2(num553, num552) - 1.57f;
22484 if (Main.netMode != 1)
22485 {
22486 localAI[0] += 1f;
22487 if (localAI[0] > 40f)
22488 {
22489 localAI[0] = 0f;
22490 float num555 = 10f;
22491 int num556 = 0;
22492 int num557 = 102;
22493 num554 = num555 / num554;
22494 num552 *= num554;
22495 num553 *= num554;
22496 num552 += (float)Main.rand.Next(-40, 41) * 0.01f;
22497 num553 += (float)Main.rand.Next(-40, 41) * 0.01f;
22498 vector67.X += num552 * 4f;
22499 vector67.Y += num553 * 4f;
22501 }
22502 }
22503 }
22504 }
22505 else if (aiStyle == 36)
22506 {
22507 spriteDirection = -(int)this.ai[0];
22508 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
22509 {
22510 this.ai[2] += 10f;
22511 if (this.ai[2] > 50f || Main.netMode != 2)
22512 {
22513 life = -1;
22514 HitEffect();
22515 active = false;
22516 }
22517 }
22518 if (this.ai[2] == 0f || this.ai[2] == 3f)
22519 {
22520 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
22521 {
22522 EncourageDespawn(10);
22523 }
22524 if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
22525 {
22526 localAI[0] += 3f;
22527 if (position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
22528 {
22529 if (velocity.Y > 0f)
22530 {
22531 velocity.Y *= 0.96f;
22532 }
22533 velocity.Y -= 0.07f;
22534 if (velocity.Y > 6f)
22535 {
22536 velocity.Y = 6f;
22537 }
22538 }
22539 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
22540 {
22541 if (velocity.Y < 0f)
22542 {
22543 velocity.Y *= 0.96f;
22544 }
22545 velocity.Y += 0.07f;
22546 if (velocity.Y < -6f)
22547 {
22548 velocity.Y = -6f;
22549 }
22550 }
22551 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
22552 {
22553 if (velocity.X > 0f)
22554 {
22555 velocity.X *= 0.96f;
22556 }
22557 velocity.X -= 0.1f;
22558 if (velocity.X > 8f)
22559 {
22560 velocity.X = 8f;
22561 }
22562 }
22563 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
22564 {
22565 if (velocity.X < 0f)
22566 {
22567 velocity.X *= 0.96f;
22568 }
22569 velocity.X += 0.1f;
22570 if (velocity.X < -8f)
22571 {
22572 velocity.X = -8f;
22573 }
22574 }
22575 }
22576 else
22577 {
22578 this.ai[3] += 1f;
22579 if (this.ai[3] >= 800f)
22580 {
22581 this.ai[2] += 1f;
22582 this.ai[3] = 0f;
22583 netUpdate = true;
22584 }
22585 if (position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
22586 {
22587 if (velocity.Y > 0f)
22588 {
22589 velocity.Y *= 0.96f;
22590 }
22591 velocity.Y -= 0.1f;
22592 if (velocity.Y > 3f)
22593 {
22594 velocity.Y = 3f;
22595 }
22596 }
22597 else if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
22598 {
22599 if (velocity.Y < 0f)
22600 {
22601 velocity.Y *= 0.96f;
22602 }
22603 velocity.Y += 0.1f;
22604 if (velocity.Y < -3f)
22605 {
22606 velocity.Y = -3f;
22607 }
22608 }
22609 if (position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0])
22610 {
22611 if (velocity.X > 0f)
22612 {
22613 velocity.X *= 0.96f;
22614 }
22615 velocity.X -= 0.14f;
22616 if (velocity.X > 8f)
22617 {
22618 velocity.X = 8f;
22619 }
22620 }
22621 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0])
22622 {
22623 if (velocity.X < 0f)
22624 {
22625 velocity.X *= 0.96f;
22626 }
22627 velocity.X += 0.14f;
22628 if (velocity.X < -8f)
22629 {
22630 velocity.X = -8f;
22631 }
22632 }
22633 }
22634 TargetClosest();
22635 Vector2 vector68 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22636 float num559 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector68.X;
22637 float num560 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector68.Y;
22638 float num561 = (float)Math.Sqrt(num559 * num559 + num560 * num560);
22639 rotation = (float)Math.Atan2(num560, num559) - 1.57f;
22640 if (Main.netMode != 1)
22641 {
22642 localAI[0] += 1f;
22643 if (localAI[0] > 200f)
22644 {
22645 localAI[0] = 0f;
22646 float num562 = 8f;
22647 int num563 = 25;
22648 int num564 = 100;
22649 num561 = num562 / num561;
22650 num559 *= num561;
22651 num560 *= num561;
22652 num559 += (float)Main.rand.Next(-40, 41) * 0.05f;
22653 num560 += (float)Main.rand.Next(-40, 41) * 0.05f;
22654 vector68.X += num559 * 8f;
22655 vector68.Y += num560 * 8f;
22657 }
22658 }
22659 }
22660 else
22661 {
22662 if (this.ai[2] != 1f)
22663 {
22664 return;
22665 }
22666 this.ai[3] += 1f;
22667 if (this.ai[3] >= 200f)
22668 {
22669 localAI[0] = 0f;
22670 this.ai[2] = 0f;
22671 this.ai[3] = 0f;
22672 netUpdate = true;
22673 }
22674 Vector2 vector69 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22675 float num566 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - 350f - vector69.X;
22676 float num567 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 20f - vector69.Y;
22677 float num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567);
22678 num568 = 7f / num568;
22679 num566 *= num568;
22680 num567 *= num568;
22681 if (velocity.X > num566)
22682 {
22683 if (velocity.X > 0f)
22684 {
22685 velocity.X *= 0.9f;
22686 }
22687 velocity.X -= 0.1f;
22688 }
22689 if (velocity.X < num566)
22690 {
22691 if (velocity.X < 0f)
22692 {
22693 velocity.X *= 0.9f;
22694 }
22695 velocity.X += 0.1f;
22696 }
22697 if (velocity.Y > num567)
22698 {
22699 if (velocity.Y > 0f)
22700 {
22701 velocity.Y *= 0.9f;
22702 }
22703 velocity.Y -= 0.03f;
22704 }
22705 if (velocity.Y < num567)
22706 {
22707 if (velocity.Y < 0f)
22708 {
22709 velocity.Y *= 0.9f;
22710 }
22711 velocity.Y += 0.03f;
22712 }
22713 TargetClosest();
22714 vector69 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22715 num566 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector69.X;
22716 num567 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector69.Y;
22717 num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567);
22718 rotation = (float)Math.Atan2(num567, num566) - 1.57f;
22719 if (Main.netMode == 1)
22720 {
22721 localAI[0] += 1f;
22722 if (localAI[0] > 80f)
22723 {
22724 localAI[0] = 0f;
22725 float num569 = 10f;
22726 int num570 = 25;
22727 int num571 = 100;
22728 num568 = num569 / num568;
22729 num566 *= num568;
22730 num567 *= num568;
22731 num566 += (float)Main.rand.Next(-40, 41) * 0.05f;
22732 num567 += (float)Main.rand.Next(-40, 41) * 0.05f;
22733 vector69.X += num566 * 8f;
22734 vector69.Y += num567 * 8f;
22736 }
22737 }
22738 }
22739 }
22740 else if (aiStyle == 37)
22741 {
22743 }
22744 else if (aiStyle == 38)
22745 {
22746 float num573 = 4f;
22747 float num574 = 1f;
22748 if (type == 143)
22749 {
22750 num573 = 3f;
22751 num574 = 0.7f;
22752 }
22753 if (type == 145)
22754 {
22755 num573 = 3.5f;
22756 num574 = 0.8f;
22757 }
22758 if (type == 143)
22759 {
22760 this.ai[2] += 1f;
22761 if (this.ai[2] >= 120f)
22762 {
22763 this.ai[2] = 0f;
22764 if (Main.netMode != 1)
22765 {
22766 Vector2 vector70 = new Vector2(position.X + (float)width * 0.5f - (float)(direction * 12), position.Y + (float)height * 0.5f);
22767 float speedX = 12 * spriteDirection;
22768 float speedY = 0f;
22769 if (Main.netMode != 1)
22770 {
22771 int num575 = 25;
22772 int num576 = 110;
22774 Main.projectile[num577].ai[0] = 2f;
22775 Main.projectile[num577].timeLeft = 300;
22776 Main.projectile[num577].friendly = false;
22777 NetMessage.SendData(27, -1, -1, null, num577);
22778 netUpdate = true;
22779 }
22780 }
22781 }
22782 }
22783 if (type == 144 && this.ai[1] >= 3f)
22784 {
22785 TargetClosest();
22787 if (velocity.Y == 0f)
22788 {
22789 velocity.X *= 0.9f;
22790 this.ai[2] += 1f;
22791 if ((double)velocity.X > -0.3 && (double)velocity.X < 0.3)
22792 {
22793 velocity.X = 0f;
22794 }
22795 if (this.ai[2] >= 200f)
22796 {
22797 this.ai[2] = 0f;
22798 this.ai[1] = 0f;
22799 }
22800 }
22801 }
22802 else if (type == 145 && this.ai[1] >= 3f)
22803 {
22804 TargetClosest();
22805 if (velocity.Y == 0f)
22806 {
22807 velocity.X *= 0.9f;
22808 this.ai[2] += 1f;
22809 if ((double)velocity.X > -0.3 && (double)velocity.X < 0.3)
22810 {
22811 velocity.X = 0f;
22812 }
22813 if (this.ai[2] >= 16f)
22814 {
22815 this.ai[2] = 0f;
22816 this.ai[1] = 0f;
22817 }
22818 }
22819 if (velocity.X == 0f && velocity.Y == 0f && this.ai[2] == 8f)
22820 {
22821 float num578 = 10f;
22822 Vector2 vector71 = new Vector2(position.X + (float)width * 0.5f - (float)(direction * 12), position.Y + (float)height * 0.25f);
22823 float num579 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector71.X;
22824 float num580 = Main.player[target].position.Y - vector71.Y;
22825 float num581 = (float)Math.Sqrt(num579 * num579 + num580 * num580);
22826 num581 = num578 / num581;
22827 num579 *= num581;
22828 num580 *= num581;
22829 if (Main.netMode != 1)
22830 {
22831 int num582 = 35;
22832 int num583 = 109;
22834 Main.projectile[num584].ai[0] = 2f;
22835 Main.projectile[num584].timeLeft = 300;
22836 Main.projectile[num584].friendly = false;
22837 NetMessage.SendData(27, -1, -1, null, num584);
22838 netUpdate = true;
22839 }
22840 }
22841 }
22842 else
22843 {
22844 if (velocity.Y == 0f)
22845 {
22846 if (localAI[2] == position.X)
22847 {
22848 direction *= -1;
22849 this.ai[3] = 60f;
22850 }
22851 localAI[2] = position.X;
22852 if (this.ai[3] == 0f)
22853 {
22854 TargetClosest();
22855 }
22856 this.ai[0] += 1f;
22857 if (this.ai[0] > 2f)
22858 {
22859 this.ai[0] = 0f;
22860 this.ai[1] += 1f;
22861 velocity.Y = -8.2f;
22862 velocity.X += (float)direction * num574 * 1.1f;
22863 }
22864 else
22865 {
22866 velocity.Y = -6f;
22867 velocity.X += (float)direction * num574 * 0.9f;
22868 }
22870 }
22871 velocity.X += (float)direction * num574 * 0.01f;
22872 }
22873 if (this.ai[3] > 0f)
22874 {
22875 this.ai[3] -= 1f;
22876 }
22877 if (velocity.X > num573 && direction > 0)
22878 {
22879 velocity.X = num573;
22880 }
22881 if (velocity.X < 0f - num573 && direction < 0)
22882 {
22883 velocity.X = 0f - num573;
22884 }
22885 }
22886 else if (aiStyle == 39)
22887 {
22888 if (target < 0 || Main.player[target].dead || direction == 0)
22889 {
22890 TargetClosest();
22891 }
22892 bool flag28 = true;
22893 int num585 = 0;
22894 if (velocity.X < 0f)
22895 {
22896 num585 = -1;
22897 }
22898 if (velocity.X > 0f)
22899 {
22900 num585 = 1;
22901 }
22903 vector72.X += velocity.X;
22904 int num586 = (int)((vector72.X + (float)(width / 2) + (float)((width / 2 + 1) * num585)) / 16f);
22905 int num587 = (int)((vector72.Y + (float)height - 1f) / 16f);
22906 if ((float)(num586 * 16) < vector72.X + (float)width && (float)(num586 * 16 + 16) > vector72.X)
22907 {
22914 if (((tileSafely6.nactive() && !tileSafely6.topSlope() && !tileSafely5.topSlope() && ((Main.tileSolid[tileSafely6.type] && !Main.tileSolidTop[tileSafely6.type]) || (flag28 && Main.tileSolidTop[tileSafely6.type] && (!Main.tileSolid[tileSafely5.type] || !tileSafely5.nactive()) && tileSafely6.type != 16 && tileSafely6.type != 18 && tileSafely6.type != 134))) || (tileSafely5.halfBrick() && tileSafely5.nactive())) && (!tileSafely5.nactive() || !Main.tileSolid[tileSafely5.type] || Main.tileSolidTop[tileSafely5.type] || (tileSafely5.halfBrick() && (!tileSafely.nactive() || !Main.tileSolid[tileSafely.type] || Main.tileSolidTop[tileSafely.type]))) && (!tileSafely4.nactive() || !Main.tileSolid[tileSafely4.type] || Main.tileSolidTop[tileSafely4.type]) && (!tileSafely3.nactive() || !Main.tileSolid[tileSafely3.type] || Main.tileSolidTop[tileSafely3.type]) && (!tileSafely2.nactive() || !Main.tileSolid[tileSafely2.type] || Main.tileSolidTop[tileSafely2.type]))
22915 {
22916 float num588 = num587 * 16;
22917 if (tileSafely6.halfBrick())
22918 {
22919 num588 += 8f;
22920 }
22921 if (tileSafely5.halfBrick())
22922 {
22923 num588 -= 8f;
22924 }
22925 if (num588 < vector72.Y + (float)height)
22926 {
22927 float num589 = vector72.Y + (float)height - num588;
22928 if ((double)num589 <= 16.1)
22929 {
22930 gfxOffY += position.Y + (float)height - num588;
22931 position.Y = num588 - (float)height;
22932 if (num589 < 9f)
22933 {
22934 stepSpeed = 0.75f;
22935 }
22936 else
22937 {
22938 stepSpeed = 1.5f;
22939 }
22940 }
22941 }
22942 }
22943 }
22944 if (justHit && type != 417)
22945 {
22946 this.ai[0] = 0f;
22947 this.ai[1] = 0f;
22948 TargetClosest();
22949 }
22950 if (type == 154)
22951 {
22953 if (Main.rand.Next(10) == 0)
22954 {
22955 int num590 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 1.5f);
22956 Main.dust[num590].noGravity = true;
22957 Dust dust = Main.dust[num590];
22958 dust.velocity *= 0.2f;
22959 }
22961 }
22962 if (this.ai[0] == 0f)
22963 {
22964 if (velocity.X < 0f)
22965 {
22966 direction = -1;
22967 }
22968 else if (velocity.X > 0f)
22969 {
22970 direction = 1;
22971 }
22973 Vector2 vector73 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
22974 float num591 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector73.X;
22975 float num592 = Main.player[target].position.Y - vector73.Y;
22976 float num593 = (float)Math.Sqrt(num591 * num591 + num592 * num592);
22977 bool flag29 = Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height);
22978 if (type >= 496 && type <= 497)
22979 {
22980 if (num593 > 200f && flag29)
22981 {
22982 this.ai[1] += 2f;
22983 }
22984 if (num593 > 600f && (flag29 || position.Y + (float)height > Main.player[target].position.Y - 200f))
22985 {
22986 this.ai[1] += 4f;
22987 }
22988 }
22989 else
22990 {
22991 if (num593 > 200f && flag29)
22992 {
22993 this.ai[1] += 4f;
22994 }
22995 if (num593 > 600f && (flag29 || position.Y + (float)height > Main.player[target].position.Y - 200f))
22996 {
22997 this.ai[1] += 10f;
22998 }
22999 if (wet)
23000 {
23001 this.ai[1] = 1000f;
23002 }
23003 }
23005 damage = defDamage;
23006 if (type >= 496 && type <= 497)
23007 {
23008 knockBackResist = 0.75f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
23009 }
23010 else
23011 {
23012 knockBackResist = 0.3f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
23013 }
23014 this.ai[1] += 1f;
23015 if (this.ai[1] >= 400f)
23016 {
23017 this.ai[1] = 0f;
23018 this.ai[0] = 1f;
23019 }
23020 if (!justHit && velocity.X != oldVelocity.X)
23021 {
23022 direction *= -1;
23023 }
23024 if (velocity.Y == 0f && Main.player[target].position.Y < position.Y + (float)height)
23025 {
23026 int num594;
23027 int num595;
23028 if (direction > 0)
23029 {
23030 num594 = (int)(((double)position.X + (double)width * 0.5) / 16.0);
23031 num595 = num594 + 3;
23032 }
23033 else
23034 {
23035 num595 = (int)(((double)position.X + (double)width * 0.5) / 16.0);
23036 num594 = num595 - 3;
23037 }
23038 int num596 = (int)((position.Y + (float)height + 2f) / 16f) - 1;
23039 int num597 = num596 + 4;
23040 bool flag30 = false;
23041 for (int num598 = num594; num598 <= num595; num598++)
23042 {
23043 for (int num599 = num596; num599 <= num597; num599++)
23044 {
23045 if (Main.tile[num598, num599] != null && Main.tile[num598, num599].nactive() && Main.tileSolid[Main.tile[num598, num599].type])
23046 {
23047 flag30 = true;
23048 }
23049 }
23050 }
23051 if (!flag30)
23052 {
23053 direction *= -1;
23054 velocity.X = 0.1f * (float)direction;
23055 }
23056 }
23057 if (type >= 496 && type <= 497)
23058 {
23059 float num600 = 0.5f;
23060 if (velocity.X < 0f - num600 || velocity.X > num600)
23061 {
23062 if (velocity.Y == 0f)
23063 {
23064 velocity *= 0.8f;
23065 }
23066 }
23067 else if (velocity.X < num600 && direction == 1)
23068 {
23069 velocity.X += 0.07f;
23070 if (velocity.X > num600)
23071 {
23072 velocity.X = num600;
23073 }
23074 }
23075 else if (velocity.X > 0f - num600 && direction == -1)
23076 {
23077 velocity.X -= 0.07f;
23078 if (velocity.X < 0f - num600)
23079 {
23080 velocity.X = 0f - num600;
23081 }
23082 }
23083 return;
23084 }
23085 float num601 = 1f;
23086 if (num593 < 400f)
23087 {
23088 if (velocity.X < 0f - num601 || velocity.X > num601)
23089 {
23090 if (velocity.Y == 0f)
23091 {
23092 velocity *= 0.8f;
23093 }
23094 }
23095 else if (velocity.X < num601 && direction == 1)
23096 {
23097 velocity.X += 0.07f;
23098 if (velocity.X > num601)
23099 {
23100 velocity.X = num601;
23101 }
23102 }
23103 else if (velocity.X > 0f - num601 && direction == -1)
23104 {
23105 velocity.X -= 0.07f;
23106 if (velocity.X < 0f - num601)
23107 {
23108 velocity.X = 0f - num601;
23109 }
23110 }
23111 }
23112 else if (velocity.X < -1.5f || velocity.X > 1.5f)
23113 {
23114 if (velocity.Y == 0f)
23115 {
23116 velocity *= 0.8f;
23117 }
23118 }
23119 else if (velocity.X < 1.5f && direction == 1)
23120 {
23121 velocity.X += 0.07f;
23122 if (velocity.X > 1.5f)
23123 {
23124 velocity.X = 1.5f;
23125 }
23126 }
23127 else if (velocity.X > -1.5f && direction == -1)
23128 {
23129 velocity.X -= 0.07f;
23130 if (velocity.X < -1.5f)
23131 {
23132 velocity.X = -1.5f;
23133 }
23134 }
23135 }
23136 else if (this.ai[0] == 1f)
23137 {
23138 velocity.X *= 0.5f;
23139 if (type >= 496 && type <= 497)
23140 {
23141 this.ai[1] += 0.5f;
23142 }
23143 else
23144 {
23145 this.ai[1] += 1f;
23146 }
23147 if (this.ai[1] >= 30f)
23148 {
23149 netUpdate = true;
23150 TargetClosest();
23151 this.ai[1] = 0f;
23152 this.ai[2] = 0f;
23153 this.ai[0] = 3f;
23154 if (type == 417)
23155 {
23156 position.Y += height;
23157 height = 32;
23158 position.Y -= height;
23159 this.ai[0] = 6f;
23160 this.ai[2] = Main.rand.Next(2, 5);
23161 }
23162 }
23163 }
23164 else if (this.ai[0] == 3f)
23165 {
23166 if (type == 154 && Main.rand.Next(3) < 2)
23167 {
23169 int num602 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 1.5f);
23170 Main.dust[num602].noGravity = true;
23171 Dust dust = Main.dust[num602];
23172 dust.velocity *= 0.2f;
23174 }
23175 float num603 = 2f;
23176 if (type >= 496 && type <= 497)
23177 {
23178 num603 = 1.5f;
23179 }
23181 defense = defDefense * 2;
23182 this.ai[1] += 1f;
23183 if (this.ai[1] == 1f)
23184 {
23185 netUpdate = true;
23186 TargetClosest();
23187 this.ai[2] += 0.3f;
23188 rotation += this.ai[2] * (float)direction;
23189 this.ai[1] += 1f;
23190 bool flag31 = Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height);
23191 float num604 = 10f;
23192 if (!flag31)
23193 {
23194 num604 = 6f;
23195 }
23196 if (type >= 496 && type <= 497)
23197 {
23198 num604 *= 0.75f;
23199 }
23200 Vector2 vector74 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
23201 float num605 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector74.X;
23202 float num606 = Math.Abs(num605) * 0.2f;
23203 if (directionY > 0)
23204 {
23205 num606 = 0f;
23206 }
23207 float num607 = Main.player[target].position.Y - vector74.Y - num606;
23208 float num608 = (float)Math.Sqrt(num605 * num605 + num607 * num607);
23209 netUpdate = true;
23210 num608 = num604 / num608;
23211 num605 *= num608;
23212 num607 *= num608;
23213 if (!flag31)
23214 {
23215 num607 = -10f;
23216 }
23217 velocity.X = num605;
23218 velocity.Y = num607;
23219 this.ai[3] = velocity.X;
23220 }
23221 else
23222 {
23223 if (position.X + (float)width > Main.player[target].position.X && position.X < Main.player[target].position.X + (float)Main.player[target].width && position.Y < Main.player[target].position.Y + (float)Main.player[target].height)
23224 {
23225 velocity.X *= 0.8f;
23226 this.ai[3] = 0f;
23227 if (velocity.Y < 0f)
23228 {
23229 velocity.Y += 0.2f;
23230 }
23231 }
23232 if (this.ai[3] != 0f)
23233 {
23234 velocity.X = this.ai[3];
23235 velocity.Y -= 0.22f;
23236 }
23237 if (this.ai[1] >= 90f)
23238 {
23239 noGravity = false;
23240 this.ai[1] = 0f;
23241 this.ai[0] = 4f;
23242 }
23243 }
23244 if (wet && directionY < 0)
23245 {
23246 velocity.Y -= 0.3f;
23247 }
23248 rotation += this.ai[2] * (float)direction;
23249 }
23250 else if (this.ai[0] == 4f)
23251 {
23252 if (wet && directionY < 0)
23253 {
23254 velocity.Y -= 0.3f;
23255 }
23256 velocity.X *= 0.96f;
23257 if (this.ai[2] > 0f)
23258 {
23259 this.ai[2] -= 0.01f;
23260 rotation += this.ai[2] * (float)direction;
23261 }
23262 else if (velocity.Y >= 0f)
23263 {
23264 rotation = 0f;
23265 }
23266 if (this.ai[2] <= 0f && (velocity.Y == 0f || wet))
23267 {
23268 netUpdate = true;
23269 rotation = 0f;
23270 this.ai[2] = 0f;
23271 this.ai[1] = 0f;
23272 this.ai[0] = 5f;
23273 }
23274 }
23275 else if (this.ai[0] == 6f)
23276 {
23277 damage = GetAttackDamage_LerpBetweenFinalValues((float)defDamage * 1.8f, (float)defDamage * 1.4f);
23278 defense = defDefense * 2;
23279 knockBackResist = 0f;
23280 if (Main.rand.Next(3) < 2)
23281 {
23283 int num609 = Dust.NewDust(base.Center - new Vector2(30f), 60, 60, 6, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 1.5f);
23284 Main.dust[num609].noGravity = true;
23285 Dust dust = Main.dust[num609];
23286 dust.velocity *= 0.2f;
23287 Main.dust[num609].fadeIn = 1f;
23289 }
23290 this.ai[1] += 1f;
23291 if (this.ai[3] > 0f)
23292 {
23294 if (this.ai[3] == 1f)
23295 {
23296 Vector2 vector75 = base.Center - new Vector2(50f);
23297 for (int num610 = 0; num610 < 32; num610++)
23298 {
23299 int num611 = Dust.NewDust(vector75, 100, 100, 6, 0f, 0f, 100, default(Color), 2.5f);
23300 Main.dust[num611].noGravity = true;
23301 Dust dust = Main.dust[num611];
23302 dust.velocity *= 3f;
23303 num611 = Dust.NewDust(vector75, 100, 100, 6, 0f, 0f, 100, default(Color), 1.5f);
23304 dust = Main.dust[num611];
23305 dust.velocity *= 2f;
23306 Main.dust[num611].noGravity = true;
23307 }
23308 for (int num612 = 0; num612 < 4; num612++)
23309 {
23310 int num613 = Gore.NewGore(vector75 + new Vector2((float)(50 * Main.rand.Next(100)) / 100f, (float)(50 * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
23311 Gore gore = Main.gore[num613];
23312 gore.velocity *= 0.3f;
23313 Main.gore[num613].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
23314 Main.gore[num613].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
23315 }
23316 }
23317 for (int num614 = 0; num614 < 5; num614++)
23318 {
23319 int num615 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
23320 Main.dust[num615].velocity = Main.dust[num615].velocity * Main.rand.NextFloat();
23321 }
23322 this.ai[3]++;
23323 if (this.ai[3] >= 10f)
23324 {
23325 this.ai[3] = 0f;
23326 }
23328 }
23329 if (this.ai[1] == 1f)
23330 {
23331 netUpdate = true;
23332 TargetClosest();
23333 bool flag32 = Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height);
23334 float num616 = 16f;
23335 if (!flag32)
23336 {
23337 num616 = 10f;
23338 }
23339 Vector2 vector76 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
23340 float num617 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector76.X;
23341 float num618 = Math.Abs(num617) * 0.2f;
23342 if (directionY > 0)
23343 {
23344 num618 = 0f;
23345 }
23346 float num619 = Main.player[target].position.Y - vector76.Y - num618;
23347 float num620 = (float)Math.Sqrt(num617 * num617 + num619 * num619);
23348 netUpdate = true;
23349 num620 = num616 / num620;
23350 num617 *= num620;
23351 num619 *= num620;
23352 if (!flag32)
23353 {
23354 num619 = -12f;
23355 }
23356 velocity.X = num617;
23357 velocity.Y = num619;
23358 }
23359 else
23360 {
23361 if (position.X + (float)width > Main.player[target].position.X && position.X < Main.player[target].position.X + (float)Main.player[target].width && position.Y < Main.player[target].position.Y + (float)Main.player[target].height)
23362 {
23363 velocity.X *= 0.9f;
23364 if (velocity.Y < 0f)
23365 {
23366 velocity.Y += 0.2f;
23367 }
23368 }
23369 if (this.ai[2] == 0f || this.ai[1] >= 1200f)
23370 {
23371 this.ai[1] = 0f;
23372 this.ai[0] = 5f;
23373 }
23374 }
23375 if (wet && directionY < 0)
23376 {
23377 velocity.Y -= 0.3f;
23378 }
23379 rotation += MathHelper.Clamp(velocity.X / 10f * (float)direction, -(float)Math.PI / 10f, (float)Math.PI / 10f);
23380 }
23381 else if (this.ai[0] == 5f)
23382 {
23383 if (type == 417)
23384 {
23385 position.Y += height;
23386 height = 52;
23387 position.Y -= height;
23388 }
23389 rotation = 0f;
23390 velocity.X = 0f;
23391 if (type >= 496 && type <= 497)
23392 {
23393 this.ai[1] += 0.5f;
23394 }
23395 else
23396 {
23397 this.ai[1] += 1f;
23398 }
23399 if (this.ai[1] >= 30f)
23400 {
23401 TargetClosest();
23402 netUpdate = true;
23403 this.ai[1] = 0f;
23404 this.ai[0] = 0f;
23405 }
23406 if (wet)
23407 {
23408 this.ai[0] = 3f;
23409 this.ai[1] = 0f;
23410 }
23411 }
23412 }
23413 else if (aiStyle == 40)
23414 {
23415 if (target < 0 || target == 255 || Main.player[target].dead)
23416 {
23417 TargetClosest();
23418 }
23419 float num621 = 2f;
23420 float num622 = 0.08f;
23421 if (type == 237)
23422 {
23423 num621 = 3f;
23424 num622 = 0.12f;
23425 }
23426 if (type == 531)
23427 {
23428 num621 = 4f;
23429 num622 = 0.16f;
23430 }
23431 Vector2 vector77 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
23432 float num623 = Main.player[target].position.X + (float)(Main.player[target].width / 2);
23433 float num624 = Main.player[target].position.Y + (float)(Main.player[target].height / 2);
23434 num623 = (int)(num623 / 8f) * 8;
23435 num624 = (int)(num624 / 8f) * 8;
23436 vector77.X = (int)(vector77.X / 8f) * 8;
23437 vector77.Y = (int)(vector77.Y / 8f) * 8;
23438 num623 -= vector77.X;
23439 num624 -= vector77.Y;
23440 if (confused)
23441 {
23442 num623 *= -2f;
23443 num624 *= -2f;
23444 }
23445 float num625 = (float)Math.Sqrt(num623 * num623 + num624 * num624);
23446 float num626 = num625;
23447 if (num625 == 0f)
23448 {
23449 num623 = velocity.X;
23450 num624 = velocity.Y;
23451 }
23452 else
23453 {
23454 num625 = num621 / num625;
23455 num623 *= num625;
23456 num624 *= num625;
23457 }
23458 if (Main.player[target].dead)
23459 {
23460 num623 = (float)direction * num621 / 2f;
23461 num624 = (0f - num621) / 2f;
23462 }
23463 spriteDirection = -1;
23464 if (!Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
23465 {
23466 this.ai[0] += 1f;
23467 if (this.ai[0] > 0f)
23468 {
23469 velocity.Y += 0.023f;
23470 }
23471 else
23472 {
23473 velocity.Y -= 0.023f;
23474 }
23475 if (this.ai[0] < -100f || this.ai[0] > 100f)
23476 {
23477 velocity.X += 0.023f;
23478 }
23479 else
23480 {
23481 velocity.X -= 0.023f;
23482 }
23483 if (this.ai[0] > 200f)
23484 {
23485 this.ai[0] = -200f;
23486 }
23487 velocity.X += num623 * 0.007f;
23488 velocity.Y += num624 * 0.007f;
23489 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23490 if ((double)velocity.X > 1.5)
23491 {
23492 velocity.X *= 0.9f;
23493 }
23494 if ((double)velocity.X < -1.5)
23495 {
23496 velocity.X *= 0.9f;
23497 }
23498 if ((double)velocity.Y > 1.5)
23499 {
23500 velocity.Y *= 0.9f;
23501 }
23502 if ((double)velocity.Y < -1.5)
23503 {
23504 velocity.Y *= 0.9f;
23505 }
23506 if (velocity.X > 3f)
23507 {
23508 velocity.X = 3f;
23509 }
23510 if (velocity.X < -3f)
23511 {
23512 velocity.X = -3f;
23513 }
23514 if (velocity.Y > 3f)
23515 {
23516 velocity.Y = 3f;
23517 }
23518 if (velocity.Y < -3f)
23519 {
23520 velocity.Y = -3f;
23521 }
23522 }
23523 else
23524 {
23525 if (velocity.X < num623)
23526 {
23527 velocity.X += num622;
23528 if (velocity.X < 0f && num623 > 0f)
23529 {
23530 velocity.X += num622;
23531 }
23532 }
23533 else if (velocity.X > num623)
23534 {
23535 velocity.X -= num622;
23536 if (velocity.X > 0f && num623 < 0f)
23537 {
23538 velocity.X -= num622;
23539 }
23540 }
23541 if (velocity.Y < num624)
23542 {
23543 velocity.Y += num622;
23544 if (velocity.Y < 0f && num624 > 0f)
23545 {
23546 velocity.Y += num622;
23547 }
23548 }
23549 else if (velocity.Y > num624)
23550 {
23551 velocity.Y -= num622;
23552 if (velocity.Y > 0f && num624 < 0f)
23553 {
23554 velocity.Y -= num622;
23555 }
23556 }
23557 rotation = (float)Math.Atan2(num624, num623);
23558 }
23559 if (type == 531)
23560 {
23561 rotation += (float)Math.PI / 2f;
23562 }
23563 float num627 = 0.5f;
23564 if (collideX)
23565 {
23566 netUpdate = true;
23567 velocity.X = oldVelocity.X * (0f - num627);
23568 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
23569 {
23570 velocity.X = 2f;
23571 }
23572 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
23573 {
23574 velocity.X = -2f;
23575 }
23576 }
23577 if (collideY)
23578 {
23579 netUpdate = true;
23580 velocity.Y = oldVelocity.Y * (0f - num627);
23581 if (velocity.Y > 0f && (double)velocity.Y < 1.5)
23582 {
23583 velocity.Y = 2f;
23584 }
23585 if (velocity.Y < 0f && (double)velocity.Y > -1.5)
23586 {
23587 velocity.Y = -2f;
23588 }
23589 }
23590 if (((velocity.X > 0f && oldVelocity.X < 0f) || (velocity.X < 0f && oldVelocity.X > 0f) || (velocity.Y > 0f && oldVelocity.Y < 0f) || (velocity.Y < 0f && oldVelocity.Y > 0f)) && !justHit)
23591 {
23592 netUpdate = true;
23593 }
23594 if (Main.netMode == 1)
23595 {
23596 return;
23597 }
23598 if (Main.netMode != 1 && Main.expertMode && target >= 0 && (type == 163 || type == 238 || type == 236 || type == 237) && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
23599 {
23600 localAI[0] += 1f;
23601 if (justHit)
23602 {
23603 localAI[0] -= Main.rand.Next(20, 60);
23604 if (localAI[0] < 0f)
23605 {
23606 localAI[0] = 0f;
23607 }
23608 }
23609 if (localAI[0] > (float)Main.rand.Next(180, 900))
23610 {
23611 localAI[0] = 0f;
23612 Vector2 vector78 = Main.player[target].Center - base.Center;
23613 vector78.Normalize();
23614 vector78 *= 8f;
23617 }
23618 }
23619 if (!NPCCanStickToWalls())
23620 {
23621 int newType = type;
23622 switch (type)
23623 {
23624 case 165:
23625 newType = 164;
23626 break;
23627 case 237:
23628 newType = 236;
23629 break;
23630 case 238:
23631 newType = 163;
23632 break;
23633 case 240:
23634 newType = 239;
23635 break;
23636 case 531:
23637 newType = 530;
23638 break;
23639 }
23641 }
23642 }
23643 else if (aiStyle == 41)
23644 {
23645 if (this.ai[2] > 1f)
23646 {
23647 this.ai[2] -= 1f;
23648 }
23649 if (this.ai[2] == 0f)
23650 {
23651 this.ai[0] = -100f;
23652 this.ai[2] = 1f;
23653 TargetClosest();
23655 }
23656 if (type == 378)
23657 {
23658 Vector2 vector79 = new Vector2(-6f, -10f);
23659 vector79.X *= spriteDirection;
23660 if (this.ai[1] != 5f && Main.rand.Next(3) == 0)
23661 {
23663 int num629 = Dust.NewDust(base.Center + vector79 - Vector2.One * 5f, 4, 4, 6);
23664 Main.dust[num629].scale = 1.5f;
23665 Main.dust[num629].noGravity = true;
23666 Main.dust[num629].velocity = Main.dust[num629].velocity * 0.25f + Vector2.Normalize(vector79) * 1f;
23667 Main.dust[num629].velocity = Main.dust[num629].velocity.RotatedBy(-(float)Math.PI / 2f * (float)direction);
23669 }
23670 if (this.ai[1] == 5f)
23671 {
23673 position.X += width / 2;
23674 position.Y += height / 2;
23675 width = 160;
23676 height = 160;
23677 position.X -= width / 2;
23678 position.Y -= height / 2;
23679 dontTakeDamage = true;
23681 if (this.ai[2] > 7f)
23682 {
23683 for (int num630 = 0; num630 < 8; num630++)
23684 {
23685 int num631 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
23686 }
23687 for (int num632 = 0; num632 < 32; num632++)
23688 {
23689 int num633 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
23690 Main.dust[num633].noGravity = true;
23691 Dust dust = Main.dust[num633];
23692 dust.velocity *= 3f;
23693 num633 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
23694 dust = Main.dust[num633];
23695 dust.velocity *= 2f;
23696 Main.dust[num633].noGravity = true;
23697 }
23698 for (int num634 = 0; num634 < 2; num634++)
23699 {
23700 int num635 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
23701 Gore gore = Main.gore[num635];
23702 gore.velocity *= 0.3f;
23703 Main.gore[num635].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
23704 Main.gore[num635].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
23705 }
23706 if (this.ai[2] == 9f)
23707 {
23709 }
23710 }
23711 if (this.ai[2] == 1f)
23712 {
23713 life = -1;
23714 HitEffect();
23715 active = false;
23716 }
23718 return;
23719 }
23720 }
23721 if (type == 378 && this.ai[1] != 5f)
23722 {
23723 if (wet || Vector2.Distance(base.Center, Main.player[target].Center) < 64f)
23724 {
23725 this.ai[1] = 5f;
23726 this.ai[2] = 10f;
23727 netUpdate = true;
23728 return;
23729 }
23730 }
23731 else if (wet && type != 177)
23732 {
23733 if (collideX)
23734 {
23735 direction *= -direction;
23737 }
23738 if (collideY)
23739 {
23740 TargetClosest();
23741 if (oldVelocity.Y < 0f)
23742 {
23743 velocity.Y = 5f;
23744 }
23745 else
23746 {
23747 velocity.Y -= 2f;
23748 }
23750 }
23751 if (velocity.Y > 4f)
23752 {
23753 velocity.Y *= 0.95f;
23754 }
23755 velocity.Y -= 0.3f;
23756 if (velocity.Y < -4f)
23757 {
23758 velocity.Y = -4f;
23759 }
23760 }
23761 if (velocity.Y == 0f)
23762 {
23763 if (this.ai[3] == position.X)
23764 {
23765 direction *= -1;
23766 this.ai[2] = 300f;
23767 }
23768 this.ai[3] = 0f;
23769 velocity.X *= 0.8f;
23770 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
23771 {
23772 velocity.X = 0f;
23773 }
23774 if (type == 177)
23775 {
23776 this.ai[0] += 2f;
23777 }
23778 else
23779 {
23780 this.ai[0] += 5f;
23781 }
23782 Vector2 vector80 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
23783 float num636 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector80.X;
23784 float num637 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector80.Y;
23785 float num638 = (float)Math.Sqrt(num636 * num636 + num637 * num637);
23786 float num639 = 400f / num638;
23787 num639 = ((type != 177) ? (num639 * 10f) : (num639 * 5f));
23788 if (num639 > 30f)
23789 {
23790 num639 = 30f;
23791 }
23792 this.ai[0] += (int)num639;
23793 if (this.ai[0] >= 0f)
23794 {
23795 netUpdate = true;
23796 if (this.ai[2] == 1f)
23797 {
23798 TargetClosest();
23799 }
23800 if (type == 177)
23801 {
23802 if (this.ai[1] == 2f)
23803 {
23804 velocity.Y = -11.5f;
23805 velocity.X += 2f * (float)direction;
23807 {
23808 velocity.X += direction;
23809 }
23810 this.ai[0] = -200f;
23811 this.ai[1] = 0f;
23812 this.ai[3] = position.X;
23813 }
23814 else
23815 {
23816 velocity.Y = -7.5f;
23817 velocity.X += 4 * direction;
23819 {
23820 velocity.X += direction;
23821 }
23822 this.ai[0] = -120f;
23823 this.ai[1] += 1f;
23824 }
23825 }
23826 else
23827 {
23828 if (type == 378)
23829 {
23830 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 124);
23831 }
23832 if (this.ai[1] == 3f)
23833 {
23834 velocity.Y = -9f;
23835 velocity.X += 3 * direction;
23837 {
23838 velocity.X += direction;
23839 }
23840 this.ai[0] = -200f;
23841 this.ai[1] = 0f;
23842 this.ai[3] = position.X;
23843 }
23844 else
23845 {
23846 velocity.Y = -5f;
23847 velocity.X += 5 * direction;
23849 {
23850 velocity.X += direction;
23851 }
23852 this.ai[0] = -120f;
23853 this.ai[1] += 1f;
23854 }
23855 }
23856 }
23857 else if (this.ai[0] >= -30f)
23858 {
23859 aiAction = 1;
23860 }
23862 }
23863 else
23864 {
23865 if (target >= 255)
23866 {
23867 return;
23868 }
23869 if (type == 177)
23870 {
23871 bool flag33 = false;
23872 if (position.Y + (float)height < Main.player[target].position.Y && position.X + (float)width > Main.player[target].position.X && position.X < Main.player[target].position.X + (float)Main.player[target].width)
23873 {
23874 flag33 = true;
23875 velocity.X *= 0.92f;
23876 if (velocity.Y < 0f)
23877 {
23878 velocity.Y *= 0.9f;
23879 velocity.Y += 0.1f;
23880 }
23881 }
23882 if (!flag33 && ((direction == 1 && velocity.X < 4f) || (direction == -1 && velocity.X > -4f)))
23883 {
23884 if ((direction == -1 && (double)velocity.X < 0.1) || (direction == 1 && (double)velocity.X > -0.1))
23885 {
23886 velocity.X += 0.2f * (float)direction;
23887 }
23888 else
23889 {
23890 velocity.X *= 0.93f;
23891 }
23892 }
23893 }
23894 else if ((direction == 1 && velocity.X < 3f) || (direction == -1 && velocity.X > -3f))
23895 {
23896 if ((direction == -1 && (double)velocity.X < 0.1) || (direction == 1 && (double)velocity.X > -0.1))
23897 {
23898 velocity.X += 0.2f * (float)direction;
23899 }
23900 else
23901 {
23902 velocity.X *= 0.93f;
23903 }
23904 }
23905 }
23906 }
23907 else if (aiStyle == 42)
23908 {
23909 TargetClosest();
23910 if (this.ai[0] == 0f)
23911 {
23912 if (target >= 0)
23913 {
23914 Vector2 vector81 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
23915 float num640 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector81.X;
23916 float num641 = Main.player[target].position.Y - vector81.Y;
23917 float num642 = (float)Math.Sqrt(num640 * num640 + num641 * num641);
23918 if (num642 < 200f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
23919 {
23920 this.ai[0] = 1f;
23921 }
23922 }
23923 if (velocity.X != 0f || velocity.Y < 0f || velocity.Y > 2f || life != lifeMax)
23924 {
23925 this.ai[0] = 1f;
23926 }
23927 }
23928 else
23929 {
23930 this.ai[0] += 1f;
23931 if (this.ai[0] >= 21f)
23932 {
23933 this.ai[0] = 21f;
23934 Transform(196);
23935 }
23936 }
23937 }
23938 else if (aiStyle == 43)
23939 {
23940 if (Main.expertMode)
23941 {
23942 int num643 = (int)(20f * (1f - (float)life / (float)lifeMax));
23944 }
23945 if (target < 0 || target == 255 || Main.player[target].dead || !Main.player[target].active)
23946 {
23947 TargetClosest();
23948 }
23949 bool dead4 = Main.player[target].dead;
23950 float num644 = 0f;
23951 if ((double)(position.Y / 16f) < Main.worldSurface)
23952 {
23953 num644 += 1f;
23954 }
23955 if (!Main.player[target].ZoneJungle)
23956 {
23957 num644 += 1f;
23958 }
23959 if (Main.getGoodWorld)
23960 {
23961 num644 += 0.5f;
23962 }
23963 float num645 = Vector2.Distance(base.Center, Main.player[target].Center);
23964 if (this.ai[0] != 5f)
23965 {
23966 if (timeLeft < 60)
23967 {
23968 timeLeft = 60;
23969 }
23970 if (num645 > 3000f)
23971 {
23972 this.ai[0] = 4f;
23973 netUpdate = true;
23974 }
23975 }
23976 if (dead4)
23977 {
23978 this.ai[0] = 5f;
23979 netUpdate = true;
23980 }
23981 if (this.ai[0] == 5f)
23982 {
23983 velocity.Y *= 0.98f;
23984 if (velocity.X < 0f)
23985 {
23986 direction = -1;
23987 }
23988 else
23989 {
23990 direction = 1;
23991 }
23993 if (position.X < (float)(Main.maxTilesX * 8))
23994 {
23995 if (velocity.X > 0f)
23996 {
23997 velocity.X *= 0.98f;
23998 }
23999 else
24000 {
24001 localAI[0] = 1f;
24002 }
24003 velocity.X -= 0.08f;
24004 }
24005 else
24006 {
24007 if (velocity.X < 0f)
24008 {
24009 velocity.X *= 0.98f;
24010 }
24011 else
24012 {
24013 localAI[0] = 1f;
24014 }
24015 velocity.X += 0.08f;
24016 }
24017 EncourageDespawn(10);
24018 }
24019 else if (this.ai[0] == -1f)
24020 {
24021 if (Main.netMode == 1)
24022 {
24023 return;
24024 }
24025 float num646 = this.ai[1];
24026 int num647;
24027 do
24028 {
24029 num647 = Main.rand.Next(3);
24030 switch (num647)
24031 {
24032 case 1:
24033 num647 = 2;
24034 break;
24035 case 2:
24036 num647 = 3;
24037 break;
24038 }
24039 }
24040 while ((float)num647 == num646);
24041 this.ai[0] = num647;
24042 this.ai[1] = 0f;
24043 this.ai[2] = 0f;
24044 netUpdate = true;
24045 }
24046 else if (this.ai[0] == 0f)
24047 {
24048 int num648 = 2;
24049 if (Main.expertMode)
24050 {
24051 if (life < lifeMax / 2)
24052 {
24053 num648++;
24054 }
24055 if (life < lifeMax / 3)
24056 {
24057 num648++;
24058 }
24059 if (life < lifeMax / 5)
24060 {
24061 num648++;
24062 }
24063 }
24064 num648 += (int)(1f * num644);
24065 if (this.ai[1] > (float)(2 * num648) && this.ai[1] % 2f == 0f)
24066 {
24067 this.ai[0] = -1f;
24068 this.ai[1] = 0f;
24069 this.ai[2] = 0f;
24070 netUpdate = true;
24071 return;
24072 }
24073 if (this.ai[1] % 2f == 0f)
24074 {
24075 TargetClosest();
24076 float num649 = 20f;
24077 num649 += 20f * num644;
24078 if (Math.Abs(base.Center.Y - Main.player[target].Center.Y) < num649)
24079 {
24080 localAI[0] = 1f;
24081 this.ai[1] += 1f;
24082 this.ai[2] = 0f;
24083 netUpdate = true;
24084 float num650 = 12f;
24085 if (Main.expertMode)
24086 {
24087 num650 = 16f;
24088 if ((double)life < (double)lifeMax * 0.75)
24089 {
24090 num650 += 2f;
24091 }
24092 if ((double)life < (double)lifeMax * 0.5)
24093 {
24094 num650 += 2f;
24095 }
24096 if ((double)life < (double)lifeMax * 0.25)
24097 {
24098 num650 += 2f;
24099 }
24100 if ((double)life < (double)lifeMax * 0.1)
24101 {
24102 num650 += 2f;
24103 }
24104 }
24105 num650 += 7f * num644;
24106 Vector2 vector82 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
24107 float num651 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector82.X;
24108 float num652 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector82.Y;
24109 float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652);
24110 num653 = num650 / num653;
24111 velocity.X = num651 * num653;
24112 velocity.Y = num652 * num653;
24114 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 125);
24115 return;
24116 }
24117 localAI[0] = 0f;
24118 float num654 = 12f;
24119 float num655 = 0.15f;
24120 if (Main.expertMode)
24121 {
24122 if ((double)life < (double)lifeMax * 0.75)
24123 {
24124 num654 += 1f;
24125 num655 += 0.05f;
24126 }
24127 if ((double)life < (double)lifeMax * 0.5)
24128 {
24129 num654 += 1f;
24130 num655 += 0.05f;
24131 }
24132 if ((double)life < (double)lifeMax * 0.25)
24133 {
24134 num654 += 2f;
24135 num655 += 0.05f;
24136 }
24137 if ((double)life < (double)lifeMax * 0.1)
24138 {
24139 num654 += 2f;
24140 num655 += 0.1f;
24141 }
24142 }
24143 num654 += 3f * num644;
24144 num655 += 0.5f * num644;
24145 if (position.Y + (float)(height / 2) < Main.player[target].position.Y + (float)(Main.player[target].height / 2))
24146 {
24147 velocity.Y += num655;
24148 }
24149 else
24150 {
24151 velocity.Y -= num655;
24152 }
24153 if (velocity.Y < 0f - num654)
24154 {
24155 velocity.Y = 0f - num654;
24156 }
24157 if (velocity.Y > num654)
24158 {
24159 velocity.Y = num654;
24160 }
24161 if (Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2))) > 600f)
24162 {
24163 velocity.X += 0.15f * (float)direction;
24164 }
24165 else if (Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2))) < 300f)
24166 {
24167 velocity.X -= 0.15f * (float)direction;
24168 }
24169 else
24170 {
24171 velocity.X *= 0.8f;
24172 }
24173 if (velocity.X < -16f)
24174 {
24175 velocity.X = -16f;
24176 }
24177 if (velocity.X > 16f)
24178 {
24179 velocity.X = 16f;
24180 }
24182 return;
24183 }
24184 if (velocity.X < 0f)
24185 {
24186 direction = -1;
24187 }
24188 else
24189 {
24190 direction = 1;
24191 }
24193 int num656 = 600;
24194 if (Main.expertMode)
24195 {
24196 if ((double)life < (double)lifeMax * 0.1)
24197 {
24198 num656 = 300;
24199 }
24200 else if ((double)life < (double)lifeMax * 0.25)
24201 {
24202 num656 = 450;
24203 }
24204 else if ((double)life < (double)lifeMax * 0.5)
24205 {
24206 num656 = 500;
24207 }
24208 else if ((double)life < (double)lifeMax * 0.75)
24209 {
24210 num656 = 550;
24211 }
24212 }
24213 int num657 = 1;
24214 if (position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2))
24215 {
24216 num657 = -1;
24217 }
24218 num656 -= (int)(100f * num644);
24219 bool flag34 = false;
24220 if (direction == num657 && Math.Abs(base.Center.X - Main.player[target].Center.X) > (float)num656)
24221 {
24222 this.ai[2] = 1f;
24223 flag34 = true;
24224 }
24225 if (Math.Abs(base.Center.Y - Main.player[target].Center.Y) > (float)num656 * 1.5f)
24226 {
24227 this.ai[2] = 1f;
24228 flag34 = true;
24229 }
24230 if (num644 > 0f && flag34)
24231 {
24232 velocity *= 0.5f;
24233 }
24234 if (this.ai[2] == 1f)
24235 {
24236 TargetClosest();
24238 localAI[0] = 0f;
24239 velocity *= 0.9f;
24240 float num658 = 0.1f;
24241 if (Main.expertMode)
24242 {
24243 if (life < lifeMax / 2)
24244 {
24245 velocity *= 0.9f;
24246 num658 += 0.05f;
24247 }
24248 if (life < lifeMax / 3)
24249 {
24250 velocity *= 0.9f;
24251 num658 += 0.05f;
24252 }
24253 if (life < lifeMax / 5)
24254 {
24255 velocity *= 0.9f;
24256 num658 += 0.05f;
24257 }
24258 }
24259 if (num644 > 0f)
24260 {
24261 velocity *= 0.7f;
24262 }
24264 {
24265 this.ai[2] = 0f;
24266 this.ai[1] += 1f;
24267 netUpdate = true;
24268 }
24269 }
24270 else
24271 {
24272 localAI[0] = 1f;
24273 }
24274 }
24275 else if (this.ai[0] == 2f)
24276 {
24277 TargetClosest();
24279 float num659 = 12f;
24280 float num660 = 0.07f;
24281 if (Main.expertMode)
24282 {
24283 num660 = 0.1f;
24284 }
24285 Vector2 vector83 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
24286 float num661 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector83.X;
24287 float num662 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 200f - vector83.Y;
24288 float num663 = (float)Math.Sqrt(num661 * num661 + num662 * num662);
24289 if (num663 < 200f)
24290 {
24291 this.ai[0] = 1f;
24292 this.ai[1] = 0f;
24293 netUpdate = true;
24294 return;
24295 }
24296 num663 = num659 / num663;
24297 if (velocity.X < num661)
24298 {
24299 velocity.X += num660;
24300 if (velocity.X < 0f && num661 > 0f)
24301 {
24302 velocity.X += num660;
24303 }
24304 }
24305 else if (velocity.X > num661)
24306 {
24307 velocity.X -= num660;
24308 if (velocity.X > 0f && num661 < 0f)
24309 {
24310 velocity.X -= num660;
24311 }
24312 }
24313 if (velocity.Y < num662)
24314 {
24315 velocity.Y += num660;
24316 if (velocity.Y < 0f && num662 > 0f)
24317 {
24318 velocity.Y += num660;
24319 }
24320 }
24321 else if (velocity.Y > num662)
24322 {
24323 velocity.Y -= num660;
24324 if (velocity.Y > 0f && num662 < 0f)
24325 {
24326 velocity.Y -= num660;
24327 }
24328 }
24329 }
24330 else if (this.ai[0] == 1f)
24331 {
24332 localAI[0] = 0f;
24333 TargetClosest();
24334 Vector2 vector84 = new Vector2(position.X + (float)(width / 2) + (float)(Main.rand.Next(20) * direction), position.Y + (float)height * 0.8f);
24335 Vector2 vector85 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
24336 float num664 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector85.X;
24337 float num665 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector85.Y;
24338 float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665);
24339 this.ai[1] += 1f;
24340 if (Main.expertMode)
24341 {
24342 int num667 = 0;
24343 for (int num668 = 0; num668 < 255; num668++)
24344 {
24345 if (Main.player[num668].active && !Main.player[num668].dead && (base.Center - Main.player[num668].Center).Length() < 1000f)
24346 {
24347 num667++;
24348 }
24349 }
24350 this.ai[1] += num667 / 2;
24351 if ((double)life < (double)lifeMax * 0.75)
24352 {
24353 this.ai[1] += 0.25f;
24354 }
24355 if ((double)life < (double)lifeMax * 0.5)
24356 {
24357 this.ai[1] += 0.25f;
24358 }
24359 if ((double)life < (double)lifeMax * 0.25)
24360 {
24361 this.ai[1] += 0.25f;
24362 }
24363 if ((double)life < (double)lifeMax * 0.1)
24364 {
24365 this.ai[1] += 0.25f;
24366 }
24367 }
24368 bool flag35 = false;
24369 int num669 = (int)(40f - 18f * num644);
24370 if (this.ai[1] > (float)num669)
24371 {
24372 this.ai[1] = 0f;
24373 this.ai[2]++;
24374 flag35 = true;
24375 }
24376 if (Collision.CanHit(vector84, 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height) && flag35)
24377 {
24378 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
24379 if (Main.netMode != 1)
24380 {
24381 int num670 = Main.rand.Next(210, 212);
24383 Main.npc[num671].velocity = Main.player[target].Center - base.Center;
24384 Main.npc[num671].velocity.Normalize();
24385 NPC nPC3 = Main.npc[num671];
24386 nPC3.velocity *= 5f;
24387 Main.npc[num671].CanBeReplacedByOtherNPCs = true;
24388 Main.npc[num671].localAI[0] = 60f;
24389 Main.npc[num671].netUpdate = true;
24390 }
24391 }
24392 if (num666 > 400f || !Collision.CanHit(new Vector2(vector84.X, vector84.Y - 30f), 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height))
24393 {
24394 float num672 = 14f;
24395 float num673 = 0.1f;
24397 num664 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector85.X;
24398 num665 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector85.Y;
24399 num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665);
24400 num666 = num672 / num666;
24401 if (velocity.X < num664)
24402 {
24403 velocity.X += num673;
24404 if (velocity.X < 0f && num664 > 0f)
24405 {
24406 velocity.X += num673;
24407 }
24408 }
24409 else if (velocity.X > num664)
24410 {
24411 velocity.X -= num673;
24412 if (velocity.X > 0f && num664 < 0f)
24413 {
24414 velocity.X -= num673;
24415 }
24416 }
24417 if (velocity.Y < num665)
24418 {
24419 velocity.Y += num673;
24420 if (velocity.Y < 0f && num665 > 0f)
24421 {
24422 velocity.Y += num673;
24423 }
24424 }
24425 else if (velocity.Y > num665)
24426 {
24427 velocity.Y -= num673;
24428 if (velocity.Y > 0f && num665 < 0f)
24429 {
24430 velocity.Y -= num673;
24431 }
24432 }
24433 }
24434 else
24435 {
24436 velocity *= 0.9f;
24437 }
24439 if (this.ai[2] > 5f)
24440 {
24441 this.ai[0] = -1f;
24442 this.ai[1] = 1f;
24443 netUpdate = true;
24444 }
24445 }
24446 else if (this.ai[0] == 3f)
24447 {
24448 float num674 = 4f;
24449 float num675 = 0.05f;
24450 if (Main.expertMode)
24451 {
24452 num675 = 0.075f;
24453 num674 = 6f;
24454 }
24455 num675 += 0.2f * num644;
24456 num674 += 6f * num644;
24457 Vector2 vector86 = new Vector2(position.X + (float)(width / 2) + (float)(Main.rand.Next(20) * direction), position.Y + (float)height * 0.8f);
24458 Vector2 vector87 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
24459 float num676 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector87.X;
24460 float num677 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 300f - vector87.Y;
24461 float num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677);
24462 this.ai[1] += 1f;
24463 bool flag36 = false;
24464 int num679 = 40;
24465 if (Main.expertMode)
24466 {
24467 num679 = (((double)life < (double)lifeMax * 0.1) ? 15 : ((life < lifeMax / 3) ? 25 : ((life >= lifeMax / 2) ? 35 : 30)));
24468 }
24469 num679 -= (int)(5f * num644);
24470 if (this.ai[1] % (float)num679 == (float)(num679 - 1) && position.Y + (float)height < Main.player[target].position.Y && Collision.CanHit(vector86, 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height))
24471 {
24473 if (Main.netMode != 1)
24474 {
24475 float num680 = 8f;
24476 if (Main.expertMode)
24477 {
24478 num680 += 2f;
24479 }
24480 if (Main.expertMode && (double)life < (double)lifeMax * 0.1)
24481 {
24482 num680 += 3f;
24483 }
24484 num680 += 7f * num644;
24485 int num681 = (int)(80f - 39f * num644);
24486 int num682 = (int)(40f - 19f * num644);
24487 if (num681 < 1)
24488 {
24489 num681 = 1;
24490 }
24491 if (num682 < 1)
24492 {
24493 num682 = 1;
24494 }
24495 float num683 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector86.X + (float)Main.rand.Next(-num681, num681 + 1);
24496 float num684 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector86.Y + (float)Main.rand.Next(-num682, num682 + 1);
24497 float num685 = (float)Math.Sqrt(num683 * num683 + num684 * num684);
24498 num685 = num680 / num685;
24499 num683 *= num685;
24500 num684 *= num685;
24501 int num686 = 11;
24502 int num687 = 719;
24504 Main.projectile[num688].timeLeft = 300;
24505 }
24506 }
24507 if (!Collision.CanHit(new Vector2(vector86.X, vector86.Y - 30f), 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height))
24508 {
24509 num674 = 14f;
24510 num675 = 0.1f;
24511 if (num644 > 0f)
24512 {
24513 num675 = 0.5f;
24514 }
24516 num676 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector87.X;
24517 num677 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector87.Y;
24518 num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677);
24519 num678 = num674 / num678;
24520 if (velocity.X < num676)
24521 {
24522 velocity.X += num675;
24523 if (velocity.X < 0f && num676 > 0f)
24524 {
24525 velocity.X += num675;
24526 }
24527 }
24528 else if (velocity.X > num676)
24529 {
24530 velocity.X -= num675;
24531 if (velocity.X > 0f && num676 < 0f)
24532 {
24533 velocity.X -= num675;
24534 }
24535 }
24536 if (velocity.Y < num677)
24537 {
24538 velocity.Y += num675;
24539 if (velocity.Y < 0f && num677 > 0f)
24540 {
24541 velocity.Y += num675;
24542 }
24543 }
24544 else if (velocity.Y > num677)
24545 {
24546 velocity.Y -= num675;
24547 if (velocity.Y > 0f && num677 < 0f)
24548 {
24549 velocity.Y -= num675;
24550 }
24551 }
24552 }
24553 else if (num678 > 100f)
24554 {
24555 TargetClosest();
24557 num678 = num674 / num678;
24558 if (velocity.X < num676)
24559 {
24560 velocity.X += num675;
24561 if (velocity.X < 0f && num676 > 0f)
24562 {
24563 velocity.X += num675 * 2f;
24564 }
24565 }
24566 else if (velocity.X > num676)
24567 {
24568 velocity.X -= num675;
24569 if (velocity.X > 0f && num676 < 0f)
24570 {
24571 velocity.X -= num675 * 2f;
24572 }
24573 }
24574 if (velocity.Y < num677)
24575 {
24576 velocity.Y += num675;
24577 if (velocity.Y < 0f && num677 > 0f)
24578 {
24579 velocity.Y += num675 * 2f;
24580 }
24581 }
24582 else if (velocity.Y > num677)
24583 {
24584 velocity.Y -= num675;
24585 if (velocity.Y > 0f && num677 < 0f)
24586 {
24587 velocity.Y -= num675 * 2f;
24588 }
24589 }
24590 }
24591 float num689 = 20f;
24592 num689 -= 5f * num644;
24593 if (this.ai[1] > (float)num679 * num689)
24594 {
24595 this.ai[0] = -1f;
24596 this.ai[1] = 3f;
24597 netUpdate = true;
24598 }
24599 }
24600 else if (this.ai[0] == 4f)
24601 {
24602 localAI[0] = 1f;
24603 float num690 = 14f;
24604 float num691 = 14f;
24605 Vector2 vector88 = Main.player[target].Center - base.Center;
24606 vector88.Normalize();
24607 vector88 *= num690;
24608 velocity = (velocity * num691 + vector88) / (num691 + 1f);
24609 if (velocity.X < 0f)
24610 {
24611 direction = -1;
24612 }
24613 else
24614 {
24615 direction = 1;
24616 }
24618 if (num645 < 2000f)
24619 {
24620 this.ai[0] = -1f;
24621 localAI[0] = 0f;
24622 }
24623 }
24624 }
24625 else if (aiStyle == 44)
24626 {
24627 noGravity = true;
24628 if (collideX)
24629 {
24630 if (oldVelocity.X > 0f)
24631 {
24632 direction = -1;
24633 }
24634 else
24635 {
24636 direction = 1;
24637 }
24638 velocity.X = direction;
24639 }
24640 if (collideY)
24641 {
24642 if (oldVelocity.Y > 0f)
24643 {
24644 directionY = -1;
24645 }
24646 else
24647 {
24648 directionY = 1;
24649 }
24650 velocity.Y = directionY;
24651 }
24652 if (type == 587)
24653 {
24655 if (alpha == 255)
24656 {
24657 velocity.Y = -6f;
24658 netUpdate = true;
24659 for (int num692 = 0; num692 < 15; num692++)
24660 {
24662 Dust dust = dust2;
24663 dust.velocity *= 0.5f;
24664 dust2.scale = 1f + Main.rand.NextFloat() * 0.5f;
24665 dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
24666 dust = dust2;
24667 dust.velocity += velocity * 0.5f;
24668 }
24669 }
24670 alpha -= 15;
24671 if (alpha < 0)
24672 {
24673 alpha = 0;
24674 }
24675 if (alpha != 0)
24676 {
24677 for (int num693 = 0; num693 < 2; num693++)
24678 {
24680 Dust dust = dust3;
24681 dust.velocity *= 1f;
24682 dust3.scale = 1f + Main.rand.NextFloat() * 0.5f;
24683 dust3.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
24684 dust = dust3;
24685 dust.velocity += velocity * 0.3f;
24686 }
24687 }
24688 if (Main.rand.Next(3) == 0)
24689 {
24691 Dust dust = dust4;
24692 dust.velocity *= 0f;
24693 dust4.alpha = 120;
24694 dust4.scale = 0.7f + Main.rand.NextFloat() * 0.5f;
24695 dust = dust4;
24696 dust.velocity += velocity * 0.3f;
24697 }
24699 }
24700 int num694 = target;
24701 int num695 = direction;
24702 if (target == 255 || (type != 587 && Main.player[target].wet) || Main.player[target].dead || Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
24703 {
24704 this.ai[0] = 90f;
24705 TargetClosest();
24706 }
24707 else if (this.ai[0] > 0f)
24708 {
24709 this.ai[0] -= 1f;
24710 TargetClosest();
24711 }
24712 if (netUpdate && num694 == target && num695 == direction)
24713 {
24714 netUpdate = false;
24715 }
24716 float num696 = 0.05f;
24717 float num697 = 0.01f;
24718 float num698 = 3f;
24719 float num699 = 1f;
24720 float num700 = 30f;
24721 float num701 = 100f;
24722 float num702 = Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2)));
24723 float num703 = Main.player[target].position.Y - (float)(height / 2);
24724 if (type == 509)
24725 {
24726 num696 = 0.08f;
24727 num697 = 0.03f;
24728 num698 = 4.5f;
24729 num699 = 2f;
24730 num700 = 40f;
24731 num701 = 150f;
24732 num703 = Main.player[target].Center.Y - (float)(height / 2);
24733 rotation = velocity.X * 0.1f;
24734 for (int num704 = 0; num704 < 200; num704++)
24735 {
24736 if (num704 != whoAmI && Main.npc[num704].active && Main.npc[num704].type == type && Math.Abs(position.X - Main.npc[num704].position.X) + Math.Abs(position.Y - Main.npc[num704].position.Y) < (float)width)
24737 {
24738 if (position.X < Main.npc[num704].position.X)
24739 {
24740 velocity.X -= 0.05f;
24741 }
24742 else
24743 {
24744 velocity.X += 0.05f;
24745 }
24746 if (position.Y < Main.npc[num704].position.Y)
24747 {
24748 velocity.Y -= 0.05f;
24749 }
24750 else
24751 {
24752 velocity.Y += 0.05f;
24753 }
24754 }
24755 }
24756 }
24757 else if (type == 581)
24758 {
24759 num696 = 0.06f;
24760 num697 = 0.02f;
24761 num698 = 4f;
24762 num699 = 2f;
24763 num700 = 40f;
24764 num701 = 150f;
24765 num703 = Main.player[target].Center.Y - (float)(height / 2);
24766 rotation = velocity.X * 0.1f;
24767 for (int num705 = 0; num705 < 200; num705++)
24768 {
24769 if (num705 != whoAmI && Main.npc[num705].active && Main.npc[num705].type == type && Math.Abs(position.X - Main.npc[num705].position.X) + Math.Abs(position.Y - Main.npc[num705].position.Y) < (float)width)
24770 {
24771 if (position.X < Main.npc[num705].position.X)
24772 {
24773 velocity.X -= 0.05f;
24774 }
24775 else
24776 {
24777 velocity.X += 0.05f;
24778 }
24779 if (position.Y < Main.npc[num705].position.Y)
24780 {
24781 velocity.Y -= 0.05f;
24782 }
24783 else
24784 {
24785 velocity.Y += 0.05f;
24786 }
24787 }
24788 }
24789 }
24790 else if (type == 587)
24791 {
24792 num696 = 0.13f;
24793 num697 = 0.09f;
24794 num698 = 6.5f;
24795 num699 = 3.5f;
24796 num700 = 0f;
24797 num701 = 250f;
24798 num703 = Main.player[target].position.Y;
24799 if (Main.dayTime)
24800 {
24801 num703 = 0f;
24802 direction *= -1;
24803 }
24804 }
24805 if (this.ai[0] <= 0f)
24806 {
24807 num698 *= 0.8f;
24808 num696 *= 0.7f;
24809 num703 = base.Center.Y + (float)(directionY * 1000);
24810 if (velocity.X < 0f)
24811 {
24812 direction = -1;
24813 }
24814 else if (velocity.X > 0f || direction == 0)
24815 {
24816 direction = 1;
24817 }
24818 }
24819 if (num702 > num700)
24820 {
24821 if (direction == -1 && velocity.X > 0f - num698)
24822 {
24823 velocity.X -= num696;
24824 if (velocity.X > num698)
24825 {
24826 velocity.X -= num696;
24827 }
24828 else if (velocity.X > 0f)
24829 {
24830 velocity.X -= num696 / 2f;
24831 }
24832 if (velocity.X < 0f - num698)
24833 {
24834 velocity.X = 0f - num698;
24835 }
24836 }
24837 else if (direction == 1 && velocity.X < num698)
24838 {
24839 velocity.X += num696;
24840 if (velocity.X < 0f - num698)
24841 {
24842 velocity.X += num696;
24843 }
24844 else if (velocity.X < 0f)
24845 {
24846 velocity.X += num696 / 2f;
24847 }
24848 if (velocity.X > num698)
24849 {
24850 velocity.X = num698;
24851 }
24852 }
24853 }
24854 if (num702 > num701)
24855 {
24856 num703 -= num701 / 2f;
24857 }
24858 if (position.Y < num703)
24859 {
24860 velocity.Y += num697;
24861 if (velocity.Y < 0f)
24862 {
24863 velocity.Y += num697;
24864 }
24865 }
24866 else
24867 {
24868 velocity.Y -= num697;
24869 if (velocity.Y > 0f)
24870 {
24871 velocity.Y -= num697;
24872 }
24873 }
24874 if (velocity.Y < 0f - num699)
24875 {
24876 velocity.Y = 0f - num699;
24877 }
24878 if (velocity.Y > num699)
24879 {
24880 velocity.Y = num699;
24881 }
24882 if (type != 587 && wet)
24883 {
24884 if (velocity.Y > 0f)
24885 {
24886 velocity.Y *= 0.95f;
24887 }
24888 velocity.Y -= 0.5f;
24889 if (velocity.Y < -4f)
24890 {
24891 velocity.Y = -4f;
24892 }
24893 }
24894 }
24895 else if (aiStyle == 45)
24896 {
24897 AI_045_Golem();
24898 }
24899 else if (aiStyle == 46)
24900 {
24901 float num706 = GetMyBalance();
24902 if (Main.getGoodWorld)
24903 {
24904 num706 += 3f;
24905 }
24906 if ((!Main.player[target].ZoneLihzhardTemple && !Main.player[target].ZoneJungle) || (double)Main.player[target].Center.Y < Main.worldSurface * 16.0)
24907 {
24908 num706 *= 2f;
24909 }
24910 noTileCollide = true;
24911 if (golemBoss < 0)
24912 {
24913 StrikeNPCNoInteraction(9999, 0f, 0);
24914 return;
24915 }
24916 float num707 = 100f;
24917 Vector2 vector89 = new Vector2(base.Center.X, base.Center.Y);
24918 float num708 = Main.npc[golemBoss].Center.X - vector89.X;
24919 float num709 = Main.npc[golemBoss].Center.Y - vector89.Y;
24920 num709 -= 57f * scale;
24921 num708 -= 3f * scale;
24922 float num710 = (float)Math.Sqrt(num708 * num708 + num709 * num709);
24923 if (num710 < num707)
24924 {
24925 rotation = 0f;
24926 velocity.X = num708;
24927 velocity.Y = num709;
24928 }
24929 else
24930 {
24931 num710 = num707 / num710;
24932 velocity.X = num708 * num710;
24933 velocity.Y = num709 * num710;
24934 rotation = velocity.X * 0.1f;
24935 }
24936 if (alpha > 0)
24937 {
24938 alpha -= 10;
24939 if (alpha < 0)
24940 {
24941 alpha = 0;
24942 }
24943 this.ai[1] = 30f;
24944 }
24945 if (this.ai[0] == 0f)
24946 {
24947 this.ai[1] += 1f;
24948 int num711 = 300;
24949 if (this.ai[1] < 20f || this.ai[1] > (float)(num711 - 20))
24950 {
24951 this.ai[1] += 2f * (num706 - 1f) / 3f;
24952 localAI[0] = 1f;
24953 }
24954 else
24955 {
24956 this.ai[1] += 1f * (num706 - 1f) / 2f;
24957 localAI[0] = 0f;
24958 }
24959 if (this.ai[1] >= (float)num711)
24960 {
24961 TargetClosest();
24962 this.ai[1] = 0f;
24963 Vector2 vector90 = new Vector2(base.Center.X, base.Center.Y + 10f * scale);
24964 float num712 = 8f;
24965 float num713 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector90.X;
24966 float num714 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector90.Y;
24967 float num715 = (float)Math.Sqrt(num713 * num713 + num714 * num714);
24968 num715 = num712 / num715;
24969 num713 *= num715;
24970 num714 *= num715;
24971 int num716 = 18;
24972 int num717 = 258;
24973 if (Main.netMode != 1)
24974 {
24976 }
24977 }
24978 }
24979 else if (this.ai[0] == 1f)
24980 {
24981 TargetClosest();
24982 Vector2 vector91 = new Vector2(base.Center.X, base.Center.Y + 10f * scale);
24983 if (Main.player[target].Center.X < base.Center.X - (float)width)
24984 {
24985 localAI[1] = -1f;
24986 vector91.X -= 40f * scale;
24987 }
24988 else if (Main.player[target].Center.X > base.Center.X + (float)width)
24989 {
24990 localAI[1] = 1f;
24991 vector91.X += 40f * scale;
24992 }
24993 else
24994 {
24995 localAI[1] = 0f;
24996 }
24997 float num719 = (num706 + 3f) / 4f;
24998 this.ai[1] += num719;
24999 if ((double)life < (double)lifeMax * 0.4)
25000 {
25001 this.ai[1] += num719;
25002 }
25003 if ((double)life < (double)lifeMax * 0.2)
25004 {
25005 this.ai[1] += num719;
25006 }
25007 int num720 = 300;
25008 if (this.ai[1] < 20f || this.ai[1] > (float)(num720 - 20))
25009 {
25010 localAI[0] = 1f;
25011 }
25012 else
25013 {
25014 localAI[0] = 0f;
25015 }
25016 if (this.ai[1] >= (float)num720)
25017 {
25018 TargetClosest();
25019 this.ai[1] = 0f;
25020 float num721 = 8f;
25021 float num722 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector91.X;
25022 float num723 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector91.Y;
25023 float num724 = (float)Math.Sqrt(num722 * num722 + num723 * num723);
25024 num724 = num721 / num724;
25025 num722 *= num724;
25026 num723 *= num724;
25027 int num725 = 24;
25028 int num726 = 258;
25029 if (Main.netMode != 1)
25030 {
25032 }
25033 }
25034 this.ai[2] += num719;
25035 if (life < lifeMax / 3)
25036 {
25037 this.ai[2] += num719;
25038 }
25039 if (life < lifeMax / 4)
25040 {
25041 this.ai[2] += num719;
25042 }
25043 if (life < lifeMax / 5)
25044 {
25045 this.ai[2] += num719;
25046 }
25047 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
25048 {
25049 this.ai[2] += 4f;
25050 }
25051 if (this.ai[2] > (float)(60 + Main.rand.Next(600)))
25052 {
25053 this.ai[2] = 0f;
25054 int num728 = 28;
25055 int num729 = 259;
25056 if (localAI[1] == 0f)
25057 {
25058 for (int num730 = 0; num730 < 2; num730++)
25059 {
25060 vector91 = new Vector2(base.Center.X, base.Center.Y - 22f * scale);
25061 if (num730 == 0)
25062 {
25063 vector91.X -= 18f * scale;
25064 }
25065 else
25066 {
25067 vector91.X += 18f * scale;
25068 }
25069 float num731 = 11f;
25070 float num732 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector91.X;
25071 float num733 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector91.Y;
25072 float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733);
25073 num734 = num731 / num734;
25074 num732 *= num734;
25075 num733 *= num734;
25076 vector91.X += num732 * 3f;
25077 vector91.Y += num733 * 3f;
25078 if (Main.netMode != 1)
25079 {
25081 Main.projectile[num735].timeLeft = 300;
25082 }
25083 }
25084 }
25085 else if (localAI[1] != 0f)
25086 {
25087 vector91 = new Vector2(base.Center.X, base.Center.Y - 22f * scale);
25088 if (localAI[1] == -1f)
25089 {
25090 vector91.X -= 30f * scale;
25091 }
25092 else if (localAI[1] == 1f)
25093 {
25094 vector91.X += 30f * scale;
25095 }
25096 float num736 = 12f;
25097 float num737 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector91.X;
25098 float num738 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector91.Y;
25099 float num739 = (float)Math.Sqrt(num737 * num737 + num738 * num738);
25100 num739 = num736 / num739;
25101 num737 *= num739;
25102 num738 *= num739;
25103 vector91.X += num737 * 3f;
25104 vector91.Y += num738 * 3f;
25105 if (Main.netMode != 1)
25106 {
25108 Main.projectile[num740].timeLeft = 300;
25109 }
25110 }
25111 }
25112 }
25113 if (life < lifeMax / 2)
25114 {
25115 this.ai[0] = 1f;
25116 }
25117 else
25118 {
25119 this.ai[0] = 0f;
25120 }
25121 }
25122 else if (aiStyle == 47)
25123 {
25125 }
25126 else if (aiStyle == 48)
25127 {
25128 bool flag37 = false;
25129 float num741 = GetMyBalance();
25130 if (Main.getGoodWorld)
25131 {
25132 num741 += 3f;
25133 }
25134 if ((!Main.player[target].ZoneLihzhardTemple && !Main.player[target].ZoneJungle) || (double)Main.player[target].Center.Y < Main.worldSurface * 16.0)
25135 {
25136 num741 *= 2f;
25137 }
25138 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
25139 {
25140 noTileCollide = true;
25141 flag37 = true;
25142 }
25144 {
25145 noTileCollide = false;
25146 }
25147 if (golemBoss < 0)
25148 {
25149 StrikeNPCNoInteraction(9999, 0f, 0);
25150 return;
25151 }
25152 TargetClosest();
25153 float num742 = 7f;
25154 float num743 = 0.05f;
25155 Vector2 vector92 = new Vector2(base.Center.X, base.Center.Y);
25156 float num744 = Main.player[target].Center.X - vector92.X;
25157 float num745 = Main.player[target].Center.Y - vector92.Y - 300f;
25158 float num746 = (float)Math.Sqrt(num744 * num744 + num745 * num745);
25159 num746 = num742 / num746;
25160 num744 *= num746;
25161 num745 *= num746;
25162 if (velocity.X < num744)
25163 {
25164 velocity.X += num743;
25165 if (velocity.X < 0f && num744 > 0f)
25166 {
25167 velocity.X += num743;
25168 }
25169 }
25170 else if (velocity.X > num744)
25171 {
25172 velocity.X -= num743;
25173 if (velocity.X > 0f && num744 < 0f)
25174 {
25175 velocity.X -= num743;
25176 }
25177 }
25178 if (velocity.Y < num745)
25179 {
25180 velocity.Y += num743;
25181 if (velocity.Y < 0f && num745 > 0f)
25182 {
25183 velocity.Y += num743;
25184 }
25185 }
25186 else if (velocity.Y > num745)
25187 {
25188 velocity.Y -= num743;
25189 if (velocity.Y > 0f && num745 < 0f)
25190 {
25191 velocity.Y -= num743;
25192 }
25193 }
25194 float num747 = (num741 + 4f) / 5f;
25195 this.ai[1] += num747;
25196 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.8)
25197 {
25198 this.ai[1] += num747;
25199 }
25200 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.6)
25201 {
25202 this.ai[1] += num747;
25203 }
25204 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.2)
25205 {
25206 this.ai[1] += num747;
25207 }
25208 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.1)
25209 {
25210 this.ai[1] += num747;
25211 }
25212 int num748 = 300;
25213 if (this.ai[1] < 20f || this.ai[1] > (float)(num748 - 20))
25214 {
25215 localAI[0] = 1f;
25216 }
25217 else
25218 {
25219 localAI[0] = 0f;
25220 }
25221 if (flag37)
25222 {
25223 this.ai[1] = 20f;
25224 }
25225 if (this.ai[1] >= (float)num748)
25226 {
25227 TargetClosest();
25228 this.ai[1] = 0f;
25229 Vector2 vector93 = new Vector2(base.Center.X, base.Center.Y - 10f * scale);
25230 float num749 = 8f;
25231 int num750 = 20;
25232 int num751 = 258;
25233 float num752 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector93.X;
25234 float num753 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector93.Y;
25235 float num754 = (float)Math.Sqrt(num752 * num752 + num753 * num753);
25236 num754 = num749 / num754;
25237 num752 *= num754;
25238 num753 *= num754;
25239 if (Main.netMode != 1)
25240 {
25242 }
25243 }
25244 float num756 = num741;
25245 this.ai[2] += num756;
25246 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax / 1.25)
25247 {
25248 this.ai[2] += num756;
25249 }
25250 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax / 1.5)
25251 {
25252 this.ai[2] += num756;
25253 }
25254 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax / 2)
25255 {
25256 this.ai[2] += num756;
25257 }
25258 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax / 3)
25259 {
25260 this.ai[2] += num756;
25261 }
25262 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax / 4)
25263 {
25264 this.ai[2] += num756;
25265 }
25266 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax / 5)
25267 {
25268 this.ai[2] += num756;
25269 }
25270 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax / 6)
25271 {
25272 this.ai[2] += num756;
25273 }
25274 bool flag38 = false;
25275 if (!Collision.CanHit(Main.npc[golemBoss].Center, 1, 1, Main.player[target].Center, 1, 1))
25276 {
25277 flag38 = true;
25278 }
25279 if (flag38)
25280 {
25281 this.ai[2] += num756 * 10f;
25282 }
25283 if (this.ai[2] > (float)(100 + Main.rand.Next(4800)))
25284 {
25285 this.ai[2] = 0f;
25286 for (int num757 = 0; num757 < 2; num757++)
25287 {
25288 Vector2 vector94 = new Vector2(base.Center.X, base.Center.Y - 50f * scale);
25289 switch (num757)
25290 {
25291 case 0:
25292 vector94.X -= 14f * scale;
25293 break;
25294 case 1:
25295 vector94.X += 14f * scale;
25296 break;
25297 }
25298 float num758 = 11f;
25299 int num759 = 24;
25300 int num760 = 259;
25301 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.5)
25302 {
25303 num759++;
25304 num758 += 0.25f;
25305 }
25306 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.4)
25307 {
25308 num759++;
25309 num758 += 0.25f;
25310 }
25311 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.3)
25312 {
25313 num759++;
25314 num758 += 0.25f;
25315 }
25316 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.2)
25317 {
25318 num759++;
25319 num758 += 0.25f;
25320 }
25321 if ((double)Main.npc[golemBoss].life < (double)Main.npc[golemBoss].lifeMax * 0.1)
25322 {
25323 num759++;
25324 num758 += 0.25f;
25325 }
25326 float num761 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f;
25327 float num762 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f;
25328 if (flag38)
25329 {
25330 num759 = (int)((double)num759 * 1.5);
25331 num758 *= 2.5f;
25332 num761 += Main.player[target].velocity.X * Main.rand.NextFloat() * 50f;
25333 num762 += Main.player[target].velocity.Y * Main.rand.NextFloat() * 50f;
25334 }
25335 num761 -= vector94.X;
25336 num762 -= vector94.Y;
25337 float num763 = (float)Math.Sqrt(num761 * num761 + num762 * num762);
25338 num763 = num758 / num763;
25339 num761 *= num763;
25340 num762 *= num763;
25341 vector94.X += num761 * 3f;
25342 vector94.Y += num762 * 3f;
25343 if (Main.netMode != 1)
25344 {
25346 Main.projectile[num764].timeLeft = 300;
25347 }
25348 }
25349 }
25350 if (!Main.getGoodWorld)
25351 {
25353 int num765 = Main.rand.Next(2) * 2 - 1;
25354 Vector2 vector95 = base.Bottom + new Vector2((float)(num765 * 22) * scale, -22f * scale);
25355 Dust dust5 = Dust.NewDustPerfect(vector95, 228, ((float)Math.PI / 2f + -(float)Math.PI / 2f * (float)num765 + Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)).ToRotationVector2() * (2f + Main.rand.NextFloat()));
25356 Dust dust = dust5;
25357 dust.velocity += velocity;
25358 dust5.noGravity = true;
25359 dust5 = Dust.NewDustPerfect(base.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * scale, (Main.rand.NextFloat() * -4f - 8f) * scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat()));
25360 dust5.fadeIn = 0f;
25361 dust5.scale = 0.7f + Main.rand.NextFloat() * 0.5f;
25362 dust5.noGravity = true;
25363 dust = dust5;
25364 dust.velocity += velocity;
25366 }
25367 }
25368 else if (aiStyle == 49)
25369 {
25370 noGravity = true;
25371 TargetClosest();
25372 float num766 = 4f;
25373 float num767 = 0.25f;
25374 Vector2 vector96 = new Vector2(base.Center.X, base.Center.Y);
25375 float num768 = Main.player[target].Center.X - vector96.X;
25376 float num769 = Main.player[target].Center.Y - vector96.Y - 200f;
25377 float num770 = (float)Math.Sqrt(num768 * num768 + num769 * num769);
25378 if (num770 < 20f)
25379 {
25380 num768 = velocity.X;
25381 num769 = velocity.Y;
25382 }
25383 else
25384 {
25385 num770 = num766 / num770;
25386 num768 *= num770;
25387 num769 *= num770;
25388 }
25389 if (velocity.X < num768)
25390 {
25391 velocity.X += num767;
25392 if (velocity.X < 0f && num768 > 0f)
25393 {
25394 velocity.X += num767 * 2f;
25395 }
25396 }
25397 else if (velocity.X > num768)
25398 {
25399 velocity.X -= num767;
25400 if (velocity.X > 0f && num768 < 0f)
25401 {
25402 velocity.X -= num767 * 2f;
25403 }
25404 }
25405 if (velocity.Y < num769)
25406 {
25407 velocity.Y += num767;
25408 if (velocity.Y < 0f && num769 > 0f)
25409 {
25410 velocity.Y += num767 * 2f;
25411 }
25412 }
25413 else if (velocity.Y > num769)
25414 {
25415 velocity.Y -= num767;
25416 if (velocity.Y > 0f && num769 < 0f)
25417 {
25418 velocity.Y -= num767 * 2f;
25419 }
25420 }
25421 if (position.X + (float)width > Main.player[target].position.X && position.X < Main.player[target].position.X + (float)Main.player[target].width && position.Y + (float)height < Main.player[target].position.Y && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && Main.netMode != 1)
25422 {
25423 this.ai[0] += 1f;
25424 if (this.ai[0] > 8f)
25425 {
25426 this.ai[0] = 0f;
25427 int num771 = (int)(position.X + 10f + (float)Main.rand.Next(width - 20));
25428 int num772 = (int)(position.Y + (float)height + 4f);
25430 }
25431 }
25432 }
25433 else if (aiStyle == 50)
25434 {
25436 if (type == 261)
25437 {
25438 noTileCollide = false;
25439 if (collideX || collideY)
25440 {
25441 life = 0;
25442 HitEffect(0, 100.0);
25443 checkDead();
25444 return;
25445 }
25446 }
25447 else
25448 {
25449 noTileCollide = true;
25450 }
25451 velocity.Y += 0.02f;
25452 TargetClosest();
25453 if (velocity.Y < 0f && Main.player[target].position.Y > position.Y + 100f)
25454 {
25455 velocity.Y *= 0.95f;
25456 }
25457 if (velocity.Y > 1f)
25458 {
25459 velocity.Y = 1f;
25460 }
25461 if (position.X + (float)width < Main.player[target].position.X)
25462 {
25463 if (velocity.X < 0f)
25464 {
25465 velocity.X *= 0.98f;
25466 }
25467 if (Main.expertMode && velocity.X < 0f)
25468 {
25469 velocity.X *= 0.98f;
25470 }
25471 velocity.X += 0.1f;
25472 if (Main.expertMode)
25473 {
25474 velocity.X += 0.1f;
25475 }
25476 }
25477 else if (position.X > Main.player[target].position.X + (float)Main.player[target].width)
25478 {
25479 if (velocity.X > 0f)
25480 {
25481 velocity.X *= 0.98f;
25482 }
25483 if (Main.expertMode && velocity.X > 0f)
25484 {
25485 velocity.X *= 0.98f;
25486 }
25487 velocity.X -= 0.1f;
25488 if (Main.expertMode)
25489 {
25490 velocity.X -= 0.1f;
25491 }
25492 }
25493 if (velocity.X > 5f || velocity.X < -5f)
25494 {
25495 velocity.X *= 0.97f;
25496 }
25497 rotation = velocity.X * 0.2f;
25498 }
25499 else if (aiStyle == 51)
25500 {
25501 bool flag39 = false;
25502 bool flag40 = false;
25503 TargetClosest();
25504 if (Main.player[target].dead)
25505 {
25506 flag40 = true;
25507 flag39 = true;
25508 }
25509 else if (Main.netMode != 1 && target >= 0 && target < 255)
25510 {
25511 int num773 = 4800;
25512 if (timeLeft < activeTime && Vector2.Distance(base.Center, Main.player[target].Center) < (float)num773)
25513 {
25515 }
25516 }
25517 plantBoss = whoAmI;
25518 if (localAI[0] == 0f && Main.netMode != 1)
25519 {
25520 localAI[0] = 1f;
25521 int num774 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 263, whoAmI);
25522 num774 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 263, whoAmI);
25523 num774 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 263, whoAmI);
25524 }
25525 int[] array2 = new int[3];
25526 float num775 = 0f;
25527 float num776 = 0f;
25528 int num777 = 0;
25529 for (int num778 = 0; num778 < 200; num778++)
25530 {
25531 if (Main.npc[num778].active && Main.npc[num778].aiStyle == 52)
25532 {
25533 num775 += Main.npc[num778].Center.X;
25534 num776 += Main.npc[num778].Center.Y;
25535 array2[num777] = num778;
25536 num777++;
25537 if (num777 > 2)
25538 {
25539 break;
25540 }
25541 }
25542 }
25543 num775 /= (float)num777;
25544 num776 /= (float)num777;
25545 float num779 = 2.5f;
25546 float num780 = 0.025f;
25547 if (life < lifeMax / 2)
25548 {
25549 num779 = 5f;
25550 num780 = 0.05f;
25551 }
25552 if (life < lifeMax / 4)
25553 {
25554 num779 = 7f;
25555 }
25556 if (!Main.player[target].ZoneJungle || (double)Main.player[target].position.Y < Main.worldSurface * 16.0 || Main.player[target].position.Y > (float)(Main.UnderworldLayer * 16))
25557 {
25558 flag39 = true;
25559 num779 += 8f;
25560 num780 = 0.15f;
25561 }
25562 if (Main.expertMode)
25563 {
25564 num779 += 1f;
25565 num779 *= 1.1f;
25566 num780 += 0.01f;
25567 num780 *= 1.1f;
25568 }
25569 if (Main.getGoodWorld)
25570 {
25571 num779 *= 1.15f;
25572 num780 *= 1.15f;
25573 }
25575 float num781 = Main.player[target].Center.X - vector97.X;
25576 float num782 = Main.player[target].Center.Y - vector97.Y;
25577 if (flag40)
25578 {
25579 num782 *= -1f;
25580 num781 *= -1f;
25581 num779 += 8f;
25582 }
25583 float num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782);
25584 int num784 = 500;
25585 if (flag39)
25586 {
25587 num784 += 350;
25588 }
25589 if (Main.expertMode)
25590 {
25591 num784 += 150;
25592 }
25593 if (num783 >= (float)num784)
25594 {
25595 num783 = (float)num784 / num783;
25596 num781 *= num783;
25597 num782 *= num783;
25598 }
25599 num775 += num781;
25600 num776 += num782;
25601 vector97 = new Vector2(base.Center.X, base.Center.Y);
25602 num781 = num775 - vector97.X;
25603 num782 = num776 - vector97.Y;
25604 num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782);
25605 if (num783 < num779)
25606 {
25607 num781 = velocity.X;
25608 num782 = velocity.Y;
25609 }
25610 else
25611 {
25612 num783 = num779 / num783;
25613 num781 *= num783;
25614 num782 *= num783;
25615 }
25616 if (velocity.X < num781)
25617 {
25618 velocity.X += num780;
25619 if (velocity.X < 0f && num781 > 0f)
25620 {
25621 velocity.X += num780 * 2f;
25622 }
25623 }
25624 else if (velocity.X > num781)
25625 {
25626 velocity.X -= num780;
25627 if (velocity.X > 0f && num781 < 0f)
25628 {
25629 velocity.X -= num780 * 2f;
25630 }
25631 }
25632 if (velocity.Y < num782)
25633 {
25634 velocity.Y += num780;
25635 if (velocity.Y < 0f && num782 > 0f)
25636 {
25637 velocity.Y += num780 * 2f;
25638 }
25639 }
25640 else if (velocity.Y > num782)
25641 {
25642 velocity.Y -= num780;
25643 if (velocity.Y > 0f && num782 < 0f)
25644 {
25645 velocity.Y -= num780 * 2f;
25646 }
25647 }
25648 Vector2 vector98 = new Vector2(base.Center.X, base.Center.Y);
25649 float num785 = Main.player[target].Center.X - vector98.X;
25650 float num786 = Main.player[target].Center.Y - vector98.Y;
25651 rotation = (float)Math.Atan2(num786, num785) + 1.57f;
25652 if (life > lifeMax / 2)
25653 {
25654 defense = 36;
25655 int num787 = 50;
25656 if (flag39)
25657 {
25658 defense *= 2;
25659 num787 *= 2;
25660 }
25662 if (Main.netMode == 1)
25663 {
25664 return;
25665 }
25666 localAI[1] += 1f;
25667 if ((double)life < (double)lifeMax * 0.9)
25668 {
25669 localAI[1] += 1f;
25670 }
25671 if ((double)life < (double)lifeMax * 0.8)
25672 {
25673 localAI[1] += 1f;
25674 }
25675 if ((double)life < (double)lifeMax * 0.7)
25676 {
25677 localAI[1] += 1f;
25678 }
25679 if ((double)life < (double)lifeMax * 0.6)
25680 {
25681 localAI[1] += 1f;
25682 }
25683 if (flag39)
25684 {
25685 localAI[1] += 3f;
25686 }
25687 if (Main.expertMode)
25688 {
25689 localAI[1] += 1f;
25690 }
25691 if (Main.expertMode && justHit && Main.rand.Next(2) == 0)
25692 {
25693 localAI[3] = 1f;
25694 }
25695 if (Main.getGoodWorld)
25696 {
25697 localAI[1] += 1f;
25698 }
25699 if (!(localAI[1] > 80f))
25700 {
25701 return;
25702 }
25703 localAI[1] = 0f;
25704 bool flag41 = Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height);
25705 if (localAI[3] > 0f)
25706 {
25707 flag41 = true;
25708 localAI[3] = 0f;
25709 }
25710 if (flag41)
25711 {
25712 Vector2 vector99 = new Vector2(base.Center.X, base.Center.Y);
25713 float num788 = 15f;
25714 if (Main.expertMode)
25715 {
25716 num788 = 17f;
25717 }
25718 float num789 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector99.X;
25719 float num790 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector99.Y;
25720 float num791 = (float)Math.Sqrt(num789 * num789 + num790 * num790);
25721 num791 = num788 / num791;
25722 num789 *= num791;
25723 num790 *= num791;
25724 int num792 = 22;
25725 int num793 = 275;
25726 int maxValue2 = 4;
25727 int maxValue3 = 8;
25728 if (Main.expertMode)
25729 {
25730 maxValue2 = 2;
25731 maxValue3 = 6;
25732 }
25733 if ((double)life < (double)lifeMax * 0.8 && Main.rand.Next(maxValue2) == 0)
25734 {
25735 num792 = 27;
25736 localAI[1] = -30f;
25737 num793 = 276;
25738 }
25739 else if ((double)life < (double)lifeMax * 0.8 && Main.rand.Next(maxValue3) == 0)
25740 {
25741 num792 = 31;
25742 localAI[1] = -120f;
25743 num793 = 277;
25744 }
25745 if (flag39)
25746 {
25747 num792 *= 2;
25748 }
25750 vector99.X += num789 * 3f;
25751 vector99.Y += num790 * 3f;
25753 if (num793 != 277)
25754 {
25755 Main.projectile[num794].timeLeft = 300;
25756 }
25757 }
25758 return;
25759 }
25760 defense = 10;
25761 int num795 = 70;
25762 if (flag39)
25763 {
25764 defense *= 4;
25765 num795 *= 2;
25766 }
25768 if (Main.netMode != 1)
25769 {
25770 if (localAI[0] == 1f)
25771 {
25772 localAI[0] = 2f;
25773 int num796 = 8;
25774 if (Main.getGoodWorld)
25775 {
25776 num796 += 6;
25777 }
25778 for (int num797 = 0; num797 < num796; num797++)
25779 {
25780 int num798 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 264, whoAmI);
25781 }
25782 if (Main.expertMode)
25783 {
25784 for (int num799 = 0; num799 < 200; num799++)
25785 {
25786 if (Main.npc[num799].active && Main.npc[num799].aiStyle == 52)
25787 {
25788 for (int num800 = 0; num800 < num796 / 2 - 1; num800++)
25789 {
25790 int num801 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 264, whoAmI);
25791 Main.npc[num801].ai[3] = num799 + 1;
25792 }
25793 }
25794 }
25795 }
25796 }
25797 else if (Main.expertMode && Main.rand.Next(60) == 0)
25798 {
25799 int num802 = 0;
25800 for (int num803 = 0; num803 < 200; num803++)
25801 {
25802 if (Main.npc[num803].active && Main.npc[num803].type == 264 && Main.npc[num803].ai[3] == 0f)
25803 {
25804 num802++;
25805 }
25806 }
25807 if (num802 < 8 && Main.rand.Next((num802 + 1) * 10) <= 1)
25808 {
25809 int num804 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 264, whoAmI);
25810 }
25811 }
25812 }
25813 if (localAI[2] == 0f)
25814 {
25815 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 378, scale);
25816 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 379, scale);
25817 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 380, scale);
25818 localAI[2] = 1f;
25819 }
25820 if (Main.netMode == 1)
25821 {
25822 return;
25823 }
25824 localAI[1] += 1f;
25825 if ((double)life < (double)lifeMax * 0.4)
25826 {
25827 localAI[1] += 1f;
25828 }
25829 if ((double)life < (double)lifeMax * 0.3)
25830 {
25831 localAI[1] += 1f;
25832 }
25833 if ((double)life < (double)lifeMax * 0.2)
25834 {
25835 localAI[1] += 1f;
25836 }
25837 if ((double)life < (double)lifeMax * 0.1)
25838 {
25839 localAI[1] += 1f;
25840 }
25841 if (localAI[1] >= 350f)
25842 {
25843 float num805 = 8f;
25844 Vector2 vector100 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
25845 float num806 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector100.X + (float)Main.rand.Next(-10, 11);
25846 float num807 = Math.Abs(num806 * 0.2f);
25847 float num808 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector100.Y + (float)Main.rand.Next(-10, 11);
25848 if (num808 > 0f)
25849 {
25850 num807 = 0f;
25851 }
25852 num808 -= num807;
25853 float num809 = (float)Math.Sqrt(num806 * num806 + num808 * num808);
25854 num809 = num805 / num809;
25855 num806 *= num809;
25856 num808 *= num809;
25857 int num810 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 265);
25858 Main.npc[num810].velocity.X = num806;
25859 Main.npc[num810].velocity.Y = num808;
25860 Main.npc[num810].netUpdate = true;
25861 localAI[1] = 0f;
25862 }
25863 }
25864 else if (aiStyle == 52)
25865 {
25866 bool flag42 = false;
25867 bool flag43 = false;
25868 if (plantBoss < 0)
25869 {
25870 StrikeNPCNoInteraction(9999, 0f, 0);
25871 netUpdate = true;
25872 return;
25873 }
25874 if (Main.player[Main.npc[plantBoss].target].dead)
25875 {
25876 flag43 = true;
25877 }
25878 if ((plantBoss != -1 && !Main.player[Main.npc[plantBoss].target].ZoneJungle) || (double)Main.player[Main.npc[plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[plantBoss].target].position.Y > (float)(Main.UnderworldLayer * 16) || flag43)
25879 {
25880 localAI[0] -= 4f;
25881 flag42 = true;
25882 }
25883 if (Main.netMode == 1)
25884 {
25885 if (this.ai[0] == 0f)
25886 {
25887 this.ai[0] = (int)(base.Center.X / 16f);
25888 }
25889 if (this.ai[1] == 0f)
25890 {
25891 this.ai[1] = (int)(base.Center.X / 16f);
25892 }
25893 }
25894 if (Main.netMode != 1)
25895 {
25896 if (this.ai[0] == 0f || this.ai[1] == 0f)
25897 {
25898 localAI[0] = 0f;
25899 }
25900 localAI[0] -= 1f;
25901 if (Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 2)
25902 {
25903 localAI[0] -= 2f;
25904 }
25905 if (Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 4)
25906 {
25907 localAI[0] -= 2f;
25908 }
25909 if (flag42)
25910 {
25911 localAI[0] -= 6f;
25912 }
25913 if (!flag43 && localAI[0] <= 0f && this.ai[0] != 0f)
25914 {
25915 for (int num811 = 0; num811 < 200; num811++)
25916 {
25917 if (num811 != whoAmI && Main.npc[num811].active && Main.npc[num811].type == type && (Main.npc[num811].velocity.X != 0f || Main.npc[num811].velocity.Y != 0f))
25918 {
25919 localAI[0] = Main.rand.Next(60, 300);
25920 }
25921 }
25922 }
25923 if (localAI[0] <= 0f)
25924 {
25925 localAI[0] = Main.rand.Next(300, 600);
25926 bool flag44 = false;
25927 int num812 = 0;
25928 while (!flag44 && num812 <= 1000)
25929 {
25930 num812++;
25931 int num813 = (int)(Main.player[Main.npc[plantBoss].target].Center.X / 16f);
25932 int num814 = (int)(Main.player[Main.npc[plantBoss].target].Center.Y / 16f);
25933 if (this.ai[0] == 0f)
25934 {
25935 num813 = (int)((Main.player[Main.npc[plantBoss].target].Center.X + Main.npc[plantBoss].Center.X) / 32f);
25936 num814 = (int)((Main.player[Main.npc[plantBoss].target].Center.Y + Main.npc[plantBoss].Center.Y) / 32f);
25937 }
25938 if (flag43)
25939 {
25940 num813 = (int)Main.npc[plantBoss].position.X / 16;
25941 num814 = (int)(Main.npc[plantBoss].position.Y + 400f) / 16;
25942 }
25943 int num815 = 20;
25944 num815 += (int)(100f * ((float)num812 / 1000f));
25945 int num816 = num813 + Main.rand.Next(-num815, num815 + 1);
25946 int num817 = num814 + Main.rand.Next(-num815, num815 + 1);
25947 if (Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 2 && Main.rand.Next(6) == 0)
25948 {
25949 TargetClosest();
25950 int num818 = (int)(Main.player[target].Center.X / 16f);
25951 int num819 = (int)(Main.player[target].Center.Y / 16f);
25952 if (Main.tile[num818, num819].wall > 0)
25953 {
25954 num816 = num818;
25955 num817 = num819;
25956 }
25957 }
25958 try
25959 {
25960 if (WorldGen.InWorld(num816, num817) && (WorldGen.SolidTile(num816, num817) || (Main.tile[num816, num817].wall > 0 && (num812 > 500 || Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 2))))
25961 {
25962 flag44 = true;
25963 this.ai[0] = num816;
25964 this.ai[1] = num817;
25965 netUpdate = true;
25966 }
25967 }
25968 catch
25969 {
25970 }
25971 }
25972 }
25973 }
25974 if (!(this.ai[0] > 0f) || !(this.ai[1] > 0f))
25975 {
25976 return;
25977 }
25978 float num820 = 6f;
25979 if (Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 2)
25980 {
25981 num820 = 8f;
25982 }
25983 if (Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 4)
25984 {
25985 num820 = 10f;
25986 }
25987 if (Main.expertMode)
25988 {
25989 num820 += 1f;
25990 }
25991 if (Main.expertMode && Main.npc[plantBoss].life < Main.npc[plantBoss].lifeMax / 2)
25992 {
25993 num820 += 1f;
25994 }
25995 if (flag42)
25996 {
25997 num820 *= 2f;
25998 }
25999 if (flag43)
26000 {
26001 num820 *= 2f;
26002 }
26003 Vector2 vector101 = new Vector2(base.Center.X, base.Center.Y);
26004 float num821 = this.ai[0] * 16f - 8f - vector101.X;
26005 float num822 = this.ai[1] * 16f - 8f - vector101.Y;
26006 float num823 = (float)Math.Sqrt(num821 * num821 + num822 * num822);
26007 if (num823 < 12f + num820)
26008 {
26009 if (Main.netMode != 1 && Main.getGoodWorld && localAI[3] == 1f)
26010 {
26011 localAI[3] = 0f;
26013 }
26014 velocity.X = num821;
26015 velocity.Y = num822;
26016 }
26017 else
26018 {
26019 if (Main.netMode != 1 && Main.getGoodWorld)
26020 {
26021 localAI[3] = 1f;
26022 }
26023 num823 = num820 / num823;
26024 velocity.X = num821 * num823;
26025 velocity.Y = num822 * num823;
26026 }
26027 Vector2 vector102 = new Vector2(base.Center.X, base.Center.Y);
26028 float num824 = Main.npc[plantBoss].Center.X - vector102.X;
26029 float num825 = Main.npc[plantBoss].Center.Y - vector102.Y;
26030 rotation = (float)Math.Atan2(num825, num824) - 1.57f;
26031 }
26032 else if (aiStyle == 53)
26033 {
26034 if (Main.getGoodWorld)
26035 {
26036 if (Main.rand.Next(10) == 0)
26037 {
26038 reflectsProjectiles = true;
26039 }
26040 else
26041 {
26042 reflectsProjectiles = false;
26043 }
26044 }
26045 if (plantBoss < 0)
26046 {
26047 StrikeNPCNoInteraction(9999, 0f, 0);
26048 netUpdate = true;
26049 return;
26050 }
26051 int num826 = plantBoss;
26052 if (this.ai[3] > 0f)
26053 {
26054 num826 = (int)this.ai[3] - 1;
26055 }
26056 if (Main.netMode != 1)
26057 {
26058 localAI[0] -= 1f;
26059 if (localAI[0] <= 0f)
26060 {
26061 localAI[0] = Main.rand.Next(120, 480);
26062 this.ai[0] = Main.rand.Next(-100, 101);
26063 this.ai[1] = Main.rand.Next(-100, 101);
26064 netUpdate = true;
26065 }
26066 }
26067 TargetClosest();
26068 float num827 = 0.2f;
26069 float num828 = 200f;
26070 if ((double)Main.npc[plantBoss].life < (double)Main.npc[plantBoss].lifeMax * 0.25)
26071 {
26072 num828 += 100f;
26073 }
26074 if ((double)Main.npc[plantBoss].life < (double)Main.npc[plantBoss].lifeMax * 0.1)
26075 {
26076 num828 += 100f;
26077 }
26078 if (Main.expertMode)
26079 {
26080 float num829 = 1f - (float)life / (float)lifeMax;
26081 num828 += num829 * 300f;
26082 num827 += 0.3f;
26083 }
26084 if (Main.getGoodWorld)
26085 {
26086 num827 += 4f;
26087 }
26088 if (!Main.npc[num826].active || plantBoss < 0)
26089 {
26090 active = false;
26091 return;
26092 }
26093 float num830 = Main.npc[num826].position.X + (float)(Main.npc[num826].width / 2);
26094 float num831 = Main.npc[num826].position.Y + (float)(Main.npc[num826].height / 2);
26096 float num832 = num830 + this.ai[0];
26097 float num833 = num831 + this.ai[1];
26098 float num834 = num832 - vector103.X;
26099 float num835 = num833 - vector103.Y;
26100 float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835);
26101 num836 = num828 / num836;
26102 num834 *= num836;
26103 num835 *= num836;
26104 if (position.X < num830 + num834)
26105 {
26106 velocity.X += num827;
26107 if (velocity.X < 0f && num834 > 0f)
26108 {
26109 velocity.X *= 0.9f;
26110 }
26111 }
26112 else if (position.X > num830 + num834)
26113 {
26114 velocity.X -= num827;
26115 if (velocity.X > 0f && num834 < 0f)
26116 {
26117 velocity.X *= 0.9f;
26118 }
26119 }
26120 if (position.Y < num831 + num835)
26121 {
26122 velocity.Y += num827;
26123 if (velocity.Y < 0f && num835 > 0f)
26124 {
26125 velocity.Y *= 0.9f;
26126 }
26127 }
26128 else if (position.Y > num831 + num835)
26129 {
26130 velocity.Y -= num827;
26131 if (velocity.Y > 0f && num835 < 0f)
26132 {
26133 velocity.Y *= 0.9f;
26134 }
26135 }
26136 if (velocity.X > 8f)
26137 {
26138 velocity.X = 8f;
26139 }
26140 if (velocity.X < -8f)
26141 {
26142 velocity.X = -8f;
26143 }
26144 if (velocity.Y > 8f)
26145 {
26146 velocity.Y = 8f;
26147 }
26148 if (velocity.Y < -8f)
26149 {
26150 velocity.Y = -8f;
26151 }
26152 if (num834 > 0f)
26153 {
26154 spriteDirection = 1;
26155 rotation = (float)Math.Atan2(num835, num834);
26156 }
26157 if (num834 < 0f)
26158 {
26159 spriteDirection = -1;
26160 rotation = (float)Math.Atan2(num835, num834) + 3.14f;
26161 }
26162 }
26163 else if (aiStyle == 54)
26164 {
26166 if (Main.netMode != 1 && localAI[0] == 0f)
26167 {
26168 localAI[0] = 1f;
26171 {
26172 float x2 = base.Center.X;
26173 float y4 = base.Center.Y;
26174 x2 += (float)Main.rand.Next(-width, width);
26175 y4 += (float)Main.rand.Next(-height, height);
26176 int num838 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)x2, (int)y4, 267);
26177 Main.npc[num838].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f);
26178 Main.npc[num838].netUpdate = true;
26179 }
26180 }
26181 if (Main.netMode != 1)
26182 {
26183 TargetClosest();
26184 int num839 = 6000;
26185 if (Math.Abs(base.Center.X - Main.player[target].Center.X) + Math.Abs(base.Center.Y - Main.player[target].Center.Y) > (float)num839)
26186 {
26187 active = false;
26188 life = 0;
26189 if (Main.netMode == 2)
26190 {
26191 NetMessage.SendData(23, -1, -1, null, whoAmI);
26192 }
26193 }
26194 }
26195 if (this.ai[0] < 0f)
26196 {
26197 if (Main.getGoodWorld)
26198 {
26200 }
26201 if (localAI[2] == 0f)
26202 {
26203 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
26204 localAI[2] = 1f;
26205 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392);
26206 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393);
26207 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394);
26208 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395);
26209 for (int num840 = 0; num840 < 20; num840++)
26210 {
26211 Dust.NewDust(position, width, height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f);
26212 }
26213 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
26214 }
26215 dontTakeDamage = false;
26216 TargetClosest();
26217 Vector2 vector104 = new Vector2(base.Center.X, base.Center.Y);
26218 float num841 = Main.player[target].Center.X - vector104.X;
26219 float num842 = Main.player[target].Center.Y - vector104.Y;
26220 float num843 = (float)Math.Sqrt(num841 * num841 + num842 * num842);
26221 float num844 = 8f;
26222 num843 = num844 / num843;
26223 num841 *= num843;
26224 num842 *= num843;
26225 velocity.X = (velocity.X * 50f + num841) / 51f;
26226 velocity.Y = (velocity.Y * 50f + num842) / 51f;
26227 if (this.ai[0] == -1f)
26228 {
26229 if (Main.netMode != 1)
26230 {
26231 localAI[1] += 1f;
26232 if (justHit)
26233 {
26234 localAI[1] -= Main.rand.Next(5);
26235 }
26236 int num845 = 60 + Main.rand.Next(120);
26237 if (Main.netMode != 0)
26238 {
26239 num845 += Main.rand.Next(30, 90);
26240 }
26241 if (localAI[1] >= (float)num845)
26242 {
26243 localAI[1] = 0f;
26244 TargetClosest();
26245 int num846 = 0;
26247 do
26248 {
26249 num846++;
26250 int num847 = (int)player2.Center.X / 16;
26251 int num848 = (int)player2.Center.Y / 16;
26252 int minValue = 10;
26253 int num849 = 12;
26254 float num850 = 16f;
26255 int num851 = Main.rand.Next(minValue, num849 + 1);
26256 int num852 = Main.rand.Next(minValue, num849 + 1);
26257 if (Main.rand.Next(2) == 0)
26258 {
26259 num851 *= -1;
26260 }
26261 if (Main.rand.Next(2) == 0)
26262 {
26263 num852 *= -1;
26264 }
26265 Vector2 v = new Vector2(num851 * 16, num852 * 16);
26266 if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), v.SafeNormalize(Vector2.UnitY)) > 0f)
26267 {
26268 v += v.SafeNormalize(Vector2.Zero) * num850 * player2.velocity.Length();
26269 }
26270 num847 += (int)(v.X / 16f);
26271 num848 += (int)(v.Y / 16f);
26272 if (num846 > 100 || !WorldGen.SolidTile(num847, num848))
26273 {
26274 this.ai[3] = 0f;
26275 this.ai[0] = -2f;
26276 this.ai[1] = num847;
26277 this.ai[2] = num848;
26278 netUpdate = true;
26279 netSpam = 0;
26280 break;
26281 }
26282 }
26283 while (num846 <= 100);
26284 }
26285 }
26286 }
26287 else if (this.ai[0] == -2f)
26288 {
26289 velocity *= 0.9f;
26290 if (Main.netMode != 0)
26291 {
26292 this.ai[3] += 15f;
26293 }
26294 else
26295 {
26296 this.ai[3] += 25f;
26297 }
26298 if (this.ai[3] >= 255f)
26299 {
26300 this.ai[3] = 255f;
26301 position.X = this.ai[1] * 16f - (float)(width / 2);
26302 position.Y = this.ai[2] * 16f - (float)(height / 2);
26304 this.ai[0] = -3f;
26305 netUpdate = true;
26306 netSpam = 0;
26307 }
26308 alpha = (int)this.ai[3];
26309 }
26310 else if (this.ai[0] == -3f)
26311 {
26312 if (Main.netMode != 0)
26313 {
26314 this.ai[3] -= 15f;
26315 }
26316 else
26317 {
26318 this.ai[3] -= 25f;
26319 }
26320 if (this.ai[3] <= 0f)
26321 {
26322 this.ai[3] = 0f;
26323 this.ai[0] = -1f;
26324 netUpdate = true;
26325 netSpam = 0;
26326 }
26327 alpha = (int)this.ai[3];
26328 }
26329 }
26330 else
26331 {
26332 TargetClosest();
26333 Vector2 vector105 = new Vector2(base.Center.X, base.Center.Y);
26334 float num853 = Main.player[target].Center.X - vector105.X;
26335 float num854 = Main.player[target].Center.Y - vector105.Y;
26336 float num855 = (float)Math.Sqrt(num853 * num853 + num854 * num854);
26337 float num856 = 1f;
26338 if (Main.getGoodWorld)
26339 {
26340 num856 *= 3f;
26341 }
26342 if (num855 < num856)
26343 {
26344 velocity.X = num853;
26345 velocity.Y = num854;
26346 }
26347 else
26348 {
26349 num855 = num856 / num855;
26350 velocity.X = num853 * num855;
26351 velocity.Y = num854 * num855;
26352 }
26353 if (this.ai[0] == 0f)
26354 {
26355 if (Main.netMode != 1)
26356 {
26357 int num857 = 0;
26358 for (int num858 = 0; num858 < 200; num858++)
26359 {
26360 if (Main.npc[num858].active && Main.npc[num858].type == 267)
26361 {
26362 num857++;
26363 }
26364 }
26365 if (num857 == 0)
26366 {
26367 this.ai[0] = -1f;
26368 localAI[1] = 0f;
26369 alpha = 0;
26370 netUpdate = true;
26371 }
26372 localAI[1] += 1f;
26373 if (localAI[1] >= (float)(120 + Main.rand.Next(300)))
26374 {
26375 localAI[1] = 0f;
26376 TargetClosest();
26377 int num859 = 0;
26379 do
26380 {
26381 num859++;
26382 int num860 = (int)player3.Center.X / 16;
26383 int num861 = (int)player3.Center.Y / 16;
26384 int minValue2 = 12;
26385 int num862 = 40;
26386 float num863 = 16f;
26387 int num864 = Main.rand.Next(minValue2, num862 + 1);
26388 int num865 = Main.rand.Next(minValue2, num862 + 1);
26389 if (Main.rand.Next(2) == 0)
26390 {
26391 num864 *= -1;
26392 }
26393 if (Main.rand.Next(2) == 0)
26394 {
26395 num865 *= -1;
26396 }
26397 Vector2 v2 = new Vector2(num864 * 16, num865 * 16);
26398 if (Vector2.Dot(player3.velocity.SafeNormalize(Vector2.UnitY), v2.SafeNormalize(Vector2.UnitY)) > 0f)
26399 {
26400 v2 += v2.SafeNormalize(Vector2.Zero) * num863 * player3.velocity.Length();
26401 }
26402 num860 += (int)(v2.X / 16f);
26403 num861 += (int)(v2.Y / 16f);
26404 if (num859 > 100 || (!WorldGen.SolidTile(num860, num861) && (num859 > 75 || Collision.CanHit(new Vector2(num860 * 16, num861 * 16), 1, 1, Main.player[target].position, Main.player[target].width, Main.player[target].height))))
26405 {
26406 this.ai[0] = 1f;
26407 this.ai[1] = num860;
26408 this.ai[2] = num861;
26409 netUpdate = true;
26410 break;
26411 }
26412 }
26413 while (num859 <= 100);
26414 }
26415 }
26416 }
26417 else if (this.ai[0] == 1f)
26418 {
26419 alpha += 5;
26420 if (alpha >= 255)
26421 {
26423 alpha = 255;
26424 position.X = this.ai[1] * 16f - (float)(width / 2);
26425 position.Y = this.ai[2] * 16f - (float)(height / 2);
26426 this.ai[0] = 2f;
26427 }
26428 }
26429 else if (this.ai[0] == 2f)
26430 {
26431 alpha -= 5;
26432 if (alpha <= 0)
26433 {
26434 alpha = 0;
26435 this.ai[0] = 0f;
26436 }
26437 }
26438 }
26439 if (Main.player[target].dead || !Main.player[target].ZoneCrimson)
26440 {
26441 if (localAI[3] < 120f)
26442 {
26443 localAI[3]++;
26444 }
26445 if (localAI[3] > 60f)
26446 {
26447 velocity.Y += (localAI[3] - 60f) * 0.25f;
26448 }
26449 this.ai[0] = 2f;
26450 alpha = 10;
26451 }
26452 else if (localAI[3] > 0f)
26453 {
26454 localAI[3]--;
26455 }
26456 }
26457 else if (aiStyle == 55)
26458 {
26459 if (crimsonBoss < 0)
26460 {
26461 active = false;
26462 netUpdate = true;
26463 return;
26464 }
26465 if (this.ai[0] == 0f)
26466 {
26467 this.ai[1] = 0f;
26468 Vector2 vector106 = new Vector2(base.Center.X, base.Center.Y);
26469 float num866 = Main.npc[crimsonBoss].Center.X - vector106.X;
26470 float num867 = Main.npc[crimsonBoss].Center.Y - vector106.Y;
26471 float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867);
26472 if (num868 > 90f)
26473 {
26474 num868 = 8f / num868;
26475 num866 *= num868;
26476 num867 *= num868;
26477 velocity.X = (velocity.X * 15f + num866) / 16f;
26478 velocity.Y = (velocity.Y * 15f + num867) / 16f;
26479 return;
26480 }
26481 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 8f)
26482 {
26483 velocity.Y *= 1.05f;
26484 velocity.X *= 1.05f;
26485 }
26486 if (Main.netMode != 1 && ((Main.expertMode && Main.rand.Next(100) == 0) || Main.rand.Next(200) == 0))
26487 {
26488 TargetClosest();
26489 vector106 = new Vector2(base.Center.X, base.Center.Y);
26490 num866 = Main.player[target].Center.X - vector106.X;
26491 num867 = Main.player[target].Center.Y - vector106.Y;
26492 num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867);
26493 num868 = 8f / num868;
26494 velocity.X = num866 * num868;
26495 velocity.Y = num867 * num868;
26496 this.ai[0] = 1f;
26497 netUpdate = true;
26498 }
26499 return;
26500 }
26501 if (Main.expertMode)
26502 {
26503 Vector2 vector107 = Main.player[target].Center - base.Center;
26504 vector107.Normalize();
26505 if (Main.getGoodWorld)
26506 {
26507 vector107 *= 12f;
26508 velocity = (velocity * 49f + vector107) / 50f;
26509 }
26510 else
26511 {
26512 vector107 *= 9f;
26513 velocity = (velocity * 99f + vector107) / 100f;
26514 }
26515 }
26516 Vector2 vector108 = new Vector2(base.Center.X, base.Center.Y);
26517 float num869 = Main.npc[crimsonBoss].Center.X - vector108.X;
26518 float num870 = Main.npc[crimsonBoss].Center.Y - vector108.Y;
26519 float num871 = (float)Math.Sqrt(num869 * num869 + num870 * num870);
26520 if (num871 > 700f)
26521 {
26522 this.ai[0] = 0f;
26523 }
26524 else
26525 {
26526 if (!justHit)
26527 {
26528 return;
26529 }
26530 if (knockBackResist == 0f)
26531 {
26532 this.ai[1] += 1f;
26533 if (this.ai[1] > 5f)
26534 {
26535 this.ai[0] = 0f;
26536 }
26537 }
26538 else
26539 {
26540 this.ai[0] = 0f;
26541 }
26542 }
26543 }
26544 else if (aiStyle == 56)
26545 {
26546 TargetClosest();
26547 Vector2 vector109 = new Vector2(base.Center.X, base.Center.Y);
26548 float num872 = Main.player[target].Center.X - vector109.X;
26549 float num873 = Main.player[target].Center.Y - vector109.Y;
26550 float num874 = (float)Math.Sqrt(num872 * num872 + num873 * num873);
26551 float num875 = 12f;
26552 num874 = num875 / num874;
26553 num872 *= num874;
26554 num873 *= num874;
26555 velocity.X = (velocity.X * 100f + num872) / 101f;
26556 velocity.Y = (velocity.Y * 100f + num873) / 101f;
26557 rotation = (float)Math.Atan2(num873, num872) - 1.57f;
26559 int num876 = Dust.NewDust(position, width, height, 180);
26560 Dust dust = Main.dust[num876];
26561 dust.velocity *= 0.1f;
26562 Main.dust[num876].scale = 1.3f;
26563 Main.dust[num876].noGravity = true;
26565 }
26566 else if (aiStyle == 57)
26567 {
26568 float num877 = 2f;
26569 noGravity = true;
26570 noTileCollide = true;
26571 if (!Main.dayTime)
26572 {
26573 TargetClosest();
26574 }
26575 bool flag45 = false;
26576 if ((double)life < (double)lifeMax * 0.75)
26577 {
26578 num877 = 3f;
26579 }
26580 if ((double)life < (double)lifeMax * 0.5)
26581 {
26582 num877 = 4f;
26583 }
26584 if (type == 344)
26585 {
26586 Lighting.AddLight(base.Bottom + new Vector2(0f, -30f), 0.3f, 0.16f, 0.125f);
26587 }
26588 if (type == 325)
26589 {
26590 Lighting.AddLight(base.Bottom + new Vector2(0f, -30f), 0.3f, 0.125f, 0.06f);
26591 }
26592 if (Main.dayTime)
26593 {
26594 EncourageDespawn(10);
26595 num877 = 8f;
26596 }
26597 else if (this.ai[0] == 0f)
26598 {
26599 this.ai[1] += 1f;
26600 if ((double)life < (double)lifeMax * 0.5)
26601 {
26602 this.ai[1] += 1f;
26603 }
26604 if ((double)life < (double)lifeMax * 0.25)
26605 {
26606 this.ai[1] += 1f;
26607 }
26608 if (this.ai[1] >= 300f && Main.netMode != 1)
26609 {
26610 this.ai[1] = 0f;
26611 if ((double)life < (double)lifeMax * 0.25 && type != 344)
26612 {
26613 this.ai[0] = Main.rand.Next(3, 5);
26614 }
26615 else
26616 {
26617 this.ai[0] = Main.rand.Next(1, 3);
26618 }
26619 netUpdate = true;
26620 }
26621 }
26622 else if (this.ai[0] == 1f)
26623 {
26624 if (type == 344)
26625 {
26626 if (Main.rand.Next(5) == 0)
26627 {
26628 int num878 = Dust.NewDust(position + Main.rand.NextVector2Square(0f, 1f) * base.Size - new Vector2(1f, 2f), 10, 14, 245, 0f, 0f, 254, Color.Transparent, 0.25f);
26629 Dust dust = Main.dust[num878];
26630 dust.velocity *= 0.2f;
26631 }
26632 flag45 = true;
26633 this.ai[1] += 1f;
26634 if (this.ai[1] % 5f == 0f)
26635 {
26636 Vector2 vector110 = new Vector2(position.X + 20f + (float)Main.rand.Next(width - 40), position.Y + 20f + (float)Main.rand.Next(height - 40));
26637 float num879 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector110.X;
26638 float num880 = Main.player[target].position.Y - vector110.Y;
26639 num879 += (float)Main.rand.Next(-50, 51);
26640 num880 += (float)Main.rand.Next(-50, 51);
26641 num880 -= Math.Abs(num879) * ((float)Main.rand.Next(0, 21) * 0.01f);
26642 float num881 = (float)Math.Sqrt(num879 * num879 + num880 * num880);
26643 float num882 = 12.5f;
26644 num881 = num882 / num881;
26645 num879 *= num881;
26646 num880 *= num881;
26647 num879 *= 1f + (float)Main.rand.Next(-20, 21) * 0.02f;
26648 num880 *= 1f + (float)Main.rand.Next(-20, 21) * 0.02f;
26650 }
26651 if (this.ai[1] >= 180f)
26652 {
26653 this.ai[1] = 0f;
26654 this.ai[0] = 0f;
26655 }
26656 }
26657 else
26658 {
26659 flag45 = true;
26660 this.ai[1] += 1f;
26661 if (this.ai[1] % 15f == 0f)
26662 {
26663 Vector2 vector111 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
26664 float num884 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector111.X;
26665 float num885 = Main.player[target].position.Y - vector111.Y;
26666 float num886 = (float)Math.Sqrt(num884 * num884 + num885 * num885);
26667 float num887 = 10f;
26668 num886 = num887 / num886;
26669 num884 *= num886;
26670 num885 *= num886;
26671 num884 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
26672 num885 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
26674 }
26675 if (this.ai[1] >= 120f)
26676 {
26677 this.ai[1] = 0f;
26678 this.ai[0] = 0f;
26679 }
26680 }
26681 }
26682 else if (this.ai[0] == 2f)
26683 {
26684 if (type == 344)
26685 {
26686 flag45 = true;
26687 this.ai[1] += 1f;
26688 if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 15f == 0f)
26689 {
26690 float num889 = 4.5f;
26691 Vector2 vector112 = new Vector2(position.X + 20f + (float)Main.rand.Next(width - 40), position.Y + 60f + (float)Main.rand.Next(height - 80));
26692 float num890 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector112.X;
26693 float num891 = Main.player[target].position.Y - vector112.Y;
26694 num891 -= Math.Abs(num890) * 0.3f;
26695 num889 += Math.Abs(num890) * 0.004f;
26696 num890 += (float)Main.rand.Next(-50, 51);
26697 num891 -= (float)Main.rand.Next(50, 201);
26698 float num892 = (float)Math.Sqrt(num890 * num890 + num891 * num891);
26699 num892 = num889 / num892;
26700 num890 *= num892;
26701 num891 *= num892;
26702 num890 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26703 num891 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26705 }
26706 if (this.ai[1] >= 300f)
26707 {
26708 this.ai[1] = 0f;
26709 this.ai[0] = 0f;
26710 }
26711 }
26712 else
26713 {
26714 flag45 = true;
26715 this.ai[1] += 1f;
26716 if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 8f == 0f)
26717 {
26718 float num894 = 10f;
26719 Vector2 vector113 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
26720 float num895 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector113.X;
26721 float num896 = Main.player[target].position.Y - vector113.Y;
26722 num896 -= Math.Abs(num895) * 0.3f;
26723 num894 += Math.Abs(num895) * 0.004f;
26724 if (num894 > 14f)
26725 {
26726 num894 = 14f;
26727 }
26728 num895 += (float)Main.rand.Next(-50, 51);
26729 num896 -= (float)Main.rand.Next(50, 201);
26730 float num897 = (float)Math.Sqrt(num895 * num895 + num896 * num896);
26731 num897 = num894 / num897;
26732 num895 *= num897;
26733 num896 *= num897;
26734 num895 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26735 num896 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26737 }
26738 if (this.ai[1] >= 300f)
26739 {
26740 this.ai[1] = 0f;
26741 this.ai[0] = 0f;
26742 }
26743 }
26744 }
26745 else if (this.ai[0] == 3f)
26746 {
26747 num877 = 4f;
26748 this.ai[1] += 1f;
26749 if (this.ai[1] % 30f == 0f)
26750 {
26751 Vector2 vector114 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
26752 float num899 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector114.X;
26753 float num900 = Main.player[target].position.Y - vector114.Y;
26754 float num901 = (float)Math.Sqrt(num899 * num899 + num900 * num900);
26755 float num902 = 16f;
26756 num901 = num902 / num901;
26757 num899 *= num901;
26758 num900 *= num901;
26759 num899 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f;
26760 num900 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f;
26762 }
26763 if (this.ai[1] >= 120f)
26764 {
26765 this.ai[1] = 0f;
26766 this.ai[0] = 0f;
26767 }
26768 }
26769 else if (this.ai[0] == 4f)
26770 {
26771 num877 = 4f;
26772 this.ai[1] += 1f;
26773 if (this.ai[1] % 10f == 0f)
26774 {
26775 float num904 = 12f;
26776 Vector2 vector115 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
26777 float num905 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector115.X;
26778 float num906 = Main.player[target].position.Y - vector115.Y;
26779 num906 -= Math.Abs(num905) * 0.2f;
26780 num904 += Math.Abs(num905) * 0.002f;
26781 if (num904 > 16f)
26782 {
26783 num904 = 16f;
26784 }
26785 num905 += (float)Main.rand.Next(-50, 51);
26786 num906 -= (float)Main.rand.Next(50, 201);
26787 float num907 = (float)Math.Sqrt(num905 * num905 + num906 * num906);
26788 num907 = num904 / num907;
26789 num905 *= num907;
26790 num906 *= num907;
26791 num905 *= 1f + (float)Main.rand.Next(-30, 31) * 0.005f;
26792 num906 *= 1f + (float)Main.rand.Next(-30, 31) * 0.005f;
26794 }
26795 if (this.ai[1] >= 240f)
26796 {
26797 this.ai[1] = 0f;
26798 this.ai[0] = 0f;
26799 }
26800 }
26801 if (Math.Abs(base.Center.X - Main.player[target].Center.X) < 50f)
26802 {
26803 flag45 = true;
26804 }
26805 if (flag45)
26806 {
26807 velocity.X *= 0.9f;
26808 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
26809 {
26810 velocity.X = 0f;
26811 }
26812 }
26813 else
26814 {
26815 if (direction > 0)
26816 {
26817 velocity.X = (velocity.X * 20f + num877) / 21f;
26818 }
26819 if (direction < 0)
26820 {
26821 velocity.X = (velocity.X * 20f - num877) / 21f;
26822 }
26823 }
26824 int num909 = 80;
26825 int num910 = 20;
26826 Vector2 vector116 = new Vector2(base.Center.X - (float)(num909 / 2), position.Y + (float)height - (float)num910);
26827 bool flag46 = false;
26828 if (position.X < Main.player[target].position.X && position.X + (float)width > Main.player[target].position.X + (float)Main.player[target].width && position.Y + (float)height < Main.player[target].position.Y + (float)Main.player[target].height - 16f)
26829 {
26830 flag46 = true;
26831 }
26832 if (flag46)
26833 {
26834 velocity.Y += 0.5f;
26835 }
26837 {
26838 if (velocity.Y > 0f)
26839 {
26840 velocity.Y = 0f;
26841 }
26842 if ((double)velocity.Y > -0.2)
26843 {
26844 velocity.Y -= 0.025f;
26845 }
26846 else
26847 {
26848 velocity.Y -= 0.2f;
26849 }
26850 if (velocity.Y < -4f)
26851 {
26852 velocity.Y = -4f;
26853 }
26854 }
26855 else
26856 {
26857 if (velocity.Y < 0f)
26858 {
26859 velocity.Y = 0f;
26860 }
26861 if ((double)velocity.Y < 0.1)
26862 {
26863 velocity.Y += 0.025f;
26864 }
26865 else
26866 {
26867 velocity.Y += 0.5f;
26868 }
26869 }
26870 if (velocity.Y > 10f)
26871 {
26872 velocity.Y = 10f;
26873 }
26874 }
26875 else if (aiStyle == 58)
26876 {
26877 localAI[0] += 1f;
26878 if (localAI[0] > 6f)
26879 {
26880 localAI[0] = 0f;
26881 localAI[1] += 1f;
26882 if (localAI[1] > 4f)
26883 {
26884 localAI[1] = 0f;
26885 }
26886 }
26887 if (type == 327)
26888 {
26889 Lighting.AddLight(base.Center, 0.4f, 0.4f, 0.2f);
26890 }
26891 if (Main.netMode != 1)
26892 {
26893 localAI[2] += 1f;
26894 if (localAI[2] > 300f)
26895 {
26896 this.ai[3] = Main.rand.Next(3);
26897 localAI[2] = 0f;
26898 }
26899 else if (this.ai[3] == 0f && localAI[2] % 30f == 0f && localAI[2] > 30f)
26900 {
26901 float num911 = 5f;
26902 Vector2 vector117 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
26903 if (!WorldGen.SolidTile((int)vector117.X / 16, (int)vector117.Y / 16))
26904 {
26905 float num912 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector117.X;
26906 float num913 = Main.player[target].position.Y - vector117.Y;
26907 num912 += (float)Main.rand.Next(-50, 51);
26908 num913 += (float)Main.rand.Next(50, 201);
26909 num913 *= 0.2f;
26910 float num914 = (float)Math.Sqrt(num912 * num912 + num913 * num913);
26911 num914 = num911 / num914;
26912 num912 *= num914;
26913 num913 *= num914;
26914 num912 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26915 num913 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
26917 }
26918 }
26919 }
26920 if (this.ai[0] == 0f && Main.netMode != 1)
26921 {
26922 TargetClosest();
26923 this.ai[0] = 1f;
26924 int num916 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 328, whoAmI);
26925 Main.npc[num916].ai[0] = -1f;
26926 Main.npc[num916].ai[1] = whoAmI;
26927 Main.npc[num916].target = target;
26928 Main.npc[num916].netUpdate = true;
26929 num916 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)position.Y + height / 2, 328, whoAmI);
26930 Main.npc[num916].ai[0] = 1f;
26931 Main.npc[num916].ai[1] = whoAmI;
26932 Main.npc[num916].ai[3] = 150f;
26933 Main.npc[num916].target = target;
26934 Main.npc[num916].netUpdate = true;
26935 }
26936 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 2000f || Math.Abs(position.Y - Main.player[target].position.Y) > 2000f)
26937 {
26938 TargetClosest();
26939 if (Main.player[target].dead || Math.Abs(position.X - Main.player[target].position.X) > 2000f || Math.Abs(position.Y - Main.player[target].position.Y) > 2000f)
26940 {
26941 this.ai[1] = 2f;
26942 }
26943 }
26944 if (Main.dayTime)
26945 {
26946 velocity.Y += 0.3f;
26947 velocity.X *= 0.9f;
26948 }
26949 else if (this.ai[1] == 0f)
26950 {
26951 this.ai[2] += 1f;
26952 if (this.ai[2] >= 300f)
26953 {
26954 if (this.ai[3] != 1f)
26955 {
26956 this.ai[1] = 0f;
26957 this.ai[2] = 0f;
26958 }
26959 else
26960 {
26961 this.ai[2] = 0f;
26962 this.ai[1] = 1f;
26963 TargetClosest();
26964 netUpdate = true;
26965 }
26966 }
26967 Vector2 vector118 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
26968 float num917 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector118.X;
26969 float num918 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - 200f - vector118.Y;
26970 float num919 = (float)Math.Sqrt(num917 * num917 + num918 * num918);
26971 float num920 = 6f;
26972 if (this.ai[3] == 1f)
26973 {
26974 if (num919 > 900f)
26975 {
26976 num920 = 12f;
26977 }
26978 else if (num919 > 600f)
26979 {
26980 num920 = 10f;
26981 }
26982 else if (num919 > 300f)
26983 {
26984 num920 = 8f;
26985 }
26986 }
26987 if (num919 > 50f)
26988 {
26989 num919 = num920 / num919;
26990 velocity.X = (velocity.X * 14f + num917 * num919) / 15f;
26991 velocity.Y = (velocity.Y * 14f + num918 * num919) / 15f;
26992 }
26993 }
26994 else if (this.ai[1] == 1f)
26995 {
26996 this.ai[2] += 1f;
26997 if (this.ai[2] >= 600f || this.ai[3] != 1f)
26998 {
26999 this.ai[2] = 0f;
27000 this.ai[1] = 0f;
27001 }
27002 Vector2 vector119 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27003 float num921 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector119.X;
27004 float num922 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector119.Y;
27005 float num923 = (float)Math.Sqrt(num921 * num921 + num922 * num922);
27006 num923 = 16f / num923;
27007 velocity.X = (velocity.X * 49f + num921 * num923) / 50f;
27008 velocity.Y = (velocity.Y * 49f + num922 * num923) / 50f;
27009 }
27010 else if (this.ai[1] == 2f)
27011 {
27012 this.ai[1] = 3f;
27013 velocity.Y += 0.1f;
27014 if (velocity.Y < 0f)
27015 {
27016 velocity.Y *= 0.95f;
27017 }
27018 velocity.X *= 0.95f;
27019 EncourageDespawn(500);
27020 }
27021 rotation = velocity.X * -0.02f;
27022 }
27023 else if (aiStyle == 59)
27024 {
27025 spriteDirection = -(int)this.ai[0];
27026 if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 58)
27027 {
27028 this.ai[2] += 10f;
27029 if (this.ai[2] > 50f || Main.netMode != 2)
27030 {
27031 life = -1;
27032 HitEffect();
27033 active = false;
27034 }
27035 }
27036 if (Main.netMode != 1 && Main.npc[(int)this.ai[1]].ai[3] == 2f)
27037 {
27038 localAI[1] += 1f;
27039 if (localAI[1] > 90f)
27040 {
27041 localAI[1] = 0f;
27042 float num924 = 0.01f;
27043 Vector2 vector120 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f + 30f);
27044 float num925 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector120.X;
27045 float num926 = Main.player[target].position.Y - vector120.Y;
27046 float num927 = (float)Math.Sqrt(num925 * num925 + num926 * num926);
27047 num927 = num924 / num927;
27048 num925 *= num927;
27049 num926 *= num927;
27051 }
27052 }
27053 if (Main.dayTime)
27054 {
27055 velocity.Y += 0.3f;
27056 velocity.X *= 0.9f;
27057 }
27058 else if (this.ai[2] == 0f || this.ai[2] == 3f)
27059 {
27060 if (Main.npc[(int)this.ai[1]].ai[1] == 3f)
27061 {
27062 EncourageDespawn(10);
27063 }
27064 this.ai[3] += 1f;
27065 if (this.ai[3] >= 180f)
27066 {
27067 this.ai[2] += 1f;
27068 this.ai[3] = 0f;
27069 netUpdate = true;
27070 }
27071 Vector2 vector121 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27072 float num929 = (Main.player[target].Center.X + Main.npc[(int)this.ai[1]].Center.X) / 2f;
27073 float num930 = (Main.player[target].Center.Y + Main.npc[(int)this.ai[1]].Center.Y) / 2f;
27074 num929 += -170f * this.ai[0] - vector121.X;
27075 num930 += 90f - vector121.Y;
27076 float num931 = Math.Abs(Main.player[target].Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(Main.player[target].Center.Y - Main.npc[(int)this.ai[1]].Center.Y);
27077 if (num931 > 700f)
27078 {
27079 num929 = Main.npc[(int)this.ai[1]].Center.X - 170f * this.ai[0] - vector121.X;
27080 num930 = Main.npc[(int)this.ai[1]].Center.Y + 90f - vector121.Y;
27081 }
27082 float num932 = (float)Math.Sqrt(num929 * num929 + num930 * num930);
27083 float num933 = 6f;
27084 if (num932 > 1000f)
27085 {
27086 num933 = 21f;
27087 }
27088 else if (num932 > 800f)
27089 {
27090 num933 = 18f;
27091 }
27092 else if (num932 > 600f)
27093 {
27094 num933 = 15f;
27095 }
27096 else if (num932 > 400f)
27097 {
27098 num933 = 12f;
27099 }
27100 else if (num932 > 200f)
27101 {
27102 num933 = 9f;
27103 }
27104 if (this.ai[0] < 0f && base.Center.X > Main.npc[(int)this.ai[1]].Center.X)
27105 {
27106 num929 -= 4f;
27107 }
27108 if (this.ai[0] > 0f && base.Center.X < Main.npc[(int)this.ai[1]].Center.X)
27109 {
27110 num929 += 4f;
27111 }
27112 num932 = num933 / num932;
27113 velocity.X = (velocity.X * 14f + num929 * num932) / 15f;
27114 velocity.Y = (velocity.Y * 14f + num930 * num932) / 15f;
27115 num932 = (float)Math.Sqrt(num929 * num929 + num930 * num930);
27116 if (num932 > 20f)
27117 {
27118 rotation = (float)Math.Atan2(num930, num929) + 1.57f;
27119 }
27120 }
27121 else if (this.ai[2] == 1f)
27122 {
27123 Vector2 vector122 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27124 float num934 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector122.X;
27125 float num935 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector122.Y;
27126 float num936 = (float)Math.Sqrt(num934 * num934 + num935 * num935);
27127 rotation = (float)Math.Atan2(num935, num934) + 1.57f;
27128 velocity.X *= 0.95f;
27129 velocity.Y -= 0.3f;
27130 if (velocity.Y < -14f)
27131 {
27132 velocity.Y = -14f;
27133 }
27134 if (position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f)
27135 {
27136 TargetClosest();
27137 this.ai[2] = 2f;
27138 vector122 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27139 num934 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector122.X;
27140 num935 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector122.Y;
27141 num936 = (float)Math.Sqrt(num934 * num934 + num935 * num935);
27142 num936 = 18f / num936;
27143 velocity.X = num934 * num936;
27144 velocity.Y = num935 * num936;
27145 netUpdate = true;
27146 }
27147 }
27148 else if (this.ai[2] == 2f)
27149 {
27150 float num937 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y);
27151 if (position.Y > Main.player[target].position.Y || velocity.Y < 0f || num937 > 800f)
27152 {
27153 this.ai[2] = 3f;
27154 }
27155 }
27156 else if (this.ai[2] == 4f)
27157 {
27158 Vector2 vector123 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27159 float num938 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector123.X;
27160 float num939 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector123.Y;
27161 float num940 = (float)Math.Sqrt(num938 * num938 + num939 * num939);
27162 rotation = (float)Math.Atan2(num939, num938) + 1.57f;
27163 velocity.Y *= 0.95f;
27164 velocity.X += 0.3f * (0f - this.ai[0]);
27165 if (velocity.X < -14f)
27166 {
27167 velocity.X = -14f;
27168 }
27169 if (velocity.X > 14f)
27170 {
27171 velocity.X = 14f;
27172 }
27173 if (position.X + (float)(width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || position.X + (float)(width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f)
27174 {
27175 TargetClosest();
27176 this.ai[2] = 5f;
27177 vector123 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
27178 num938 = Main.player[target].position.X + (float)(Main.player[target].width / 2) - vector123.X;
27179 num939 = Main.player[target].position.Y + (float)(Main.player[target].height / 2) - vector123.Y;
27180 num940 = (float)Math.Sqrt(num938 * num938 + num939 * num939);
27181 num940 = 17f / num940;
27182 velocity.X = num938 * num940;
27183 velocity.Y = num939 * num940;
27184 netUpdate = true;
27185 }
27186 }
27187 else if (this.ai[2] == 5f)
27188 {
27189 float num941 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y);
27190 if ((velocity.X > 0f && position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2)) || (velocity.X < 0f && position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2)) || num941 > 800f)
27191 {
27192 this.ai[2] = 0f;
27193 }
27194 }
27195 }
27196 else if (aiStyle == 60)
27197 {
27198 if (Main.dayTime)
27199 {
27200 if (velocity.X > 0f)
27201 {
27202 velocity.X += 0.25f;
27203 }
27204 else
27205 {
27206 velocity.X -= 0.25f;
27207 }
27208 velocity.Y -= 0.1f;
27209 rotation = velocity.X * 0.05f;
27210 }
27211 else if (this.ai[0] == 0f)
27212 {
27213 if (this.ai[2] == 0f)
27214 {
27215 TargetClosest();
27216 if (base.Center.X < Main.player[target].Center.X)
27217 {
27218 this.ai[2] = 1f;
27219 }
27220 else
27221 {
27222 this.ai[2] = -1f;
27223 }
27224 }
27225 TargetClosest();
27226 int num942 = 800;
27227 float num943 = Math.Abs(base.Center.X - Main.player[target].Center.X);
27228 if (base.Center.X < Main.player[target].Center.X && this.ai[2] < 0f && num943 > (float)num942)
27229 {
27230 this.ai[2] = 0f;
27231 }
27232 if (base.Center.X > Main.player[target].Center.X && this.ai[2] > 0f && num943 > (float)num942)
27233 {
27234 this.ai[2] = 0f;
27235 }
27236 float num944 = 0.45f;
27237 float num945 = 7f;
27238 if ((double)life < (double)lifeMax * 0.75)
27239 {
27240 num944 = 0.55f;
27241 num945 = 8f;
27242 }
27243 if ((double)life < (double)lifeMax * 0.5)
27244 {
27245 num944 = 0.7f;
27246 num945 = 10f;
27247 }
27248 if ((double)life < (double)lifeMax * 0.25)
27249 {
27250 num944 = 0.8f;
27251 num945 = 11f;
27252 }
27253 velocity.X += this.ai[2] * num944;
27254 if (velocity.X > num945)
27255 {
27256 velocity.X = num945;
27257 }
27258 if (velocity.X < 0f - num945)
27259 {
27260 velocity.X = 0f - num945;
27261 }
27262 float num946 = Main.player[target].position.Y - (position.Y + (float)height);
27263 if (num946 < 150f)
27264 {
27265 velocity.Y -= 0.2f;
27266 }
27267 if (num946 > 200f)
27268 {
27269 velocity.Y += 0.2f;
27270 }
27271 if (velocity.Y > 8f)
27272 {
27273 velocity.Y = 8f;
27274 }
27275 if (velocity.Y < -8f)
27276 {
27277 velocity.Y = -8f;
27278 }
27279 rotation = velocity.X * 0.05f;
27280 if ((num943 < 500f || this.ai[3] < 0f) && position.Y < Main.player[target].position.Y)
27281 {
27282 this.ai[3] += 1f;
27283 int num947 = 13;
27284 if ((double)life < (double)lifeMax * 0.75)
27285 {
27286 num947 = 12;
27287 }
27288 if ((double)life < (double)lifeMax * 0.5)
27289 {
27290 num947 = 11;
27291 }
27292 if ((double)life < (double)lifeMax * 0.25)
27293 {
27294 num947 = 10;
27295 }
27296 num947++;
27297 if (this.ai[3] > (float)num947)
27298 {
27299 this.ai[3] = -num947;
27300 }
27301 if (this.ai[3] == 0f && Main.netMode != 1)
27302 {
27303 Vector2 vector124 = new Vector2(base.Center.X, base.Center.Y);
27304 vector124.X += velocity.X * 7f;
27305 float num948 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector124.X;
27306 float num949 = Main.player[target].Center.Y - vector124.Y;
27307 float num950 = (float)Math.Sqrt(num948 * num948 + num949 * num949);
27308 float num951 = 6f;
27309 if ((double)life < (double)lifeMax * 0.75)
27310 {
27311 num951 = 7f;
27312 }
27313 if ((double)life < (double)lifeMax * 0.5)
27314 {
27315 num951 = 8f;
27316 }
27317 if ((double)life < (double)lifeMax * 0.25)
27318 {
27319 num951 = 9f;
27320 }
27321 num950 = num951 / num950;
27322 num948 *= num950;
27323 num949 *= num950;
27325 }
27326 }
27327 else if (this.ai[3] < 0f)
27328 {
27329 this.ai[3] += 1f;
27330 }
27331 if (Main.netMode != 1)
27332 {
27333 this.ai[1] += Main.rand.Next(1, 4);
27334 if (this.ai[1] > 800f && num943 < 600f)
27335 {
27336 this.ai[0] = -1f;
27337 }
27338 }
27339 }
27340 else if (this.ai[0] == 1f)
27341 {
27342 TargetClosest();
27343 float num953 = 0.15f;
27344 float num954 = 7f;
27345 if ((double)life < (double)lifeMax * 0.75)
27346 {
27347 num953 = 0.17f;
27348 num954 = 8f;
27349 }
27350 if ((double)life < (double)lifeMax * 0.5)
27351 {
27352 num953 = 0.2f;
27353 num954 = 9f;
27354 }
27355 if ((double)life < (double)lifeMax * 0.25)
27356 {
27357 num953 = 0.25f;
27358 num954 = 10f;
27359 }
27360 num953 -= 0.05f;
27361 num954 -= 1f;
27362 if (base.Center.X < Main.player[target].Center.X)
27363 {
27364 velocity.X += num953;
27365 if (velocity.X < 0f)
27366 {
27367 velocity.X *= 0.98f;
27368 }
27369 }
27370 if (base.Center.X > Main.player[target].Center.X)
27371 {
27372 velocity.X -= num953;
27373 if (velocity.X > 0f)
27374 {
27375 velocity.X *= 0.98f;
27376 }
27377 }
27378 if (velocity.X > num954 || velocity.X < 0f - num954)
27379 {
27380 velocity.X *= 0.95f;
27381 }
27382 float num955 = Main.player[target].position.Y - (position.Y + (float)height);
27383 if (num955 < 180f)
27384 {
27385 velocity.Y -= 0.1f;
27386 }
27387 if (num955 > 200f)
27388 {
27389 velocity.Y += 0.1f;
27390 }
27391 if (velocity.Y > 6f)
27392 {
27393 velocity.Y = 6f;
27394 }
27395 if (velocity.Y < -6f)
27396 {
27397 velocity.Y = -6f;
27398 }
27399 rotation = velocity.X * 0.01f;
27400 if (Main.netMode != 1)
27401 {
27402 this.ai[3] += 1f;
27403 int num956 = 15;
27404 if ((double)life < (double)lifeMax * 0.75)
27405 {
27406 num956 = 14;
27407 }
27408 if ((double)life < (double)lifeMax * 0.5)
27409 {
27410 num956 = 12;
27411 }
27412 if ((double)life < (double)lifeMax * 0.25)
27413 {
27414 num956 = 10;
27415 }
27416 if ((double)life < (double)lifeMax * 0.1)
27417 {
27418 num956 = 8;
27419 }
27420 num956 += 3;
27421 if (this.ai[3] >= (float)num956)
27422 {
27423 this.ai[3] = 0f;
27424 Vector2 vector125 = new Vector2(base.Center.X, position.Y + (float)height - 14f);
27425 int i2 = (int)(vector125.X / 16f);
27426 int j2 = (int)(vector125.Y / 16f);
27427 if (!WorldGen.SolidTile(i2, j2))
27428 {
27429 float num957 = velocity.Y;
27430 if (num957 < 0f)
27431 {
27432 num957 = 0f;
27433 }
27434 num957 += 3f;
27435 float speedX2 = velocity.X * 0.25f;
27437 }
27438 }
27439 }
27440 if (Main.netMode != 1)
27441 {
27442 this.ai[1] += Main.rand.Next(1, 4);
27443 if (this.ai[1] > 600f)
27444 {
27445 this.ai[0] = -1f;
27446 }
27447 }
27448 }
27449 else if (this.ai[0] == 2f)
27450 {
27451 TargetClosest();
27452 Vector2 vector126 = new Vector2(base.Center.X, base.Center.Y - 20f);
27453 float num959 = Main.rand.Next(-1000, 1001);
27454 float num960 = Main.rand.Next(-1000, 1001);
27455 float num961 = (float)Math.Sqrt(num959 * num959 + num960 * num960);
27456 float num962 = 15f;
27457 velocity *= 0.95f;
27458 num961 = num962 / num961;
27459 num959 *= num961;
27460 num960 *= num961;
27461 rotation += 0.2f;
27462 vector126.X += num959 * 4f;
27463 vector126.Y += num960 * 4f;
27464 this.ai[3] += 1f;
27465 int num963 = 7;
27466 if ((double)life < (double)lifeMax * 0.75)
27467 {
27468 num963--;
27469 }
27470 if ((double)life < (double)lifeMax * 0.5)
27471 {
27472 num963 -= 2;
27473 }
27474 if ((double)life < (double)lifeMax * 0.25)
27475 {
27476 num963 -= 3;
27477 }
27478 if ((double)life < (double)lifeMax * 0.1)
27479 {
27480 num963 -= 4;
27481 }
27482 if (this.ai[3] > (float)num963)
27483 {
27484 this.ai[3] = 0f;
27486 }
27487 if (Main.netMode != 1)
27488 {
27489 this.ai[1] += Main.rand.Next(1, 4);
27490 if (this.ai[1] > 500f)
27491 {
27492 this.ai[0] = -1f;
27493 }
27494 }
27495 }
27496 if (this.ai[0] == -1f)
27497 {
27498 int num965 = Main.rand.Next(3);
27499 TargetClosest();
27500 if (Math.Abs(base.Center.X - Main.player[target].Center.X) > 1000f)
27501 {
27502 num965 = 0;
27503 }
27504 this.ai[0] = num965;
27505 this.ai[1] = 0f;
27506 this.ai[2] = 0f;
27507 this.ai[3] = 0f;
27508 }
27509 }
27510 else if (aiStyle == 61)
27511 {
27512 float num966 = 2f;
27513 noGravity = true;
27514 noTileCollide = true;
27515 if (!Main.dayTime)
27516 {
27517 TargetClosest();
27518 }
27519 bool flag47 = false;
27520 if ((double)life < (double)lifeMax * 0.75)
27521 {
27522 num966 = 3f;
27523 }
27524 if ((double)life < (double)lifeMax * 0.5)
27525 {
27526 num966 = 4f;
27527 }
27528 if ((double)life < (double)lifeMax * 0.25)
27529 {
27530 num966 = 5f;
27531 }
27532 Vector2 center4 = base.Center;
27533 Point point5 = center4.ToTileCoordinates();
27535 {
27536 Lighting.AddLight(center4, 0.3f, 0.26f, 0.05f);
27537 }
27538 if (Main.dayTime)
27539 {
27540 EncourageDespawn(10);
27541 num966 = 8f;
27542 if (velocity.X == 0f)
27543 {
27544 velocity.X = 0.1f;
27545 }
27546 }
27547 else if (this.ai[0] == 0f)
27548 {
27549 this.ai[1] += 1f;
27550 if (this.ai[1] >= 300f && Main.netMode != 1)
27551 {
27552 TargetClosest();
27553 this.ai[1] = 0f;
27554 this.ai[0] = 1f;
27555 netUpdate = true;
27556 }
27557 }
27558 else if (this.ai[0] == 1f)
27559 {
27560 this.ai[1] += 1f;
27561 flag47 = true;
27562 int num967 = 16;
27563 if ((double)life < (double)lifeMax * 0.25)
27564 {
27565 num967 = 8;
27566 }
27567 else if ((double)life < (double)lifeMax * 0.5)
27568 {
27569 num967 = 11;
27570 }
27571 else if ((double)life < (double)lifeMax * 0.75)
27572 {
27573 num967 = 14;
27574 }
27575 if (this.ai[1] % (float)num967 == 0f)
27576 {
27577 Vector2 vector127 = new Vector2(base.Center.X + (float)(direction * 50), base.Center.Y + (float)Main.rand.Next(15, 36));
27578 float num968 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector127.X;
27579 float num969 = Main.player[target].Center.Y - vector127.Y;
27580 num968 += (float)Main.rand.Next(-40, 41);
27581 num969 += (float)Main.rand.Next(-40, 41);
27582 float num970 = (float)Math.Sqrt(num968 * num968 + num969 * num969);
27583 float num971 = 15f;
27584 num970 = num971 / num970;
27585 num968 *= num970;
27586 num969 *= num970;
27587 num968 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27588 num969 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27590 }
27591 if (this.ai[1] > 240f)
27592 {
27593 this.ai[0] = 0f;
27594 this.ai[1] = 0f;
27595 }
27596 }
27597 if (Main.netMode != 1)
27598 {
27599 int num973 = 600;
27600 int num974 = 1200;
27601 int num975 = 2700;
27602 if ((double)life < (double)lifeMax * 0.25)
27603 {
27604 num973 = (int)((double)num973 * 0.5);
27605 num974 = (int)((double)num974 * 0.5);
27606 num975 = (int)((double)num975 * 0.5);
27607 }
27608 else if ((double)life < (double)lifeMax * 0.5)
27609 {
27610 num973 = (int)((double)num973 * 0.75);
27611 num974 = (int)((double)num974 * 0.75);
27612 num975 = (int)((double)num975 * 0.75);
27613 }
27614 else if ((double)life < (double)lifeMax * 0.75)
27615 {
27616 num973 = (int)((double)num973 * 0.9);
27617 num974 = (int)((double)num974 * 0.9);
27618 num975 = (int)((double)num975 * 0.9);
27619 }
27620 if (Main.rand.Next(num973) == 0)
27621 {
27622 Vector2 vector128 = new Vector2(base.Center.X - (float)(direction * 24), base.Center.Y - 64f);
27623 float num976 = Main.rand.Next(1, 100) * direction;
27624 float num977 = 1f;
27625 float num978 = (float)Math.Sqrt(num976 * num976 + num977 * num977);
27626 float num979 = 1f;
27627 num978 = num979 / num978;
27628 num976 *= num978;
27629 num977 *= num978;
27631 }
27632 if (Main.rand.Next(num974) == 0)
27633 {
27634 localAI[1] = 1f;
27635 }
27636 if (localAI[1] >= 1f)
27637 {
27638 localAI[1] += 1f;
27639 int num981 = 12;
27640 if (localAI[1] % (float)num981 == 0f)
27641 {
27642 Vector2 vector129 = new Vector2(base.Center.X - (float)(direction * 24), base.Center.Y - 64f);
27643 float num982 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector129.X;
27644 float num983 = Main.player[target].Center.Y - vector129.Y;
27645 num982 += (float)Main.rand.Next(-50, 51);
27646 num983 += (float)Main.rand.Next(-50, 51);
27647 float num984 = (float)Math.Sqrt(num982 * num982 + num983 * num983);
27648 float num985 = 12.5f;
27649 num984 = num985 / num984;
27650 num982 *= num984;
27651 num983 *= num984;
27652 num982 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27653 num983 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27655 }
27656 if (localAI[1] >= 100f)
27657 {
27658 localAI[1] = 0f;
27659 }
27660 }
27661 if (Main.rand.Next(num975) == 0)
27662 {
27663 localAI[2] = 2f;
27664 }
27665 if (localAI[2] > 0f)
27666 {
27667 localAI[2] += 1f;
27668 int num987 = 9;
27669 if (localAI[2] % (float)num987 == 0f)
27670 {
27671 Vector2 vector130 = new Vector2(base.Center.X - (float)(direction * 24), base.Center.Y - 64f);
27672 float num988 = Main.rand.Next(-100, 101);
27673 float num989 = -300f;
27674 float num990 = (float)Math.Sqrt(num988 * num988 + num989 * num989);
27675 float num991 = 11f;
27676 num990 = num991 / num990;
27677 num988 *= num990;
27678 num989 *= num990;
27679 num988 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
27680 num989 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
27682 }
27683 if (localAI[2] >= 100f)
27684 {
27685 localAI[2] = 0f;
27686 }
27687 }
27688 }
27689 if (Math.Abs(base.Center.X - Main.player[target].Center.X) < 50f)
27690 {
27691 flag47 = true;
27692 }
27693 if (flag47)
27694 {
27695 velocity.X *= 0.9f;
27696 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
27697 {
27698 velocity.X = 0f;
27699 }
27700 }
27701 else
27702 {
27703 if (direction > 0)
27704 {
27705 velocity.X = (velocity.X * 20f + num966) / 21f;
27706 }
27707 if (direction < 0)
27708 {
27709 velocity.X = (velocity.X * 20f - num966) / 21f;
27710 }
27711 }
27712 int num993 = 80;
27713 int num994 = 20;
27714 Vector2 vector131 = new Vector2(base.Center.X - (float)(num993 / 2), position.Y + (float)height - (float)num994);
27715 bool flag48 = false;
27716 if (position.X < Main.player[target].position.X && position.X + (float)width > Main.player[target].position.X + (float)Main.player[target].width && position.Y + (float)height < Main.player[target].position.Y + (float)Main.player[target].height - 16f)
27717 {
27718 flag48 = true;
27719 }
27720 if (flag48)
27721 {
27722 velocity.Y += 0.5f;
27723 }
27725 {
27726 if (velocity.Y > 0f)
27727 {
27728 velocity.Y = 0f;
27729 }
27730 if ((double)velocity.Y > -0.2)
27731 {
27732 velocity.Y -= 0.025f;
27733 }
27734 else
27735 {
27736 velocity.Y -= 0.2f;
27737 }
27738 if (velocity.Y < -4f)
27739 {
27740 velocity.Y = -4f;
27741 }
27742 }
27743 else
27744 {
27745 if (velocity.Y < 0f)
27746 {
27747 velocity.Y = 0f;
27748 }
27749 if ((double)velocity.Y < 0.1)
27750 {
27751 velocity.Y += 0.025f;
27752 }
27753 else
27754 {
27755 velocity.Y += 0.5f;
27756 }
27757 }
27758 if (velocity.Y > 10f)
27759 {
27760 velocity.Y = 10f;
27761 }
27762 }
27763 else if (aiStyle == 62)
27764 {
27765 TargetClosest();
27766 rotation = Math.Abs(velocity.X) * (float)direction * 0.1f;
27768 float num995 = 7f;
27769 Vector2 vector132 = new Vector2(base.Center.X + (float)(direction * 20), base.Center.Y + 6f);
27770 float num996 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector132.X;
27771 float num997 = Main.player[target].position.Y - vector132.Y;
27772 float num998 = (float)Math.Sqrt(num996 * num996 + num997 * num997);
27773 float num999 = num995 / num998;
27774 num996 *= num999;
27775 num997 *= num999;
27776 bool flag49 = Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1);
27777 if (Main.dayTime)
27778 {
27779 int num1000 = 60;
27780 velocity.X = (velocity.X * (float)(num1000 - 1) - num996) / (float)num1000;
27781 velocity.Y = (velocity.Y * (float)(num1000 - 1) - num997) / (float)num1000;
27782 EncourageDespawn(10);
27783 return;
27784 }
27785 if (num998 > 600f || !flag49)
27786 {
27787 int num1001 = 60;
27788 velocity.X = (velocity.X * (float)(num1001 - 1) + num996) / (float)num1001;
27789 velocity.Y = (velocity.Y * (float)(num1001 - 1) + num997) / (float)num1001;
27790 return;
27791 }
27792 velocity *= 0.98f;
27793 if (Math.Abs(velocity.X) < 1f && Math.Abs(velocity.Y) < 1f && Main.netMode != 1)
27794 {
27795 localAI[0] += 1f;
27796 if (localAI[0] >= 15f)
27797 {
27798 localAI[0] = 0f;
27799 num996 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector132.X;
27800 num997 = Main.player[target].Center.Y - vector132.Y;
27801 num996 += (float)Main.rand.Next(-35, 36);
27802 num997 += (float)Main.rand.Next(-35, 36);
27803 num996 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27804 num997 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f;
27805 num998 = (float)Math.Sqrt(num996 * num996 + num997 * num997);
27806 num995 = 10f;
27807 num999 = num995 / num998;
27808 num996 *= num999;
27809 num997 *= num999;
27810 num996 *= 1f + (float)Main.rand.Next(-20, 21) * 0.0125f;
27811 num997 *= 1f + (float)Main.rand.Next(-20, 21) * 0.0125f;
27813 }
27814 }
27815 }
27816 else if (aiStyle == 63)
27817 {
27818 TargetClosest();
27819 float num1003 = 11f;
27820 Vector2 vector133 = new Vector2(base.Center.X + (float)(direction * 20), base.Center.Y + 6f);
27821 float num1004 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector133.X;
27822 float num1005 = Main.player[target].Center.Y - vector133.Y;
27823 float num1006 = (float)Math.Sqrt(num1004 * num1004 + num1005 * num1005);
27824 float num1007 = num1003 / num1006;
27825 num1004 *= num1007;
27826 num1005 *= num1007;
27827 if (Main.dayTime)
27828 {
27829 num1004 = 0f - num1004;
27830 num1005 = 0f - num1005;
27831 }
27832 this.ai[0] -= 1f;
27833 if (num1006 < 200f || this.ai[0] > 0f)
27834 {
27835 if (num1006 < 200f)
27836 {
27837 this.ai[0] = 20f;
27838 }
27839 if (velocity.X < 0f)
27840 {
27841 direction = -1;
27842 }
27843 else
27844 {
27845 direction = 1;
27846 }
27847 rotation += (float)direction * 0.3f;
27848 return;
27849 }
27850 velocity.X = (velocity.X * 50f + num1004) / 51f;
27851 velocity.Y = (velocity.Y * 50f + num1005) / 51f;
27852 if (num1006 < 350f)
27853 {
27854 velocity.X = (velocity.X * 10f + num1004) / 11f;
27855 velocity.Y = (velocity.Y * 10f + num1005) / 11f;
27856 }
27857 if (num1006 < 300f)
27858 {
27859 velocity.X = (velocity.X * 7f + num1004) / 8f;
27860 velocity.Y = (velocity.Y * 7f + num1005) / 8f;
27861 }
27862 rotation = velocity.X * 0.15f;
27863 }
27864 else if (aiStyle == 64)
27865 {
27866 float num1008 = this.ai[0];
27867 float num1009 = this.ai[1];
27868 if (Main.netMode != 1)
27869 {
27870 localAI[0] -= 1f;
27871 if (this.ai[3] == 0f)
27872 {
27873 this.ai[3] = (float)Main.rand.Next(75, 111) * 0.01f;
27874 }
27875 if (localAI[0] <= 0f)
27876 {
27877 TargetClosest();
27878 localAI[0] = Main.rand.Next(60, 180);
27879 float num1010 = Math.Abs(base.Center.X - Main.player[target].Center.X);
27880 if (num1010 > 700f && localAI[3] == 0f)
27881 {
27882 float num1011 = (float)Main.rand.Next(50, 151) * 0.01f;
27883 if (num1010 > 1000f)
27884 {
27885 num1011 = (float)Main.rand.Next(150, 201) * 0.01f;
27886 }
27887 else if (num1010 > 850f)
27888 {
27889 num1011 = (float)Main.rand.Next(100, 151) * 0.01f;
27890 }
27891 int num1012 = direction * Main.rand.Next(100, 251);
27892 int num1013 = Main.rand.Next(-50, 51);
27893 if (position.Y > Main.player[target].position.Y - 100f)
27894 {
27895 num1013 -= Main.rand.Next(100, 251);
27896 }
27897 float num1014 = num1011 / (float)Math.Sqrt(num1012 * num1012 + num1013 * num1013);
27898 num1008 = (float)num1012 * num1014;
27899 num1009 = (float)num1013 * num1014;
27900 }
27901 else
27902 {
27903 localAI[3] = 1f;
27904 float num1015 = (float)Main.rand.Next(5, 151) * 0.01f;
27905 int num1016 = Main.rand.Next(-100, 101);
27906 int num1017 = Main.rand.Next(-100, 101);
27907 float num1018 = num1015 / (float)Math.Sqrt(num1016 * num1016 + num1017 * num1017);
27908 num1008 = (float)num1016 * num1018;
27909 num1009 = (float)num1017 * num1018;
27910 }
27911 netUpdate = true;
27912 }
27913 }
27914 scale = this.ai[3];
27915 if (type == 677)
27916 {
27917 bool flag50 = true;
27918 Point point6 = base.Center.ToTileCoordinates();
27919 int num1019 = 40;
27920 if (point6.X < num1019)
27921 {
27922 num1008 += 0.5f;
27923 if (num1008 > 3f)
27924 {
27925 num1008 = 3f;
27926 }
27927 flag50 = false;
27928 }
27929 else if (point6.X > Main.maxTilesX - num1019)
27930 {
27931 num1008 -= 0.5f;
27932 if (num1008 < -3f)
27933 {
27934 num1008 = -3f;
27935 }
27936 flag50 = false;
27937 }
27938 if (point6.Y < num1019)
27939 {
27940 num1009 += 0.5f;
27941 if (num1009 > 3f)
27942 {
27943 velocity.Y = 3f;
27944 }
27945 flag50 = false;
27946 }
27947 else if (point6.Y > Main.maxTilesY - num1019)
27948 {
27949 num1009 -= 0.5f;
27950 if (num1009 < -3f)
27951 {
27952 num1009 = -3f;
27953 }
27954 flag50 = false;
27955 }
27956 if (localAI[1] > 0f)
27957 {
27958 localAI[1]--;
27959 }
27960 else if (flag50)
27961 {
27962 localAI[1] = 15f;
27963 float num1020 = 0f;
27965 for (int num1021 = 0; num1021 < 200; num1021++)
27966 {
27967 NPC nPC4 = Main.npc[num1021];
27968 if (nPC4.active && nPC4.damage > 0 && !nPC4.friendly && nPC4.Hitbox.Distance(base.Center) <= 100f)
27969 {
27970 num1020++;
27971 zero += DirectionFrom(nPC4.Center);
27972 }
27973 }
27974 for (int num1022 = 0; num1022 < 255; num1022++)
27975 {
27977 if (player4.active && player4.Hitbox.Distance(base.Center) <= 150f)
27978 {
27979 num1020++;
27980 zero += DirectionFrom(player4.Center);
27981 }
27982 }
27983 if (num1020 > 0f)
27984 {
27985 float num1023 = 2f;
27986 zero /= num1020;
27987 zero *= num1023;
27988 velocity += zero;
27989 if (velocity.Length() > 8f)
27990 {
27991 velocity = velocity.SafeNormalize(Vector2.Zero) * 8f;
27992 }
27993 Vector2 vector134 = base.Center + zero * 10f;
27994 localAI[0] = 10f;
27995 netUpdate = true;
27996 }
27997 }
27998 }
27999 else if (localAI[2] > 0f)
28000 {
28001 int i3 = (int)base.Center.X / 16;
28002 int j3 = (int)base.Center.Y / 16;
28003 if (localAI[2] > 3f)
28004 {
28005 if (type == 358)
28006 {
28007 Lighting.AddLight(i3, j3, 0.10124999f * scale, 0.21374999f * scale, 0.225f * scale);
28008 }
28009 else if (type == 654)
28010 {
28011 Lighting.AddLight(i3, j3, 0.225f * scale, 0.105000004f * scale, 0.060000002f * scale);
28012 }
28013 else
28014 {
28015 Lighting.AddLight(i3, j3, 0.109500006f * scale, 0.15f * scale, 0.0615f * scale);
28016 }
28017 }
28018 localAI[2] -= 1f;
28019 }
28020 else if (localAI[1] > 0f)
28021 {
28022 localAI[1] -= 1f;
28023 }
28024 else
28025 {
28026 localAI[1] = Main.rand.Next(30, 180);
28027 if (!Main.dayTime || (double)(position.Y / 16f) > Main.worldSurface + 10.0)
28028 {
28029 localAI[2] = Main.rand.Next(10, 30);
28030 }
28031 }
28032 int num1024 = 80;
28033 velocity.X = (velocity.X * (float)(num1024 - 1) + num1008) / (float)num1024;
28034 velocity.Y = (velocity.Y * (float)(num1024 - 1) + num1009) / (float)num1024;
28035 if (velocity.Y > 0f)
28036 {
28037 int num1025 = 4;
28038 int num1026 = (int)base.Center.X / 16;
28039 int num1027 = (int)base.Center.Y / 16;
28040 for (int num1028 = num1027; num1028 < num1027 + num1025; num1028++)
28041 {
28042 if (WorldGen.InWorld(num1026, num1028, 2) && Main.tile[num1026, num1028] != null && ((Main.tile[num1026, num1028].nactive() && Main.tileSolid[Main.tile[num1026, num1028].type]) || Main.tile[num1026, num1028].liquid > 0))
28043 {
28044 num1009 *= -1f;
28045 if (velocity.Y > 0f)
28046 {
28047 velocity.Y *= 0.9f;
28048 }
28049 }
28050 }
28051 }
28052 if (velocity.Y < 0f)
28053 {
28054 int num1029 = 30;
28055 bool flag51 = false;
28056 int num1030 = (int)base.Center.X / 16;
28057 int num1031 = (int)base.Center.Y / 16;
28058 for (int num1032 = num1031; num1032 < num1031 + num1029; num1032++)
28059 {
28060 if (WorldGen.InWorld(num1030, num1032, 2) && Main.tile[num1030, num1032] != null && Main.tile[num1030, num1032].nactive() && Main.tileSolid[Main.tile[num1030, num1032].type])
28061 {
28062 flag51 = true;
28063 }
28064 }
28065 if (!flag51)
28066 {
28067 num1009 *= -1f;
28068 if (velocity.Y < 0f)
28069 {
28070 velocity.Y *= 0.9f;
28071 }
28072 }
28073 }
28074 if (collideX)
28075 {
28076 num1008 = ((!(velocity.X < 0f)) ? (0f - Math.Abs(num1008)) : Math.Abs(num1008));
28077 velocity.X *= -0.2f;
28078 }
28079 if (type == 677)
28080 {
28081 rotation = velocity.X * 0.3f;
28082 }
28083 if (velocity.X < 0f)
28084 {
28085 direction = -1;
28086 }
28087 if (velocity.X > 0f)
28088 {
28089 direction = 1;
28090 }
28091 this.ai[0] = num1008;
28092 this.ai[1] = num1009;
28093 }
28094 else if (aiStyle == 65)
28095 {
28097 }
28098 else if (aiStyle == 66)
28099 {
28100 if (type == 484)
28101 {
28102 float num1033 = (float)Main.rand.Next(90, 111) * 0.01f;
28103 num1033 *= (Main.essScale + 0.5f) / 2f;
28104 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.3f * num1033, 0.1f * num1033, 0.25f * num1033);
28105 }
28106 if (velocity.Y == 0f)
28107 {
28108 if (this.ai[0] == 1f)
28109 {
28110 if (direction == 0)
28111 {
28112 TargetClosest();
28113 }
28114 if (collideX)
28115 {
28116 direction *= -1;
28117 }
28118 float num1034 = 0.2f;
28119 if (type == 485)
28120 {
28121 num1034 = 0.25f;
28122 }
28123 if (type == 486)
28124 {
28125 num1034 = 0.325f;
28126 }
28127 if (type == 487)
28128 {
28129 num1034 = 0.4f;
28130 }
28131 velocity.X = num1034 * (float)direction;
28132 if (type == 374)
28133 {
28134 velocity.X *= 3f;
28135 }
28136 }
28137 else
28138 {
28139 velocity.X = 0f;
28140 }
28141 if (Main.netMode != 1)
28142 {
28143 localAI[1] -= 1f;
28144 if (localAI[1] <= 0f)
28145 {
28146 if (this.ai[0] == 1f)
28147 {
28148 this.ai[0] = 0f;
28149 localAI[1] = Main.rand.Next(300, 900);
28150 }
28151 else
28152 {
28153 this.ai[0] = 1f;
28154 localAI[1] = Main.rand.Next(600, 1800);
28155 }
28156 netUpdate = true;
28157 }
28158 }
28159 }
28160 else if (direction == 0)
28161 {
28162 direction = 1;
28163 if (velocity.X < 0f)
28164 {
28165 direction = -1;
28166 }
28167 }
28168 if (type != 374)
28169 {
28170 return;
28171 }
28173 bool flag52 = false;
28174 for (int num1035 = 0; num1035 < 255; num1035++)
28175 {
28177 if (player5.active && !player5.dead && !(Vector2.Distance(player5.Center, base.Center) > 160f))
28178 {
28179 flag52 = true;
28180 break;
28181 }
28182 }
28183 int num1036 = 90;
28184 if (flag52 && this.ai[1] < (float)num1036)
28185 {
28186 this.ai[1]++;
28187 }
28188 if (this.ai[1] == (float)num1036 && Main.netMode != 1)
28189 {
28190 position.Y += 16f;
28191 Transform(375);
28192 netUpdate = true;
28193 }
28194 }
28195 else if (aiStyle == 67)
28196 {
28197 if (Main.netMode != 1)
28198 {
28199 int num1037 = (int)MathHelper.Clamp((int)(base.Center.X / 16f), 0f, Main.maxTilesX);
28200 int num1038 = (int)MathHelper.Clamp((int)(base.Center.Y / 16f), 0f, Main.maxTilesY);
28201 Tile tile = Main.tile[num1037, num1038];
28202 if (tile.shimmer() && tile.liquid > 30)
28203 {
28204 GetShimmered();
28205 return;
28206 }
28207 }
28208 if (type == 359)
28209 {
28210 if (this.ai[3] != 0f)
28211 {
28212 scale = this.ai[3];
28213 int num1039 = (int)(12f * scale);
28214 int num1040 = (int)(12f * scale);
28215 if (num1039 != width)
28216 {
28217 position.X = position.X + (float)(width / 2) - (float)num1039 - 2f;
28218 width = num1039;
28219 }
28220 if (num1040 != height)
28221 {
28222 position.Y = position.Y + (float)height - (float)num1040;
28223 height = num1040;
28224 }
28225 }
28226 if (this.ai[3] == 0f && Main.netMode != 1)
28227 {
28228 this.ai[3] = (float)Main.rand.Next(80, 111) * 0.01f;
28229 netUpdate = true;
28230 }
28231 }
28232 if (type == 360)
28233 {
28234 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.1f, 0.2f, 0.7f);
28235 }
28236 if (type == 655)
28237 {
28238 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.6f, 0.3f, 0.1f);
28239 }
28240 float num1041 = 0.3f;
28241 if (type == 360 || type == 655)
28242 {
28243 num1041 = 0.6f;
28244 }
28245 if (this.ai[0] == 0f)
28246 {
28247 TargetClosest();
28248 directionY = 1;
28249 this.ai[0] = 1f;
28250 if (direction > 0)
28251 {
28252 spriteDirection = 1;
28253 }
28254 }
28255 bool flag53 = false;
28256 if (Main.netMode != 1)
28257 {
28258 if (this.ai[2] == 0f && Main.rand.Next(7200) == 0)
28259 {
28260 this.ai[2] = 2f;
28261 netUpdate = true;
28262 }
28263 if (!collideX && !collideY)
28264 {
28265 localAI[3] += 1f;
28266 if (localAI[3] > 5f)
28267 {
28268 this.ai[2] = 2f;
28269 netUpdate = true;
28270 }
28271 }
28272 else
28273 {
28274 localAI[3] = 0f;
28275 }
28276 }
28277 if (this.ai[2] > 0f)
28278 {
28279 this.ai[1] = 0f;
28280 this.ai[0] = 1f;
28281 directionY = 1;
28282 if (velocity.Y > num1041)
28283 {
28284 rotation += (float)direction * 0.1f;
28285 }
28286 else
28287 {
28288 rotation = 0f;
28289 }
28291 velocity.X = num1041 * (float)direction;
28292 noGravity = false;
28293 int num1042 = (int)(base.Center.X + (float)(width / 2 * -direction)) / 16;
28294 int num1043 = (int)(position.Y + (float)height + 8f) / 16;
28295 if (Main.tile[num1042, num1043] != null && !Main.tile[num1042, num1043].topSlope() && collideY)
28296 {
28297 this.ai[2] -= 1f;
28298 }
28299 num1043 = (int)(position.Y + (float)height - 4f) / 16;
28300 num1042 = (int)(base.Center.X + (float)(width / 2 * direction)) / 16;
28301 if (Main.tile[num1042, num1043] != null && Main.tile[num1042, num1043].bottomSlope())
28302 {
28303 direction *= -1;
28304 }
28305 if (collideX && velocity.Y == 0f)
28306 {
28307 flag53 = true;
28308 this.ai[2] = 0f;
28309 directionY = -1;
28310 this.ai[1] = 1f;
28311 }
28312 if (velocity.Y == 0f)
28313 {
28314 if (localAI[1] == position.X)
28315 {
28316 localAI[2] += 1f;
28317 if (localAI[2] > 10f)
28318 {
28319 direction = 1;
28320 velocity.X = (float)direction * num1041;
28321 localAI[2] = 0f;
28322 }
28323 }
28324 else
28325 {
28326 localAI[2] = 0f;
28327 localAI[1] = position.X;
28328 }
28329 }
28330 }
28331 if (this.ai[2] != 0f)
28332 {
28333 return;
28334 }
28335 noGravity = true;
28336 if (this.ai[1] == 0f)
28337 {
28338 if (collideY)
28339 {
28340 this.ai[0] = 2f;
28341 }
28342 if (!collideY && this.ai[0] == 2f)
28343 {
28345 this.ai[1] = 1f;
28346 this.ai[0] = 1f;
28347 }
28348 if (collideX)
28349 {
28351 this.ai[1] = 1f;
28352 }
28353 }
28354 else
28355 {
28356 if (collideX)
28357 {
28358 this.ai[0] = 2f;
28359 }
28360 if (!collideX && this.ai[0] == 2f)
28361 {
28363 this.ai[1] = 0f;
28364 this.ai[0] = 1f;
28365 }
28366 if (collideY)
28367 {
28369 this.ai[1] = 0f;
28370 }
28371 }
28372 if (!flag53)
28373 {
28374 float num1044 = rotation;
28375 if (directionY < 0)
28376 {
28377 if (direction < 0)
28378 {
28379 if (collideX)
28380 {
28381 rotation = 1.57f;
28382 spriteDirection = -1;
28383 }
28384 else if (collideY)
28385 {
28386 rotation = 3.14f;
28387 spriteDirection = 1;
28388 }
28389 }
28390 else if (collideY)
28391 {
28392 rotation = 3.14f;
28393 spriteDirection = -1;
28394 }
28395 else if (collideX)
28396 {
28397 rotation = 4.71f;
28398 spriteDirection = 1;
28399 }
28400 }
28401 else if (direction < 0)
28402 {
28403 if (collideY)
28404 {
28405 rotation = 0f;
28406 spriteDirection = -1;
28407 }
28408 else if (collideX)
28409 {
28410 rotation = 1.57f;
28411 spriteDirection = 1;
28412 }
28413 }
28414 else if (collideX)
28415 {
28416 rotation = 4.71f;
28417 spriteDirection = -1;
28418 }
28419 else if (collideY)
28420 {
28421 rotation = 0f;
28422 spriteDirection = 1;
28423 }
28424 float num1045 = rotation;
28425 rotation = num1044;
28426 if ((double)rotation > 6.28)
28427 {
28428 rotation -= 6.28f;
28429 }
28430 if (rotation < 0f)
28431 {
28432 rotation += 6.28f;
28433 }
28434 float num1046 = Math.Abs(rotation - num1045);
28435 float num1047 = 0.1f;
28436 if (rotation > num1045)
28437 {
28438 if ((double)num1046 > 3.14)
28439 {
28440 rotation += num1047;
28441 }
28442 else
28443 {
28444 rotation -= num1047;
28445 if (rotation < num1045)
28446 {
28447 rotation = num1045;
28448 }
28449 }
28450 }
28451 if (rotation < num1045)
28452 {
28453 if ((double)num1046 > 3.14)
28454 {
28455 rotation -= num1047;
28456 }
28457 else
28458 {
28459 rotation += num1047;
28460 if (rotation > num1045)
28461 {
28462 rotation = num1045;
28463 }
28464 }
28465 }
28466 }
28467 velocity.X = num1041 * (float)direction;
28468 velocity.Y = num1041 * (float)directionY;
28469 }
28470 else if (aiStyle == 68)
28471 {
28472 noGravity = true;
28473 if (this.ai[0] == 0f)
28474 {
28475 noGravity = false;
28476 int num1048 = direction;
28477 int num1049 = target;
28478 TargetClosest();
28479 if (num1049 >= 0 && num1048 != 0)
28480 {
28482 }
28483 if (wet && WorldGen.InWorld((int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16, (int)(base.Center.Y / 16f), 5))
28484 {
28485 float num1050 = 2f;
28486 velocity.X = (velocity.X * 19f + num1050 * (float)direction) / 20f;
28487 int num1051 = (int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16;
28488 int num1052 = (int)(base.Center.Y / 16f);
28489 int j4 = (int)(position.Y / 16f);
28490 int num1053 = (int)((position.Y + (float)height) / 16f);
28491 if (Main.tile[num1051, num1052] == null)
28492 {
28493 Main.tile[num1051, num1052] = new Tile();
28494 }
28495 if (Main.tile[num1051, num1053] == null)
28496 {
28497 Main.tile[num1051, num1053] = new Tile();
28498 }
28500 {
28501 direction *= -1;
28502 }
28504 if (velocity.Y > 0f)
28505 {
28506 velocity.Y *= 0.5f;
28507 }
28508 noGravity = true;
28509 num1051 = (int)(base.Center.X / 16f);
28510 num1052 = (int)(base.Center.Y / 16f);
28511 float num1054 = position.Y + (float)height;
28512 if (Main.tile[num1051, num1052 - 1] == null)
28513 {
28514 Main.tile[num1051, num1052 - 1] = new Tile();
28515 }
28516 if (Main.tile[num1051, num1052] == null)
28517 {
28518 Main.tile[num1051, num1052] = new Tile();
28519 }
28520 if (Main.tile[num1051, num1052 + 1] == null)
28521 {
28522 Main.tile[num1051, num1052 + 1] = new Tile();
28523 }
28524 if (Main.tile[num1051, num1052 - 1].liquid > 0)
28525 {
28526 num1054 = num1052 * 16;
28527 num1054 -= (float)(Main.tile[num1051, num1052 - 1].liquid / 16);
28528 }
28529 else if (Main.tile[num1051, num1052].liquid > 0)
28530 {
28531 num1054 = (num1052 + 1) * 16;
28532 num1054 -= (float)(Main.tile[num1051, num1052].liquid / 16);
28533 }
28534 else if (Main.tile[num1051, num1052 + 1].liquid > 0)
28535 {
28536 num1054 = (num1052 + 2) * 16;
28537 num1054 -= (float)(Main.tile[num1051, num1052 + 1].liquid / 16);
28538 }
28539 num1054 -= 6f;
28540 if (base.Center.Y > num1054)
28541 {
28542 velocity.Y -= 0.1f;
28543 if (velocity.Y < -8f)
28544 {
28545 velocity.Y = -8f;
28546 }
28547 if (base.Center.Y + velocity.Y < num1054)
28548 {
28549 velocity.Y = num1054 - base.Center.Y;
28550 }
28551 }
28552 else
28553 {
28554 velocity.Y = num1054 - base.Center.Y;
28555 }
28556 }
28557 if (Main.netMode == 1)
28558 {
28559 return;
28560 }
28561 if (!wet)
28562 {
28563 this.ai[0] = 1f;
28564 netUpdate = true;
28566 return;
28567 }
28568 Rectangle rectangle4 = new Rectangle((int)Main.player[target].position.X, (int)Main.player[target].position.Y, Main.player[target].width, Main.player[target].height);
28569 if (new Rectangle((int)position.X - 100, (int)position.Y - 100, width + 200, height + 200).Intersects(rectangle4) || life < lifeMax)
28570 {
28571 this.ai[0] = 1f;
28572 velocity.Y -= 6f;
28573 netUpdate = true;
28575 }
28576 }
28577 else
28578 {
28579 if (Main.player[target].dead)
28580 {
28581 return;
28582 }
28583 bool flag54 = false;
28584 this.ai[1] += 1f;
28585 if (this.ai[1] >= 300f)
28586 {
28587 flag54 = true;
28588 }
28589 if (flag54)
28590 {
28591 if (velocity.Y == 0f || collideY || wet)
28592 {
28593 velocity.X = 0f;
28594 velocity.Y = 0f;
28595 this.ai[0] = 0f;
28596 this.ai[1] = 0f;
28597 if (Main.netMode != 1)
28598 {
28599 if ((type == 363 || type == 365 || type == 603 || type == 609) && !wet)
28600 {
28601 int num1055 = direction;
28602 Transform(type - 1);
28603 TargetClosest();
28605 this.ai[0] = 0f;
28606 this.ai[1] = 200 + Main.rand.Next(200);
28607 }
28608 netUpdate = true;
28609 }
28610 }
28611 else
28612 {
28613 velocity.X *= 0.98f;
28614 velocity.Y += 0.1f;
28615 if (velocity.Y > 2f)
28616 {
28617 velocity.Y = 2f;
28618 }
28619 }
28620 return;
28621 }
28622 if (collideX)
28623 {
28624 direction *= -1;
28625 velocity.X = oldVelocity.X * -0.5f;
28626 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
28627 {
28628 velocity.X = 2f;
28629 }
28630 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
28631 {
28632 velocity.X = -2f;
28633 }
28634 }
28635 if (collideY)
28636 {
28637 velocity.Y = oldVelocity.Y * -0.5f;
28638 if (velocity.Y > 0f && velocity.Y < 1f)
28639 {
28640 velocity.Y = 1f;
28641 }
28642 if (velocity.Y < 0f && velocity.Y > -1f)
28643 {
28644 velocity.Y = -1f;
28645 }
28646 }
28647 if (direction == -1 && velocity.X > -3f)
28648 {
28649 velocity.X -= 0.1f;
28650 if (velocity.X > 3f)
28651 {
28652 velocity.X -= 0.1f;
28653 }
28654 else if (velocity.X > 0f)
28655 {
28656 velocity.X -= 0.05f;
28657 }
28658 if (velocity.X < -3f)
28659 {
28660 velocity.X = -3f;
28661 }
28662 }
28663 else if (direction == 1 && velocity.X < 3f)
28664 {
28665 velocity.X += 0.1f;
28666 if (velocity.X < -3f)
28667 {
28668 velocity.X += 0.1f;
28669 }
28670 else if (velocity.X < 0f)
28671 {
28672 velocity.X += 0.05f;
28673 }
28674 if (velocity.X > 3f)
28675 {
28676 velocity.X = 3f;
28677 }
28678 }
28679 int num1056 = (int)((position.X + (float)(width / 2)) / 16f) + direction;
28680 int num1057 = (int)((position.Y + (float)height) / 16f);
28681 bool flag55 = true;
28682 int num1058 = 15;
28683 bool flag56 = false;
28684 for (int num1059 = num1057; num1059 < num1057 + num1058; num1059++)
28685 {
28686 if (Main.tile[num1056, num1059] == null)
28687 {
28688 Main.tile[num1056, num1059] = new Tile();
28689 }
28690 if ((Main.tile[num1056, num1059].nactive() && Main.tileSolid[Main.tile[num1056, num1059].type]) || Main.tile[num1056, num1059].liquid > 0)
28691 {
28692 if (num1059 < num1057 + 5)
28693 {
28694 flag56 = true;
28695 }
28696 flag55 = false;
28697 break;
28698 }
28699 }
28700 if (flag55)
28701 {
28702 velocity.Y += 0.1f;
28703 }
28704 else
28705 {
28706 velocity.Y -= 0.1f;
28707 }
28708 if (flag56)
28709 {
28710 velocity.Y -= 0.2f;
28711 }
28712 if (velocity.Y > 3f)
28713 {
28714 velocity.Y = 3f;
28715 }
28716 if (velocity.Y < -4f)
28717 {
28718 velocity.Y = -4f;
28719 }
28720 }
28721 }
28722 else if (aiStyle == 69)
28723 {
28725 }
28726 else if (aiStyle == 70)
28727 {
28728 if (target == 255)
28729 {
28730 TargetClosest();
28731 this.ai[3] = (float)Main.rand.Next(80, 121) / 100f;
28732 float num1060 = (float)Main.rand.Next(165, 265) / 15f;
28733 velocity = Vector2.Normalize(Main.player[target].Center - base.Center + new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101))) * num1060;
28734 netUpdate = true;
28735 }
28737 velocity = (velocity * 40f + vector135 * 20f) / 41f;
28738 scale = this.ai[3];
28739 alpha -= 30;
28740 if (alpha < 50)
28741 {
28742 alpha = 50;
28743 }
28744 alpha = 50;
28745 velocity.X = (velocity.X * 50f + Main.windSpeedCurrent * 2f + (float)Main.rand.Next(-10, 11) * 0.1f) / 51f;
28746 velocity.Y = (velocity.Y * 50f + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / 51f;
28747 if (velocity.Y > 0f)
28748 {
28749 velocity.Y -= 0.04f;
28750 }
28751 if (this.ai[0] == 0f)
28752 {
28753 int num1061 = 40;
28755 rect.X -= num1061 + width / 2;
28756 rect.Y -= num1061 + height / 2;
28757 rect.Width += num1061 * 2;
28758 rect.Height += num1061 * 2;
28759 for (int num1062 = 0; num1062 < 255; num1062++)
28760 {
28762 if (player6.active && !player6.dead && rect.Intersects(player6.getRect()))
28763 {
28764 this.ai[0] = 1f;
28765 this.ai[1] = 4f;
28766 netUpdate = true;
28767 break;
28768 }
28769 }
28770 }
28771 if (this.ai[0] == 0f)
28772 {
28773 this.ai[1]++;
28774 if (this.ai[1] >= 150f)
28775 {
28776 this.ai[0] = 1f;
28777 this.ai[1] = 4f;
28778 }
28779 }
28780 if (this.ai[0] == 1f)
28781 {
28782 this.ai[1]--;
28783 if (this.ai[1] <= 0f)
28784 {
28785 life = 0;
28786 HitEffect();
28787 active = false;
28788 return;
28789 }
28790 }
28791 if (justHit || this.ai[0] == 1f)
28792 {
28793 dontTakeDamage = true;
28794 position = base.Center;
28795 width = (height = 100);
28796 position = new Vector2(position.X - (float)(width / 2), position.Y - (float)(height / 2));
28798 }
28799 }
28800 else if (aiStyle == 71)
28801 {
28802 noTileCollide = true;
28803 int num1063 = 90;
28804 if (target < 0 || target == 255 || Main.player[target].dead)
28805 {
28806 TargetClosest(faceTarget: false);
28807 direction = 1;
28808 netUpdate = true;
28809 }
28810 if (this.ai[0] == 0f)
28811 {
28812 this.ai[1]++;
28813 _ = type;
28814 _ = 372;
28815 noGravity = true;
28816 dontTakeDamage = true;
28817 velocity.Y = this.ai[3];
28818 if (type == 373)
28819 {
28820 float num1064 = (float)Math.PI / 30f;
28821 float num1065 = this.ai[2];
28822 float num1066 = (float)(Math.Cos(num1064 * localAI[1]) - 0.5) * num1065;
28823 position.X -= num1066 * (float)(-direction);
28824 localAI[1]++;
28825 num1066 = (float)(Math.Cos(num1064 * localAI[1]) - 0.5) * num1065;
28826 position.X += num1066 * (float)(-direction);
28827 if (Math.Abs(Math.Cos(num1064 * localAI[1]) - 0.5) > 0.25)
28828 {
28829 spriteDirection = ((!(Math.Cos(num1064 * localAI[1]) - 0.5 >= 0.0)) ? 1 : (-1));
28830 }
28831 rotation = velocity.Y * (float)spriteDirection * 0.1f;
28832 if ((double)rotation < -0.2)
28833 {
28834 rotation = -0.2f;
28835 }
28836 if ((double)rotation > 0.2)
28837 {
28838 rotation = 0.2f;
28839 }
28840 alpha -= 6;
28841 if (alpha < 0)
28842 {
28843 alpha = 0;
28844 }
28845 }
28846 if (this.ai[1] >= (float)num1063)
28847 {
28848 this.ai[0] = 1f;
28849 this.ai[1] = 0f;
28851 {
28852 this.ai[1] = 1f;
28853 }
28854 SoundEngine.PlaySound(4, (int)base.Center.X, (int)base.Center.Y, 19);
28855 TargetClosest();
28857 Vector2 vector136 = Main.player[target].Center - base.Center;
28858 vector136.Normalize();
28859 velocity = vector136 * 16f;
28860 rotation = velocity.ToRotation();
28861 if (direction == -1)
28862 {
28863 rotation += (float)Math.PI;
28864 }
28865 netUpdate = true;
28866 }
28867 }
28868 else
28869 {
28870 if (this.ai[0] != 1f)
28871 {
28872 return;
28873 }
28874 noGravity = true;
28876 {
28877 if (this.ai[1] < 1f)
28878 {
28879 this.ai[1] = 1f;
28880 }
28881 }
28882 else
28883 {
28884 alpha -= 15;
28885 if (alpha < 150)
28886 {
28887 alpha = 150;
28888 }
28889 }
28890 if (this.ai[1] >= 1f)
28891 {
28892 alpha -= 60;
28893 if (alpha < 0)
28894 {
28895 alpha = 0;
28896 }
28897 dontTakeDamage = false;
28898 this.ai[1]++;
28900 {
28901 if (DeathSound != null)
28902 {
28904 }
28905 life = 0;
28906 HitEffect();
28907 active = false;
28908 return;
28909 }
28910 }
28911 if (this.ai[1] >= 60f)
28912 {
28913 noGravity = false;
28914 }
28915 rotation = velocity.ToRotation();
28916 if (direction == -1)
28917 {
28918 rotation += (float)Math.PI;
28919 }
28920 }
28921 }
28922 else if (aiStyle == 72)
28923 {
28924 if (type == 384)
28925 {
28926 int num1067 = (int)this.ai[0];
28927 if (Main.npc[num1067].active && Main.npc[num1067].type == 383)
28928 {
28930 position = Main.npc[num1067].Center;
28931 position.X -= width / 2;
28932 position.Y -= height / 2;
28933 gfxOffY = Main.npc[num1067].gfxOffY;
28934 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.1f, 0.5f, 0.7f);
28935 }
28936 else
28937 {
28938 life = 0;
28939 HitEffect();
28940 active = false;
28941 }
28942 }
28943 }
28944 else if (aiStyle == 73)
28945 {
28946 TargetClosest(faceTarget: false);
28948 velocity.X *= 0.93f;
28949 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
28950 {
28951 velocity.X = 0f;
28952 }
28953 if (type == 387)
28954 {
28955 float num1068 = 120f;
28956 float num1069 = 60f;
28957 if (this.ai[1] < num1068)
28958 {
28959 this.ai[1]++;
28960 if (this.ai[1] > 60f)
28961 {
28962 float num1070 = (this.ai[1] - num1069) / (num1068 - num1069);
28963 alpha = (int)((1f - num1070) * 255f);
28964 }
28965 else
28966 {
28967 alpha = 255;
28968 }
28969 dontTakeDamage = true;
28970 frameCounter = 0.0;
28971 frame.Y = 0;
28972 float num1071 = this.ai[1] / num1069;
28973 Vector2 spinningpoint = new Vector2(0f, -30f);
28974 spinningpoint = spinningpoint.RotatedBy(num1071 * 1.5f * ((float)Math.PI * 2f)) * new Vector2(1f, 0.4f);
28975 for (int num1072 = 0; num1072 < 4; num1072++)
28976 {
28978 float num1073 = 1f;
28979 if (num1072 == 0)
28980 {
28981 vector137 = Vector2.UnitY * -15f;
28982 num1073 = 0.15f;
28983 }
28984 if (num1072 == 1)
28985 {
28986 vector137 = Vector2.UnitY * -5f;
28987 num1073 = 0.3f;
28988 }
28989 if (num1072 == 2)
28990 {
28991 vector137 = Vector2.UnitY * 5f;
28992 num1073 = 0.6f;
28993 }
28994 if (num1072 == 3)
28995 {
28996 vector137 = Vector2.UnitY * 20f;
28997 num1073 = 0.45f;
28998 }
28999 int num1074 = Dust.NewDust(base.Center, 0, 0, 226, 0f, 0f, 100, default(Color), 0.5f);
29000 Main.dust[num1074].noGravity = true;
29001 Main.dust[num1074].position = base.Center + spinningpoint * num1073 + vector137;
29002 Main.dust[num1074].velocity = Vector2.Zero;
29003 spinningpoint *= -1f;
29004 num1074 = Dust.NewDust(base.Center, 0, 0, 226, 0f, 0f, 100, default(Color), 0.5f);
29005 Main.dust[num1074].noGravity = true;
29006 Main.dust[num1074].position = base.Center + spinningpoint * num1073 + vector137;
29007 Main.dust[num1074].velocity = Vector2.Zero;
29008 }
29009 Lighting.AddLight((int)base.Center.X / 16, (int)(base.Center.Y - 10f) / 16, 0.1f * num1071, 0.5f * num1071, 0.7f * num1071);
29010 return;
29011 }
29012 if (this.ai[1] == num1068)
29013 {
29014 this.ai[1]++;
29015 netUpdate = true;
29016 }
29017 Lighting.AddLight((int)base.Center.X / 16, (int)(base.Center.Y - 10f) / 16, 0.1f, 0.5f, 0.7f);
29018 dontTakeDamage = false;
29019 }
29020 if (this.ai[0] < 60f)
29021 {
29022 this.ai[0]++;
29023 }
29024 if (justHit)
29025 {
29026 this.ai[0] = -30f;
29027 netUpdate = true;
29028 }
29029 if (this.ai[0] == 60f && Main.netMode != 1)
29030 {
29031 this.ai[0] = -120f;
29032 netUpdate = true;
29033 Vector2 center5 = Main.player[target].Center;
29034 Vector2 vector138 = base.Center - Vector2.UnitY * 10f;
29036 vector139.X += Main.rand.Next(-100, 101);
29037 vector139.Y += Main.rand.Next(-100, 101);
29038 vector139.X *= (float)Main.rand.Next(70, 131) * 0.01f;
29039 vector139.Y *= (float)Main.rand.Next(70, 131) * 0.01f;
29040 vector139.Normalize();
29041 if (float.IsNaN(vector139.X) || float.IsNaN(vector139.Y))
29042 {
29044 }
29045 vector139 *= 14f;
29046 int num1075 = 35;
29047 float num1076 = 1f;
29048 if (type >= 381 && type <= 392)
29049 {
29050 num1076 = 0.8f;
29051 }
29054 }
29055 }
29056 else if (aiStyle == 74)
29057 {
29058 TargetClosest(faceTarget: false);
29059 rotation = velocity.ToRotation();
29060 if (rotation < -(float)Math.PI / 2f)
29061 {
29062 rotation += (float)Math.PI;
29063 }
29064 if (rotation > (float)Math.PI / 2f)
29065 {
29066 rotation -= (float)Math.PI;
29067 }
29068 if (Math.Sign(velocity.X) != 0)
29069 {
29071 }
29072 if (type == 418)
29073 {
29075 }
29076 float num1077 = 0.4f;
29077 float num1078 = 10f;
29078 float num1079 = 200f;
29079 float num1080 = 0f;
29080 float num1081 = 750f;
29081 float num1082 = 0f;
29082 float num1083 = 30f;
29083 float num1084 = 30f;
29084 float num1085 = 0.95f;
29085 int num1086 = 50;
29086 float num1087 = 14f;
29087 float num1088 = 30f;
29088 float num1089 = 100f;
29089 float num1090 = 20f;
29090 float num1091 = 0f;
29091 float num1092 = 7f;
29092 bool flag57 = true;
29093 if (type == 418)
29094 {
29095 num1077 = 0.3f;
29096 num1078 = 8f;
29097 num1079 = 175f;
29098 num1080 = 175f;
29099 num1081 = 600f;
29100 num1082 = 80f;
29101 num1083 = 60f;
29102 num1084 = 20f;
29103 num1085 = 0.75f;
29104 num1086 = 0;
29105 num1087 = 9f;
29106 num1088 = 30f;
29107 num1089 = 150f;
29108 num1090 = 60f;
29109 num1091 = 4f / 15f;
29110 num1092 = 7f;
29111 flag57 = false;
29112 }
29113 num1091 *= num1090;
29114 if (Main.expertMode)
29115 {
29116 num1077 *= Main.GameModeInfo.KnockbackToEnemiesMultiplier;
29117 }
29118 if (type == 388 && this.ai[0] != 3f)
29119 {
29121 int num1093 = Dust.NewDust(position, width, height, 226, 0f, 0f, 100, default(Color), 0.5f);
29122 Main.dust[num1093].noGravity = true;
29123 Main.dust[num1093].velocity = velocity / 5f;
29124 Vector2 spinningpoint2 = new Vector2(-10f, 10f);
29125 if (spriteDirection == 1)
29126 {
29127 spinningpoint2.X *= -1f;
29128 }
29130 Main.dust[num1093].position = base.Center + spinningpoint2;
29132 }
29133 if (type == 418)
29134 {
29135 int num1094 = ((this.ai[0] != 2f) ? 1 : 2);
29136 int num1095 = ((this.ai[0] == 2f) ? 30 : 20);
29137 for (int num1096 = 0; num1096 < 2; num1096++)
29138 {
29139 if (Main.rand.Next(3) < num1094)
29140 {
29142 int num1097 = Dust.NewDust(base.Center - new Vector2(num1095), num1095 * 2, num1095 * 2, 6, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 1.5f);
29143 Main.dust[num1097].noGravity = true;
29144 Dust dust = Main.dust[num1097];
29145 dust.velocity *= 0.2f;
29146 Main.dust[num1097].fadeIn = 1f;
29148 }
29149 }
29150 }
29151 if (this.ai[0] == 0f)
29152 {
29154 float num1098 = num1078;
29155 Vector2 center6 = base.Center;
29156 Vector2 center7 = Main.player[target].Center;
29158 Vector2 vector141 = vector140 - Vector2.UnitY * num1079;
29159 vector141 += Vector2.UnitX * ((vector140.X < 0f) ? num1080 : (0f - num1080));
29160 float num1099 = vector140.Length();
29163 bool flag58 = Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1);
29164 if (this.ai[3] >= 120f)
29165 {
29166 flag58 = true;
29167 }
29168 float num1100 = 8f;
29169 flag58 = flag58 && vector140.ToRotation() > (float)Math.PI / num1100 && vector140.ToRotation() < (float)Math.PI - (float)Math.PI / num1100;
29170 bool flag59 = num1099 < num1082;
29171 bool flag60 = num1099 > num1081;
29172 if (flag59 || flag60 || !flag58)
29173 {
29174 velocity.X = (velocity.X * (num1083 - 1f) + vector141.X) / num1083;
29175 velocity.Y = (velocity.Y * (num1083 - 1f) + vector141.Y) / num1083;
29176 if (!flag58)
29177 {
29178 if (!flag59 && !flag60)
29179 {
29180 this.ai[3]++;
29181 }
29182 if (this.ai[3] == 120f)
29183 {
29184 netUpdate = true;
29185 }
29186 }
29187 else
29188 {
29189 this.ai[3] = 0f;
29190 }
29191 }
29192 else
29193 {
29194 this.ai[0] = 1f;
29195 this.ai[2] = vector140.X;
29196 this.ai[3] = vector140.Y;
29197 netUpdate = true;
29198 }
29199 }
29200 else if (this.ai[0] == 1f)
29201 {
29202 knockBackResist = 0f;
29203 bool flag61 = true;
29204 if (type == 418)
29205 {
29206 flag61 = velocity.Length() > 2f;
29207 if (!flag61 && target >= 0 && !Main.player[target].DeadOrGhost)
29208 {
29209 Vector2 value = (Main.player[target].Center - base.Center).SafeNormalize(Vector2.Zero) * 0.1f;
29210 velocity = Vector2.Lerp(velocity, value, 0.25f);
29211 }
29212 }
29213 if (flag61)
29214 {
29215 velocity *= num1085;
29216 }
29217 this.ai[1]++;
29218 if (this.ai[1] >= num1084)
29219 {
29220 this.ai[0] = 2f;
29221 this.ai[1] = 0f;
29222 netUpdate = true;
29223 Vector2 vector142 = new Vector2(this.ai[2], this.ai[3]) + new Vector2(Main.rand.Next(-num1086, num1086 + 1), Main.rand.Next(-num1086, num1086 + 1)) * 0.04f;
29224 vector142.Normalize();
29225 vector142 *= num1087;
29227 }
29228 if (type == 388 && Main.rand.Next(4) == 0)
29229 {
29231 int num1101 = Dust.NewDust(position, width, height, 226, 0f, 0f, 100, default(Color), 0.5f);
29232 Main.dust[num1101].noGravity = true;
29233 Dust dust = Main.dust[num1101];
29234 dust.velocity *= 2f;
29235 Main.dust[num1101].velocity = Main.dust[num1101].velocity / 2f + Vector2.Normalize(Main.dust[num1101].position - base.Center);
29237 }
29238 }
29239 else if (this.ai[0] == 2f)
29240 {
29241 knockBackResist = 0f;
29242 float num1102 = num1088;
29243 this.ai[1]++;
29244 bool flag62 = Vector2.Distance(base.Center, Main.player[target].Center) > num1089 && base.Center.Y > Main.player[target].Center.Y;
29245 if ((this.ai[1] >= num1102 && flag62) || velocity.Length() < num1092)
29246 {
29247 this.ai[0] = 0f;
29248 this.ai[1] = 0f;
29249 this.ai[2] = 0f;
29250 this.ai[3] = 0f;
29251 velocity /= 2f;
29252 netUpdate = true;
29253 if (type == 418)
29254 {
29255 this.ai[1] = 45f;
29256 this.ai[0] = 4f;
29257 }
29258 }
29259 else
29260 {
29261 Vector2 center8 = base.Center;
29262 Vector2 center9 = Main.player[target].Center;
29264 vector143.Normalize();
29265 if (vector143.HasNaNs())
29266 {
29267 vector143 = new Vector2(direction, 0f);
29268 }
29270 }
29272 {
29273 this.ai[0] = 3f;
29274 this.ai[1] = 0f;
29275 this.ai[2] = 0f;
29276 this.ai[3] = 0f;
29277 netUpdate = true;
29278 }
29279 }
29280 else if (this.ai[0] == 4f)
29281 {
29282 this.ai[1] -= 3f;
29283 if (this.ai[1] <= 0f)
29284 {
29285 this.ai[0] = 0f;
29286 this.ai[1] = 0f;
29287 netUpdate = true;
29288 }
29289 velocity *= 0.95f;
29290 }
29291 if (flag57 && this.ai[0] != 3f && Vector2.Distance(base.Center, Main.player[target].Center) < 64f)
29292 {
29293 this.ai[0] = 3f;
29294 this.ai[1] = 0f;
29295 this.ai[2] = 0f;
29296 this.ai[3] = 0f;
29297 netUpdate = true;
29298 }
29299 if (this.ai[0] != 3f)
29300 {
29301 return;
29302 }
29303 position = base.Center;
29304 width = (height = 192);
29305 position.X -= width / 2;
29306 position.Y -= height / 2;
29309 alpha = 255;
29310 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.2f, 0.7f, 1.1f);
29311 for (int num1103 = 0; num1103 < 10; num1103++)
29312 {
29313 int num1104 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
29314 Dust dust = Main.dust[num1104];
29315 dust.velocity *= 1.4f;
29316 Main.dust[num1104].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + base.Center;
29317 }
29318 for (int num1105 = 0; num1105 < 40; num1105++)
29319 {
29320 int num1106 = Dust.NewDust(position, width, height, 226, 0f, 0f, 100, default(Color), 0.5f);
29321 Main.dust[num1106].noGravity = true;
29322 Dust dust = Main.dust[num1106];
29323 dust.velocity *= 2f;
29324 Main.dust[num1106].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + base.Center;
29325 Main.dust[num1106].velocity = Main.dust[num1106].velocity / 2f + Vector2.Normalize(Main.dust[num1106].position - base.Center);
29326 if (Main.rand.Next(2) == 0)
29327 {
29328 num1106 = Dust.NewDust(position, width, height, 226, 0f, 0f, 100, default(Color), 0.9f);
29329 Main.dust[num1106].noGravity = true;
29330 dust = Main.dust[num1106];
29331 dust.velocity *= 1.2f;
29332 Main.dust[num1106].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + base.Center;
29333 Main.dust[num1106].velocity = Main.dust[num1106].velocity / 2f + Vector2.Normalize(Main.dust[num1106].position - base.Center);
29334 }
29335 if (Main.rand.Next(4) == 0)
29336 {
29337 num1106 = Dust.NewDust(position, width, height, 226, 0f, 0f, 100, default(Color), 0.7f);
29338 dust = Main.dust[num1106];
29339 dust.velocity *= 1.2f;
29340 Main.dust[num1106].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * ((float)Main.rand.NextDouble() * 96f) + base.Center;
29341 Main.dust[num1106].velocity = Main.dust[num1106].velocity / 2f + Vector2.Normalize(Main.dust[num1106].position - base.Center);
29342 }
29343 }
29344 this.ai[1]++;
29345 if (this.ai[1] >= 3f)
29346 {
29348 life = 0;
29349 HitEffect();
29350 active = false;
29351 }
29352 }
29353 else if (aiStyle == 75)
29354 {
29355 int num1107 = -1;
29357 int num1108 = 0;
29358 if (type == 390)
29359 {
29360 if (localAI[0] == 0f && Main.netMode != 1)
29361 {
29362 localAI[0] = 1f;
29363 int num1109 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 391, whoAmI);
29364 this.ai[0] = num1109;
29365 netUpdate = true;
29366 }
29367 int num1110 = (int)this.ai[0];
29368 if (Main.npc[num1110].active && Main.npc[num1110].type == 391)
29369 {
29371 num1107 = num1110;
29372 vector144 = Vector2.UnitY * -14f;
29373 }
29374 }
29375 if (type == 416)
29376 {
29377 if (localAI[0] == 0f && Main.netMode != 1)
29378 {
29379 localAI[0] = 1f;
29380 int num1111 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 415, whoAmI);
29381 this.ai[0] = num1111;
29382 netUpdate = true;
29383 }
29384 int num1112 = (int)this.ai[0];
29385 if (Main.npc[num1112].active && Main.npc[num1112].type == 415)
29386 {
29388 num1107 = num1112;
29389 vector144 = new Vector2(-Main.npc[num1112].spriteDirection * 10, -30f);
29390 }
29391 }
29392 else if (type == 392)
29393 {
29394 int num1113 = (int)this.ai[0];
29395 if (Main.npc[num1113].active && Main.npc[num1113].type == 395)
29396 {
29398 num1107 = num1113;
29399 vector144 = Vector2.UnitY * 2f;
29400 vector144 *= Main.npc[num1113].scale;
29401 float num1114 = Main.npc[num1113].rotation;
29402 vector144 = vector144.RotatedBy(num1114);
29403 rotation = num1114;
29404 if (Main.netMode != 1)
29405 {
29406 bool flag63 = true;
29407 if (Main.npc[num1113].ai[0] >= 1f || Main.npc[num1113].ai[0] < 0f)
29408 {
29409 flag63 = false;
29410 }
29411 if (flag63)
29412 {
29413 for (int num1115 = 0; num1115 < 2; num1115++)
29414 {
29415 if (Main.npc[(int)localAI[num1115]].active && Main.npc[(int)localAI[num1115]].type == 393)
29416 {
29417 flag63 = false;
29418 }
29419 }
29420 for (int num1116 = 2; num1116 < 4; num1116++)
29421 {
29422 if (Main.npc[(int)localAI[num1116]].active && Main.npc[(int)localAI[num1116]].type == 394)
29423 {
29424 flag63 = false;
29425 }
29426 }
29427 }
29428 if (Main.npc[num1113].ai[3] % 200f == 0f && Main.npc[num1113].ai[0] != 1f)
29429 {
29430 for (int num1117 = 0; num1117 < 2; num1117++)
29431 {
29432 if (Main.npc[(int)localAI[num1117]].active && Main.npc[(int)localAI[num1117]].type == 393)
29433 {
29434 Main.npc[(int)localAI[num1117]].netUpdate = true;
29435 }
29436 }
29437 for (int num1118 = 2; num1118 < 4; num1118++)
29438 {
29439 if (Main.npc[(int)localAI[num1118]].active && Main.npc[(int)localAI[num1118]].type == 394)
29440 {
29441 Main.npc[(int)localAI[num1118]].netUpdate = true;
29442 }
29443 }
29444 netUpdate = true;
29445 }
29446 if (flag63)
29447 {
29448 if (!Main.expertMode)
29449 {
29450 Main.npc[num1113].ai[0] = 3f;
29451 Main.npc[num1113].ai[1] = 0f;
29452 Main.npc[num1113].ai[2] = 0f;
29453 Main.npc[num1113].ai[3] = 0f;
29454 Main.npc[num1113].netUpdate = true;
29455 }
29456 else
29457 {
29458 Main.npc[num1113].ai[0] = 1f;
29459 Main.npc[num1113].ai[1] = 0f;
29460 Main.npc[num1113].ai[2] = 0f;
29461 Main.npc[num1113].ai[3] = 0f;
29462 Main.npc[num1113].netUpdate = true;
29463 }
29464 }
29465 }
29466 }
29467 }
29468 else if (type == 393)
29469 {
29470 int num1119 = (int)this.ai[0];
29471 if (Main.npc[num1119].active && Main.npc[num1119].type == 395)
29472 {
29474 num1107 = num1119;
29475 vector144 = Vector2.UnitY * 29f + ((this.ai[1] == 1f) ? Vector2.UnitX : (-Vector2.UnitX)) * 60f;
29476 vector144 *= Main.npc[num1119].scale;
29477 float num1120 = Main.npc[num1119].rotation;
29478 vector144 = vector144.RotatedBy(num1120);
29479 rotation = num1120;
29480 }
29481 }
29482 else if (type == 394)
29483 {
29484 int num1121 = (int)this.ai[0];
29485 if (Main.npc[num1121].active && Main.npc[num1121].type == 395)
29486 {
29488 num1107 = num1121;
29489 vector144 = Vector2.UnitY * -13f + ((this.ai[1] == 1f) ? Vector2.UnitX : (-Vector2.UnitX)) * 49f;
29490 vector144 *= Main.npc[num1121].scale;
29491 float num1122 = Main.npc[num1121].rotation;
29492 vector144 = vector144.RotatedBy(num1122);
29493 rotation = num1122;
29494 num1108 = ((this.ai[1] == 1f) ? 1 : (-1));
29495 }
29496 }
29497 else if (type == 492)
29498 {
29499 int num1123 = (int)this.ai[0];
29500 if (Main.npc[num1123].active && Main.npc[num1123].type == 491)
29501 {
29503 num1107 = num1123;
29504 vector144 = new Vector2((-122f + 68f * this.ai[1]) * (float)((Main.npc[num1123].spriteDirection != 1) ? 1 : (-1)), -6f);
29505 vector144 *= Main.npc[num1123].scale;
29506 float num1124 = Main.npc[num1123].rotation;
29507 vector144 = vector144.RotatedBy(num1124);
29508 rotation = num1124;
29509 }
29510 }
29511 if (num1107 != -1)
29512 {
29513 NPC nPC5 = Main.npc[num1107];
29515 position = nPC5.Center;
29516 position.X -= width / 2;
29517 position.Y -= height / 2;
29519 gfxOffY = nPC5.gfxOffY;
29520 direction = nPC5.direction;
29521 if (num1108 == 0)
29522 {
29523 spriteDirection = nPC5.spriteDirection;
29524 }
29525 else
29526 {
29528 }
29529 if (type == 390)
29530 {
29531 timeLeft = nPC5.timeLeft;
29532 velocity = nPC5.velocity;
29533 target = nPC5.target;
29534 if (this.ai[1] < 60f)
29535 {
29536 this.ai[1]++;
29537 }
29538 if (justHit)
29539 {
29540 this.ai[1] = -30f;
29541 }
29542 int num1125 = 438;
29543 int num1126 = 30;
29544 float num1127 = 7f;
29545 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
29546 {
29547 Vector2 vector145 = Main.player[target].Center - base.Center;
29549 float num1128 = vector145.Length();
29550 float num1129 = 700f;
29551 if (type == 214)
29552 {
29553 num1129 = 550f;
29554 }
29555 if (type == 215)
29556 {
29557 num1129 = 800f;
29558 }
29559 if (num1128 < num1129)
29560 {
29561 if (this.ai[1] == 60f && Math.Sign(vector145.X) == direction)
29562 {
29563 this.ai[1] = -60f;
29564 Vector2 center10 = Main.player[target].Center;
29565 Vector2 vector147 = base.Center - Vector2.UnitY * 4f;
29567 vector148.X += Main.rand.Next(-50, 51);
29568 vector148.Y += Main.rand.Next(-50, 51);
29569 vector148.X *= (float)Main.rand.Next(80, 121) * 0.01f;
29570 vector148.Y *= (float)Main.rand.Next(80, 121) * 0.01f;
29571 vector148.Normalize();
29572 if (float.IsNaN(vector148.X) || float.IsNaN(vector148.Y))
29573 {
29575 }
29576 vector148 *= num1127;
29578 netUpdate = true;
29579 }
29580 else
29581 {
29582 float num1130 = this.ai[2];
29583 velocity.X *= 0.5f;
29584 this.ai[2] = 3f;
29585 if (Math.Abs(vector146.Y) > Math.Abs(vector146.X) * 2f)
29586 {
29587 if (vector146.Y > 0f)
29588 {
29589 this.ai[2] = 1f;
29590 }
29591 else
29592 {
29593 this.ai[2] = 5f;
29594 }
29595 }
29596 else if (Math.Abs(vector146.X) > Math.Abs(vector146.Y) * 2f)
29597 {
29598 this.ai[2] = 3f;
29599 }
29600 else if (vector146.Y > 0f)
29601 {
29602 this.ai[2] = 2f;
29603 }
29604 else
29605 {
29606 this.ai[2] = 4f;
29607 }
29608 if (this.ai[2] != num1130)
29609 {
29610 netUpdate = true;
29611 }
29612 }
29613 }
29614 }
29615 }
29616 if (type == 492)
29617 {
29618 timeLeft = nPC5.timeLeft;
29619 velocity = nPC5.velocity;
29620 if (this.ai[3] < 240f)
29621 {
29622 this.ai[3]++;
29623 }
29624 if (this.ai[3] == 2f)
29625 {
29626 TargetClosest(faceTarget: false);
29627 }
29628 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
29629 {
29630 Vector2 vector149 = Main.player[target].Center - base.Center;
29632 if (this.ai[3] >= 240f)
29633 {
29634 this.ai[3] = 0f;
29635 Vector2 center11 = Main.player[target].Center;
29636 Vector2 center12 = base.Center;
29638 if (float.IsNaN(vector151.X) || float.IsNaN(vector151.Y))
29639 {
29641 }
29642 vector151 *= 14f;
29643 vector151 += Vector2.UnitY * -5f;
29644 if (Main.netMode != 1)
29645 {
29647 }
29648 netUpdate = true;
29649 }
29650 else
29651 {
29652 float num1131 = this.ai[2];
29653 float[] array3 = new float[8];
29654 for (int num1132 = 0; num1132 < array3.Length; num1132++)
29655 {
29656 array3[num1132] = Vector2.Distance(base.Center + Vector2.UnitY.RotatedBy((float)num1132 * (-(float)Math.PI / 4f)) * 50f, Main.player[target].Center);
29657 }
29658 int num1133 = 0;
29659 for (int num1134 = 1; num1134 < array3.Length; num1134++)
29660 {
29661 if (array3[num1133] > array3[num1134])
29662 {
29663 num1133 = num1134;
29664 }
29665 }
29666 this.ai[2] = num1133 + 1;
29667 if (spriteDirection == 1)
29668 {
29669 this.ai[2] = 9f - this.ai[2];
29670 }
29671 if (this.ai[2] != num1131)
29672 {
29673 netUpdate = true;
29674 }
29675 }
29676 }
29677 else
29678 {
29679 if (this.ai[2] != 0f)
29680 {
29681 netUpdate = true;
29682 }
29683 this.ai[2] = 0f;
29684 }
29685 }
29686 if (type == 394)
29687 {
29688 timeLeft = nPC5.timeLeft;
29690 this.ai[3] = nPC5.ai[3];
29691 float num1135 = 440f;
29692 float num1136 = 140f;
29693 if (this.ai[3] >= num1135 && this.ai[3] < num1135 + num1136)
29694 {
29695 float num1137 = this.ai[3] - num1135;
29696 if (num1137 % 20f == 0f)
29697 {
29698 if (Main.netMode != 1)
29699 {
29701 spinningpoint3 = spinningpoint3.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29702 spinningpoint3 *= 8f;
29703 Vector2 vector152 = num1108 * Vector2.UnitX * 36f + base.Center + Vector2.UnitY * 8f;
29705 }
29707 }
29708 }
29709 }
29710 if (type == 393)
29711 {
29712 timeLeft = nPC5.timeLeft;
29714 this.ai[3] = nPC5.ai[3];
29715 float num1138 = 280f;
29716 float num1139 = 140f;
29717 bool flag64 = this.ai[3] >= num1138 && this.ai[3] < num1138 + num1139;
29718 if (!flag64)
29719 {
29720 TargetClosest(faceTarget: false);
29722 Vector2 v3 = player7.Center - base.Center;
29723 if (v3.Y < 0f)
29724 {
29725 v3.Y = 0f;
29726 }
29727 v3.Normalize();
29728 if (float.IsNaN(v3.X) || float.IsNaN(v3.Y))
29729 {
29730 v3 = Vector2.UnitY;
29731 }
29732 this.ai[2] = v3.ToRotation();
29733 }
29734 if (flag64)
29735 {
29736 float num1140 = this.ai[3] - num1138;
29737 if (num1140 % 6f == 0f)
29738 {
29739 if (Main.netMode != 1)
29740 {
29741 Vector2 spinningpoint4 = this.ai[2].ToRotationVector2();
29742 spinningpoint4 = spinningpoint4.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433 / 3.0);
29743 spinningpoint4 *= 16f;
29744 Vector2 vector153 = base.Center + spinningpoint4 * 1f;
29746 }
29748 }
29749 }
29750 }
29751 if (type != 392)
29752 {
29753 return;
29754 }
29755 timeLeft = nPC5.timeLeft;
29757 this.ai[3] = nPC5.ai[3];
29758 float num1141 = 20f;
29759 float num1142 = 240f;
29760 if (this.ai[3] >= num1141 && this.ai[3] < num1141 + num1142 && nPC5.ai[0] == 0f)
29761 {
29762 float num1143 = this.ai[3] - num1141;
29763 if (num1143 == 0f)
29764 {
29765 if (Main.netMode != 1)
29766 {
29767 Vector2 center13 = base.Center;
29769 }
29771 }
29772 }
29773 bool flag65 = false;
29774 int maxValue4 = 1000;
29775 int maxValue5 = 1000;
29776 int num1144 = 450;
29778 if (nPC5.ai[0] == 2f)
29779 {
29780 flag65 = true;
29781 maxValue5 = 120;
29782 maxValue4 = 120;
29783 }
29784 if (!flag65)
29785 {
29786 num1141 = 280f;
29787 num1142 = 120f;
29788 flag65 = flag65 || (this.ai[3] >= num1141 && this.ai[3] < num1141 + num1142);
29789 if (flag65)
29790 {
29791 maxValue5 = 90;
29792 maxValue4 = 60;
29793 }
29794 }
29795 if (!flag65)
29796 {
29797 num1141 = 440f;
29798 num1142 = 140f;
29799 flag65 = flag65 || (this.ai[3] >= num1141 && this.ai[3] < num1141 + num1142);
29800 if (flag65)
29801 {
29802 maxValue5 = 60;
29803 maxValue4 = 90;
29804 }
29805 }
29806 bool flag66 = true;
29807 bool flag67 = true;
29808 bool flag68 = true;
29809 bool flag69 = true;
29810 if (Main.npc[(int)localAI[0]].active && Main.npc[(int)localAI[0]].type == 393)
29811 {
29812 flag66 = false;
29813 }
29814 if (Main.npc[(int)localAI[1]].active && Main.npc[(int)localAI[1]].type == 393)
29815 {
29816 flag67 = false;
29817 }
29818 if (Main.npc[(int)localAI[2]].active && Main.npc[(int)localAI[2]].type == 394)
29819 {
29820 flag68 = false;
29821 }
29822 if (Main.npc[(int)localAI[3]].active && Main.npc[(int)localAI[3]].type == 394)
29823 {
29824 flag69 = false;
29825 }
29826 if (flag65)
29827 {
29828 bool flag70 = true;
29829 if (flag66 && Main.rand.Next(maxValue4) == 0)
29830 {
29831 if (Main.netMode != 1)
29832 {
29833 Vector2 spinningpoint5 = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f);
29834 spinningpoint5 = spinningpoint5.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29835 spinningpoint5 *= 3f;
29836 Vector2 vector154 = -1f * Vector2.UnitX * Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * Main.rand.Next(30, 45);
29838 }
29840 }
29841 if (flag67 && Main.rand.Next(maxValue4) == 0)
29842 {
29843 if (Main.netMode != 1)
29844 {
29845 Vector2 spinningpoint6 = new Vector2(1f * (float)Main.rand.NextDouble() * 3f, 1f);
29846 spinningpoint6 = spinningpoint6.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29847 spinningpoint6 *= 3f;
29848 Vector2 vector155 = 1f * Vector2.UnitX * Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * Main.rand.Next(30, 45);
29850 }
29852 }
29853 }
29854 if (flag65)
29855 {
29856 bool flag71 = true;
29857 if (flag68 && Main.rand.Next(maxValue5) == 0)
29858 {
29859 if (Main.netMode != 1)
29860 {
29861 Vector2 spinningpoint7 = new Vector2(-1f * (float)Main.rand.NextDouble() * 2f, -1f);
29862 spinningpoint7 = spinningpoint7.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29863 spinningpoint7 *= 3f;
29864 Vector2 vector156 = -1f * Vector2.UnitX * Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * Main.rand.Next(-30, -10);
29866 }
29868 }
29869 if (flag69 && Main.rand.Next(maxValue5) == 0)
29870 {
29871 if (Main.netMode != 1)
29872 {
29873 Vector2 spinningpoint8 = new Vector2(1f * (float)Main.rand.NextDouble() * 2f, -1f);
29874 spinningpoint8 = spinningpoint8.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29875 spinningpoint8 *= 3f;
29876 Vector2 vector157 = 1f * Vector2.UnitX * Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * Main.rand.Next(-30, -10);
29878 }
29880 }
29881 }
29882 if (flag66 && Main.rand.Next(8) == 0)
29883 {
29884 int num1145 = Dust.NewDust(-1f * Vector2.UnitX * Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * Main.rand.Next(15, 30), 4, 16, (Main.rand.Next(4) != 0) ? 31 : 228, 0f, 0f, 100, default(Color), 1.2f);
29885 Main.dust[num1145].velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f).RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29886 Dust dust = Main.dust[num1145];
29887 dust.velocity *= 0.5f;
29888 Main.dust[num1145].velocity.Y = 0f - Math.Abs(Main.dust[num1145].velocity.Y);
29889 }
29890 if (flag67 && Main.rand.Next(8) == 0)
29891 {
29892 int num1146 = Dust.NewDust(Vector2.UnitX * Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * Main.rand.Next(15, 30), 4, 16, (Main.rand.Next(4) != 0) ? 31 : 228, 0f, 0f, 100, default(Color), 1.2f);
29893 Main.dust[num1146].velocity = new Vector2((float)Main.rand.NextDouble() * 3f, 1f).RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29894 Dust dust = Main.dust[num1146];
29895 dust.velocity *= 0.5f;
29896 Main.dust[num1146].velocity.Y = 0f - Math.Abs(Main.dust[num1146].velocity.Y);
29897 }
29898 if (flag68 && Main.rand.Next(8) == 0)
29899 {
29900 int num1147 = Dust.NewDust(-1f * Vector2.UnitX * Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * Main.rand.Next(-30, -10), 4, 16, (Main.rand.Next(4) != 0) ? 31 : 228, 0f, 0f, 100, default(Color), 1.2f);
29901 Main.dust[num1147].velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 2f, 1f).RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29902 Dust dust = Main.dust[num1147];
29903 dust.velocity *= 0.5f;
29904 Main.dust[num1147].velocity.Y = 0f - Math.Abs(Main.dust[num1147].velocity.Y);
29905 }
29906 if (flag69 && Main.rand.Next(8) == 0)
29907 {
29908 int num1148 = Dust.NewDust(Vector2.UnitX * Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * Main.rand.Next(-30, -10), 4, 16, (Main.rand.Next(4) != 0) ? 31 : 228, 0f, 0f, 100, default(Color), 1.2f);
29909 Main.dust[num1148].velocity = new Vector2((float)Main.rand.NextDouble() * 2f, 1f).RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
29910 Dust dust = Main.dust[num1148];
29911 dust.velocity *= 0.5f;
29912 Main.dust[num1148].velocity.Y = 0f - Math.Abs(Main.dust[num1148].velocity.Y);
29913 }
29914 }
29915 else if (type == 390)
29916 {
29917 Transform(382);
29918 }
29919 else if (type == 416)
29920 {
29921 Transform(518);
29922 }
29923 else
29924 {
29925 life = 0;
29926 HitEffect();
29927 active = false;
29928 }
29929 }
29930 else if (aiStyle == 76)
29931 {
29932 if (localAI[3] == 0f && Main.netMode != 1 && type == 395)
29933 {
29934 localAI[3] = 1f;
29935 int[] array4 = new int[4];
29936 int num1149 = 0;
29937 for (int num1150 = 0; num1150 < 2; num1150++)
29938 {
29939 int num1151 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + num1150 * 300 - 150, (int)base.Center.Y, 393, whoAmI);
29940 Main.npc[num1151].ai[1] = num1150;
29941 Main.npc[num1151].netUpdate = true;
29942 array4[num1149++] = num1151;
29943 }
29944 for (int num1152 = 0; num1152 < 2; num1152++)
29945 {
29946 int num1153 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + num1152 * 300 - 150, (int)base.Center.Y, 394, whoAmI);
29947 Main.npc[num1153].ai[1] = num1152;
29948 Main.npc[num1153].netUpdate = true;
29949 array4[num1149++] = num1153;
29950 }
29951 int num1154 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 392, whoAmI);
29952 Main.npc[num1154].ai[0] = whoAmI;
29953 Main.npc[num1154].netUpdate = true;
29954 for (int num1155 = 0; num1155 < 4; num1155++)
29955 {
29956 Main.npc[array4[num1155]].ai[0] = whoAmI;
29957 }
29958 for (int num1156 = 0; num1156 < 4; num1156++)
29959 {
29960 Main.npc[num1154].localAI[num1156] = array4[num1156];
29961 }
29962 }
29963 if (this.ai[0] == 3f)
29964 {
29965 StrikeNPCNoInteraction(9999, 0f, 0);
29966 return;
29967 }
29968 Vector2 center14 = base.Center;
29970 float num1157 = 5600f;
29971 if (target < 0 || target == 255 || player8.dead || !player8.active || Vector2.Distance(player8.Center, center14) > num1157)
29972 {
29973 TargetClosest();
29975 netUpdate = true;
29976 }
29977 if ((player8.dead || !player8.active || Vector2.Distance(player8.Center, center14) > num1157) && this.ai[0] != 1f)
29978 {
29979 if (this.ai[0] == 0f)
29980 {
29981 this.ai[0] = -1f;
29982 }
29983 if (this.ai[0] == 2f)
29984 {
29985 this.ai[0] = -2f;
29986 }
29987 netUpdate = true;
29988 }
29989 if (this.ai[0] == -1f || this.ai[0] == -2f)
29990 {
29991 velocity.Y -= 0.4f;
29992 EncourageDespawn(10);
29993 if (!player8.dead)
29994 {
29995 timeLeft = 300;
29996 if (this.ai[0] == -2f)
29997 {
29998 this.ai[0] = 2f;
29999 }
30000 if (this.ai[0] == 0f)
30001 {
30002 this.ai[0] = 0f;
30003 }
30004 this.ai[1] = 0f;
30005 this.ai[2] = 0f;
30006 this.ai[3] = 0f;
30007 netUpdate = true;
30008 }
30009 }
30010 else if (this.ai[0] == 0f)
30011 {
30012 int num1158 = 0;
30013 int num1159 = 0;
30014 if (this.ai[3] >= 580f)
30015 {
30016 num1158 = 0;
30017 }
30018 else if (this.ai[3] >= 440f)
30019 {
30020 num1158 = 5;
30021 }
30022 else if (this.ai[3] >= 420f)
30023 {
30024 num1158 = 4;
30025 }
30026 else if (this.ai[3] >= 280f)
30027 {
30028 num1158 = 3;
30029 }
30030 else if (this.ai[3] >= 260f)
30031 {
30032 num1158 = 2;
30033 }
30034 else if (this.ai[3] >= 20f)
30035 {
30036 num1158 = 1;
30037 }
30038 this.ai[3]++;
30039 if (this.ai[3] >= 600f)
30040 {
30041 this.ai[3] = 0f;
30042 }
30043 num1159 = num1158;
30044 if (this.ai[3] >= 580f)
30045 {
30046 num1158 = 0;
30047 }
30048 else if (this.ai[3] >= 440f)
30049 {
30050 num1158 = 5;
30051 }
30052 else if (this.ai[3] >= 420f)
30053 {
30054 num1158 = 4;
30055 }
30056 else if (this.ai[3] >= 280f)
30057 {
30058 num1158 = 3;
30059 }
30060 else if (this.ai[3] >= 260f)
30061 {
30062 num1158 = 2;
30063 }
30064 else if (this.ai[3] >= 20f)
30065 {
30066 num1158 = 1;
30067 }
30068 if (num1158 != num1159)
30069 {
30070 if (num1158 == 0)
30071 {
30072 this.ai[2] = 0f;
30073 }
30074 if (num1158 == 1)
30075 {
30076 this.ai[2] = ((Math.Sign((player8.Center - center14).X) == 1) ? 1 : (-1));
30077 }
30078 if (num1158 == 2)
30079 {
30080 this.ai[2] = 0f;
30081 }
30082 netUpdate = true;
30083 }
30084 if (num1158 == 0)
30085 {
30086 if (this.ai[2] == 0f)
30087 {
30088 this.ai[2] = -600 * Math.Sign((center14 - player8.Center).X);
30089 }
30090 Vector2 vector158 = player8.Center + new Vector2(this.ai[2], -250f) - center14;
30091 if (vector158.Length() < 50f)
30092 {
30093 this.ai[3] = 19f;
30094 }
30095 else
30096 {
30097 vector158.Normalize();
30098 velocity = Vector2.Lerp(velocity, vector158 * 16f, 0.1f);
30099 }
30100 }
30101 if (num1158 == 1)
30102 {
30103 int num1160 = (int)base.Center.X / 16;
30104 int num1161 = (int)(position.Y + (float)height) / 16;
30105 int num1162 = 0;
30107 {
30108 num1162 = 1;
30109 }
30110 else
30111 {
30112 for (; num1162 < 150 && num1161 + num1162 < Main.maxTilesY; num1162++)
30113 {
30114 int num1163 = num1161 + num1162;
30116 {
30117 num1162--;
30118 break;
30119 }
30120 }
30121 }
30122 float num1164 = num1162 * 16;
30123 float num1165 = 250f;
30124 if (num1164 < num1165)
30125 {
30126 float num1166 = -4f;
30127 if (0f - num1166 > num1164)
30128 {
30129 num1166 = 0f - num1164;
30130 }
30131 velocity.Y = MathHelper.Lerp(velocity.Y, num1166, 0.05f);
30132 }
30133 else
30134 {
30135 velocity.Y *= 0.95f;
30136 }
30137 velocity.X = 3.5f * this.ai[2];
30138 }
30139 switch (num1158)
30140 {
30141 case 2:
30142 {
30143 if (this.ai[2] == 0f)
30144 {
30145 this.ai[2] = 300 * Math.Sign((center14 - player8.Center).X);
30146 }
30147 Vector2 vector159 = player8.Center + new Vector2(this.ai[2], -170f) - center14;
30148 int num1175 = (int)base.Center.X / 16;
30149 int num1176 = (int)(position.Y + (float)height) / 16;
30150 int num1177 = 0;
30152 {
30153 num1177 = 1;
30154 }
30155 else
30156 {
30157 for (; num1177 < 150 && num1176 + num1177 < Main.maxTilesY; num1177++)
30158 {
30159 int num1178 = num1176 + num1177;
30161 {
30162 num1177--;
30163 break;
30164 }
30165 }
30166 }
30167 float num1179 = num1177 * 16;
30168 float num1180 = 170f;
30169 if (num1179 < num1180)
30170 {
30171 vector159.Y -= num1180 - num1179;
30172 }
30173 if (vector159.Length() < 70f)
30174 {
30175 this.ai[3] = 279f;
30176 break;
30177 }
30178 vector159.Normalize();
30179 velocity = Vector2.Lerp(velocity, vector159 * 20f, 0.1f);
30180 break;
30181 }
30182 case 3:
30183 {
30184 float num1167 = 0.85f;
30185 int num1168 = (int)base.Center.X / 16;
30186 int num1169 = (int)(position.Y + (float)height) / 16;
30187 int num1170 = 0;
30189 {
30190 num1170 = 1;
30191 }
30192 else
30193 {
30194 for (; num1170 < 150 && num1169 + num1170 < Main.maxTilesY; num1170++)
30195 {
30196 int num1171 = num1169 + num1170;
30198 {
30199 num1170--;
30200 break;
30201 }
30202 }
30203 }
30204 float num1172 = num1170 * 16;
30205 float num1173 = 170f;
30206 if (num1172 < num1173)
30207 {
30208 float num1174 = -4f;
30209 if (0f - num1174 > num1172)
30210 {
30211 num1174 = 0f - num1172;
30212 }
30213 velocity.Y = MathHelper.Lerp(velocity.Y, num1174, 0.05f);
30214 }
30215 else
30216 {
30217 velocity.Y *= num1167;
30218 }
30219 velocity.X *= num1167;
30220 break;
30221 }
30222 }
30223 switch (num1158)
30224 {
30225 case 4:
30226 {
30227 Vector2 vector160 = player8.Center + new Vector2(0f, -250f) - center14;
30228 if (vector160.Length() < 50f)
30229 {
30230 this.ai[3] = 439f;
30231 break;
30232 }
30233 vector160.Normalize();
30234 velocity = Vector2.Lerp(velocity, vector160 * 16f, 0.1f);
30235 break;
30236 }
30237 case 5:
30238 velocity *= 0.85f;
30239 break;
30240 }
30241 }
30242 else if (this.ai[0] == 1f)
30243 {
30244 dontTakeDamage = false;
30245 velocity *= 0.96f;
30246 float num1181 = 150f;
30247 this.ai[1]++;
30248 if (this.ai[1] >= num1181)
30249 {
30250 this.ai[0] = 2f;
30251 this.ai[1] = 0f;
30252 rotation = 0f;
30253 netUpdate = true;
30254 }
30255 else if (this.ai[1] < 40f)
30256 {
30257 rotation = Vector2.UnitY.RotatedBy(this.ai[1] / 40f * ((float)Math.PI * 2f)).Y * 0.2f;
30258 }
30259 else if (this.ai[1] < 80f)
30260 {
30261 rotation = Vector2.UnitY.RotatedBy(this.ai[1] / 20f * ((float)Math.PI * 2f)).Y * 0.3f;
30262 }
30263 else if (this.ai[1] < 120f)
30264 {
30265 rotation = Vector2.UnitY.RotatedBy(this.ai[1] / 10f * ((float)Math.PI * 2f)).Y * 0.4f;
30266 }
30267 else
30268 {
30269 rotation = (this.ai[1] - 120f) / 30f * ((float)Math.PI * 2f);
30270 }
30271 }
30272 else if (this.ai[0] == 2f)
30273 {
30274 int num1182 = 80;
30275 float num1183 = 3600f;
30276 float num1184 = 120f;
30277 float num1185 = 60f;
30278 int num1186 = 0;
30279 if (this.ai[3] % num1184 >= num1185)
30280 {
30281 num1186 = 1;
30282 }
30283 int num1187 = num1186;
30284 num1186 = 0;
30285 this.ai[3]++;
30286 if (this.ai[3] % num1184 >= num1185)
30287 {
30288 num1186 = 1;
30289 }
30290 if (num1186 != num1187)
30291 {
30292 if (num1186 == 1)
30293 {
30294 this.ai[2] = ((Math.Sign((player8.Center - center14).X) == 1) ? 1 : (-1));
30295 if (Main.netMode != 1)
30296 {
30297 Vector2 center15 = base.Center;
30299 }
30301 }
30302 netUpdate = true;
30303 }
30304 if (this.ai[3] >= num1183)
30305 {
30306 this.ai[0] = 2f;
30307 this.ai[1] = 0f;
30308 this.ai[2] = 0f;
30309 this.ai[3] = 0f;
30310 netUpdate = true;
30311 }
30312 else if (num1186 == 0)
30313 {
30314 Vector2 vector161 = player8.Center + new Vector2(this.ai[2] * 350f, -250f) - center14;
30315 vector161.Normalize();
30316 velocity = Vector2.Lerp(velocity, vector161 * 16f, 0.1f);
30317 }
30318 else
30319 {
30320 int num1188 = (int)base.Center.X / 16;
30321 int num1189 = (int)(position.Y + (float)height) / 16;
30322 int num1190 = 0;
30324 {
30325 num1190 = 1;
30326 }
30327 else
30328 {
30329 for (; num1190 < 150 && num1189 + num1190 < Main.maxTilesY; num1190++)
30330 {
30331 int num1191 = num1189 + num1190;
30333 {
30334 num1190--;
30335 break;
30336 }
30337 }
30338 }
30339 float num1192 = num1190 * 16;
30340 float num1193 = 250f;
30341 if (num1192 < num1193)
30342 {
30343 float num1194 = -4f;
30344 if (0f - num1194 > num1192)
30345 {
30346 num1194 = 0f - num1192;
30347 }
30348 velocity.Y = MathHelper.Lerp(velocity.Y, num1194, 0.05f);
30349 }
30350 else
30351 {
30352 velocity.Y *= 0.95f;
30353 }
30354 velocity.X = 8f * this.ai[2];
30355 }
30356 rotation = 0f;
30357 }
30358 bool flag72 = false;
30359 if (position.Y < -100f)
30360 {
30361 flag72 = true;
30362 }
30363 if (position.X < -100f)
30364 {
30365 flag72 = true;
30366 }
30367 if (position.Y > (float)(Main.maxTilesY * 16 + 100))
30368 {
30369 flag72 = true;
30370 }
30371 if (position.X > (float)(Main.maxTilesX * 16 + 100))
30372 {
30373 flag72 = true;
30374 }
30375 if (flag72)
30376 {
30377 position = Vector2.Clamp(position, new Vector2(-100f), new Vector2(100f) + new Vector2(Main.maxTilesX, Main.maxTilesY) * 16f);
30378 active = false;
30379 netUpdate = true;
30380 }
30381 }
30382 else if (aiStyle == 77)
30383 {
30384 if (this.ai[0] != -1f && this.ai[0] != 2f && Main.rand.Next(200) == 0)
30385 {
30386 SoundEngine.PlaySound(29, (int)base.Center.X, (int)base.Center.Y, Main.rand.Next(93, 100));
30387 }
30388 if (localAI[3] == 0f)
30389 {
30390 netUpdate = true;
30391 localAI[3] = 1f;
30392 this.ai[0] = -1f;
30393 }
30394 if (this.ai[0] == -2f)
30395 {
30396 dontTakeDamage = true;
30397 this.ai[1]++;
30398 if (this.ai[1] == 30f)
30399 {
30400 SoundEngine.PlaySound(29, (int)base.Center.X, (int)base.Center.Y, 92);
30401 }
30402 if (this.ai[1] < 60f)
30403 {
30404 MoonlordDeathDrama.RequestLight(this.ai[1] / 30f, base.Center);
30405 }
30406 if (this.ai[1] == 60f)
30407 {
30408 this.ai[1] = 0f;
30409 this.ai[0] = 0f;
30410 if (Main.netMode != 1 && type == 398)
30411 {
30412 this.ai[2] = Main.rand.Next(3);
30413 this.ai[2] = 0f;
30414 netUpdate = true;
30415 }
30416 }
30417 }
30418 if (this.ai[0] == -1f)
30419 {
30420 dontTakeDamage = true;
30421 this.ai[1]++;
30422 if (this.ai[1] == 30f)
30423 {
30424 SoundEngine.PlaySound(29, (int)base.Center.X, (int)base.Center.Y, 92);
30425 }
30426 if (this.ai[1] < 60f)
30427 {
30428 MoonlordDeathDrama.RequestLight(this.ai[1] / 30f, base.Center);
30429 }
30430 if (this.ai[1] == 60f)
30431 {
30432 this.ai[1] = 0f;
30433 this.ai[0] = 0f;
30434 if (Main.netMode != 1 && type == 398)
30435 {
30436 this.ai[2] = Main.rand.Next(3);
30437 this.ai[2] = 0f;
30438 netUpdate = true;
30439 int[] array5 = new int[3];
30440 int num1195 = 0;
30441 for (int num1196 = 0; num1196 < 2; num1196++)
30442 {
30443 int num1197 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + num1196 * 800 - 400, (int)base.Center.Y - 100, 397, whoAmI);
30444 Main.npc[num1197].ai[2] = num1196;
30445 Main.npc[num1197].netUpdate = true;
30446 array5[num1195++] = num1197;
30447 }
30448 int num1198 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y - 400, 396, whoAmI);
30449 Main.npc[num1198].netUpdate = true;
30450 array5[num1195++] = num1198;
30451 for (int num1199 = 0; num1199 < 3; num1199++)
30452 {
30453 Main.npc[array5[num1199]].ai[3] = whoAmI;
30454 }
30455 for (int num1200 = 0; num1200 < 3; num1200++)
30456 {
30458 }
30459 }
30460 }
30461 }
30462 if (this.ai[0] == 0f)
30463 {
30464 dontTakeDamage = true;
30465 TargetClosest(faceTarget: false);
30466 Vector2 vector162 = Main.player[target].Center - base.Center + new Vector2(0f, 130f);
30467 if (vector162.Length() > 20f)
30468 {
30473 }
30474 if (Main.netMode != 1)
30475 {
30476 bool flag73 = false;
30477 if (localAI[0] < 0f || localAI[1] < 0f || localAI[2] < 0f)
30478 {
30479 flag73 = true;
30480 }
30481 else if (!Main.npc[(int)localAI[0]].active || Main.npc[(int)localAI[0]].type != 397)
30482 {
30483 flag73 = true;
30484 }
30485 else if (!Main.npc[(int)localAI[1]].active || Main.npc[(int)localAI[1]].type != 397)
30486 {
30487 flag73 = true;
30488 }
30489 else if (!Main.npc[(int)localAI[2]].active || Main.npc[(int)localAI[2]].type != 396)
30490 {
30491 flag73 = true;
30492 }
30493 if (flag73)
30494 {
30495 life = 0;
30496 HitEffect();
30497 active = false;
30498 }
30499 bool flag74 = true;
30500 if (Main.npc[(int)localAI[0]].ai[0] != -2f)
30501 {
30502 flag74 = false;
30503 }
30504 if (Main.npc[(int)localAI[1]].ai[0] != -2f)
30505 {
30506 flag74 = false;
30507 }
30508 if (Main.npc[(int)localAI[2]].ai[0] != -2f)
30509 {
30510 flag74 = false;
30511 }
30512 if (flag74)
30513 {
30514 this.ai[0] = 1f;
30515 dontTakeDamage = false;
30516 netUpdate = true;
30517 }
30518 }
30519 }
30520 else if (this.ai[0] == 1f)
30521 {
30522 dontTakeDamage = false;
30523 TargetClosest(faceTarget: false);
30524 Vector2 vector163 = Main.player[target].Center - base.Center + new Vector2(0f, 130f);
30525 if (vector163.Length() > 20f)
30526 {
30531 }
30532 }
30533 else if (this.ai[0] == 2f)
30534 {
30535 dontTakeDamage = true;
30536 velocity = Vector2.Lerp(value2: new Vector2(direction, -0.5f), value1: velocity, amount: 0.98f);
30537 this.ai[1]++;
30538 if (this.ai[1] < 60f)
30539 {
30540 MoonlordDeathDrama.RequestLight(this.ai[1] / 60f, base.Center);
30541 }
30542 if (this.ai[1] == 60f)
30543 {
30544 for (int num1201 = 0; num1201 < 1000; num1201++)
30545 {
30546 Projectile projectile = Main.projectile[num1201];
30547 if (projectile.active && (projectile.type == 456 || projectile.type == 462 || projectile.type == 455 || projectile.type == 452 || projectile.type == 454))
30548 {
30549 projectile.Kill();
30550 }
30551 }
30552 for (int num1202 = 0; num1202 < 200; num1202++)
30553 {
30554 NPC nPC6 = Main.npc[num1202];
30555 if (nPC6.active && nPC6.type == 400)
30556 {
30557 nPC6.HitEffect(0, 9999.0);
30558 nPC6.active = false;
30559 }
30560 }
30561 }
30562 if (this.ai[1] % 3f == 0f && this.ai[1] < 580f && this.ai[1] > 60f)
30563 {
30565 if (vector164 != Vector2.Zero)
30566 {
30567 vector164.Normalize();
30568 }
30569 vector164 *= 20f + Main.rand.NextFloat() * 400f;
30570 bool flag75 = true;
30571 Vector2 vector165 = base.Center + vector164;
30572 Point point7 = vector165.ToTileCoordinates();
30573 if (!WorldGen.InWorld(point7.X, point7.Y))
30574 {
30575 flag75 = false;
30576 }
30577 if (flag75 && WorldGen.SolidTile(point7.X, point7.Y))
30578 {
30579 flag75 = false;
30580 }
30581 float num1203 = Main.rand.Next(6, 19);
30582 float num1204 = (float)Math.PI * 2f / num1203;
30583 float num1205 = (float)Math.PI * 2f * Main.rand.NextFloat();
30584 float num1206 = 1f + Main.rand.NextFloat() * 2f;
30585 float num1207 = 1f + Main.rand.NextFloat();
30586 float fadeIn = 0.4f + Main.rand.NextFloat();
30587 int num1208 = Utils.SelectRandom<int>(Main.rand, 31, 229);
30588 if (flag75 && !Main.dedServ)
30589 {
30591 for (float num1209 = 0f; num1209 < num1203 * 2f; num1209++)
30592 {
30593 Dust dust6 = Main.dust[Dust.NewDust(vector165, 0, 0, 229)];
30594 dust6.noGravity = true;
30595 dust6.position = vector165;
30596 dust6.velocity = Vector2.UnitY.RotatedBy(num1205 + num1204 * num1209) * num1206 * (Main.rand.NextFloat() * 1.6f + 1.6f);
30597 dust6.fadeIn = fadeIn;
30598 dust6.scale = num1207;
30599 }
30600 }
30601 for (float num1210 = 0f; num1210 < this.ai[1] / 60f; num1210++)
30602 {
30604 if (vector166 != Vector2.Zero)
30605 {
30606 vector166.Normalize();
30607 }
30608 vector166 *= 20f + Main.rand.NextFloat() * 800f;
30609 Vector2 vec = base.Center + vector166;
30610 Point point8 = vec.ToTileCoordinates();
30611 bool flag76 = true;
30612 if (!WorldGen.InWorld(point8.X, point8.Y))
30613 {
30614 flag76 = false;
30615 }
30616 if (flag76 && WorldGen.SolidTile(point8.X, point8.Y))
30617 {
30618 flag76 = false;
30619 }
30620 if (flag76)
30621 {
30623 dust7.noGravity = true;
30624 dust7.position = vec;
30625 dust7.velocity = -Vector2.UnitY * num1206 * (Main.rand.NextFloat() * 0.9f + 1.6f);
30626 dust7.fadeIn = fadeIn;
30627 dust7.scale = num1207;
30628 }
30629 }
30630 }
30631 if (this.ai[1] % 15f == 0f && this.ai[1] < 480f && this.ai[1] >= 90f && Main.netMode != 1)
30632 {
30634 if (vector167 != Vector2.Zero)
30635 {
30636 vector167.Normalize();
30637 }
30638 vector167 *= 20f + Main.rand.NextFloat() * 400f;
30639 bool flag77 = true;
30640 Vector2 vec2 = base.Center + vector167;
30641 Point point9 = vec2.ToTileCoordinates();
30642 if (!WorldGen.InWorld(point9.X, point9.Y))
30643 {
30644 flag77 = false;
30645 }
30646 if (flag77 && WorldGen.SolidTile(point9.X, point9.Y))
30647 {
30648 flag77 = false;
30649 }
30650 if (flag77)
30651 {
30652 float num1211 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * ((float)Math.PI / 8f + (float)Math.PI / 4f * Main.rand.NextFloat());
30653 Vector2 vector168 = new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.5f - 0.5f).RotatedBy(num1211) * 6f;
30655 }
30656 }
30657 if (this.ai[1] == 1f)
30658 {
30660 }
30661 if (this.ai[1] >= 480f)
30662 {
30663 MoonlordDeathDrama.RequestLight((this.ai[1] - 480f) / 120f, base.Center);
30664 }
30665 if (this.ai[1] >= 600f)
30666 {
30667 life = 0;
30668 HitEffect(0, 1337.0);
30669 checkDead();
30670 return;
30671 }
30672 }
30673 else if (this.ai[0] == 3f)
30674 {
30675 dontTakeDamage = true;
30676 velocity = Vector2.Lerp(value2: new Vector2(direction, -0.5f), value1: velocity, amount: 0.98f);
30677 this.ai[1]++;
30678 if (this.ai[1] < 60f)
30679 {
30680 MoonlordDeathDrama.RequestLight(this.ai[1] / 40f, base.Center);
30681 }
30682 if (this.ai[1] == 40f)
30683 {
30684 for (int num1212 = 0; num1212 < 1000; num1212++)
30685 {
30687 if (projectile2.active && (projectile2.type == 456 || projectile2.type == 462 || projectile2.type == 455 || projectile2.type == 452 || projectile2.type == 454))
30688 {
30689 projectile2.active = false;
30690 if (Main.netMode != 1)
30691 {
30692 NetMessage.SendData(27, -1, -1, null, num1212);
30693 }
30694 }
30695 }
30696 for (int num1213 = 0; num1213 < 200; num1213++)
30697 {
30698 NPC nPC7 = Main.npc[num1213];
30699 if (nPC7.active && nPC7.type == 400)
30700 {
30701 nPC7.active = false;
30702 if (Main.netMode != 1)
30703 {
30704 NetMessage.SendData(23, -1, -1, null, nPC7.whoAmI);
30705 }
30706 }
30707 }
30708 for (int num1214 = 0; num1214 < 600; num1214++)
30709 {
30711 if (gore2.active && gore2.type >= 619 && gore2.type <= 622)
30712 {
30713 gore2.active = false;
30714 }
30715 }
30716 }
30717 if (this.ai[1] >= 60f)
30718 {
30719 for (int num1215 = 0; num1215 < 200; num1215++)
30720 {
30721 NPC nPC8 = Main.npc[num1215];
30722 if (nPC8.active && (nPC8.type == 400 || nPC8.type == 397 || nPC8.type == 396))
30723 {
30724 nPC8.active = false;
30725 if (Main.netMode != 1)
30726 {
30727 NetMessage.SendData(23, -1, -1, null, nPC8.whoAmI);
30728 }
30729 }
30730 }
30731 active = false;
30732 if (Main.netMode != 1)
30733 {
30734 NetMessage.SendData(23, -1, -1, null, whoAmI);
30735 }
30736 LunarApocalypseIsUp = false;
30737 if (Main.netMode == 2)
30738 {
30740 }
30741 return;
30742 }
30743 }
30744 bool flag78 = false;
30745 if (this.ai[0] == -2f || this.ai[0] == -1f || this.ai[0] == 2f || this.ai[0] == 3f)
30746 {
30747 flag78 = true;
30748 }
30749 if (Main.player[target].active && !Main.player[target].dead)
30750 {
30751 flag78 = true;
30752 }
30753 if (!flag78)
30754 {
30755 for (int num1216 = 0; num1216 < 255; num1216++)
30756 {
30757 if (Main.player[num1216].active && !Main.player[num1216].dead)
30758 {
30759 flag78 = true;
30760 break;
30761 }
30762 }
30763 }
30764 if (!flag78)
30765 {
30766 this.ai[0] = 3f;
30767 this.ai[1] = 0f;
30768 netUpdate = true;
30769 }
30770 if (!(this.ai[0] >= 0f) || !(this.ai[0] < 2f) || Main.netMode == 1 || !(Distance(Main.player[target].Center) > 2400f))
30771 {
30772 return;
30773 }
30774 this.ai[0] = -2f;
30775 netUpdate = true;
30776 Vector2 vector169 = Main.player[target].Center - Vector2.UnitY * 150f - base.Center;
30778 if (Main.npc[(int)localAI[0]].active)
30779 {
30780 NPC nPC3 = Main.npc[(int)localAI[0]];
30781 nPC3.position += vector169;
30782 Main.npc[(int)localAI[0]].netUpdate = true;
30783 }
30784 if (Main.npc[(int)localAI[1]].active)
30785 {
30786 NPC nPC3 = Main.npc[(int)localAI[1]];
30787 nPC3.position += vector169;
30788 Main.npc[(int)localAI[1]].netUpdate = true;
30789 }
30790 if (Main.npc[(int)localAI[2]].active)
30791 {
30792 NPC nPC3 = Main.npc[(int)localAI[2]];
30793 nPC3.position += vector169;
30794 Main.npc[(int)localAI[2]].netUpdate = true;
30795 }
30796 for (int num1217 = 0; num1217 < 200; num1217++)
30797 {
30798 NPC nPC9 = Main.npc[num1217];
30799 if (nPC9.active && nPC9.type == 400)
30800 {
30801 NPC nPC3 = nPC9;
30802 nPC3.position += vector169;
30803 nPC9.netUpdate = true;
30804 }
30805 }
30806 }
30807 else if (aiStyle == 78)
30808 {
30810 if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398)
30811 {
30812 life = 0;
30813 HitEffect();
30814 active = false;
30815 }
30816 bool flag79 = this.ai[2] == 0f;
30817 float num1218 = -flag79.ToDirectionInt();
30818 spriteDirection = (int)num1218;
30819 if (frameCounter == 19.0 && !dontTakeDamage)
30820 {
30822 }
30823 dontTakeDamage = frameCounter >= 21.0;
30824 Vector2 vector170 = new Vector2(30f, 66f);
30825 float num1219 = 0f;
30826 float num1220 = 0f;
30827 bool flag80 = true;
30828 int num1221 = 0;
30829 if (this.ai[0] != -2f)
30830 {
30831 float num1222 = this.ai[0];
30832 this.ai[1]++;
30833 int num1223 = (int)Main.npc[(int)this.ai[3]].ai[2];
30834 int num1224 = ((!flag79) ? 1 : 0);
30835 int num1225 = 0;
30836 int num1226 = 0;
30837 for (; num1225 < 5; num1225++)
30838 {
30840 if (!(num1220 + (float)num1226 <= this.ai[1]))
30841 {
30842 break;
30843 }
30844 num1226 += (int)num1220;
30845 }
30846 if (num1225 == 5)
30847 {
30848 num1225 = 0;
30849 this.ai[1] = 0f;
30851 num1226 = 0;
30852 }
30853 this.ai[0] = MoonLordAttacksArray[num1223, num1224, 0, num1225];
30854 num1219 = (int)this.ai[1] - num1226;
30855 if (this.ai[0] != num1222)
30856 {
30857 netUpdate = true;
30858 }
30859 }
30860 if (this.ai[0] == -2f)
30861 {
30862 damage = 80;
30863 num1221 = 0;
30864 dontTakeDamage = true;
30865 this.ai[1]++;
30866 if (this.ai[1] >= 32f)
30867 {
30868 this.ai[1] = 0f;
30869 }
30870 if (this.ai[1] < 0f)
30871 {
30872 this.ai[1] = 0f;
30873 }
30874 Vector2 center16 = Main.npc[(int)this.ai[3]].Center;
30875 Vector2 vector171 = center16 + new Vector2(350f * num1218, -100f);
30876 Vector2 vector172 = vector171 - base.Center;
30877 if (vector172.Length() > 20f)
30878 {
30879 vector172.Normalize();
30880 vector172 *= 6f;
30882 if (vector172 != Vector2.Zero)
30883 {
30885 }
30887 }
30888 }
30889 else if (this.ai[0] == 0f)
30890 {
30891 num1221 = 3;
30892 localAI[1] -= 0.05f;
30893 if (localAI[1] < 0f)
30894 {
30895 localAI[1] = 0f;
30896 }
30897 Vector2 center17 = Main.npc[(int)this.ai[3]].Center;
30898 Vector2 vector173 = center17 + new Vector2(350f * num1218, -100f);
30899 Vector2 vector174 = vector173 - base.Center;
30900 if (vector174.Length() > 20f)
30901 {
30902 vector174.Normalize();
30903 vector174 *= 6f;
30905 if (vector174 != Vector2.Zero)
30906 {
30908 }
30910 }
30911 }
30912 else if (this.ai[0] == 1f)
30913 {
30914 num1221 = 0;
30915 int num1227 = 7;
30916 int num1228 = 4;
30917 if (num1219 >= (float)(num1227 * num1228 * 2))
30918 {
30919 localAI[1] -= 0.07f;
30920 if (localAI[1] < 0f)
30921 {
30922 localAI[1] = 0f;
30923 }
30924 }
30925 else if (num1219 >= (float)(num1227 * num1228))
30926 {
30927 localAI[1] += 0.05f;
30928 if (localAI[1] > 0.75f)
30929 {
30930 localAI[1] = 0.75f;
30931 }
30932 float num1229 = (float)Math.PI * 2f * (num1219 % (float)(num1227 * num1228)) / (float)(num1227 * num1228) - (float)Math.PI / 2f;
30933 localAI[0] = new Vector2((float)Math.Cos(num1229) * vector170.X, (float)Math.Sin(num1229) * vector170.Y).ToRotation();
30934 if (num1219 % (float)num1228 == 0f)
30935 {
30936 Vector2 vector175 = new Vector2(1f * (0f - num1218), 3f);
30937 Vector2 vector176 = Utils.Vector2FromElipse(localAI[0].ToRotationVector2(), vector170 * localAI[1]);
30938 Vector2 vector177 = base.Center + Vector2.Normalize(vector176) * vector170.Length() * 0.4f + vector175;
30940 float ai = ((float)Math.PI * 2f * (float)Main.rand.NextDouble() - (float)Math.PI) / 30f + (float)Math.PI / 180f * num1218;
30942 }
30943 }
30944 else
30945 {
30946 localAI[1] += 0.02f;
30947 if (localAI[1] > 0.75f)
30948 {
30949 localAI[1] = 0.75f;
30950 }
30951 float num1230 = (float)Math.PI * 2f * (num1219 % (float)(num1227 * num1228)) / (float)(num1227 * num1228) - (float)Math.PI / 2f;
30952 localAI[0] = new Vector2((float)Math.Cos(num1230) * vector170.X, (float)Math.Sin(num1230) * vector170.Y).ToRotation();
30953 }
30954 }
30955 else if (this.ai[0] == 2f)
30956 {
30957 localAI[1] -= 0.05f;
30958 if (localAI[1] < 0f)
30959 {
30960 localAI[1] = 0f;
30961 }
30962 Vector2 center18 = Main.npc[(int)this.ai[3]].Center;
30963 Vector2 vector179 = new Vector2(220f * num1218, -60f) + center18;
30964 vector179 += new Vector2(num1218 * 100f, -50f);
30965 Vector2 vector180 = new Vector2(400f * num1218, -60f);
30966 if (num1219 < 30f)
30967 {
30968 Vector2 vector181 = vector179 - base.Center;
30969 if (vector181 != Vector2.Zero)
30970 {
30972 vector182.Normalize();
30973 velocity = Vector2.SmoothStep(velocity, vector182 * Math.Min(8f, vector181.Length()), 0.2f);
30974 }
30975 }
30976 else if (num1219 < 210f)
30977 {
30978 num1221 = 1;
30979 int num1231 = (int)num1219 - 30;
30980 if (num1231 % 30 == 0 && Main.netMode != 1)
30981 {
30982 Vector2 vector183 = new Vector2(5f * num1218, -8f);
30983 int num1232 = num1231 / 30;
30984 vector183.X += ((float)num1232 - 3.5f) * num1218 * 3f;
30985 vector183.Y += ((float)num1232 - 4.5f) * 1f;
30986 vector183 *= 1.2f;
30987 int num1233 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, vector183.X, vector183.Y, 454, 40, 1f, Main.myPlayer, 0f, whoAmI);
30988 }
30990 if (vector184 != Vector2.Zero)
30991 {
30993 vector185.Normalize();
30994 velocity = Vector2.Lerp(velocity, vector185 * Math.Min(20f, vector184.Length()), 0.5f);
30995 }
30996 }
30997 else if (num1219 < 282f)
30998 {
30999 num1221 = 0;
31000 velocity *= 0.9f;
31001 }
31002 else if (num1219 < 287f)
31003 {
31004 num1221 = 1;
31005 velocity *= 0.9f;
31006 }
31007 else if (num1219 < 292f)
31008 {
31009 num1221 = 2;
31010 velocity *= 0.9f;
31011 }
31012 else if (num1219 < 300f)
31013 {
31014 num1221 = 3;
31015 if (num1219 == 292f && Main.netMode != 1)
31016 {
31018 Vector2 vector186 = Vector2.Normalize(Main.player[num1234].Center - (base.Center + Vector2.UnitY * -350f));
31019 if (float.IsNaN(vector186.X) || float.IsNaN(vector186.Y))
31020 {
31022 }
31023 vector186 *= 12f;
31024 for (int num1235 = 0; num1235 < 1000; num1235++)
31025 {
31027 if (projectile3.active && projectile3.type == 454 && projectile3.ai[1] == (float)whoAmI && projectile3.ai[0] != -1f)
31028 {
31029 projectile3.ai[0] = -1f;
31030 projectile3.velocity = vector186;
31031 projectile3.netUpdate = true;
31032 NetMessage.SendData(27, -1, -1, null, num1235);
31033 }
31034 }
31035 }
31036 Vector2 vector187 = Vector2.SmoothStep(vector179, vector179 + vector180, 1f - (num1219 - 270f) / 30f) - base.Center;
31037 if (vector187 != Vector2.Zero)
31038 {
31040 vector188.Normalize();
31041 velocity = Vector2.Lerp(velocity, vector188 * Math.Min(14f, vector187.Length()), 0.1f);
31042 }
31043 }
31044 else
31045 {
31046 num1221 = 3;
31047 Vector2 vector189 = vector179 - base.Center;
31048 if (vector189 != Vector2.Zero)
31049 {
31051 vector190.Normalize();
31052 velocity = Vector2.SmoothStep(velocity, vector190 * Math.Min(8f, vector189.Length()), 0.2f);
31053 }
31054 }
31055 }
31056 else if (this.ai[0] == 3f)
31057 {
31058 if (num1219 == 0f)
31059 {
31060 TargetClosest(faceTarget: false);
31061 netUpdate = true;
31062 }
31063 Vector2 v4 = Main.player[target].Center + Main.player[target].velocity * 20f - base.Center;
31064 localAI[0] = localAI[0].AngleLerp(v4.ToRotation(), 0.5f);
31065 localAI[1] += 0.05f;
31066 if (localAI[1] > 1f)
31067 {
31068 localAI[1] = 1f;
31069 }
31070 if (num1219 == num1220 - 35f)
31071 {
31072 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 6);
31073 }
31074 if ((num1219 == num1220 - 14f || num1219 == num1220 - 7f || num1219 == num1220) && Main.netMode != 1)
31075 {
31076 Vector2 vector191 = Utils.Vector2FromElipse(localAI[0].ToRotationVector2(), vector170 * localAI[1]);
31078 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector191.X, base.Center.Y + vector191.Y, vector192.X, vector192.Y, 462, 30, 0f, Main.myPlayer);
31079 }
31080 }
31081 if (flag80)
31082 {
31083 Vector2 center19 = Main.npc[(int)this.ai[3]].Center;
31084 Vector2 vector193 = new Vector2(220f * num1218, -60f) + center19;
31085 Vector2 vector194 = vector193 + new Vector2(num1218 * 110f, -150f);
31086 Vector2 max = vector194 + new Vector2(num1218 * 370f, 150f);
31087 if (vector194.X > max.X)
31088 {
31089 Utils.Swap(ref vector194.X, ref max.X);
31090 }
31091 if (vector194.Y > max.Y)
31092 {
31093 Utils.Swap(ref vector194.Y, ref max.Y);
31094 }
31096 if (vector195 != base.Center + velocity)
31097 {
31098 base.Center = vector195 - velocity;
31099 }
31100 }
31101 int num1236 = num1221 * 7;
31102 if ((double)num1236 > frameCounter)
31103 {
31104 frameCounter++;
31105 }
31106 if ((double)num1236 < frameCounter)
31107 {
31108 frameCounter--;
31109 }
31110 if (frameCounter < 0.0)
31111 {
31112 frameCounter = 0.0;
31113 }
31114 if (frameCounter > 21.0)
31115 {
31116 frameCounter = 21.0;
31117 }
31118 int num1237 = 0;
31119 if (flag79)
31120 {
31121 num1237 = 0;
31122 }
31123 switch (num1237)
31124 {
31125 case 1:
31126 if (this.ai[0] == 0f)
31127 {
31128 if ((this.ai[1] += 1f) >= 20f)
31129 {
31130 this.ai[1] = 0f;
31131 this.ai[0] = 1f;
31132 netUpdate = true;
31133 }
31134 velocity = Vector2.UnitX * 4f;
31135 }
31136 else if (this.ai[0] == 1f)
31137 {
31138 if ((this.ai[1] += 1f) >= 20f)
31139 {
31140 this.ai[1] = 0f;
31141 this.ai[0] = 2f;
31142 netUpdate = true;
31143 }
31144 velocity = Vector2.UnitX * -4f;
31145 }
31146 else if (this.ai[0] == 2f || this.ai[0] == 4f)
31147 {
31148 if ((this.ai[1] += 1f) >= 20f)
31149 {
31150 this.ai[1] = 0f;
31151 this.ai[0]++;
31152 netUpdate = true;
31153 }
31154 velocity = Vector2.UnitY * -4f * (flag79 ? 1 : (-1));
31155 }
31156 else
31157 {
31158 if (this.ai[0] != 3f && this.ai[0] != 5f)
31159 {
31160 break;
31161 }
31162 if ((this.ai[1] += 1f) >= 20f)
31163 {
31164 this.ai[1] = 0f;
31165 this.ai[0]++;
31166 if (this.ai[0] == 6f)
31167 {
31168 this.ai[0] = 0f;
31169 }
31170 netUpdate = true;
31171 }
31172 velocity = Vector2.UnitY * 4f * (flag79 ? 1 : (-1));
31173 }
31174 break;
31175 case 2:
31176 {
31177 Vector2 vector196 = new Vector2(30f, 66f);
31178 TargetClosest(faceTarget: false);
31179 Vector2 v5 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - base.Center;
31180 float num1238 = v5.Length() / 200f;
31181 if (num1238 > 1f)
31182 {
31183 num1238 = 1f;
31184 }
31185 num1238 = 1f - num1238;
31186 num1238 *= 2f;
31187 if (num1238 > 1f)
31188 {
31189 num1238 = 1f;
31190 }
31191 localAI[0] = v5.ToRotation();
31192 localAI[1] = num1238;
31193 localAI[1] = 1f;
31194 break;
31195 }
31196 case 3:
31197 {
31198 int num1244 = 7;
31199 int num1245 = 4;
31200 this.ai[1]++;
31201 if (this.ai[1] >= (float)(num1244 * num1245 * 10))
31202 {
31203 this.ai[1] = 0f;
31204 break;
31205 }
31206 if (this.ai[1] >= (float)(num1244 * num1245))
31207 {
31208 localAI[1] -= 0.07f;
31209 if (localAI[1] < 0f)
31210 {
31211 localAI[1] = 0f;
31212 }
31213 break;
31214 }
31215 localAI[1] += 0.05f;
31216 if (localAI[1] > 0.75f)
31217 {
31218 localAI[1] = 0.75f;
31219 }
31220 float num1246 = (float)Math.PI * 2f * (this.ai[1] % (float)(num1244 * num1245)) / (float)(num1244 * num1245) - (float)Math.PI / 2f;
31221 localAI[0] = new Vector2((float)Math.Cos(num1246) * vector170.X, (float)Math.Sin(num1246) * vector170.Y).ToRotation();
31222 if (this.ai[1] % (float)num1245 == 0f)
31223 {
31224 Vector2 vector207 = new Vector2(1f * (0f - num1218), 3f);
31225 Vector2 vector208 = Utils.Vector2FromElipse(localAI[0].ToRotationVector2(), vector170 * localAI[1]);
31226 Vector2 vector209 = base.Center + Vector2.Normalize(vector208) * vector170.Length() * 0.4f + vector207;
31228 float ai2 = ((float)Math.PI * 2f * (float)Main.rand.NextDouble() - (float)Math.PI) / 30f + (float)Math.PI / 180f * num1218;
31230 }
31231 break;
31232 }
31233 case 4:
31234 {
31235 Vector2 center20 = Main.npc[(int)this.ai[3]].Center;
31236 Vector2 vector197 = new Vector2(220f * num1218, -60f) + center20;
31237 vector197 += new Vector2(num1218 * 100f, -50f);
31238 Vector2 vector198 = new Vector2(400f * num1218, -60f);
31239 this.ai[1]++;
31240 if (this.ai[1] < 30f)
31241 {
31242 Vector2 vector199 = vector197 - base.Center;
31243 if (vector199 != Vector2.Zero)
31244 {
31246 vector200.Normalize();
31247 velocity = Vector2.SmoothStep(velocity, vector200 * Math.Min(8f, vector199.Length()), 0.2f);
31248 }
31249 }
31250 else if (this.ai[1] < 210f)
31251 {
31252 int num1239 = (int)this.ai[1] - 30;
31253 if (num1239 % 30 == 0 && Main.netMode != 1)
31254 {
31255 Vector2 vector201 = new Vector2(5f * num1218, -8f);
31256 int num1240 = num1239 / 30;
31257 vector201.X += ((float)num1240 - 3.5f) * num1218 * 3f;
31258 vector201.Y += ((float)num1240 - 4.5f) * 1f;
31259 vector201 *= 1.2f;
31260 int num1241 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, vector201.X, vector201.Y, 454, 1, 1f, Main.myPlayer, 0f, whoAmI);
31261 }
31262 Vector2 vector202 = Vector2.SmoothStep(vector197, vector197 + vector198, (this.ai[1] - 30f) / 180f) - base.Center;
31263 if (vector202 != Vector2.Zero)
31264 {
31266 vector203.Normalize();
31267 velocity = Vector2.Lerp(velocity, vector203 * Math.Min(4f, vector202.Length()), 0.1f);
31268 }
31269 }
31270 else if (this.ai[1] < 270f)
31271 {
31272 velocity *= 0.9f;
31273 }
31274 else if (this.ai[1] < 300f)
31275 {
31276 if (this.ai[1] == 270f && Main.netMode != 1)
31277 {
31279 Vector2 vector204 = Vector2.Normalize(Main.player[num1242].Center - (base.Center + Vector2.UnitY * -350f));
31280 if (float.IsNaN(vector204.X) || float.IsNaN(vector204.Y))
31281 {
31283 }
31284 vector204 *= 12f;
31285 for (int num1243 = 0; num1243 < 1000; num1243++)
31286 {
31288 if (projectile4.active && projectile4.type == 454 && projectile4.ai[1] == (float)whoAmI && projectile4.ai[0] != -1f)
31289 {
31290 projectile4.ai[0] = -1f;
31291 projectile4.velocity = vector204;
31292 projectile4.netUpdate = true;
31293 }
31294 }
31295 }
31296 Vector2 vector205 = Vector2.SmoothStep(vector197, vector197 + vector198, 1f - (this.ai[1] - 270f) / 30f) - base.Center;
31297 if (vector205 != Vector2.Zero)
31298 {
31300 vector206.Normalize();
31301 velocity = Vector2.Lerp(velocity, vector206 * Math.Min(14f, vector205.Length()), 0.1f);
31302 }
31303 }
31304 else
31305 {
31306 this.ai[1] = 0f;
31307 }
31308 break;
31309 }
31310 case 5:
31311 dontTakeDamage = true;
31312 this.ai[1]++;
31313 if (this.ai[1] >= 40f)
31314 {
31315 this.ai[1] = 0f;
31316 }
31317 break;
31318 }
31319 }
31320 else if (aiStyle == 79)
31321 {
31322 if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398)
31323 {
31324 life = 0;
31325 HitEffect();
31326 active = false;
31327 }
31328 if (localAI[3] == 13f && !dontTakeDamage)
31329 {
31331 }
31332 dontTakeDamage = localAI[3] >= 15f;
31334 base.Center = Main.npc[(int)this.ai[3]].Center + new Vector2(0f, -400f);
31335 Vector2 vector211 = new Vector2(27f, 59f);
31336 float num1247 = 0f;
31337 float num1248 = 0f;
31338 int num1249 = 0;
31339 int num1250 = 0;
31340 if (this.ai[0] >= 0f)
31341 {
31342 float num1251 = this.ai[0];
31343 this.ai[1]++;
31344 int num1252 = (int)Main.npc[(int)this.ai[3]].ai[2];
31345 int num1253 = 2;
31346 int num1254 = 0;
31347 int num1255 = 0;
31348 for (; num1254 < 5; num1254++)
31349 {
31351 if (!(num1248 + (float)num1255 <= this.ai[1]))
31352 {
31353 break;
31354 }
31355 num1255 += (int)num1248;
31356 }
31357 if (num1254 == 5)
31358 {
31359 num1254 = 0;
31360 this.ai[1] = 0f;
31362 num1255 = 0;
31363 }
31364 this.ai[0] = MoonLordAttacksArray[num1252, num1253, 0, num1254];
31365 num1247 = (int)this.ai[1] - num1255;
31366 if (this.ai[0] != num1251)
31367 {
31368 netUpdate = true;
31369 }
31370 }
31371 if (this.ai[0] == -3f)
31372 {
31373 damage = 0;
31374 dontTakeDamage = true;
31375 rotation = MathHelper.Lerp(rotation, (float)Math.PI / 12f, 0.07f);
31376 this.ai[1]++;
31377 if (this.ai[1] >= 32f)
31378 {
31379 this.ai[1] = 0f;
31380 }
31381 if (this.ai[1] < 0f)
31382 {
31383 this.ai[1] = 0f;
31384 }
31385 if (localAI[2] < 14f)
31386 {
31387 localAI[2]++;
31388 }
31389 }
31390 else if (this.ai[0] == -2f)
31391 {
31392 if (Main.npc[(int)this.ai[3]].ai[0] == 2f)
31393 {
31394 this.ai[0] = -3f;
31395 return;
31396 }
31397 damage = 80;
31398 dontTakeDamage = true;
31399 this.ai[1]++;
31400 if (this.ai[1] >= 32f)
31401 {
31402 this.ai[1] = 0f;
31403 }
31404 if (this.ai[1] < 0f)
31405 {
31406 this.ai[1] = 0f;
31407 }
31408 this.ai[2]++;
31409 if (this.ai[2] >= 555f)
31410 {
31411 this.ai[2] = 0f;
31412 }
31413 if (this.ai[2] >= 120f)
31414 {
31415 num1247 = this.ai[2] - 120f;
31416 num1248 = 555f;
31417 num1249 = 2;
31418 Vector2 vector212 = new Vector2(0f, 216f);
31419 if (num1247 == 0f && Main.netMode != 1)
31420 {
31421 Vector2 vector213 = base.Center + vector212;
31422 for (int num1256 = 0; num1256 < 255; num1256++)
31423 {
31425 if (player9.active && !player9.dead && Vector2.Distance(player9.Center, vector213) <= 3000f)
31426 {
31428 if (vector214 != Vector2.Zero)
31429 {
31430 vector214.Normalize();
31431 }
31433 }
31434 }
31435 }
31436 if ((num1247 == 120f || num1247 == 180f || num1247 == 240f) && Main.netMode != 1)
31437 {
31438 for (int num1257 = 0; num1257 < 1000; num1257++)
31439 {
31441 if (projectile5.active && projectile5.type == 456 && Main.player[(int)projectile5.ai[1]].FindBuffIndex(145) != -1)
31442 {
31443 Vector2 center21 = Main.player[target].Center;
31444 int num1258 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)center21.X, (int)center21.Y, 401);
31445 Main.npc[num1258].netUpdate = true;
31446 Main.npc[num1258].ai[0] = whoAmI + 1;
31447 Main.npc[num1258].ai[1] = num1257;
31448 }
31449 }
31450 }
31451 }
31452 }
31453 else if (this.ai[0] == 0f)
31454 {
31455 num1250 = 3;
31456 TargetClosest(faceTarget: false);
31457 Vector2 v6 = Main.player[target].Center - base.Center - new Vector2(0f, -22f);
31458 float num1259 = v6.Length() / 500f;
31459 if (num1259 > 1f)
31460 {
31461 num1259 = 1f;
31462 }
31463 num1259 = 1f - num1259;
31464 num1259 *= 2f;
31465 if (num1259 > 1f)
31466 {
31467 num1259 = 1f;
31468 }
31469 localAI[0] = v6.ToRotation();
31470 localAI[1] = num1259;
31471 localAI[2] = MathHelper.Lerp(localAI[2], 1f, 0.2f);
31472 }
31473 if (this.ai[0] == 1f)
31474 {
31475 if (num1247 < 180f)
31476 {
31477 localAI[1] -= 0.05f;
31478 if (localAI[1] < 0f)
31479 {
31480 localAI[1] = 0f;
31481 }
31482 if (num1247 >= 60f)
31483 {
31484 Vector2 center22 = base.Center;
31485 int num1260 = 0;
31486 if (num1247 >= 120f)
31487 {
31488 num1260 = 1;
31489 }
31490 for (int num1261 = 0; num1261 < 1 + num1260; num1261++)
31491 {
31492 int num1262 = 229;
31493 float num1263 = 0.8f;
31494 if (num1261 % 2 == 1)
31495 {
31496 num1262 = 229;
31497 num1263 = 1.65f;
31498 }
31499 Vector2 vector215 = center22 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * vector211 / 2f;
31500 int num1264 = Dust.NewDust(vector215 - Vector2.One * 8f, 16, 16, num1262, velocity.X / 2f, velocity.Y / 2f);
31501 Main.dust[num1264].velocity = Vector2.Normalize(center22 - vector215) * 3.5f * (10f - (float)num1260 * 2f) / 10f;
31502 Main.dust[num1264].noGravity = true;
31503 Main.dust[num1264].scale = num1263;
31504 Main.dust[num1264].customData = this;
31505 }
31506 }
31507 }
31508 else if (num1247 < num1248 - 15f)
31509 {
31510 if (num1247 == 180f && Main.netMode != 1)
31511 {
31512 TargetClosest(faceTarget: false);
31513 Vector2 spinningpoint9 = Main.player[target].Center - base.Center;
31514 spinningpoint9.Normalize();
31515 float num1265 = -1f;
31516 if (spinningpoint9.X < 0f)
31517 {
31518 num1265 = 1f;
31519 }
31520 spinningpoint9 = spinningpoint9.RotatedBy((0f - num1265) * ((float)Math.PI * 2f) / 6f);
31521 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, spinningpoint9.X, spinningpoint9.Y, 455, 75, 0f, Main.myPlayer, num1265 * ((float)Math.PI * 2f) / 540f, whoAmI);
31522 this.ai[2] = (spinningpoint9.ToRotation() + (float)Math.PI * 3f) * num1265;
31523 netUpdate = true;
31524 }
31525 localAI[1] += 0.05f;
31526 if (localAI[1] > 1f)
31527 {
31528 localAI[1] = 1f;
31529 }
31530 float num1266 = (this.ai[2] >= 0f).ToDirectionInt();
31531 float num1267 = this.ai[2];
31532 if (num1267 < 0f)
31533 {
31534 num1267 *= -1f;
31535 }
31536 num1267 += (float)Math.PI * -3f;
31537 num1267 += num1266 * ((float)Math.PI * 2f) / 540f;
31538 localAI[0] = num1267;
31539 this.ai[2] = (num1267 + (float)Math.PI * 3f) * num1266;
31540 }
31541 else
31542 {
31543 localAI[1] -= 0.07f;
31544 if (localAI[1] < 0f)
31545 {
31546 localAI[1] = 0f;
31548 {
31549 for (int num1268 = 0; num1268 < 30; num1268++)
31550 {
31551 if (!WorldGen.SolidTile((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f)))
31552 {
31553 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, (float)Main.rand.Next(-1599, 1600) * 0.01f, (float)Main.rand.Next(-1599, 1) * 0.01f, 1021, 70, 10f);
31554 }
31555 }
31556 }
31557 }
31558 num1250 = 3;
31559 }
31560 }
31561 else if (this.ai[0] == 2f)
31562 {
31563 num1249 = 2;
31564 num1250 = 3;
31565 Vector2 vector216 = new Vector2(0f, 216f);
31566 if (num1247 == 0f && Main.netMode != 1)
31567 {
31568 Vector2 vector217 = base.Center + vector216;
31569 for (int num1269 = 0; num1269 < 255; num1269++)
31570 {
31572 if (player10.active && !player10.dead && Vector2.Distance(player10.Center, vector217) <= 3000f)
31573 {
31575 if (vector218 != Vector2.Zero)
31576 {
31577 vector218.Normalize();
31578 }
31580 }
31581 }
31582 }
31583 if ((num1247 == 120f || num1247 == 180f || num1247 == 240f) && Main.netMode != 1)
31584 {
31585 for (int num1270 = 0; num1270 < 1000; num1270++)
31586 {
31588 if (projectile6.active && projectile6.type == 456 && Main.player[(int)projectile6.ai[1]].FindBuffIndex(145) != -1)
31589 {
31590 Vector2 center23 = Main.player[target].Center;
31591 int num1271 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)center23.X, (int)center23.Y, 401);
31592 Main.npc[num1271].netUpdate = true;
31593 Main.npc[num1271].ai[0] = whoAmI + 1;
31594 Main.npc[num1271].ai[1] = num1270;
31595 }
31596 }
31597 }
31598 }
31599 else if (this.ai[0] == 3f)
31600 {
31601 if ((double)num1247 == 1.0)
31602 {
31603 TargetClosest(faceTarget: false);
31604 netUpdate = true;
31605 }
31606 Vector2 v7 = Main.player[target].Center + Main.player[target].velocity * 20f - base.Center;
31607 localAI[0] = localAI[0].AngleLerp(v7.ToRotation(), 0.5f);
31608 localAI[1] += 0.05f;
31609 if (localAI[1] > 1f)
31610 {
31611 localAI[1] = 1f;
31612 }
31613 if (num1247 == num1248 - 35f)
31614 {
31615 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 6);
31616 }
31617 if ((num1247 == num1248 - 14f || num1247 == num1248 - 7f || num1247 == num1248) && Main.netMode != 1)
31618 {
31619 Vector2 vector219 = Utils.Vector2FromElipse(localAI[0].ToRotationVector2(), vector211 * localAI[1]);
31621 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector219.X, base.Center.Y + vector219.Y, vector220.X, vector220.Y, 462, 30, 0f, Main.myPlayer);
31622 }
31623 }
31624 int num1272 = num1249 * 7;
31625 if ((float)num1272 > localAI[2])
31626 {
31627 localAI[2]++;
31628 }
31629 if ((float)num1272 < localAI[2])
31630 {
31631 localAI[2]--;
31632 }
31633 if (localAI[2] < 0f)
31634 {
31635 localAI[2] = 0f;
31636 }
31637 if (localAI[2] > 14f)
31638 {
31639 localAI[2] = 14f;
31640 }
31641 int num1273 = num1250 * 5;
31642 if ((float)num1273 > localAI[3])
31643 {
31644 localAI[3]++;
31645 }
31646 if ((float)num1273 < localAI[3])
31647 {
31648 localAI[3]--;
31649 }
31650 if (localAI[3] < 0f)
31651 {
31652 localAI[2] = 0f;
31653 }
31654 if (localAI[3] > 15f)
31655 {
31656 localAI[2] = 15f;
31657 }
31658 int num1274 = 0;
31659 if (num1274 == 1)
31660 {
31661 Vector2 vector221 = new Vector2(27f, 59f);
31662 TargetClosest(faceTarget: false);
31663 Vector2 v8 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - base.Center;
31664 float num1275 = v8.Length() / 200f;
31665 if (num1275 > 1f)
31666 {
31667 num1275 = 1f;
31668 }
31669 num1275 = 1f - num1275;
31670 num1275 *= 2f;
31671 if (num1275 > 1f)
31672 {
31673 num1275 = 1f;
31674 }
31675 localAI[0] = v8.ToRotation();
31676 localAI[1] = num1275;
31677 localAI[1] = 1f;
31678 }
31679 if (num1274 == 2)
31680 {
31681 Vector2 vector222 = new Vector2(27f, 59f);
31682 float num1276 = (float)Math.PI * 2f * ((float)Main.timeForVisualEffects % 600f) / 600f;
31683 localAI[0] = new Vector2((float)Math.Cos(num1276) * vector222.X, (float)Math.Sin(num1276) * vector222.Y).ToRotation();
31684 localAI[1] = 0.75f;
31685 if (this.ai[1] == 0f)
31686 {
31687 Vector2 vector223 = num1276.ToRotationVector2();
31689 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, vector223.X, vector223.Y, 455, 1, 0f, Main.myPlayer, (float)Math.PI / 300f, whoAmI);
31690 }
31691 this.ai[1]++;
31692 if (this.ai[1] >= 600f)
31693 {
31694 this.ai[1] = 0f;
31695 }
31696 }
31697 if (num1274 == 3)
31698 {
31699 Vector2 vector224 = new Vector2(0f, 216f);
31700 if (this.ai[1] == 0f)
31701 {
31702 TargetClosest(faceTarget: false);
31703 Vector2 vector225 = Main.player[target].Center - base.Center;
31704 vector225.Normalize();
31705 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector224.X, base.Center.Y + vector224.Y, vector225.X, vector225.Y, 456, 0, 0f, Main.myPlayer, whoAmI + 1, target);
31706 }
31707 this.ai[1]++;
31708 if (this.ai[1] >= 600f)
31709 {
31710 this.ai[1] = 0f;
31711 }
31712 }
31713 if (num1274 == 4)
31714 {
31715 Vector2 vector226 = new Vector2(27f, 59f);
31716 TargetClosest(faceTarget: false);
31717 Vector2 v9 = Main.player[target].Center + Main.player[target].velocity * 20f - base.Center;
31718 localAI[0] = localAI[0].AngleLerp(v9.ToRotation(), 0.5f);
31719 localAI[1] = 1f;
31720 this.ai[1]++;
31721 if (this.ai[1] == 55f)
31722 {
31723 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 6);
31724 }
31725 if (this.ai[1] == 76f || this.ai[1] == 83f || this.ai[1] == 90f)
31726 {
31727 Vector2 vector227 = Utils.Vector2FromElipse(elipseSizes: new Vector2(27f, 59f) * localAI[1], angleVector: localAI[0].ToRotationVector2());
31729 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector227.X, base.Center.Y + vector227.Y, vector228.X, vector228.Y, 462, 5, 0f, Main.myPlayer);
31730 }
31731 if (this.ai[1] >= 90f)
31732 {
31733 this.ai[1] = 0f;
31734 }
31735 }
31736 }
31737 else if (aiStyle == 80)
31738 {
31739 if (this.ai[0] == 0f)
31740 {
31741 if (direction == 0)
31742 {
31743 TargetClosest();
31744 netUpdate = true;
31745 }
31746 if (collideX)
31747 {
31749 netUpdate = true;
31750 }
31751 velocity.X = 3f * (float)direction;
31752 Vector2 center24 = base.Center;
31753 Point point10 = center24.ToTileCoordinates();
31754 int num1277 = 30;
31755 if (WorldGen.InWorld(point10.X, point10.Y, 30))
31756 {
31757 for (int num1278 = 0; num1278 < 30; num1278++)
31758 {
31760 {
31761 num1277 = num1278;
31762 break;
31763 }
31764 }
31765 }
31766 if (num1277 < 15)
31767 {
31768 velocity.Y = Math.Max(velocity.Y - 0.05f, -3.5f);
31769 }
31770 else if (num1277 < 20)
31771 {
31772 velocity.Y *= 0.95f;
31773 }
31774 else
31775 {
31776 velocity.Y = Math.Min(velocity.Y + 0.05f, 1.5f);
31777 }
31778 float distanceToPlayer;
31780 if (num1279 == -1 || Main.player[num1279].dead)
31781 {
31782 return;
31783 }
31784 if (distanceToPlayer < 352f && Main.player[num1279].Center.Y > base.Center.Y)
31785 {
31786 this.ai[0] = 1f;
31787 this.ai[1] = 0f;
31788 netUpdate = true;
31789 }
31790 }
31791 else if (this.ai[0] == 1f)
31792 {
31793 this.ai[1]++;
31794 velocity *= 0.95f;
31795 if (this.ai[1] >= 60f)
31796 {
31797 this.ai[1] = 0f;
31798 this.ai[0] = 2f;
31799 int num1280 = FindClosestPlayer();
31800 if (num1280 != -1)
31801 {
31802 this.ai[3] = ((Main.player[num1280].Center.X > base.Center.X) ? (-1f) : 1f);
31803 }
31804 else
31805 {
31806 this.ai[3] = 1f;
31807 }
31808 netUpdate = true;
31809 }
31810 }
31811 else if (this.ai[0] == 2f)
31812 {
31813 noTileCollide = true;
31814 this.ai[1]++;
31815 velocity.Y = Math.Max(velocity.Y - 0.1f, -10f);
31816 velocity.X = Math.Min(velocity.X + this.ai[3] * 0.05f, 4f);
31817 if ((position.Y < (float)(-height) || this.ai[1] >= 180f) && Main.netMode != 1)
31818 {
31820 active = false;
31821 netUpdate = true;
31822 }
31823 }
31824 Vector3 rgb = Color.SkyBlue.ToVector3();
31825 if (this.ai[0] == 2f)
31826 {
31827 rgb = Color.Red.ToVector3();
31828 }
31829 rgb *= 0.65f;
31830 Lighting.AddLight(base.Center, rgb);
31831 }
31832 else if (aiStyle == 81)
31833 {
31834 if (Main.rand.Next(420) == 0)
31835 {
31836 SoundEngine.PlaySound(29, (int)base.Center.X, (int)base.Center.Y, Main.rand.Next(100, 101));
31837 }
31838 Vector2 vector229 = new Vector2(30f);
31839 if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398)
31840 {
31841 life = 0;
31842 HitEffect();
31843 active = false;
31844 }
31845 float num1281 = 0f;
31846 float num1282 = 0f;
31847 float num1283 = this.ai[0];
31848 this.ai[1]++;
31849 int num1284 = 0;
31850 int num1285 = 0;
31851 for (; num1284 < 10; num1284++)
31852 {
31854 if (!(num1282 + (float)num1285 <= this.ai[1]))
31855 {
31856 break;
31857 }
31858 num1285 += (int)num1282;
31859 }
31860 if (num1284 == 10)
31861 {
31862 num1284 = 0;
31863 this.ai[1] = 0f;
31865 num1285 = 0;
31866 }
31867 this.ai[0] = MoonLordAttacksArray2[0, num1284];
31868 num1281 = (int)this.ai[1] - num1285;
31869 if (this.ai[0] != num1283)
31870 {
31871 netUpdate = true;
31872 }
31873 if (this.ai[0] == -1f)
31874 {
31875 this.ai[1]++;
31876 if (this.ai[1] > 180f)
31877 {
31878 this.ai[1] = 0f;
31879 }
31880 float num1286 = 1f;
31881 if (this.ai[1] < 60f)
31882 {
31883 num1286 = 0.75f;
31884 localAI[0] = 0f;
31885 localAI[1] = (float)Math.Sin(this.ai[1] * ((float)Math.PI * 2f) / 15f) * 0.35f;
31886 if (localAI[1] < 0f)
31887 {
31888 localAI[0] = (float)Math.PI;
31889 }
31890 }
31891 else if (this.ai[1] < 120f)
31892 {
31893 num1286 = 1f;
31894 if (localAI[1] < 0.5f)
31895 {
31896 localAI[1] += 0.025f;
31897 }
31898 localAI[0] += (float)Math.PI / 15f;
31899 }
31900 else
31901 {
31902 num1286 = 1.15f;
31903 localAI[1] -= 0.05f;
31904 if (localAI[1] < 0f)
31905 {
31906 localAI[1] = 0f;
31907 }
31908 }
31909 localAI[2] = MathHelper.Lerp(localAI[2], num1286, 0.3f);
31910 }
31911 if (this.ai[0] == 0f)
31912 {
31913 TargetClosest(faceTarget: false);
31914 Vector2 v10 = Main.player[target].Center + Main.player[target].velocity * 20f - base.Center;
31915 localAI[0] = localAI[0].AngleLerp(v10.ToRotation(), 0.5f);
31916 localAI[1] += 0.05f;
31917 if (localAI[1] > 0.7f)
31918 {
31919 localAI[1] = 0.7f;
31920 }
31921 localAI[2] = MathHelper.Lerp(localAI[2], 1f, 0.2f);
31922 float num1287 = 24f;
31923 Vector2 center25 = base.Center;
31924 Vector2 center26 = Main.player[target].Center;
31926 Vector2 vector231 = vector230 - Vector2.UnitY * 200f;
31928 int num1288 = 30;
31929 velocity.X = (velocity.X * (float)(num1288 - 1) + vector231.X) / (float)num1288;
31930 velocity.Y = (velocity.Y * (float)(num1288 - 1) + vector231.Y) / (float)num1288;
31931 float num1289 = 0.25f;
31932 for (int num1290 = 0; num1290 < 200; num1290++)
31933 {
31934 if (num1290 != whoAmI && Main.npc[num1290].active && Main.npc[num1290].type == 400 && Vector2.Distance(base.Center, Main.npc[num1290].Center) < 150f)
31935 {
31936 if (position.X < Main.npc[num1290].position.X)
31937 {
31938 velocity.X -= num1289;
31939 }
31940 else
31941 {
31942 velocity.X += num1289;
31943 }
31944 if (position.Y < Main.npc[num1290].position.Y)
31945 {
31946 velocity.Y -= num1289;
31947 }
31948 else
31949 {
31950 velocity.Y += num1289;
31951 }
31952 }
31953 }
31954 }
31955 else if (this.ai[0] == 1f)
31956 {
31957 if (num1281 == 0f)
31958 {
31959 TargetClosest(faceTarget: false);
31960 netUpdate = true;
31961 }
31962 velocity *= 0.95f;
31963 if (velocity.Length() < 1f)
31964 {
31966 }
31967 Vector2 v11 = Main.player[target].Center + Main.player[target].velocity * 20f - base.Center;
31968 localAI[0] = localAI[0].AngleLerp(v11.ToRotation(), 0.5f);
31969 localAI[1] += 0.05f;
31970 if (localAI[1] > 1f)
31971 {
31972 localAI[1] = 1f;
31973 }
31974 if (num1281 < 20f)
31975 {
31976 localAI[2] = MathHelper.Lerp(localAI[2], 1.1f, 0.2f);
31977 }
31978 else
31979 {
31980 localAI[2] = MathHelper.Lerp(localAI[2], 0.4f, 0.2f);
31981 }
31982 if (num1281 == num1282 - 35f)
31983 {
31984 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 6);
31985 }
31986 if ((num1281 == num1282 - 14f || num1281 == num1282 - 7f || num1281 == num1282) && Main.netMode != 1)
31987 {
31988 Vector2 vector232 = Utils.Vector2FromElipse(localAI[0].ToRotationVector2(), vector229 * localAI[1]);
31990 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector232.X, base.Center.Y + vector232.Y, vector233.X, vector233.Y, 462, 35, 0f, Main.myPlayer);
31991 }
31992 }
31993 else if (this.ai[0] == 2f)
31994 {
31995 if (num1281 < 15f)
31996 {
31997 localAI[1] -= 0.07f;
31998 if (localAI[1] < 0f)
31999 {
32000 localAI[1] = 0f;
32001 }
32002 localAI[2] = MathHelper.Lerp(localAI[2], 0.4f, 0.2f);
32003 velocity *= 0.8f;
32004 if (velocity.Length() < 1f)
32005 {
32007 }
32008 }
32009 else if (num1281 < 75f)
32010 {
32011 float num1291 = (num1281 - 15f) / 10f;
32012 int num1292 = 0;
32013 int num1293 = 0;
32014 switch ((int)num1291)
32015 {
32016 case 0:
32017 num1292 = 0;
32018 num1293 = 2;
32019 break;
32020 case 1:
32021 num1292 = 2;
32022 num1293 = 5;
32023 break;
32024 case 2:
32025 num1292 = 5;
32026 num1293 = 3;
32027 break;
32028 case 3:
32029 num1292 = 3;
32030 num1293 = 1;
32031 break;
32032 case 4:
32033 num1292 = 1;
32034 num1293 = 4;
32035 break;
32036 case 5:
32037 num1292 = 4;
32038 num1293 = 0;
32039 break;
32040 }
32041 Vector2 spinningpoint10 = Vector2.UnitY * -30f;
32042 Vector2 value8 = spinningpoint10.RotatedBy((float)num1292 * ((float)Math.PI * 2f) / 6f);
32043 Vector2 value9 = spinningpoint10.RotatedBy((float)num1293 * ((float)Math.PI * 2f) / 6f);
32045 float value10 = vector234.Length() / 30f;
32046 localAI[0] = vector234.ToRotation();
32047 localAI[1] = MathHelper.Lerp(localAI[1], value10, 0.5f);
32048 for (int num1294 = 0; num1294 < 2; num1294++)
32049 {
32050 int num1295 = Dust.NewDust(base.Center + vector234 - Vector2.One * 4f, 0, 0, 229);
32051 Dust dust = Main.dust[num1295];
32052 dust.velocity += vector234 / 15f;
32053 Main.dust[num1295].noGravity = true;
32054 }
32055 if ((num1281 - 15f) % 10f == 0f && Main.netMode != 1)
32056 {
32058 if (vec3.HasNaNs())
32059 {
32060 vec3 = Vector2.UnitY * -1f;
32061 }
32062 vec3 *= 4f;
32063 int num1296 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + vector234.X, base.Center.Y + vector234.Y, vec3.X, vec3.Y, 454, 40, 0f, Main.myPlayer, 30f, whoAmI);
32064 }
32065 }
32066 else if (num1281 < 105f)
32067 {
32068 localAI[0] = localAI[0].AngleLerp(this.ai[2] - (float)Math.PI / 2f, 0.2f);
32069 localAI[2] = MathHelper.Lerp(localAI[2], 0.75f, 0.2f);
32070 if (num1281 == 75f)
32071 {
32072 TargetClosest(faceTarget: false);
32073 netUpdate = true;
32074 velocity = Vector2.UnitY * -7f;
32075 for (int num1297 = 0; num1297 < 1000; num1297++)
32076 {
32078 if (projectile7.active && projectile7.type == 454 && projectile7.ai[1] == (float)whoAmI && projectile7.ai[0] != -1f)
32079 {
32081 projectile8.velocity += velocity;
32082 projectile7.netUpdate = true;
32083 }
32084 }
32085 }
32086 velocity.Y *= 0.96f;
32087 this.ai[2] = (Main.player[target].Center - base.Center).ToRotation() + (float)Math.PI / 2f;
32088 rotation = rotation.AngleTowards(this.ai[2], (float)Math.PI / 30f);
32089 }
32090 else if (num1281 < 120f)
32091 {
32092 SoundEngine.PlaySound(29, (int)base.Center.X, (int)base.Center.Y, 102);
32093 if (num1281 == 105f)
32094 {
32095 netUpdate = true;
32096 }
32097 Vector2 vector235 = (this.ai[2] - (float)Math.PI / 2f).ToRotationVector2() * 12f;
32098 velocity = vector235 * 2f;
32099 for (int num1298 = 0; num1298 < 1000; num1298++)
32100 {
32102 if (projectile9.active && projectile9.type == 454 && projectile9.ai[1] == (float)whoAmI && projectile9.ai[0] != -1f)
32103 {
32104 projectile9.ai[0] = -1f;
32105 projectile9.velocity = vector235;
32106 projectile9.netUpdate = true;
32107 }
32108 }
32109 }
32110 else
32111 {
32112 velocity *= 0.92f;
32113 rotation = rotation.AngleLerp(0f, 0.2f);
32114 }
32115 }
32116 else if (this.ai[0] == 3f)
32117 {
32118 if (num1281 < 15f)
32119 {
32120 localAI[1] -= 0.07f;
32121 if (localAI[1] < 0f)
32122 {
32123 localAI[1] = 0f;
32124 }
32125 localAI[2] = MathHelper.Lerp(localAI[2], 0.4f, 0.2f);
32126 velocity *= 0.9f;
32127 if (velocity.Length() < 1f)
32128 {
32130 }
32131 }
32132 else if (num1281 < 45f)
32133 {
32134 localAI[0] = 0f;
32135 localAI[1] = (float)Math.Sin((num1281 - 15f) * ((float)Math.PI * 2f) / 15f) * 0.5f;
32136 if (localAI[1] < 0f)
32137 {
32138 localAI[0] = (float)Math.PI;
32139 }
32140 }
32141 else if (num1281 < 185f)
32142 {
32143 if (num1281 == 45f)
32144 {
32145 this.ai[2] = (float)(Main.rand.Next(2) == 0).ToDirectionInt() * ((float)Math.PI * 2f) / 40f;
32146 netUpdate = true;
32147 }
32148 if ((num1281 - 15f - 30f) % 40f == 0f)
32149 {
32150 this.ai[2] *= 0.95f;
32151 }
32152 localAI[0] += this.ai[2];
32153 localAI[1] += 0.05f;
32154 if (localAI[1] > 1f)
32155 {
32156 localAI[1] = 1f;
32157 }
32158 Vector2 vector236 = localAI[0].ToRotationVector2() * vector229 * localAI[1];
32159 float num1299 = MathHelper.Lerp(8f, 20f, (num1281 - 15f - 30f) / 140f);
32161 rotation = rotation.AngleLerp(velocity.ToRotation() + (float)Math.PI / 2f, 0.2f);
32162 if ((num1281 - 15f - 30f) % 10f == 0f && Main.netMode != 1)
32163 {
32164 Vector2 vector237 = base.Center + Vector2.Normalize(vector236) * vector229.Length() * 0.4f;
32166 float ai3 = ((float)Math.PI * 2f * (float)Main.rand.NextDouble() - (float)Math.PI) / 30f + (float)Math.PI / 180f * this.ai[2];
32168 }
32169 }
32170 else
32171 {
32172 velocity *= 0.88f;
32173 rotation = rotation.AngleLerp(0f, 0.2f);
32174 localAI[1] -= 0.07f;
32175 if (localAI[1] < 0f)
32176 {
32177 localAI[1] = 0f;
32178 }
32179 localAI[2] = MathHelper.Lerp(localAI[2], 1f, 0.2f);
32180 }
32181 }
32182 else
32183 {
32184 if (this.ai[0] != 4f)
32185 {
32186 return;
32187 }
32188 if (num1281 == 0f)
32189 {
32190 TargetClosest(faceTarget: false);
32191 netUpdate = true;
32192 }
32193 if (num1281 < 180f)
32194 {
32195 localAI[2] = MathHelper.Lerp(localAI[2], 1f, 0.2f);
32196 localAI[1] -= 0.05f;
32197 if (localAI[1] < 0f)
32198 {
32199 localAI[1] = 0f;
32200 }
32201 velocity *= 0.95f;
32202 if (velocity.Length() < 1f)
32203 {
32205 }
32206 if (!(num1281 >= 60f))
32207 {
32208 return;
32209 }
32210 Vector2 center27 = base.Center;
32211 int num1300 = 0;
32212 if (num1281 >= 120f)
32213 {
32214 num1300 = 1;
32215 }
32216 for (int num1301 = 0; num1301 < 1 + num1300; num1301++)
32217 {
32218 int num1302 = 229;
32219 float num1303 = 0.8f;
32220 if (num1301 % 2 == 1)
32221 {
32222 num1302 = 229;
32223 num1303 = 1.65f;
32224 }
32225 Vector2 vector239 = center27 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * vector229 / 2f;
32226 int num1304 = Dust.NewDust(vector239 - Vector2.One * 8f, 16, 16, num1302, velocity.X / 2f, velocity.Y / 2f);
32227 Main.dust[num1304].velocity = Vector2.Normalize(center27 - vector239) * 3.5f * (10f - (float)num1300 * 2f) / 10f;
32228 Main.dust[num1304].noGravity = true;
32229 Main.dust[num1304].scale = num1303;
32230 Main.dust[num1304].customData = this;
32231 }
32232 }
32233 else if (num1281 < num1282 - 15f)
32234 {
32235 if (num1281 == 180f && Main.netMode != 1)
32236 {
32237 TargetClosest(faceTarget: false);
32238 Vector2 spinningpoint11 = Main.player[target].Center - base.Center;
32239 spinningpoint11.Normalize();
32240 float num1305 = -1f;
32241 if (spinningpoint11.X < 0f)
32242 {
32243 num1305 = 1f;
32244 }
32245 spinningpoint11 = spinningpoint11.RotatedBy((0f - num1305) * ((float)Math.PI * 2f) / 6f);
32246 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, spinningpoint11.X, spinningpoint11.Y, 455, 50, 0f, Main.myPlayer, num1305 * ((float)Math.PI * 2f) / 540f, whoAmI);
32247 this.ai[2] = (spinningpoint11.ToRotation() + (float)Math.PI * 3f) * num1305;
32248 netUpdate = true;
32249 }
32250 localAI[1] += 0.05f;
32251 if (localAI[1] > 1f)
32252 {
32253 localAI[1] = 1f;
32254 }
32255 float num1306 = (this.ai[2] >= 0f).ToDirectionInt();
32256 float num1307 = this.ai[2];
32257 if (num1307 < 0f)
32258 {
32259 num1307 *= -1f;
32260 }
32261 num1307 += (float)Math.PI * -3f;
32262 num1307 += num1306 * ((float)Math.PI * 2f) / 540f;
32263 localAI[0] = num1307;
32264 this.ai[2] = (num1307 + (float)Math.PI * 3f) * num1306;
32265 }
32266 else
32267 {
32268 localAI[1] -= 0.07f;
32269 if (localAI[1] < 0f)
32270 {
32271 localAI[1] = 0f;
32272 }
32273 }
32274 }
32275 }
32276 else if (aiStyle == 82)
32277 {
32278 float num1308 = 90f;
32279 Vector2 vector240 = new Vector2(0f, 216f);
32280 int num1309 = (int)Math.Abs(this.ai[0]) - 1;
32281 int num1310 = (int)this.ai[1];
32282 if (!Main.npc[num1309].active || Main.npc[num1309].type != 396)
32283 {
32284 life = 0;
32285 HitEffect();
32286 active = false;
32287 return;
32288 }
32289 this.ai[2]++;
32290 if (this.ai[2] >= num1308)
32291 {
32292 if (Main.netMode != 1)
32293 {
32294 int num1311 = (int)Main.npc[num1309].ai[3];
32295 int num1312 = -1;
32296 int num1313 = -1;
32297 int num1314 = num1309;
32298 for (int num1315 = 0; num1315 < 200; num1315++)
32299 {
32300 if (Main.npc[num1315].active && Main.npc[num1315].ai[3] == (float)num1311)
32301 {
32302 if (num1312 == -1 && Main.npc[num1315].type == 397 && Main.npc[num1315].ai[2] == 0f)
32303 {
32304 num1312 = num1315;
32305 }
32306 if (num1313 == -1 && Main.npc[num1315].type == 397 && Main.npc[num1315].ai[2] == 1f)
32307 {
32308 num1313 = num1315;
32309 }
32310 if (num1312 != -1 && num1313 != -1 && num1314 != -1)
32311 {
32312 break;
32313 }
32314 }
32315 }
32316 int num1316 = 1000;
32317 int num1317 = Main.npc[num1311].lifeMax - Main.npc[num1311].life;
32318 int num1318 = Main.npc[num1312].lifeMax - Main.npc[num1312].life;
32319 int num1319 = Main.npc[num1313].lifeMax - Main.npc[num1313].life;
32320 int num1320 = Main.npc[num1314].lifeMax - Main.npc[num1314].life;
32321 if (num1320 > 0 && num1316 > 0)
32322 {
32323 int num1321 = num1320 - num1316;
32324 if (num1321 > 0)
32325 {
32326 num1321 = 0;
32327 }
32328 int num1322 = num1316 + num1321;
32329 num1316 -= num1322;
32330 NPC nPC3 = Main.npc[num1314];
32331 nPC3.life += num1322;
32333 }
32334 if (num1317 > 0 && num1316 > 0)
32335 {
32336 int num1323 = num1317 - num1316;
32337 if (num1323 > 0)
32338 {
32339 num1323 = 0;
32340 }
32341 int num1324 = num1316 + num1323;
32342 num1316 -= num1324;
32343 NPC nPC3 = Main.npc[num1311];
32344 nPC3.life += num1324;
32346 }
32347 if (num1318 > 0 && num1316 > 0)
32348 {
32349 int num1325 = num1318 - num1316;
32350 if (num1325 > 0)
32351 {
32352 num1325 = 0;
32353 }
32354 int num1326 = num1316 + num1325;
32355 num1316 -= num1326;
32356 NPC nPC3 = Main.npc[num1312];
32357 nPC3.life += num1326;
32359 }
32360 if (num1319 > 0 && num1316 > 0)
32361 {
32362 int num1327 = num1319 - num1316;
32363 if (num1327 > 0)
32364 {
32365 num1327 = 0;
32366 }
32367 int num1328 = num1316 + num1327;
32368 num1316 -= num1328;
32369 NPC nPC3 = Main.npc[num1313];
32370 nPC3.life += num1328;
32372 }
32373 }
32374 life = 0;
32375 HitEffect();
32376 active = false;
32377 }
32378 else
32379 {
32381 base.Center = Vector2.Lerp(Main.projectile[num1310].Center, Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center + vector240, this.ai[2] / num1308);
32382 Vector2 spinningpoint12 = Vector2.UnitY * -height / 2f;
32383 for (int num1329 = 0; num1329 < 6; num1329++)
32384 {
32385 int num1330 = Dust.NewDust(base.Center - Vector2.One * 4f + spinningpoint12.RotatedBy((float)num1329 * ((float)Math.PI * 2f) / 6f), 0, 0, 229);
32386 Main.dust[num1330].velocity = -Vector2.UnitY;
32387 Main.dust[num1330].noGravity = true;
32388 Main.dust[num1330].scale = 0.7f;
32389 Main.dust[num1330].customData = this;
32390 }
32391 spinningpoint12 = Vector2.UnitY * -height / 6f;
32392 for (int num1331 = 0; num1331 < 3; num1331++)
32393 {
32394 int num1332 = Dust.NewDust(base.Center - Vector2.One * 4f + spinningpoint12.RotatedBy((float)num1331 * ((float)Math.PI * 2f) / 6f), 0, 0, 229, 0f, -2f);
32395 Main.dust[num1332].noGravity = true;
32396 Main.dust[num1332].scale = 1.5f;
32397 Main.dust[num1332].customData = this;
32398 }
32399 }
32400 }
32401 else if (aiStyle == 83)
32402 {
32403 if (type == 437)
32404 {
32405 if (localAI[3] == 0f && Main.netMode != 1)
32406 {
32407 localAI[3] = 1f;
32408 netUpdate = true;
32409 Point[] spawnPoints = null;
32411 {
32412 life = 0;
32413 HitEffect();
32414 active = false;
32415 return;
32416 }
32417 int num1333 = 0;
32418 int num1334 = 1;
32419 for (int num1335 = 0; num1335 < 4; num1335++)
32420 {
32421 int num1336 = 0;
32422 bool flag81 = num1335 == 1 || num1335 == 2;
32423 num1336 = ((!flag81) ? 379 : 438);
32425 if (flag81)
32426 {
32427 localAI[num1334++] = num1337 + 1;
32428 Main.npc[num1337].ai[3] = -(whoAmI + 1);
32429 }
32430 else
32431 {
32432 this.ai[num1333++] = num1337 + 1;
32433 Main.npc[num1337].ai[3] = -(whoAmI + 1);
32434 }
32435 Main.npc[num1337].netUpdate = true;
32436 }
32437 }
32438 if (localAI[0] == 1f && Main.netMode != 1)
32439 {
32440 localAI[0] = 2f;
32441 for (int num1338 = 0; num1338 < 2; num1338++)
32442 {
32443 Main.npc[(int)localAI[num1338 + 1] - 1].ai[1] = 1f;
32444 Main.npc[(int)localAI[num1338 + 1] - 1].netUpdate = true;
32445 Main.npc[(int)this.ai[num1338] - 1].ai[3] = 0f;
32446 Main.npc[(int)this.ai[num1338] - 1].TargetClosest();
32447 Main.npc[(int)this.ai[num1338] - 1].netUpdate = true;
32448 }
32449 }
32450 if (this.ai[0] != -1f && Main.netMode != 1)
32451 {
32452 bool flag82 = true;
32453 for (int num1339 = 0; num1339 < 2; num1339++)
32454 {
32455 if (Main.npc[(int)localAI[num1339 + 1] - 1].active && Main.npc[(int)localAI[num1339 + 1] - 1].type == 438)
32456 {
32457 flag82 = false;
32458 }
32459 if (Main.npc[(int)this.ai[num1339] - 1].active && Main.npc[(int)this.ai[num1339] - 1].type == 379)
32460 {
32461 flag82 = false;
32462 }
32463 }
32464 if (flag82)
32465 {
32466 this.ai[0] = -1f;
32467 this.ai[1] = 0f;
32468 this.ai[3] = 0f;
32469 int num1340 = (int)base.Center.X / 16 + 11 * (Main.rand.Next(2) == 0).ToDirectionInt();
32470 int num1341 = 0;
32471 for (int num1342 = -5; num1342 < 12; num1342++)
32472 {
32473 int num1343 = num1340;
32474 int num1344 = (int)base.Center.Y / 16 + num1342;
32476 {
32477 num1341 = num1344;
32478 break;
32479 }
32480 if (num1342 == 11)
32481 {
32482 num1341 = num1344;
32483 }
32484 }
32485 int num1345 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), num1340 * 16 + 10, num1341 * 16 - 2, 439);
32486 Main.npc[num1345].direction = (Main.npc[num1345].spriteDirection = Math.Sign(base.Center.X - (float)(num1340 * 16) - 10f));
32487 this.ai[2] = num1345;
32488 netUpdate = true;
32490 }
32491 }
32492 if (this.ai[0] == -1f)
32493 {
32494 this.ai[3]++;
32495 if (this.ai[3] > 300f)
32496 {
32497 life = 0;
32498 HitEffect(0, 9999.0);
32499 active = false;
32500 if (Main.netMode != 1)
32501 {
32502 for (int num1346 = 0; num1346 < 6; num1346++)
32503 {
32504 float num1347 = 3f + Main.rand.NextFloat() * 6f;
32505 Vector2 vector241 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
32506 Vector2 center28 = base.Center;
32507 center28 += vector241 * 30f;
32508 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center28.X, center28.Y, vector241.X * num1347, vector241.Y * num1347, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y);
32509 }
32510 for (int num1348 = 0; num1348 < 20; num1348++)
32511 {
32512 if (Main.rand.Next(2) != 0)
32513 {
32514 float num1349 = 3f + Main.rand.NextFloat() * 6f;
32515 Vector2 vector242 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
32516 Vector2 center29 = base.Center;
32517 center29 += vector242 * 30f;
32518 Vector2 vector243 = base.Center + vector242 * (Main.rand.NextFloat() * 45f + 45f) + Vector2.UnitY * 20f;
32520 }
32521 }
32522 }
32523 }
32524 else if (this.ai[3] % 10f == 1f && this.ai[3] > 120f && Main.netMode != 1)
32525 {
32526 float num1350 = 3f + Main.rand.NextFloat() * 6f;
32527 Vector2 vector244 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
32528 Vector2 center30 = base.Center;
32529 center30 += vector244 * 25f;
32530 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center30.X, center30.Y, vector244.X * num1350, vector244.Y * num1350, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y);
32531 }
32532 }
32533 }
32534 if (type == 438)
32535 {
32536 velocity.X *= 0.93f;
32537 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
32538 {
32539 velocity.X = 0f;
32540 }
32541 int num1351 = (int)(0f - this.ai[3] - 1f);
32542 if (num1351 == -1)
32543 {
32544 life = 0;
32545 HitEffect();
32546 active = false;
32547 return;
32548 }
32549 int num1352 = Math.Sign(Main.npc[num1351].Center.X - base.Center.X);
32550 if (num1352 != direction)
32551 {
32552 velocity.X = 0f;
32554 netUpdate = true;
32555 }
32556 if (justHit && Main.netMode != 1 && Main.npc[num1351].localAI[0] == 0f)
32557 {
32558 Main.npc[num1351].localAI[0] = 1f;
32559 }
32560 if ((this.ai[0] += 1f) >= 300f)
32561 {
32562 this.ai[0] = 0f;
32563 netUpdate = true;
32564 }
32565 }
32566 if (type == 437)
32567 {
32568 Lighting.AddLight(base.Center, 0.8f, 0.75f, 0.55f);
32569 }
32570 }
32571 else if (aiStyle == 84)
32572 {
32574 }
32575 else if (aiStyle == 85)
32576 {
32577 noTileCollide = false;
32578 if (this.ai[0] == 0f)
32579 {
32580 TargetClosest();
32581 if (Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
32582 {
32583 this.ai[0] = 1f;
32584 }
32585 else
32586 {
32587 Vector2 vector245 = Main.player[target].Center - base.Center;
32588 vector245.Y -= Main.player[target].height / 4;
32589 float num1353 = vector245.Length();
32590 if (num1353 > 800f)
32591 {
32592 this.ai[0] = 2f;
32593 }
32594 else
32595 {
32596 Vector2 center31 = base.Center;
32597 center31.X = Main.player[target].Center.X;
32598 Vector2 vector246 = center31 - base.Center;
32599 if (vector246.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center31, 1, 1))
32600 {
32601 this.ai[0] = 3f;
32602 this.ai[1] = center31.X;
32603 this.ai[2] = center31.Y;
32604 Vector2 center32 = base.Center;
32605 center32.Y = Main.player[target].Center.Y;
32606 if (vector246.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center32, 1, 1) && Collision.CanHit(center32, 1, 1, Main.player[target].position, 1, 1))
32607 {
32608 this.ai[0] = 3f;
32609 this.ai[1] = center32.X;
32610 this.ai[2] = center32.Y;
32611 }
32612 }
32613 else
32614 {
32615 center31 = base.Center;
32616 center31.Y = Main.player[target].Center.Y;
32617 if ((center31 - base.Center).Length() > 8f && Collision.CanHit(base.Center, 1, 1, center31, 1, 1))
32618 {
32619 this.ai[0] = 3f;
32620 this.ai[1] = center31.X;
32621 this.ai[2] = center31.Y;
32622 }
32623 }
32624 if (this.ai[0] == 0f)
32625 {
32626 localAI[0] = 0f;
32627 vector245.Normalize();
32628 vector245 *= 0.5f;
32630 this.ai[0] = 4f;
32631 this.ai[1] = 0f;
32632 }
32633 }
32634 }
32635 }
32636 else if (this.ai[0] == 1f)
32637 {
32638 rotation += (float)direction * 0.3f;
32639 Vector2 vector247 = Main.player[target].Center - base.Center;
32640 if (type == 421)
32641 {
32642 vector247 = Main.player[target].Top - base.Center;
32643 }
32644 float num1354 = vector247.Length();
32645 float num1355 = 5.5f;
32646 if (type == 405)
32647 {
32648 num1355 = 8f;
32649 }
32650 num1355 += num1354 / 100f;
32651 int num1356 = 50;
32652 vector247.Normalize();
32653 vector247 *= num1355;
32654 velocity = (velocity * (num1356 - 1) + vector247) / num1356;
32655 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
32656 {
32657 this.ai[0] = 0f;
32658 this.ai[1] = 0f;
32659 }
32660 if (type == 421 && num1354 < 40f && Main.player[target].active && !Main.player[target].dead)
32661 {
32662 bool flag83 = true;
32663 for (int num1357 = 0; num1357 < 200; num1357++)
32664 {
32666 if (nPC10.active && nPC10.type == type && nPC10.ai[0] == 5f && nPC10.target == target)
32667 {
32668 flag83 = false;
32669 break;
32670 }
32671 }
32672 if (flag83)
32673 {
32674 base.Center = Main.player[target].Top;
32676 this.ai[0] = 5f;
32677 this.ai[1] = 0f;
32678 netUpdate = true;
32679 }
32680 }
32681 }
32682 else if (this.ai[0] == 2f)
32683 {
32684 rotation = velocity.X * 0.1f;
32685 noTileCollide = true;
32686 Vector2 vector248 = Main.player[target].Center - base.Center;
32687 float num1358 = vector248.Length();
32688 float num1359 = 3f;
32689 if (type == 405)
32690 {
32691 num1359 = 6f;
32692 }
32693 int num1360 = 3;
32694 vector248.Normalize();
32695 vector248 *= num1359;
32696 velocity = (velocity * (num1360 - 1) + vector248) / num1360;
32698 {
32699 this.ai[0] = 0f;
32700 }
32701 }
32702 else if (this.ai[0] == 3f)
32703 {
32704 rotation = velocity.X * 0.1f;
32705 Vector2 vector249 = new Vector2(this.ai[1], this.ai[2]);
32706 Vector2 vector250 = vector249 - base.Center;
32707 float num1361 = vector250.Length();
32708 float num1362 = 2f;
32709 if (type == 405)
32710 {
32711 num1362 = 3f;
32712 }
32713 float num1363 = 3f;
32714 vector250.Normalize();
32715 vector250 *= num1362;
32716 velocity = (velocity * (num1363 - 1f) + vector250) / num1363;
32717 if (collideX || collideY)
32718 {
32719 this.ai[0] = 4f;
32720 this.ai[1] = 0f;
32721 }
32722 if (num1361 < num1362 || num1361 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
32723 {
32724 this.ai[0] = 0f;
32725 }
32726 }
32727 else if (this.ai[0] == 4f)
32728 {
32729 rotation = velocity.X * 0.1f;
32730 if (collideX)
32731 {
32732 velocity.X *= -0.8f;
32733 }
32734 if (collideY)
32735 {
32736 velocity.Y *= -0.8f;
32737 }
32739 if (velocity.X == 0f && velocity.Y == 0f)
32740 {
32741 vector251 = Main.player[target].Center - base.Center;
32742 vector251.Y -= Main.player[target].height / 4;
32743 vector251.Normalize();
32744 velocity = vector251 * 0.1f;
32745 }
32746 float num1364 = 2f;
32747 if (type == 405)
32748 {
32749 num1364 = 3f;
32750 }
32751 float num1365 = 20f;
32753 vector251.Normalize();
32754 vector251 *= num1364;
32755 velocity = (velocity * (num1365 - 1f) + vector251) / num1365;
32756 this.ai[1] += 1f;
32757 if (this.ai[1] > 180f)
32758 {
32759 this.ai[0] = 0f;
32760 this.ai[1] = 0f;
32761 }
32762 if (Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
32763 {
32764 this.ai[0] = 0f;
32765 }
32766 localAI[0] += 1f;
32767 if (localAI[0] >= 5f && !Collision.SolidCollision(position - new Vector2(10f, 10f), width + 20, height + 20))
32768 {
32769 localAI[0] = 0f;
32770 Vector2 center33 = base.Center;
32771 center33.X = Main.player[target].Center.X;
32772 if (Collision.CanHit(base.Center, 1, 1, center33, 1, 1) && Collision.CanHit(base.Center, 1, 1, center33, 1, 1) && Collision.CanHit(Main.player[target].Center, 1, 1, center33, 1, 1))
32773 {
32774 this.ai[0] = 3f;
32775 this.ai[1] = center33.X;
32776 this.ai[2] = center33.Y;
32777 }
32778 else
32779 {
32780 center33 = base.Center;
32781 center33.Y = Main.player[target].Center.Y;
32782 if (Collision.CanHit(base.Center, 1, 1, center33, 1, 1) && Collision.CanHit(Main.player[target].Center, 1, 1, center33, 1, 1))
32783 {
32784 this.ai[0] = 3f;
32785 this.ai[1] = center33.X;
32786 this.ai[2] = center33.Y;
32787 }
32788 }
32789 }
32790 }
32791 else if (this.ai[0] == 5f)
32792 {
32794 if (!player11.active || player11.dead)
32795 {
32796 this.ai[0] = 0f;
32797 this.ai[1] = 0f;
32798 netUpdate = true;
32799 }
32800 else
32801 {
32802 base.Center = ((player11.gravDir == 1f) ? player11.Top : player11.Bottom) + new Vector2(player11.direction * 4, 0f);
32803 gfxOffY = player11.gfxOffY;
32805 if (!player11.creativeGodMode)
32806 {
32807 player11.AddBuff(163, 59);
32808 }
32809 }
32810 }
32811 if (type == 405)
32812 {
32813 rotation = 0f;
32814 for (int num1366 = 0; num1366 < 200; num1366++)
32815 {
32816 if (num1366 != whoAmI && Main.npc[num1366].active && Main.npc[num1366].type == type && Math.Abs(position.X - Main.npc[num1366].position.X) + Math.Abs(position.Y - Main.npc[num1366].position.Y) < (float)width)
32817 {
32818 if (position.X < Main.npc[num1366].position.X)
32819 {
32820 velocity.X -= 0.05f;
32821 }
32822 else
32823 {
32824 velocity.X += 0.05f;
32825 }
32826 if (position.Y < Main.npc[num1366].position.Y)
32827 {
32828 velocity.Y -= 0.05f;
32829 }
32830 else
32831 {
32832 velocity.Y += 0.05f;
32833 }
32834 }
32835 }
32836 }
32837 else
32838 {
32839 if (type != 421)
32840 {
32841 return;
32842 }
32843 hide = this.ai[0] == 5f;
32844 rotation = velocity.X * 0.1f;
32845 for (int num1367 = 0; num1367 < 200; num1367++)
32846 {
32847 if (num1367 != whoAmI && Main.npc[num1367].active && Main.npc[num1367].type == type && Math.Abs(position.X - Main.npc[num1367].position.X) + Math.Abs(position.Y - Main.npc[num1367].position.Y) < (float)width)
32848 {
32849 if (position.X < Main.npc[num1367].position.X)
32850 {
32851 velocity.X -= 0.05f;
32852 }
32853 else
32854 {
32855 velocity.X += 0.05f;
32856 }
32857 if (position.Y < Main.npc[num1367].position.Y)
32858 {
32859 velocity.Y -= 0.05f;
32860 }
32861 else
32862 {
32863 velocity.Y += 0.05f;
32864 }
32865 }
32866 }
32867 }
32868 }
32869 else if (aiStyle == 86)
32870 {
32871 if (alpha > 0)
32872 {
32873 alpha -= 30;
32874 if (alpha < 0)
32875 {
32876 alpha = 0;
32877 }
32878 }
32879 noGravity = true;
32880 noTileCollide = true;
32881 knockBackResist = 0f;
32882 for (int num1368 = 0; num1368 < 200; num1368++)
32883 {
32884 if (num1368 == whoAmI || !Main.npc[num1368].active || Main.npc[num1368].type != type)
32885 {
32886 continue;
32887 }
32888 Vector2 vector252 = Main.npc[num1368].Center - base.Center;
32889 if (!(vector252.Length() < 50f))
32890 {
32891 continue;
32892 }
32893 vector252.Normalize();
32894 if (vector252.X == 0f && vector252.Y == 0f)
32895 {
32896 if (num1368 > whoAmI)
32897 {
32898 vector252.X = 1f;
32899 }
32900 else
32901 {
32902 vector252.X = -1f;
32903 }
32904 }
32905 vector252 *= 0.4f;
32907 NPC nPC3 = Main.npc[num1368];
32908 nPC3.velocity += vector252;
32909 }
32910 if (type == 472)
32911 {
32912 float num1369 = 120f;
32913 if (localAI[0] < num1369)
32914 {
32915 if (localAI[0] == 0f)
32916 {
32918 TargetClosest();
32919 if (direction > 0)
32920 {
32921 velocity.X += 2f;
32922 }
32923 else
32924 {
32925 velocity.X -= 2f;
32926 }
32928 for (int num1370 = 0; num1370 < 20; num1370++)
32929 {
32930 Vector2 center34 = base.Center;
32931 center34.Y -= 18f;
32932 Vector2 vector253 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
32933 vector253.Normalize();
32934 vector253 *= (float)Main.rand.Next(0, 100) * 0.1f;
32936 vector253.Normalize();
32937 vector253 *= (float)Main.rand.Next(50, 90) * 0.2f;
32938 int num1371 = Dust.NewDust(center34, 1, 1, 27);
32939 Main.dust[num1371].velocity = -vector253 * 0.3f;
32940 Main.dust[num1371].alpha = 100;
32941 if (Main.rand.Next(2) == 0)
32942 {
32943 Main.dust[num1371].noGravity = true;
32944 Dust dust = Main.dust[num1371];
32945 dust.scale += 0.3f;
32946 }
32947 }
32949 }
32950 localAI[0] += 1f;
32951 float num1372 = 1f - localAI[0] / num1369;
32952 float num1373 = num1372 * 20f;
32953 for (int num1374 = 0; (float)num1374 < num1373; num1374++)
32954 {
32955 if (Main.rand.Next(5) == 0)
32956 {
32958 int num1375 = Dust.NewDust(position, width, height, 27);
32959 Main.dust[num1375].alpha = 100;
32960 Dust dust = Main.dust[num1375];
32961 dust.velocity *= 0.3f;
32962 dust = Main.dust[num1375];
32963 dust.velocity += velocity * 0.75f;
32964 Main.dust[num1375].noGravity = true;
32966 }
32967 }
32968 }
32969 }
32970 if (type == 521)
32971 {
32972 float num1376 = 120f;
32973 if (localAI[0] < num1376)
32974 {
32975 if (localAI[0] == 0f)
32976 {
32978 TargetClosest();
32979 if (direction > 0)
32980 {
32981 velocity.X += 2f;
32982 }
32983 else
32984 {
32985 velocity.X -= 2f;
32986 }
32987 }
32988 localAI[0] += 1f;
32989 int num1377 = 10;
32990 for (int num1378 = 0; num1378 < 2; num1378++)
32991 {
32993 int num1379 = Dust.NewDust(position - new Vector2(num1377), width + num1377 * 2, height + num1377 * 2, 228, 0f, 0f, 100, default(Color), 2f);
32994 Main.dust[num1379].noGravity = true;
32995 Main.dust[num1379].noLight = true;
32997 }
32998 }
32999 }
33000 if (this.ai[0] == 0f)
33001 {
33002 TargetClosest();
33003 this.ai[0] = 1f;
33004 this.ai[1] = direction;
33005 }
33006 else if (this.ai[0] == 1f)
33007 {
33008 TargetClosest();
33009 float num1380 = 0.3f;
33010 float num1381 = 7f;
33011 float num1382 = 4f;
33012 float num1383 = 660f;
33013 float num1384 = 4f;
33014 if (type == 521)
33015 {
33016 num1380 = 0.7f;
33017 num1381 = 14f;
33018 num1383 = 500f;
33019 num1382 = 6f;
33020 num1384 = 3f;
33021 }
33022 velocity.X += this.ai[1] * num1380;
33023 if (velocity.X > num1381)
33024 {
33025 velocity.X = num1381;
33026 }
33027 if (velocity.X < 0f - num1381)
33028 {
33029 velocity.X = 0f - num1381;
33030 }
33031 float num1385 = Main.player[target].Center.Y - base.Center.Y;
33032 if (Math.Abs(num1385) > num1382)
33033 {
33034 num1384 = 15f;
33035 }
33036 if (num1385 > num1382)
33037 {
33038 num1385 = num1382;
33039 }
33040 else if (num1385 < 0f - num1382)
33041 {
33042 num1385 = 0f - num1382;
33043 }
33044 velocity.Y = (velocity.Y * (num1384 - 1f) + num1385) / num1384;
33045 if ((this.ai[1] > 0f && Main.player[target].Center.X - base.Center.X < 0f - num1383) || (this.ai[1] < 0f && Main.player[target].Center.X - base.Center.X > num1383))
33046 {
33047 this.ai[0] = 2f;
33048 this.ai[1] = 0f;
33049 if (base.Center.Y + 20f > Main.player[target].Center.Y)
33050 {
33051 this.ai[1] = -1f;
33052 }
33053 else
33054 {
33055 this.ai[1] = 1f;
33056 }
33057 }
33058 }
33059 else if (this.ai[0] == 2f)
33060 {
33061 float num1386 = 0.4f;
33062 float num1387 = 0.95f;
33063 float num1388 = 5f;
33064 if (type == 521)
33065 {
33066 num1386 = 0.3f;
33067 num1388 = 7f;
33068 num1387 = 0.9f;
33069 }
33070 velocity.Y += this.ai[1] * num1386;
33071 if (velocity.Length() > num1388)
33072 {
33073 velocity *= num1387;
33074 }
33075 if (velocity.X > -1f && velocity.X < 1f)
33076 {
33077 TargetClosest();
33078 this.ai[0] = 3f;
33079 this.ai[1] = direction;
33080 }
33081 }
33082 else if (this.ai[0] == 3f)
33083 {
33084 float num1389 = 0.4f;
33085 float num1390 = 0.2f;
33086 float num1391 = 5f;
33087 float num1392 = 0.95f;
33088 if (type == 521)
33089 {
33090 num1389 = 0.6f;
33091 num1390 = 0.3f;
33092 num1391 = 7f;
33093 num1392 = 0.9f;
33094 }
33095 velocity.X += this.ai[1] * num1389;
33096 if (base.Center.Y > Main.player[target].Center.Y)
33097 {
33098 velocity.Y -= num1390;
33099 }
33100 else
33101 {
33102 velocity.Y += num1390;
33103 }
33104 if (velocity.Length() > num1391)
33105 {
33106 velocity *= num1392;
33107 }
33108 if (velocity.Y > -1f && velocity.Y < 1f)
33109 {
33110 TargetClosest();
33111 this.ai[0] = 0f;
33112 this.ai[1] = direction;
33113 }
33114 }
33115 if (type == 521)
33116 {
33117 int num1393 = 10;
33119 for (int num1394 = 0; num1394 < 1; num1394++)
33120 {
33121 int num1395 = Dust.NewDust(position - new Vector2(num1393), width + num1393 * 2, height + num1393 * 2, 228, 0f, 0f, 100, default(Color), 2f);
33122 Main.dust[num1395].noGravity = true;
33123 Main.dust[num1395].noLight = true;
33124 }
33126 }
33127 }
33128 else if (aiStyle == 87)
33129 {
33130 knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
33131 dontTakeDamage = false;
33132 noTileCollide = false;
33133 noGravity = false;
33134 reflectsProjectiles = false;
33135 if (this.ai[0] != 7f && Main.player[target].dead)
33136 {
33137 TargetClosest();
33138 if (Main.player[target].dead)
33139 {
33140 this.ai[0] = 7f;
33141 this.ai[1] = 0f;
33142 this.ai[2] = 0f;
33143 this.ai[3] = 0f;
33144 netUpdate = true;
33145 }
33146 }
33147 if (this.ai[0] == 0f)
33148 {
33149 TargetClosest();
33150 Vector2 vector254 = Main.player[target].Center - base.Center;
33151 if (Main.netMode != 1 && (velocity.X != 0f || velocity.Y > 100f || justHit || vector254.Length() < 80f))
33152 {
33153 this.ai[0] = 1f;
33154 this.ai[1] = 0f;
33155 netUpdate = true;
33156 }
33157 }
33158 else if (this.ai[0] == 1f)
33159 {
33160 this.ai[1] += 1f;
33161 if (Main.netMode != 1 && this.ai[1] > 36f)
33162 {
33163 this.ai[0] = 2f;
33164 this.ai[1] = 0f;
33165 netUpdate = true;
33166 }
33167 }
33168 else if (this.ai[0] == 2f)
33169 {
33170 Vector2 vector255 = Main.player[target].Center - base.Center;
33171 if (Main.netMode != 1 && vector255.Length() > 600f)
33172 {
33173 this.ai[0] = 5f;
33174 this.ai[1] = 0f;
33175 this.ai[2] = 0f;
33176 this.ai[3] = 0f;
33177 netUpdate = true;
33178 }
33179 if (velocity.Y == 0f)
33180 {
33181 TargetClosest();
33182 velocity.X *= 0.85f;
33183 this.ai[1] += 1f;
33184 float num1396 = 15f + 30f * ((float)life / (float)lifeMax);
33185 float num1397 = 3f + 4f * (1f - (float)life / (float)lifeMax);
33186 float num1398 = 4f;
33187 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
33188 {
33189 num1398 += 2f;
33190 }
33191 if (Main.netMode != 1 && this.ai[1] > num1396)
33192 {
33193 this.ai[3] += 1f;
33194 if (this.ai[3] >= 3f)
33195 {
33196 this.ai[3] = 0f;
33197 num1398 *= 2f;
33198 num1397 /= 2f;
33199 }
33200 this.ai[1] = 0f;
33201 velocity.Y -= num1398;
33202 velocity.X = num1397 * (float)direction;
33203 netUpdate = true;
33204 }
33205 }
33206 else
33207 {
33208 knockBackResist = 0f;
33209 velocity.X *= 0.99f;
33211 {
33212 velocity.X = -1f;
33213 }
33214 if (direction > 0 && velocity.X < 1f)
33215 {
33216 velocity.X = 1f;
33217 }
33218 }
33219 this.ai[2] += 1f;
33220 if ((double)this.ai[2] > 210.0 && velocity.Y == 0f && Main.netMode != 1)
33221 {
33222 switch (Main.rand.Next(3))
33223 {
33224 case 0:
33225 this.ai[0] = 3f;
33226 break;
33227 case 1:
33228 this.ai[0] = 4f;
33229 noTileCollide = true;
33230 velocity.Y = -8f;
33231 break;
33232 case 2:
33233 this.ai[0] = 6f;
33234 break;
33235 default:
33236 this.ai[0] = 2f;
33237 break;
33238 }
33239 if (Main.tenthAnniversaryWorld && type == 476 && this.ai[0] == 3f && Main.rand.Next(2) == 0)
33240 {
33241 this.ai[0] = 8f;
33242 }
33243 this.ai[1] = 0f;
33244 this.ai[2] = 0f;
33245 this.ai[3] = 0f;
33246 netUpdate = true;
33247 }
33248 }
33249 else if (this.ai[0] == 3f)
33250 {
33251 velocity.X *= 0.85f;
33252 dontTakeDamage = true;
33253 this.ai[1] += 1f;
33254 if (Main.netMode != 1 && this.ai[1] >= 180f)
33255 {
33256 this.ai[0] = 2f;
33257 this.ai[1] = 0f;
33258 netUpdate = true;
33259 }
33260 if (Main.expertMode)
33261 {
33262 ReflectProjectiles(base.Hitbox);
33263 reflectsProjectiles = true;
33264 }
33265 }
33266 else if (this.ai[0] == 4f)
33267 {
33268 noTileCollide = true;
33269 noGravity = true;
33270 knockBackResist = 0f;
33271 if (velocity.X < 0f)
33272 {
33273 direction = -1;
33274 }
33275 else
33276 {
33277 direction = 1;
33278 }
33280 TargetClosest();
33281 Vector2 center35 = Main.player[target].Center;
33282 center35.Y -= 350f;
33283 Vector2 vector256 = center35 - base.Center;
33284 if (this.ai[2] == 1f)
33285 {
33286 this.ai[1] += 1f;
33287 vector256 = Main.player[target].Center - base.Center;
33288 vector256.Normalize();
33289 vector256 *= 8f;
33290 velocity = (velocity * 4f + vector256) / 5f;
33291 if (Main.netMode != 1 && this.ai[1] > 6f)
33292 {
33293 this.ai[1] = 0f;
33294 this.ai[0] = 4.1f;
33295 this.ai[2] = 0f;
33297 netUpdate = true;
33298 }
33299 }
33300 else if (Math.Abs(base.Center.X - Main.player[target].Center.X) < 40f && base.Center.Y < Main.player[target].Center.Y - 300f)
33301 {
33302 if (Main.netMode != 1)
33303 {
33304 this.ai[1] = 0f;
33305 this.ai[2] = 1f;
33306 netUpdate = true;
33307 }
33308 }
33309 else
33310 {
33311 vector256.Normalize();
33312 vector256 *= 12f;
33313 velocity = (velocity * 5f + vector256) / 6f;
33314 }
33315 }
33316 else if (this.ai[0] == 4.1f)
33317 {
33318 knockBackResist = 0f;
33319 if (this.ai[2] == 0f && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1) && !Collision.SolidCollision(position, width, height))
33320 {
33321 this.ai[2] = 1f;
33322 }
33323 if (position.Y + (float)height >= Main.player[target].position.Y || velocity.Y <= 0f)
33324 {
33325 this.ai[1] += 1f;
33326 if (Main.netMode != 1 && this.ai[1] > 10f)
33327 {
33328 this.ai[0] = 2f;
33329 this.ai[1] = 0f;
33330 this.ai[2] = 0f;
33331 this.ai[3] = 0f;
33332 netUpdate = true;
33334 {
33335 this.ai[0] = 5f;
33336 }
33337 }
33338 }
33339 else if (this.ai[2] == 0f)
33340 {
33341 noTileCollide = true;
33342 noGravity = true;
33343 knockBackResist = 0f;
33344 }
33345 velocity.Y += 0.2f;
33346 if (velocity.Y > 16f)
33347 {
33348 velocity.Y = 16f;
33349 }
33350 }
33351 else if (this.ai[0] == 5f)
33352 {
33353 if (velocity.X > 0f)
33354 {
33355 direction = 1;
33356 }
33357 else
33358 {
33359 direction = -1;
33360 }
33362 noTileCollide = true;
33363 noGravity = true;
33364 knockBackResist = 0f;
33365 Vector2 vector257 = Main.player[target].Center - base.Center;
33366 vector257.Y -= 4f;
33367 if (Main.netMode != 1 && vector257.Length() < 200f && !Collision.SolidCollision(position, width, height))
33368 {
33369 this.ai[0] = 2f;
33370 this.ai[1] = 0f;
33371 this.ai[2] = 0f;
33372 this.ai[3] = 0f;
33373 netUpdate = true;
33374 }
33375 if (vector257.Length() > 10f)
33376 {
33377 vector257.Normalize();
33378 vector257 *= 10f;
33379 }
33380 velocity = (velocity * 4f + vector257) / 5f;
33381 }
33382 else if (this.ai[0] == 6f)
33383 {
33384 knockBackResist = 0f;
33385 if (velocity.Y == 0f)
33386 {
33387 TargetClosest();
33388 velocity.X *= 0.8f;
33389 this.ai[1] += 1f;
33390 if (this.ai[1] > 5f)
33391 {
33392 this.ai[1] = 0f;
33393 velocity.Y -= 4f;
33394 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y)
33395 {
33396 velocity.Y -= 1.25f;
33397 }
33398 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y - 40f)
33399 {
33400 velocity.Y -= 1.5f;
33401 }
33402 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y - 80f)
33403 {
33404 velocity.Y -= 1.75f;
33405 }
33406 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y - 120f)
33407 {
33408 velocity.Y -= 2f;
33409 }
33410 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y - 160f)
33411 {
33412 velocity.Y -= 2.25f;
33413 }
33414 if (Main.player[target].position.Y + (float)Main.player[target].height < base.Center.Y - 200f)
33415 {
33416 velocity.Y -= 2.5f;
33417 }
33418 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
33419 {
33420 velocity.Y -= 2f;
33421 }
33422 velocity.X = 12 * direction;
33423 this.ai[2] += 1f;
33424 netUpdate = true;
33425 }
33426 }
33427 else
33428 {
33429 velocity.X *= 0.98f;
33431 {
33432 velocity.X = -8f;
33433 }
33434 if (direction > 0 && velocity.X < 8f)
33435 {
33436 velocity.X = 8f;
33437 }
33438 }
33439 if (Main.netMode != 1 && this.ai[2] >= 3f && velocity.Y == 0f)
33440 {
33441 this.ai[0] = 2f;
33442 this.ai[1] = 0f;
33443 this.ai[2] = 0f;
33444 this.ai[3] = 0f;
33445 netUpdate = true;
33446 }
33447 }
33448 else if (this.ai[0] == 7f)
33449 {
33450 damage = 0;
33451 life = lifeMax;
33452 defense = 9999;
33453 noTileCollide = true;
33454 alpha += 7;
33455 if (alpha > 255)
33456 {
33457 alpha = 255;
33458 }
33459 velocity.X *= 0.98f;
33460 }
33461 else
33462 {
33463 if (this.ai[0] != 8f)
33464 {
33465 return;
33466 }
33467 velocity.X *= 0.85f;
33468 this.ai[1] += 1f;
33469 if (Main.netMode != 1)
33470 {
33471 if (!Main.tenthAnniversaryWorld || this.ai[1] >= 180f)
33472 {
33473 this.ai[0] = 2f;
33474 this.ai[1] = 0f;
33475 netUpdate = true;
33476 }
33477 else if (this.ai[1] % 20f == 0f)
33478 {
33480 }
33481 }
33482 }
33483 }
33484 else if (aiStyle == 88)
33485 {
33486 int num1399 = 7;
33487 noTileCollide = false;
33488 noGravity = true;
33489 knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
33490 damage = defDamage;
33491 if (!Main.eclipse && Main.netMode != 1)
33492 {
33493 if (this.ai[0] != -1f)
33494 {
33495 netUpdate = true;
33496 }
33497 this.ai[0] = -1f;
33498 }
33499 else if (target < 0 || Main.player[target].dead || !Main.player[target].active)
33500 {
33501 TargetClosest();
33502 Vector2 vector258 = Main.player[target].Center - base.Center;
33503 if (Main.netMode != 1 && (Main.player[target].dead || vector258.Length() > 3000f))
33504 {
33505 if (this.ai[0] != -1f)
33506 {
33507 netUpdate = true;
33508 }
33509 this.ai[0] = -1f;
33510 }
33511 }
33512 else
33513 {
33514 Vector2 vector259 = Main.player[target].Center - base.Center;
33515 if (Main.netMode != 1 && this.ai[0] > 1f && vector259.Length() > 1000f)
33516 {
33517 if (this.ai[0] != 1f)
33518 {
33519 netUpdate = true;
33520 }
33521 this.ai[0] = 1f;
33522 }
33523 }
33524 if (this.ai[0] == -1f)
33525 {
33526 Vector2 vector260 = new Vector2(0f, -8f);
33527 velocity = (velocity * 9f + vector260) / 10f;
33528 noTileCollide = true;
33529 dontTakeDamage = true;
33530 }
33531 else if (this.ai[0] == 0f)
33532 {
33533 TargetClosest();
33534 if (base.Center.X < Main.player[target].Center.X - 2f)
33535 {
33536 direction = 1;
33537 }
33538 if (base.Center.X > Main.player[target].Center.X + 2f)
33539 {
33540 direction = -1;
33541 }
33543 rotation = (rotation * 9f + velocity.X * 0.1f) / 10f;
33544 if (collideX)
33545 {
33546 velocity.X *= (0f - oldVelocity.X) * 0.5f;
33547 if (velocity.X > 4f)
33548 {
33549 velocity.X = 4f;
33550 }
33551 if (velocity.X < -4f)
33552 {
33553 velocity.X = -4f;
33554 }
33555 }
33556 if (collideY)
33557 {
33558 velocity.Y *= (0f - oldVelocity.Y) * 0.5f;
33559 if (velocity.Y > 4f)
33560 {
33561 velocity.Y = 4f;
33562 }
33563 if (velocity.Y < -4f)
33564 {
33565 velocity.Y = -4f;
33566 }
33567 }
33568 Vector2 vector261 = Main.player[target].Center - base.Center;
33569 vector261.Y -= 200f;
33570 if (vector261.Length() > 800f)
33571 {
33572 this.ai[0] = 1f;
33573 this.ai[1] = 0f;
33574 this.ai[2] = 0f;
33575 this.ai[3] = 0f;
33576 netUpdate = true;
33577 }
33578 else if (vector261.Length() > 80f)
33579 {
33580 float num1400 = 6f;
33581 float num1401 = 30f;
33582 vector261.Normalize();
33583 vector261 *= num1400;
33584 velocity = (velocity * (num1401 - 1f) + vector261) / num1401;
33585 }
33586 else if (velocity.Length() > 2f)
33587 {
33588 velocity *= 0.95f;
33589 }
33590 else if (velocity.Length() < 1f)
33591 {
33592 velocity *= 1.05f;
33593 }
33594 if (Main.netMode == 1)
33595 {
33596 return;
33597 }
33598 this.ai[1] += 1f;
33599 if (justHit)
33600 {
33601 this.ai[1] += Main.rand.Next(10, 30);
33602 }
33603 if (!(this.ai[1] >= 180f))
33604 {
33605 return;
33606 }
33607 this.ai[1] = 0f;
33608 this.ai[2] = 0f;
33609 this.ai[3] = 0f;
33610 netUpdate = true;
33611 while (this.ai[0] == 0f)
33612 {
33613 int num1402 = Main.rand.Next(3);
33614 if (num1402 == 0 && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
33615 {
33616 this.ai[0] = 2f;
33617 continue;
33618 }
33619 switch (num1402)
33620 {
33621 case 1:
33622 this.ai[0] = 3f;
33623 break;
33624 case 2:
33625 if (CountNPCS(478) + CountNPCS(479) < num1399)
33626 {
33627 this.ai[0] = 4f;
33628 }
33629 break;
33630 }
33631 }
33632 }
33633 else if (this.ai[0] == 1f)
33634 {
33635 collideX = false;
33636 collideY = false;
33637 noTileCollide = true;
33638 knockBackResist = 0f;
33639 if (target < 0 || !Main.player[target].active || Main.player[target].dead)
33640 {
33641 TargetClosest();
33642 }
33643 if (velocity.X < 0f)
33644 {
33645 direction = -1;
33646 }
33647 else if (velocity.X > 0f)
33648 {
33649 direction = 1;
33650 }
33652 rotation = (rotation * 9f + velocity.X * 0.08f) / 10f;
33653 Vector2 vector262 = Main.player[target].Center - base.Center;
33654 if (Main.netMode != 1 && vector262.Length() < 300f && !Collision.SolidCollision(position, width, height))
33655 {
33656 this.ai[0] = 0f;
33657 this.ai[1] = 0f;
33658 this.ai[2] = 0f;
33659 this.ai[3] = 0f;
33660 netUpdate = true;
33661 }
33662 float num1403 = 7f + vector262.Length() / 100f;
33663 float num1404 = 25f;
33664 vector262.Normalize();
33665 vector262 *= num1403;
33666 velocity = (velocity * (num1404 - 1f) + vector262) / num1404;
33667 }
33668 else if (this.ai[0] == 2f)
33669 {
33670 damage = (int)((double)defDamage * 0.5);
33671 knockBackResist = 0f;
33672 if (target < 0 || !Main.player[target].active || Main.player[target].dead)
33673 {
33674 TargetClosest();
33675 this.ai[0] = 0f;
33676 this.ai[1] = 0f;
33677 this.ai[2] = 0f;
33678 this.ai[3] = 0f;
33679 netUpdate = true;
33680 }
33681 if (Main.player[target].Center.X - 10f < base.Center.X)
33682 {
33683 direction = -1;
33684 }
33685 else if (Main.player[target].Center.X + 10f > base.Center.X)
33686 {
33687 direction = 1;
33688 }
33690 rotation = (rotation * 4f + velocity.X * 0.1f) / 5f;
33691 if (collideX)
33692 {
33693 velocity.X *= (0f - oldVelocity.X) * 0.5f;
33694 if (velocity.X > 4f)
33695 {
33696 velocity.X = 4f;
33697 }
33698 if (velocity.X < -4f)
33699 {
33700 velocity.X = -4f;
33701 }
33702 }
33703 if (collideY)
33704 {
33705 velocity.Y *= (0f - oldVelocity.Y) * 0.5f;
33706 if (velocity.Y > 4f)
33707 {
33708 velocity.Y = 4f;
33709 }
33710 if (velocity.Y < -4f)
33711 {
33712 velocity.Y = -4f;
33713 }
33714 }
33715 Vector2 vector263 = Main.player[target].Center - base.Center;
33716 vector263.Y -= 20f;
33717 this.ai[2] += 1f / 45f;
33718 if (Main.expertMode)
33719 {
33720 this.ai[2] += 1f / 60f;
33721 }
33722 float num1405 = 4f + this.ai[2] + vector263.Length() / 120f;
33723 float num1406 = 20f;
33724 vector263.Normalize();
33725 vector263 *= num1405;
33726 velocity = (velocity * (num1406 - 1f) + vector263) / num1406;
33727 if (Main.netMode != 1)
33728 {
33729 this.ai[1] += 1f;
33730 if (this.ai[1] > 240f || !Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
33731 {
33732 this.ai[0] = 0f;
33733 this.ai[1] = 0f;
33734 this.ai[2] = 0f;
33735 this.ai[3] = 0f;
33736 netUpdate = true;
33737 }
33738 }
33739 }
33740 else if (this.ai[0] == 3f)
33741 {
33742 knockBackResist = 0f;
33743 noTileCollide = true;
33744 if (velocity.X < 0f)
33745 {
33746 direction = -1;
33747 }
33748 else
33749 {
33750 direction = 1;
33751 }
33753 rotation = (rotation * 4f + velocity.X * 0.07f) / 5f;
33754 Vector2 vector264 = Main.player[target].Center - base.Center;
33755 vector264.Y -= 12f;
33756 if (base.Center.X > Main.player[target].Center.X)
33757 {
33758 vector264.X += 400f;
33759 }
33760 else
33761 {
33762 vector264.X -= 400f;
33763 }
33764 if (Main.netMode != 1 && Math.Abs(base.Center.X - Main.player[target].Center.X) > 350f && Math.Abs(base.Center.Y - Main.player[target].Center.Y) < 20f)
33765 {
33766 this.ai[0] = 3.1f;
33767 this.ai[1] = 0f;
33768 netUpdate = true;
33769 }
33770 this.ai[1] += 1f / 30f;
33771 float num1407 = 8f + this.ai[1];
33772 float num1408 = 4f;
33773 vector264.Normalize();
33774 vector264 *= num1407;
33775 velocity = (velocity * (num1408 - 1f) + vector264) / num1408;
33776 }
33777 else if (this.ai[0] == 3.1f)
33778 {
33779 knockBackResist = 0f;
33780 noTileCollide = true;
33781 rotation = (rotation * 4f + velocity.X * 0.07f) / 5f;
33782 Vector2 vector265 = Main.player[target].Center - base.Center;
33783 vector265.Y -= 12f;
33784 float num1409 = 16f;
33785 float num1410 = 8f;
33786 vector265.Normalize();
33787 vector265 *= num1409;
33788 velocity = (velocity * (num1410 - 1f) + vector265) / num1410;
33789 if (velocity.X < 0f)
33790 {
33791 direction = -1;
33792 }
33793 else
33794 {
33795 direction = 1;
33796 }
33798 this.ai[1] += 1f;
33799 if (Main.netMode != 1 && this.ai[1] > 10f)
33800 {
33802 if (velocity.X < 0f)
33803 {
33804 direction = -1;
33805 }
33806 else
33807 {
33808 direction = 1;
33809 }
33810 this.ai[0] = 3.2f;
33811 this.ai[1] = 0f;
33812 this.ai[1] = direction;
33813 netUpdate = true;
33814 }
33815 }
33816 else if (this.ai[0] == 3.2f)
33817 {
33818 damage = (int)((double)defDamage * 1.3);
33819 collideX = false;
33820 collideY = false;
33821 knockBackResist = 0f;
33822 noTileCollide = true;
33823 this.ai[2] += 1f / 30f;
33824 velocity.X = (16f + this.ai[2]) * this.ai[1];
33825 if ((this.ai[1] > 0f && base.Center.X > Main.player[target].Center.X + 260f) || (this.ai[1] < 0f && base.Center.X < Main.player[target].Center.X - 260f))
33826 {
33828 {
33829 this.ai[0] = 0f;
33830 this.ai[1] = 0f;
33831 this.ai[2] = 0f;
33832 this.ai[3] = 0f;
33833 netUpdate = true;
33834 }
33835 else if (Main.netMode != 1 && Math.Abs(base.Center.X - Main.player[target].Center.X) > 800f)
33836 {
33837 this.ai[0] = 1f;
33838 this.ai[1] = 0f;
33839 this.ai[2] = 0f;
33840 this.ai[3] = 0f;
33841 netUpdate = true;
33842 }
33843 }
33844 rotation = (rotation * 4f + velocity.X * 0.07f) / 5f;
33845 }
33846 else if (this.ai[0] == 4f)
33847 {
33848 bool flag84 = (double)(base.Center.Y / 16f) < Main.worldSurface;
33849 TargetClosest();
33850 if (Main.netMode != 1)
33851 {
33852 this.ai[0] = 0f;
33853 this.ai[1] = 0f;
33854 this.ai[2] = 0f;
33855 for (int num1411 = 0; num1411 < 1000; num1411++)
33856 {
33857 int num1412 = (int)Main.player[target].Center.X / 16;
33858 int num1413 = (int)Main.player[target].Center.Y / 16;
33859 int num1414 = 30 + num1411 / 50;
33860 int num1415 = 20 + num1411 / 75;
33861 num1412 += Main.rand.Next(-num1414, num1414 + 1);
33862 num1413 += Main.rand.Next(-num1415, num1415 + 1);
33864 {
33865 continue;
33866 }
33867 bool flag85 = false;
33868 int num1416 = 50;
33869 while (num1416 > 0)
33870 {
33871 num1416--;
33872 if (!WorldGen.InWorld(num1412, num1413, 5))
33873 {
33874 flag85 = true;
33875 break;
33876 }
33878 if (tile2 == null)
33879 {
33880 flag85 = true;
33881 break;
33882 }
33883 if (tile2.liquid > 0 && tile2.lava())
33884 {
33885 flag85 = true;
33886 break;
33887 }
33889 if (tile3 == null)
33890 {
33891 flag85 = true;
33892 break;
33893 }
33894 if (tile3.liquid > 0 && tile3.lava())
33895 {
33896 flag85 = true;
33897 break;
33898 }
33900 {
33901 break;
33902 }
33903 num1413++;
33904 }
33905 if (!(num1416 <= 0 || flag85) && (new Vector2(num1412 * 16 + 8, num1413 * 16 + 8) - Main.player[target].Center).Length() < 600f)
33906 {
33907 this.ai[0] = 4.1f;
33908 this.ai[1] = num1412;
33909 this.ai[2] = num1413;
33910 break;
33911 }
33912 }
33913 }
33914 netUpdate = true;
33915 }
33916 else if (this.ai[0] == 4.1f)
33917 {
33918 if (velocity.X < -2f)
33919 {
33920 direction = -1;
33921 }
33922 else if (velocity.X > 2f)
33923 {
33924 direction = 1;
33925 }
33927 rotation = (rotation * 9f + velocity.X * 0.1f) / 10f;
33928 noTileCollide = true;
33929 int num1417 = (int)this.ai[1];
33930 int num1418 = (int)this.ai[2];
33931 float x3 = num1417 * 16 + 8;
33932 float y5 = num1418 * 16 - 20;
33933 Vector2 v12 = new Vector2(x3, y5);
33934 v12 -= base.Center;
33935 float num1419 = 6f + v12.Length() / 150f;
33936 if (num1419 > 10f)
33937 {
33938 num1419 = 10f;
33939 }
33940 float num1420 = 10f;
33941 if (v12.Length() < 10f)
33942 {
33943 this.ai[0] = 4.2f;
33944 netUpdate = true;
33945 }
33946 v12 = v12.SafeNormalize(Vector2.Zero);
33947 v12 *= num1419;
33948 velocity = (velocity * (num1420 - 1f) + v12) / num1420;
33949 if (velocity.Length() > num1419)
33950 {
33952 velocity *= num1419;
33953 }
33954 }
33955 else
33956 {
33957 if (this.ai[0] != 4.2f)
33958 {
33959 return;
33960 }
33961 rotation = (rotation * 9f + velocity.X * 0.1f) / 10f;
33962 knockBackResist = 0f;
33963 noTileCollide = true;
33964 int num1421 = (int)this.ai[1];
33965 int num1422 = (int)this.ai[2];
33966 float x4 = num1421 * 16 + 8;
33967 float y6 = num1422 * 16 - 20;
33968 Vector2 vector266 = new Vector2(x4, y6);
33969 vector266 -= base.Center;
33970 float num1423 = 4f;
33971 float num1424 = 2f;
33972 if (Main.netMode != 1 && vector266.Length() < 4f)
33973 {
33974 int num1425 = 70;
33975 if (Main.expertMode)
33976 {
33977 num1425 = (int)((double)num1425 * 0.75);
33978 }
33979 this.ai[3] += 1f;
33980 if (this.ai[3] == (float)num1425)
33981 {
33982 int num1426 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), num1421 * 16 + 8, num1422 * 16, 478, whoAmI);
33983 Main.npc[num1426].netUpdate = true;
33984 }
33985 else if (this.ai[3] == (float)(num1425 * 2))
33986 {
33987 this.ai[0] = 0f;
33988 this.ai[1] = 0f;
33989 this.ai[2] = 0f;
33990 this.ai[3] = 0f;
33991 netUpdate = true;
33992 if (CountNPCS(478) + CountNPCS(479) < num1399 && Main.rand.Next(3) != 0)
33993 {
33994 this.ai[0] = 4f;
33995 }
33997 {
33998 this.ai[0] = 1f;
33999 }
34000 }
34001 }
34002 if (vector266.Length() > num1423)
34003 {
34004 vector266.Normalize();
34005 vector266 *= num1423;
34006 }
34007 velocity = (velocity * (num1424 - 1f) + vector266) / num1424;
34008 if (velocity.Length() > num1423)
34009 {
34011 velocity *= num1423;
34012 }
34013 }
34014 }
34015 else if (aiStyle == 89)
34016 {
34017 if (velocity.Y == 0f)
34018 {
34019 velocity.X *= 0.9f;
34020 rotation += velocity.X * 0.02f;
34021 }
34022 else
34023 {
34024 velocity.X *= 0.99f;
34025 rotation += velocity.X * 0.04f;
34026 }
34027 int num1427 = 900;
34028 if (Main.expertMode)
34029 {
34030 num1427 = 600;
34031 }
34032 if (justHit)
34033 {
34034 this.ai[0] -= Main.rand.Next(10, 21);
34035 if (!Main.expertMode)
34036 {
34037 this.ai[0] -= Main.rand.Next(10, 21);
34038 }
34039 }
34040 this.ai[0] += 1f;
34041 if (this.ai[0] >= (float)num1427)
34042 {
34043 Transform(479);
34044 }
34045 if (Main.netMode != 1 && velocity.Y == 0f && (double)Math.Abs(velocity.X) < 0.2 && (double)this.ai[0] >= (double)num1427 * 0.75)
34046 {
34047 float num1428 = this.ai[0] - (float)num1427 * 0.75f;
34048 num1428 /= (float)num1427 * 0.25f;
34049 if ((float)Main.rand.Next(-10, 120) < num1428 * 100f)
34050 {
34051 velocity.Y -= (float)Main.rand.Next(20, 40) * 0.025f;
34052 velocity.X += (float)Main.rand.Next(-20, 20) * 0.025f;
34053 velocity *= 1f + num1428 * 2f;
34054 netUpdate = true;
34055 }
34056 }
34057 }
34058 else if (aiStyle == 90)
34059 {
34060 noTileCollide = false;
34061 knockBackResist = 0.4f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
34062 noGravity = true;
34063 rotation = (rotation * 9f + velocity.X * 0.1f) / 10f;
34064 if (!Main.eclipse)
34065 {
34067 velocity.Y -= 0.2f;
34068 if (velocity.Y < -8f)
34069 {
34070 velocity.Y = -8f;
34071 }
34072 noTileCollide = true;
34073 return;
34074 }
34075 if (this.ai[0] == 0f || this.ai[0] == 1f)
34076 {
34077 for (int num1429 = 0; num1429 < 200; num1429++)
34078 {
34079 if (num1429 != whoAmI && Main.npc[num1429].active && Main.npc[num1429].type == type)
34080 {
34081 Vector2 vector267 = Main.npc[num1429].Center - base.Center;
34082 if (vector267.Length() < (float)(width + height))
34083 {
34084 vector267.Normalize();
34085 vector267 *= -0.1f;
34087 NPC nPC3 = Main.npc[num1429];
34088 nPC3.velocity -= vector267;
34089 }
34090 }
34091 }
34092 }
34093 if (target < 0 || Main.player[target].dead || !Main.player[target].active)
34094 {
34095 TargetClosest();
34096 Vector2 vector268 = Main.player[target].Center - base.Center;
34097 if (Main.player[target].dead || vector268.Length() > 3000f)
34098 {
34099 this.ai[0] = -1f;
34100 }
34101 }
34102 else
34103 {
34104 Vector2 vector269 = Main.player[target].Center - base.Center;
34105 if (this.ai[0] > 1f && vector269.Length() > 1000f)
34106 {
34107 this.ai[0] = 1f;
34108 }
34109 }
34110 if (this.ai[0] == -1f)
34111 {
34112 Vector2 vector270 = new Vector2(0f, -8f);
34113 velocity = (velocity * 9f + vector270) / 10f;
34114 noTileCollide = true;
34115 dontTakeDamage = true;
34116 }
34117 else if (this.ai[0] == 0f)
34118 {
34119 TargetClosest();
34121 if (collideX)
34122 {
34123 velocity.X *= (0f - oldVelocity.X) * 0.5f;
34124 if (velocity.X > 4f)
34125 {
34126 velocity.X = 4f;
34127 }
34128 if (velocity.X < -4f)
34129 {
34130 velocity.X = -4f;
34131 }
34132 }
34133 if (collideY)
34134 {
34135 velocity.Y *= (0f - oldVelocity.Y) * 0.5f;
34136 if (velocity.Y > 4f)
34137 {
34138 velocity.Y = 4f;
34139 }
34140 if (velocity.Y < -4f)
34141 {
34142 velocity.Y = -4f;
34143 }
34144 }
34145 Vector2 vector271 = Main.player[target].Center - base.Center;
34146 if (vector271.Length() > 800f)
34147 {
34148 this.ai[0] = 1f;
34149 this.ai[1] = 0f;
34150 this.ai[2] = 0f;
34151 this.ai[3] = 0f;
34152 }
34153 else if (vector271.Length() > 200f)
34154 {
34155 float num1430 = 5.5f + vector271.Length() / 100f + this.ai[1] / 15f;
34156 float num1431 = 40f;
34157 vector271.Normalize();
34158 vector271 *= num1430;
34159 velocity = (velocity * (num1431 - 1f) + vector271) / num1431;
34160 }
34161 else if (velocity.Length() > 2f)
34162 {
34163 velocity *= 0.95f;
34164 }
34165 else if (velocity.Length() < 1f)
34166 {
34167 velocity *= 1.05f;
34168 }
34169 this.ai[1] += 1f;
34170 if (this.ai[1] >= 90f)
34171 {
34172 this.ai[1] = 0f;
34173 this.ai[0] = 2f;
34174 }
34175 }
34176 else if (this.ai[0] == 1f)
34177 {
34178 collideX = false;
34179 collideY = false;
34180 noTileCollide = true;
34181 knockBackResist = 0f;
34182 if (target < 0 || !Main.player[target].active || Main.player[target].dead)
34183 {
34184 TargetClosest();
34185 }
34186 if (velocity.X < 0f)
34187 {
34188 direction = -1;
34189 }
34190 else if (velocity.X > 0f)
34191 {
34192 direction = 1;
34193 }
34195 rotation = (rotation * 9f + velocity.X * 0.08f) / 10f;
34196 Vector2 vector272 = Main.player[target].Center - base.Center;
34197 if (vector272.Length() < 300f && !Collision.SolidCollision(position, width, height))
34198 {
34199 this.ai[0] = 0f;
34200 this.ai[1] = 0f;
34201 this.ai[2] = 0f;
34202 this.ai[3] = 0f;
34203 }
34204 this.ai[2] += 1f / 60f;
34205 float num1432 = 5.5f + this.ai[2] + vector272.Length() / 150f;
34206 float num1433 = 35f;
34207 vector272.Normalize();
34208 vector272 *= num1432;
34209 velocity = (velocity * (num1433 - 1f) + vector272) / num1433;
34210 }
34211 else if (this.ai[0] == 2f)
34212 {
34213 if (velocity.X < 0f)
34214 {
34215 direction = -1;
34216 }
34217 else if (velocity.X > 0f)
34218 {
34219 direction = 1;
34220 }
34222 rotation = (rotation * 7f + velocity.X * 0.1f) / 8f;
34223 knockBackResist = 0f;
34224 noTileCollide = true;
34225 Vector2 vector273 = Main.player[target].Center - base.Center;
34226 vector273.Y -= 8f;
34227 float num1434 = 9f;
34228 float num1435 = 8f;
34229 vector273.Normalize();
34230 vector273 *= num1434;
34231 velocity = (velocity * (num1435 - 1f) + vector273) / num1435;
34232 if (velocity.X < 0f)
34233 {
34234 direction = -1;
34235 }
34236 else
34237 {
34238 direction = 1;
34239 }
34241 this.ai[1] += 1f;
34242 if (this.ai[1] > 10f)
34243 {
34245 if (velocity.X < 0f)
34246 {
34247 direction = -1;
34248 }
34249 else
34250 {
34251 direction = 1;
34252 }
34253 this.ai[0] = 2.1f;
34254 this.ai[1] = 0f;
34255 }
34256 }
34257 else
34258 {
34259 if (this.ai[0] != 2.1f)
34260 {
34261 return;
34262 }
34263 if (velocity.X < 0f)
34264 {
34265 direction = -1;
34266 }
34267 else if (velocity.X > 0f)
34268 {
34269 direction = 1;
34270 }
34272 velocity *= 1.01f;
34273 knockBackResist = 0f;
34274 noTileCollide = true;
34275 this.ai[1] += 1f;
34276 int num1436 = 45;
34277 if (this.ai[1] > (float)num1436)
34278 {
34280 {
34281 this.ai[0] = 0f;
34282 this.ai[1] = 0f;
34283 this.ai[2] = 0f;
34284 }
34285 else if (this.ai[1] > (float)(num1436 * 2))
34286 {
34287 this.ai[0] = 1f;
34288 this.ai[1] = 0f;
34289 this.ai[2] = 0f;
34290 }
34291 }
34292 }
34293 }
34294 else if (aiStyle == 91)
34295 {
34296 noGravity = true;
34297 noTileCollide = false;
34298 dontTakeDamage = false;
34299 if (justHit && Main.netMode != 1 && Main.expertMode && Main.rand.Next(6) == 0)
34300 {
34301 netUpdate = true;
34302 this.ai[0] = -1f;
34303 this.ai[1] = 0f;
34304 }
34305 if (this.ai[0] == -1f)
34306 {
34307 dontTakeDamage = true;
34308 noGravity = false;
34309 velocity.X *= 0.98f;
34310 this.ai[1] += 1f;
34311 if (this.ai[1] >= 120f)
34312 {
34313 this.ai[0] = (this.ai[1] = (this.ai[2] = (this.ai[3] = 0f)));
34314 }
34315 }
34316 else if (this.ai[0] == 0f)
34317 {
34318 TargetClosest();
34319 if (Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
34320 {
34321 this.ai[0] = 1f;
34322 return;
34323 }
34324 Vector2 vector274 = Main.player[target].Center - base.Center;
34325 vector274.Y -= Main.player[target].height / 4;
34326 float num1437 = vector274.Length();
34327 Vector2 center36 = base.Center;
34328 center36.X = Main.player[target].Center.X;
34329 Vector2 vector275 = center36 - base.Center;
34330 if (vector275.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center36, 1, 1))
34331 {
34332 this.ai[0] = 3f;
34333 this.ai[1] = center36.X;
34334 this.ai[2] = center36.Y;
34335 Vector2 center37 = base.Center;
34336 center37.Y = Main.player[target].Center.Y;
34337 if (vector275.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center37, 1, 1) && Collision.CanHit(center37, 1, 1, Main.player[target].position, 1, 1))
34338 {
34339 this.ai[0] = 3f;
34340 this.ai[1] = center37.X;
34341 this.ai[2] = center37.Y;
34342 }
34343 }
34344 else
34345 {
34346 center36 = base.Center;
34347 center36.Y = Main.player[target].Center.Y;
34348 if ((center36 - base.Center).Length() > 8f && Collision.CanHit(base.Center, 1, 1, center36, 1, 1))
34349 {
34350 this.ai[0] = 3f;
34351 this.ai[1] = center36.X;
34352 this.ai[2] = center36.Y;
34353 }
34354 }
34355 if (this.ai[0] == 0f)
34356 {
34357 localAI[0] = 0f;
34358 vector274.Normalize();
34359 vector274 *= 0.5f;
34361 this.ai[0] = 4f;
34362 this.ai[1] = 0f;
34363 }
34364 }
34365 else if (this.ai[0] == 1f)
34366 {
34367 Vector2 vector276 = Main.player[target].Center - base.Center;
34368 float num1438 = vector276.Length();
34369 float num1439 = 2f;
34370 num1439 += num1438 / 200f;
34371 int num1440 = 50;
34372 vector276.Normalize();
34373 vector276 *= num1439;
34374 velocity = (velocity * (num1440 - 1) + vector276) / num1440;
34375 if (!Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
34376 {
34377 this.ai[0] = 0f;
34378 this.ai[1] = 0f;
34379 }
34380 }
34381 else if (this.ai[0] == 2f)
34382 {
34383 noTileCollide = true;
34384 Vector2 vector277 = Main.player[target].Center - base.Center;
34385 float num1441 = vector277.Length();
34386 float num1442 = 2f;
34387 int num1443 = 4;
34388 vector277.Normalize();
34389 vector277 *= num1442;
34390 velocity = (velocity * (num1443 - 1) + vector277) / num1443;
34392 {
34393 this.ai[0] = 0f;
34394 }
34395 }
34396 else if (this.ai[0] == 3f)
34397 {
34398 Vector2 vector278 = new Vector2(this.ai[1], this.ai[2]);
34399 Vector2 vector279 = vector278 - base.Center;
34400 float num1444 = vector279.Length();
34401 float num1445 = 1f;
34402 float num1446 = 3f;
34403 vector279.Normalize();
34404 vector279 *= num1445;
34405 velocity = (velocity * (num1446 - 1f) + vector279) / num1446;
34406 if (collideX || collideY)
34407 {
34408 this.ai[0] = 4f;
34409 this.ai[1] = 0f;
34410 }
34411 if (num1444 < num1445 || num1444 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
34412 {
34413 this.ai[0] = 0f;
34414 }
34415 }
34416 else
34417 {
34418 if (this.ai[0] != 4f)
34419 {
34420 return;
34421 }
34422 if (collideX)
34423 {
34424 velocity.X *= -0.8f;
34425 }
34426 if (collideY)
34427 {
34428 velocity.Y *= -0.8f;
34429 }
34431 if (velocity.X == 0f && velocity.Y == 0f)
34432 {
34433 vector280 = Main.player[target].Center - base.Center;
34434 vector280.Y -= Main.player[target].height / 4;
34435 vector280.Normalize();
34436 velocity = vector280 * 0.1f;
34437 }
34438 float num1447 = 1.5f;
34439 float num1448 = 20f;
34441 vector280.Normalize();
34442 vector280 *= num1447;
34443 velocity = (velocity * (num1448 - 1f) + vector280) / num1448;
34444 this.ai[1] += 1f;
34445 if (this.ai[1] > 180f)
34446 {
34447 this.ai[0] = 0f;
34448 this.ai[1] = 0f;
34449 }
34450 if (Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
34451 {
34452 this.ai[0] = 0f;
34453 }
34454 localAI[0] += 1f;
34455 if (!(localAI[0] >= 5f) || Collision.SolidCollision(position - new Vector2(10f, 10f), width + 20, height + 20))
34456 {
34457 return;
34458 }
34459 localAI[0] = 0f;
34460 Vector2 center38 = base.Center;
34461 center38.X = Main.player[target].Center.X;
34462 if (Collision.CanHit(base.Center, 1, 1, center38, 1, 1) && Collision.CanHit(base.Center, 1, 1, center38, 1, 1) && Collision.CanHit(Main.player[target].Center, 1, 1, center38, 1, 1))
34463 {
34464 this.ai[0] = 3f;
34465 this.ai[1] = center38.X;
34466 this.ai[2] = center38.Y;
34467 return;
34468 }
34469 center38 = base.Center;
34470 center38.Y = Main.player[target].Center.Y;
34471 if (Collision.CanHit(base.Center, 1, 1, center38, 1, 1) && Collision.CanHit(Main.player[target].Center, 1, 1, center38, 1, 1))
34472 {
34473 this.ai[0] = 3f;
34474 this.ai[1] = center38.X;
34475 this.ai[2] = center38.Y;
34476 }
34477 }
34478 }
34479 else if (aiStyle == 92)
34480 {
34481 if (Main.rand.Next(20) == 0)
34482 {
34483 switch (Main.rand.Next(15, 18))
34484 {
34485 case 15:
34487 break;
34488 case 16:
34490 break;
34491 case 17:
34493 break;
34494 }
34495 }
34496 if (Main.netMode == 1)
34497 {
34498 return;
34499 }
34500 bool flag86 = false;
34501 int num1449 = (int)this.ai[0];
34502 int num1450 = (int)this.ai[1];
34503 if (!flag86 && (!Main.tile[num1449, num1450].active() || Main.tile[num1449, num1450].type != 378))
34504 {
34505 flag86 = true;
34506 }
34507 if (!flag86 && (target == 255 || Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > 160000f))
34508 {
34509 TargetClosest(faceTarget: false);
34510 if (target == 255 || Main.player[target].dead || Vector2.Distance(base.Center, Main.player[target].Center) > 160000f)
34511 {
34512 flag86 = true;
34513 }
34514 }
34515 if (flag86)
34516 {
34517 life = 0;
34518 HitEffect();
34519 active = false;
34520 int num1451 = TETrainingDummy.Find((int)this.ai[0], (int)this.ai[1]);
34521 if (num1451 != -1)
34522 {
34523 ((TETrainingDummy)TileEntity.ByID[num1451]).Deactivate();
34524 }
34525 }
34526 }
34527 else if (aiStyle == 93)
34528 {
34529 if (Main.netMode != 1 && localAI[0] == 0f)
34530 {
34531 localAI[0] = 1f;
34532 for (int num1452 = 0; num1452 < 4; num1452++)
34533 {
34534 int num1453 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + num1452 * 40 - 150, (int)base.Center.Y, 492, whoAmI, whoAmI, num1452, 0f, 60 * num1452);
34535 Main.npc[num1453].TargetClosest(faceTarget: false);
34536 Main.npc[num1453].timeLeft = 600;
34537 Main.npc[num1453].netUpdate = true;
34538 this.ai[num1452] = num1453;
34539 }
34540 netUpdate = true;
34541 }
34542 bool flag87 = true;
34543 for (int num1454 = 0; num1454 < 4; num1454++)
34544 {
34545 if (this.ai[num1454] >= 0f && (!Main.npc[(int)this.ai[num1454]].active || Main.npc[(int)this.ai[num1454]].type != 492))
34546 {
34547 this.ai[num1454] = -1f;
34548 netUpdate = true;
34549 }
34550 else if (this.ai[num1454] >= 0f)
34551 {
34552 flag87 = false;
34553 }
34554 }
34555 if (flag87)
34556 {
34557 StrikeNPCNoInteraction(9999, 0f, 0);
34558 return;
34559 }
34560 if (Main.netMode != 1 && Main.rand.Next(300) == 0)
34561 {
34562 Vector2 vector281 = new Vector2((Main.rand.NextFloat() - 0.5f) * (float)(width - 70), (Main.rand.NextFloat() - 0.5f) * 20f - (float)(height / 2) - 20f).RotatedBy(rotation);
34563 vector281 += base.Center;
34564 int num1455 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector281.X, (int)vector281.Y, Utils.SelectRandom<int>(Main.rand, 213, 215, 214, 212));
34565 Main.npc[num1455].velocity = new Vector2((Main.rand.NextFloat() - 0.5f) * 5f, -8.01f) + velocity;
34566 Main.npc[num1455].netUpdate = true;
34567 Main.npc[num1455].timeLeft = 600;
34568 }
34569 if ((localAI[3] += 1f) >= 64f)
34570 {
34571 localAI[3] = 0f;
34572 }
34573 TargetClosest();
34574 int num1456 = (int)base.Center.X / 16 + Math.Sign(velocity.X) * 10;
34575 int num1457 = (int)(position.Y + (float)height) / 16;
34576 int num1458 = 0;
34578 {
34579 num1458 = 1;
34580 }
34581 else
34582 {
34583 for (; num1458 < 150 && num1457 + num1458 < Main.maxTilesY; num1458++)
34584 {
34585 int num1459 = num1457 + num1458;
34587 {
34588 num1458--;
34589 break;
34590 }
34591 }
34592 }
34593 float num1460 = num1458 * 16;
34594 if (num1460 < 350f)
34595 {
34596 float num1461 = num1460 - 350f;
34597 if (num1461 < -4f)
34598 {
34599 num1461 = -4f;
34600 }
34601 velocity.Y = MathHelper.Lerp(velocity.Y, num1461, 0.05f);
34602 }
34603 else if (num1460 > 450f)
34604 {
34605 float num1462 = num1460 - 350f;
34606 if (num1462 > 4f)
34607 {
34608 num1462 = 4f;
34609 }
34610 velocity.Y = MathHelper.Lerp(velocity.Y, num1462, 0.05f);
34611 }
34612 else
34613 {
34614 velocity.Y *= 0.95f;
34615 }
34616 float num1463 = Main.player[target].Center.X - base.Center.X;
34617 if (Math.Abs(num1463) >= 300f && (Math.Abs(velocity.X) < 6f || Math.Sign(velocity.X) != direction))
34618 {
34619 velocity.X += (float)direction * 0.06f;
34620 }
34621 rotation = velocity.X * 0.025f;
34623 for (int num1464 = 0; num1464 < 2; num1464++)
34624 {
34625 if (Main.rand.Next(2) != 0)
34626 {
34627 Vector2 vector282 = new Vector2((Main.rand.NextFloat() - 0.5f) * (float)(width - 70), (Main.rand.NextFloat() - 0.5f) * 20f + (float)(height / 2) + 10f).RotatedBy(rotation);
34628 Dust dust8 = Main.dust[Dust.NewDust(base.Center, 0, 0, 228)];
34629 dust8.position = base.Center + vector282;
34630 dust8.velocity = Vector2.Zero;
34631 dust8.noGravity = true;
34632 dust8.noLight = true;
34633 dust8.fadeIn = 1.5f;
34634 dust8.scale = 0.5f;
34635 }
34636 }
34637 }
34638 else if (aiStyle == 94)
34639 {
34640 if (this.ai[2] == 1f)
34641 {
34642 velocity = Vector2.UnitY * velocity.Length();
34643 if (velocity.Y < 0.25f)
34644 {
34645 velocity.Y += 0.02f;
34646 }
34647 if (velocity.Y > 0.25f)
34648 {
34649 velocity.Y -= 0.02f;
34650 }
34651 dontTakeDamage = true;
34652 this.ai[1]++;
34653 if (this.ai[1] > 120f)
34654 {
34655 Opacity = 1f - (this.ai[1] - 120f) / 60f;
34656 }
34657 int num1465 = 6;
34658 switch (type)
34659 {
34660 case 517:
34661 num1465 = 127;
34662 break;
34663 case 422:
34664 num1465 = 229;
34665 break;
34666 case 507:
34667 num1465 = 242;
34668 break;
34669 case 493:
34670 num1465 = 135;
34671 break;
34672 }
34673 if (Main.rand.Next(5) == 0 && this.ai[1] < 120f)
34674 {
34675 for (int num1466 = 0; num1466 < 3; num1466++)
34676 {
34678 dust9.position = base.Center + Vector2.UnitY.RotatedByRandom(4.188790321350098) * new Vector2((float)width * 1.5f, (float)height * 1.1f) * 0.8f * (0.8f + Main.rand.NextFloat() * 0.2f);
34679 dust9.velocity.X = 0f;
34680 dust9.velocity.Y = (0f - Math.Abs(dust9.velocity.Y - (float)num1466 + velocity.Y - 4f)) * 3f;
34681 dust9.noGravity = true;
34682 dust9.fadeIn = 1f;
34683 dust9.scale = 1f + Main.rand.NextFloat() + (float)num1466 * 0.3f;
34684 }
34685 }
34686 if (this.ai[1] < 150f)
34687 {
34688 for (int num1467 = 0; num1467 < 3; num1467++)
34689 {
34690 if (Main.rand.Next(4) == 0)
34691 {
34692 Dust dust10 = Main.dust[Dust.NewDust(base.Top + new Vector2((float)(-width) * (0.33f - 0.11f * (float)num1467), -20f), (int)((float)width * (0.66f - 0.22f * (float)num1467)), 20, num1465)];
34693 dust10.velocity.X = 0f;
34694 dust10.velocity.Y = (0f - Math.Abs(dust10.velocity.Y - (float)num1467 + velocity.Y - 4f)) * (1f + this.ai[1] / 180f * 0.5f);
34695 dust10.noGravity = true;
34696 dust10.fadeIn = 1f;
34697 dust10.scale = 1f + Main.rand.NextFloat() + (float)num1467 * 0.3f;
34698 }
34699 }
34700 }
34701 if (Main.rand.Next(5) == 0 && this.ai[1] < 150f)
34702 {
34703 for (int num1468 = 0; num1468 < 3; num1468++)
34704 {
34705 Vector2 vector283 = base.Center + Vector2.UnitY.RotatedByRandom(4.188790321350098) * new Vector2(width, height) * 0.7f * Main.rand.NextFloat();
34706 float num1469 = 1f + Main.rand.NextFloat() * 2f + this.ai[1] / 180f * 4f;
34707 for (int num1470 = 0; num1470 < 6; num1470++)
34708 {
34710 dust11.position = vector283;
34711 dust11.velocity.X *= num1469;
34712 dust11.velocity.Y = (0f - Math.Abs(dust11.velocity.Y)) * num1469;
34713 dust11.noGravity = true;
34714 dust11.fadeIn = 1f;
34715 dust11.scale = 1.5f + Main.rand.NextFloat() + (float)num1470 * 0.13f;
34716 }
34717 SoundEngine.PlaySound(3, vector283, Utils.SelectRandom<int>(Main.rand, 1, 18));
34718 }
34719 }
34720 if (Main.rand.Next(3) != 0 && this.ai[1] < 150f)
34721 {
34722 Dust dust12 = Main.dust[Dust.NewDust(base.Left, width, height / 2, 241)];
34723 dust12.position = base.Center + Vector2.UnitY.RotatedByRandom(4.188790321350098) * new Vector2(width / 2, height / 2) * (0.8f + Main.rand.NextFloat() * 0.2f);
34724 dust12.velocity.X = 0f;
34725 dust12.velocity.Y = Math.Abs(dust12.velocity.Y) * 0.25f;
34726 }
34727 if (this.ai[1] % 60f == 1f)
34728 {
34729 SoundEngine.PlaySound(4, base.Center, 22);
34730 }
34731 if (this.ai[1] >= 180f)
34732 {
34733 life = 0;
34734 HitEffect(0, 1337.0);
34735 checkDead();
34736 }
34737 return;
34738 }
34739 if (this.ai[3] > 0f)
34740 {
34741 bool flag88 = dontTakeDamage;
34742 switch (type)
34743 {
34744 case 517:
34746 break;
34747 case 422:
34749 break;
34750 case 507:
34752 break;
34753 case 493:
34755 break;
34756 }
34757 if (flag88 != dontTakeDamage)
34758 {
34760 }
34761 else if (this.ai[3] == 1f)
34762 {
34764 }
34765 this.ai[3]++;
34766 if (this.ai[3] > 120f)
34767 {
34768 this.ai[3] = 0f;
34769 }
34770 }
34771 switch (type)
34772 {
34773 case 517:
34775 break;
34776 case 422:
34778 break;
34779 case 507:
34781 break;
34782 case 493:
34784 break;
34785 }
34786 TargetClosest(faceTarget: false);
34787 if (Main.player[target].Distance(base.Center) > 2000f)
34788 {
34789 localAI[0]++;
34790 }
34791 if (localAI[0] >= 60f && Main.netMode != 1)
34792 {
34793 localAI[0] = 0f;
34794 netUpdate = true;
34795 life = (int)MathHelper.Clamp(life + 200, 0f, lifeMax);
34796 }
34797 else
34798 {
34799 localAI[0] = 0f;
34800 }
34801 velocity = new Vector2(0f, (float)Math.Sin((float)Math.PI * 2f * this.ai[0] / 300f) * 0.5f);
34802 Point origin = base.Bottom.ToTileCoordinates();
34803 int maxDistance = 10;
34804 int num1471 = 20;
34805 int num1472 = 30;
34806 if (WorldGen.InWorld(origin.X, origin.Y, 20) && Main.tile[origin.X, origin.Y] != null)
34807 {
34809 {
34810 float num1473 = 1f - (float)Math.Abs(origin.Y - result.Y) / 10f;
34811 position.Y -= 1.5f * num1473;
34812 }
34813 else if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(num1471), new Terraria.WorldBuilding.Conditions.IsSolid()), out result))
34814 {
34815 float num1474 = 1f;
34817 {
34818 num1474 = Utils.GetLerpValue(num1471, num1472, Math.Abs(origin.Y - result.Y), clamped: true);
34819 }
34820 position.Y += 1.5f * num1474;
34821 }
34822 }
34823 if (!Main.remixWorld && !Main.getGoodWorld && (double)base.Bottom.Y > Main.worldSurface * 16.0 - 100.0)
34824 {
34825 position.Y = (float)Main.worldSurface * 16f - (float)height - 100f;
34826 }
34827 this.ai[0]++;
34828 if (this.ai[0] >= 300f)
34829 {
34830 this.ai[0] = 0f;
34831 netUpdate = true;
34832 }
34833 if (type == 493)
34834 {
34835 if (Main.rand.Next(5) == 0)
34836 {
34837 Dust dust13 = Main.dust[Dust.NewDust(base.Left, width, height / 2, 241)];
34838 dust13.position = base.Center + Vector2.UnitY.RotatedByRandom(2.094395160675049) * new Vector2(width / 2, height / 2) * (0.8f + Main.rand.NextFloat() * 0.2f);
34839 dust13.velocity.X = 0f;
34840 dust13.velocity.Y = Math.Abs(dust13.velocity.Y) * 0.25f;
34841 }
34842 for (int num1475 = 0; num1475 < 3; num1475++)
34843 {
34844 if (Main.rand.Next(5) == 0)
34845 {
34846 Dust dust14 = Main.dust[Dust.NewDust(base.Top + new Vector2((float)(-width) * (0.33f - 0.11f * (float)num1475), -20f), (int)((float)width * (0.66f - 0.22f * (float)num1475)), 20, 135)];
34847 dust14.velocity.X = 0f;
34848 dust14.velocity.Y = (0f - Math.Abs(dust14.velocity.Y - (float)num1475 + velocity.Y - 4f)) * 1f;
34849 dust14.noGravity = true;
34850 dust14.fadeIn = 1f;
34851 dust14.scale = 1f + Main.rand.NextFloat() + (float)num1475 * 0.3f;
34852 }
34853 }
34854 if (this.ai[1] > 0f)
34855 {
34856 this.ai[1]--;
34857 }
34858 if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[target].active && !Main.player[target].dead && Distance(Main.player[target].Center) < 1080f && Main.player[target].position.Y - position.Y < 400f)
34859 {
34861 }
34862 }
34863 if (type == 507)
34864 {
34865 if (Main.rand.Next(5) == 0)
34866 {
34867 Dust dust15 = Main.dust[Dust.NewDust(base.Left, width, height / 2, 241)];
34868 dust15.position = base.Center + Vector2.UnitY.RotatedByRandom(2.094395160675049) * new Vector2(width / 2, height / 2) * (0.8f + Main.rand.NextFloat() * 0.2f);
34869 dust15.velocity.X = 0f;
34870 dust15.velocity.Y = Math.Abs(dust15.velocity.Y) * 0.25f;
34871 }
34872 for (int num1476 = 0; num1476 < 3; num1476++)
34873 {
34874 if (Main.rand.Next(5) == 0)
34875 {
34876 Dust dust16 = Main.dust[Dust.NewDust(base.Top + new Vector2((float)(-width) * (0.33f - 0.11f * (float)num1476), -20f), (int)((float)width * (0.66f - 0.22f * (float)num1476)), 20, 242)];
34877 dust16.velocity.X = 0f;
34878 dust16.velocity.Y = (0f - Math.Abs(dust16.velocity.Y - (float)num1476 + velocity.Y - 4f)) * 1f;
34879 dust16.noGravity = true;
34880 dust16.fadeIn = 1f;
34881 dust16.color = Color.Black;
34882 dust16.scale = 1f + Main.rand.NextFloat() + (float)num1476 * 0.3f;
34883 }
34884 }
34885 }
34886 if (type == 422)
34887 {
34888 if (Main.rand.Next(5) == 0)
34889 {
34890 Dust dust17 = Main.dust[Dust.NewDust(base.Left, width, height / 2, 241)];
34891 dust17.position = base.Center + Vector2.UnitY.RotatedByRandom(2.094395160675049) * new Vector2(width / 2, height / 2) * (0.8f + Main.rand.NextFloat() * 0.2f);
34892 dust17.velocity.X = 0f;
34893 dust17.velocity.Y = Math.Abs(dust17.velocity.Y) * 0.25f;
34894 }
34895 for (int num1477 = 0; num1477 < 3; num1477++)
34896 {
34897 if (Main.rand.Next(5) == 0)
34898 {
34899 Dust dust18 = Main.dust[Dust.NewDust(base.Top + new Vector2((float)(-width) * (0.33f - 0.11f * (float)num1477), -20f), (int)((float)width * (0.66f - 0.22f * (float)num1477)), 20, 229)];
34900 dust18.velocity.X = 0f;
34901 dust18.velocity.Y = (0f - Math.Abs(dust18.velocity.Y - (float)num1477 + velocity.Y - 4f)) * 1f;
34902 dust18.noGravity = true;
34903 dust18.fadeIn = 1f;
34904 dust18.color = Color.Black;
34905 dust18.scale = 1f + Main.rand.NextFloat() + (float)num1477 * 0.3f;
34906 }
34907 }
34908 if (this.ai[1] > 0f)
34909 {
34910 this.ai[1]--;
34911 }
34912 if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[target].active && !Main.player[target].dead && Distance(Main.player[target].Center) < 3240f && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
34913 {
34914 this.ai[1] = 60 + Main.rand.Next(120);
34915 Point point11 = Main.player[target].Top.ToTileCoordinates();
34916 bool flag89 = CountNPCS(428) + CountNPCS(427) + CountNPCS(426) < 14;
34917 for (int num1478 = 0; num1478 < 10; num1478++)
34918 {
34920 {
34921 break;
34922 }
34923 if (point11.Y <= 10)
34924 {
34925 break;
34926 }
34927 point11.Y--;
34928 }
34929 if (flag89)
34930 {
34931 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), point11.X * 16 + 8, point11.Y * 16 + 24, 0f, 0f, 579, 0, 0f, Main.myPlayer);
34932 }
34933 else
34934 {
34935 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), point11.X * 16 + 8, point11.Y * 16 + 17, 0f, 0f, 578, 0, 1f, Main.myPlayer);
34936 }
34937 }
34938 if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[target].active && !Main.player[target].dead && Distance(Main.player[target].Center) < 1080f && Main.player[target].position.Y - position.Y < 400f && CountNPCS(427) + CountNPCS(426) * 3 + CountNPCS(428) < 20)
34939 {
34940 this.ai[1] = 420 + Main.rand.Next(360);
34941 Point point12 = base.Center.ToTileCoordinates();
34942 Point point13 = Main.player[target].Center.ToTileCoordinates();
34943 Vector2 vector284 = Main.player[target].Center - base.Center;
34944 int num1479 = 20;
34945 int num1480 = 3;
34946 int num1481 = 8;
34947 int num1482 = 2;
34948 int num1483 = 0;
34949 bool flag90 = false;
34950 if (vector284.Length() > 2000f)
34951 {
34952 flag90 = true;
34953 }
34954 while (!flag90 && num1483 < 100)
34955 {
34956 num1483++;
34957 int num1484 = Main.rand.Next(point13.X - num1479, point13.X + num1479 + 1);
34958 int num1485 = Main.rand.Next(point13.Y - num1479, point13.Y + num1479 + 1);
34960 {
34961 bool flag91 = true;
34962 if (flag91 && Main.tile[num1484, num1485].lava())
34963 {
34964 flag91 = false;
34965 }
34967 {
34968 flag91 = false;
34969 }
34970 if (flag91 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
34971 {
34972 flag91 = false;
34973 }
34974 if (flag91)
34975 {
34976 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), num1484 * 16 + 8, num1485 * 16 + 8, 0f, 0f, 579, 0, 0f, Main.myPlayer);
34977 flag90 = true;
34978 break;
34979 }
34980 }
34981 }
34982 }
34983 }
34984 if (type != 517)
34985 {
34986 return;
34987 }
34988 if (Main.rand.Next(5) == 0)
34989 {
34990 Dust dust19 = Main.dust[Dust.NewDust(base.Left, width, height / 2, 241)];
34991 dust19.position = base.Center + Vector2.UnitY.RotatedByRandom(2.094395160675049) * new Vector2(width / 2, height / 2) * (0.8f + Main.rand.NextFloat() * 0.2f);
34992 dust19.velocity.X = 0f;
34993 dust19.velocity.Y = Math.Abs(dust19.velocity.Y) * 0.25f;
34994 }
34995 for (int num1486 = 0; num1486 < 3; num1486++)
34996 {
34997 if (Main.rand.Next(5) == 0)
34998 {
34999 Dust dust20 = Main.dust[Dust.NewDust(base.Top + new Vector2((float)(-width) * (0.33f - 0.11f * (float)num1486), -20f), (int)((float)width * (0.66f - 0.22f * (float)num1486)), 20, 6)];
35000 dust20.velocity.X = 0f;
35001 dust20.velocity.Y = (0f - Math.Abs(dust20.velocity.Y - (float)num1486 + velocity.Y - 4f)) * 1f;
35002 dust20.noGravity = true;
35003 dust20.fadeIn = 1f;
35004 dust20.scale = 1f + Main.rand.NextFloat() + (float)num1486 * 0.3f;
35005 }
35006 }
35007 if (this.ai[1] > 0f)
35008 {
35009 this.ai[1]--;
35010 }
35011 if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[target].active && !Main.player[target].dead && Distance(Main.player[target].Center) < 1080f && Main.player[target].position.Y - position.Y < 700f)
35012 {
35013 Vector2 vector285 = base.Top + new Vector2((float)(-width) * 0.33f, -20f) + new Vector2((float)width * 0.66f, 20f) * Utils.RandomVector2(Main.rand, 0f, 1f);
35014 Vector2 vector286 = -Vector2.UnitY.RotatedByRandom(0.7853981852531433) * (7f + Main.rand.NextFloat() * 5f);
35016 Main.npc[num1487].velocity = vector286;
35017 Main.npc[num1487].netUpdate = true;
35018 this.ai[1] = 60f;
35019 }
35020 }
35021 else if (aiStyle == 95)
35022 {
35023 float num1488 = 300f;
35024 if (velocity.Length() > 4f)
35025 {
35026 velocity *= 0.95f;
35027 }
35028 velocity *= 0.99f;
35029 this.ai[0]++;
35030 float num1489 = MathHelper.Clamp(this.ai[0] / num1488, 0f, 1f);
35031 scale = 1f + 0.3f * num1489;
35032 if (this.ai[0] >= num1488)
35033 {
35034 if (Main.netMode != 1)
35035 {
35036 Transform(405);
35037 netUpdate = true;
35038 }
35039 return;
35040 }
35041 rotation += velocity.X * 0.1f;
35042 if (!(this.ai[0] > 20f))
35043 {
35044 return;
35045 }
35046 Vector2 center39 = base.Center;
35047 int num1490 = (int)(this.ai[0] / (num1488 / 2f));
35048 for (int num1491 = 0; num1491 < num1490 + 1; num1491++)
35049 {
35050 if (Main.rand.Next(2) != 0)
35051 {
35052 int num1492 = 226;
35053 float num1493 = 0.4f;
35054 if (num1491 % 2 == 1)
35055 {
35056 num1492 = 226;
35057 num1493 = 0.65f;
35058 }
35059 Vector2 vector287 = center39 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - (float)(num1490 * 2));
35060 int num1494 = Dust.NewDust(vector287 - Vector2.One * 12f, 24, 24, num1492, velocity.X / 2f, velocity.Y / 2f);
35061 Dust dust = Main.dust[num1494];
35062 dust.position -= new Vector2(2f);
35063 Main.dust[num1494].velocity = Vector2.Normalize(center39 - vector287) * 1.5f * (10f - (float)num1490 * 2f) / 10f;
35064 Main.dust[num1494].noGravity = true;
35065 Main.dust[num1494].scale = num1493;
35066 Main.dust[num1494].customData = this;
35067 }
35068 }
35069 }
35070 else if (aiStyle == 96)
35071 {
35072 float num1495 = 5f;
35073 float moveSpeed = 0.15f;
35074 TargetClosest();
35075 Vector2 desiredVelocity3 = Main.player[target].Center - base.Center + new Vector2(0f, -250f);
35076 float num1496 = desiredVelocity3.Length();
35077 if (num1496 < 20f)
35078 {
35080 }
35081 else if (num1496 < 40f)
35082 {
35083 desiredVelocity3.Normalize();
35084 desiredVelocity3 *= num1495 * 0.35f;
35085 }
35086 else if (num1496 < 80f)
35087 {
35088 desiredVelocity3.Normalize();
35089 desiredVelocity3 *= num1495 * 0.65f;
35090 }
35091 else
35092 {
35093 desiredVelocity3.Normalize();
35095 }
35097 rotation = velocity.X * 0.1f;
35098 if (!((this.ai[0] += 1f) >= 70f))
35099 {
35100 return;
35101 }
35102 this.ai[0] = 0f;
35103 if (Main.netMode != 1)
35104 {
35106 while (Math.Abs(vector288.X) < 1.5f)
35107 {
35108 vector288 = Vector2.UnitY.RotatedByRandom(1.5707963705062866) * new Vector2(5f, 3f);
35109 }
35110 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, vector288.X, vector288.Y, 539, 60, 0f, Main.myPlayer, 0f, whoAmI);
35111 }
35112 }
35113 else if (aiStyle == 97)
35114 {
35115 float num1497 = 7f;
35116 int num1498 = 480;
35117 int num1499 = 30;
35118 int maxValue6 = 6;
35119 if (localAI[2] < 180f)
35120 {
35121 localAI[2]++;
35122 if (Main.netMode != 1 && localAI[2] % 60f == 0f)
35123 {
35125 while (Math.Abs(vector289.X) < 1.5f)
35126 {
35127 vector289 = Vector2.UnitY.RotatedByRandom(1.5707963705062866) * new Vector2(4f, 2.5f);
35128 }
35130 }
35131 }
35132 if (localAI[1] == 1f)
35133 {
35134 localAI[1] = 0f;
35135 if (Main.rand.Next(maxValue6) == 0)
35136 {
35137 this.ai[0] = num1498;
35138 }
35139 }
35140 TargetClosest();
35141 if (Main.netMode != 1 && (!Main.player[target].active || Main.player[target].dead))
35142 {
35143 this.ai[0] = 0f;
35144 this.ai[1] = 1f;
35145 this.ai[2] = 0f;
35146 this.ai[3] = 0f;
35147 netUpdate = true;
35148 }
35149 rotation = Math.Abs(velocity.X) * (float)direction * 0.1f;
35151 Vector2 vector290 = base.Center + new Vector2(direction * 20, 6f);
35153 bool flag92 = Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1);
35154 bool flag93 = false;
35155 if (this.ai[1] == 1f)
35156 {
35157 if (localAI[3] == 0f)
35158 {
35159 localAI[3] = 1f;
35160 this.ai[3] = 3f;
35162 for (int num1500 = 0; num1500 < 20; num1500++)
35163 {
35164 int num1501 = Dust.NewDust(position, width, height, 242);
35165 Dust dust = Main.dust[num1501];
35166 dust.velocity *= 3f;
35167 Main.dust[num1501].noGravity = true;
35168 Main.dust[num1501].scale = 2.5f;
35169 }
35170 }
35171 this.ai[3]--;
35172 if (this.ai[3] <= 0f)
35173 {
35174 active = false;
35175 netUpdate = true;
35176 }
35177 return;
35178 }
35179 if (vector291.Length() > 400f || !flag92)
35180 {
35182 if (vector292.Length() > num1497)
35183 {
35184 vector292.Normalize();
35185 vector292 *= num1497;
35186 }
35187 int num1502 = 30;
35188 velocity = (velocity * (num1502 - 1) + vector292) / num1502;
35189 }
35190 else
35191 {
35192 velocity *= 0.98f;
35193 flag93 = true;
35194 }
35195 if (this.ai[2] != 0f && this.ai[3] != 0f)
35196 {
35198 for (int num1503 = 0; num1503 < 20; num1503++)
35199 {
35200 int num1504 = Dust.NewDust(position, width, height, 242);
35201 Dust dust = Main.dust[num1504];
35202 dust.velocity *= 3f;
35203 Main.dust[num1504].noGravity = true;
35204 Main.dust[num1504].scale = 2.5f;
35205 }
35206 base.Center = new Vector2(this.ai[2] * 16f, this.ai[3] * 16f);
35208 this.ai[2] = 0f;
35209 this.ai[3] = 0f;
35211 for (int num1505 = 0; num1505 < 20; num1505++)
35212 {
35213 int num1506 = Dust.NewDust(position, width, height, 242);
35214 Dust dust = Main.dust[num1506];
35215 dust.velocity *= 3f;
35216 Main.dust[num1506].noGravity = true;
35217 Main.dust[num1506].scale = 2.5f;
35218 }
35219 }
35220 this.ai[0]++;
35221 if (this.ai[0] >= (float)num1498 && Main.netMode != 1)
35222 {
35223 this.ai[0] = 0f;
35224 Point point14 = base.Center.ToTileCoordinates();
35225 Point point15 = Main.player[target].Center.ToTileCoordinates();
35228 {
35229 this.ai[1] = 20f;
35230 this.ai[2] = chosenTile2.X;
35231 this.ai[3] = chosenTile2.Y;
35232 bool flag94 = true;
35233 for (int num1507 = 0; num1507 < 1000; num1507++)
35234 {
35236 if (projectile10.active && projectile10.type == 574 && projectile10.ai[1] == (float)whoAmI && !(projectile10.ai[0] >= 0f))
35237 {
35238 flag94 = false;
35239 break;
35240 }
35241 }
35242 if (flag94)
35243 {
35244 for (int num1508 = 0; num1508 < 1000; num1508++)
35245 {
35247 if (projectile11.active && projectile11.type == 574 && projectile11.ai[1] == (float)whoAmI)
35248 {
35249 projectile11.ai[0] -= num1499;
35250 }
35251 }
35252 }
35253 }
35254 netUpdate = true;
35255 }
35256 if (flag93 && velocity.Length() < 2f && Main.netMode != 1)
35257 {
35258 localAI[0] += 1f;
35259 _ = localAI[0];
35260 _ = 13f;
35261 }
35262 }
35263 else if (aiStyle == 98)
35264 {
35265 noTileCollide = false;
35266 if (this.ai[0] == 0f)
35267 {
35268 TargetClosest();
35269 this.ai[0] = 1f;
35270 this.ai[1] = 0f;
35271 this.ai[2] = 0f;
35272 this.ai[3] = 0f;
35273 }
35274 bool flag95 = Collision.CanHit(base.Center, 1, 1, Main.player[target].position, 1, 1);
35275 bool flag96 = true;
35276 if (!flag95 || Main.player[target].dead)
35277 {
35278 flag96 = false;
35279 }
35280 else
35281 {
35282 int num1509 = (int)(Main.player[target].Center.X / 16f);
35283 int num1510 = (int)(Main.player[target].Center.Y / 16f);
35284 for (int num1511 = num1509 - 2; num1511 <= num1509 + 2; num1511++)
35285 {
35286 for (int num1512 = num1510; num1512 <= num1510 + 25; num1512++)
35287 {
35289 {
35290 flag96 = false;
35291 }
35292 }
35293 }
35294 }
35295 if (this.ai[0] < 0f)
35296 {
35297 Vector2 vector293 = Main.player[target].Center - base.Center;
35298 float num1513 = vector293.Length();
35299 if (this.ai[0] == -1f)
35300 {
35301 vector293.Normalize();
35302 if (vector293.HasNaNs())
35303 {
35304 vector293 = new Vector2(direction, 0f);
35305 }
35306 float num1514 = 8f + num1513 / 100f;
35307 float num1515 = 12f;
35308 if (Main.player[target].velocity.Length() > num1515)
35309 {
35310 num1515 = Main.player[target].velocity.Length();
35311 }
35312 if (num1514 > num1515)
35313 {
35314 num1514 = num1515;
35315 }
35316 vector293 *= num1514;
35317 float num1516 = 10f;
35318 velocity = (velocity * (num1516 - 1f) + vector293) / num1516;
35319 for (int num1517 = 0; num1517 < 200; num1517++)
35320 {
35321 if (Main.npc[num1517].active && Main.npc[num1517].type == type && num1517 != whoAmI)
35322 {
35323 Vector2 vector294 = Main.npc[num1517].Center - base.Center;
35324 if (vector294.Length() < 40f)
35325 {
35326 vector294.Normalize();
35327 vector294 *= 1f;
35329 }
35330 }
35331 }
35332 rotation += velocity.X * 0.03f;
35333 if ((double)rotation < -6.2831)
35334 {
35335 rotation += 6.2831f;
35336 }
35337 if ((double)rotation > 6.2831)
35338 {
35339 rotation -= 6.2831f;
35340 }
35341 if (velocity.X > 0f)
35342 {
35343 direction = 1;
35344 }
35345 else if (velocity.X < 0f)
35346 {
35347 direction = -1;
35348 }
35350 }
35351 this.ai[1] += 1f;
35352 if (this.ai[1] >= 60f && !flag96)
35353 {
35354 this.ai[0] = 0f;
35355 }
35356 }
35357 else if (this.ai[0] == 2f)
35358 {
35359 rotation *= 0.92f;
35360 if ((double)Math.Abs(rotation) < 0.02)
35361 {
35362 rotation = 0f;
35363 }
35364 int num1518 = 300;
35365 float num1519 = Math.Abs(base.Center.X - Main.player[target].Center.X);
35366 if (num1519 < (float)num1518 && Collision.CanHit(base.Center, 1, 1, Main.player[target].position, 1, 1))
35367 {
35368 velocity.X *= 0.96f;
35369 velocity.Y *= 0.96f;
35370 this.ai[1] += 1f;
35371 if (this.ai[1] == 20f)
35372 {
35373 if (Main.netMode != 1)
35374 {
35375 int num1520 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y + 26, 516, 0, 0f, 0f, 0f, 0f, target);
35376 }
35377 }
35378 else if (this.ai[1] >= 30f)
35379 {
35380 this.ai[1] = 0f;
35381 }
35382 for (int num1521 = 0; num1521 < 200; num1521++)
35383 {
35384 if (Main.npc[num1521].active && Main.npc[num1521].type == type && num1521 != whoAmI)
35385 {
35386 Vector2 vector295 = Main.npc[num1521].Center - base.Center;
35387 if (vector295.Length() < 100f)
35388 {
35389 vector295.Normalize();
35390 vector295 *= 0.1f;
35392 }
35393 }
35394 }
35395 }
35396 else
35397 {
35398 this.ai[0] = 0f;
35399 }
35400 if (Main.player[target].Center.X < base.Center.X)
35401 {
35402 direction = -1;
35403 }
35404 else if (Main.player[target].Center.X > base.Center.X)
35405 {
35406 direction = 1;
35407 }
35409 }
35410 if (this.ai[0] != 1f)
35411 {
35412 return;
35413 }
35414 rotation *= 0.92f;
35415 if ((double)Math.Abs(rotation) < 0.02)
35416 {
35417 rotation = 0f;
35418 }
35419 if (flag96)
35420 {
35421 this.ai[0] = -1f;
35422 this.ai[1] = 0f;
35423 this.ai[2] = 0f;
35424 this.ai[3] = 0f;
35425 }
35426 int num1522 = 300;
35427 for (int num1523 = 0; num1523 < 200; num1523++)
35428 {
35429 if (Main.npc[num1523].active && Main.npc[num1523].type == type && num1523 != whoAmI)
35430 {
35431 Vector2 vector296 = Main.npc[num1523].Center - base.Center;
35432 if (vector296.Length() < 50f)
35433 {
35434 vector296.Normalize();
35435 vector296 *= 0.1f;
35437 velocity.X -= vector296.X * 1f;
35438 }
35439 }
35440 }
35441 int num1524 = 800;
35442 float num1525 = Math.Abs(base.Center.X - Main.player[target].Center.X);
35443 if (num1525 < (float)num1522 && flag95)
35444 {
35445 this.ai[0] = 2f;
35446 this.ai[1] = 0f;
35447 }
35448 else
35449 {
35450 if (collideX)
35451 {
35452 velocity.X *= -0.5f;
35453 this.ai[1] = 60f;
35454 direction *= -1;
35455 }
35456 if (this.ai[1] > 0f)
35457 {
35458 this.ai[1] -= 1f;
35459 }
35460 else if (flag95)
35461 {
35462 if (base.Center.X > Main.player[target].Center.X)
35463 {
35464 direction = -1;
35465 }
35466 else
35467 {
35468 direction = 1;
35469 }
35470 }
35471 else if (num1525 > (float)num1524)
35472 {
35473 if (base.Center.X > Main.player[target].Center.X)
35474 {
35475 direction = -1;
35476 }
35477 else
35478 {
35479 direction = 1;
35480 }
35481 }
35482 float num1526 = 2f;
35483 float num1527 = 0.1f;
35484 if (velocity.X > num1526 || velocity.X < 0f - num1526)
35485 {
35486 if (Math.Abs(velocity.X) < num1526 + num1527 * 2f)
35487 {
35488 if (velocity.X < 0f)
35489 {
35490 velocity.X = 0f - num1526;
35491 }
35492 else
35493 {
35494 velocity.X = num1526;
35495 }
35496 }
35497 else
35498 {
35499 velocity.X *= 0.99f;
35500 }
35501 }
35502 else
35503 {
35504 velocity.X += (float)direction * num1527;
35505 }
35507 }
35508 if (collideY)
35509 {
35510 this.ai[2] = 60f;
35511 directionY *= -1;
35512 velocity.Y *= -0.5f;
35513 }
35514 if (this.ai[2] > 0f)
35515 {
35516 this.ai[2] -= 1f;
35517 }
35518 else
35519 {
35520 int num1528 = (int)(base.Center.Y / 16f);
35521 int num1529 = (int)((base.Center.X - 8f) / 16f);
35522 int num1530 = 30;
35523 int num1531 = 15;
35524 int num1532 = 0;
35525 for (int num1533 = num1528; num1533 < num1528 + num1530; num1533++)
35526 {
35527 for (int num1534 = num1529; num1534 <= num1529 + 1; num1534++)
35528 {
35529 if (WorldGen.SolidTile(num1534, num1533) || Main.tile[num1534, num1533].liquid > 0)
35530 {
35532 break;
35533 }
35534 }
35535 if (num1532 != 0)
35536 {
35537 break;
35538 }
35539 }
35540 if (num1532 == 0)
35541 {
35542 directionY = 1;
35543 }
35544 else if (num1532 < num1531)
35545 {
35546 directionY = -1;
35547 }
35548 }
35549 float num1535 = 2f;
35550 float num1536 = 0.1f;
35551 if (velocity.Y > num1535 || velocity.Y < 0f - num1535)
35552 {
35553 if (Math.Abs(velocity.Y) < num1535 + num1536 * 2f)
35554 {
35555 if (velocity.Y < 0f)
35556 {
35557 velocity.Y = 0f - num1535;
35558 }
35559 else
35560 {
35561 velocity.Y = num1535;
35562 }
35563 }
35564 else
35565 {
35566 velocity.Y *= 0.99f;
35567 }
35568 }
35569 else
35570 {
35571 velocity.Y += (float)directionY * num1536;
35572 }
35573 }
35574 else if (aiStyle == 99)
35575 {
35576 if (velocity.Y == 0f && this.ai[0] == 0f)
35577 {
35578 this.ai[0] = 1f;
35579 this.ai[1] = 0f;
35580 netUpdate = true;
35581 return;
35582 }
35583 if (this.ai[0] == 1f)
35584 {
35587 this.ai[1]++;
35588 if (this.ai[1] >= 5f)
35589 {
35590 HitEffect(0, 9999.0);
35591 active = false;
35592 }
35593 return;
35594 }
35595 velocity.Y += 0.2f;
35596 if (velocity.Y > 12f)
35597 {
35598 velocity.Y = 12f;
35599 }
35600 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
35601 if (type != 519)
35602 {
35603 return;
35604 }
35605 if (localAI[0] == 0f)
35606 {
35607 localAI[0] = 1f;
35608 for (int num1537 = 0; num1537 < 13; num1537++)
35609 {
35610 int num1538 = Dust.NewDust(position, width, height, 6, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 2.5f);
35611 Main.dust[num1538].noGravity = true;
35612 Main.dust[num1538].fadeIn = 1f;
35613 Dust dust = Main.dust[num1538];
35614 dust.velocity *= 4f;
35615 Main.dust[num1538].noLight = true;
35616 }
35617 }
35618 for (int num1539 = 0; num1539 < 3; num1539++)
35619 {
35620 if (Main.rand.Next(3) < 2)
35621 {
35622 int num1540 = Dust.NewDust(position, width, height, 6, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 2.5f);
35623 Main.dust[num1540].noGravity = true;
35624 Dust dust = Main.dust[num1540];
35625 dust.velocity *= 0.2f;
35626 Main.dust[num1540].fadeIn = 1f;
35627 if (Main.rand.Next(6) == 0)
35628 {
35629 dust = Main.dust[num1540];
35630 dust.velocity *= 30f;
35631 Main.dust[num1540].noGravity = false;
35632 Main.dust[num1540].noLight = true;
35633 }
35634 else
35635 {
35636 Main.dust[num1540].velocity = DirectionFrom(Main.dust[num1540].position) * Main.dust[num1540].velocity.Length();
35637 }
35638 }
35639 }
35640 }
35641 else if (aiStyle == 100)
35642 {
35643 if (velocity.Y == 0f && this.ai[0] >= 0f)
35644 {
35645 this.ai[0] = -1f;
35646 this.ai[1] = 0f;
35647 netUpdate = true;
35648 return;
35649 }
35650 if (this.ai[0] == -1f)
35651 {
35654 this.ai[1]++;
35655 if (this.ai[1] >= 5f)
35656 {
35657 HitEffect(0, 9999.0);
35658 active = false;
35659 }
35660 return;
35661 }
35662 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
35663 if (type != 522)
35664 {
35665 return;
35666 }
35667 if (localAI[0] == 0f)
35668 {
35669 localAI[0] = 1f;
35670 velocity.X = this.ai[2];
35671 velocity.Y = this.ai[3];
35672 for (int num1541 = 0; num1541 < 13; num1541++)
35673 {
35674 int num1542 = Dust.NewDust(position, width, height, 261, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 2.5f);
35675 Main.dust[num1542].noGravity = true;
35676 Main.dust[num1542].fadeIn = 1f;
35677 Dust dust = Main.dust[num1542];
35678 dust.velocity *= 4f;
35679 Main.dust[num1542].noLight = true;
35680 }
35681 }
35682 for (int num1543 = 0; num1543 < 2; num1543++)
35683 {
35684 if (Main.rand.Next(10 - (int)Math.Min(7f, velocity.Length())) < 1)
35685 {
35686 int num1544 = Dust.NewDust(position, width, height, 261, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 2.5f);
35687 Main.dust[num1544].noGravity = true;
35688 Dust dust = Main.dust[num1544];
35689 dust.velocity *= 0.2f;
35690 Main.dust[num1544].fadeIn = 0.4f;
35691 if (Main.rand.Next(6) == 0)
35692 {
35693 dust = Main.dust[num1544];
35694 dust.velocity *= 5f;
35695 Main.dust[num1544].noLight = true;
35696 }
35697 else
35698 {
35699 Main.dust[num1544].velocity = DirectionFrom(Main.dust[num1544].position) * Main.dust[num1544].velocity.Length();
35700 }
35701 }
35702 }
35703 if (this.ai[0] >= 0f)
35704 {
35705 this.ai[0]++;
35706 if (this.ai[0] > 60f)
35707 {
35708 velocity = velocity.RotatedBy(this.ai[1]);
35709 }
35710 if (this.ai[0] > 120f)
35711 {
35712 velocity *= 0.98f;
35713 }
35714 if (velocity.Length() < 0.2f)
35715 {
35717 }
35718 }
35719 }
35720 else if (aiStyle == 101)
35721 {
35722 float num1545 = 420f;
35723 float num1546 = 120f;
35724 int num1547 = 1;
35725 float value11 = 0f;
35726 float value12 = 1f;
35727 float num1548 = 4f;
35728 bool flag97 = !(this.ai[1] >= 0f) || !Main.npc[(int)this.ai[0]].active;
35729 if (Main.npc[(int)this.ai[0]].type == 439)
35730 {
35731 if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 2)
35732 {
35733 num1547 = 2;
35734 }
35735 if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 4)
35736 {
35737 num1547 = 3;
35738 }
35739 }
35740 else
35741 {
35742 flag97 = true;
35743 }
35744 this.ai[1] += num1547;
35745 float num1549 = this.ai[1] / num1546;
35746 num1549 = MathHelper.Clamp(num1549, 0f, 1f);
35747 position = base.Center;
35749 base.Center = position;
35750 alpha = (int)(255f - num1549 * 255f);
35751 if (Main.rand.Next(6) == 0)
35752 {
35753 Vector2 vector297 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
35754 Dust dust21 = Main.dust[Dust.NewDust(base.Center - vector297 * 20f, 0, 0, 27)];
35755 dust21.noGravity = true;
35756 dust21.position = base.Center - vector297 * Main.rand.Next(10, 21) * scale;
35757 dust21.velocity = vector297.RotatedBy(1.5707963705062866) * 4f;
35758 dust21.scale = 0.5f + Main.rand.NextFloat();
35759 dust21.fadeIn = 0.5f;
35760 }
35761 if (Main.rand.Next(6) == 0)
35762 {
35763 Vector2 vector298 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
35764 Dust dust22 = Main.dust[Dust.NewDust(base.Center - vector298 * 30f, 0, 0, 240)];
35765 dust22.noGravity = true;
35766 dust22.position = base.Center - vector298 * 20f * scale;
35767 dust22.velocity = vector298.RotatedBy(-1.5707963705062866) * 2f;
35768 dust22.scale = 0.5f + Main.rand.NextFloat();
35769 dust22.fadeIn = 0.5f;
35770 }
35771 if (Main.rand.Next(6) == 0)
35772 {
35773 Vector2 vector299 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
35774 Dust dust23 = Main.dust[Dust.NewDust(base.Center - vector299 * 30f, 0, 0, 240)];
35775 dust23.position = base.Center - vector299 * 20f * scale;
35776 dust23.velocity = Vector2.Zero;
35777 dust23.scale = 0.5f + Main.rand.NextFloat();
35778 dust23.fadeIn = 0.5f;
35779 dust23.noLight = true;
35780 }
35781 localAI[0] += (float)Math.PI / 60f;
35782 localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(this.ai[1] * ((float)Math.PI * 2f) / 60f).Y * 0.25f;
35783 if (this.ai[1] >= num1545)
35784 {
35785 flag97 = true;
35786 if (Main.netMode != 1)
35787 {
35788 for (int num1550 = 0; num1550 < 4; num1550++)
35789 {
35790 Vector2 vector300 = new Vector2(0f, 0f - num1548).RotatedBy((float)Math.PI / 2f * (float)num1550);
35792 }
35793 }
35794 }
35795 if (flag97)
35796 {
35797 HitEffect(0, 9999.0);
35798 active = false;
35799 }
35800 }
35801 else if (aiStyle == 102)
35802 {
35803 bool flag98 = false;
35804 bool flag99 = false;
35805 bool flag100 = true;
35806 bool flag101 = false;
35807 int num1551 = 4;
35808 int num1552 = 3;
35809 int num1553 = 0;
35810 float num1554 = 0.2f;
35811 float num1555 = 2f;
35812 float num1556 = -0.2f;
35813 float num1557 = -4f;
35814 bool flag102 = true;
35815 float num1558 = 2f;
35816 float num1559 = 0.1f;
35817 float num1560 = 1f;
35818 float num1561 = 0.04f;
35819 bool flag103 = false;
35820 float num1562 = 0.96f;
35821 bool flag104 = true;
35822 if (type == 541)
35823 {
35824 flag102 = false;
35825 rotation = velocity.X * 0.04f;
35826 spriteDirection = ((direction > 0) ? 1 : (-1));
35827 num1553 = 3;
35828 num1556 = -0.1f;
35829 num1554 = 0.1f;
35830 float num1563 = (float)life / (float)lifeMax;
35831 num1558 += (1f - num1563) * 2f;
35832 num1559 += (1f - num1563) * 0.02f;
35833 if (num1563 < 0.5f)
35834 {
35835 knockBackResist = 0f;
35836 }
35838 Vector2 vector301 = base.BottomLeft + new Vector2(0f, -12f);
35839 Vector2 bottomRight = base.BottomRight;
35840 Vector2 vector302 = new Vector2(-spriteDirection * 10, -4f);
35841 Color color = new Color(222, 108, 48) * 0.7f;
35842 float num1564 = -0.3f + MathHelper.Max(velocity.Y * 2f, 0f);
35843 for (int num1565 = 0; num1565 < 2; num1565++)
35844 {
35845 if (Main.rand.Next(2) != 0)
35846 {
35847 Dust dust24 = Main.dust[Dust.NewDust(base.Bottom, 0, 0, 268)];
35848 dust24.position = new Vector2(MathHelper.Lerp(vector301.X, bottomRight.X, Main.rand.NextFloat()), MathHelper.Lerp(vector301.Y, bottomRight.Y, Main.rand.NextFloat())) + vector302;
35849 if (num1565 == 1)
35850 {
35851 dust24.position = base.Bottom + Utils.RandomVector2(Main.rand, -6f, 6f);
35852 }
35853 dust24.color = color;
35854 dust24.scale = 0.8f;
35855 dust24.velocity.Y += num1564;
35856 dust24.velocity.X += (float)spriteDirection * 0.2f;
35857 }
35858 }
35860 localAI[2] = 0f;
35861 if (this.ai[0] < 0f)
35862 {
35863 this.ai[0] = MathHelper.Min(this.ai[0] + 1f, 0f);
35864 }
35865 if (this.ai[0] > 0f)
35866 {
35867 flag104 = false;
35868 flag103 = true;
35869 this.ai[0]++;
35870 if (this.ai[0] >= 135f)
35871 {
35872 this.ai[0] = -300f;
35873 netUpdate = true;
35874 }
35875 Vector2 vector303 = base.Center + Vector2.UnitX * direction * 200f;
35876 Vector2 vector304 = base.Center + Vector2.UnitX * direction * 50f - Vector2.UnitY * 6f;
35877 if (this.ai[0] == 54f && Main.netMode != 1)
35878 {
35880 Vector2 vector305 = Main.player[target].Center + new Vector2(Main.player[target].velocity.X * 30f, 0f);
35881 if (Distance(vector305) < 2000f)
35882 {
35883 Point point16 = vector305.ToTileCoordinates();
35884 for (int num1566 = 0; num1566 < 1000; num1566++)
35885 {
35886 if (list.Count >= 3)
35887 {
35888 break;
35889 }
35890 bool flag105 = false;
35891 int num1567 = Main.rand.Next(point16.X - 30, point16.X + 30 + 1);
35892 foreach (Point item in list)
35893 {
35894 if (Math.Abs(item.X - num1567) < 10)
35895 {
35896 flag105 = true;
35897 break;
35898 }
35899 }
35900 if (!flag105)
35901 {
35902 int startY = point16.Y - 20;
35904 if (StrayMethods.CanSpawnSandstormHostile(new Vector2(num1567, bottomY - 15) * 16f, 15, 15))
35905 {
35906 list.Add(new Point(num1567, bottomY - 15));
35907 }
35908 }
35909 }
35910 foreach (Point item2 in list)
35911 {
35912 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), item2.X * 16, item2.Y * 16, 0f, 0f, 658, 0, 0f, Main.myPlayer);
35913 }
35914 }
35915 else
35916 {
35917 this.ai[0] = -200f;
35918 netUpdate = true;
35919 }
35920 }
35921 Vector2 vector306 = new Vector2(0.9f, 2f);
35922 if (this.ai[0] < 114f && this.ai[0] > 0f)
35923 {
35925 for (int num1568 = 0; num1568 < 1000; num1568++)
35926 {
35928 if (projectile12.active && projectile12.type == 658)
35929 {
35930 list2.Add(projectile12.Center);
35931 }
35932 }
35933 Vector2 vector307 = new Vector2(0f, 1500f);
35934 float num1569 = (this.ai[0] - 54f) / 30f;
35936 {
35937 foreach (Vector2 item3 in list2)
35938 {
35941 float num1570 = num1569;
35942 if (num1570 > 0.5f)
35943 {
35944 num1570 = 1f - num1570;
35945 }
35946 float num1571 = 2f;
35947 if (Vector2.Distance(value13, value14) > 5f)
35948 {
35949 num1571 = 3f;
35950 }
35951 if (Vector2.Distance(value13, value14) > 10f)
35952 {
35953 num1571 = 4f;
35954 }
35955 for (float num1572 = 0f; num1572 < num1571; num1572++)
35956 {
35957 Dust dust25 = Main.dust[Dust.NewDust(vector304, 0, 0, 269)];
35958 dust25.position = Vector2.Lerp(value13, value14, num1572 / num1571) + Utils.RandomVector2(Main.rand, -2f, 2f);
35959 dust25.noLight = true;
35960 dust25.scale = 0.3f + num1569;
35961 }
35962 }
35963 }
35964 }
35965 _ = this.ai[0];
35966 _ = 100f;
35967 }
35968 if (this.ai[0] == 0f)
35969 {
35970 this.ai[0] = 1f;
35971 netUpdate = true;
35972 flag103 = true;
35973 }
35974 }
35975 if (justHit)
35976 {
35977 localAI[2] = 0f;
35978 }
35979 if (!flag99)
35980 {
35981 if (localAI[2] >= 0f)
35982 {
35983 float num1573 = 16f;
35984 bool flag106 = false;
35985 bool flag107 = false;
35986 if (position.X > localAI[0] - num1573 && position.X < localAI[0] + num1573)
35987 {
35988 flag106 = true;
35989 }
35990 else if ((velocity.X < 0f && direction > 0) || (velocity.X > 0f && direction < 0))
35991 {
35992 flag106 = true;
35993 num1573 += 24f;
35994 }
35995 if (position.Y > localAI[1] - num1573 && position.Y < localAI[1] + num1573)
35996 {
35997 flag107 = true;
35998 }
35999 if (flag106 && flag107)
36000 {
36001 localAI[2] += 1f;
36002 if (localAI[2] >= 30f && num1573 == 16f)
36003 {
36004 flag98 = true;
36005 }
36006 if (localAI[2] >= 60f)
36007 {
36008 localAI[2] = -180f;
36009 direction *= -1;
36010 velocity.X *= -1f;
36011 collideX = false;
36012 }
36013 }
36014 else
36015 {
36016 localAI[0] = position.X;
36017 localAI[1] = position.Y;
36018 localAI[2] = 0f;
36019 }
36020 if (flag104)
36021 {
36022 TargetClosest();
36023 }
36024 }
36025 else
36026 {
36027 localAI[2] += 1f;
36028 direction = ((Main.player[target].Center.X > base.Center.X) ? 1 : (-1));
36029 }
36030 }
36031 int num1574 = (int)((position.X + (float)(width / 2)) / 16f) + direction * 2;
36032 int num1575 = (int)((position.Y + (float)height) / 16f);
36033 int num1576 = (int)base.Bottom.Y / 16;
36034 int num1577 = (int)base.Bottom.X / 16;
36035 if (flag103)
36036 {
36037 velocity *= num1562;
36038 return;
36039 }
36040 for (int num1578 = num1575; num1578 < num1575 + num1551; num1578++)
36041 {
36042 if (Main.tile[num1574, num1578] == null)
36043 {
36044 Main.tile[num1574, num1578] = new Tile();
36045 }
36046 if ((Main.tile[num1574, num1578].nactive() && Main.tileSolid[Main.tile[num1574, num1578].type]) || Main.tile[num1574, num1578].liquid > 0)
36047 {
36048 if (num1578 <= num1575 + 1)
36049 {
36050 flag101 = true;
36051 }
36052 flag100 = false;
36053 break;
36054 }
36055 }
36056 for (int num1579 = num1576; num1579 < num1576 + num1553; num1579++)
36057 {
36058 if (Main.tile[num1577, num1579] == null)
36059 {
36060 Main.tile[num1577, num1579] = new Tile();
36061 }
36062 if ((Main.tile[num1577, num1579].nactive() && Main.tileSolid[Main.tile[num1577, num1579].type]) || Main.tile[num1577, num1579].liquid > 0)
36063 {
36064 flag101 = true;
36065 flag100 = false;
36066 break;
36067 }
36068 }
36069 if (flag102)
36070 {
36071 for (int num1580 = num1575 - num1552; num1580 < num1575; num1580++)
36072 {
36073 if (Main.tile[num1574, num1580] == null)
36074 {
36075 Main.tile[num1574, num1580] = new Tile();
36076 }
36077 if ((Main.tile[num1574, num1580].nactive() && Main.tileSolid[Main.tile[num1574, num1580].type]) || Main.tile[num1574, num1580].liquid > 0)
36078 {
36079 flag101 = false;
36080 flag98 = true;
36081 break;
36082 }
36083 }
36084 }
36085 if (flag98)
36086 {
36087 flag101 = false;
36088 flag100 = true;
36089 }
36090 if (flag100)
36091 {
36092 velocity.Y += num1554;
36093 if (velocity.Y > num1555)
36094 {
36095 velocity.Y = num1555;
36096 }
36097 }
36098 else
36099 {
36101 {
36102 velocity.Y += num1556;
36103 }
36104 if (velocity.Y < num1557)
36105 {
36106 velocity.Y = num1557;
36107 }
36108 }
36109 if (collideX)
36110 {
36111 velocity.X = oldVelocity.X * -0.4f;
36112 if (direction == -1 && velocity.X > 0f && velocity.X < 1f)
36113 {
36114 velocity.X = 1f;
36115 }
36116 if (direction == 1 && velocity.X < 0f && velocity.X > -1f)
36117 {
36118 velocity.X = -1f;
36119 }
36120 }
36121 if (collideY)
36122 {
36123 velocity.Y = oldVelocity.Y * -0.25f;
36124 if (velocity.Y > 0f && velocity.Y < 1f)
36125 {
36126 velocity.Y = 1f;
36127 }
36128 if (velocity.Y < 0f && velocity.Y > -1f)
36129 {
36130 velocity.Y = -1f;
36131 }
36132 }
36133 if (direction == -1 && velocity.X > 0f - num1558)
36134 {
36135 velocity.X -= num1559;
36136 if (velocity.X > num1558)
36137 {
36138 velocity.X -= num1559;
36139 }
36140 else if (velocity.X > 0f)
36141 {
36142 velocity.X += num1559 / 2f;
36143 }
36144 if (velocity.X < 0f - num1558)
36145 {
36146 velocity.X = 0f - num1558;
36147 }
36148 }
36149 else if (direction == 1 && velocity.X < num1558)
36150 {
36151 velocity.X += num1559;
36152 if (velocity.X < 0f - num1558)
36153 {
36154 velocity.X += num1559;
36155 }
36156 else if (velocity.X < 0f)
36157 {
36158 velocity.X -= num1559 / 2f;
36159 }
36160 if (velocity.X > num1558)
36161 {
36162 velocity.X = num1558;
36163 }
36164 }
36165 if (directionY == -1 && velocity.Y > 0f - num1560)
36166 {
36167 velocity.Y -= num1561;
36168 if (velocity.Y > num1560)
36169 {
36170 velocity.Y -= num1561 * 1.25f;
36171 }
36172 else if (velocity.Y > 0f)
36173 {
36174 velocity.Y += num1561 * 0.75f;
36175 }
36176 if (velocity.Y < 0f - num1560)
36177 {
36178 velocity.Y = 0f - num1558;
36179 }
36180 }
36181 else if (directionY == 1 && velocity.Y < num1560)
36182 {
36183 velocity.Y += num1561;
36184 if (velocity.Y < 0f - num1560)
36185 {
36186 velocity.Y += num1561 * 1.25f;
36187 }
36188 else if (velocity.Y < 0f)
36189 {
36190 velocity.Y -= num1561 * 0.75f;
36191 }
36192 if (velocity.Y > num1560)
36193 {
36194 velocity.Y = num1560;
36195 }
36196 }
36197 }
36198 else if (aiStyle == 103)
36199 {
36200 if (direction == 0)
36201 {
36202 TargetClosest();
36203 }
36204 bool flag108 = true;
36205 Point pt = base.Center.ToTileCoordinates();
36208 flag108 |= wet;
36209 bool flag109 = false;
36210 TargetClosest(faceTarget: false);
36211 Vector2 vector308 = targetRect.Center.ToVector2();
36212 if (Main.player[target].velocity.Y > -0.1f && !Main.player[target].dead && Distance(vector308) > 150f)
36213 {
36214 flag109 = true;
36215 }
36216 if (localAI[0] == -1f && !flag108)
36217 {
36218 localAI[0] = 20f;
36219 }
36220 if (localAI[0] > 0f)
36221 {
36222 localAI[0]--;
36223 }
36224 if (flag108)
36225 {
36226 if (soundDelay == 0)
36227 {
36228 float num1581 = Distance(vector308) / 40f;
36229 if (num1581 < 10f)
36230 {
36231 num1581 = 10f;
36232 }
36233 if (num1581 > 20f)
36234 {
36235 num1581 = 20f;
36236 }
36237 soundDelay = (int)num1581;
36238 SoundEngine.PlaySound(15, base.Center, 4);
36239 }
36240 float num1582 = this.ai[1];
36241 bool flag110 = false;
36242 pt = (base.Center + new Vector2(0f, 24f)).ToTileCoordinates();
36245 {
36246 flag110 = true;
36247 }
36248 this.ai[1] = flag110.ToInt();
36249 if (this.ai[2] < 30f)
36250 {
36251 this.ai[2]++;
36252 }
36253 if (flag109)
36254 {
36255 TargetClosest();
36256 velocity.X += (float)direction * 0.15f;
36257 velocity.Y += (float)directionY * 0.15f;
36258 if (velocity.X > 5f)
36259 {
36260 velocity.X = 5f;
36261 }
36262 if (velocity.X < -5f)
36263 {
36264 velocity.X = -5f;
36265 }
36266 if (velocity.Y > 3f)
36267 {
36268 velocity.Y = 3f;
36269 }
36270 if (velocity.Y < -3f)
36271 {
36272 velocity.Y = -3f;
36273 }
36274 Vector2 vec4 = base.Center + velocity.SafeNormalize(Vector2.Zero) * base.Size.Length() / 2f + velocity;
36275 pt = vec4.ToTileCoordinates();
36278 if (!flag111 && wet)
36279 {
36280 flag111 = tileSafely7.liquid > 0;
36281 }
36282 int num1583 = 400;
36283 if (Main.remixWorld)
36284 {
36285 num1583 = 700;
36286 }
36287 if (!flag111 && Math.Sign(velocity.X) == direction && Distance(vector308) < (float)num1583 && (this.ai[2] >= 30f || this.ai[2] < 0f))
36288 {
36289 if (localAI[0] == 0f)
36290 {
36291 SoundEngine.PlaySound(14, base.Center, 542);
36292 localAI[0] = -1f;
36293 }
36294 this.ai[2] = -30f;
36295 Vector2 vector309 = DirectionTo(vector308 + new Vector2(0f, -80f));
36296 velocity = vector309 * 12f;
36297 }
36298 }
36299 else
36300 {
36301 if (collideX)
36302 {
36303 velocity.X *= -1f;
36304 direction *= -1;
36305 netUpdate = true;
36306 }
36307 if (collideY)
36308 {
36309 netUpdate = true;
36310 velocity.Y *= -1f;
36312 this.ai[0] = directionY;
36313 }
36314 float num1584 = 6f;
36315 velocity.X += (float)direction * 0.1f;
36316 if (velocity.X < 0f - num1584 || velocity.X > num1584)
36317 {
36318 velocity.X *= 0.95f;
36319 }
36320 if (flag110)
36321 {
36322 this.ai[0] = -1f;
36323 }
36324 else
36325 {
36326 this.ai[0] = 1f;
36327 }
36328 float num1585 = 0.06f;
36329 float num1586 = 0.01f;
36330 if (this.ai[0] == -1f)
36331 {
36332 velocity.Y -= num1586;
36333 if (velocity.Y < 0f - num1585)
36334 {
36335 this.ai[0] = 1f;
36336 }
36337 }
36338 else
36339 {
36340 velocity.Y += num1586;
36341 if (velocity.Y > num1585)
36342 {
36343 this.ai[0] = -1f;
36344 }
36345 }
36346 if (velocity.Y > 0.4f || velocity.Y < -0.4f)
36347 {
36348 velocity.Y *= 0.95f;
36349 }
36350 }
36351 }
36352 else
36353 {
36354 if (velocity.Y == 0f)
36355 {
36356 if (flag109)
36357 {
36358 TargetClosest();
36359 }
36360 float num1587 = 1f;
36361 velocity.X += (float)direction * 0.1f;
36362 if (velocity.X < 0f - num1587 || velocity.X > num1587)
36363 {
36364 velocity.X *= 0.95f;
36365 }
36366 }
36367 velocity.Y += 0.3f;
36368 if (velocity.Y > 10f)
36369 {
36370 velocity.Y = 10f;
36371 }
36372 this.ai[0] = 1f;
36373 }
36374 rotation = velocity.Y * (float)direction * 0.1f;
36375 if (rotation < -0.2f)
36376 {
36377 rotation = -0.2f;
36378 }
36379 if (rotation > 0.2f)
36380 {
36381 rotation = 0.2f;
36382 }
36383 }
36384 else if (aiStyle == 104)
36385 {
36386 active = false;
36387 }
36388 else if (aiStyle == 105)
36389 {
36390 if (alpha == 0)
36391 {
36392 Lighting.AddLight(base.Center, 1.3f, 0.5f, 1.5f);
36393 }
36394 if (this.ai[1] == 0f)
36395 {
36396 if (this.ai[0] > 0f)
36397 {
36398 this.ai[0]--;
36399 }
36400 if (this.ai[0] != 0f)
36401 {
36402 return;
36403 }
36404 this.ai[0] = 180f;
36405 netUpdate = true;
36406 if (localAI[0] == 0f)
36407 {
36409 localAI[0] = 1f;
36410 xLeftEnd.X += 2;
36411 xRightEnd.X -= 2;
36413 Main.npc[num1588].Bottom = xLeftEnd.ToWorldCoordinates(8f, 16f);
36415 Main.npc[num1588].Bottom = xRightEnd.ToWorldCoordinates(8f, 16f);
36416 if (Main.netMode != 1)
36417 {
36419 }
36420 }
36421 }
36422 else if (this.ai[1] == 2f)
36423 {
36425 life = lifeMax;
36426 if (this.ai[0] == 3f)
36427 {
36429 for (int num1589 = 0; num1589 < 200; num1589++)
36430 {
36432 if (nPC11.active && nPC11.type == 549)
36433 {
36434 nPC11.ai[1] = 1f;
36435 nPC11.ai[0] = 0f;
36436 nPC11.netUpdate = true;
36437 }
36438 }
36439 if (Main.netMode != 1)
36440 {
36442 }
36443 }
36444 this.ai[0]++;
36445 noGravity = true;
36446 if (this.ai[0] <= 120f)
36447 {
36448 float num1590 = this.ai[0] / 120f;
36449 velocity.Y = (float)Math.Cos(num1590 * ((float)Math.PI * 2f)) * 0.25f - 0.25f;
36450 }
36451 else
36452 {
36453 velocity.Y = 0f;
36454 }
36455 float lerpValue = Utils.GetLerpValue(480f, 570f, this.ai[0], clamped: true);
36456 if (lerpValue != 0f)
36457 {
36459 }
36460 if (this.ai[0] >= 600f)
36461 {
36462 DD2Event.StopInvasion(win: true);
36463 dontTakeDamage = false;
36464 life = 0;
36465 checkDead();
36466 netUpdate = true;
36467 }
36468 if (true)
36469 {
36470 Vector2 vector310 = base.Center + new Vector2(0f, -20f);
36471 float num1591 = 0.99f;
36472 if (this.ai[0] >= 60f)
36473 {
36474 num1591 = 0.79f;
36475 }
36476 if (this.ai[0] >= 120f)
36477 {
36478 num1591 = 0.58f;
36479 }
36480 if (this.ai[0] >= 180f)
36481 {
36482 num1591 = 0.43f;
36483 }
36484 if (this.ai[0] >= 240f)
36485 {
36486 num1591 = 0.33f;
36487 }
36488 if (this.ai[0] >= 540f)
36489 {
36490 num1591 = 1f;
36491 }
36492 for (int num1592 = 0; num1592 < 9; num1592++)
36493 {
36494 if (!(Main.rand.NextFloat() < num1591))
36495 {
36496 float num1593 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
36497 float num1594 = Main.rand.NextFloat();
36498 Vector2 vector311 = vector310 + num1593.ToRotationVector2() * (110f + 600f * num1594);
36499 Vector2 vector312 = (num1593 - (float)Math.PI).ToRotationVector2() * (14f + 0f * Main.rand.NextFloat() + 8f * num1594);
36501 dust26.scale = 0.9f;
36502 dust26.fadeIn = 1.15f + num1594 * 0.3f;
36503 dust26.color = new Color(1f, 1f, 1f, num1591) * (1f - num1591);
36504 dust26.noGravity = true;
36505 dust26.noLight = true;
36506 }
36507 }
36508 }
36509 if (this.ai[0] == 100f || this.ai[0] == 160f || this.ai[0] == 220f || this.ai[0] == 280f || this.ai[0] == 340f || this.ai[0] == 370f || this.ai[0] == 400f || this.ai[0] == 430f || this.ai[0] == 460f || this.ai[0] == 500f || this.ai[0] == 520f || this.ai[0] == 540f)
36510 {
36511 float num1595 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
36512 float num1596 = 120f;
36513 for (int num1597 = 0; (float)num1597 < num1596; num1597++)
36514 {
36515 float num1598 = (float)num1597 / num1596 * ((float)Math.PI * 2f);
36516 float num1599 = Main.rand.NextFloat();
36517 Vector2 vector313 = base.Center + new Vector2(0f, -20f) + num1598.ToRotationVector2() * (810f - this.ai[0]);
36518 Vector2 vector314 = (num1598 - (float)Math.PI).ToRotationVector2() * (14f + 5f * (this.ai[0] / 600f) + 8f * num1599);
36520 dust27.scale = 0.9f;
36521 dust27.fadeIn = 1.15f + num1599 * 0.3f;
36522 dust27.color = new Color(1f, 1f, 1f, 0f);
36523 dust27.noGravity = true;
36524 dust27.noLight = true;
36525 }
36526 }
36527 }
36528 else
36529 {
36530 if (this.ai[1] != 1f)
36531 {
36532 return;
36533 }
36535 life = lifeMax;
36536 if (this.ai[0] == 0f)
36537 {
36538 for (int num1600 = 0; num1600 < 200; num1600++)
36539 {
36541 if (nPC12.active && nPC12.type == 549)
36542 {
36543 nPC12.ai[1] = 1f;
36544 nPC12.ai[0] = 0f;
36545 nPC12.netUpdate = true;
36546 }
36547 }
36548 if (Main.netMode != 1)
36549 {
36552 }
36553 }
36554 this.ai[0]++;
36555 float lerpValue2 = Utils.GetLerpValue(480f, 600f, this.ai[0], clamped: true);
36556 if (lerpValue2 != 0f)
36557 {
36559 }
36560 float num1601 = 96f;
36561 if (this.ai[0] < num1601)
36562 {
36563 velocity.Y = MathHelper.Lerp(0f, -1f, this.ai[0] / num1601);
36564 }
36565 if (this.ai[0] >= num1601)
36566 {
36567 alpha += 50;
36568 if (alpha > 255)
36569 {
36570 alpha = 255;
36571 }
36572 }
36573 if (true)
36574 {
36575 Vector2 vector315 = base.Center + new Vector2(0f, MathHelper.Lerp(0f, -70f, Utils.GetLerpValue(0f, 300f, this.ai[0], clamped: true)));
36576 float num1602 = 0.99f;
36577 if (this.ai[0] >= 60f)
36578 {
36579 num1602 = 0.79f;
36580 }
36581 if (this.ai[0] >= 120f)
36582 {
36583 num1602 = 0.58f;
36584 }
36585 if (this.ai[0] >= 180f)
36586 {
36587 num1602 = 0.23f;
36588 }
36589 if (this.ai[0] >= 240f)
36590 {
36591 num1602 = 0.35f;
36592 }
36593 if (this.ai[0] >= 300f)
36594 {
36595 num1602 = 0.6f;
36596 }
36597 if (this.ai[0] >= 360f)
36598 {
36599 num1602 = 0.98f;
36600 }
36601 if (this.ai[0] >= 420f)
36602 {
36603 num1602 = 0.995f;
36604 }
36605 if (this.ai[0] >= 450f)
36606 {
36607 num1602 = 1f;
36608 }
36609 for (int num1603 = 0; num1603 < 12; num1603++)
36610 {
36611 if (!(Main.rand.NextFloat() < num1602))
36612 {
36613 float num1604 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
36614 float num1605 = Main.rand.NextFloat();
36615 Vector2 vector316 = vector315 + num1604.ToRotationVector2() * (70f + 600f * num1605);
36616 Vector2 vector317 = (num1604 - (float)Math.PI / 2f - (float)Math.PI / 8f).ToRotationVector2() * (12f + 9f * Main.rand.NextFloat() + 4f * num1605);
36618 dust28.scale = 0.8f;
36619 dust28.fadeIn = 0.95f + num1605 * 0.3f;
36620 dust28.noGravity = true;
36621 }
36622 }
36623 }
36624 if (this.ai[0] >= 600f)
36625 {
36627 if (!Main.dedServ)
36628 {
36629 Filters.Scene.Deactivate("CrystalDestructionVortex");
36630 Filters.Scene.Deactivate("CrystalDestructionColor");
36631 Filters.Scene.Deactivate("CrystalWin");
36632 }
36633 dontTakeDamage = false;
36634 life = 0;
36635 checkDead();
36636 netUpdate = true;
36637 }
36638 }
36639 }
36640 else if (aiStyle == 106)
36641 {
36642 if (alpha == 0)
36643 {
36644 Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f);
36645 }
36646 SlotId val;
36647 if (this.ai[1] == 0f)
36648 {
36649 if (localAI[0] == 0f)
36650 {
36652 float[] array6 = localAI;
36653 val = SlotId.Invalid;
36654 array6[3] = ((SlotId)(ref val)).ToFloat();
36655 }
36656 if (localAI[0] > 150f)
36657 {
36659 if (activeSound == null)
36660 {
36661 float[] array7 = localAI;
36663 array7[3] = ((SlotId)(ref val)).ToFloat();
36664 }
36665 }
36667 {
36668 this.ai[0]++;
36669 }
36670 if (this.ai[0] >= (float)DD2Event.LaneSpawnRate)
36671 {
36672 if (this.ai[0] >= (float)(DD2Event.LaneSpawnRate * 3))
36673 {
36674 this.ai[0] = 0f;
36675 }
36676 netUpdate = true;
36677 if (Main.netMode != 1 && (int)this.ai[0] % DD2Event.LaneSpawnRate == 0)
36678 {
36681 {
36682 this.ai[0] += 1f;
36683 }
36684 }
36685 }
36686 localAI[0]++;
36687 if (localAI[0] > 180f)
36688 {
36689 localAI[0] = 180f;
36690 }
36691 if (Main.netMode != 1 && localAI[0] >= 180f)
36692 {
36693 if (AnyNPCs(548))
36694 {
36695 dontTakeDamage = true;
36696 return;
36697 }
36698 this.ai[1] = 1f;
36699 this.ai[0] = 0f;
36700 dontTakeDamage = true;
36701 }
36702 }
36703 else if (this.ai[1] == 1f)
36704 {
36705 this.ai[0]++;
36706 scale = MathHelper.Lerp(1f, 0.05f, Utils.GetLerpValue(500f, 600f, this.ai[0], clamped: true));
36708 if (activeSound2 == null)
36709 {
36710 float[] array8 = localAI;
36712 array8[3] = ((SlotId)(ref val)).ToFloat();
36713 }
36715 if (activeSound2 != null)
36716 {
36717 activeSound2.Volume = scale;
36718 }
36719 if (this.ai[0] >= 550f)
36720 {
36721 dontTakeDamage = false;
36722 life = 0;
36723 checkDead();
36724 netUpdate = true;
36725 activeSound2?.Stop();
36726 }
36727 }
36728 }
36729 else if (aiStyle == 107)
36730 {
36732 }
36733 else if (aiStyle == 108)
36734 {
36736 }
36737 else if (aiStyle == 109)
36738 {
36740 }
36741 else if (aiStyle == 110)
36742 {
36743 AI_110_Betsy();
36744 }
36745 else if (aiStyle == 111)
36746 {
36748 }
36749 else if (aiStyle == 112)
36750 {
36752 }
36753 else if (aiStyle == 113)
36754 {
36756 }
36757 else if (aiStyle == 114)
36758 {
36760 }
36761 else if (aiStyle == 115)
36762 {
36764 }
36765 else if (aiStyle == 116)
36766 {
36768 }
36769 else if (aiStyle == 117)
36770 {
36772 }
36773 else if (aiStyle == 118)
36774 {
36776 }
36777 else if (aiStyle == 119)
36778 {
36780 }
36781 else if (aiStyle == 120)
36782 {
36784 }
36785 else if (aiStyle == 121)
36786 {
36788 }
36789 else if (aiStyle == 122)
36790 {
36792 }
36793 else if (aiStyle == 123)
36794 {
36796 }
36797 else if (aiStyle == 124)
36798 {
36800 }
36801 else if (aiStyle == 125)
36802 {
36804 }
36805 }
36806
36808 {
36809 velocity.Y += 0.2f;
36810 }
36811
36813 {
36814 if (localAI[0] == 0f && Main.netMode != 1)
36815 {
36816 TargetClosest();
36817 localAI[0] = 1f;
36818 netUpdate = true;
36819 }
36821 rotation = velocity.X * 0.05f;
36823 float num = float.PositiveInfinity;
36824 int num2 = 0;
36826 if (!targetData.Invalid)
36827 {
36828 zero = targetData.Center - base.Bottom;
36829 if (zero.Y < 0f)
36830 {
36831 num2 = (int)zero.Y / -16;
36832 }
36833 num = zero.Length();
36834 if (direction != Math.Sign(zero.X))
36835 {
36836 num2 = 0;
36837 }
36838 }
36839 if (wet || collideX || (collideY && oldVelocity.Y < 0f))
36840 {
36841 float num3 = oldVelocity.X + (float)(direction * 8);
36842 position.X -= num3;
36843 TargetClosest(faceTarget: false);
36844 direction *= -1;
36845 velocity.X = direction * 2;
36846 life = -1;
36847 HitEffect();
36848 active = false;
36849 netUpdate = true;
36851 return;
36852 }
36853 if (collideY)
36854 {
36855 velocity.Y = ((oldVelocity.Y > 0f) ? 1 : (-1));
36856 TargetClosest(faceTarget: false);
36857 }
36858 float num4 = 3f + Math.Abs(Main.windSpeedTarget) * 2f;
36860 {
36861 velocity.X += (float)direction * 0.04f;
36862 if (velocity.X * (float)direction < 0f)
36863 {
36864 if (Math.Abs(velocity.X) > num4)
36865 {
36866 velocity.X += (float)direction * 0.15f;
36867 }
36868 else
36869 {
36870 velocity.X += (float)direction * 0.1f;
36871 }
36872 }
36873 else if (Math.Abs(velocity.X) > num4)
36874 {
36875 velocity.X = (float)direction * num4;
36876 }
36877 }
36878 int num5 = (int)((position.X + (float)(width / 2)) / 16f) + direction;
36879 int num6 = (int)((position.Y + (float)height) / 16f);
36880 bool flag = true;
36881 int num7 = 8 + num2;
36882 bool flag2 = false;
36883 for (int i = num6; i < num6 + num7; i++)
36884 {
36885 if (Main.tile[num5, i] == null)
36886 {
36887 Main.tile[num5, i] = new Tile();
36888 }
36889 if ((Main.tile[num5, i].nactive() && Main.tileSolid[Main.tile[num5, i].type]) || Main.tile[num5, i].liquid > 0)
36890 {
36891 if (i < num6 + 5 + num2)
36892 {
36893 flag2 = true;
36894 }
36895 flag = false;
36896 break;
36897 }
36898 }
36899 if (num < 400f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
36900 {
36901 float num8 = 2f;
36902 float num9 = 0.035f;
36903 if (base.Center.Y + (float)(height / 4) > Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y > 0f - num8)
36904 {
36905 velocity.Y -= num9;
36906 if (velocity.Y > 0f)
36907 {
36908 velocity.Y -= num9;
36909 }
36910 }
36911 else if (base.Center.Y + (float)(height / 4) < Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y < num8)
36912 {
36913 velocity.Y += num9;
36914 if (velocity.Y < 0f)
36915 {
36916 velocity.Y += num9;
36917 }
36918 }
36919 }
36920 else
36921 {
36922 if (flag)
36923 {
36924 velocity.Y += 0.05f;
36925 }
36926 else
36927 {
36928 velocity.Y -= 0.1f;
36929 }
36930 if (flag2)
36931 {
36932 velocity.Y -= 0.2f;
36933 }
36934 if (velocity.Y > 2f)
36935 {
36936 velocity.Y = 2f;
36937 }
36938 if (velocity.Y < -4f)
36939 {
36940 velocity.Y = -4f;
36941 }
36942 }
36943 }
36944
36946 {
36947 List<int> list = new List<int>();
36948 if (CountNPCS(405) + CountNPCS(406) < 2)
36949 {
36950 list.Add(405);
36951 }
36952 if (CountNPCS(402) < 2)
36953 {
36954 list.Add(402);
36955 }
36956 if (CountNPCS(407) < 1)
36957 {
36958 list.Add(407);
36959 }
36960 if (list.Count > 0)
36961 {
36962 int num = Utils.SelectRandom(Main.rand, list.ToArray());
36963 ai[1] = 30 * Main.rand.Next(5, 16);
36964 int num2 = Main.rand.Next(3, 6);
36965 int num3 = Main.rand.Next(0, 4);
36966 int num4 = 0;
36969 list2.Add(Tuple.Create(base.Top - Vector2.UnitY * 120f, num2, 0));
36970 int num5 = 0;
36971 int num6 = list2.Count;
36972 while (list2.Count > 0)
36973 {
36974 Vector2 item = list2[0].Item1;
36975 int num7 = 1;
36976 int num8 = 1;
36977 if (num5 > 0 && num3 > 0 && (Main.rand.Next(3) != 0 || num5 == 1))
36978 {
36979 num8 = Main.rand.Next(Math.Max(1, list2[0].Item2));
36980 num7++;
36981 num3--;
36982 }
36983 for (int i = 0; i < num7; i++)
36984 {
36985 int num9 = list2[0].Item3;
36986 if (num5 == 0)
36987 {
36988 num9 = Utils.SelectRandom<int>(Main.rand, -1, 1);
36989 }
36990 else if (i == 1)
36991 {
36992 num9 *= -1;
36993 }
36994 float num10 = ((num5 % 2 == 0) ? 0f : ((float)Math.PI)) + (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f) + (float)num9 * ((float)Math.PI / 4f) * (float)(num5 % 2 == 0).ToDirectionInt();
36995 float num11 = 100f + 50f * Main.rand.NextFloat();
36996 int num12 = list2[0].Item2;
36997 if (i != 0)
36998 {
36999 num12 = num8;
37000 }
37001 if (num5 == 0)
37002 {
37003 num10 = (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f);
37004 num11 = 100f + 100f * Main.rand.NextFloat();
37005 }
37006 Vector2 vector = (-Vector2.UnitY).RotatedBy(num10) * num11;
37007 if (num12 - 1 < 0)
37008 {
37010 }
37011 num4 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), item.X, item.Y, vector.X, vector.Y, 540, 0, 0f, Main.myPlayer, (float)(-num5) * 10f, 0.5f + Main.rand.NextFloat() * 0.5f);
37012 list3.Add(item + vector);
37013 if (num5 < num2 && list2[0].Item2 > 0)
37014 {
37015 list2.Add(Tuple.Create(item + vector, num12 - 1, num9));
37016 }
37017 }
37018 list2.Remove(list2[0]);
37019 if (--num6 == 0)
37020 {
37021 num6 = list2.Count;
37022 num5++;
37023 }
37024 }
37025 Main.projectile[num4].localAI[0] = num;
37026 }
37027 else
37028 {
37029 ai[1] = 30f;
37030 }
37031 }
37032
37034 {
37035 List<int> list = new List<int>();
37036 if (CountNPCS(405) + CountNPCS(406) < 2)
37037 {
37038 list.Add(405);
37039 }
37040 if (CountNPCS(402) < 3)
37041 {
37042 list.Add(402);
37043 }
37044 if (CountNPCS(407) < 1)
37045 {
37046 list.Add(407);
37047 }
37048 if (list.Count <= 0)
37049 {
37050 return;
37051 }
37052 int num = Utils.SelectRandom(Main.rand, list.ToArray());
37053 int num2 = Main.rand.Next(3, 6);
37054 int num3 = Main.rand.Next(0, 4);
37055 int num4 = 0;
37058 list2.Add(Tuple.Create(base.Center, num2, 0));
37059 int num5 = 0;
37060 int num6 = list2.Count;
37061 while (list2.Count > 0)
37062 {
37063 Vector2 item = list2[0].Item1;
37064 int num7 = 1;
37065 int num8 = 1;
37066 if (num5 > 0 && num3 > 0 && (Main.rand.Next(3) != 0 || num5 == 1))
37067 {
37068 num8 = Main.rand.Next(Math.Max(1, list2[0].Item2));
37069 num7++;
37070 num3--;
37071 }
37072 for (int i = 0; i < num7; i++)
37073 {
37074 int num9 = list2[0].Item3;
37075 if (num5 == 0)
37076 {
37077 num9 = Utils.SelectRandom<int>(Main.rand, -1, 1);
37078 }
37079 else if (i == 1)
37080 {
37081 num9 *= -1;
37082 }
37083 float num10 = ((num5 % 2 == 0) ? 0f : ((float)Math.PI)) + (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f) + (float)num9 * ((float)Math.PI / 4f) * (float)(num5 % 2 == 0).ToDirectionInt();
37084 float num11 = 100f + 50f * Main.rand.NextFloat();
37085 int num12 = list2[0].Item2;
37086 if (i != 0)
37087 {
37088 num12 = num8;
37089 }
37090 if (num5 == 0)
37091 {
37092 num10 = (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f);
37093 num11 = 100f + 100f * Main.rand.NextFloat();
37094 }
37095 Vector2 vector = (-Vector2.UnitY).RotatedBy(num10) * num11;
37096 if (num12 - 1 < 0)
37097 {
37099 }
37100 num4 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), item.X, item.Y, vector.X, vector.Y, 540, 0, 0f, Main.myPlayer, (float)(-num5) * 10f, 0.5f + Main.rand.NextFloat() * 0.5f);
37101 list3.Add(item + vector);
37102 if (num5 < num2 && list2[0].Item2 > 0)
37103 {
37104 list2.Add(Tuple.Create(item + vector, num12 - 1, num9));
37105 }
37106 }
37107 list2.Remove(list2[0]);
37108 if (--num6 == 0)
37109 {
37110 num6 = list2.Count;
37111 num5++;
37112 }
37113 }
37114 Main.projectile[num4].localAI[0] = num;
37115 }
37116
37117 public static bool IsDeerclopsHostile()
37118 {
37119 if (deerclopsBoss == -1)
37120 {
37121 return false;
37122 }
37124 if (!nPC.active || nPC.type != 668)
37125 {
37126 return false;
37127 }
37128 int num = (int)nPC.ai[0];
37129 if (num == 6 || num == 7 || num == 8)
37130 {
37132 rectangle.Inflate(960, 960);
37133 if (!nPC.Hitbox.Intersects(rectangle))
37134 {
37135 return false;
37136 }
37137 }
37138 return true;
37139 }
37140
37141 private void AI_123_Deerclops()
37142 {
37144 int num = 15;
37146 bool haltMovement = false;
37147 bool goHome = false;
37148 bool flag = Distance(targetData.Center) >= 450f;
37149 localAI[3] = MathHelper.Clamp(localAI[3] + (float)flag.ToDirectionInt(), 0f, 30f);
37150 dontTakeDamage = localAI[3] >= 30f;
37151 float lifePercent = (float)life / (float)lifeMax;
37152 bool expertMode = Main.expertMode;
37153 int shadowHandDamage = 10;
37154 float num2 = Utils.Remap(localAI[3], 0f, 30f, 0f, 1f);
37155 if (num2 > 0f)
37156 {
37157 float num3 = Main.rand.NextFloat() * num2 * 3f;
37158 while (num3 > 0f)
37159 {
37160 num3 -= 1f;
37161 Dust.NewDustDirect(position, width, height, 109, 0f, -3f, 0, default(Color), 1.4f).noGravity = true;
37162 }
37163 }
37164 if (homeTileX == -1 && homeTileY == -1)
37165 {
37166 Point point = base.Bottom.ToTileCoordinates();
37167 homeTileX = point.X;
37168 homeTileY = point.Y;
37169 this.ai[2] = homeTileX;
37170 this.ai[3] = homeTileY;
37171 netUpdate = true;
37172 timeLeft = 86400;
37173 }
37175 if (timeLeft < 0)
37176 {
37177 timeLeft = 0;
37178 }
37179 homeTileX = (int)this.ai[2];
37180 homeTileY = (int)this.ai[3];
37181 if (!expertMode)
37182 {
37183 localAI[2] = 0f;
37184 }
37185 if (expertMode && Main.netMode != 1)
37186 {
37188 }
37189 switch ((int)this.ai[0])
37190 {
37191 case -1:
37192 localAI[3] = -10f;
37193 break;
37194 case 6:
37195 {
37196 TargetClosest(faceTarget: false);
37198 if (Main.netMode != 1)
37199 {
37200 if (!ShouldRunAway(ref targetData, isChasing: false))
37201 {
37202 this.ai[0] = 0f;
37203 this.ai[1] = 0f;
37204 localAI[1] = 0f;
37205 netUpdate = true;
37206 break;
37207 }
37208 if (timeLeft <= 0)
37209 {
37210 this.ai[0] = 8f;
37211 this.ai[1] = 0f;
37212 localAI[1] = 0f;
37213 netUpdate = true;
37214 break;
37215 }
37216 }
37217 if (direction != oldDirection)
37218 {
37219 netUpdate = true;
37220 }
37221 goHome = true;
37222 this.ai[1] += 1f;
37223 Vector2 other = new Vector2(homeTileX * 16, homeTileY * 16);
37224 bool flag2 = base.Top.Y > other.Y + 1600f;
37225 bool num4 = Distance(other) < 1020f;
37226 Distance(targetData.Center);
37227 float num5 = this.ai[1] % 600f;
37228 if (num4 && num5 < 420f)
37229 {
37230 haltMovement = true;
37231 }
37232 bool flag3 = false;
37233 int num6 = 300;
37234 if (flag2 && this.ai[1] >= (float)num6)
37235 {
37236 flag3 = true;
37237 }
37238 int num7 = 1500;
37239 if (!num4 && this.ai[1] >= (float)num7)
37240 {
37241 flag3 = true;
37242 }
37243 if (flag3)
37244 {
37245 this.ai[0] = 7f;
37246 this.ai[1] = 0f;
37247 localAI[1] = 0f;
37248 netUpdate = true;
37249 }
37250 break;
37251 }
37252 case 0:
37253 {
37254 TargetClosest();
37257 {
37258 this.ai[0] = 6f;
37259 this.ai[1] = 0f;
37260 localAI[1] = 0f;
37261 netUpdate = true;
37262 break;
37263 }
37264 this.ai[1] += 1f;
37265 Vector2 vector = base.Bottom + new Vector2(0f, -32f);
37266 Vector2 vector2 = targetData.Hitbox.ClosestPointInRect(vector);
37268 (vector2 - base.Center).Length();
37269 float num15 = 0.6f;
37270 bool flag4 = Math.Abs(vector3.X) >= Math.Abs(vector3.Y) * num15 || vector3.Length() < 48f;
37271 bool flag5 = vector3.Y <= (float)(100 + targetData.Height) && vector3.Y >= -200f;
37272 if (Math.Abs(vector3.X) < 120f && flag5 && velocity.Y == 0f && localAI[1] >= 2f)
37273 {
37274 velocity.X = 0f;
37275 this.ai[0] = 4f;
37276 this.ai[1] = 0f;
37277 localAI[1] = 0f;
37278 netUpdate = true;
37279 break;
37280 }
37281 if (Math.Abs(vector3.X) < 120f && flag5 && velocity.Y == 0f && flag4)
37282 {
37283 velocity.X = 0f;
37284 this.ai[0] = 1f;
37285 this.ai[1] = 0f;
37286 localAI[1] += 1f;
37287 netUpdate = true;
37288 break;
37289 }
37290 bool flag6 = this.ai[1] >= 240f;
37291 if (velocity.Y == 0f && velocity.X != 0f && flag6)
37292 {
37293 velocity.X = 0f;
37294 this.ai[0] = 2f;
37295 this.ai[1] = 0f;
37296 localAI[1] = 0f;
37297 netUpdate = true;
37298 break;
37299 }
37300 bool flag7 = this.ai[1] >= 90f;
37301 if (velocity.Y == 0f && velocity.X == 0f && flag7)
37302 {
37303 velocity.X = 0f;
37304 this.ai[0] = 5f;
37305 this.ai[1] = 0f;
37306 localAI[1] = 0f;
37307 netUpdate = true;
37308 break;
37309 }
37310 bool flag8 = this.ai[1] >= 120f;
37311 int num16 = 32;
37312 bool flag9 = targetData.Type == NPCTargetType.Player && !Main.player[target].buffImmune[num16] && Main.player[target].FindBuffIndex(num16) == -1;
37313 if (velocity.Y == 0f && flag8 && flag9 && Math.Abs(vector3.X) > 100f)
37314 {
37315 velocity.X = 0f;
37316 this.ai[0] = 3f;
37317 this.ai[1] = 0f;
37318 localAI[1] = 0f;
37319 netUpdate = true;
37320 }
37321 break;
37322 }
37323 case 1:
37324 this.ai[1] += 1f;
37325 haltMovement = true;
37327 if (this.ai[1] >= 80f)
37328 {
37329 this.ai[0] = 0f;
37330 this.ai[1] = 0f;
37331 netUpdate = true;
37332 }
37333 break;
37334 case 4:
37335 this.ai[1] += 1f;
37336 haltMovement = true;
37337 TargetClosest();
37339 if (this.ai[1] >= 90f)
37340 {
37341 this.ai[0] = 0f;
37342 this.ai[1] = 0f;
37343 netUpdate = true;
37344 }
37345 break;
37346 case 2:
37347 {
37348 int num8 = 4;
37349 int num9 = 8 * num8;
37350 this.ai[1] += 1f;
37351 if (this.ai[1] == (float)(num9 - 20))
37352 {
37354 }
37355 if (this.ai[1] == (float)num9)
37356 {
37358 }
37359 haltMovement = true;
37360 if (Main.netMode != 1 && this.ai[1] >= (float)num9)
37361 {
37362 Point sourceTileCoords = base.Top.ToTileCoordinates();
37363 int num10 = 20;
37365 float upBiasPerSpike = 200f;
37366 sourceTileCoords.X += direction * 3;
37367 sourceTileCoords.Y -= 10;
37368 int num11 = (int)this.ai[1] - num9;
37369 if (num11 == 0)
37370 {
37371 PunchCameraModifier modifier4 = new PunchCameraModifier(base.Center, new Vector2(0f, -1f), 20f, 6f, 30, 1000f, "Deerclops");
37372 Main.instance.CameraModifiers.Add(modifier4);
37373 }
37374 int num12 = 1;
37375 int num13 = num11 / num12 * num12;
37376 int num14 = num13 + num12;
37377 if (num11 % num12 != 0)
37378 {
37379 num14 = num13;
37380 }
37381 for (int j = num13; j < num14 && j < num10; j++)
37382 {
37384 }
37385 }
37386 if (this.ai[1] >= 60f)
37387 {
37388 this.ai[0] = 0f;
37389 this.ai[1] = 0f;
37390 netUpdate = true;
37391 }
37392 break;
37393 }
37394 case 3:
37395 if (this.ai[1] == 30f)
37396 {
37398 }
37399 this.ai[1] += 1f;
37400 haltMovement = true;
37401 if ((int)this.ai[1] % 4 == 0 && this.ai[1] >= 28f)
37402 {
37403 PunchCameraModifier modifier5 = new PunchCameraModifier(base.Center, (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2(), 20f, 6f, 20, 1000f, "Deerclops");
37404 Main.instance.CameraModifiers.Add(modifier5);
37405 if (Main.netMode != 2)
37406 {
37407 Player player = Main.player[Main.myPlayer];
37408 _ = Main.myPlayer;
37409 int num17 = 32;
37410 int timeToAdd = 720;
37411 if (!player.dead && player.active && player.FindBuffIndex(num17) == -1 && (player.Center - base.Center).Length() < 800f && !player.creativeGodMode)
37412 {
37413 player.AddBuff(num17, timeToAdd);
37414 }
37415 }
37416 }
37417 if (this.ai[1] == 30f)
37418 {
37419 TargetClosest();
37420 }
37421 if (this.ai[1] >= 60f)
37422 {
37423 this.ai[0] = 0f;
37424 this.ai[1] = 0f;
37425 netUpdate = true;
37426 }
37427 break;
37428 case 7:
37429 if (this.ai[1] == 30f)
37430 {
37432 }
37433 this.ai[1] += 1f;
37434 haltMovement = true;
37435 if ((int)this.ai[1] % 4 == 0 && this.ai[1] >= 28f)
37436 {
37437 PunchCameraModifier modifier3 = new PunchCameraModifier(base.Center, (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2(), 20f, 6f, 20, 1000f, "Deerclops");
37438 Main.instance.CameraModifiers.Add(modifier3);
37439 }
37440 if (this.ai[1] == 40f)
37441 {
37442 TargetClosest();
37443 if (Main.netMode != 1)
37444 {
37445 netUpdate = true;
37446 base.Bottom = new Vector2(homeTileX * 16, homeTileY * 16);
37447 }
37448 }
37449 if (this.ai[1] >= 60f)
37450 {
37451 this.ai[0] = 0f;
37452 this.ai[1] = 0f;
37453 netUpdate = true;
37454 }
37455 break;
37456 case 8:
37457 if (this.ai[1] == 30f)
37458 {
37460 }
37461 this.ai[1] += 1f;
37462 haltMovement = true;
37463 if ((int)this.ai[1] % 4 == 0 && this.ai[1] >= 28f)
37464 {
37465 PunchCameraModifier modifier2 = new PunchCameraModifier(base.Center, (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2(), 20f, 6f, 20, 1000f, "Deerclops");
37466 Main.instance.CameraModifiers.Add(modifier2);
37467 }
37468 if (this.ai[1] >= 40f)
37469 {
37470 life = -1;
37471 HitEffect();
37472 active = false;
37473 if (Main.netMode != 1)
37474 {
37475 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
37476 }
37477 return;
37478 }
37479 break;
37480 case 5:
37481 if (this.ai[1] == 30f)
37482 {
37484 }
37485 this.ai[1] += 1f;
37486 haltMovement = true;
37487 if ((int)this.ai[1] % 4 == 0 && this.ai[1] >= 28f)
37488 {
37489 PunchCameraModifier modifier = new PunchCameraModifier(base.Center, (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2(), 20f, 6f, 20, 1000f, "Deerclops");
37490 Main.instance.CameraModifiers.Add(modifier);
37491 }
37492 if (this.ai[1] == 30f)
37493 {
37494 TargetClosest();
37495 if (Main.netMode != 1)
37496 {
37497 for (int i = 0; i < 6; i++)
37498 {
37501 }
37502 }
37503 }
37504 if (this.ai[1] >= 60f)
37505 {
37506 this.ai[0] = 0f;
37507 this.ai[1] = 0f;
37508 netUpdate = true;
37509 }
37510 break;
37511 }
37513 }
37514
37516 {
37517 if (targetData.Type == NPCTargetType.Player)
37518 {
37519 Player player = Main.player[target];
37520 bool zoneSnow = player.ZoneSnow;
37521 Vector2 other = new Vector2(homeTileX * 16, homeTileY * 16);
37522 int num = 480;
37523 zoneSnow |= player.Distance(other) <= (float)num;
37524 return (player.dead || (!isChasing && !zoneSnow)) | (Distance(player.Center) >= 2400f);
37525 }
37526 if (targetData.Type == NPCTargetType.None)
37527 {
37528 return true;
37529 }
37530 return false;
37531 }
37532
37534 {
37535 int num = (int)Utils.Remap(lifePercent, 1f, 0f, 80f, 40f);
37536 localAI[2] += 1f;
37537 int num2 = (int)localAI[2];
37538 if (num2 % num != 0)
37539 {
37540 return;
37541 }
37542 int num3 = num2 / num;
37543 if (num2 / num >= 3)
37544 {
37545 localAI[2] = 0f;
37546 }
37547 for (int i = 0; i < 255; i++)
37548 {
37549 if (Boss_CanShootExtraAt(i, num3 % 3, 3, 1200f, alwaysSkipMainTarget: false))
37550 {
37553 }
37554 }
37555 }
37556
37558 {
37559 int num = 18;
37561 for (int i = 0; i < 35; i++)
37562 {
37563 int num3 = sourceTileCoords.X + num2 * direction;
37564 int num4 = sourceTileCoords.Y + i;
37566 {
37567 Vector2 vector = targetData.Center + new Vector2(num2 * direction * 20, (0f - upBiasPerSpike) * (float)howMany + (float)num2 * upBiasPerSpike / (float)distancedByThisManyTiles);
37568 Vector2 vector2 = new Vector2(num3 * 16 + 8, num4 * 16 + 8);
37569 Vector2 vector3 = (vector - vector2).SafeNormalize(-Vector2.UnitY);
37570 vector3 = new Vector2(0f, -1f).RotatedBy((float)(whichOne * direction) * 0.7f * ((float)Math.PI / 4f / (float)howMany));
37571 int num5 = Main.rand.Next(Main.projFrames[962] * 4);
37572 num5 = 6 + Main.rand.Next(6);
37573 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), new Vector2(num3 * 16 + 8, num4 * 16 - 8), vector3 * (8f + Main.rand.NextFloat() * 8f), 962, num, 0f, Main.myPlayer, 0f, num5);
37574 break;
37575 }
37576 }
37577 }
37578
37580 {
37581 int num = 9;
37582 int num2 = 4;
37583 if (Main.netMode == 1)
37584 {
37585 return;
37586 }
37587 int num3 = num * num2;
37588 if (!(ai[AISLOT_PhaseCounter] < (float)num3))
37589 {
37590 Point sourceTileCoords = base.Bottom.ToTileCoordinates();
37591 int num4 = 20;
37592 int num5 = 1;
37593 sourceTileCoords.X += direction * 3;
37594 int num6 = (int)ai[AISLOT_PhaseCounter] - num3;
37595 if (num6 == 0)
37596 {
37597 PunchCameraModifier modifier = new PunchCameraModifier(base.Center, new Vector2(0f, 1f), 20f, 6f, 30, 1000f, "Deerclops");
37598 Main.instance.CameraModifiers.Add(modifier);
37599 }
37600 int num7 = 4;
37601 int num8 = num6 / num7 * num7;
37602 int num9 = num8 + num7;
37603 if (num6 % num7 != 0)
37604 {
37605 num9 = num8;
37606 }
37607 for (int i = num8; i < num9 && i < num4; i++)
37608 {
37609 int xOffset = i * num5;
37611 }
37612 }
37613 }
37614
37616 {
37617 if (Main.netMode == 1)
37618 {
37619 return;
37620 }
37621 int num = 56;
37622 if (!(ai[AISLOT_PhaseCounter] < (float)num))
37623 {
37624 Point sourceTileCoords = base.Bottom.ToTileCoordinates();
37625 int num2 = 15;
37626 int num3 = 1;
37627 int num4 = (int)ai[AISLOT_PhaseCounter] - num;
37628 if (num4 == 0)
37629 {
37630 PunchCameraModifier modifier = new PunchCameraModifier(base.Center, new Vector2(0f, 1f), 20f, 6f, 30, 1000f, "Deerclops");
37631 Main.instance.CameraModifiers.Add(modifier);
37632 }
37633 int num5 = 2;
37634 int num6 = num4 / num5 * num5;
37635 int num7 = num6 + num5;
37636 if (num4 % num5 != 0)
37637 {
37638 num7 = num6;
37639 }
37640 for (int i = num6; i >= 0 && i < num7 && i < num2; i++)
37641 {
37642 int xOffset = i * num3;
37645 }
37646 }
37647 }
37648
37649 public static bool IsADeerclopsNearScreen()
37650 {
37651 return npcsFoundForCheckActive[668];
37652 }
37653
37654 private void AI_123_Deerclops_FindSpotToSpawnSpike(int howMany, int whichOne, ref int x, ref int y)
37655 {
37657 {
37658 return;
37659 }
37661 int num = rectangle.Center.X / 16;
37662 int num2 = (rectangle.Bottom - 16) / 16;
37663 int num3 = ((num2 - y > 0) ? 1 : (-1));
37664 int num4 = y;
37665 for (int i = 1; i <= 10; i++)
37666 {
37667 int num5 = y + num3 * i;
37668 if (num5 >= 20 && num5 <= Main.maxTilesY - 20 && WorldGen.ActiveAndWalkableTile(x, num5))
37669 {
37670 num4 = num5;
37671 }
37672 }
37673 if (num4 != y)
37674 {
37675 y = num4;
37676 return;
37677 }
37678 y = (int)MathHelper.Lerp(num2, y, (float)Math.Abs(num - x) * 0.1f);
37679 for (int j = 0; j < 4; j++)
37680 {
37681 int num6 = y + j;
37682 if (num6 >= 20 && num6 <= Main.maxTilesY - 20 && WorldGen.ActiveAndWalkableTile(x, num6))
37683 {
37684 y = num6;
37685 break;
37686 }
37687 }
37688 }
37689
37691 {
37692 int num = 13;
37693 int num2 = sourceTileCoords.X + xOffset * dir;
37696 {
37697 Vector2 vector = new Vector2(num2 * 16 + 8, num3 * 16 - 8);
37698 Vector2 vector2 = new Vector2(0f, -1f).RotatedBy((float)(whichOne * dir) * 0.7f * ((float)Math.PI / 4f / (float)howMany));
37699 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector, vector2, 961, num, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * 1.1f / (float)howMany);
37700 }
37701 }
37702
37704 {
37705 int num = sourceTileCoords.Y;
37707 if (!targetData.Invalid)
37708 {
37709 Rectangle hitbox = targetData.Hitbox;
37710 Vector2 vector = new Vector2(hitbox.Center.X, hitbox.Bottom);
37711 int num2 = (int)(vector.Y / 16f);
37712 int num3 = Math.Sign(num2 - num);
37713 int num4 = num2 + num3 * 15;
37714 int? num5 = null;
37715 float num6 = float.PositiveInfinity;
37716 for (int i = num; i != num4; i += num3)
37717 {
37719 {
37720 float num7 = new Point(x, i).ToWorldCoordinates().Distance(vector);
37721 if (!num5.HasValue || !(num7 >= num6))
37722 {
37723 num5 = i;
37724 num6 = num7;
37725 }
37726 }
37727 }
37728 if (num5.HasValue)
37729 {
37730 num = num5.Value;
37731 }
37732 }
37733 for (int j = 0; j < 20; j++)
37734 {
37735 if (num < 10)
37736 {
37737 break;
37738 }
37739 if (!WorldGen.SolidTile(x, num))
37740 {
37741 break;
37742 }
37743 num--;
37744 }
37745 for (int k = 0; k < 20; k++)
37746 {
37747 if (num > Main.maxTilesY - 10)
37748 {
37749 break;
37750 }
37751 if (WorldGen.ActiveAndWalkableTile(x, num))
37752 {
37753 break;
37754 }
37755 num++;
37756 }
37757 return num;
37758 }
37759
37761 {
37762 float num = (float)life / (float)lifeMax;
37763 float num2 = 1f - num;
37764 float num3 = 3.5f + 1f * num2;
37765 float num4 = 4f;
37766 float num5 = -0.4f;
37767 float min = -8f;
37768 float num6 = 0.4f;
37770 if (goHome)
37771 {
37772 rectangle = new Rectangle(homeTileX * 16, homeTileY * 16, 16, 16);
37773 if (Distance(rectangle.Center.ToVector2()) < 240f)
37774 {
37775 rectangle.X = (int)(base.Center.X + (float)(160 * direction));
37776 }
37777 }
37778 float num7 = (float)rectangle.Center.X - base.Center.X;
37779 float num8 = Math.Abs(num7);
37780 if (goHome && num7 != 0f)
37781 {
37783 }
37784 bool flag = num8 < 80f;
37785 bool flag2 = flag || haltMovement;
37786 if (ai[0] == -1f)
37787 {
37788 num7 = 5f;
37789 num3 = 5.35f;
37790 flag2 = false;
37791 }
37792 if (flag2)
37793 {
37794 velocity.X *= 0.9f;
37795 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
37796 {
37797 velocity.X = 0f;
37798 }
37799 }
37800 else
37801 {
37802 int num9 = Math.Sign(num7);
37803 velocity.X = MathHelper.Lerp(velocity.X, (float)num9 * num3, 1f / num4);
37804 }
37805 int num10 = 40;
37806 int num11 = 20;
37807 int num12 = 0;
37808 Vector2 vector = new Vector2(base.Center.X - (float)(num10 / 2), position.Y + (float)height - (float)num11 + (float)num12);
37809 bool num13 = vector.X < (float)rectangle.X && vector.X + (float)width > (float)(rectangle.X + rectangle.Width);
37810 bool flag3 = vector.Y + (float)num11 < (float)(rectangle.Y + rectangle.Height - 16);
37811 bool acceptTopSurfaces = base.Bottom.Y >= (float)rectangle.Top;
37815 float num14 = 8f;
37816 if (flag4 || flag5)
37817 {
37818 localAI[0] = 0f;
37819 }
37820 if ((num13 || flag) && flag3)
37821 {
37822 velocity.Y = MathHelper.Clamp(velocity.Y + num6 * 2f, 0.001f, 16f);
37823 }
37824 else if (flag4 && !flag5)
37825 {
37826 velocity.Y = 0f;
37827 }
37828 else if (flag4)
37829 {
37830 velocity.Y = MathHelper.Clamp(velocity.Y + num5, min, 0f);
37831 }
37832 else if (velocity.Y == 0f && flag6)
37833 {
37834 velocity.Y = 0f - num14;
37835 localAI[0] = 1f;
37836 }
37837 else
37838 {
37839 velocity.Y = MathHelper.Clamp(velocity.Y + num6, 0f - num14, 16f);
37840 }
37841 }
37842
37843 private void AI_124_DeerclopsLeg()
37844 {
37845 int num = (int)ai[0];
37846 if (num < 0 || num > 200)
37847 {
37848 active = false;
37849 if (Main.netMode != 1)
37850 {
37851 NetMessage.SendData(23, -1, -1, null, whoAmI);
37852 }
37853 return;
37854 }
37855 NPC nPC = Main.npc[num];
37856 if (!nPC.active || nPC.type != 668)
37857 {
37858 active = false;
37859 if (Main.netMode != 1)
37860 {
37861 NetMessage.SendData(23, -1, -1, null, whoAmI);
37862 }
37863 return;
37864 }
37865 NPCAimedTarget targetData = nPC.GetTargetData();
37866 Vector2 vector = targetData.Center - base.Center;
37867 float num2 = targetData.Center.X - (float)(width / 2);
37868 int num3 = Math.Sign(num2 - position.X);
37869 float val = Math.Abs(num2 - position.X);
37870 float num4 = Math.Min(50f, val);
37871 float num5 = num2 + (float)(-num3) * num4;
37872 Math.Abs(vector.X);
37873 if (Math.Abs(num5 - base.Center.X) >= 30f && localAI[0] == 0f)
37874 {
37875 localAI[0] = 1f;
37876 }
37877 float num6 = 4f;
37878 float num7 = 30f;
37879 if (localAI[0] < 0f)
37880 {
37881 localAI[0] += 1f;
37882 }
37883 if (localAI[0] > 0f)
37884 {
37885 localAI[0] += 1f;
37886 if (localAI[0] >= num7)
37887 {
37888 localAI[0] = 0f - num6;
37889 }
37890 }
37891 int num8 = ((ai[1] != 0f) ? 1 : (-1));
37892 if (localAI[0] > 0f)
37893 {
37894 Vector2 vector2 = new Vector2(num8 * 14, -20f);
37895 Vector2 searchStartPositionInWorld = nPC.Bottom + vector2 + new Vector2(0f, 30f);
37896 int searchRange = 16;
37897 int tilesTraveled = 0;
37899 float amount = 1f / 3f;
37901 float num10 = localAI[0] / num7;
37902 if (num9.HasValue && tilesTraveled > 2)
37903 {
37904 new Vector2(searchStartPositionInWorld.X, num9.Value * 16f);
37905 value = new Vector2(searchStartPositionInWorld.X, num9.Value * 16f);
37906 amount = num10;
37907 }
37908 value.Y -= (1f - num10) * 30f;
37909 Vector2 bottom = Vector2.Lerp(base.Bottom, value, amount);
37910 base.Bottom = bottom;
37911 }
37912 int num11 = num8;
37913 if (Math.Abs(vector.X) > 30f)
37914 {
37915 num11 = Math.Sign(vector.X);
37916 }
37918 }
37919
37921 {
37922 Point point = searchStartPositionInWorld.ToTileCoordinates();
37923 int x = point.X;
37924 for (int i = point.Y; i < point.Y + searchRange; i++)
37925 {
37926 if (Main.tile[x, i] == null)
37927 {
37928 Main.tile[x, i] = new Tile();
37929 }
37930 if (Main.tile[x, i].nactive() && Main.tileSolid[Main.tile[x, i].type])
37931 {
37932 tilesTraveled = i - point.Y;
37933 return i;
37934 }
37935 }
37936 tilesTraveled = 0;
37937 return null;
37938 }
37939
37941 {
37942 int num = 10;
37943 for (int i = 0; i < num; i++)
37944 {
37947 }
37948 }
37949
37951 {
37952 int num = Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, itemID, 1, noBroadcast: false, -1, noGrabDelay: true);
37953 float num2 = Main.rand.Next(10, 26);
37954 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
37955 Vector2 vector2 = Main.player[target].Center - new Vector2(0f, 120f);
37956 float num3 = vector2.X - vector.X;
37957 float num4 = vector2.Y - vector.Y;
37958 num3 += (float)Main.rand.Next(-50, 51) * 0.1f;
37959 num4 += (float)Main.rand.Next(-50, 51) * 0.1f;
37960 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
37961 num5 = num2 / num5;
37962 num3 *= num5;
37963 num4 *= num5;
37964 num3 += (float)Main.rand.Next(-50, 51) * 0.1f;
37965 num4 += (float)Main.rand.Next(-50, 51) * 0.1f;
37966 Main.item[num].velocity.X = num3;
37967 Main.item[num].velocity.Y = num4;
37968 Main.item[num].noGrabDelay = 100;
37969 if (Main.netMode != 0)
37970 {
37971 NetMessage.SendData(21, -1, -1, null, num);
37972 }
37973 }
37974
37976 {
37977 if (localAI[0] == 0f)
37978 {
37979 localAI[0] = 1f;
37981 }
37983 if (targetData.Invalid)
37984 {
37985 TargetClosest();
37987 }
37988 if (targetData.Invalid)
37989 {
37990 velocity *= 0.9f;
37991 alpha = Utils.Clamp(alpha + 5, 0, 255);
37992 if (alpha >= 255)
37993 {
37994 StrikeNPCNoInteraction(9999, 0f, 0);
37995 }
37996 return;
37997 }
37998 alpha = Utils.Clamp(alpha - 5, 0, 255);
37999 Vector2 targetPosition = Vector2.Zero.MoveTowards(targetData.Center - base.Center, 4f);
38000 velocity = velocity.MoveTowards(targetPosition, 2f / 15f);
38001 for (int i = 0; i < 200; i++)
38002 {
38003 if (Main.npc[i].active && Main.npc[i].type == type && i != whoAmI)
38004 {
38005 Vector2 vector = Main.npc[i].Center - base.Center;
38006 if (vector.Length() < 50f)
38007 {
38008 vector.Normalize();
38009 vector *= 0.1f;
38010 velocity -= vector;
38011 velocity.X -= vector.X * 1f;
38012 }
38013 }
38014 }
38015 }
38016
38018 {
38020 Main.BestiaryTracker.Chats.RegisterChatStartWith(this);
38021 Main.player[playerID].SetTalkNPC(whoAmI);
38022 if (Main.netMode == 2)
38023 {
38024 NetMessage.SendData(40, -1, -1, null, playerID);
38025 }
38026 }
38027
38028 private void AI_065_Butterflies()
38029 {
38030 float num = ai[0];
38031 float num2 = ai[1];
38032 if (type == 661)
38033 {
38034 Vector3 rgb = Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.33f % 1f, 1f, 0.5f).ToVector3() * 0.3f;
38035 rgb += Vector3.One * 0.1f;
38036 Lighting.AddLight(base.Center, rgb);
38037 int num3 = 60;
38038 bool flag = false;
38039 int num4 = 50;
38041 if (targetData.Invalid || targetData.Center.Distance(base.Center) >= 300f)
38042 {
38043 flag = true;
38044 }
38045 if (!Main.remixWorld && !targetData.Invalid && targetData.Type == NPCTargetType.Player && !Main.player[target].ZoneHallow)
38046 {
38047 num4 = num3;
38048 flag = true;
38049 }
38050 ai[2] = MathHelper.Clamp(ai[2] + (float)flag.ToDirectionInt(), 0f, num4);
38051 if (ai[2] >= (float)num3)
38052 {
38053 active = false;
38054 if (Main.netMode != 1)
38055 {
38056 NetMessage.SendData(23, -1, -1, null, whoAmI);
38057 }
38058 return;
38059 }
38060 Opacity = Utils.GetLerpValue(num3, (float)num4 / 2f, ai[2], clamped: true);
38061 if (ai[2] > 0f)
38062 {
38063 int num5 = 1;
38064 for (int i = 0; i < num5; i++)
38065 {
38066 if (Main.rand.Next(5) == 0)
38067 {
38068 float num6 = MathHelper.Lerp(0.9f, 0.6f, Opacity);
38069 Color newColor = Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.3f % 1f, 1f, 0.5f) * 0.5f;
38070 int num7 = Dust.NewDust(position, width, height, 267, 0f, 0f, 0, newColor);
38071 Main.dust[num7].position = base.Center + Main.rand.NextVector2Circular(width, height);
38072 Main.dust[num7].velocity *= Main.rand.NextFloat() * 0.8f;
38073 Main.dust[num7].velocity += velocity * 0.6f;
38074 Main.dust[num7].noGravity = true;
38075 Main.dust[num7].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * num6;
38076 Main.dust[num7].scale = 0.35f;
38077 if (num7 != 6000)
38078 {
38079 Dust dust = Dust.CloneDust(num7);
38080 dust.scale /= 2f;
38081 dust.fadeIn *= 0.85f;
38082 dust.color = new Color(255, 255, 255, 255) * 0.5f;
38083 }
38084 }
38085 }
38086 }
38087 dontTakeDamage = ai[2] >= (float)(num4 / 2);
38088 }
38089 if (Main.netMode != 1)
38090 {
38091 if (ai[2] == 0f && type != 661)
38092 {
38093 int num8 = 0;
38094 int num9 = 4;
38095 int num10 = 6;
38096 int num11 = 3;
38097 int num12 = 7;
38098 int num13 = 2;
38099 int num14 = 1;
38100 int num15 = 5;
38101 int num16 = Main.rand.Next(100);
38102 num16 = ((num16 == 0) ? num15 : ((num16 < 3) ? num14 : ((num16 < 9) ? num13 : ((num16 < 19) ? num12 : ((num16 < 34) ? num11 : ((num16 < 53) ? num10 : ((num16 >= 75) ? num8 : num9)))))));
38103 ai[2] = 1 + num16;
38104 }
38105 if (ai[3] == 0f)
38106 {
38107 ai[3] = (float)Main.rand.Next(75, 111) * 0.01f;
38108 }
38109 localAI[0] -= 1f;
38110 if (localAI[0] <= 0f)
38111 {
38112 localAI[0] = Main.rand.Next(90, 240);
38113 TargetClosest();
38114 float num17 = Math.Abs(base.Center.X - Main.player[target].Center.X);
38115 if (num17 > 700f && localAI[3] == 0f)
38116 {
38117 float num18 = (float)Main.rand.Next(50, 151) * 0.01f;
38118 if (num17 > 1000f)
38119 {
38120 num18 = (float)Main.rand.Next(150, 201) * 0.01f;
38121 }
38122 else if (num17 > 850f)
38123 {
38124 num18 = (float)Main.rand.Next(100, 151) * 0.01f;
38125 }
38126 int num19 = direction * Main.rand.Next(100, 251);
38127 int num20 = Main.rand.Next(-50, 51);
38128 if (position.Y > Main.player[target].position.Y - 100f)
38129 {
38130 num20 -= Main.rand.Next(100, 251);
38131 }
38132 float num21 = num18 / (float)Math.Sqrt(num19 * num19 + num20 * num20);
38133 num = (float)num19 * num21;
38134 num2 = (float)num20 * num21;
38135 }
38136 else
38137 {
38138 localAI[3] = 1f;
38139 float num22 = (float)Main.rand.Next(26, 301) * 0.01f;
38140 int num23 = Main.rand.Next(-100, 101);
38141 int num24 = Main.rand.Next(-100, 101);
38142 float num25 = num22 / (float)Math.Sqrt(num23 * num23 + num24 * num24);
38143 num = (float)num23 * num25;
38144 num2 = (float)num24 * num25;
38145 }
38146 netUpdate = true;
38147 }
38148 }
38149 scale = ai[3];
38150 int num26 = 60;
38151 velocity.X = (velocity.X * (float)(num26 - 1) + num) / (float)num26;
38152 velocity.Y = (velocity.Y * (float)(num26 - 1) + num2) / (float)num26;
38153 if (velocity.Y > 0f)
38154 {
38155 int num27 = 3;
38156 int num28 = (int)base.Center.X / 16;
38157 int num29 = (int)base.Center.Y / 16;
38158 for (int j = num29; j < num29 + num27; j++)
38159 {
38160 if (Main.tile[num28, j] != null && ((Main.tile[num28, j].nactive() && Main.tileSolid[Main.tile[num28, j].type]) || Main.tile[num28, j].liquid > 0))
38161 {
38162 num2 *= -1f;
38163 if (velocity.Y > 0f)
38164 {
38165 velocity.Y *= 0.9f;
38166 }
38167 }
38168 }
38169 }
38170 if (velocity.Y < 0f)
38171 {
38172 int num30 = 30;
38173 bool flag2 = false;
38174 int num31 = (int)base.Center.X / 16;
38175 int num32 = (int)base.Center.Y / 16;
38176 for (int k = num32; k < num32 + num30; k++)
38177 {
38178 if (Main.tile[num31, k] != null && Main.tile[num31, k].nactive() && Main.tileSolid[Main.tile[num31, k].type])
38179 {
38180 flag2 = true;
38181 }
38182 }
38183 if (!flag2)
38184 {
38185 num2 *= -1f;
38186 if (velocity.Y < 0f)
38187 {
38188 velocity.Y *= 0.9f;
38189 }
38190 }
38191 }
38192 if (localAI[1] > 0f)
38193 {
38194 localAI[1] -= 1f;
38195 }
38196 else
38197 {
38198 localAI[1] = 15f;
38199 if (type == 661)
38200 {
38201 localAI[1] = 10f;
38202 }
38203 float num33 = 0f;
38205 for (int l = 0; l < 200; l++)
38206 {
38207 NPC nPC = Main.npc[l];
38208 if (nPC.active && nPC.damage > 0 && !nPC.friendly && nPC.Hitbox.Distance(base.Center) <= 100f)
38209 {
38210 num33 += 1f;
38211 zero += DirectionFrom(nPC.Center);
38212 }
38213 }
38214 if (num33 > 0f)
38215 {
38216 zero /= num33;
38217 zero *= 2f;
38218 velocity += zero;
38219 if (velocity.Length() > 16f)
38220 {
38221 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
38222 }
38223 }
38224 }
38225 if (collideX)
38226 {
38227 num = ((!(velocity.X < 0f)) ? (0f - Math.Abs(num)) : Math.Abs(num));
38228 velocity.X *= -0.2f;
38229 }
38230 if (velocity.X < 0f)
38231 {
38232 direction = -1;
38233 }
38234 if (velocity.X > 0f)
38235 {
38236 direction = 1;
38237 }
38238 ai[0] = num;
38239 ai[1] = num2;
38240 if (type == 356)
38241 {
38242 catchItem = (short)(1994f + ai[2] - 1f);
38243 }
38244 if (type == 653)
38245 {
38247 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.6f, 0.3f, 0.1f);
38248 if (Main.rand.Next(60) == 0)
38249 {
38250 int num34 = Dust.NewDust(position, width, height, 6, 0f, 0f, 254);
38251 Main.dust[num34].velocity *= 0f;
38252 }
38254 }
38255 }
38256
38258 {
38259 Color value = new Color(0, 160, 255);
38260 Color value3 = Color.Lerp(value2: new Color(255, 80, 255), value1: new Color(200, 200, 200), amount: Main.rand.NextFloat());
38261 return Color.Lerp(value, value3, Main.rand.NextFloat());
38262 }
38263
38265 {
38266 noTileCollide = true;
38267 noGravity = true;
38268 float num = 12f;
38269 float num2 = 0.085f;
38270 float num3 = 250f;
38271 TargetClosest();
38272 Vector2 desiredVelocity = base.Center;
38273 if (timeLeft > 10)
38274 {
38275 if (!Collision.CanHit(this, Main.player[target]))
38276 {
38277 bool flag = false;
38278 Vector2 center = Main.player[target].Center;
38279 for (int i = 0; i < 16; i++)
38280 {
38281 float num4 = 16 * i;
38282 Point point = (center + new Vector2(0f, 0f - num4)).ToTileCoordinates();
38283 if (WorldGen.SolidOrSlopedTile(point.X, point.Y))
38284 {
38285 desiredVelocity = center + new Vector2(0f, 0f - num4 + 16f) - base.Center;
38286 flag = true;
38287 break;
38288 }
38289 }
38290 if (!flag)
38291 {
38292 desiredVelocity = center - base.Center;
38293 }
38294 }
38295 else
38296 {
38297 desiredVelocity = Main.player[target].Center + new Vector2(0f, 0f - num3) - base.Center;
38298 }
38299 }
38300 else
38301 {
38302 desiredVelocity = base.Center + new Vector2(500f * (float)direction, 0f - num3) - base.Center;
38303 }
38304 float num5 = desiredVelocity.Length();
38305 if (Math.Abs(desiredVelocity.X) < 40f)
38306 {
38307 desiredVelocity.X = velocity.X;
38308 }
38309 float num6 = num - 2f;
38310 if (num5 > 100f && ((velocity.X < 0f - num6 && desiredVelocity.X > 0f) || (velocity.X > num6 && desiredVelocity.X < 0f)))
38311 {
38312 num2 *= 2f;
38313 }
38314 if (num5 < 40f)
38315 {
38317 }
38318 else if (num5 < 80f)
38319 {
38320 desiredVelocity.Normalize();
38321 desiredVelocity *= num * 0.65f;
38322 }
38323 else
38324 {
38325 desiredVelocity.Normalize();
38326 desiredVelocity *= num;
38327 }
38329 rotation = velocity.X * 0.1f;
38330 if (rotation > 0.5f)
38331 {
38332 rotation = 0.5f;
38333 }
38334 if (rotation < -0.5f)
38335 {
38336 rotation = -0.5f;
38337 }
38338 }
38339
38340 private void AI_121_QueenSlime()
38341 {
38342 int num = 30;
38343 int num2 = 40;
38344 _ = Main.expertMode;
38345 float num3 = 1f;
38346 bool flag = false;
38347 bool flag2 = life <= lifeMax / 2;
38348 if (localAI[0] == 0f)
38349 {
38350 ai[1] = -100f;
38351 localAI[0] = lifeMax;
38352 TargetClosest();
38353 netUpdate = true;
38354 }
38355 Lighting.AddLight(base.Center, 1f, 0.7f, 0.9f);
38356 int num4 = 500;
38357 if (Main.player[target].dead || Math.Abs(base.Center.X - Main.player[target].Center.X) / 16f > (float)num4)
38358 {
38359 TargetClosest();
38360 if (Main.player[target].dead || Math.Abs(base.Center.X - Main.player[target].Center.X) / 16f > (float)num4)
38361 {
38362 EncourageDespawn(10);
38363 if (Main.player[target].Center.X < base.Center.X)
38364 {
38365 direction = 1;
38366 }
38367 else
38368 {
38369 direction = -1;
38370 }
38371 }
38372 }
38373 if (!Main.player[target].dead && timeLeft > 10 && !flag2 && ai[3] >= 300f && ai[0] == 0f && velocity.Y == 0f)
38374 {
38375 ai[0] = 2f;
38376 ai[1] = 0f;
38377 if (Main.netMode != 1)
38378 {
38379 netUpdate = true;
38380 TargetClosest(faceTarget: false);
38381 Point point = base.Center.ToTileCoordinates();
38382 Point point2 = Main.player[target].Center.ToTileCoordinates();
38383 Vector2 vector = Main.player[target].Center - base.Center;
38384 int num5 = 10;
38385 int num6 = 0;
38386 int num7 = 7;
38387 int num8 = 0;
38388 bool flag3 = false;
38389 if (ai[3] >= 360f || vector.Length() > 2000f)
38390 {
38391 if (ai[3] > 360f)
38392 {
38393 ai[3] = 360f;
38394 }
38395 flag3 = true;
38396 num8 = 100;
38397 }
38398 while (!flag3 && num8 < 100)
38399 {
38400 num8++;
38401 int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1);
38402 int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1);
38403 if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].nactive())
38404 {
38405 continue;
38406 }
38407 int num11 = num10;
38408 int i = 0;
38409 if (Main.tile[num9, num11].nactive() && Main.tileSolid[Main.tile[num9, num11].type] && !Main.tileSolidTop[Main.tile[num9, num11].type])
38410 {
38411 i = 1;
38412 }
38413 else
38414 {
38415 for (; i < 150 && num11 + i < Main.maxTilesY; i++)
38416 {
38417 int num12 = num11 + i;
38418 if (Main.tile[num9, num12].nactive() && Main.tileSolid[Main.tile[num9, num12].type] && !Main.tileSolidTop[Main.tile[num9, num12].type])
38419 {
38420 i--;
38421 break;
38422 }
38423 }
38424 }
38425 num10 += i;
38426 bool flag4 = true;
38427 if (flag4 && Main.tile[num9, num10].lava())
38428 {
38429 flag4 = false;
38430 }
38431 if (flag4 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
38432 {
38433 flag4 = false;
38434 }
38435 if (flag4)
38436 {
38437 localAI[1] = num9 * 16 + 8;
38438 localAI[2] = num10 * 16 + 16;
38439 flag3 = true;
38440 break;
38441 }
38442 }
38443 if (num8 >= 100)
38444 {
38446 localAI[1] = bottom.X;
38447 localAI[2] = bottom.Y;
38448 ai[3] = 0f;
38449 }
38450 }
38451 }
38452 if (!flag2 && (!Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0) || Math.Abs(base.Top.Y - Main.player[target].Bottom.Y) > 320f))
38453 {
38454 ai[3] += 1.5f;
38455 }
38456 else
38457 {
38458 float num13 = ai[3];
38459 ai[3] -= 1f;
38460 if (ai[3] < 0f)
38461 {
38462 if (Main.netMode != 1 && num13 > 0f)
38463 {
38464 netUpdate = true;
38465 }
38466 ai[3] = 0f;
38467 }
38468 }
38469 if (timeLeft <= 10 && ((flag2 && ai[0] != 0f) || (!flag2 && ai[0] != 3f)))
38470 {
38471 if (flag2)
38472 {
38473 ai[0] = 0f;
38474 }
38475 else
38476 {
38477 ai[0] = 3f;
38478 }
38479 ai[1] = 0f;
38480 ai[2] = 0f;
38481 ai[3] = 0f;
38482 netUpdate = true;
38483 }
38484 noTileCollide = false;
38485 noGravity = false;
38486 if (flag2)
38487 {
38488 localAI[3] += 1f;
38489 if (localAI[3] >= 24f)
38490 {
38491 localAI[3] = 0f;
38492 }
38493 if (ai[0] == 4f && ai[2] == 1f)
38494 {
38495 localAI[3] = 6f;
38496 }
38497 if (ai[0] == 5f && ai[2] != 1f)
38498 {
38499 localAI[3] = 7f;
38500 }
38501 }
38502 switch ((int)ai[0])
38503 {
38504 case 0:
38505 {
38506 if (flag2)
38507 {
38509 }
38510 else
38511 {
38512 noTileCollide = false;
38513 noGravity = false;
38514 if (velocity.Y == 0f)
38515 {
38516 velocity.X *= 0.8f;
38517 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
38518 {
38519 velocity.X = 0f;
38520 }
38521 }
38522 }
38523 if (timeLeft <= 10 || (!flag2 && velocity.Y != 0f))
38524 {
38525 break;
38526 }
38527 ai[1] += 1f;
38528 int num18 = 60;
38529 if (flag2)
38530 {
38531 num18 = 120;
38532 }
38533 if (!(ai[1] > (float)num18))
38534 {
38535 break;
38536 }
38537 ai[1] = 0f;
38538 if (flag2)
38539 {
38540 Player player = Main.player[target];
38541 int num19 = Main.rand.Next(2);
38542 if (num19 != 1)
38543 {
38544 ai[0] = 4f;
38545 }
38546 else
38547 {
38548 ai[0] = 5f;
38549 }
38550 if (ai[0] == 4f)
38551 {
38552 ai[2] = 1f;
38553 if (player != null && player.active && !player.dead && (player.Bottom.Y < base.Bottom.Y || Math.Abs(player.Center.X - base.Center.X) > 250f))
38554 {
38555 ai[0] = 5f;
38556 ai[2] = 0f;
38557 }
38558 }
38559 }
38560 else
38561 {
38562 switch (Main.rand.Next(3))
38563 {
38564 default:
38565 ai[0] = 3f;
38566 break;
38567 case 1:
38568 ai[0] = 4f;
38569 break;
38570 case 2:
38571 ai[0] = 5f;
38572 break;
38573 }
38574 }
38575 netUpdate = true;
38576 break;
38577 }
38578 case 1:
38579 {
38580 rotation = 0f;
38581 ai[1] += 1f;
38582 num3 = MathHelper.Clamp(ai[1] / 30f, 0f, 1f);
38583 num3 = 0.5f + num3 * 0.5f;
38584 if (ai[1] >= 30f && Main.netMode != 1)
38585 {
38586 ai[0] = 0f;
38587 ai[1] = 0f;
38588 netUpdate = true;
38589 TargetClosest();
38590 }
38591 if (Main.netMode == 1 && ai[1] >= 60f)
38592 {
38593 ai[0] = 0f;
38594 ai[1] = 0f;
38595 TargetClosest();
38596 }
38598 newColor2.A = 150;
38599 for (int num27 = 0; num27 < 10; num27++)
38600 {
38601 int num28 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 50, newColor2, 1.5f);
38602 Main.dust[num28].noGravity = true;
38603 Main.dust[num28].velocity *= 2f;
38604 }
38605 break;
38606 }
38607 case 2:
38608 rotation = 0f;
38609 ai[1] += 1f;
38610 num3 = MathHelper.Clamp((60f - ai[1]) / 60f, 0f, 1f);
38611 num3 = 0.5f + num3 * 0.5f;
38612 if (ai[1] >= 60f)
38613 {
38614 flag = true;
38615 }
38616 if (ai[1] == 60f)
38617 {
38618 Gore.NewGore(base.Center + new Vector2(-40f, -height / 2), velocity, 1258);
38619 }
38620 if (ai[1] >= 60f && Main.netMode != 1)
38621 {
38622 base.Bottom = new Vector2(localAI[1], localAI[2]);
38623 ai[0] = 1f;
38624 ai[1] = 0f;
38625 netUpdate = true;
38626 }
38627 if (Main.netMode == 1 && ai[1] >= 120f)
38628 {
38629 ai[0] = 1f;
38630 ai[1] = 0f;
38631 }
38632 if (!flag)
38633 {
38635 newColor.A = 150;
38636 for (int n = 0; n < 10; n++)
38637 {
38638 int num26 = Dust.NewDust(position + Vector2.UnitX * -20f, width + 40, height, 4, velocity.X, velocity.Y, 50, newColor, 1.5f);
38639 Main.dust[num26].noGravity = true;
38640 Main.dust[num26].velocity *= 0.5f;
38641 }
38642 }
38643 break;
38644 case 3:
38645 rotation = 0f;
38646 if (velocity.Y == 0f)
38647 {
38648 velocity.X *= 0.8f;
38649 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
38650 {
38651 velocity.X = 0f;
38652 }
38653 ai[1] += 4f;
38654 if ((double)life < (double)lifeMax * 0.66)
38655 {
38656 ai[1] += 4f;
38657 }
38658 if ((double)life < (double)lifeMax * 0.33)
38659 {
38660 ai[1] += 4f;
38661 }
38662 if (!(ai[1] >= 0f))
38663 {
38664 break;
38665 }
38666 netUpdate = true;
38667 TargetClosest();
38668 if (ai[2] == 3f)
38669 {
38670 velocity.Y = -13f;
38671 velocity.X += 3.5f * (float)direction;
38672 ai[1] = 0f;
38673 ai[2] = 0f;
38674 if (timeLeft > 10)
38675 {
38676 ai[0] = 0f;
38677 }
38678 else
38679 {
38680 ai[1] = -60f;
38681 }
38682 }
38683 else if (ai[2] == 2f)
38684 {
38685 velocity.Y = -6f;
38686 velocity.X += 4.5f * (float)direction;
38687 ai[1] = -40f;
38688 ai[2] += 1f;
38689 }
38690 else
38691 {
38692 velocity.Y = -8f;
38693 velocity.X += 4f * (float)direction;
38694 ai[1] = -40f;
38695 ai[2] += 1f;
38696 }
38697 }
38698 else
38699 {
38700 if (target >= 255)
38701 {
38702 break;
38703 }
38704 float num20 = 3f;
38705 if (Main.getGoodWorld)
38706 {
38707 num20 = 7f;
38708 }
38709 if ((direction == 1 && velocity.X < num20) || (direction == -1 && velocity.X > 0f - num20))
38710 {
38711 if ((direction == -1 && (double)velocity.X < 0.1) || (direction == 1 && (double)velocity.X > -0.1))
38712 {
38713 velocity.X += 0.2f * (float)direction;
38714 }
38715 else
38716 {
38717 velocity.X *= 0.93f;
38718 }
38719 }
38720 }
38721 break;
38722 case 4:
38723 {
38724 rotation *= 0.9f;
38725 noTileCollide = true;
38726 noGravity = true;
38727 if (ai[2] == 1f)
38728 {
38729 noTileCollide = false;
38730 noGravity = false;
38731 int num21 = 30;
38732 if (flag2)
38733 {
38734 num21 = 10;
38735 }
38736 if (Main.getGoodWorld)
38737 {
38738 num21 = 0;
38739 }
38741 _ = base.Center;
38742 if (!player2.dead && player2.active && Math.Abs(base.Center.X - player2.Center.X) / 16f <= (float)num4)
38743 {
38744 _ = player2.Center;
38745 }
38746 if (velocity.Y == 0f)
38747 {
38748 ai[0] = 0f;
38749 ai[1] = 0f;
38750 ai[2] = 0f;
38751 netUpdate = true;
38753 if (Main.netMode != 1)
38754 {
38756 }
38757 for (int l = 0; l < 20; l++)
38758 {
38759 int num22 = Dust.NewDust(base.Bottom - new Vector2(width / 2, 30f), width, 30, 31, velocity.X, velocity.Y, 40, AI_121_QueenSlime_GetDustColor());
38760 Main.dust[num22].noGravity = true;
38761 Main.dust[num22].velocity.Y = -5f + Main.rand.NextFloat() * -3f;
38762 Main.dust[num22].velocity.X *= 7f;
38763 }
38764 }
38765 else if (ai[1] >= (float)num21)
38766 {
38767 for (int m = 0; m < 4; m++)
38768 {
38769 Vector2 vector3 = base.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8));
38771 Main.dust[num23].position = vector3;
38772 Main.dust[num23].noGravity = true;
38773 Main.dust[num23].velocity.Y = velocity.Y * 0.9f;
38774 Main.dust[num23].velocity.X = ((Main.rand.Next(2) == 0) ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f;
38775 }
38776 }
38777 velocity.X *= 0.8f;
38778 float num24 = ai[1];
38779 ai[1] += 1f;
38780 if (ai[1] >= (float)num21)
38781 {
38782 if (num24 < (float)num21)
38783 {
38784 netUpdate = true;
38785 }
38786 if (flag2 && ai[1] > (float)(num21 + 120))
38787 {
38788 ai[0] = 0f;
38789 ai[1] = 0f;
38790 ai[2] = 0f;
38791 velocity.Y *= 0.8f;
38792 netUpdate = true;
38793 break;
38794 }
38795 velocity.Y += 1f;
38796 float num25 = 14f;
38797 if (Main.getGoodWorld)
38798 {
38799 velocity.Y += 1f;
38800 num25 = 15.99f;
38801 }
38802 if (velocity.Y == 0f)
38803 {
38804 velocity.Y = 0.01f;
38805 }
38806 if (velocity.Y >= num25)
38807 {
38808 velocity.Y = num25;
38809 }
38810 }
38811 else
38812 {
38813 velocity.Y *= 0.8f;
38814 }
38815 break;
38816 }
38817 if (Main.netMode != 1 && ai[1] == 0f)
38818 {
38819 TargetClosest();
38820 netUpdate = true;
38821 }
38822 ai[1] += 1f;
38823 if (!(ai[1] >= 30f))
38824 {
38825 break;
38826 }
38827 if (ai[1] >= 60f)
38828 {
38829 ai[1] = 60f;
38830 if (Main.netMode != 1)
38831 {
38832 ai[1] = 0f;
38833 ai[2] = 1f;
38834 velocity.Y = -3f;
38835 netUpdate = true;
38836 }
38837 }
38839 Vector2 center = base.Center;
38840 if (!player3.dead && player3.active && Math.Abs(base.Center.X - player3.Center.X) / 16f <= (float)num4)
38841 {
38842 center = player3.Center;
38843 }
38844 center.Y -= 384f;
38845 if (velocity.Y == 0f)
38846 {
38847 velocity = center - base.Center;
38848 velocity = velocity.SafeNormalize(Vector2.Zero);
38849 velocity *= 20f;
38850 }
38851 else
38852 {
38853 velocity.Y *= 0.95f;
38854 }
38855 break;
38856 }
38857 case 5:
38858 {
38859 rotation *= 0.9f;
38860 noTileCollide = true;
38861 noGravity = true;
38862 if (flag2)
38863 {
38864 ai[3] = 0f;
38865 }
38866 if (ai[2] == 1f)
38867 {
38868 ai[1] += 1f;
38869 if (!(ai[1] >= 10f))
38870 {
38871 break;
38872 }
38873 if (Main.netMode != 1)
38874 {
38875 int num14 = 10;
38876 if (Main.getGoodWorld)
38877 {
38878 num14 = 15;
38879 }
38880 int num15 = num14;
38881 if (!flag2)
38882 {
38883 num15 = 6;
38884 }
38885 for (int j = 0; j < num15; j++)
38886 {
38887 Vector2 spinningpoint = new Vector2(9f, 0f);
38888 spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num14, Vector2.Zero);
38890 }
38891 }
38892 ai[0] = 0f;
38893 ai[1] = 0f;
38894 ai[2] = 0f;
38895 netUpdate = true;
38896 break;
38897 }
38898 if (Main.netMode != 1 && ai[1] == 0f)
38899 {
38900 TargetClosest();
38901 netUpdate = true;
38902 }
38903 ai[1] += 1f;
38904 if (ai[1] >= 50f)
38905 {
38906 ai[1] = 50f;
38907 if (Main.netMode != 1)
38908 {
38909 ai[1] = 0f;
38910 ai[2] = 1f;
38911 netUpdate = true;
38912 }
38913 }
38914 float num16 = 100f;
38915 for (int k = 0; k < 4; k++)
38916 {
38917 Vector2 vector2 = base.Center + Main.rand.NextVector2CircularEdge(num16, num16);
38918 if (!flag2)
38919 {
38920 vector2 += new Vector2(0f, 20f);
38921 }
38922 Vector2 v = vector2 - base.Center;
38923 v = v.SafeNormalize(Vector2.Zero) * -8f;
38924 int num17 = Dust.NewDust(vector2, 2, 2, 31, v.X, v.Y, 40, AI_121_QueenSlime_GetDustColor(), 1.8f);
38925 Main.dust[num17].position = vector2;
38926 Main.dust[num17].noGravity = true;
38927 Main.dust[num17].alpha = 250;
38928 Main.dust[num17].velocity = v;
38929 Main.dust[num17].customData = this;
38930 }
38931 if (flag2)
38932 {
38934 }
38935 break;
38936 }
38937 }
38938 dontTakeDamage = (hide = flag);
38939 if (num3 != scale)
38940 {
38941 position.X += width / 2;
38942 position.Y += height;
38943 scale = num3;
38944 width = (int)(114f * scale);
38945 height = (int)(100f * scale);
38946 position.X -= width / 2;
38947 position.Y -= height;
38948 }
38949 if (life <= 0)
38950 {
38951 return;
38952 }
38953 if (Main.rand.Next(360) == 0)
38954 {
38956 }
38957 if (Main.netMode == 1)
38958 {
38959 return;
38960 }
38961 if (localAI[0] >= (float)(lifeMax / 2) && life < lifeMax / 2)
38962 {
38963 localAI[0] = life;
38964 ai[0] = 0f;
38965 ai[1] = 0f;
38966 ai[2] = 0f;
38967 netUpdate = true;
38968 }
38969 int num29 = (int)((float)lifeMax * 0.02f);
38970 if (flag2)
38971 {
38972 num29 = (int)((float)lifeMax * 0.015f);
38973 }
38974 if (!((float)(life + num29) < localAI[0]))
38975 {
38976 return;
38977 }
38978 localAI[0] = life;
38979 int num30 = Main.rand.Next(1, 3);
38980 for (int num31 = 0; num31 < num30; num31++)
38981 {
38982 int x = (int)(position.X + (float)Main.rand.Next(width - 32));
38983 int y = (int)(position.Y + (float)Main.rand.Next(height - 32));
38984 int num32 = 658;
38985 switch (Main.rand.Next(3))
38986 {
38987 case 0:
38988 num32 = 658;
38989 break;
38990 case 1:
38991 num32 = 659;
38992 break;
38993 case 2:
38994 num32 = 660;
38995 break;
38996 }
38998 Main.npc[num33].SetDefaults(num32);
38999 Main.npc[num33].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
39000 Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
39001 Main.npc[num33].ai[0] = -500 * Main.rand.Next(3);
39002 Main.npc[num33].ai[1] = 0f;
39003 if (Main.netMode == 2 && num33 < 200)
39004 {
39005 NetMessage.SendData(23, -1, -1, null, num33);
39006 }
39007 }
39008 }
39009
39011 {
39012 if (ai[3] != 1f)
39013 {
39014 return ai[3] == 3f;
39015 }
39016 return true;
39017 }
39018
39020 {
39021 if (ai[3] != 2f)
39022 {
39023 return ai[3] == 3f;
39024 }
39025 return true;
39026 }
39027
39029 {
39030 float num = 4f;
39031 float num2 = 1f;
39032 float fadeIn = 0f;
39033 float num3 = 0.5f;
39034 int num4 = 2;
39035 int num5 = 267;
39036 switch (effectType)
39037 {
39038 case 1:
39039 num2 = 0.5f;
39040 fadeIn = 2f;
39041 num3 = 0f;
39042 break;
39043 case 2:
39044 case 4:
39045 num = 50f;
39046 num2 = 0.5f;
39047 fadeIn = 0f;
39048 num3 = 0f;
39049 num4 = 4;
39050 break;
39051 case 3:
39052 num = 30f;
39053 num2 = 0.1f;
39054 fadeIn = 2.5f;
39055 num3 = 0f;
39056 break;
39057 case 5:
39058 if (progress == 0f)
39059 {
39060 num4 = 0;
39061 }
39062 else
39063 {
39064 num4 = 5;
39065 num5 = Main.rand.Next(86, 92);
39066 }
39067 if (progress >= 1f)
39068 {
39069 num4 = 0;
39070 }
39071 break;
39072 }
39073 for (int i = 0; i < num4; i++)
39074 {
39075 Dust dust = Dust.NewDustPerfect(spot, num5, Main.rand.NextVector2CircularEdge(num, num) * (Main.rand.NextFloat() * (1f - num3) + num3), 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), (Main.rand.NextFloat() * 2f + 2f) * num2);
39076 dust.fadeIn = fadeIn;
39077 dust.noGravity = true;
39078 switch (effectType)
39079 {
39080 case 2:
39081 case 4:
39082 {
39083 dust.velocity *= 0.005f;
39084 dust.scale = 3f * Utils.GetLerpValue(0.7f, 0f, progress, clamped: true) * Utils.GetLerpValue(0f, 0.3f, progress, clamped: true);
39085 dust.velocity = ((float)Math.PI * 2f * ((float)i / 4f) + (float)Math.PI / 4f).ToRotationVector2() * 8f * Utils.GetLerpValue(1f, 0f, progress, clamped: true);
39086 dust.velocity += velocity * 0.3f;
39087 float num6 = 0f;
39088 if (effectType == 4)
39089 {
39090 num6 = 0.5f;
39091 }
39092 dust.color = Main.hslToRgb(((float)i / 5f + num6 + progress * 0.5f) % 1f, 1f, 0.5f);
39093 dust.color.A /= 2;
39094 dust.alpha = 127;
39095 break;
39096 }
39097 case 5:
39098 if (progress == 0f)
39099 {
39100 dust.customData = this;
39101 dust.scale = 1.5f;
39102 dust.fadeIn = 0f;
39103 dust.velocity = new Vector2(0f, -1f) + Main.rand.NextVector2Circular(1f, 1f);
39104 dust.color = new Color(255, 255, 255, 80) * 0.3f;
39105 }
39106 else
39107 {
39108 dust.color = Main.hslToRgb(progress * 2f % 1f, 1f, 0.5f);
39109 dust.alpha = 0;
39110 dust.scale = 1f;
39111 dust.fadeIn = 1.3f;
39112 dust.velocity *= 3f;
39113 dust.velocity.X *= 0.1f;
39114 dust.velocity += velocity * 1f;
39115 }
39116 break;
39117 }
39118 }
39119 }
39120
39121 public static bool ShouldEmpressBeEnraged()
39122 {
39123 if (Main.remixWorld)
39124 {
39125 if (empressRageMode)
39126 {
39127 return true;
39128 }
39129 int num = -1;
39130 for (int i = 0; i < 200; i++)
39131 {
39132 if (Main.npc[i].type == 636)
39133 {
39134 num = i;
39135 break;
39136 }
39137 }
39138 if (num >= 0 && (double)Main.npc[num].Center.Y < Main.worldSurface * 16.0)
39139 {
39140 empressRageMode = true;
39141 return true;
39142 }
39143 empressRageMode = false;
39144 return false;
39145 }
39146 return Main.dayTime;
39147 }
39148
39149 private void AI_120_HallowBoss()
39150 {
39151 Vector2 vector = new Vector2(-150f, -250f);
39152 Vector2 vector2 = new Vector2(150f, -250f);
39153 Vector2 vector3 = new Vector2(0f, -350f);
39154 Vector2 vector4 = new Vector2(0f, -350f);
39155 Vector2 vector5 = new Vector2(-80f, -500f);
39156 float num = 0.5f;
39157 float num2 = 12f;
39158 float num3 = 40f;
39159 float num4 = 6400f;
39160 int num5 = 40;
39161 int num6 = 50;
39162 int num7 = 70;
39163 int num8 = 45;
39164 int num9 = 45;
39165 int num10 = 50;
39166 bool flag = AI_120_HallowBoss_IsInPhase2();
39167 bool flag2 = Main.expertMode;
39168 bool flag3 = flag && flag2;
39171 {
39172 this.ai[3] += 2f;
39173 }
39174 bool flag5 = true;
39175 int num11 = 30;
39176 int num12 = 30;
39177 int num13 = 30;
39178 int num14 = 35;
39179 int num15 = 65;
39180 if (flag)
39181 {
39182 num6 = 60;
39183 num8 = 50;
39184 num9 = 50;
39185 num10 = 60;
39186 num7 = 65;
39187 num11 = 35;
39188 num12 = 35;
39189 num13 = 35;
39190 num14 = 40;
39191 num15 = 30;
39192 }
39198 if (flag4)
39199 {
39200 num6 = 9999;
39201 num8 = 9999;
39202 num9 = 9999;
39203 num10 = 9999;
39204 num7 = 9999;
39205 flag2 = true;
39206 }
39207 float num16 = (flag2 ? 0.3f : 1f);
39208 bool flag6 = true;
39209 int num17 = 0;
39210 if (flag)
39211 {
39212 num17 += 15;
39213 }
39214 if (flag2)
39215 {
39216 num17 += 5;
39217 }
39218 switch ((int)this.ai[0])
39219 {
39220 case 0:
39221 if (this.ai[1] == 0f)
39222 {
39223 velocity = new Vector2(0f, 5f);
39224 if (Main.netMode != 1)
39225 {
39227 }
39228 }
39229 if (this.ai[1] == 10f)
39230 {
39232 }
39233 velocity *= 0.95f;
39234 if (this.ai[1] > 10f && this.ai[1] < 150f)
39235 {
39236 int num67 = 2;
39237 for (int m = 0; m < num67; m++)
39238 {
39239 float num68 = MathHelper.Lerp(1.3f, 0.7f, Opacity) * Utils.GetLerpValue(0f, 120f, this.ai[1], clamped: true);
39240 Color newColor2 = Main.hslToRgb(this.ai[1] / 180f, 1f, 0.5f);
39241 int num69 = Dust.NewDust(position, width, height, 267, 0f, 0f, 0, newColor2);
39242 Main.dust[num69].position = base.Center + Main.rand.NextVector2Circular((float)width * 3f, (float)height * 3f) + new Vector2(0f, -150f);
39243 Main.dust[num69].velocity *= Main.rand.NextFloat() * 0.8f;
39244 Main.dust[num69].noGravity = true;
39245 Main.dust[num69].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * num68;
39246 Main.dust[num69].velocity += Vector2.UnitY * 3f;
39247 Main.dust[num69].scale = 0.35f;
39248 if (num69 != 6000)
39249 {
39251 dust2.scale /= 2f;
39252 dust2.fadeIn *= 0.85f;
39253 dust2.color = new Color(255, 255, 255, 255);
39254 }
39255 }
39256 }
39257 this.ai[1] += 1f;
39258 flag5 = false;
39259 flag6 = false;
39260 Opacity = MathHelper.Clamp(this.ai[1] / 180f, 0f, 1f);
39261 if (this.ai[1] >= 180f)
39262 {
39264 {
39265 this.ai[3] += 2f;
39266 }
39267 this.ai[0] = 1f;
39268 this.ai[1] = 0f;
39269 netUpdate = true;
39270 TargetClosest();
39271 }
39272 break;
39273 case 1:
39274 {
39275 float num34 = (flag ? 20f : 45f);
39276 if (Main.getGoodWorld)
39277 {
39278 num34 /= 2f;
39279 }
39280 if (this.ai[1] <= 10f)
39281 {
39282 if (this.ai[1] == 0f)
39283 {
39284 TargetClosest();
39285 }
39287 if (targetData4.Invalid)
39288 {
39289 this.ai[0] = 13f;
39290 this.ai[1] = 0f;
39291 this.ai[2] += 1f;
39292 velocity /= 4f;
39293 netUpdate = true;
39294 break;
39295 }
39296 Vector2 center = targetData4.Center;
39298 netUpdate = true;
39299 }
39300 if (velocity.Length() > 16f && this.ai[1] > 10f)
39301 {
39302 velocity /= 2f;
39303 }
39304 velocity *= 0.92f;
39305 this.ai[1] += 1f;
39306 if (!(this.ai[1] >= num34))
39307 {
39308 break;
39309 }
39310 int num35 = (int)this.ai[2];
39311 int num36 = 2;
39312 int num37 = 0;
39313 if (!flag)
39314 {
39315 int num38 = num37++;
39316 int num39 = num37++;
39317 int num40 = num37++;
39318 int num41 = num37++;
39319 int num42 = num37++;
39320 int num43 = num37++;
39321 int num44 = num37++;
39322 int num45 = num37++;
39323 int num46 = num37++;
39324 int num47 = num37++;
39325 if (num35 % num37 == num38)
39326 {
39327 num36 = 2;
39328 }
39329 if (num35 % num37 == num39)
39330 {
39331 num36 = 8;
39332 }
39333 if (num35 % num37 == num40)
39334 {
39335 num36 = 6;
39336 }
39337 if (num35 % num37 == num41)
39338 {
39339 num36 = 8;
39340 }
39341 if (num35 % num37 == num42)
39342 {
39343 num36 = 5;
39344 }
39345 if (num35 % num37 == num43)
39346 {
39347 num36 = 2;
39348 }
39349 if (num35 % num37 == num44)
39350 {
39351 num36 = 8;
39352 }
39353 if (num35 % num37 == num45)
39354 {
39355 num36 = 4;
39356 }
39357 if (num35 % num37 == num46)
39358 {
39359 num36 = 8;
39360 }
39361 if (num35 % num37 == num47)
39362 {
39363 num36 = 5;
39364 }
39365 if ((float)life / (float)lifeMax <= 0.5f)
39366 {
39367 num36 = 10;
39368 }
39369 }
39370 if (flag)
39371 {
39372 int num48 = num37++;
39373 int num49 = num37++;
39374 int num50 = num37++;
39375 int num51 = -1;
39376 if (flag2)
39377 {
39378 num51 = num37++;
39379 }
39380 int num52 = num37++;
39381 int num53 = num37++;
39382 int num54 = num37++;
39383 int num55 = num37++;
39384 int num56 = num37++;
39385 int num57 = num37++;
39386 if (num35 % num37 == num48)
39387 {
39388 num36 = 7;
39389 }
39390 if (num35 % num37 == num49)
39391 {
39392 num36 = 2;
39393 }
39394 if (num35 % num37 == num50)
39395 {
39396 num36 = 8;
39397 }
39398 if (num35 % num37 == num52)
39399 {
39400 num36 = 5;
39401 }
39402 if (num35 % num37 == num53)
39403 {
39404 num36 = 2;
39405 }
39406 if (num35 % num37 == num54)
39407 {
39408 num36 = 6;
39409 }
39410 if (num35 % num37 == num54)
39411 {
39412 num36 = 6;
39413 }
39414 if (num35 % num37 == num55)
39415 {
39416 num36 = 4;
39417 }
39418 if (num35 % num37 == num56)
39419 {
39420 num36 = 8;
39421 }
39422 if (num35 % num37 == num51)
39423 {
39424 num36 = 11;
39425 }
39426 if (num35 % num37 == num57)
39427 {
39428 num36 = 12;
39429 }
39430 }
39431 TargetClosest();
39433 bool flag12 = false;
39435 {
39436 if (!Main.dayTime)
39437 {
39438 flag12 = true;
39439 }
39440 if (Main.dayTime && Main.time >= 53400.0)
39441 {
39442 flag12 = true;
39443 }
39444 }
39445 if (targetData5.Invalid || Distance(targetData5.Center) > num4 || flag12)
39446 {
39447 num36 = 13;
39448 }
39449 if (num36 == 8 && targetData5.Center.X > base.Center.X)
39450 {
39451 num36 = 9;
39452 }
39453 if (flag2 && num36 != 5 && num36 != 12)
39454 {
39455 velocity = DirectionFrom(targetData5.Center).SafeNormalize(Vector2.Zero).RotatedBy((float)Math.PI / 2f * (float)(targetData5.Center.X > base.Center.X).ToDirectionInt()) * 20f;
39456 }
39457 this.ai[0] = num36;
39458 this.ai[1] = 0f;
39459 this.ai[2] += 1f;
39460 netUpdate = true;
39461 break;
39462 }
39463 case 2:
39464 {
39465 if (this.ai[1] == 0f)
39466 {
39468 }
39469 float num90 = 90f - (float)num17;
39470 Vector2 vector36 = new Vector2(-55f, -30f);
39472 Vector2 vector37 = (targetData11.Invalid ? base.Center : targetData11.Center);
39473 if (Distance(vector37 + vector) > num3)
39474 {
39475 SimpleFlyMovement(DirectionTo(vector37 + vector).SafeNormalize(Vector2.Zero) * num2, num);
39476 }
39477 if (this.ai[1] < 60f)
39478 {
39479 AI_120_HallowBoss_DoMagicEffect(base.Center + vector36, 1, Utils.GetLerpValue(0f, 60f, this.ai[1], clamped: true));
39480 }
39481 int num91 = 3;
39482 if (flag2)
39483 {
39484 num91 = 2;
39485 }
39486 if ((int)this.ai[1] % num91 == 0 && this.ai[1] < 60f)
39487 {
39488 float ai3 = this.ai[1] / 60f;
39489 Vector2 vector38 = new Vector2(0f, -6f).RotatedBy((float)Math.PI / 2f * Main.rand.NextFloatDirection());
39490 if (flag3)
39491 {
39492 vector38 = new Vector2(0f, -10f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat());
39493 }
39494 if (Main.netMode != 1)
39495 {
39497 }
39498 if (Main.netMode != 1)
39499 {
39500 int num92 = (int)(this.ai[1] / (float)num91);
39501 for (int num93 = 0; num93 < 255; num93++)
39502 {
39503 if (Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f))
39504 {
39506 }
39507 }
39508 }
39509 }
39510 this.ai[1] += 1f;
39511 if (this.ai[1] >= 60f + num90)
39512 {
39513 this.ai[0] = 1f;
39514 this.ai[1] = 0f;
39515 netUpdate = true;
39516 }
39517 break;
39518 }
39519 case 3:
39520 {
39521 this.ai[1] += 1f;
39523 Vector2 vector23 = (targetData8.Invalid ? base.Center : targetData8.Center);
39524 if (Distance(vector23 + vector2) > num3)
39525 {
39526 SimpleFlyMovement(DirectionTo(vector23 + vector2).SafeNormalize(Vector2.Zero) * num2, num);
39527 }
39528 if ((int)this.ai[1] % 180 == 0)
39529 {
39530 Vector2 vector24 = new Vector2(0f, -100f);
39532 }
39533 if (this.ai[1] >= 120f)
39534 {
39535 this.ai[0] = 1f;
39536 this.ai[1] = 0f;
39537 netUpdate = true;
39538 }
39539 break;
39540 }
39541 case 4:
39542 {
39543 float num81 = 20 - num17;
39544 new Vector2(0f, -100f);
39545 if (this.ai[1] == 0f)
39546 {
39548 }
39549 if (this.ai[1] >= 6f && this.ai[1] < 54f)
39550 {
39551 AI_120_HallowBoss_DoMagicEffect(base.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, 100f, this.ai[1], clamped: true));
39552 AI_120_HallowBoss_DoMagicEffect(base.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, 100f, this.ai[1], clamped: true));
39553 }
39555 Vector2 vector29 = (targetData10.Invalid ? base.Center : targetData10.Center);
39556 if (Distance(vector29 + vector3) > num3)
39557 {
39558 SimpleFlyMovement(DirectionTo(vector29 + vector3).SafeNormalize(Vector2.Zero) * num2, num);
39559 }
39560 int num82 = 4;
39561 if (flag2)
39562 {
39563 num82 = 5;
39564 }
39565 if ((int)this.ai[1] % 4 == 0 && this.ai[1] < 100f)
39566 {
39567 int num83 = 1;
39568 int num84 = 0;
39569 for (int n = 0; n < num83; n++)
39570 {
39571 int num85 = (int)this.ai[1] / 4;
39572 Vector2 vector30 = Vector2.UnitX.RotatedBy((float)Math.PI / (float)(num82 * 2) + (float)num85 * ((float)Math.PI / (float)num82) + 0f);
39573 if (!flag2)
39574 {
39575 vector30.X += ((vector30.X > 0f) ? 0.5f : (-0.5f));
39576 }
39577 vector30.Normalize();
39578 float num86 = 300f;
39579 if (flag2)
39580 {
39581 num86 = 450f;
39582 }
39583 Vector2 center4 = targetData10.Center;
39584 if (Distance(center4) > 2400f)
39585 {
39586 continue;
39587 }
39588 if (Vector2.Dot(targetData10.Velocity.SafeNormalize(Vector2.UnitY), vector30) > 0f)
39589 {
39590 vector30 *= -1f;
39591 }
39592 int num87 = 90;
39593 Vector2 vector31 = center4 + targetData10.Velocity * num87;
39594 Vector2 vector32 = center4 + vector30 * num86 - targetData10.Velocity * 30f;
39595 if (vector32.Distance(center4) < num86)
39596 {
39598 if (vector33 == Vector2.Zero)
39599 {
39601 }
39603 }
39605 if (Main.netMode != 1)
39606 {
39607 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector32, Vector2.Zero, 919, num6, 0f, Main.myPlayer, v3.ToRotation(), this.ai[1] / 100f);
39608 }
39609 if (Main.netMode == 1)
39610 {
39611 continue;
39612 }
39613 int num88 = (int)(this.ai[1] / 4f);
39614 for (int num89 = 0; num89 < 255; num89++)
39615 {
39616 if (!Boss_CanShootExtraAt(num89, num88 % 3, 3, 2400f))
39617 {
39618 continue;
39619 }
39621 center4 = player2.Center;
39622 if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), vector30) > 0f)
39623 {
39624 vector30 *= -1f;
39625 }
39626 Vector2 vector34 = center4 + player2.velocity * num87;
39627 vector32 = center4 + vector30 * num86 - player2.velocity * 30f;
39628 if (vector32.Distance(center4) < num86)
39629 {
39631 if (vector35 == Vector2.Zero)
39632 {
39634 }
39636 }
39637 v3 = vector34 - vector32;
39638 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector32, Vector2.Zero, 919, num6, 0f, Main.myPlayer, v3.ToRotation(), this.ai[1] / 100f);
39639 }
39640 }
39641 }
39642 this.ai[1] += 1f;
39643 if (this.ai[1] >= 100f + num81)
39644 {
39645 this.ai[0] = 1f;
39646 this.ai[1] = 0f;
39647 netUpdate = true;
39648 }
39649 break;
39650 }
39651 case 5:
39652 {
39653 if (this.ai[1] == 0f)
39654 {
39656 }
39657 float num63 = 30f;
39658 num63 -= (float)num17;
39659 Vector2 vector19 = new Vector2(55f, -30f);
39660 Vector2 vector20 = base.Center + vector19;
39661 if (this.ai[1] < 42f)
39662 {
39663 AI_120_HallowBoss_DoMagicEffect(base.Center + vector19, 3, Utils.GetLerpValue(0f, 42f, this.ai[1], clamped: true));
39664 }
39666 Vector2 vector21 = (targetData7.Invalid ? base.Center : targetData7.Center);
39667 if (Distance(vector21 + vector4) > num3)
39668 {
39669 SimpleFlyMovement(DirectionTo(vector21 + vector4).SafeNormalize(Vector2.Zero) * num2, num);
39670 }
39671 if ((int)this.ai[1] % 42 == 0 && this.ai[1] < 42f)
39672 {
39673 float num64 = (float)Math.PI * 2f * Main.rand.NextFloat();
39674 for (float num65 = 0f; num65 < 1f; num65 += 1f / 13f)
39675 {
39676 float num66 = num65;
39677 Vector2 vector22 = Vector2.UnitY.RotatedBy((float)Math.PI / 2f + (float)Math.PI * 2f * num66 + num64);
39678 if (Main.netMode != 1)
39679 {
39680 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector20 + vector22.RotatedBy(-1.5707963705062866) * 30f, vector22 * 8f, 872, num9, 0f, Main.myPlayer, 0f, num66);
39681 }
39682 }
39683 }
39684 this.ai[1] += 1f;
39685 if (this.ai[1] >= 42f + num63)
39686 {
39687 this.ai[0] = 1f;
39688 this.ai[1] = 0f;
39689 netUpdate = true;
39690 }
39691 break;
39692 }
39693 case 6:
39694 {
39695 float num25 = 120 - num17;
39696 Vector2 vector8 = new Vector2(0f, -100f);
39697 Vector2 vector9 = base.Center + vector8;
39699 Vector2 vector10 = (targetData2.Invalid ? base.Center : targetData2.Center);
39700 if (Distance(vector10 + vector5) > num3)
39701 {
39702 SimpleFlyMovement(DirectionTo(vector10 + vector5).SafeNormalize(Vector2.Zero) * num2 * 0.3f, num * 0.7f);
39703 }
39704 if ((int)this.ai[1] % 60 == 0 && this.ai[1] < 180f)
39705 {
39706 int num26 = (int)this.ai[1] / 60;
39707 int num27 = ((targetData2.Center.X > base.Center.X) ? 1 : 0);
39708 float num28 = 6f;
39709 if (flag2)
39710 {
39711 num28 = 8f;
39712 }
39713 float num29 = 1f / num28;
39714 for (float num30 = 0f; num30 < 1f; num30 += num29)
39715 {
39716 float num31 = (num30 + num29 * 0.5f + (float)num26 * num29 * 0.5f) % 1f;
39717 float ai = (float)Math.PI * 2f * (num31 + (float)num27);
39718 if (Main.netMode != 1)
39719 {
39721 }
39722 }
39723 }
39724 this.ai[1] += 1f;
39725 if (this.ai[1] >= 180f + num25)
39726 {
39727 this.ai[0] = 1f;
39728 this.ai[1] = 0f;
39729 netUpdate = true;
39730 }
39731 break;
39732 }
39733 case 7:
39734 {
39735 float num70 = 20f;
39736 float num71 = 60f;
39737 float num72 = num71 * 4f;
39738 if (flag2)
39739 {
39740 num70 = 40f;
39741 num71 = 40f;
39742 num72 = num71 * 6f;
39743 }
39744 num70 -= (float)num17;
39746 Vector2 vector25 = (targetData9.Invalid ? base.Center : targetData9.Center);
39747 if (Distance(vector25 + vector4) > num3)
39748 {
39749 SimpleFlyMovement(DirectionTo(vector25 + vector4).SafeNormalize(Vector2.Zero) * num2 * 0.4f, num);
39750 }
39751 if ((float)(int)this.ai[1] % num71 == 0f && this.ai[1] < num72)
39752 {
39754 Main.rand.NextFloat();
39755 int num73 = (int)this.ai[1] / (int)num71;
39756 float num74 = 13f;
39757 float num75 = 150f;
39758 float num76 = num74 * num75;
39759 Vector2 center3 = targetData9.Center;
39760 if (Distance(center3) <= 3200f)
39761 {
39764 float num77 = 0.4f;
39765 float num78 = 1.4f;
39766 float num79 = 1f;
39767 if (flag2)
39768 {
39769 num74 += 5f;
39770 num75 += 50f;
39771 num79 *= 1f;
39772 num76 *= 0.5f;
39773 }
39774 switch (num73)
39775 {
39776 case 0:
39777 center3 += new Vector2((0f - num76) / 2f, 0f) * num79;
39778 vector26 = new Vector2(0f, num76);
39780 break;
39781 case 1:
39782 center3 += new Vector2(num76 / 2f, num75 / 2f) * num79;
39783 vector26 = new Vector2(0f, num76);
39785 break;
39786 case 2:
39787 center3 += new Vector2(0f - num76, 0f - num76) * num77 * num79;
39788 vector26 = new Vector2(num76 * num78, 0f);
39789 vector27 = new Vector2(1f, 1f);
39790 break;
39791 case 3:
39792 center3 += new Vector2(num76 * num77 + num75 / 2f, (0f - num76) * num77) * num79;
39793 vector26 = new Vector2((0f - num76) * num78, 0f);
39794 vector27 = new Vector2(-1f, 1f);
39795 break;
39796 case 4:
39797 center3 += new Vector2(0f - num76, num76) * num77 * num79;
39798 vector26 = new Vector2(num76 * num78, 0f);
39799 vector27 = center3.DirectionTo(targetData9.Center);
39800 break;
39801 case 5:
39802 center3 += new Vector2(num76 * num77 + num75 / 2f, num76 * num77) * num79;
39803 vector26 = new Vector2((0f - num76) * num78, 0f);
39804 vector27 = center3.DirectionTo(targetData9.Center);
39805 break;
39806 }
39807 for (float num80 = 0f; num80 <= 1f; num80 += 1f / num74)
39808 {
39809 Vector2 origin = center3 + vector26 * (num80 - 0.5f);
39811 if (flag2)
39812 {
39813 Vector2 vector28 = targetData9.Velocity * 20f * num80;
39814 Vector2 value2 = origin.DirectionTo(targetData9.Center + vector28);
39815 v2 = Vector2.Lerp(vector27, value2, 0.75f).SafeNormalize(Vector2.UnitY);
39816 }
39817 float ai2 = num80;
39818 if (Main.netMode != 1)
39819 {
39821 }
39822 }
39823 }
39824 }
39825 this.ai[1] += 1f;
39826 if (this.ai[1] >= num72 + num70)
39827 {
39828 this.ai[0] = 1f;
39829 this.ai[1] = 0f;
39830 netUpdate = true;
39831 }
39832 break;
39833 }
39834 case 8:
39835 case 9:
39836 {
39837 float num32 = 20 - num17;
39838 Vector2 vector11 = new Vector2(0f, -100f);
39839 _ = base.Center + vector11;
39840 flag6 = !(this.ai[1] >= 6f) || !(this.ai[1] <= 40f);
39841 int num33 = ((this.ai[0] != 8f) ? 1 : (-1));
39842 AI_120_HallowBoss_DoMagicEffect(base.Center, 5, Utils.GetLerpValue(40f, 90f, this.ai[1], clamped: true));
39843 if (this.ai[1] <= 40f)
39844 {
39845 if (this.ai[1] == 20f)
39846 {
39848 }
39850 Vector2 destination = (targetData3.Invalid ? base.Center : targetData3.Center) + new Vector2(num33 * -550, 0f);
39851 SimpleFlyMovement(DirectionTo(destination).SafeNormalize(Vector2.Zero) * num2, num * 2f);
39852 if (this.ai[1] == 40f)
39853 {
39854 velocity *= 0.3f;
39855 }
39856 }
39857 else if (this.ai[1] <= 90f)
39858 {
39859 velocity = Vector2.Lerp(value2: new Vector2(num33 * 50, 0f), value1: velocity, amount: 0.05f);
39860 if (this.ai[1] == 90f)
39861 {
39862 velocity *= 0.7f;
39863 }
39864 num16 *= 1.5f;
39865 }
39866 else
39867 {
39868 velocity *= 0.92f;
39869 }
39870 this.ai[1] += 1f;
39871 if (this.ai[1] >= 90f + num32)
39872 {
39873 this.ai[0] = 1f;
39874 this.ai[1] = 0f;
39875 netUpdate = true;
39876 }
39877 break;
39878 }
39879 case 10:
39880 {
39881 float num94 = 20 - num17;
39882 if (this.ai[1] == 0f)
39883 {
39885 }
39886 flag6 = !(this.ai[1] >= 30f) || !(this.ai[1] <= 170f);
39887 velocity *= 0.95f;
39888 if (this.ai[1] == 90f)
39889 {
39890 if (this.ai[3] == 0f)
39891 {
39892 this.ai[3] = 1f;
39893 }
39894 if (this.ai[3] == 2f)
39895 {
39896 this.ai[3] = 3f;
39897 }
39898 base.Center = GetTargetData().Center + new Vector2(0f, -250f);
39899 netUpdate = true;
39900 }
39901 this.ai[1] += 1f;
39902 if (this.ai[1] >= 180f + num94)
39903 {
39904 this.ai[0] = 1f;
39905 this.ai[1] = 0f;
39906 this.ai[2] = 0f;
39907 netUpdate = true;
39908 }
39909 break;
39910 }
39911 case 11:
39912 {
39913 if (this.ai[1] == 0f)
39914 {
39916 }
39917 float num58 = 20 - num17;
39918 new Vector2(0f, -100f);
39919 if (this.ai[1] >= 6f && this.ai[1] < 54f)
39920 {
39921 AI_120_HallowBoss_DoMagicEffect(base.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, 100f, this.ai[1], clamped: true));
39922 AI_120_HallowBoss_DoMagicEffect(base.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, 100f, this.ai[1], clamped: true));
39923 }
39925 Vector2 vector12 = (targetData6.Invalid ? base.Center : targetData6.Center);
39926 if (Distance(vector12 + vector3) > num3)
39927 {
39928 SimpleFlyMovement(DirectionTo(vector12 + vector3).SafeNormalize(Vector2.Zero) * num2, num);
39929 }
39930 if ((int)this.ai[1] % 3 == 0 && this.ai[1] < 100f)
39931 {
39932 int num59 = 1;
39933 for (int k = 0; k < num59; k++)
39934 {
39935 Vector2 vector13 = -targetData6.Velocity;
39936 vector13.SafeNormalize(-Vector2.UnitY);
39937 float num60 = 100f;
39938 Vector2 center2 = targetData6.Center;
39939 if (Distance(center2) > 2400f)
39940 {
39941 continue;
39942 }
39943 int num61 = 90;
39944 Vector2 vector14 = center2 + targetData6.Velocity * num61;
39946 if (vector15.Distance(center2) < num60)
39947 {
39949 if (vector16 == Vector2.Zero)
39950 {
39952 }
39954 }
39956 if (Main.netMode != 1)
39957 {
39958 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector15, Vector2.Zero, 919, num6, 0f, Main.myPlayer, v.ToRotation(), this.ai[1] / 100f);
39959 }
39960 if (Main.netMode == 1)
39961 {
39962 continue;
39963 }
39964 int num62 = (int)(this.ai[1] / 3f);
39965 for (int l = 0; l < 255; l++)
39966 {
39967 if (!Boss_CanShootExtraAt(l, num62 % 3, 3, 2400f))
39968 {
39969 continue;
39970 }
39971 Player player = Main.player[l];
39972 vector13 = -player.velocity;
39973 vector13.SafeNormalize(-Vector2.UnitY);
39974 num60 = 100f;
39975 center2 = player.Center;
39976 num61 = 90;
39977 Vector2 vector17 = center2 + player.velocity * num61;
39979 if (vector15.Distance(center2) < num60)
39980 {
39982 if (vector18 == Vector2.Zero)
39983 {
39985 }
39987 }
39988 v = vector17 - vector15;
39989 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), vector15, Vector2.Zero, 919, num6, 0f, Main.myPlayer, v.ToRotation(), this.ai[1] / 100f);
39990 }
39991 }
39992 }
39993 this.ai[1] += 1f;
39994 if (this.ai[1] >= 100f + num58)
39995 {
39996 this.ai[0] = 1f;
39997 this.ai[1] = 0f;
39998 netUpdate = true;
39999 }
40000 break;
40001 }
40002 case 12:
40003 {
40004 float num21 = 90f - (float)num17;
40005 Vector2 vector6 = new Vector2(-55f, -30f);
40006 if (this.ai[1] == 0f)
40007 {
40009 velocity = new Vector2(0f, -12f);
40010 }
40011 velocity *= 0.95f;
40012 bool flag11 = this.ai[1] < 60f && this.ai[1] >= 10f;
40013 if (flag11)
40014 {
40015 AI_120_HallowBoss_DoMagicEffect(base.Center + vector6, 1, Utils.GetLerpValue(0f, 60f, this.ai[1], clamped: true));
40016 }
40017 int num22 = 6;
40018 if (flag2)
40019 {
40020 num22 = 4;
40021 }
40022 float num23 = (this.ai[1] - 10f) / 50f;
40023 if ((int)this.ai[1] % num22 == 0 && flag11)
40024 {
40025 _ = this.ai[1] / 60f;
40026 Vector2 vector7 = (vector7 = new Vector2(0f, -20f).RotatedBy((float)Math.PI * 2f * num23));
40027 if (Main.netMode != 1)
40028 {
40030 }
40031 if (Main.netMode != 1)
40032 {
40033 int num24 = (int)(this.ai[1] % (float)num22);
40034 for (int j = 0; j < 255; j++)
40035 {
40036 if (Boss_CanShootExtraAt(j, num24 % 3, 3, 2400f))
40037 {
40039 }
40040 }
40041 }
40042 }
40043 this.ai[1] += 1f;
40044 if (this.ai[1] >= 60f + num21)
40045 {
40046 this.ai[0] = 1f;
40047 this.ai[1] = 0f;
40048 netUpdate = true;
40049 }
40050 break;
40051 }
40052 case 13:
40053 {
40054 new Vector2(-55f, -30f);
40055 if (this.ai[1] == 0f)
40056 {
40058 velocity = new Vector2(0f, -7f);
40059 }
40060 velocity *= 0.95f;
40061 TargetClosest();
40063 flag5 = false;
40064 bool flag7 = false;
40065 bool flag8 = false;
40066 if (!flag7)
40067 {
40069 {
40070 if (!Main.dayTime)
40071 {
40072 flag8 = true;
40073 }
40074 if (Main.dayTime && Main.time >= 53400.0)
40075 {
40076 flag8 = true;
40077 }
40078 }
40079 flag7 = flag7 || flag8;
40080 }
40081 if (!flag7)
40082 {
40083 bool flag9 = targetData.Invalid || Distance(targetData.Center) > num4;
40084 flag7 = flag7 || flag9;
40085 }
40086 alpha = Utils.Clamp(alpha + flag7.ToDirectionInt() * 5, 0, 255);
40087 bool flag10 = alpha == 0 || alpha == 255;
40088 int num18 = 5;
40089 for (int i = 0; i < num18; i++)
40090 {
40091 float num19 = MathHelper.Lerp(1.3f, 0.7f, Opacity);
40092 Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f);
40093 int num20 = Dust.NewDust(position - base.Size * 0.5f, width * 2, height * 2, 267, 0f, 0f, 0, newColor);
40094 Main.dust[num20].position = base.Center + Main.rand.NextVector2Circular(width, height);
40095 Main.dust[num20].velocity *= Main.rand.NextFloat() * 0.8f;
40096 Main.dust[num20].noGravity = true;
40097 Main.dust[num20].scale = 0.9f + Main.rand.NextFloat() * 1.2f;
40098 Main.dust[num20].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * num19;
40099 Main.dust[num20].velocity += Vector2.UnitY * -2f;
40100 Main.dust[num20].scale = 0.35f;
40101 if (num20 != 6000)
40102 {
40103 Dust dust = Dust.CloneDust(num20);
40104 dust.scale /= 2f;
40105 dust.fadeIn *= 0.85f;
40106 dust.color = new Color(255, 255, 255, 255);
40107 }
40108 }
40109 this.ai[1] += 1f;
40110 if (!(this.ai[1] >= 20f && flag10))
40111 {
40112 break;
40113 }
40114 if (alpha == 255)
40115 {
40116 active = false;
40117 if (Main.netMode != 1)
40118 {
40119 NetMessage.SendData(23, -1, -1, null, whoAmI);
40120 }
40121 return;
40122 }
40123 this.ai[0] = 1f;
40124 this.ai[1] = 0f;
40125 netUpdate = true;
40126 break;
40127 }
40128 }
40131 if (flag4)
40132 {
40133 damage = 9999;
40134 }
40135 if (flag)
40136 {
40137 defense = (int)((float)defDefense * 1.2f);
40138 }
40139 else
40140 {
40142 }
40143 if ((localAI[0] += 1f) >= 44f)
40144 {
40145 localAI[0] = 0f;
40146 }
40147 if (flag5)
40148 {
40149 alpha = Utils.Clamp(alpha - 5, 0, 255);
40150 }
40152 }
40153
40155 {
40157 targetPosition += new Vector2(0f, -300f);
40158 if (Distance(targetPosition) > 200f)
40159 {
40161 }
40162 Vector2 vector = targetPosition - base.Center;
40163 float lerpValue = Utils.GetLerpValue(100f, 600f, vector.Length(), clamped: true);
40164 float num = vector.Length();
40165 if (num > 18f)
40166 {
40167 num = 18f;
40168 }
40169 velocity = Vector2.Lerp(vector.SafeNormalize(Vector2.Zero) * num, vector / 6f, lerpValue);
40170 }
40171
40173 {
40175 {
40176 return false;
40177 }
40179 {
40180 return false;
40181 }
40182 Player player = Main.player[playerIndex];
40183 if (!player.active || player.dead || !playerInteraction[playerIndex])
40184 {
40185 return false;
40186 }
40187 if (Distance(player.Center) > attackScanDistance)
40188 {
40189 return false;
40190 }
40191 return true;
40192 }
40193
40194 private void AI_119_Dandelion()
40195 {
40196 if (!Main.IsItAHappyWindyDay && timeLeft > 10)
40197 {
40198 timeLeft = 10;
40199 }
40200 bool flag = false;
40201 float num = 0f;
40202 float num2 = 0f;
40205 if (targetData.Type == NPCTargetType.Player)
40206 {
40207 Rectangle hitbox = targetData.Hitbox;
40208 float windSpeedCurrent = Main.windSpeedCurrent;
40209 num = (float)hitbox.Center.X - base.Center.X;
40210 num2 = Math.Abs(num);
40211 flag = Math.Abs((float)hitbox.Center.Y - base.Center.Y) < 100f && num2 < 600f && ((num > 0f && windSpeedCurrent > 0f) || (num < 0f && windSpeedCurrent < 0f));
40212 }
40213 if (ai[0] == 1f)
40214 {
40215 localAI[0] = 0f;
40216 if (num2 < 500f)
40217 {
40218 localAI[0] = 1f;
40219 }
40220 if (Main.netMode == 1)
40221 {
40222 return;
40223 }
40224 if (!flag)
40225 {
40226 ai[0] = 0f;
40227 netUpdate = true;
40228 }
40229 else
40230 {
40231 if (localAI[0] != 1f)
40232 {
40233 return;
40234 }
40235 localAI[1] += 1f;
40236 if (localAI[1] > 80f)
40237 {
40238 ai[0] = 0f;
40239 netUpdate = true;
40240 }
40241 else
40242 {
40243 if (localAI[1] != 40f)
40244 {
40245 return;
40246 }
40247 for (int i = 0; i < 1 + Main.rand.Next(3); i++)
40248 {
40249 int num3 = -1;
40250 if (num > 0f)
40251 {
40252 num3 = 1;
40253 }
40254 Vector2 vector = new Vector2(num3 * Main.rand.Next(-2, 10), 10 + Main.rand.Next(-6, 6));
40255 Vector2 vector2 = new Vector2(2f * (float)num3, -2f);
40256 vector2 += vector * 0.25f;
40257 if (vector2.Y > -3f)
40258 {
40259 vector2.Y = -3f;
40260 }
40261 Vector2 vector3 = base.Center + vector;
40262 vector3.X += num3 * 6;
40263 int num4 = 7;
40265 }
40266 netUpdate = true;
40267 }
40268 }
40269 }
40270 else if (ai[0] == 0f)
40271 {
40272 localAI[0] = 0f;
40273 localAI[1] = 0f;
40274 if (Main.netMode != 1 && flag)
40275 {
40276 ai[0] = 1f;
40277 netUpdate = true;
40278 }
40279 }
40280 }
40281
40282 private void AI_118_Seahorses()
40283 {
40284 noGravity = wet;
40285 Collision.GetWaterLineIterate(base.Center.ToTileCoordinates(), out var waterLineHeight);
40286 bool flag = waterLineHeight > 0f && base.Top.Y - waterLineHeight < 20f;
40287 if (!wet)
40288 {
40289 if (velocity.Y == 0f)
40290 {
40291 velocity.X *= 0.95f;
40292 }
40293 rotation += (velocity.X + velocity.Y) / 2f * 0.05f;
40294 }
40295 else
40296 {
40297 ai[1] -= 1f;
40298 if (ai[1] <= 0f)
40299 {
40300 velocity += ai[0].ToRotationVector2() * 0.06f;
40301 float num = velocity.Length();
40302 if (num > 3f || num < -3f)
40303 {
40304 velocity.X = Math.Min(3f, Math.Max(-3f, velocity.X));
40305 ai[1] = Main.rand.Next(450, 600);
40306 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
40307 if (flag && ai[0] > (float)Math.PI)
40308 {
40309 ai[0] -= (float)Math.PI;
40310 }
40311 netUpdate = true;
40312 }
40313 }
40314 else
40315 {
40316 velocity *= 0.95f;
40317 }
40318 rotation = velocity.X * 0.1f;
40319 }
40320 bool flag2 = collideY && wet && (!flag || velocity.Y < 0f);
40321 if (collideX || flag2)
40322 {
40323 Vector2 v = ai[0].ToRotationVector2();
40324 if (collideX)
40325 {
40326 v.X *= -1f;
40327 }
40328 if (flag2)
40329 {
40330 v.Y *= -1f;
40331 }
40332 ai[0] = v.ToRotation();
40333 velocity = ai[0].ToRotationVector2() * velocity.Length();
40334 netUpdate = true;
40335 }
40336 }
40337
40339 {
40340 float moveSpeed = 0.15f;
40341 float num = 7.5f;
40342 float num2 = 60f;
40343 float num3 = 90f;
40344 float num4 = 180f;
40345 float num5 = 90f;
40346 float num6 = 90f;
40347 int num7 = 3;
40348 float num8 = 180f;
40349 bool flag = false;
40350 if (localAI[0] == 0f)
40351 {
40352 localAI[0] = 1f;
40353 alpha = 255;
40354 if (Main.netMode != 1)
40355 {
40356 ai[0] = -1f;
40357 netUpdate = true;
40358 }
40359 }
40360 if (ai[0] != -1f && Main.rand.Next(4) == 0)
40361 {
40363 Dust dust = Dust.NewDustDirect(position + new Vector2(5f), width - 10, height - 10, 5);
40364 dust.velocity *= 0.5f;
40365 if (dust.velocity.Y < 0f)
40366 {
40367 dust.velocity.Y *= -1f;
40368 }
40369 dust.alpha = 120;
40370 dust.scale = 1f + Main.rand.NextFloat() * 0.4f;
40371 dust.velocity += velocity * 0.3f;
40373 }
40374 if (target == 255)
40375 {
40376 TargetClosest();
40377 ai[2] = direction;
40378 }
40379 if (Main.player[target].dead || Vector2.Distance(Main.player[target].Center, base.Center) > 2000f)
40380 {
40381 TargetClosest();
40382 }
40384 if (Main.dayTime || !Main.bloodMoon)
40385 {
40386 nPCAimedTarget = default(NPCAimedTarget);
40387 }
40388 int num9 = -1;
40389 switch ((int)ai[0])
40390 {
40391 case -1:
40392 {
40393 velocity *= 0.98f;
40394 int num17 = Math.Sign(nPCAimedTarget.Center.X - base.Center.X);
40395 if (num17 != 0)
40396 {
40397 direction = num17;
40399 }
40400 if (localAI[1] == 0f && alpha < 100)
40401 {
40402 localAI[1] = 1f;
40403 int num18 = 36;
40404 for (int l = 0; l < num18; l++)
40405 {
40407 Vector2 vector3 = (Vector2.Normalize(velocity) * new Vector2((float)width / 2f, height) * 0.75f * 0.5f).RotatedBy((float)(l - (num18 / 2 - 1)) * ((float)Math.PI * 2f) / (float)num18) + base.Center;
40408 Vector2 vector4 = vector3 - base.Center;
40409 int num19 = Dust.NewDust(vector3 + vector4, 0, 0, 5, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f);
40410 Main.dust[num19].noGravity = true;
40411 Main.dust[num19].velocity = Vector2.Normalize(vector4) * 3f;
40413 }
40414 }
40415 if (ai[2] > 5f)
40416 {
40417 velocity.Y = -2.5f;
40418 alpha -= 10;
40420 {
40421 alpha += 15;
40422 if (alpha > 150)
40423 {
40424 alpha = 150;
40425 }
40426 }
40427 if (alpha < 0)
40428 {
40429 alpha = 0;
40430 }
40431 }
40432 ai[2] += 1f;
40433 if (ai[2] >= 50f)
40434 {
40435 ai[0] = 0f;
40436 ai[1] = 0f;
40437 ai[2] = 0f;
40438 ai[3] = 0f;
40439 netUpdate = true;
40440 }
40441 break;
40442 }
40443 case 0:
40444 {
40445 Vector2 destination = nPCAimedTarget.Center + new Vector2((0f - ai[2]) * 300f, -200f);
40446 if (base.Center.Distance(destination) > 50f)
40447 {
40450 }
40451 direction = ((base.Center.X < nPCAimedTarget.Center.X) ? 1 : (-1));
40452 float num15 = base.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 0.47123894f * (float)spriteDirection;
40453 if (spriteDirection == -1)
40454 {
40455 num15 += (float)Math.PI;
40456 }
40458 {
40460 rotation = 0f - rotation;
40461 num15 = 0f - num15;
40462 }
40463 rotation = rotation.AngleTowards(num15, 0.02f);
40464 ai[1] += 1f;
40465 if (ai[1] > num2)
40466 {
40467 num9 = 1;
40468 int num16 = (int)ai[3];
40469 if (num16 % 7 == 3)
40470 {
40471 num9 = 3;
40472 }
40473 else if (num16 % 2 == 0)
40474 {
40476 num9 = 2;
40477 }
40478 else
40479 {
40481 num9 = 1;
40482 }
40483 }
40484 break;
40485 }
40486 case 1:
40487 {
40488 direction = ((!(base.Center.X < nPCAimedTarget.Center.X)) ? 1 : (-1));
40489 float num20 = base.Center.DirectionFrom(nPCAimedTarget.Center).ToRotation() - 0.47123894f * (float)spriteDirection;
40490 if (spriteDirection == -1)
40491 {
40492 num20 += (float)Math.PI;
40493 }
40494 bool flag2 = ai[1] < num3;
40496 {
40498 rotation = 0f - rotation;
40499 num20 = 0f - num20;
40500 }
40501 if (ai[1] < num3)
40502 {
40503 if (ai[1] == num3 - 1f)
40504 {
40506 }
40507 flag = true;
40508 velocity *= 0.95f;
40509 rotation = rotation.AngleLerp(num20, 0.02f);
40512 Dust dust6 = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 60f - new Vector2(40f), 80, 80, 16, 0f, 0f, 150, Color.Transparent, 0.6f);
40513 dust6.fadeIn = 1f;
40514 dust6.velocity = dust6.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * dust6.velocity.Length();
40515 dust6.noGravity = true;
40516 dust6 = Dust.NewDustDirect(mouthPosition4 + mouthDirection4 * 100f - new Vector2(30f), 60, 60, 16, 0f, 0f, 100, Color.Transparent, 0.9f);
40517 dust6.fadeIn = 1.5f;
40518 dust6.velocity = dust6.position.DirectionTo(mouthPosition4 + Main.rand.NextVector2Circular(15f, 15f)) * (dust6.velocity.Length() + 5f);
40519 dust6.noGravity = true;
40521 }
40522 else if (ai[1] < num3 + num4)
40523 {
40525 rotation = rotation.AngleLerp(num20, 0.05f);
40527 if (base.Center.Distance(nPCAimedTarget.Center) > 150f)
40528 {
40529 velocity = mouthDirection5 * -16f + base.Center.DirectionTo(nPCAimedTarget.Center) * 1.5f;
40530 }
40531 for (int m = 0; m < 4; m++)
40532 {
40533 Dust dust7 = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f);
40534 dust7.velocity = dust7.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(5f, 5f)) * dust7.velocity.Length();
40535 dust7.position -= mouthDirection5 * 60f;
40536 dust7 = Dust.NewDustDirect(mouthPosition5 + mouthDirection5 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f);
40537 dust7.velocity = dust7.position.DirectionFrom(mouthPosition5 + Main.rand.NextVector2Circular(10f, 10f)) * (dust7.velocity.Length() + 5f);
40538 dust7.position -= mouthDirection5 * 100f;
40539 }
40541 }
40542 ai[1] += 1f;
40543 if (ai[1] >= num3 + num4)
40544 {
40545 num9 = 0;
40546 }
40547 break;
40548 }
40549 case 2:
40550 {
40551 direction = ((base.Center.X < nPCAimedTarget.Center.X) ? 1 : (-1));
40552 float num12 = base.Center.DirectionTo(nPCAimedTarget.Center).ToRotation() - 0.47123894f * (float)spriteDirection;
40553 if (spriteDirection == -1)
40554 {
40555 num12 += (float)Math.PI;
40556 }
40558 {
40560 rotation = 0f - rotation;
40561 num12 = 0f - num12;
40562 }
40563 rotation = rotation.AngleLerp(num12, 0.2f);
40564 if (ai[1] < num5)
40565 {
40567 velocity *= 0.95f;
40569 if (Main.rand.Next(4) != 0)
40570 {
40571 Dust dust3 = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 60f - new Vector2(60f), 120, 120, 16, 0f, 0f, 150, Color.Transparent, 0.6f);
40572 dust3.fadeIn = 1f;
40573 dust3.velocity = dust3.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (dust3.velocity.Length() + 3f);
40574 dust3.noGravity = true;
40575 dust3 = Dust.NewDustDirect(mouthPosition2 + mouthDirection2 * 100f - new Vector2(80f), 160, 160, 16, 0f, 0f, 100, Color.Transparent, 0.9f);
40576 dust3.fadeIn = 1.5f;
40577 dust3.velocity = dust3.position.DirectionTo(mouthPosition2 + Main.rand.NextVector2Circular(15f, 15f)) * (dust3.velocity.Length() + 5f);
40578 dust3.noGravity = true;
40579 }
40581 }
40582 else if (ai[1] < num5 + num6)
40583 {
40585 velocity *= 0.9f;
40586 float num13 = (ai[1] - num5) % (num6 / (float)num7);
40588 if (num13 < num6 / (float)num7 * 0.8f)
40589 {
40590 for (int i = 0; i < 5; i++)
40591 {
40592 Dust dust4 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 50f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f);
40593 dust4.velocity = dust4.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * dust4.velocity.Length();
40594 dust4.position -= mouthDirection3 * 60f;
40595 dust4 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 90f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f);
40596 dust4.velocity = dust4.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (dust4.velocity.Length() + 5f);
40597 dust4.position -= mouthDirection3 * 100f;
40598 }
40599 }
40600 if ((int)num13 == 0)
40601 {
40602 velocity += mouthDirection3 * -8f;
40603 for (int j = 0; j < 20; j++)
40604 {
40605 Dust dust5 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 60f - new Vector2(15f), 30, 30, 5, 0f, 0f, 0, Color.Transparent, 1.5f);
40606 dust5.velocity = dust5.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(5f, 5f)) * dust5.velocity.Length();
40607 dust5.position -= mouthDirection3 * 60f;
40608 dust5 = Dust.NewDustDirect(mouthPosition3 + mouthDirection3 * 100f - new Vector2(20f), 40, 40, 5, 0f, 0f, 100, Color.Transparent, 1.5f);
40609 dust5.velocity = dust5.position.DirectionFrom(mouthPosition3 + Main.rand.NextVector2Circular(10f, 10f)) * (dust5.velocity.Length() + 5f);
40610 dust5.position -= mouthDirection3 * 100f;
40611 }
40612 if (Main.netMode != 1)
40613 {
40614 int num14 = Main.rand.Next(5, 11);
40617 for (int k = 0; k < num14; k++)
40618 {
40619 Vector2 vector2 = vector + Main.rand.NextVector2Square(-6f, 6f);
40621 }
40622 }
40623 }
40625 }
40626 ai[1] += 1f;
40627 if (ai[1] >= num5 + num6)
40628 {
40629 num9 = 0;
40630 }
40631 break;
40632 }
40633 case 3:
40634 {
40635 direction = ((base.Center.X < nPCAimedTarget.Center.X) ? 1 : (-1));
40636 float targetAngle = 0f;
40638 if (ai[1] < num8)
40639 {
40641 float num10 = MathHelper.Clamp(1f - ai[1] / num8 * 1.5f, 0f, 1f);
40642 velocity = Vector2.Lerp(value2: new Vector2(0f, num10 * -1.5f), value1: velocity, amount: 0.03f);
40644 rotation = rotation.AngleLerp(targetAngle, 0.02f);
40646 float t = ai[1] / num8;
40647 float num11 = Utils.GetLerpValue(0f, 0.5f, t) * Utils.GetLerpValue(1f, 0.5f, t);
40648 Lighting.AddLight(base.Center, new Vector3(1f, 0.5f, 0.5f) * num11);
40649 if (Main.rand.Next(3) != 0)
40650 {
40651 Dust dust2 = Dust.NewDustDirect(base.Center - new Vector2(6f), 12, 12, 5, 0f, 0f, 60, Color.Transparent, 1.4f);
40652 dust2.position += new Vector2(spriteDirection * 12, 12f);
40653 dust2.velocity *= 0.1f;
40654 }
40656 }
40657 if (ai[1] == 10f || ai[1] == 20f || ai[1] == 30f)
40658 {
40660 }
40661 ai[1] += 1f;
40662 if (ai[1] >= num8)
40663 {
40664 num9 = 0;
40665 }
40666 break;
40667 }
40668 }
40669 if (num9 != -1)
40670 {
40671 ai[0] = num9;
40672 ai[1] = 0f;
40673 ai[2] = 0f;
40674 netUpdate = true;
40675 TargetClosest();
40676 if (num9 == 0)
40677 {
40678 ai[2] = direction;
40679 }
40680 else
40681 {
40682 ai[3] += 1f;
40683 }
40684 }
40685 reflectsProjectiles = flag;
40686 }
40687
40689 {
40690 if (Main.netMode == 1 || !Main.player[target].active || Main.player[target].dead || Distance(Main.player[target].Center) > 2000f || CountNPCS(619) >= 3)
40691 {
40692 return;
40693 }
40694 Point point = base.Center.ToTileCoordinates();
40695 Point point2 = point;
40696 int num = 20;
40697 int num2 = 3;
40698 int num3 = 8;
40699 int num4 = 2;
40700 int num5 = 0;
40701 bool flag = false;
40702 while (!flag && num5 < 100)
40703 {
40704 num5++;
40705 int num6 = Main.rand.Next(point2.X - num, point2.X + num + 1);
40706 int num7 = Main.rand.Next(point2.Y - num, point2.Y + num + 1);
40708 {
40709 bool flag2 = true;
40710 if (flag2 && Main.tile[num6, num7].lava())
40711 {
40712 flag2 = false;
40713 }
40715 {
40716 flag2 = false;
40717 }
40718 if (flag2 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
40719 {
40720 flag2 = false;
40721 }
40722 if (flag2)
40723 {
40724 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), num6 * 16 + 8, num7 * 16 + 8, 0f, 0f, 813, 0, 0f, Main.myPlayer);
40725 flag = true;
40726 break;
40727 }
40728 }
40729 }
40730 }
40731
40733 {
40734 bool flag = false;
40735 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
40736 {
40737 float num = base.Bottom.Y - 1f;
40738 if (base.Center.Y > waterLineHeight)
40739 {
40740 velocity.Y -= 0.8f;
40741 if (velocity.Y < -4f)
40742 {
40743 velocity.Y = -4f;
40744 }
40745 if (num + velocity.Y < waterLineHeight)
40746 {
40747 velocity.Y = waterLineHeight - num;
40748 }
40749 }
40750 else
40751 {
40752 velocity.Y = MathHelper.Min(velocity.Y, waterLineHeight - num);
40753 flag = true;
40754 }
40755 }
40756 else if (wet)
40757 {
40758 velocity.Y -= 0.2f;
40759 }
40760 if ((int)ai[0] != 0)
40761 {
40762 return;
40763 }
40764 ai[1] += 1f;
40765 velocity.X *= 0.9f;
40766 if (velocity.Y == 0f)
40767 {
40768 velocity.X *= 0.6f;
40769 }
40770 bool flag2 = wet || flag;
40771 bool flag3 = flag2 || velocity.Y == 0f;
40772 int num2 = Main.rand.Next(120, 241);
40773 if (!flag2)
40774 {
40775 num2 = Main.rand.Next(60, 241);
40776 }
40777 if (!flag3 || !(ai[1] >= (float)num2))
40778 {
40779 return;
40780 }
40781 ai[1] = 0f;
40782 velocity.X = Main.rand.NextFloatDirection() * 5f;
40783 netUpdate = true;
40784 if (!flag2)
40785 {
40786 if (velocity.Y == 0f)
40787 {
40788 velocity.Y = -2f;
40789 }
40790 ai[1] = 60f;
40791 }
40792 }
40793
40794 private void AI_115_LadyBugs()
40795 {
40796 if (Main.netMode != 1)
40797 {
40798 if (ai[1] == 0f)
40799 {
40800 ai[1] = Main.rand.NextFloat() * 0.2f + 0.7f;
40801 netUpdate = true;
40802 }
40803 if ((localAI[0] -= 1f) <= 0f)
40804 {
40805 localAI[0] = Main.rand.Next(60, 181);
40806 if (Main.rand.Next(5) == 0)
40807 {
40808 if (ai[2] == 0f)
40809 {
40810 ai[2] = 1f;
40811 ai[0] = 0f;
40812 netUpdate = true;
40813 }
40814 else if (ai[2] == 1f)
40815 {
40816 TargetClosest();
40817 ai[2] = 0f;
40818 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
40819 if (Distance(Main.player[target].Center) > 700f)
40820 {
40821 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
40822 }
40823 netUpdate = true;
40824 }
40825 }
40826 TargetClosest();
40827 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
40828 if (Distance(Main.player[target].Center) > 700f)
40829 {
40830 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
40831 }
40832 netUpdate = true;
40833 }
40834 }
40835 scale = ai[1];
40836 if (ai[2] == 0f)
40837 {
40838 Vector2 value = ai[0].ToRotationVector2() * 1f;
40839 value.X += Main.windSpeedTarget * 0.8f;
40840 velocity = Vector2.Lerp(velocity, value, 0.0125f);
40841 if (velocity.Y > 0f)
40842 {
40843 int num = 4;
40844 int num2 = (int)base.Center.X / 16;
40845 int num3 = (int)base.Center.Y / 16;
40846 for (int i = num3; i < num3 + num; i++)
40847 {
40848 if (Main.tile[num2, i] != null && ((Main.tile[num2, i].nactive() && Main.tileSolid[Main.tile[num2, i].type]) || Main.tile[num2, i].liquid > 0))
40849 {
40850 ai[0] = 0f - ai[0];
40851 if (velocity.Y > 0f)
40852 {
40853 velocity.Y *= 0.9f;
40854 }
40855 }
40856 }
40857 }
40858 if (velocity.Y < 0f)
40859 {
40860 int num4 = 30;
40861 bool flag = false;
40862 int num5 = (int)base.Center.X / 16;
40863 int num6 = (int)base.Center.Y / 16;
40864 for (int j = num6; j < num6 + num4; j++)
40865 {
40866 if (Main.tile[num5, j] != null && ((Main.tile[num5, j].nactive() && Main.tileSolid[Main.tile[num5, j].type]) || Main.tile[num5, j].liquid > 0))
40867 {
40868 flag = true;
40869 }
40870 }
40871 if (!flag)
40872 {
40873 ai[0] = 0f - ai[0];
40874 if (velocity.Y < 0f)
40875 {
40876 velocity.Y *= 0.9f;
40877 }
40878 }
40879 }
40880 if (collideX)
40881 {
40882 ai[0] = 0f - ai[0] + (float)Math.PI;
40883 velocity.X *= -0.2f;
40884 }
40885 }
40886 else
40887 {
40888 if (velocity.Y > 0f)
40889 {
40890 int num7 = 4;
40891 int num8 = (int)base.Center.X / 16 + direction;
40892 int num9 = (int)base.Center.Y / 16;
40893 for (int k = num9; k < num9 + num7; k++)
40894 {
40895 if (Main.tile[num8, k] != null && Main.tile[num8, k].liquid > 0)
40896 {
40897 TargetClosest();
40898 velocity.Y = -1f;
40899 ai[2] = 0f;
40900 ai[0] = Main.rand.NextFloat() * ((float)Math.PI / 4f) - (float)Math.PI / 2f;
40901 if (Distance(Main.player[target].Center) > 700f)
40902 {
40903 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
40904 }
40905 netUpdate = true;
40906 return;
40907 }
40908 }
40909 }
40910 if (velocity.Y != 0f)
40911 {
40912 velocity.X *= 0.98f;
40913 velocity.Y = MathHelper.Lerp(velocity.Y, 2f, 0.005f);
40914 }
40915 else
40916 {
40918 velocity.Y += 0.2f;
40919 if (collideX)
40920 {
40921 direction *= -1;
40922 velocity.X *= -0.2f;
40923 netUpdate = true;
40924 }
40925 }
40926 }
40927 direction = ((velocity.X > 0f) ? 1 : (-1));
40928 }
40929
40930 private void AI_114_Dragonflies()
40931 {
40932 if (localAI[0] == 0f && Main.netMode != 1)
40933 {
40934 localAI[0] = 1f;
40935 Vector2 center = base.Center;
40936 ai[2] = center.X;
40937 ai[3] = center.Y;
40938 velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
40939 ai[1] = 0f;
40940 ai[0] = 1f;
40941 netUpdate = true;
40942 }
40943 switch ((int)ai[0])
40944 {
40945 case 0:
40946 velocity *= 0.94f;
40947 if (Main.netMode != 1 && (ai[1] += 1f) >= (float)(60 + Main.rand.Next(60)))
40948 {
40949 Vector2 vector = new Vector2(ai[2], ai[3]);
40950 if (Distance(vector) > 96f)
40951 {
40952 velocity = DirectionTo(vector) * 3f;
40953 }
40954 else if (Distance(vector) > 16f)
40955 {
40956 velocity = DirectionTo(vector) * 1f + Main.rand.NextVector2Circular(1f, 0.5f);
40957 }
40958 else
40959 {
40960 velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
40961 }
40962 ai[1] = 0f;
40963 ai[0] = 1f;
40964 netUpdate = true;
40965 }
40966 break;
40967 case 1:
40968 {
40969 int num = 4;
40970 Vector2 other = new Vector2(ai[2], ai[3]);
40971 if (Distance(other) > 112f)
40972 {
40973 num = 200;
40974 }
40975 if ((ai[1] += 1f) >= (float)num)
40976 {
40977 ai[1] = 0f;
40978 ai[0] = 0f;
40979 netUpdate = true;
40980 }
40981 int num2 = (int)base.Center.X / 16;
40982 int num3 = (int)base.Center.Y / 16;
40983 int num4 = 3;
40984 for (int i = num3; i < num3 + num4; i++)
40985 {
40986 if (Main.tile[num2, i] != null && ((Main.tile[num2, i].nactive() && Main.tileSolid[Main.tile[num2, i].type]) || Main.tile[num2, i].liquid > 0))
40987 {
40988 if (velocity.Y > 0f)
40989 {
40990 velocity.Y *= 0.9f;
40991 }
40992 velocity.Y -= 0.2f;
40993 }
40994 }
40995 if (!(velocity.Y < 0f))
40996 {
40997 break;
40998 }
40999 int num5 = 30;
41000 bool flag = false;
41001 for (int j = num3; j < num3 + num5; j++)
41002 {
41003 if (Main.tile[num2, j] != null && Main.tile[num2, j].nactive() && Main.tileSolid[Main.tile[num2, j].type])
41004 {
41005 flag = true;
41006 break;
41007 }
41008 }
41009 if (!flag && velocity.Y < 0f)
41010 {
41011 velocity.Y *= 0.9f;
41012 }
41013 break;
41014 }
41015 }
41016 if (velocity.X != 0f)
41017 {
41018 direction = ((velocity.X > 0f) ? 1 : (-1));
41019 }
41020 if (wet)
41021 {
41022 velocity.Y = -3f;
41023 }
41024 if (localAI[1] > 0f)
41025 {
41026 localAI[1] -= 1f;
41027 return;
41028 }
41029 localAI[1] = 15f;
41030 float num6 = 0f;
41032 for (int k = 0; k < 200; k++)
41033 {
41034 NPC nPC = Main.npc[k];
41035 if (nPC.active && nPC.damage > 0 && !nPC.friendly && nPC.Hitbox.Distance(base.Center) <= 100f)
41036 {
41037 num6 += 1f;
41038 zero += DirectionFrom(nPC.Center);
41039 }
41040 }
41041 for (int l = 0; l < 255; l++)
41042 {
41043 Player player = Main.player[l];
41044 if (player.active && player.Hitbox.Distance(base.Center) <= 150f)
41045 {
41046 num6 += 1f;
41047 zero += DirectionFrom(player.Center);
41048 }
41049 }
41050 if (num6 > 0f)
41051 {
41052 float num7 = 2f;
41053 zero /= num6;
41054 zero *= num7;
41055 velocity += zero;
41056 if (velocity.Length() > 16f)
41057 {
41058 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
41059 }
41060 Vector2 vector2 = base.Center + zero * 10f;
41061 ai[1] = -10f;
41062 ai[0] = 1f;
41063 ai[2] = vector2.X;
41064 ai[3] = vector2.Y;
41065 netUpdate = true;
41066 }
41067 else
41068 {
41069 if (Main.netMode == 1 || !((new Vector2(ai[2], ai[3]) - base.Center).Length() < 16f))
41070 {
41071 return;
41072 }
41073 int maxValue = 30;
41074 if (Main.tile[(int)ai[2] / 16, (int)ai[3] / 16].type != 519)
41075 {
41076 maxValue = 4;
41077 }
41078 if (Main.rand.Next(maxValue) != 0)
41079 {
41080 return;
41081 }
41082 int cattailX = (int)ai[2];
41083 int cattailY = (int)ai[2];
41084 if (FindCattailTop((int)ai[2] / 16, (int)ai[3] / 16, out cattailX, out cattailY))
41085 {
41086 ai[2] = cattailX * 16;
41087 ai[3] = cattailY * 16;
41088 netUpdate = true;
41089 return;
41090 }
41091 int num8 = (int)(base.Center.X / 16f);
41092 int m;
41093 for (m = (int)(base.Center.Y / 16f); !WorldGen.SolidTile(num8, m) && (double)m < Main.worldSurface; m++)
41094 {
41095 }
41096 m -= Main.rand.Next(3, 6);
41097 ai[2] = num8 * 16;
41098 ai[3] = m * 16;
41099 netUpdate = true;
41100 }
41101 }
41102
41103 private void AI_113_WindyBalloon()
41104 {
41105 if (localAI[0] == 0f && Main.netMode != 1)
41106 {
41107 TargetClosest();
41108 localAI[0] = 1f;
41109 ai[2] = Main.rand.Next(7) + 1;
41110 int num = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)position.X, (int)position.Y, 1);
41111 if (Main.rand.Next(180) == 0)
41112 {
41113 Main.npc[num].SetDefaults(-4);
41114 }
41115 else if (Main.rand.Next(10) == 0)
41116 {
41117 Main.npc[num].SetDefaults(-7);
41118 }
41119 else if (Main.rand.Next(3) == 0)
41120 {
41121 Main.npc[num].SetDefaults(-3);
41122 }
41123 Main.npc[num].ai[0] = -999f;
41124 Main.npc[num].netUpdate = true;
41125 ai[3] = num;
41126 netUpdate = true;
41127 ai[1] = Main.npc[num].scale;
41128 }
41129 position = base.Center;
41130 base.Size = new Vector2(20f, 20f) * ai[1];
41131 scale = ai[1];
41132 base.Center = position;
41134 rotation = velocity.X * 0.05f;
41135 if (nPC != null)
41136 {
41138 float num2 = float.PositiveInfinity;
41139 int num3 = 0;
41141 if (!targetData.Invalid)
41142 {
41143 zero = targetData.Center - base.Bottom;
41144 if (zero.Y < 0f)
41145 {
41146 num3 = (int)zero.Y / -16;
41147 }
41148 num2 = zero.Length();
41149 if (direction != Math.Sign(zero.X))
41150 {
41151 num3 = 0;
41152 }
41153 }
41154 if (wet || nPC.wet || collideX || (collideY && oldVelocity.Y < 0f))
41155 {
41156 float num4 = oldVelocity.X + (float)(direction * 8);
41157 position.X -= num4;
41158 nPC.position.X -= num4;
41159 TargetClosest(faceTarget: false);
41160 direction *= -1;
41161 velocity.X = direction * 2;
41162 life = -1;
41163 HitEffect();
41164 active = false;
41165 netUpdate = true;
41167 return;
41168 }
41169 if (collideY)
41170 {
41171 velocity.Y = ((oldVelocity.Y > 0f) ? 1 : (-1));
41172 TargetClosest(faceTarget: false);
41173 }
41174 float num5 = 2f + Math.Abs(Main.windSpeedTarget) * 2f;
41176 {
41177 velocity.X += (float)direction * 0.01f;
41178 if (velocity.X * (float)direction < 0f)
41179 {
41180 if (Math.Abs(velocity.X) > num5)
41181 {
41182 velocity.X += (float)direction * 0.1f;
41183 }
41184 else
41185 {
41186 velocity.X += (float)direction * 0.05f;
41187 }
41188 }
41189 else if (Math.Abs(velocity.X) > num5)
41190 {
41191 velocity.X = (float)direction * num5;
41192 }
41193 }
41194 int num6 = (int)((position.X + (float)(width / 2)) / 16f) + direction;
41195 int num7 = (int)((position.Y + (float)height) / 16f);
41196 bool flag = true;
41197 int num8 = 8 + num3;
41198 bool flag2 = false;
41199 for (int i = num7; i < num7 + num8; i++)
41200 {
41201 if (Main.tile[num6, i] == null)
41202 {
41203 Main.tile[num6, i] = new Tile();
41204 }
41205 if ((Main.tile[num6, i].nactive() && Main.tileSolid[Main.tile[num6, i].type]) || Main.tile[num6, i].liquid > 0)
41206 {
41207 if (i < num7 + 5 + num3)
41208 {
41209 flag2 = true;
41210 }
41211 flag = false;
41212 break;
41213 }
41214 }
41215 if (num2 < 400f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
41216 {
41217 float num9 = 2f;
41218 float num10 = 0.035f;
41219 if (base.Center.Y + (float)(height / 4) > Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y > 0f - num9)
41220 {
41221 velocity.Y -= num10;
41222 if (velocity.Y > 0f)
41223 {
41224 velocity.Y -= num10;
41225 }
41226 }
41227 else if (base.Center.Y + (float)(height / 4) < Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y < num9)
41228 {
41229 velocity.Y += num10;
41230 if (velocity.Y < 0f)
41231 {
41232 velocity.Y += num10;
41233 }
41234 }
41235 }
41236 else
41237 {
41238 if (flag)
41239 {
41240 velocity.Y += 0.05f;
41241 }
41242 else
41243 {
41244 velocity.Y -= 0.1f;
41245 }
41246 if (flag2)
41247 {
41248 velocity.Y -= 0.2f;
41249 }
41250 if (velocity.Y > 2f)
41251 {
41252 velocity.Y = 2f;
41253 }
41254 if (velocity.Y < -4f)
41255 {
41256 velocity.Y = -4f;
41257 }
41258 }
41259 nPC.Center = base.Bottom + new Vector2(0f, -8f) + new Vector2(0f, 56f * ai[1]);
41260 nPC.velocity = velocity;
41261 }
41262 else
41263 {
41264 velocity.Y = MathHelper.Clamp(velocity.Y - 0.2f, -8f, 8f);
41265 velocity.X = MathHelper.Clamp(velocity.X + Main.windSpeedTarget * 0.3f, -4f, 4f);
41266 if (collideX || collideY)
41267 {
41268 float num11 = oldVelocity.X + (float)(direction * 8);
41269 position.X -= num11;
41270 TargetClosest(faceTarget: false);
41271 direction *= -1;
41272 velocity.X = direction * 2;
41273 life = -1;
41274 HitEffect();
41275 active = false;
41276 netUpdate = true;
41278 }
41279 }
41280 }
41281
41283 {
41284 NPC nPC = null;
41285 int num = (int)ai[3];
41286 if (num >= 0 && num < 200)
41287 {
41288 nPC = Main.npc[num];
41289 if (!nPC.active || nPC.type != 1 || nPC.ai[0] != -999f)
41290 {
41291 nPC = null;
41292 ai[3] = -1f;
41293 netUpdate = true;
41294 }
41295 }
41296 else
41297 {
41298 nPC = null;
41299 }
41300 return nPC;
41301 }
41302
41303 private void AI_112_FairyCritter()
41304 {
41305 bool flag = false;
41306 lavaImmune = true;
41307 if (Main.netMode != 1 && ai[2] > 1f)
41308 {
41309 int num = 18000;
41310 localAI[1] += 1f;
41311 if (localAI[1] >= (float)num)
41312 {
41313 ai[2] = 7f;
41314 if (Main.player[target].Center.X < base.Center.X)
41315 {
41316 direction = 1;
41317 }
41318 else
41319 {
41320 direction = -1;
41321 }
41322 netUpdate = true;
41323 }
41324 }
41325 switch ((int)ai[2])
41326 {
41327 case 0:
41328 {
41329 lavaImmune = false;
41330 noTileCollide = false;
41331 if (ai[0] == 0f && ai[1] == 0f)
41332 {
41333 ai[0] = base.Center.X;
41334 ai[1] = base.Center.Y;
41335 }
41336 if (localAI[0] == 0f)
41337 {
41338 localAI[0] = 1f;
41339 velocity = new Vector2(MathHelper.Lerp(2f, 4f, Main.rand.NextFloat()) * (float)(Main.rand.Next(2) * 2 - 1), MathHelper.Lerp(1f, 2f, Main.rand.NextFloat()) * (float)(Main.rand.Next(2) * 2 - 1));
41340 velocity *= 0.7f;
41341 netUpdate = true;
41342 }
41343 Vector2 vector4 = new Vector2(ai[0], ai[1]) - base.Center;
41344 if (vector4.Length() > 20f)
41345 {
41346 Vector2 vector5 = new Vector2((vector4.X > 0f) ? 1 : (-1), (vector4.Y > 0f) ? 1 : (-1));
41347 velocity += vector5 * 0.04f;
41348 if (Math.Abs(velocity.Y) > 2f)
41349 {
41350 velocity.Y *= 0.95f;
41351 }
41352 }
41353 TargetClosest();
41354 Player player = Main.player[target];
41355 if (!player.dead && player.Distance(base.Center) < 250f)
41356 {
41357 ai[2] = 1f;
41358 direction = ((!(player.Center.X > base.Center.X)) ? 1 : (-1));
41359 if (velocity.X * (float)direction < 0f)
41360 {
41361 velocity.X = direction * 2;
41362 }
41363 ai[3] = 0f;
41364 netUpdate = true;
41365 }
41366 break;
41367 }
41368 case 1:
41369 {
41370 lavaImmune = false;
41371 noTileCollide = false;
41372 if (collideX)
41373 {
41374 direction *= -1;
41375 velocity.X = direction * 2;
41376 }
41377 if (collideY)
41378 {
41379 velocity.Y = ((oldVelocity.Y > 0f) ? 1 : (-1));
41380 }
41381 float num12 = 4.5f;
41383 {
41384 velocity.X += (float)direction * 0.04f;
41385 if (velocity.X * (float)direction < 0f)
41386 {
41387 if (Math.Abs(velocity.X) > num12)
41388 {
41389 velocity.X += (float)direction * 0.4f;
41390 }
41391 else
41392 {
41393 velocity.X += (float)direction * 0.2f;
41394 }
41395 }
41396 else if (Math.Abs(velocity.X) > num12)
41397 {
41398 velocity.X = (float)direction * num12;
41399 }
41400 }
41401 int num13 = (int)((position.X + (float)(width / 2)) / 16f);
41402 int num14 = 20;
41403 if (direction < 0)
41404 {
41405 num13 -= num14;
41406 }
41407 int num15 = (int)((position.Y + (float)height) / 16f);
41408 bool flag5 = true;
41409 int num16 = 8;
41410 bool flag6 = false;
41411 for (int i = num13; i <= num13 + num14; i++)
41412 {
41413 for (int j = num15; j < num15 + num16; j++)
41414 {
41415 if (Main.tile[i, j] == null)
41416 {
41417 Main.tile[i, j] = new Tile();
41418 }
41419 if ((Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].type]) || Main.tile[i, j].liquid > 0)
41420 {
41421 if (j < num15 + 5)
41422 {
41423 flag6 = true;
41424 }
41425 flag5 = false;
41426 break;
41427 }
41428 }
41429 }
41430 if (flag5)
41431 {
41432 velocity.Y += 0.05f;
41433 }
41434 else
41435 {
41436 velocity.Y -= 0.2f;
41437 }
41438 if (flag6)
41439 {
41440 velocity.Y -= 0.3f;
41441 }
41442 if (velocity.Y > 3f)
41443 {
41444 velocity.Y = 3f;
41445 }
41446 if (velocity.Y < -5f)
41447 {
41448 velocity.Y = -5f;
41449 }
41450 break;
41451 }
41452 case 2:
41453 {
41454 noTileCollide = true;
41456 bool flag3 = false;
41457 if (targetData.Type == NPCTargetType.Player)
41458 {
41459 flag3 = Main.player[target].dead;
41460 }
41461 if (flag3)
41462 {
41463 ai[2] = 1f;
41464 direction = ((!(targetData.Center.X > base.Center.X)) ? 1 : (-1));
41465 if (velocity.X * (float)direction < 0f)
41466 {
41467 velocity.X = direction * 2;
41468 }
41469 ai[3] = 0f;
41470 netUpdate = true;
41471 break;
41472 }
41473 Rectangle r = Utils.CenteredRectangle(targetData.Center, new Vector2(targetData.Width + 60, targetData.Height / 2));
41474 if (Main.netMode != 1 && base.Hitbox.Intersects(r))
41475 {
41477 {
41478 ai[0] = treasureCoords2.X;
41479 ai[1] = treasureCoords2.Y;
41480 ai[2] = 3f;
41481 ai[3] = 0f;
41482 netUpdate = true;
41483 }
41484 else
41485 {
41486 ai[2] = 6f;
41487 ai[3] = 0f;
41488 netUpdate = true;
41489 }
41490 break;
41491 }
41492 Vector2 vector3 = r.ClosestPointInRect(base.Center);
41494 float num8 = Distance(vector3);
41495 if (num8 > 150f)
41496 {
41497 value *= 2f;
41498 }
41499 else if (num8 > 80f)
41500 {
41501 value *= 1.5f;
41502 }
41503 velocity = Vector2.Lerp(velocity, value, 0.07f);
41504 Point point = base.Center.ToTileCoordinates();
41505 if (ai[3] < 300f)
41506 {
41508 if (goDownwards)
41509 {
41510 velocity.Y += 0.05f;
41511 }
41512 if (goUpwards)
41513 {
41514 velocity.Y -= 0.02f;
41515 }
41516 if (velocity.Y > 2f)
41517 {
41518 velocity.Y = 2f;
41519 }
41520 if (velocity.Y < -4f)
41521 {
41522 velocity.Y = -4f;
41523 }
41524 }
41525 if (WorldGen.InWorld(point.X, point.Y))
41526 {
41527 if (WorldGen.SolidTile(point))
41528 {
41529 ai[3] = Math.Min(ai[3] + 2f, 400f);
41530 }
41531 else
41532 {
41533 ai[3] = Math.Max(ai[3] - 1f, 0f);
41534 }
41535 }
41536 break;
41537 }
41538 case 3:
41539 noTileCollide = true;
41540 if (ai[3] == 15f)
41541 {
41542 SoundEngine.PlaySound(27, (int)position.X, (int)position.Y);
41543 }
41544 if (ai[3] <= 15f)
41545 {
41546 velocity *= 0.9f;
41547 }
41548 else
41549 {
41550 if (Main.player[target].Center.X > base.Center.X)
41551 {
41552 spriteDirection = -1;
41553 }
41554 else
41555 {
41556 spriteDirection = 1;
41557 }
41558 flag = true;
41559 float num6 = 0f;
41560 float num7 = ai[3] - 15f;
41561 float circleHeight = 22f;
41562 if (num7 <= 65f)
41563 {
41564 num6 = (float)Math.PI / 8f;
41565 circleHeight = 14f;
41566 }
41567 else if (num7 <= 130f)
41568 {
41569 num6 = -(float)Math.PI / 8f;
41570 circleHeight = 18f;
41571 }
41572 num6 *= (float)direction;
41576 }
41577 ai[3] += 1f;
41578 if (ai[3] >= 210f)
41579 {
41580 ai[2] = 4f;
41581 TargetClosest();
41582 ai[3] = 0f;
41583 netUpdate = true;
41584 }
41585 break;
41586 case 6:
41587 {
41588 noTileCollide = true;
41589 Vector2 vector = Main.player[target].Center - base.Center;
41590 if (vector.Length() > 100f)
41591 {
41592 ai[2] = 2f;
41593 TargetClosest();
41594 ai[3] = 0f;
41595 netUpdate = true;
41596 break;
41597 }
41599 {
41600 noTileCollide = false;
41601 if (collideX)
41602 {
41603 velocity.X *= -1f;
41604 }
41605 if (collideY)
41606 {
41607 velocity.Y *= -1f;
41608 }
41609 }
41610 if (vector.Length() > 20f)
41611 {
41612 Vector2 vector2 = new Vector2((vector.X > 0f) ? 1 : (-1), (vector.Y > 0f) ? 1 : (-1));
41613 velocity += vector2 * 0.04f;
41614 if (Math.Abs(velocity.Y) > 2f)
41615 {
41616 velocity.Y *= 0.95f;
41617 }
41618 }
41620 {
41621 ai[0] = treasureCoords.X;
41622 ai[1] = treasureCoords.Y;
41623 ai[2] = 3f;
41624 ai[3] = 0f;
41625 netUpdate = true;
41626 }
41627 break;
41628 }
41629 case 4:
41630 {
41631 noTileCollide = true;
41633 bool flag4 = false;
41634 if (targetData2.Type == NPCTargetType.Player)
41635 {
41636 flag4 = Main.player[target].dead;
41637 }
41638 if (flag4)
41639 {
41640 ai[2] = 1f;
41641 direction = ((!(targetData2.Center.X > base.Center.X)) ? 1 : (-1));
41642 if (velocity.X * (float)direction < 0f)
41643 {
41644 velocity.X = direction * 2;
41645 }
41646 ai[3] = 0f;
41647 netUpdate = true;
41648 break;
41649 }
41650 Rectangle r2 = Utils.CenteredRectangle(new Vector2(ai[0] * 16f + 8f, ai[1] * 16f + 8f), Vector2.One * 5f);
41651 if (base.Hitbox.Intersects(r2))
41652 {
41653 ai[2] = 5f;
41654 ai[3] = 0f;
41655 netUpdate = true;
41656 break;
41657 }
41658 float num9 = Distance(targetData2.Center);
41659 float num10 = 300f;
41660 if (num9 > num10)
41661 {
41663 {
41664 noTileCollide = false;
41665 if (collideX)
41666 {
41667 velocity.X *= -1f;
41668 }
41669 if (collideY)
41670 {
41671 velocity.Y *= -1f;
41672 }
41673 }
41674 flag = true;
41675 if (Main.player[target].Center.X > base.Center.X)
41676 {
41677 spriteDirection = -1;
41678 }
41679 else
41680 {
41681 spriteDirection = 1;
41682 }
41684 if (num9 > num10 + 60f)
41685 {
41686 velocity += vector6 * -0.1f;
41687 if (Main.rand.Next(30) == 0)
41688 {
41689 SoundEngine.PlaySound(27, (int)position.X, (int)position.Y);
41690 }
41691 }
41692 else if (num9 < num10 + 30f)
41693 {
41694 Vector2 destination = r2.ClosestPointInRect(base.Center);
41696 velocity += vector7 * 0.1f;
41697 }
41698 if (velocity.Length() > 1f)
41699 {
41700 velocity *= 1f / velocity.Length();
41701 }
41702 break;
41703 }
41704 Vector2 vector8 = r2.ClosestPointInRect(base.Center);
41706 float num11 = Distance(vector8);
41707 if (num11 > 150f)
41708 {
41709 value2 *= 3f;
41710 }
41711 else if (num11 > 80f)
41712 {
41713 value2 *= 2f;
41714 }
41715 Point point2 = base.Center.ToTileCoordinates();
41716 if (ai[3] < 300f)
41717 {
41718 velocity = Vector2.Lerp(velocity, value2, 0.07f);
41720 if (goDownwards2)
41721 {
41722 velocity.Y += 0.05f;
41723 }
41724 if (goUpwards2)
41725 {
41726 velocity.Y -= 0.05f;
41727 }
41728 if (velocity.Y > 1f)
41729 {
41730 velocity.Y = 1f;
41731 }
41732 if (velocity.Y < -1f)
41733 {
41734 velocity.Y = -1f;
41735 }
41736 }
41737 else
41738 {
41739 velocity = Vector2.Lerp(velocity, value2, 0.07f);
41740 }
41742 {
41743 ai[3] = Math.Min(ai[3] + 2f, 400f);
41744 }
41745 else
41746 {
41747 ai[3] = Math.Max(ai[3] - 1f, 0f);
41748 }
41749 break;
41750 }
41751 case 5:
41752 {
41753 localAI[1] = 0f;
41754 noTileCollide = true;
41755 bool flag2 = false;
41756 Tile tileSafely = Framing.GetTileSafely(new Point((int)ai[0], (int)ai[1]));
41758 {
41759 flag2 = true;
41760 }
41761 if (ai[3] == 15f)
41762 {
41763 SoundEngine.PlaySound(27, (int)position.X, (int)position.Y);
41764 }
41765 if (ai[3] <= 15f)
41766 {
41767 velocity *= 0.9f;
41768 }
41769 else
41770 {
41771 flag = true;
41772 float num2 = 0f;
41773 float num3 = ai[3] - 15f;
41774 float num4 = 22f;
41775 int num5 = (int)(num3 / 50f);
41776 num2 = (float)Math.Cos((float)num5 * 1f) * ((float)Math.PI * 2f) / 16f;
41777 num4 = (float)Math.Cos((float)num5 * 2f) * 10f + 8f;
41778 num2 *= (float)direction;
41782 if (Main.player[target].Center.X > base.Center.X)
41783 {
41784 spriteDirection = -1;
41785 }
41786 else
41787 {
41788 spriteDirection = 1;
41789 }
41790 }
41791 ai[3] += 1f;
41792 if (Main.netMode != 1 && ai[3] > 200f)
41793 {
41794 active = false;
41795 if (Main.netMode == 0)
41796 {
41797 FairyEffects(base.Center, type - 583);
41798 }
41799 else if (Main.netMode == 2)
41800 {
41801 netSkip = -1;
41802 life = 0;
41803 NetMessage.SendData(23, -1, -1, null, whoAmI);
41804 NetMessage.SendData(112, -1, -1, null, 2, (int)base.Center.X, (int)base.Center.Y, 0f, type - 583);
41805 }
41806 }
41807 break;
41808 }
41809 case 7:
41810 noTileCollide = true;
41811 velocity.X += 0.05f * (float)direction;
41812 velocity.X = MathHelper.Clamp(velocity.X, -10f, 10f);
41813 velocity.Y -= 0.025f;
41814 velocity.Y = MathHelper.Clamp(velocity.Y, -5f, 5f);
41815 EncourageDespawn(10);
41816 break;
41817 }
41819 for (int k = 0; k < 200; k++)
41820 {
41821 if (k != whoAmI && Main.npc[k].active && Main.npc[k].aiStyle == 112 && Math.Abs(position.X - Main.npc[k].position.X) + Math.Abs(position.Y - Main.npc[k].position.Y) < (float)width * 1.5f)
41822 {
41823 if (position.Y < Main.npc[k].position.Y)
41824 {
41825 velocity.Y -= 0.05f;
41826 }
41827 else
41828 {
41829 velocity.Y += 0.05f;
41830 }
41831 }
41832 }
41833 if (!flag)
41834 {
41835 direction = ((velocity.X >= 0f) ? 1 : (-1));
41837 }
41840 int num17 = 4;
41841 if (type == 584)
41842 {
41845 }
41846 if (type == 585)
41847 {
41850 }
41851 if ((int)Main.timeForVisualEffects % 2 == 0)
41852 {
41854 Dust dust = Dust.NewDustDirect(base.Center - new Vector2(num17) * 0.5f, num17 + 4, num17 + 4, 278, 0f, 0f, 200, Color.Lerp(value3, value4, Main.rand.NextFloat()), 0.65f);
41855 dust.velocity *= 0f;
41856 dust.velocity += velocity * 0.3f;
41857 dust.noGravity = true;
41858 dust.noLight = true;
41860 }
41861 Lighting.AddLight(base.Center, value3.ToVector3() * 0.7f);
41862 if (Main.netMode != 2)
41863 {
41865 if (!localPlayer.dead && localPlayer.HitboxForBestiaryNearbyCheck.Intersects(base.Hitbox))
41866 {
41868 }
41869 }
41870 }
41871
41872 public static void FairyEffects(Vector2 Position, int type)
41873 {
41876 int num = 4;
41877 if (type == 1)
41878 {
41881 }
41882 if (type == 2)
41883 {
41886 }
41887 for (int i = 0; i < 40; i++)
41888 {
41889 Dust dust = Dust.NewDustDirect(Position - new Vector2(num) * 0.5f, num + 4, num + 4, 278, 0f, 0f, 200, Color.Lerp(value, value2, Main.rand.NextFloat()), 0.65f);
41890 dust.velocity *= 1.5f;
41891 if (i >= 30)
41892 {
41893 dust.velocity *= 3.5f;
41894 }
41895 else if (i >= 20)
41896 {
41897 dust.velocity *= 2f;
41898 }
41899 dust.fadeIn = (float)Main.rand.Next(0, 17) * 0.1f;
41900 dust.noGravity = true;
41901 }
41903 }
41904
41906 {
41907 tCoords.X += direction;
41908 goDownwards = true;
41909 goUpwards = false;
41910 int x = tCoords.X;
41911 for (int i = tCoords.Y; i < tCoords.Y + downScanRange && WorldGen.InWorld(x, i); i++)
41912 {
41913 Tile tile = Main.tile[x, i];
41914 if (tile == null)
41915 {
41916 break;
41917 }
41918 if ((tile.nactive() && Main.tileSolid[tile.type]) || tile.liquid > 0)
41919 {
41920 if (i < tCoords.Y + upRange)
41921 {
41922 goUpwards = true;
41923 }
41924 goDownwards = false;
41925 break;
41926 }
41927 }
41928 }
41929
41930 private Vector2 GetFairyCircleOffset(float elapsedTime, float circleRotation, float circleHeight)
41931 {
41932 return ((((float)Math.PI * 2f * elapsedTime + (float)Math.PI / 2f).ToRotationVector2() + new Vector2(0f, -1f)) * new Vector2(6 * -direction, circleHeight)).RotatedBy(circleRotation);
41933 }
41934
41936 {
41937 treasureCoords = default(Point);
41938 Point point = base.Center.ToTileCoordinates();
41939 Rectangle value = new Rectangle(point.X, point.Y, 1, 1);
41940 value.Inflate(75, 50);
41941 int num = 40;
41943 value2.Inflate(-num, -num);
41945 int num2 = -1;
41946 float num3 = -1f;
41947 for (int i = value.Left; i <= value.Right; i++)
41948 {
41949 for (int j = value.Top; j <= value.Bottom; j++)
41950 {
41951 Tile tile = Main.tile[i, j];
41952 if (tile == null || !tile.active() || !TileID.Sets.FriendlyFairyCanLureTo[tile.type] || !SceneMetrics.IsValidForOreFinder(tile))
41953 {
41954 continue;
41955 }
41956 short num4 = Main.tileOreFinderPriority[tile.type];
41957 if (TileID.Sets.Ore[tile.type])
41958 {
41959 int num5 = 3;
41960 int num6 = 3;
41961 int num7 = 40;
41962 int num8 = 0;
41963 for (int k = i - num5; k <= i + num5; k++)
41964 {
41965 for (int l = j - num6; l <= j + num6; l++)
41966 {
41967 if (Main.tile[k, l].active() && Main.tile[k, l].type == tile.type)
41968 {
41969 num8++;
41970 }
41971 }
41972 }
41973 if (num8 < num7)
41974 {
41975 num4 = -1;
41976 }
41977 }
41978 if (num2 <= num4)
41979 {
41980 float num9 = Distance(new Vector2(i * 16 + 8, j * 16 + 8));
41981 if (num2 != num4 || !(num9 >= num3))
41982 {
41983 num2 = num4;
41984 num3 = num9;
41985 treasureCoords.X = i;
41986 treasureCoords.Y = j;
41987 }
41988 }
41989 }
41990 }
41991 return num2 != -1;
41992 }
41993
41994 private void AI_069_DukeFishron()
41995 {
41996 bool expertMode = Main.expertMode;
41997 float num = (expertMode ? 1.2f : 1f);
41998 bool flag = (double)life <= (double)lifeMax * 0.5;
41999 bool flag2 = expertMode && (double)life <= (double)lifeMax * 0.15;
42000 bool flag3 = ai[0] > 4f;
42001 bool flag4 = ai[0] > 9f;
42002 bool flag5 = ai[3] < 10f;
42003 if (flag4)
42004 {
42005 damage = (int)((float)defDamage * 1.1f * num);
42006 defense = 0;
42007 }
42008 else if (flag3)
42009 {
42010 damage = (int)((float)defDamage * 1.2f * num);
42011 defense = (int)((float)defDefense * 0.8f);
42012 }
42013 else
42014 {
42015 damage = defDamage;
42017 }
42018 int num2 = (expertMode ? 40 : 60);
42019 float num3 = (expertMode ? 0.55f : 0.45f);
42020 float num4 = (expertMode ? 8.5f : 7.5f);
42021 if (flag4)
42022 {
42023 num3 = 0.7f;
42024 num4 = 12f;
42025 num2 = 30;
42026 }
42027 else if (flag3 && flag5)
42028 {
42029 num3 = (expertMode ? 0.6f : 0.5f);
42030 num4 = (expertMode ? 10f : 8f);
42031 num2 = (expertMode ? 40 : 20);
42032 }
42033 else if (flag5 && !flag3 && !flag4)
42034 {
42035 num2 = 30;
42036 }
42037 int num5 = (expertMode ? 28 : 30);
42038 float num6 = (expertMode ? 17f : 16f);
42039 if (flag4)
42040 {
42041 num5 = 25;
42042 num6 = 27f;
42043 }
42044 else if (flag5 && flag3)
42045 {
42046 num5 = (expertMode ? 27 : 30);
42047 if (expertMode)
42048 {
42049 num6 = 21f;
42050 }
42051 }
42052 int num7 = 80;
42053 int num8 = 4;
42054 float num9 = 0.3f;
42055 float num10 = 5f;
42056 int num11 = 90;
42057 int num12 = 180;
42058 int num13 = 180;
42059 int num14 = 30;
42060 int num15 = 120;
42061 int num16 = 4;
42062 float num17 = 6f;
42063 float num18 = 20f;
42064 float num19 = (float)Math.PI * 2f / (float)(num15 / 2);
42065 int num20 = 75;
42066 Vector2 center = base.Center;
42067 Player player = Main.player[target];
42068 if (target < 0 || target == 255 || player.dead || !player.active || Vector2.Distance(player.Center, center) > 5600f)
42069 {
42070 TargetClosest();
42071 player = Main.player[target];
42072 netUpdate = true;
42073 }
42074 if (player.dead || Vector2.Distance(player.Center, center) > 5600f)
42075 {
42076 velocity.Y -= 0.4f;
42077 EncourageDespawn(10);
42078 if (ai[0] > 4f)
42079 {
42080 ai[0] = 5f;
42081 }
42082 else
42083 {
42084 ai[0] = 0f;
42085 }
42086 ai[2] = 0f;
42087 }
42088 bool flag6 = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400));
42089 if (flag6)
42090 {
42091 num2 = 10;
42092 damage = defDamage * 2;
42093 defense = defDefense * 2;
42094 num6 += 6f;
42095 }
42096 bool flag7 = true;
42097 if (localAI[0] == 0f)
42098 {
42099 localAI[0] = 1f;
42100 alpha = 255;
42101 rotation = 0f;
42102 if (Main.netMode != 1)
42103 {
42104 ai[0] = -1f;
42105 netUpdate = true;
42106 }
42107 }
42108 float num21 = (float)Math.Atan2(player.Center.Y - center.Y, player.Center.X - center.X);
42109 if (spriteDirection == 1)
42110 {
42111 num21 += (float)Math.PI;
42112 }
42113 if (num21 < 0f)
42114 {
42115 num21 += (float)Math.PI * 2f;
42116 }
42117 if (num21 > (float)Math.PI * 2f)
42118 {
42119 num21 -= (float)Math.PI * 2f;
42120 }
42121 if (ai[0] == -1f)
42122 {
42123 num21 = 0f;
42124 }
42125 if (ai[0] == 3f)
42126 {
42127 num21 = 0f;
42128 }
42129 if (ai[0] == 4f)
42130 {
42131 num21 = 0f;
42132 }
42133 if (ai[0] == 8f)
42134 {
42135 num21 = 0f;
42136 }
42137 float num22 = 0.04f;
42138 if (ai[0] == 1f || ai[0] == 6f)
42139 {
42140 num22 = 0f;
42141 }
42142 if (ai[0] == 7f)
42143 {
42144 num22 = 0f;
42145 }
42146 if (ai[0] == 3f)
42147 {
42148 num22 = 0.01f;
42149 }
42150 if (ai[0] == 4f)
42151 {
42152 num22 = 0.01f;
42153 }
42154 if (ai[0] == 8f)
42155 {
42156 num22 = 0.01f;
42157 }
42158 if (rotation < num21)
42159 {
42160 if ((double)(num21 - rotation) > Math.PI)
42161 {
42162 rotation -= num22;
42163 }
42164 else
42165 {
42166 rotation += num22;
42167 }
42168 }
42169 if (rotation > num21)
42170 {
42171 if ((double)(rotation - num21) > Math.PI)
42172 {
42173 rotation += num22;
42174 }
42175 else
42176 {
42177 rotation -= num22;
42178 }
42179 }
42180 if (rotation > num21 - num22 && rotation < num21 + num22)
42181 {
42182 rotation = num21;
42183 }
42184 if (rotation < 0f)
42185 {
42186 rotation += (float)Math.PI * 2f;
42187 }
42188 if (rotation > (float)Math.PI * 2f)
42189 {
42190 rotation -= (float)Math.PI * 2f;
42191 }
42192 if (rotation > num21 - num22 && rotation < num21 + num22)
42193 {
42194 rotation = num21;
42195 }
42196 if (ai[0] != -1f && ai[0] < 9f)
42197 {
42199 {
42200 alpha += 15;
42201 }
42202 else
42203 {
42204 alpha -= 15;
42205 }
42206 if (alpha < 0)
42207 {
42208 alpha = 0;
42209 }
42210 if (alpha > 150)
42211 {
42212 alpha = 150;
42213 }
42214 }
42215 if (ai[0] == -1f)
42216 {
42217 flag7 = false;
42218 velocity *= 0.98f;
42219 int num23 = Math.Sign(player.Center.X - center.X);
42220 if (num23 != 0)
42221 {
42222 direction = num23;
42224 }
42225 if (ai[2] > 20f)
42226 {
42227 velocity.Y = -2f;
42228 alpha -= 5;
42230 {
42231 alpha += 15;
42232 }
42233 if (alpha < 0)
42234 {
42235 alpha = 0;
42236 }
42237 if (alpha > 150)
42238 {
42239 alpha = 150;
42240 }
42241 }
42242 if (ai[2] == (float)(num11 - 30))
42243 {
42244 int num24 = 36;
42245 for (int i = 0; i < num24; i++)
42246 {
42247 Vector2 vector = (Vector2.Normalize(velocity) * new Vector2((float)width / 2f, height) * 0.75f * 0.5f).RotatedBy((float)(i - (num24 / 2 - 1)) * ((float)Math.PI * 2f) / (float)num24) + base.Center;
42248 Vector2 vector2 = vector - base.Center;
42249 int num25 = Dust.NewDust(vector + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f);
42250 Main.dust[num25].noGravity = true;
42251 Main.dust[num25].noLight = true;
42252 Main.dust[num25].velocity = Vector2.Normalize(vector2) * 3f;
42253 }
42254 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42255 }
42256 ai[2] += 1f;
42257 if (ai[2] >= (float)num20)
42258 {
42259 ai[0] = 0f;
42260 ai[1] = 0f;
42261 ai[2] = 0f;
42262 netUpdate = true;
42263 }
42264 }
42265 else if (ai[0] == 0f && !player.dead)
42266 {
42267 if (ai[1] == 0f)
42268 {
42269 ai[1] = 300 * Math.Sign((center - player.Center).X);
42270 }
42271 Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(ai[1], -200f) - center - velocity) * num4;
42272 if (velocity.X < vector3.X)
42273 {
42274 velocity.X += num3;
42275 if (velocity.X < 0f && vector3.X > 0f)
42276 {
42277 velocity.X += num3;
42278 }
42279 }
42280 else if (velocity.X > vector3.X)
42281 {
42282 velocity.X -= num3;
42283 if (velocity.X > 0f && vector3.X < 0f)
42284 {
42285 velocity.X -= num3;
42286 }
42287 }
42288 if (velocity.Y < vector3.Y)
42289 {
42290 velocity.Y += num3;
42291 if (velocity.Y < 0f && vector3.Y > 0f)
42292 {
42293 velocity.Y += num3;
42294 }
42295 }
42296 else if (velocity.Y > vector3.Y)
42297 {
42298 velocity.Y -= num3;
42299 if (velocity.Y > 0f && vector3.Y < 0f)
42300 {
42301 velocity.Y -= num3;
42302 }
42303 }
42304 int num26 = Math.Sign(player.Center.X - center.X);
42305 if (num26 != 0)
42306 {
42307 if (ai[2] == 0f && num26 != direction)
42308 {
42309 rotation += (float)Math.PI;
42310 }
42311 direction = num26;
42312 if (spriteDirection != -direction)
42313 {
42314 rotation += (float)Math.PI;
42315 }
42317 }
42318 ai[2] += 1f;
42319 if (ai[2] >= (float)num2)
42320 {
42321 int num27 = 0;
42322 switch ((int)ai[3])
42323 {
42324 case 0:
42325 case 1:
42326 case 2:
42327 case 3:
42328 case 4:
42329 case 5:
42330 case 6:
42331 case 7:
42332 case 8:
42333 case 9:
42334 num27 = 1;
42335 break;
42336 case 10:
42337 ai[3] = 1f;
42338 num27 = 2;
42339 break;
42340 case 11:
42341 ai[3] = 0f;
42342 num27 = 3;
42343 break;
42344 }
42345 if (flag6 && num27 == 2)
42346 {
42347 num27 = 3;
42348 }
42349 if (flag)
42350 {
42351 num27 = 4;
42352 }
42353 switch (num27)
42354 {
42355 case 1:
42356 ai[0] = 1f;
42357 ai[1] = 0f;
42358 ai[2] = 0f;
42360 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
42361 if (num26 != 0)
42362 {
42363 direction = num26;
42364 if (spriteDirection == 1)
42365 {
42366 rotation += (float)Math.PI;
42367 }
42369 }
42370 break;
42371 case 2:
42372 ai[0] = 2f;
42373 ai[1] = 0f;
42374 ai[2] = 0f;
42375 break;
42376 case 3:
42377 ai[0] = 3f;
42378 ai[1] = 0f;
42379 ai[2] = 0f;
42380 if (flag6)
42381 {
42382 ai[2] = num11 - 40;
42383 }
42384 break;
42385 case 4:
42386 ai[0] = 4f;
42387 ai[1] = 0f;
42388 ai[2] = 0f;
42389 break;
42390 }
42391 netUpdate = true;
42392 }
42393 }
42394 else if (ai[0] == 1f)
42395 {
42396 int num28 = 7;
42397 for (int j = 0; j < num28; j++)
42398 {
42399 Vector2 vector4 = (Vector2.Normalize(velocity) * new Vector2((float)(width + 50) / 2f, height) * 0.75f).RotatedBy((double)(j - (num28 / 2 - 1)) * Math.PI / (double)(float)num28) + center;
42400 Vector2 vector5 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
42401 int num29 = Dust.NewDust(vector4 + vector5, 0, 0, 172, vector5.X * 2f, vector5.Y * 2f, 100, default(Color), 1.4f);
42402 Main.dust[num29].noGravity = true;
42403 Main.dust[num29].noLight = true;
42404 Main.dust[num29].velocity /= 4f;
42405 Main.dust[num29].velocity -= velocity;
42406 }
42407 ai[2] += 1f;
42408 if (ai[2] >= (float)num5)
42409 {
42410 ai[0] = 0f;
42411 ai[1] = 0f;
42412 ai[2] = 0f;
42413 ai[3] += 2f;
42414 netUpdate = true;
42415 }
42416 }
42417 else if (ai[0] == 2f)
42418 {
42419 if (ai[1] == 0f)
42420 {
42421 ai[1] = 300 * Math.Sign((center - player.Center).X);
42422 }
42423 Vector2 vector6 = Vector2.Normalize(player.Center + new Vector2(ai[1], -200f) - center - velocity) * num10;
42424 if (velocity.X < vector6.X)
42425 {
42426 velocity.X += num9;
42427 if (velocity.X < 0f && vector6.X > 0f)
42428 {
42429 velocity.X += num9;
42430 }
42431 }
42432 else if (velocity.X > vector6.X)
42433 {
42434 velocity.X -= num9;
42435 if (velocity.X > 0f && vector6.X < 0f)
42436 {
42437 velocity.X -= num9;
42438 }
42439 }
42440 if (velocity.Y < vector6.Y)
42441 {
42442 velocity.Y += num9;
42443 if (velocity.Y < 0f && vector6.Y > 0f)
42444 {
42445 velocity.Y += num9;
42446 }
42447 }
42448 else if (velocity.Y > vector6.Y)
42449 {
42450 velocity.Y -= num9;
42451 if (velocity.Y > 0f && vector6.Y < 0f)
42452 {
42453 velocity.Y -= num9;
42454 }
42455 }
42456 if (ai[2] == 0f)
42457 {
42458 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42459 }
42460 if (ai[2] % (float)num8 == 0f)
42461 {
42462 SoundEngine.PlaySound(4, (int)base.Center.X, (int)base.Center.Y, 19);
42463 if (Main.netMode != 1)
42464 {
42465 Vector2 vector7 = Vector2.Normalize(player.Center - center) * (width + 20) / 2f + center;
42466 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector7.X, (int)vector7.Y + 45, 371);
42467 }
42468 }
42469 int num30 = Math.Sign(player.Center.X - center.X);
42470 if (num30 != 0)
42471 {
42472 direction = num30;
42473 if (spriteDirection != -direction)
42474 {
42475 rotation += (float)Math.PI;
42476 }
42478 }
42479 ai[2] += 1f;
42480 if (ai[2] >= (float)num7)
42481 {
42482 ai[0] = 0f;
42483 ai[1] = 0f;
42484 ai[2] = 0f;
42485 netUpdate = true;
42486 }
42487 }
42488 else if (ai[0] == 3f)
42489 {
42490 velocity *= 0.98f;
42491 velocity.Y = MathHelper.Lerp(velocity.Y, 0f, 0.02f);
42492 if (ai[2] == (float)(num11 - 30))
42493 {
42494 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 9);
42495 }
42496 if (Main.netMode != 1 && ai[2] == (float)(num11 - 30))
42497 {
42498 Vector2 vector8 = rotation.ToRotationVector2() * (Vector2.UnitX * direction) * (width + 20) / 2f + center;
42501 }
42502 ai[2] += 1f;
42503 if (ai[2] >= (float)num11)
42504 {
42505 ai[0] = 0f;
42506 ai[1] = 0f;
42507 ai[2] = 0f;
42508 netUpdate = true;
42509 }
42510 }
42511 else if (ai[0] == 4f)
42512 {
42513 flag7 = false;
42514 velocity *= 0.98f;
42515 velocity.Y = MathHelper.Lerp(velocity.Y, 0f, 0.02f);
42516 if (ai[2] == (float)(num12 - 60))
42517 {
42518 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42519 }
42520 ai[2] += 1f;
42521 if (ai[2] >= (float)num12)
42522 {
42523 ai[0] = 5f;
42524 ai[1] = 0f;
42525 ai[2] = 0f;
42526 ai[3] = 0f;
42527 netUpdate = true;
42528 }
42529 }
42530 else if (ai[0] == 5f && !player.dead)
42531 {
42532 if (ai[1] == 0f)
42533 {
42534 ai[1] = 300 * Math.Sign((center - player.Center).X);
42535 }
42536 Vector2 vector9 = Vector2.Normalize(player.Center + new Vector2(ai[1], -200f) - center - velocity) * num4;
42537 if (velocity.X < vector9.X)
42538 {
42539 velocity.X += num3;
42540 if (velocity.X < 0f && vector9.X > 0f)
42541 {
42542 velocity.X += num3;
42543 }
42544 }
42545 else if (velocity.X > vector9.X)
42546 {
42547 velocity.X -= num3;
42548 if (velocity.X > 0f && vector9.X < 0f)
42549 {
42550 velocity.X -= num3;
42551 }
42552 }
42553 if (velocity.Y < vector9.Y)
42554 {
42555 velocity.Y += num3;
42556 if (velocity.Y < 0f && vector9.Y > 0f)
42557 {
42558 velocity.Y += num3;
42559 }
42560 }
42561 else if (velocity.Y > vector9.Y)
42562 {
42563 velocity.Y -= num3;
42564 if (velocity.Y > 0f && vector9.Y < 0f)
42565 {
42566 velocity.Y -= num3;
42567 }
42568 }
42569 int num31 = Math.Sign(player.Center.X - center.X);
42570 if (num31 != 0)
42571 {
42572 if (ai[2] == 0f && num31 != direction)
42573 {
42574 rotation += (float)Math.PI;
42575 }
42576 direction = num31;
42577 if (spriteDirection != -direction)
42578 {
42579 rotation += (float)Math.PI;
42580 }
42582 }
42583 ai[2] += 1f;
42584 if (ai[2] >= (float)num2)
42585 {
42586 int num32 = 0;
42587 switch ((int)ai[3])
42588 {
42589 case 0:
42590 case 1:
42591 case 2:
42592 case 3:
42593 case 4:
42594 case 5:
42595 num32 = 1;
42596 break;
42597 case 6:
42598 ai[3] = 1f;
42599 num32 = 2;
42600 break;
42601 case 7:
42602 ai[3] = 0f;
42603 num32 = 3;
42604 break;
42605 }
42606 if (flag2)
42607 {
42608 num32 = 4;
42609 }
42610 if (flag6 && num32 == 2)
42611 {
42612 num32 = 3;
42613 }
42614 switch (num32)
42615 {
42616 case 1:
42617 ai[0] = 6f;
42618 ai[1] = 0f;
42619 ai[2] = 0f;
42621 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
42622 if (num31 != 0)
42623 {
42624 direction = num31;
42625 if (spriteDirection == 1)
42626 {
42627 rotation += (float)Math.PI;
42628 }
42630 }
42631 break;
42632 case 2:
42634 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
42635 if (num31 != 0)
42636 {
42637 direction = num31;
42638 if (spriteDirection == 1)
42639 {
42640 rotation += (float)Math.PI;
42641 }
42643 }
42644 ai[0] = 7f;
42645 ai[1] = 0f;
42646 ai[2] = 0f;
42647 break;
42648 case 3:
42649 ai[0] = 8f;
42650 ai[1] = 0f;
42651 ai[2] = 0f;
42652 break;
42653 case 4:
42654 ai[0] = 9f;
42655 ai[1] = 0f;
42656 ai[2] = 0f;
42657 break;
42658 }
42659 netUpdate = true;
42660 }
42661 }
42662 else if (ai[0] == 6f)
42663 {
42664 int num33 = 7;
42665 for (int k = 0; k < num33; k++)
42666 {
42667 Vector2 vector10 = (Vector2.Normalize(velocity) * new Vector2((float)(width + 50) / 2f, height) * 0.75f).RotatedBy((double)(k - (num33 / 2 - 1)) * Math.PI / (double)(float)num33) + center;
42668 Vector2 vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
42669 int num34 = Dust.NewDust(vector10 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f);
42670 Main.dust[num34].noGravity = true;
42671 Main.dust[num34].noLight = true;
42672 Main.dust[num34].velocity /= 4f;
42673 Main.dust[num34].velocity -= velocity;
42674 }
42675 ai[2] += 1f;
42676 if (ai[2] >= (float)num5)
42677 {
42678 ai[0] = 5f;
42679 ai[1] = 0f;
42680 ai[2] = 0f;
42681 ai[3] += 2f;
42682 netUpdate = true;
42683 }
42684 }
42685 else if (ai[0] == 7f)
42686 {
42687 if (ai[2] == 0f)
42688 {
42689 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42690 }
42691 if (ai[2] % (float)num16 == 0f)
42692 {
42693 SoundEngine.PlaySound(4, (int)base.Center.X, (int)base.Center.Y, 19);
42694 if (Main.netMode != 1)
42695 {
42697 int num35 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector12.X, (int)vector12.Y + 45, 371);
42698 Main.npc[num35].target = target;
42699 Main.npc[num35].velocity = Vector2.Normalize(velocity).RotatedBy((float)Math.PI / 2f * (float)direction) * num17;
42700 Main.npc[num35].netUpdate = true;
42701 Main.npc[num35].ai[3] = (float)Main.rand.Next(80, 121) / 100f;
42702 }
42703 }
42704 velocity = velocity.RotatedBy((0f - num19) * (float)direction);
42705 rotation -= num19 * (float)direction;
42706 ai[2] += 1f;
42707 if (ai[2] >= (float)num15)
42708 {
42709 ai[0] = 5f;
42710 ai[1] = 0f;
42711 ai[2] = 0f;
42712 netUpdate = true;
42713 }
42714 }
42715 else if (ai[0] == 8f)
42716 {
42717 velocity *= 0.98f;
42718 velocity.Y = MathHelper.Lerp(velocity.Y, 0f, 0.02f);
42719 if (ai[2] == (float)(num11 - 30))
42720 {
42721 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42722 }
42723 if (Main.netMode != 1 && ai[2] == (float)(num11 - 30))
42724 {
42725 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), center.X, center.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, target + 1, flag6 ? 1 : 0);
42726 }
42727 ai[2] += 1f;
42728 if (ai[2] >= (float)num11)
42729 {
42730 ai[0] = 5f;
42731 ai[1] = 0f;
42732 ai[2] = 0f;
42733 netUpdate = true;
42734 }
42735 }
42736 else if (ai[0] == 9f)
42737 {
42738 flag7 = false;
42739 if (ai[2] < (float)(num13 - 90))
42740 {
42742 {
42743 alpha += 15;
42744 }
42745 else
42746 {
42747 alpha -= 15;
42748 }
42749 if (alpha < 0)
42750 {
42751 alpha = 0;
42752 }
42753 if (alpha > 150)
42754 {
42755 alpha = 150;
42756 }
42757 }
42758 else if (alpha < 255)
42759 {
42760 alpha += 4;
42761 if (alpha > 255)
42762 {
42763 alpha = 255;
42764 }
42765 }
42766 velocity *= 0.98f;
42767 velocity.Y = MathHelper.Lerp(velocity.Y, 0f, 0.02f);
42768 if (ai[2] == (float)(num13 - 60))
42769 {
42770 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42771 }
42772 ai[2] += 1f;
42773 if (ai[2] >= (float)num13)
42774 {
42775 ai[0] = 10f;
42776 ai[1] = 0f;
42777 ai[2] = 0f;
42778 ai[3] = 0f;
42779 netUpdate = true;
42780 }
42781 }
42782 else if (ai[0] == 10f && !player.dead)
42783 {
42784 chaseable = false;
42785 if (alpha < 255)
42786 {
42787 alpha += 25;
42788 if (alpha > 255)
42789 {
42790 alpha = 255;
42791 }
42792 }
42793 if (ai[1] == 0f)
42794 {
42795 ai[1] = 360 * Math.Sign((center - player.Center).X);
42796 }
42797 Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(ai[1], -200f) - center - velocity) * num4;
42799 int num36 = Math.Sign(player.Center.X - center.X);
42800 if (num36 != 0)
42801 {
42802 if (ai[2] == 0f && num36 != direction)
42803 {
42804 rotation += (float)Math.PI;
42805 for (int l = 0; l < oldPos.Length; l++)
42806 {
42807 oldPos[l] = Vector2.Zero;
42808 }
42809 }
42810 direction = num36;
42811 if (spriteDirection != -direction)
42812 {
42813 rotation += (float)Math.PI;
42814 }
42816 }
42817 ai[2] += 1f;
42818 if (ai[2] >= (float)num2)
42819 {
42820 int num37 = 0;
42821 switch ((int)ai[3])
42822 {
42823 case 0:
42824 case 2:
42825 case 3:
42826 case 5:
42827 case 6:
42828 case 7:
42829 num37 = 1;
42830 break;
42831 case 1:
42832 case 4:
42833 case 8:
42834 num37 = 2;
42835 break;
42836 }
42837 switch (num37)
42838 {
42839 case 1:
42840 ai[0] = 11f;
42841 ai[1] = 0f;
42842 ai[2] = 0f;
42844 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
42845 if (num36 != 0)
42846 {
42847 direction = num36;
42848 if (spriteDirection == 1)
42849 {
42850 rotation += (float)Math.PI;
42851 }
42853 }
42854 break;
42855 case 2:
42856 ai[0] = 12f;
42857 ai[1] = 0f;
42858 ai[2] = 0f;
42859 break;
42860 case 3:
42861 ai[0] = 13f;
42862 ai[1] = 0f;
42863 ai[2] = 0f;
42864 break;
42865 }
42866 netUpdate = true;
42867 }
42868 }
42869 else if (ai[0] == 11f)
42870 {
42871 chaseable = true;
42872 alpha -= 25;
42873 if (alpha < 0)
42874 {
42875 alpha = 0;
42876 }
42877 int num38 = 7;
42878 for (int m = 0; m < num38; m++)
42879 {
42880 Vector2 vector13 = (Vector2.Normalize(velocity) * new Vector2((float)(width + 50) / 2f, height) * 0.75f).RotatedBy((double)(m - (num38 / 2 - 1)) * Math.PI / (double)(float)num38) + center;
42881 Vector2 vector14 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
42882 int num39 = Dust.NewDust(vector13 + vector14, 0, 0, 172, vector14.X * 2f, vector14.Y * 2f, 100, default(Color), 1.4f);
42883 Main.dust[num39].noGravity = true;
42884 Main.dust[num39].noLight = true;
42885 Main.dust[num39].velocity /= 4f;
42886 Main.dust[num39].velocity -= velocity;
42887 }
42888 ai[2] += 1f;
42889 if (ai[2] >= (float)num5)
42890 {
42891 ai[0] = 10f;
42892 ai[1] = 0f;
42893 ai[2] = 0f;
42894 ai[3] += 1f;
42895 netUpdate = true;
42896 }
42897 }
42898 else if (ai[0] == 12f)
42899 {
42900 flag7 = false;
42901 chaseable = false;
42902 if (alpha < 255)
42903 {
42904 alpha += 17;
42905 if (alpha > 255)
42906 {
42907 alpha = 255;
42908 }
42909 }
42910 velocity *= 0.98f;
42911 velocity.Y = MathHelper.Lerp(velocity.Y, 0f, 0.02f);
42912 if (ai[2] == (float)(num14 / 2))
42913 {
42914 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42915 }
42916 if (Main.netMode != 1 && ai[2] == (float)(num14 / 2))
42917 {
42918 if (ai[1] == 0f)
42919 {
42920 ai[1] = 300 * Math.Sign((center - player.Center).X);
42921 }
42922 Vector2 vector15 = player.Center + new Vector2(0f - ai[1], -200f);
42923 Vector2 vector17 = (base.Center = vector15);
42924 center = vector17;
42925 int num40 = Math.Sign(player.Center.X - center.X);
42926 if (num40 != 0)
42927 {
42928 if (ai[2] == 0f && num40 != direction)
42929 {
42930 rotation += (float)Math.PI;
42931 for (int n = 0; n < oldPos.Length; n++)
42932 {
42933 oldPos[n] = Vector2.Zero;
42934 }
42935 }
42936 direction = num40;
42937 if (spriteDirection != -direction)
42938 {
42939 rotation += (float)Math.PI;
42940 }
42942 }
42943 }
42944 ai[2] += 1f;
42945 if (ai[2] >= (float)num14)
42946 {
42947 ai[0] = 10f;
42948 ai[1] = 0f;
42949 ai[2] = 0f;
42950 ai[3] += 1f;
42951 if (ai[3] >= 9f)
42952 {
42953 ai[3] = 0f;
42954 }
42955 netUpdate = true;
42956 }
42957 }
42958 else if (ai[0] == 13f)
42959 {
42960 if (ai[2] == 0f)
42961 {
42962 SoundEngine.PlaySound(29, (int)center.X, (int)center.Y, 20);
42963 }
42964 velocity = velocity.RotatedBy((0f - num19) * (float)direction);
42965 rotation -= num19 * (float)direction;
42966 ai[2] += 1f;
42967 if (ai[2] >= (float)num15)
42968 {
42969 ai[0] = 10f;
42970 ai[1] = 0f;
42971 ai[2] = 0f;
42972 ai[3] += 1f;
42973 netUpdate = true;
42974 }
42975 }
42977 }
42978
42979 private void AI_037_Destroyer()
42980 {
42981 int num = 0;
42982 int num2 = 10;
42983 if (IsMechQueenUp && type != 134)
42984 {
42985 int num3 = (int)ai[1];
42986 while (num3 > 0 && num3 < 200)
42987 {
42988 if (Main.npc[num3].active && Main.npc[num3].type >= 134 && Main.npc[num3].type <= 136)
42989 {
42990 num++;
42991 if (Main.npc[num3].type == 134)
42992 {
42993 break;
42994 }
42995 if (num >= num2)
42996 {
42997 num = 0;
42998 break;
42999 }
43000 num3 = (int)Main.npc[num3].ai[1];
43001 continue;
43002 }
43003 num = 0;
43004 break;
43005 }
43006 }
43007 if (ai[3] > 0f)
43008 {
43009 realLife = (int)ai[3];
43010 }
43011 if (target < 0 || target == 255 || Main.player[target].dead)
43012 {
43013 TargetClosest();
43014 }
43015 if (type >= 134 && type <= 136)
43016 {
43017 velocity.Length();
43018 if (type == 134 || (type != 134 && Main.npc[(int)ai[1]].alpha < 128))
43019 {
43020 if (alpha != 0)
43021 {
43022 for (int i = 0; i < 2; i++)
43023 {
43024 int num4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 182, 0f, 0f, 100, default(Color), 2f);
43025 Main.dust[num4].noGravity = true;
43026 Main.dust[num4].noLight = true;
43027 }
43028 }
43029 alpha -= 42;
43030 if (alpha < 0)
43031 {
43032 alpha = 0;
43033 }
43034 }
43035 }
43036 if (type > 134)
43037 {
43038 bool flag = false;
43039 if (ai[1] <= 0f)
43040 {
43041 flag = true;
43042 }
43043 else if (Main.npc[(int)ai[1]].life <= 0)
43044 {
43045 flag = true;
43046 }
43047 if (flag)
43048 {
43049 life = 0;
43050 HitEffect();
43051 checkDead();
43052 }
43053 }
43054 if (Main.netMode != 1)
43055 {
43056 if (ai[0] == 0f && type == 134)
43057 {
43058 ai[3] = whoAmI;
43059 realLife = whoAmI;
43060 int num5 = 0;
43061 int num6 = whoAmI;
43063 for (int j = 0; j <= destroyerSegmentsCount; j++)
43064 {
43065 int num7 = 135;
43067 {
43068 num7 = 136;
43069 }
43070 num5 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num7, whoAmI);
43071 Main.npc[num5].ai[3] = whoAmI;
43072 Main.npc[num5].realLife = whoAmI;
43073 Main.npc[num5].ai[1] = num6;
43074 Main.npc[num6].ai[0] = num5;
43075 NetMessage.SendData(23, -1, -1, null, num5);
43076 num6 = num5;
43077 }
43078 }
43079 if (type == 135)
43080 {
43081 localAI[0] += Main.rand.Next(4);
43082 if (localAI[0] >= (float)Main.rand.Next(1400, 26000))
43083 {
43084 localAI[0] = 0f;
43085 TargetClosest();
43086 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
43087 {
43088 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)(height / 2));
43089 float num8 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21);
43090 float num9 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21);
43091 float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
43092 num10 = 8f / num10;
43093 num8 *= num10;
43094 num9 *= num10;
43095 num8 += (float)Main.rand.Next(-20, 21) * 0.05f;
43096 num9 += (float)Main.rand.Next(-20, 21) * 0.05f;
43098 int num11 = 100;
43099 vector.X += num8 * 5f;
43100 vector.Y += num9 * 5f;
43102 Main.projectile[num12].timeLeft = 300;
43103 netUpdate = true;
43104 }
43105 }
43106 }
43107 }
43108 int num13 = (int)(position.X / 16f) - 1;
43109 int num14 = (int)((position.X + (float)width) / 16f) + 2;
43110 int num15 = (int)(position.Y / 16f) - 1;
43111 int num16 = (int)((position.Y + (float)height) / 16f) + 2;
43112 if (num13 < 0)
43113 {
43114 num13 = 0;
43115 }
43116 if (num14 > Main.maxTilesX)
43117 {
43119 }
43120 if (num15 < 0)
43121 {
43122 num15 = 0;
43123 }
43124 if (num16 > Main.maxTilesY)
43125 {
43127 }
43128 bool flag2 = false;
43129 if (!flag2)
43130 {
43131 Vector2 vector2 = default(Vector2);
43132 for (int k = num13; k < num14; k++)
43133 {
43134 for (int l = num15; l < num16; l++)
43135 {
43136 if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].type] || (Main.tileSolidTop[Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64))
43137 {
43138 vector2.X = k * 16;
43139 vector2.Y = l * 16;
43140 if (position.X + (float)width > vector2.X && position.X < vector2.X + 16f && position.Y + (float)height > vector2.Y && position.Y < vector2.Y + 16f)
43141 {
43142 flag2 = true;
43143 break;
43144 }
43145 }
43146 }
43147 }
43148 }
43149 if (!flag2)
43150 {
43151 if (type != 135 || ai[2] != 1f)
43152 {
43153 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.3f, 0.1f, 0.05f);
43154 }
43155 localAI[1] = 1f;
43156 if (type == 134)
43157 {
43159 int num17 = 1000;
43160 bool flag3 = true;
43161 if (position.Y > Main.player[target].position.Y)
43162 {
43163 for (int m = 0; m < 255; m++)
43164 {
43165 if (Main.player[m].active)
43166 {
43167 Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num17, (int)Main.player[m].position.Y - num17, num17 * 2, num17 * 2);
43168 if (rectangle.Intersects(rectangle2))
43169 {
43170 flag3 = false;
43171 break;
43172 }
43173 }
43174 }
43175 if (flag3)
43176 {
43177 flag2 = true;
43178 }
43179 }
43180 }
43181 }
43182 else
43183 {
43184 localAI[1] = 0f;
43185 }
43186 float num18 = 16f;
43187 if (Main.IsItDay() || Main.player[target].dead)
43188 {
43189 flag2 = false;
43190 velocity.Y += 1f;
43191 if ((double)position.Y > Main.worldSurface * 16.0)
43192 {
43193 velocity.Y += 1f;
43194 num18 = 32f;
43195 }
43196 if ((double)position.Y > Main.rockLayer * 16.0)
43197 {
43198 for (int n = 0; n < 200; n++)
43199 {
43200 if (Main.npc[n].aiStyle == aiStyle)
43201 {
43202 Main.npc[n].active = false;
43203 }
43204 }
43205 }
43206 }
43207 float num19 = 0.1f;
43208 float num20 = 0.15f;
43209 if (Main.getGoodWorld)
43210 {
43211 num19 *= 1.2f;
43212 num20 *= 1.2f;
43213 }
43214 Vector2 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43215 float num21 = Main.player[target].position.X + (float)(Main.player[target].width / 2);
43216 float num22 = Main.player[target].position.Y + (float)(Main.player[target].height / 2);
43217 num21 = (int)(num21 / 16f) * 16;
43218 num22 = (int)(num22 / 16f) * 16;
43219 vector3.X = (int)(vector3.X / 16f) * 16;
43220 vector3.Y = (int)(vector3.Y / 16f) * 16;
43221 num21 -= vector3.X;
43222 num22 -= vector3.Y;
43223 float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
43224 if (ai[1] > 0f && ai[1] < (float)Main.npc.Length)
43225 {
43226 int num24 = (int)(44f * scale);
43227 try
43228 {
43229 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43230 num21 = Main.npc[(int)ai[1]].position.X + (float)(Main.npc[(int)ai[1]].width / 2) - vector3.X;
43231 num22 = Main.npc[(int)ai[1]].position.Y + (float)(Main.npc[(int)ai[1]].height / 2) - vector3.Y;
43232 }
43233 catch
43234 {
43235 }
43236 if (num > 0)
43237 {
43238 float num25 = (float)num24 - (float)num24 * (((float)num - 1f) * 0.1f);
43239 if (num25 < 0f)
43240 {
43241 num25 = 0f;
43242 }
43243 if (num25 > (float)num24)
43244 {
43245 num25 = num24;
43246 }
43247 num22 = Main.npc[(int)ai[1]].position.Y + (float)(Main.npc[(int)ai[1]].height / 2) + num25 - vector3.Y;
43248 }
43249 rotation = (float)Math.Atan2(num22, num21) + 1.57f;
43250 num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
43251 if (num > 0)
43252 {
43253 num24 = num24 / num2 * num;
43254 }
43255 num23 = (num23 - (float)num24) / num23;
43256 num21 *= num23;
43257 num22 *= num23;
43259 position.X += num21;
43260 position.Y += num22;
43261 num21 = Main.npc[(int)ai[1]].position.X + (float)(Main.npc[(int)ai[1]].width / 2) - vector3.X;
43262 num22 = Main.npc[(int)ai[1]].position.Y + (float)(Main.npc[(int)ai[1]].height / 2) - vector3.Y;
43263 rotation = (float)Math.Atan2(num22, num21) + 1.57f;
43264 }
43265 else
43266 {
43267 if (!flag2)
43268 {
43269 TargetClosest();
43270 velocity.Y += 0.15f;
43271 if (velocity.Y > num18)
43272 {
43273 velocity.Y = num18;
43274 }
43275 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num18 * 0.4)
43276 {
43277 if (velocity.X < 0f)
43278 {
43279 velocity.X -= num19 * 1.1f;
43280 }
43281 else
43282 {
43283 velocity.X += num19 * 1.1f;
43284 }
43285 }
43286 else if (velocity.Y == num18)
43287 {
43288 if (velocity.X < num21)
43289 {
43290 velocity.X += num19;
43291 }
43292 else if (velocity.X > num21)
43293 {
43294 velocity.X -= num19;
43295 }
43296 }
43297 else if (velocity.Y > 4f)
43298 {
43299 if (velocity.X < 0f)
43300 {
43301 velocity.X += num19 * 0.9f;
43302 }
43303 else
43304 {
43305 velocity.X -= num19 * 0.9f;
43306 }
43307 }
43308 }
43309 else
43310 {
43311 if (soundDelay == 0)
43312 {
43313 float num26 = num23 / 40f;
43314 if (num26 < 10f)
43315 {
43316 num26 = 10f;
43317 }
43318 if (num26 > 20f)
43319 {
43320 num26 = 20f;
43321 }
43322 soundDelay = (int)num26;
43323 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y);
43324 }
43325 num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
43326 float num27 = Math.Abs(num21);
43327 float num28 = Math.Abs(num22);
43328 float num29 = num18 / num23;
43329 num21 *= num29;
43330 num22 *= num29;
43331 if (((velocity.X > 0f && num21 > 0f) || (velocity.X < 0f && num21 < 0f)) && ((velocity.Y > 0f && num22 > 0f) || (velocity.Y < 0f && num22 < 0f)))
43332 {
43333 if (velocity.X < num21)
43334 {
43335 velocity.X += num20;
43336 }
43337 else if (velocity.X > num21)
43338 {
43339 velocity.X -= num20;
43340 }
43341 if (velocity.Y < num22)
43342 {
43343 velocity.Y += num20;
43344 }
43345 else if (velocity.Y > num22)
43346 {
43347 velocity.Y -= num20;
43348 }
43349 }
43350 if ((velocity.X > 0f && num21 > 0f) || (velocity.X < 0f && num21 < 0f) || (velocity.Y > 0f && num22 > 0f) || (velocity.Y < 0f && num22 < 0f))
43351 {
43352 if (velocity.X < num21)
43353 {
43354 velocity.X += num19;
43355 }
43356 else if (velocity.X > num21)
43357 {
43358 velocity.X -= num19;
43359 }
43360 if (velocity.Y < num22)
43361 {
43362 velocity.Y += num19;
43363 }
43364 else if (velocity.Y > num22)
43365 {
43366 velocity.Y -= num19;
43367 }
43368 if ((double)Math.Abs(num22) < (double)num18 * 0.2 && ((velocity.X > 0f && num21 < 0f) || (velocity.X < 0f && num21 > 0f)))
43369 {
43370 if (velocity.Y > 0f)
43371 {
43372 velocity.Y += num19 * 2f;
43373 }
43374 else
43375 {
43376 velocity.Y -= num19 * 2f;
43377 }
43378 }
43379 if ((double)Math.Abs(num21) < (double)num18 * 0.2 && ((velocity.Y > 0f && num22 < 0f) || (velocity.Y < 0f && num22 > 0f)))
43380 {
43381 if (velocity.X > 0f)
43382 {
43383 velocity.X += num19 * 2f;
43384 }
43385 else
43386 {
43387 velocity.X -= num19 * 2f;
43388 }
43389 }
43390 }
43391 else if (num27 > num28)
43392 {
43393 if (velocity.X < num21)
43394 {
43395 velocity.X += num19 * 1.1f;
43396 }
43397 else if (velocity.X > num21)
43398 {
43399 velocity.X -= num19 * 1.1f;
43400 }
43401 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num18 * 0.5)
43402 {
43403 if (velocity.Y > 0f)
43404 {
43405 velocity.Y += num19;
43406 }
43407 else
43408 {
43409 velocity.Y -= num19;
43410 }
43411 }
43412 }
43413 else
43414 {
43415 if (velocity.Y < num22)
43416 {
43417 velocity.Y += num19 * 1.1f;
43418 }
43419 else if (velocity.Y > num22)
43420 {
43421 velocity.Y -= num19 * 1.1f;
43422 }
43423 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num18 * 0.5)
43424 {
43425 if (velocity.X > 0f)
43426 {
43427 velocity.X += num19;
43428 }
43429 else
43430 {
43431 velocity.X -= num19;
43432 }
43433 }
43434 }
43435 }
43436 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
43437 if (type == 134)
43438 {
43439 if (flag2)
43440 {
43441 if (localAI[0] != 1f)
43442 {
43443 netUpdate = true;
43444 }
43445 localAI[0] = 1f;
43446 }
43447 else
43448 {
43449 if (localAI[0] != 0f)
43450 {
43451 netUpdate = true;
43452 }
43453 localAI[0] = 0f;
43454 }
43455 if (((velocity.X > 0f && oldVelocity.X < 0f) || (velocity.X < 0f && oldVelocity.X > 0f) || (velocity.Y > 0f && oldVelocity.Y < 0f) || (velocity.Y < 0f && oldVelocity.Y > 0f)) && !justHit)
43456 {
43457 netUpdate = true;
43458 }
43459 }
43460 }
43461 if (IsMechQueenUp && type == 134)
43462 {
43464 Vector2 mechQueenCenter = nPC.GetMechQueenCenter();
43465 Vector2 vector4 = new Vector2(0f, 100f);
43467 float num30 = nPC.velocity.X * 0.025f;
43469 position = spinningpoint - base.Size / 2f + nPC.velocity;
43470 velocity.X = 0f;
43471 velocity.Y = 0f;
43472 rotation = num30 * 0.75f + (float)Math.PI;
43473 }
43474 }
43475
43476 private void AI_005_EaterOfSouls()
43477 {
43478 if (type == 210 || type == 211)
43479 {
43481 }
43482 else if (target < 0 || target <= 255 || Main.player[target].dead)
43483 {
43484 TargetClosest();
43485 }
43486 if (type == 619)
43487 {
43488 if (Main.dayTime)
43489 {
43490 velocity.Y -= 0.3f;
43491 EncourageDespawn(60);
43492 }
43494 if (alpha == 255)
43495 {
43497 velocity.Y = -6f;
43498 for (int i = 0; i < 35; i++)
43499 {
43501 dust.velocity *= 1f;
43502 dust.scale = 1f + Main.rand.NextFloat() * 0.5f;
43503 dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
43504 dust.velocity += velocity * 0.5f;
43505 }
43506 }
43507 alpha -= 15;
43508 if (alpha < 0)
43509 {
43510 alpha = 0;
43511 }
43512 if (alpha != 0)
43513 {
43514 for (int j = 0; j < 2; j++)
43515 {
43517 dust2.velocity *= 1f;
43518 dust2.scale = 1f + Main.rand.NextFloat() * 0.5f;
43519 dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
43520 dust2.velocity += velocity * 0.3f;
43521 }
43522 }
43524 }
43526 bool flag = false;
43527 if (targetData.Type == NPCTargetType.Player)
43528 {
43529 flag = Main.player[target].dead;
43530 }
43531 float num = 6f;
43532 float num2 = 0.05f;
43533 if (type == 6 || type == 173)
43534 {
43535 num = 4f;
43536 num2 = 0.02f;
43537 if (type == 6 && Main.expertMode)
43538 {
43539 num2 = 0.035f;
43540 }
43541 if (Main.remixWorld)
43542 {
43543 num2 = 0.06f;
43544 num = 5f;
43545 }
43546 }
43547 else if (type == 94)
43548 {
43549 num = 4.2f;
43550 num2 = 0.022f;
43551 }
43552 else if (type == 619)
43553 {
43554 num = 6f;
43555 num2 = 0.1f;
43556 }
43557 else if (type == 252)
43558 {
43559 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
43560 {
43561 num = 6f;
43562 num2 = 0.1f;
43563 }
43564 else
43565 {
43566 num2 = 0.01f;
43567 num = 2f;
43568 }
43569 }
43570 else if (type == 42 || (type >= 231 && type <= 235))
43571 {
43572 num = 3.5f;
43573 num2 = 0.021f;
43574 if (type == 231)
43575 {
43576 num = 3f;
43577 num2 = 0.017f;
43578 }
43579 num *= 1f - scale;
43580 num2 *= 1f - scale;
43581 if ((double)(position.Y / 16f) < Main.worldSurface)
43582 {
43583 if (Main.player[target].position.Y - position.Y > 300f && velocity.Y < 0f)
43584 {
43585 velocity.Y *= 0.97f;
43586 }
43587 if (Main.player[target].position.Y - position.Y < 80f && velocity.Y > 0f)
43588 {
43589 velocity.Y *= 0.97f;
43590 }
43591 }
43592 }
43593 else if (type == 205)
43594 {
43595 num = 3.25f;
43596 num2 = 0.018f;
43597 }
43598 else if (type == 176)
43599 {
43600 num = 4f;
43601 num2 = 0.017f;
43602 }
43603 else if (type == 23)
43604 {
43605 num = 1f;
43606 num2 = 0.03f;
43607 }
43608 else if (type == 5)
43609 {
43610 num = 5f;
43611 num2 = 0.03f;
43612 }
43613 else if (type == 210 || type == 211)
43614 {
43615 ai[1] += 1f;
43616 float num3 = (ai[1] - 60f) / 60f;
43617 if (num3 > 1f)
43618 {
43619 num3 = 1f;
43620 }
43621 else
43622 {
43623 if (velocity.X > 6f)
43624 {
43625 velocity.X = 6f;
43626 }
43627 if (velocity.X < -6f)
43628 {
43629 velocity.X = -6f;
43630 }
43631 if (velocity.Y > 6f)
43632 {
43633 velocity.Y = 6f;
43634 }
43635 if (velocity.Y < -6f)
43636 {
43637 velocity.Y = -6f;
43638 }
43639 }
43640 num = 5f;
43641 num2 = 0.1f;
43642 num2 *= num3;
43643 }
43644 else if (type == 139 && Main.zenithWorld)
43645 {
43646 num = 3f;
43647 }
43648 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43649 float num4 = targetData.Position.X + (float)(targetData.Width / 2);
43650 float num5 = targetData.Position.Y + (float)(targetData.Height / 2);
43651 num4 = (int)(num4 / 8f) * 8;
43652 num5 = (int)(num5 / 8f) * 8;
43653 vector.X = (int)(vector.X / 8f) * 8;
43654 vector.Y = (int)(vector.Y / 8f) * 8;
43655 num4 -= vector.X;
43656 num5 -= vector.Y;
43657 float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5);
43658 float num7 = num6;
43659 bool flag2 = false;
43660 if (num6 > 600f)
43661 {
43662 flag2 = true;
43663 }
43664 if (num6 == 0f)
43665 {
43666 num4 = velocity.X;
43667 num5 = velocity.Y;
43668 }
43669 else
43670 {
43671 num6 = num / num6;
43672 num4 *= num6;
43673 num5 *= num6;
43674 }
43675 bool num8 = type == 6 || type == 139 || type == 173 || type == 205;
43676 bool flag3 = type == 42 || type == 94 || type == 619 || type == 176 || type == 210 || type == 211 || (type >= 231 && type <= 235);
43677 bool flag4 = type != 173 && type != 6 && type != 42 && (type < 231 || type > 235) && type != 94 && type != 139 && type != 619;
43678 if (num8 || flag3)
43679 {
43680 if (num7 > 100f || flag3)
43681 {
43682 ai[0] += 1f;
43683 if (ai[0] > 0f)
43684 {
43685 velocity.Y += 0.023f;
43686 }
43687 else
43688 {
43689 velocity.Y -= 0.023f;
43690 }
43691 if (ai[0] < -100f || ai[0] > 100f)
43692 {
43693 velocity.X += 0.023f;
43694 }
43695 else
43696 {
43697 velocity.X -= 0.023f;
43698 }
43699 if (ai[0] > 200f)
43700 {
43701 ai[0] = -200f;
43702 }
43703 }
43704 if (num7 < 150f && (type == 6 || type == 94 || type == 173 || type == 619))
43705 {
43706 velocity.X += num4 * 0.007f;
43707 velocity.Y += num5 * 0.007f;
43708 }
43709 }
43710 if (flag)
43711 {
43712 num4 = (float)direction * num / 2f;
43713 num5 = (0f - num) / 2f;
43714 }
43715 else if (type == 619 && base.Center.Y > targetData.Center.Y - 200f)
43716 {
43717 velocity.Y -= 0.3f;
43718 }
43719 if (type == 139 && ai[3] != 0f)
43720 {
43721 if (IsMechQueenUp)
43722 {
43724 Vector2 vector2 = new Vector2(26f * ai[3], 0f);
43725 int num9 = (int)ai[2];
43726 if (num9 < 0 || num9 >= 200)
43727 {
43728 num9 = FindFirstNPC(134);
43729 ai[2] = num9;
43730 netUpdate = true;
43731 }
43732 if (num9 > -1)
43733 {
43734 NPC nPC2 = Main.npc[num9];
43735 if (!nPC2.active || nPC2.type != 134)
43736 {
43737 dontTakeDamage = false;
43738 if (ai[3] > 0f)
43739 {
43740 netUpdate = true;
43741 }
43742 ai[3] = 0f;
43743 }
43744 else
43745 {
43746 Vector2 spinningpoint = nPC2.Center + vector2;
43747 spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center);
43748 base.Center = spinningpoint;
43749 velocity = nPC.velocity;
43750 dontTakeDamage = true;
43751 }
43752 }
43753 else
43754 {
43755 dontTakeDamage = false;
43756 if (ai[3] > 0f)
43757 {
43758 netUpdate = true;
43759 }
43760 ai[3] = 0f;
43761 }
43762 }
43763 else
43764 {
43765 dontTakeDamage = false;
43766 if (ai[3] > 0f)
43767 {
43768 netUpdate = true;
43769 }
43770 ai[3] = 0f;
43771 }
43772 }
43773 else
43774 {
43775 if (type == 139)
43776 {
43777 dontTakeDamage = false;
43778 }
43779 if (velocity.X < num4)
43780 {
43781 velocity.X += num2;
43782 if (flag4 && velocity.X < 0f && num4 > 0f)
43783 {
43784 velocity.X += num2;
43785 }
43786 }
43787 else if (velocity.X > num4)
43788 {
43789 velocity.X -= num2;
43790 if (flag4 && velocity.X > 0f && num4 < 0f)
43791 {
43792 velocity.X -= num2;
43793 }
43794 }
43795 if (velocity.Y < num5)
43796 {
43797 velocity.Y += num2;
43798 if (flag4 && velocity.Y < 0f && num5 > 0f)
43799 {
43800 velocity.Y += num2;
43801 }
43802 }
43803 else if (velocity.Y > num5)
43804 {
43805 velocity.Y -= num2;
43806 if (flag4 && velocity.Y > 0f && num5 < 0f)
43807 {
43808 velocity.Y -= num2;
43809 }
43810 }
43811 }
43812 if (type == 23)
43813 {
43814 if (num4 > 0f)
43815 {
43816 spriteDirection = 1;
43817 rotation = (float)Math.Atan2(num5, num4);
43818 }
43819 else if (num4 < 0f)
43820 {
43821 spriteDirection = -1;
43822 rotation = (float)Math.Atan2(num5, num4) + 3.14f;
43823 }
43824 }
43825 else if (type == 139)
43826 {
43827 localAI[0] += 1f;
43828 if (ai[3] != 0f)
43829 {
43830 localAI[0] += 2f;
43831 }
43832 if (justHit)
43833 {
43834 localAI[0] = 0f;
43835 }
43836 float num10 = 120f;
43837 if (IsMechQueenUp)
43838 {
43839 num10 = 360f;
43840 }
43841 if (Main.netMode != 1 && localAI[0] >= num10)
43842 {
43843 localAI[0] = 0f;
43844 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
43845 {
43847 int num11 = 84;
43849 if (IsMechQueenUp)
43850 {
43851 Vector2 v = targetData.Center - base.Center - targetData.Velocity * 20f;
43852 float num12 = 8f;
43853 vector3 = v.SafeNormalize(Vector2.UnitY) * num12;
43854 }
43856 }
43857 }
43858 int num13 = (int)position.X + width / 2;
43859 int num14 = (int)position.Y + height / 2;
43860 num13 /= 16;
43861 num14 /= 16;
43863 {
43864 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.3f, 0.1f, 0.05f);
43865 }
43866 if (num4 > 0f)
43867 {
43868 spriteDirection = 1;
43869 rotation = (float)Math.Atan2(num5, num4);
43870 }
43871 if (num4 < 0f)
43872 {
43873 spriteDirection = -1;
43874 rotation = (float)Math.Atan2(num5, num4) + 3.14f;
43875 }
43876 }
43877 else if (type == 6 || type == 94 || type == 173 || type == 619)
43878 {
43879 rotation = (float)Math.Atan2(num5, num4) - 1.57f;
43880 }
43881 else if (type == 42 || type == 176 || type == 205 || (type >= 231 && type <= 235))
43882 {
43883 if (velocity.X > 0f)
43884 {
43885 spriteDirection = 1;
43886 }
43887 if (velocity.X < 0f)
43888 {
43889 spriteDirection = -1;
43890 }
43891 rotation = velocity.X * 0.1f;
43892 }
43893 else
43894 {
43895 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
43896 }
43897 if (type == 6 || type == 619 || type == 23 || type == 42 || type == 94 || type == 139 || type == 173 || type == 176 || type == 205 || type == 210 || type == 211 || (type >= 231 && type <= 235))
43898 {
43899 float num15 = 0.7f;
43900 if (type == 6 || type == 173)
43901 {
43902 num15 = 0.4f;
43903 }
43904 if (collideX)
43905 {
43906 netUpdate = true;
43907 velocity.X = oldVelocity.X * (0f - num15);
43908 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
43909 {
43910 velocity.X = 2f;
43911 }
43912 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
43913 {
43914 velocity.X = -2f;
43915 }
43916 }
43917 if (collideY)
43918 {
43919 netUpdate = true;
43920 velocity.Y = oldVelocity.Y * (0f - num15);
43921 if (velocity.Y > 0f && (double)velocity.Y < 1.5)
43922 {
43923 velocity.Y = 2f;
43924 }
43925 if (velocity.Y < 0f && (double)velocity.Y > -1.5)
43926 {
43927 velocity.Y = -2f;
43928 }
43929 }
43931 if (type == 619)
43932 {
43933 int num16 = Dust.NewDust(position, width, height, 5, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
43934 Main.dust[num16].velocity *= 0.5f;
43935 }
43936 else if (type != 42 && type != 139 && type != 176 && type != 205 && type != 210 && type != 211 && type != 252 && (type < 231 || type > 235) && Main.rand.Next(20) == 0)
43937 {
43938 int num17 = 18;
43939 if (type == 173)
43940 {
43941 num17 = 5;
43942 }
43943 int num18 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), num17, velocity.X, 2f, 75, color, scale);
43944 Main.dust[num18].velocity.X *= 0.5f;
43945 Main.dust[num18].velocity.Y *= 0.1f;
43946 }
43948 }
43949 else if (type != 252 && Main.rand.Next(40) == 0)
43950 {
43951 int num19 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
43952 Main.dust[num19].velocity.X *= 0.5f;
43953 Main.dust[num19].velocity.Y *= 0.1f;
43954 }
43955 if ((type == 6 || type == 94 || type == 173 || type == 619) && wet)
43956 {
43957 if (velocity.Y > 0f)
43958 {
43959 velocity.Y *= 0.95f;
43960 }
43961 velocity.Y -= 0.3f;
43962 if (velocity.Y < -2f)
43963 {
43964 velocity.Y = -2f;
43965 }
43966 }
43967 if (type == 205 && wet)
43968 {
43969 if (velocity.Y > 0f)
43970 {
43971 velocity.Y *= 0.95f;
43972 }
43973 velocity.Y -= 0.5f;
43974 if (velocity.Y < -4f)
43975 {
43976 velocity.Y = -4f;
43977 }
43978 TargetClosest();
43979 }
43980 if (type == 42 || type == 176 || (type >= 231 && type <= 235))
43981 {
43982 if (wet)
43983 {
43984 if (velocity.Y > 0f)
43985 {
43986 velocity.Y *= 0.95f;
43987 }
43988 velocity.Y -= 0.5f;
43989 if (velocity.Y < -4f)
43990 {
43991 velocity.Y = -4f;
43992 }
43993 TargetClosest();
43994 }
43995 if (ai[1] == 101f)
43996 {
43998 ai[1] = 0f;
43999 }
44000 if (Main.netMode != 1)
44001 {
44002 ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * scale;
44003 if (type == 176)
44004 {
44005 ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * scale;
44006 }
44007 if (Main.getGoodWorld)
44008 {
44009 ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * scale;
44010 }
44011 if (targetData.Type == NPCTargetType.Player)
44012 {
44013 Player player = Main.player[target];
44014 if (player != null && player.stealth == 0f && player.itemAnimation == 0)
44015 {
44016 ai[1] = 0f;
44017 }
44018 }
44019 if (ai[1] >= 130f)
44020 {
44021 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
44022 {
44023 float num20 = 8f;
44024 Vector2 vector4 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)(height / 2));
44025 float num21 = targetData.Center.X - vector4.X + (float)Main.rand.Next(-20, 21);
44026 float num22 = targetData.Center.Y - vector4.Y + (float)Main.rand.Next(-20, 21);
44027 if ((num21 < 0f && velocity.X < 0f) || (num21 > 0f && velocity.X > 0f))
44028 {
44029 float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
44030 num23 = num20 / num23;
44031 num21 *= num23;
44032 num22 *= num23;
44033 int num24 = (int)(10f * scale);
44034 if (type == 176)
44035 {
44036 num24 = (int)(30f * scale);
44037 }
44038 int num25 = 55;
44040 Main.projectile[num26].timeLeft = 300;
44041 ai[1] = 101f;
44042 netUpdate = true;
44043 }
44044 else
44045 {
44046 ai[1] = 0f;
44047 }
44048 }
44049 else
44050 {
44051 ai[1] = 0f;
44052 }
44053 }
44054 }
44055 }
44056 if (type == 139 && flag2)
44057 {
44058 if ((velocity.X > 0f && num4 > 0f) || (velocity.X < 0f && num4 < 0f))
44059 {
44060 int num27 = 12;
44061 if (IsMechQueenUp)
44062 {
44063 num27 = 5;
44064 }
44065 if (Math.Abs(velocity.X) < (float)num27)
44066 {
44067 velocity.X *= 1.05f;
44068 }
44069 }
44070 else
44071 {
44072 velocity.X *= 0.9f;
44073 }
44074 }
44075 if (type == 139 && IsMechQueenUp && ai[2] == 0f)
44076 {
44078 Vector2 v2 = center - base.Center;
44079 int num28 = 120;
44080 if (v2.Length() < (float)num28)
44081 {
44082 base.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28;
44083 }
44084 }
44085 if (Main.netMode != 1)
44086 {
44087 if (Main.getGoodWorld && type == 6 && AnyNPCs(13))
44088 {
44089 if (justHit)
44090 {
44091 localAI[0] = 0f;
44092 }
44093 localAI[0] += 1f;
44094 if (localAI[0] == 60f)
44095 {
44096 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
44097 {
44098 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 666);
44099 }
44100 localAI[0] = 0f;
44101 }
44102 }
44103 if (type == 94 && !flag)
44104 {
44105 if (justHit)
44106 {
44107 localAI[0] = 0f;
44108 }
44109 localAI[0] += 1f;
44110 if (localAI[0] == 180f)
44111 {
44112 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
44113 {
44114 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 112);
44115 }
44116 localAI[0] = 0f;
44117 }
44118 }
44119 if (type == 619 && !flag)
44120 {
44121 if (justHit)
44122 {
44123 localAI[0] += 10f;
44124 }
44125 localAI[0] += 1f;
44126 if (localAI[0] >= 120f)
44127 {
44128 if (targetData.Type != 0 && Collision.CanHit(this, targetData))
44129 {
44130 if ((base.Center - targetData.Center).Length() < 400f)
44131 {
44132 Vector2 vector5 = DirectionTo(new Vector2(targetData.Center.X, targetData.Position.Y));
44133 velocity = -vector5 * 5f;
44134 netUpdate = true;
44135 localAI[0] = 0f;
44136 vector5 = DirectionTo(new Vector2(targetData.Center.X + (float)Main.rand.Next(-100, 101), targetData.Position.Y + (float)Main.rand.Next(-100, 101)));
44138 }
44139 else
44140 {
44141 localAI[0] = 50f;
44142 }
44143 }
44144 else
44145 {
44146 localAI[0] = 50f;
44147 }
44148 }
44149 }
44150 }
44151 if ((Main.IsItDay() && type != 173 && type != 619 && type != 6 && type != 23 && type != 42 && type != 94 && type != 176 && type != 205 && type != 210 && type != 211 && type != 252 && (type < 231 || type > 235)) || flag)
44152 {
44153 velocity.Y -= num2 * 2f;
44154 EncourageDespawn(10);
44155 }
44156 if (((velocity.X > 0f && oldVelocity.X < 0f) || (velocity.X < 0f && oldVelocity.X > 0f) || (velocity.Y > 0f && oldVelocity.Y < 0f) || (velocity.Y < 0f && oldVelocity.Y > 0f)) && !justHit)
44157 {
44158 netUpdate = true;
44159 }
44160 }
44161
44162 public void CopyInteractions(NPC npc)
44163 {
44164 for (int i = 0; i < playerInteraction.Length; i++)
44165 {
44167 }
44169 }
44170
44172 {
44173 if (!Main.expertMode)
44174 {
44175 return 65;
44176 }
44177 return 70;
44178 }
44179
44181 {
44182 if (!Main.RegisteredGameModes.TryGetValue(gamemode, out var gameModeData))
44183 {
44184 return 65;
44185 }
44186 if (!gameModeData.IsExpertMode)
44187 {
44188 return 65;
44189 }
44190 return 70;
44191 }
44192
44194 {
44195 if (Main.getGoodWorld)
44196 {
44197 return 40;
44198 }
44199 return 20;
44200 }
44201
44202 public static int GetDestroyerSegmentsCount()
44203 {
44204 if (Main.getGoodWorld)
44205 {
44206 return 100;
44207 }
44208 return 80;
44209 }
44210
44212 {
44213 if (IsMechQueenUp && type == 127)
44214 {
44215 return base.Center + new Vector2(0f, -14f);
44216 }
44217 return base.Center;
44218 }
44219
44220 private void AI_006_Worms()
44221 {
44222 if (type == 117 && localAI[1] == 0f)
44223 {
44224 localAI[1] = 1f;
44226 int num = 1;
44227 if (velocity.X < 0f)
44228 {
44229 num = -1;
44230 }
44231 for (int i = 0; i < 20; i++)
44232 {
44233 Dust.NewDust(new Vector2(position.X - 20f, position.Y - 20f), width + 40, height + 40, 5, num * 8, -1f);
44234 }
44235 }
44236 if (type == 454 && localAI[3] == 0f)
44237 {
44239 localAI[3] = 1f;
44240 }
44241 if (type >= 454 && type <= 459)
44242 {
44243 dontTakeDamage = alpha > 0;
44244 if (type == 454 || (type != 454 && Main.npc[(int)ai[1]].alpha < 85))
44245 {
44246 if (dontTakeDamage)
44247 {
44248 for (int j = 0; j < 2; j++)
44249 {
44250 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
44251 Main.dust[num2].noGravity = true;
44252 Main.dust[num2].noLight = true;
44253 }
44254 }
44255 alpha -= 42;
44256 if (alpha < 0)
44257 {
44258 alpha = 0;
44259 }
44260 }
44261 }
44262 if (type >= 621 && type <= 623)
44263 {
44265 dontTakeDamage = alpha > 0;
44266 if (type == 621 || (type != 621 && Main.npc[(int)ai[1]].alpha < 85))
44267 {
44268 if (dontTakeDamage)
44269 {
44270 for (int k = 0; k < 2; k++)
44271 {
44272 Dust.NewDust(position, width, height, 5, 0f, 0f, 100);
44273 }
44274 }
44275 alpha -= 42;
44276 if (alpha < 0)
44277 {
44278 alpha = 0;
44279 }
44280 }
44281 if (alpha == 0 && Main.rand.Next(5) == 0)
44282 {
44283 Dust.NewDust(position, width, height, 5, 0f, 0f, 100);
44284 }
44286 }
44287 else if (type == 402)
44288 {
44289 ai[2] += 1f;
44290 float num3 = 600f;
44291 float num4 = num3 - 30f;
44292 if (velocity.Length() >= 1f && ai[2] <= num4)
44293 {
44294 velocity *= Utils.Remap(ai[2], num4 * 0.5f, num4, 1f, 0.5f);
44295 }
44296 if (ai[2] == num4)
44297 {
44298 for (int l = 0; l < 50; l++)
44299 {
44300 Vector2 vector = Main.rand.NextVector2Circular(8f, 8f);
44301 if (Main.rand.Next(2) == 0)
44302 {
44303 int num5 = Dust.NewDust(position, width, height, 180, 0f, 0f, 100);
44304 Main.dust[num5].scale += (float)Main.rand.Next(50) * 0.04f;
44305 Main.dust[num5].noGravity = true;
44306 Main.dust[num5].velocity = vector;
44307 Main.dust[num5].fadeIn = Main.rand.NextFloat() * 1.5f;
44308 }
44309 if (Main.rand.Next(2) == 0)
44310 {
44311 int num6 = Dust.NewDust(position, width, height, 176, 0f, 0f, 100);
44312 Main.dust[num6].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
44313 Main.dust[num6].noGravity = true;
44314 Main.dust[num6].velocity = vector;
44315 Main.dust[num6].fadeIn = Main.rand.NextFloat() * 1.5f;
44316 }
44317 }
44318 if (Main.netMode != 1)
44319 {
44321 velocity = velocity.SafeNormalize(Vector2.Zero) * 6f;
44322 netUpdate = true;
44323 }
44324 }
44325 if (ai[2] >= num3 && Main.netMode != 1)
44326 {
44327 ai[2] = 0f;
44328 netUpdate = true;
44329 }
44330 }
44331 if (Main.netMode != 1 && Main.expertMode)
44332 {
44333 if (type == 14 && ((double)(position.Y / 16f) < Main.worldSurface || Main.getGoodWorld))
44334 {
44335 int num7 = (int)(base.Center.X / 16f);
44336 int num8 = (int)(base.Center.Y / 16f);
44337 if (WorldGen.InWorld(num7, num8) && Main.tile[num7, num8].wall == 0)
44338 {
44339 int num9 = 900;
44340 if (Main.getGoodWorld)
44341 {
44342 num9 /= 2;
44343 }
44344 if (Main.rand.Next(num9) == 0)
44345 {
44346 TargetClosest();
44347 if (Collision.CanHitLine(base.Center, 1, 1, Main.player[target].Center, 1, 1))
44348 {
44349 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 666, 0, 0f, 1f);
44350 }
44351 }
44352 }
44353 }
44354 else if (type == 13)
44355 {
44356 int num10 = 90;
44357 num10 += (int)((float)life / (float)lifeMax * 60f * 5f);
44358 if (Main.rand.Next(num10) == 0)
44359 {
44360 TargetClosest();
44361 if (Collision.CanHitLine(base.Center, 1, 1, Main.player[target].Center, 1, 1))
44362 {
44363 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2) + velocity.X), (int)(position.Y + (float)(height / 2) + velocity.Y), 666, 0, 0f, 1f);
44364 }
44365 }
44366 }
44367 }
44368 bool flag = false;
44369 float num11 = 0.2f;
44370 switch (type)
44371 {
44372 case 513:
44373 flag = !Main.player[target].ZoneUndergroundDesert;
44374 num11 = 0.1f;
44375 break;
44376 case 10:
44377 case 39:
44378 case 95:
44379 case 117:
44380 case 510:
44381 flag = true;
44382 break;
44383 case 621:
44384 flag = false;
44385 break;
44386 }
44387 if (type >= 13 && type <= 15)
44388 {
44389 realLife = -1;
44390 }
44391 else if (ai[3] > 0f)
44392 {
44393 realLife = (int)ai[3];
44394 }
44395 if (target < 0 || target == 255 || Main.player[target].dead || (flag && (double)Main.player[target].position.Y < Main.worldSurface * 16.0))
44396 {
44397 TargetClosest();
44398 }
44399 if (Main.player[target].dead || (flag && (double)Main.player[target].position.Y < Main.worldSurface * 16.0))
44400 {
44401 EncourageDespawn(300);
44402 if (flag)
44403 {
44404 velocity.Y += num11;
44405 }
44406 }
44407 if (type == 621 && Main.dayTime)
44408 {
44409 EncourageDespawn(60);
44410 velocity.Y += 1f;
44411 }
44412 if (Main.netMode != 1)
44413 {
44414 if (type == 87 && ai[0] == 0f)
44415 {
44416 ai[3] = whoAmI;
44417 realLife = whoAmI;
44418 int num12 = 0;
44419 int num13 = whoAmI;
44420 for (int m = 0; m < 14; m++)
44421 {
44422 int num14 = 89;
44423 switch (m)
44424 {
44425 case 1:
44426 case 8:
44427 num14 = 88;
44428 break;
44429 case 11:
44430 num14 = 90;
44431 break;
44432 case 12:
44433 num14 = 91;
44434 break;
44435 case 13:
44436 num14 = 92;
44437 break;
44438 }
44439 num12 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num14, whoAmI);
44440 Main.npc[num12].ai[3] = whoAmI;
44441 Main.npc[num12].realLife = whoAmI;
44442 Main.npc[num12].ai[1] = num13;
44443 Main.npc[num12].CopyInteractions(this);
44444 Main.npc[num13].ai[0] = num12;
44445 NetMessage.SendData(23, -1, -1, null, num12);
44446 num13 = num12;
44447 }
44448 }
44449 if (type == 454 && ai[0] == 0f)
44450 {
44451 ai[3] = whoAmI;
44452 realLife = whoAmI;
44453 int num15 = 0;
44454 int num16 = whoAmI;
44455 for (int n = 0; n < 30; n++)
44456 {
44457 int num17 = 456;
44458 if ((n - 2) % 4 == 0 && n < 26)
44459 {
44460 num17 = 455;
44461 }
44462 else
44463 {
44464 switch (n)
44465 {
44466 case 27:
44467 num17 = 457;
44468 break;
44469 case 28:
44470 num17 = 458;
44471 break;
44472 case 29:
44473 num17 = 459;
44474 break;
44475 }
44476 }
44477 num15 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num17, whoAmI);
44478 Main.npc[num15].ai[3] = whoAmI;
44479 Main.npc[num15].realLife = whoAmI;
44480 Main.npc[num15].ai[1] = num16;
44481 Main.npc[num15].CopyInteractions(this);
44482 Main.npc[num16].ai[0] = num15;
44483 NetMessage.SendData(23, -1, -1, null, num15);
44484 num16 = num15;
44485 }
44486 }
44487 if (type == 513 && ai[0] == 0f)
44488 {
44489 ai[3] = whoAmI;
44490 realLife = whoAmI;
44491 int num18 = 0;
44492 int num19 = whoAmI;
44493 int num20 = Main.rand.Next(6, 10);
44494 for (int num21 = 0; num21 < num20; num21++)
44495 {
44496 int num22 = 514;
44497 if (num21 == num20 - 1)
44498 {
44499 num22 = 515;
44500 }
44501 num18 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num22, whoAmI);
44502 Main.npc[num18].ai[3] = whoAmI;
44503 Main.npc[num18].realLife = whoAmI;
44504 Main.npc[num18].ai[1] = num19;
44505 Main.npc[num18].CopyInteractions(this);
44506 Main.npc[num19].ai[0] = num18;
44507 NetMessage.SendData(23, -1, -1, null, num18);
44508 num19 = num18;
44509 }
44510 }
44511 if (type == 510 && ai[0] == 0f)
44512 {
44513 ai[3] = whoAmI;
44514 realLife = whoAmI;
44515 int num23 = 0;
44516 int num24 = whoAmI;
44517 int num25 = Main.rand.Next(12, 21);
44518 for (int num26 = 0; num26 < num25; num26++)
44519 {
44520 int num27 = 511;
44521 if (num26 == num25 - 1)
44522 {
44523 num27 = 512;
44524 }
44525 num23 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num27, whoAmI);
44526 Main.npc[num23].ai[3] = whoAmI;
44527 Main.npc[num23].realLife = whoAmI;
44528 Main.npc[num23].ai[1] = num24;
44529 Main.npc[num23].CopyInteractions(this);
44530 Main.npc[num24].ai[0] = num23;
44531 NetMessage.SendData(23, -1, -1, null, num23);
44532 num24 = num23;
44533 }
44534 }
44535 if (type == 621 && ai[0] == 0f)
44536 {
44537 ai[3] = whoAmI;
44538 realLife = whoAmI;
44539 int num28 = 0;
44540 int num29 = whoAmI;
44541 int num30 = 16;
44542 for (int num31 = 0; num31 < num30; num31++)
44543 {
44544 int num32 = 622;
44545 if (num31 == num30 - 1)
44546 {
44547 num32 = 623;
44548 }
44549 num28 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num32, whoAmI);
44550 Main.npc[num28].ai[3] = whoAmI;
44551 Main.npc[num28].realLife = whoAmI;
44552 Main.npc[num28].ai[1] = num29;
44553 Main.npc[num28].CopyInteractions(this);
44554 Main.npc[num29].ai[0] = num28;
44555 NetMessage.SendData(23, -1, -1, null, num28);
44556 num29 = num28;
44557 }
44558 }
44559 else if ((type == 7 || type == 8 || type == 10 || type == 11 || type == 13 || type == 14 || type == 39 || type == 40 || type == 95 || type == 96 || type == 98 || type == 99 || type == 117 || type == 118) && ai[0] == 0f)
44560 {
44561 if (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117)
44562 {
44563 if (type < 13 || type > 15)
44564 {
44565 ai[3] = whoAmI;
44566 realLife = whoAmI;
44567 }
44568 ai[2] = Main.rand.Next(8, 13);
44569 if (type == 10)
44570 {
44571 ai[2] = Main.rand.Next(4, 7);
44572 }
44573 if (type == 13)
44574 {
44576 }
44577 if (type == 39)
44578 {
44579 ai[2] = Main.rand.Next(14, 23);
44580 if (Main.getGoodWorld)
44581 {
44582 ai[2] += 3f;
44583 if (Main.remixWorld)
44584 {
44585 ai[2] += 4f;
44586 }
44587 }
44588 }
44589 if (type == 95)
44590 {
44591 ai[2] = Main.rand.Next(6, 12);
44592 }
44593 if (type == 98)
44594 {
44595 ai[2] = Main.rand.Next(20, 26);
44596 }
44597 if (type == 117)
44598 {
44599 ai[2] = Main.rand.Next(3, 6);
44600 }
44601 if (type == 7 && Main.remixWorld)
44602 {
44603 ai[2] *= 2f;
44604 }
44605 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type + 1, whoAmI);
44606 Main.npc[(int)ai[0]].CopyInteractions(this);
44607 }
44608 else if ((type == 8 || type == 11 || type == 14 || type == 40 || type == 96 || type == 99 || type == 118) && ai[2] > 0f)
44609 {
44610 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type, whoAmI);
44611 Main.npc[(int)ai[0]].CopyInteractions(this);
44612 }
44613 else
44614 {
44615 ai[0] = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), type + 1, whoAmI);
44616 Main.npc[(int)ai[0]].CopyInteractions(this);
44617 }
44618 if (type < 13 || type > 15)
44619 {
44620 Main.npc[(int)ai[0]].ai[3] = ai[3];
44621 Main.npc[(int)ai[0]].realLife = realLife;
44622 }
44623 Main.npc[(int)ai[0]].ai[1] = whoAmI;
44624 Main.npc[(int)ai[0]].ai[2] = ai[2] - 1f;
44625 netUpdate = true;
44626 }
44627 if (type == 412 && ai[0] == 0f)
44628 {
44629 ai[3] = whoAmI;
44630 realLife = whoAmI;
44631 int num33 = 0;
44632 int num34 = whoAmI;
44633 int num35 = 30;
44634 for (int num36 = 0; num36 < num35; num36++)
44635 {
44636 int num37 = 413;
44637 if (num36 == num35 - 1)
44638 {
44639 num37 = 414;
44640 }
44641 num33 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), num37, whoAmI);
44642 Main.npc[num33].ai[3] = whoAmI;
44643 Main.npc[num33].realLife = whoAmI;
44644 Main.npc[num33].ai[1] = num34;
44645 Main.npc[num33].CopyInteractions(this);
44646 Main.npc[num34].ai[0] = num33;
44647 NetMessage.SendData(23, -1, -1, null, num33);
44648 num34 = num33;
44649 }
44650 }
44651 switch (type)
44652 {
44653 case 8:
44654 case 9:
44655 case 11:
44656 case 12:
44657 case 40:
44658 case 41:
44659 case 88:
44660 case 89:
44661 case 90:
44662 case 91:
44663 case 92:
44664 case 96:
44665 case 97:
44666 case 99:
44667 case 100:
44668 case 118:
44669 case 119:
44670 case 413:
44671 case 414:
44672 case 455:
44673 case 456:
44674 case 457:
44675 case 458:
44676 case 459:
44677 case 511:
44678 case 512:
44679 case 514:
44680 case 515:
44681 case 622:
44682 case 623:
44683 if (!Main.npc[(int)ai[1]].active || Main.npc[(int)ai[1]].aiStyle != aiStyle)
44684 {
44685 life = 0;
44686 HitEffect();
44687 checkDead();
44688 active = false;
44689 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44690 return;
44691 }
44692 break;
44693 }
44694 switch (type)
44695 {
44696 case 7:
44697 case 8:
44698 case 10:
44699 case 11:
44700 case 39:
44701 case 40:
44702 case 87:
44703 case 88:
44704 case 89:
44705 case 90:
44706 case 91:
44707 case 95:
44708 case 96:
44709 case 98:
44710 case 99:
44711 case 117:
44712 case 118:
44713 case 412:
44714 case 413:
44715 case 454:
44716 case 455:
44717 case 456:
44718 case 457:
44719 case 458:
44720 case 510:
44721 case 511:
44722 case 513:
44723 case 514:
44724 case 621:
44725 case 622:
44726 if (!Main.npc[(int)ai[0]].active || Main.npc[(int)ai[0]].aiStyle != aiStyle)
44727 {
44728 life = 0;
44729 HitEffect();
44730 checkDead();
44731 active = false;
44732 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44733 return;
44734 }
44735 break;
44736 }
44737 if (type == 13 || type == 14 || type == 15)
44738 {
44739 if (!Main.npc[(int)ai[1]].active && !Main.npc[(int)ai[0]].active)
44740 {
44741 life = 0;
44742 HitEffect();
44743 checkDead();
44744 active = false;
44745 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44746 return;
44747 }
44748 if (type == 13 && !Main.npc[(int)ai[0]].active)
44749 {
44750 life = 0;
44751 HitEffect();
44752 checkDead();
44753 active = false;
44754 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44755 return;
44756 }
44757 if (type == 15 && !Main.npc[(int)ai[1]].active)
44758 {
44759 life = 0;
44760 HitEffect();
44761 checkDead();
44762 active = false;
44763 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44764 return;
44765 }
44766 if (type == 14 && (!Main.npc[(int)ai[1]].active || Main.npc[(int)ai[1]].aiStyle != aiStyle))
44767 {
44768 type = 13;
44769 int num38 = whoAmI;
44770 float num39 = (float)life / (float)lifeMax;
44771 float num40 = ai[0];
44773 life = (int)((float)lifeMax * num39);
44774 ai[0] = num40;
44775 TargetClosest();
44776 netUpdate = true;
44777 whoAmI = num38;
44778 alpha = 0;
44779 }
44780 if (type == 14 && (!Main.npc[(int)ai[0]].active || Main.npc[(int)ai[0]].aiStyle != aiStyle))
44781 {
44782 type = 15;
44783 int num41 = whoAmI;
44784 float num42 = (float)life / (float)lifeMax;
44785 float num43 = ai[1];
44787 life = (int)((float)lifeMax * num42);
44788 ai[1] = num43;
44789 TargetClosest();
44790 netUpdate = true;
44791 whoAmI = num41;
44792 alpha = 0;
44793 }
44794 }
44795 if (!active && Main.netMode == 2)
44796 {
44797 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
44798 }
44799 }
44800 int num44 = (int)(position.X / 16f) - 1;
44801 int num45 = (int)((position.X + (float)width) / 16f) + 2;
44802 int num46 = (int)(position.Y / 16f) - 1;
44803 int num47 = (int)((position.Y + (float)height) / 16f) + 2;
44804 if (num44 < 0)
44805 {
44806 num44 = 0;
44807 }
44808 if (num45 > Main.maxTilesX)
44809 {
44811 }
44812 if (num46 < 0)
44813 {
44814 num46 = 0;
44815 }
44816 if (num47 > Main.maxTilesY)
44817 {
44819 }
44820 bool flag2 = false;
44821 if (type >= 87 && type <= 92)
44822 {
44823 flag2 = true;
44824 }
44825 if (type >= 454 && type <= 459)
44826 {
44827 flag2 = true;
44828 }
44829 if (type >= 621 && type <= 623)
44830 {
44831 flag2 = true;
44832 }
44833 if (type >= 412 && type <= 414)
44834 {
44835 flag2 = true;
44836 }
44837 if (type == 402)
44838 {
44839 flag2 = true;
44840 }
44841 if (!flag2)
44842 {
44843 Vector2 vector2 = default(Vector2);
44844 for (int num48 = num44; num48 < num45; num48++)
44845 {
44846 for (int num49 = num46; num49 < num47; num49++)
44847 {
44848 if (Main.tile[num48, num49] == null || ((!Main.tile[num48, num49].nactive() || (!Main.tileSolid[Main.tile[num48, num49].type] && (!Main.tileSolidTop[Main.tile[num48, num49].type] || Main.tile[num48, num49].frameY != 0))) && Main.tile[num48, num49].liquid <= 64))
44849 {
44850 continue;
44851 }
44852 vector2.X = num48 * 16;
44853 vector2.Y = num49 * 16;
44854 if (position.X + (float)width > vector2.X && position.X < vector2.X + 16f && position.Y + (float)height > vector2.Y && position.Y < vector2.Y + 16f)
44855 {
44856 flag2 = true;
44857 if (Main.rand.Next(100) == 0 && type != 117 && Main.tile[num48, num49].nactive() && Main.tileSolid[Main.tile[num48, num49].type])
44858 {
44859 WorldGen.KillTile(num48, num49, fail: true, effectOnly: true);
44860 }
44861 }
44862 }
44863 }
44864 }
44865 if (!flag2 && (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117 || type == 375 || type == 454 || type == 510 || type == 513 || type == 621))
44866 {
44868 int num50 = 1000;
44869 bool flag3 = true;
44870 for (int num51 = 0; num51 < 255; num51++)
44871 {
44872 if (Main.player[num51].active)
44873 {
44874 Rectangle rectangle2 = new Rectangle((int)Main.player[num51].position.X - num50, (int)Main.player[num51].position.Y - num50, num50 * 2, num50 * 2);
44875 if (rectangle.Intersects(rectangle2))
44876 {
44877 flag3 = false;
44878 break;
44879 }
44880 }
44881 }
44882 if (flag3)
44883 {
44884 flag2 = true;
44885 }
44886 }
44887 if ((type >= 87 && type <= 92) || (type >= 454 && type <= 459) || (type >= 621 && type <= 623))
44888 {
44889 if (velocity.X < 0f)
44890 {
44891 spriteDirection = 1;
44892 }
44893 else if (velocity.X > 0f)
44894 {
44895 spriteDirection = -1;
44896 }
44897 }
44898 if (type == 414)
44899 {
44900 if (justHit)
44901 {
44902 localAI[3] = 3f;
44903 }
44904 if (localAI[2] > 0f)
44905 {
44906 localAI[2] -= 16f;
44907 if (localAI[2] == 0f)
44908 {
44909 localAI[2] = -128f;
44910 }
44911 }
44912 else if (localAI[2] < 0f)
44913 {
44914 localAI[2] += 16f;
44915 }
44916 else if (localAI[3] > 0f)
44917 {
44918 localAI[2] = 128f;
44919 localAI[3] -= 1f;
44920 }
44921 }
44922 if (type == 412)
44923 {
44925 Vector2 vector3 = base.Center + (rotation - (float)Math.PI / 2f).ToRotationVector2() * 8f;
44926 Vector2 vector4 = rotation.ToRotationVector2() * 16f;
44927 Dust obj = Main.dust[Dust.NewDust(vector3 + vector4, 0, 0, 6, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)];
44928 obj.noGravity = true;
44929 obj.noLight = true;
44930 obj.position -= new Vector2(4f);
44931 obj.fadeIn = 1f;
44932 obj.velocity = Vector2.Zero;
44933 Dust obj2 = Main.dust[Dust.NewDust(vector3 - vector4, 0, 0, 6, velocity.X, velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)];
44934 obj2.noGravity = true;
44935 obj2.noLight = true;
44936 obj2.position -= new Vector2(4f);
44937 obj2.fadeIn = 1f;
44938 obj2.velocity = Vector2.Zero;
44940 }
44941 float num52 = 8f;
44942 float num53 = 0.07f;
44943 if (type == 95)
44944 {
44945 num52 = 5.5f;
44946 num53 = 0.045f;
44947 }
44948 if (type == 10)
44949 {
44950 num52 = 6f;
44951 num53 = 0.05f;
44952 }
44953 if (type == 513)
44954 {
44955 num52 = 7f;
44956 num53 = 0.1f;
44957 }
44958 if (type == 7)
44959 {
44960 num52 = 9f;
44961 num53 = 0.1f;
44962 }
44963 if (type == 13)
44964 {
44965 num52 = 10f;
44966 num53 = 0.07f;
44967 if (Main.expertMode)
44968 {
44969 num52 = 12f;
44970 num53 = 0.15f;
44971 }
44972 if (Main.getGoodWorld)
44973 {
44974 num52 += 4f;
44975 num53 += 0.05f;
44976 }
44977 }
44978 if (type == 510)
44979 {
44980 if (!Main.player[target].dead && Main.player[target].ZoneSandstorm)
44981 {
44982 num52 = 16f;
44983 num53 = 0.35f;
44984 }
44985 else
44986 {
44987 num52 = 10f;
44988 num53 = 0.25f;
44989 }
44990 }
44991 if (type == 87)
44992 {
44993 num52 = 11f;
44994 num53 = 0.25f;
44995 }
44996 if (type == 621)
44997 {
44998 num52 = 15f;
44999 num53 = 0.45f;
45000 }
45001 if (type == 375)
45002 {
45003 num52 = 6f;
45004 num53 = 0.15f;
45005 }
45006 if (type == 454)
45007 {
45008 num52 = 20f;
45009 num53 = 0.55f;
45010 }
45011 if (type == 402)
45012 {
45013 num52 = 9f;
45014 num53 = 0.3f;
45015 }
45016 if (type == 117 && Main.wofNPCIndex >= 0)
45017 {
45018 float num54 = (float)Main.npc[Main.wofNPCIndex].life / (float)Main.npc[Main.wofNPCIndex].lifeMax;
45019 if ((double)num54 < 0.5)
45020 {
45021 num52 += 1f;
45022 num53 += 0.1f;
45023 }
45024 if ((double)num54 < 0.25)
45025 {
45026 num52 += 1f;
45027 num53 += 0.1f;
45028 }
45029 if ((double)num54 < 0.1)
45030 {
45031 num52 += 2f;
45032 num53 += 0.1f;
45033 }
45034 }
45035 if (type == 39)
45036 {
45037 num52 = 9f;
45038 num53 = 0.1f;
45039 if (Main.getGoodWorld)
45040 {
45041 num52 = 10f;
45042 num53 = 0.12f;
45043 }
45044 }
45045 Vector2 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45046 float num55 = Main.player[target].position.X + (float)(Main.player[target].width / 2);
45047 float num56 = Main.player[target].position.Y + (float)(Main.player[target].height / 2);
45048 if (type == 412)
45049 {
45050 num52 = 10f;
45051 num53 = 0.3f;
45052 int num57 = -1;
45053 int num58 = (int)(Main.player[target].Center.X / 16f);
45054 int num59 = (int)(Main.player[target].Center.Y / 16f);
45055 for (int num60 = num58 - 2; num60 <= num58 + 2; num60++)
45056 {
45057 for (int num61 = num59; num61 <= num59 + 15; num61++)
45058 {
45060 {
45061 num57 = num61;
45062 break;
45063 }
45064 }
45065 if (num57 > 0)
45066 {
45067 break;
45068 }
45069 }
45070 if (num57 > 0)
45071 {
45072 num57 *= 16;
45073 float num62 = num57 - 800;
45074 if (Main.player[target].position.Y > num62)
45075 {
45076 num56 = num62;
45077 if (Math.Abs(base.Center.X - Main.player[target].Center.X) < 500f)
45078 {
45079 num55 = ((!(velocity.X > 0f)) ? (Main.player[target].Center.X - 600f) : (Main.player[target].Center.X + 600f));
45080 }
45081 }
45082 }
45083 else
45084 {
45085 num52 = 14f;
45086 num53 = 0.5f;
45087 }
45088 float num63 = num52 * 1.3f;
45089 float num64 = num52 * 0.7f;
45090 float num65 = velocity.Length();
45091 if (num65 > 0f)
45092 {
45093 if (num65 > num63)
45094 {
45096 velocity *= num63;
45097 }
45098 else if (num65 < num64)
45099 {
45101 velocity *= num64;
45102 }
45103 }
45104 if (num57 > 0)
45105 {
45106 for (int num66 = 0; num66 < 200; num66++)
45107 {
45108 if (Main.npc[num66].active && Main.npc[num66].type == type && num66 != whoAmI)
45109 {
45110 Vector2 vector6 = Main.npc[num66].Center - base.Center;
45111 if (vector6.Length() < 400f)
45112 {
45113 vector6.Normalize();
45114 vector6 *= 1000f;
45115 num55 -= vector6.X;
45116 num56 -= vector6.Y;
45117 }
45118 }
45119 }
45120 }
45121 else
45122 {
45123 for (int num67 = 0; num67 < 200; num67++)
45124 {
45125 if (Main.npc[num67].active && Main.npc[num67].type == type && num67 != whoAmI)
45126 {
45127 Vector2 vector7 = Main.npc[num67].Center - base.Center;
45128 if (vector7.Length() < 60f)
45129 {
45130 vector7.Normalize();
45131 vector7 *= 200f;
45132 num55 -= vector7.X;
45133 num56 -= vector7.Y;
45134 }
45135 }
45136 }
45137 }
45138 }
45139 num55 = (int)(num55 / 16f) * 16;
45140 num56 = (int)(num56 / 16f) * 16;
45141 vector5.X = (int)(vector5.X / 16f) * 16;
45142 vector5.Y = (int)(vector5.Y / 16f) * 16;
45143 num55 -= vector5.X;
45144 num56 -= vector5.Y;
45145 if (type == 375)
45146 {
45147 num55 *= -1f;
45148 num56 *= -1f;
45149 }
45150 float num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45151 if (ai[1] > 0f && ai[1] < (float)Main.npc.Length)
45152 {
45153 try
45154 {
45155 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45156 num55 = Main.npc[(int)ai[1]].position.X + (float)(Main.npc[(int)ai[1]].width / 2) - vector5.X;
45157 num56 = Main.npc[(int)ai[1]].position.Y + (float)(Main.npc[(int)ai[1]].height / 2) - vector5.Y;
45158 }
45159 catch
45160 {
45161 }
45162 rotation = (float)Math.Atan2(num56, num55) + 1.57f;
45163 num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45164 int num69 = width;
45165 if (type >= 87 && type <= 92)
45166 {
45167 num69 = 42;
45168 }
45169 if (type >= 454 && type <= 459)
45170 {
45171 num69 = 36;
45172 }
45173 if (type >= 13 && type <= 15)
45174 {
45175 num69 = (int)((float)num69 * scale);
45176 }
45177 if (type >= 513 && type <= 515)
45178 {
45179 num69 -= 6;
45180 }
45181 if (type >= 412 && type <= 414)
45182 {
45183 num69 += 6;
45184 }
45185 if (type >= 621 && type <= 623)
45186 {
45187 num69 = 24;
45188 }
45189 if (Main.getGoodWorld && type >= 13 && type <= 15)
45190 {
45191 num69 = 62;
45192 }
45193 num68 = (num68 - (float)num69) / num68;
45194 num55 *= num68;
45195 num56 *= num68;
45197 position.X += num55;
45198 position.Y += num56;
45199 if (type >= 87 && type <= 92)
45200 {
45201 if (num55 < 0f)
45202 {
45203 spriteDirection = 1;
45204 }
45205 else if (num55 > 0f)
45206 {
45207 spriteDirection = -1;
45208 }
45209 }
45210 if (type >= 454 && type <= 459)
45211 {
45212 if (num55 < 0f)
45213 {
45214 spriteDirection = 1;
45215 }
45216 else if (num55 > 0f)
45217 {
45218 spriteDirection = -1;
45219 }
45220 }
45221 if (type >= 621 && type <= 623)
45222 {
45223 if (num55 < 0f)
45224 {
45225 spriteDirection = 1;
45226 }
45227 else if (num55 > 0f)
45228 {
45229 spriteDirection = -1;
45230 }
45231 }
45232 }
45233 else
45234 {
45235 if (!flag2)
45236 {
45237 TargetClosest();
45238 if (type == 39 && velocity.Y < 0f)
45239 {
45240 velocity.Y += 0.08f;
45241 }
45242 else
45243 {
45244 velocity.Y += 0.11f;
45245 }
45246 if (velocity.Y > num52)
45247 {
45248 velocity.Y = num52;
45249 }
45250 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.4)
45251 {
45252 if (velocity.X < 0f)
45253 {
45254 velocity.X -= num53 * 1.1f;
45255 }
45256 else
45257 {
45258 velocity.X += num53 * 1.1f;
45259 }
45260 }
45261 else if (velocity.Y == num52)
45262 {
45263 if (velocity.X < num55)
45264 {
45265 velocity.X += num53;
45266 }
45267 else if (velocity.X > num55)
45268 {
45269 velocity.X -= num53;
45270 }
45271 }
45272 else if (velocity.Y > 4f)
45273 {
45274 if (velocity.X < 0f)
45275 {
45276 velocity.X += num53 * 0.9f;
45277 }
45278 else
45279 {
45280 velocity.X -= num53 * 0.9f;
45281 }
45282 }
45283 }
45284 else
45285 {
45286 if (type != 621 && type != 87 && type != 117 && type != 454 && type != 412 && soundDelay == 0)
45287 {
45288 float num70 = num68 / 40f;
45289 if (num70 < 10f)
45290 {
45291 num70 = 10f;
45292 }
45293 if (num70 > 20f)
45294 {
45295 num70 = 20f;
45296 }
45297 soundDelay = (int)num70;
45298 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y);
45299 }
45300 num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56);
45301 float num71 = Math.Abs(num55);
45302 float num72 = Math.Abs(num56);
45303 float num73 = num52 / num68;
45304 num55 *= num73;
45305 num56 *= num73;
45306 bool flag4 = false;
45307 if ((type == 7 || type == 13) && ((!Main.player[target].ZoneCorrupt && !Main.player[target].ZoneCrimson) || Main.player[target].dead))
45308 {
45309 flag4 = true;
45310 }
45311 if ((type == 513 && (double)Main.player[target].position.Y < Main.worldSurface * 16.0 && !Main.player[target].ZoneSandstorm && !Main.player[target].ZoneUndergroundDesert) || Main.player[target].dead)
45312 {
45313 flag4 = true;
45314 }
45315 if ((type == 510 && (double)Main.player[target].position.Y < Main.worldSurface * 16.0 && !Main.player[target].ZoneSandstorm && !Main.player[target].ZoneUndergroundDesert) || Main.player[target].dead)
45316 {
45317 flag4 = true;
45318 }
45319 if (flag4)
45320 {
45321 bool flag5 = true;
45322 for (int num74 = 0; num74 < 255; num74++)
45323 {
45324 if (Main.player[num74].active && !Main.player[num74].dead && Main.player[num74].ZoneCorrupt)
45325 {
45326 flag5 = false;
45327 }
45328 }
45329 if (flag5)
45330 {
45331 if (Main.netMode != 1 && (double)(position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0)
45332 {
45333 active = false;
45334 int num75 = (int)ai[0];
45335 while (num75 > 0 && num75 < 200 && Main.npc[num75].active && Main.npc[num75].aiStyle == aiStyle)
45336 {
45337 int num76 = (int)Main.npc[num75].ai[0];
45338 Main.npc[num75].active = false;
45339 life = 0;
45340 if (Main.netMode == 2)
45341 {
45342 NetMessage.SendData(23, -1, -1, null, num75);
45343 }
45344 num75 = num76;
45345 }
45346 if (Main.netMode == 2)
45347 {
45348 NetMessage.SendData(23, -1, -1, null, whoAmI);
45349 }
45350 }
45351 num55 = 0f;
45352 num56 = num52;
45353 }
45354 }
45355 bool flag6 = false;
45356 if (type == 87)
45357 {
45358 if (((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f) || (velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)) && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num53 / 2f && num68 < 300f)
45359 {
45360 flag6 = true;
45361 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num52)
45362 {
45363 velocity *= 1.1f;
45364 }
45365 }
45366 if (position.Y > Main.player[target].position.Y || (double)(Main.player[target].position.Y / 16f) > Main.worldSurface || Main.player[target].dead)
45367 {
45368 flag6 = true;
45369 if (Math.Abs(velocity.X) < num52 / 2f)
45370 {
45371 if (velocity.X == 0f)
45372 {
45373 velocity.X -= direction;
45374 }
45375 velocity.X *= 1.1f;
45376 }
45377 else if (velocity.Y > 0f - num52)
45378 {
45379 velocity.Y -= num53;
45380 }
45381 }
45382 }
45383 if (type == 454 || type == 621)
45384 {
45385 float num77 = 300f;
45386 if (type == 621)
45387 {
45388 num77 = 120f;
45389 }
45390 if (((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f) || (velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)) && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num53 / 2f && num68 < num77)
45391 {
45392 flag6 = true;
45393 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num52)
45394 {
45395 velocity *= 1.1f;
45396 }
45397 }
45398 if (position.Y > Main.player[target].position.Y || Main.player[target].dead)
45399 {
45400 flag6 = true;
45401 if (Math.Abs(velocity.X) < num52 / 2f)
45402 {
45403 if (velocity.X == 0f)
45404 {
45405 velocity.X -= direction;
45406 }
45407 velocity.X *= 1.1f;
45408 }
45409 else if (velocity.Y > 0f - num52)
45410 {
45411 velocity.Y -= num53;
45412 }
45413 }
45414 }
45415 if (!flag6)
45416 {
45417 if ((velocity.X > 0f && num55 > 0f) || (velocity.X < 0f && num55 < 0f) || (velocity.Y > 0f && num56 > 0f) || (velocity.Y < 0f && num56 < 0f))
45418 {
45419 if (velocity.X < num55)
45420 {
45421 velocity.X += num53;
45422 }
45423 else if (velocity.X > num55)
45424 {
45425 velocity.X -= num53;
45426 }
45427 if (velocity.Y < num56)
45428 {
45429 velocity.Y += num53;
45430 }
45431 else if (velocity.Y > num56)
45432 {
45433 velocity.Y -= num53;
45434 }
45435 if ((double)Math.Abs(num56) < (double)num52 * 0.2 && ((velocity.X > 0f && num55 < 0f) || (velocity.X < 0f && num55 > 0f)))
45436 {
45437 if (velocity.Y > 0f)
45438 {
45439 velocity.Y += num53 * 2f;
45440 }
45441 else
45442 {
45443 velocity.Y -= num53 * 2f;
45444 }
45445 }
45446 if ((double)Math.Abs(num55) < (double)num52 * 0.2 && ((velocity.Y > 0f && num56 < 0f) || (velocity.Y < 0f && num56 > 0f)))
45447 {
45448 if (velocity.X > 0f)
45449 {
45450 velocity.X += num53 * 2f;
45451 }
45452 else
45453 {
45454 velocity.X -= num53 * 2f;
45455 }
45456 }
45457 }
45458 else if (num71 > num72)
45459 {
45460 if (velocity.X < num55)
45461 {
45462 velocity.X += num53 * 1.1f;
45463 }
45464 else if (velocity.X > num55)
45465 {
45466 velocity.X -= num53 * 1.1f;
45467 }
45468 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.5)
45469 {
45470 if (velocity.Y > 0f)
45471 {
45472 velocity.Y += num53;
45473 }
45474 else
45475 {
45476 velocity.Y -= num53;
45477 }
45478 }
45479 }
45480 else
45481 {
45482 if (velocity.Y < num56)
45483 {
45484 velocity.Y += num53 * 1.1f;
45485 }
45486 else if (velocity.Y > num56)
45487 {
45488 velocity.Y -= num53 * 1.1f;
45489 }
45490 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num52 * 0.5)
45491 {
45492 if (velocity.X > 0f)
45493 {
45494 velocity.X += num53;
45495 }
45496 else
45497 {
45498 velocity.X -= num53;
45499 }
45500 }
45501 }
45502 }
45503 }
45504 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
45505 if (type == 7 || type == 10 || type == 13 || type == 39 || type == 95 || type == 98 || type == 117 || type == 510 || type == 513 || type == 621)
45506 {
45507 if (flag2)
45508 {
45509 if (localAI[0] != 1f)
45510 {
45511 netUpdate = true;
45512 }
45513 localAI[0] = 1f;
45514 }
45515 else
45516 {
45517 if (localAI[0] != 0f)
45518 {
45519 netUpdate = true;
45520 }
45521 localAI[0] = 0f;
45522 }
45523 if (((velocity.X > 0f && oldVelocity.X < 0f) || (velocity.X < 0f && oldVelocity.X > 0f) || (velocity.Y > 0f && oldVelocity.Y < 0f) || (velocity.Y < 0f && oldVelocity.Y > 0f)) && !justHit)
45524 {
45525 netUpdate = true;
45526 }
45527 }
45528 if (type == 454)
45529 {
45530 float num78 = Vector2.Distance(Main.player[target].Center, base.Center);
45531 int num79 = 0;
45532 if (Vector2.Normalize(Main.player[target].Center - base.Center).ToRotation().AngleTowards(velocity.ToRotation(), (float)Math.PI / 2f) == velocity.ToRotation() && num78 < 350f)
45533 {
45534 num79 = 4;
45535 }
45536 if ((double)num79 > frameCounter)
45537 {
45538 frameCounter += 1.0;
45539 }
45540 if ((double)num79 < frameCounter)
45541 {
45542 frameCounter -= 1.0;
45543 }
45544 if (frameCounter < 0.0)
45545 {
45546 frameCounter = 0.0;
45547 }
45548 if (frameCounter > 4.0)
45549 {
45550 frameCounter = 4.0;
45551 }
45552 }
45553 }
45554 if (type < 13 || type > 15 || (type != 13 && (type == 13 || Main.npc[(int)ai[1]].alpha >= 85)))
45555 {
45556 return;
45557 }
45558 if (alpha > 0 && life > 0)
45559 {
45560 for (int num80 = 0; num80 < 2; num80++)
45561 {
45562 int num81 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 100, default(Color), 2f);
45563 Main.dust[num81].noGravity = true;
45564 Main.dust[num81].noLight = true;
45565 }
45566 }
45567 if ((position - oldPosition).Length() > 2f)
45568 {
45569 alpha -= 42;
45570 if (alpha < 0)
45571 {
45572 alpha = 0;
45573 }
45574 }
45575 }
45576
45577 private void AI_002_FloatingEye()
45578 {
45579 if ((type == 170 || type == 171 || type == 180) && Main.rand.Next(1000) == 0)
45580 {
45581 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 9);
45582 }
45583 noGravity = true;
45584 if (!noTileCollide)
45585 {
45586 if (collideX)
45587 {
45588 velocity.X = oldVelocity.X * -0.5f;
45589 if (direction == -1 && velocity.X > 0f && velocity.X < 2f)
45590 {
45591 velocity.X = 2f;
45592 }
45593 if (direction == 1 && velocity.X < 0f && velocity.X > -2f)
45594 {
45595 velocity.X = -2f;
45596 }
45597 }
45598 if (collideY)
45599 {
45600 velocity.Y = oldVelocity.Y * -0.5f;
45601 if (velocity.Y > 0f && velocity.Y < 1f)
45602 {
45603 velocity.Y = 1f;
45604 }
45605 if (velocity.Y < 0f && velocity.Y > -1f)
45606 {
45607 velocity.Y = -1f;
45608 }
45609 }
45610 }
45612 {
45613 EncourageDespawn(10);
45614 directionY = -1;
45615 if (velocity.Y > 0f)
45616 {
45617 direction = 1;
45618 }
45619 direction = -1;
45620 if (velocity.X > 0f)
45621 {
45622 direction = 1;
45623 }
45624 }
45625 else
45626 {
45627 TargetClosest();
45628 }
45629 if (type == 170 || type == 171 || type == 180)
45630 {
45631 if (Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
45632 {
45633 if (ai[1] > 0f && !Collision.SolidCollision(position, width, height))
45634 {
45635 ai[1] = 0f;
45636 ai[0] = 0f;
45637 netUpdate = true;
45638 }
45639 }
45640 else if (ai[1] == 0f)
45641 {
45642 ai[0] += 1f;
45643 }
45644 if (ai[0] >= 300f)
45645 {
45646 ai[1] = 1f;
45647 ai[0] = 0f;
45648 netUpdate = true;
45649 }
45650 if (ai[1] == 0f)
45651 {
45652 alpha = 0;
45653 noTileCollide = false;
45654 }
45655 else
45656 {
45657 wet = false;
45658 alpha = 200;
45659 noTileCollide = true;
45660 }
45661 rotation = velocity.Y * 0.1f * (float)direction;
45662 TargetClosest();
45663 if (direction == -1 && velocity.X > -4f && position.X > Main.player[target].position.X + (float)Main.player[target].width)
45664 {
45665 velocity.X -= 0.08f;
45666 if (velocity.X > 4f)
45667 {
45668 velocity.X -= 0.04f;
45669 }
45670 else if (velocity.X > 0f)
45671 {
45672 velocity.X -= 0.2f;
45673 }
45674 if (velocity.X < -4f)
45675 {
45676 velocity.X = -4f;
45677 }
45678 }
45679 else if (direction == 1 && velocity.X < 4f && position.X + (float)width < Main.player[target].position.X)
45680 {
45681 velocity.X += 0.08f;
45682 if (velocity.X < -4f)
45683 {
45684 velocity.X += 0.04f;
45685 }
45686 else if (velocity.X < 0f)
45687 {
45688 velocity.X += 0.2f;
45689 }
45690 if (velocity.X > 4f)
45691 {
45692 velocity.X = 4f;
45693 }
45694 }
45695 if (directionY == -1 && (double)velocity.Y > -2.5 && position.Y > Main.player[target].position.Y + (float)Main.player[target].height)
45696 {
45697 velocity.Y -= 0.1f;
45698 if ((double)velocity.Y > 2.5)
45699 {
45700 velocity.Y -= 0.05f;
45701 }
45702 else if (velocity.Y > 0f)
45703 {
45704 velocity.Y -= 0.15f;
45705 }
45706 if ((double)velocity.Y < -2.5)
45707 {
45708 velocity.Y = -2.5f;
45709 }
45710 }
45711 else if (directionY == 1 && (double)velocity.Y < 2.5 && position.Y + (float)height < Main.player[target].position.Y)
45712 {
45713 velocity.Y += 0.1f;
45714 if ((double)velocity.Y < -2.5)
45715 {
45716 velocity.Y += 0.05f;
45717 }
45718 else if (velocity.Y < 0f)
45719 {
45720 velocity.Y += 0.15f;
45721 }
45722 if ((double)velocity.Y > 2.5)
45723 {
45724 velocity.Y = 2.5f;
45725 }
45726 }
45727 }
45728 else if (type == 116)
45729 {
45730 TargetClosest();
45731 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.3f, 0.2f, 0.1f);
45732 if (direction == -1 && velocity.X > -6f)
45733 {
45734 velocity.X -= 0.1f;
45735 if (velocity.X > 6f)
45736 {
45737 velocity.X -= 0.1f;
45738 }
45739 else if (velocity.X > 0f)
45740 {
45741 velocity.X -= 0.2f;
45742 }
45743 if (velocity.X < -6f)
45744 {
45745 velocity.X = -6f;
45746 }
45747 }
45748 else if (direction == 1 && velocity.X < 6f)
45749 {
45750 velocity.X += 0.1f;
45751 if (velocity.X < -6f)
45752 {
45753 velocity.X += 0.1f;
45754 }
45755 else if (velocity.X < 0f)
45756 {
45757 velocity.X += 0.2f;
45758 }
45759 if (velocity.X > 6f)
45760 {
45761 velocity.X = 6f;
45762 }
45763 }
45764 if (directionY == -1 && (double)velocity.Y > -2.5)
45765 {
45766 velocity.Y -= 0.04f;
45767 if ((double)velocity.Y > 2.5)
45768 {
45769 velocity.Y -= 0.05f;
45770 }
45771 else if (velocity.Y > 0f)
45772 {
45773 velocity.Y -= 0.15f;
45774 }
45775 if ((double)velocity.Y < -2.5)
45776 {
45777 velocity.Y = -2.5f;
45778 }
45779 }
45780 else if (directionY == 1 && (double)velocity.Y < 1.5)
45781 {
45782 velocity.Y += 0.04f;
45783 if ((double)velocity.Y < -2.5)
45784 {
45785 velocity.Y += 0.05f;
45786 }
45787 else if (velocity.Y < 0f)
45788 {
45789 velocity.Y += 0.15f;
45790 }
45791 if ((double)velocity.Y > 2.5)
45792 {
45793 velocity.Y = 2.5f;
45794 }
45795 }
45796 if (Main.rand.Next(40) == 0)
45797 {
45799 int num = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
45800 Main.dust[num].velocity.X *= 0.5f;
45801 Main.dust[num].velocity.Y *= 0.1f;
45803 }
45804 }
45805 else if (type == 133)
45806 {
45807 if ((double)life < (double)lifeMax * 0.5)
45808 {
45809 if (direction == -1 && velocity.X > -6f)
45810 {
45811 velocity.X -= 0.1f;
45812 if (velocity.X > 6f)
45813 {
45814 velocity.X -= 0.1f;
45815 }
45816 else if (velocity.X > 0f)
45817 {
45818 velocity.X += 0.05f;
45819 }
45820 if (velocity.X < -6f)
45821 {
45822 velocity.X = -6f;
45823 }
45824 }
45825 else if (direction == 1 && velocity.X < 6f)
45826 {
45827 velocity.X += 0.1f;
45828 if (velocity.X < -6f)
45829 {
45830 velocity.X += 0.1f;
45831 }
45832 else if (velocity.X < 0f)
45833 {
45834 velocity.X -= 0.05f;
45835 }
45836 if (velocity.X > 6f)
45837 {
45838 velocity.X = 6f;
45839 }
45840 }
45841 if (directionY == -1 && velocity.Y > -4f)
45842 {
45843 velocity.Y -= 0.1f;
45844 if (velocity.Y > 4f)
45845 {
45846 velocity.Y -= 0.1f;
45847 }
45848 else if (velocity.Y > 0f)
45849 {
45850 velocity.Y += 0.05f;
45851 }
45852 if (velocity.Y < -4f)
45853 {
45854 velocity.Y = -4f;
45855 }
45856 }
45857 else if (directionY == 1 && velocity.Y < 4f)
45858 {
45859 velocity.Y += 0.1f;
45860 if (velocity.Y < -4f)
45861 {
45862 velocity.Y += 0.1f;
45863 }
45864 else if (velocity.Y < 0f)
45865 {
45866 velocity.Y -= 0.05f;
45867 }
45868 if (velocity.Y > 4f)
45869 {
45870 velocity.Y = 4f;
45871 }
45872 }
45873 }
45874 else
45875 {
45876 if (direction == -1 && velocity.X > -4f)
45877 {
45878 velocity.X -= 0.1f;
45879 if (velocity.X > 4f)
45880 {
45881 velocity.X -= 0.1f;
45882 }
45883 else if (velocity.X > 0f)
45884 {
45885 velocity.X += 0.05f;
45886 }
45887 if (velocity.X < -4f)
45888 {
45889 velocity.X = -4f;
45890 }
45891 }
45892 else if (direction == 1 && velocity.X < 4f)
45893 {
45894 velocity.X += 0.1f;
45895 if (velocity.X < -4f)
45896 {
45897 velocity.X += 0.1f;
45898 }
45899 else if (velocity.X < 0f)
45900 {
45901 velocity.X -= 0.05f;
45902 }
45903 if (velocity.X > 4f)
45904 {
45905 velocity.X = 4f;
45906 }
45907 }
45908 if (directionY == -1 && (double)velocity.Y > -1.5)
45909 {
45910 velocity.Y -= 0.04f;
45911 if ((double)velocity.Y > 1.5)
45912 {
45913 velocity.Y -= 0.05f;
45914 }
45915 else if (velocity.Y > 0f)
45916 {
45917 velocity.Y += 0.03f;
45918 }
45919 if ((double)velocity.Y < -1.5)
45920 {
45921 velocity.Y = -1.5f;
45922 }
45923 }
45924 else if (directionY == 1 && (double)velocity.Y < 1.5)
45925 {
45926 velocity.Y += 0.04f;
45927 if ((double)velocity.Y < -1.5)
45928 {
45929 velocity.Y += 0.05f;
45930 }
45931 else if (velocity.Y < 0f)
45932 {
45933 velocity.Y -= 0.03f;
45934 }
45935 if ((double)velocity.Y > 1.5)
45936 {
45937 velocity.Y = 1.5f;
45938 }
45939 }
45940 }
45941 }
45942 else
45943 {
45944 float num2 = 4f;
45945 float num3 = 1.5f;
45946 num2 *= 1f + (1f - scale);
45947 num3 *= 1f + (1f - scale);
45948 if (direction == -1 && velocity.X > 0f - num2)
45949 {
45950 velocity.X -= 0.1f;
45951 if (velocity.X > num2)
45952 {
45953 velocity.X -= 0.1f;
45954 }
45955 else if (velocity.X > 0f)
45956 {
45957 velocity.X += 0.05f;
45958 }
45959 if (velocity.X < 0f - num2)
45960 {
45961 velocity.X = 0f - num2;
45962 }
45963 }
45964 else if (direction == 1 && velocity.X < num2)
45965 {
45966 velocity.X += 0.1f;
45967 if (velocity.X < 0f - num2)
45968 {
45969 velocity.X += 0.1f;
45970 }
45971 else if (velocity.X < 0f)
45972 {
45973 velocity.X -= 0.05f;
45974 }
45975 if (velocity.X > num2)
45976 {
45977 velocity.X = num2;
45978 }
45979 }
45980 if (directionY == -1 && velocity.Y > 0f - num3)
45981 {
45982 velocity.Y -= 0.04f;
45983 if (velocity.Y > num3)
45984 {
45985 velocity.Y -= 0.05f;
45986 }
45987 else if (velocity.Y > 0f)
45988 {
45989 velocity.Y += 0.03f;
45990 }
45991 if (velocity.Y < 0f - num3)
45992 {
45993 velocity.Y = 0f - num3;
45994 }
45995 }
45996 else if (directionY == 1 && velocity.Y < num3)
45997 {
45998 velocity.Y += 0.04f;
45999 if (velocity.Y < 0f - num3)
46000 {
46001 velocity.Y += 0.05f;
46002 }
46003 else if (velocity.Y < 0f)
46004 {
46005 velocity.Y -= 0.03f;
46006 }
46007 if (velocity.Y > num3)
46008 {
46009 velocity.Y = num3;
46010 }
46011 }
46012 }
46013 if ((type == 2 || type == 133 || type == 190 || type == 191 || type == 192 || type == 193 || type == 194) && Main.rand.Next(40) == 0)
46014 {
46016 int num4 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height * 0.25f), width, (int)((float)height * 0.5f), 5, velocity.X, 2f);
46017 Main.dust[num4].velocity.X *= 0.5f;
46018 Main.dust[num4].velocity.Y *= 0.1f;
46020 }
46021 if (wet && type != 170 && type != 171 && type != 172)
46022 {
46023 if (velocity.Y > 0f)
46024 {
46025 velocity.Y *= 0.95f;
46026 }
46027 velocity.Y -= 0.5f;
46028 if (velocity.Y < -4f)
46029 {
46030 velocity.Y = -4f;
46031 }
46032 TargetClosest();
46033 }
46034 }
46035
46036 private void StingerExplosion()
46037 {
46038 int num = Main.rand.Next(4, 9);
46039 for (int i = 0; i < num; i++)
46040 {
46041 float num2 = 8f;
46042 Vector2 vector = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() - 0.5f);
46043 vector.Normalize();
46044 vector *= num2;
46045 int num3 = (int)(10f * scale);
46046 if (type == 176)
46047 {
46048 num3 = (int)(30f * scale);
46049 }
46050 int num4 = 55;
46052 Main.projectile[num5].timeLeft = 300;
46053 }
46054 }
46055
46057 {
46058 if (!Main.player[target].ZoneGraveyard && Main.IsItDay() && (double)npcPosition.Y <= Main.worldSurface * 16.0)
46059 {
46060 if (npcID != 2 && npcID != 133 && npcID != 190 && npcID != 191 && npcID != 192 && npcID != 193 && npcID != 194 && npcID != 317)
46061 {
46062 return npcID == 318;
46063 }
46064 return true;
46065 }
46066 return false;
46067 }
46068
46070 {
46071 if (!Main.dayTime && ai[0] == 5f)
46072 {
46073 if (Math.Abs(tileX - idealRestX) <= 7)
46074 {
46075 return Math.Abs(tileY - idealRestY) <= 7;
46076 }
46077 return false;
46078 }
46079 if ((type == 361 || type == 445 || type == 687) && wet)
46080 {
46081 return false;
46082 }
46083 if (tileX == idealRestX)
46084 {
46085 return tileY == idealRestY;
46086 }
46087 return false;
46088 }
46089
46091 {
46092 floorX = homeTileX;
46093 floorY = homeTileY;
46094 if (floorX == -1 || floorY == -1)
46095 {
46096 return;
46097 }
46099 {
46100 floorY++;
46101 }
46102 if (Main.dayTime || (ai[0] == 5f && Math.Abs(myTileX - floorX) < 7 && Math.Abs(myTileY - floorY) < 7))
46103 {
46104 return;
46105 }
46106 Point point = new Point(floorX, floorY);
46107 Point point2 = new Point(-1, -1);
46108 int num = -1;
46109 if (type == 638 || type == 656 || NPCID.Sets.IsTownSlime[type] || ai[0] == 5f)
46110 {
46111 return;
46112 }
46113 int num2 = 7;
46114 int num3 = 6;
46115 int num4 = 2;
46116 int num5 = 1;
46117 int num6 = 2;
46118 for (int i = point.X - num2; i <= point.X + num2; i += num5)
46119 {
46120 for (int num7 = point.Y + num4; num7 >= point.Y - num3; num7 -= num6)
46121 {
46122 Tile tile = Main.tile[i, num7];
46123 if (tile != null && tile.active() && TileID.Sets.CanBeSatOnForNPCs[tile.type] && (tile.frameY % 40 != 0 || num7 + 1 <= point.Y + num4))
46124 {
46125 int num8 = Math.Abs(i - point.X) + Math.Abs(num7 - point.Y);
46126 if (num == -1 || num8 < num)
46127 {
46128 num = num8;
46129 point2.X = i;
46130 point2.Y = num7;
46131 }
46132 }
46133 }
46134 }
46135 if (num == -1)
46136 {
46137 return;
46138 }
46139 Tile tile2 = Main.tile[point2.X, point2.Y];
46140 if (tile2.type == 497 || tile2.type == 15)
46141 {
46142 if (tile2.frameY % 40 != 0)
46143 {
46144 point2.Y--;
46145 }
46146 point2.Y += 2;
46147 }
46148 for (int j = 0; j < 200; j++)
46149 {
46150 if (Main.npc[j].active && Main.npc[j].aiStyle == 7 && Main.npc[j].townNPC && Main.npc[j].ai[0] == 5f && (Main.npc[j].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == point2)
46151 {
46152 return;
46153 }
46154 }
46155 floorX = point2.X;
46156 floorY = point2.Y;
46157 }
46158
46160 {
46161 Tile tile = Main.tile[homeFloorX, homeFloorY - 1];
46162 bool flag = type != 638 && type != 656 && !NPCID.Sets.IsTownSlime[type] && ai[0] != 5f;
46163 if (flag)
46164 {
46165 flag &= tile != null && tile.active() && (tile.type == 15 || tile.type == 497);
46166 }
46167 if (flag)
46168 {
46169 flag &= tile.type != 15 || tile.frameY < 1080 || tile.frameY > 1098;
46170 }
46171 if (flag)
46172 {
46173 Point point = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
46174 for (int i = 0; i < 200; i++)
46175 {
46176 if (Main.npc[i].active && Main.npc[i].aiStyle == 7 && Main.npc[i].townNPC && Main.npc[i].ai[0] == 5f && (Main.npc[i].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == point)
46177 {
46178 flag = false;
46179 break;
46180 }
46181 }
46182 }
46183 if (flag)
46184 {
46185 ai[0] = 5f;
46186 ai[1] = 900 + Main.rand.Next(10800);
46187 direction = ((tile.frameX != 0) ? 1 : (-1));
46188 base.Bottom = new Vector2(homeFloorX * 16 + 8 + 2 * direction, homeFloorY * 16);
46190 localAI[3] = 0f;
46191 netUpdate = true;
46192 }
46193 }
46194
46195 public void UpdateHomeTileState(bool homeless, int x, int y)
46196 {
46197 bool num = x != homeTileX || y != homeTileY || this.homeless != homeless;
46198 this.homeless = homeless;
46199 homeTileX = x;
46200 homeTileY = y;
46201 if (num && Main.netMode != 1)
46202 {
46203 byte householdStatus = WorldGen.TownManager.GetHouseholdStatus(this);
46204 NetMessage.SendData(60, -1, -1, null, whoAmI, homeTileX, homeTileY, (int)householdStatus);
46205 }
46206 }
46207
46209 {
46211 if (type == 160 && townNpcVariationIndex == 1)
46212 {
46213 result = new Color(result.B, result.G, result.R, result.A);
46214 }
46215 if (type == 20 && townNpcVariationIndex == 1)
46216 {
46217 result = new Color(90, 20, 210, result.A);
46218 }
46219 if (type == 663 && townNpcVariationIndex == 1)
46220 {
46221 result = new Color(255, 0, 77, result.A);
46222 }
46223 return result;
46224 }
46225
46226 private void AI_007_TownEntities()
46227 {
46229 if (type == 441 && GivenName == "Andrew")
46230 {
46231 defDefense = 200;
46232 }
46233 int num = 300;
46234 if (type == 638 || type == 656 || NPCID.Sets.IsTownSlime[type])
46235 {
46236 num = 0;
46237 }
46238 bool flag = Main.raining;
46239 if (!Main.dayTime)
46240 {
46241 flag = true;
46242 }
46243 if (Main.eclipse)
46244 {
46245 flag = true;
46246 }
46247 if (Main.slimeRain)
46248 {
46249 flag = true;
46250 }
46251 float num2 = 1f;
46252 if (Main.masterMode)
46253 {
46254 defense = (dryadWard ? (defDefense + 14) : defDefense);
46255 }
46256 else if (Main.expertMode)
46257 {
46258 defense = (dryadWard ? (defDefense + 10) : defDefense);
46259 }
46260 else
46261 {
46262 defense = (dryadWard ? (defDefense + 6) : defDefense);
46263 }
46264 if (isLikeATownNPC)
46265 {
46267 {
46268 num2 += 0.2f;
46269 defense += 6;
46270 }
46272 {
46273 num2 += 0.2f;
46274 defense += 6;
46275 }
46276 if (downedBoss1)
46277 {
46278 num2 += 0.1f;
46279 defense += 3;
46280 }
46281 if (downedBoss2)
46282 {
46283 num2 += 0.1f;
46284 defense += 3;
46285 }
46286 if (downedBoss3)
46287 {
46288 num2 += 0.1f;
46289 defense += 3;
46290 }
46291 if (downedQueenBee)
46292 {
46293 num2 += 0.1f;
46294 defense += 3;
46295 }
46296 if (Main.hardMode)
46297 {
46298 num2 += 0.4f;
46299 defense += 12;
46300 }
46301 if (downedQueenSlime)
46302 {
46303 num2 += 0.15f;
46304 defense += 6;
46305 }
46306 if (downedMechBoss1)
46307 {
46308 num2 += 0.15f;
46309 defense += 6;
46310 }
46311 if (downedMechBoss2)
46312 {
46313 num2 += 0.15f;
46314 defense += 6;
46315 }
46316 if (downedMechBoss3)
46317 {
46318 num2 += 0.15f;
46319 defense += 6;
46320 }
46321 if (downedPlantBoss)
46322 {
46323 num2 += 0.15f;
46324 defense += 8;
46325 }
46327 {
46328 num2 += 0.15f;
46329 defense += 8;
46330 }
46331 if (downedGolemBoss)
46332 {
46333 num2 += 0.15f;
46334 defense += 8;
46335 }
46337 {
46338 num2 += 0.15f;
46339 defense += 8;
46340 }
46341 }
46342 if (type == 142 && Main.netMode != 1 && !Main.xMas)
46343 {
46344 StrikeNPCNoInteraction(9999, 0f, 0);
46345 if (Main.netMode == 2)
46346 {
46347 NetMessage.SendData(28, -1, -1, null, whoAmI, 9999f);
46348 }
46349 }
46350 if ((type == 148 || type == 149) && localAI[0] == 0f)
46351 {
46352 localAI[0] = Main.rand.Next(1, 5);
46353 }
46354 if (type == 124)
46355 {
46357 bool flag2 = false;
46358 if (Main.projectile.IndexInRange(num3))
46359 {
46360 Projectile projectile = Main.projectile[num3];
46361 if (projectile.active && projectile.type == 582 && projectile.ai[1] == (float)whoAmI)
46362 {
46363 flag2 = true;
46364 }
46365 }
46366 localAI[0] = flag2.ToInt();
46367 }
46368 if ((type == 362 || type == 364 || type == 602 || type == 608) && Main.netMode != 1 && (velocity.Y > 4f || velocity.Y < -4f || wet))
46369 {
46370 int num4 = direction;
46371 Transform(type + 1);
46372 TargetClosest();
46373 direction = num4;
46374 netUpdate = true;
46375 return;
46376 }
46377 switch (type)
46378 {
46379 case 588:
46380 savedGolfer = true;
46381 break;
46382 case 441:
46383 savedTaxCollector = true;
46384 break;
46385 case 107:
46386 savedGoblin = true;
46387 break;
46388 case 108:
46389 savedWizard = true;
46390 break;
46391 case 124:
46392 savedMech = true;
46393 break;
46394 case 353:
46395 savedStylist = true;
46396 break;
46397 case 369:
46398 savedAngler = true;
46399 break;
46400 case 550:
46401 savedBartender = true;
46402 break;
46403 }
46404 dontTakeDamage = false;
46405 if (ai[0] == 25f)
46406 {
46407 dontTakeDamage = true;
46408 if (ai[1] == 0f)
46409 {
46410 velocity.X = 0f;
46411 }
46412 shimmerWet = false;
46413 wet = false;
46414 lavaWet = false;
46415 honeyWet = false;
46416 if (ai[1] == 0f && Main.netMode == 1)
46417 {
46418 return;
46419 }
46420 if (ai[1] == 0f && ai[2] < 1f)
46421 {
46423 }
46424 if (ai[2] > 0f)
46425 {
46426 ai[2] -= 1f;
46427 if (ai[2] <= 0f)
46428 {
46429 ai[1] = 1f;
46430 }
46431 return;
46432 }
46433 ai[1] += 1f;
46434 if (ai[1] >= 30f)
46435 {
46437 {
46439 }
46440 else
46441 {
46442 ai[1] = 30f;
46443 }
46444 velocity = new Vector2(0f, -4f * shimmerTransparency);
46445 }
46446 Rectangle hitbox = base.Hitbox;
46447 hitbox.Y += 20;
46448 hitbox.Height -= 20;
46449 float num5 = Main.rand.NextFloatDirection();
46450 Lighting.AddLight(base.Center, Main.hslToRgb((float)Main.timeForVisualEffects / 360f % 1f, 0.6f, 0.65f).ToVector3() * Utils.Remap(ai[1], 30f, 90f, 0f, 0.7f));
46451 if (Main.rand.NextFloat() > Utils.Remap(ai[1], 30f, 60f, 1f, 0.5f))
46452 {
46453 Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(hitbox) + Main.rand.NextVector2Circular(8f, 0f) + new Vector2(0f, 4f), 309, new Vector2(0f, -2f).RotatedBy(num5 * ((float)Math.PI * 2f) * 0.11f), 0, default(Color), 1.7f - Math.Abs(num5) * 1.3f);
46454 }
46455 if (ai[1] > 60f && Main.rand.Next(15) == 0)
46456 {
46457 for (int i = 0; i < 3; i++)
46458 {
46459 Vector2 vector = Main.rand.NextVector2FromRectangle(base.Hitbox);
46461 {
46462 PositionInWorld = vector,
46463 MovementVector = DirectionTo(vector).RotatedBy((float)Math.PI * 9f / 20f * (float)(Main.rand.Next(2) * 2 - 1)) * Main.rand.NextFloat()
46464 });
46465 }
46466 }
46467 TargetClosest();
46469 if (ai[1] >= 75f && shimmerTransparency <= 0f && Main.netMode != 1)
46470 {
46471 ai[0] = 0f;
46472 ai[1] = 0f;
46473 ai[2] = 0f;
46474 ai[3] = 0f;
46475 Math.Sign(targetData.Center.X - base.Center.X);
46476 velocity = new Vector2(0f, -4f);
46477 localAI[0] = 0f;
46478 localAI[1] = 0f;
46479 localAI[2] = 0f;
46480 localAI[3] = 0f;
46481 netUpdate = true;
46483 NetMessage.SendData(56, -1, -1, null, whoAmI);
46484 Teleport(position, 12);
46486 {
46487 PositionInWorld = base.Center
46488 });
46489 }
46490 return;
46491 }
46492 if (type >= 0 && type < NPCID.Count && NPCID.Sets.TownCritter[type] && target == 255)
46493 {
46494 TargetClosest();
46495 if (position.X < Main.player[target].position.X)
46496 {
46497 direction = 1;
46499 }
46500 if (position.X > Main.player[target].position.X)
46501 {
46502 direction = -1;
46504 }
46505 if (homeTileX == -1)
46506 {
46507 UpdateHomeTileState(homeless, (int)((position.X + (float)(width / 2)) / 16f), homeTileY);
46508 }
46509 }
46510 else if (homeTileX == -1 && homeTileY == -1 && velocity.Y == 0f && !shimmering)
46511 {
46512 UpdateHomeTileState(homeless, (int)base.Center.X / 16, (int)(position.Y + (float)height + 4f) / 16);
46513 }
46514 bool flag3 = false;
46515 int num6 = (int)(position.X + (float)(width / 2)) / 16;
46516 int num7 = (int)(position.Y + (float)height + 1f) / 16;
46518 if (type == 441)
46519 {
46520 taxCollector = true;
46521 }
46522 directionY = -1;
46523 if (direction == 0)
46524 {
46525 direction = 1;
46526 }
46527 if (ai[0] != 24f)
46528 {
46529 for (int j = 0; j < 255; j++)
46530 {
46531 if (Main.player[j].active && Main.player[j].talkNPC == whoAmI)
46532 {
46533 flag3 = true;
46534 if (ai[0] != 0f)
46535 {
46536 netUpdate = true;
46537 }
46538 ai[0] = 0f;
46539 ai[1] = 300f;
46540 localAI[3] = 100f;
46541 if (Main.player[j].position.X + (float)(Main.player[j].width / 2) < position.X + (float)(width / 2))
46542 {
46543 direction = -1;
46544 }
46545 else
46546 {
46547 direction = 1;
46548 }
46549 }
46550 }
46551 }
46552 if (ai[3] == 1f)
46553 {
46554 life = -1;
46555 HitEffect();
46556 active = false;
46557 netUpdate = true;
46558 if (type == 37)
46559 {
46560 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
46561 }
46562 return;
46563 }
46564 if (type == 37 && Main.netMode != 1)
46565 {
46567 if (downedBoss3)
46568 {
46569 ai[3] = 1f;
46570 netUpdate = true;
46571 }
46572 }
46573 if (type == 368)
46574 {
46575 homeless = true;
46576 if (!Main.dayTime)
46577 {
46578 if (!shimmering)
46579 {
46580 UpdateHomeTileState(homeless, (int)(base.Center.X / 16f), (int)(position.Y + (float)height + 2f) / 16);
46581 }
46582 if (!flag3 && ai[0] == 0f)
46583 {
46584 ai[0] = 1f;
46585 ai[1] = 200f;
46586 }
46587 flag = false;
46588 }
46589 }
46590 if (type == 369 && homeless && wet)
46591 {
46592 if (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380))
46593 {
46595 ai[0] = 1f;
46596 ai[1] = 200f;
46597 }
46598 if (position.X / 16f < 300f)
46599 {
46600 direction = 1;
46601 }
46602 else if (position.X / 16f > (float)(Main.maxTilesX - 300))
46603 {
46604 direction = -1;
46605 }
46606 }
46607 if (!WorldGen.InWorld(num6, num7) || Main.tile[num6, num7] == null)
46608 {
46609 return;
46610 }
46612 {
46613 bool flag4 = true;
46614 for (int k = 0; k < 2; k++)
46615 {
46616 if (!flag4)
46617 {
46618 break;
46619 }
46620 Rectangle rectangle = new Rectangle((int)(position.X + (float)(width / 2) - (float)(sWidth / 2) - (float)safeRangeX), (int)(position.Y + (float)(height / 2) - (float)(sHeight / 2) - (float)safeRangeY), sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
46621 if (k == 1)
46622 {
46623 rectangle = new Rectangle(floorX * 16 + 8 - sWidth / 2 - safeRangeX, floorY * 16 + 8 - sHeight / 2 - safeRangeY, sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
46624 }
46625 for (int l = 0; l < 255; l++)
46626 {
46627 if (Main.player[l].active && new Rectangle((int)Main.player[l].position.X, (int)Main.player[l].position.Y, Main.player[l].width, Main.player[l].height).Intersects(rectangle))
46628 {
46629 flag4 = false;
46630 break;
46631 }
46632 }
46633 }
46634 if (flag4)
46635 {
46637 }
46638 }
46639 bool flag5 = type == 300 || type == 447 || type == 610;
46640 bool flag6 = type == 616 || type == 617 || type == 625;
46641 bool flag7 = type == 361 || type == 445 || type == 687;
46644 bool flag9 = flag6 || flag7;
46645 bool flag10 = flag6 || flag7;
46646 bool flag11 = flag8;
46647 bool flag12 = flag8;
46648 float num8 = 200f;
46649 if (NPCID.Sets.DangerDetectRange[type] != -1)
46650 {
46652 }
46653 bool flag13 = false;
46654 bool flag14 = false;
46655 float num9 = -1f;
46656 float num10 = -1f;
46657 int num11 = 0;
46658 int num12 = -1;
46659 int num13 = -1;
46660 if (!flag6 && Main.netMode != 1 && !flag3)
46661 {
46662 for (int m = 0; m < 200; m++)
46663 {
46664 if (!Main.npc[m].active || Main.npc[m].friendly || Main.npc[m].damage <= 0 || !(Main.npc[m].Distance(base.Center) < num8) || (type == 453 && NPCID.Sets.Skeletons[Main.npc[m].type]) || (!Main.npc[m].noTileCollide && !Collision.CanHit(base.Center, 0, 0, Main.npc[m].Center, 0, 0)))
46665 {
46666 continue;
46667 }
46668 bool flag15 = Main.npc[m].CanBeChasedBy(this);
46669 flag13 = true;
46670 float num14 = Main.npc[m].Center.X - base.Center.X;
46671 if (type == 614)
46672 {
46673 if (num14 < 0f && (num9 == -1f || num14 > num9))
46674 {
46675 num10 = num14;
46676 num13 = m;
46677 }
46678 if (num14 > 0f && (num10 == -1f || num14 < num10))
46679 {
46680 num9 = num14;
46681 num12 = m;
46682 }
46683 continue;
46684 }
46685 if (num14 < 0f && (num9 == -1f || num14 > num9))
46686 {
46687 num9 = num14;
46688 if (flag15)
46689 {
46690 num12 = m;
46691 }
46692 }
46693 if (num14 > 0f && (num10 == -1f || num14 < num10))
46694 {
46695 num10 = num14;
46696 if (flag15)
46697 {
46698 num13 = m;
46699 }
46700 }
46701 }
46702 if (flag13)
46703 {
46704 num11 = ((num9 == -1f) ? 1 : ((num10 != -1f) ? (num10 < 0f - num9).ToDirectionInt() : (-1)));
46705 float num15 = 0f;
46706 if (num9 != -1f)
46707 {
46708 num15 = 0f - num9;
46709 }
46710 if (num15 == 0f || (num10 < num15 && num10 > 0f))
46711 {
46712 num15 = num10;
46713 }
46714 if (ai[0] == 8f)
46715 {
46716 if (direction == -num11)
46717 {
46718 ai[0] = 1f;
46719 ai[1] = 300 + Main.rand.Next(300);
46720 ai[2] = 0f;
46721 localAI[3] = 0f;
46722 netUpdate = true;
46723 }
46724 }
46725 else if (ai[0] != 10f && ai[0] != 12f && ai[0] != 13f && ai[0] != 14f && ai[0] != 15f)
46726 {
46727 if (NPCID.Sets.PrettySafe[type] != -1 && (float)NPCID.Sets.PrettySafe[type] < num15)
46728 {
46729 flag13 = false;
46731 }
46732 else if (ai[0] != 1f)
46733 {
46734 int tileX = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
46735 int tileY = (int)((position.Y + (float)height - 16f) / 16f);
46736 bool currentlyDrowning = wet && !flag9;
46738 if (!avoidFalling)
46739 {
46740 if (ai[0] == 3f || ai[0] == 4f || ai[0] == 16f || ai[0] == 17f)
46741 {
46742 NPC nPC = Main.npc[(int)ai[2]];
46743 if (nPC.active)
46744 {
46745 nPC.ai[0] = 1f;
46746 nPC.ai[1] = 120 + Main.rand.Next(120);
46747 nPC.ai[2] = 0f;
46748 nPC.localAI[3] = 0f;
46749 nPC.direction = -num11;
46750 nPC.netUpdate = true;
46751 }
46752 }
46753 ai[0] = 1f;
46754 ai[1] = 120 + Main.rand.Next(120);
46755 ai[2] = 0f;
46756 localAI[3] = 0f;
46757 direction = -num11;
46758 netUpdate = true;
46759 }
46760 }
46761 else if (ai[0] == 1f && direction != -num11)
46762 {
46763 direction = -num11;
46764 netUpdate = true;
46765 }
46766 }
46767 }
46768 }
46769 if (ai[0] == 0f)
46770 {
46771 if (localAI[3] > 0f)
46772 {
46773 localAI[3] -= 1f;
46774 }
46775 int num16 = 120;
46776 if (type == 638)
46777 {
46778 num16 = 60;
46779 }
46780 if ((flag7 || flag8) && wet)
46781 {
46782 ai[0] = 1f;
46783 ai[1] = 200 + Main.rand.Next(500, 700);
46784 ai[2] = 0f;
46785 localAI[3] = 0f;
46786 netUpdate = true;
46787 }
46788 else if (flag && !flag3 && !NPCID.Sets.TownCritter[type])
46789 {
46790 if (Main.netMode != 1)
46791 {
46792 if (num6 == floorX && num7 == floorY)
46793 {
46794 if (velocity.X != 0f)
46795 {
46796 netUpdate = true;
46797 }
46798 if (velocity.X > 0.1f)
46799 {
46800 velocity.X -= 0.1f;
46801 }
46802 else if (velocity.X < -0.1f)
46803 {
46804 velocity.X += 0.1f;
46805 }
46806 else
46807 {
46808 velocity.X = 0f;
46810 }
46811 if (NPCID.Sets.IsTownPet[type])
46812 {
46814 }
46815 }
46816 else
46817 {
46818 if (num6 > floorX)
46819 {
46820 direction = -1;
46821 }
46822 else
46823 {
46824 direction = 1;
46825 }
46826 ai[0] = 1f;
46827 ai[1] = 200 + Main.rand.Next(200);
46828 ai[2] = 0f;
46829 localAI[3] = 0f;
46830 netUpdate = true;
46831 }
46832 }
46833 }
46834 else
46835 {
46836 if (flag5)
46837 {
46838 velocity.X *= 0.5f;
46839 }
46840 if (velocity.X > 0.1f)
46841 {
46842 velocity.X -= 0.1f;
46843 }
46844 else if (velocity.X < -0.1f)
46845 {
46846 velocity.X += 0.1f;
46847 }
46848 else
46849 {
46850 velocity.X = 0f;
46851 }
46852 if (Main.netMode != 1)
46853 {
46854 if (!flag3 && NPCID.Sets.IsTownPet[type] && ai[1] >= 100f && ai[1] <= 150f)
46855 {
46857 }
46858 if (ai[1] > 0f)
46859 {
46860 ai[1] -= 1f;
46861 }
46862 bool flag16 = true;
46863 int tileX2 = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
46864 int tileY2 = (int)((position.Y + (float)height - 16f) / 16f);
46865 bool currentlyDrowning2 = wet && !flag9;
46867 if (wet && !flag9)
46868 {
46871 {
46872 ai[0] = 1f;
46873 ai[1] = 200 + Main.rand.Next(300);
46874 ai[2] = 0f;
46876 {
46877 ai[1] += Main.rand.Next(200, 400);
46878 }
46879 localAI[3] = 0f;
46880 netUpdate = true;
46881 }
46882 }
46883 if (avoidFalling2)
46884 {
46885 flag16 = false;
46886 }
46887 if (ai[1] <= 0f)
46888 {
46889 if (flag16 && !avoidFalling2)
46890 {
46891 ai[0] = 1f;
46892 ai[1] = 200 + Main.rand.Next(300);
46893 ai[2] = 0f;
46895 {
46896 ai[1] += Main.rand.Next(200, 400);
46897 }
46898 localAI[3] = 0f;
46899 netUpdate = true;
46900 }
46901 else
46902 {
46903 direction *= -1;
46904 ai[1] = 60 + Main.rand.Next(120);
46905 netUpdate = true;
46906 }
46907 }
46908 }
46909 }
46911 {
46913 {
46914 if (localAI[3] == 0f)
46915 {
46916 if (num6 < floorX - 50 && direction == -1)
46917 {
46918 direction = 1;
46919 netUpdate = true;
46920 }
46921 else if (num6 > floorX + 50 && direction == 1)
46922 {
46923 direction = -1;
46924 netUpdate = true;
46925 }
46926 }
46927 }
46928 else if (Main.rand.Next(80) == 0 && localAI[3] == 0f)
46929 {
46930 localAI[3] = 200f;
46931 direction *= -1;
46932 netUpdate = true;
46933 }
46934 }
46935 }
46936 else if (ai[0] == 1f)
46937 {
46939 {
46940 ai[0] = 0f;
46941 ai[1] = 200 + Main.rand.Next(200);
46942 localAI[3] = 60f;
46943 netUpdate = true;
46944 }
46945 else
46946 {
46948 if (!flag17)
46949 {
46951 {
46952 if (position.X < (float)(floorX * 16) && direction == -1)
46953 {
46954 ai[1] -= 5f;
46955 }
46956 else if (position.X > (float)(floorX * 16) && direction == 1)
46957 {
46958 ai[1] -= 5f;
46959 }
46960 }
46961 ai[1] -= 1f;
46962 }
46963 if (ai[1] <= 0f)
46964 {
46965 ai[0] = 0f;
46966 ai[1] = 300 + Main.rand.Next(300);
46967 ai[2] = 0f;
46969 {
46970 ai[1] -= Main.rand.Next(100);
46971 }
46972 else
46973 {
46974 ai[1] += Main.rand.Next(900);
46975 }
46976 localAI[3] = 60f;
46977 netUpdate = true;
46978 }
46979 if (closeDoor && ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 2) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 2)))
46980 {
46982 if (tileSafely.type == 11)
46983 {
46985 {
46986 closeDoor = false;
46987 NetMessage.SendData(19, -1, -1, null, 1, doorX, doorY, direction);
46988 }
46989 if ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 4) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 4) || (position.Y + (float)(height / 2)) / 16f > (float)(doorY + 4) || (position.Y + (float)(height / 2)) / 16f < (float)(doorY - 4))
46990 {
46991 closeDoor = false;
46992 }
46993 }
46994 else if (tileSafely.type == 389)
46995 {
46997 {
46998 closeDoor = false;
46999 NetMessage.SendData(19, -1, -1, null, 5, doorX, doorY);
47000 }
47001 if ((position.X + (float)(width / 2)) / 16f > (float)(doorX + 4) || (position.X + (float)(width / 2)) / 16f < (float)(doorX - 4) || (position.Y + (float)(height / 2)) / 16f > (float)(doorY + 4) || (position.Y + (float)(height / 2)) / 16f < (float)(doorY - 4))
47002 {
47003 closeDoor = false;
47004 }
47005 }
47006 else
47007 {
47008 closeDoor = false;
47009 }
47010 }
47011 float num17 = 1f;
47012 float num18 = 0.07f;
47013 if (type == 614 && flag13)
47014 {
47015 num17 = 1.5f;
47016 num18 = 0.1f;
47017 }
47018 else if (type == 299 || type == 539 || type == 538 || (type >= 639 && type <= 645))
47019 {
47020 num17 = 1.5f;
47021 }
47022 else if (flag6)
47023 {
47024 if (wet)
47025 {
47026 num18 = 1f;
47027 num17 = 2f;
47028 }
47029 else
47030 {
47031 num18 = 0.07f;
47032 num17 = 0.5f;
47033 }
47034 }
47035 if (type == 625)
47036 {
47037 if (wet)
47038 {
47039 num18 = 1f;
47040 num17 = 2.5f;
47041 }
47042 else
47043 {
47044 num18 = 0.07f;
47045 num17 = 0.2f;
47046 }
47047 }
47048 if (flag5)
47049 {
47050 num17 = 2f;
47051 num18 = 1f;
47052 }
47053 if (friendly && (flag13 || flag17))
47054 {
47055 num17 = 1.5f;
47056 float num19 = 1f - (float)life / (float)lifeMax;
47057 num17 += num19 * 0.9f;
47058 num18 = 0.1f;
47059 }
47060 if (flag11 && wet)
47061 {
47062 num17 = 2f;
47063 num18 = 0.2f;
47064 }
47065 if (flag7 && wet)
47066 {
47067 if (Math.Abs(velocity.X) < 0.05f && Math.Abs(velocity.Y) < 0.05f)
47068 {
47069 velocity.X += num17 * 10f * (float)direction;
47070 }
47071 else
47072 {
47073 velocity.X *= 0.9f;
47074 }
47075 }
47076 else if (velocity.X < 0f - num17 || velocity.X > num17)
47077 {
47078 if (velocity.Y == 0f)
47079 {
47080 velocity *= 0.8f;
47081 }
47082 }
47083 else if (velocity.X < num17 && direction == 1)
47084 {
47085 velocity.X += num18;
47086 if (velocity.X > num17)
47087 {
47088 velocity.X = num17;
47089 }
47090 }
47091 else if (velocity.X > 0f - num17 && direction == -1)
47092 {
47093 velocity.X -= num18;
47094 if (velocity.X > num17)
47095 {
47096 velocity.X = num17;
47097 }
47098 }
47099 bool flag18 = true;
47100 if ((float)(homeTileY * 16 - 32) > position.Y)
47101 {
47102 flag18 = false;
47103 }
47104 if (!flag18 && velocity.Y == 0f)
47105 {
47107 }
47108 if (velocity.Y >= 0f)
47109 {
47111 }
47112 if (velocity.Y == 0f)
47113 {
47114 int num20 = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
47115 int num21 = (int)((position.Y + (float)height - 16f) / 16f);
47116 int num22 = 180;
47118 bool flag19 = false;
47119 bool flag20 = false;
47121 {
47122 avoidFalling3 = true;
47123 localAI[3] = num22;
47124 int num23 = 0;
47125 for (int n = 0; n <= 10 && Framing.GetTileSafely(num20 - direction, num21 - n).liquid != 0; n++)
47126 {
47127 num23++;
47128 }
47129 float num24 = 0.3f;
47130 float num25 = (float)Math.Sqrt((float)(num23 * 16 + 16) * 2f * num24);
47131 if (num25 > 26f)
47132 {
47133 num25 = 26f;
47134 }
47135 velocity.Y = 0f - num25;
47136 localAI[3] = position.X;
47137 flag19 = true;
47138 }
47139 if (avoidFalling3 && !flag19)
47140 {
47141 int num26 = (int)((position.X + (float)(width / 2)) / 16f);
47142 int num27 = 0;
47143 for (int num28 = -1; num28 <= 1; num28++)
47144 {
47146 if (tileSafely2.nactive() && Main.tileSolid[tileSafely2.type])
47147 {
47148 num27++;
47149 }
47150 }
47151 if (num27 <= 2)
47152 {
47153 if (velocity.X != 0f)
47154 {
47155 netUpdate = true;
47156 }
47157 keepwalking3 = (avoidFalling3 = false);
47158 ai[0] = 0f;
47159 ai[1] = 50 + Main.rand.Next(50);
47160 ai[2] = 0f;
47161 localAI[3] = 40f;
47162 }
47163 }
47164 if (position.X == localAI[3] && !flag19)
47165 {
47166 direction *= -1;
47167 netUpdate = true;
47168 localAI[3] = num22;
47169 }
47170 if (flag17 && !flag19)
47171 {
47172 if (localAI[3] > (float)num22)
47173 {
47174 localAI[3] = num22;
47175 }
47176 if (localAI[3] > 0f)
47177 {
47178 localAI[3] -= 1f;
47179 }
47180 }
47181 else
47182 {
47183 localAI[3] = -1f;
47184 }
47188 bool flag21 = height / 16 < 3;
47189 if (townNPC && tileSafely5.nactive() && (tileSafely5.type == 10 || tileSafely5.type == 388) && (Main.rand.Next(10) == 0 || flag))
47190 {
47191 if (Main.netMode != 1)
47192 {
47194 {
47195 closeDoor = true;
47196 doorX = num20;
47197 doorY = num21 - 2;
47198 NetMessage.SendData(19, -1, -1, null, 0, num20, num21 - 2, direction);
47199 netUpdate = true;
47200 ai[1] += 80f;
47201 }
47202 else if (WorldGen.OpenDoor(num20, num21 - 2, -direction))
47203 {
47204 closeDoor = true;
47205 doorX = num20;
47206 doorY = num21 - 2;
47207 NetMessage.SendData(19, -1, -1, null, 0, num20, num21 - 2, -direction);
47208 netUpdate = true;
47209 ai[1] += 80f;
47210 }
47211 else if (WorldGen.ShiftTallGate(num20, num21 - 2, closing: false))
47212 {
47213 closeDoor = true;
47214 doorX = num20;
47215 doorY = num21 - 2;
47216 NetMessage.SendData(19, -1, -1, null, 4, num20, num21 - 2);
47217 netUpdate = true;
47218 ai[1] += 80f;
47219 }
47220 else
47221 {
47222 direction *= -1;
47223 netUpdate = true;
47224 }
47225 }
47226 }
47227 else
47228 {
47229 if ((velocity.X < 0f && direction == -1) || (velocity.X > 0f && direction == 1))
47230 {
47231 bool flag22 = false;
47232 bool flag23 = false;
47233 if (tileSafely5.nactive() && Main.tileSolid[tileSafely5.type] && !Main.tileSolidTop[tileSafely5.type] && (!flag21 || (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type] && !Main.tileSolidTop[tileSafely4.type])))
47234 {
47236 {
47237 velocity.Y = -6f;
47238 netUpdate = true;
47239 }
47240 else if (flag5)
47241 {
47242 if (WorldGen.SolidTile((int)(base.Center.X / 16f) + direction, (int)(base.Center.Y / 16f)))
47243 {
47244 direction *= -1;
47245 velocity.X *= 0f;
47246 netUpdate = true;
47247 }
47248 }
47249 else if (flag13)
47250 {
47251 flag23 = true;
47252 flag22 = true;
47253 }
47254 else if (!flag20)
47255 {
47256 flag22 = true;
47257 }
47258 }
47259 else if (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type] && !Main.tileSolidTop[tileSafely4.type])
47260 {
47262 {
47263 velocity.Y = -5f;
47264 netUpdate = true;
47265 }
47266 else if (flag13)
47267 {
47268 flag23 = true;
47269 flag22 = true;
47270 }
47271 else
47272 {
47273 flag22 = true;
47274 }
47275 }
47276 else if (position.Y + (float)height - (float)(num21 * 16) > 20f && tileSafely3.nactive() && Main.tileSolid[tileSafely3.type] && !tileSafely3.topSlope())
47277 {
47279 {
47280 velocity.Y = -4.4f;
47281 netUpdate = true;
47282 }
47283 else if (flag13)
47284 {
47285 flag23 = true;
47286 flag22 = true;
47287 }
47288 else
47289 {
47290 flag22 = true;
47291 }
47292 }
47293 else if (avoidFalling3)
47294 {
47295 if (!flag20)
47296 {
47297 flag22 = true;
47298 }
47299 if (flag13)
47300 {
47301 flag23 = true;
47302 }
47303 }
47304 else if (flag12 && !Collision.SolidTilesVersatile(num20 - direction * 2, num20 - direction, num21 - 2, num21 - 1))
47305 {
47306 velocity.Y = -5f;
47307 netUpdate = true;
47308 }
47309 if (flag23)
47310 {
47311 keepwalking3 = false;
47312 velocity.X = 0f;
47313 ai[0] = 8f;
47314 ai[1] = 240f;
47315 netUpdate = true;
47316 }
47317 if (flag22)
47318 {
47319 direction *= -1;
47320 velocity.X *= -1f;
47321 netUpdate = true;
47322 }
47323 if (keepwalking3)
47324 {
47325 ai[1] = 90f;
47326 netUpdate = true;
47327 }
47328 if (velocity.Y < 0f)
47329 {
47330 localAI[3] = position.X;
47331 }
47332 }
47333 if (velocity.Y < 0f && wet)
47334 {
47335 velocity.Y *= 1.2f;
47336 }
47337 if (velocity.Y < 0f && NPCID.Sets.TownCritter[type] && !flag5)
47338 {
47339 velocity.Y *= 1.2f;
47340 }
47341 }
47342 }
47343 else if (flag12 && !wet)
47344 {
47345 int num29 = (int)(base.Center.X / 16f);
47346 int num30 = (int)((position.Y + (float)height - 16f) / 16f);
47347 int num31 = 0;
47348 for (int num32 = -1; num32 <= 1; num32++)
47349 {
47350 for (int num33 = 1; num33 <= 6; num33++)
47351 {
47353 if (tileSafely6.liquid > 0 || (tileSafely6.nactive() && Main.tileSolid[tileSafely6.type]))
47354 {
47355 num31++;
47356 }
47357 }
47358 }
47359 if (num31 <= 2)
47360 {
47361 if (velocity.X != 0f)
47362 {
47363 netUpdate = true;
47364 }
47365 velocity.X *= 0.2f;
47366 ai[0] = 0f;
47367 ai[1] = 50 + Main.rand.Next(50);
47368 ai[2] = 0f;
47369 localAI[3] = 40f;
47370 }
47371 }
47372 }
47373 }
47374 else if (ai[0] == 2f || ai[0] == 11f)
47375 {
47376 if (Main.netMode != 1)
47377 {
47378 localAI[3] -= 1f;
47379 if (Main.rand.Next(60) == 0 && localAI[3] == 0f)
47380 {
47381 localAI[3] = 60f;
47382 direction *= -1;
47383 netUpdate = true;
47384 }
47385 }
47386 ai[1] -= 1f;
47387 velocity.X *= 0.8f;
47388 if (ai[1] <= 0f)
47389 {
47390 localAI[3] = 40f;
47391 ai[0] = 0f;
47392 ai[1] = 60 + Main.rand.Next(60);
47393 netUpdate = true;
47394 }
47395 }
47396 else if (ai[0] == 3f || ai[0] == 4f || ai[0] == 5f || ai[0] == 8f || ai[0] == 9f || ai[0] == 16f || ai[0] == 17f || ai[0] == 20f || ai[0] == 21f || ai[0] == 22f || ai[0] == 23f)
47397 {
47398 velocity.X *= 0.8f;
47399 ai[1] -= 1f;
47400 if (ai[0] == 8f && ai[1] < 60f && flag13)
47401 {
47402 ai[1] = 180f;
47403 netUpdate = true;
47404 }
47405 if (ai[0] == 5f)
47406 {
47407 Point coords = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
47408 Tile tile = Main.tile[coords.X, coords.Y];
47409 if (tile.type != 15 && tile.type != 497)
47410 {
47411 ai[1] = 0f;
47412 }
47413 else
47414 {
47415 Main.sittingManager.AddNPC(whoAmI, coords);
47416 }
47417 }
47418 if (ai[1] <= 0f)
47419 {
47420 ai[0] = 0f;
47421 ai[1] = 60 + Main.rand.Next(60);
47422 ai[2] = 0f;
47423 localAI[3] = 30 + Main.rand.Next(60);
47424 netUpdate = true;
47425 }
47426 }
47427 else if (ai[0] == 6f || ai[0] == 7f || ai[0] == 18f || ai[0] == 19f)
47428 {
47429 if (ai[0] == 18f && (localAI[3] < 1f || localAI[3] > 2f))
47430 {
47431 localAI[3] = 2f;
47432 }
47433 velocity.X *= 0.8f;
47434 ai[1] -= 1f;
47435 int num34 = (int)ai[2];
47436 if (num34 < 0 || num34 > 255 || !Main.player[num34].CanBeTalkedTo || Main.player[num34].Distance(base.Center) > 200f || !Collision.CanHitLine(base.Top, 0, 0, Main.player[num34].Top, 0, 0))
47437 {
47438 ai[1] = 0f;
47439 }
47440 if (ai[1] > 0f)
47441 {
47442 int num35 = ((base.Center.X < Main.player[num34].Center.X) ? 1 : (-1));
47443 if (num35 != direction)
47444 {
47445 netUpdate = true;
47446 }
47447 direction = num35;
47448 }
47449 else
47450 {
47451 ai[0] = 0f;
47452 ai[1] = 60 + Main.rand.Next(60);
47453 ai[2] = 0f;
47454 localAI[3] = 30 + Main.rand.Next(60);
47455 netUpdate = true;
47456 }
47457 }
47458 else if (ai[0] == 10f)
47459 {
47460 int num36 = 0;
47461 int num37 = 0;
47462 float knockBack = 0f;
47463 float num38 = 0f;
47464 int num39 = 0;
47465 int num40 = 0;
47466 int maxValue = 0;
47467 float num41 = 0f;
47469 float num43 = 0f;
47470 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
47471 {
47472 frameCounter = 0.0;
47473 localAI[3] = 0f;
47474 }
47475 if (type == 38)
47476 {
47477 num36 = 30;
47478 num38 = 6f;
47479 num37 = 20;
47480 num39 = 10;
47481 num40 = 180;
47482 maxValue = 120;
47483 num41 = 16f;
47484 knockBack = 7f;
47485 }
47486 else if (type == 633)
47487 {
47488 num36 = 880;
47489 num38 = 24f;
47490 num37 = 15;
47491 num39 = 1;
47492 num41 = 0f;
47493 knockBack = 7f;
47494 num40 = 15;
47495 maxValue = 10;
47497 {
47498 num36 = 929;
47499 num37 = (int)((float)num37 * 1.5f);
47500 }
47501 }
47502 else if (type == 550)
47503 {
47504 num36 = 669;
47505 num38 = 6f;
47506 num37 = 24;
47507 num39 = 10;
47508 num40 = 120;
47509 maxValue = 60;
47510 num41 = 16f;
47511 knockBack = 9f;
47512 }
47513 else if (type == 588)
47514 {
47515 num36 = 721;
47516 num38 = 8f;
47517 num37 = 15;
47518 num39 = 5;
47519 num40 = 20;
47520 maxValue = 10;
47521 num41 = 16f;
47522 knockBack = 9f;
47523 }
47524 else if (type == 208)
47525 {
47526 num36 = 588;
47527 num38 = 6f;
47528 num37 = 30;
47529 num39 = 10;
47530 num40 = 60;
47531 maxValue = 120;
47532 num41 = 16f;
47533 knockBack = 6f;
47534 }
47535 else if (type == 17)
47536 {
47537 num36 = 48;
47538 num38 = 9f;
47539 num37 = 12;
47540 num39 = 10;
47541 num40 = 60;
47542 maxValue = 60;
47543 num41 = 16f;
47544 knockBack = 1.5f;
47545 }
47546 else if (type == 369)
47547 {
47548 num36 = 520;
47549 num38 = 12f;
47550 num37 = 10;
47551 num39 = 10;
47552 num40 = 0;
47553 maxValue = 1;
47554 num41 = 16f;
47555 knockBack = 3f;
47556 }
47557 else if (type == 453)
47558 {
47559 num36 = 21;
47560 num38 = 14f;
47561 num37 = 14;
47562 num39 = 10;
47563 num40 = 0;
47564 maxValue = 1;
47565 num41 = 16f;
47566 knockBack = 3f;
47567 }
47568 else if (type == 107)
47569 {
47570 num36 = 24;
47571 num38 = 5f;
47572 num37 = 15;
47573 num39 = 10;
47574 num40 = 60;
47575 maxValue = 60;
47576 num41 = 16f;
47577 knockBack = 1f;
47578 }
47579 else if (type == 124)
47580 {
47581 num36 = 582;
47582 num38 = 10f;
47583 num37 = 11;
47584 num39 = 1;
47585 num40 = 30;
47586 maxValue = 30;
47587 knockBack = 3.5f;
47588 }
47589 else if (type == 18)
47590 {
47591 num36 = 583;
47592 num38 = 8f;
47593 num37 = 8;
47594 num39 = 1;
47595 num40 = 15;
47596 maxValue = 10;
47597 knockBack = 2f;
47598 num41 = 10f;
47599 }
47600 else if (type == 142)
47601 {
47602 num36 = 589;
47603 num38 = 7f;
47604 num37 = 22;
47605 num39 = 1;
47606 num40 = 10;
47607 maxValue = 1;
47608 knockBack = 2f;
47609 num41 = 10f;
47610 }
47611 if (Main.expertMode)
47612 {
47613 num37 = (int)((float)num37 * Main.GameModeInfo.TownNPCDamageMultiplier);
47614 }
47615 num37 = (int)((float)num37 * num2);
47616 velocity.X *= 0.8f;
47617 ai[1] -= 1f;
47618 localAI[3] += 1f;
47619 if (localAI[3] == (float)num39 && Main.netMode != 1)
47620 {
47622 if (num11 == 1 && spriteDirection == 1 && num13 != -1)
47623 {
47624 vec = DirectionTo(Main.npc[num13].Center + new Vector2(0f, (0f - num41) * MathHelper.Clamp(Distance(Main.npc[num13].Center) / num42, 0f, 1f)));
47625 }
47626 if (num11 == -1 && spriteDirection == -1 && num12 != -1)
47627 {
47628 vec = DirectionTo(Main.npc[num12].Center + new Vector2(0f, (0f - num41) * MathHelper.Clamp(Distance(Main.npc[num12].Center) / num42, 0f, 1f)));
47629 }
47630 if (vec.HasNaNs() || Math.Sign(vec.X) != spriteDirection)
47631 {
47632 vec = new Vector2(spriteDirection, -1f);
47633 }
47634 vec *= num38;
47636 int num44 = 1000;
47637 num44 = ((type == 124) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num36, num37, knockBack, Main.myPlayer, 0f, whoAmI, townNpcVariationIndex) : ((type != 142) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num36, num37, knockBack, Main.myPlayer) : Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec.X, vec.Y, num36, num37, knockBack, Main.myPlayer, 0f, Main.rand.Next(5))));
47638 Main.projectile[num44].npcProj = true;
47639 Main.projectile[num44].noDropItem = true;
47640 if (type == 588)
47641 {
47642 Main.projectile[num44].timeLeft = 480;
47643 }
47644 }
47645 if (ai[1] <= 0f && 0 == 0)
47646 {
47647 ai[0] = ((localAI[2] == 8f && flag13) ? 8 : 0);
47648 ai[1] = num40 + Main.rand.Next(maxValue);
47649 ai[2] = 0f;
47650 localAI[1] = (localAI[3] = num40 / 2 + Main.rand.Next(maxValue));
47651 netUpdate = true;
47652 }
47653 }
47654 else if (ai[0] == 12f)
47655 {
47656 int num45 = 0;
47657 int num46 = 0;
47658 float num47 = 0f;
47659 int num48 = 0;
47660 int num49 = 0;
47661 int maxValue2 = 0;
47662 float knockBack2 = 0f;
47663 int num50 = 0;
47664 bool flag24 = false;
47665 float num51 = 0f;
47666 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
47667 {
47668 frameCounter = 0.0;
47669 localAI[3] = 0f;
47670 }
47671 int num52 = -1;
47672 if (num11 == 1 && spriteDirection == 1)
47673 {
47674 num52 = num13;
47675 }
47676 if (num11 == -1 && spriteDirection == -1)
47677 {
47678 num52 = num12;
47679 }
47680 if (type == 19)
47681 {
47682 num45 = 14;
47683 num47 = 13f;
47684 num46 = 24;
47685 num49 = 14;
47686 maxValue2 = 4;
47687 knockBack2 = 3f;
47688 num48 = 1;
47689 num51 = 0.5f;
47690 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
47691 {
47692 frameCounter = 0.0;
47693 localAI[3] = 0f;
47694 }
47695 if (Main.hardMode)
47696 {
47697 num46 = 15;
47698 if (localAI[3] > (float)num48)
47699 {
47700 num48 = 10;
47701 flag24 = true;
47702 }
47703 if (localAI[3] > (float)num48)
47704 {
47705 num48 = 20;
47706 flag24 = true;
47707 }
47708 if (localAI[3] > (float)num48)
47709 {
47710 num48 = 30;
47711 flag24 = true;
47712 }
47713 }
47714 }
47715 else if (type == 227)
47716 {
47717 num45 = 587;
47718 num47 = 10f;
47719 num46 = 8;
47720 num49 = 10;
47721 maxValue2 = 1;
47722 knockBack2 = 1.75f;
47723 num48 = 1;
47724 num51 = 0.5f;
47725 if (localAI[3] > (float)num48)
47726 {
47727 num48 = 12;
47728 flag24 = true;
47729 }
47730 if (localAI[3] > (float)num48)
47731 {
47732 num48 = 24;
47733 flag24 = true;
47734 }
47735 if (Main.hardMode)
47736 {
47737 num46 += 2;
47738 }
47739 }
47740 else if (type == 368)
47741 {
47742 num45 = 14;
47743 num47 = 13f;
47744 num46 = 24;
47745 num49 = 12;
47746 maxValue2 = 5;
47747 knockBack2 = 2f;
47748 num48 = 1;
47749 num51 = 0.2f;
47750 if (Main.hardMode)
47751 {
47752 num46 = 30;
47753 num45 = 357;
47754 }
47755 }
47756 else if (type == 22)
47757 {
47758 num47 = 10f;
47759 num46 = 8;
47760 num48 = 1;
47761 if (Main.hardMode)
47762 {
47763 num45 = 2;
47764 num49 = 15;
47765 maxValue2 = 10;
47766 num46 += 6;
47767 }
47768 else
47769 {
47770 num45 = 1;
47771 num49 = 30;
47772 maxValue2 = 20;
47773 }
47774 knockBack2 = 2.75f;
47775 num50 = 4;
47776 num51 = 0.7f;
47777 }
47778 else if (type == 228)
47779 {
47780 num45 = 267;
47781 num47 = 14f;
47782 num46 = 20;
47783 num48 = 1;
47784 num49 = 10;
47785 maxValue2 = 1;
47786 knockBack2 = 3f;
47787 num50 = 6;
47788 num51 = 0.4f;
47789 }
47790 else if (type == 178)
47791 {
47792 num45 = 242;
47793 num47 = 13f;
47794 num46 = ((!Main.hardMode) ? 11 : 15);
47795 num49 = 10;
47796 maxValue2 = 1;
47797 knockBack2 = 2f;
47798 num48 = 1;
47799 if (localAI[3] > (float)num48)
47800 {
47801 num48 = 8;
47802 flag24 = true;
47803 }
47804 if (localAI[3] > (float)num48)
47805 {
47806 num48 = 16;
47807 flag24 = true;
47808 }
47809 num51 = 0.3f;
47810 }
47811 else if (type == 229)
47812 {
47813 num45 = 14;
47814 num47 = 14f;
47815 num46 = 24;
47816 num49 = 10;
47817 maxValue2 = 1;
47818 knockBack2 = 2f;
47819 num48 = 1;
47820 num51 = 0.7f;
47821 if (localAI[3] > (float)num48)
47822 {
47823 num48 = 16;
47824 flag24 = true;
47825 }
47826 if (localAI[3] > (float)num48)
47827 {
47828 num48 = 24;
47829 flag24 = true;
47830 }
47831 if (localAI[3] > (float)num48)
47832 {
47833 num48 = 32;
47834 flag24 = true;
47835 }
47836 if (localAI[3] > (float)num48)
47837 {
47838 num48 = 40;
47839 flag24 = true;
47840 }
47841 if (localAI[3] > (float)num48)
47842 {
47843 num48 = 48;
47844 flag24 = true;
47845 }
47846 if (localAI[3] == 0f && num52 != -1 && Distance(Main.npc[num52].Center) < (float)NPCID.Sets.PrettySafe[type])
47847 {
47848 num51 = 0.1f;
47849 num45 = 162;
47850 num46 = 50;
47851 knockBack2 = 10f;
47852 num47 = 24f;
47853 }
47854 }
47855 else if (type == 209)
47856 {
47857 num45 = Utils.SelectRandom<int>(Main.rand, 134, 133, 135);
47858 num48 = 1;
47859 switch (num45)
47860 {
47861 case 135:
47862 num47 = 12f;
47863 num46 = 30;
47864 num49 = 30;
47865 maxValue2 = 10;
47866 knockBack2 = 7f;
47867 num51 = 0.2f;
47868 break;
47869 case 133:
47870 num47 = 10f;
47871 num46 = 25;
47872 num49 = 10;
47873 maxValue2 = 1;
47874 knockBack2 = 6f;
47875 num51 = 0.2f;
47876 break;
47877 case 134:
47878 num47 = 13f;
47879 num46 = 20;
47880 num49 = 20;
47881 maxValue2 = 10;
47882 knockBack2 = 4f;
47883 num51 = 0.1f;
47884 break;
47885 }
47886 }
47887 if (Main.expertMode)
47888 {
47889 num46 = (int)((float)num46 * Main.GameModeInfo.TownNPCDamageMultiplier);
47890 }
47891 num46 = (int)((float)num46 * num2);
47892 velocity.X *= 0.8f;
47893 ai[1] -= 1f;
47894 localAI[3] += 1f;
47895 if (localAI[3] == (float)num48 && Main.netMode != 1)
47896 {
47898 if (num52 != -1)
47899 {
47900 vec2 = DirectionTo(Main.npc[num52].Center + new Vector2(0f, -num50));
47901 }
47902 if (vec2.HasNaNs() || Math.Sign(vec2.X) != spriteDirection)
47903 {
47904 vec2 = new Vector2(spriteDirection, 0f);
47905 }
47906 vec2 *= num47;
47908 int num53 = 1000;
47909 num53 = ((type != 227) ? Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec2.X, vec2.Y, num45, num46, knockBack2, Main.myPlayer) : Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec2.X, vec2.Y, num45, num46, knockBack2, Main.myPlayer, 0f, (float)Main.rand.Next(12) / 6f));
47910 Main.projectile[num53].npcProj = true;
47911 Main.projectile[num53].noDropItem = true;
47912 }
47913 if (localAI[3] == (float)num48 && flag24 && num52 != -1)
47914 {
47916 if (vector2.Y <= 0.5f && vector2.Y >= -0.5f)
47917 {
47918 ai[2] = vector2.Y;
47919 }
47920 }
47921 if (ai[1] <= 0f && 0 == 0)
47922 {
47923 ai[0] = ((localAI[2] == 8f && flag13) ? 8 : 0);
47924 ai[1] = num49 + Main.rand.Next(maxValue2);
47925 ai[2] = 0f;
47926 localAI[1] = (localAI[3] = num49 / 2 + Main.rand.Next(maxValue2));
47927 netUpdate = true;
47928 }
47929 }
47930 else if (ai[0] == 13f)
47931 {
47932 velocity.X *= 0.8f;
47933 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
47934 {
47935 frameCounter = 0.0;
47936 }
47937 ai[1] -= 1f;
47938 localAI[3] += 1f;
47939 if (localAI[3] == 1f && Main.netMode != 1)
47940 {
47941 Vector2 vec3 = DirectionTo(Main.npc[(int)ai[2]].Center + new Vector2(0f, -20f));
47942 if (vec3.HasNaNs() || Math.Sign(vec3.X) == -spriteDirection)
47943 {
47944 vec3 = new Vector2(spriteDirection, -1f);
47945 }
47946 vec3 *= 8f;
47947 int num54 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec3.X, vec3.Y, 584, 0, 0f, Main.myPlayer, ai[2]);
47948 Main.projectile[num54].npcProj = true;
47949 Main.projectile[num54].noDropItem = true;
47950 }
47951 if (ai[1] <= 0f)
47952 {
47953 ai[0] = 0f;
47954 ai[1] = 10 + Main.rand.Next(10);
47955 ai[2] = 0f;
47956 localAI[3] = 5 + Main.rand.Next(10);
47957 netUpdate = true;
47958 }
47959 }
47960 else if (ai[0] == 14f)
47961 {
47962 int num55 = 0;
47963 int num56 = 0;
47964 float num57 = 0f;
47965 int num58 = 0;
47966 int num59 = 0;
47967 int maxValue3 = 0;
47968 float knockBack3 = 0f;
47969 float num60 = 0f;
47971 float num62 = 1f;
47972 float num63 = 0f;
47973 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
47974 {
47975 frameCounter = 0.0;
47976 localAI[3] = 0f;
47977 }
47978 int num64 = -1;
47979 if (num11 == 1 && spriteDirection == 1)
47980 {
47981 num64 = num13;
47982 }
47983 if (num11 == -1 && spriteDirection == -1)
47984 {
47985 num64 = num12;
47986 }
47987 if (type == 54)
47988 {
47989 num55 = 585;
47990 num57 = 10f;
47991 num56 = 16;
47992 num58 = 30;
47993 num59 = 20;
47994 maxValue3 = 15;
47995 knockBack3 = 2f;
47996 num63 = 1f;
47997 }
47998 else if (type == 108)
47999 {
48000 num55 = 15;
48001 num57 = 6f;
48002 num56 = 18;
48003 num58 = 15;
48004 num59 = 15;
48005 maxValue3 = 5;
48006 knockBack3 = 3f;
48007 num60 = 20f;
48008 }
48009 else if (type == 160)
48010 {
48011 num55 = 590;
48012 num56 = 40;
48013 num58 = 15;
48014 num59 = 10;
48015 maxValue3 = 1;
48016 knockBack3 = 3f;
48017 for (; localAI[3] > (float)num58; num58 += 15)
48018 {
48019 }
48020 }
48021 else if (type == 663)
48022 {
48023 num55 = 950;
48024 num56 = ((!Main.hardMode) ? 15 : 20);
48025 num58 = 15;
48026 num59 = 0;
48027 maxValue3 = 0;
48028 knockBack3 = 3f;
48029 for (; localAI[3] > (float)num58; num58 += 10)
48030 {
48031 }
48032 }
48033 else if (type == 20)
48034 {
48035 num55 = 586;
48036 num58 = 24;
48037 num59 = 10;
48038 maxValue3 = 1;
48039 knockBack3 = 3f;
48040 }
48041 if (Main.expertMode)
48042 {
48043 num56 = (int)((float)num56 * Main.GameModeInfo.TownNPCDamageMultiplier);
48044 }
48045 num56 = (int)((float)num56 * num2);
48046 velocity.X *= 0.8f;
48047 ai[1] -= 1f;
48048 localAI[3] += 1f;
48049 if (localAI[3] == (float)num58 && Main.netMode != 1)
48050 {
48052 if (num64 != -1)
48053 {
48054 vec4 = DirectionTo(Main.npc[num64].Center + new Vector2(0f, (0f - num60) * MathHelper.Clamp(Distance(Main.npc[num64].Center) / num61, 0f, 1f)));
48055 }
48056 if (vec4.HasNaNs() || Math.Sign(vec4.X) != spriteDirection)
48057 {
48058 vec4 = new Vector2(spriteDirection, 0f);
48059 }
48060 vec4 *= num57;
48062 if (type == 108)
48063 {
48064 int num65 = Utils.SelectRandom<int>(Main.rand, 1, 1, 1, 1, 2, 2, 3);
48065 for (int num66 = 0; num66 < num65; num66++)
48066 {
48067 Vector2 vector3 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f);
48068 int num67 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X + vector3.X, vec4.Y + vector3.Y, num55, num56, knockBack3, Main.myPlayer, 0f, 0f, townNpcVariationIndex);
48069 Main.projectile[num67].npcProj = true;
48070 Main.projectile[num67].noDropItem = true;
48071 }
48072 }
48073 else if (type == 160)
48074 {
48075 if (num64 != -1)
48076 {
48077 Vector2 vector4 = Main.npc[num64].position - Main.npc[num64].Size * 2f + Main.npc[num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
48078 int num68 = 10;
48079 while (num68 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)vector4.X / 16, (int)vector4.Y / 16)))
48080 {
48081 num68--;
48082 vector4 = Main.npc[num64].position - Main.npc[num64].Size * 2f + Main.npc[num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
48083 }
48085 Main.projectile[num69].npcProj = true;
48086 Main.projectile[num69].noDropItem = true;
48087 }
48088 }
48089 else if (type == 663)
48090 {
48091 if (num64 != -1)
48092 {
48093 Vector2 vector5 = Main.npc[num64].position + Main.npc[num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 1f;
48094 int num70 = 5;
48095 while (num70 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)vector5.X / 16, (int)vector5.Y / 16)))
48096 {
48097 num70--;
48098 vector5 = Main.npc[num64].position + Main.npc[num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 1f;
48099 }
48101 Main.projectile[num71].npcProj = true;
48102 Main.projectile[num71].noDropItem = true;
48103 }
48104 }
48105 else if (type == 20)
48106 {
48107 int num72 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X, vec4.Y, num55, num56, knockBack3, Main.myPlayer, 0f, whoAmI, townNpcVariationIndex);
48108 Main.projectile[num72].npcProj = true;
48109 Main.projectile[num72].noDropItem = true;
48110 }
48111 else
48112 {
48113 int num73 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X + (float)(spriteDirection * 16), base.Center.Y - 2f, vec4.X, vec4.Y, num55, num56, knockBack3, Main.myPlayer);
48114 Main.projectile[num73].npcProj = true;
48115 Main.projectile[num73].noDropItem = true;
48116 }
48117 }
48118 if (num62 > 0f)
48119 {
48121 Lighting.AddLight(base.Center, vector6.X, vector6.Y, vector6.Z);
48122 }
48123 if (ai[1] <= 0f && 0 == 0)
48124 {
48125 ai[0] = ((localAI[2] == 8f && flag13) ? 8 : 0);
48126 ai[1] = num59 + Main.rand.Next(maxValue3);
48127 ai[2] = 0f;
48128 localAI[1] = (localAI[3] = num59 / 2 + Main.rand.Next(maxValue3));
48129 netUpdate = true;
48130 }
48131 }
48132 else if (ai[0] == 15f)
48133 {
48134 int num74 = 0;
48135 int maxValue4 = 0;
48136 if ((float)NPCID.Sets.AttackTime[type] == ai[1])
48137 {
48138 frameCounter = 0.0;
48139 localAI[3] = 0f;
48140 }
48141 int num75 = 0;
48142 float num76 = 0f;
48143 int num77 = 0;
48144 int num78 = 0;
48145 if (num11 == 1)
48146 {
48148 _ = 1;
48149 }
48150 if (num11 == -1)
48151 {
48153 _ = -1;
48154 }
48155 if (type == 207)
48156 {
48157 num75 = 11;
48158 num77 = (num78 = 32);
48159 num74 = 12;
48160 maxValue4 = 6;
48161 num76 = 4.25f;
48162 }
48163 else if (type == 441)
48164 {
48165 num75 = 9;
48166 num77 = (num78 = 28);
48167 num74 = 9;
48168 maxValue4 = 3;
48169 num76 = 3.5f;
48170 if (GivenName == "Andrew")
48171 {
48172 num75 *= 2;
48173 num76 *= 2f;
48174 }
48175 }
48176 else if (type == 353)
48177 {
48178 num75 = 10;
48179 num77 = (num78 = 32);
48180 num74 = 15;
48181 maxValue4 = 8;
48182 num76 = 5f;
48183 }
48184 else if (NPCID.Sets.IsTownPet[type])
48185 {
48186 num75 = 10;
48187 num77 = (num78 = 32);
48188 num74 = 15;
48189 maxValue4 = 8;
48190 num76 = 3f;
48191 }
48192 if (Main.expertMode)
48193 {
48194 num75 = (int)((float)num75 * Main.GameModeInfo.TownNPCDamageMultiplier);
48195 }
48196 num75 = (int)((float)num75 * num2);
48197 velocity.X *= 0.8f;
48198 ai[1] -= 1f;
48199 if (Main.netMode != 1)
48200 {
48202 Rectangle itemRectangle = new Rectangle((int)swingStats.Item1.X, (int)swingStats.Item1.Y, num77, num78);
48203 if (spriteDirection == -1)
48204 {
48205 itemRectangle.X -= num77;
48206 }
48207 itemRectangle.Y -= num78;
48209 int myPlayer = Main.myPlayer;
48210 for (int num79 = 0; num79 < 200; num79++)
48211 {
48212 NPC nPC2 = Main.npc[num79];
48213 if (nPC2.active && nPC2.immune[myPlayer] == 0 && !nPC2.dontTakeDamage && !nPC2.friendly && nPC2.damage > 0 && itemRectangle.Intersects(nPC2.Hitbox) && (nPC2.noTileCollide || Collision.CanHit(position, width, height, nPC2.position, nPC2.width, nPC2.height)))
48214 {
48215 nPC2.StrikeNPCNoInteraction(num75, num76, spriteDirection);
48216 if (Main.netMode != 0)
48217 {
48218 NetMessage.SendData(28, -1, -1, null, num79, num75, num76, spriteDirection);
48219 }
48220 nPC2.netUpdate = true;
48221 nPC2.immune[myPlayer] = (int)ai[1] + 2;
48222 }
48223 }
48224 }
48225 if (ai[1] <= 0f)
48226 {
48227 bool flag25 = false;
48228 if (flag13)
48229 {
48230 int num80 = -num11;
48231 if (!Collision.CanHit(base.Center, 0, 0, base.Center + Vector2.UnitX * num80 * 32f, 0, 0) || localAI[2] == 8f)
48232 {
48233 flag25 = true;
48234 }
48235 if (flag25)
48236 {
48238 int num82 = ((num11 == 1) ? num13 : num12);
48239 int num83 = ((num11 == 1) ? num12 : num13);
48240 if (num82 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num82].Center, 0, 0))
48241 {
48242 num82 = ((num83 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num83].Center, 0, 0)) ? (-1) : num83);
48243 }
48244 if (num82 != -1)
48245 {
48246 ai[0] = 15f;
48247 ai[1] = num81;
48248 ai[2] = 0f;
48249 localAI[3] = 0f;
48250 direction = ((position.X < Main.npc[num82].position.X) ? 1 : (-1));
48251 netUpdate = true;
48252 }
48253 else
48254 {
48255 flag25 = false;
48256 }
48257 }
48258 }
48259 if (!flag25)
48260 {
48261 ai[0] = ((localAI[2] == 8f && flag13) ? 8 : 0);
48262 ai[1] = num74 + Main.rand.Next(maxValue4);
48263 ai[2] = 0f;
48264 localAI[1] = (localAI[3] = num74 / 2 + Main.rand.Next(maxValue4));
48265 netUpdate = true;
48266 }
48267 }
48268 }
48269 else if (ai[0] == 24f)
48270 {
48271 velocity.X *= 0.8f;
48272 ai[1] -= 1f;
48273 localAI[3] += 1f;
48274 direction = 1;
48275 spriteDirection = 1;
48277 Lighting.AddLight(base.Center, vector7.X, vector7.Y, vector7.Z);
48278 if (ai[1] <= 0f)
48279 {
48280 ai[0] = 0f;
48281 ai[1] = 480f;
48282 ai[2] = 0f;
48283 localAI[1] = 480f;
48284 netUpdate = true;
48285 }
48286 }
48287 if (flag11 && wet)
48288 {
48289 int num84 = (int)(base.Center.X / 16f);
48290 int num85 = 5;
48291 if (collideX || (num84 < num85 && direction == -1) || (num84 > Main.maxTilesX - num85 && direction == 1))
48292 {
48293 direction *= -1;
48294 velocity.X *= -0.25f;
48295 netUpdate = true;
48296 }
48297 velocity.Y *= 0.9f;
48298 velocity.Y -= 0.5f;
48299 if (velocity.Y < -15f)
48300 {
48301 velocity.Y = -15f;
48302 }
48303 }
48304 if (flag10 && wet)
48305 {
48306 if (flag7)
48307 {
48308 ai[1] = 50f;
48309 }
48310 int num86 = (int)(base.Center.X / 16f);
48311 int num87 = 5;
48312 if (collideX || (num86 < num87 && direction == -1) || (num86 > Main.maxTilesX - num87 && direction == 1))
48313 {
48314 direction *= -1;
48315 velocity.X *= -0.25f;
48316 netUpdate = true;
48317 }
48318 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
48319 {
48320 float num88 = base.Center.Y + 1f;
48321 if (base.Center.Y > waterLineHeight)
48322 {
48323 velocity.Y -= 0.8f;
48324 if (velocity.Y < -4f)
48325 {
48326 velocity.Y = -4f;
48327 }
48329 {
48330 velocity.Y = waterLineHeight - num88;
48331 }
48332 }
48333 else
48334 {
48335 velocity.Y = MathHelper.Min(velocity.Y, waterLineHeight - num88);
48336 }
48337 }
48338 else
48339 {
48340 velocity.Y -= 0.2f;
48341 }
48342 }
48343 if (Main.netMode != 1 && isLikeATownNPC && !flag3)
48344 {
48345 bool flag26 = ai[0] < 2f && !flag13 && !wet;
48346 bool flag27 = (ai[0] < 2f || ai[0] == 8f) && (flag13 || flag14);
48347 if (localAI[1] > 0f)
48348 {
48349 localAI[1] -= 1f;
48350 }
48351 if (localAI[1] > 0f)
48352 {
48353 flag27 = false;
48354 }
48355 if (flag27 && type == 124 && localAI[0] == 1f)
48356 {
48357 flag27 = false;
48358 }
48359 if (flag27 && type == 20)
48360 {
48361 flag27 = false;
48362 for (int num89 = 0; num89 < 200; num89++)
48363 {
48364 NPC nPC3 = Main.npc[num89];
48365 if (nPC3.active && nPC3.townNPC && !(Distance(nPC3.Center) > 1200f) && nPC3.FindBuffIndex(165) == -1)
48366 {
48367 flag27 = true;
48368 break;
48369 }
48370 }
48371 }
48372 if (CanTalk && flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(300) == 0)
48373 {
48374 int num90 = 420;
48375 num90 = ((Main.rand.Next(2) != 0) ? (num90 * Main.rand.Next(1, 3)) : (num90 * Main.rand.Next(1, 4)));
48376 int num91 = 100;
48377 int num92 = 20;
48378 for (int num93 = 0; num93 < 200; num93++)
48379 {
48380 NPC nPC4 = Main.npc[num93];
48381 bool flag28 = (nPC4.ai[0] == 1f && nPC4.closeDoor) || (nPC4.ai[0] == 1f && nPC4.ai[1] > 200f) || nPC4.ai[0] > 1f || nPC4.wet;
48382 if (nPC4 != this && nPC4.active && nPC4.CanBeTalkedTo && !flag28 && nPC4.Distance(base.Center) < (float)num91 && nPC4.Distance(base.Center) > (float)num92 && Collision.CanHit(base.Center, 0, 0, nPC4.Center, 0, 0))
48383 {
48384 int num94 = (position.X < nPC4.position.X).ToDirectionInt();
48385 ai[0] = 3f;
48386 ai[1] = num90;
48387 ai[2] = num93;
48388 direction = num94;
48389 netUpdate = true;
48390 nPC4.ai[0] = 4f;
48391 nPC4.ai[1] = num90;
48392 nPC4.ai[2] = whoAmI;
48393 nPC4.direction = -num94;
48394 nPC4.netUpdate = true;
48395 break;
48396 }
48397 }
48398 }
48399 else if (CanTalk && flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1800) == 0)
48400 {
48401 int num95 = 420;
48402 num95 = ((Main.rand.Next(2) != 0) ? (num95 * Main.rand.Next(1, 3)) : (num95 * Main.rand.Next(1, 4)));
48403 int num96 = 100;
48404 int num97 = 20;
48405 for (int num98 = 0; num98 < 200; num98++)
48406 {
48407 NPC nPC5 = Main.npc[num98];
48408 bool flag29 = (nPC5.ai[0] == 1f && nPC5.closeDoor) || (nPC5.ai[0] == 1f && nPC5.ai[1] > 200f) || nPC5.ai[0] > 1f || nPC5.wet;
48409 if (nPC5 != this && nPC5.active && nPC5.CanBeTalkedTo && !NPCID.Sets.IsTownPet[nPC5.type] && !flag29 && nPC5.Distance(base.Center) < (float)num96 && nPC5.Distance(base.Center) > (float)num97 && Collision.CanHit(base.Center, 0, 0, nPC5.Center, 0, 0))
48410 {
48411 int num99 = (position.X < nPC5.position.X).ToDirectionInt();
48412 ai[0] = 16f;
48413 ai[1] = num95;
48414 ai[2] = num98;
48415 localAI[2] = Main.rand.Next(4);
48416 localAI[3] = Main.rand.Next(3 - (int)localAI[2]);
48417 direction = num99;
48418 netUpdate = true;
48419 nPC5.ai[0] = 17f;
48420 nPC5.ai[1] = num95;
48421 nPC5.ai[2] = whoAmI;
48422 nPC5.localAI[2] = 0f;
48423 nPC5.localAI[3] = 0f;
48424 nPC5.direction = -num99;
48425 nPC5.netUpdate = true;
48426 break;
48427 }
48428 }
48429 }
48430 else if (!NPCID.Sets.IsTownPet[type] && flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1200) == 0 && (type == 208 || (BirthdayParty.PartyIsUp && NPCID.Sets.AttackType[type] == NPCID.Sets.AttackType[208])))
48431 {
48432 int num100 = 300;
48433 int num101 = 150;
48434 for (int num102 = 0; num102 < 255; num102++)
48435 {
48436 Player player = Main.player[num102];
48437 if (player.active && !player.dead && player.Distance(base.Center) < (float)num101 && Collision.CanHitLine(base.Top, 0, 0, player.Top, 0, 0))
48438 {
48439 int num103 = (position.X < player.position.X).ToDirectionInt();
48440 ai[0] = 6f;
48441 ai[1] = num100;
48442 ai[2] = num102;
48443 direction = num103;
48444 netUpdate = true;
48445 break;
48446 }
48447 }
48448 }
48449 else if (flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(600) == 0 && type == 550)
48450 {
48451 int num104 = 300;
48452 int num105 = 150;
48453 for (int num106 = 0; num106 < 255; num106++)
48454 {
48456 if (player2.active && !player2.dead && player2.Distance(base.Center) < (float)num105 && Collision.CanHitLine(base.Top, 0, 0, player2.Top, 0, 0))
48457 {
48458 int num107 = (position.X < player2.position.X).ToDirectionInt();
48459 ai[0] = 18f;
48460 ai[1] = num104;
48461 ai[2] = num106;
48462 direction = num107;
48463 netUpdate = true;
48464 break;
48465 }
48466 }
48467 }
48468 else if (!NPCID.Sets.IsTownPet[type] && flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1800) == 0)
48469 {
48470 ai[0] = 2f;
48471 ai[1] = 45 * Main.rand.Next(1, 2);
48472 netUpdate = true;
48473 }
48474 else if (flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(600) == 0 && type == 229 && !flag14)
48475 {
48476 ai[0] = 11f;
48477 ai[1] = 30 * Main.rand.Next(1, 4);
48478 netUpdate = true;
48479 }
48480 else if (flag26 && ai[0] == 0f && velocity.Y == 0f && Main.rand.Next(1200) == 0)
48481 {
48482 int num108 = 220;
48483 int num109 = 150;
48484 for (int num110 = 0; num110 < 255; num110++)
48485 {
48487 if (player3.CanBeTalkedTo && player3.Distance(base.Center) < (float)num109 && Collision.CanHitLine(base.Top, 0, 0, player3.Top, 0, 0))
48488 {
48489 int num111 = (position.X < player3.position.X).ToDirectionInt();
48490 ai[0] = 7f;
48491 ai[1] = num108;
48492 ai[2] = num110;
48493 direction = num111;
48494 netUpdate = true;
48495 break;
48496 }
48497 }
48498 }
48499 else if (flag26 && ai[0] == 1f && velocity.Y == 0f && num > 0 && Main.rand.Next(num) == 0)
48500 {
48501 Point point = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
48502 bool flag30 = WorldGen.InWorld(point.X, point.Y, 1);
48503 if (flag30)
48504 {
48505 for (int num112 = 0; num112 < 200; num112++)
48506 {
48507 if (Main.npc[num112].active && Main.npc[num112].aiStyle == 7 && Main.npc[num112].townNPC && Main.npc[num112].ai[0] == 5f && (Main.npc[num112].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == point)
48508 {
48509 flag30 = false;
48510 break;
48511 }
48512 }
48513 for (int num113 = 0; num113 < 255; num113++)
48514 {
48515 if (Main.player[num113].active && Main.player[num113].sitting.isSitting && Main.player[num113].Center.ToTileCoordinates() == point)
48516 {
48517 flag30 = false;
48518 break;
48519 }
48520 }
48521 }
48522 if (flag30)
48523 {
48524 Tile tile2 = Main.tile[point.X, point.Y];
48525 flag30 = tile2.type == 15 || tile2.type == 497;
48526 if (flag30 && tile2.type == 15 && tile2.frameY >= 1080 && tile2.frameY <= 1098)
48527 {
48528 flag30 = false;
48529 }
48530 if (flag30)
48531 {
48532 ai[0] = 5f;
48533 ai[1] = 900 + Main.rand.Next(10800);
48534 direction = ((tile2.frameX != 0) ? 1 : (-1));
48535 base.Bottom = new Vector2(point.X * 16 + 8 + 2 * direction, point.Y * 16 + 16);
48537 localAI[3] = 0f;
48538 netUpdate = true;
48539 }
48540 }
48541 }
48542 else if (flag26 && ai[0] == 1f && velocity.Y == 0f && Main.rand.Next(600) == 0 && Utils.PlotTileLine(base.Top, base.Bottom, width, DelegateMethods.SearchAvoidedByNPCs))
48543 {
48544 Point point2 = (base.Center + new Vector2(direction * 10, 0f)).ToTileCoordinates();
48545 bool flag31 = WorldGen.InWorld(point2.X, point2.Y, 1);
48546 if (flag31)
48547 {
48549 if (!tileSafely7.nactive() || !TileID.Sets.InteractibleByNPCs[tileSafely7.type])
48550 {
48551 flag31 = false;
48552 }
48553 }
48554 if (flag31)
48555 {
48556 ai[0] = 9f;
48557 ai[1] = 40 + Main.rand.Next(90);
48559 localAI[3] = 0f;
48560 netUpdate = true;
48561 }
48562 }
48563 if (Main.netMode != 1 && ai[0] < 2f && velocity.Y == 0f && type == 18 && breath > 0)
48564 {
48565 int num114 = -1;
48566 for (int num115 = 0; num115 < 200; num115++)
48567 {
48568 NPC nPC6 = Main.npc[num115];
48569 if (nPC6.active && nPC6.townNPC && nPC6.life != nPC6.lifeMax && (num114 == -1 || nPC6.lifeMax - nPC6.life > Main.npc[num114].lifeMax - Main.npc[num114].life) && Collision.CanHitLine(position, width, height, nPC6.position, nPC6.width, nPC6.height) && Distance(nPC6.Center) < 500f)
48570 {
48571 num114 = num115;
48572 }
48573 }
48574 if (num114 != -1)
48575 {
48576 ai[0] = 13f;
48577 ai[1] = 34f;
48578 ai[2] = num114;
48579 localAI[3] = 0f;
48580 direction = ((position.X < Main.npc[num114].position.X) ? 1 : (-1));
48581 netUpdate = true;
48582 }
48583 }
48585 {
48587 int num117 = ((num11 == 1) ? num13 : num12);
48588 int num118 = ((num11 == 1) ? num12 : num13);
48589 if (num117 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num117].Center, 0, 0))
48590 {
48591 num117 = ((num118 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num118].Center, 0, 0)) ? (-1) : num118);
48592 }
48593 bool flag32 = num117 != -1;
48594 if (flag32 && type == 633)
48595 {
48596 flag32 = Vector2.Distance(base.Center, Main.npc[num117].Center) <= 50f;
48597 }
48598 if (flag32)
48599 {
48600 localAI[2] = ai[0];
48601 ai[0] = 10f;
48602 ai[1] = num116;
48603 ai[2] = 0f;
48604 localAI[3] = 0f;
48605 direction = ((position.X < Main.npc[num117].position.X) ? 1 : (-1));
48606 netUpdate = true;
48607 }
48608 }
48609 else if (flag27 && velocity.Y == 0f && NPCID.Sets.AttackType[type] == 1 && NPCID.Sets.AttackAverageChance[type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[type] * 2) == 0)
48610 {
48612 int num120 = ((num11 == 1) ? num13 : num12);
48613 int num121 = ((num11 == 1) ? num12 : num13);
48614 if (num120 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num120].Center, 0, 0))
48615 {
48616 num120 = ((num121 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num121].Center, 0, 0)) ? (-1) : num121);
48617 }
48618 if (num120 != -1)
48619 {
48621 if (vector8.Y <= 0.5f && vector8.Y >= -0.5f)
48622 {
48623 localAI[2] = ai[0];
48624 ai[0] = 12f;
48625 ai[1] = num119;
48626 ai[2] = vector8.Y;
48627 localAI[3] = 0f;
48628 direction = ((position.X < Main.npc[num120].position.X) ? 1 : (-1));
48629 netUpdate = true;
48630 }
48631 }
48632 }
48634 {
48636 int num123 = ((num11 == 1) ? num13 : num12);
48637 int num124 = ((num11 == 1) ? num12 : num13);
48638 if (num123 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num123].Center, 0, 0))
48639 {
48640 num123 = ((num124 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num124].Center, 0, 0)) ? (-1) : num124);
48641 }
48642 if (num123 != -1)
48643 {
48644 localAI[2] = ai[0];
48645 ai[0] = 14f;
48646 ai[1] = num122;
48647 ai[2] = 0f;
48648 localAI[3] = 0f;
48649 direction = ((position.X < Main.npc[num123].position.X) ? 1 : (-1));
48650 netUpdate = true;
48651 }
48652 else if (type == 20)
48653 {
48654 localAI[2] = ai[0];
48655 ai[0] = 14f;
48656 ai[1] = num122;
48657 ai[2] = 0f;
48658 localAI[3] = 0f;
48659 netUpdate = true;
48660 }
48661 }
48663 {
48665 int num126 = ((num11 == 1) ? num13 : num12);
48666 int num127 = ((num11 == 1) ? num12 : num13);
48667 if (num126 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num126].Center, 0, 0))
48668 {
48669 num126 = ((num127 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num127].Center, 0, 0)) ? (-1) : num127);
48670 }
48671 if (num126 != -1)
48672 {
48673 localAI[2] = ai[0];
48674 ai[0] = 15f;
48675 ai[1] = num125;
48676 ai[2] = 0f;
48677 localAI[3] = 0f;
48678 direction = ((position.X < Main.npc[num126].position.X) ? 1 : (-1));
48679 netUpdate = true;
48680 }
48681 }
48682 }
48683 if (type == 681)
48684 {
48685 float R = 0f;
48686 float G = 0f;
48687 float B = 0f;
48688 TorchID.TorchColor(23, out R, out G, out B);
48689 float num128 = 0.35f;
48690 R *= num128;
48691 G *= num128;
48692 B *= num128;
48693 Lighting.AddLight(base.Center, R, G, B);
48694 }
48695 if (type == 683 || type == 687)
48696 {
48697 float num129 = Utils.WrappedLerp(0.75f, 1f, (float)Main.timeForVisualEffects % 120f / 120f);
48698 Lighting.AddLight(base.Center, 0.25f * num129, 0.25f * num129, 0.1f * num129);
48699 }
48700 }
48701
48703 {
48705 if (vector.HasValue)
48706 {
48708 position = vector.Value;
48710 int num = 560;
48711 if (movementVector.Length() >= (float)num)
48712 {
48713 ai[2] = 30f;
48715 {
48716 PositionInWorld = vector2 + base.Size / 2f,
48717 MovementVector = movementVector
48718 });
48719 }
48720 netUpdate = true;
48721 }
48722 }
48723
48725 {
48726 Point point = base.Top.ToTileCoordinates();
48727 int num = 30;
48728 Vector2? result = null;
48729 bool flag = homeless && (homeTileX == -1 || homeTileY == -1);
48730 for (int i = 1; i < num; i += 2)
48731 {
48732 Vector2? vector = ShimmerHelper.FindSpotWithoutShimmer(this, point.X, point.Y, i, flag);
48733 if (vector.HasValue)
48734 {
48735 result = vector.Value;
48736 break;
48737 }
48738 }
48739 if (!result.HasValue && homeTileX != -1 && homeTileY != -1)
48740 {
48741 for (int j = 1; j < num; j += 2)
48742 {
48744 if (vector2.HasValue)
48745 {
48746 result = vector2.Value;
48747 break;
48748 }
48749 }
48750 }
48751 if (!result.HasValue)
48752 {
48753 int num2 = (flag ? 30 : 0);
48754 num = 60;
48755 flag = true;
48756 for (int k = num2; k < num; k += 2)
48757 {
48758 Vector2? vector3 = ShimmerHelper.FindSpotWithoutShimmer(this, point.X, point.Y, k, flag);
48759 if (vector3.HasValue)
48760 {
48761 result = vector3.Value;
48762 break;
48763 }
48764 }
48765 }
48766 if (!result.HasValue && homeTileX != -1 && homeTileY != -1)
48767 {
48768 num = 60;
48769 flag = true;
48770 for (int l = 30; l < num; l += 2)
48771 {
48773 if (vector4.HasValue)
48774 {
48775 result = vector4.Value;
48776 break;
48777 }
48778 }
48779 }
48780 return result;
48781 }
48782
48784 {
48785 bool flag = false;
48786 for (int i = 0; i < 3; i++)
48787 {
48788 int num = homeFloorX + i switch
48789 {
48790 1 => -1,
48791 0 => 0,
48792 _ => 1,
48793 };
48794 if (type == 37 || !Collision.SolidTiles(num - 1, num + 1, homeFloorY - 3, homeFloorY - 1))
48795 {
48796 velocity.X = 0f;
48797 velocity.Y = 0f;
48798 position.X = num * 16 + 8 - width / 2;
48799 position.Y = (float)(homeFloorY * 16 - height) - 0.1f;
48800 netUpdate = true;
48802 flag = true;
48803 break;
48804 }
48805 }
48806 if (!flag)
48807 {
48808 homeless = true;
48810 }
48811 }
48812
48814 {
48815 keepwalking = false;
48816 avoidFalling = true;
48817 bool flag = myTileX >= homeFloorX - 35 && myTileX <= homeFloorX + 35;
48818 if (townNPC && ai[1] < 30f)
48819 {
48821 if (!keepwalking)
48822 {
48823 Rectangle hitbox = base.Hitbox;
48824 hitbox.X -= 20;
48825 hitbox.Width += 40;
48826 for (int i = 0; i < 200; i++)
48827 {
48828 if (Main.npc[i].active && Main.npc[i].friendly && i != whoAmI && Main.npc[i].velocity.X == 0f && hitbox.Intersects(Main.npc[i].Hitbox))
48829 {
48830 keepwalking = true;
48831 break;
48832 }
48833 }
48834 }
48835 }
48837 {
48838 keepwalking = true;
48839 }
48841 {
48842 avoidFalling = false;
48843 }
48844 if (!avoidFalling)
48845 {
48846 return;
48847 }
48848 bool flag2 = false;
48849 Point p = default(Point);
48850 int num = 0;
48851 for (int j = -1; j <= 4; j++)
48852 {
48854 if (tileSafely.liquid > 0)
48855 {
48856 num++;
48857 if (tileSafely.lava())
48858 {
48859 flag2 = true;
48860 break;
48861 }
48862 }
48863 if (tileSafely.nactive() && Main.tileSolid[tileSafely.type])
48864 {
48865 if (num > 0)
48866 {
48867 p.X = tileX;
48868 p.Y = tileY + j;
48869 }
48870 avoidFalling = false;
48871 break;
48872 }
48873 }
48875 double num2 = Math.Ceiling((float)height / 16f);
48876 if ((double)num >= num2)
48877 {
48878 avoidFalling = true;
48879 }
48880 if (!avoidFalling && p.X != 0 && p.Y != 0)
48881 {
48882 Vector2 vector = p.ToWorldCoordinates(8f, 0f) + new Vector2(-width / 2, -height);
48884 }
48885 }
48886
48888 {
48889 return currentlyDrowning;
48890 }
48891
48893 {
48894 if (velocity.X == 0f && Main.netMode != 1 && Main.rand.Next(petIdleChance) == 0)
48895 {
48896 int num = 3;
48897 if (type == 638)
48898 {
48899 num = 2;
48900 }
48902 {
48903 num = 0;
48904 }
48905 ai[0] = ((num == 0) ? 20 : Main.rand.Next(20, 20 + num));
48906 ai[1] = 200 + Main.rand.Next(300);
48907 if (ai[0] == 20f && type == 637)
48908 {
48909 ai[1] = 500 + Main.rand.Next(200);
48910 }
48911 if (ai[0] == 21f && type == 638)
48912 {
48913 ai[1] = 100 + Main.rand.Next(100);
48914 }
48915 if (ai[0] == 22f && type == 656)
48916 {
48917 ai[1] = 200 + Main.rand.Next(200);
48918 }
48919 if (ai[0] == 20f && NPCID.Sets.IsTownSlime[type])
48920 {
48921 ai[1] = 180 + Main.rand.Next(240);
48922 }
48923 ai[2] = 0f;
48924 localAI[3] = 0f;
48925 netUpdate = true;
48926 }
48927 }
48928
48930 {
48931 int num = (int)base.Center.X / 16;
48932 int num2 = (int)base.Center.Y / 16;
48933 int num3 = 0;
48934 for (int i = num - 1; i <= num + 1; i++)
48935 {
48936 for (int j = num2 - 1; j <= num2 + 1; j++)
48937 {
48939 if ((!tileSafely.active() || !Main.tileSolid[tileSafely.type] || TileID.Sets.Platforms[tileSafely.type]) && tileSafely.wall > 0)
48940 {
48941 num3++;
48942 if (num3 > 4)
48943 {
48944 return true;
48945 }
48946 }
48947 }
48948 }
48949 return false;
48950 }
48951
48953 {
48954 if (Main.remixWorld)
48955 {
48956 return position.Y / 16f > (float)(Main.maxTilesY - 350);
48957 }
48958 if (Main.dayTime)
48959 {
48961 }
48962 return false;
48963 }
48964
48965 private void AI_003_Fighters()
48966 {
48967 if (Main.player[target].position.Y + (float)Main.player[target].height == position.Y + (float)height)
48968 {
48969 directionY = -1;
48970 }
48971 bool flag = false;
48972 if (type == 624 && AI_003_Gnomes_ShouldTurnToStone())
48973 {
48974 int num = (int)(base.Center.X / 16f);
48975 int num2 = (int)(base.Bottom.Y / 16f);
48977 int num3 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, Color.White, 0.5f);
48978 Main.dust[num3].velocity *= 0.2f;
48981 {
48982 for (int i = 0; i < 5; i++)
48983 {
48985 int num4 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, Color.White, 0.5f);
48986 Main.dust[num4].velocity *= 0.2f;
48988 }
48989 if (Main.netMode != 1 && TileObject.CanPlace(num, num2 - 1, 567, 0, direction, out var _, onlyCheck: true) && WorldGen.PlaceTile(num, num2 - 1, 567, mute: false, forced: false, -1, Main.rand.Next(5)))
48990 {
48991 if (Main.netMode == 2)
48992 {
48993 NetMessage.SendTileSquare(-1, num, num2 - 2, 1, 2);
48994 }
48995 if (Main.netMode != 1)
48996 {
48998 {
48999 Main.BestiaryTracker.Kills.RegisterKill(this);
49000 }
49002 }
49003 life = 0;
49004 active = false;
49006 return;
49007 }
49008 }
49009 }
49010 if (type == 466)
49011 {
49012 int num5 = 200;
49013 if (ai[2] == 0f)
49014 {
49015 alpha = num5;
49016 TargetClosest();
49017 if (!Main.player[target].dead && (Main.player[target].Center - base.Center).Length() < 170f)
49018 {
49019 ai[2] = -16f;
49020 }
49021 if (velocity.X != 0f || velocity.Y < 0f || velocity.Y > 2f || justHit)
49022 {
49023 ai[2] = -16f;
49024 }
49025 return;
49026 }
49027 if (ai[2] < 0f)
49028 {
49029 if (alpha > 0)
49030 {
49031 alpha -= num5 / 16;
49032 if (alpha < 0)
49033 {
49034 alpha = 0;
49035 }
49036 }
49037 ai[2] += 1f;
49038 if (ai[2] == 0f)
49039 {
49040 ai[2] = 1f;
49041 velocity.X = direction * 2;
49042 }
49043 return;
49044 }
49045 alpha = 0;
49046 }
49047 if (type == 166)
49048 {
49049 if (Main.netMode != 1 && Main.rand.Next(240) == 0)
49050 {
49051 ai[2] = Main.rand.Next(-480, -60);
49052 netUpdate = true;
49053 }
49054 if (ai[2] < 0f)
49055 {
49056 TargetClosest();
49057 if (justHit)
49058 {
49059 ai[2] = 0f;
49060 }
49061 if (Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
49062 {
49063 ai[2] = 0f;
49064 }
49065 }
49066 if (ai[2] < 0f)
49067 {
49068 velocity.X *= 0.9f;
49069 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
49070 {
49071 velocity.X = 0f;
49072 }
49073 ai[2] += 1f;
49074 if (ai[2] == 0f)
49075 {
49076 velocity.X = (float)direction * 0.1f;
49077 }
49078 return;
49079 }
49080 }
49081 if (type == 461)
49082 {
49083 if (wet)
49084 {
49085 knockBackResist = 0f;
49086 ai[3] = -0.10101f;
49087 noGravity = true;
49088 Vector2 center = base.Center;
49089 width = 34;
49090 height = 24;
49091 position.X = center.X - (float)(width / 2);
49092 position.Y = center.Y - (float)(height / 2);
49093 TargetClosest();
49094 if (collideX)
49095 {
49096 velocity.X = 0f - oldVelocity.X;
49097 }
49098 if (velocity.X < 0f)
49099 {
49100 direction = -1;
49101 }
49102 if (velocity.X > 0f)
49103 {
49104 direction = 1;
49105 }
49106 if (Collision.CanHit(position, width, height, Main.player[target].Center, 1, 1))
49107 {
49108 Vector2 vector = Main.player[target].Center - base.Center;
49109 vector.Normalize();
49110 vector *= 5f;
49111 velocity = (velocity * 19f + vector) / 20f;
49112 return;
49113 }
49114 float num6 = 5f;
49115 if (velocity.Y > 0f)
49116 {
49117 num6 = 3f;
49118 }
49119 if (velocity.Y < 0f)
49120 {
49121 num6 = 8f;
49122 }
49123 Vector2 vector2 = new Vector2(direction, -1f);
49124 vector2.Normalize();
49125 vector2 *= num6;
49126 if (num6 < 5f)
49127 {
49128 velocity = (velocity * 24f + vector2) / 25f;
49129 }
49130 else
49131 {
49132 velocity = (velocity * 9f + vector2) / 10f;
49133 }
49134 return;
49135 }
49136 knockBackResist = 0.4f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
49137 noGravity = false;
49138 Vector2 center2 = base.Center;
49139 width = 18;
49140 height = 40;
49141 position.X = center2.X - (float)(width / 2);
49142 position.Y = center2.Y - (float)(height / 2);
49143 if (ai[3] == -0.10101f)
49144 {
49145 ai[3] = 0f;
49146 float num7 = velocity.Length();
49147 num7 *= 2f;
49148 if (num7 > 10f)
49149 {
49150 num7 = 10f;
49151 }
49153 velocity *= num7;
49154 if (velocity.X < 0f)
49155 {
49156 direction = -1;
49157 }
49158 if (velocity.X > 0f)
49159 {
49160 direction = 1;
49161 }
49163 }
49164 }
49165 if (type == 586)
49166 {
49167 if (alpha == 255)
49168 {
49169 TargetClosest();
49171 velocity.Y = -6f;
49172 netUpdate = true;
49173 for (int j = 0; j < 35; j++)
49174 {
49176 dust.velocity *= 1f;
49177 dust.scale = 1f + Main.rand.NextFloat() * 0.5f;
49178 dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
49179 dust.velocity += velocity * 0.5f;
49180 }
49181 }
49182 alpha -= 15;
49183 if (alpha < 0)
49184 {
49185 alpha = 0;
49186 }
49188 if (alpha != 0)
49189 {
49190 for (int k = 0; k < 2; k++)
49191 {
49193 dust2.velocity *= 1f;
49194 dust2.scale = 1f + Main.rand.NextFloat() * 0.5f;
49195 dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
49196 dust2.velocity += velocity * 0.3f;
49197 }
49198 }
49199 if (Main.rand.Next(3) == 0)
49200 {
49202 dust3.velocity *= 0f;
49203 dust3.alpha = 120;
49204 dust3.scale = 0.7f + Main.rand.NextFloat() * 0.5f;
49205 dust3.velocity += velocity * 0.3f;
49206 }
49208 if (wet)
49209 {
49210 knockBackResist = 0f;
49211 ai[3] = -0.10101f;
49212 noGravity = true;
49213 Vector2 center3 = base.Center;
49214 position.X = center3.X - (float)(width / 2);
49215 position.Y = center3.Y - (float)(height / 2);
49216 TargetClosest();
49217 if (collideX)
49218 {
49219 velocity.X = 0f - oldVelocity.X;
49220 }
49221 if (velocity.X < 0f)
49222 {
49223 direction = -1;
49224 }
49225 if (velocity.X > 0f)
49226 {
49227 direction = 1;
49228 }
49229 if (Collision.CanHit(position, width, height, Main.player[target].Center, 1, 1))
49230 {
49231 Vector2 vector3 = Main.player[target].Center - base.Center;
49232 vector3.Normalize();
49233 float num8 = 1f;
49234 num8 += Math.Abs(base.Center.Y - Main.player[target].Center.Y) / 40f;
49235 num8 = MathHelper.Clamp(num8, 5f, 20f);
49236 vector3 *= num8;
49237 if (velocity.Y > 0f)
49238 {
49239 velocity = (velocity * 29f + vector3) / 30f;
49240 }
49241 else
49242 {
49243 velocity = (velocity * 4f + vector3) / 5f;
49244 }
49245 return;
49246 }
49247 float num9 = 5f;
49248 if (velocity.Y > 0f)
49249 {
49250 num9 = 3f;
49251 }
49252 if (velocity.Y < 0f)
49253 {
49254 num9 = 8f;
49255 }
49256 Vector2 vector4 = new Vector2(direction, -1f);
49257 vector4.Normalize();
49258 vector4 *= num9;
49259 if (num9 < 5f)
49260 {
49261 velocity = (velocity * 24f + vector4) / 25f;
49262 }
49263 else
49264 {
49265 velocity = (velocity * 9f + vector4) / 10f;
49266 }
49267 return;
49268 }
49269 noGravity = false;
49270 Vector2 center4 = base.Center;
49271 position.X = center4.X - (float)(width / 2);
49272 position.Y = center4.Y - (float)(height / 2);
49273 if (ai[3] == -0.10101f)
49274 {
49275 ai[3] = 0f;
49276 float num10 = velocity.Length();
49277 num10 *= 2f;
49278 if (num10 > 15f)
49279 {
49280 num10 = 15f;
49281 }
49283 velocity *= num10;
49284 if (velocity.X < 0f)
49285 {
49286 direction = -1;
49287 }
49288 if (velocity.X > 0f)
49289 {
49290 direction = 1;
49291 }
49293 }
49294 }
49295 if (type == 379 || type == 380)
49296 {
49297 if (ai[3] < 0f)
49298 {
49299 directionY = -1;
49300 flag = false;
49301 damage = 0;
49302 velocity.X *= 0.93f;
49303 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
49304 {
49305 velocity.X = 0f;
49306 }
49307 int num11 = (int)(0f - ai[3] - 1f);
49308 int num12 = Math.Sign(Main.npc[num11].Center.X - base.Center.X);
49309 if (num12 != direction)
49310 {
49311 velocity.X = 0f;
49312 direction = num12;
49313 netUpdate = true;
49314 }
49315 if (justHit && Main.netMode != 1 && Main.npc[num11].localAI[0] == 0f)
49316 {
49317 Main.npc[num11].localAI[0] = 1f;
49318 }
49319 if (ai[0] < 1000f)
49320 {
49321 ai[0] = 1000f;
49322 }
49323 if ((ai[0] += 1f) >= 1300f)
49324 {
49325 ai[0] = 1000f;
49326 netUpdate = true;
49327 }
49328 return;
49329 }
49330 if (ai[0] >= 1000f)
49331 {
49332 ai[0] = 0f;
49333 }
49334 damage = defDamage;
49335 }
49336 if (type == 383 && ai[2] == 0f && localAI[0] == 0f && Main.netMode != 1)
49337 {
49338 int num13 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 384, whoAmI);
49339 ai[2] = num13 + 1;
49340 localAI[0] = -1f;
49341 netUpdate = true;
49342 Main.npc[num13].ai[0] = whoAmI;
49343 Main.npc[num13].netUpdate = true;
49344 }
49345 if (type == 383)
49346 {
49347 int num14 = (int)ai[2] - 1;
49348 if (num14 != -1 && Main.npc[num14].active && Main.npc[num14].type == 384)
49349 {
49350 dontTakeDamage = true;
49351 }
49352 else
49353 {
49354 dontTakeDamage = false;
49355 ai[2] = 0f;
49356 if (localAI[0] == -1f)
49357 {
49358 localAI[0] = 180f;
49359 }
49360 if (localAI[0] > 0f)
49361 {
49362 localAI[0] -= 1f;
49363 }
49364 }
49365 }
49366 if (type == 482)
49367 {
49368 int num15 = 300;
49369 int num16 = 120;
49370 dontTakeDamage = false;
49371 if (ai[2] < 0f)
49372 {
49373 dontTakeDamage = true;
49374 ai[2] += 1f;
49375 velocity.X *= 0.9f;
49376 if ((double)Math.Abs(velocity.X) < 0.001)
49377 {
49378 velocity.X = 0.001f * (float)direction;
49379 }
49380 if (Math.Abs(velocity.Y) > 1f)
49381 {
49382 ai[2] += 10f;
49383 }
49384 if (ai[2] >= 0f)
49385 {
49386 netUpdate = true;
49387 velocity.X += (float)direction * 0.3f;
49388 }
49389 return;
49390 }
49391 if (ai[2] < (float)num15)
49392 {
49393 if (justHit)
49394 {
49395 ai[2] += 15f;
49396 }
49397 ai[2] += 1f;
49398 }
49399 else if (velocity.Y == 0f)
49400 {
49401 ai[2] = -num16;
49402 netUpdate = true;
49403 }
49404 }
49405 if (type == 631)
49406 {
49407 if (target < 0 || target == 255 || Main.player[target].dead || !Main.player[target].active)
49408 {
49409 TargetClosest(ai[2] > 0f);
49410 }
49411 Player player = Main.player[target];
49412 bool flag2 = !player.dead && player.active && base.Center.Distance(player.Center) < 320f;
49413 int num17 = 100;
49414 int num18 = 32;
49415 if (ai[2] == 0f)
49416 {
49417 ai[3] = 65f;
49418 if (flag2 && Collision.CanHit(player, this))
49419 {
49420 ai[2] = num17;
49421 ai[3] = 0f;
49422 velocity.X = (float)direction * 0.01f;
49423 netUpdate = true;
49424 }
49425 }
49426 else
49427 {
49428 if (ai[2] < (float)num17)
49429 {
49430 ai[2] += 1f;
49431 velocity.X *= 0.9f;
49432 if ((double)Math.Abs(velocity.X) < 0.001)
49433 {
49434 velocity.X = 0f;
49435 }
49436 if (Math.Abs(velocity.Y) > 1f)
49437 {
49438 ai[2] = 0f;
49439 }
49440 if (ai[2] == (float)(num17 - num18 / 2) && Main.netMode != 1 && !player.Hitbox.Intersects(base.Hitbox) && Collision.CanHit(player, this))
49441 {
49442 float num19 = 8f;
49443 Vector2 center5 = base.Center;
49445 if (vector5.HasNaNs())
49446 {
49447 vector5 = new Vector2((float)direction * num19, 0f);
49448 }
49449 int num20 = 20;
49450 Vector2 v = vector5 + Utils.RandomVector2(Main.rand, -0.8f, 0.8f);
49451 v = v.SafeNormalize(Vector2.Zero);
49452 v *= num19;
49454 }
49455 if (ai[2] >= (float)num17)
49456 {
49457 ai[2] = num17;
49458 ai[3] = 0f;
49459 velocity.X = (float)direction * 0.01f;
49460 netUpdate = true;
49461 }
49462 return;
49463 }
49464 if (velocity.Y == 0f && flag2 && (player.Hitbox.Intersects(base.Hitbox) || Collision.CanHit(player, this)))
49465 {
49466 ai[2] = num17 - num18;
49467 netUpdate = true;
49468 }
49469 }
49470 }
49471 if (type == 480)
49472 {
49473 int num21 = 180;
49474 int num22 = 300;
49475 int num23 = 180;
49476 int num24 = 60;
49477 int num25 = 20;
49478 if (life < lifeMax / 3)
49479 {
49480 num21 = 120;
49481 num22 = 240;
49482 num23 = 240;
49483 num24 = 90;
49484 }
49485 if (ai[2] > 0f)
49486 {
49487 ai[2] -= 1f;
49488 }
49489 else if (ai[2] == 0f)
49490 {
49491 if (((Main.player[target].Center.X < base.Center.X && direction < 0) || (Main.player[target].Center.X > base.Center.X && direction > 0)) && velocity.Y == 0f && Distance(Main.player[target].Center) < 900f && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
49492 {
49493 ai[2] = -num23 - num25;
49494 netUpdate = true;
49495 }
49496 }
49497 else
49498 {
49499 if (ai[2] < 0f && ai[2] < (float)(-num23))
49500 {
49502 velocity.X *= 0.9f;
49503 if (velocity.Y < -2f || velocity.Y > 4f || justHit)
49504 {
49505 ai[2] = num21;
49506 }
49507 else
49508 {
49509 ai[2] += 1f;
49510 if (ai[2] == 0f)
49511 {
49512 ai[2] = num22;
49513 }
49514 }
49515 float num26 = ai[2] + (float)num23 + (float)num25;
49516 if (num26 == 1f)
49517 {
49518 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 17);
49519 }
49520 if (num26 < (float)num25)
49521 {
49522 Vector2 vector6 = base.Top + new Vector2(spriteDirection * 6, 6f);
49523 float num27 = MathHelper.Lerp(20f, 30f, (num26 * 3f + 50f) / 182f);
49524 Main.rand.NextFloat();
49525 for (float num28 = 0f; num28 < 2f; num28 += 1f)
49526 {
49527 Vector2 vector7 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (Main.rand.NextFloat() * 0.5f + 0.5f);
49528 Dust obj = Main.dust[Dust.NewDust(vector6, 0, 0, 228)];
49529 obj.position = vector6 + vector7 * num27;
49530 obj.noGravity = true;
49531 obj.velocity = vector7 * 2f;
49532 obj.scale = 0.5f + Main.rand.NextFloat() * 0.5f;
49533 }
49534 }
49535 Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f);
49537 return;
49538 }
49539 if (ai[2] < 0f && ai[2] >= (float)(-num23))
49540 {
49542 Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f);
49543 velocity.X *= 0.9f;
49544 if (velocity.Y < -2f || velocity.Y > 4f || justHit)
49545 {
49546 ai[2] = num21;
49547 }
49548 else
49549 {
49550 ai[2] += 1f;
49551 if (ai[2] == 0f)
49552 {
49553 ai[2] = num22;
49554 }
49555 }
49556 float num29 = ai[2] + (float)num23;
49557 if (num29 < 180f && (Main.rand.Next(3) == 0 || ai[2] % 3f == 0f))
49558 {
49559 Vector2 vector8 = base.Top + new Vector2(spriteDirection * 10, 10f);
49560 float num30 = MathHelper.Lerp(20f, 30f, (num29 * 3f + 50f) / 182f);
49561 Main.rand.NextFloat();
49562 for (float num31 = 0f; num31 < 1f; num31 += 1f)
49563 {
49564 Vector2 vector9 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (Main.rand.NextFloat() * 0.5f + 0.5f);
49565 Dust obj2 = Main.dust[Dust.NewDust(vector8, 0, 0, 228)];
49566 obj2.position = vector8 + vector9 * num30;
49567 obj2.noGravity = true;
49568 obj2.velocity = vector9 * 4f;
49569 obj2.scale = 0.5f + Main.rand.NextFloat();
49570 }
49571 }
49573 if (Main.netMode == 2)
49574 {
49575 return;
49576 }
49578 _ = Main.myPlayer;
49579 if (player2.dead || !player2.active || player2.FindBuffIndex(156) != -1)
49580 {
49581 return;
49582 }
49583 Vector2 vector10 = player2.Center - base.Center;
49584 if (!(vector10.Length() < 700f))
49585 {
49586 return;
49587 }
49588 bool flag3 = vector10.Length() < 30f;
49589 if (!flag3)
49590 {
49591 float x = ((float)Math.PI / 4f).ToRotationVector2().X;
49593 if (vector11.X > x || vector11.X < 0f - x)
49594 {
49595 flag3 = true;
49596 }
49597 }
49598 if (((player2.Center.X < base.Center.X && direction < 0 && player2.direction > 0) || (player2.Center.X > base.Center.X && direction > 0 && player2.direction < 0)) && flag3 && (Collision.CanHitLine(base.Center, 1, 1, player2.Center, 1, 1) || Collision.CanHitLine(base.Center - Vector2.UnitY * 16f, 1, 1, player2.Center, 1, 1) || Collision.CanHitLine(base.Center + Vector2.UnitY * 8f, 1, 1, player2.Center, 1, 1)) && !player2.creativeGodMode)
49599 {
49600 player2.AddBuff(156, num24 + (int)ai[2] * -1);
49601 }
49602 return;
49603 }
49604 }
49605 }
49606 if (type == 471)
49607 {
49608 if (ai[3] < 0f)
49609 {
49610 knockBackResist = 0f;
49611 defense = (int)((double)defDefense * 1.1);
49612 noGravity = true;
49613 noTileCollide = true;
49614 if (velocity.X < 0f)
49615 {
49616 direction = -1;
49617 }
49618 else if (velocity.X > 0f)
49619 {
49620 direction = 1;
49621 }
49622 rotation = velocity.X * 0.1f;
49623 if (Main.netMode != 1)
49624 {
49625 localAI[3] += 1f;
49626 if (localAI[3] > (float)Main.rand.Next(20, 180))
49627 {
49628 localAI[3] = 0f;
49629 Vector2 center6 = base.Center;
49630 center6 += velocity;
49631 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)center6.X, (int)center6.Y, 30);
49632 }
49633 }
49634 }
49635 else
49636 {
49637 localAI[3] = 0f;
49638 knockBackResist = 0.35f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
49639 rotation *= 0.9f;
49641 noGravity = false;
49642 noTileCollide = false;
49643 }
49644 if (ai[3] == 1f)
49645 {
49646 knockBackResist = 0f;
49647 defense += 10;
49648 }
49649 if (ai[3] == -1f)
49650 {
49651 TargetClosest();
49652 float num32 = 8f;
49653 float num33 = 40f;
49654 Vector2 vector12 = Main.player[target].Center - base.Center;
49655 float num34 = vector12.Length();
49656 num32 += num34 / 200f;
49657 vector12.Normalize();
49658 vector12 *= num32;
49659 velocity = (velocity * (num33 - 1f) + vector12) / num33;
49661 {
49662 ai[3] = 0f;
49663 ai[2] = 0f;
49664 }
49665 return;
49666 }
49667 if (ai[3] == -2f)
49668 {
49669 velocity.Y -= 0.2f;
49670 if (velocity.Y < -10f)
49671 {
49672 velocity.Y = -10f;
49673 }
49674 if (Main.player[target].Center.Y - base.Center.Y > 200f)
49675 {
49676 TargetClosest();
49677 ai[3] = -3f;
49678 if (Main.player[target].Center.X > base.Center.X)
49679 {
49680 ai[2] = 1f;
49681 }
49682 else
49683 {
49684 ai[2] = -1f;
49685 }
49686 }
49687 velocity.X *= 0.99f;
49688 return;
49689 }
49690 if (ai[3] == -3f)
49691 {
49692 if (direction == 0)
49693 {
49694 TargetClosest();
49695 }
49696 if (ai[2] == 0f)
49697 {
49698 ai[2] = direction;
49699 }
49700 velocity.Y *= 0.9f;
49701 velocity.X += ai[2] * 0.3f;
49702 if (velocity.X > 10f)
49703 {
49704 velocity.X = 10f;
49705 }
49706 if (velocity.X < -10f)
49707 {
49708 velocity.X = -10f;
49709 }
49710 float num35 = Main.player[target].Center.X - base.Center.X;
49711 if ((ai[2] < 0f && num35 > 300f) || (ai[2] > 0f && num35 < -300f))
49712 {
49713 ai[3] = -4f;
49714 ai[2] = 0f;
49715 }
49716 else if (Math.Abs(num35) > 800f)
49717 {
49718 ai[3] = -1f;
49719 ai[2] = 0f;
49720 }
49721 return;
49722 }
49723 if (ai[3] == -4f)
49724 {
49725 ai[2] += 1f;
49726 velocity.Y += 0.1f;
49727 if (velocity.Length() > 4f)
49728 {
49729 velocity *= 0.9f;
49730 }
49731 int num36 = (int)base.Center.X / 16;
49732 int num37 = (int)(position.Y + (float)height + 12f) / 16;
49733 bool flag4 = false;
49734 for (int l = num36 - 1; l <= num36 + 1; l++)
49735 {
49736 if (Main.tile[l, num37] == null)
49737 {
49738 Main.tile[num36, num37] = new Tile();
49739 }
49740 if (Main.tile[l, num37].active() && Main.tileSolid[Main.tile[l, num37].type])
49741 {
49742 flag4 = true;
49743 }
49744 }
49746 {
49747 ai[3] = 0f;
49748 ai[2] = 0f;
49749 }
49750 else if (ai[2] > 300f || base.Center.Y > Main.player[target].Center.Y + 200f)
49751 {
49752 ai[3] = -1f;
49753 ai[2] = 0f;
49754 }
49755 }
49756 else
49757 {
49758 if (ai[3] == 1f)
49759 {
49760 Vector2 center7 = base.Center;
49761 center7.Y -= 70f;
49762 velocity.X *= 0.8f;
49763 ai[2] += 1f;
49764 if (ai[2] == 60f)
49765 {
49766 if (Main.netMode != 1)
49767 {
49768 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)center7.X, (int)center7.Y + 18, 472);
49769 }
49770 }
49771 else if (ai[2] >= 90f)
49772 {
49773 ai[3] = -2f;
49774 ai[2] = 0f;
49775 }
49776 for (int m = 0; m < 2; m++)
49777 {
49779 Vector2 vector14 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
49780 vector14.Normalize();
49781 vector14 *= (float)Main.rand.Next(0, 100) * 0.1f;
49783 vector14.Normalize();
49784 vector14 *= (float)Main.rand.Next(50, 90) * 0.1f;
49785 int num38 = Dust.NewDust(vector15, 1, 1, 27);
49786 Main.dust[num38].velocity = -vector14 * 0.3f;
49787 Main.dust[num38].alpha = 100;
49788 if (Main.rand.Next(2) == 0)
49789 {
49790 Main.dust[num38].noGravity = true;
49791 Main.dust[num38].scale += 0.3f;
49792 }
49793 }
49794 return;
49795 }
49796 ai[2] += 1f;
49797 int num39 = 10;
49798 if (velocity.Y == 0f && CountNPCS(472) < num39)
49799 {
49800 if (ai[2] >= 180f)
49801 {
49802 ai[2] = 0f;
49803 ai[3] = 1f;
49804 }
49805 }
49806 else
49807 {
49808 if (CountNPCS(472) >= num39)
49809 {
49810 ai[2] += 1f;
49811 }
49812 if (ai[2] >= 360f)
49813 {
49814 ai[2] = 0f;
49815 ai[3] = -2f;
49816 velocity.Y -= 3f;
49817 }
49818 }
49819 if (target >= 0 && !Main.player[target].dead && (Main.player[target].Center - base.Center).Length() > 800f)
49820 {
49821 ai[3] = -1f;
49822 ai[2] = 0f;
49823 }
49824 }
49825 if (Main.player[target].dead)
49826 {
49827 TargetClosest();
49828 if (Main.player[target].dead)
49829 {
49831 }
49832 }
49833 }
49834 if (type == 419)
49835 {
49836 reflectsProjectiles = false;
49838 int num40 = 6;
49839 int num41 = 10;
49840 float num42 = 16f;
49841 if (ai[2] > 0f)
49842 {
49843 ai[2] -= 1f;
49844 }
49845 if (ai[2] == 0f)
49846 {
49847 if (((Main.player[target].Center.X < base.Center.X && direction < 0) || (Main.player[target].Center.X > base.Center.X && direction > 0)) && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
49848 {
49849 ai[2] = -1f;
49850 netUpdate = true;
49851 TargetClosest();
49852 }
49853 }
49854 else
49855 {
49856 if (ai[2] < 0f && ai[2] > (float)(-num40))
49857 {
49858 ai[2] -= 1f;
49859 velocity.X *= 0.9f;
49860 return;
49861 }
49862 if (ai[2] == (float)(-num40))
49863 {
49864 ai[2] -= 1f;
49865 TargetClosest();
49866 Vector2 vector16 = DirectionTo(Main.player[target].Top + new Vector2(0f, -30f));
49867 if (vector16.HasNaNs())
49868 {
49870 }
49872 netUpdate = true;
49873 return;
49874 }
49875 if (ai[2] < (float)(-num40))
49876 {
49877 ai[2] -= 1f;
49878 if (velocity.Y == 0f)
49879 {
49880 ai[2] = 60f;
49881 }
49882 else if (ai[2] < (float)(-num40 - num41))
49883 {
49884 velocity.Y += 0.15f;
49885 if (velocity.Y > 24f)
49886 {
49887 velocity.Y = 24f;
49888 }
49889 }
49890 reflectsProjectiles = true;
49892 if (justHit)
49893 {
49894 ai[2] = 60f;
49895 netUpdate = true;
49896 }
49897 return;
49898 }
49899 }
49900 }
49901 if (type == 415)
49902 {
49903 int num43 = 42;
49904 int num44 = 18;
49905 if (justHit)
49906 {
49907 ai[2] = 120f;
49908 netUpdate = true;
49909 }
49910 if (ai[2] > 0f)
49911 {
49912 ai[2] -= 1f;
49913 }
49914 if (ai[2] == 0f)
49915 {
49916 int num45 = 0;
49917 for (int n = 0; n < 200; n++)
49918 {
49919 if (Main.npc[n].active && Main.npc[n].type == 516)
49920 {
49921 num45++;
49922 }
49923 }
49924 if (num45 > 6)
49925 {
49926 ai[2] = 90f;
49927 }
49928 else if (((Main.player[target].Center.X < base.Center.X && direction < 0) || (Main.player[target].Center.X > base.Center.X && direction > 0)) && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
49929 {
49930 ai[2] = -1f;
49931 netUpdate = true;
49932 TargetClosest();
49933 }
49934 }
49935 else if (ai[2] < 0f && ai[2] > (float)(-num43))
49936 {
49937 ai[2] -= 1f;
49938 if (ai[2] == (float)(-num43))
49939 {
49940 ai[2] = 180 + 30 * Main.rand.Next(10);
49941 }
49942 velocity.X *= 0.8f;
49943 if (ai[2] == (float)(-num44) || ai[2] == (float)(-num44 - 8) || ai[2] == (float)(-num44 - 16))
49944 {
49946 for (int num46 = 0; num46 < 20; num46++)
49947 {
49948 Vector2 vector17 = base.Center + Vector2.UnitX * spriteDirection * 40f;
49949 Dust obj3 = Main.dust[Dust.NewDust(vector17, 0, 0, 259)];
49950 Vector2 vector18 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
49951 obj3.position = vector17 + vector18 * 4f;
49952 obj3.velocity = vector18 * 2f + Vector2.UnitX * Main.rand.NextFloat() * spriteDirection * 3f;
49953 obj3.scale = 0.3f + vector18.X * (float)(-spriteDirection);
49954 obj3.fadeIn = 0.7f;
49955 obj3.noGravity = true;
49956 }
49958 if (velocity.X > -0.5f && velocity.X < 0.5f)
49959 {
49960 velocity.X = 0f;
49961 }
49962 if (Main.netMode != 1)
49963 {
49964 NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X + spriteDirection * 45, (int)base.Center.Y + 8, 516, 0, 0f, 0f, 0f, 0f, target);
49965 }
49966 }
49967 return;
49968 }
49969 }
49970 if (type == 428)
49971 {
49972 localAI[0] += 1f;
49973 if (localAI[0] >= 300f)
49974 {
49975 int num47 = (int)base.Center.X / 16 - 1;
49976 int num48 = (int)base.Center.Y / 16 - 1;
49977 if (!Collision.SolidTiles(num47, num47 + 2, num48, num48 + 1) && Main.netMode != 1)
49978 {
49979 Transform(427);
49980 life = lifeMax;
49981 localAI[0] = 0f;
49982 return;
49983 }
49984 }
49985 int num49 = 0;
49986 num49 = ((localAI[0] < 60f) ? 16 : ((localAI[0] < 120f) ? 8 : ((localAI[0] < 180f) ? 4 : ((localAI[0] < 240f) ? 2 : ((!(localAI[0] < 300f)) ? 1 : 1)))));
49987 if (Main.rand.Next(num49) == 0)
49988 {
49991 dust4.noGravity = true;
49992 dust4.scale = 1f;
49993 dust4.noLight = true;
49994 dust4.velocity = DirectionFrom(dust4.position) * dust4.velocity.Length();
49995 dust4.position -= dust4.velocity * 5f;
49996 dust4.position.X += direction * 6;
49997 dust4.position.Y += 4f;
49999 }
50000 }
50001 if (type == 427)
50002 {
50003 localAI[0] += 1f;
50004 localAI[0] += Math.Abs(velocity.X) / 2f;
50005 if (localAI[0] >= 1200f && Main.netMode != 1)
50006 {
50007 int num50 = (int)base.Center.X / 16 - 2;
50008 int num51 = (int)base.Center.Y / 16 - 3;
50009 if (!Collision.SolidTiles(num50, num50 + 4, num51, num51 + 4))
50010 {
50011 Transform(426);
50012 life = lifeMax;
50013 localAI[0] = 0f;
50014 return;
50015 }
50016 }
50017 int num52 = 0;
50018 num52 = ((localAI[0] < 360f) ? 32 : ((localAI[0] < 720f) ? 16 : ((localAI[0] < 1080f) ? 6 : ((localAI[0] < 1440f) ? 2 : ((!(localAI[0] < 1800f)) ? 1 : 1)))));
50019 if (Main.rand.Next(num52) == 0)
50020 {
50023 obj4.noGravity = true;
50024 obj4.scale = 1f;
50025 obj4.noLight = true;
50027 }
50028 }
50029 if (type == 590)
50030 {
50032 int num53 = (int)(position.Y + 6f) / 16;
50033 if (spriteDirection < 0)
50034 {
50035 int num54 = (int)(base.Center.X - 22f) / 16;
50038 if (WorldGen.InWorld(num54, num53) && tileSafely2.liquid == 0 && tileSafely.liquid == 0)
50039 {
50040 Lighting.AddLight(num54, num53, 1f, 0.95f, 0.8f);
50041 if (Main.rand.Next(30) == 0)
50042 {
50043 Dust.NewDust(new Vector2(base.Center.X - 22f, position.Y + 6f), 1, 1, 6);
50044 }
50045 }
50046 }
50047 else
50048 {
50049 int num55 = (int)(base.Center.X + 14f) / 16;
50052 if (WorldGen.InWorld(num55, num53) && tileSafely4.liquid == 0 && tileSafely3.liquid == 0)
50053 {
50054 Lighting.AddLight(num55, num53, 1f, 0.95f, 0.8f);
50055 if (Main.rand.Next(30) == 0)
50056 {
50057 Dust.NewDust(new Vector2(base.Center.X + 14f, position.Y + 6f), 1, 1, 6);
50058 }
50059 }
50060 }
50062 }
50063 else if (type == 591)
50064 {
50066 if (!wet)
50067 {
50068 if (spriteDirection < 0)
50069 {
50070 Lighting.AddLight(new Vector2(base.Center.X - 36f, position.Y + 24f), 1f, 0.95f, 0.8f);
50071 if (ai[2] == 0f && Main.rand.Next(30) == 0)
50072 {
50073 Dust.NewDust(new Vector2(base.Center.X - 36f, position.Y + 24f), 1, 1, 6);
50074 }
50075 }
50076 else
50077 {
50078 Lighting.AddLight(new Vector2(base.Center.X + 28f, position.Y + 24f), 1f, 0.95f, 0.8f);
50079 if (ai[2] == 0f && Main.rand.Next(30) == 0)
50080 {
50081 Dust.NewDust(new Vector2(base.Center.X + 28f, position.Y + 24f), 1, 1, 6);
50082 }
50083 }
50084 }
50086 }
50087 bool flag5 = false;
50088 bool flag6 = false;
50089 if (velocity.X == 0f)
50090 {
50091 flag6 = true;
50092 }
50093 if (justHit)
50094 {
50095 flag6 = false;
50096 }
50097 if (Main.netMode != 1 && type == 198 && (double)life <= (double)lifeMax * 0.55)
50098 {
50099 Transform(199);
50100 }
50101 if (Main.netMode != 1 && type == 348 && (double)life <= (double)lifeMax * 0.55)
50102 {
50103 Transform(349);
50104 }
50105 int num56 = 60;
50106 if (type == 120)
50107 {
50108 num56 = 180;
50109 if (ai[3] == -120f)
50110 {
50111 velocity *= 0f;
50112 ai[3] = 0f;
50115 Vector2 vector19 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
50116 float num57 = oldPos[2].X + (float)width * 0.5f - vector19.X;
50117 float num58 = oldPos[2].Y + (float)height * 0.5f - vector19.Y;
50118 float num59 = (float)Math.Sqrt(num57 * num57 + num58 * num58);
50119 num59 = 2f / num59;
50120 num57 *= num59;
50121 num58 *= num59;
50122 for (int num60 = 0; num60 < 20; num60++)
50123 {
50124 int num61 = Dust.NewDust(position, width, height, 71, num57, num58, 200, default(Color), 2f);
50125 Main.dust[num61].noGravity = true;
50126 Main.dust[num61].velocity.X *= 2f;
50127 }
50128 for (int num62 = 0; num62 < 20; num62++)
50129 {
50130 int num63 = Dust.NewDust(oldPos[2], width, height, 71, 0f - num57, 0f - num58, 200, default(Color), 2f);
50131 Main.dust[num63].noGravity = true;
50132 Main.dust[num63].velocity.X *= 2f;
50133 }
50135 }
50136 }
50137 bool flag7 = false;
50138 bool flag8 = true;
50139 if (type == 343 || type == 47 || type == 67 || type == 109 || type == 110 || type == 111 || type == 120 || type == 163 || type == 164 || type == 239 || type == 168 || type == 199 || type == 206 || type == 214 || type == 215 || type == 216 || type == 217 || type == 218 || type == 219 || type == 220 || type == 226 || type == 243 || type == 251 || type == 257 || type == 258 || type == 290 || type == 291 || type == 292 || type == 293 || type == 305 || type == 306 || type == 307 || type == 308 || type == 309 || type == 348 || type == 349 || type == 350 || type == 351 || type == 379 || (type >= 430 && type <= 436) || type == 591 || type == 380 || type == 381 || type == 382 || type == 383 || type == 386 || type == 391 || (type >= 449 && type <= 452) || type == 466 || type == 464 || type == 166 || type == 469 || type == 468 || type == 471 || type == 470 || type == 480 || type == 481 || type == 482 || type == 411 || type == 424 || type == 409 || (type >= 494 && type <= 506) || type == 425 || type == 427 || type == 426 || type == 428 || type == 580 || type == 508 || type == 415 || type == 419 || type == 520 || (type >= 524 && type <= 527) || type == 528 || type == 529 || type == 530 || type == 532 || type == 582 || type == 624 || type == 631)
50140 {
50141 flag8 = false;
50142 }
50143 bool flag9 = false;
50144 int num64 = type;
50145 if (num64 == 425 || num64 == 471)
50146 {
50147 flag9 = true;
50148 }
50149 bool flag10 = true;
50150 switch (type)
50151 {
50152 case 110:
50153 case 111:
50154 case 206:
50155 case 214:
50156 case 215:
50157 case 216:
50158 case 291:
50159 case 292:
50160 case 293:
50161 case 350:
50162 case 379:
50163 case 380:
50164 case 381:
50165 case 382:
50166 case 409:
50167 case 411:
50168 case 424:
50169 case 426:
50170 case 466:
50171 case 498:
50172 case 499:
50173 case 500:
50174 case 501:
50175 case 502:
50176 case 503:
50177 case 504:
50178 case 505:
50179 case 506:
50180 case 520:
50181 if (ai[2] > 0f)
50182 {
50183 flag10 = false;
50184 }
50185 break;
50186 }
50187 if (!flag9 && flag10)
50188 {
50189 if (velocity.Y == 0f && ((velocity.X > 0f && direction < 0) || (velocity.X < 0f && direction > 0)))
50190 {
50191 flag7 = true;
50192 }
50193 if (position.X == oldPosition.X || ai[3] >= (float)num56 || flag7)
50194 {
50195 ai[3] += 1f;
50196 }
50197 else if ((double)Math.Abs(velocity.X) > 0.9 && ai[3] > 0f)
50198 {
50199 ai[3] -= 1f;
50200 }
50201 if (ai[3] > (float)(num56 * 10))
50202 {
50203 ai[3] = 0f;
50204 }
50205 if (justHit)
50206 {
50207 ai[3] = 0f;
50208 }
50209 if (ai[3] == (float)num56)
50210 {
50211 netUpdate = true;
50212 }
50213 if (Main.player[target].Hitbox.Intersects(base.Hitbox))
50214 {
50215 ai[3] = 0f;
50216 }
50217 }
50218 if (type == 463 && Main.netMode != 1)
50219 {
50220 if (localAI[3] > 0f)
50221 {
50222 localAI[3] -= 1f;
50223 }
50224 if (justHit && localAI[3] <= 0f && Main.rand.Next(3) == 0)
50225 {
50226 localAI[3] = 30f;
50227 int num65 = Main.rand.Next(3, 6);
50228 int[] array = new int[num65];
50229 int num66 = 0;
50230 for (int num67 = 0; num67 < 255; num67++)
50231 {
50232 if (Main.player[num67].active && !Main.player[num67].dead && Collision.CanHitLine(position, width, height, Main.player[num67].position, Main.player[num67].width, Main.player[num67].height))
50233 {
50234 array[num66] = num67;
50235 num66++;
50236 if (num66 == num65)
50237 {
50238 break;
50239 }
50240 }
50241 }
50242 if (num66 > 1)
50243 {
50244 for (int num68 = 0; num68 < 100; num68++)
50245 {
50246 int num69 = Main.rand.Next(num66);
50247 int num70;
50248 for (num70 = num69; num70 == num69; num70 = Main.rand.Next(num66))
50249 {
50250 }
50251 int num71 = array[num69];
50252 array[num69] = array[num70];
50253 array[num70] = num71;
50254 }
50255 }
50256 Vector2 vector20 = new Vector2(-1f, -1f);
50257 for (int num72 = 0; num72 < num66; num72++)
50258 {
50259 Vector2 vector21 = Main.npc[array[num72]].Center - base.Center;
50260 vector21.Normalize();
50261 vector20 += vector21;
50262 }
50263 vector20.Normalize();
50264 for (int num73 = 0; num73 < num65; num73++)
50265 {
50266 float num74 = Main.rand.Next(8, 13);
50267 Vector2 vector22 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
50268 vector22.Normalize();
50269 if (num66 > 0)
50270 {
50271 vector22 += vector20;
50272 vector22.Normalize();
50273 }
50274 vector22 *= num74;
50275 if (num66 > 0)
50276 {
50277 num66--;
50278 vector22 = Main.player[array[num66]].Center - base.Center;
50279 vector22.Normalize();
50280 vector22 *= num74;
50281 }
50282 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, position.Y + (float)(width / 4), vector22.X, vector22.Y, 498, (int)((double)damage * 0.15), 1f, Main.myPlayer);
50283 }
50284 }
50285 }
50286 if (type == 460)
50287 {
50288 if (velocity.Y < 0f - gravity || velocity.Y > gravity)
50289 {
50290 knockBackResist = 0f;
50291 }
50292 else
50293 {
50294 knockBackResist = 0.25f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
50295 }
50296 }
50297 if (type == 469)
50298 {
50299 knockBackResist = 0.45f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
50300 if (ai[2] == 1f)
50301 {
50302 knockBackResist = 0f;
50303 }
50304 bool flag11 = false;
50305 int num75 = (int)base.Center.X / 16;
50306 int num76 = (int)base.Center.Y / 16;
50307 for (int num77 = num75 - 1; num77 <= num75 + 1; num77++)
50308 {
50309 for (int num78 = num76 - 1; num78 <= num76 + 1; num78++)
50310 {
50311 if (Main.tile[num77, num78] != null && Main.tile[num77, num78].wall > 0)
50312 {
50313 flag11 = true;
50314 break;
50315 }
50316 }
50317 if (flag11)
50318 {
50319 break;
50320 }
50321 }
50322 if (ai[2] == 0f && flag11)
50323 {
50324 if (velocity.Y == 0f)
50325 {
50326 flag = true;
50327 velocity.Y = -4.6f;
50328 velocity.X *= 1.3f;
50329 }
50330 else if (velocity.Y > 0f && !Main.player[target].dead)
50331 {
50332 ai[2] = 1f;
50333 }
50334 }
50335 if (flag11 && ai[2] == 1f && !Main.player[target].dead && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
50336 {
50337 Vector2 vector23 = Main.player[target].Center - base.Center;
50338 float num79 = vector23.Length();
50339 vector23.Normalize();
50340 vector23 *= 4.5f + num79 / 300f;
50341 velocity = (velocity * 29f + vector23) / 30f;
50342 noGravity = true;
50343 ai[2] = 1f;
50344 return;
50345 }
50346 noGravity = false;
50347 ai[2] = 0f;
50348 }
50349 if (type == 462 && velocity.Y == 0f && (Main.player[target].Center - base.Center).Length() < 150f && Math.Abs(velocity.X) > 3f && ((velocity.X < 0f && base.Center.X > Main.player[target].Center.X) || (velocity.X > 0f && base.Center.X < Main.player[target].Center.X)))
50350 {
50351 flag = true;
50352 velocity.X *= 1.75f;
50353 velocity.Y -= 4.5f;
50354 if (base.Center.Y - Main.player[target].Center.Y > 20f)
50355 {
50356 velocity.Y -= 0.5f;
50357 }
50358 if (base.Center.Y - Main.player[target].Center.Y > 40f)
50359 {
50360 velocity.Y -= 1f;
50361 }
50362 if (base.Center.Y - Main.player[target].Center.Y > 80f)
50363 {
50364 velocity.Y -= 1.5f;
50365 }
50366 if (base.Center.Y - Main.player[target].Center.Y > 100f)
50367 {
50368 velocity.Y -= 1.5f;
50369 }
50370 if (Math.Abs(velocity.X) > 7f)
50371 {
50372 if (velocity.X < 0f)
50373 {
50374 velocity.X = -7f;
50375 }
50376 else
50377 {
50378 velocity.X = 7f;
50379 }
50380 }
50381 }
50382 if (type == 624 && target < 255)
50383 {
50385 {
50386 ai[3] = num56;
50387 directionY = -1;
50388 if (type == 624 && !AI_003_Gnomes_ShouldTurnToStone() && (base.Center - Main.player[target].Center).Length() > 500f)
50389 {
50390 velocity.X *= 0.95f;
50391 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
50392 {
50393 velocity.X = 0f;
50394 }
50395 return;
50396 }
50397 }
50398 else if (Main.player[target].Center.Y > base.Center.Y - 128f)
50399 {
50400 ai[3] = 0f;
50401 }
50402 }
50404 {
50405 if (shimmerTransparency < 1f)
50406 {
50407 if ((type == 3 || type == 591 || type == 590 || type == 331 || type == 332 || type == 21 || (type >= 449 && type <= 452) || type == 31 || type == 294 || type == 295 || type == 296 || type == 77 || type == 110 || type == 132 || type == 167 || type == 161 || type == 162 || type == 186 || type == 187 || type == 188 || type == 189 || type == 197 || type == 200 || type == 201 || type == 202 || type == 203 || type == 223 || type == 291 || type == 292 || type == 293 || type == 320 || type == 321 || type == 319 || type == 481 || type == 632 || type == 635) && Main.rand.Next(1000) == 0)
50408 {
50409 SoundEngine.PlaySound(14, (int)position.X, (int)position.Y);
50410 }
50411 if ((type == 489 || type == 586) && Main.rand.Next(800) == 0)
50412 {
50413 SoundEngine.PlaySound(14, (int)position.X, (int)position.Y, type);
50414 }
50415 if ((type == 78 || type == 79 || type == 80 || type == 630) && Main.rand.Next(500) == 0)
50416 {
50417 SoundEngine.PlaySound(26, (int)position.X, (int)position.Y);
50418 }
50419 if (type == 159 && Main.rand.Next(500) == 0)
50420 {
50421 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 7);
50422 }
50423 if (type == 162 && Main.rand.Next(500) == 0)
50424 {
50425 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 6);
50426 }
50427 if (type == 181 && Main.rand.Next(500) == 0)
50428 {
50429 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 8);
50430 }
50431 if (type >= 269 && type <= 280 && Main.rand.Next(1000) == 0)
50432 {
50433 SoundEngine.PlaySound(14, (int)position.X, (int)position.Y);
50434 }
50435 }
50436 TargetClosest();
50437 if (directionY > 0 && Main.player[target].Center.Y <= base.Bottom.Y)
50438 {
50439 directionY = -1;
50440 }
50441 }
50443 {
50444 if (Main.IsItDay() && (double)(position.Y / 16f) < Main.worldSurface && type != 624 && type != 631)
50445 {
50446 EncourageDespawn(10);
50447 }
50448 if (velocity.X == 0f)
50449 {
50450 if (velocity.Y == 0f)
50451 {
50452 ai[0] += 1f;
50453 if (ai[0] >= 2f)
50454 {
50455 direction *= -1;
50457 ai[0] = 0f;
50458 }
50459 }
50460 }
50461 else
50462 {
50463 ai[0] = 0f;
50464 }
50465 if (direction == 0)
50466 {
50467 direction = 1;
50468 }
50469 }
50470 if (type == 159 || type == 349)
50471 {
50472 if (type == 159 && ((velocity.X > 0f && direction < 0) || (velocity.X < 0f && direction > 0)))
50473 {
50474 velocity.X *= 0.95f;
50475 }
50476 if (velocity.X < -6f || velocity.X > 6f)
50477 {
50478 if (velocity.Y == 0f)
50479 {
50480 velocity *= 0.8f;
50481 }
50482 }
50483 else if (velocity.X < 6f && direction == 1)
50484 {
50485 if (velocity.Y == 0f && velocity.X < 0f)
50486 {
50487 velocity.X *= 0.99f;
50488 }
50489 velocity.X += 0.07f;
50490 if (velocity.X > 6f)
50491 {
50492 velocity.X = 6f;
50493 }
50494 }
50495 else if (velocity.X > -6f && direction == -1)
50496 {
50497 if (velocity.Y == 0f && velocity.X > 0f)
50498 {
50499 velocity.X *= 0.99f;
50500 }
50501 velocity.X -= 0.07f;
50502 if (velocity.X < -6f)
50503 {
50504 velocity.X = -6f;
50505 }
50506 }
50507 }
50508 else if (type == 199)
50509 {
50510 if (velocity.X < -4f || velocity.X > 4f)
50511 {
50512 if (velocity.Y == 0f)
50513 {
50514 velocity *= 0.8f;
50515 }
50516 }
50517 else if (velocity.X < 4f && direction == 1)
50518 {
50519 if (velocity.Y == 0f && velocity.X < 0f)
50520 {
50521 velocity.X *= 0.8f;
50522 }
50523 velocity.X += 0.1f;
50524 if (velocity.X > 4f)
50525 {
50526 velocity.X = 4f;
50527 }
50528 }
50529 else if (velocity.X > -4f && direction == -1)
50530 {
50531 if (velocity.Y == 0f && velocity.X > 0f)
50532 {
50533 velocity.X *= 0.8f;
50534 }
50535 velocity.X -= 0.1f;
50536 if (velocity.X < -4f)
50537 {
50538 velocity.X = -4f;
50539 }
50540 }
50541 }
50542 else if (type == 120 || type == 166 || type == 213 || type == 258 || type == 528 || type == 529)
50543 {
50544 if (velocity.X < -3f || velocity.X > 3f)
50545 {
50546 if (velocity.Y == 0f)
50547 {
50548 velocity *= 0.8f;
50549 }
50550 }
50551 else if (velocity.X < 3f && direction == 1)
50552 {
50553 if (velocity.Y == 0f && velocity.X < 0f)
50554 {
50555 velocity.X *= 0.99f;
50556 }
50557 velocity.X += 0.07f;
50558 if (velocity.X > 3f)
50559 {
50560 velocity.X = 3f;
50561 }
50562 }
50563 else if (velocity.X > -3f && direction == -1)
50564 {
50565 if (velocity.Y == 0f && velocity.X > 0f)
50566 {
50567 velocity.X *= 0.99f;
50568 }
50569 velocity.X -= 0.07f;
50570 if (velocity.X < -3f)
50571 {
50572 velocity.X = -3f;
50573 }
50574 }
50575 }
50576 else if (type == 461 || type == 27 || type == 77 || type == 104 || type == 163 || type == 162 || type == 196 || type == 197 || type == 212 || type == 257 || type == 326 || type == 343 || type == 348 || type == 351 || (type >= 524 && type <= 527) || type == 530 || type == 236)
50577 {
50578 if (velocity.X < -2f || velocity.X > 2f)
50579 {
50580 if (velocity.Y == 0f)
50581 {
50582 velocity *= 0.8f;
50583 }
50584 }
50585 else if (velocity.X < 2f && direction == 1)
50586 {
50587 velocity.X += 0.07f;
50588 if (velocity.X > 2f)
50589 {
50590 velocity.X = 2f;
50591 }
50592 }
50593 else if (velocity.X > -2f && direction == -1)
50594 {
50595 velocity.X -= 0.07f;
50596 if (velocity.X < -2f)
50597 {
50598 velocity.X = -2f;
50599 }
50600 }
50601 }
50602 else if (type == 109)
50603 {
50604 if (velocity.X < -2f || velocity.X > 2f)
50605 {
50606 if (velocity.Y == 0f)
50607 {
50608 velocity *= 0.8f;
50609 }
50610 }
50611 else if (velocity.X < 2f && direction == 1)
50612 {
50613 velocity.X += 0.04f;
50614 if (velocity.X > 2f)
50615 {
50616 velocity.X = 2f;
50617 }
50618 }
50619 else if (velocity.X > -2f && direction == -1)
50620 {
50621 velocity.X -= 0.04f;
50622 if (velocity.X < -2f)
50623 {
50624 velocity.X = -2f;
50625 }
50626 }
50627 }
50628 else if (type == 21 || type == 26 || type == 31 || type == 294 || type == 295 || type == 296 || type == 47 || type == 73 || type == 140 || type == 164 || type == 239 || type == 167 || type == 168 || type == 185 || type == 198 || type == 201 || type == 202 || type == 203 || type == 217 || type == 218 || type == 219 || type == 226 || type == 181 || type == 254 || type == 338 || type == 339 || type == 340 || type == 342 || type == 385 || type == 389 || type == 462 || type == 463 || type == 466 || type == 464 || type == 469 || type == 470 || type == 480 || type == 482 || type == 425 || type == 429 || type == 586 || type == 631 || type == 635)
50629 {
50630 float num80 = 1.5f;
50631 if (type == 181 && Main.remixWorld)
50632 {
50633 num80 = 3.75f;
50634 }
50635 else if (type == 294)
50636 {
50637 num80 = 2f;
50638 }
50639 else if (type == 295)
50640 {
50641 num80 = 1.75f;
50642 }
50643 else if (type == 296)
50644 {
50645 num80 = 1.25f;
50646 }
50647 else if (type == 201)
50648 {
50649 num80 = 1.1f;
50650 }
50651 else if (type == 202)
50652 {
50653 num80 = 0.9f;
50654 }
50655 else if (type == 203)
50656 {
50657 num80 = 1.2f;
50658 }
50659 else if (type == 338)
50660 {
50661 num80 = 1.75f;
50662 }
50663 else if (type == 339)
50664 {
50665 num80 = 1.25f;
50666 }
50667 else if (type == 340)
50668 {
50669 num80 = 2f;
50670 }
50671 else if (type == 385)
50672 {
50673 num80 = 1.8f;
50674 }
50675 else if (type == 389)
50676 {
50677 num80 = 2.25f;
50678 }
50679 else if (type == 462)
50680 {
50681 num80 = 4f;
50682 }
50683 else if (type == 463)
50684 {
50685 num80 = 0.75f;
50686 }
50687 else if (type == 466)
50688 {
50689 num80 = 3.75f;
50690 }
50691 else if (type == 469)
50692 {
50693 num80 = 3.25f;
50694 }
50695 else if (type == 480)
50696 {
50697 num80 = 1.5f + (1f - (float)life / (float)lifeMax) * 2f;
50698 }
50699 else if (type == 425)
50700 {
50701 num80 = 6f;
50702 }
50703 else if (type == 429)
50704 {
50705 num80 = 4f;
50706 }
50707 else if (type == 631)
50708 {
50709 num80 = 0.9f;
50710 }
50711 else if (type == 586)
50712 {
50713 num80 = 1.5f + (1f - (float)life / (float)lifeMax) * 3.5f;
50714 }
50715 if (type == 21 || type == 201 || type == 202 || type == 203 || type == 342 || type == 635)
50716 {
50717 num80 *= 1f + (1f - scale);
50718 }
50719 if (velocity.X < 0f - num80 || velocity.X > num80)
50720 {
50721 if (velocity.Y == 0f)
50722 {
50723 velocity *= 0.8f;
50724 }
50725 }
50726 else if (velocity.X < num80 && direction == 1)
50727 {
50728 if (type == 466 && velocity.X < -2f)
50729 {
50730 velocity.X *= 0.9f;
50731 }
50732 if (type == 586 && velocity.Y == 0f && velocity.X < -1f)
50733 {
50734 velocity.X *= 0.9f;
50735 }
50736 velocity.X += 0.07f;
50737 if (velocity.X > num80)
50738 {
50739 velocity.X = num80;
50740 }
50741 }
50742 else if (velocity.X > 0f - num80 && direction == -1)
50743 {
50744 if (type == 466 && velocity.X > 2f)
50745 {
50746 velocity.X *= 0.9f;
50747 }
50748 if (type == 586 && velocity.Y == 0f && velocity.X > 1f)
50749 {
50750 velocity.X *= 0.9f;
50751 }
50752 velocity.X -= 0.07f;
50753 if (velocity.X < 0f - num80)
50754 {
50755 velocity.X = 0f - num80;
50756 }
50757 }
50758 if (velocity.Y == 0f && type == 462 && ((direction > 0 && velocity.X < 0f) || (direction < 0 && velocity.X > 0f)))
50759 {
50760 velocity.X *= 0.9f;
50761 }
50762 }
50763 else if (type >= 269 && type <= 280)
50764 {
50765 float num81 = 1.5f;
50766 if (type == 269)
50767 {
50768 num81 = 2f;
50769 }
50770 if (type == 270)
50771 {
50772 num81 = 1f;
50773 }
50774 if (type == 271)
50775 {
50776 num81 = 1.5f;
50777 }
50778 if (type == 272)
50779 {
50780 num81 = 3f;
50781 }
50782 if (type == 273)
50783 {
50784 num81 = 1.25f;
50785 }
50786 if (type == 274)
50787 {
50788 num81 = 3f;
50789 }
50790 if (type == 275)
50791 {
50792 num81 = 3.25f;
50793 }
50794 if (type == 276)
50795 {
50796 num81 = 2f;
50797 }
50798 if (type == 277)
50799 {
50800 num81 = 2.75f;
50801 }
50802 if (type == 278)
50803 {
50804 num81 = 1.8f;
50805 }
50806 if (type == 279)
50807 {
50808 num81 = 1.3f;
50809 }
50810 if (type == 280)
50811 {
50812 num81 = 2.5f;
50813 }
50814 num81 *= 1f + (1f - scale);
50815 if (velocity.X < 0f - num81 || velocity.X > num81)
50816 {
50817 if (velocity.Y == 0f)
50818 {
50819 velocity *= 0.8f;
50820 }
50821 }
50822 else if (velocity.X < num81 && direction == 1)
50823 {
50824 velocity.X += 0.07f;
50825 if (velocity.X > num81)
50826 {
50827 velocity.X = num81;
50828 }
50829 }
50830 else if (velocity.X > 0f - num81 && direction == -1)
50831 {
50832 velocity.X -= 0.07f;
50833 if (velocity.X < 0f - num81)
50834 {
50835 velocity.X = 0f - num81;
50836 }
50837 }
50838 }
50839 else if (type >= 305 && type <= 314)
50840 {
50841 float num82 = 1.5f;
50842 if (type == 305 || type == 310)
50843 {
50844 num82 = 2f;
50845 }
50846 if (type == 306 || type == 311)
50847 {
50848 num82 = 1.25f;
50849 }
50850 if (type == 307 || type == 312)
50851 {
50852 num82 = 2.25f;
50853 }
50854 if (type == 308 || type == 313)
50855 {
50856 num82 = 1.5f;
50857 }
50858 if (type == 309 || type == 314)
50859 {
50860 num82 = 1f;
50861 }
50862 if (type < 310)
50863 {
50864 if (velocity.Y == 0f)
50865 {
50866 velocity.X *= 0.85f;
50867 if ((double)velocity.X > -0.3 && (double)velocity.X < 0.3)
50868 {
50869 flag = true;
50870 velocity.Y = -7f;
50871 velocity.X = num82 * (float)direction;
50872 }
50873 }
50874 else if (spriteDirection == direction)
50875 {
50876 velocity.X = (velocity.X * 10f + num82 * (float)direction) / 11f;
50877 }
50878 }
50879 else if (velocity.X < 0f - num82 || velocity.X > num82)
50880 {
50881 if (velocity.Y == 0f)
50882 {
50883 velocity *= 0.8f;
50884 }
50885 }
50886 else if (velocity.X < num82 && direction == 1)
50887 {
50888 velocity.X += 0.07f;
50889 if (velocity.X > num82)
50890 {
50891 velocity.X = num82;
50892 }
50893 }
50894 else if (velocity.X > 0f - num82 && direction == -1)
50895 {
50896 velocity.X -= 0.07f;
50897 if (velocity.X < 0f - num82)
50898 {
50899 velocity.X = 0f - num82;
50900 }
50901 }
50902 }
50903 else if (type == 67 || type == 220 || type == 428)
50904 {
50905 if (velocity.X < -0.5f || velocity.X > 0.5f)
50906 {
50907 if (velocity.Y == 0f)
50908 {
50909 velocity *= 0.7f;
50910 }
50911 }
50912 else if (velocity.X < 0.5f && direction == 1)
50913 {
50914 velocity.X += 0.03f;
50915 if (velocity.X > 0.5f)
50916 {
50917 velocity.X = 0.5f;
50918 }
50919 }
50920 else if (velocity.X > -0.5f && direction == -1)
50921 {
50922 velocity.X -= 0.03f;
50923 if (velocity.X < -0.5f)
50924 {
50925 velocity.X = -0.5f;
50926 }
50927 }
50928 }
50929 else if (type == 78 || type == 79 || type == 80 || type == 630)
50930 {
50931 float num83 = 1f;
50932 float num84 = 0.05f;
50933 if (life < lifeMax / 2)
50934 {
50935 num83 = 2f;
50936 num84 = 0.1f;
50937 }
50938 if (type == 79 || type == 630)
50939 {
50940 num83 *= 1.5f;
50941 }
50942 if (velocity.X < 0f - num83 || velocity.X > num83)
50943 {
50944 if (velocity.Y == 0f)
50945 {
50946 velocity *= 0.7f;
50947 }
50948 }
50949 else if (velocity.X < num83 && direction == 1)
50950 {
50951 velocity.X += num84;
50952 if (velocity.X > num83)
50953 {
50954 velocity.X = num83;
50955 }
50956 }
50957 else if (velocity.X > 0f - num83 && direction == -1)
50958 {
50959 velocity.X -= num84;
50960 if (velocity.X < 0f - num83)
50961 {
50962 velocity.X = 0f - num83;
50963 }
50964 }
50965 }
50966 else if (type == 287)
50967 {
50968 float num85 = 5f;
50969 float num86 = 0.2f;
50970 if (velocity.X < 0f - num85 || velocity.X > num85)
50971 {
50972 if (velocity.Y == 0f)
50973 {
50974 velocity *= 0.7f;
50975 }
50976 }
50977 else if (velocity.X < num85 && direction == 1)
50978 {
50979 velocity.X += num86;
50980 if (velocity.X > num85)
50981 {
50982 velocity.X = num85;
50983 }
50984 }
50985 else if (velocity.X > 0f - num85 && direction == -1)
50986 {
50987 velocity.X -= num86;
50988 if (velocity.X < 0f - num85)
50989 {
50990 velocity.X = 0f - num85;
50991 }
50992 }
50993 }
50994 else if (type == 243)
50995 {
50996 float num87 = 1f;
50997 float num88 = 0.07f;
50998 num87 += (1f - (float)life / (float)lifeMax) * 1.5f;
50999 num88 += (1f - (float)life / (float)lifeMax) * 0.15f;
51000 if (velocity.X < 0f - num87 || velocity.X > num87)
51001 {
51002 if (velocity.Y == 0f)
51003 {
51004 velocity *= 0.7f;
51005 }
51006 }
51007 else if (velocity.X < num87 && direction == 1)
51008 {
51009 velocity.X += num88;
51010 if (velocity.X > num87)
51011 {
51012 velocity.X = num87;
51013 }
51014 }
51015 else if (velocity.X > 0f - num87 && direction == -1)
51016 {
51017 velocity.X -= num88;
51018 if (velocity.X < 0f - num87)
51019 {
51020 velocity.X = 0f - num87;
51021 }
51022 }
51023 }
51024 else if (type == 251)
51025 {
51026 float num89 = 1f;
51027 float num90 = 0.08f;
51028 num89 += (1f - (float)life / (float)lifeMax) * 2f;
51029 num90 += (1f - (float)life / (float)lifeMax) * 0.2f;
51030 if (velocity.X < 0f - num89 || velocity.X > num89)
51031 {
51032 if (velocity.Y == 0f)
51033 {
51034 velocity *= 0.7f;
51035 }
51036 }
51037 else if (velocity.X < num89 && direction == 1)
51038 {
51039 velocity.X += num90;
51040 if (velocity.X > num89)
51041 {
51042 velocity.X = num89;
51043 }
51044 }
51045 else if (velocity.X > 0f - num89 && direction == -1)
51046 {
51047 velocity.X -= num90;
51048 if (velocity.X < 0f - num89)
51049 {
51050 velocity.X = 0f - num89;
51051 }
51052 }
51053 }
51054 else if (type == 386)
51055 {
51056 if (ai[2] > 0f)
51057 {
51058 if (velocity.Y == 0f)
51059 {
51060 velocity.X *= 0.8f;
51061 }
51062 }
51063 else
51064 {
51065 float num91 = 0.15f;
51066 float num92 = 1.5f;
51067 if (velocity.X < 0f - num92 || velocity.X > num92)
51068 {
51069 if (velocity.Y == 0f)
51070 {
51071 velocity *= 0.7f;
51072 }
51073 }
51074 else if (velocity.X < num92 && direction == 1)
51075 {
51076 velocity.X += num91;
51077 if (velocity.X > num92)
51078 {
51079 velocity.X = num92;
51080 }
51081 }
51082 else if (velocity.X > 0f - num92 && direction == -1)
51083 {
51084 velocity.X -= num91;
51085 if (velocity.X < 0f - num92)
51086 {
51087 velocity.X = 0f - num92;
51088 }
51089 }
51090 }
51091 }
51092 else if (type == 460)
51093 {
51094 float num93 = 3f;
51095 float num94 = 0.1f;
51096 if (Math.Abs(velocity.X) > 2f)
51097 {
51098 num94 *= 0.8f;
51099 }
51100 if ((double)Math.Abs(velocity.X) > 2.5)
51101 {
51102 num94 *= 0.8f;
51103 }
51104 if (Math.Abs(velocity.X) > 3f)
51105 {
51106 num94 *= 0.8f;
51107 }
51108 if ((double)Math.Abs(velocity.X) > 3.5)
51109 {
51110 num94 *= 0.8f;
51111 }
51112 if (Math.Abs(velocity.X) > 4f)
51113 {
51114 num94 *= 0.8f;
51115 }
51116 if ((double)Math.Abs(velocity.X) > 4.5)
51117 {
51118 num94 *= 0.8f;
51119 }
51120 if (Math.Abs(velocity.X) > 5f)
51121 {
51122 num94 *= 0.8f;
51123 }
51124 if ((double)Math.Abs(velocity.X) > 5.5)
51125 {
51126 num94 *= 0.8f;
51127 }
51128 num93 += (1f - (float)life / (float)lifeMax) * 3f;
51129 if (velocity.X < 0f - num93 || velocity.X > num93)
51130 {
51131 if (velocity.Y == 0f)
51132 {
51133 velocity *= 0.7f;
51134 }
51135 }
51136 else if (velocity.X < num93 && direction == 1)
51137 {
51138 if (velocity.X < 0f)
51139 {
51140 velocity.X *= 0.93f;
51141 }
51142 velocity.X += num94;
51143 if (velocity.X > num93)
51144 {
51145 velocity.X = num93;
51146 }
51147 }
51148 else if (velocity.X > 0f - num93 && direction == -1)
51149 {
51150 if (velocity.X > 0f)
51151 {
51152 velocity.X *= 0.93f;
51153 }
51154 velocity.X -= num94;
51155 if (velocity.X < 0f - num93)
51156 {
51157 velocity.X = 0f - num93;
51158 }
51159 }
51160 }
51161 else if (type == 508 || type == 580 || type == 582)
51162 {
51163 float num95 = 2.5f;
51164 float num96 = 10f;
51165 float num97 = Math.Abs(velocity.X);
51166 if (type == 582)
51167 {
51168 num95 = 2.25f;
51169 num96 = 7f;
51170 if (num97 > 2.5f)
51171 {
51172 num95 = 3f;
51173 num96 += 75f;
51174 }
51175 else if (num97 > 2f)
51176 {
51177 num95 = 2.75f;
51178 num96 += 55f;
51179 }
51180 }
51181 else if (num97 > 2.75f)
51182 {
51183 num95 = 3.5f;
51184 num96 += 80f;
51185 }
51186 else if ((double)num97 > 2.25)
51187 {
51188 num95 = 3f;
51189 num96 += 60f;
51190 }
51191 if ((double)Math.Abs(velocity.Y) < 0.5)
51192 {
51193 if (velocity.X > 0f && direction < 0)
51194 {
51195 velocity *= 0.95f;
51196 }
51197 if (velocity.X < 0f && direction > 0)
51198 {
51199 velocity *= 0.95f;
51200 }
51201 }
51202 if (Math.Abs(velocity.Y) > gravity)
51203 {
51204 float num98 = 3f;
51205 if (type == 582)
51206 {
51207 num98 = 2f;
51208 }
51209 num96 *= num98;
51210 }
51211 if (velocity.X <= 0f && direction < 0)
51212 {
51213 velocity.X = (velocity.X * num96 - num95) / (num96 + 1f);
51214 }
51215 else if (velocity.X >= 0f && direction > 0)
51216 {
51217 velocity.X = (velocity.X * num96 + num95) / (num96 + 1f);
51218 }
51219 else if (Math.Abs(base.Center.X - Main.player[target].Center.X) > 20f && Math.Abs(velocity.Y) <= gravity)
51220 {
51221 velocity.X *= 0.99f;
51222 velocity.X += (float)direction * 0.025f;
51223 }
51224 }
51225 else if (type == 391 || type == 427 || type == 415 || type == 419 || type == 518 || type == 532)
51226 {
51227 float num99 = 5f;
51228 float num100 = 0.25f;
51229 float num101 = 0.7f;
51230 if (type == 427)
51231 {
51232 num99 = 6f;
51233 num100 = 0.2f;
51234 num101 = 0.8f;
51235 }
51236 else if (type == 415)
51237 {
51238 num99 = 4f;
51239 num100 = 0.1f;
51240 num101 = 0.95f;
51241 }
51242 else if (type == 419)
51243 {
51244 num99 = 6f;
51245 num100 = 0.15f;
51246 num101 = 0.85f;
51247 }
51248 else if (type == 518)
51249 {
51250 num99 = 5f;
51251 num100 = 0.1f;
51252 num101 = 0.95f;
51253 }
51254 else if (type == 532)
51255 {
51256 num99 = 5f;
51257 num100 = 0.15f;
51258 num101 = 0.98f;
51259 }
51260 if (velocity.X < 0f - num99 || velocity.X > num99)
51261 {
51262 if (velocity.Y == 0f)
51263 {
51264 velocity *= num101;
51265 }
51266 }
51267 else if (velocity.X < num99 && direction == 1)
51268 {
51269 velocity.X += num100;
51270 if (velocity.X > num99)
51271 {
51272 velocity.X = num99;
51273 }
51274 }
51275 else if (velocity.X > 0f - num99 && direction == -1)
51276 {
51277 velocity.X -= num100;
51278 if (velocity.X < 0f - num99)
51279 {
51280 velocity.X = 0f - num99;
51281 }
51282 }
51283 }
51284 else if ((type >= 430 && type <= 436) || type == 494 || type == 495 || type == 591)
51285 {
51286 if (ai[2] == 0f)
51287 {
51288 damage = defDamage;
51289 float num102 = 1f;
51290 num102 *= 1f + (1f - scale);
51291 if (velocity.X < 0f - num102 || velocity.X > num102)
51292 {
51293 if (velocity.Y == 0f)
51294 {
51295 velocity *= 0.8f;
51296 }
51297 }
51298 else if (velocity.X < num102 && direction == 1)
51299 {
51300 velocity.X += 0.07f;
51301 if (velocity.X > num102)
51302 {
51303 velocity.X = num102;
51304 }
51305 }
51306 else if (velocity.X > 0f - num102 && direction == -1)
51307 {
51308 velocity.X -= 0.07f;
51309 if (velocity.X < 0f - num102)
51310 {
51311 velocity.X = 0f - num102;
51312 }
51313 }
51314 if (velocity.Y == 0f && (!Main.IsItDay() || (double)position.Y > Main.worldSurface * 16.0) && !Main.player[target].dead)
51315 {
51316 Vector2 vector24 = base.Center - Main.player[target].Center;
51317 int num103 = 50;
51318 if (type >= 494 && type <= 495)
51319 {
51320 num103 = 42;
51321 }
51322 if (vector24.Length() < (float)num103 && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
51323 {
51324 velocity.X *= 0.7f;
51325 ai[2] = 1f;
51326 }
51327 }
51328 }
51329 else
51330 {
51331 damage = (int)((double)defDamage * 1.5);
51332 ai[3] = 1f;
51333 velocity.X *= 0.9f;
51334 if ((double)Math.Abs(velocity.X) < 0.1)
51335 {
51336 velocity.X = 0f;
51337 }
51338 ai[2] += 1f;
51339 if (ai[2] >= 20f || velocity.Y != 0f || (Main.IsItDay() && (double)position.Y < Main.worldSurface * 16.0))
51340 {
51341 ai[2] = 0f;
51342 }
51343 }
51344 }
51345 else if (type != 110 && type != 111 && type != 206 && type != 214 && type != 215 && type != 216 && type != 290 && type != 291 && type != 292 && type != 293 && type != 350 && type != 379 && type != 380 && type != 381 && type != 382 && (type < 449 || type > 452) && type != 468 && type != 481 && type != 411 && type != 409 && (type < 498 || type > 506) && type != 424 && type != 426 && type != 520)
51346 {
51347 float num104 = 1f;
51348 if (type == 624)
51349 {
51350 num104 = 2.5f;
51351 }
51352 if (type == 186)
51353 {
51354 num104 = 1.1f;
51355 }
51356 if (type == 187)
51357 {
51358 num104 = 0.9f;
51359 }
51360 if (type == 188)
51361 {
51362 num104 = 1.2f;
51363 }
51364 if (type == 189)
51365 {
51366 num104 = 0.8f;
51367 }
51368 if (type == 132)
51369 {
51370 num104 = 0.95f;
51371 }
51372 if (type == 200)
51373 {
51374 num104 = 0.87f;
51375 }
51376 if (type == 223)
51377 {
51378 num104 = 1.05f;
51379 }
51380 if (type == 632)
51381 {
51382 num104 = 0.8f;
51383 }
51384 if (type == 489)
51385 {
51386 float num105 = (Main.player[target].Center - base.Center).Length();
51387 num105 *= 0.0025f;
51388 if ((double)num105 > 1.5)
51389 {
51390 num105 = 1.5f;
51391 }
51392 num104 = ((!Main.expertMode) ? (2.5f - num105) : (3f - num105));
51393 num104 *= 0.8f;
51394 }
51395 if (type == 489 || type == 3 || type == 132 || type == 186 || type == 187 || type == 188 || type == 189 || type == 200 || type == 223 || type == 331 || type == 332)
51396 {
51397 num104 *= 1f + (1f - scale);
51398 }
51399 if (velocity.X < 0f - num104 || velocity.X > num104)
51400 {
51401 if (velocity.Y == 0f)
51402 {
51403 velocity *= 0.8f;
51404 }
51405 }
51406 else if (velocity.X < num104 && direction == 1)
51407 {
51408 velocity.X += 0.07f;
51409 if (velocity.X > num104)
51410 {
51411 velocity.X = num104;
51412 }
51413 }
51414 else if (velocity.X > 0f - num104 && direction == -1)
51415 {
51416 velocity.X -= 0.07f;
51417 if (velocity.X < 0f - num104)
51418 {
51419 velocity.X = 0f - num104;
51420 }
51421 }
51422 }
51423 if (type >= 277 && type <= 280)
51424 {
51425 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.2f, 0.1f, 0f);
51426 }
51427 else if (type == 520)
51428 {
51429 Lighting.AddLight(base.Top + new Vector2(0f, 20f), 0.3f, 0.3f, 0.7f);
51430 }
51431 else if (type == 525)
51432 {
51433 Vector3 rgb = new Vector3(0.7f, 1f, 0.2f) * 0.5f;
51434 Lighting.AddLight(base.Top + new Vector2(0f, 15f), rgb);
51435 }
51436 else if (type == 526)
51437 {
51438 Vector3 rgb2 = new Vector3(1f, 1f, 0.5f) * 0.4f;
51439 Lighting.AddLight(base.Top + new Vector2(0f, 15f), rgb2);
51440 }
51441 else if (type == 527)
51442 {
51443 Vector3 rgb3 = new Vector3(0.6f, 0.3f, 1f) * 0.4f;
51444 Lighting.AddLight(base.Top + new Vector2(0f, 15f), rgb3);
51445 }
51446 else if (type == 415)
51447 {
51448 hide = false;
51449 for (int num106 = 0; num106 < 200; num106++)
51450 {
51451 if (Main.npc[num106].active && Main.npc[num106].type == 416 && Main.npc[num106].ai[0] == (float)whoAmI)
51452 {
51453 hide = true;
51454 break;
51455 }
51456 }
51457 }
51458 else if (type == 258)
51459 {
51460 if (velocity.Y != 0f)
51461 {
51462 TargetClosest();
51464 if (Main.player[target].Center.X < position.X && velocity.X > 0f)
51465 {
51466 velocity.X *= 0.95f;
51467 }
51468 else if (Main.player[target].Center.X > position.X + (float)width && velocity.X < 0f)
51469 {
51470 velocity.X *= 0.95f;
51471 }
51472 if (Main.player[target].Center.X < position.X && velocity.X > -5f)
51473 {
51474 velocity.X -= 0.1f;
51475 }
51476 else if (Main.player[target].Center.X > position.X + (float)width && velocity.X < 5f)
51477 {
51478 velocity.X += 0.1f;
51479 }
51480 }
51481 else if (Main.player[target].Center.Y + 50f < position.Y && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51482 {
51483 flag = true;
51484 velocity.Y = -7f;
51485 }
51486 }
51487 else if (type == 425)
51488 {
51489 if (localAI[3] == 0f)
51490 {
51491 localAI[3] = 1f;
51492 ai[3] = -120f;
51493 }
51494 if (velocity.Y == 0f)
51495 {
51496 ai[2] = 0f;
51497 }
51498 if (velocity.Y != 0f && ai[2] == 1f)
51499 {
51500 TargetClosest();
51502 if (Collision.CanHit(base.Center, 0, 0, Main.player[target].Center, 0, 0))
51503 {
51504 float num107 = 0.3f;
51505 float num108 = 8f;
51506 float num109 = 0.3f;
51507 float num110 = 7f;
51508 float num111 = Main.player[target].Center.X - (float)(direction * 300) - base.Center.X;
51509 float num112 = Main.player[target].Bottom.Y - base.Bottom.Y;
51511 {
51512 velocity.X *= 0.9f;
51513 }
51514 else if (num111 > 0f && velocity.X < 0f)
51515 {
51516 velocity.X *= 0.9f;
51517 }
51519 {
51520 velocity.X -= num109;
51521 }
51522 else if (num111 > 0f && velocity.X < num110)
51523 {
51524 velocity.X += num109;
51525 }
51526 if (velocity.X > num110)
51527 {
51528 velocity.X = num110;
51529 }
51530 if (velocity.X < 0f - num110)
51531 {
51532 velocity.X = 0f - num110;
51533 }
51535 {
51536 velocity.Y *= 0.8f;
51537 }
51538 else if (num112 > 20f && velocity.Y < 0f)
51539 {
51540 velocity.Y *= 0.8f;
51541 }
51543 {
51544 velocity.Y -= num107;
51545 }
51546 else if (num112 > 20f && velocity.Y < num108)
51547 {
51548 velocity.Y += num107;
51549 }
51550 }
51551 if (Main.rand.Next(3) == 0)
51552 {
51554 Vector2 vector25 = base.Center + new Vector2(direction * -14, -8f) - Vector2.One * 4f;
51555 Vector2 vector26 = new Vector2(direction * -6, 12f) * 0.2f + Utils.RandomVector2(Main.rand, -1f, 1f) * 0.1f;
51556 Dust obj5 = Main.dust[Dust.NewDust(vector25, 8, 8, 229, vector26.X, vector26.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 0.5f)];
51557 obj5.noGravity = true;
51558 obj5.velocity = vector26;
51559 obj5.customData = this;
51561 }
51562 for (int num113 = 0; num113 < 200; num113++)
51563 {
51564 if (num113 != whoAmI && Main.npc[num113].active && Main.npc[num113].type == type && Math.Abs(position.X - Main.npc[num113].position.X) + Math.Abs(position.Y - Main.npc[num113].position.Y) < (float)width)
51565 {
51566 if (position.X < Main.npc[num113].position.X)
51567 {
51568 velocity.X -= 0.15f;
51569 }
51570 else
51571 {
51572 velocity.X += 0.15f;
51573 }
51574 if (position.Y < Main.npc[num113].position.Y)
51575 {
51576 velocity.Y -= 0.15f;
51577 }
51578 else
51579 {
51580 velocity.Y += 0.15f;
51581 }
51582 }
51583 }
51584 }
51585 else if (Main.player[target].Center.Y + 100f < position.Y && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51586 {
51587 flag = true;
51588 velocity.Y = -5f;
51589 ai[2] = 1f;
51590 }
51591 if (ai[3] < 0f)
51592 {
51593 ai[3] += 1f;
51594 }
51595 int num114 = 30;
51596 int num115 = 10;
51597 int num116 = 180;
51598 if (ai[3] >= 0f && ai[3] <= (float)num114)
51599 {
51601 bool flag12 = Math.Abs(vector27.Y) <= Math.Abs(vector27.X);
51602 bool flag13 = Distance(Main.player[target].Center) < 800f && flag12 && Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0);
51603 ai[3] = MathHelper.Clamp(ai[3] + (float)flag13.ToDirectionInt(), 0f, num114);
51604 }
51605 if (ai[3] >= (float)(num114 + 1) && (ai[3] += 1f) >= (float)(num114 + num115))
51606 {
51607 ai[3] = num114 - num116;
51608 netUpdate = true;
51609 }
51610 if (Main.netMode != 1 && ai[3] == (float)num114)
51611 {
51612 ai[3] += 1f;
51613 netUpdate = true;
51614 int num117 = 20;
51615 Vector2 chaserPosition = base.Center + new Vector2(direction * 30, 2f);
51617 if (vector28.HasNaNs())
51618 {
51619 vector28 = new Vector2(direction * num117, 0f);
51620 }
51621 int num118 = 2;
51623 if (chaseResults.InterceptionHappens)
51624 {
51625 Vector2 vector29 = chaseResults.ChaserVelocity / num118;
51626 vector28.X = vector29.X;
51627 vector28.Y = vector29.Y;
51628 }
51630 for (int num119 = 0; num119 < 4; num119++)
51631 {
51632 Vector2 vector30 = vector28 + Utils.RandomVector2(Main.rand, -0.8f, 0.8f) * ((num119 != 0) ? 1 : 0);
51634 }
51635 }
51636 }
51637 else if (type == 427)
51638 {
51639 if (velocity.Y == 0f)
51640 {
51641 ai[2] = 0f;
51642 rotation = 0f;
51643 }
51644 else
51645 {
51646 rotation = velocity.X * 0.1f;
51647 }
51648 if (velocity.Y != 0f && ai[2] == 1f)
51649 {
51650 TargetClosest();
51652 if (Collision.CanHit(base.Center, 0, 0, Main.player[target].Center, 0, 0))
51653 {
51654 float num120 = Main.player[target].Center.X - base.Center.X;
51655 float num121 = Main.player[target].Center.Y - base.Center.Y;
51657 {
51658 velocity.X *= 0.98f;
51659 }
51660 else if (num120 > 0f && velocity.X < 0f)
51661 {
51662 velocity.X *= 0.98f;
51663 }
51665 {
51666 velocity.X -= 0.015f;
51667 }
51668 else if (num120 > 20f && velocity.X < 6f)
51669 {
51670 velocity.X += 0.015f;
51671 }
51672 if (velocity.X > 6f)
51673 {
51674 velocity.X = 6f;
51675 }
51676 if (velocity.X < -6f)
51677 {
51678 velocity.X = -6f;
51679 }
51681 {
51682 velocity.Y *= 0.98f;
51683 }
51684 else if (num121 > 20f && velocity.Y < 0f)
51685 {
51686 velocity.Y *= 0.98f;
51687 }
51689 {
51690 velocity.Y -= 0.15f;
51691 }
51692 else if (num121 > 20f && velocity.Y < 6f)
51693 {
51694 velocity.Y += 0.15f;
51695 }
51696 }
51697 for (int num122 = 0; num122 < 200; num122++)
51698 {
51699 if (num122 != whoAmI && Main.npc[num122].active && Main.npc[num122].type == type && Math.Abs(position.X - Main.npc[num122].position.X) + Math.Abs(position.Y - Main.npc[num122].position.Y) < (float)width)
51700 {
51701 if (position.X < Main.npc[num122].position.X)
51702 {
51703 velocity.X -= 0.05f;
51704 }
51705 else
51706 {
51707 velocity.X += 0.05f;
51708 }
51709 if (position.Y < Main.npc[num122].position.Y)
51710 {
51711 velocity.Y -= 0.05f;
51712 }
51713 else
51714 {
51715 velocity.Y += 0.05f;
51716 }
51717 }
51718 }
51719 }
51720 else if (Main.player[target].Center.Y + 100f < position.Y && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51721 {
51722 flag = true;
51723 velocity.Y = -5f;
51724 ai[2] = 1f;
51725 }
51726 }
51727 else if (type == 426)
51728 {
51729 float num123 = 6f;
51730 float num124 = 0.2f;
51731 float num125 = 6f;
51732 if (ai[1] > 0f && velocity.Y > 0f)
51733 {
51734 velocity.Y *= 0.85f;
51735 if (velocity.Y == 0f)
51736 {
51737 velocity.Y = -0.4f;
51738 }
51739 }
51740 if (velocity.Y != 0f)
51741 {
51742 TargetClosest();
51744 if (Collision.CanHit(base.Center, 0, 0, Main.player[target].Center, 0, 0))
51745 {
51746 float num126 = Main.player[target].Center.X - (float)(direction * 300) - base.Center.X;
51748 {
51749 velocity.X *= 0.98f;
51750 }
51751 else if (num126 > 40f && velocity.X < 0f)
51752 {
51753 velocity.X *= 0.98f;
51754 }
51756 {
51757 velocity.X -= num124;
51758 }
51759 else if (num126 > 40f && velocity.X < num123)
51760 {
51761 velocity.X += num124;
51762 }
51763 if (velocity.X > num123)
51764 {
51765 velocity.X = num123;
51766 }
51767 if (velocity.X < 0f - num123)
51768 {
51769 velocity.X = 0f - num123;
51770 }
51771 }
51772 }
51773 else if (Main.player[target].Center.Y + 100f < position.Y && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51774 {
51775 flag = true;
51776 velocity.Y = 0f - num125;
51777 }
51778 for (int num127 = 0; num127 < 200; num127++)
51779 {
51780 if (num127 != whoAmI && Main.npc[num127].active && Main.npc[num127].type == type && Math.Abs(position.X - Main.npc[num127].position.X) + Math.Abs(position.Y - Main.npc[num127].position.Y) < (float)width)
51781 {
51782 if (position.X < Main.npc[num127].position.X)
51783 {
51784 velocity.X -= 0.1f;
51785 }
51786 else
51787 {
51788 velocity.X += 0.1f;
51789 }
51790 if (position.Y < Main.npc[num127].position.Y)
51791 {
51792 velocity.Y -= 0.1f;
51793 }
51794 else
51795 {
51796 velocity.Y += 0.1f;
51797 }
51798 }
51799 }
51800 if (Main.rand.Next(6) == 0 && ai[1] <= 20f)
51801 {
51803 Dust obj6 = Main.dust[Dust.NewDust(base.Center + new Vector2((spriteDirection == 1) ? 8 : (-20), -20f), 8, 8, 229, velocity.X, velocity.Y, 100)];
51804 obj6.velocity = obj6.velocity / 4f + velocity / 2f;
51805 obj6.scale = 0.6f;
51806 obj6.noLight = true;
51808 }
51809 if (ai[1] >= 57f)
51810 {
51812 int num128 = Utils.SelectRandom<int>(Main.rand, 161, 229);
51813 Dust obj7 = Main.dust[Dust.NewDust(base.Center + new Vector2((spriteDirection == 1) ? 8 : (-20), -20f), 8, 8, num128, velocity.X, velocity.Y, 100)];
51814 obj7.velocity = obj7.velocity / 4f + DirectionTo(Main.player[target].Top);
51815 obj7.scale = 1.2f;
51816 obj7.noLight = true;
51818 }
51819 if (Main.rand.Next(6) == 0)
51820 {
51822 Dust dust5 = Main.dust[Dust.NewDust(base.Center, 2, 2, 229)];
51823 dust5.position = base.Center + new Vector2((spriteDirection == 1) ? 26 : (-26), 24f);
51824 dust5.velocity.X = 0f;
51825 if (dust5.velocity.Y < 0f)
51826 {
51827 dust5.velocity.Y = 0f;
51828 }
51829 dust5.noGravity = true;
51830 dust5.scale = 1f;
51831 dust5.noLight = true;
51833 }
51834 }
51835 else if (type == 185)
51836 {
51837 if (velocity.Y == 0f)
51838 {
51839 rotation = 0f;
51840 localAI[0] = 0f;
51841 }
51842 else if (localAI[0] == 1f)
51843 {
51844 rotation += velocity.X * 0.05f;
51845 }
51846 }
51847 else if (type == 428)
51848 {
51849 if (velocity.Y == 0f)
51850 {
51851 rotation = 0f;
51852 }
51853 else
51854 {
51855 rotation += velocity.X * 0.08f;
51856 }
51857 }
51858 if (type == 159 && Main.netMode != 1)
51859 {
51860 Vector2 vector31 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
51861 float num129 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector31.X;
51862 float num130 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector31.Y;
51863 if ((float)Math.Sqrt(num129 * num129 + num130 * num130) > 300f)
51864 {
51865 Transform(158);
51866 }
51867 }
51868 if (Main.netMode != 1)
51869 {
51870 if (Main.expertMode && target >= 0 && (type == 163 || type == 238 || type == 236 || type == 237) && Collision.CanHit(base.Center, 1, 1, Main.player[target].Center, 1, 1))
51871 {
51872 localAI[0] += 1f;
51873 if (justHit)
51874 {
51875 localAI[0] -= Main.rand.Next(20, 60);
51876 if (localAI[0] < 0f)
51877 {
51878 localAI[0] = 0f;
51879 }
51880 }
51881 if (localAI[0] > (float)Main.rand.Next(180, 900))
51882 {
51883 localAI[0] = 0f;
51884 Vector2 vector32 = Main.player[target].Center - base.Center;
51885 vector32.Normalize();
51886 vector32 *= 8f;
51889 }
51890 }
51891 if (velocity.Y == 0f)
51892 {
51893 int num131 = -1;
51894 switch (type)
51895 {
51896 case 164:
51897 num131 = 165;
51898 break;
51899 case 236:
51900 num131 = 237;
51901 break;
51902 case 163:
51903 num131 = 238;
51904 break;
51905 case 239:
51906 num131 = 240;
51907 break;
51908 case 530:
51909 num131 = 531;
51910 break;
51911 }
51912 if (num131 != -1 && NPCCanStickToWalls())
51913 {
51915 }
51916 }
51917 }
51918 if (type == 243)
51919 {
51920 if (justHit && Main.rand.Next(3) == 0)
51921 {
51922 ai[2] -= Main.rand.Next(30);
51923 }
51924 if (ai[2] < 0f)
51925 {
51926 ai[2] = 0f;
51927 }
51928 if (confused)
51929 {
51930 ai[2] = 0f;
51931 }
51932 ai[2] += 1f;
51933 float num132 = Main.rand.Next(30, 900);
51934 num132 *= (float)life / (float)lifeMax;
51935 num132 += 30f;
51936 if (Main.netMode != 1 && ai[2] >= num132 && velocity.Y == 0f && !Main.player[target].dead && !Main.player[target].frozen && ((direction > 0 && base.Center.X < Main.player[target].Center.X) || (direction < 0 && base.Center.X > Main.player[target].Center.X)) && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51937 {
51938 Vector2 vector33 = new Vector2(position.X + (float)width * 0.5f, position.Y + 20f);
51939 vector33.X += 10 * direction;
51940 float num133 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector33.X;
51941 float num134 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector33.Y;
51942 num133 += (float)Main.rand.Next(-40, 41);
51943 num134 += (float)Main.rand.Next(-40, 41);
51944 float num135 = (float)Math.Sqrt(num133 * num133 + num134 * num134);
51945 netUpdate = true;
51946 num135 = 15f / num135;
51947 num133 *= num135;
51948 num134 *= num135;
51949 int num136 = 32;
51950 int num137 = 257;
51951 vector33.X += num133 * 3f;
51952 vector33.Y += num134 * 3f;
51954 ai[2] = 0f;
51955 }
51956 }
51957 if (type == 251)
51958 {
51959 if (justHit)
51960 {
51961 ai[2] -= Main.rand.Next(30);
51962 }
51963 if (ai[2] < 0f)
51964 {
51965 ai[2] = 0f;
51966 }
51967 if (confused)
51968 {
51969 ai[2] = 0f;
51970 }
51971 ai[2] += 1f;
51972 float num138 = Main.rand.Next(60, 1800);
51973 num138 *= (float)life / (float)lifeMax;
51974 num138 += 15f;
51975 if (Main.netMode != 1 && ai[2] >= num138 && velocity.Y == 0f && !Main.player[target].dead && !Main.player[target].frozen && ((direction > 0 && base.Center.X < Main.player[target].Center.X) || (direction < 0 && base.Center.X > Main.player[target].Center.X)) && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
51976 {
51977 Vector2 vector34 = new Vector2(position.X + (float)width * 0.5f, position.Y + 12f);
51978 vector34.X += 6 * direction;
51979 float num139 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector34.X;
51980 float num140 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector34.Y;
51981 num139 += (float)Main.rand.Next(-40, 41);
51982 num140 += (float)Main.rand.Next(-30, 0);
51983 float num141 = (float)Math.Sqrt(num139 * num139 + num140 * num140);
51984 netUpdate = true;
51985 num141 = 15f / num141;
51986 num139 *= num141;
51987 num140 *= num141;
51988 int num142 = 30;
51989 int num143 = 83;
51990 vector34.X += num139 * 3f;
51991 vector34.Y += num140 * 3f;
51993 ai[2] = 0f;
51994 }
51995 }
51996 if (type == 386)
51997 {
51998 if (confused)
51999 {
52000 ai[2] = -60f;
52001 }
52002 else
52003 {
52004 if (ai[2] < 60f)
52005 {
52006 ai[2] += 1f;
52007 }
52008 if (ai[2] > 0f && CountNPCS(387) >= 4 * CountNPCS(386))
52009 {
52010 ai[2] = 0f;
52011 }
52012 if (justHit)
52013 {
52014 ai[2] = -30f;
52015 }
52016 if (ai[2] == 30f)
52017 {
52018 int num144 = (int)position.X / 16;
52019 int num145 = (int)position.Y / 16;
52020 int num146 = (int)position.X / 16;
52021 int num147 = (int)position.Y / 16;
52022 int num148 = 5;
52023 int num149 = 0;
52024 bool flag14 = false;
52025 int num150 = 2;
52026 int num151 = 0;
52027 while (!flag14 && num149 < 100)
52028 {
52029 num149++;
52030 int num152 = Main.rand.Next(num144 - num148, num144 + num148);
52031 for (int num153 = Main.rand.Next(num145 - num148, num145 + num148); num153 < num145 + num148; num153++)
52032 {
52034 {
52035 bool flag15 = true;
52036 if (Main.tile[num152, num153 - 1].lava())
52037 {
52038 flag15 = false;
52039 }
52040 if (flag15 && Main.tileSolid[Main.tile[num152, num153].type] && !Collision.SolidTiles(num152 - 1, num152 + 1, num153 - 4, num153 - 1))
52041 {
52042 int num154 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), num152 * 16 - width / 2, num153 * 16, 387);
52043 Main.npc[num154].position.Y = num153 * 16 - Main.npc[num154].height;
52044 flag14 = true;
52045 netUpdate = true;
52046 break;
52047 }
52048 }
52049 }
52050 }
52051 }
52052 if (ai[2] == 60f)
52053 {
52054 ai[2] = -120f;
52055 }
52056 }
52057 }
52058 if (type == 389)
52059 {
52060 if (confused)
52061 {
52062 ai[2] = -60f;
52063 }
52064 else
52065 {
52066 if (ai[2] < 20f)
52067 {
52068 ai[2] += 1f;
52069 }
52070 if (justHit)
52071 {
52072 ai[2] = -30f;
52073 }
52074 if (ai[2] == 20f && Main.netMode != 1)
52075 {
52076 ai[2] = -10 + Main.rand.Next(3) * -10;
52077 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y + 8f, direction * 6, 0f, 437, 25, 1f, Main.myPlayer);
52078 }
52079 }
52080 }
52081 if (type == 110 || type == 111 || type == 206 || type == 214 || type == 215 || type == 216 || type == 290 || type == 291 || type == 292 || type == 293 || type == 350 || type == 379 || type == 380 || type == 381 || type == 382 || (type >= 449 && type <= 452) || type == 468 || type == 481 || type == 411 || type == 409 || (type >= 498 && type <= 506) || type == 424 || type == 426 || type == 520)
52082 {
52083 bool flag16 = type == 381 || type == 382 || type == 520;
52084 bool flag17 = type == 426;
52085 bool flag18 = true;
52086 int num155 = -1;
52087 int num156 = -1;
52088 if (type == 411)
52089 {
52090 flag16 = true;
52091 num155 = 120;
52092 num156 = 120;
52093 if (ai[1] <= 220f)
52094 {
52095 flag18 = false;
52096 }
52097 }
52098 if (ai[1] > 0f)
52099 {
52100 ai[1] -= 1f;
52101 }
52102 if (justHit)
52103 {
52104 ai[1] = 30f;
52105 ai[2] = 0f;
52106 }
52107 int num157 = 70;
52108 if (type == 379 || type == 380)
52109 {
52110 num157 = 80;
52111 }
52112 if (type == 381 || type == 382)
52113 {
52114 num157 = 80;
52115 }
52116 if (type == 520)
52117 {
52118 num157 = 15;
52119 }
52120 if (type == 350)
52121 {
52122 num157 = 110;
52123 }
52124 if (type == 291)
52125 {
52126 num157 = 200;
52127 }
52128 if (type == 292)
52129 {
52130 num157 = 120;
52131 }
52132 if (type == 293)
52133 {
52134 num157 = 90;
52135 }
52136 if (type == 111)
52137 {
52138 num157 = 180;
52139 }
52140 if (type == 206)
52141 {
52142 num157 = 50;
52143 }
52144 if (type == 481)
52145 {
52146 num157 = 100;
52147 }
52148 if (type == 214)
52149 {
52150 num157 = 40;
52151 }
52152 if (type == 215)
52153 {
52154 num157 = 80;
52155 }
52156 if (type == 290)
52157 {
52158 num157 = 30;
52159 }
52160 if (type == 411)
52161 {
52162 num157 = 330;
52163 }
52164 if (type == 409)
52165 {
52166 num157 = 60;
52167 }
52168 if (type == 424)
52169 {
52170 num157 = 180;
52171 }
52172 if (type == 426)
52173 {
52174 num157 = 60;
52175 }
52176 bool flag19 = false;
52177 if (type == 216)
52178 {
52179 if (localAI[2] >= 20f)
52180 {
52181 flag19 = true;
52182 }
52183 num157 = ((!flag19) ? 8 : 60);
52184 }
52185 int num158 = num157 / 2;
52186 if (type == 424)
52187 {
52188 num158 = num157 - 1;
52189 }
52190 if (type == 426)
52191 {
52192 num158 = num157 - 1;
52193 }
52194 if (type == 411)
52195 {
52196 num158 = 220;
52197 }
52198 if (confused)
52199 {
52200 ai[2] = 0f;
52201 }
52202 if (ai[2] > 0f)
52203 {
52204 if (flag18)
52205 {
52206 TargetClosest();
52207 }
52208 if (ai[1] == (float)num158)
52209 {
52210 if (type == 216)
52211 {
52212 localAI[2] += 1f;
52213 }
52214 float num159 = 11f;
52215 if (type == 111)
52216 {
52217 num159 = 9f;
52218 }
52219 if (type == 206)
52220 {
52221 num159 = 7f;
52222 }
52223 if (type == 290)
52224 {
52225 num159 = 9f;
52226 }
52227 if (type == 293)
52228 {
52229 num159 = 4f;
52230 }
52231 if (type == 214)
52232 {
52233 num159 = 14f;
52234 }
52235 if (type == 215)
52236 {
52237 num159 = 16f;
52238 }
52239 if (type == 382)
52240 {
52241 num159 = 7f;
52242 }
52243 if (type == 520)
52244 {
52245 num159 = 8f;
52246 }
52247 if (type == 409)
52248 {
52249 num159 = 4f;
52250 }
52251 if (type >= 449 && type <= 452)
52252 {
52253 num159 = 7f;
52254 }
52255 if (type == 481)
52256 {
52257 num159 = 8f;
52258 }
52259 if (type == 468)
52260 {
52261 num159 = 7.5f;
52262 }
52263 if (type == 411)
52264 {
52265 num159 = 1f;
52266 }
52267 if (type >= 498 && type <= 506)
52268 {
52269 num159 = 7f;
52270 }
52271 Vector2 chaserPosition2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
52272 if (type == 481)
52273 {
52274 chaserPosition2.Y -= 14f;
52275 }
52276 if (type == 206)
52277 {
52278 chaserPosition2.Y -= 10f;
52279 }
52280 if (type == 290)
52281 {
52282 chaserPosition2.Y -= 10f;
52283 }
52284 if (type == 381 || type == 382)
52285 {
52286 chaserPosition2.Y += 6f;
52287 }
52288 if (type == 520)
52289 {
52290 chaserPosition2.Y = position.Y + 20f;
52291 }
52292 if (type >= 498 && type <= 506)
52293 {
52294 chaserPosition2.Y -= 8f;
52295 }
52296 if (type == 426)
52297 {
52298 chaserPosition2 += new Vector2(spriteDirection * 2, -12f);
52299 num159 = 7f;
52300 }
52301 float num160 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - chaserPosition2.X;
52302 float num161 = Math.Abs(num160) * 0.1f;
52303 if (type == 291 || type == 292)
52304 {
52305 num161 = 0f;
52306 }
52307 if (type == 215)
52308 {
52309 num161 = Math.Abs(num160) * 0.08f;
52310 }
52311 if (type == 214 || (type == 216 && !flag19))
52312 {
52313 num161 = 0f;
52314 }
52315 if (type == 381 || type == 382 || type == 520)
52316 {
52317 num161 = 0f;
52318 }
52319 if (type >= 449 && type <= 452)
52320 {
52321 num161 = Math.Abs(num160) * (float)Main.rand.Next(10, 50) * 0.01f;
52322 }
52323 if (type == 468)
52324 {
52325 num161 = Math.Abs(num160) * (float)Main.rand.Next(10, 50) * 0.01f;
52326 }
52327 if (type == 481)
52328 {
52329 num161 = Math.Abs(num160) * (float)Main.rand.Next(-10, 11) * 0.0035f;
52330 }
52331 if (type >= 498 && type <= 506)
52332 {
52333 num161 = Math.Abs(num160) * (float)Main.rand.Next(1, 11) * 0.0025f;
52334 }
52335 float num162 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - chaserPosition2.Y - num161;
52336 if (type == 291)
52337 {
52338 num160 += (float)Main.rand.Next(-40, 41) * 0.2f;
52339 num162 += (float)Main.rand.Next(-40, 41) * 0.2f;
52340 }
52341 else if (type == 381 || type == 382 || type == 520)
52342 {
52343 num160 += (float)Main.rand.Next(-100, 101) * 0.4f;
52344 num162 += (float)Main.rand.Next(-100, 101) * 0.4f;
52345 num160 *= (float)Main.rand.Next(85, 116) * 0.01f;
52346 num162 *= (float)Main.rand.Next(85, 116) * 0.01f;
52347 if (type == 520)
52348 {
52349 num160 += (float)Main.rand.Next(-100, 101) * 0.6f;
52350 num162 += (float)Main.rand.Next(-100, 101) * 0.6f;
52351 num160 *= (float)Main.rand.Next(85, 116) * 0.015f;
52352 num162 *= (float)Main.rand.Next(85, 116) * 0.015f;
52353 }
52354 }
52355 else if (type == 481)
52356 {
52357 num160 += (float)Main.rand.Next(-40, 41) * 0.4f;
52358 num162 += (float)Main.rand.Next(-40, 41) * 0.4f;
52359 }
52360 else if (type >= 498 && type <= 506)
52361 {
52362 num160 += (float)Main.rand.Next(-40, 41) * 0.3f;
52363 num162 += (float)Main.rand.Next(-40, 41) * 0.3f;
52364 }
52365 else if (type == 426)
52366 {
52367 num160 += (float)Main.rand.Next(-30, 31) * 0.3f;
52368 num162 += (float)Main.rand.Next(-30, 31) * 0.3f;
52369 }
52370 else if (type != 292)
52371 {
52372 num160 += (float)Main.rand.Next(-40, 41);
52373 num162 += (float)Main.rand.Next(-40, 41);
52374 }
52375 float num163 = (float)Math.Sqrt(num160 * num160 + num162 * num162);
52376 netUpdate = true;
52377 num163 = num159 / num163;
52378 num160 *= num163;
52379 num162 *= num163;
52380 int num164 = 35;
52381 int num165 = 82;
52382 if (type == 111)
52383 {
52384 num164 = 11;
52385 }
52386 if (type == 206)
52387 {
52388 num164 = 37;
52389 }
52390 if (type == 379 || type == 380)
52391 {
52392 num164 = 40;
52393 }
52394 if (type == 350)
52395 {
52396 num164 = 45;
52397 }
52398 if (type == 468)
52399 {
52400 num164 = 50;
52401 }
52402 if (type == 111)
52403 {
52404 num165 = 81;
52405 }
52406 if (type == 379 || type == 380)
52407 {
52408 num165 = 81;
52409 }
52410 if (type == 381)
52411 {
52412 num165 = 436;
52413 num164 = 24;
52414 }
52415 if (type == 382)
52416 {
52417 num165 = 438;
52418 num164 = 30;
52419 }
52420 if (type == 520)
52421 {
52422 num165 = 592;
52423 num164 = 35;
52424 }
52425 if (type >= 449 && type <= 452)
52426 {
52427 num165 = 471;
52428 num164 = 15;
52429 }
52430 if (type >= 498 && type <= 506)
52431 {
52432 num165 = 572;
52433 num164 = 14;
52434 }
52435 if (type == 481)
52436 {
52437 num165 = 508;
52438 num164 = 18;
52439 }
52440 if (type == 206)
52441 {
52442 num165 = 177;
52443 }
52444 if (type == 468)
52445 {
52446 num165 = 501;
52447 }
52448 if (type == 411)
52449 {
52450 num165 = 537;
52452 }
52453 if (type == 424)
52454 {
52455 num165 = 573;
52457 }
52458 if (type == 426)
52459 {
52460 num165 = 581;
52462 }
52463 if (type == 291)
52464 {
52465 num165 = 302;
52466 num164 = 100;
52467 }
52468 if (type == 290)
52469 {
52470 num165 = 300;
52471 num164 = 60;
52472 }
52473 if (type == 293)
52474 {
52475 num165 = 303;
52476 num164 = 60;
52477 }
52478 if (type == 214)
52479 {
52480 num165 = 180;
52481 num164 = 25;
52482 }
52483 if (type == 215)
52484 {
52485 num165 = 82;
52486 num164 = 40;
52487 }
52488 if (type == 292)
52489 {
52490 num164 = 50;
52491 num165 = 180;
52492 }
52493 if (type == 216)
52494 {
52495 num165 = 180;
52496 num164 = 30;
52497 if (flag19)
52498 {
52499 num164 = 100;
52500 num165 = 240;
52501 localAI[2] = 0f;
52502 }
52503 }
52505 Vector2? vector35 = null;
52506 if (type == 426)
52507 {
52508 vector35 = Main.rand.NextVector2FromRectangle(player3.Hitbox);
52509 }
52510 if (vector35.HasValue)
52511 {
52513 if (chaseResults2.InterceptionHappens)
52514 {
52515 Vector2 vector36 = Utils.FactorAcceleration(chaseResults2.ChaserVelocity, chaseResults2.InterceptionTime, new Vector2(0f, 0.1f), 15);
52516 num160 = vector36.X;
52517 num162 = vector36.Y;
52518 }
52519 }
52520 chaserPosition2.X += num160;
52521 chaserPosition2.Y += num162;
52522 if (type == 290)
52523 {
52525 }
52526 if (type >= 381 && type <= 392)
52527 {
52529 }
52530 if (Main.netMode != 1)
52531 {
52532 if (type == 292)
52533 {
52534 for (int num166 = 0; num166 < 4; num166++)
52535 {
52536 num160 = player3.position.X + (float)player3.width * 0.5f - chaserPosition2.X;
52537 num162 = player3.position.Y + (float)player3.height * 0.5f - chaserPosition2.Y;
52538 num163 = (float)Math.Sqrt(num160 * num160 + num162 * num162);
52539 num163 = 12f / num163;
52540 num160 = (num160 += (float)Main.rand.Next(-40, 41));
52541 num162 = (num162 += (float)Main.rand.Next(-40, 41));
52542 num160 *= num163;
52543 num162 *= num163;
52545 }
52546 }
52547 else if (type == 411)
52548 {
52550 }
52551 else if (type == 424)
52552 {
52553 for (int num167 = 0; num167 < 4; num167++)
52554 {
52555 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X - (float)(spriteDirection * 4), base.Center.Y + 6f, (float)(-3 + 2 * num167) * 0.15f, (float)(-Main.rand.Next(0, 3)) * 0.2f - 0.1f, num165, num164, 0f, Main.myPlayer, 0f, whoAmI);
52556 }
52557 }
52558 else if (type == 409)
52559 {
52560 int num168 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 410, whoAmI);
52561 Main.npc[num168].velocity = new Vector2(num160, -6f + num162);
52562 }
52563 else
52564 {
52566 }
52567 }
52568 if (Math.Abs(num162) > Math.Abs(num160) * 2f)
52569 {
52570 if (num162 > 0f)
52571 {
52572 ai[2] = 1f;
52573 }
52574 else
52575 {
52576 ai[2] = 5f;
52577 }
52578 }
52579 else if (Math.Abs(num160) > Math.Abs(num162) * 2f)
52580 {
52581 ai[2] = 3f;
52582 }
52583 else if (num162 > 0f)
52584 {
52585 ai[2] = 2f;
52586 }
52587 else
52588 {
52589 ai[2] = 4f;
52590 }
52591 }
52592 if ((velocity.Y != 0f && !flag17) || ai[1] <= 0f)
52593 {
52594 ai[2] = 0f;
52595 ai[1] = 0f;
52596 }
52597 else if (!flag16 || (num155 != -1 && ai[1] >= (float)num155 && ai[1] < (float)(num155 + num156) && (!flag17 || velocity.Y == 0f)))
52598 {
52599 velocity.X *= 0.9f;
52601 }
52602 }
52603 if (type == 468 && !Main.eclipse)
52604 {
52605 flag16 = true;
52606 }
52607 else if ((ai[2] <= 0f || flag16) && (velocity.Y == 0f || flag17) && ai[1] <= 0f && !Main.player[target].dead)
52608 {
52609 bool flag20 = Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height);
52610 if (type == 520)
52611 {
52612 flag20 = Collision.CanHitLine(base.Top + new Vector2(0f, 20f), 0, 0, Main.player[target].position, Main.player[target].width, Main.player[target].height);
52613 }
52614 if (Main.player[target].stealth == 0f && Main.player[target].itemAnimation == 0)
52615 {
52616 flag20 = false;
52617 }
52618 if (flag20)
52619 {
52620 float num169 = 10f;
52621 Vector2 vector37 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
52622 float num170 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector37.X;
52623 float num171 = Math.Abs(num170) * 0.1f;
52624 float num172 = Main.player[target].position.Y + (float)Main.player[target].height * 0.5f - vector37.Y - num171;
52625 num170 += (float)Main.rand.Next(-40, 41);
52626 num172 += (float)Main.rand.Next(-40, 41);
52627 float num173 = (float)Math.Sqrt(num170 * num170 + num172 * num172);
52628 float num174 = 700f;
52629 if (type == 214)
52630 {
52631 num174 = 550f;
52632 }
52633 if (type == 215)
52634 {
52635 num174 = 800f;
52636 }
52637 if (type >= 498 && type <= 506)
52638 {
52639 num174 = 190f;
52640 }
52641 if (type >= 449 && type <= 452)
52642 {
52643 num174 = 200f;
52644 }
52645 if (type == 481)
52646 {
52647 num174 = 400f;
52648 }
52649 if (type == 468)
52650 {
52651 num174 = 400f;
52652 }
52653 if (num173 < num174)
52654 {
52655 netUpdate = true;
52656 velocity.X *= 0.5f;
52657 num173 = num169 / num173;
52658 num170 *= num173;
52659 num172 *= num173;
52660 ai[2] = 3f;
52661 ai[1] = num157;
52662 if (Math.Abs(num172) > Math.Abs(num170) * 2f)
52663 {
52664 if (num172 > 0f)
52665 {
52666 ai[2] = 1f;
52667 }
52668 else
52669 {
52670 ai[2] = 5f;
52671 }
52672 }
52673 else if (Math.Abs(num170) > Math.Abs(num172) * 2f)
52674 {
52675 ai[2] = 3f;
52676 }
52677 else if (num172 > 0f)
52678 {
52679 ai[2] = 2f;
52680 }
52681 else
52682 {
52683 ai[2] = 4f;
52684 }
52685 }
52686 }
52687 }
52688 if (ai[2] <= 0f || (flag16 && (num155 == -1 || !(ai[1] >= (float)num155) || !(ai[1] < (float)(num155 + num156)))))
52689 {
52690 float num175 = 1f;
52691 float num176 = 0.07f;
52692 float num177 = 0.8f;
52693 if (type == 214)
52694 {
52695 num175 = 2f;
52696 num176 = 0.09f;
52697 }
52698 else if (type == 215)
52699 {
52700 num175 = 1.5f;
52701 num176 = 0.08f;
52702 }
52703 else if (type == 381 || type == 382)
52704 {
52705 num175 = 2f;
52706 num176 = 0.5f;
52707 }
52708 else if (type == 520)
52709 {
52710 num175 = 4f;
52711 num176 = 1f;
52712 num177 = 0.7f;
52713 }
52714 else if (type == 411)
52715 {
52716 num175 = 2f;
52717 num176 = 0.5f;
52718 }
52719 else if (type == 409)
52720 {
52721 num175 = 2f;
52722 num176 = 0.5f;
52723 }
52724 else if (type == 426)
52725 {
52726 num175 = 4f;
52727 num176 = 0.6f;
52728 num177 = 0.95f;
52729 }
52730 bool flag21 = false;
52731 if ((type == 381 || type == 382) && Vector2.Distance(base.Center, Main.player[target].Center) < 300f && Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
52732 {
52733 flag21 = true;
52734 ai[3] = 0f;
52735 }
52736 if (type == 520 && Vector2.Distance(base.Center, Main.player[target].Center) < 400f && Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
52737 {
52738 flag21 = true;
52739 ai[3] = 0f;
52740 }
52741 if (velocity.X < 0f - num175 || velocity.X > num175 || flag21)
52742 {
52743 if (velocity.Y == 0f)
52744 {
52745 velocity *= num177;
52746 }
52747 }
52748 else if (velocity.X < num175 && direction == 1)
52749 {
52750 velocity.X += num176;
52751 if (velocity.X > num175)
52752 {
52753 velocity.X = num175;
52754 }
52755 }
52756 else if (velocity.X > 0f - num175 && direction == -1)
52757 {
52758 velocity.X -= num176;
52759 if (velocity.X < 0f - num175)
52760 {
52761 velocity.X = 0f - num175;
52762 }
52763 }
52764 }
52765 if (type == 520)
52766 {
52767 localAI[2] += 1f;
52768 if (localAI[2] >= 6f)
52769 {
52770 localAI[2] = 0f;
52771 localAI[3] = Main.player[target].DirectionFrom(base.Top + new Vector2(0f, 20f)).ToRotation();
52772 }
52773 }
52774 }
52775 if (type == 109 && Main.netMode != 1 && !Main.player[target].dead)
52776 {
52777 if (justHit)
52778 {
52779 ai[2] = 0f;
52780 }
52781 ai[2] += 1f;
52782 if (ai[2] > 60f)
52783 {
52784 Vector2 vector38 = new Vector2(position.X + (float)width * 0.5f - (float)(direction * 24), position.Y + 4f);
52785 if (Main.rand.Next(5) != 0 || AnyNPCs(378))
52786 {
52787 int num178 = Main.rand.Next(3, 8) * direction;
52788 int num179 = Main.rand.Next(-8, -5);
52790 Main.projectile[num180].timeLeft = 300;
52791 ai[2] = 0f;
52792 }
52793 else
52794 {
52795 ai[2] = -120f;
52796 int number = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector38.X, (int)vector38.Y, 378);
52797 NetMessage.SendData(23, -1, -1, null, number);
52798 }
52799 }
52800 }
52801 if (velocity.Y == 0f || flag)
52802 {
52803 int num181 = (int)(position.Y + (float)height + 7f) / 16;
52804 int num182 = (int)(position.Y - 9f) / 16;
52805 int num183 = (int)position.X / 16;
52806 int num184 = (int)(position.X + (float)width) / 16;
52807 int num185 = (int)(position.X + 8f) / 16;
52808 int num186 = (int)(position.X + (float)width - 8f) / 16;
52809 bool flag22 = false;
52810 for (int num187 = num185; num187 <= num186; num187++)
52811 {
52812 if (num187 >= num183 && num187 <= num184 && Main.tile[num187, num181] == null)
52813 {
52814 flag22 = true;
52815 continue;
52816 }
52817 if (Main.tile[num187, num182] != null && Main.tile[num187, num182].nactive() && Main.tileSolid[Main.tile[num187, num182].type])
52818 {
52819 flag5 = false;
52820 break;
52821 }
52822 if (!flag22 && num187 >= num183 && num187 <= num184 && Main.tile[num187, num181].nactive() && Main.tileSolid[Main.tile[num187, num181].type])
52823 {
52824 flag5 = true;
52825 }
52826 }
52827 if (!flag5 && velocity.Y < 0f)
52828 {
52829 velocity.Y = 0f;
52830 }
52831 if (flag22)
52832 {
52833 return;
52834 }
52835 }
52836 if (type == 428)
52837 {
52838 flag5 = false;
52839 }
52840 if (velocity.Y >= 0f && (type != 580 || directionY != 1))
52841 {
52842 int num188 = 0;
52843 if (velocity.X < 0f)
52844 {
52845 num188 = -1;
52846 }
52847 if (velocity.X > 0f)
52848 {
52849 num188 = 1;
52850 }
52852 vector39.X += velocity.X;
52853 int num189 = (int)((vector39.X + (float)(width / 2) + (float)((width / 2 + 1) * num188)) / 16f);
52854 int num190 = (int)((vector39.Y + (float)height - 1f) / 16f);
52855 if (WorldGen.InWorld(num189, num190, 4))
52856 {
52857 if (Main.tile[num189, num190] == null)
52858 {
52859 Main.tile[num189, num190] = new Tile();
52860 }
52861 if (Main.tile[num189, num190 - 1] == null)
52862 {
52863 Main.tile[num189, num190 - 1] = new Tile();
52864 }
52865 if (Main.tile[num189, num190 - 2] == null)
52866 {
52867 Main.tile[num189, num190 - 2] = new Tile();
52868 }
52869 if (Main.tile[num189, num190 - 3] == null)
52870 {
52871 Main.tile[num189, num190 - 3] = new Tile();
52872 }
52873 if (Main.tile[num189, num190 + 1] == null)
52874 {
52875 Main.tile[num189, num190 + 1] = new Tile();
52876 }
52877 if (Main.tile[num189 - num188, num190 - 3] == null)
52878 {
52879 Main.tile[num189 - num188, num190 - 3] = new Tile();
52880 }
52881 if ((float)(num189 * 16) < vector39.X + (float)width && (float)(num189 * 16 + 16) > vector39.X && ((Main.tile[num189, num190].nactive() && !Main.tile[num189, num190].topSlope() && !Main.tile[num189, num190 - 1].topSlope() && Main.tileSolid[Main.tile[num189, num190].type] && !Main.tileSolidTop[Main.tile[num189, num190].type]) || (Main.tile[num189, num190 - 1].halfBrick() && Main.tile[num189, num190 - 1].nactive())) && (!Main.tile[num189, num190 - 1].nactive() || !Main.tileSolid[Main.tile[num189, num190 - 1].type] || Main.tileSolidTop[Main.tile[num189, num190 - 1].type] || (Main.tile[num189, num190 - 1].halfBrick() && (!Main.tile[num189, num190 - 4].nactive() || !Main.tileSolid[Main.tile[num189, num190 - 4].type] || Main.tileSolidTop[Main.tile[num189, num190 - 4].type]))) && (!Main.tile[num189, num190 - 2].nactive() || !Main.tileSolid[Main.tile[num189, num190 - 2].type] || Main.tileSolidTop[Main.tile[num189, num190 - 2].type]) && (!Main.tile[num189, num190 - 3].nactive() || !Main.tileSolid[Main.tile[num189, num190 - 3].type] || Main.tileSolidTop[Main.tile[num189, num190 - 3].type]) && (!Main.tile[num189 - num188, num190 - 3].nactive() || !Main.tileSolid[Main.tile[num189 - num188, num190 - 3].type]))
52882 {
52883 float num191 = num190 * 16;
52884 if (Main.tile[num189, num190].halfBrick())
52885 {
52886 num191 += 8f;
52887 }
52888 if (Main.tile[num189, num190 - 1].halfBrick())
52889 {
52890 num191 -= 8f;
52891 }
52892 if (num191 < vector39.Y + (float)height)
52893 {
52894 float num192 = vector39.Y + (float)height - num191;
52895 float num193 = 16.1f;
52896 if (type == 163 || type == 164 || type == 236 || type == 239 || type == 530)
52897 {
52898 num193 += 8f;
52899 }
52900 if (num192 <= num193)
52901 {
52902 gfxOffY += position.Y + (float)height - num191;
52903 position.Y = num191 - (float)height;
52904 if (num192 < 9f)
52905 {
52906 stepSpeed = 1f;
52907 }
52908 else
52909 {
52910 stepSpeed = 2f;
52911 }
52912 }
52913 }
52914 }
52915 }
52916 }
52917 if (flag5)
52918 {
52919 int num194 = (int)((position.X + (float)(width / 2) + (float)(15 * direction)) / 16f);
52920 int num195 = (int)((position.Y + (float)height - 15f) / 16f);
52921 if (type == 109 || type == 163 || type == 164 || type == 199 || type == 236 || type == 239 || type == 257 || type == 258 || type == 290 || type == 391 || type == 425 || type == 427 || type == 426 || type == 580 || type == 508 || type == 415 || type == 530 || type == 532 || type == 582)
52922 {
52923 num194 = (int)((position.X + (float)(width / 2) + (float)((width / 2 + 16) * direction)) / 16f);
52924 }
52925 if (Main.tile[num194, num195] == null)
52926 {
52927 Main.tile[num194, num195] = new Tile();
52928 }
52929 if (Main.tile[num194, num195 - 1] == null)
52930 {
52931 Main.tile[num194, num195 - 1] = new Tile();
52932 }
52933 if (Main.tile[num194, num195 - 2] == null)
52934 {
52935 Main.tile[num194, num195 - 2] = new Tile();
52936 }
52937 if (Main.tile[num194, num195 - 3] == null)
52938 {
52939 Main.tile[num194, num195 - 3] = new Tile();
52940 }
52941 if (Main.tile[num194, num195 + 1] == null)
52942 {
52943 Main.tile[num194, num195 + 1] = new Tile();
52944 }
52945 if (Main.tile[num194 + direction, num195 - 1] == null)
52946 {
52947 Main.tile[num194 + direction, num195 - 1] = new Tile();
52948 }
52949 if (Main.tile[num194 + direction, num195 + 1] == null)
52950 {
52951 Main.tile[num194 + direction, num195 + 1] = new Tile();
52952 }
52953 if (Main.tile[num194 - direction, num195 + 1] == null)
52954 {
52955 Main.tile[num194 - direction, num195 + 1] = new Tile();
52956 }
52957 Main.tile[num194, num195 + 1].halfBrick();
52958 if (Main.tile[num194, num195 - 1].nactive() && (Main.tile[num194, num195 - 1].type == 10 || Main.tile[num194, num195 - 1].type == 388) && flag8)
52959 {
52960 ai[2] += 1f;
52961 ai[3] = 0f;
52962 if (ai[2] >= 60f)
52963 {
52964 bool flag23 = type == 3 || type == 430 || type == 590 || type == 331 || type == 332 || type == 132 || type == 161 || type == 186 || type == 187 || type == 188 || type == 189 || type == 200 || type == 223 || type == 320 || type == 321 || type == 319 || type == 21 || type == 324 || type == 323 || type == 322 || type == 44 || type == 196 || type == 167 || type == 77 || type == 197 || type == 202 || type == 203 || type == 449 || type == 450 || type == 451 || type == 452 || type == 481 || type == 201 || type == 635;
52965 bool flag24 = Main.player[target].ZoneGraveyard && Main.rand.Next(60) == 0;
52966 if ((!Main.bloodMoon || Main.getGoodWorld) && !flag24 && flag23)
52967 {
52968 ai[1] = 0f;
52969 }
52970 velocity.X = 0.5f * (float)(-direction);
52971 int num196 = 5;
52972 if (Main.tile[num194, num195 - 1].type == 388)
52973 {
52974 num196 = 2;
52975 }
52976 ai[1] += num196;
52977 if (type == 27)
52978 {
52979 ai[1] += 1f;
52980 }
52981 if (type == 31 || type == 294 || type == 295 || type == 296)
52982 {
52983 ai[1] += 6f;
52984 }
52985 ai[2] = 0f;
52986 bool flag25 = false;
52987 if (ai[1] >= 10f)
52988 {
52989 flag25 = true;
52990 ai[1] = 10f;
52991 }
52992 if (type == 460)
52993 {
52994 flag25 = true;
52995 }
52996 WorldGen.KillTile(num194, num195 - 1, fail: true);
52997 if ((Main.netMode != 1 || !flag25) && flag25 && Main.netMode != 1)
52998 {
52999 if (type == 26)
53000 {
53002 if (Main.netMode == 2)
53003 {
53004 NetMessage.SendData(17, -1, -1, null, 0, num194, num195 - 1);
53005 }
53006 }
53007 else
53008 {
53009 if (Main.tile[num194, num195 - 1].type == 10)
53010 {
53012 if (!flag26)
53013 {
53014 ai[3] = num56;
53015 netUpdate = true;
53016 }
53017 if (Main.netMode == 2 && flag26)
53018 {
53019 NetMessage.SendData(19, -1, -1, null, 0, num194, num195 - 1, direction);
53020 }
53021 }
53022 if (Main.tile[num194, num195 - 1].type == 388)
53023 {
53024 bool flag27 = WorldGen.ShiftTallGate(num194, num195 - 1, closing: false);
53025 if (!flag27)
53026 {
53027 ai[3] = num56;
53028 netUpdate = true;
53029 }
53030 if (Main.netMode == 2 && flag27)
53031 {
53032 NetMessage.SendData(19, -1, -1, null, 4, num194, num195 - 1);
53033 }
53034 }
53035 }
53036 }
53037 }
53038 }
53039 else
53040 {
53041 int num197 = spriteDirection;
53042 if (type == 425)
53043 {
53044 num197 *= -1;
53045 }
53046 if ((velocity.X < 0f && num197 == -1) || (velocity.X > 0f && num197 == 1))
53047 {
53048 if (height >= 32 && Main.tile[num194, num195 - 2].nactive() && Main.tileSolid[Main.tile[num194, num195 - 2].type])
53049 {
53050 if (Main.tile[num194, num195 - 3].nactive() && Main.tileSolid[Main.tile[num194, num195 - 3].type])
53051 {
53052 velocity.Y = -8f;
53053 netUpdate = true;
53054 }
53055 else
53056 {
53057 velocity.Y = -7f;
53058 netUpdate = true;
53059 }
53060 }
53061 else if (Main.tile[num194, num195 - 1].nactive() && Main.tileSolid[Main.tile[num194, num195 - 1].type])
53062 {
53063 if (type == 624)
53064 {
53065 velocity.Y = -8f;
53066 int num198 = (int)(position.Y + (float)height) / 16;
53067 if (WorldGen.SolidTile((int)base.Center.X / 16, num198 - 8))
53068 {
53069 direction *= -1;
53071 velocity.X = 3 * direction;
53072 }
53073 }
53074 else
53075 {
53076 velocity.Y = -6f;
53077 }
53078 netUpdate = true;
53079 }
53080 else if (position.Y + (float)height - (float)(num195 * 16) > 20f && Main.tile[num194, num195].nactive() && !Main.tile[num194, num195].topSlope() && Main.tileSolid[Main.tile[num194, num195].type])
53081 {
53082 velocity.Y = -5f;
53083 netUpdate = true;
53084 }
53085 else if (directionY < 0 && type != 67 && (!Main.tile[num194, num195 + 1].nactive() || !Main.tileSolid[Main.tile[num194, num195 + 1].type]) && (!Main.tile[num194 + direction, num195 + 1].nactive() || !Main.tileSolid[Main.tile[num194 + direction, num195 + 1].type]))
53086 {
53087 velocity.Y = -8f;
53088 velocity.X *= 1.5f;
53089 netUpdate = true;
53090 }
53091 else if (flag8)
53092 {
53093 ai[1] = 0f;
53094 ai[2] = 0f;
53095 }
53096 if (velocity.Y == 0f && flag6 && ai[3] == 1f)
53097 {
53098 velocity.Y = -5f;
53099 }
53100 if (velocity.Y == 0f && (Main.expertMode || type == 586) && Main.player[target].Bottom.Y < base.Top.Y && Math.Abs(base.Center.X - Main.player[target].Center.X) < (float)(Main.player[target].width * 3) && Collision.CanHit(this, Main.player[target]))
53101 {
53102 if (type == 586)
53103 {
53104 int num199 = (int)((base.Bottom.Y - 16f - Main.player[target].Bottom.Y) / 16f);
53105 if (num199 < 14 && Collision.CanHit(this, Main.player[target]))
53106 {
53107 if (num199 < 7)
53108 {
53109 velocity.Y = -8.8f;
53110 }
53111 else if (num199 < 8)
53112 {
53113 velocity.Y = -9.2f;
53114 }
53115 else if (num199 < 9)
53116 {
53117 velocity.Y = -9.7f;
53118 }
53119 else if (num199 < 10)
53120 {
53121 velocity.Y = -10.3f;
53122 }
53123 else if (num199 < 11)
53124 {
53125 velocity.Y = -10.6f;
53126 }
53127 else
53128 {
53129 velocity.Y = -11f;
53130 }
53131 }
53132 }
53133 if (velocity.Y == 0f)
53134 {
53135 int num200 = 6;
53136 if (Main.player[target].Bottom.Y > base.Top.Y - (float)(num200 * 16))
53137 {
53138 velocity.Y = -7.9f;
53139 }
53140 else
53141 {
53142 int num201 = (int)(base.Center.X / 16f);
53143 int num202 = (int)(base.Bottom.Y / 16f) - 1;
53144 for (int num203 = num202; num203 > num202 - num200; num203--)
53145 {
53146 if (Main.tile[num201, num203].nactive() && TileID.Sets.Platforms[Main.tile[num201, num203].type])
53147 {
53148 velocity.Y = -7.9f;
53149 break;
53150 }
53151 }
53152 }
53153 }
53154 }
53155 }
53156 if ((type == 31 || type == 294 || type == 295 || type == 296 || type == 47 || type == 77 || type == 104 || type == 168 || type == 196 || type == 385 || type == 389 || type == 464 || type == 470 || (type >= 524 && type <= 527)) && velocity.Y == 0f)
53157 {
53158 int num204 = 100;
53159 int num205 = 50;
53160 if (type == 586)
53161 {
53162 num204 = 150;
53163 num205 = 150;
53164 }
53165 if (Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2))) < (float)num204 && Math.Abs(position.Y + (float)(height / 2) - (Main.player[target].position.Y + (float)(Main.player[target].height / 2))) < (float)num205 && ((direction > 0 && velocity.X >= 1f) || (direction < 0 && velocity.X <= -1f)))
53166 {
53167 if (type == 586)
53168 {
53169 velocity.X += direction;
53170 velocity.X *= 2f;
53171 if (velocity.X > 8f)
53172 {
53173 velocity.X = 8f;
53174 }
53175 if (velocity.X < -8f)
53176 {
53177 velocity.X = -8f;
53178 }
53179 velocity.Y = -4.5f;
53180 if (position.Y > Main.player[target].position.Y + 40f)
53181 {
53182 velocity.Y -= 2f;
53183 }
53184 if (position.Y > Main.player[target].position.Y + 80f)
53185 {
53186 velocity.Y -= 2f;
53187 }
53188 if (position.Y > Main.player[target].position.Y + 120f)
53189 {
53190 velocity.Y -= 2f;
53191 }
53192 }
53193 else
53194 {
53195 velocity.X *= 2f;
53196 if (velocity.X > 3f)
53197 {
53198 velocity.X = 3f;
53199 }
53200 if (velocity.X < -3f)
53201 {
53202 velocity.X = -3f;
53203 }
53204 velocity.Y = -4f;
53205 }
53206 netUpdate = true;
53207 }
53208 }
53209 if (type == 120 && velocity.Y < 0f)
53210 {
53211 velocity.Y *= 1.1f;
53212 }
53213 if (type == 287 && velocity.Y == 0f && Math.Abs(position.X + (float)(width / 2) - (Main.player[target].position.X + (float)(Main.player[target].width / 2))) < 150f && Math.Abs(position.Y + (float)(height / 2) - (Main.player[target].position.Y + (float)(Main.player[target].height / 2))) < 50f && ((direction > 0 && velocity.X >= 1f) || (direction < 0 && velocity.X <= -1f)))
53214 {
53215 velocity.X = 8 * direction;
53216 velocity.Y = -4f;
53217 netUpdate = true;
53218 }
53219 if (type == 287 && velocity.Y < 0f)
53220 {
53221 velocity.X *= 1.2f;
53222 velocity.Y *= 1.1f;
53223 }
53224 if (type == 460 && velocity.Y < 0f)
53225 {
53226 velocity.X *= 1.3f;
53227 velocity.Y *= 1.1f;
53228 }
53229 }
53230 }
53231 else if (flag8)
53232 {
53233 ai[1] = 0f;
53234 ai[2] = 0f;
53235 }
53236 if (Main.netMode != 1 && type == 120 && ai[3] >= (float)num56)
53237 {
53238 int targetTileX = (int)Main.player[target].Center.X / 16;
53239 int targetTileY = (int)Main.player[target].Center.Y / 16;
53242 {
53243 position.X = chosenTile.X * 16f - (float)(width / 2);
53244 position.Y = chosenTile.Y * 16f - (float)height;
53245 ai[3] = -120f;
53246 netUpdate = true;
53247 }
53248 }
53249 }
53250
53252 {
53253 if (!Main.eclipse && Main.IsItDay() && (npcInstance == null || !npcInstance.SpawnedFromStatue) && !((double)position.Y > Main.worldSurface * 16.0) && (npcInstance == null || !Main.player[npcInstance.target].ZoneGraveyard) && (!Main.snowMoon || (npcID != 343 && npcID != 350)) && (Main.invasionType != 1 || (npcID != 26 && npcID != 27 && npcID != 28 && npcID != 111 && npcID != 471)) && (!Main.dontStarveWorld || (npcID != 164 && npcID != 163)) && npcID != 73 && npcID != 624 && (npcID != 631 || !(npcInstance.ai[2] > 0f)) && (Main.invasionType != 3 || npcID < 212 || npcID > 216) && (Main.invasionType != 4 || (npcID != 381 && npcID != 382 && npcID != 383 && npcID != 385 && npcID != 386 && npcID != 389 && npcID != 391 && npcID != 520)) && npcID != 31 && npcID != 294 && npcID != 295 && npcID != 296 && npcID != 47 && npcID != 67 && npcID != 77 && npcID != 78 && npcID != 79 && npcID != 80 && npcID != 630 && npcID != 110 && npcID != 120 && npcID != 168 && npcID != 181 && npcID != 185 && npcID != 198 && npcID != 199 && npcID != 206 && npcID != 217 && npcID != 218 && npcID != 219 && npcID != 220 && npcID != 239 && npcID != 243 && npcID != 254 && npcID != 255 && npcID != 257 && npcID != 258 && npcID != 291 && npcID != 292 && npcID != 293 && npcID != 379 && npcID != 380 && npcID != 464 && npcID != 470 && npcID != 424 && (npcID != 411 || (npcInstance != null && !(npcInstance.ai[1] >= 180f) && !(npcInstance.ai[1] < 90f))))
53254 {
53255 switch (npcID)
53256 {
53257 default:
53258 if (npcID != 528 && npcID != 529 && npcID != 530)
53259 {
53260 return npcID == 532;
53261 }
53262 break;
53263 case 409:
53264 case 415:
53265 case 419:
53266 case 425:
53267 case 427:
53268 case 428:
53269 case 429:
53270 case 508:
53271 case 524:
53272 case 525:
53273 case 526:
53274 case 527:
53275 case 580:
53276 case 582:
53277 break;
53278 }
53279 }
53280 return true;
53281 }
53282
53284 {
53285 if (npcID != 110 && npcID != 111 && npcID != 206 && npcID != 216 && npcID != 214 && npcID != 215 && npcID != 291 && npcID != 292 && npcID != 293 && npcID != 350 && npcID != 381 && npcID != 382 && npcID != 383 && npcID != 385 && npcID != 386 && npcID != 389 && npcID != 391 && npcID != 469 && npcID != 166 && npcID != 466 && npcID != 471 && npcID != 411 && npcID != 409 && npcID != 424 && npcID != 425 && npcID != 426 && npcID != 415 && npcID != 419)
53286 {
53287 return npcID == 520;
53288 }
53289 return true;
53290 }
53291
53292 private void AI_001_Slimes()
53293 {
53294 if (type == 1 && (ai[1] == 1f || ai[1] == 2f || ai[1] == 3f))
53295 {
53296 ai[1] = -1f;
53297 }
53298 if (type == 1 && ai[1] == 75f)
53299 {
53300 float num = 0.3f;
53301 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.8f * num, 0.7f * num, 0.1f * num);
53302 if (Main.rand.Next(12) == 0)
53303 {
53304 Dust dust = Dust.NewDustPerfect(base.Center + new Vector2(0f, (float)height * 0.2f) + Main.rand.NextVector2CircularEdge(width, (float)height * 0.6f) * (0.3f + Main.rand.NextFloat() * 0.5f), 228, new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.3f - 1.5f), 127);
53305 dust.scale = 0.5f;
53306 dust.fadeIn = 1.1f;
53307 dust.noGravity = true;
53308 dust.noLight = true;
53309 }
53310 }
53311 if (type == 1 && ai[1] == 0f && Main.netMode != 1 && value > 0f)
53312 {
53313 ai[1] = -1f;
53314 if (Main.remixWorld && ai[0] != -999f && Main.rand.Next(3) == 0)
53315 {
53316 ai[1] = 75f;
53317 netUpdate = true;
53318 }
53319 else if (Main.rand.Next(20) == 0)
53320 {
53321 int num2 = AI_001_Slimes_GenerateItemInsideBody(ai[0] == -999f);
53322 ai[1] = num2;
53323 netUpdate = true;
53324 }
53325 }
53326 if (type == 1 && ai[0] == -999f)
53327 {
53328 frame.Y = 0;
53329 frameCounter = 0.0;
53330 rotation = 0f;
53331 return;
53332 }
53333 if (type == 244)
53334 {
53335 float num3 = (float)Main.DiscoR / 255f;
53336 float num4 = (float)Main.DiscoG / 255f;
53337 float num5 = (float)Main.DiscoB / 255f;
53338 num3 *= 1f;
53339 num4 *= 1f;
53340 num5 *= 1f;
53341 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), num3, num4, num5);
53343 }
53344 bool flag = false;
53345 if (!Main.dayTime || life != lifeMax || (double)position.Y > Main.worldSurface * 16.0 || Main.slimeRain)
53346 {
53347 flag = true;
53348 }
53349 if (Main.remixWorld && type == 59 && life == lifeMax)
53350 {
53351 flag = false;
53352 }
53353 if (type == 81)
53354 {
53355 flag = true;
53356 if (Main.rand.Next(30) == 0)
53357 {
53359 int num6 = Dust.NewDust(position, width, height, 14, 0f, 0f, alpha, this.color);
53360 Main.dust[num6].velocity *= 0.3f;
53362 }
53363 }
53364 if ((type == 377 || type == 446) && target != 255 && !Main.player[target].dead && Vector2.Distance(base.Center, Main.player[target].Center) <= 200f && !wet)
53365 {
53366 flag = true;
53367 }
53368 if (type == 183)
53369 {
53370 flag = true;
53371 }
53372 if (type == 304)
53373 {
53374 flag = true;
53375 }
53376 if (type == 667)
53377 {
53378 flag = true;
53379 }
53380 if (type == 244)
53381 {
53382 flag = true;
53383 ai[0] += 2f;
53384 }
53385 if (type == 147 && Main.rand.Next(10) == 0)
53386 {
53388 int num7 = Dust.NewDust(position, width, height, 76);
53389 Main.dust[num7].noGravity = true;
53390 Main.dust[num7].velocity *= 0.1f;
53392 }
53393 if (type == 667)
53394 {
53395 Color color = new Color(204, 181, 72, 255);
53396 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), (float)(int)color.R / 255f * 1.1f, (float)(int)color.G / 255f * 1.1f, (float)(int)color.B / 255f * 1.1f);
53397 if (velocity.Length() > 1f || Main.rand.Next(4) != 0)
53398 {
53399 int num8 = 8;
53400 Vector2 vector = position + new Vector2(-num8, -num8);
53401 int num9 = width + num8 * 2;
53402 int num10 = height + num8 * 2;
53404 int num11 = Dust.NewDust(vector, num9, num10, 246);
53405 Main.dust[num11].noGravity = true;
53406 Main.dust[num11].noLightEmittence = true;
53407 Main.dust[num11].velocity *= 0.2f;
53408 Main.dust[num11].scale = 1.5f;
53410 }
53411 }
53412 if (type == 676)
53413 {
53414 Lighting.AddLight(base.Center, 23);
53415 if ((velocity.Length() > 1f && Main.rand.Next(3) == 0) || Main.rand.Next(5) == 0)
53416 {
53417 Dust dust2 = Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(base.Hitbox), 306);
53418 dust2.noGravity = true;
53419 dust2.noLightEmittence = true;
53420 dust2.alpha = 127;
53421 dust2.color = Main.hslToRgb(((float)Main.timeForVisualEffects / 300f + Main.rand.NextFloat() * 0.1f) % 1f, 1f, 0.65f);
53422 dust2.color.A = 0;
53423 dust2.velocity = dust2.position - base.Center;
53424 dust2.velocity *= 0.1f;
53425 dust2.velocity.X *= 0.25f;
53426 if (dust2.velocity.Y > 0f)
53427 {
53428 dust2.velocity.Y *= -1f;
53429 }
53430 dust2.scale = Main.rand.NextFloat() * 0.3f + 0.5f;
53431 dust2.fadeIn = 0.9f;
53432 dust2.position += netOffset;
53433 }
53434 }
53435 if (type == 184)
53436 {
53437 if (Main.rand.Next(8) == 0)
53438 {
53441 Main.dust[num12].noGravity = true;
53442 Main.dust[num12].velocity *= 0.15f;
53444 }
53445 flag = true;
53446 if (localAI[0] > 0f)
53447 {
53448 localAI[0] -= 1f;
53449 }
53450 if (!wet && !Main.player[target].npcTypeNoAggro[type])
53451 {
53452 Vector2 vector2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
53453 float num13 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector2.X;
53454 float num14 = Main.player[target].position.Y - vector2.Y;
53455 float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
53456 if (Main.expertMode && num15 < 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53457 {
53458 ai[0] = -40f;
53459 if (velocity.Y == 0f)
53460 {
53461 velocity.X *= 0.9f;
53462 }
53463 if (Main.netMode != 1 && localAI[0] == 0f)
53464 {
53465 for (int i = 0; i < 5; i++)
53466 {
53467 Vector2 vector3 = new Vector2(i - 2, -4f);
53468 vector3.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53469 vector3.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53470 vector3.Normalize();
53471 vector3 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f;
53474 localAI[0] = 30f;
53475 }
53476 }
53477 }
53478 else if (num15 < 200f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53479 {
53480 ai[0] = -40f;
53481 if (velocity.Y == 0f)
53482 {
53483 velocity.X *= 0.9f;
53484 }
53485 if (Main.netMode != 1 && localAI[0] == 0f)
53486 {
53487 num14 = Main.player[target].position.Y - vector2.Y - (float)Main.rand.Next(0, 200);
53488 num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
53489 num15 = 4.5f / num15;
53490 num13 *= num15;
53491 num14 *= num15;
53492 localAI[0] = 50f;
53494 }
53495 }
53496 }
53497 }
53498 if (type == 535)
53499 {
53500 flag = true;
53501 if (localAI[0] > 0f)
53502 {
53503 localAI[0] -= 1f;
53504 }
53505 if (!wet && !Main.player[target].npcTypeNoAggro[type])
53506 {
53507 Vector2 vector4 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
53508 float num16 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector4.X;
53509 float num17 = Main.player[target].position.Y - vector4.Y;
53510 float num18 = (float)Math.Sqrt(num16 * num16 + num17 * num17);
53511 if (Main.expertMode && num18 < 120f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53512 {
53513 ai[0] = -40f;
53514 if (velocity.Y == 0f)
53515 {
53516 velocity.X *= 0.9f;
53517 }
53518 if (Main.netMode != 1 && localAI[0] == 0f)
53519 {
53520 for (int j = 0; j < 5; j++)
53521 {
53522 Vector2 vector5 = new Vector2(j - 2, -4f);
53523 vector5.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53524 vector5.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53525 vector5.Normalize();
53526 vector5 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f;
53529 localAI[0] = 30f;
53530 }
53531 }
53532 }
53533 else if (num18 < 200f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53534 {
53535 ai[0] = -40f;
53536 if (velocity.Y == 0f)
53537 {
53538 velocity.X *= 0.9f;
53539 }
53540 if (Main.netMode != 1 && localAI[0] == 0f)
53541 {
53542 num17 = Main.player[target].position.Y - vector4.Y - (float)Main.rand.Next(0, 200);
53543 num18 = (float)Math.Sqrt(num16 * num16 + num17 * num17);
53544 num18 = 4.5f / num18;
53545 num16 *= num18;
53546 num17 *= num18;
53547 localAI[0] = 50f;
53549 }
53550 }
53551 }
53552 }
53553 if (type == 658)
53554 {
53555 flag = true;
53556 if (localAI[0] > 0f)
53557 {
53558 localAI[0] -= 1f;
53559 }
53560 if (!wet && Main.player[target].active && !Main.player[target].dead && !Main.player[target].npcTypeNoAggro[type])
53561 {
53563 Vector2 center = base.Center;
53564 float num19 = obj.Center.X - center.X;
53565 float num20 = obj.Center.Y - center.Y;
53566 float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20);
53567 int num22 = CountNPCS(658);
53568 if (Main.expertMode && num22 < 5 && Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53569 {
53570 ai[0] = -40f;
53571 if (velocity.Y == 0f)
53572 {
53573 velocity.X *= 0.9f;
53574 }
53575 if (Main.netMode != 1 && localAI[0] == 0f)
53576 {
53577 for (int k = 0; k < 3; k++)
53578 {
53579 Vector2 vector6 = new Vector2(k - 1, -4f);
53580 vector6.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53581 vector6.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f;
53582 vector6.Normalize();
53583 vector6 *= 6f + (float)Main.rand.Next(-50, 51) * 0.01f;
53584 if (num21 > 350f)
53585 {
53586 vector6 *= 2f;
53587 }
53588 else if (num21 > 250f)
53589 {
53590 vector6 *= 1.5f;
53591 }
53594 localAI[0] = 25f;
53595 if (num22 > 4)
53596 {
53597 break;
53598 }
53599 }
53600 }
53601 }
53602 else if (Math.Abs(num19) < 500f && Math.Abs(num20) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53603 {
53604 float num23 = num21;
53605 ai[0] = -40f;
53606 if (velocity.Y == 0f)
53607 {
53608 velocity.X *= 0.9f;
53609 }
53610 if (Main.netMode != 1 && localAI[0] == 0f)
53611 {
53612 num20 = Main.player[target].position.Y - center.Y - (float)Main.rand.Next(0, 200);
53613 num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20);
53614 num21 = 4.5f / num21;
53615 num21 *= 2f;
53616 if (num23 > 350f)
53617 {
53618 num21 *= 2f;
53619 }
53620 else if (num23 > 250f)
53621 {
53622 num21 *= 1.5f;
53623 }
53624 num19 *= num21;
53625 num20 *= num21;
53626 localAI[0] = 50f;
53629 }
53630 }
53631 }
53632 }
53633 if (type == 659)
53634 {
53635 flag = true;
53636 if (localAI[0] > 0f)
53637 {
53638 localAI[0] -= 1f;
53639 }
53640 if (!wet && Main.player[target].active && !Main.player[target].dead && !Main.player[target].npcTypeNoAggro[type])
53641 {
53643 Vector2 center2 = base.Center;
53644 float num24 = obj2.Center.X - center2.X;
53645 float num25 = obj2.Center.Y - center2.Y;
53646 float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25);
53647 float num27 = num26;
53648 if (Math.Abs(num24) < 500f && Math.Abs(num25) < 550f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53649 {
53650 ai[0] = -40f;
53651 if (velocity.Y == 0f)
53652 {
53653 velocity.X *= 0.9f;
53654 }
53655 if (Main.netMode != 1 && localAI[0] == 0f)
53656 {
53657 num25 = Main.player[target].position.Y - center2.Y - (float)Main.rand.Next(0, 200);
53658 num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25);
53659 num26 = 4.5f / num26;
53660 num26 *= 2f;
53661 if (num27 > 350f)
53662 {
53663 num26 *= 1.75f;
53664 }
53665 else if (num27 > 250f)
53666 {
53667 num26 *= 1.25f;
53668 }
53669 num24 *= num26;
53670 num25 *= num26;
53671 localAI[0] = 40f;
53672 if (Main.expertMode)
53673 {
53674 localAI[0] = 30f;
53675 }
53678 }
53679 }
53680 }
53681 }
53682 if (type == 204)
53683 {
53684 flag = true;
53685 if (localAI[0] > 0f)
53686 {
53687 localAI[0] -= 1f;
53688 }
53689 if (!wet && !Main.player[target].npcTypeNoAggro[type])
53690 {
53691 Vector2 vector7 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
53692 float num28 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector7.X;
53693 float num29 = Main.player[target].position.Y - vector7.Y;
53694 float num30 = (float)Math.Sqrt(num28 * num28 + num29 * num29);
53695 if (Main.expertMode && num30 < 200f && Collision.CanHit(new Vector2(position.X, position.Y - 20f), width, height + 20, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53696 {
53697 ai[0] = -40f;
53698 if (velocity.Y == 0f)
53699 {
53700 velocity.X *= 0.9f;
53701 }
53702 if (Main.netMode != 1 && localAI[0] == 0f)
53703 {
53704 for (int l = 0; l < 5; l++)
53705 {
53706 Vector2 vector8 = new Vector2(l - 2, -2f);
53707 vector8.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f;
53708 vector8.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f;
53709 vector8.Normalize();
53710 vector8 *= 3f + (float)Main.rand.Next(-50, 51) * 0.01f;
53713 localAI[0] = 80f;
53714 }
53715 }
53716 }
53717 if (num30 < 400f && Collision.CanHit(new Vector2(position.X, position.Y - 20f), width, height + 20, Main.player[target].position, Main.player[target].width, Main.player[target].height) && velocity.Y == 0f)
53718 {
53719 ai[0] = -80f;
53720 if (velocity.Y == 0f)
53721 {
53722 velocity.X *= 0.9f;
53723 }
53724 if (Main.netMode != 1 && localAI[0] == 0f)
53725 {
53726 num29 = Main.player[target].position.Y - vector7.Y - (float)Main.rand.Next(-30, 20);
53727 num29 -= num30 * 0.05f;
53728 num28 = Main.player[target].position.X - vector7.X - (float)Main.rand.Next(-20, 20);
53729 num30 = (float)Math.Sqrt(num28 * num28 + num29 * num29);
53730 num30 = 7f / num30;
53731 num28 *= num30;
53732 num29 *= num30;
53733 localAI[0] = 65f;
53735 }
53736 }
53737 }
53738 }
53739 if (type == 377 || type == 446)
53740 {
53741 if (localAI[2] < 90f)
53742 {
53743 localAI[2] += 1f;
53744 }
53745 else
53746 {
53747 friendly = false;
53748 }
53749 }
53750 if (type == 59)
53751 {
53753 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.3f, 0.1f);
53754 int num31 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.7f);
53755 Main.dust[num31].noGravity = true;
53757 }
53758 if (ai[2] > 1f)
53759 {
53760 ai[2] -= 1f;
53761 }
53762 if (wet)
53763 {
53764 if (collideY)
53765 {
53766 velocity.Y = -2f;
53767 }
53768 if (velocity.Y < 0f && ai[3] == position.X)
53769 {
53770 direction *= -1;
53771 ai[2] = 200f;
53772 }
53773 if (velocity.Y > 0f)
53774 {
53775 ai[3] = position.X;
53776 }
53777 if (type == 59 && !Main.remixWorld)
53778 {
53779 if (velocity.Y > 2f)
53780 {
53781 velocity.Y *= 0.9f;
53782 }
53783 else if (directionY < 0)
53784 {
53785 velocity.Y -= 0.8f;
53786 }
53787 velocity.Y -= 0.5f;
53788 if (velocity.Y < -10f)
53789 {
53790 velocity.Y = -10f;
53791 }
53792 }
53793 else
53794 {
53795 if (velocity.Y > 2f)
53796 {
53797 velocity.Y *= 0.9f;
53798 }
53799 velocity.Y -= 0.5f;
53800 if (velocity.Y < -4f)
53801 {
53802 velocity.Y = -4f;
53803 }
53804 }
53805 if (ai[2] == 1f && flag)
53806 {
53807 TargetClosest();
53808 }
53809 }
53810 aiAction = 0;
53811 if (ai[2] == 0f)
53812 {
53813 ai[0] = -100f;
53814 ai[2] = 1f;
53815 TargetClosest();
53816 }
53817 if (velocity.Y == 0f)
53818 {
53820 {
53821 position.X -= velocity.X + (float)direction;
53822 }
53823 if (ai[3] == position.X)
53824 {
53825 direction *= -1;
53826 ai[2] = 200f;
53827 }
53828 ai[3] = 0f;
53829 velocity.X *= 0.8f;
53830 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
53831 {
53832 velocity.X = 0f;
53833 }
53834 if (flag)
53835 {
53836 ai[0] += 1f;
53837 }
53838 ai[0] += 1f;
53839 if (type == 59 && !Main.remixWorld)
53840 {
53841 ai[0] += 2f;
53842 }
53843 if (type == 71)
53844 {
53845 ai[0] += 3f;
53846 }
53847 if (type == 667)
53848 {
53849 ai[0] += 3f;
53850 }
53851 if (type == 138)
53852 {
53853 ai[0] += 2f;
53854 }
53855 if (type == 183)
53856 {
53857 ai[0] += 1f;
53858 }
53859 if (type == 658)
53860 {
53861 ai[0] += 5f;
53862 }
53863 if (type == 659)
53864 {
53865 ai[0] += 3f;
53866 }
53867 if (type == 304)
53868 {
53869 float num32 = (1 - life / lifeMax) * 10;
53870 ai[0] += num32;
53871 }
53872 if (type == 377 || type == 446)
53873 {
53874 ai[0] += 3f;
53875 }
53876 if (type == 81)
53877 {
53878 if (scale >= 0f)
53879 {
53880 ai[0] += 4f;
53881 }
53882 else
53883 {
53884 ai[0] += 1f;
53885 }
53886 }
53887 float num33 = -1000f;
53888 if (type == 659)
53889 {
53890 num33 = -500f;
53891 }
53892 if (type == 667)
53893 {
53894 num33 = -400f;
53895 }
53896 int num34 = 0;
53897 if (ai[0] >= 0f)
53898 {
53899 num34 = 1;
53900 }
53901 if (ai[0] >= num33 && ai[0] <= num33 * 0.5f)
53902 {
53903 num34 = 2;
53904 }
53905 if (ai[0] >= num33 * 2f && ai[0] <= num33 * 1.5f)
53906 {
53907 num34 = 3;
53908 }
53909 if (num34 > 0)
53910 {
53911 netUpdate = true;
53912 if (flag && ai[2] == 1f)
53913 {
53914 TargetClosest();
53915 }
53916 if (num34 == 3)
53917 {
53918 velocity.Y = -8f;
53919 if (type == 59 && !Main.remixWorld)
53920 {
53921 velocity.Y -= 2f;
53922 }
53923 velocity.X += 3 * direction;
53924 if (type == 59 && !Main.remixWorld)
53925 {
53926 velocity.X += 0.5f * (float)direction;
53927 }
53928 ai[0] = -200f;
53929 ai[3] = position.X;
53930 }
53931 else
53932 {
53933 velocity.Y = -6f;
53934 velocity.X += 2 * direction;
53935 if (type == 59 && !Main.remixWorld)
53936 {
53937 velocity.X += 2 * direction;
53938 }
53939 ai[0] = -120f;
53940 if (num34 == 1)
53941 {
53942 ai[0] += num33;
53943 }
53944 else
53945 {
53946 ai[0] += num33 * 2f;
53947 }
53948 }
53949 if (type == 659)
53950 {
53951 velocity.Y *= 1.6f;
53952 velocity.X *= 1.2f;
53953 }
53954 if (type == 685)
53955 {
53956 velocity.Y *= 0.5f;
53957 velocity.X *= 0.2f;
53958 if (Main.rand.Next(2) == 0)
53959 {
53960 direction *= -1;
53961 }
53962 }
53963 if (type == 141)
53964 {
53965 velocity.Y *= 1.3f;
53966 velocity.X *= 1.2f;
53967 }
53968 if (type == 377 || type == 446)
53969 {
53970 velocity.Y *= 0.9f;
53971 velocity.X *= 0.6f;
53972 if (flag)
53973 {
53975 velocity.X *= -1f;
53976 }
53977 int i2 = (int)(base.Center.X / 16f);
53978 int j2 = (int)(base.Center.Y / 16f) - 1;
53979 if (WorldGen.SolidTile(i2, j2) && 0f - velocity.Y + (float)height > 16f)
53980 {
53981 velocity.Y = -(16 - height);
53982 }
53983 }
53984 }
53985 else if (ai[0] >= -30f)
53986 {
53987 aiAction = 1;
53988 }
53989 }
53990 else if (target < 255 && ((direction == 1 && velocity.X < 3f) || (direction == -1 && velocity.X > -3f)))
53991 {
53992 if (collideX && Math.Abs(velocity.X) == 0.2f)
53993 {
53994 position.X -= 1.4f * (float)direction;
53995 }
53997 {
53998 position.X -= velocity.X + (float)direction;
53999 }
54000 if ((direction == -1 && (double)velocity.X < 0.01) || (direction == 1 && (double)velocity.X > -0.01))
54001 {
54002 velocity.X += 0.2f * (float)direction;
54003 }
54004 else
54005 {
54006 velocity.X *= 0.93f;
54007 }
54008 }
54009 }
54010
54012 {
54013 color.R = (byte)Main.DiscoR;
54014 color.G = (byte)Main.DiscoG;
54015 color.B = (byte)Main.DiscoB;
54016 color.A = 100;
54017 alpha = 175;
54018 }
54019
54021 {
54022 int num = Main.rand.Next(4);
54023 if (isBallooned)
54024 {
54025 switch (Main.rand.Next(13))
54026 {
54027 default:
54028 return 4367;
54029 case 1:
54030 return 4368;
54031 case 2:
54032 return 4369;
54033 case 3:
54034 return 4370;
54035 case 4:
54036 return 4371;
54037 case 5:
54038 return 4612;
54039 case 6:
54040 return 4674;
54041 case 7:
54042 case 8:
54043 case 9:
54044 return 4343;
54045 case 10:
54046 case 11:
54047 case 12:
54048 return 4344;
54049 }
54050 }
54051 switch (num)
54052 {
54053 case 0:
54054 switch (Main.rand.Next(7))
54055 {
54056 case 0:
54057 return 290;
54058 case 1:
54059 return 292;
54060 case 2:
54061 return 296;
54062 case 3:
54063 return 2322;
54064 default:
54065 if (Main.netMode != 0 && Main.rand.Next(2) == 0)
54066 {
54067 return 2997;
54068 }
54069 return 2350;
54070 }
54071 case 1:
54072 return Main.rand.Next(4) switch
54073 {
54074 0 => 8,
54075 1 => 166,
54076 2 => 965,
54077 _ => 58,
54078 };
54079 case 2:
54080 if (Main.rand.Next(2) == 0)
54081 {
54082 return Main.rand.Next(11, 15);
54083 }
54084 return Main.rand.Next(699, 703);
54085 default:
54086 return Main.rand.Next(3) switch
54087 {
54088 0 => 71,
54089 1 => 72,
54090 _ => 73,
54091 };
54092 }
54093 }
54094
54095 private void AI_110_Betsy()
54096 {
54097 //IL_04f4: Unknown result type (might be due to invalid IL or missing references)
54098 //IL_0486: Unknown result type (might be due to invalid IL or missing references)
54099 //IL_0b13: Unknown result type (might be due to invalid IL or missing references)
54100 //IL_0c83: Unknown result type (might be due to invalid IL or missing references)
54101 //IL_1363: Unknown result type (might be due to invalid IL or missing references)
54102 //IL_1376: Unknown result type (might be due to invalid IL or missing references)
54103 //IL_137b: Unknown result type (might be due to invalid IL or missing references)
54104 //IL_0693: Unknown result type (might be due to invalid IL or missing references)
54105 //IL_0698: Unknown result type (might be due to invalid IL or missing references)
54106 //IL_10a7: Unknown result type (might be due to invalid IL or missing references)
54107 //IL_117f: Unknown result type (might be due to invalid IL or missing references)
54110 int num = -1;
54111 float num2 = 1f;
54112 int num3 = 35;
54113 int num4 = 35;
54114 float num5 = 10f;
54115 float num6 = 0.45f;
54116 float num7 = 7.5f;
54117 float num8 = 30f;
54118 float num9 = 30f;
54119 float num10 = 23f;
54120 float num11 = 600f;
54121 float num12 = 12f;
54122 float num13 = 40f;
54123 float num14 = 80f;
54124 float num15 = num13 + num14;
54125 float num16 = 1500f;
54126 float num17 = 60f;
54127 float num18 = 13f;
54128 float amount = 1f / 30f;
54129 float num19 = 12f;
54130 int num20 = 10;
54131 int num21 = 6 * num20;
54132 float num22 = 60f;
54133 float num23 = num17 + (float)num21 + num22;
54134 float num24 = 60f;
54135 float num25 = 1f;
54136 float num26 = (float)Math.PI * 2f * (num25 / num24);
54137 float num27 = 0.1f;
54138 float num28 = 32f;
54139 float num29 = 90f;
54140 float num30 = 20f;
54141 _ = ai[0];
54142 _ = -1f;
54143 SlotId val;
54144 if (ai[0] == 0f)
54145 {
54146 if ((ai[1] += 1f) >= num5)
54147 {
54148 ai[1] = 0f;
54149 ai[0] = 1f;
54150 ai[2] = 0f;
54151 netUpdate = true;
54152 }
54153 }
54154 else if (ai[0] == 1f)
54155 {
54156 if (ai[2] == 0f)
54157 {
54158 ai[2] = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54159 }
54160 Vector2 destination = targetData.Center + new Vector2((0f - ai[2]) * 300f, -200f);
54163 int num31 = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54165 if ((ai[1] += 1f) >= num8)
54166 {
54167 int num32 = 1;
54168 if (ai[3] == 5f && Main.rand.Next(3) == 0)
54169 {
54170 ai[3] += 1f;
54171 }
54172 switch ((int)ai[3])
54173 {
54174 case 0:
54175 case 1:
54176 case 3:
54177 num32 = 2;
54178 break;
54179 case 2:
54180 num32 = 3;
54181 break;
54182 case 4:
54183 num32 = 4;
54184 break;
54185 case 5:
54186 num32 = 5;
54187 break;
54188 case 6:
54189 num32 = 3;
54190 break;
54191 case 7:
54192 num32 = 6;
54193 break;
54194 }
54195 ai[0] = num32;
54196 ai[1] = 0f;
54197 ai[2] = 0f;
54198 ai[3] += 1f;
54199 netUpdate = true;
54200 if (ai[3] >= 8f)
54201 {
54202 ai[3] = 0f;
54203 }
54204 switch (num32)
54205 {
54206 case 2:
54207 {
54209 spriteDirection = ((vector2.X > 0f) ? 1 : (-1));
54210 rotation = vector2.ToRotation();
54211 if (spriteDirection == -1)
54212 {
54213 rotation += (float)Math.PI;
54214 }
54216 break;
54217 }
54218 case 3:
54219 {
54220 Vector2 vector3 = new Vector2((targetData.Center.X > base.Center.X) ? 1 : (-1), 0f);
54221 spriteDirection = ((vector3.X > 0f) ? 1 : (-1));
54222 velocity = vector3 * -2f;
54223 break;
54224 }
54225 case 5:
54226 {
54228 spriteDirection = ((vector.X > 0f) ? 1 : (-1));
54229 rotation = vector.ToRotation();
54230 if (spriteDirection == -1)
54231 {
54232 rotation += (float)Math.PI;
54233 }
54234 velocity = vector * num28;
54235 break;
54236 }
54237 }
54238 }
54239 }
54240 else if (ai[0] == 2f)
54241 {
54242 if (ai[1] == 0f)
54243 {
54245 }
54246 if ((ai[1] += 1f) >= num9)
54247 {
54248 ai[0] = 1f;
54249 ai[1] = 0f;
54250 ai[2] = 0f;
54251 }
54252 }
54253 else if (ai[0] == 3f)
54254 {
54256 if (activeSound != null)
54257 {
54258 activeSound.Position = base.Center;
54259 }
54260 ai[1] += 1f;
54261 int num33 = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54262 ai[2] = num33;
54263 if (ai[1] < num13)
54264 {
54265 Vector2 vector4 = targetData.Center + new Vector2((float)num33 * (0f - num11), -250f);
54267 if (Distance(vector4) < num12)
54268 {
54269 base.Center = vector4;
54270 }
54271 else
54272 {
54273 position += vector5;
54274 }
54275 if (Vector2.Distance(vector4, base.Center) < 16f)
54276 {
54277 ai[1] = num13 - 1f;
54278 }
54279 num2 = 1.5f;
54280 }
54281 if (ai[1] == num13)
54282 {
54283 int num34 = ((targetData.Center.X > base.Center.X) ? 1 : (-1));
54284 velocity = new Vector2(num34, 0f) * 10f;
54286 if (Main.netMode != 1)
54287 {
54289 }
54290 float[] array = localAI;
54292 array[2] = ((SlotId)(ref val)).ToFloat();
54293 }
54294 if (ai[1] >= num13)
54295 {
54296 num2 = 1.5f;
54297 if (Math.Abs(targetData.Center.X - base.Center.X) > 550f && Math.Abs(velocity.X) < 20f)
54298 {
54299 velocity.X += (float)Math.Sign(velocity.X) * 0.5f;
54300 }
54301 }
54302 if (ai[1] >= num15)
54303 {
54304 ai[0] = 1f;
54305 ai[1] = 0f;
54306 ai[2] = 0f;
54307 }
54308 }
54309 else if (ai[0] == 4f)
54310 {
54311 int num35 = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54312 ai[2] = num35;
54313 if (ai[1] < num17)
54314 {
54315 Vector2 vector6 = targetData.Center + new Vector2((float)num35 * (0f - num16), -350f);
54318 int num36 = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54320 if (Vector2.Distance(vector6, base.Center) < 16f)
54321 {
54322 ai[1] = num17 - 1f;
54323 }
54324 num2 = 1.5f;
54325 }
54326 else if (ai[1] == num17)
54327 {
54328 Vector2 v = DirectionTo(targetData.Center);
54329 v.Y *= 0.25f;
54330 v = v.SafeNormalize(Vector2.UnitX * direction);
54331 spriteDirection = ((v.X > 0f) ? 1 : (-1));
54332 rotation = v.ToRotation();
54333 if (spriteDirection == -1)
54334 {
54335 rotation += (float)Math.PI;
54336 }
54337 velocity = v * num19;
54338 }
54339 else
54340 {
54341 position.X += DirectionTo(targetData.Center).X * 7f;
54342 position.Y += DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f;
54343 if (ai[1] <= num23 - num22)
54344 {
54345 num2 = 1.5f;
54346 }
54347 float num37 = 30f;
54348 Vector2 vector7 = base.Center + new Vector2((110f + num37) * (float)direction, 20f).RotatedBy(rotation);
54349 int num38 = (int)(ai[1] - num17 + 1f);
54350 if (num38 <= num21 && num38 % num20 == 0 && Main.netMode != 1)
54351 {
54353 }
54354 }
54355 if (ai[1] > num23 - num22)
54356 {
54357 velocity.Y -= 0.1f;
54358 }
54359 ai[1] += 1f;
54360 if (ai[1] >= num23)
54361 {
54362 ai[0] = 1f;
54363 ai[1] = 0f;
54364 ai[2] = 0f;
54365 }
54366 }
54367 else if (ai[0] == 5f)
54368 {
54369 velocity = velocity.RotatedBy((0f - num26) * (float)direction);
54370 position.Y -= num27;
54371 position += DirectionTo(targetData.Center) * 10f;
54372 rotation -= num26 * (float)direction;
54373 num2 *= 0.7f;
54374 if (ai[1] == 1f)
54375 {
54377 }
54378 if ((ai[1] += 1f) >= num24)
54379 {
54380 ai[0] = 1f;
54381 ai[1] = 0f;
54382 ai[2] = 0f;
54383 velocity /= 2f;
54384 }
54385 }
54386 else if (ai[0] == 6f)
54387 {
54388 if (ai[1] == 0f)
54389 {
54390 Vector2 destination2 = targetData.Center + new Vector2(0f, -200f);
54393 int num39 = ((base.Center.X < targetData.Center.X) ? 1 : (-1));
54395 ai[2] += 1f;
54396 if (Distance(targetData.Center) < 350f || ai[2] >= 180f)
54397 {
54398 ai[1] = 1f;
54399 netUpdate = true;
54400 }
54401 }
54402 else
54403 {
54404 if (ai[1] == 1f)
54405 {
54407 }
54408 if (ai[1] < num30)
54409 {
54410 velocity *= 0.95f;
54411 }
54412 else
54413 {
54414 velocity *= 0.98f;
54415 }
54416 if (ai[1] == num30)
54417 {
54418 if (velocity.Y > 0f)
54419 {
54420 velocity.Y /= 3f;
54421 }
54422 velocity.Y -= 3f;
54423 }
54424 num2 *= 0.85f;
54425 if (ai[1] == 20f || ai[1] == 25f || ai[1] == 30f)
54426 {
54427 Point point = base.Center.ToTileCoordinates();
54428 int num40 = 30;
54429 int num41 = 35;
54430 int num42 = 4;
54431 for (int i = point.X - num40; i <= point.X + num40; i++)
54432 {
54433 bool flag = false;
54434 for (int j = point.Y - num41 / 3; j < point.Y + num41; j++)
54435 {
54437 bool flag2 = tileSafely.active() && Main.tileSolid[tileSafely.type] && !Main.tileFrameImportant[tileSafely.type];
54438 if (flag && flag2)
54439 {
54441 for (int k = 0; k < num43; k++)
54442 {
54444 obj.velocity.Y -= 3f + (float)num42 * 1.5f;
54445 obj.velocity.Y *= Main.rand.NextFloat();
54446 obj.scale += (float)num42 * 0.03f;
54447 }
54448 for (int l = 0; l < num43 - 1; l++)
54449 {
54451 obj2.velocity.Y -= 1f + (float)num42;
54452 obj2.velocity.Y *= Main.rand.NextFloat();
54453 }
54454 if (num43 > 0 && Main.rand.Next(3) != 0)
54455 {
54456 float num44 = Math.Abs(point.X - i) / (num40 / 2);
54457 Gore gore = Gore.NewGoreDirect(position, Vector2.Zero, 61 + Main.rand.Next(3), 1f - (float)num42 * 0.15f + num44 * 0.5f);
54458 gore.velocity.Y -= 0.1f + (float)num42 * 0.5f + num44 * (float)num42 * 1f;
54459 gore.velocity.Y *= Main.rand.NextFloat();
54460 gore.position = new Vector2(i * 16 + 20, j * 16 + 20);
54461 }
54462 }
54463 flag = !flag2;
54464 }
54465 }
54466 }
54467 bool flag3 = ai[1] == 20f || ai[1] == 45f || ai[1] == 70f;
54468 if (CountNPCS(560) > 4)
54469 {
54470 flag3 = false;
54471 }
54472 if (flag3 && Main.netMode != 1)
54473 {
54474 for (int m = 0; m < 1; m++)
54475 {
54476 Vector2 vector8 = base.Center + ((float)Math.PI * 2f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 300f * (0.6f + Main.rand.NextFloat() * 0.4f);
54477 if (Vector2.Distance(vector8, targetData.Center) > 100f)
54478 {
54479 Point point2 = vector8.ToPoint();
54482 }
54483 }
54484 List<NPC> list = new List<NPC>();
54485 for (int n = 0; n < 200; n++)
54486 {
54487 NPC nPC = Main.npc[n];
54488 if (nPC.active && nPC.type == 549)
54489 {
54490 list.Add(nPC);
54491 }
54492 }
54493 if (list.Count > 0)
54494 {
54495 for (int num45 = 0; num45 < 3; num45++)
54496 {
54497 NPC nPC2 = list[Main.rand.Next(list.Count)];
54498 Point point3 = nPC2.Center.ToPoint();
54501 }
54502 }
54503 }
54504 ai[1] += 1f;
54505 }
54506 if (ai[1] >= num29)
54507 {
54508 ai[0] = 1f;
54509 ai[1] = 0f;
54510 ai[2] = 0f;
54511 }
54512 }
54513 localAI[0] += num2;
54514 if (localAI[0] >= 36f)
54515 {
54516 localAI[0] = 0f;
54517 }
54518 if (num != -1)
54519 {
54520 localAI[0] = num * 4;
54521 }
54522 if ((localAI[1] += 1f) >= 60f)
54523 {
54524 localAI[1] = 0f;
54525 }
54526 float num46 = DirectionTo(targetData.Center).ToRotation();
54527 float num47 = 0.04f;
54528 switch ((int)ai[0])
54529 {
54530 case 2:
54531 case 5:
54532 num47 = 0f;
54533 break;
54534 case 3:
54535 num47 = 0.01f;
54536 num46 = 0f;
54537 if (spriteDirection == -1)
54538 {
54539 num46 -= (float)Math.PI;
54540 }
54541 if (ai[1] >= num13)
54542 {
54543 num46 += (float)spriteDirection * (float)Math.PI / 12f;
54544 num47 = 0.05f;
54545 }
54546 break;
54547 case 4:
54548 num47 = 0.01f;
54549 num46 = (float)Math.PI;
54550 if (spriteDirection == 1)
54551 {
54552 num46 += (float)Math.PI;
54553 }
54554 break;
54555 case 6:
54556 num47 = 0.02f;
54557 num46 = 0f;
54558 if (spriteDirection == -1)
54559 {
54560 num46 -= (float)Math.PI;
54561 }
54562 break;
54563 }
54564 if (spriteDirection == -1)
54565 {
54566 num46 += (float)Math.PI;
54567 }
54568 if (num47 != 0f)
54569 {
54570 rotation = rotation.AngleTowards(num46, num47);
54571 }
54573 {
54574 float[] array2 = localAI;
54575 val = SlotId.Invalid;
54576 array2[2] = ((SlotId)(ref val)).ToFloat();
54577 }
54578 }
54579
54580 private void AI_026_Unicorns()
54581 {
54582 int num = 30;
54583 int num2 = 10;
54584 bool flag = false;
54585 bool flag2 = false;
54586 bool flag3 = false;
54587 if (velocity.Y == 0f && ((velocity.X > 0f && direction < 0) || (velocity.X < 0f && direction > 0)))
54588 {
54589 flag2 = true;
54590 ai[3] += 1f;
54591 }
54592 if (type == 546)
54593 {
54594 num2 = 4;
54595 bool flag4 = velocity.Y == 0f;
54596 for (int i = 0; i < 200; i++)
54597 {
54598 if (i != whoAmI && Main.npc[i].active && Main.npc[i].type == type && Math.Abs(position.X - Main.npc[i].position.X) + Math.Abs(position.Y - Main.npc[i].position.Y) < (float)width)
54599 {
54600 if (position.X < Main.npc[i].position.X)
54601 {
54602 velocity.X -= 0.05f;
54603 }
54604 else
54605 {
54606 velocity.X += 0.05f;
54607 }
54608 if (position.Y < Main.npc[i].position.Y)
54609 {
54610 velocity.Y -= 0.05f;
54611 }
54612 else
54613 {
54614 velocity.Y += 0.05f;
54615 }
54616 }
54617 }
54618 if (flag4)
54619 {
54620 velocity.Y = 0f;
54621 }
54622 }
54623 if (type == 315)
54624 {
54625 int num3 = 480;
54626 if (localAI[0]++ >= (float)num3)
54627 {
54628 localAI[0] = 0f;
54629 int num4 = target;
54630 if (Main.netMode != 1 && num4 != 255)
54631 {
54633 Projectile.NewProjectile(GetSpawnSourceForNPCFromNPCAI(), base.Center + Main.rand.NextVector2Circular(40f, 40f), new Vector2(velocity.X, Main.rand.NextFloatDirection() * 3f), 1001, attackDamage_ForProjectiles, 0f, Main.myPlayer, num4);
54634 }
54635 }
54636 Lighting.AddLight(base.Center, 0.4f, 0.36f, 0.2f);
54637 int num5 = frame.Height;
54638 if (num5 < 1)
54639 {
54640 num5 = 1;
54641 }
54642 int num6 = frame.Y / num5;
54643 if (num6 >= 4 && num6 <= 7)
54644 {
54645 Vector2 vector = base.Bottom + new Vector2(-30f, -8f);
54646 Vector2 vector2 = new Vector2(60f, 8f);
54647 if (Main.rand.Next(3) != 0)
54648 {
54649 Dust dust = Dust.NewDustPerfect(vector + new Vector2(Main.rand.NextFloat() * vector2.X, Main.rand.NextFloat() * vector2.Y), 6, velocity);
54650 dust.scale = 0.6f;
54651 dust.fadeIn = 1.1f;
54652 dust.noGravity = true;
54653 dust.noLight = true;
54654 }
54655 }
54656 }
54657 if (position.X == oldPosition.X || ai[3] >= (float)num || flag2)
54658 {
54659 ai[3] += 1f;
54660 flag3 = true;
54661 }
54662 else if (ai[3] > 0f)
54663 {
54664 ai[3] -= 1f;
54665 }
54666 if (ai[3] > (float)(num * num2))
54667 {
54668 ai[3] = 0f;
54669 }
54670 if (justHit)
54671 {
54672 ai[3] = 0f;
54673 }
54674 if (ai[3] == (float)num)
54675 {
54676 netUpdate = true;
54677 }
54678 Vector2 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
54679 float num7 = Main.player[target].position.X + (float)Main.player[target].width * 0.5f - vector3.X;
54680 float num8 = Main.player[target].position.Y - vector3.Y;
54681 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
54682 if (num9 < 200f && !flag3)
54683 {
54684 ai[3] = 0f;
54685 }
54686 if (type == 410)
54687 {
54688 ai[1] += 1f;
54689 bool flag5 = ai[1] >= 240f;
54690 if (!flag5 && velocity.Y == 0f)
54691 {
54692 for (int j = 0; j < 255; j++)
54693 {
54694 if (Main.player[j].active && !Main.player[j].dead && Main.player[j].Distance(base.Center) < 800f && Main.player[j].Center.Y < base.Center.Y && Math.Abs(Main.player[j].Center.X - base.Center.X) < 20f)
54695 {
54696 flag5 = true;
54697 break;
54698 }
54699 }
54700 }
54701 if (flag5 && Main.netMode != 1)
54702 {
54703 for (int k = 0; k < 3; k++)
54704 {
54705 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, (Main.rand.NextFloat() - 0.5f) * 2f, -4f - 10f * Main.rand.NextFloat(), 538, 50, 0f, Main.myPlayer);
54706 }
54707 HitEffect(9999);
54708 active = false;
54709 return;
54710 }
54711 }
54712 else if (type == 423)
54713 {
54714 if (ai[2] == 1f)
54715 {
54716 ai[1] += 1f;
54717 velocity.X *= 0.7f;
54718 if (ai[1] < 30f)
54719 {
54720 Vector2 vector4 = base.Center + Vector2.UnitX * spriteDirection * -20f;
54721 Dust obj = Main.dust[Dust.NewDust(vector4, 0, 0, 242)];
54722 Vector2 vector5 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
54723 obj.position = vector4 + vector5 * 20f;
54724 obj.velocity = -vector5 * 2f;
54725 obj.scale = 0.5f + vector5.X * (float)(-spriteDirection);
54726 obj.fadeIn = 1f;
54727 obj.noGravity = true;
54728 }
54729 else if (ai[1] == 30f)
54730 {
54731 for (int l = 0; l < 20; l++)
54732 {
54733 Vector2 vector6 = base.Center + Vector2.UnitX * spriteDirection * -20f;
54734 Dust obj2 = Main.dust[Dust.NewDust(vector6, 0, 0, 242)];
54735 Vector2 vector7 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
54736 obj2.position = vector6 + vector7 * 4f;
54737 obj2.velocity = vector7 * 4f + Vector2.UnitX * Main.rand.NextFloat() * spriteDirection * -5f;
54738 obj2.scale = 0.5f + vector7.X * (float)(-spriteDirection);
54739 obj2.fadeIn = 1f;
54740 obj2.noGravity = true;
54741 }
54742 }
54743 if (velocity.X > -0.5f && velocity.X < 0.5f)
54744 {
54745 velocity.X = 0f;
54746 }
54747 if (ai[1] == 30f && Main.netMode != 1)
54748 {
54751 }
54752 if (ai[1] >= 60f)
54753 {
54754 ai[1] = -Main.rand.Next(320, 601);
54755 ai[2] = 0f;
54756 }
54757 }
54758 else
54759 {
54760 ai[1] += 1f;
54761 if (ai[1] >= 180f && num9 < 500f && velocity.Y == 0f)
54762 {
54763 flag = true;
54764 ai[1] = 0f;
54765 ai[2] = 1f;
54766 netUpdate = true;
54767 }
54768 else if (velocity.Y == 0f && num9 < 100f && Math.Abs(velocity.X) > 3f && ((base.Center.X < Main.player[target].Center.X && velocity.X > 0f) || (base.Center.X > Main.player[target].Center.X && velocity.X < 0f)))
54769 {
54770 velocity.Y -= 4f;
54771 }
54772 }
54773 }
54774 else if (type == 155 || type == 329)
54775 {
54776 if (velocity.Y == 0f && num9 < 100f && Math.Abs(velocity.X) > 3f && ((position.X + (float)(width / 2) < Main.player[target].position.X + (float)(Main.player[target].width / 2) && velocity.X > 0f) || (position.X + (float)(width / 2) > Main.player[target].position.X + (float)(Main.player[target].width / 2) && velocity.X < 0f)))
54777 {
54778 velocity.Y -= 4f;
54779 }
54780 }
54781 else if (type == 546 && velocity.Y == 0f && Math.Abs(velocity.X) > 3f && ((base.Center.X < Main.player[target].Center.X && velocity.X > 0f) || (base.Center.X > Main.player[target].Center.X && velocity.X < 0f)))
54782 {
54783 velocity.Y -= 4f;
54784 SoundEngine.PlaySound(3, base.Center, 11);
54785 }
54786 if (type == 546 && !Main.player[target].ZoneDesert)
54787 {
54788 int num10 = direction;
54789 TargetClosest();
54790 if (!Main.player[target].ZoneDesert)
54791 {
54792 EncourageDespawn(10);
54793 ai[3] = num;
54794 direction = num10;
54795 }
54796 }
54797 if (ai[3] < (float)num)
54798 {
54799 if ((type == 329 || type == 315) && !Main.pumpkinMoon)
54800 {
54801 EncourageDespawn(10);
54802 }
54803 else
54804 {
54805 TargetClosest();
54806 }
54807 }
54808 else
54809 {
54810 if (velocity.X == 0f)
54811 {
54812 if (velocity.Y == 0f)
54813 {
54814 ai[0] += 1f;
54815 if (ai[0] >= 2f)
54816 {
54817 direction *= -1;
54819 ai[0] = 0f;
54820 }
54821 }
54822 }
54823 else
54824 {
54825 ai[0] = 0f;
54826 }
54827 directionY = -1;
54828 if (direction == 0)
54829 {
54830 direction = 1;
54831 }
54832 }
54833 float num11 = 6f;
54834 float num12 = 0.07f;
54835 if (!flag && (velocity.Y == 0f || wet || (velocity.X <= 0f && direction < 0) || (velocity.X >= 0f && direction > 0)))
54836 {
54837 if (type == 155)
54838 {
54839 if (velocity.X > 0f && direction < 0)
54840 {
54841 velocity.X *= 0.95f;
54842 }
54843 if (velocity.X < 0f && direction > 0)
54844 {
54845 velocity.X *= 0.95f;
54846 }
54847 }
54848 else if (type == 329)
54849 {
54850 if (velocity.X > 0f && direction < 0)
54851 {
54852 velocity.X *= 0.9f;
54853 }
54854 if (velocity.X < 0f && direction > 0)
54855 {
54856 velocity.X *= 0.9f;
54857 }
54858 if (direction > 0 && velocity.X < 3f)
54859 {
54860 velocity.X += 0.1f;
54861 }
54863 {
54864 velocity.X -= 0.1f;
54865 }
54866 }
54867 else if (type == 315)
54868 {
54869 if (velocity.X > 0f && direction < 0)
54870 {
54871 velocity.X *= 0.95f;
54872 }
54873 if (velocity.X < 0f && direction > 0)
54874 {
54875 velocity.X *= 0.95f;
54876 }
54877 if (velocity.X < 0f - num11 || velocity.X > num11)
54878 {
54879 if (velocity.Y == 0f)
54880 {
54881 velocity *= 0.8f;
54882 }
54883 }
54884 else if (velocity.X < num11 && direction == 1)
54885 {
54886 velocity.X += 0.07f;
54887 if (velocity.X > num11)
54888 {
54889 velocity.X = num11;
54890 }
54891 }
54892 else if (velocity.X > 0f - num11 && direction == -1)
54893 {
54894 velocity.X -= 0.07f;
54895 if (velocity.X < 0f - num11)
54896 {
54897 velocity.X = 0f - num11;
54898 }
54899 }
54900 }
54901 else if (type == 410)
54902 {
54903 if (Math.Sign(velocity.X) != direction)
54904 {
54905 velocity.X *= 0.9f;
54906 }
54907 num11 = 6f;
54908 num12 = 0.2f;
54909 }
54910 else if (type == 423)
54911 {
54912 if (Math.Sign(velocity.X) != direction)
54913 {
54914 velocity.X *= 0.85f;
54915 }
54916 num11 = 10f;
54917 num12 = 0.2f;
54918 }
54919 else if (type == 546)
54920 {
54921 if (Math.Sign(velocity.X) != direction)
54922 {
54923 velocity.X *= 0.92f;
54924 }
54926 if (!Main.player[target].ZoneSandstorm)
54927 {
54928 num13 = 0f;
54929 }
54930 num11 = 4f + num13 * (float)direction * 3f;
54931 num12 = 0.05f;
54932 }
54933 if (velocity.X < 0f - num11 || velocity.X > num11)
54934 {
54935 if (velocity.Y == 0f)
54936 {
54937 velocity *= 0.8f;
54938 }
54939 }
54940 else if (velocity.X < num11 && direction == 1)
54941 {
54942 velocity.X += num12;
54943 if (velocity.X > num11)
54944 {
54945 velocity.X = num11;
54946 }
54947 }
54948 else if (velocity.X > 0f - num11 && direction == -1)
54949 {
54950 velocity.X -= num12;
54951 if (velocity.X < 0f - num11)
54952 {
54953 velocity.X = 0f - num11;
54954 }
54955 }
54956 }
54957 if (velocity.Y >= 0f)
54958 {
54959 int num14 = 0;
54960 if (velocity.X < 0f)
54961 {
54962 num14 = -1;
54963 }
54964 if (velocity.X > 0f)
54965 {
54966 num14 = 1;
54967 }
54969 vector8.X += velocity.X;
54970 int num15 = (int)((vector8.X + (float)(width / 2) + (float)((width / 2 + 1) * num14)) / 16f);
54971 int num16 = (int)((vector8.Y + (float)height - 1f) / 16f);
54972 if (Main.tile[num15, num16] == null)
54973 {
54974 Main.tile[num15, num16] = new Tile();
54975 }
54976 if (Main.tile[num15, num16 - 1] == null)
54977 {
54978 Main.tile[num15, num16 - 1] = new Tile();
54979 }
54980 if (Main.tile[num15, num16 - 2] == null)
54981 {
54982 Main.tile[num15, num16 - 2] = new Tile();
54983 }
54984 if (Main.tile[num15, num16 - 3] == null)
54985 {
54986 Main.tile[num15, num16 - 3] = new Tile();
54987 }
54988 if (Main.tile[num15, num16 + 1] == null)
54989 {
54990 Main.tile[num15, num16 + 1] = new Tile();
54991 }
54992 if ((float)(num15 * 16) < vector8.X + (float)width && (float)(num15 * 16 + 16) > vector8.X && ((Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[Main.tile[num15, num16].type] && !Main.tileSolidTop[Main.tile[num15, num16].type]) || (Main.tile[num15, num16 - 1].halfBrick() && Main.tile[num15, num16 - 1].nactive())) && (!Main.tile[num15, num16 - 1].nactive() || !Main.tileSolid[Main.tile[num15, num16 - 1].type] || Main.tileSolidTop[Main.tile[num15, num16 - 1].type] || (Main.tile[num15, num16 - 1].halfBrick() && (!Main.tile[num15, num16 - 4].nactive() || !Main.tileSolid[Main.tile[num15, num16 - 4].type] || Main.tileSolidTop[Main.tile[num15, num16 - 4].type]))) && (!Main.tile[num15, num16 - 2].nactive() || !Main.tileSolid[Main.tile[num15, num16 - 2].type] || Main.tileSolidTop[Main.tile[num15, num16 - 2].type]) && (!Main.tile[num15, num16 - 3].nactive() || !Main.tileSolid[Main.tile[num15, num16 - 3].type] || Main.tileSolidTop[Main.tile[num15, num16 - 3].type]) && (!Main.tile[num15 - num14, num16 - 3].nactive() || !Main.tileSolid[Main.tile[num15 - num14, num16 - 3].type]))
54993 {
54994 float num17 = num16 * 16;
54995 if (Main.tile[num15, num16].halfBrick())
54996 {
54997 num17 += 8f;
54998 }
54999 if (Main.tile[num15, num16 - 1].halfBrick())
55000 {
55001 num17 -= 8f;
55002 }
55003 if (num17 < vector8.Y + (float)height)
55004 {
55005 float num18 = vector8.Y + (float)height - num17;
55006 if ((double)num18 <= 16.1)
55007 {
55008 gfxOffY += position.Y + (float)height - num17;
55009 position.Y = num17 - (float)height;
55010 if (num18 < 9f)
55011 {
55012 stepSpeed = 1f;
55013 }
55014 else
55015 {
55016 stepSpeed = 2f;
55017 }
55018 }
55019 }
55020 }
55021 }
55022 if (velocity.Y == 0f)
55023 {
55024 bool flag6 = true;
55025 int num19 = (int)(position.Y - 7f) / 16;
55026 int num20 = (int)(position.X - 7f) / 16;
55027 int num21 = (int)(position.X + (float)width + 7f) / 16;
55028 for (int m = num20; m <= num21; m++)
55029 {
55030 if (Main.tile[m, num19] != null && Main.tile[m, num19].nactive() && Main.tileSolid[Main.tile[m, num19].type])
55031 {
55032 flag6 = false;
55033 break;
55034 }
55035 }
55036 if (flag6)
55037 {
55038 int num22 = (int)((position.X + (float)(width / 2) + (float)((width / 2 + 2) * direction) + velocity.X * 5f) / 16f);
55039 int num23 = (int)((position.Y + (float)height - 15f) / 16f);
55040 if (Main.tile[num22, num23] == null)
55041 {
55042 Main.tile[num22, num23] = new Tile();
55043 }
55044 if (Main.tile[num22, num23 - 1] == null)
55045 {
55046 Main.tile[num22, num23 - 1] = new Tile();
55047 }
55048 if (Main.tile[num22, num23 - 2] == null)
55049 {
55050 Main.tile[num22, num23 - 2] = new Tile();
55051 }
55052 if (Main.tile[num22, num23 - 3] == null)
55053 {
55054 Main.tile[num22, num23 - 3] = new Tile();
55055 }
55056 if (Main.tile[num22, num23 + 1] == null)
55057 {
55058 Main.tile[num22, num23 + 1] = new Tile();
55059 }
55060 if (Main.tile[num22 + direction, num23 - 1] == null)
55061 {
55062 Main.tile[num22 + direction, num23 - 1] = new Tile();
55063 }
55064 if (Main.tile[num22 + direction, num23 + 1] == null)
55065 {
55066 Main.tile[num22 + direction, num23 + 1] = new Tile();
55067 }
55068 if (Main.tile[num22 - direction, num23 + 1] == null)
55069 {
55070 Main.tile[num22 - direction, num23 + 1] = new Tile();
55071 }
55072 if (Main.tile[num22 + direction, num23 + 3] == null)
55073 {
55074 Main.tile[num22 + direction, num23 + 3] = new Tile();
55075 }
55076 int num24 = spriteDirection;
55077 if (type == 423 || type == 410 || type == 546)
55078 {
55079 num24 *= -1;
55080 }
55081 if ((velocity.X < 0f && num24 == -1) || (velocity.X > 0f && num24 == 1))
55082 {
55083 bool flag7 = type == 410 || type == 423;
55084 float num25 = 3f;
55085 if (Main.tile[num22, num23 - 2].nactive() && Main.tileSolid[Main.tile[num22, num23 - 2].type])
55086 {
55087 if (Main.tile[num22, num23 - 3].nactive() && Main.tileSolid[Main.tile[num22, num23 - 3].type])
55088 {
55089 velocity.Y = -8.5f;
55090 netUpdate = true;
55091 }
55092 else
55093 {
55094 velocity.Y = -7.5f;
55095 netUpdate = true;
55096 }
55097 }
55098 else if (Main.tile[num22, num23 - 1].nactive() && !Main.tile[num22, num23 - 1].topSlope() && Main.tileSolid[Main.tile[num22, num23 - 1].type])
55099 {
55100 velocity.Y = -7f;
55101 netUpdate = true;
55102 }
55103 else if (position.Y + (float)height - (float)(num23 * 16) > 20f && Main.tile[num22, num23].nactive() && !Main.tile[num22, num23].topSlope() && Main.tileSolid[Main.tile[num22, num23].type])
55104 {
55105 velocity.Y = -6f;
55106 netUpdate = true;
55107 }
55108 else if ((directionY < 0 || Math.Abs(velocity.X) > num25) && (!flag7 || !Main.tile[num22, num23 + 1].nactive() || !Main.tileSolid[Main.tile[num22, num23 + 1].type]) && (!Main.tile[num22, num23 + 2].nactive() || !Main.tileSolid[Main.tile[num22, num23 + 2].type]) && (!Main.tile[num22 + direction, num23 + 3].nactive() || !Main.tileSolid[Main.tile[num22 + direction, num23 + 3].type]))
55109 {
55110 velocity.Y = -8f;
55111 netUpdate = true;
55112 }
55113 }
55114 }
55115 }
55116 if (type == 423 && Math.Abs(velocity.X) >= num11 * 0.95f)
55117 {
55118 Rectangle hitbox = base.Hitbox;
55119 for (int n = 0; n < 2; n++)
55120 {
55121 if (Main.rand.Next(3) == 0)
55122 {
55123 Dust obj3 = Main.dust[Dust.NewDust(hitbox.TopLeft(), hitbox.Width, hitbox.Height, 242)];
55124 obj3.velocity = Vector2.Zero;
55125 obj3.noGravity = true;
55126 obj3.fadeIn = 1f;
55127 obj3.scale = 0.5f + Main.rand.NextFloat();
55128 }
55129 }
55130 }
55131 if (type == 546)
55132 {
55133 rotation += velocity.X * 0.05f;
55135 }
55136 }
55137
55139 {
55140 //IL_16d7: Unknown result type (might be due to invalid IL or missing references)
55141 //IL_0890: Unknown result type (might be due to invalid IL or missing references)
55142 //IL_0895: Unknown result type (might be due to invalid IL or missing references)
55143 //IL_08a6: Unknown result type (might be due to invalid IL or missing references)
55144 //IL_08ab: Unknown result type (might be due to invalid IL or missing references)
55145 //IL_139a: Unknown result type (might be due to invalid IL or missing references)
55146 //IL_139f: Unknown result type (might be due to invalid IL or missing references)
55147 //IL_08d6: Unknown result type (might be due to invalid IL or missing references)
55148 //IL_08f5: Unknown result type (might be due to invalid IL or missing references)
55149 //IL_23c4: Unknown result type (might be due to invalid IL or missing references)
55150 //IL_145b: Unknown result type (might be due to invalid IL or missing references)
55151 //IL_1e7c: Unknown result type (might be due to invalid IL or missing references)
55152 //IL_196e: Unknown result type (might be due to invalid IL or missing references)
55153 //IL_147d: Unknown result type (might be due to invalid IL or missing references)
55154 //IL_1482: Unknown result type (might be due to invalid IL or missing references)
55155 //IL_0f7b: Unknown result type (might be due to invalid IL or missing references)
55156 //IL_0f80: Unknown result type (might be due to invalid IL or missing references)
55157 //IL_0509: Unknown result type (might be due to invalid IL or missing references)
55158 //IL_05f1: Unknown result type (might be due to invalid IL or missing references)
55159 //IL_0589: Unknown result type (might be due to invalid IL or missing references)
55160 //IL_1e9e: Unknown result type (might be due to invalid IL or missing references)
55161 //IL_0813: Unknown result type (might be due to invalid IL or missing references)
55162 //IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
55163 //IL_0fa2: Unknown result type (might be due to invalid IL or missing references)
55164 //IL_0835: Unknown result type (might be due to invalid IL or missing references)
55165 //IL_10a1: Unknown result type (might be due to invalid IL or missing references)
55166 //IL_0fe2: Unknown result type (might be due to invalid IL or missing references)
55167 //IL_0fe7: Unknown result type (might be due to invalid IL or missing references)
55168 //IL_1003: Unknown result type (might be due to invalid IL or missing references)
55169 //IL_1008: Unknown result type (might be due to invalid IL or missing references)
55170 //IL_10c3: Unknown result type (might be due to invalid IL or missing references)
55171 //IL_10c8: Unknown result type (might be due to invalid IL or missing references)
55172 //IL_10e9: Unknown result type (might be due to invalid IL or missing references)
55173 //IL_110b: Unknown result type (might be due to invalid IL or missing references)
55174 //IL_1110: Unknown result type (might be due to invalid IL or missing references)
55175 //IL_2c37: Unknown result type (might be due to invalid IL or missing references)
55176 //IL_0f1e: Unknown result type (might be due to invalid IL or missing references)
55177 bool flag = velocity.X == 0f && velocity.Y == 0f && !justHit;
55178 bool flag2 = false;
55179 bool flag3 = false;
55180 bool flag4 = false;
55181 int num = 32;
55182 int num2 = 15;
55183 float num3 = 9f;
55184 bool flag5 = false;
55185 float num4 = 40f;
55186 int num5 = 30;
55187 int num6 = 0;
55188 bool flag6 = false;
55189 bool flag7 = true;
55190 float num7 = 0.9f;
55191 bool flag8 = false;
55192 bool flag9 = false;
55193 bool flag10 = false;
55194 bool flag11 = false;
55195 bool flag12 = false;
55196 bool flag13 = false;
55197 bool flag14 = false;
55198 bool flag15 = true;
55199 int num8 = 70;
55200 int num9 = num8 / 2;
55201 float num10 = 11f;
55203 int num11 = 1;
55204 int num12 = 81;
55205 float num13 = 700f;
55206 float num14 = 0f;
55207 float num15 = 0.1f;
55208 Vector2? vector2 = null;
55209 float num16 = 0.5f;
55210 int num17 = 1;
55211 float num18 = 1f;
55212 bool flag16 = false;
55213 float num19 = 30f;
55214 float num20 = 0f;
55215 bool flag17 = false;
55216 bool flag18 = true;
55217 bool flag19 = false;
55218 int num21 = 30;
55219 bool flag20 = false;
55220 bool flag21 = false;
55221 bool flag22 = false;
55222 bool flag23 = false;
55223 LegacySoundStyle style = null;
55224 int num22 = 0;
55225 bool flag24 = false;
55226 float num23 = 1f;
55227 float num24 = 0.07f;
55228 float num25 = 0.8f;
55229 float num26 = width / 2 + 6;
55230 bool flag25 = directionY < 0;
55231 bool flag26 = false;
55232 int num27 = 1;
55233 bool flag27 = false;
55234 float num28 = 5f;
55235 float num29 = 3f;
55236 float num30 = 8f;
55237 float amount = 0.05f;
55238 float amount2 = 0.04f;
55239 float amount3 = 0.1f;
55240 bool flag28 = false;
55241 float num31 = 0.025f;
55243 NPCUtils.NPCTargetingMethod nPCTargetingMethod = NPCUtils.TargetClosestCommon;
55245 {
55247 }
55248 if (targetData.Type == NPCTargetType.NPC && Main.npc[TranslatedTargetIndex].type == 548 && Main.npc[TranslatedTargetIndex].dontTakeDamageFromHostiles)
55249 {
55250 nPCTargetingMethod(this, faceTarget: true, null);
55252 }
55254 {
55255 if (!targetData.Invalid)
55256 {
55257 flag2 = !Collision.CanHit(base.Center, 0, 0, targetData.Center, 0, 0) && (direction == Math.Sign(targetData.Center.X - base.Center.X) || (noGravity && Distance(targetData.Center) > 50f && base.Center.Y > targetData.Center.Y));
55258 }
55259 flag2 &= ai[0] <= 0f;
55260 }
55261 if (flag2)
55262 {
55263 if (velocity.Y == 0f || Math.Abs(targetData.Center.Y - base.Center.Y) > 800f)
55264 {
55265 noGravity = true;
55266 noTileCollide = true;
55267 }
55268 }
55269 else
55270 {
55271 noGravity = false;
55272 noTileCollide = false;
55273 }
55275 bool flag30 = true;
55276 SlotId val;
55277 switch (type)
55278 {
55279 case 576:
55280 case 577:
55281 num22 = 700;
55282 style = SoundID.DD2_OgreRoar;
55283 num26 -= 32f;
55284 flag5 = true;
55285 num6 = 60;
55286 num4 = 130f;
55287 num5 = 44;
55289 num7 = 0.7f;
55290 if (localAI[0] > 0f)
55291 {
55292 localAI[0] -= 1f;
55293 }
55294 if (ai[0] <= 0f)
55295 {
55296 float num34 = ai[1];
55297 float num35 = Distance(targetData.Center);
55298 if (localAI[3] >= 60f)
55299 {
55300 if (num35 <= num4 + 300f && localAI[0] <= 0f)
55301 {
55302 ai[1] = 2f;
55303 }
55304 else if (num35 > num4 + 30f)
55305 {
55306 ai[1] = 1f;
55307 }
55308 else if (!(num35 > num4))
55309 {
55310 ai[1] = 0f;
55311 if (num34 == 1f)
55312 {
55313 ai[0] = 0f;
55314 }
55315 }
55316 }
55317 if (num34 != ai[1])
55318 {
55319 netUpdate = true;
55320 }
55321 }
55322 else if (ai[1] == 2f)
55323 {
55324 localAI[0] = 300f;
55325 }
55326 switch ((int)ai[1])
55327 {
55328 case 0:
55329 num5 = 44;
55330 if (ai[0] == 40f)
55331 {
55333 }
55334 break;
55335 case 2:
55336 num5 = 90;
55337 num4 = 250f;
55338 flag4 = true;
55340 num9 = 36;
55341 num = 56;
55342 num2 = 41;
55343 num3 = 13f;
55344 flag3 = true;
55345 num12 = 683;
55346 flag15 = false;
55347 vector = new Vector2(-direction * 20, height / 2 - 1);
55348 if (ai[0] == 40f)
55349 {
55351 }
55352 break;
55353 case 1:
55354 flag3 = true;
55355 num5 = 90;
55356 num4 = 1000f;
55357 num6 = 240;
55359 flag15 = false;
55360 vector = new Vector2(direction * 30, -70f);
55361 num12 = 676;
55362 if (ai[0] == 80f)
55363 {
55365 }
55366 break;
55367 }
55368 if (ai[0] < (float)(-num6))
55369 {
55370 ai[0] = -num6;
55371 }
55372 break;
55373 case 552:
55374 case 553:
55375 case 554:
55376 style = SoundID.DD2_GoblinScream;
55377 num22 = 1000;
55378 flag5 = true;
55380 if (type == 553)
55381 {
55382 num24 += 0.01f;
55383 num23 += 0.2f;
55384 }
55385 if (type == 554)
55386 {
55387 num24 += 0.02f;
55388 num23 += 0.4f;
55389 }
55390 if (!(localAI[3] >= 60f))
55391 {
55392 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55393 }
55394 break;
55395 case 570:
55396 case 571:
55398 flag24 = true;
55399 flag12 = true;
55400 flag15 = ai[1] > 40f;
55401 num8 = 60;
55402 num9 = 40;
55403 if (type == 571 && ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 6 == 0)
55404 {
55405 num9 = (int)ai[1] - 1;
55406 }
55407 if (type == 570 && ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 9 == 0)
55408 {
55409 num9 = (int)ai[1] - 1;
55410 }
55411 num12 = 671;
55412 vector.X += 22 * direction;
55413 num15 = 0.15f;
55414 num16 = 1.5f;
55415 num13 = 600f;
55416 num10 = 13f;
55417 num17 = 1;
55418 num18 = 0f;
55419 if (type == 570)
55420 {
55421 num16 = 2.5f;
55422 }
55424 if (type == 571)
55425 {
55427 }
55428 num23 = 0.77f;
55429 if (ai[0] > 0f)
55430 {
55431 if (ai[1] == 40f)
55432 {
55434 }
55435 else if (ai[1] == 60f)
55436 {
55438 }
55439 }
55440 if (!(localAI[3] >= 60f))
55441 {
55442 num13 = 1f;
55443 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55444 }
55445 break;
55446 case 572:
55447 case 573:
55448 if (localAI[3] == 0f)
55449 {
55450 float[] array = localAI;
55451 val = SlotId.Invalid;
55452 array[0] = ((SlotId)(ref val)).ToFloat();
55453 float[] array2 = localAI;
55454 val = SlotId.Invalid;
55455 array2[1] = ((SlotId)(ref val)).ToFloat();
55456 }
55458 if (ai[1] == 2f)
55459 {
55462 position = base.Center;
55463 width = (height = 192);
55464 base.Center = position;
55467 alpha = 255;
55468 for (int k = 0; k < 4; k++)
55469 {
55470 int num37 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
55471 Main.dust[num37].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55472 }
55473 for (int l = 0; l < 20; l++)
55474 {
55475 int num38 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
55476 Main.dust[num38].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55477 Main.dust[num38].noGravity = true;
55478 Main.dust[num38].velocity *= 3f;
55479 num38 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
55480 Main.dust[num38].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 4f;
55481 Main.dust[num38].velocity *= 2f;
55482 Main.dust[num38].noGravity = true;
55483 Main.dust[num38].fadeIn = 2.5f;
55484 }
55485 for (int m = 0; m < 6; m++)
55486 {
55487 int num39 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
55488 Main.dust[num39].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
55489 Main.dust[num39].noGravity = true;
55490 Main.dust[num39].velocity *= 3f;
55491 }
55492 for (int n = 0; n < 12; n++)
55493 {
55494 int num40 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
55495 Main.dust[num40].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
55496 Main.dust[num40].noGravity = true;
55497 Main.dust[num40].velocity *= 3f;
55498 }
55499 for (int num41 = 0; num41 < 5; num41++)
55500 {
55501 int num42 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
55502 Main.gore[num42].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
55503 Main.gore[num42].velocity *= 0.3f;
55504 Main.gore[num42].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
55505 Main.gore[num42].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
55506 }
55507 ai[0] += 1f;
55508 if (ai[0] >= 3f)
55509 {
55511 life = 0;
55512 HitEffect();
55513 active = false;
55514 }
55515 return;
55516 }
55517 if (ai[0] > 0f && ai[1] == 0f && life > 0)
55518 {
55520 if (!((SlotId)(ref val2)).IsValid)
55521 {
55522 float[] array3 = localAI;
55524 array3[0] = ((SlotId)(ref val)).ToFloat();
55525 }
55526 localAI[2] += 1f;
55527 if (localAI[2] == 30f)
55528 {
55529 float[] array4 = localAI;
55531 array4[0] = ((SlotId)(ref val)).ToFloat();
55532 float[] array5 = localAI;
55534 array5[1] = ((SlotId)(ref val)).ToFloat();
55535 }
55536 }
55537 if (ai[0] > 0f && ai[1] == 1f)
55538 {
55539 ai[0] = 0f;
55540 ai[1] = 2f;
55541 netUpdate = true;
55542 return;
55543 }
55544 num23 = 0.88f;
55545 if (ai[0] == 1f)
55546 {
55547 ai[1] = 1f;
55548 }
55549 if (ai[0] == 0f && ai[1] == 1f)
55550 {
55552 if (activeSound == null)
55553 {
55554 float[] array6 = localAI;
55556 array6[0] = ((SlotId)(ref val)).ToFloat();
55557 }
55558 else
55559 {
55560 activeSound.Position = base.Center;
55561 }
55563 if (activeSound2 == null)
55564 {
55565 float[] array7 = localAI;
55567 array7[1] = ((SlotId)(ref val)).ToFloat();
55568 }
55569 else
55570 {
55571 activeSound2.Position = base.Center;
55572 }
55573 }
55574 if (ai[1] > 0f && ai[0] == 0f)
55575 {
55576 flag5 = true;
55577 num5 = 40;
55578 num4 = 64f;
55579 num24 = 0.3f;
55580 num23 = 4f;
55581 Vector2 vector3 = base.Center + new Vector2(spriteDirection * 12, 0f);
55582 if (Main.rand.Next(6) == 0)
55583 {
55584 Dust dust3 = Dust.NewDustDirect(vector3, 1, 1, 213, Main.rand.Next(-2, 3), Main.rand.Next(-2, 3), 100, new Color(255, 255, 255, 0));
55585 dust3.noGravity = true;
55586 dust3.fadeIn = dust3.scale + 1f + 0.01f * (float)Main.rand.Next(0, 51);
55587 dust3.velocity *= 0.3f;
55588 dust3.velocity.X += (float)(-spriteDirection) * 1.2f;
55589 dust3.velocity.Y += -3.5f;
55590 dust3.velocity.X += velocity.X;
55591 }
55592 if (Main.rand.Next(12) == 0)
55593 {
55595 dust4.noGravity = true;
55596 dust4.velocity.Y -= 1f + Main.rand.NextFloat();
55597 dust4.scale = 1.1f;
55598 dust4.fadeIn = 0.5f;
55599 dust4.customData = this;
55600 }
55601 }
55602 else
55603 {
55604 flag5 = true;
55605 num5 = 40;
55606 num4 = 700f;
55607 }
55608 if (!(localAI[3] >= 60f))
55609 {
55610 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55611 }
55612 break;
55613 case 568:
55614 case 569:
55615 {
55616 num5 = 110;
55617 num24 = 0.16f;
55618 num25 = 0.7f;
55619 num23 = 1.4f;
55620 flag5 = true;
55621 num4 = 600f;
55623 if (!(localAI[3] >= 60f))
55624 {
55625 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55626 }
55627 if (ai[0] == 0f)
55628 {
55629 float[] array8 = localAI;
55630 val = SlotId.Invalid;
55631 array8[1] = ((SlotId)(ref val)).ToFloat();
55632 }
55633 if (ai[0] != 1f)
55634 {
55635 break;
55636 }
55638 ai[0] += 1f;
55639 if (Main.rand.Next(10) == 0)
55640 {
55641 Dust dust7 = Dust.NewDustDirect(base.TopLeft, width, height, 271, 0f, -3f, 0, Color.Transparent, 0.6f);
55642 dust7.velocity.X /= 2f;
55643 dust7.noGravity = true;
55644 dust7.fadeIn = 1.5f;
55645 dust7.position.Y += 4f;
55646 }
55648 if (activeSound3 == null)
55649 {
55650 float[] array9 = localAI;
55652 array9[1] = ((SlotId)(ref val)).ToFloat();
55653 }
55654 else
55655 {
55656 activeSound3.Position = base.Center;
55657 }
55658 localAI[0] += 1f;
55659 if (localAI[0] > 60f && Main.rand.Next(10) == 0)
55660 {
55661 Vector2 vec = base.Center + (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2() * 400f * (0.3f + 0.7f * Main.rand.NextFloat());
55662 Point point = vec.ToTileCoordinates();
55663 if (!WorldGen.SolidTile(point.X, point.Y))
55664 {
55665 Dust dust8 = Dust.NewDustPerfect(vec, 27, new Vector2(0f, -3f), 0, new Color(255, 255, 255, 127), 1.5f);
55666 dust8.velocity = DirectionTo(dust8.position) * dust8.velocity.Length();
55667 dust8.fadeIn = 1.5f;
55668 }
55669 }
55670 if (Main.netMode != 2)
55671 {
55672 Player player = Main.player[Main.myPlayer];
55673 if (!player.dead && player.active && (player.Center - base.Center).Length() < 400f && !player.creativeGodMode)
55674 {
55675 player.AddBuff(195, 3, quiet: false);
55676 }
55677 }
55678 if (ai[1] > 0f)
55679 {
55680 ai[1] -= 1f;
55681 }
55682 if (!(ai[1] <= 0f))
55683 {
55684 break;
55685 }
55686 ai[1] = 60f;
55687 if (Main.netMode != 1)
55688 {
55689 int num51 = lifeMax / 20;
55690 if (num51 > lifeMax - life)
55691 {
55692 num51 = lifeMax - life;
55693 }
55694 if (num51 > 0)
55695 {
55696 life += num51;
55698 netUpdate = true;
55699 }
55700 }
55701 break;
55702 }
55703 case 561:
55704 case 562:
55705 case 563:
55706 {
55707 bool num36 = localAI[3] >= 60f;
55708 if (ai[1] == 82f)
55709 {
55711 num22 = 7;
55713 }
55715 flag24 = true;
55716 flag12 = true;
55717 flag15 = ai[1] > 82f;
55718 num8 = 90;
55719 num9 = 82;
55720 num12 = 662;
55721 if (type == 563)
55722 {
55723 num12 = 685;
55724 }
55725 vector.Y -= 14f;
55726 num15 = 0f;
55727 num16 = 0.5f;
55728 num13 = 600f;
55729 num10 = 13f;
55730 if (!num36)
55731 {
55732 num13 = 1f;
55733 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55734 }
55735 if (type == 561)
55736 {
55737 num23 = 0.88f;
55738 num16 = 0.6f;
55740 num10 = 11.5f;
55741 num13 -= 100f;
55742 }
55743 if (type == 562)
55744 {
55745 num23 = 0.94f;
55746 num16 = 0.5f;
55748 num10 = 12.2f;
55749 num13 -= 50f;
55750 }
55751 if (type == 563)
55752 {
55753 num23 = 1f;
55754 num16 = 0.4f;
55756 }
55757 break;
55758 }
55759 case 555:
55760 case 556:
55761 case 557:
55762 {
55763 num22 = 800;
55765 bool num33 = localAI[3] >= 60f;
55767 flag24 = true;
55768 flag12 = true;
55769 flag15 = ai[1] > 18f;
55770 num8 = 42;
55771 num9 = 18;
55772 num12 = 681;
55773 num11 = 10;
55774 vector.Y -= 14f;
55775 num15 = 0.4f;
55776 num16 = 0.5f;
55777 num13 = 280f;
55778 num10 = 6f;
55779 if (!num33)
55780 {
55781 num13 = 1f;
55782 num24 = 0.01f + localAI[3] / 60f * 0.05f;
55783 }
55784 if (type == 555)
55785 {
55786 num23 = 0.88f;
55787 num16 = 0.6f;
55789 }
55790 if (type == 556)
55791 {
55792 num23 = 0.88f;
55793 num16 = 0.6f;
55795 }
55796 if (type == 557)
55797 {
55798 num23 = 1.12f;
55799 num16 = 0.4f;
55801 }
55802 if (ai[1] == (float)num9)
55803 {
55805 }
55806 break;
55807 }
55808 case 566:
55809 case 567:
55810 {
55811 DelegateMethods.v3_1 = new Vector3(0.3f, 0.05f, 0.45f) * 1.5f;
55814 bool num43 = localAI[3] >= 120f;
55815 if (!num43)
55816 {
55817 num24 = 0f;
55818 }
55819 if (num43)
55820 {
55821 dontTakeDamage = false;
55822 break;
55823 }
55824 dontTakeDamage = true;
55825 velocity.X = 0f;
55826 flag24 = true;
55827 flag20 = true;
55828 ai[3] = 0f;
55829 if (localAI[3] == 0f)
55830 {
55831 alpha = 255;
55832 }
55833 localAI[3] += 1f;
55834 float num44 = localAI[3];
55835 if (num44 >= 110f)
55836 {
55837 alpha -= 26;
55838 if (alpha < 0)
55839 {
55840 alpha = 0;
55841 }
55842 }
55843 if (num44 >= 100f)
55844 {
55845 int num45 = (int)localAI[3] / 20;
55846 float num46 = base.Size.Length() / 2f;
55847 num46 /= 20f;
55848 int maxValue = 5;
55849 for (int num47 = 0; num47 < num45 * 2; num47++)
55850 {
55851 if (Main.rand.Next(maxValue) == 0)
55852 {
55854 dust5.scale = 1f;
55855 dust5.fadeIn = 0.3f;
55856 dust5.velocity = new Vector2(Main.rand.NextFloatDirection() * 1f, 0f - dust5.velocity.Length()) * 1.25f * num46;
55857 }
55858 }
55859 }
55860 else
55861 {
55862 int num48 = (int)localAI[3] / 10;
55863 float num49 = base.Size.Length() / 2f;
55864 num49 /= 20f;
55865 int maxValue2 = 5;
55866 for (int num50 = 0; (float)num50 < (float)num48 * 1.3f; num50++)
55867 {
55868 if (Main.rand.Next(maxValue2) == 0)
55869 {
55870 Dust dust6 = Dust.NewDustDirect(position + new Vector2(-width / 2, 8f), width + width, height, 27, velocity.X * 1f, 0f, 100);
55871 dust6.scale = 1.1f;
55872 dust6.fadeIn = 0.1f;
55873 dust6.velocity = new Vector2(Main.rand.NextFloatDirection() * 0.1f, 0f - dust6.velocity.Length()) * 1.05f * num49 * Main.rand.NextFloat();
55874 dust6.velocity.Y *= Utils.GetLerpValue((float)width * 0.75f, 0f, Math.Abs(dust6.position.X - base.Center.X), clamped: true);
55875 }
55876 }
55877 }
55878 if (num44 > 100f && (int)num44 % 4 == 0)
55879 {
55880 Gore.NewGoreDirect(base.Left, new Vector2(0f, -3f), Utils.SelectRandom<int>(Main.rand, 971, 972), 0.85f).velocity.X *= 0.8f;
55881 }
55882 break;
55883 }
55884 case 620:
55885 {
55886 flag27 = wet;
55887 flag30 = false;
55888 flag16 = true;
55889 num20 = 150f;
55890 num19 = 20f;
55891 bool dayTime = Main.dayTime;
55892 flag21 = !dayTime;
55893 flag24 = true;
55894 flag12 = true;
55895 flag15 = ai[1] > 40f;
55896 num8 = 60;
55897 num9 = 40;
55898 if (ai[1] > 10f && ai[1] <= 40f && (int)ai[1] % 5 == 0)
55899 {
55900 num9 = (int)ai[1] - 1;
55901 }
55902 num12 = 811;
55903 vector.X -= 4 * direction;
55904 vector.Y -= 20f;
55905 num15 = 0.15f;
55906 num16 = 2.5f;
55907 num13 = 600f;
55908 num10 = 13f;
55909 num17 = 1;
55910 num18 = 0f;
55912 num23 = 8f;
55913 num24 *= 3f;
55914 num25 = 0.9f;
55915 if (ai[0] > 0f)
55916 {
55917 if (ai[1] == 40f)
55918 {
55920 }
55921 else if (ai[1] == 60f)
55922 {
55924 }
55925 }
55927 if (alpha == 255)
55928 {
55930 velocity.Y = -6f;
55931 netUpdate = true;
55932 for (int i = 0; i < 35; i++)
55933 {
55935 dust.velocity *= 1f;
55936 dust.scale = 1f + Main.rand.NextFloat() * 0.5f;
55937 dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
55938 dust.velocity += velocity * 0.5f;
55939 }
55940 }
55941 alpha -= 15;
55942 if (alpha < 0)
55943 {
55944 alpha = 0;
55945 }
55946 if (alpha != 0)
55947 {
55948 for (int j = 0; j < 2; j++)
55949 {
55951 dust2.velocity *= 1f;
55952 dust2.scale = 1f + Main.rand.NextFloat() * 0.5f;
55953 dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
55954 dust2.velocity += velocity * 0.3f;
55955 }
55956 }
55957 if (Main.rand.Next(3) == 0)
55958 {
55959 Dust.NewDustDirect(position, width, height, 5, 0f, 0f, 50, default(Color), 1.3f).velocity = Vector2.Zero;
55960 }
55962 if (dayTime)
55963 {
55964 flag12 = false;
55965 flag24 = false;
55966 flag23 = true;
55967 }
55968 else
55969 {
55970 if (velocity.Y != 0f || !((float)targetData.Hitbox.Bottom < base.Top.Y) || !(Math.Abs(base.Center.X - (float)targetData.Hitbox.Center.X) < (float)(width * 3)) || !Collision.CanHit(base.Hitbox.TopLeft(), base.Hitbox.Width, base.Hitbox.Height, targetData.Hitbox.TopLeft(), targetData.Hitbox.Width, targetData.Hitbox.Height))
55971 {
55972 break;
55973 }
55974 int num32 = (int)((base.Bottom.Y - 16f - (float)targetData.Hitbox.Bottom) / 16f);
55975 if (num32 < 27)
55976 {
55977 if (num32 < 11)
55978 {
55979 velocity.Y = -11f;
55980 }
55981 else if (num32 < 15)
55982 {
55983 velocity.Y = -13f;
55984 }
55985 else if (num32 < 19)
55986 {
55987 velocity.Y = -14f;
55988 }
55989 else
55990 {
55991 velocity.Y = -15.9f;
55992 }
55993 }
55994 }
55995 break;
55996 }
55997 }
55998 if (flag28)
55999 {
56000 bool flag31 = velocity.Y == 0f;
56001 for (int num52 = 0; num52 < 200; num52++)
56002 {
56003 if (num52 != whoAmI && Main.npc[num52].active && Main.npc[num52].type == type && Math.Abs(position.X - Main.npc[num52].position.X) + Math.Abs(position.Y - Main.npc[num52].position.Y) < (float)width)
56004 {
56005 if (position.X < Main.npc[num52].position.X)
56006 {
56007 velocity.X -= num31;
56008 }
56009 else
56010 {
56011 velocity.X += num31;
56012 }
56013 if (position.Y < Main.npc[num52].position.Y)
56014 {
56015 velocity.Y -= num31;
56016 }
56017 else
56018 {
56019 velocity.Y += num31;
56020 }
56021 }
56022 }
56023 if (flag31)
56024 {
56025 velocity.Y = 0f;
56026 }
56027 }
56028 if (flag29)
56029 {
56030 if (localAI[3] == 0f)
56031 {
56032 alpha = 255;
56033 }
56034 if (localAI[3] == 30f)
56035 {
56037 }
56038 if (localAI[3] < 60f)
56039 {
56040 localAI[3] += 1f;
56041 alpha -= 5;
56042 if (alpha < 0)
56043 {
56044 alpha = 0;
56045 }
56046 int num53 = (int)localAI[3] / 10;
56047 float num54 = base.Size.Length() / 2f;
56048 num54 /= 20f;
56049 int maxValue3 = 5;
56050 if (type == 576 || type == 577)
56051 {
56052 maxValue3 = 1;
56053 }
56054 for (int num55 = 0; num55 < num53; num55++)
56055 {
56056 if (Main.rand.Next(maxValue3) == 0)
56057 {
56058 Dust dust9 = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
56059 dust9.scale = 0.55f;
56060 dust9.fadeIn = 0.7f;
56061 dust9.velocity *= 0.1f * num54;
56062 dust9.velocity += velocity;
56063 }
56064 }
56065 }
56066 }
56067 if (flag27)
56068 {
56069 noGravity = true;
56070 TargetClosest(faceTarget: false);
56071 if (collideX)
56072 {
56073 velocity.X = 0f - oldVelocity.X;
56074 }
56075 if (velocity.X != 0f)
56076 {
56078 }
56079 if (Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56080 {
56081 Vector2 value = targetData.Center - base.Center;
56082 value.Normalize();
56083 value *= num28;
56085 return;
56086 }
56087 float num56 = num28;
56088 if (velocity.Y > 0f)
56089 {
56090 num56 = num29;
56091 }
56092 if (velocity.Y < 0f)
56093 {
56094 num56 = num30;
56095 }
56096 Vector2 value2 = new Vector2(direction, -1f);
56097 value2.Normalize();
56098 value2 *= num56;
56099 if (num56 < num28)
56100 {
56102 }
56103 else
56104 {
56106 }
56107 return;
56108 }
56109 bool flag32 = false;
56110 if ((flag12 || flag5) && ai[0] > 0f)
56111 {
56112 flag18 = false;
56113 }
56114 if (flag12 && ai[1] > 0f)
56115 {
56116 flag22 = true;
56117 }
56118 if (flag5 && ai[0] > 0f)
56119 {
56120 flag22 = true;
56121 }
56122 if (flag5)
56123 {
56124 if (ai[0] < 0f)
56125 {
56126 ai[0] += 1f;
56127 flag = false;
56128 }
56129 if (ai[0] == 0f && (velocity.Y == 0f || flag6) && targetData.Type != 0 && (Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height) || Collision.CanHitLine(position, width, height, targetData.Position, targetData.Width, targetData.Height)) && (targetData.Center - base.Center).Length() < num4)
56130 {
56131 ai[0] = num5;
56132 netUpdate = true;
56133 }
56134 if (ai[0] > 0f)
56135 {
56137 if (flag7)
56138 {
56139 velocity.X *= num7;
56140 flag24 = true;
56141 flag20 = true;
56142 ai[3] = 0f;
56143 netUpdate = true;
56144 }
56145 ai[0] -= 1f;
56146 if (ai[0] == 0f)
56147 {
56148 ai[0] = -num6;
56149 netUpdate = true;
56150 }
56151 }
56152 }
56153 if (flag3 && ai[0] > 0f)
56154 {
56155 if (flag15)
56156 {
56157 nPCTargetingMethod(this, faceTarget: true, null);
56159 }
56160 if (ai[0] == (float)num9)
56161 {
56162 Vector2 vector4 = base.Center + vector;
56163 Vector2 v = targetData.Center - vector4;
56164 v.Y -= Math.Abs(v.X) * num15;
56165 Vector2 vector5 = v.SafeNormalize(-Vector2.UnitY) * num10;
56166 for (int num57 = 0; num57 < num17; num57++)
56167 {
56170 if (vector2.HasValue)
56171 {
56172 vector6 += vector2.Value;
56173 }
56174 else
56175 {
56177 }
56178 vector7 += vector5 * num18;
56179 if (Main.netMode != 1)
56180 {
56182 }
56183 }
56184 }
56185 }
56186 if (flag4 && ai[0] > 0f)
56187 {
56188 if (velocity.Y != 0f && ai[0] < (float)num2)
56189 {
56190 ai[0] = num2;
56191 }
56192 if (ai[0] == (float)num)
56193 {
56194 velocity.Y = 0f - num3;
56195 }
56196 }
56197 if (!flag17 && flag18)
56198 {
56199 if (velocity.Y == 0f && velocity.X * (float)direction < 0f)
56200 {
56201 flag19 = true;
56202 }
56203 if (position.X == oldPosition.X || ai[3] >= (float)num21 || flag19)
56204 {
56205 ai[3] += 1f;
56206 }
56207 else if (Math.Abs(velocity.X) > 0.9f && ai[3] > 0f)
56208 {
56209 ai[3] -= 1f;
56210 }
56211 if (ai[3] > (float)(num21 * 10))
56212 {
56213 ai[3] = 0f;
56214 }
56215 if (justHit && !flag30)
56216 {
56217 ai[3] = 0f;
56218 }
56219 if (targetData.Hitbox.Intersects(base.Hitbox))
56220 {
56221 ai[3] = 0f;
56222 }
56223 if (ai[3] == (float)num21)
56224 {
56225 netUpdate = true;
56226 if (flag30)
56227 {
56228 noGravity = true;
56229 noTileCollide = true;
56230 position.X += direction * width * 2;
56231 int num58 = 20;
56232 float num59 = base.Size.Length() / 2f;
56233 num59 /= 20f;
56234 int maxValue4 = 5;
56235 if (type == 576 || type == 577)
56236 {
56237 maxValue4 = 1;
56238 }
56239 for (int num60 = 0; num60 < num58; num60++)
56240 {
56241 if (Main.rand.Next(maxValue4) == 0)
56242 {
56243 Dust dust10 = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
56244 dust10.scale = 0.55f;
56245 dust10.fadeIn = 0.7f;
56246 dust10.velocity *= 3f * num59;
56247 dust10.noGravity = true;
56248 dust10.fadeIn = 1.5f;
56249 dust10.velocity *= 3f;
56250 }
56251 }
56252 return;
56253 }
56254 }
56255 }
56256 if (!flag20)
56257 {
56258 if (ai[3] < (float)num21 && flag21)
56259 {
56260 if (num22 > 0 && Main.rand.Next(num22) == 0)
56261 {
56262 SoundEngine.PlayTrackedSound(style, base.Center);
56263 }
56265 nPCTargetingMethod(this, faceTarget: true, null);
56268 {
56269 netUpdate = true;
56270 }
56271 }
56272 else if (!flag22)
56273 {
56274 if (flag23)
56275 {
56276 EncourageDespawn(10);
56277 }
56278 if (velocity.X == 0f)
56279 {
56280 if (velocity.Y == 0f)
56281 {
56282 ai[2] += 1f;
56283 if (ai[2] >= 2f)
56284 {
56285 direction *= -1;
56287 ai[2] = 0f;
56288 netUpdate = true;
56289 }
56290 }
56291 }
56292 else if (ai[2] != 0f)
56293 {
56294 ai[2] = 0f;
56295 netUpdate = true;
56296 }
56297 if (direction == 0)
56298 {
56299 direction = 1;
56300 }
56301 }
56302 }
56303 if (!flag24)
56304 {
56305 if (velocity.X < 0f - num23 || velocity.X > num23)
56306 {
56307 if (velocity.Y == 0f)
56308 {
56309 velocity *= num25;
56310 }
56311 }
56312 else if ((velocity.X < num23 && direction == 1) || (velocity.X > 0f - num23 && direction == -1))
56313 {
56314 velocity.X = MathHelper.Clamp(velocity.X + num24 * (float)direction, 0f - num23, num23);
56315 }
56316 }
56317 if (flag12)
56318 {
56319 if (confused)
56320 {
56321 ai[0] = 0f;
56322 }
56323 else
56324 {
56325 if (ai[1] > 0f)
56326 {
56327 ai[1] -= 1f;
56328 }
56329 if (justHit)
56330 {
56331 ai[1] = num19;
56332 ai[0] = 0f;
56333 }
56334 if (ai[0] > 0f)
56335 {
56336 if (flag15)
56337 {
56338 nPCTargetingMethod(this, faceTarget: true, null);
56340 }
56341 if (ai[1] == (float)num9)
56342 {
56343 Vector2 vector8 = base.Center + vector;
56344 Vector2 v2 = targetData.Center - vector8;
56345 v2.Y -= Math.Abs(v2.X) * num15;
56346 Vector2 vector9 = v2.SafeNormalize(-Vector2.UnitY) * num10;
56347 for (int num61 = 0; num61 < num17; num61++)
56348 {
56351 if (vector2.HasValue)
56352 {
56353 vector11 += vector2.Value;
56354 }
56355 else
56356 {
56358 }
56359 vector10 += vector11 * num18;
56360 if (Main.netMode != 1)
56361 {
56363 }
56364 }
56365 if (Math.Abs(vector9.Y) > Math.Abs(vector9.X) * 2f)
56366 {
56367 ai[0] = ((vector9.Y > 0f) ? 1 : 5);
56368 }
56369 else if (Math.Abs(vector9.X) > Math.Abs(vector9.Y) * 2f)
56370 {
56371 ai[0] = 3f;
56372 }
56373 else
56374 {
56375 ai[0] = ((vector9.Y > 0f) ? 2 : 4);
56376 }
56377 if (flag16)
56378 {
56379 direction = ((vector9.X > 0f) ? 1 : (-1));
56380 }
56381 }
56382 bool flag33 = true;
56383 if ((velocity.Y != 0f && !flag14) || ai[1] <= 0f)
56384 {
56385 bool flag34 = false;
56386 if (num20 != 0f && ai[1] <= 0f)
56387 {
56388 flag34 = true;
56389 }
56390 ai[0] = 0f;
56391 ai[1] = (flag34 ? num20 : 0f);
56392 }
56393 else if (!flag13 || (!flag33 && (!flag14 || velocity.Y == 0f)))
56394 {
56395 velocity.X *= 0.9f;
56397 }
56398 }
56399 if ((ai[0] <= 0f || flag13) && (velocity.Y == 0f || flag14) && ai[1] <= 0f && targetData.Type != 0 && Collision.CanHit(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56400 {
56401 Vector2 vector12 = targetData.Center - base.Center;
56402 if (vector12.Length() < num13)
56403 {
56404 netUpdate = true;
56405 velocity.X *= 0.5f;
56406 ai[0] = 3f;
56407 ai[1] = num8;
56408 if (Math.Abs(vector12.Y) > Math.Abs(vector12.X) * 2f)
56409 {
56410 ai[0] = ((vector12.Y > 0f) ? 1 : 5);
56411 }
56412 else if (Math.Abs(vector12.X) > Math.Abs(vector12.Y) * 2f)
56413 {
56414 ai[0] = 3f;
56415 }
56416 else
56417 {
56418 ai[0] = ((vector12.Y > 0f) ? 2 : 4);
56419 }
56420 if (flag16)
56421 {
56422 direction = ((vector12.X > 0f) ? 1 : (-1));
56423 }
56424 }
56425 }
56426 if (ai[0] <= 0f || flag13)
56427 {
56428 bool flag35 = Distance(targetData.Center) < num14;
56429 if (flag35 && Collision.CanHitLine(position, width, height, targetData.Position, targetData.Width, targetData.Height))
56430 {
56431 ai[3] = 0f;
56432 }
56433 if (velocity.X < 0f - num23 || velocity.X > num23 || flag35)
56434 {
56435 if (velocity.Y == 0f)
56436 {
56437 velocity.X *= num25;
56438 }
56439 }
56440 else if ((velocity.X < num23 && direction == 1) || (velocity.X > 0f - num23 && direction == -1))
56441 {
56442 velocity.X = MathHelper.Clamp(velocity.X + num24 * (float)direction, 0f - num23, num23);
56443 }
56444 }
56445 }
56446 }
56447 if (velocity.Y == 0f)
56448 {
56449 int num62 = (int)(base.Bottom.Y + 7f) / 16;
56450 int num63 = (int)base.Left.X / 16;
56451 int num64 = (int)base.Right.X / 16;
56452 int num65;
56453 for (num65 = num63; num65 <= num64; num65++)
56454 {
56455 num65 = Utils.Clamp(num65, 0, Main.maxTilesX);
56456 num62 = Utils.Clamp(num62, 0, Main.maxTilesY);
56457 Tile tile = Main.tile[num65, num62];
56458 if (tile == null)
56459 {
56460 return;
56461 }
56462 if (tile.nactive() && Main.tileSolid[tile.type])
56463 {
56464 flag32 = true;
56465 break;
56466 }
56467 }
56468 }
56469 Point point2 = base.Center.ToTileCoordinates();
56470 if (WorldGen.InWorld(point2.X, point2.Y, 5) && !noGravity)
56471 {
56476 }
56477 if (flag32)
56478 {
56479 int num66 = (int)(base.Center.X + num26 * (float)direction) / 16;
56480 int num67 = ((int)base.Bottom.Y - 15) / 16;
56481 bool flag36 = position.Y + (float)height - (float)(num67 * 16) > 20f;
56488 if (flag8 && tileSafely4.nactive() && (tileSafely4.type == 10 || tileSafely4.type == 388))
56489 {
56490 ai[0] += 1f;
56491 ai[3] = 0f;
56492 if (ai[0] >= 60f)
56493 {
56494 if (flag9)
56495 {
56496 ai[1] = 0f;
56497 }
56498 int num68 = 5;
56499 if (Main.tile[num66, num67 - 1].type == 388)
56500 {
56501 num68 = 2;
56502 }
56503 velocity.X = 0.5f * (float)(-direction);
56504 ai[1] += num68;
56505 bool flag37 = false;
56506 if (ai[1] >= 10f)
56507 {
56508 flag37 = true;
56509 ai[1] = 10f;
56510 }
56511 if (flag10)
56512 {
56513 flag37 = true;
56514 }
56515 WorldGen.KillTile(num66, num67 - 1, fail: true);
56516 if (Main.netMode != 1 && flag37)
56517 {
56518 if (flag11)
56519 {
56521 if (Main.netMode == 2)
56522 {
56523 NetMessage.SendData(17, -1, -1, null, 0, num66, num67 - 1);
56524 }
56525 }
56526 else
56527 {
56528 if (tileSafely4.type == 10)
56529 {
56531 if (!flag38)
56532 {
56533 ai[3] = num21;
56534 netUpdate = true;
56535 }
56536 if (Main.netMode == 2 && flag38)
56537 {
56538 NetMessage.SendData(19, -1, -1, null, 0, num66, num67 - 1, direction);
56539 }
56540 }
56541 if (tileSafely4.type == 388)
56542 {
56543 bool flag39 = WorldGen.ShiftTallGate(num66, num67 - 1, closing: false);
56544 if (!flag39)
56545 {
56546 ai[3] = num21;
56547 netUpdate = true;
56548 }
56549 if (Main.netMode == 2 && flag39)
56550 {
56551 NetMessage.SendData(19, -1, -1, null, 4, num66, num67 - 1, direction);
56552 }
56553 }
56554 }
56555 }
56556 }
56557 }
56558 else
56559 {
56560 int num69 = spriteDirection * num27;
56561 if (velocity.X * (float)num69 > 0f)
56562 {
56563 if (height >= 32 && tileSafely5.nactive() && Main.tileSolid[tileSafely5.type])
56564 {
56565 netUpdate = true;
56566 velocity.Y = -7f;
56567 if (tileSafely6.nactive() && Main.tileSolid[tileSafely6.type])
56568 {
56569 velocity.Y = -8f;
56570 }
56571 }
56572 else if (tileSafely4.nactive() && Main.tileSolid[tileSafely4.type])
56573 {
56574 velocity.Y = -6f;
56575 netUpdate = true;
56576 }
56577 else if (flag36 && tileSafely3.nactive() && !tileSafely3.topSlope() && Main.tileSolid[tileSafely3.type])
56578 {
56579 velocity.Y = -5f;
56580 netUpdate = true;
56581 }
56582 else if (flag25 && (!tileSafely2.nactive() || !Main.tileSolid[tileSafely2.type]) && (!tileSafely.nactive() || !Main.tileSolid[tileSafely.type]))
56583 {
56584 velocity.X *= 1.5f;
56585 velocity.Y = -8f;
56586 netUpdate = true;
56587 }
56588 else if (flag8)
56589 {
56590 ai[0] = 0f;
56591 ai[1] = 0f;
56592 }
56593 if (velocity.Y == 0f && flag && ai[3] == 1f)
56594 {
56595 velocity.Y = -5f;
56596 netUpdate = true;
56597 }
56598 }
56599 if (flag26 && velocity.Y == 0f && Math.Abs(targetData.Center.X - base.Center.X) < 100f && Math.Abs(targetData.Center.Y - base.Center.Y) < 50f && Math.Abs(velocity.X) >= 1f && velocity.X * (float)direction > 0f)
56600 {
56601 velocity.X = MathHelper.Clamp(velocity.X * 2f, -3f, 3f);
56602 velocity.Y = -4f;
56603 netAlways = true;
56604 }
56605 }
56606 }
56607 else if (flag8)
56608 {
56609 ai[0] = 0f;
56610 ai[1] = 0f;
56611 }
56612 if (!flag2 || !noTileCollide)
56613 {
56614 return;
56615 }
56616 wet = false;
56617 if (flag29)
56618 {
56619 if (alpha < 60)
56620 {
56621 alpha += 20;
56622 }
56623 localAI[3] = 40f;
56624 }
56625 bool num70 = velocity.Y == 0f;
56626 if (Math.Abs(base.Center.X - targetData.Center.X) > 200f)
56627 {
56628 spriteDirection = (direction = ((targetData.Center.X > base.Center.X) ? 1 : (-1)));
56629 velocity.X = MathHelper.Lerp(velocity.X, direction, 0.05f);
56630 }
56631 int num71 = 80;
56632 int num72 = height;
56633 Vector2 vector14 = new Vector2(base.Center.X - (float)(num71 / 2), position.Y + (float)height - (float)num72);
56634 bool flag40 = false;
56635 if (position.Y + (float)height < targetData.Position.Y + (float)targetData.Height - 16f)
56636 {
56637 flag40 = true;
56638 }
56639 if (flag40)
56640 {
56641 velocity.Y += 0.5f;
56642 }
56643 else if (Collision.SolidCollision(vector14, num71, num72) || targetData.Center.Y - base.Center.Y < -100f || (targetData.Center.Y - base.Center.Y < 10f && Math.Abs(targetData.Center.X - base.Center.X) < 60f))
56644 {
56645 if (velocity.Y > 0f)
56646 {
56647 velocity.Y = 0f;
56648 }
56649 if ((double)velocity.Y > -0.2)
56650 {
56651 velocity.Y -= 0.025f;
56652 }
56653 else
56654 {
56655 velocity.Y -= 0.2f;
56656 }
56657 if (velocity.Y < -4f)
56658 {
56659 velocity.Y = -4f;
56660 }
56661 }
56662 else
56663 {
56664 if (velocity.Y < 0f)
56665 {
56666 velocity.Y = 0f;
56667 }
56668 if ((double)velocity.Y < 0.1)
56669 {
56670 velocity.Y += 0.025f;
56671 }
56672 else
56673 {
56674 velocity.Y += 0.5f;
56675 }
56676 }
56677 if (velocity.Y > 10f)
56678 {
56679 velocity.Y = 10f;
56680 }
56681 if (num70)
56682 {
56683 velocity.Y = 0f;
56684 }
56685 }
56686
56688 {
56689 if (this.ai[0] != -1f && Main.rand.Next(1000) == 0)
56690 {
56691 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(88, 92));
56692 }
56693 bool expertMode = Main.expertMode;
56694 bool flag = life <= lifeMax / 2;
56695 int num = 120;
56697 if (expertMode)
56698 {
56699 num = 90;
56700 }
56701 if (Main.getGoodWorld)
56702 {
56703 num -= 30;
56704 }
56705 int num2 = 18;
56706 int num3 = 3;
56708 if (expertMode)
56709 {
56710 num2 = 12;
56711 num3 = 4;
56712 }
56713 if (Main.getGoodWorld)
56714 {
56715 num2 = 10;
56716 num3 = 5;
56717 }
56718 int num4 = 80;
56720 if (expertMode)
56721 {
56722 num4 = 40;
56723 }
56724 if (Main.getGoodWorld)
56725 {
56726 num4 -= 20;
56727 }
56728 int num5 = 20;
56729 int num6 = 2;
56730 if (expertMode)
56731 {
56732 num5 = 30;
56733 num6 = 2;
56734 }
56735 int num7 = 20;
56736 int num8 = 3;
56737 bool flag2 = type == 439;
56738 bool flag3 = false;
56739 bool flag4 = false;
56740 if (flag)
56741 {
56742 defense = (int)((float)defDefense * 0.65f);
56743 }
56744 if (!flag2)
56745 {
56746 if (this.ai[3] < 0f || !Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 439)
56747 {
56748 life = 0;
56749 HitEffect();
56750 active = false;
56751 return;
56752 }
56753 this.ai[0] = Main.npc[(int)this.ai[3]].ai[0];
56754 this.ai[1] = Main.npc[(int)this.ai[3]].ai[1];
56755 if (this.ai[0] == 5f)
56756 {
56757 if (justHit)
56758 {
56759 life = 0;
56760 HitEffect();
56761 active = false;
56762 if (Main.netMode != 1)
56763 {
56764 NetMessage.SendData(23, -1, -1, null, whoAmI);
56765 }
56766 NPC obj = Main.npc[(int)this.ai[3]];
56767 obj.ai[0] = 6f;
56768 obj.ai[1] = 0f;
56769 obj.netUpdate = true;
56770 }
56771 }
56772 else
56773 {
56774 flag3 = true;
56775 flag4 = true;
56776 }
56777 }
56778 else if (this.ai[0] == 5f && this.ai[1] >= 120f && this.ai[1] < 420f && justHit)
56779 {
56780 this.ai[0] = 0f;
56781 this.ai[1] = 0f;
56782 this.ai[3] += 1f;
56784 netUpdate = true;
56785 List<int> list = new List<int>();
56786 for (int i = 0; i < 200; i++)
56787 {
56788 if (Main.npc[i].active && Main.npc[i].type == 440 && Main.npc[i].ai[3] == (float)whoAmI)
56789 {
56790 list.Add(i);
56791 }
56792 }
56793 int num9 = 10;
56794 if (Main.expertMode)
56795 {
56796 num9 = 3;
56797 }
56798 foreach (int item in list)
56799 {
56800 NPC nPC = Main.npc[item];
56801 if (nPC.localAI[1] == localAI[1] && num9 > 0)
56802 {
56803 num9--;
56804 nPC.life = 0;
56805 nPC.HitEffect();
56806 nPC.active = false;
56807 if (Main.netMode != 1)
56808 {
56809 NetMessage.SendData(23, -1, -1, null, item);
56810 }
56811 }
56812 else if (num9 > 0)
56813 {
56814 num9--;
56815 nPC.life = 0;
56816 nPC.HitEffect();
56817 nPC.active = false;
56818 }
56819 }
56820 Main.projectile[(int)this.ai[2]].ai[1] = -1f;
56821 Main.projectile[(int)this.ai[2]].netUpdate = true;
56822 }
56823 Vector2 center = base.Center;
56824 Player player = Main.player[target];
56825 float num10 = 5600f;
56826 if (target < 0 || target == 255 || player.dead || !player.active || Vector2.Distance(player.Center, center) > num10)
56827 {
56828 TargetClosest(faceTarget: false);
56829 player = Main.player[target];
56830 netUpdate = true;
56831 }
56832 if (player.dead || !player.active || Vector2.Distance(player.Center, center) > num10)
56833 {
56834 life = 0;
56835 HitEffect();
56836 active = false;
56837 if (Main.netMode != 1)
56838 {
56839 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
56840 }
56841 new List<int>().Add(whoAmI);
56842 for (int j = 0; j < 200; j++)
56843 {
56844 if (Main.npc[j].active && Main.npc[j].type == 440 && Main.npc[j].ai[3] == (float)whoAmI)
56845 {
56846 Main.npc[j].life = 0;
56847 Main.npc[j].HitEffect();
56848 Main.npc[j].active = false;
56849 if (Main.netMode != 1)
56850 {
56851 NetMessage.SendData(28, -1, -1, null, whoAmI, -1f);
56852 }
56853 }
56854 }
56855 }
56856 float num11 = this.ai[3];
56857 if (localAI[0] == 0f)
56858 {
56859 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 89);
56860 localAI[0] = 1f;
56861 alpha = 255;
56862 rotation = 0f;
56863 if (Main.netMode != 1)
56864 {
56865 this.ai[0] = -1f;
56866 netUpdate = true;
56867 }
56868 }
56869 if (this.ai[0] == -1f)
56870 {
56871 alpha -= 5;
56872 if (alpha < 0)
56873 {
56874 alpha = 0;
56875 }
56876 this.ai[1] += 1f;
56877 if (this.ai[1] >= 420f)
56878 {
56879 this.ai[0] = 0f;
56880 this.ai[1] = 0f;
56881 netUpdate = true;
56882 }
56883 else if (this.ai[1] > 360f)
56884 {
56885 velocity *= 0.95f;
56886 if (localAI[2] != 13f)
56887 {
56888 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 105);
56889 }
56890 localAI[2] = 13f;
56891 }
56892 else if (this.ai[1] > 300f)
56893 {
56895 localAI[2] = 10f;
56896 }
56897 else if (this.ai[1] > 120f)
56898 {
56899 localAI[2] = 1f;
56900 }
56901 else
56902 {
56903 localAI[2] = 0f;
56904 }
56905 flag3 = true;
56906 flag4 = true;
56907 }
56908 if (this.ai[0] == 0f)
56909 {
56910 if (this.ai[1] == 0f)
56911 {
56912 TargetClosest(faceTarget: false);
56913 }
56914 localAI[2] = 10f;
56915 int num12 = Math.Sign(player.Center.X - center.X);
56916 if (num12 != 0)
56917 {
56919 }
56920 this.ai[1] += 1f;
56921 if (this.ai[1] >= 40f && flag2)
56922 {
56923 int num13 = 0;
56924 if (flag)
56925 {
56926 switch ((int)this.ai[3])
56927 {
56928 case 0:
56929 num13 = 0;
56930 break;
56931 case 1:
56932 num13 = 1;
56933 break;
56934 case 2:
56935 num13 = 0;
56936 break;
56937 case 3:
56938 num13 = 5;
56939 break;
56940 case 4:
56941 num13 = 0;
56942 break;
56943 case 5:
56944 num13 = 3;
56945 break;
56946 case 6:
56947 num13 = 0;
56948 break;
56949 case 7:
56950 num13 = 5;
56951 break;
56952 case 8:
56953 num13 = 0;
56954 break;
56955 case 9:
56956 num13 = 2;
56957 break;
56958 case 10:
56959 num13 = 0;
56960 break;
56961 case 11:
56962 num13 = 3;
56963 break;
56964 case 12:
56965 num13 = 0;
56966 break;
56967 case 13:
56968 num13 = 4;
56969 this.ai[3] = -1f;
56970 break;
56971 default:
56972 this.ai[3] = -1f;
56973 break;
56974 }
56975 }
56976 else
56977 {
56978 switch ((int)this.ai[3])
56979 {
56980 case 0:
56981 num13 = 0;
56982 break;
56983 case 1:
56984 num13 = 1;
56985 break;
56986 case 2:
56987 num13 = 0;
56988 break;
56989 case 3:
56990 num13 = 2;
56991 break;
56992 case 4:
56993 num13 = 0;
56994 break;
56995 case 5:
56996 num13 = 3;
56997 break;
56998 case 6:
56999 num13 = 0;
57000 break;
57001 case 7:
57002 num13 = 1;
57003 break;
57004 case 8:
57005 num13 = 0;
57006 break;
57007 case 9:
57008 num13 = 2;
57009 break;
57010 case 10:
57011 num13 = 0;
57012 break;
57013 case 11:
57014 num13 = 4;
57015 this.ai[3] = -1f;
57016 break;
57017 default:
57018 this.ai[3] = -1f;
57019 break;
57020 }
57021 }
57022 int maxValue = 6;
57023 if (life < lifeMax / 3)
57024 {
57025 maxValue = 4;
57026 }
57027 if (life < lifeMax / 4)
57028 {
57029 maxValue = 3;
57030 }
57031 if (expertMode && flag && Main.rand.Next(maxValue) == 0 && num13 != 0 && num13 != 4 && num13 != 5 && CountNPCS(523) < 10)
57032 {
57033 num13 = 6;
57034 }
57035 if (num13 == 0)
57036 {
57037 float num14 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f);
57038 if (num14 == 0f)
57039 {
57040 num14 = 1f;
57041 }
57042 List<int> list2 = new List<int>();
57043 int num15 = 0;
57044 list2.Add(whoAmI);
57045 for (int k = 0; k < 200; k++)
57046 {
57047 if (Main.npc[k].active && Main.npc[k].type == 440 && Main.npc[k].ai[3] == (float)whoAmI)
57048 {
57049 list2.Add(k);
57050 }
57051 }
57052 bool flag5 = list2.Count % 2 == 0;
57053 foreach (int item2 in list2)
57054 {
57055 NPC nPC2 = Main.npc[item2];
57056 Vector2 center2 = nPC2.Center;
57057 float num16 = (float)((num15 + flag5.ToInt() + 1) / 2) * ((float)Math.PI * 2f) * 0.4f / (float)list2.Count;
57058 if (num15 % 2 == 1)
57059 {
57060 num16 *= -1f;
57061 }
57062 if (list2.Count == 1)
57063 {
57064 num16 = 0f;
57065 }
57066 Vector2 vector = new Vector2(0f, -1f).RotatedBy(num16) * new Vector2(300f, 200f);
57067 Vector2 vector2 = player.Center + vector - center2;
57068 nPC2.ai[0] = 1f;
57069 nPC2.ai[1] = num14 * 2f;
57070 nPC2.velocity = vector2 / num14;
57071 if (whoAmI >= nPC2.whoAmI)
57072 {
57073 nPC2.position -= nPC2.velocity;
57074 }
57075 nPC2.netUpdate = true;
57076 num15++;
57077 }
57078 }
57079 switch (num13)
57080 {
57081 case 1:
57082 this.ai[0] = 3f;
57083 this.ai[1] = 0f;
57084 break;
57085 case 2:
57086 this.ai[0] = 2f;
57087 this.ai[1] = 0f;
57088 break;
57089 case 3:
57090 this.ai[0] = 4f;
57091 this.ai[1] = 0f;
57092 break;
57093 case 4:
57094 this.ai[0] = 5f;
57095 this.ai[1] = 0f;
57096 break;
57097 }
57098 if (num13 == 5)
57099 {
57100 this.ai[0] = 7f;
57101 this.ai[1] = 0f;
57102 }
57103 if (num13 == 6)
57104 {
57105 this.ai[0] = 8f;
57106 this.ai[1] = 0f;
57107 }
57108 netUpdate = true;
57109 }
57110 }
57111 else if (this.ai[0] == 1f)
57112 {
57113 flag3 = true;
57114 localAI[2] = 10f;
57115 if ((float)(int)this.ai[1] % 2f != 0f && this.ai[1] != 1f)
57116 {
57117 position -= velocity;
57118 }
57119 this.ai[1] -= 1f;
57120 if (this.ai[1] <= 0f)
57121 {
57122 this.ai[0] = 0f;
57123 this.ai[1] = 0f;
57124 this.ai[3] += 1f;
57126 netUpdate = true;
57127 }
57128 }
57129 else if (this.ai[0] == 2f)
57130 {
57131 localAI[2] = 11f;
57133 if (vec.HasNaNs())
57134 {
57135 vec = new Vector2(direction, 0f);
57136 }
57137 if (this.ai[1] >= 4f && flag2 && (int)(this.ai[1] - 4f) % num == 0)
57138 {
57139 if (Main.netMode != 1)
57140 {
57141 List<int> list3 = new List<int>();
57142 for (int l = 0; l < 200; l++)
57143 {
57144 if (Main.npc[l].active && Main.npc[l].type == 440 && Main.npc[l].ai[3] == (float)whoAmI)
57145 {
57146 list3.Add(l);
57147 }
57148 }
57149 foreach (int item3 in list3)
57150 {
57151 NPC nPC3 = Main.npc[item3];
57152 Vector2 center3 = nPC3.Center;
57153 int num17 = Math.Sign(player.Center.X - center3.X);
57154 if (num17 != 0)
57155 {
57156 nPC3.direction = (nPC3.spriteDirection = num17);
57157 }
57158 if (Main.netMode != 1)
57159 {
57160 vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f);
57161 if (vec.HasNaNs())
57162 {
57163 vec = new Vector2(direction, 0f);
57164 }
57165 Vector2 vector3 = center3 + new Vector2(direction * 30, 12f);
57166 for (int m = 0; m < 1; m++)
57167 {
57168 Vector2 spinninpoint = vec * (6f + (float)Main.rand.NextDouble() * 4f);
57169 spinninpoint = spinninpoint.RotatedByRandom(0.5235987901687622);
57171 }
57172 }
57173 }
57174 }
57175 if (Main.netMode != 1)
57176 {
57177 vec = Vector2.Normalize(player.Center - center + player.velocity * 20f);
57178 if (vec.HasNaNs())
57179 {
57180 vec = new Vector2(direction, 0f);
57181 }
57182 Vector2 vector4 = base.Center + new Vector2(direction * 30, 12f);
57183 for (int n = 0; n < 1; n++)
57184 {
57185 Vector2 vector5 = vec * 4f;
57187 }
57188 }
57189 }
57190 this.ai[1] += 1f;
57191 if (this.ai[1] >= (float)(4 + num))
57192 {
57193 this.ai[0] = 0f;
57194 this.ai[1] = 0f;
57195 this.ai[3] += 1f;
57197 netUpdate = true;
57198 }
57199 }
57200 else if (this.ai[0] == 3f)
57201 {
57202 localAI[2] = 11f;
57204 if (vec2.HasNaNs())
57205 {
57206 vec2 = new Vector2(direction, 0f);
57207 }
57208 if (this.ai[1] >= 4f && flag2 && (int)(this.ai[1] - 4f) % num2 == 0)
57209 {
57210 if ((int)(this.ai[1] - 4f) / num2 == 2)
57211 {
57212 List<int> list4 = new List<int>();
57213 for (int num18 = 0; num18 < 200; num18++)
57214 {
57215 if (Main.npc[num18].active && Main.npc[num18].type == 440 && Main.npc[num18].ai[3] == (float)whoAmI)
57216 {
57217 list4.Add(num18);
57218 }
57219 }
57220 if (Main.netMode != 1)
57221 {
57222 foreach (int item4 in list4)
57223 {
57224 NPC nPC4 = Main.npc[item4];
57225 Vector2 center4 = nPC4.Center;
57226 int num19 = Math.Sign(player.Center.X - center4.X);
57227 if (num19 != 0)
57228 {
57229 nPC4.direction = (nPC4.spriteDirection = num19);
57230 }
57231 if (Main.netMode != 1)
57232 {
57233 vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f);
57234 if (vec2.HasNaNs())
57235 {
57236 vec2 = new Vector2(direction, 0f);
57237 }
57238 Vector2 vector6 = center4 + new Vector2(direction * 30, 12f);
57239 for (int num20 = 0; num20 < 1; num20++)
57240 {
57241 Vector2 spinninpoint2 = vec2 * (6f + (float)Main.rand.NextDouble() * 4f);
57242 spinninpoint2 = spinninpoint2.RotatedByRandom(0.5235987901687622);
57244 }
57245 }
57246 }
57247 }
57248 }
57249 int num21 = Math.Sign(player.Center.X - center.X);
57250 if (num21 != 0)
57251 {
57253 }
57254 if (Main.netMode != 1)
57255 {
57256 vec2 = Vector2.Normalize(player.Center - center + player.velocity * 20f);
57257 if (vec2.HasNaNs())
57258 {
57259 vec2 = new Vector2(direction, 0f);
57260 }
57261 Vector2 vector7 = base.Center + new Vector2(direction * 30, 12f);
57262 for (int num22 = 0; num22 < 1; num22++)
57263 {
57264 Vector2 spinninpoint3 = vec2 * (6f + (float)Main.rand.NextDouble() * 4f);
57265 spinninpoint3 = spinninpoint3.RotatedByRandom(0.5235987901687622);
57267 }
57268 }
57269 }
57270 this.ai[1] += 1f;
57271 if (this.ai[1] >= (float)(4 + num2 * num3))
57272 {
57273 this.ai[0] = 0f;
57274 this.ai[1] = 0f;
57275 this.ai[3] += 1f;
57277 netUpdate = true;
57278 }
57279 }
57280 else if (this.ai[0] == 4f)
57281 {
57282 if (flag2)
57283 {
57284 localAI[2] = 12f;
57285 }
57286 else
57287 {
57288 localAI[2] = 11f;
57289 }
57290 if (this.ai[1] == 20f && flag2 && Main.netMode != 1)
57291 {
57292 List<int> list5 = new List<int>();
57293 for (int num23 = 0; num23 < 200; num23++)
57294 {
57295 if (Main.npc[num23].active && Main.npc[num23].type == 440 && Main.npc[num23].ai[3] == (float)whoAmI)
57296 {
57297 list5.Add(num23);
57298 }
57299 }
57300 foreach (int item5 in list5)
57301 {
57302 NPC nPC5 = Main.npc[item5];
57303 Vector2 center5 = nPC5.Center;
57304 int num24 = Math.Sign(player.Center.X - center5.X);
57305 if (num24 != 0)
57306 {
57307 nPC5.direction = (nPC5.spriteDirection = num24);
57308 }
57309 if (Main.netMode != 1)
57310 {
57311 Vector2 vector8 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f);
57312 if (vector8.HasNaNs())
57313 {
57314 vector8 = new Vector2(direction, 0f);
57315 }
57316 Vector2 vector9 = center5 + new Vector2(direction * 30, 12f);
57317 for (int num25 = 0; num25 < 1; num25++)
57318 {
57319 Vector2 spinninpoint4 = vector8 * (6f + (float)Main.rand.NextDouble() * 4f);
57320 spinninpoint4 = spinninpoint4.RotatedByRandom(0.5235987901687622);
57322 }
57323 }
57324 }
57325 if ((int)(this.ai[1] - 20f) % num4 == 0)
57326 {
57327 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y - 100f, 0f, 0f, 465, attackDamage_ForProjectiles3, 0f, Main.myPlayer);
57328 }
57329 }
57330 this.ai[1] += 1f;
57331 if (this.ai[1] >= (float)(20 + num4))
57332 {
57333 this.ai[0] = 0f;
57334 this.ai[1] = 0f;
57335 this.ai[3] += 1f;
57337 netUpdate = true;
57338 }
57339 }
57340 else if (this.ai[0] == 5f)
57341 {
57342 localAI[2] = 10f;
57343 if (Vector2.Normalize(player.Center - center).HasNaNs())
57344 {
57345 new Vector2(direction, 0f);
57346 }
57347 if (this.ai[1] >= 0f && this.ai[1] < 30f)
57348 {
57349 flag3 = true;
57350 flag4 = true;
57351 float num26 = (this.ai[1] - 0f) / 30f;
57352 alpha = (int)(num26 * 255f);
57353 }
57354 else if (this.ai[1] >= 30f && this.ai[1] < 90f)
57355 {
57356 if (this.ai[1] == 30f && Main.netMode != 1 && flag2)
57357 {
57358 localAI[1] += 1f;
57359 Vector2 spinningpoint = new Vector2(180f, 0f);
57360 List<int> list6 = new List<int>();
57361 for (int num27 = 0; num27 < 200; num27++)
57362 {
57363 if (Main.npc[num27].active && Main.npc[num27].type == 440 && Main.npc[num27].ai[3] == (float)whoAmI)
57364 {
57365 list6.Add(num27);
57366 }
57367 }
57368 int num28 = 6 - list6.Count;
57369 if (num28 > 2)
57370 {
57371 num28 = 2;
57372 }
57373 int num29 = list6.Count + num28 + 1;
57374 float[] array = new float[num29];
57375 for (int num30 = 0; num30 < array.Length; num30++)
57376 {
57377 array[num30] = Vector2.Distance(base.Center + spinningpoint.RotatedBy((float)num30 * ((float)Math.PI * 2f) / (float)num29 - (float)Math.PI / 2f), player.Center);
57378 }
57379 int num31 = 0;
57380 for (int num32 = 1; num32 < array.Length; num32++)
57381 {
57382 if (array[num31] > array[num32])
57383 {
57384 num31 = num32;
57385 }
57386 }
57387 num31 = ((num31 >= num29 / 2) ? (num31 - num29 / 2) : (num31 + num29 / 2));
57388 int num33 = num28;
57389 for (int num34 = 0; num34 < array.Length; num34++)
57390 {
57391 if (num31 != num34)
57392 {
57393 Vector2 center6 = base.Center + spinningpoint.RotatedBy((float)num34 * ((float)Math.PI * 2f) / (float)num29 - (float)Math.PI / 2f);
57394 if (num33-- > 0)
57395 {
57396 int num35 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)center6.X, (int)center6.Y + height / 2, 440, whoAmI);
57397 Main.npc[num35].ai[3] = whoAmI;
57398 Main.npc[num35].netUpdate = true;
57399 Main.npc[num35].localAI[1] = localAI[1];
57400 }
57401 else
57402 {
57403 int num36 = list6[-num33 - 1];
57404 Main.npc[num36].Center = center6;
57405 NetMessage.SendData(23, -1, -1, null, num36);
57406 }
57407 }
57408 }
57409 this.ai[2] = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 490, 0, 0f, Main.myPlayer, 0f, whoAmI);
57410 base.Center += spinningpoint.RotatedBy((float)num31 * ((float)Math.PI * 2f) / (float)num29 - (float)Math.PI / 2f);
57411 netUpdate = true;
57412 list6.Clear();
57413 }
57414 flag3 = true;
57415 flag4 = true;
57416 alpha = 255;
57417 if (flag2)
57418 {
57419 Vector2 vector10 = Main.projectile[(int)this.ai[2]].Center;
57420 vector10 -= base.Center;
57421 if (vector10 == Vector2.Zero)
57422 {
57424 }
57425 vector10.Normalize();
57426 if (Math.Abs(vector10.Y) < 0.77f)
57427 {
57428 localAI[2] = 11f;
57429 }
57430 else if (vector10.Y < 0f)
57431 {
57432 localAI[2] = 12f;
57433 }
57434 else
57435 {
57436 localAI[2] = 10f;
57437 }
57438 int num37 = Math.Sign(vector10.X);
57439 if (num37 != 0)
57440 {
57442 }
57443 }
57444 else
57445 {
57446 Vector2 vector11 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center;
57447 vector11 -= base.Center;
57448 if (vector11 == Vector2.Zero)
57449 {
57451 }
57452 vector11.Normalize();
57453 if (Math.Abs(vector11.Y) < 0.77f)
57454 {
57455 localAI[2] = 11f;
57456 }
57457 else if (vector11.Y < 0f)
57458 {
57459 localAI[2] = 12f;
57460 }
57461 else
57462 {
57463 localAI[2] = 10f;
57464 }
57465 int num38 = Math.Sign(vector11.X);
57466 if (num38 != 0)
57467 {
57469 }
57470 }
57471 }
57472 else if (this.ai[1] >= 90f && this.ai[1] < 120f)
57473 {
57474 flag3 = true;
57475 flag4 = true;
57476 float num39 = (this.ai[1] - 90f) / 30f;
57477 alpha = 255 - (int)(num39 * 255f);
57478 }
57479 else if (this.ai[1] >= 120f && this.ai[1] < 420f)
57480 {
57481 flag4 = true;
57482 alpha = 0;
57483 if (flag2)
57484 {
57485 Vector2 vector12 = Main.projectile[(int)this.ai[2]].Center;
57486 vector12 -= base.Center;
57487 if (vector12 == Vector2.Zero)
57488 {
57490 }
57491 vector12.Normalize();
57492 if (Math.Abs(vector12.Y) < 0.77f)
57493 {
57494 localAI[2] = 11f;
57495 }
57496 else if (vector12.Y < 0f)
57497 {
57498 localAI[2] = 12f;
57499 }
57500 else
57501 {
57502 localAI[2] = 10f;
57503 }
57504 int num40 = Math.Sign(vector12.X);
57505 if (num40 != 0)
57506 {
57508 }
57509 }
57510 else
57511 {
57512 Vector2 vector13 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center;
57513 vector13 -= base.Center;
57514 if (vector13 == Vector2.Zero)
57515 {
57517 }
57518 vector13.Normalize();
57519 if (Math.Abs(vector13.Y) < 0.77f)
57520 {
57521 localAI[2] = 11f;
57522 }
57523 else if (vector13.Y < 0f)
57524 {
57525 localAI[2] = 12f;
57526 }
57527 else
57528 {
57529 localAI[2] = 10f;
57530 }
57531 int num41 = Math.Sign(vector13.X);
57532 if (num41 != 0)
57533 {
57535 }
57536 }
57537 }
57538 this.ai[1] += 1f;
57539 if (this.ai[1] >= 420f)
57540 {
57541 flag4 = true;
57542 this.ai[0] = 0f;
57543 this.ai[1] = 0f;
57544 this.ai[3] += 1f;
57546 netUpdate = true;
57547 }
57548 }
57549 else if (this.ai[0] == 6f)
57550 {
57551 localAI[2] = 13f;
57552 this.ai[1] += 1f;
57553 if (this.ai[1] >= 120f)
57554 {
57555 this.ai[0] = 0f;
57556 this.ai[1] = 0f;
57557 this.ai[3] += 1f;
57559 netUpdate = true;
57560 }
57561 }
57562 else if (this.ai[0] == 7f)
57563 {
57564 localAI[2] = 11f;
57566 if (vec3.HasNaNs())
57567 {
57568 vec3 = new Vector2(direction, 0f);
57569 }
57570 if (this.ai[1] >= 4f && flag2 && (int)(this.ai[1] - 4f) % num5 == 0)
57571 {
57572 if ((int)(this.ai[1] - 4f) / num5 == 2)
57573 {
57574 List<int> list7 = new List<int>();
57575 for (int num42 = 0; num42 < 200; num42++)
57576 {
57577 if (Main.npc[num42].active && Main.npc[num42].type == 440 && Main.npc[num42].ai[3] == (float)whoAmI)
57578 {
57579 list7.Add(num42);
57580 }
57581 }
57582 foreach (int item6 in list7)
57583 {
57584 NPC nPC6 = Main.npc[item6];
57585 Vector2 center7 = nPC6.Center;
57586 int num43 = Math.Sign(player.Center.X - center7.X);
57587 if (num43 != 0)
57588 {
57589 nPC6.direction = (nPC6.spriteDirection = num43);
57590 }
57591 if (Main.netMode != 1)
57592 {
57593 vec3 = Vector2.Normalize(player.Center - center7 + player.velocity * 20f);
57594 if (vec3.HasNaNs())
57595 {
57596 vec3 = new Vector2(direction, 0f);
57597 }
57598 Vector2 vector14 = center7 + new Vector2(direction * 30, 12f);
57599 for (int num44 = 0; (float)num44 < 5f; num44++)
57600 {
57601 Vector2 spinninpoint5 = vec3 * (6f + (float)Main.rand.NextDouble() * 4f);
57602 spinninpoint5 = spinninpoint5.RotatedByRandom(1.2566370964050293);
57604 }
57605 }
57606 }
57607 }
57608 int num45 = Math.Sign(player.Center.X - center.X);
57609 if (num45 != 0)
57610 {
57612 }
57613 if (Main.netMode != 1)
57614 {
57615 vec3 = Vector2.Normalize(player.Center - center + player.velocity * 20f);
57616 if (vec3.HasNaNs())
57617 {
57618 vec3 = new Vector2(direction, 0f);
57619 }
57620 Vector2 vector15 = base.Center + new Vector2(direction * 30, 12f);
57621 float num46 = 8f;
57622 float num47 = (float)Math.PI * 2f / 25f;
57623 for (int num48 = 0; (float)num48 < 5f; num48++)
57624 {
57626 spinningpoint2 = spinningpoint2.RotatedBy(num47 * (float)num48 - ((float)Math.PI * 2f / 5f - num47) / 2f);
57627 float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * ((float)Math.PI * 2f) / 60f;
57628 int num49 = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)vector15.X, (int)vector15.Y + 7, 522, 0, 0f, ai, spinningpoint2.X, spinningpoint2.Y);
57629 Main.npc[num49].velocity = spinningpoint2;
57630 Main.npc[num49].netUpdate = true;
57631 }
57632 }
57633 }
57634 this.ai[1] += 1f;
57635 if (this.ai[1] >= (float)(4 + num5 * num6))
57636 {
57637 this.ai[0] = 0f;
57638 this.ai[1] = 0f;
57639 this.ai[3] += 1f;
57641 netUpdate = true;
57642 }
57643 }
57644 else if (this.ai[0] == 8f)
57645 {
57646 localAI[2] = 13f;
57647 if (this.ai[1] >= 4f && flag2 && (int)(this.ai[1] - 4f) % num7 == 0)
57648 {
57649 List<int> list8 = new List<int>();
57650 for (int num50 = 0; num50 < 200; num50++)
57651 {
57652 if (Main.npc[num50].active && Main.npc[num50].type == 440 && Main.npc[num50].ai[3] == (float)whoAmI)
57653 {
57654 list8.Add(num50);
57655 }
57656 }
57657 int num51 = list8.Count + 1;
57658 if (num51 > 3)
57659 {
57660 num51 = 3;
57661 }
57662 int num52 = Math.Sign(player.Center.X - center.X);
57663 if (num52 != 0)
57664 {
57666 }
57667 if (Main.netMode != 1)
57668 {
57669 for (int num53 = 0; num53 < num51; num53++)
57670 {
57671 Point point = base.Center.ToTileCoordinates();
57672 Point point2 = Main.player[target].Center.ToTileCoordinates();
57673 Vector2 vector16 = Main.player[target].Center - base.Center;
57674 int num54 = 20;
57675 int num55 = 3;
57676 int num56 = 7;
57677 int num57 = 2;
57678 int num58 = 0;
57679 bool flag6 = false;
57680 if (vector16.Length() > 2000f)
57681 {
57682 flag6 = true;
57683 }
57684 while (!flag6 && num58 < 100)
57685 {
57686 num58++;
57687 int num59 = Main.rand.Next(point2.X - num54, point2.X + num54 + 1);
57688 int num60 = Main.rand.Next(point2.Y - num54, point2.Y + num54 + 1);
57689 if ((num60 < point2.Y - num56 || num60 > point2.Y + num56 || num59 < point2.X - num56 || num59 > point2.X + num56) && (num60 < point.Y - num55 || num60 > point.Y + num55 || num59 < point.X - num55 || num59 > point.X + num55) && !Main.tile[num59, num60].nactive())
57690 {
57691 bool flag7 = true;
57693 {
57694 flag7 = false;
57695 }
57696 if (flag7)
57697 {
57698 NewNPC(GetSpawnSourceForNPCFromNPCAI(), num59 * 16 + 8, num60 * 16 + 8, 523, 0, whoAmI);
57699 flag6 = true;
57700 break;
57701 }
57702 }
57703 }
57704 }
57705 }
57706 }
57707 this.ai[1] += 1f;
57708 if (this.ai[1] >= (float)(4 + num7 * num8))
57709 {
57710 this.ai[0] = 0f;
57711 this.ai[1] = 0f;
57712 this.ai[3] += 1f;
57714 netUpdate = true;
57715 }
57716 }
57717 if (!flag2)
57718 {
57719 this.ai[3] = num11;
57720 }
57722 chaseable = !flag4;
57723 }
57724
57725 private void AI_108_DivingFlyer()
57726 {
57727 //IL_0210: Unknown result type (might be due to invalid IL or missing references)
57728 //IL_0b8b: Unknown result type (might be due to invalid IL or missing references)
57729 //IL_07a2: Unknown result type (might be due to invalid IL or missing references)
57730 //IL_07a7: Unknown result type (might be due to invalid IL or missing references)
57731 //IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
57732 //IL_0bb6: Unknown result type (might be due to invalid IL or missing references)
57733 //IL_090e: Unknown result type (might be due to invalid IL or missing references)
57734 //IL_07d0: Unknown result type (might be due to invalid IL or missing references)
57735 //IL_07d5: Unknown result type (might be due to invalid IL or missing references)
57736 //IL_0930: Unknown result type (might be due to invalid IL or missing references)
57737 //IL_0935: Unknown result type (might be due to invalid IL or missing references)
57738 //IL_0bef: Unknown result type (might be due to invalid IL or missing references)
57739 //IL_080d: Unknown result type (might be due to invalid IL or missing references)
57740 //IL_0812: Unknown result type (might be due to invalid IL or missing references)
57741 //IL_0827: Unknown result type (might be due to invalid IL or missing references)
57742 //IL_0c15: Unknown result type (might be due to invalid IL or missing references)
57743 //IL_0c1a: Unknown result type (might be due to invalid IL or missing references)
57744 rotation = velocity.ToRotation();
57745 float num = 0.4f;
57746 float num2 = 10f;
57747 float num3 = 200f;
57748 float num4 = 750f;
57749 float num5 = 30f;
57750 float num6 = 30f;
57751 float num7 = 0.95f;
57752 int num8 = 50;
57753 float num9 = 14f;
57754 float num10 = 30f;
57755 float num11 = 100f;
57756 float num12 = 20f;
57757 float num13 = 0f;
57758 float num14 = 7f;
57759 bool flag = true;
57760 bool flag2 = true;
57761 int num15 = 120;
57762 bool flag3 = false;
57763 bool flag4 = false;
57764 float num16 = 0.05f;
57765 float num17 = 0f;
57766 bool flag5 = false;
57767 switch (type)
57768 {
57769 case 558:
57770 case 559:
57771 case 560:
57772 flag4 = true;
57773 num = 0.7f;
57774 if (type == 559)
57775 {
57776 num = 0.5f;
57777 }
57778 if (type == 560)
57779 {
57780 num = 0.2f;
57781 }
57782 num2 = 3f;
57783 num3 = 400f;
57784 num4 = 500f;
57785 num5 = 90f;
57786 num6 = 20f;
57787 num7 = 0.95f;
57788 num8 = 0;
57789 num9 = 8f;
57790 num10 = 30f;
57791 num11 = 150f;
57792 num12 = 60f;
57793 num13 = 0.05f;
57794 num14 = 6f;
57795 flag2 = false;
57796 flag5 = true;
57797 break;
57798 case 574:
57799 case 575:
57800 flag4 = true;
57801 num = 0.6f;
57802 if (type == 575)
57803 {
57804 num = 0.4f;
57805 }
57806 num2 = 4f;
57807 num3 = 400f;
57808 num4 = 500f;
57809 num5 = 90f;
57810 num6 = 30f;
57811 num7 = 0.95f;
57812 num8 = 3;
57813 num9 = 8f;
57814 num10 = 30f;
57815 num11 = 150f;
57816 num12 = 10f;
57817 num13 = 0.05f;
57818 num14 = 0f;
57819 num17 = -0.1f;
57820 flag3 = true;
57821 flag5 = true;
57822 break;
57823 }
57826 if (flag5)
57827 {
57828 if (localAI[0] == 0f)
57829 {
57830 alpha = 255;
57831 }
57832 if (localAI[0] == 30f)
57833 {
57835 }
57836 if (localAI[0] < 60f)
57837 {
57838 localAI[0] += 1f;
57839 alpha -= 5;
57840 if (alpha < 0)
57841 {
57842 alpha = 0;
57843 }
57844 int num18 = (int)localAI[0] / 10;
57845 float num19 = base.Size.Length() / 2f;
57846 num19 /= 20f;
57847 int maxValue = 5;
57848 if (type == 576 || type == 577)
57849 {
57850 maxValue = 1;
57851 }
57852 for (int i = 0; i < num18; i++)
57853 {
57854 if (Main.rand.Next(maxValue) == 0)
57855 {
57856 Dust dust = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
57857 dust.scale = 0.55f;
57858 dust.fadeIn = 0.7f;
57859 dust.velocity *= 0.1f * num19;
57860 dust.velocity += velocity;
57861 }
57862 }
57863 }
57864 }
57865 if (flag4)
57866 {
57867 for (int j = 0; j < 200; j++)
57868 {
57869 if (j != whoAmI && Main.npc[j].active && Main.npc[j].type == type && Math.Abs(position.X - Main.npc[j].position.X) + Math.Abs(position.Y - Main.npc[j].position.Y) < (float)width)
57870 {
57871 if (position.X < Main.npc[j].position.X)
57872 {
57873 velocity.X -= num16;
57874 }
57875 else
57876 {
57877 velocity.X += num16;
57878 }
57879 if (position.Y < Main.npc[j].position.Y)
57880 {
57881 velocity.Y -= num16;
57882 }
57883 else
57884 {
57885 velocity.Y += num16;
57886 }
57887 }
57888 }
57889 }
57890 if (Math.Sign(velocity.X) != 0)
57891 {
57893 }
57894 if (rotation < -(float)Math.PI / 2f)
57895 {
57896 rotation += (float)Math.PI;
57897 }
57898 if (rotation > (float)Math.PI / 2f)
57899 {
57900 rotation -= (float)Math.PI;
57901 }
57902 num13 *= num12;
57903 if (Main.expertMode)
57904 {
57905 num *= Main.GameModeInfo.KnockbackToEnemiesMultiplier;
57906 }
57907 SlotId val;
57908 if (ai[0] == 0f)
57909 {
57910 knockBackResist = num;
57911 float num20 = num2;
57912 Vector2 center = base.Center;
57913 Vector2 vector = targetData.Center - center;
57914 Vector2 vector2 = vector - Vector2.UnitY * num3;
57915 float num21 = vector.Length();
57918 bool flag6 = Collision.CanHit(base.Center, 1, 1, targetData.Center, 1, 1);
57919 if (ai[3] >= (float)num15)
57920 {
57921 flag6 = true;
57922 }
57923 float num22 = 8f;
57924 flag6 = flag6 && vector.ToRotation() > (float)Math.PI / num22 && vector.ToRotation() < (float)Math.PI - (float)Math.PI / num22;
57925 if (num21 > num4 || !flag6)
57926 {
57927 velocity.X = (velocity.X * (num5 - 1f) + vector2.X) / num5;
57928 velocity.Y = (velocity.Y * (num5 - 1f) + vector2.Y) / num5;
57929 if (targetData.Center.Y < base.Center.Y)
57930 {
57931 velocity.Y -= 0.2f;
57932 if (velocity.Y < -10f)
57933 {
57934 velocity.Y = -10f;
57935 }
57936 }
57937 if (!flag6)
57938 {
57939 ai[3] += 1f;
57940 if (ai[3] == (float)num15)
57941 {
57942 netUpdate = true;
57943 }
57944 }
57945 else
57946 {
57947 ai[3] = 0f;
57948 }
57949 }
57950 else
57951 {
57952 ai[0] = 1f;
57953 ai[2] = vector.X;
57954 ai[3] = vector.Y;
57955 netUpdate = true;
57956 }
57957 }
57958 else if (ai[0] == 1f)
57959 {
57960 knockBackResist = 0f;
57961 velocity *= num7;
57962 velocity.Y += num17;
57963 ai[1] += 1f;
57964 if (ai[1] == num6)
57965 {
57966 if (type == 558 || type == 559 || type == 560)
57967 {
57968 float[] array = localAI;
57970 array[1] = ((SlotId)(ref val)).ToFloat();
57971 if (Main.rand.Next(5) == 0)
57972 {
57973 float[] array2 = localAI;
57975 array2[2] = ((SlotId)(ref val)).ToFloat();
57976 }
57977 }
57978 else if (type == 574 || type == 575)
57979 {
57980 float[] array3 = localAI;
57982 array3[1] = ((SlotId)(ref val)).ToFloat();
57984 }
57985 }
57986 if (ai[1] >= num6)
57987 {
57988 ai[0] = 2f;
57989 ai[1] = 0f;
57990 netUpdate = true;
57991 Vector2 vector3 = new Vector2(ai[2], ai[3]) + new Vector2(Main.rand.Next(-num8, num8 + 1), Main.rand.Next(-num8, num8 + 1)) * 0.04f;
57992 vector3.Normalize();
57993 vector3 *= num9;
57994 velocity = vector3;
57995 }
57996 }
57997 else if (ai[0] == 2f)
57998 {
57999 if (ai[1] >= 20f && (type == 574 || type == 575))
58000 {
58002 if (activeSound == null)
58003 {
58004 float[] array4 = localAI;
58006 array4[2] = ((SlotId)(ref val)).ToFloat();
58007 }
58008 else
58009 {
58010 activeSound.Position = base.Center;
58011 }
58012 }
58013 knockBackResist = 0f;
58014 float num23 = num10;
58015 ai[1] += 1f;
58016 bool flag7 = Vector2.Distance(base.Center, targetData.Center) > num11 && base.Center.Y > targetData.Center.Y;
58017 if (flag3)
58018 {
58019 flag7 = false;
58020 }
58021 if ((ai[1] >= num23 && flag7) || velocity.Length() < num14)
58022 {
58023 ai[0] = 0f;
58024 ai[1] = 0f;
58025 ai[2] = 0f;
58026 ai[3] = 0f;
58027 velocity /= 2f;
58028 netUpdate = true;
58029 if (flag)
58030 {
58031 ai[1] = 45f;
58032 ai[0] = 4f;
58033 }
58034 }
58035 else
58036 {
58037 Vector2 center2 = base.Center;
58038 Vector2 vector4 = targetData.Center - center2;
58039 vector4.Normalize();
58040 if (vector4.HasNaNs())
58041 {
58042 vector4 = new Vector2(direction, 0f);
58043 }
58044 velocity = (velocity * (num12 - 1f) + vector4 * (velocity.Length() + num13)) / num12;
58045 }
58047 {
58048 ai[0] = 3f;
58049 ai[1] = 0f;
58050 ai[2] = 0f;
58051 ai[3] = 0f;
58052 netUpdate = true;
58053 }
58054 }
58055 else if (ai[0] == 4f)
58056 {
58057 ai[1] -= 3f;
58058 if (ai[1] <= 0f)
58059 {
58060 ai[0] = 0f;
58061 ai[1] = 0f;
58062 netUpdate = true;
58063 }
58064 velocity *= 0.95f;
58065 }
58067 if (activeSound2 != null)
58068 {
58069 activeSound2.Position = base.Center;
58070 }
58071 else
58072 {
58073 float[] array5 = localAI;
58074 val = SlotId.Invalid;
58075 array5[1] = ((SlotId)(ref val)).ToFloat();
58076 }
58077 if (type == 558 || type == 559 || type == 560)
58078 {
58080 if (activeSound2 != null)
58081 {
58082 activeSound2.Position = base.Center;
58083 }
58084 else
58085 {
58086 float[] array6 = localAI;
58087 val = SlotId.Invalid;
58088 array6[2] = ((SlotId)(ref val)).ToFloat();
58089 }
58090 }
58091 if (flag2 && ai[0] != 3f && Vector2.Distance(base.Center, targetData.Center) < 64f)
58092 {
58093 ai[0] = 3f;
58094 ai[1] = 0f;
58095 ai[2] = 0f;
58096 ai[3] = 0f;
58097 netUpdate = true;
58098 }
58099 if (ai[0] != 3f)
58100 {
58101 return;
58102 }
58103 position = base.Center;
58104 width = (height = 192);
58105 position.X -= width / 2;
58106 position.Y -= height / 2;
58109 alpha = 255;
58110 if (ai[1] == 0f && (type == 574 || type == 575))
58111 {
58112 for (int k = 0; k < 4; k++)
58113 {
58114 int num24 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
58115 Main.dust[num24].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
58116 }
58117 for (int l = 0; l < 20; l++)
58118 {
58119 int num25 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
58120 Main.dust[num25].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
58121 Main.dust[num25].noGravity = true;
58122 Main.dust[num25].velocity *= 3f;
58123 num25 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
58124 Main.dust[num25].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 4f;
58125 Main.dust[num25].velocity *= 2f;
58126 Main.dust[num25].noGravity = true;
58127 Main.dust[num25].fadeIn = 2.5f;
58128 }
58129 for (int m = 0; m < 6; m++)
58130 {
58131 int num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
58132 Main.dust[num26].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
58133 Main.dust[num26].noGravity = true;
58134 Main.dust[num26].velocity *= 3f;
58135 }
58136 for (int n = 0; n < 12; n++)
58137 {
58138 int num27 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
58139 Main.dust[num27].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
58140 Main.dust[num27].noGravity = true;
58141 Main.dust[num27].velocity *= 3f;
58142 }
58143 for (int num28 = 0; num28 < 5; num28++)
58144 {
58145 int num29 = Gore.NewGore(position + new Vector2((float)(width * Main.rand.Next(100)) / 100f, (float)(height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64));
58146 Main.gore[num29].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
58147 Main.gore[num29].velocity *= 0.3f;
58148 Main.gore[num29].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
58149 Main.gore[num29].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
58150 }
58151 }
58152 ai[1] += 1f;
58153 if (ai[1] >= 3f)
58154 {
58156 life = 0;
58157 HitEffect();
58158 active = false;
58159 }
58160 }
58161
58162 private void AI_109_DarkMage()
58163 {
58164 //IL_01c8: Unknown result type (might be due to invalid IL or missing references)
58165 //IL_0661: Unknown result type (might be due to invalid IL or missing references)
58166 //IL_034a: Unknown result type (might be due to invalid IL or missing references)
58167 bool flag = false;
58168 bool flag2 = false;
58169 bool flag3 = true;
58170 bool flag4 = false;
58171 int num = 4;
58172 int num2 = 3;
58173 int num3 = 0;
58174 float num4 = 0.2f;
58175 float num5 = 2f;
58176 float num6 = -0.2f;
58177 float num7 = -4f;
58178 bool flag5 = true;
58179 float num8 = 2f;
58180 float num9 = 0.1f;
58181 float num10 = 1f;
58182 float num11 = 0.04f;
58183 bool flag6 = false;
58184 float num12 = 0.96f;
58185 bool flag7 = true;
58187 if (type == 564 || type == 565)
58188 {
58189 flag5 = false;
58190 rotation = velocity.X * 0.04f;
58191 spriteDirection = ((direction > 0) ? 1 : (-1));
58192 num3 = 2;
58193 num6 = -0.05f;
58194 num7 = -0.4f;
58195 num4 = 0.05f;
58196 num5 = 0.2f;
58197 num10 = 0.5f;
58198 num11 = 0.02f;
58199 num8 = 0.5f;
58200 num9 = 0.1f;
58201 localAI[2] = 0f;
58202 DelegateMethods.v3_1 = new Vector3(0.3f, 0.05f, 0.45f) * 1.5f;
58204 if (ai[0] < 0f)
58205 {
58206 ai[0] = MathHelper.Min(ai[0] + 1f, 0f);
58207 }
58208 if (ai[0] > 0f)
58209 {
58210 flag7 = false;
58211 flag6 = true;
58212 num12 = 0.9f;
58213 ai[0] -= 1f;
58214 if (ai[0] == 80f && ai[1] == 2f)
58215 {
58217 }
58218 if (ai[1] == 2f && ai[0] == 64f && Main.netMode != 1)
58219 {
58221 DD2Event.RaiseGoblins(this, base.Center);
58222 }
58223 if (ai[1] == 0f && ai[0] == 32f)
58224 {
58225 Vector2 vector = (targetData.Center - (base.Center + new Vector2(direction * 10, -16f))).SafeNormalize(Vector2.UnitY) * 14f;
58226 direction = ((vector.X > 0f) ? 1 : (-1));
58227 if (Main.netMode != 1)
58228 {
58229 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center + new Vector2(direction * 10, -16f), vector, 675, 40, 0f, Main.myPlayer);
58230 }
58231 }
58232 if (ai[0] == 126f && ai[1] == 1f)
58233 {
58235 }
58236 if (ai[1] == 1f && Main.netMode != 1 && (ai[0] == 40f || ai[0] == 48f || ai[0] == 56f) && WorldUtils.Find(new Vector2(base.Center.X + (float)(direction * 240), base.Center.Y).ToTileCoordinates(), Searches.Chain(new Searches.Down(50), new Terraria.WorldBuilding.Conditions.IsSolid()), out var result))
58237 {
58238 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), result.ToWorldCoordinates(8f, 0f), Vector2.Zero, 674, 0, 0f, Main.myPlayer);
58239 }
58240 if (ai[0] <= 0f)
58241 {
58242 float num13 = ai[1];
58243 ai[1] += 1f;
58244 if (ai[1] >= 3f)
58245 {
58246 ai[1] = 0f;
58247 }
58248 ai[0] = -120f;
58249 if (num13 == 0f)
58250 {
58251 ai[0] = -20f;
58252 }
58253 netUpdate = true;
58254 }
58255 }
58256 if (ai[0] == 0f && localAI[3] >= 60f)
58257 {
58258 bool flag8 = false;
58259 Vector2 minimum = base.Center + new Vector2(-600f, -200f);
58260 Vector2 maximum = base.Center + new Vector2(600f, 200f);
58261 int num14 = 0;
58262 for (int i = 0; i < 200; i++)
58263 {
58264 NPC nPC = Main.npc[i];
58265 if (nPC.active && nPC.lifeMax != nPC.life && nPC.Center.Between(minimum, maximum) && ++num14 >= 2)
58266 {
58267 flag8 = true;
58268 break;
58269 }
58270 }
58271 if (!flag8)
58272 {
58273 ai[1] = 2f;
58274 }
58275 if (ai[1] == 2f && !DD2Event.CanRaiseGoblinsHere(base.Center))
58276 {
58277 ai[1] = 0f;
58278 }
58279 bool flag9 = true;
58280 if (ai[1] == 0f && (Distance(targetData.Center) >= 1000f || !Collision.CanHitLine(base.Center, 0, 0, targetData.Center, 0, 0)))
58281 {
58282 flag9 = false;
58283 }
58284 if (flag9)
58285 {
58286 switch ((int)ai[1])
58287 {
58288 case 0:
58289 ai[0] = 97f;
58290 break;
58291 case 1:
58292 ai[0] = 127f;
58293 break;
58294 case 2:
58295 ai[0] = 183f;
58296 break;
58297 }
58298 netUpdate = true;
58299 flag6 = true;
58300 }
58301 }
58302 if (localAI[3] == 0f)
58303 {
58304 alpha = 255;
58305 }
58306 if (localAI[3] == 30f)
58307 {
58309 }
58310 if (localAI[3] < 60f)
58311 {
58312 localAI[3] += 1f;
58313 alpha -= 5;
58314 if (alpha < 0)
58315 {
58316 alpha = 0;
58317 }
58318 int num15 = (int)localAI[3] / 10;
58319 float num16 = base.Size.Length() / 2f;
58320 num16 /= 20f;
58321 int maxValue = 5;
58322 if (type == 576 || type == 577)
58323 {
58324 maxValue = 1;
58325 }
58326 for (int j = 0; j < num15; j++)
58327 {
58328 if (Main.rand.Next(maxValue) == 0)
58329 {
58330 Dust dust = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
58331 dust.scale = 0.55f;
58332 dust.fadeIn = 0.7f;
58333 dust.velocity *= 0.1f * num16;
58334 dust.velocity += velocity;
58335 }
58336 }
58337 }
58338 }
58339 if (justHit)
58340 {
58341 localAI[2] = 0f;
58342 }
58343 if (!flag2)
58344 {
58345 if (localAI[2] >= 0f)
58346 {
58347 float num17 = 16f;
58348 bool flag10 = false;
58349 bool flag11 = false;
58350 if (position.X > localAI[0] - num17 && position.X < localAI[0] + num17)
58351 {
58352 flag10 = true;
58353 }
58354 else if ((velocity.X < 0f && direction > 0) || (velocity.X > 0f && direction < 0))
58355 {
58356 flag10 = true;
58357 num17 += 24f;
58358 }
58359 if (position.Y > localAI[1] - num17 && position.Y < localAI[1] + num17)
58360 {
58361 flag11 = true;
58362 }
58363 if (flag10 && flag11)
58364 {
58365 localAI[2] += 1f;
58366 if (localAI[2] >= 30f && num17 == 16f)
58367 {
58368 flag = true;
58369 }
58370 if (localAI[2] >= 60f)
58371 {
58372 localAI[2] = -180f;
58373 direction *= -1;
58374 velocity.X *= -1f;
58375 collideX = false;
58376 }
58377 }
58378 else
58379 {
58380 localAI[0] = position.X;
58381 localAI[1] = position.Y;
58382 localAI[2] = 0f;
58383 }
58384 if (flag7)
58385 {
58387 }
58388 }
58389 else
58390 {
58391 localAI[2] += 1f;
58392 direction = ((targetData.Center.X > base.Center.X) ? 1 : (-1));
58393 }
58394 }
58395 int num18 = (int)((position.X + (float)(width / 2)) / 16f) + direction * 2;
58396 int num19 = (int)((position.Y + (float)height) / 16f);
58397 int num20 = (int)base.Bottom.Y / 16;
58398 int num21 = (int)base.Bottom.X / 16;
58399 if (flag6)
58400 {
58401 velocity *= num12;
58402 return;
58403 }
58404 for (int k = num19; k < num19 + num; k++)
58405 {
58406 if (Main.tile[num18, k] == null)
58407 {
58408 Main.tile[num18, k] = new Tile();
58409 }
58410 if ((Main.tile[num18, k].nactive() && Main.tileSolid[Main.tile[num18, k].type]) || Main.tile[num18, k].liquid > 0)
58411 {
58412 if (k <= num19 + 1)
58413 {
58414 flag4 = true;
58415 }
58416 flag3 = false;
58417 break;
58418 }
58419 }
58420 for (int l = num20; l < num20 + num3; l++)
58421 {
58422 if (Main.tile[num21, l] == null)
58423 {
58424 Main.tile[num21, l] = new Tile();
58425 }
58426 if ((Main.tile[num21, l].nactive() && Main.tileSolid[Main.tile[num21, l].type]) || Main.tile[num21, l].liquid > 0)
58427 {
58428 flag4 = true;
58429 flag3 = false;
58430 break;
58431 }
58432 }
58433 if (flag5)
58434 {
58435 for (int m = num19 - num2; m < num19; m++)
58436 {
58437 if (Main.tile[num18, m] == null)
58438 {
58439 Main.tile[num18, m] = new Tile();
58440 }
58441 if ((Main.tile[num18, m].nactive() && Main.tileSolid[Main.tile[num18, m].type]) || Main.tile[num18, m].liquid > 0)
58442 {
58443 flag4 = false;
58444 flag = true;
58445 break;
58446 }
58447 }
58448 }
58449 if (flag)
58450 {
58451 flag4 = false;
58452 flag3 = true;
58453 }
58454 if (flag3)
58455 {
58456 velocity.Y += num4;
58457 if (velocity.Y > num5)
58458 {
58459 velocity.Y = num5;
58460 }
58461 }
58462 else
58463 {
58465 {
58466 velocity.Y += num6;
58467 }
58468 if (velocity.Y < num7)
58469 {
58470 velocity.Y = num7;
58471 }
58472 }
58473 if (collideX)
58474 {
58475 velocity.X = oldVelocity.X * -0.4f;
58476 if (direction == -1 && velocity.X > 0f && velocity.X < 1f)
58477 {
58478 velocity.X = 1f;
58479 }
58480 if (direction == 1 && velocity.X < 0f && velocity.X > -1f)
58481 {
58482 velocity.X = -1f;
58483 }
58484 }
58485 if (collideY)
58486 {
58487 velocity.Y = oldVelocity.Y * -0.25f;
58488 if (velocity.Y > 0f && velocity.Y < 1f)
58489 {
58490 velocity.Y = 1f;
58491 }
58492 if (velocity.Y < 0f && velocity.Y > -1f)
58493 {
58494 velocity.Y = -1f;
58495 }
58496 }
58497 if (direction == -1 && velocity.X > 0f - num8)
58498 {
58499 velocity.X -= num9;
58500 if (velocity.X > num8)
58501 {
58502 velocity.X -= num9;
58503 }
58504 else if (velocity.X > 0f)
58505 {
58506 velocity.X += num9 / 2f;
58507 }
58508 if (velocity.X < 0f - num8)
58509 {
58510 velocity.X = 0f - num8;
58511 }
58512 }
58513 else if (direction == 1 && velocity.X < num8)
58514 {
58515 velocity.X += num9;
58516 if (velocity.X < 0f - num8)
58517 {
58518 velocity.X += num9;
58519 }
58520 else if (velocity.X < 0f)
58521 {
58522 velocity.X -= num9 / 2f;
58523 }
58524 if (velocity.X > num8)
58525 {
58526 velocity.X = num8;
58527 }
58528 }
58529 if (directionY == -1 && velocity.Y > 0f - num10)
58530 {
58531 velocity.Y -= num11;
58532 if (velocity.Y > num10)
58533 {
58534 velocity.Y -= num11 * 1.25f;
58535 }
58536 else if (velocity.Y > 0f)
58537 {
58538 velocity.Y += num11 * 0.75f;
58539 }
58540 if (velocity.Y < 0f - num10)
58541 {
58542 velocity.Y = 0f - num8;
58543 }
58544 }
58545 else if (directionY == 1 && velocity.Y < num10)
58546 {
58547 velocity.Y += num11;
58548 if (velocity.Y < 0f - num10)
58549 {
58550 velocity.Y += num11 * 1.25f;
58551 }
58552 else if (velocity.Y < 0f)
58553 {
58554 velocity.Y -= num11 * 0.75f;
58555 }
58556 if (velocity.Y > num10)
58557 {
58558 velocity.Y = num10;
58559 }
58560 }
58561 }
58562
58564 {
58565 //IL_02f6: Unknown result type (might be due to invalid IL or missing references)
58566 bool flag = true;
58567 float num = 7f;
58568 float num2 = 60f;
58569 float num3 = 60f;
58570 float num4 = 1f;
58571 float num5 = 0.96f;
58572 int num6 = 30;
58573 int num7 = 20;
58574 float num8 = 200f;
58575 int num9 = 40;
58576 int num10 = 438;
58577 float num11 = 10f;
58578 float num12 = 100f;
58579 bool flag2 = false;
58580 float num13 = 0.05f;
58581 Vector2 center = base.Center;
58584 bool flag3 = false;
58585 int num14 = type;
58586 if (num14 == 578)
58587 {
58588 num = 4f;
58589 num2 = 20f;
58590 num3 = 20f;
58591 flag3 = true;
58592 flag2 = true;
58593 num13 = 0.1f;
58594 num10 = 682;
58595 num9 = 50;
58596 num11 = 10f;
58597 num12 = 50f;
58598 num6 = 5;
58599 num7 = 30;
58600 center += new Vector2(-spriteDirection * 20, 10f);
58602 if (Main.rand.Next(15) == 0)
58603 {
58605 if (direction == -1)
58606 {
58607 vector.X += width / 2;
58608 }
58609 Dust dust = Dust.NewDustDirect(vector, width / 2, height, 272);
58610 dust.scale = 0.65f;
58611 dust.velocity.Y -= 0.8f;
58612 if (dust.velocity.X * (float)direction > 0f)
58613 {
58614 dust.velocity.X *= -1f;
58615 }
58616 if (dust.velocity.Y > 0f)
58617 {
58618 dust.velocity *= -0.5f;
58619 }
58620 }
58621 if (Main.rand.Next(80) == 0)
58622 {
58623 Vector2 vector2 = (Main.rand.NextFloat() * ((float)Math.PI * 2f)).ToRotationVector2();
58624 Dust dust2 = Dust.NewDustPerfect(base.Center, 272, vector2);
58625 dust2.velocity *= 1.1f;
58626 dust2.noGravity = true;
58627 dust2.customData = this;
58628 Dust dust3 = Dust.NewDustPerfect(base.Center, 272, vector2);
58629 dust3.velocity *= 1.5f;
58630 dust3.noGravity = true;
58631 dust3.customData = this;
58632 }
58634 }
58635 if (flag3)
58636 {
58637 if (localAI[1] == 0f)
58638 {
58639 alpha = 255;
58640 }
58641 if (localAI[1] == 30f)
58642 {
58644 }
58645 if (localAI[1] < 60f)
58646 {
58647 localAI[1] += 1f;
58648 alpha -= 5;
58649 if (alpha < 0)
58650 {
58651 alpha = 0;
58652 }
58653 int num15 = (int)localAI[1] / 10;
58654 float num16 = base.Size.Length() / 2f;
58655 num16 /= 20f;
58656 int maxValue = 5;
58657 if (type == 576 || type == 577)
58658 {
58659 maxValue = 1;
58660 }
58661 for (int i = 0; i < num15; i++)
58662 {
58663 if (Main.rand.Next(maxValue) == 0)
58664 {
58665 Dust dust4 = Dust.NewDustDirect(position, width, height, 27, velocity.X * 1f, 0f, 100);
58666 dust4.scale = 0.55f;
58667 dust4.fadeIn = 0.7f;
58668 dust4.velocity *= 0.1f * num16;
58669 dust4.velocity += velocity;
58670 }
58671 }
58672 }
58673 }
58674 if (flag2)
58675 {
58676 for (int j = 0; j < 200; j++)
58677 {
58678 if (j != whoAmI && Main.npc[j].active && Main.npc[j].type == type && Math.Abs(position.X - Main.npc[j].position.X) + Math.Abs(position.Y - Main.npc[j].position.Y) < (float)width)
58679 {
58680 if (position.X < Main.npc[j].position.X)
58681 {
58682 velocity.X -= num13;
58683 }
58684 else
58685 {
58686 velocity.X += num13;
58687 }
58688 if (position.Y < Main.npc[j].position.Y)
58689 {
58690 velocity.Y -= num13;
58691 }
58692 else
58693 {
58694 velocity.Y += num13;
58695 }
58696 }
58697 }
58698 }
58699 rotation = Math.Abs(velocity.X) * (float)direction * 0.1f;
58702 Vector2 vector4 = targetData.Center - vector3;
58703 Vector2 vector5 = vector4.SafeNormalize(Vector2.UnitY) * num;
58704 bool flag4 = Collision.CanHit(base.Center, 1, 1, targetData.Center, 1, 1);
58705 if (localAI[0] < 0f)
58706 {
58707 localAI[0] += 1f;
58708 }
58709 if (!flag)
58710 {
58711 velocity = (velocity * (num2 - 1f) + vector5) / num2;
58712 EncourageDespawn(10);
58713 }
58714 else if (vector4.Length() > num8 || !flag4)
58715 {
58716 velocity = (velocity * (num3 - 1f) + vector5) / num3;
58717 }
58718 else if (vector4.Y < num12)
58719 {
58720 velocity.Y -= 0.03f;
58721 }
58722 else if (localAI[0] >= 0f)
58723 {
58724 velocity *= num5;
58725 if (velocity.Length() < num4 && Main.netMode != 1)
58726 {
58727 localAI[0] += 1f;
58728 if (localAI[0] >= (float)num6)
58729 {
58730 localAI[0] = -num7;
58731 direction = (spriteDirection = ((vector5.X > 0f) ? 1 : (-1)));
58732 vector5 = vector4 + Utils.RandomVector2(Main.rand, -25f, 25f);
58733 vector5.X *= 1f + (float)Main.rand.Next(-20, 21) * 0.005f;
58734 vector5.Y *= 1f + (float)Main.rand.Next(-20, 21) * 0.005f;
58735 vector5 = vector5.SafeNormalize(Vector2.UnitY) * num11;
58736 vector5.X *= 1f + (float)Main.rand.Next(-20, 21) * (1f / 160f);
58737 vector5.Y *= 1f + (float)Main.rand.Next(-20, 21) * (1f / 160f);
58739 }
58740 }
58741 }
58742 if (!flag)
58743 {
58744 return;
58745 }
58746 bool flag5 = false;
58747 if (targetData.Center.Y < base.Center.Y)
58748 {
58749 flag5 = true;
58750 }
58751 if (!flag5)
58752 {
58753 Point point = base.Center.ToTileCoordinates();
58754 if (WorldGen.InWorld(point.X, point.Y, 2))
58755 {
58756 Tile tile = Main.tile[point.X, point.Y];
58757 if (tile != null && tile.active() && WorldGen.SolidTile(tile))
58758 {
58759 flag5 = true;
58760 }
58761 }
58762 }
58763 if (flag5)
58764 {
58765 velocity.Y -= 0.2f;
58766 if (velocity.Y < -10f)
58767 {
58768 velocity.Y = -10f;
58769 }
58770 }
58771 }
58772
58774 {
58775 for (int i = 0; i < 1000; i++)
58776 {
58777 if (Main.projectile[i].active && Main.projectile[i].CanBeReflected() && CanReflectProjectile(Main.projectile[i]))
58778 {
58780 }
58781 }
58782 }
58783
58785 {
58786 bool result = proj.Hitbox.Intersects(base.Hitbox);
58787 int num = type;
58788 if (num == 618)
58789 {
58791 }
58792 return result;
58793 }
58794
58796 {
58797 float num = rotation + 0.47123894f * (float)spriteDirection;
58798 if (spriteDirection == -1)
58799 {
58800 num += (float)Math.PI;
58801 }
58802 mouthDirection = num.ToRotationVector2();
58803 mouthPosition = base.Center + mouthDirection * 50f;
58804 }
58805
58807 {
58809 for (int i = 0; i < 3; i++)
58810 {
58811 int num = Dust.NewDust(proj.position, proj.width, proj.height, 31);
58812 Main.dust[num].velocity *= 0.3f;
58813 }
58814 proj.reflected = true;
58815 proj.hostile = true;
58816 proj.friendly = false;
58817 Vector2 vector = Main.player[proj.owner].Center - proj.Center;
58818 vector.Normalize();
58819 vector *= proj.oldVelocity.Length();
58820 proj.velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
58821 proj.velocity.Normalize();
58822 proj.velocity *= vector.Length();
58823 proj.velocity += vector * 20f;
58824 proj.velocity.Normalize();
58825 proj.velocity *= vector.Length();
58826 proj.damage /= 2;
58827 proj.damage /= 2;
58828 proj.penetrate = 1;
58829 }
58830
58831 public int GetShootingFrame(float circleY)
58832 {
58833 int num = -4;
58834 if (circleY < -0.3f)
58835 {
58836 num = 1;
58837 }
58838 if (circleY < -0.1f)
58839 {
58840 num = 0;
58841 }
58842 if (circleY > 0.1f)
58843 {
58844 num = 2;
58845 }
58846 if (circleY > 0.3f)
58847 {
58848 num = 3;
58849 }
58850 if (type == 228 || type == 229 || type == 209 || type == 22 || type == 368)
58851 {
58852 if (num == -4)
58853 {
58854 num = 1;
58855 }
58856 if (circleY >= -0.1f)
58857 {
58858 num++;
58859 }
58860 }
58861 return num;
58862 }
58863
58864 public Tuple<Vector2, float> GetSwingStats(int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight)
58865 {
58867 if ((double)swingCurrent < (double)swingMax * 0.333)
58868 {
58869 float num = 10f;
58870 if (itemWidth > 32)
58871 {
58872 num = 14f;
58873 }
58874 if (itemWidth >= 52)
58875 {
58876 num = 24f;
58877 }
58878 if (itemWidth >= 64)
58879 {
58880 num = 28f;
58881 }
58882 if (itemWidth >= 92)
58883 {
58884 num = 38f;
58885 }
58886 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num) * (float)aimDir;
58887 zero.Y = position.Y + 24f;
58888 }
58889 else if ((double)swingCurrent < (double)swingMax * 0.666)
58890 {
58891 float num2 = 10f;
58892 if (itemWidth > 32)
58893 {
58894 num2 = 18f;
58895 }
58896 if (itemWidth >= 52)
58897 {
58898 num2 = 24f;
58899 }
58900 if (itemWidth >= 64)
58901 {
58902 num2 = 28f;
58903 }
58904 if (itemWidth >= 92)
58905 {
58906 num2 = 38f;
58907 }
58908 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num2) * (float)aimDir;
58909 num2 = 10f;
58910 if (itemHeight > 32)
58911 {
58912 num2 = 8f;
58913 }
58914 if (itemHeight > 52)
58915 {
58916 num2 = 12f;
58917 }
58918 if (itemHeight > 64)
58919 {
58920 num2 = 14f;
58921 }
58922 zero.Y = position.Y + num2;
58923 }
58924 else
58925 {
58926 float num3 = 6f;
58927 if (itemWidth > 32)
58928 {
58929 num3 = 14f;
58930 }
58931 if (itemWidth >= 48)
58932 {
58933 num3 = 18f;
58934 }
58935 if (itemWidth >= 52)
58936 {
58937 num3 = 24f;
58938 }
58939 if (itemWidth >= 64)
58940 {
58941 num3 = 28f;
58942 }
58943 if (itemWidth >= 92)
58944 {
58945 num3 = 38f;
58946 }
58947 zero.X = base.Center.X - ((float)itemWidth * 0.5f - num3) * (float)aimDir;
58948 num3 = 10f;
58949 if (itemHeight > 32)
58950 {
58951 num3 = 10f;
58952 }
58953 if (itemHeight > 52)
58954 {
58955 num3 = 12f;
58956 }
58957 if (itemHeight > 64)
58958 {
58959 num3 = 14f;
58960 }
58961 zero.Y = position.Y + num3;
58962 }
58963 float item = ((float)swingCurrent / (float)swingMax - 0.5f) * (float)(-aimDir) * 3.5f - (float)aimDir * 0.3f;
58964 return Tuple.Create(zero, item);
58965 }
58966
58968 {
58969 if ((double)swingCurrent < (double)swingMax * 0.333)
58970 {
58971 if (aimDir == -1)
58972 {
58973 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.4 - (double)itemRectangle.Width);
58974 }
58975 itemRectangle.Width = (int)((double)itemRectangle.Width * 1.4);
58976 itemRectangle.Y += (int)((double)itemRectangle.Height * 0.5);
58977 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.1);
58978 }
58979 else if (!((double)swingCurrent < (double)swingMax * 0.666))
58980 {
58981 if (aimDir == 1)
58982 {
58983 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.2);
58984 }
58985 itemRectangle.Width *= 2;
58986 itemRectangle.Y -= (int)((double)itemRectangle.Height * 1.4 - (double)itemRectangle.Height);
58987 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.4);
58988 }
58989 }
58990
58991 public bool UsesPartyHat()
58992 {
58993 if (type == 441 || type == 37 || type == 633)
58994 {
58995 return false;
58996 }
58997 if (type == 20 && townNpcVariationIndex == 1)
58998 {
58999 return false;
59000 }
59001 if (ForcePartyHatOn)
59002 {
59003 return true;
59004 }
59006 {
59007 return false;
59008 }
59009 if (frame.Height > 0 && townNPC)
59010 {
59011 return BirthdayParty.PartyIsUp;
59012 }
59013 return false;
59014 }
59015
59017 {
59018 if (!UsesPartyHat() || string.IsNullOrEmpty(GivenOrTypeName))
59019 {
59020 return PartyHatColor.None;
59021 }
59022 int num = GivenOrTypeName.Length + GivenOrTypeName[0];
59023 int num2 = Main.moonPhase;
59024 if (Main.dayTime)
59025 {
59026 num2--;
59027 }
59028 num += whoAmI;
59029 num += num2 * (whoAmI % 2 == 0).ToDirectionInt();
59030 if (num < 0)
59031 {
59032 num += 5;
59033 }
59034 num %= 5;
59035 if (num == 0)
59036 {
59037 num++;
59038 }
59039 return (PartyHatColor)num;
59040 }
59041
59042 public void SetFrameSize()
59043 {
59044 Main.instance.LoadNPC(type);
59045 if (setFrameSize)
59046 {
59047 frame = new Rectangle(0, 0, TextureAssets.Npc[type].Width(), TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]);
59048 setFrameSize = false;
59049 }
59050 }
59051
59052 public void FindFrame()
59053 {
59055 int num = 1;
59056 if (!Main.dedServ)
59057 {
59058 if (!TextureAssets.Npc[type].IsLoaded)
59059 {
59060 return;
59061 }
59062 num = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type];
59063 }
59064 int num2 = 0;
59065 if (aiAction == 0)
59066 {
59067 num2 = ((velocity.Y < 0f) ? 2 : ((velocity.Y > 0f) ? 3 : ((velocity.X != 0f) ? 1 : 0)));
59068 }
59069 else if (aiAction == 1)
59070 {
59071 num2 = 4;
59072 }
59073 switch (type)
59074 {
59075 case 668:
59076 {
59077 int y2 = frame.Y;
59078 int num144 = y2;
59079 frame.Width = 180;
59080 if (ai[0] == 1f)
59081 {
59083 int num145 = 12;
59084 int num146 = 17;
59086 {
59087 y2 = num145;
59088 frameCounter = 0.0;
59089 if (!IsABestiaryIconDummy && y2 != num144)
59090 {
59092 }
59093 }
59094 frameCounter += 1.0;
59095 int sequenceFrame = (int)frameCounter / 4;
59097 }
59098 else if (ai[0] == 2f)
59099 {
59101 int num147 = 12;
59102 int num148 = 18;
59104 {
59105 y2 = num147;
59106 frameCounter = 0.0;
59107 if (!IsABestiaryIconDummy && y2 != num144)
59108 {
59110 }
59111 }
59112 frameCounter += 1.0;
59113 int sequenceFrame2 = (int)frameCounter / 4;
59116 }
59117 else if (ai[0] == 3f || ai[0] == 5f || ai[0] == 7f || ai[0] == 8f)
59118 {
59120 int num149 = 19;
59121 int num150 = 24;
59123 {
59124 y2 = num149;
59125 frameCounter = 0.0;
59126 }
59127 frameCounter += 1.0;
59128 int sequenceFrame3 = (int)frameCounter / 4;
59130 if (y2 == 21)
59131 {
59133 }
59134 }
59135 else if (ai[0] == 4f)
59136 {
59138 int num151 = 12;
59139 int num152 = 17;
59141 {
59142 y2 = num151;
59143 frameCounter = 0.0;
59144 if (!IsABestiaryIconDummy && y2 != num144)
59145 {
59147 }
59148 }
59149 frameCounter += 1.0;
59150 int sequenceFrame4 = (int)frameCounter / 4;
59152 }
59153 else
59154 {
59155 if (velocity.Y == 0f)
59156 {
59158 }
59159 if (velocity.Y > 0f || localAI[0] == 1f)
59160 {
59161 frameCounter = 0.0;
59162 y2 = 1;
59163 }
59164 else if (velocity.X == 0f)
59165 {
59166 frameCounter = 0.0;
59167 y2 = 0;
59168 }
59169 else
59170 {
59172 int num153 = 10;
59173 int num154 = 15;
59174 if (frameCounter >= (double)(num153 * num154) || frameCounter < 0.0)
59175 {
59176 frameCounter = 0.0;
59177 }
59178 y2 = 2 + (int)(frameCounter / (double)num154);
59179 if (num144 != y2 && !IsABestiaryIconDummy && (y2 == 4 || y2 == 9))
59180 {
59182 }
59183 }
59184 }
59185 frame.Y = y2;
59186 break;
59187 }
59188 case 657:
59189 {
59190 bool flag = life <= lifeMax / 2;
59191 frame.Width = 180;
59192 int num9 = frame.Y / num;
59193 if ((flag && noGravity) || velocity.Y < 0f)
59194 {
59195 if (num9 < 20 || num9 > 23)
59196 {
59197 if (num9 < 4 || num9 > 7)
59198 {
59199 num9 = 4;
59200 frameCounter = -1.0;
59201 }
59202 if ((frameCounter += 1.0) >= 4.0)
59203 {
59204 frameCounter = 0.0;
59205 num9++;
59206 if (num9 >= 7)
59207 {
59208 num9 = ((!flag) ? 7 : 22);
59209 }
59210 }
59211 }
59212 else if ((frameCounter += 1.0) >= 5.0)
59213 {
59214 frameCounter = 0.0;
59215 num9++;
59216 if (num9 >= 24)
59217 {
59218 num9 = 20;
59219 }
59220 }
59221 frame.Y = num9 * num;
59222 }
59223 else if (velocity.Y > 0f)
59224 {
59225 if (num9 < 8 || num9 > 10)
59226 {
59227 num9 = 8;
59228 frameCounter = -1.0;
59229 }
59230 if ((frameCounter += 1.0) >= 8.0)
59231 {
59232 frameCounter = 0.0;
59233 num9++;
59234 if (num9 >= 10)
59235 {
59236 num9 = 10;
59237 }
59238 }
59239 frame.Y = num9 * num;
59240 }
59241 else
59242 {
59243 if (velocity.Y != 0f)
59244 {
59245 break;
59246 }
59247 if (ai[0] == 5f)
59248 {
59249 frameCounter = 0.0;
59250 num9 = ((int)ai[1] / 3 % 3) switch
59251 {
59252 1 => 14,
59253 2 => 15,
59254 _ => 13,
59255 };
59256 }
59257 else if (ai[0] == 4f)
59258 {
59259 frameCounter = 0.0;
59260 switch ((int)ai[1] / 15)
59261 {
59262 default:
59263 num9 = 12;
59264 break;
59265 case 1:
59266 num9 = 11;
59267 break;
59268 case 2:
59269 case 3:
59270 num9 = 10;
59271 break;
59272 }
59273 }
59274 else
59275 {
59276 bool flag2 = num9 >= 10 && num9 <= 12;
59277 int num10 = 10;
59278 if (flag2)
59279 {
59280 num10 = 6;
59281 }
59282 if (!flag2 && num9 >= 4)
59283 {
59284 num9 = 0;
59285 frameCounter = -1.0;
59286 }
59287 if ((frameCounter += 1.0) >= (double)num10)
59288 {
59289 frameCounter = 0.0;
59290 num9++;
59291 if ((!flag2 || num9 == 13) && num9 >= 4)
59292 {
59293 num9 = 0;
59294 }
59295 }
59296 }
59297 frame.Y = num9 * num;
59298 }
59299 break;
59300 }
59301 case 604:
59302 case 605:
59303 {
59305 int num155 = 2;
59306 int num156 = 4;
59307 if ((frameCounter += 1.0) >= (double)(num156 * num155))
59308 {
59309 frameCounter = 0.0;
59310 }
59311 if (velocity.Y == 0f)
59312 {
59313 frame.Y = num * ((int)frameCounter / num155);
59314 }
59315 else
59316 {
59317 frame.Y = num * (4 + (int)frameCounter / num155);
59318 }
59319 break;
59320 }
59321 case 669:
59322 {
59324 int num186 = 2;
59325 int num187 = 4;
59326 if ((frameCounter += 1.0) >= (double)(num187 * num186))
59327 {
59328 frameCounter = 0.0;
59329 }
59330 if (velocity.Y == 0f)
59331 {
59332 frame.Y = num * ((int)frameCounter / num186);
59333 }
59334 else
59335 {
59336 frame.Y = num * (4 + (int)frameCounter / num186);
59337 }
59338 break;
59339 }
59340 case 618:
59341 if ((frameCounter += 1.0) >= 5.0)
59342 {
59343 frameCounter = 0.0;
59344 frame.Y += num;
59345 if (frame.Y / num >= Main.npcFrameCount[type])
59346 {
59347 frame.Y = 0;
59348 }
59349 }
59350 break;
59351 case 619:
59352 if ((frameCounter += 1.0) >= 6.0)
59353 {
59354 frameCounter = 0.0;
59355 frame.Y += num;
59356 if (frame.Y / num >= Main.npcFrameCount[type])
59357 {
59358 frame.Y = 0;
59359 }
59360 }
59361 break;
59362 case 636:
59363 frame.Y = (AI_120_HallowBoss_IsInPhase2() ? num : 0);
59364 break;
59365 case 568:
59366 case 569:
59367 if (ai[0] > 0f)
59368 {
59369 int num188 = frame.Y / num;
59372 {
59373 frameCounter = 0.0;
59374 }
59375 num188 = 7;
59376 frameCounter += 1.0;
59377 int num189 = 0;
59378 double num190 = frameCounter;
59379 int num17 = num189 + 1;
59380 num189 = num17;
59381 if (num190 >= (double)(5 * num17))
59382 {
59383 num188 = 8;
59384 }
59385 double num191 = frameCounter;
59386 num17 = num189 + 1;
59387 num189 = num17;
59388 if (num191 >= (double)(5 * num17))
59389 {
59390 num188 = 9;
59391 }
59392 double num192 = frameCounter;
59393 num17 = num189 + 1;
59394 num189 = num17;
59395 if (num192 >= (double)(5 * num17))
59396 {
59397 num188 = 10;
59398 }
59399 double num193 = frameCounter;
59400 num17 = num189 + 1;
59401 num189 = num17;
59402 if (num193 >= (double)(5 * num17))
59403 {
59404 num188 = 7;
59405 }
59406 double num194 = frameCounter;
59407 num17 = num189 + 1;
59408 num189 = num17;
59409 if (num194 >= (double)(5 * num17))
59410 {
59411 num188 = 8;
59412 }
59413 double num195 = frameCounter;
59414 num17 = num189 + 1;
59415 num189 = num17;
59416 if (num195 >= (double)(5 * num17))
59417 {
59418 num188 = 9;
59419 }
59420 double num196 = frameCounter;
59421 num17 = num189 + 1;
59422 num189 = num17;
59423 if (num196 >= (double)(5 * num17))
59424 {
59425 num188 = 10;
59426 }
59427 double num197 = frameCounter;
59428 num17 = num189 + 1;
59429 num189 = num17;
59430 if (num197 >= (double)(5 * num17))
59431 {
59432 num188 = 7;
59433 }
59434 double num198 = frameCounter;
59435 num17 = num189 + 1;
59436 num189 = num17;
59437 if (num198 >= (double)(5 * num17))
59438 {
59439 num188 = 8;
59440 }
59441 double num199 = frameCounter;
59442 num17 = num189 + 1;
59443 num189 = num17;
59444 if (num199 >= (double)(5 * num17))
59445 {
59446 num188 = 9;
59447 }
59448 double num200 = frameCounter;
59449 num17 = num189 + 1;
59450 num189 = num17;
59451 if (num200 >= (double)(5 * num17))
59452 {
59453 num188 = 10;
59454 }
59455 double num201 = frameCounter;
59456 num17 = num189 + 1;
59457 num189 = num17;
59458 if (num201 >= (double)(5 * num17))
59459 {
59460 num188 = 7;
59461 }
59462 double num202 = frameCounter;
59463 num17 = num189 + 1;
59464 num189 = num17;
59465 if (num202 >= (double)(5 * num17))
59466 {
59467 num188 = 8;
59468 }
59469 double num203 = frameCounter;
59470 num17 = num189 + 1;
59471 num189 = num17;
59472 if (num203 >= (double)(5 * num17))
59473 {
59474 num188 = 9;
59475 }
59476 double num204 = frameCounter;
59477 num17 = num189 + 1;
59478 num189 = num17;
59479 if (num204 >= (double)(5 * num17))
59480 {
59481 num188 = 10;
59482 }
59483 double num205 = frameCounter;
59484 num17 = num189 + 1;
59485 num189 = num17;
59486 if (num205 >= (double)(5 * num17))
59487 {
59488 num188 = 7;
59489 }
59490 double num206 = frameCounter;
59491 num17 = num189 + 1;
59492 num189 = num17;
59493 if (num206 >= (double)(5 * num17))
59494 {
59495 num188 = 8;
59496 }
59497 double num207 = frameCounter;
59498 num17 = num189 + 1;
59499 num189 = num17;
59500 if (num207 >= (double)(5 * num17))
59501 {
59502 num188 = 9;
59503 }
59504 double num208 = frameCounter;
59505 num17 = num189 + 1;
59506 num189 = num17;
59507 if (num208 >= (double)(5 * num17))
59508 {
59509 num188 = 10;
59510 }
59511 double num209 = frameCounter;
59512 num17 = num189 + 1;
59513 num189 = num17;
59514 if (num209 >= (double)(5 * num17))
59515 {
59516 num188 = 7;
59517 }
59518 double num210 = frameCounter;
59519 num17 = num189 + 1;
59520 num189 = num17;
59521 if (num210 >= (double)(5 * num17))
59522 {
59523 num188 = 8;
59524 }
59525 double num211 = frameCounter;
59526 num17 = num189 + 1;
59527 num189 = num17;
59528 if (num211 >= (double)(5 * num17))
59529 {
59530 num188 = 9;
59531 }
59532 double num212 = frameCounter;
59533 num17 = num189 + 1;
59534 num189 = num17;
59535 if (num212 >= (double)(5 * num17))
59536 {
59537 num188 = 10;
59538 }
59539 double num213 = frameCounter;
59540 num17 = num189 + 1;
59541 num189 = num17;
59542 if (num213 >= (double)(5 * num17))
59543 {
59544 num188 = 11;
59545 }
59546 double num214 = frameCounter;
59547 num17 = num189 + 1;
59548 num189 = num17;
59549 if (num214 >= (double)(5 * num17))
59550 {
59551 num188 = 12;
59552 }
59553 double num215 = frameCounter;
59554 num17 = num189 + 1;
59555 num189 = num17;
59556 if (num215 >= (double)(5 * num17))
59557 {
59558 num188 = 13;
59559 }
59560 double num216 = frameCounter;
59561 num17 = num189 + 1;
59562 num189 = num17;
59563 if (num216 >= (double)(5 * num17))
59564 {
59565 num188 = 14;
59566 }
59567 if (frameCounter >= 270.0)
59568 {
59569 num188 = 14;
59570 frameCounter -= 10.0;
59571 }
59572 frame.Y = num * num188;
59573 break;
59574 }
59575 if (velocity.Y == 0f)
59576 {
59578 }
59579 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
59580 {
59581 frameCounter = 0.0;
59582 frame.Y = num * 4;
59583 break;
59584 }
59585 if (velocity.X == 0f)
59586 {
59587 frameCounter = 0.0;
59588 frame.Y = num * 6;
59589 break;
59590 }
59592 if (frameCounter >= 56.0 || frameCounter < 0.0)
59593 {
59594 frameCounter = 0.0;
59595 }
59596 frame.Y = num * (int)(frameCounter / 8.0);
59597 break;
59598 case 551:
59599 {
59600 int num11 = frame.Y / num;
59601 if (ai[0] == 4f)
59602 {
59603 float num12 = 60f;
59604 int num13 = 10;
59605 int num14 = 6 * num13;
59606 if (num11 < 5)
59607 {
59608 frameCounter = 0.0;
59609 }
59610 num11 = 5;
59611 frameCounter = (int)ai[1];
59612 int num15 = 0;
59613 double num16 = frameCounter;
59614 int num17 = num15 + 1;
59615 num15 = num17;
59616 if (num16 >= (double)(5 * num17))
59617 {
59618 num11 = 6;
59619 }
59620 num15 = 0;
59621 if (frameCounter >= (double)(num12 - 6f))
59622 {
59623 num11 = 7;
59624 }
59625 if (frameCounter >= (double)(num12 - 3f))
59626 {
59627 num11 = 8;
59628 }
59629 if (frameCounter >= (double)num12)
59630 {
59631 num11 = 9 + (int)frameCounter / 3 % 2;
59632 }
59633 num15 = 0;
59634 if (frameCounter >= (double)(num12 + (float)num14 + 3f))
59635 {
59636 num11 = 8;
59637 }
59638 double num18 = frameCounter;
59639 float num19 = num12 + (float)num14 + 3f;
59640 num17 = num15 + 1;
59641 num15 = num17;
59642 if (num18 >= (double)(num19 + (float)(5 * num17)))
59643 {
59644 num11 = 7;
59645 }
59646 double num20 = frameCounter;
59647 float num21 = num12 + (float)num14 + 3f;
59648 num17 = num15 + 1;
59649 num15 = num17;
59650 if (num20 >= (double)(num21 + (float)(5 * num17)))
59651 {
59652 num11 = 0;
59653 }
59654 }
59655 else if (ai[0] == 3f)
59656 {
59657 float num22 = 40f;
59658 float num23 = 80f;
59659 float num24 = num22 + num23;
59660 float num25 = 25f;
59661 if (num11 < 5)
59662 {
59663 frameCounter = 0.0;
59664 }
59665 num11 = 5;
59666 frameCounter = (int)ai[1];
59667 int num26 = 0;
59668 double num27 = frameCounter;
59669 int num17 = num26 + 1;
59670 num26 = num17;
59671 if (num27 >= (double)(5 * num17))
59672 {
59673 num11 = 6;
59674 }
59675 num26 = 0;
59676 if (frameCounter >= (double)(num22 - 6f))
59677 {
59678 num11 = 7;
59679 }
59680 if (frameCounter >= (double)(num22 - 3f))
59681 {
59682 num11 = 8;
59683 }
59684 if (frameCounter >= (double)num22)
59685 {
59686 num11 = 9 + (int)frameCounter / 3 % 2;
59687 }
59688 num26 = 0;
59689 if (frameCounter >= (double)(num24 - num25 + 3f))
59690 {
59691 num11 = 8;
59692 }
59693 double num28 = frameCounter;
59694 float num29 = num24 - num25 + 3f;
59695 num17 = num26 + 1;
59696 num26 = num17;
59697 if (num28 >= (double)(num29 + (float)(5 * num17)))
59698 {
59699 num11 = 7;
59700 }
59701 double num30 = frameCounter;
59702 float num31 = num24 - num25 + 3f;
59703 num17 = num26 + 1;
59704 num26 = num17;
59705 if (num30 >= (double)(num31 + (float)(5 * num17)))
59706 {
59707 num11 = 0;
59708 }
59709 }
59710 else if (ai[0] == 5f)
59711 {
59712 num11 = 3;
59713 }
59714 else if (ai[0] == 6f)
59715 {
59716 if (num11 > 4)
59717 {
59718 frameCounter = 0.0;
59719 }
59720 num11 = 1;
59721 frameCounter = (int)ai[1];
59722 int num32 = 0;
59723 double num33 = frameCounter;
59724 int num17 = num32 + 1;
59725 num32 = num17;
59726 if (num33 >= (double)(8 * num17))
59727 {
59728 num11 = 2;
59729 }
59730 double num34 = frameCounter;
59731 num17 = num32 + 1;
59732 num32 = num17;
59733 if (num34 >= (double)(8 * num17))
59734 {
59735 num11 = 3;
59736 }
59737 double num35 = frameCounter;
59738 num17 = num32 + 1;
59739 num32 = num17;
59740 if (num35 >= (double)(8 * num17))
59741 {
59742 num11 = 4;
59743 }
59744 double num36 = frameCounter;
59745 num17 = num32 + 1;
59746 num32 = num17;
59747 if (num36 >= (double)(8 * num17))
59748 {
59749 num11 = 3;
59750 }
59751 double num37 = frameCounter;
59752 num17 = num32 + 1;
59753 num32 = num17;
59754 if (num37 >= (double)(8 * num17))
59755 {
59756 num11 = 4;
59757 }
59758 double num38 = frameCounter;
59759 num17 = num32 + 1;
59760 num32 = num17;
59761 if (num38 >= (double)(8 * num17))
59762 {
59763 num11 = 3;
59764 }
59765 double num39 = frameCounter;
59766 num17 = num32 + 1;
59767 num32 = num17;
59768 if (num39 >= (double)(8 * num17))
59769 {
59770 num11 = 2;
59771 }
59772 double num40 = frameCounter;
59773 num17 = num32 + 1;
59774 num32 = num17;
59775 if (num40 >= (double)(8 * num17))
59776 {
59777 num11 = 1;
59778 }
59779 double num41 = frameCounter;
59780 num17 = num32 + 1;
59781 num32 = num17;
59782 if (num41 >= (double)(8 * num17))
59783 {
59784 num11 = 0;
59785 }
59786 }
59787 else
59788 {
59789 num11 = 0;
59790 }
59791 frame.Y = num * num11;
59792 break;
59793 }
59794 case 552:
59795 case 553:
59796 case 554:
59797 if (ai[0] > 0f)
59798 {
59800 if (frame.Y < num * 10 || frame.Y > num * 13 || ai[1] == 29f)
59801 {
59802 frame.Y = num * 10;
59803 frameCounter = 0.0;
59804 }
59805 if ((frameCounter += 1.0) >= 6.0 && frame.Y < num * 13)
59806 {
59807 frameCounter = 0.0;
59808 frame.Y += num;
59809 }
59810 break;
59811 }
59812 if (velocity.Y == 0f)
59813 {
59815 }
59816 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
59817 {
59818 frameCounter = 0.0;
59819 frame.Y = num * 8;
59820 break;
59821 }
59822 if (velocity.X == 0f)
59823 {
59824 frameCounter = 0.0;
59825 frame.Y = num * 9;
59826 break;
59827 }
59829 if (frameCounter >= 64.0 || frameCounter < 0.0)
59830 {
59831 frameCounter = 0.0;
59832 }
59833 frame.Y = num * (int)(frameCounter / 8.0);
59834 break;
59835 case 572:
59836 case 573:
59837 if (ai[0] > 0f && ai[1] == 0f)
59838 {
59840 if (frame.Y != num * 8 || frameCounter > 2.0)
59841 {
59842 frame.Y = num * 8;
59843 frameCounter = 0.0;
59844 }
59845 if (frameCounter == 0.0)
59846 {
59847 frameCounter = 1.0;
59848 EmoteBubble.NewBubble(3, new WorldUIAnchor(this), 60);
59849 }
59850 break;
59851 }
59852 if (ai[1] == 1f)
59853 {
59854 if (velocity.Y == 0f)
59855 {
59857 }
59858 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
59859 {
59860 frameCounter = 0.0;
59861 frame.Y = num * 17;
59862 break;
59863 }
59864 if (velocity.X == 0f)
59865 {
59866 frameCounter = 0.0;
59867 frame.Y = num * 8;
59868 break;
59869 }
59871 if (frameCounter >= 64.0 || frameCounter < 0.0)
59872 {
59873 frameCounter = 0.0;
59874 }
59875 frame.Y = num * ((int)(frameCounter / 8.0) + 8);
59876 break;
59877 }
59878 if (velocity.Y == 0f)
59879 {
59881 }
59882 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
59883 {
59884 frameCounter = 0.0;
59885 frame.Y = num * 16;
59886 break;
59887 }
59888 if (velocity.X == 0f)
59889 {
59890 frameCounter = 0.0;
59891 frame.Y = 0;
59892 break;
59893 }
59895 if (frameCounter >= 64.0 || frameCounter < 0.0)
59896 {
59897 frameCounter = 0.0;
59898 }
59899 frame.Y = num * (int)(frameCounter / 8.0);
59900 break;
59901 case 566:
59902 case 567:
59903 if (velocity.Y == 0f)
59904 {
59906 }
59907 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
59908 {
59909 frameCounter = 0.0;
59910 frame.Y = num * 8;
59911 break;
59912 }
59913 if (velocity.X == 0f)
59914 {
59915 frameCounter = 0.0;
59916 frame.Y = 0;
59917 break;
59918 }
59920 if (frameCounter >= 64.0 || frameCounter < 0.0)
59921 {
59922 frameCounter = 0.0;
59923 }
59924 frame.Y = num * (int)(frameCounter / 8.0);
59925 break;
59926 case 576:
59927 case 577:
59928 {
59929 int num76 = frame.Y;
59930 frame.Width = 80;
59931 if (ai[0] > 0f && ai[1] == 0f)
59932 {
59934 if (num76 < 11 || num76 > 20)
59935 {
59936 num76 = 11;
59937 frameCounter = 0.0;
59938 }
59939 int num77 = 4;
59940 if (num76 == 13 || num76 == 19)
59941 {
59942 num77 = 8;
59943 }
59944 if (num76 == 14 || num76 == 18)
59945 {
59946 num77 = 2;
59947 }
59948 if ((frameCounter += 1.0) >= (double)num77 && num76 < 20)
59949 {
59950 frameCounter = 0.0;
59951 num76++;
59952 }
59953 }
59954 else if (ai[0] > 0f && ai[1] == 2f)
59955 {
59957 if (num76 < 37 || num76 > 47)
59958 {
59959 num76 = 39;
59960 frameCounter = 0.0;
59961 }
59962 int num78 = 5;
59963 if (num76 == 42)
59964 {
59965 num78 = 6;
59966 }
59967 if (num76 == 45)
59968 {
59969 num78 = 8;
59970 }
59971 if (num76 == 46)
59972 {
59973 num78 = 4;
59974 }
59975 if (num76 == 47)
59976 {
59977 num78 = 26;
59978 }
59979 if (num76 == 37 || num76 == 38)
59980 {
59981 num78 = 7;
59982 }
59983 bool flag7 = true;
59984 if (num76 == 46 && velocity.Y != 0f)
59985 {
59986 flag7 = false;
59987 }
59988 if (num76 == 38)
59989 {
59990 flag7 = false;
59991 }
59992 if (flag7)
59993 {
59994 frameCounter += 1.0;
59995 }
59996 if (frameCounter >= (double)num78)
59997 {
59998 if (num76 < 47)
59999 {
60000 frameCounter = 0.0;
60001 num76++;
60002 }
60003 else
60004 {
60005 num76 = 37;
60006 frameCounter = 0.0;
60007 }
60008 }
60009 }
60010 else if (ai[0] > 0f && ai[1] == 1f)
60011 {
60013 if (num76 < 21 || num76 > 38)
60014 {
60015 num76 = 21;
60016 frameCounter = 0.0;
60017 }
60018 int num79 = 5;
60019 if ((frameCounter += 1.0) >= (double)num79 && num76 < 38)
60020 {
60021 frameCounter = 0.0;
60022 num76++;
60023 }
60024 }
60025 else
60026 {
60027 if (velocity.Y == 0f)
60028 {
60030 }
60031 if (velocity.Y != 0f)
60032 {
60033 frameCounter = 0.0;
60034 num76 = 43;
60035 }
60036 else if (velocity.X == 0f)
60037 {
60038 frameCounter = 0.0;
60039 num76 = 0;
60040 }
60041 else
60042 {
60044 if (frameCounter >= 60.0 || frameCounter < 0.0)
60045 {
60046 frameCounter = 0.0;
60047 }
60048 num76 = 1 + (int)(frameCounter / 6.0);
60049 }
60050 }
60051 frame.Y = num76;
60052 break;
60053 }
60054 case 570:
60055 case 571:
60056 if (ai[1] > 0f && ai[0] > 0f)
60057 {
60059 if (frame.Y < num * 10 || frame.Y > num * 15 || ai[1] == 59f)
60060 {
60061 frame.Y = num * 10;
60062 frameCounter = 0.0;
60063 }
60064 int num232 = 5;
60065 if (frame.Y == num * 14)
60066 {
60067 num232 = 35;
60068 }
60069 if ((frameCounter += 1.0) >= (double)num232 && frame.Y < num * 15)
60070 {
60071 frameCounter = 0.0;
60072 frame.Y += num;
60073 }
60074 break;
60075 }
60076 if (velocity.Y == 0f)
60077 {
60079 }
60080 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
60081 {
60082 frameCounter = 0.0;
60083 frame.Y = num;
60084 break;
60085 }
60086 if (velocity.X == 0f)
60087 {
60088 frameCounter = 0.0;
60089 frame.Y = num * 9;
60090 break;
60091 }
60093 if (frameCounter >= 64.0 || frameCounter < 0.0)
60094 {
60095 frameCounter = 0.0;
60096 }
60097 frame.Y = num * (int)(frameCounter / 8.0 + 2.0);
60098 break;
60099 case 561:
60100 case 562:
60101 case 563:
60102 if (ai[1] > 0f && ai[0] > 0f)
60103 {
60105 if (frame.Y < num * 10 || frame.Y > num * 13 || ai[1] == 89f)
60106 {
60107 frame.Y = num * 10;
60108 frameCounter = 0.0;
60109 }
60110 if ((frameCounter += 1.0) >= 6.0 && frame.Y < num * 13)
60111 {
60112 frameCounter = 0.0;
60113 frame.Y += num;
60114 }
60115 break;
60116 }
60117 if (velocity.Y == 0f)
60118 {
60120 }
60121 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
60122 {
60123 frameCounter = 0.0;
60124 frame.Y = num * 8;
60125 break;
60126 }
60127 if (velocity.X == 0f)
60128 {
60129 frameCounter = 0.0;
60130 frame.Y = num * 9;
60131 break;
60132 }
60134 if (frameCounter >= 64.0 || frameCounter < 0.0)
60135 {
60136 frameCounter = 0.0;
60137 }
60138 frame.Y = num * (int)(frameCounter / 8.0);
60139 break;
60140 case 555:
60141 case 556:
60142 case 557:
60143 if (ai[1] > 0f && ai[0] > 0f)
60144 {
60146 if (frame.Y < num * 10 || frame.Y > num * 16 || ai[1] == 41f)
60147 {
60148 frame.Y = num * 10;
60149 frameCounter = 0.0;
60150 }
60151 if ((frameCounter += 1.0) >= 6.0 && frame.Y < num * 16)
60152 {
60153 frameCounter = 0.0;
60154 frame.Y += num;
60155 }
60156 break;
60157 }
60158 if (velocity.Y == 0f)
60159 {
60161 }
60162 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
60163 {
60164 frameCounter = 0.0;
60165 frame.Y = num;
60166 break;
60167 }
60168 if (velocity.X == 0f)
60169 {
60170 frameCounter = 0.0;
60171 frame.Y = 0;
60172 break;
60173 }
60175 if (frameCounter >= 64.0 || frameCounter < 0.0)
60176 {
60177 frameCounter = 0.0;
60178 }
60179 frame.Y = num * ((int)(frameCounter / 8.0) + 2);
60180 break;
60181 case 558:
60182 case 559:
60183 case 560:
60184 {
60185 if (velocity.X > 0f)
60186 {
60187 spriteDirection = 1;
60188 }
60189 if (velocity.X < 0f)
60190 {
60191 spriteDirection = -1;
60192 }
60193 float num45 = velocity.ToRotation();
60194 if (velocity.X < 0f)
60195 {
60196 num45 += (float)Math.PI;
60197 }
60198 if (ai[0] != 2f)
60199 {
60200 num45 = velocity.X * 0.1f;
60201 }
60202 rotation = num45;
60203 if (ai[0] == 2f)
60204 {
60205 frame.Y = num * 4;
60206 }
60207 else if ((frameCounter += 1.0) >= 6.0)
60208 {
60209 frame.Y += num;
60210 frameCounter = 0.0;
60211 if (frame.Y >= num * 4)
60212 {
60213 frame.Y = 0;
60214 }
60215 }
60216 break;
60217 }
60218 case 578:
60219 rotation = velocity.X * 0.1f;
60220 if ((frameCounter += 1.0) >= 4.0)
60221 {
60222 frame.Y += num;
60223 frameCounter = 0.0;
60224 if (frame.Y >= num * 4)
60225 {
60226 frame.Y = 0;
60227 }
60228 }
60229 break;
60230 case 574:
60231 case 575:
60232 {
60233 if (velocity.X > 0f)
60234 {
60235 spriteDirection = 1;
60236 }
60237 if (velocity.X < 0f)
60238 {
60239 spriteDirection = -1;
60240 }
60241 float num230 = velocity.ToRotation();
60242 if (velocity.X < 0f)
60243 {
60244 num230 += (float)Math.PI;
60245 }
60246 rotation = rotation.AngleTowards(num230, 0.02f);
60247 if (ai[0] != 0f)
60248 {
60249 if (frame.Y < num * 2)
60250 {
60251 frame.Y = num * 2;
60252 frameCounter = 0.0;
60253 }
60254 int num231 = 4;
60255 if (frame.Y >= num * 5)
60256 {
60257 num231 = 8;
60258 }
60259 Vector2 vector3 = base.Center + new Vector2(56 * spriteDirection, -30f).RotatedBy(rotation);
60260 if ((frameCounter += 1.0) >= (double)num231 && frame.Y < num * 9)
60261 {
60262 frameCounter = 0.0;
60263 frame.Y += num;
60264 if (frame.Y == num * 9)
60265 {
60266 for (int k = 0; k < 8; k++)
60267 {
60268 Dust dust2 = Dust.NewDustDirect(vector3, 0, 0, 6, 0f, 0f, 100);
60269 Dust dust = dust2;
60270 dust.velocity *= 3f;
60271 dust2.scale = 0.6f;
60272 dust2.fadeIn = 1.2f;
60273 dust2.noGravity = true;
60274 dust2.noLight = true;
60275 }
60276 }
60277 }
60278 if (frame.Y < num * 9 || !(ai[0] < 3f))
60279 {
60280 break;
60281 }
60284 int maxValue = 5;
60285 if (frameCounter > 60.0)
60286 {
60287 maxValue = 4;
60288 }
60289 if (frameCounter > 180.0)
60290 {
60291 maxValue = 3;
60292 }
60293 if (frameCounter > 300.0)
60294 {
60295 maxValue = 2;
60296 }
60297 if (frameCounter > 600.0)
60298 {
60299 maxValue = 1;
60300 }
60301 for (int l = 0; l < 2; l++)
60302 {
60303 if (Main.rand.Next(maxValue) == 0)
60304 {
60305 Dust dust3 = Dust.NewDustDirect(Vector2.Lerp(value2, value, (float)l / 10f + 0.1f), 0, 0, 6, 0f, 0f, 50);
60306 dust3.scale = 0.3f;
60307 dust3.fadeIn = 1.5f;
60308 dust3.noGravity = true;
60309 dust3.noLight = true;
60310 }
60311 }
60312 }
60313 else if ((frameCounter += 1.0) >= 6.0)
60314 {
60315 frame.Y += num;
60316 frameCounter = 0.0;
60317 if (frame.Y >= num * 2)
60318 {
60319 frame.Y = 0;
60320 }
60321 }
60322 break;
60323 }
60324 case 549:
60325 spriteDirection = 1;
60326 rotation = 0f;
60327 if ((frameCounter += 1.0) >= 6.0)
60328 {
60329 frame.Y += num;
60330 frameCounter = 0.0;
60331 if (frame.Y >= num * Main.npcFrameCount[type])
60332 {
60333 frame.Y = 0;
60334 }
60335 }
60336 break;
60337 case 594:
60338 spriteDirection = 1;
60339 frame.Y = (int)ai[2];
60340 frame.Width = 32;
60341 break;
60342 case 564:
60343 case 565:
60344 {
60345 int y = frame.Y;
60346 frame.Width = 80;
60347 frame.Height = 80;
60348 if (ai[0] > 0f && ai[1] == 0f)
60349 {
60351 if (y < 5 || y > 13)
60352 {
60353 frameCounter = 0.0;
60354 }
60355 y = 5;
60356 frameCounter += 1.0;
60357 int num87 = 0;
60358 double num88 = frameCounter;
60359 int num17 = num87 + 1;
60360 num87 = num17;
60361 if (num88 >= (double)(7 * num17))
60362 {
60363 y = 6;
60364 }
60365 double num89 = frameCounter;
60366 num17 = num87 + 1;
60367 num87 = num17;
60368 if (num89 >= (double)(7 * num17))
60369 {
60370 y = 7;
60371 }
60372 double num90 = frameCounter;
60373 num17 = num87 + 1;
60374 num87 = num17;
60375 if (num90 >= (double)(7 * num17))
60376 {
60377 y = 5;
60378 }
60379 double num91 = frameCounter;
60380 num17 = num87 + 1;
60381 num87 = num17;
60382 if (num91 >= (double)(7 * num17))
60383 {
60384 y = 6;
60385 }
60386 double num92 = frameCounter;
60387 num17 = num87 + 1;
60388 num87 = num17;
60389 if (num92 >= (double)(7 * num17))
60390 {
60391 y = 7;
60392 }
60393 double num93 = frameCounter;
60394 num17 = num87 + 1;
60395 num87 = num17;
60396 if (num93 >= (double)(7 * num17))
60397 {
60398 y = 5;
60399 }
60400 double num94 = frameCounter;
60401 num17 = num87 + 1;
60402 num87 = num17;
60403 if (num94 >= (double)(7 * num17))
60404 {
60405 y = 6;
60406 }
60407 double num95 = frameCounter;
60408 num17 = num87 + 1;
60409 num87 = num17;
60410 if (num95 >= (double)(7 * num17))
60411 {
60412 y = 7;
60413 }
60414 double num96 = frameCounter;
60415 num17 = num87 + 1;
60416 num87 = num17;
60417 if (num96 >= (double)(7 * num17))
60418 {
60419 y = 8;
60420 }
60421 double num97 = frameCounter;
60422 num17 = num87 + 1;
60423 num87 = num17;
60424 if (num97 >= (double)(7 * num17))
60425 {
60426 y = 9;
60427 }
60428 double num98 = frameCounter;
60429 num17 = num87 + 1;
60430 num87 = num17;
60431 if (num98 >= (double)(7 * num17))
60432 {
60433 y = 10;
60434 }
60435 double num99 = frameCounter;
60436 num17 = num87 + 1;
60437 num87 = num17;
60438 if (num99 >= (double)(7 * num17))
60439 {
60440 y = 11;
60441 }
60442 double num100 = frameCounter;
60443 num17 = num87 + 1;
60444 num87 = num17;
60445 if (num100 >= (double)(7 * num17))
60446 {
60447 y = 12;
60448 }
60449 double num101 = frameCounter;
60450 num17 = num87 + 1;
60451 num87 = num17;
60452 if (num101 >= (double)(7 * num17))
60453 {
60454 y = 5;
60455 frameCounter = 0.0;
60456 }
60457 }
60458 else if (ai[0] > 0f && ai[1] == 1f)
60459 {
60461 if (y < 13 || y > 25)
60462 {
60463 frameCounter = 0.0;
60464 }
60465 y = 13;
60466 frameCounter += 1.0;
60467 int num102 = 0;
60468 double num103 = frameCounter;
60469 int num17 = num102 + 1;
60470 num102 = num17;
60471 if (num103 >= (double)(8 * num17))
60472 {
60473 y = 14;
60474 }
60475 double num104 = frameCounter;
60476 num17 = num102 + 1;
60477 num102 = num17;
60478 if (num104 >= (double)(8 * num17))
60479 {
60480 y = 15;
60481 }
60482 double num105 = frameCounter;
60483 num17 = num102 + 1;
60484 num102 = num17;
60485 if (num105 >= (double)(8 * num17))
60486 {
60487 y = 16;
60488 }
60489 double num106 = frameCounter;
60490 num17 = num102 + 1;
60491 num102 = num17;
60492 if (num106 >= (double)(8 * num17))
60493 {
60494 y = 17;
60495 }
60496 double num107 = frameCounter;
60497 num17 = num102 + 1;
60498 num102 = num17;
60499 if (num107 >= (double)(8 * num17))
60500 {
60501 y = 18;
60502 }
60503 double num108 = frameCounter;
60504 num17 = num102 + 1;
60505 num102 = num17;
60506 if (num108 >= (double)(8 * num17))
60507 {
60508 y = 19;
60509 }
60510 double num109 = frameCounter;
60511 num17 = num102 + 1;
60512 num102 = num17;
60513 if (num109 >= (double)(8 * num17))
60514 {
60515 y = 20;
60516 }
60517 double num110 = frameCounter;
60518 num17 = num102 + 1;
60519 num102 = num17;
60520 if (num110 >= (double)(8 * num17))
60521 {
60522 y = 18;
60523 }
60524 double num111 = frameCounter;
60525 num17 = num102 + 1;
60526 num102 = num17;
60527 if (num111 >= (double)(8 * num17))
60528 {
60529 y = 19;
60530 }
60531 double num112 = frameCounter;
60532 num17 = num102 + 1;
60533 num102 = num17;
60534 if (num112 >= (double)(8 * num17))
60535 {
60536 y = 20;
60537 }
60538 double num113 = frameCounter;
60539 num17 = num102 + 1;
60540 num102 = num17;
60541 if (num113 >= (double)(8 * num17))
60542 {
60543 y = 21;
60544 }
60545 double num114 = frameCounter;
60546 num17 = num102 + 1;
60547 num102 = num17;
60548 if (num114 >= (double)(8 * num17))
60549 {
60550 y = 22;
60551 }
60552 double num115 = frameCounter;
60553 num17 = num102 + 1;
60554 num102 = num17;
60555 if (num115 >= (double)(8 * num17))
60556 {
60557 y = 23;
60558 }
60559 double num116 = frameCounter;
60560 num17 = num102 + 1;
60561 num102 = num17;
60562 if (num116 >= (double)(8 * num17))
60563 {
60564 y = 24;
60565 }
60566 double num117 = frameCounter;
60567 num17 = num102 + 1;
60568 num102 = num17;
60569 if (num117 >= (double)(8 * num17))
60570 {
60571 y = 25;
60572 }
60573 double num118 = frameCounter;
60574 num17 = num102 + 1;
60575 num102 = num17;
60576 if (num118 >= (double)(8 * num17))
60577 {
60578 y = 14;
60579 frameCounter = 0.0;
60580 }
60581 }
60582 else if (ai[0] > 0f && ai[1] == 2f)
60583 {
60585 if (y < 26 || y > 40)
60586 {
60587 frameCounter = 0.0;
60588 }
60589 y = 26;
60590 frameCounter += 1.0;
60591 int num119 = 0;
60592 double num120 = frameCounter;
60593 int num17 = num119 + 1;
60594 num119 = num17;
60595 if (num120 >= (double)(8 * num17))
60596 {
60597 y = 27;
60598 }
60599 double num121 = frameCounter;
60600 num17 = num119 + 1;
60601 num119 = num17;
60602 if (num121 >= (double)(8 * num17))
60603 {
60604 y = 28;
60605 }
60606 double num122 = frameCounter;
60607 num17 = num119 + 1;
60608 num119 = num17;
60609 if (num122 >= (double)(8 * num17))
60610 {
60611 y = 29;
60612 }
60613 double num123 = frameCounter;
60614 num17 = num119 + 1;
60615 num119 = num17;
60616 if (num123 >= (double)(8 * num17))
60617 {
60618 y = 26;
60619 }
60620 double num124 = frameCounter;
60621 num17 = num119 + 1;
60622 num119 = num17;
60623 if (num124 >= (double)(8 * num17))
60624 {
60625 y = 27;
60626 }
60627 double num125 = frameCounter;
60628 num17 = num119 + 1;
60629 num119 = num17;
60630 if (num125 >= (double)(8 * num17))
60631 {
60632 y = 28;
60633 }
60634 double num126 = frameCounter;
60635 num17 = num119 + 1;
60636 num119 = num17;
60637 if (num126 >= (double)(8 * num17))
60638 {
60639 y = 29;
60640 }
60641 double num127 = frameCounter;
60642 num17 = num119 + 1;
60643 num119 = num17;
60644 if (num127 >= (double)(8 * num17))
60645 {
60646 y = 26;
60647 }
60648 double num128 = frameCounter;
60649 num17 = num119 + 1;
60650 num119 = num17;
60651 if (num128 >= (double)(8 * num17))
60652 {
60653 y = 27;
60654 }
60655 double num129 = frameCounter;
60656 num17 = num119 + 1;
60657 num119 = num17;
60658 if (num129 >= (double)(8 * num17))
60659 {
60660 y = 28;
60661 }
60662 double num130 = frameCounter;
60663 num17 = num119 + 1;
60664 num119 = num17;
60665 if (num130 >= (double)(8 * num17))
60666 {
60667 y = 29;
60668 }
60669 double num131 = frameCounter;
60670 num17 = num119 + 1;
60671 num119 = num17;
60672 if (num131 >= (double)(8 * num17))
60673 {
60674 y = 30;
60675 }
60676 double num132 = frameCounter;
60677 num17 = num119 + 1;
60678 num119 = num17;
60679 if (num132 >= (double)(8 * num17))
60680 {
60681 y = 31;
60682 }
60683 double num133 = frameCounter;
60684 num17 = num119 + 1;
60685 num119 = num17;
60686 if (num133 >= (double)(8 * num17))
60687 {
60688 y = 32;
60689 }
60690 double num134 = frameCounter;
60691 num17 = num119 + 1;
60692 num119 = num17;
60693 if (num134 >= (double)(8 * num17))
60694 {
60695 y = 33;
60696 }
60697 double num135 = frameCounter;
60698 num17 = num119 + 1;
60699 num119 = num17;
60700 if (num135 >= (double)(8 * num17))
60701 {
60702 y = 34;
60703 }
60704 double num136 = frameCounter;
60705 num17 = num119 + 1;
60706 num119 = num17;
60707 if (num136 >= (double)(8 * num17))
60708 {
60709 y = 35;
60710 }
60711 double num137 = frameCounter;
60712 num17 = num119 + 1;
60713 num119 = num17;
60714 if (num137 >= (double)(8 * num17))
60715 {
60716 y = 36;
60717 }
60718 double num138 = frameCounter;
60719 num17 = num119 + 1;
60720 num119 = num17;
60721 if (num138 >= (double)(8 * num17))
60722 {
60723 y = 37;
60724 }
60725 double num139 = frameCounter;
60726 num17 = num119 + 1;
60727 num119 = num17;
60728 if (num139 >= (double)(8 * num17))
60729 {
60730 y = 38;
60731 }
60732 double num140 = frameCounter;
60733 num17 = num119 + 1;
60734 num119 = num17;
60735 if (num140 >= (double)(8 * num17))
60736 {
60737 y = 39;
60738 }
60739 double num141 = frameCounter;
60740 num17 = num119 + 1;
60741 num119 = num17;
60742 if (num141 >= (double)(8 * num17))
60743 {
60744 y = 40;
60745 }
60746 double num142 = frameCounter;
60747 num17 = num119 + 1;
60748 num119 = num17;
60749 if (num142 >= (double)(8 * num17))
60750 {
60751 y = 26;
60752 frameCounter = 0.0;
60753 }
60754 }
60755 else
60756 {
60757 frameCounter = frameCounter + (double)(velocity.Length() * 0.1f) + 1.0;
60758 if (frameCounter >= 40.0 || frameCounter < 0.0)
60759 {
60760 frameCounter = 0.0;
60761 }
60762 y = (int)(frameCounter / 8.0);
60763 }
60764 frame.Y = y;
60765 break;
60766 }
60767 case 620:
60768 if (ai[1] > 0f && ai[0] > 0f)
60769 {
60771 if (frame.Y < num * 14 || frame.Y > num * 20 || ai[1] == 59f)
60772 {
60773 frame.Y = num * 14;
60774 frameCounter = 0.0;
60775 }
60776 int num222 = 5;
60777 if (frame.Y == num * 17 || frame.Y == num * 16)
60778 {
60779 num222 = 3;
60780 }
60781 if ((frameCounter += 1.0) >= (double)num222 && frame.Y < num * 20)
60782 {
60783 frameCounter = 0.0;
60784 frame.Y += num;
60785 if (ai[1] > 0f && frame.Y == num * 18)
60786 {
60787 frame.Y = num * 16;
60788 }
60789 }
60790 break;
60791 }
60792 if (wet)
60793 {
60794 if (velocity.X < 0f)
60795 {
60796 direction = -1;
60797 }
60798 if (velocity.X > 0f)
60799 {
60800 direction = 1;
60801 }
60803 {
60804 rotation *= -1f;
60806 }
60807 float num223 = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
60808 if (Math.Abs(rotation - num223) >= (float)Math.PI)
60809 {
60810 if (num223 < rotation)
60811 {
60812 rotation -= (float)Math.PI * 2f;
60813 }
60814 else
60815 {
60816 rotation += (float)Math.PI * 2f;
60817 }
60818 }
60819 rotation = (rotation * 4f + num223) / 5f;
60821 frameCounter += 1.0;
60822 if (frameCounter > 8.0)
60823 {
60824 frame.Y += num;
60825 frameCounter = 0.0;
60826 }
60827 if (frame.Y / num > 13)
60828 {
60829 frame.Y = num * 8;
60830 }
60831 else if (frame.Y / num < 8)
60832 {
60833 frame.Y = num * 13;
60834 }
60835 break;
60836 }
60837 if ((double)rotation > 3.14)
60838 {
60839 rotation -= 6.28f;
60840 }
60841 if ((double)rotation > -0.01 && (double)rotation < 0.01)
60842 {
60843 rotation = 0f;
60844 }
60845 else
60846 {
60847 rotation *= 0.9f;
60848 }
60849 if (velocity.Y == 0f)
60850 {
60851 if (direction == 1)
60852 {
60853 spriteDirection = 1;
60854 }
60855 if (direction == -1)
60856 {
60857 spriteDirection = -1;
60858 }
60859 if (velocity.X == 0f)
60860 {
60861 frame.Y = 0;
60862 frameCounter = 0.0;
60863 break;
60864 }
60865 if (frame.Y < num * 2)
60866 {
60867 frame.Y = num * 2;
60868 }
60870 frameCounter += 1.0;
60871 if (frameCounter > 9.0)
60872 {
60873 frame.Y += num;
60874 frameCounter = 0.0;
60875 }
60876 if (frame.Y / num > 7)
60877 {
60878 frame.Y = num * 2;
60879 }
60880 }
60881 else
60882 {
60883 frameCounter = 0.0;
60884 frame.Y = num;
60885 }
60886 break;
60887 case 17:
60888 case 18:
60889 case 19:
60890 case 20:
60891 case 21:
60892 case 22:
60893 case 26:
60894 case 27:
60895 case 28:
60896 case 31:
60897 case 37:
60898 case 38:
60899 case 44:
60900 case 54:
60901 case 73:
60902 case 77:
60903 case 78:
60904 case 79:
60905 case 80:
60906 case 104:
60907 case 107:
60908 case 108:
60909 case 120:
60910 case 124:
60911 case 140:
60912 case 142:
60913 case 159:
60914 case 160:
60915 case 162:
60916 case 167:
60917 case 178:
60918 case 181:
60919 case 185:
60920 case 196:
60921 case 197:
60922 case 198:
60923 case 201:
60924 case 202:
60925 case 203:
60926 case 207:
60927 case 208:
60928 case 209:
60929 case 212:
60930 case 213:
60931 case 227:
60932 case 228:
60933 case 229:
60934 case 287:
60935 case 294:
60936 case 295:
60937 case 296:
60938 case 310:
60939 case 311:
60940 case 312:
60941 case 313:
60942 case 314:
60943 case 322:
60944 case 323:
60945 case 324:
60946 case 326:
60947 case 338:
60948 case 339:
60949 case 340:
60950 case 353:
60951 case 368:
60952 case 369:
60953 case 441:
60954 case 453:
60955 case 460:
60956 case 462:
60957 case 463:
60958 case 489:
60959 case 534:
60960 case 550:
60961 case 588:
60962 case 630:
60963 case 632:
60964 case 633:
60965 case 635:
60966 case 637:
60967 case 638:
60968 case 656:
60969 case 663:
60970 case 670:
60971 case 678:
60972 case 679:
60973 case 680:
60974 case 681:
60975 case 682:
60976 case 683:
60977 case 684:
60978 {
60981 if (false && !Main.dedServ && TownNPCProfiles.Instance.GetProfile(type, out var profile))
60982 {
60983 Asset<Texture2D> textureNPCShouldUse = profile.GetTextureNPCShouldUse(this);
60984 if (textureNPCShouldUse.IsLoaded)
60985 {
60986 num = textureNPCShouldUse.Height() / Main.npcFrameCount[type];
60987 frame.Width = textureNPCShouldUse.Width();
60988 frame.Height = num;
60989 }
60990 }
60991 if (velocity.Y == 0f)
60992 {
60993 if (direction == 1)
60994 {
60995 spriteDirection = 1;
60996 }
60997 if (direction == -1)
60998 {
60999 spriteDirection = -1;
61000 }
61002 {
61003 spriteDirection *= -1;
61004 }
61006 if (ai[0] == 23f)
61007 {
61008 frameCounter += 1.0;
61009 int num238 = frame.Y / num;
61010 int num17 = num237 - num238;
61011 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num238 != 0)
61012 {
61013 frame.Y = 0;
61014 frameCounter = 0.0;
61015 }
61016 int num239 = 0;
61017 num239 = ((!(frameCounter < 6.0)) ? (num237 - 4) : (num237 - 5));
61018 if (ai[1] < 6f)
61019 {
61020 num239 = num237 - 5;
61021 }
61022 frame.Y = num * num239;
61023 }
61024 else if (ai[0] >= 20f && ai[0] <= 22f)
61025 {
61026 int num240 = frame.Y / num;
61027 switch ((int)ai[0])
61028 {
61029 case 20:
61030 if (flag11)
61031 {
61032 if (ai[1] > 30f && (num240 < 8 || num240 > 13))
61033 {
61034 num240 = 8;
61035 }
61036 if (num240 > 0)
61037 {
61038 frameCounter += 1.0;
61039 }
61040 if (frameCounter >= 12.0)
61041 {
61042 frameCounter = 0.0;
61043 num240++;
61044 if (num240 > 13 && ai[1] > 30f)
61045 {
61046 num240 = 8;
61047 }
61048 if (num240 > 13)
61049 {
61050 num240 = 0;
61051 }
61052 }
61053 }
61054 if (type == 656)
61055 {
61056 if (ai[1] > 30f && (num240 < 7 || num240 > 9))
61057 {
61058 num240 = 7;
61059 }
61060 if (num240 > 0)
61061 {
61062 frameCounter += 1.0;
61063 }
61064 if (frameCounter > 4.0)
61065 {
61066 frameCounter = 0.0;
61067 num240++;
61068 if (num240 > 8 && ai[1] > 30f)
61069 {
61070 num240 = 8;
61071 }
61072 if (num240 > 9)
61073 {
61074 num240 = 0;
61075 }
61076 }
61077 }
61078 if (type == 637)
61079 {
61080 if (ai[1] > 30f && (num240 < 10 || num240 > 16))
61081 {
61082 num240 = 10;
61083 }
61084 if (num240 > 0)
61085 {
61086 frameCounter += 1.0;
61087 }
61088 if (frameCounter > 4.0)
61089 {
61090 frameCounter = 0.0;
61091 num240++;
61092 if (num240 > 13 && ai[1] > 30f)
61093 {
61094 num240 = 13;
61095 }
61096 if (num240 > 16)
61097 {
61098 num240 = 0;
61099 }
61100 }
61101 }
61102 if (type != 638)
61103 {
61104 break;
61105 }
61106 if (ai[1] > 30f && (num240 < 23 || num240 > 27))
61107 {
61108 num240 = 23;
61109 }
61110 if (num240 > 0)
61111 {
61112 frameCounter += 1.0;
61113 }
61114 if (frameCounter > 4.0)
61115 {
61116 frameCounter = 0.0;
61117 num240++;
61118 if (num240 > 26 && ai[1] > 30f)
61119 {
61120 num240 = 24;
61121 }
61122 if (num240 > 27)
61123 {
61124 num240 = 0;
61125 }
61126 }
61127 break;
61128 case 21:
61129 if (type == 656)
61130 {
61131 if (ai[1] > 30f && (num240 < 10 || num240 > 16))
61132 {
61133 num240 = 10;
61134 }
61135 if (num240 > 0)
61136 {
61137 frameCounter += 1.0;
61138 }
61139 if (frameCounter > 4.0)
61140 {
61141 frameCounter = 0.0;
61142 num240++;
61143 if (num240 > 13 && ai[1] > 30f)
61144 {
61145 num240 = 13;
61146 }
61147 if (num240 > 16)
61148 {
61149 num240 = 0;
61150 }
61151 }
61152 }
61153 if (type == 637)
61154 {
61155 if (ai[1] > 30f && (num240 < 17 || num240 > 21))
61156 {
61157 num240 = 17;
61158 }
61159 if (num240 > 0)
61160 {
61161 frameCounter += 1.0;
61162 }
61163 if (frameCounter > 4.0)
61164 {
61165 frameCounter = 0.0;
61166 num240++;
61167 if (num240 > 19 && ai[1] > 30f)
61168 {
61169 num240 = 19;
61170 }
61171 if (num240 > 21)
61172 {
61173 num240 = 0;
61174 }
61175 }
61176 }
61177 if (type != 638)
61178 {
61179 break;
61180 }
61181 if (ai[1] > 30f && (num240 < 17 || num240 > 22))
61182 {
61183 num240 = 17;
61184 }
61185 if (num240 > 0)
61186 {
61187 frameCounter += 1.0;
61188 }
61189 if (frameCounter > 4.0)
61190 {
61191 frameCounter = 0.0;
61192 num240++;
61193 if (num240 > 21 && ai[1] > 30f)
61194 {
61195 num240 = 18;
61196 }
61197 if (num240 > 22)
61198 {
61199 num240 = 0;
61200 }
61201 }
61202 break;
61203 case 22:
61204 if (type == 656)
61205 {
61207 if (ai[1] > 40f && (num240 < 17 || num240 >= num241))
61208 {
61209 num240 = 17;
61210 }
61211 if (num240 > 0)
61212 {
61213 frameCounter += 1.0;
61214 }
61215 if (frameCounter > 4.0)
61216 {
61217 frameCounter = 0.0;
61218 num240++;
61219 if (num240 > 20 && ai[1] > 40f)
61220 {
61221 num240 = 19;
61222 }
61223 if (num240 >= num241)
61224 {
61225 num240 = 0;
61226 }
61227 }
61228 }
61229 if (type != 637)
61230 {
61231 break;
61232 }
61233 if (ai[1] > 30f && (num240 < 17 || num240 > 27))
61234 {
61235 num240 = 17;
61236 }
61237 if (num240 > 0)
61238 {
61239 frameCounter += 1.0;
61240 }
61241 if (frameCounter > 4.0)
61242 {
61243 frameCounter = 0.0;
61244 num240++;
61245 if (num240 > 27)
61246 {
61247 num240 = ((!(ai[1] <= 30f)) ? 22 : 20);
61248 }
61249 else if (ai[1] <= 30f && num240 == 22)
61250 {
61251 num240 = 0;
61252 }
61253 else if (ai[1] > 30f && num240 > 19 && num240 < 22)
61254 {
61255 num240 = 22;
61256 }
61257 }
61258 break;
61259 }
61260 frame.Y = num240 * num;
61261 }
61262 else if (ai[0] == 2f)
61263 {
61264 frameCounter += 1.0;
61265 if (frame.Y / num == num237 - 1 && frameCounter >= 5.0)
61266 {
61267 frame.Y = 0;
61268 frameCounter = 0.0;
61269 }
61270 else if (frame.Y / num == 0 && frameCounter >= 40.0)
61271 {
61272 frame.Y = num * (num237 - 1);
61273 frameCounter = 0.0;
61274 }
61275 else if (frame.Y != 0 && frame.Y != num * (num237 - 1))
61276 {
61277 frame.Y = 0;
61278 frameCounter = 0.0;
61279 }
61280 }
61281 else if (ai[0] == 11f)
61282 {
61283 frameCounter += 1.0;
61284 if (frame.Y / num == num237 - 1 && frameCounter >= 50.0)
61285 {
61286 if (frameCounter == 50.0)
61287 {
61288 int num242 = Main.rand.Next(4);
61289 for (int m = 0; m < 3 + num242; m++)
61290 {
61291 int num243 = Dust.NewDust(base.Center + Vector2.UnitX * -direction * 8f - Vector2.One * 5f + Vector2.UnitY * 8f, 3, 6, 216, -direction, 1f);
61292 Dust dust = Main.dust[num243];
61293 dust.velocity /= 2f;
61294 Main.dust[num243].scale = 0.8f;
61295 }
61296 if (Main.rand.Next(30) == 0)
61297 {
61298 int num244 = Gore.NewGore(base.Center + Vector2.UnitX * -direction * 8f, Vector2.Zero, Main.rand.Next(580, 583));
61299 Gore gore = Main.gore[num244];
61300 gore.velocity /= 2f;
61301 Main.gore[num244].velocity.Y = Math.Abs(Main.gore[num244].velocity.Y);
61302 Main.gore[num244].velocity.X = (0f - Math.Abs(Main.gore[num244].velocity.X)) * (float)direction;
61303 }
61304 }
61305 if (frameCounter >= 100.0 && Main.rand.Next(20) == 0)
61306 {
61307 frame.Y = 0;
61308 frameCounter = 0.0;
61309 }
61310 }
61311 else if (frame.Y / num == 0 && frameCounter >= 20.0)
61312 {
61313 frame.Y = num * (num237 - 1);
61314 frameCounter = 0.0;
61315 EmoteBubble.NewBubble(89, new WorldUIAnchor(this), 90);
61316 }
61317 else if (frame.Y != 0 && frame.Y != num * (num237 - 1))
61318 {
61319 frame.Y = 0;
61320 frameCounter = 0.0;
61321 }
61322 }
61323 else if (ai[0] == 5f)
61324 {
61325 frame.Y = num * (num237 - 3);
61326 if (type == 637)
61327 {
61328 frame.Y = num * 19;
61329 }
61330 frameCounter = 0.0;
61331 }
61332 else if (ai[0] == 6f)
61333 {
61334 frameCounter += 1.0;
61335 int num245 = frame.Y / num;
61336 int num17 = num237 - num245;
61337 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num245 != 0)
61338 {
61339 frame.Y = 0;
61340 frameCounter = 0.0;
61341 }
61342 int num246 = 0;
61343 num246 = ((!(frameCounter < 10.0)) ? ((frameCounter < 16.0) ? (num237 - 5) : ((frameCounter < 46.0) ? (num237 - 4) : ((frameCounter < 60.0) ? (num237 - 5) : ((!(frameCounter < 66.0)) ? ((frameCounter < 72.0) ? (num237 - 5) : ((frameCounter < 102.0) ? (num237 - 4) : ((frameCounter < 108.0) ? (num237 - 5) : ((!(frameCounter < 114.0)) ? ((frameCounter < 120.0) ? (num237 - 5) : ((frameCounter < 150.0) ? (num237 - 4) : ((frameCounter < 156.0) ? (num237 - 5) : ((!(frameCounter < 162.0)) ? ((frameCounter < 168.0) ? (num237 - 5) : ((frameCounter < 198.0) ? (num237 - 4) : ((frameCounter < 204.0) ? (num237 - 5) : ((!(frameCounter < 210.0)) ? ((frameCounter < 216.0) ? (num237 - 5) : ((frameCounter < 246.0) ? (num237 - 4) : ((frameCounter < 252.0) ? (num237 - 5) : ((!(frameCounter < 258.0)) ? ((frameCounter < 264.0) ? (num237 - 5) : ((frameCounter < 294.0) ? (num237 - 4) : ((frameCounter < 300.0) ? (num237 - 5) : 0))) : 0)))) : 0)))) : 0)))) : 0)))) : 0)))) : 0);
61344 if (num246 == num237 - 4 && num245 == num237 - 5)
61345 {
61346 Vector2 vector4 = base.Center + new Vector2(10 * direction, -4f);
61347 for (int n = 0; n < 8; n++)
61348 {
61349 int num247 = Main.rand.Next(139, 143);
61350 int num248 = Dust.NewDust(vector4, 0, 0, num247, velocity.X + (float)direction, velocity.Y - 2.5f, 0, default(Color), 1.2f);
61351 Main.dust[num248].velocity.X += (float)direction * 1.5f;
61352 Dust dust = Main.dust[num248];
61353 dust.position -= new Vector2(4f);
61354 dust = Main.dust[num248];
61355 dust.velocity *= 2f;
61356 Main.dust[num248].scale = 0.7f + Main.rand.NextFloat() * 0.3f;
61357 }
61358 }
61359 frame.Y = num * num246;
61360 if (frameCounter >= 300.0)
61361 {
61362 frameCounter = 0.0;
61363 }
61364 }
61365 else if ((ai[0] == 7f || ai[0] == 19f) && !NPCID.Sets.IsTownPet[type])
61366 {
61367 frameCounter += 1.0;
61368 int num249 = frame.Y / num;
61369 int num17 = num237 - num249;
61370 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num249 != 0)
61371 {
61372 frame.Y = 0;
61373 frameCounter = 0.0;
61374 }
61375 int num250 = 0;
61376 if (frameCounter < 16.0)
61377 {
61378 num250 = 0;
61379 }
61380 else if (frameCounter == 16.0)
61381 {
61382 EmoteBubble.NewBubbleNPC(new WorldUIAnchor(this), 112);
61383 }
61384 else if (frameCounter < 128.0)
61385 {
61386 num250 = ((frameCounter % 16.0 < 8.0) ? (num237 - 2) : 0);
61387 }
61388 else if (frameCounter < 160.0)
61389 {
61390 num250 = 0;
61391 }
61392 else if (frameCounter != 160.0)
61393 {
61394 num250 = ((frameCounter < 220.0) ? ((frameCounter % 12.0 < 6.0) ? (num237 - 2) : 0) : 0);
61395 }
61396 else
61397 {
61398 EmoteBubble.NewBubbleNPC(new WorldUIAnchor(this), 60);
61399 }
61400 frame.Y = num * num250;
61401 if (frameCounter >= 220.0)
61402 {
61403 frameCounter = 0.0;
61404 }
61405 }
61406 else if (ai[0] == 9f)
61407 {
61408 frameCounter += 1.0;
61409 int num251 = frame.Y / num;
61410 int num17 = num237 - num251;
61411 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num251 != 0)
61412 {
61413 frame.Y = 0;
61414 frameCounter = 0.0;
61415 }
61416 int num252 = 0;
61417 num252 = ((!(frameCounter < 10.0)) ? ((!(frameCounter < 16.0)) ? (num237 - 4) : (num237 - 5)) : 0);
61418 if (ai[1] < 16f)
61419 {
61420 num252 = num237 - 5;
61421 }
61422 if (ai[1] < 10f)
61423 {
61424 num252 = 0;
61425 }
61426 frame.Y = num * num252;
61427 }
61428 else if (ai[0] == 18f)
61429 {
61430 frameCounter += 1.0;
61431 int num253 = frame.Y / num;
61432 int num17 = num237 - num253;
61433 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num253 != 0)
61434 {
61435 frame.Y = 0;
61436 frameCounter = 0.0;
61437 }
61438 int num254 = 0;
61439 if (frameCounter < 10.0)
61440 {
61441 num254 = 0;
61442 }
61443 else if (frameCounter < 16.0)
61444 {
61445 num254 = num237 - 1;
61446 }
61447 else
61448 {
61449 num254 = num237 - 2;
61450 }
61451 if (ai[1] < 16f)
61452 {
61453 num254 = num237 - 1;
61454 }
61455 if (ai[1] < 10f)
61456 {
61457 num254 = 0;
61458 }
61460 frame.Y = num * num254;
61461 }
61462 else if (ai[0] == 10f || ai[0] == 13f)
61463 {
61464 frameCounter += 1.0;
61465 int num255 = frame.Y / num;
61466 int num17 = num255 - num237;
61467 if ((uint)num17 > 3u && num255 != 0)
61468 {
61469 frame.Y = 0;
61470 frameCounter = 0.0;
61471 }
61472 int num256 = 10;
61473 int num257 = 6;
61474 if (type == 633)
61475 {
61476 num256 = 0;
61477 num257 = 2;
61478 }
61479 int num258 = 0;
61480 num258 = ((!(frameCounter < (double)num256)) ? ((frameCounter < (double)(num256 + num257)) ? num237 : ((frameCounter < (double)(num256 + num257 * 2)) ? (num237 + 1) : ((frameCounter < (double)(num256 + num257 * 3)) ? (num237 + 2) : ((frameCounter < (double)(num256 + num257 * 4)) ? (num237 + 3) : 0)))) : 0);
61481 frame.Y = num * num258;
61482 }
61483 else if (ai[0] == 15f)
61484 {
61485 frameCounter += 1.0;
61486 int num259 = frame.Y / num;
61487 int num17 = num259 - num237;
61488 if ((uint)num17 > 3u && num259 != 0)
61489 {
61490 frame.Y = 0;
61491 frameCounter = 0.0;
61492 }
61493 float num260 = ai[1] / (float)NPCID.Sets.AttackTime[type];
61494 int num261 = 0;
61495 num261 = ((num260 > 0.65f) ? num237 : ((num260 > 0.5f) ? (num237 + 1) : ((num260 > 0.35f) ? (num237 + 2) : ((num260 > 0f) ? (num237 + 3) : 0))));
61496 frame.Y = num * num261;
61497 }
61498 else if (ai[0] == 25f)
61499 {
61500 frame.Y = num;
61501 }
61502 else if (ai[0] == 12f)
61503 {
61504 frameCounter += 1.0;
61505 int num262 = frame.Y / num;
61506 int num17 = num262 - num237;
61507 if ((uint)num17 > 4u && num262 != 0)
61508 {
61509 frame.Y = 0;
61510 frameCounter = 0.0;
61511 }
61512 int num263 = num237 + GetShootingFrame(ai[2]);
61513 frame.Y = num * num263;
61514 }
61515 else if (ai[0] == 14f || ai[0] == 24f)
61516 {
61517 frameCounter += 1.0;
61518 int num264 = frame.Y / num;
61519 int num17 = num264 - num237;
61520 if ((uint)num17 > 1u && num264 != 0)
61521 {
61522 frame.Y = 0;
61523 frameCounter = 0.0;
61524 }
61525 int num265 = 12;
61526 int num266 = ((frameCounter % (double)num265 * 2.0 < (double)num265) ? num237 : (num237 + 1));
61527 frame.Y = num * num266;
61528 if (ai[0] == 24f)
61529 {
61530 if (frameCounter == 60.0)
61531 {
61532 EmoteBubble.NewBubble(87, new WorldUIAnchor(this), 60);
61533 }
61534 if (frameCounter == 150.0)
61535 {
61536 EmoteBubble.NewBubble(3, new WorldUIAnchor(this), 90);
61537 }
61538 if (frameCounter >= 240.0)
61539 {
61540 frame.Y = 0;
61541 }
61542 }
61543 }
61544 else if (ai[0] == 1001f)
61545 {
61546 frame.Y = num * (num237 - 1);
61547 frameCounter = 0.0;
61548 }
61549 else if (CanTalk && (ai[0] == 3f || ai[0] == 4f))
61550 {
61551 frameCounter += 1.0;
61552 int num267 = frame.Y / num;
61553 int num17 = num237 - num267;
61554 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num267 != 0)
61555 {
61556 frame.Y = 0;
61557 frameCounter = 0.0;
61558 }
61559 bool flag12 = ai[0] == 3f;
61560 int num268 = 0;
61561 int num269 = 0;
61562 int num270 = -1;
61563 int num271 = -1;
61564 if (frameCounter < 10.0)
61565 {
61566 num268 = 0;
61567 }
61568 else if (frameCounter < 16.0)
61569 {
61570 num268 = num237 - 5;
61571 }
61572 else if (frameCounter < 46.0)
61573 {
61574 num268 = num237 - 4;
61575 }
61576 else if (frameCounter < 60.0)
61577 {
61578 num268 = num237 - 5;
61579 }
61580 else if (frameCounter < 216.0)
61581 {
61582 num268 = 0;
61583 }
61584 else if (frameCounter == 216.0 && Main.netMode != 1)
61585 {
61586 num270 = 70;
61587 }
61588 else if (frameCounter < 286.0)
61589 {
61590 num268 = ((frameCounter % 12.0 < 6.0) ? (num237 - 2) : 0);
61591 }
61592 else if (frameCounter < 320.0)
61593 {
61594 num268 = 0;
61595 }
61596 else if (frameCounter != 320.0 || Main.netMode == 1)
61597 {
61598 num268 = ((frameCounter < 420.0) ? ((frameCounter % 16.0 < 8.0) ? (num237 - 2) : 0) : 0);
61599 }
61600 else
61601 {
61602 num270 = 100;
61603 }
61604 if (frameCounter < 70.0)
61605 {
61606 num269 = 0;
61607 }
61608 else if (frameCounter != 70.0 || Main.netMode == 1)
61609 {
61610 num269 = ((frameCounter < 160.0) ? ((frameCounter % 16.0 < 8.0) ? (num237 - 2) : 0) : ((frameCounter < 166.0) ? (num237 - 5) : ((frameCounter < 186.0) ? (num237 - 4) : ((frameCounter < 200.0) ? (num237 - 5) : ((!(frameCounter < 320.0)) ? ((frameCounter < 326.0) ? (num237 - 1) : 0) : 0)))));
61611 }
61612 else
61613 {
61614 num271 = 90;
61615 }
61616 if (flag12)
61617 {
61618 NPC nPC = Main.npc[(int)ai[2]];
61619 if (num270 != -1)
61620 {
61622 }
61623 if (num271 != -1 && nPC.CanTalk)
61624 {
61626 }
61627 }
61628 frame.Y = num * (flag12 ? num268 : num269);
61629 if (frameCounter >= 420.0)
61630 {
61631 frameCounter = 0.0;
61632 }
61633 }
61634 else if (CanTalk && (ai[0] == 16f || ai[0] == 17f))
61635 {
61636 frameCounter += 1.0;
61637 int num272 = frame.Y / num;
61638 int num17 = num237 - num272;
61639 if ((uint)(num17 - 1) > 1u && (uint)(num17 - 4) > 1u && num272 != 0)
61640 {
61641 frame.Y = 0;
61642 frameCounter = 0.0;
61643 }
61644 bool flag13 = ai[0] == 16f;
61645 int num273 = 0;
61646 int num274 = -1;
61647 if (frameCounter < 10.0)
61648 {
61649 num273 = 0;
61650 }
61651 else if (frameCounter < 16.0)
61652 {
61653 num273 = num237 - 5;
61654 }
61655 else if (frameCounter < 22.0)
61656 {
61657 num273 = num237 - 4;
61658 }
61659 else if (frameCounter < 28.0)
61660 {
61661 num273 = num237 - 5;
61662 }
61663 else if (frameCounter < 34.0)
61664 {
61665 num273 = num237 - 4;
61666 }
61667 else if (frameCounter < 40.0)
61668 {
61669 num273 = num237 - 5;
61670 }
61671 else if (frameCounter == 40.0 && Main.netMode != 1)
61672 {
61673 num274 = 45;
61674 }
61675 else if (frameCounter < 70.0)
61676 {
61677 num273 = num237 - 4;
61678 }
61679 else if (frameCounter < 76.0)
61680 {
61681 num273 = num237 - 5;
61682 }
61683 else if (frameCounter < 82.0)
61684 {
61685 num273 = num237 - 4;
61686 }
61687 else if (frameCounter < 88.0)
61688 {
61689 num273 = num237 - 5;
61690 }
61691 else if (frameCounter < 94.0)
61692 {
61693 num273 = num237 - 4;
61694 }
61695 else if (frameCounter < 100.0)
61696 {
61697 num273 = num237 - 5;
61698 }
61699 else if (frameCounter == 100.0 && Main.netMode != 1)
61700 {
61701 num274 = 45;
61702 }
61703 else if (frameCounter < 130.0)
61704 {
61705 num273 = num237 - 4;
61706 }
61707 else if (frameCounter < 136.0)
61708 {
61709 num273 = num237 - 5;
61710 }
61711 else if (frameCounter < 142.0)
61712 {
61713 num273 = num237 - 4;
61714 }
61715 else if (frameCounter < 148.0)
61716 {
61717 num273 = num237 - 5;
61718 }
61719 else if (frameCounter < 154.0)
61720 {
61721 num273 = num237 - 4;
61722 }
61723 else if (frameCounter < 160.0)
61724 {
61725 num273 = num237 - 5;
61726 }
61727 else if (frameCounter != 160.0 || Main.netMode == 1)
61728 {
61729 num273 = ((frameCounter < 220.0) ? (num237 - 4) : ((frameCounter < 226.0) ? (num237 - 5) : 0));
61730 }
61731 else
61732 {
61733 num274 = 75;
61734 }
61735 if (flag13 && num274 != -1)
61736 {
61737 int num275 = (int)localAI[2];
61738 int num276 = (int)localAI[3];
61739 int num277 = (int)Main.npc[(int)ai[2]].localAI[3];
61740 int num278 = (int)Main.npc[(int)ai[2]].localAI[2];
61741 int num279 = 3 - num275 - num276;
61742 int num280 = 0;
61743 if (frameCounter == 40.0)
61744 {
61745 num280 = 1;
61746 }
61747 if (frameCounter == 100.0)
61748 {
61749 num280 = 2;
61750 }
61751 if (frameCounter == 160.0)
61752 {
61753 num280 = 3;
61754 }
61755 int num281 = 3 - num280;
61756 int num282 = -1;
61757 int num283 = 0;
61758 while (num282 < 0)
61759 {
61760 num17 = num283 + 1;
61761 num283 = num17;
61762 if (num17 >= 100)
61763 {
61764 break;
61765 }
61766 num282 = Main.rand.Next(2);
61767 if (num282 == 0 && num278 >= num276)
61768 {
61769 num282 = -1;
61770 }
61771 if (num282 == 1 && num277 >= num275)
61772 {
61773 num282 = -1;
61774 }
61775 if (num282 == -1 && num281 <= num279)
61776 {
61777 num282 = 2;
61778 }
61779 }
61780 if (num282 == 0)
61781 {
61782 Main.npc[(int)ai[2]].localAI[3] += 1f;
61783 num277++;
61784 }
61785 if (num282 == 1)
61786 {
61787 Main.npc[(int)ai[2]].localAI[2] += 1f;
61788 num278++;
61789 }
61790 int num284 = Utils.SelectRandom<int>(Main.rand, 38, 37, 36);
61791 int num285 = num284;
61792 switch (num282)
61793 {
61794 case 0:
61795 switch (num284)
61796 {
61797 case 38:
61798 num285 = 37;
61799 break;
61800 case 37:
61801 num285 = 36;
61802 break;
61803 case 36:
61804 num285 = 38;
61805 break;
61806 }
61807 break;
61808 case 1:
61809 switch (num284)
61810 {
61811 case 38:
61812 num285 = 36;
61813 break;
61814 case 37:
61815 num285 = 38;
61816 break;
61817 case 36:
61818 num285 = 37;
61819 break;
61820 }
61821 break;
61822 }
61823 if (num281 == 0)
61824 {
61825 if (num277 >= 2)
61826 {
61827 num284 -= 3;
61828 }
61829 if (num278 >= 2)
61830 {
61831 num285 -= 3;
61832 }
61833 }
61836 }
61837 frame.Y = num * (flag13 ? num273 : num273);
61838 if (frameCounter >= 420.0)
61839 {
61840 frameCounter = 0.0;
61841 }
61842 }
61843 else if (velocity.X == 0f)
61844 {
61845 if (type == 638)
61846 {
61847 int num286 = frame.Y / num;
61848 if (num286 > 7)
61849 {
61850 num286 = 0;
61851 }
61852 frameCounter += 1.0;
61853 if (frameCounter > 4.0)
61854 {
61855 frameCounter = 0.0;
61856 num286++;
61857 if (num286 > 7)
61858 {
61859 num286 = 0;
61860 }
61861 }
61862 frame.Y = num286 * num;
61863 }
61864 else if (type == 140 || type == 489)
61865 {
61866 frame.Y = num;
61867 frameCounter = 0.0;
61868 }
61869 else
61870 {
61871 frame.Y = 0;
61872 frameCounter = 0.0;
61873 }
61874 }
61875 else
61876 {
61877 int num287 = 6;
61878 if (type == 632)
61879 {
61880 num287 = 12;
61881 }
61882 if (type == 534)
61883 {
61884 num287 = 12;
61885 }
61886 if (type == 638)
61887 {
61888 num287 = 12;
61889 }
61890 if (type == 656)
61891 {
61892 num287 = 12;
61893 }
61894 if (flag11)
61895 {
61896 num287 = 12;
61897 }
61898 if (type == 489)
61899 {
61900 num287 = 8;
61901 frameCounter += Math.Abs(velocity.X) * 1f;
61902 frameCounter += 0.5;
61903 }
61904 else
61905 {
61906 frameCounter += Math.Abs(velocity.X) * 2f;
61907 frameCounter += 1.0;
61908 }
61909 if (type == 462)
61910 {
61911 num287 = 9;
61912 }
61913 int num288 = num * 2;
61914 if (type == 638)
61915 {
61916 num288 = num * 9;
61917 }
61918 if (type == 656)
61919 {
61920 num288 = num;
61921 }
61922 if (flag11)
61923 {
61924 num288 = num;
61925 }
61926 if (frame.Y < num288)
61927 {
61928 frame.Y = num288;
61929 }
61930 if (frameCounter > (double)num287)
61931 {
61932 frame.Y += num;
61933 frameCounter = 0.0;
61934 }
61935 if (frame.Y / num >= Main.npcFrameCount[type] - num236)
61936 {
61937 frame.Y = num288;
61938 }
61939 }
61940 break;
61941 }
61942 if (type == 462)
61943 {
61944 frameCounter = 0.0;
61945 if (velocity.Y < 0f)
61946 {
61947 frame.Y = num;
61948 }
61949 else
61950 {
61951 frame.Y = num * 2;
61952 }
61953 break;
61954 }
61955 if (flag11)
61956 {
61958 int num289 = frame.Y / num;
61959 if (velocity.Y < 0f)
61960 {
61962 {
61963 num289 = 2;
61964 frameCounter = -1.0;
61965 }
61966 if ((frameCounter += 1.0) >= 4.0)
61967 {
61968 frameCounter = 0.0;
61969 num289++;
61970 if (num289 >= 3)
61971 {
61972 num289 = 3;
61973 }
61974 }
61975 frame.Y = num289 * num;
61976 }
61977 else if (velocity.Y > 0f)
61978 {
61980 {
61981 num289 = 3;
61982 frameCounter = -1.0;
61983 }
61984 if ((frameCounter += 1.0) >= 4.0)
61985 {
61986 frameCounter = 0.0;
61987 num289++;
61988 if (num289 >= 6)
61989 {
61990 num289 = 6;
61991 }
61992 }
61993 frame.Y = num289 * num;
61994 }
61995 }
61996 else
61997 {
61998 frameCounter = 0.0;
61999 frame.Y = num;
62000 }
62001 if (type == 489 || type == 21 || type == 31 || type == 294 || type == 326 || type == 295 || type == 296 || type == 44 || type == 77 || type == 120 || type == 140 || type == 159 || type == 167 || type == 197 || type == 201 || type == 202)
62002 {
62003 frame.Y = 0;
62004 }
62005 if (type == 638)
62006 {
62007 frame.Y = num * 8;
62008 }
62009 break;
62010 }
62011 case 494:
62012 case 495:
62013 if (ai[2] > 0f)
62014 {
62015 if (ai[2] < 7f)
62016 {
62017 frame.Y = num * 5;
62018 }
62019 else if (ai[2] < 14f)
62020 {
62021 frame.Y = num * 6;
62022 }
62023 else if (ai[2] < 20f)
62024 {
62025 frame.Y = num * 7;
62026 }
62027 break;
62028 }
62029 if (velocity.Y == 0f)
62030 {
62031 if (direction == 1)
62032 {
62033 spriteDirection = 1;
62034 }
62035 if (direction == -1)
62036 {
62037 spriteDirection = -1;
62038 }
62039 }
62040 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
62041 {
62042 frameCounter = 0.0;
62043 if (velocity.Y < 0f)
62044 {
62045 frame.Y = num * 2;
62046 }
62047 else
62048 {
62049 frame.Y = num * 3;
62050 }
62051 break;
62052 }
62053 if (velocity.X == 0f)
62054 {
62055 frameCounter = 0.0;
62056 frame.Y = 0;
62057 break;
62058 }
62060 if (frameCounter < 8.0)
62061 {
62062 frame.Y = 0;
62063 break;
62064 }
62065 if (frameCounter < 16.0)
62066 {
62067 frame.Y = num;
62068 break;
62069 }
62070 if (frameCounter < 24.0)
62071 {
62072 frame.Y = num * 2;
62073 break;
62074 }
62075 if (frameCounter < 32.0)
62076 {
62077 frame.Y = num * 3;
62078 break;
62079 }
62080 if (frameCounter < 39.0)
62081 {
62082 frame.Y = num * 4;
62083 break;
62084 }
62085 frame.Y = num * 4;
62086 frameCounter = 0.0;
62087 break;
62088 case 541:
62089 if (ai[0] > 0f)
62090 {
62091 float num220 = ai[0];
62092 if (num220 < 6f)
62093 {
62094 frame.Y = num * 4;
62095 }
62096 else if (num220 < 105f)
62097 {
62098 frame.Y = num * (int)(num220 / 8f % 4f + 5f);
62099 }
62100 else if (num220 < 114f)
62101 {
62102 frame.Y = num * 9;
62103 }
62104 else if (num220 < 135f)
62105 {
62106 frame.Y = num * (int)((num220 - 99f - 15f) / 7f + 10f);
62107 }
62108 else
62109 {
62110 frame.Y = num;
62111 }
62112 }
62113 else
62114 {
62115 frameCounter = frameCounter + (double)(velocity.Length() * 0.1f) + 1.0;
62116 if (frameCounter >= 8.0)
62117 {
62118 frame.Y += num;
62119 frameCounter = 0.0;
62120 }
62121 if (frame.Y >= num * 4)
62122 {
62123 frame.Y = 0;
62124 }
62125 }
62126 break;
62127 case 612:
62128 case 613:
62129 {
62131 {
62132 frameCounter += 1.0;
62133 if (frameCounter > 50.0)
62134 {
62135 frameCounter = 0.0;
62136 frame.Y = 0;
62137 }
62138 frame.Y = (int)Utils.WrappedLerp(0f, 4f, (float)frameCounter / 50f) * num;
62139 break;
62140 }
62141 bool flag5 = true;
62142 if (frame.Y == 0 && Main.rand.Next(180) != 0)
62143 {
62144 flag5 = false;
62145 }
62146 if (flag5)
62147 {
62148 frameCounter += 1.0;
62149 }
62150 if (velocity.X != 0f)
62151 {
62153 }
62154 int num68 = 10;
62155 bool flag6 = Math.Abs(velocity.X) > 1f;
62156 if (ai[1] == 1f)
62157 {
62158 frameCounter = 0.0;
62159 frame.Y = num * 4;
62160 }
62161 if (Math.Abs(velocity.Y) > 0.1f || flag6)
62162 {
62163 frameCounter = 0.0;
62164 frame.Y = num * 4;
62165 }
62166 else if (frame.Y == 0)
62167 {
62168 num68 = 2;
62169 }
62170 if (frame.Y == num * 4)
62171 {
62172 num68 = 60;
62173 if (!flag6)
62174 {
62175 num68 = 2;
62176 }
62177 }
62178 if (frameCounter >= (double)num68)
62179 {
62180 frameCounter = 0.0;
62181 frame.Y += num;
62182 if (frame.Y / num >= 5)
62183 {
62184 frame.Y = 0;
62185 }
62186 }
62187 break;
62188 }
62189 case 583:
62190 case 584:
62191 case 585:
62192 rotation = velocity.X * 0.1f;
62193 if ((frameCounter += 1.0) >= 4.0)
62194 {
62195 frame.Y += num;
62196 frameCounter = 0.0;
62197 if (frame.Y >= num * 4)
62198 {
62199 frame.Y = 0;
62200 }
62201 }
62202 break;
62203 case 498:
62204 case 499:
62205 case 500:
62206 case 501:
62207 case 502:
62208 case 503:
62209 case 504:
62210 case 505:
62211 case 506:
62212 if (velocity.Y == 0f)
62213 {
62214 if (direction == 1)
62215 {
62216 spriteDirection = 1;
62217 }
62218 if (direction == -1)
62219 {
62220 spriteDirection = -1;
62221 }
62222 if (ai[2] > 0f)
62223 {
62225 if (ai[1] < 12f)
62226 {
62227 frame.Y = num * 8;
62228 }
62229 else if (ai[1] < 34f)
62230 {
62231 frame.Y = num * 9;
62232 }
62233 else
62234 {
62235 frame.Y = num * 8;
62236 }
62237 frameCounter = 0.0;
62238 break;
62239 }
62240 if (velocity.X == 0f)
62241 {
62242 frame.Y = 0;
62243 break;
62244 }
62245 frameCounter += Math.Abs(velocity.X) * 1f;
62246 if (frameCounter > 4.0)
62247 {
62248 frame.Y += num;
62249 frameCounter = 0.0;
62250 }
62251 if (frame.Y > num * 7)
62252 {
62253 frame.Y = 0;
62254 }
62255 }
62256 else
62257 {
62258 frameCounter = 0.0;
62259 frame.Y = num * 10;
62260 }
62261 break;
62262 case 524:
62263 case 525:
62264 case 526:
62265 case 527:
62266 if (velocity.Y == 0f)
62267 {
62268 if (direction != 0)
62269 {
62271 }
62272 if (velocity.X == 0f)
62273 {
62274 frame.Y = 0;
62275 frameCounter = 0.0;
62276 break;
62277 }
62278 if (frame.Y <= num)
62279 {
62280 frame.Y = num * 2;
62281 }
62283 frameCounter += 1.0;
62284 if (frameCounter > 9.0)
62285 {
62286 frame.Y += num;
62287 frameCounter = 0.0;
62288 }
62289 if (frame.Y / num >= Main.npcFrameCount[type])
62290 {
62291 frame.Y = num * 2;
62292 }
62293 }
62294 else
62295 {
62296 frame.Y = num;
62297 frameCounter = 0.0;
62298 }
62299 break;
62300 case 528:
62301 case 529:
62302 if (velocity.Y == 0f)
62303 {
62304 if (direction != 0)
62305 {
62307 }
62308 if (velocity.X == 0f)
62309 {
62310 frame.Y = 0;
62311 frameCounter = 0.0;
62312 break;
62313 }
62315 frameCounter += 1.0;
62316 if (frameCounter > 9.0)
62317 {
62318 frame.Y += num;
62319 frameCounter = 0.0;
62320 }
62321 if (frame.Y / num >= Main.npcFrameCount[type] - 1)
62322 {
62323 frame.Y = num;
62324 }
62325 }
62326 else
62327 {
62328 frame.Y = num * (Main.npcFrameCount[type] - 1);
62329 frameCounter = 0.0;
62330 }
62331 break;
62332 case 533:
62333 if (velocity.Y == 0f && direction != 0)
62334 {
62336 }
62337 frameCounter += 1.0;
62338 if (frameCounter >= 48.0)
62339 {
62340 frameCounter = 0.0;
62341 }
62342 frame.Y = (int)(frameCounter / 6.0) * num;
62343 if (ai[1] > 0f)
62344 {
62345 frame.Y += num * 8;
62346 }
62347 break;
62348 case 496:
62349 case 497:
62350 if (ai[0] == 0f)
62351 {
62352 rotation = 0f;
62353 if (velocity.Y == 0f)
62354 {
62356 }
62357 else if (velocity.Y < 0f)
62358 {
62359 frameCounter = 0.0;
62360 }
62361 frameCounter += Math.Abs(velocity.X) * 1.1f;
62362 if (frameCounter < 6.0)
62363 {
62364 frame.Y = 0;
62365 }
62366 else if (frameCounter < 12.0)
62367 {
62368 frame.Y = num;
62369 }
62370 else if (frameCounter < 18.0)
62371 {
62372 frame.Y = num * 2;
62373 }
62374 else if (frameCounter < 24.0)
62375 {
62376 frame.Y = num * 3;
62377 }
62378 else
62379 {
62380 frameCounter = 0.0;
62381 }
62382 }
62383 else if (ai[0] == 1f)
62384 {
62385 frameCounter = 0.0;
62386 if (ai[1] < 10f)
62387 {
62388 frame.Y = num * 4;
62389 }
62390 else if (ai[1] < 20f)
62391 {
62392 frame.Y = num * 5;
62393 }
62394 else
62395 {
62396 frame.Y = num * 6;
62397 }
62398 }
62399 else if (ai[0] == 5f)
62400 {
62401 frameCounter = 0.0;
62402 if (ai[1] < 10f)
62403 {
62404 frame.Y = num * 10;
62405 }
62406 else if (ai[1] < 20f)
62407 {
62408 frame.Y = num * 11;
62409 }
62410 else
62411 {
62412 frame.Y = num * 3;
62413 }
62414 }
62415 else
62416 {
62417 frameCounter = 0.0;
62418 frame.Y = num * 7;
62419 }
62420 break;
62421 case 508:
62422 case 532:
62423 case 580:
62424 case 582:
62425 if (velocity.Y != 0f)
62426 {
62427 frame.Y = num;
62428 break;
62429 }
62430 if (velocity.X == 0f)
62431 {
62432 frame.Y = 0;
62433 break;
62434 }
62435 if (direction < 0 && velocity.X < 0f)
62436 {
62437 spriteDirection = -1;
62438 }
62439 if (direction > 0 && velocity.X > 0f)
62440 {
62441 spriteDirection = 1;
62442 }
62443 if (frame.Y / num < 2)
62444 {
62445 frame.Y = num * 2;
62446 }
62447 frameCounter += 1f + Math.Abs(velocity.X) / 2f;
62448 if (frameCounter > 6.0)
62449 {
62450 frame.Y += num;
62451 frameCounter = 0.0;
62452 }
62453 if (frame.Y / num >= Main.npcFrameCount[type])
62454 {
62455 frame.Y = num * 2;
62456 }
62457 break;
62458 case 509:
62459 case 581:
62460 if ((velocity.X > 0f && direction > 0) || (velocity.X < 0f && direction < 0))
62461 {
62463 }
62464 if ((frameCounter += 1.0) >= 3.0)
62465 {
62466 frameCounter = 0.0;
62467 frame.Y += num;
62468 if (frame.Y / num >= Main.npcFrameCount[type])
62469 {
62470 frame.Y = 0;
62471 }
62472 }
62473 break;
62474 case 415:
62475 if (ai[2] < 0f)
62476 {
62477 if (frame.Y / num != 8 && frame.Y / num != 9 && frame.Y / num != 0)
62478 {
62479 frameCounter = 0.0;
62480 }
62481 frameCounter += 1.0;
62482 int num163 = 0;
62483 int num164 = 18;
62484 int num165 = 4;
62485 if (frameCounter > (double)(num164 - num165 * 2))
62486 {
62487 num163 = 8 + (int)frameCounter / 4 % 2;
62488 }
62489 if (frameCounter > (double)(num164 + num165 * 6))
62490 {
62491 num163 = 0;
62492 frameCounter = 0.0;
62493 }
62494 frame.Y = num * num163;
62495 }
62496 else if (velocity.Y == 0f)
62497 {
62498 if (direction != 0)
62499 {
62501 }
62502 if (frame.Y < num * 2)
62503 {
62504 frame.Y = num * 2;
62505 }
62506 frameCounter += Math.Abs(velocity.X) * 0.5f;
62507 if (frameCounter >= 8.0)
62508 {
62509 frame.Y += num;
62510 frameCounter = 0.0;
62511 }
62512 if (frame.Y / num >= Main.npcFrameCount[type] - 2)
62513 {
62514 frame.Y = num * 2;
62515 }
62516 if (velocity.X == 0f)
62517 {
62518 frame.Y = 0;
62519 }
62520 }
62521 else
62522 {
62523 frameCounter = 0.0;
62524 frame.Y = num;
62525 }
62526 break;
62527 case 416:
62529 {
62530 frameCounter += 1.0;
62531 if (frameCounter > 5.0)
62532 {
62533 frameCounter = 0.0;
62534 frame.Y += num;
62535 }
62536 if (frame.Y < num * 2 || frame.Y > num * 7)
62537 {
62538 frame.Y = num * 2;
62539 }
62540 }
62541 else if (Main.netMode != 2 && !Main.dedServ)
62542 {
62543 int num63 = (int)ai[0];
62544 if (Main.npc[num63].active && Main.npc[num63].type == 415 && TextureAssets.Npc[415].IsLoaded)
62545 {
62546 frame.Y = Main.npc[num63].frame.Y / (TextureAssets.Npc[415].Height() / Main.npcFrameCount[415]) * num;
62547 }
62548 }
62549 break;
62550 case 417:
62551 if (ai[0] == 0f)
62552 {
62553 rotation = 0f;
62554 if (velocity.Y == 0f)
62555 {
62557 }
62558 else if (velocity.Y < 0f)
62559 {
62560 frameCounter = 0.0;
62561 }
62562 frameCounter += Math.Abs(velocity.X) * 1.1f;
62563 frame.Y = (int)(frameCounter / 6.0) * num;
62564 if (frameCounter >= 48.0)
62565 {
62566 frameCounter = 0.0;
62567 }
62568 }
62569 else if (ai[0] == 1f)
62570 {
62571 frameCounter = 0.0;
62572 frame.Y = num * (9 + (int)(ai[1] / 6f));
62573 }
62574 else if (ai[0] == 5f)
62575 {
62576 frameCounter = 0.0;
62577 frame.Y = num * (13 - (int)(ai[1] / 6f));
62578 }
62579 else
62580 {
62581 frameCounter = 0.0;
62582 frame.Y = num * 14;
62583 }
62584 break;
62585 case 518:
62586 if (velocity.Y == 0f)
62587 {
62588 if (direction != 0)
62589 {
62591 }
62592 if (velocity.X == 0f)
62593 {
62594 frame.Y = 0;
62595 frameCounter = 0.0;
62596 break;
62597 }
62598 if (frame.Y < num * 2)
62599 {
62600 frame.Y = num * 2;
62601 }
62602 frameCounter += Math.Abs(velocity.X) * 1f;
62603 frameCounter += 1.0;
62604 if (frameCounter > 6.0)
62605 {
62606 frame.Y += num;
62607 frameCounter = 0.0;
62608 }
62609 if (frame.Y / num >= Main.npcFrameCount[type])
62610 {
62611 frame.Y = num * 2;
62612 }
62613 }
62614 else
62615 {
62616 frame.Y = num;
62617 frameCounter = 0.0;
62618 }
62619 break;
62620 case 419:
62621 if (ai[2] < 0f)
62622 {
62623 int num61 = 1;
62624 if (direction != 0)
62625 {
62627 }
62628 if (frame.Y / num >= 9)
62629 {
62630 frame.Y = num * 2;
62631 frameCounter = 0.0;
62632 }
62633 if (frame.Y / num < 2)
62634 {
62635 frame.Y = num * 2;
62636 frameCounter = 0.0;
62637 }
62638 frameCounter += 1.0;
62639 if (frameCounter >= (double)(num61 * 4 + 6))
62640 {
62641 frameCounter = 8.0;
62642 }
62643 if (frameCounter < 6.0)
62644 {
62645 frame.Y = num * (int)(2.0 + frameCounter / 3.0);
62646 }
62647 else
62648 {
62649 frame.Y = num * (int)(4.0 + (frameCounter - 6.0) / (double)num61);
62650 }
62651 }
62652 else if (velocity.Y == 0f)
62653 {
62654 if (direction != 0)
62655 {
62657 }
62658 if (velocity.X == 0f)
62659 {
62660 frame.Y = 0;
62661 frameCounter = 0.0;
62662 break;
62663 }
62664 frameCounter += Math.Abs(velocity.X) * 1f;
62665 frameCounter += 1.0;
62666 if (frameCounter > 6.0)
62667 {
62668 frame.Y += num;
62669 frameCounter = 0.0;
62670 }
62671 if (frame.Y / num >= Main.npcFrameCount[type])
62672 {
62673 frame.Y = num * 9;
62674 }
62675 if (frame.Y / num < 9)
62676 {
62677 frame.Y = num * 9;
62678 }
62679 }
62680 else
62681 {
62682 frame.Y = num;
62683 frameCounter = 0.0;
62684 }
62685 break;
62686 case 425:
62687 if (direction != 0)
62688 {
62690 }
62691 if (ai[2] == 1f)
62692 {
62693 frameCounter += 1.0;
62694 if (frameCounter >= 3.0)
62695 {
62696 frame.Y += num;
62697 frameCounter = 0.0;
62698 }
62699 if (frame.Y > num * 12 || frame.Y < num * 10)
62700 {
62701 frame.Y = num * 10;
62702 }
62703 }
62704 else if (velocity.Y != 0f)
62705 {
62706 frameCounter = 0.0;
62707 frame.Y = num;
62708 }
62709 else if (velocity.X == 0f)
62710 {
62711 frameCounter = 0.0;
62712 frame.Y = 0;
62713 }
62714 else
62715 {
62717 if (frameCounter >= 8.0)
62718 {
62719 frame.Y += num;
62720 frameCounter = 0.0;
62721 }
62722 if (frame.Y > num * 9 || frame.Y < num * 2)
62723 {
62724 frame.Y = num * 2;
62725 }
62726 }
62727 break;
62728 case 427:
62729 if (direction != 0)
62730 {
62732 }
62733 if (velocity.Y != 0f)
62734 {
62735 frameCounter += 1.0;
62736 if (frameCounter >= 2.0)
62737 {
62738 frame.Y += num;
62739 frameCounter = 0.0;
62740 }
62741 if (frame.Y >= num * 9 || frame.Y < num * 6)
62742 {
62743 frame.Y = num * 6;
62744 }
62745 }
62746 else if (velocity.X == 0f)
62747 {
62748 frameCounter = 0.0;
62749 frame.Y = 0;
62750 }
62751 else
62752 {
62754 if (frameCounter >= 8.0)
62755 {
62756 frame.Y += num;
62757 frameCounter = 0.0;
62758 }
62759 if (frame.Y > num * 5 || frame.Y < num)
62760 {
62761 frame.Y = num;
62762 }
62763 }
62764 break;
62765 case 426:
62766 if (direction != 0)
62767 {
62769 }
62770 if (ai[1] >= 45f)
62771 {
62772 if (velocity.Y == 0f)
62773 {
62774 frame.Y = num * 8;
62775 break;
62776 }
62777 frameCounter += 1.0;
62778 if (frameCounter >= 2.0)
62779 {
62780 frame.Y += num;
62781 frameCounter = 0.0;
62782 }
62783 if (frame.Y >= num * 15 || frame.Y < num * 12)
62784 {
62785 frame.Y = num * 12;
62786 }
62787 }
62788 else if (velocity.Y != 0f)
62789 {
62790 frameCounter += 1.0;
62791 if (frameCounter >= 2.0)
62792 {
62793 frame.Y += num;
62794 frameCounter = 0.0;
62795 }
62796 if (frame.Y >= num * 12 || frame.Y < num * 9)
62797 {
62798 frame.Y = num * 9;
62799 }
62800 }
62801 else if (velocity.X == 0f)
62802 {
62803 frameCounter = 0.0;
62804 frame.Y = 0;
62805 }
62806 else
62807 {
62809 if (frameCounter >= 10.0)
62810 {
62811 frame.Y += num;
62812 frameCounter = 0.0;
62813 }
62814 if (frame.Y > num * 7 || frame.Y < num)
62815 {
62816 frame.Y = num;
62817 }
62818 }
62819 break;
62820 case 429:
62821 if (velocity.Y == 0f)
62822 {
62823 if (direction != 0)
62824 {
62826 }
62827 if (velocity.X == 0f)
62828 {
62829 frame.Y = 0;
62830 frameCounter = 0.0;
62831 break;
62832 }
62833 if (frame.Y < num * 2)
62834 {
62835 frame.Y = num * 2;
62836 }
62837 frameCounter += Math.Abs(velocity.X) * 1f;
62838 frameCounter += 1.0;
62839 if (frameCounter > 6.0)
62840 {
62841 frame.Y += num;
62842 frameCounter = 0.0;
62843 }
62844 if (frame.Y / num >= Main.npcFrameCount[type])
62845 {
62846 frame.Y = num * 2;
62847 }
62848 }
62849 else
62850 {
62851 frame.Y = num;
62852 frameCounter = 0.0;
62853 }
62854 break;
62855 case 428:
62856 if (velocity.Y == 0f)
62857 {
62858 if (direction != 0)
62859 {
62861 }
62862 if (velocity.X == 0f)
62863 {
62864 frame.Y = 0;
62865 frameCounter = 0.0;
62866 break;
62867 }
62868 frameCounter += Math.Abs(velocity.X) * 1f;
62869 if ((frameCounter += 1.0) > 10.0)
62870 {
62871 frame.Y += num;
62872 frameCounter = 0.0;
62873 }
62874 if (frame.Y / num >= Main.npcFrameCount[type] - 1)
62875 {
62876 frame.Y = 0;
62877 }
62878 }
62879 else if (frame.Y / num != 4)
62880 {
62881 if (frameCounter > 0.0)
62882 {
62883 frameCounter = 0.0;
62884 }
62885 if ((frameCounter -= 1.0) < -10.0 || velocity.Y > 0.6f)
62886 {
62887 frame.Y = num * 4;
62888 frameCounter = 0.0;
62889 }
62890 }
62891 break;
62892 case 423:
62893 if (ai[2] == 1f)
62894 {
62895 int num233 = 2;
62896 if (ai[1] >= 30f && ai[1] < 45f)
62897 {
62898 num233 = 3;
62899 }
62900 frame.Y = num233 * num;
62901 break;
62902 }
62903 if (velocity.Y != 0f)
62904 {
62905 frame.Y = num;
62906 break;
62907 }
62908 if (velocity.X == 0f)
62909 {
62910 frame.Y = 0;
62911 break;
62912 }
62913 if (velocity.X != 0f)
62914 {
62916 }
62917 if (frame.Y / num < 4)
62918 {
62919 frame.Y = num * 4;
62920 }
62921 frameCounter += 1f + Math.Abs(velocity.X) / 2f;
62922 if (frameCounter > 6.0)
62923 {
62924 frame.Y += num;
62925 frameCounter = 0.0;
62926 }
62927 if (frame.Y / num >= Main.npcFrameCount[type])
62928 {
62929 frame.Y = num * 4;
62930 }
62931 break;
62932 case 421:
62933 if (ai[0] == 5f)
62934 {
62935 frameCounter += 1.0;
62936 }
62937 if ((frameCounter += 1.0) >= 5.0)
62938 {
62939 frameCounter = 0.0;
62940 frame.Y += num;
62941 if (frame.Y / num >= Main.npcFrameCount[type])
62942 {
62943 frame.Y = 0;
62944 }
62945 }
62946 break;
62947 case 424:
62948 if (velocity.Y == 0f)
62949 {
62950 if (direction != 0)
62951 {
62953 }
62954 if (ai[2] > 0f)
62955 {
62956 frame.Y = num * ((ai[1] > 90f) ? (Main.npcFrameCount[type] - 2) : (Main.npcFrameCount[type] - 1));
62957 frameCounter = 0.0;
62958 break;
62959 }
62960 if (velocity.X == 0f)
62961 {
62962 frame.Y = 0;
62963 break;
62964 }
62965 if (frame.Y < num * 2)
62966 {
62967 frame.Y = num * 2;
62968 }
62969 frameCounter += Math.Abs(velocity.X) * 2f;
62970 frameCounter += velocity.X * 1.3f;
62971 if (frameCounter > 6.0)
62972 {
62973 frame.Y += num;
62974 frameCounter = 0.0;
62975 }
62976 if (frame.Y / num >= Main.npcFrameCount[type] - 2)
62977 {
62978 frame.Y = num * 2;
62979 }
62980 }
62981 else
62982 {
62983 frameCounter = 0.0;
62984 frame.Y = num;
62985 }
62986 break;
62987 case 420:
62988 if ((frameCounter += 1.0) >= 5.0)
62989 {
62990 frameCounter = 0.0;
62991 frame.Y += num;
62992 if (frame.Y / num >= Main.npcFrameCount[type])
62993 {
62994 frame.Y = 0;
62995 }
62996 }
62997 break;
62998 case 411:
62999 if (ai[1] >= 120f && ai[1] < 240f)
63000 {
63002 frame.Y = num * (Main.npcFrameCount[type] - 1);
63003 frameCounter = 0.0;
63004 }
63005 else if (velocity.Y == 0f)
63006 {
63007 if (direction != 0)
63008 {
63010 }
63011 if (velocity.X == 0f)
63012 {
63013 frame.Y = 0;
63014 frameCounter = 0.0;
63015 break;
63016 }
63017 if (frame.Y < num * 2)
63018 {
63019 frame.Y = num * 2;
63020 }
63021 frameCounter += Math.Abs(velocity.X) * 1f;
63022 frameCounter += 1.0;
63023 if (frameCounter > 6.0)
63024 {
63025 frame.Y += num;
63026 frameCounter = 0.0;
63027 }
63028 if (frame.Y / num >= Main.npcFrameCount[type] - 1)
63029 {
63030 frame.Y = num * 2;
63031 }
63032 }
63033 else
63034 {
63035 frame.Y = num;
63036 frameCounter = 0.0;
63037 }
63038 break;
63039 case 409:
63040 if (velocity.Y == 0f && ai[1] <= 30f && ai[1] > 0f)
63041 {
63042 frame.Y = num * (Main.npcFrameCount[type] - 1);
63043 frameCounter = 0.0;
63044 break;
63045 }
63046 if (velocity.Y == 0f)
63047 {
63049 }
63050 if ((frameCounter += 1.0) >= 6.0)
63051 {
63052 frameCounter = 0.0;
63053 frame.Y += num;
63054 if (frame.Y / num >= Main.npcFrameCount[type] - 2)
63055 {
63056 frame.Y = 0;
63057 }
63058 }
63059 break;
63060 case 410:
63062 if (frameCounter >= 10.0)
63063 {
63064 frameCounter -= 10.0;
63065 frame.Y += num;
63066 if (frame.Y / num >= Main.npcFrameCount[type])
63067 {
63068 frame.Y = 0;
63069 }
63070 }
63071 break;
63072 case 407:
63073 if ((frameCounter += 1.0) >= 6.0)
63074 {
63075 frameCounter = 0.0;
63076 frame.Y += num;
63077 if (frame.Y / num >= Main.npcFrameCount[type])
63078 {
63079 frame.Y = 0;
63080 }
63081 }
63082 break;
63083 case 405:
63084 case 406:
63085 if ((frameCounter += 1.0) >= 4.0)
63086 {
63087 frameCounter = 0.0;
63088 frame.Y += num;
63089 if (frame.Y / num >= Main.npcFrameCount[type])
63090 {
63091 frame.Y = 0;
63092 }
63093 }
63094 break;
63095 case 516:
63096 if (localAI[1] == 0f)
63097 {
63098 localAI[1] = 1f;
63099 frame.Y = num * Main.rand.Next(3);
63100 frameCounter += Main.rand.Next(3);
63101 }
63102 frameCounter += 1.0;
63103 if (frameCounter > 3.0)
63104 {
63105 frameCounter = 0.0;
63106 frame.Y += num;
63107 if (frame.Y > num * 3)
63108 {
63109 frame.Y = 0;
63110 }
63111 }
63112 break;
63113 case 418:
63114 if (ai[0] == 0f || ai[0] == 1f || ai[0] == -1f)
63115 {
63116 frameCounter += 1.0;
63117 if (frameCounter > 6.0)
63118 {
63119 frameCounter = 0.0;
63120 frame.Y += num;
63121 }
63122 if (frame.Y > num * 4)
63123 {
63124 frame.Y = 0;
63125 }
63126 }
63127 else if (ai[0] == 2f)
63128 {
63129 if (ai[1] < 10f)
63130 {
63131 frame.Y = num * 5;
63132 }
63133 else if (ai[1] < 20f)
63134 {
63135 frame.Y = num * 6;
63136 }
63137 else
63138 {
63139 frame.Y = num * 7;
63140 }
63141 }
63142 else if (ai[0] == -2f)
63143 {
63144 frameCounter += 1.0;
63145 if (frameCounter > 12.0)
63146 {
63147 frameCounter = 0.0;
63148 frame.Y += num;
63149 }
63150 if (frame.Y > num * 7)
63151 {
63152 frame.Y = num * 5;
63153 }
63154 }
63155 break;
63156 case 1:
63157 case 16:
63158 case 59:
63159 case 71:
63160 case 81:
63161 case 138:
63162 case 147:
63163 case 183:
63164 case 184:
63165 case 204:
63166 case 225:
63167 case 302:
63168 case 304:
63169 case 333:
63170 case 334:
63171 case 335:
63172 case 336:
63173 case 535:
63174 case 537:
63175 case 658:
63176 case 659:
63177 case 667:
63178 case 676:
63179 if (type == 302 || type == 304)
63180 {
63182 }
63183 frameCounter += 1.0;
63184 if (num2 > 0)
63185 {
63186 frameCounter += 1.0;
63187 }
63188 if (num2 == 4)
63189 {
63190 frameCounter += 1.0;
63191 }
63192 if (frameCounter >= 8.0)
63193 {
63194 frame.Y += num;
63195 frameCounter = 0.0;
63196 }
63197 if (frame.Y >= num * Main.npcFrameCount[type])
63198 {
63199 frame.Y = 0;
63200 }
63201 break;
63202 case 488:
63203 {
63204 int num180 = (int)localAI[1];
63205 if (Framing.GetTileSafely((int)ai[0], (int)ai[1]).frameX >= 36)
63206 {
63207 num180 *= -1;
63208 }
63209 if (localAI[0] > 24f)
63210 {
63211 localAI[0] = 24f;
63212 }
63213 if (localAI[0] > 0f)
63214 {
63215 localAI[0] -= 1f;
63216 }
63217 if (localAI[0] < 0f)
63218 {
63219 localAI[0] = 0f;
63220 }
63221 int num181 = ((num180 == -1) ? 4 : 6);
63222 int num182 = (int)localAI[0] / num181;
63223 if (localAI[0] % (float)num181 != 0f)
63224 {
63225 num182++;
63226 }
63227 if (num182 != 0 && num180 == 1)
63228 {
63229 num182 += 5;
63230 }
63231 frame.Y = num182 * num;
63232 break;
63233 }
63234 case 430:
63235 case 431:
63236 case 432:
63237 case 433:
63238 case 434:
63239 case 435:
63240 case 436:
63241 case 591:
63242 if (ai[2] > 0f)
63243 {
63244 if (ai[2] < 5f)
63245 {
63246 frame.Y = num * 3;
63247 }
63248 else if (ai[2] < 10f)
63249 {
63250 frame.Y = num * 4;
63251 }
63252 else if (ai[2] < 15f)
63253 {
63254 frame.Y = num * 5;
63255 }
63256 else
63257 {
63258 frame.Y = num * 6;
63259 }
63260 break;
63261 }
63262 if (velocity.Y == 0f)
63263 {
63264 if (direction == 1)
63265 {
63266 spriteDirection = 1;
63267 }
63268 if (direction == -1)
63269 {
63270 spriteDirection = -1;
63271 }
63272 }
63273 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
63274 {
63275 frameCounter = 0.0;
63276 frame.Y = num * 2;
63277 break;
63278 }
63279 if (velocity.X == 0f)
63280 {
63281 frameCounter = 0.0;
63282 frame.Y = 0;
63283 break;
63284 }
63286 if (frameCounter < 8.0)
63287 {
63288 frame.Y = 0;
63289 }
63290 else if (frameCounter < 16.0)
63291 {
63292 frame.Y = num;
63293 }
63294 else if (frameCounter < 24.0)
63295 {
63296 frame.Y = num * 2;
63297 }
63298 else if (frameCounter < 32.0)
63299 {
63300 frame.Y = num;
63301 }
63302 else
63303 {
63304 frameCounter = 0.0;
63305 }
63306 break;
63307 case 454:
63308 {
63309 int num160 = (int)(frameCounter / 2.0);
63310 frame.Y = num * num160;
63311 break;
63312 }
63313 case 377:
63314 case 446:
63316 {
63317 frameCounter += 1.0;
63318 if (frameCounter > 4.0)
63319 {
63320 frameCounter = 0.0;
63321 frame.Y += num;
63322 }
63323 if (frame.Y > num)
63324 {
63325 frame.Y = 0;
63326 }
63327 }
63328 else if (velocity.Y != 0f)
63329 {
63330 frame.Y = num;
63331 }
63332 else
63333 {
63334 frame.Y = 0;
63335 }
63337 break;
63338 case 378:
63339 {
63340 if (velocity.Y != 0f && frame.Y < num * 2)
63341 {
63342 frame.Y += num * 2;
63343 }
63344 if (velocity.Y == 0f && frame.Y > num * 2)
63345 {
63346 frame.Y -= num * 2;
63347 }
63348 frameCounter += 1.0;
63349 int num229 = 6;
63350 if (frameCounter >= (double)num229)
63351 {
63352 frameCounter = 0.0;
63353 frame.Y += num;
63354 if (velocity.Y != 0f && frame.Y >= num * 4)
63355 {
63356 frame.Y = num * 2;
63357 }
63358 if (velocity.Y == 0f && frame.Y >= num * 2)
63359 {
63360 frame.Y = 0;
63361 }
63362 }
63363 break;
63364 }
63365 case 376:
63366 frameCounter += 1.0;
63367 if (frameCounter > 30.0)
63368 {
63369 frameCounter = 0.0;
63370 frame.Y += num;
63371 if (frame.Y >= num * 2)
63372 {
63373 frame.Y = 0;
63374 }
63375 }
63376 break;
63377 case 589:
63378 {
63379 int num72 = frame.Y / num;
63380 frameCounter += 1.0;
63381 if (velocity.Y != 0f)
63382 {
63383 frame.Y = 0;
63384 frameCounter = 0.0;
63385 }
63386 if (num72 >= 12)
63387 {
63388 if (frameCounter > 6.0)
63389 {
63390 frameCounter = 0.0;
63391 frame.Y += num;
63392 if (frame.Y >= num * Main.npcFrameCount[type])
63393 {
63394 frame.Y = 0;
63395 }
63396 }
63397 }
63398 else if (num72 >= 11)
63399 {
63400 if (frameCounter > (double)Main.rand.Next(40, 140))
63401 {
63402 frameCounter = 0.0;
63403 frame.Y += num;
63404 }
63405 }
63406 else if (num72 >= 8)
63407 {
63408 if (!(frameCounter > 3.0))
63409 {
63410 break;
63411 }
63412 frameCounter = 0.0;
63413 frame.Y += num;
63414 if (frame.Y == num * 9)
63415 {
63417 vector.Y += height - 6;
63418 if (direction == 1)
63419 {
63420 vector.X += 30f;
63421 }
63422 else
63423 {
63424 vector.X -= 22f;
63425 }
63426 for (int j = 0; j < 4; j++)
63427 {
63428 Dust.NewDust(vector, 1, 1, 32);
63429 }
63430 }
63431 }
63432 else if (num72 >= 7)
63433 {
63434 if (frameCounter > (double)Main.rand.Next(30, 90))
63435 {
63436 frameCounter = 0.0;
63437 frame.Y += num;
63438 }
63439 }
63440 else if (num72 >= 4)
63441 {
63442 if (frameCounter > 4.0)
63443 {
63444 frameCounter = 0.0;
63445 frame.Y += num;
63446 }
63447 }
63448 else if (num72 >= 1)
63449 {
63450 if (frameCounter > 4.0)
63451 {
63452 frameCounter = 0.0;
63453 frame.Y += num;
63454 if (frame.Y >= num * 4 && Main.rand.Next(3) != 0)
63455 {
63456 frame.Y = 0;
63457 }
63458 }
63459 }
63460 else if (frameCounter > (double)Main.rand.Next(90, 450))
63461 {
63462 frameCounter = 0.0;
63463 frame.Y += num;
63464 }
63465 break;
63466 }
63467 case 375:
63468 frameCounter += 1.0;
63469 if (frameCounter > 4.0)
63470 {
63471 frameCounter = 0.0;
63472 frame.Y += num;
63473 if (frame.Y >= num * 4)
63474 {
63475 frame.Y = 0;
63476 }
63477 }
63478 break;
63479 case 374:
63480 localAI[0] = -2f;
63481 if (velocity.Y == 0f)
63482 {
63483 rotation = 0f;
63484 if (velocity.X == 0f)
63485 {
63486 frame.Y = 0;
63487 frameCounter = 0.0;
63488 break;
63489 }
63490 frameCounter += 1.0;
63491 if (frameCounter > 6.0)
63492 {
63493 frameCounter = 0.0;
63494 frame.Y += num;
63495 if (frame.Y >= num * 4)
63496 {
63497 frame.Y = num;
63498 }
63499 }
63500 break;
63501 }
63502 rotation += (float)direction * 0.1f;
63503 frameCounter += 1.0;
63504 if (frameCounter > 3.0)
63505 {
63506 frameCounter = 0.0;
63507 frame.Y += num;
63508 if (frame.Y >= num * 4)
63509 {
63510 frame.Y = num;
63511 }
63512 }
63513 break;
63514 case 492:
63515 frame.Y = num * (int)ai[2];
63516 break;
63517 case 473:
63518 case 474:
63519 case 475:
63520 case 476:
63521 if (velocity.Y == 0f)
63522 {
63524 }
63525 if (ai[0] == 0f || ai[0] == 7f)
63526 {
63527 rotation = 0f;
63528 frameCounter = 0.0;
63529 frame.Y = 0;
63530 }
63531 else if (ai[0] == 1f)
63532 {
63533 rotation = 0f;
63534 frameCounter = 0.0;
63535 int num80 = 6;
63536 if (ai[1] < (float)num80)
63537 {
63538 frame.Y = num;
63539 }
63540 else if (ai[1] < (float)(num80 * 2))
63541 {
63542 frame.Y = num * 2;
63543 }
63544 else if (ai[1] < (float)(num80 * 3))
63545 {
63546 frame.Y = num * 3;
63547 }
63548 else if (ai[1] < (float)(num80 * 4))
63549 {
63550 frame.Y = num * 4;
63551 }
63552 else if (ai[1] < (float)(num80 * 5))
63553 {
63554 frame.Y = num * 5;
63555 }
63556 else
63557 {
63558 frame.Y = num * 6;
63559 }
63560 }
63561 else if (ai[0] == 8f)
63562 {
63563 rotation = 0f;
63564 frameCounter += 1.0;
63565 if (frameCounter >= 24.0)
63566 {
63567 frameCounter = 0.0;
63568 }
63569 frame.Y = num * Math.Min(6, Math.Max(3, 3 + (int)frameCounter / 6));
63570 }
63571 else if (ai[0] == 2f || ai[0] == 6f)
63572 {
63573 rotation = 0f;
63574 if (velocity.Y == 0f)
63575 {
63576 int num81 = 6;
63577 frameCounter += 1.0;
63578 if (frame.Y < num * 7)
63579 {
63580 frame.Y = num * 12;
63581 }
63582 if (frame.Y < num * 10)
63583 {
63584 if (frameCounter > 8.0)
63585 {
63586 frame.Y += num;
63587 frameCounter = 0.0;
63588 if (frame.Y == num * 10)
63589 {
63590 frameCounter = num81 * 2;
63591 }
63592 }
63593 }
63594 else if (frameCounter < (double)num81)
63595 {
63596 frame.Y = num * 12;
63597 }
63598 else if (frameCounter < (double)(num81 * 2))
63599 {
63600 frame.Y = num * 11;
63601 }
63602 else if (frameCounter < (double)(num81 * 3))
63603 {
63604 frame.Y = num * 10;
63605 }
63606 else
63607 {
63608 frame.Y = num * 11;
63609 if (frameCounter >= (double)(num81 * 4 - 1))
63610 {
63611 frameCounter = 0.0;
63612 }
63613 }
63614 }
63615 else
63616 {
63617 frame.Y = num * 13;
63618 frameCounter = 0.0;
63619 }
63620 }
63621 else if (ai[0] == 3f)
63622 {
63623 rotation = 0f;
63624 frameCounter += 1.0;
63625 if (frameCounter > 6.0)
63626 {
63627 frameCounter = 0.0;
63628 if (frame.Y > num * 7)
63629 {
63630 frame.Y -= num;
63631 }
63632 }
63633 }
63634 else if (ai[0] == 4f || ai[0] == 5f)
63635 {
63636 if (ai[0] == 4f && ai[2] == 1f)
63637 {
63638 rotation = 0f;
63639 }
63640 frame.Y = num * 13;
63641 frameCounter = 0.0;
63642 }
63643 else
63644 {
63645 if (ai[0] != 4.1f)
63646 {
63647 break;
63648 }
63649 rotation = 0f;
63650 if (frame.Y > num * 6)
63651 {
63652 frameCounter = 0.0;
63653 }
63654 frameCounter += 1.0;
63655 int num82 = 4;
63656 if (frameCounter < (double)num82)
63657 {
63658 frame.Y = num * 6;
63659 break;
63660 }
63661 if (frameCounter < (double)(num82 * 2))
63662 {
63663 frame.Y = num * 5;
63664 break;
63665 }
63666 if (frameCounter < (double)(num82 * 3))
63667 {
63668 frame.Y = num * 4;
63669 break;
63670 }
63671 if (frameCounter < (double)(num82 * 4))
63672 {
63673 frame.Y = num * 3;
63674 break;
63675 }
63676 if (frameCounter < (double)(num82 * 5))
63677 {
63678 frame.Y = num * 4;
63679 break;
63680 }
63681 frame.Y = num * 5;
63682 if (frameCounter >= (double)(num82 * 6 - 1))
63683 {
63684 frameCounter = 0.0;
63685 }
63686 }
63687 break;
63688 case 477:
63689 frameCounter += velocity.Length() / 4f;
63690 frameCounter += 1.0;
63691 if (frameCounter >= 6.0)
63692 {
63693 frameCounter = 0.0;
63694 frame.Y += num;
63695 }
63696 if (frame.Y / num > 5)
63697 {
63698 frame.Y = 0;
63699 }
63700 break;
63701 case 479:
63702 {
63703 frameCounter += 1.0;
63704 int num62 = 4;
63705 if (frameCounter < (double)num62)
63706 {
63707 frame.Y = 0;
63708 }
63709 else if (frameCounter < (double)(num62 * 2))
63710 {
63711 frame.Y = num;
63712 }
63713 else if (frameCounter < (double)(num62 * 3))
63714 {
63715 frame.Y = num * 2;
63716 }
63717 else if (frameCounter < (double)(num62 * 4 - 1))
63718 {
63719 frame.Y = num;
63720 }
63721 else
63722 {
63723 frameCounter = 0.0;
63724 }
63725 break;
63726 }
63727 case 472:
63728 if (velocity.X < 0f)
63729 {
63730 direction = -1;
63731 }
63732 else
63733 {
63734 direction = 1;
63735 }
63736 if (direction == 1)
63737 {
63738 spriteDirection = 1;
63739 }
63740 if (direction == -1)
63741 {
63742 spriteDirection = -1;
63743 }
63744 rotation = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
63745 frameCounter += 1.0;
63746 if (frameCounter > 4.0)
63747 {
63748 frame.Y += num;
63749 frameCounter = 0.0;
63750 }
63751 if (frame.Y / num >= 6)
63752 {
63753 frame.Y = 0;
63754 }
63755 break;
63756 case 449:
63757 case 450:
63758 case 451:
63759 case 452:
63760 if (velocity.Y == 0f)
63761 {
63762 if (direction == 1)
63763 {
63764 spriteDirection = 1;
63765 }
63766 if (direction == -1)
63767 {
63768 spriteDirection = -1;
63769 }
63770 if (ai[2] > 0f)
63771 {
63773 int num176 = 0;
63774 int num177 = Main.npcFrameCount[type] - 5;
63775 int num178 = 5;
63776 int num179 = 7;
63777 num176 = ((ai[1] >= 50f) ? 1 : ((ai[1] >= (float)(50 - num179)) ? 2 : ((ai[1] >= (float)(50 - num179 * 2)) ? 3 : ((ai[1] >= (float)(50 - num179 * 3)) ? 4 : 0))));
63778 frame.Y = num * (num177 + num176);
63779 frameCounter = 0.0;
63780 break;
63781 }
63782 if (velocity.X == 0f)
63783 {
63784 frame.Y = 0;
63785 break;
63786 }
63787 if (frame.Y < num * 2)
63788 {
63789 frame.Y = num * 2;
63790 }
63791 if (frame.Y < num * 2)
63792 {
63793 frame.Y = num * 2;
63794 }
63795 frameCounter += Math.Abs(velocity.X) * 2f;
63796 if (frameCounter > 6.0)
63797 {
63798 frame.Y += num;
63799 frameCounter = 0.0;
63800 }
63801 if (frame.Y / num >= 15)
63802 {
63803 frame.Y = num * 2;
63804 }
63805 }
63806 else
63807 {
63808 frameCounter = 0.0;
63809 frame.Y = num;
63810 }
63811 break;
63812 case 481:
63813 if (velocity.Y == 0f)
63814 {
63815 if (direction == 1)
63816 {
63817 spriteDirection = 1;
63818 }
63819 if (direction == -1)
63820 {
63821 spriteDirection = -1;
63822 }
63823 if (ai[2] > 0f)
63824 {
63826 int num69 = 0;
63827 if (ai[1] < 22f)
63828 {
63829 num69 = -14;
63830 }
63831 else if (ai[1] < 28f)
63832 {
63833 num69 = 3;
63834 }
63835 else if (ai[1] < 34f)
63836 {
63837 num69 = 2;
63838 }
63839 else if (ai[1] < 40f)
63840 {
63841 num69 = 1;
63842 }
63843 frame.Y = num * (15 + num69);
63844 frameCounter = 0.0;
63845 }
63846 else if (velocity.X == 0f)
63847 {
63848 frame.Y = num;
63849 }
63850 else
63851 {
63852 if (frame.Y < num * 2)
63853 {
63854 frame.Y = num * 2;
63855 }
63856 frameCounter += Math.Abs(velocity.X) * 2f;
63857 if (frameCounter > 6.0)
63858 {
63859 frame.Y += num;
63860 frameCounter = 0.0;
63861 }
63862 if (frame.Y / num >= 15)
63863 {
63864 frame.Y = num * 2;
63865 }
63866 }
63867 }
63868 else
63869 {
63870 frameCounter = 0.0;
63871 frame.Y = 0;
63872 }
63873 break;
63874 case 468:
63875 if (velocity.Y == 0f)
63876 {
63877 if (direction == 1)
63878 {
63879 spriteDirection = 1;
63880 }
63881 if (direction == -1)
63882 {
63883 spriteDirection = -1;
63884 }
63885 if (ai[2] > 0f)
63886 {
63888 int num44 = 0;
63889 if (ai[1] < 22f)
63890 {
63891 num44 = -15;
63892 }
63893 else if (ai[1] < 28f)
63894 {
63895 num44 = 3;
63896 }
63897 else if (ai[1] < 34f)
63898 {
63899 num44 = 2;
63900 }
63901 else if (ai[1] < 40f)
63902 {
63903 num44 = 1;
63904 }
63905 frame.Y = num * (15 + num44);
63906 frameCounter = 0.0;
63907 }
63908 else if (velocity.X == 0f)
63909 {
63910 frame.Y = 0;
63911 }
63912 else
63913 {
63914 if (frame.Y < num * 2)
63915 {
63916 frame.Y = num * 2;
63917 }
63918 frameCounter += Math.Abs(velocity.X) * 2f;
63919 if (frameCounter > 6.0)
63920 {
63921 frame.Y += num;
63922 frameCounter = 0.0;
63923 }
63924 if (frame.Y / num >= 15)
63925 {
63926 frame.Y = num * 2;
63927 }
63928 }
63929 }
63930 else
63931 {
63932 frameCounter = 0.0;
63933 frame.Y = num;
63934 }
63935 break;
63936 case 379:
63937 case 380:
63938 if (velocity.Y == 0f)
63939 {
63940 if (direction == 1)
63941 {
63942 spriteDirection = 1;
63943 }
63944 if (direction == -1)
63945 {
63946 spriteDirection = -1;
63947 }
63948 if (ai[2] > 0f)
63949 {
63951 frame.Y = num * ((int)ai[2] - 1 + 2);
63952 frameCounter = 0.0;
63953 break;
63954 }
63955 if (velocity.X == 0f)
63956 {
63957 frame.Y = 0;
63958 break;
63959 }
63960 if (frame.Y < num * 7)
63961 {
63962 frame.Y = num * 7;
63963 }
63964 frameCounter += Math.Abs(velocity.X) * 2f;
63965 if (frameCounter > 6.0)
63966 {
63967 frame.Y += num;
63968 frameCounter = 0.0;
63969 }
63970 if (frame.Y / num >= Main.npcFrameCount[type])
63971 {
63972 frame.Y = num * 7;
63973 }
63974 }
63975 else
63976 {
63977 frameCounter = 0.0;
63978 frame.Y = num;
63979 }
63980 break;
63981 case 381:
63982 case 382:
63983 case 383:
63984 case 385:
63985 case 389:
63986 if (velocity.Y == 0f)
63987 {
63989 if (frame.Y < num * 2)
63990 {
63991 frame.Y = num * 2;
63992 }
63993 if (type == 389 || type == 385)
63994 {
63995 frameCounter += (double)Math.Abs(velocity.X) * 1.2;
63996 }
63997 else
63998 {
63999 frameCounter += Math.Abs(velocity.X) * 2f;
64000 }
64001 if (frameCounter > 6.0)
64002 {
64003 frame.Y += num;
64004 frameCounter = 0.0;
64005 }
64006 if (frame.Y / num >= Main.npcFrameCount[type])
64007 {
64008 frame.Y = num * 2;
64009 }
64010 if (velocity.X == 0f)
64011 {
64012 frame.Y = 0;
64013 }
64014 }
64015 else
64016 {
64017 frameCounter = 0.0;
64018 frame.Y = num;
64019 }
64020 break;
64021 case 387:
64022 if (ai[0] > 0f)
64023 {
64024 frameCounter += 1.0;
64025 if (ai[0] >= 20f)
64026 {
64027 frameCounter += 1.0;
64028 }
64029 if (ai[0] >= 40f)
64030 {
64031 frameCounter += 1.0;
64032 }
64033 if (frameCounter >= 10.0)
64034 {
64035 frameCounter = 0.0;
64036 frame.Y += num;
64037 if (frame.Y >= num * 2)
64038 {
64039 frame.Y = 0;
64040 }
64041 }
64042 break;
64043 }
64044 frameCounter += 1.0;
64045 if (frameCounter >= 15.0)
64046 {
64047 frameCounter = 0.0;
64048 frame.Y += num;
64049 if (frame.Y >= num * 2)
64050 {
64051 frame.Y = 0;
64052 }
64053 }
64054 break;
64055 case 386:
64056 if (ai[2] > 0f)
64057 {
64058 int num71 = (int)ai[2] / 12;
64059 frame.Y = num * (9 + num71 % 2);
64060 }
64061 else if (velocity.Y == 0f)
64062 {
64064 if (frame.Y < num * 2)
64065 {
64066 frame.Y = num * 2;
64067 }
64068 frameCounter += Math.Abs(velocity.X) * 2f;
64069 if (frameCounter > 6.0)
64070 {
64071 frame.Y += num;
64072 frameCounter = 0.0;
64073 }
64074 if (frame.Y / num >= 9)
64075 {
64076 frame.Y = num * 2;
64077 }
64078 if (velocity.X == 0f)
64079 {
64080 frame.Y = 0;
64081 }
64082 }
64083 else
64084 {
64085 frameCounter = 0.0;
64086 frame.Y = num;
64087 }
64088 break;
64089 case 388:
64090 {
64091 frameCounter += 1.0;
64092 int num64 = 6;
64093 if (frameCounter >= (double)num64)
64094 {
64095 frameCounter = 0.0;
64096 frame.Y += num;
64097 if (frame.Y >= num * 2)
64098 {
64099 frame.Y = 0;
64100 }
64101 }
64102 break;
64103 }
64104 case 391:
64105 if (velocity.Y == 0f)
64106 {
64107 if (direction == 1)
64108 {
64109 spriteDirection = -1;
64110 }
64111 if (direction == -1)
64112 {
64113 spriteDirection = 1;
64114 }
64115 if (frame.Y < num)
64116 {
64117 frame.Y = num;
64118 }
64119 frameCounter += Math.Abs(velocity.X) * 0.5f;
64120 if (frameCounter > 6.0)
64121 {
64122 frame.Y += num;
64123 frameCounter = 0.0;
64124 }
64125 if (frame.Y / num >= Main.npcFrameCount[type])
64126 {
64127 frame.Y = num;
64128 }
64129 if (velocity.X == 0f)
64130 {
64131 frame.Y = 0;
64132 }
64133 }
64134 else
64135 {
64136 frameCounter = 0.0;
64137 frame.Y = 0;
64138 }
64139 break;
64140 case 390:
64142 {
64143 frameCounter += Math.Abs(velocity.X) * 0.5f;
64144 if (frameCounter > 6.0)
64145 {
64146 frameCounter = 0.0;
64147 localAI[3] += 1f;
64148 if (localAI[3] >= (float)Main.npcFrameCount[391])
64149 {
64150 localAI[3] = 0f;
64151 }
64152 }
64153 }
64154 if (direction != 0)
64155 {
64157 }
64158 if (ai[2] > 0f)
64159 {
64160 frame.Y = num * ((int)ai[2] - 1);
64161 }
64162 else
64163 {
64164 frame.Y = num * 2;
64165 }
64166 break;
64167 case 393:
64168 {
64169 int num170 = 0;
64170 Vector2 vector2 = ai[2].ToRotationVector2();
64171 num170 = ((vector2.Y > Math.Abs(vector2.X) * 2f) ? 4 : ((vector2.Y > Math.Abs(vector2.X) * 1.5f) ? ((vector2.X > 0f) ? 5 : 3) : ((Math.Abs(vector2.X) > vector2.Y * 2f) ? ((vector2.X > 0f) ? 8 : 0) : ((!(Math.Abs(vector2.X) > vector2.Y * 1.5f)) ? ((vector2.X > 0f) ? 6 : 2) : ((!(vector2.X > 0f)) ? 1 : 7)))));
64172 frame.Y = num * num170;
64173 float num171 = 280f;
64174 float num172 = 140f;
64175 if (ai[3] >= num171 && ai[3] < num171 + num172 && (int)ai[3] % 6 <= 2)
64176 {
64177 frame.Y += num * 9;
64178 }
64179 break;
64180 }
64181 case 394:
64182 {
64183 int num166 = (int)ai[3] - 300;
64184 if (num166 >= 120)
64185 {
64186 num166 -= 120;
64187 if (num166 >= 160)
64188 {
64189 frame.Y = num * (7 - (num166 - 160) / 5);
64190 }
64191 else if (num166 >= 20)
64192 {
64193 frame.Y = num * (num166 / 4 % 4);
64194 }
64195 else
64196 {
64197 frame.Y = num * (4 + num166 / 5);
64198 }
64199 }
64200 else
64201 {
64202 frame.Y = num * 4;
64203 }
64204 break;
64205 }
64206 case 395:
64207 {
64208 float num157 = 20f;
64209 float num158 = 240f;
64210 bool flag9 = ai[3] >= num157 && ai[3] < num157 + num158;
64211 frameCounter += 1.0;
64212 if (frameCounter >= 66.0)
64213 {
64214 frameCounter = 0.0;
64215 }
64216 if (flag9)
64217 {
64218 frameCounter += 1.0;
64219 if (frameCounter >= 54.0 || frameCounter < 36.0)
64220 {
64221 frameCounter = 36.0;
64222 }
64223 }
64224 int num159 = (int)frameCounter % 66;
64225 num159 /= 6;
64226 frame.Y = num * num159;
64227 break;
64228 }
64229 case 392:
64230 {
64231 float num84 = 20f;
64232 float num85 = 240f;
64233 bool flag8 = ai[3] >= num84 && ai[3] < num84 + num85;
64234 frameCounter += 1.0;
64235 if (flag8)
64236 {
64237 frameCounter += 1.0;
64238 }
64239 if (frameCounter >= 12.0)
64240 {
64241 frameCounter = 0.0;
64242 }
64243 int num86 = (int)frameCounter % 12;
64244 num86 /= 3;
64245 frame.Y = num * num86;
64246 break;
64247 }
64248 case 399:
64249 frameCounter = (frameCounter + 0.25) % 4.0 + (double)((ai[0] != 0f) ? 4 : 0);
64250 frame.Y = num * (int)frameCounter;
64251 break;
64252 case 520:
64253 if (velocity.Y == 0f)
64254 {
64256 frameCounter += Math.Abs(velocity.X) * 1f;
64257 if (frameCounter > 6.0)
64258 {
64259 if (Math.Abs(velocity.X) < 0.2f)
64260 {
64261 frame.Y = 0;
64262 frameCounter = 0.0;
64263 }
64264 else
64265 {
64266 frame.Y += num;
64267 frameCounter = 0.0;
64268 }
64269 }
64270 if (frame.Y / num >= Main.npcFrameCount[type])
64271 {
64272 frame.Y = num;
64273 }
64274 if (velocity.X == 0f)
64275 {
64276 frame.Y = 0;
64277 }
64278 }
64279 else
64280 {
64281 frameCounter = 0.0;
64282 frame.Y = num;
64283 }
64284 break;
64285 case 398:
64286 {
64287 if (ai[0] <= 0f)
64288 {
64289 frame.Y = 0;
64290 break;
64291 }
64292 if (frame.Y == 0)
64293 {
64294 Gore.NewGore(position + new Vector2(-10f, -15f), velocity, 619);
64295 Gore.NewGore(position + new Vector2(10f, -15f), velocity, 620);
64296 Gore.NewGore(position + new Vector2(-10f, 15f), velocity, 621);
64297 Gore.NewGore(position + new Vector2(10f, 15f), velocity, 622);
64298 for (int i = 0; i < 50; i++)
64299 {
64300 frame.Y = num;
64302 }
64303 }
64304 frameCounter += 1.0;
64305 if (frameCounter >= 30.0)
64306 {
64307 frameCounter = 6.0;
64308 }
64309 int num67 = (int)frameCounter % 30;
64310 num67 /= 6;
64311 frame.Y = num * num67;
64312 break;
64313 }
64314 case 397:
64315 {
64316 int num48 = (int)frameCounter / 7;
64317 frame.Y = num * num48;
64318 break;
64319 }
64320 case 400:
64321 {
64322 frameCounter += 1.0;
64323 if (ai[0] == 0f || ai[0] == 3f)
64324 {
64325 frameCounter += 1.0;
64326 }
64327 if (frameCounter >= 16.0)
64328 {
64329 frameCounter = 0.0;
64330 }
64331 int num49 = (int)frameCounter % 16;
64332 num49 /= 4;
64333 frame.Y = num * num49;
64334 break;
64335 }
64336 case 437:
64337 {
64338 frameCounter += 1.0;
64339 if (frameCounter >= 20.0)
64340 {
64341 frameCounter = 0.0;
64342 }
64343 int num42 = (int)frameCounter % 20;
64344 num42 /= 5;
64345 frame.Y = num * num42;
64346 break;
64347 }
64348 case 438:
64349 {
64350 frameCounter += 1.0;
64351 if (ai[1] == 1f)
64352 {
64353 frameCounter += 1.0;
64354 }
64355 if (frameCounter >= 49.0)
64356 {
64357 frameCounter = 0.0;
64358 }
64359 int num235 = (int)frameCounter % 49;
64360 num235 /= 7;
64361 if (num235 >= 4)
64362 {
64363 num235 = 6 - num235;
64364 }
64365 frame.Y = num * num235;
64366 break;
64367 }
64368 case 439:
64369 case 440:
64370 {
64371 int num43 = (int)localAI[2];
64373 {
64374 if (frameCounter > 5.0)
64375 {
64376 frameCounter = 0.0;
64377 frame.Y += num;
64378 }
64379 if (frame.Y < num * 4 || frame.Y > num * 6)
64380 {
64381 frame.Y = num * 4;
64382 }
64383 }
64384 else
64385 {
64386 switch (num43)
64387 {
64388 case 0:
64389 if (frameCounter >= 15.0)
64390 {
64391 frameCounter = 0.0;
64392 frame.Y = 0;
64393 }
64394 else if (frame.Y != 0)
64395 {
64396 frame.Y = ((int)frameCounter / 5 + 4) * num;
64397 }
64398 break;
64399 case 10:
64400 if (frameCounter >= 15.0)
64401 {
64402 frameCounter = 0.0;
64403 }
64404 frame.Y = ((int)frameCounter / 5 + 4) * num;
64405 break;
64406 case 1:
64407 if (frameCounter >= 15.0)
64408 {
64409 frameCounter = 0.0;
64410 frame.Y = num;
64411 }
64412 else if (frame.Y != num)
64413 {
64414 frame.Y = ((int)frameCounter / 5 + 10) * num;
64415 }
64416 break;
64417 case 11:
64418 if (frameCounter >= 15.0)
64419 {
64420 frameCounter = 0.0;
64421 }
64422 frame.Y = ((int)frameCounter / 5 + 10) * num;
64423 break;
64424 case 2:
64425 if (frameCounter >= 15.0)
64426 {
64427 frameCounter = 0.0;
64428 frame.Y = num * 2;
64429 }
64430 else if (frame.Y != num * 2)
64431 {
64432 frame.Y = ((int)frameCounter / 5 + 7) * num;
64433 }
64434 break;
64435 case 12:
64436 if (frameCounter >= 15.0)
64437 {
64438 frameCounter = 0.0;
64439 }
64440 frame.Y = ((int)frameCounter / 5 + 7) * num;
64441 break;
64442 case 13:
64443 if (frameCounter >= 15.0)
64444 {
64445 frameCounter = 0.0;
64446 }
64447 frame.Y = ((int)frameCounter / 5 + 13) * num;
64448 break;
64449 }
64450 }
64451 frameCounter += 1.0;
64452 break;
64453 }
64454 case 521:
64455 if (velocity.X < 0f)
64456 {
64457 direction = -1;
64458 }
64459 else
64460 {
64461 direction = 1;
64462 }
64463 if (direction != 0)
64464 {
64466 }
64467 rotation = (float)Math.Atan2(velocity.Y * (float)spriteDirection, velocity.X * (float)spriteDirection) + velocity.X * 0.1f;
64468 if ((frameCounter += 1.0) >= 5.0)
64469 {
64470 frame.Y += num;
64471 frameCounter = 0.0;
64472 if (frame.Y / num >= Main.npcFrameCount[type])
64473 {
64474 frame.Y = 0;
64475 }
64476 }
64477 break;
64478 case 523:
64479 if ((frameCounter += 1.0) >= 6.0)
64480 {
64481 frame.Y += num;
64482 frameCounter = 0.0;
64483 if (frame.Y / num >= Main.npcFrameCount[type])
64484 {
64485 frame.Y = 0;
64486 }
64487 }
64488 break;
64489 case 371:
64490 case 372:
64491 case 373:
64492 frame.Y = num;
64493 break;
64494 case 370:
64495 {
64496 if (ai[0] == 0f || ai[0] == 5f)
64497 {
64498 int num73 = 5;
64499 if (ai[0] == 5f)
64500 {
64501 num73 = 4;
64502 }
64503 frameCounter += 1.0;
64504 if (frameCounter > (double)num73)
64505 {
64506 frameCounter = 0.0;
64507 frame.Y += num;
64508 }
64509 if (frame.Y >= num * 6)
64510 {
64511 frame.Y = 0;
64512 }
64513 }
64514 if (ai[0] == 1f || ai[0] == 6f)
64515 {
64516 if (ai[2] < 10f)
64517 {
64518 frame.Y = num * 6;
64519 }
64520 else
64521 {
64522 frame.Y = num * 7;
64523 }
64524 }
64525 if (ai[0] == 2f || ai[0] == 7f)
64526 {
64527 if (ai[2] < 10f)
64528 {
64529 frame.Y = num * 6;
64530 }
64531 else
64532 {
64533 frame.Y = num * 7;
64534 }
64535 }
64536 if (ai[0] == 3f || ai[0] == 8f || ai[0] == -1f)
64537 {
64538 int num74 = 90;
64539 if (ai[2] < (float)(num74 - 30) || ai[2] > (float)(num74 - 10))
64540 {
64541 frameCounter += 1.0;
64542 if (frameCounter > 5.0)
64543 {
64544 frameCounter = 0.0;
64545 frame.Y += num;
64546 }
64547 if (frame.Y >= num * 6)
64548 {
64549 frame.Y = 0;
64550 }
64551 }
64552 else
64553 {
64554 frame.Y = num * 6;
64555 if (ai[2] > (float)(num74 - 20) && ai[2] < (float)(num74 - 15))
64556 {
64557 frame.Y = num * 7;
64558 }
64559 }
64560 }
64561 if (ai[0] != 4f && ai[0] != 9f)
64562 {
64563 break;
64564 }
64565 int num75 = 180;
64566 if (ai[2] < (float)(num75 - 60) || ai[2] > (float)(num75 - 20))
64567 {
64568 frameCounter += 1.0;
64569 if (frameCounter > 5.0)
64570 {
64571 frameCounter = 0.0;
64572 frame.Y += num;
64573 }
64574 if (frame.Y >= num * 6)
64575 {
64576 frame.Y = 0;
64577 }
64578 }
64579 else
64580 {
64581 frame.Y = num * 6;
64582 if (ai[2] > (float)(num75 - 50) && ai[2] < (float)(num75 - 25))
64583 {
64584 frame.Y = num * 7;
64585 }
64586 }
64587 break;
64588 }
64589 case 359:
64590 case 360:
64591 case 655:
64592 {
64593 if (velocity.Y > 1f)
64594 {
64595 frameCounter += 1.0;
64596 int num65 = 6;
64597 if (frameCounter < (double)num65)
64598 {
64599 frame.Y = num * 4;
64600 break;
64601 }
64602 frame.Y = num * 5;
64603 if (frameCounter >= (double)(num65 * 2 - 1))
64604 {
64605 frameCounter = 0.0;
64606 }
64607 break;
64608 }
64609 frameCounter += 1.0;
64610 int num66 = 10;
64611 if (frameCounter < (double)num66)
64612 {
64613 frame.Y = 0;
64614 break;
64615 }
64616 if (frameCounter < (double)(num66 * 2))
64617 {
64618 frame.Y = num;
64619 break;
64620 }
64621 if (frameCounter < (double)(num66 * 3))
64622 {
64623 frame.Y = num * 2;
64624 break;
64625 }
64626 if (frameCounter < (double)(num66 * 4))
64627 {
64628 frame.Y = num * 3;
64629 break;
64630 }
64631 if (frameCounter < (double)(num66 * 5))
64632 {
64633 frame.Y = num * 2;
64634 break;
64635 }
64636 frame.Y = num;
64637 if (frameCounter >= (double)(num66 * 6 - 1))
64638 {
64639 frameCounter = 0.0;
64640 }
64641 break;
64642 }
64643 case 327:
64644 if (ai[3] == 0f)
64645 {
64646 if (frame.Y > num * 5)
64647 {
64648 frameCounter += 1.0;
64649 }
64650 else if (frame.Y > 0)
64651 {
64652 frameCounter -= 1.0;
64653 }
64654 }
64655 else if (ai[3] == 1f)
64656 {
64657 if (frame.Y > num * 10)
64658 {
64659 frameCounter += 1.0;
64660 }
64661 else if (frame.Y > num * 4)
64662 {
64663 frameCounter -= 1.0;
64664 }
64665 else if (frame.Y < num * 4)
64666 {
64667 frameCounter += 1.0;
64668 }
64669 }
64670 else if (ai[3] == 2f)
64671 {
64672 if (frame.Y < num * 2)
64673 {
64674 frameCounter -= 1.0;
64675 }
64676 else if (frame.Y > num * 8)
64677 {
64678 frameCounter -= 1.0;
64679 }
64680 else if (frame.Y < num * 8)
64681 {
64682 frameCounter += 1.0;
64683 }
64684 }
64685 if (frameCounter > 6.0)
64686 {
64687 frameCounter = 0.0;
64688 frame.Y += num;
64689 if (frame.Y > num * 11)
64690 {
64691 frame.Y = 0;
64692 }
64693 }
64694 if (frameCounter < 0.0)
64695 {
64696 frameCounter = 6.0;
64697 frame.Y -= num;
64698 if (frame.Y < 0)
64699 {
64700 frame.Y = num * 11;
64701 }
64702 }
64703 break;
64704 case 347:
64705 frameCounter += 1.0;
64706 if (frameCounter > 1.0)
64707 {
64708 frame.Y += num;
64709 frameCounter = 0.0;
64710 }
64711 if (frame.Y > num * 3)
64712 {
64713 frame.Y = 0;
64714 }
64715 break;
64716 case 346:
64717 if (ai[0] == 1f)
64718 {
64720 frameCounter += 1.0;
64721 if (frameCounter > 2.0)
64722 {
64723 frame.Y += num;
64724 frameCounter = 0.0;
64725 }
64726 if (frame.Y > num * 8)
64727 {
64728 frame.Y = num * 6;
64729 }
64730 if (frame.Y < num * 6)
64731 {
64732 frame.Y = num * 6;
64733 }
64734 break;
64735 }
64736 if (velocity.X == 0f)
64737 {
64738 ref int y3 = ref frame.Y;
64739 y3 = y3;
64740 frameCounter = 0.0;
64741 break;
64742 }
64744 frameCounter += 1.0;
64745 frameCounter += Math.Abs(velocity.X) / 2f;
64746 if (frameCounter > 4.0)
64747 {
64748 frame.Y += num;
64749 frameCounter = 0.0;
64750 }
64751 if (frame.Y > num * 5)
64752 {
64753 frame.Y = num;
64754 }
64755 if (frame.Y < num)
64756 {
64757 frame.Y = num;
64758 }
64759 break;
64760 case 352:
64761 frameCounter += 1.0;
64762 if (frameCounter > 3.0)
64763 {
64764 frame.Y += num;
64765 frameCounter = 0.0;
64766 }
64767 if (frame.Y > num * 5)
64768 {
64769 frame.Y = 0;
64770 }
64771 break;
64772 case 345:
64773 if (ai[0] == 0f)
64774 {
64775 if (ai[3] >= 0f)
64776 {
64777 frame.Y = 0;
64778 }
64779 else if (velocity.X < 0f)
64780 {
64781 frame.Y = num;
64782 }
64783 else
64784 {
64785 frame.Y = num * 2;
64786 }
64787 }
64788 else if (ai[0] == 1f)
64789 {
64790 frameCounter += 1.0;
64791 if (frameCounter > 5.0)
64792 {
64793 frameCounter = 0.0;
64794 frame.Y += num;
64795 }
64796 if (frame.Y > num * 4)
64797 {
64798 frame.Y = num * 3;
64799 }
64800 if (frame.Y < num * 3)
64801 {
64802 frame.Y = num * 3;
64803 }
64804 }
64805 else if (ai[0] == 2f)
64806 {
64807 frame.Y = num * 5;
64808 }
64809 break;
64810 case 344:
64811 if (velocity.X == 0f)
64812 {
64813 frameCounter += 1.0;
64814 if (frameCounter > 5.0)
64815 {
64816 frameCounter = 0.0;
64817 frame.Y += num;
64818 }
64819 if (frame.Y > num * 9)
64820 {
64821 frame.Y = 0;
64822 }
64823 }
64824 else
64825 {
64826 frameCounter += Math.Max(1f, Math.Abs(velocity.X) * 0.75f);
64827 if (frameCounter > 5.0)
64828 {
64829 frameCounter = 0.0;
64830 frame.Y += num;
64831 }
64832 if (frame.Y > num * 9)
64833 {
64834 frame.Y = 0;
64835 }
64836 }
64837 break;
64838 case 325:
64839 if (velocity.X == 0f)
64840 {
64841 frameCounter += 1.0;
64842 if (frameCounter > 4.0)
64843 {
64844 frameCounter = 0.0;
64845 frame.Y += num;
64846 }
64847 if (frame.Y > num * 4)
64848 {
64849 frame.Y = 0;
64850 }
64851 break;
64852 }
64853 frameCounter += 1.0;
64854 if (frameCounter > 4.0)
64855 {
64856 frameCounter = 0.0;
64857 frame.Y += num;
64858 }
64859 if (frame.Y < num * 5)
64860 {
64861 frame.Y = num * 5;
64862 }
64863 if (frame.Y > num * 9)
64864 {
64865 frame.Y = num * 5;
64866 }
64867 break;
64868 case 490:
64869 rotation = velocity.X * 0.15f;
64870 frameCounter += 1.0;
64871 if (frameCounter > 6.0)
64872 {
64873 frameCounter = 0.0;
64874 frame.Y += num;
64875 }
64876 if (frame.Y >= num * Main.npcFrameCount[type])
64877 {
64878 frame.Y = 0;
64879 }
64880 break;
64881 case 266:
64882 frameCounter += 1.0;
64883 if (frameCounter > 6.0)
64884 {
64885 frameCounter = 0.0;
64886 frame.Y += num;
64887 }
64888 if (ai[0] >= 0f)
64889 {
64890 if (frame.Y > num * 3)
64891 {
64892 frame.Y = 0;
64893 }
64894 break;
64895 }
64896 if (frame.Y < num * 4)
64897 {
64898 frame.Y = num * 4;
64899 }
64900 if (frame.Y > num * 7)
64901 {
64902 frame.Y = num * 4;
64903 }
64904 break;
64905 case 262:
64906 frameCounter += 1.0;
64907 if (frameCounter > 6.0)
64908 {
64909 frameCounter = 0.0;
64910 frame.Y += num;
64911 }
64912 if (life > lifeMax / 2)
64913 {
64914 if (frame.Y > num * 3)
64915 {
64916 frame.Y = 0;
64917 }
64918 break;
64919 }
64920 if (frame.Y < num * 4)
64921 {
64922 frame.Y = num * 4;
64923 }
64924 if (frame.Y > num * 7)
64925 {
64926 frame.Y = num * 4;
64927 }
64928 break;
64929 case 305:
64930 case 306:
64931 case 307:
64932 case 308:
64933 case 309:
64934 if (velocity.Y == 0f)
64935 {
64937 }
64938 if (velocity.Y < -3f)
64939 {
64940 frame.Y = num * 5;
64941 }
64942 else if (velocity.Y <= 0f)
64943 {
64944 frame.Y = 0;
64945 }
64946 else if (velocity.Y < 2f)
64947 {
64948 frame.Y = num * 3;
64949 }
64950 else
64951 {
64952 frame.Y = num;
64953 }
64954 rotation = velocity.X * 0.1f;
64955 break;
64956 case 263:
64957 if (velocity.X == 0f && velocity.Y == 0f)
64958 {
64959 if (frame.Y > 0)
64960 {
64961 frameCounter += 1.0;
64962 if (frameCounter > 4.0)
64963 {
64964 frameCounter = 0.0;
64965 frame.Y -= num;
64966 }
64967 }
64968 }
64969 else if (frame.Y < 2)
64970 {
64971 frameCounter += 1.0;
64972 if (frameCounter > 4.0)
64973 {
64974 frameCounter = 0.0;
64975 frame.Y += num;
64976 }
64977 }
64978 break;
64979 case 244:
64980 frameCounter += 1.0;
64981 if (num2 > 0)
64982 {
64983 frameCounter += 1.0;
64984 }
64985 if (num2 == 4)
64986 {
64987 frameCounter += 1.0;
64988 }
64989 if (frameCounter >= 8.0)
64990 {
64991 frame.Y += num;
64992 frameCounter = 0.0;
64993 }
64994 if (frame.Y >= num * Main.npcFrameCount[type])
64995 {
64996 frame.Y = 0;
64997 }
64998 break;
64999 case 289:
65000 frameCounter += 1.0;
65001 if (frameCounter < 4.0)
65002 {
65003 frame.Y = 0;
65004 }
65005 else if (frameCounter < 8.0)
65006 {
65007 frame.Y = num;
65008 }
65009 else
65010 {
65011 frame.Y = num * 2;
65012 frameCounter = 0.0;
65013 if (frameCounter > 12.0)
65014 {
65015 frameCounter = 0.0;
65016 }
65017 }
65018 if (ai[3] == 1f)
65019 {
65020 frame.Y += num * 3;
65021 }
65022 break;
65023 case 288:
65024 frameCounter += 1.0;
65025 if (frameCounter >= 6.0)
65026 {
65027 frame.Y += num;
65028 frameCounter = 0.0;
65029 }
65030 if (frame.Y >= num * Main.npcFrameCount[type])
65031 {
65032 frame.Y = 0;
65033 }
65034 break;
65035 case 355:
65036 case 358:
65037 case 654:
65039 frameCounter += 1.0;
65040 if (frameCounter < 4.0)
65041 {
65042 frame.Y = 0;
65043 }
65044 else
65045 {
65046 frame.Y = num;
65047 if (frameCounter >= 7.0)
65048 {
65049 frameCounter = 0.0;
65050 }
65051 }
65052 if (localAI[2] <= 0f)
65053 {
65054 frame.Y += num * 2;
65055 }
65056 break;
65057 case 677:
65059 frameCounter += 1.0;
65060 if ((frameCounter += 1.0) >= 6.0)
65061 {
65062 frameCounter = 0.0;
65063 if (++frame.Y >= 5)
65064 {
65065 frame.Y = 0;
65066 }
65067 }
65068 break;
65069 case 595:
65070 case 596:
65071 case 597:
65072 case 598:
65073 case 599:
65074 case 600:
65075 case 601:
65076 {
65078 int num218 = 3;
65079 if ((frameCounter += 1.0) >= (double)(Main.npcFrameCount[type] * num218))
65080 {
65081 frameCounter = 0.0;
65082 }
65083 frame.Y = num * ((int)frameCounter / num218);
65084 break;
65085 }
65086 case 356:
65087 case 444:
65088 case 653:
65089 case 661:
65090 {
65091 int num183 = 7;
65092 rotation = velocity.X * 0.3f;
65094 frameCounter = frameCounter + 1.0 + (double)((Math.Abs(velocity.X) + Math.Abs(velocity.Y)) / 2f);
65095 if (frameCounter < (double)num183)
65096 {
65097 frame.Y = 0;
65098 }
65099 else if (frameCounter < (double)(num183 * 2))
65100 {
65101 frame.Y = num;
65102 }
65103 else if (frameCounter < (double)(num183 * 3))
65104 {
65105 frame.Y = num * 2;
65106 }
65107 else
65108 {
65109 frame.Y = num;
65110 if (frameCounter >= (double)(num183 * 4 - 1))
65111 {
65112 frameCounter = 0.0;
65113 }
65114 }
65115 if (type != 444 && type != 653 && type != 661)
65116 {
65117 frame.Y += (int)((float)(num * 3) * (ai[2] - 1f));
65118 }
65119 break;
65120 }
65121 case 357:
65122 case 448:
65123 case 484:
65124 case 606:
65125 {
65126 localAI[0] = -2f;
65127 if (velocity.Y == 0f)
65128 {
65129 rotation = 0f;
65130 if (velocity.X == 0f)
65131 {
65132 frame.Y = num;
65133 frameCounter = 0.0;
65134 }
65135 else
65136 {
65137 frameCounter += 1.0;
65138 if (frameCounter > 12.0)
65139 {
65140 frameCounter = 0.0;
65141 frame.Y += num;
65142 if (frame.Y > num)
65143 {
65144 frame.Y = 0;
65145 }
65146 }
65147 }
65148 }
65149 else
65150 {
65151 rotation += (float)direction * 0.1f;
65152 frame.Y = num;
65153 }
65154 int i3 = (int)base.Center.X / 16;
65155 int j3 = (int)position.Y / 16;
65157 if (tileSafely2 != null)
65158 {
65159 if (tileSafely2.slope() == 0)
65160 {
65161 j3++;
65163 }
65164 if (tileSafely2.slope() == 1)
65165 {
65166 rotation = 0.785f;
65167 localAI[0] = 0f;
65168 }
65169 else if (tileSafely2.slope() == 2)
65170 {
65171 rotation = -0.785f;
65172 localAI[0] = 0f;
65173 }
65174 }
65175 break;
65176 }
65177 case 485:
65178 case 486:
65179 case 487:
65180 {
65182 localAI[0] = -2f;
65183 if (velocity.Y == 0f)
65184 {
65185 rotation = 0f;
65186 if (velocity.X == 0f)
65187 {
65188 frame.Y = num;
65189 frameCounter = 0.0;
65190 }
65191 else
65192 {
65193 frameCounter += Math.Abs(velocity.X * 5f);
65194 if (frameCounter > 10.0)
65195 {
65196 frameCounter = 0.0;
65197 frame.Y += num;
65198 if (frame.Y > num * 3)
65199 {
65200 frame.Y = 0;
65201 }
65202 }
65203 }
65204 }
65205 else
65206 {
65207 rotation += (float)direction * 0.1f;
65208 frame.Y = num;
65209 }
65210 int i2 = (int)base.Center.X / 16;
65211 int j2 = (int)position.Y / 16;
65213 if (tileSafely != null)
65214 {
65215 if (tileSafely.slope() == 0)
65216 {
65217 j2++;
65219 }
65220 if (tileSafely.slope() == 1)
65221 {
65222 rotation = 0.785f;
65223 localAI[0] = 0f;
65224 }
65225 else if (tileSafely.slope() == 2)
65226 {
65227 rotation = -0.785f;
65228 localAI[0] = 0f;
65229 }
65230 }
65231 break;
65232 }
65233 case 250:
65234 case 264:
65235 case 268:
65236 frameCounter += 1.0;
65237 if (frameCounter >= 6.0)
65238 {
65239 frame.Y += num;
65240 frameCounter = 0.0;
65241 }
65242 if (frame.Y >= num * Main.npcFrameCount[type])
65243 {
65244 frame.Y = 0;
65245 }
65246 break;
65247 case 245:
65248 if (ai[0] == 0f)
65249 {
65250 if (ai[1] < -16f)
65251 {
65252 frame.Y = 0;
65253 }
65254 else if (ai[1] < -12f)
65255 {
65256 frame.Y = num;
65257 }
65258 else if (ai[1] < -8f)
65259 {
65260 frame.Y = num * 2;
65261 }
65262 else if (ai[1] < -4f)
65263 {
65264 frame.Y = num * 3;
65265 }
65266 else if (ai[1] < 0f)
65267 {
65268 frame.Y = num * 4;
65269 }
65270 else
65271 {
65272 frame.Y = 0;
65273 }
65274 }
65275 else if (ai[0] == 1f)
65276 {
65277 frame.Y = 1;
65278 }
65279 break;
65280 case 246:
65281 if (ai[0] == 0f)
65282 {
65283 if (localAI[0] == 1f)
65284 {
65285 frame.Y = num;
65286 }
65287 else
65288 {
65289 frame.Y = 0;
65290 }
65291 }
65292 else if (ai[0] == 1f)
65293 {
65294 if (localAI[0] == 1f)
65295 {
65296 frame.Y = num;
65297 }
65298 else
65299 {
65300 frame.Y = 0;
65301 }
65302 if (localAI[1] == -1f)
65303 {
65304 frame.Y += num * 4;
65305 }
65306 if (localAI[1] == 1f)
65307 {
65308 frame.Y += num * 2;
65309 }
65310 }
65311 break;
65312 case 249:
65313 if (localAI[0] == 1f)
65314 {
65315 frame.Y = num;
65316 }
65317 else
65318 {
65319 frame.Y = 0;
65320 }
65321 if ((frameCounter += 1.0) >= 16.0)
65322 {
65323 frameCounter = 0.0;
65324 }
65325 break;
65326 case 141:
65328 if (velocity.Y != 0f)
65329 {
65330 frame.Y = num * 2;
65331 break;
65332 }
65333 frameCounter += 1.0;
65334 if (frameCounter >= 8.0)
65335 {
65336 frame.Y += num;
65337 frameCounter = 0.0;
65338 }
65339 if (frame.Y > num)
65340 {
65341 frame.Y = 0;
65342 }
65343 break;
65344 case 243:
65345 if (frameCounter < 0.0)
65346 {
65347 if (velocity.Y == 0f)
65348 {
65349 frameCounter += 1.0;
65350 if (frameCounter < -12.0)
65351 {
65352 if (frame.Y > num * 9)
65353 {
65354 frame.Y = num * 11;
65355 }
65356 }
65357 else if (frameCounter < -6.0)
65358 {
65359 if (frame.Y > num * 9)
65360 {
65361 frame.Y = num * 12;
65362 }
65363 }
65364 else if (frameCounter < 0.0)
65365 {
65366 frameCounter = 0.0;
65367 if (frame.Y > num * 9)
65368 {
65369 frame.Y = num * 11;
65370 }
65371 }
65372 }
65373 else
65374 {
65375 frameCounter = -18.0;
65376 if (velocity.Y < 0f)
65377 {
65378 frame.Y = num * 14;
65379 }
65380 else
65381 {
65382 frame.Y = num * 13;
65383 }
65384 }
65385 break;
65386 }
65388 frameCounter += Math.Abs(velocity.X * 1.1f);
65389 if (frameCounter >= 6.0)
65390 {
65391 frameCounter = 0.0;
65392 frame.Y += num;
65393 if (frame.Y > num * 9)
65394 {
65395 frame.Y = 0;
65396 }
65397 }
65398 if (velocity.Y < -2f || velocity.Y > 5f)
65399 {
65400 frameCounter = -18.0;
65401 }
65402 break;
65403 case 222:
65404 frameCounter += 1.0;
65405 if (localAI[0] == 1f)
65406 {
65407 if (frameCounter > 4.0)
65408 {
65409 frame.Y += num;
65410 frameCounter = 0.0;
65411 }
65412 if (frame.Y >= num * 4)
65413 {
65414 frame.Y = 0;
65415 }
65416 break;
65417 }
65418 if (frameCounter > 4.0)
65419 {
65420 frame.Y += num;
65421 frameCounter = 0.0;
65422 }
65423 if (frame.Y < num * 4)
65424 {
65425 frame.Y = num * 4;
65426 }
65427 if (frame.Y >= num * 12)
65428 {
65429 frame.Y = num * 4;
65430 }
65431 break;
65432 case 164:
65433 case 236:
65434 case 239:
65435 case 530:
65436 if (velocity.Y != 0f)
65437 {
65438 frameCounter = 0.0;
65439 if (velocity.Y < 0f)
65440 {
65441 frame.Y = num * 4;
65442 }
65443 else
65444 {
65445 frame.Y = 0;
65446 }
65447 break;
65448 }
65450 frameCounter += Math.Abs(velocity.X) * 1.1f;
65451 while (frameCounter >= 6.0)
65452 {
65453 frameCounter -= 6.0;
65454 frame.Y += num;
65455 if (frame.Y > num * 3)
65456 {
65457 frame.Y = 0;
65458 }
65459 }
65460 break;
65461 case 165:
65462 case 237:
65463 case 238:
65464 case 240:
65465 case 531:
65466 {
65467 float num217 = 0.5f;
65468 if (type == 531)
65469 {
65470 num217 = 0.4f;
65471 }
65473 if (frameCounter < 6.0)
65474 {
65475 frame.Y = 0;
65476 }
65477 else if (frameCounter < 12.0)
65478 {
65479 frame.Y = num;
65480 }
65481 else if (frameCounter < 18.0)
65482 {
65483 frame.Y = num * 2;
65484 }
65485 else if (frameCounter < 24.0)
65486 {
65487 frame.Y = num * 3;
65488 }
65489 else
65490 {
65491 frameCounter = 0.0;
65492 }
65493 break;
65494 }
65495 case 195:
65496 if (ai[0] < 3f)
65497 {
65498 frame.Y = 0;
65499 }
65500 else if (ai[0] < 6f)
65501 {
65502 frame.Y = num;
65503 }
65504 else if (ai[0] < 9f)
65505 {
65506 frame.Y = num * 2;
65507 }
65508 else if (ai[0] < 12f)
65509 {
65510 frame.Y = num * 3;
65511 }
65512 else if (ai[0] < 15f)
65513 {
65514 frame.Y = num * 4;
65515 }
65516 else
65517 {
65518 frame.Y = num * 5;
65519 }
65520 break;
65521 case 174:
65523 {
65524 frameCounter += 1.0;
65525 if (frameCounter > 5.0)
65526 {
65527 frameCounter = 0.0;
65528 frame.Y += num;
65529 }
65530 if (frame.Y > num * 4)
65531 {
65532 frame.Y = 0;
65533 }
65534 }
65535 else if (velocity.Y == 0f)
65536 {
65537 frame.Y = 0;
65538 }
65539 else if ((double)velocity.Y < -1.5)
65540 {
65541 frame.Y = num;
65542 }
65543 else if ((double)velocity.Y > 1.5)
65544 {
65545 frame.Y = num * 3;
65546 }
65547 else
65548 {
65549 frame.Y = num * 2;
65550 }
65551 break;
65552 case 177:
65553 if (velocity.Y == 0f)
65554 {
65555 frameCounter += 1.0;
65556 if (frameCounter >= 10.0)
65557 {
65558 frameCounter = 30.0;
65559 frame.Y = 0;
65560 }
65561 else
65562 {
65563 frame.Y = num;
65564 }
65565 }
65566 else if (velocity.Y < 0f)
65567 {
65568 frame.Y = num * 2;
65569 }
65570 else
65571 {
65572 frameCounter = 0.0;
65573 frame.Y = num * 2;
65574 }
65575 break;
65576 case 163:
65577 if (velocity.Y != 0f)
65578 {
65579 frameCounter = -12.0;
65580 if (velocity.Y < 0f)
65581 {
65582 frame.Y = num * 5;
65583 }
65584 else
65585 {
65586 frame.Y = num * 6;
65587 }
65588 break;
65589 }
65591 frameCounter += Math.Abs(velocity.X) * 1.1f;
65592 if (frameCounter < -6.0)
65593 {
65594 frame.Y = num * 6;
65595 }
65596 else if (frameCounter < 0.0)
65597 {
65598 frame.Y = num * 7;
65599 }
65600 else if (frameCounter < 6.0)
65601 {
65602 frame.Y = num;
65603 }
65604 else if (frameCounter < 12.0)
65605 {
65606 frame.Y = num * 2;
65607 }
65608 else if (frameCounter < 18.0)
65609 {
65610 frame.Y = num * 3;
65611 }
65612 else
65613 {
65614 frameCounter = 0.0;
65615 }
65616 break;
65617 case 143:
65618 if (velocity.Y > 0f)
65619 {
65620 frameCounter += 1.0;
65621 }
65622 else if (velocity.Y < 0f)
65623 {
65624 frameCounter -= 1.0;
65625 }
65626 if (frameCounter < 6.0)
65627 {
65628 frame.Y = num;
65629 }
65630 else if (frameCounter < 12.0)
65631 {
65632 frame.Y = num * 2;
65633 }
65634 else if (frameCounter < 18.0)
65635 {
65636 frame.Y = num * 3;
65637 }
65638 if (frameCounter < 0.0)
65639 {
65640 frameCounter = 0.0;
65641 }
65642 if (frameCounter > 17.0)
65643 {
65644 frameCounter = 17.0;
65645 }
65646 break;
65647 case 144:
65648 if (velocity.X == 0f && velocity.Y == 0f)
65649 {
65650 localAI[3] += 1f;
65651 if (localAI[3] < 6f)
65652 {
65653 frame.Y = 0;
65654 }
65655 else if (localAI[3] < 12f)
65656 {
65657 frame.Y = num;
65658 }
65659 if (localAI[3] >= 11f)
65660 {
65661 localAI[3] = 0f;
65662 }
65663 break;
65664 }
65665 if (velocity.Y > 0f)
65666 {
65667 frameCounter += 1.0;
65668 }
65669 else if (velocity.Y < 0f)
65670 {
65671 frameCounter -= 1.0;
65672 }
65673 if (frameCounter < 6.0)
65674 {
65675 frame.Y = num * 2;
65676 }
65677 else if (frameCounter < 12.0)
65678 {
65679 frame.Y = num * 3;
65680 }
65681 else if (frameCounter < 18.0)
65682 {
65683 frame.Y = num * 4;
65684 }
65685 if (frameCounter < 0.0)
65686 {
65687 frameCounter = 0.0;
65688 }
65689 if (frameCounter > 17.0)
65690 {
65691 frameCounter = 17.0;
65692 }
65693 break;
65694 case 145:
65695 if (velocity.X == 0f && velocity.Y == 0f)
65696 {
65697 if (ai[2] < 4f)
65698 {
65699 frame.Y = 0;
65700 }
65701 else if (ai[2] < 8f)
65702 {
65703 frame.Y = num;
65704 }
65705 else if (ai[2] < 12f)
65706 {
65707 frame.Y = num * 2;
65708 }
65709 else if (ai[2] < 16f)
65710 {
65711 frame.Y = num * 3;
65712 }
65713 break;
65714 }
65715 if (velocity.Y > 0f)
65716 {
65717 frameCounter += 1.0;
65718 }
65719 else if (velocity.Y < 0f)
65720 {
65721 frameCounter -= 1.0;
65722 }
65723 if (frameCounter < 6.0)
65724 {
65725 frame.Y = num * 4;
65726 }
65727 else if (frameCounter < 12.0)
65728 {
65729 frame.Y = num * 5;
65730 }
65731 else if (frameCounter < 18.0)
65732 {
65733 frame.Y = num * 6;
65734 }
65735 if (frameCounter < 0.0)
65736 {
65737 frameCounter = 0.0;
65738 }
65739 if (frameCounter > 17.0)
65740 {
65741 frameCounter = 17.0;
65742 }
65743 break;
65744 case 50:
65745 if (velocity.Y != 0f)
65746 {
65747 if (frame.Y < num * 4)
65748 {
65749 frame.Y = num * 4;
65750 frameCounter = 0.0;
65751 }
65752 if ((frameCounter += 1.0) >= 4.0)
65753 {
65754 frame.Y = num * 5;
65755 }
65756 break;
65757 }
65758 if (frame.Y >= num * 5)
65759 {
65760 frame.Y = num * 4;
65761 frameCounter = 0.0;
65762 }
65763 frameCounter += 1.0;
65764 if (num2 > 0)
65765 {
65766 frameCounter += 1.0;
65767 }
65768 if (num2 == 4)
65769 {
65770 frameCounter += 1.0;
65771 }
65772 if (frameCounter >= 8.0)
65773 {
65774 frame.Y += num;
65775 frameCounter = 0.0;
65776 if (frame.Y >= num * 4)
65777 {
65778 frame.Y = 0;
65779 }
65780 }
65781 break;
65782 case 170:
65783 case 171:
65784 case 180:
65786 frameCounter += 1.0;
65787 if (frameCounter >= 4.0)
65788 {
65789 frame.Y += num;
65790 frameCounter = 0.0;
65791 }
65792 if (frame.Y >= num * 14)
65793 {
65794 frame.Y = 0;
65795 }
65796 break;
65797 case 135:
65798 if (ai[2] == 0f)
65799 {
65800 frame.Y = 0;
65801 }
65802 else
65803 {
65804 frame.Y = num;
65805 }
65806 break;
65807 case 85:
65808 case 341:
65809 case 629:
65810 if (ai[0] == 0f)
65811 {
65812 frameCounter = 0.0;
65813 frame.Y = 0;
65814 }
65815 else
65816 {
65817 int num173 = 3;
65818 if (velocity.Y == 0f)
65819 {
65820 frameCounter -= 1.0;
65821 }
65822 else
65823 {
65824 frameCounter += 1.0;
65825 }
65826 if (frameCounter < 0.0)
65827 {
65828 frameCounter = 0.0;
65829 }
65830 if (frameCounter > (double)(num173 * 4))
65831 {
65832 frameCounter = num173 * 4;
65833 }
65834 if (frameCounter < (double)num173)
65835 {
65836 frame.Y = num;
65837 }
65838 else if (frameCounter < (double)(num173 * 2))
65839 {
65840 frame.Y = num * 2;
65841 }
65842 else if (frameCounter < (double)(num173 * 3))
65843 {
65844 frame.Y = num * 3;
65845 }
65846 else if (frameCounter < (double)(num173 * 4))
65847 {
65848 frame.Y = num * 4;
65849 }
65850 else if (frameCounter < (double)(num173 * 5))
65851 {
65852 frame.Y = num * 5;
65853 }
65854 else if (frameCounter < (double)(num173 * 6))
65855 {
65856 frame.Y = num * 4;
65857 }
65858 else if (frameCounter < (double)(num173 * 7))
65859 {
65860 frame.Y = num * 3;
65861 }
65862 else
65863 {
65864 frame.Y = num * 2;
65865 if (frameCounter >= (double)(num173 * 8))
65866 {
65868 }
65869 }
65870 }
65871 if (ai[3] == 2f || (IsABestiaryIconDummy && type == 85))
65872 {
65873 frame.Y += num * 6;
65874 }
65875 else if (ai[3] == 3f)
65876 {
65877 frame.Y += num * 12;
65878 }
65879 break;
65880 case 113:
65881 case 114:
65882 if (ai[2] == 0f)
65883 {
65884 frameCounter += 1.0;
65885 if (frameCounter >= 12.0)
65886 {
65887 frame.Y += num;
65888 frameCounter = 0.0;
65889 }
65890 if (frame.Y >= num * Main.npcFrameCount[type])
65891 {
65892 frame.Y = 0;
65893 }
65894 }
65895 else
65896 {
65897 frame.Y = 0;
65898 frameCounter = -60.0;
65899 }
65900 break;
65901 case 61:
65902 {
65904 rotation = velocity.X * 0.1f;
65905 if (velocity.X == 0f && velocity.Y == 0f)
65906 {
65907 frame.Y = 0;
65908 frameCounter = 0.0;
65909 break;
65910 }
65911 int num167 = 5;
65912 int num168 = 5;
65913 frameCounter += 1.0;
65914 if (frameCounter >= (double)(num167 * num168))
65915 {
65916 frameCounter = 0.0;
65917 }
65918 int num169 = (int)(frameCounter / (double)num167);
65919 frame.Y = (num169 + 1) * num;
65920 break;
65921 }
65922 case 252:
65923 case 301:
65924 if (type == 301)
65925 {
65926 if (velocity.Y == 0f)
65927 {
65929 }
65930 else
65931 {
65932 if ((double)velocity.X > 0.5)
65933 {
65934 spriteDirection = -1;
65935 }
65936 if ((double)velocity.X < -0.5)
65937 {
65938 spriteDirection = 1;
65939 }
65940 }
65941 }
65942 else
65943 {
65944 if ((double)velocity.X > 0.5)
65945 {
65946 spriteDirection = 1;
65947 }
65948 if ((double)velocity.X < -0.5)
65949 {
65950 spriteDirection = -1;
65951 }
65952 }
65953 rotation = velocity.X * 0.1f;
65954 if (velocity.X == 0f && velocity.Y == 0f)
65955 {
65956 frame.Y = 0;
65957 frameCounter = 0.0;
65958 break;
65959 }
65960 frameCounter += 1.0;
65961 if (frameCounter > 4.0)
65962 {
65963 frameCounter = 0.0;
65964 frame.Y += num;
65965 }
65966 if (frame.Y > num * 4 || frame.Y == 0)
65967 {
65968 frame.Y = num;
65969 }
65970 break;
65971 case 122:
65973 rotation = velocity.X * 0.05f;
65974 if (ai[3] > 0f)
65975 {
65976 int num143 = (int)(ai[3] / 8f);
65977 frameCounter = 0.0;
65978 frame.Y = (num143 + 3) * num;
65979 break;
65980 }
65981 frameCounter += 1.0;
65982 if (frameCounter >= 8.0)
65983 {
65984 frame.Y += num;
65985 frameCounter = 0.0;
65986 }
65987 if (frame.Y >= num * 3)
65988 {
65989 frame.Y = 0;
65990 }
65991 break;
65992 case 74:
65993 case 297:
65994 case 298:
65995 case 442:
65996 {
65998 rotation = velocity.X * 0.1f;
65999 if (velocity.X == 0f && velocity.Y == 0f)
66000 {
66001 frame.Y = num * 4;
66002 frameCounter = 0.0;
66003 break;
66004 }
66005 int num83 = Main.npcFrameCount[type] - 1;
66006 frameCounter += 1.0;
66007 if (frameCounter >= 4.0)
66008 {
66009 frame.Y += num;
66010 frameCounter = 0.0;
66011 }
66012 if (frame.Y >= num * num83)
66013 {
66014 frame.Y = 0;
66015 }
66016 break;
66017 }
66018 case 671:
66019 case 672:
66020 case 673:
66021 case 674:
66022 case 675:
66023 {
66025 rotation = velocity.X * 0.1f;
66026 if (velocity.X == 0f && velocity.Y == 0f)
66027 {
66028 frame.Y = 0;
66029 frameCounter = 0.0;
66030 break;
66031 }
66033 frameCounter += 1.0;
66034 if (frameCounter >= 4.0)
66035 {
66036 frameCounter = 0.0;
66037 frame.Y += num;
66038 }
66039 if (frame.Y >= num * num70)
66040 {
66041 frame.Y = num;
66042 }
66043 break;
66044 }
66045 case 611:
66047 rotation = velocity.X * 0.1f;
66048 if (velocity.X == 0f && velocity.Y == 0f)
66049 {
66050 int num57 = frame.Y / num;
66051 if (num57 < 0 || num57 >= 8)
66052 {
66053 frame.Y = 0;
66054 }
66055 if ((int)frameCounter % 40 != 0 || Main.rand.Next(80) == 0)
66056 {
66057 frameCounter += 1.0;
66058 }
66059 if ((frameCounter + 1.0) % 40.0 == 39.0)
66060 {
66061 frameCounter = 40 * Main.rand.Next(3);
66062 }
66063 int num58 = (int)frameCounter % 40 / 10;
66064 int num59 = (int)frameCounter / 40;
66065 int num60 = 0;
66066 switch (num59)
66067 {
66068 case 0:
66069 if (num58 == 3)
66070 {
66071 num58 = 1;
66072 }
66073 num60 = num58;
66074 break;
66075 case 1:
66076 if (num58 == 3)
66077 {
66078 num58 = 1;
66079 }
66080 num60 = 0;
66081 if (num58 != 0)
66082 {
66083 num60 = 2 + num58;
66084 }
66085 break;
66086 case 2:
66087 num60 = 0;
66088 if (num58 != 0)
66089 {
66090 num60 = 4 + num58;
66091 }
66092 break;
66093 }
66094 frame.Y = num * num60;
66095 }
66096 else
66097 {
66098 frameCounter += 1.0;
66099 if (frameCounter >= 5.0)
66100 {
66101 frame.Y += num;
66102 frameCounter = 0.0;
66103 }
66104 if (frame.Y >= num * Main.npcFrameCount[type] || frame.Y < num * 8)
66105 {
66106 frame.Y = num * 8;
66107 }
66108 }
66109 break;
66110 case 362:
66111 case 364:
66112 case 608:
66114 if (velocity.X == 0f)
66115 {
66116 frameCounter = 0.0;
66117 frame.Y = 0;
66118 break;
66119 }
66120 frameCounter += 1.0;
66121 if (frameCounter >= 4.0)
66122 {
66123 frame.Y += num;
66124 frameCounter = 0.0;
66125 }
66126 if (frame.Y >= num * 10)
66127 {
66128 frame.Y = num * 3;
66129 }
66130 if (frame.Y < num * 3)
66131 {
66132 frame.Y = num * 3;
66133 }
66134 break;
66135 case 363:
66136 case 365:
66137 case 609:
66139 if (wet)
66140 {
66141 frameCounter += 1.0;
66142 if (frameCounter >= 8.0)
66143 {
66144 frame.Y += num;
66145 frameCounter = 0.0;
66146 }
66147 if (frame.Y > num * 2)
66148 {
66149 frame.Y = num;
66150 }
66151 if (frame.Y < num)
66152 {
66153 frame.Y = num;
66154 }
66155 rotation = 0f;
66156 }
66157 else if (velocity.X == 0f && velocity.Y == 0f)
66158 {
66159 frame.Y = num;
66160 frameCounter = 0.0;
66161 rotation = 0f;
66162 }
66163 else
66164 {
66165 rotation = velocity.X * 0.1f;
66166 frameCounter += 1.0;
66167 if (frameCounter >= 4.0)
66168 {
66169 frame.Y += num;
66170 frameCounter = 0.0;
66171 }
66172 if (frame.Y >= num * Main.npcFrameCount[type])
66173 {
66174 frame.Y = num * 11;
66175 }
66176 if (frame.Y < num * 11)
66177 {
66178 frame.Y = num * 11;
66179 }
66180 }
66181 break;
66182 case 602:
66184 if (velocity.X == 0f)
66185 {
66186 frameCounter = 0.0;
66187 frame.Y = 0;
66188 break;
66189 }
66190 frameCounter += 1.0;
66191 if (frameCounter >= 4.0)
66192 {
66193 frame.Y += num;
66194 frameCounter = 0.0;
66195 }
66196 if (frame.Y >= num * 10)
66197 {
66198 frame.Y = num * 3;
66199 }
66200 if (frame.Y < num * 3)
66201 {
66202 frame.Y = num * 3;
66203 }
66204 break;
66205 case 603:
66207 if (wet)
66208 {
66209 frameCounter += 1.0;
66210 if (frameCounter >= 8.0)
66211 {
66212 frame.Y += num;
66213 frameCounter = 0.0;
66214 }
66215 if (frame.Y > num * 2)
66216 {
66217 frame.Y = num;
66218 }
66219 if (frame.Y < num)
66220 {
66221 frame.Y = num;
66222 }
66223 rotation = 0f;
66224 }
66225 else if (velocity.X == 0f && velocity.Y == 0f)
66226 {
66227 frame.Y = num;
66228 frameCounter = 0.0;
66229 rotation = 0f;
66230 }
66231 else
66232 {
66233 rotation = velocity.X * 0.1f;
66234 frameCounter += 1.0;
66235 if (frameCounter >= 4.0)
66236 {
66237 frame.Y += num;
66238 frameCounter = 0.0;
66239 }
66240 if (frame.Y >= num * Main.npcFrameCount[type])
66241 {
66242 frame.Y = num * 11;
66243 }
66244 if (frame.Y < num * 11)
66245 {
66246 frame.Y = num * 11;
66247 }
66248 }
66249 break;
66250 case 62:
66251 case 66:
66252 {
66254 rotation = velocity.X * 0.1f;
66255 int num225 = 5;
66256 int num226 = 5;
66257 frameCounter += 1.0;
66258 if (frameCounter >= (double)(num225 * num226))
66259 {
66260 frameCounter = 0.0;
66261 }
66262 int num227 = (int)(frameCounter / (double)num225);
66263 frame.Y = num227 * num;
66264 break;
66265 }
66266 case 156:
66267 {
66269 rotation = velocity.X * 0.1f;
66270 frameCounter += 1.0;
66271 if (frameCounter >= 20.0)
66272 {
66273 frameCounter = 0.0;
66274 }
66275 int num221 = (int)frameCounter / 4;
66276 frame.Y = num221 * num;
66277 break;
66278 }
66279 case 63:
66280 case 64:
66281 case 103:
66282 case 242:
66283 case 256:
66284 if ((type == 63 || type == 64 || type == 103 || type == 242) && ai[1] == 1f)
66285 {
66286 frameCounter += 1.0;
66287 if (frameCounter > 4.0)
66288 {
66289 frameCounter = 0.0;
66290 frame.Y += num;
66291 }
66292 if (frame.Y > num * 6)
66293 {
66294 frame.Y = num * 4;
66295 }
66296 if (frame.Y < num * 4)
66297 {
66298 frame.Y = num * 4;
66299 }
66300 return;
66301 }
66302 frameCounter += 1.0;
66303 if (frameCounter < 6.0)
66304 {
66305 frame.Y = 0;
66306 break;
66307 }
66308 if (frameCounter < 12.0)
66309 {
66310 frame.Y = num;
66311 break;
66312 }
66313 if (frameCounter < 18.0)
66314 {
66315 frame.Y = num * 2;
66316 break;
66317 }
66318 frame.Y = num * 3;
66319 if (frameCounter >= 23.0)
66320 {
66321 frameCounter = 0.0;
66322 }
66323 break;
66324 case 221:
66325 if (localAI[2] == 1f)
66326 {
66327 if (localAI[0] == 1f)
66328 {
66329 frame.Y = 0;
66330 localAI[0] = 0f;
66331 }
66332 frameCounter += 1.0;
66333 if (frameCounter >= 8.0)
66334 {
66335 frame.Y += num;
66336 frameCounter = 0.0;
66337 }
66338 if (frame.Y >= num * Main.npcFrameCount[type])
66339 {
66340 frame.Y = num * Main.npcFrameCount[type] - num;
66341 }
66342 }
66343 else
66344 {
66345 frameCounter += 1.0;
66346 if (frameCounter >= 13.0)
66347 {
66348 frame.Y += num;
66349 frameCounter = 0.0;
66350 }
66351 if (frame.Y >= num * Main.npcFrameCount[type])
66352 {
66353 frame.Y = 0;
66354 }
66355 }
66356 break;
66357 case 2:
66358 case 23:
66359 case 121:
66360 case 169:
66361 case 190:
66362 case 191:
66363 case 192:
66364 case 193:
66365 case 194:
66366 case 317:
66367 case 318:
66368 case 660:
66369 {
66370 if (type == 23)
66371 {
66372 int num161 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
66373 Main.dust[num161].noGravity = true;
66374 Main.dust[num161].velocity.X *= 0.3f;
66375 Main.dust[num161].velocity.Y *= 0.3f;
66376 }
66377 if ((type == 121 || type == 660) && localAI[0] == 0f)
66378 {
66379 localAI[0] = 1f;
66380 frame.Y = num * 2;
66381 }
66382 if (type == 2 || type == 190 || type == 191 || type == 192 || type == 193 || type == 194 || type == 317 || type == 318)
66383 {
66384 if (velocity.X > 0f)
66385 {
66386 spriteDirection = 1;
66387 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
66388 }
66389 if (velocity.X < 0f)
66390 {
66391 spriteDirection = -1;
66392 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
66393 }
66394 }
66395 else if (type == 2 || type == 121 || type == 660)
66396 {
66397 if (velocity.X > 0f)
66398 {
66399 spriteDirection = 1;
66400 }
66401 if (velocity.X < 0f)
66402 {
66403 spriteDirection = -1;
66404 }
66405 rotation = velocity.X * 0.1f;
66406 }
66407 frameCounter += 1.0;
66408 float num162 = 8f;
66409 if (type == 660)
66410 {
66411 num162 = 6f;
66412 }
66413 if (frameCounter >= (double)num162)
66414 {
66415 frame.Y += num;
66416 frameCounter = 0.0;
66417 }
66418 if (frame.Y >= num * Main.npcFrameCount[type])
66419 {
66420 frame.Y = 0;
66421 }
66422 break;
66423 }
66424 case 133:
66425 if (velocity.X > 0f)
66426 {
66427 spriteDirection = 1;
66428 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
66429 }
66430 if (velocity.X < 0f)
66431 {
66432 spriteDirection = -1;
66433 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
66434 }
66435 frameCounter += 1.0;
66436 if (frameCounter >= 8.0)
66437 {
66438 frame.Y = num;
66439 }
66440 else
66441 {
66442 frame.Y = 0;
66443 }
66444 if (frameCounter >= 16.0)
66445 {
66446 frame.Y = 0;
66447 frameCounter = 0.0;
66448 }
66449 if ((double)life < (double)lifeMax * 0.5)
66450 {
66451 frame.Y += num * 2;
66452 }
66453 break;
66454 case 116:
66455 if (velocity.X > 0f)
66456 {
66457 spriteDirection = 1;
66458 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
66459 }
66460 if (velocity.X < 0f)
66461 {
66462 spriteDirection = -1;
66463 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
66464 }
66465 frameCounter += 1.0;
66466 if (frameCounter >= 5.0)
66467 {
66468 frame.Y += num;
66469 frameCounter = 0.0;
66470 }
66471 if (frame.Y >= num * Main.npcFrameCount[type])
66472 {
66473 frame.Y = 0;
66474 }
66475 break;
66476 case 75:
66477 if (velocity.X > 0f)
66478 {
66479 spriteDirection = 1;
66480 }
66481 else
66482 {
66483 spriteDirection = -1;
66484 }
66485 rotation = velocity.X * 0.1f;
66486 frameCounter += 1.0;
66487 if (frameCounter >= 4.0)
66488 {
66489 frame.Y += num;
66490 frameCounter = 0.0;
66491 }
66492 if (frame.Y >= num * Main.npcFrameCount[type])
66493 {
66494 frame.Y = 0;
66495 }
66496 break;
66497 case 157:
66498 {
66500 frameCounter += 1.0;
66501 if (!wet)
66502 {
66503 frameCounter += 1.0;
66504 }
66505 int num56 = 5;
66506 if (frameCounter < (double)num56)
66507 {
66508 frame.Y = 0;
66509 }
66510 else if (frameCounter < (double)(num56 * 2))
66511 {
66512 frame.Y = num;
66513 }
66514 else if (frameCounter < (double)(num56 * 3))
66515 {
66516 frame.Y = num * 2;
66517 }
66518 else if (frameCounter < (double)(num56 * 4))
66519 {
66520 frame.Y = num;
66521 }
66522 else if (frameCounter < (double)(num56 * 5))
66523 {
66524 frame.Y = num * 3;
66525 }
66526 else if (frameCounter < (double)(num56 * 6))
66527 {
66528 frame.Y = num * 4;
66529 }
66530 else if (frameCounter < (double)(num56 * 7))
66531 {
66532 frame.Y = num * 5;
66533 }
66534 else if (frameCounter < (double)(num56 * 8))
66535 {
66536 frame.Y = num * 4;
66537 }
66538 else
66539 {
66540 frameCounter = 0.0;
66541 }
66542 break;
66543 }
66544 case 55:
66545 case 57:
66546 case 58:
66547 case 102:
66548 case 241:
66549 case 465:
66550 case 592:
66551 case 607:
66553 frameCounter += 1.0;
66554 if (wet)
66555 {
66556 if (frameCounter < 6.0)
66557 {
66558 frame.Y = 0;
66559 }
66560 else if (frameCounter < 12.0)
66561 {
66562 frame.Y = num;
66563 }
66564 else if (frameCounter < 18.0)
66565 {
66566 frame.Y = num * 2;
66567 }
66568 else if (frameCounter < 24.0)
66569 {
66570 frame.Y = num * 3;
66571 }
66572 else
66573 {
66574 frameCounter = 0.0;
66575 }
66576 }
66577 else if (frameCounter < 6.0)
66578 {
66579 frame.Y = num * 4;
66580 }
66581 else if (frameCounter < 12.0)
66582 {
66583 frame.Y = num * 5;
66584 }
66585 else
66586 {
66587 frameCounter = 0.0;
66588 }
66589 break;
66590 case 615:
66592 if (!wet && ai[2] == 1f)
66593 {
66594 frame.Y = 4 * num;
66595 break;
66596 }
66597 if (!wet)
66598 {
66599 frameCounter += 1.0;
66600 }
66601 if ((frameCounter += 1.0) >= (double)(7 * (Main.npcFrameCount[type] - 1)))
66602 {
66603 frameCounter = 0.0;
66604 }
66605 frame.Y = (int)(frameCounter / 7.0) * num;
66606 break;
66607 case 69:
66608 if (ai[0] < 190f)
66609 {
66610 frameCounter += 1.0;
66611 if (frameCounter >= 6.0)
66612 {
66613 frameCounter = 0.0;
66614 frame.Y += num;
66615 if (frame.Y / num >= Main.npcFrameCount[type] - 1)
66616 {
66617 frame.Y = 0;
66618 }
66619 }
66620 }
66621 else
66622 {
66623 frameCounter = 0.0;
66624 frame.Y = num * (Main.npcFrameCount[type] - 1);
66625 }
66626 break;
66627 case 155:
66628 {
66629 int num224 = frame.Y / num;
66630 if (IsABestiaryIconDummy && num224 < 3)
66631 {
66632 num224 = 3;
66633 }
66634 if (velocity.Y < 0f)
66635 {
66636 num224 = 10;
66637 }
66638 else if (velocity.Y > 0f)
66639 {
66640 num224 = 11;
66641 }
66642 else if (velocity.X == 0f)
66643 {
66644 num224 = 0;
66645 frameCounter = 0.0;
66646 }
66647 else if (((direction > 0 && velocity.X < 0f) || (direction < 0 && velocity.X > 0f)) && Math.Abs(velocity.X) < 4f)
66648 {
66650 if (num224 > 2)
66651 {
66652 num224 = 0;
66653 frameCounter = 0.0;
66654 }
66655 if (num224 < 2)
66656 {
66657 frameCounter += 1.0;
66658 if (frameCounter > 5.0)
66659 {
66660 frameCounter = 0.0;
66661 num224++;
66662 }
66663 }
66664 else
66665 {
66666 frameCounter = 0.0;
66667 }
66668 }
66669 else
66670 {
66671 spriteDirection = ((!(velocity.X < 0f)) ? 1 : (-1));
66672 frameCounter += Math.Abs(velocity.X) * 0.4f;
66673 if (num224 == 10 || num224 == 11)
66674 {
66675 num224 = 12;
66676 frameCounter = 0.0;
66677 }
66678 else if (frameCounter > 8.0)
66679 {
66680 frameCounter -= 8.0;
66681 num224++;
66682 if (num224 > 9)
66683 {
66684 num224 = 3;
66685 }
66686 }
66687 }
66688 frame.Y = num224 * num;
66689 break;
66690 }
66691 case 329:
66692 if (velocity.Y > 0f)
66693 {
66694 frame.Y = num * 3;
66695 frameCounter = 0.0;
66696 break;
66697 }
66698 if (velocity.Y < 0f)
66699 {
66700 frame.Y = num * 2;
66701 frameCounter = 0.0;
66702 break;
66703 }
66705 frameCounter += Math.Abs(velocity.X) * 0.4f;
66706 if (frameCounter > 4.0)
66707 {
66708 frameCounter = 0.0;
66709 frame.Y += num;
66710 if (frame.Y < num * 2)
66711 {
66712 frame.Y = num * 2;
66713 }
66714 if (frame.Y > num * 9)
66715 {
66716 frame.Y = num * 2;
66717 }
66718 }
66719 break;
66720 case 86:
66721 if (velocity.Y == 0f || wet)
66722 {
66723 if (velocity.X < -2f)
66724 {
66725 spriteDirection = -1;
66726 }
66727 else if (velocity.X > 2f)
66728 {
66729 spriteDirection = 1;
66730 }
66731 else
66732 {
66734 }
66735 }
66736 if (velocity.Y != 0f)
66737 {
66738 frame.Y = num * 15;
66739 frameCounter = 0.0;
66740 break;
66741 }
66742 if (velocity.X == 0f)
66743 {
66744 frameCounter = 0.0;
66745 frame.Y = 0;
66746 break;
66747 }
66748 if (Math.Abs(velocity.X) < 3f)
66749 {
66751 if (frameCounter >= 6.0)
66752 {
66753 frameCounter = 0.0;
66754 frame.Y += num;
66755 if (frame.Y / num >= 9)
66756 {
66757 frame.Y = num;
66758 }
66759 if (frame.Y / num <= 0)
66760 {
66761 frame.Y = num;
66762 }
66763 }
66764 break;
66765 }
66767 if (frameCounter >= 10.0)
66768 {
66769 frameCounter = 0.0;
66770 frame.Y += num;
66771 if (frame.Y / num >= 15)
66772 {
66773 frame.Y = num * 9;
66774 }
66775 if (frame.Y / num <= 8)
66776 {
66777 frame.Y = num * 9;
66778 }
66779 }
66780 break;
66781 case 315:
66782 if (velocity.Y == 0f || wet)
66783 {
66784 if (velocity.X < -1f)
66785 {
66786 spriteDirection = -1;
66787 }
66788 else if (velocity.X > 1f)
66789 {
66790 spriteDirection = 1;
66791 }
66792 else
66793 {
66795 }
66796 }
66797 if (velocity.Y != 0f)
66798 {
66799 frame.Y = 0;
66800 frameCounter = 0.0;
66801 break;
66802 }
66804 if (frameCounter >= 8.0)
66805 {
66806 frameCounter = 0.0;
66807 frame.Y += num;
66808 if (frame.Y / num > 10)
66809 {
66810 frame.Y = num;
66811 }
66812 }
66813 break;
66814 case 127:
66815 if (IsMechQueenUp)
66816 {
66817 if (ai[1] == 0f)
66818 {
66819 frameCounter += 1.0;
66820 if (frameCounter >= 12.0)
66821 {
66822 frameCounter = 0.0;
66823 frame.Y += num;
66824 if (frame.Y / num >= 5)
66825 {
66826 frame.Y = num * 3;
66827 }
66828 }
66829 }
66830 else
66831 {
66832 frameCounter = 0.0;
66833 frame.Y = num * 5;
66834 }
66835 }
66836 else if (ai[1] == 0f)
66837 {
66838 frameCounter += 1.0;
66839 if (frameCounter >= 12.0)
66840 {
66841 frameCounter = 0.0;
66842 frame.Y += num;
66843 if (frame.Y / num >= 2)
66844 {
66845 frame.Y = 0;
66846 }
66847 }
66848 }
66849 else
66850 {
66851 frameCounter = 0.0;
66852 frame.Y = num * 2;
66853 }
66854 break;
66855 case 129:
66856 if (velocity.Y == 0f)
66857 {
66859 }
66860 frameCounter += 1.0;
66861 if (frameCounter >= 2.0)
66862 {
66863 frameCounter = 0.0;
66864 frame.Y += num;
66865 if (frame.Y / num >= Main.npcFrameCount[type])
66866 {
66867 frame.Y = 0;
66868 }
66869 }
66870 break;
66871 case 130:
66872 if (velocity.Y == 0f)
66873 {
66875 }
66876 frameCounter += 1.0;
66877 if (frameCounter >= 8.0)
66878 {
66879 frameCounter = 0.0;
66880 frame.Y += num;
66881 if (frame.Y / num >= Main.npcFrameCount[type])
66882 {
66883 frame.Y = 0;
66884 }
66885 }
66886 break;
66887 case 67:
66888 case 217:
66889 case 218:
66890 case 219:
66891 if (velocity.Y == 0f)
66892 {
66894 }
66895 frameCounter += 1.0;
66896 if (frameCounter >= 6.0)
66897 {
66898 frameCounter = 0.0;
66899 frame.Y += num;
66900 if (frame.Y / num >= Main.npcFrameCount[type])
66901 {
66902 frame.Y = 0;
66903 }
66904 }
66905 break;
66906 case 220:
66907 if (velocity.Y == 0f)
66908 {
66910 }
66911 frameCounter += 1.0;
66912 if (frameCounter >= 10.0)
66913 {
66914 frameCounter = 0.0;
66915 frame.Y += num;
66916 if (frame.Y / num >= Main.npcFrameCount[type])
66917 {
66918 frame.Y = 0;
66919 }
66920 }
66921 break;
66922 case 109:
66923 if (velocity.Y == 0f && ((velocity.X <= 0f && direction < 0) || (velocity.X >= 0f && direction > 0)))
66924 {
66926 }
66928 if (frameCounter >= 7.0)
66929 {
66930 frameCounter -= 7.0;
66931 frame.Y += num;
66932 if (frame.Y / num >= Main.npcFrameCount[type])
66933 {
66934 frame.Y = 0;
66935 }
66936 }
66937 break;
66938 case 83:
66939 case 84:
66940 case 179:
66941 if (ai[0] == 2f)
66942 {
66943 frameCounter = 0.0;
66944 frame.Y = 0;
66945 break;
66946 }
66947 frameCounter += 1.0;
66948 if (frameCounter >= 4.0)
66949 {
66950 frameCounter = 0.0;
66951 frame.Y += num;
66952 if (frame.Y / num >= Main.npcFrameCount[type])
66953 {
66954 frame.Y = 0;
66955 }
66956 }
66957 break;
66958 case 72:
66959 frameCounter += 1.0;
66960 if (frameCounter >= 3.0)
66961 {
66962 frameCounter = 0.0;
66963 frame.Y += num;
66964 if (frame.Y / num >= Main.npcFrameCount[type])
66965 {
66966 frame.Y = 0;
66967 }
66968 }
66969 break;
66970 case 65:
66972 frameCounter += 1.0;
66973 if (wet && type == 65)
66974 {
66975 if (frameCounter < 6.0)
66976 {
66977 frame.Y = 0;
66978 }
66979 else if (frameCounter < 12.0)
66980 {
66981 frame.Y = num;
66982 }
66983 else if (frameCounter < 18.0)
66984 {
66985 frame.Y = num * 2;
66986 }
66987 else if (frameCounter < 24.0)
66988 {
66989 frame.Y = num * 3;
66990 }
66991 else
66992 {
66993 frameCounter = 0.0;
66994 }
66995 }
66996 break;
66997 case 542:
66998 case 543:
66999 case 544:
67000 case 545:
67002 frameCounter += 1.0;
67003 if (frameCounter >= 16.0)
67004 {
67005 frameCounter = 0.0;
67006 }
67007 frame.Y = num * (int)(frameCounter / 4.0);
67008 break;
67009 case 224:
67010 case 587:
67011 if (velocity.X > 0f)
67012 {
67013 spriteDirection = 1;
67014 rotation = velocity.Y * 0.2f;
67015 }
67016 if (velocity.X < 0f)
67017 {
67018 spriteDirection = -1;
67019 rotation = (0f - velocity.Y) * 0.2f;
67020 }
67021 frameCounter += 1.0;
67022 if (frameCounter >= 6.0)
67023 {
67024 frame.Y += num;
67025 frameCounter = 0.0;
67026 }
67027 if (frame.Y >= num * 4)
67028 {
67029 frame.Y = 0;
67030 }
67031 break;
67032 case 150:
67033 case 151:
67034 case 152:
67035 case 158:
67036 case 226:
67037 if (type == 151)
67038 {
67039 int num46 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
67040 Main.dust[num46].noGravity = true;
67041 }
67042 if (type == 150 && Main.rand.Next(10) == 0)
67043 {
67044 int num47 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, velocity.X * 0.5f, velocity.Y * 0.5f, 90, default(Color), 1.5f);
67045 Main.dust[num47].noGravity = true;
67046 Dust dust = Main.dust[num47];
67047 dust.velocity *= 0.2f;
67048 Main.dust[num47].noLight = true;
67049 }
67050 if (velocity.X > 0f)
67051 {
67052 spriteDirection = 1;
67053 }
67054 if (velocity.X < 0f)
67055 {
67056 spriteDirection = -1;
67057 }
67058 rotation = velocity.X * 0.1f;
67059 frameCounter += 1.0;
67060 if (frameCounter >= 6.0)
67061 {
67062 frame.Y += num;
67063 frameCounter = 0.0;
67064 }
67065 if (frame.Y >= num * 4)
67066 {
67067 frame.Y = 0;
67068 }
67069 break;
67070 case 48:
67071 case 49:
67072 case 51:
67073 case 60:
67074 case 82:
67075 case 93:
67076 case 137:
67077 case 182:
67078 case 210:
67079 case 211:
67080 case 253:
67081 case 316:
67082 case 634:
67083 case 662:
67084 case 664:
67085 {
67086 if (type == 60)
67087 {
67088 int num290 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
67089 Main.dust[num290].noGravity = true;
67090 }
67091 if (type == 634 && Main.rand.Next(10) == 0)
67092 {
67093 int num291 = Dust.NewDust(position, width, height, 165, velocity.X, velocity.Y, 50);
67094 Dust dust = Main.dust[num291];
67095 dust.velocity *= 0.1f;
67096 Main.dust[num291].noGravity = true;
67097 }
67098 if (velocity.X > 0f)
67099 {
67100 spriteDirection = 1;
67101 }
67102 if (velocity.X < 0f)
67103 {
67104 spriteDirection = -1;
67105 }
67106 rotation = velocity.X * 0.1f;
67107 if (type == 210 || type == 211)
67108 {
67109 frameCounter += 1.0;
67110 rotation = velocity.X * 0.2f;
67111 }
67112 frameCounter += 1.0;
67113 int num292 = 6;
67115 if (type == 49 || type == 51 || type == 60 || type == 634)
67116 {
67117 num293--;
67118 }
67119 if (type == 48)
67120 {
67121 num292 = 5;
67122 }
67123 if (frameCounter >= (double)num292)
67124 {
67125 frame.Y += num;
67126 frameCounter = 0.0;
67127 }
67128 if (frame.Y >= num * num293)
67129 {
67130 frame.Y = 0;
67131 }
67132 break;
67133 }
67134 case 330:
67135 if (velocity.X > 0f)
67136 {
67137 spriteDirection = 1;
67138 }
67139 if (velocity.X < 0f)
67140 {
67141 spriteDirection = -1;
67142 }
67143 rotation = velocity.X * 0.15f;
67144 frameCounter += 1.0;
67145 if (frameCounter >= 8.0)
67146 {
67147 frame.Y += num;
67148 frameCounter = 0.0;
67149 }
67150 if (frame.Y >= num * Main.npcFrameCount[type])
67151 {
67152 frame.Y = 0;
67153 }
67154 break;
67155 case 42:
67156 case 231:
67157 case 232:
67158 case 233:
67159 case 234:
67160 case 235:
67161 frameCounter += 1.0;
67162 if (frameCounter < 2.0)
67163 {
67164 frame.Y = 0;
67165 }
67166 else if (frameCounter < 4.0)
67167 {
67168 frame.Y = num;
67169 }
67170 else if (frameCounter < 6.0)
67171 {
67172 frame.Y = num * 2;
67173 }
67174 else if (frameCounter < 8.0)
67175 {
67176 frame.Y = num;
67177 }
67178 else
67179 {
67180 frameCounter = 0.0;
67181 }
67182 break;
67183 case 205:
67184 frameCounter += 0.5;
67185 if (frameCounter < 2.0)
67186 {
67187 frame.Y = 0;
67188 }
67189 else if (frameCounter < 4.0)
67190 {
67191 frame.Y = num;
67192 }
67193 else if (frameCounter < 6.0)
67194 {
67195 frame.Y = num * 2;
67196 }
67197 else if (frameCounter < 8.0)
67198 {
67199 frame.Y = num;
67200 }
67201 else
67202 {
67203 frameCounter = 0.0;
67204 }
67205 break;
67206 case 176:
67207 frameCounter += 1.0;
67208 if (frameCounter > 4.0)
67209 {
67210 frame.Y += num;
67211 frameCounter = 0.0;
67212 }
67213 if (frame.Y > num)
67214 {
67215 frame.Y = 0;
67216 }
67217 break;
67218 case 43:
67219 case 56:
67220 case 175:
67221 frameCounter += 1.0;
67222 if (frameCounter < 6.0)
67223 {
67224 frame.Y = 0;
67225 }
67226 else if (frameCounter < 12.0)
67227 {
67228 frame.Y = num;
67229 }
67230 else if (frameCounter < 18.0)
67231 {
67232 frame.Y = num * 2;
67233 }
67234 else if (frameCounter < 24.0)
67235 {
67236 frame.Y = num;
67237 }
67238 if (frameCounter == 23.0)
67239 {
67240 frameCounter = 0.0;
67241 }
67242 break;
67243 case 115:
67244 frameCounter += 1.0;
67245 if (frameCounter < 3.0)
67246 {
67247 frame.Y = 0;
67248 }
67249 else if (frameCounter < 6.0)
67250 {
67251 frame.Y = num;
67252 }
67253 else if (frameCounter < 12.0)
67254 {
67255 frame.Y = num * 2;
67256 }
67257 else if (frameCounter < 15.0)
67258 {
67259 frame.Y = num;
67260 }
67261 if (frameCounter == 15.0)
67262 {
67263 frameCounter = 0.0;
67264 }
67265 break;
67266 case 101:
67267 frameCounter += 1.0;
67268 if (frameCounter > 6.0)
67269 {
67270 frame.Y += num * 2;
67271 frameCounter = 0.0;
67272 }
67273 if (frame.Y > num * 2)
67274 {
67275 frame.Y = 0;
67276 }
67277 break;
67278 case 199:
67279 if (velocity.Y == 0f)
67280 {
67281 if (direction == 1)
67282 {
67283 spriteDirection = 1;
67284 }
67285 if (direction == -1)
67286 {
67287 spriteDirection = -1;
67288 }
67289 }
67290 if (frame.Y < num * 3)
67291 {
67292 frameCounter += 1.0;
67293 if (frameCounter > 6.0)
67294 {
67295 frameCounter = 0.0;
67296 frame.Y += num;
67297 }
67298 }
67299 else
67300 {
67301 if (velocity.Y != 0f)
67302 {
67303 break;
67304 }
67306 if (frameCounter > 12.0)
67307 {
67308 frameCounter = 0.0;
67309 frame.Y += num;
67310 if (frame.Y > num * 7)
67311 {
67312 frame.Y = num * 3;
67313 }
67314 }
67315 }
67316 break;
67317 case 467:
67318 if (ai[0] == 1f || IsABestiaryIconDummy)
67319 {
67320 frameCounter += 1.0;
67321 if (frameCounter > 4.0)
67322 {
67323 frameCounter = 0.0;
67324 if (frame.Y < num * 6)
67325 {
67326 frame.Y += num;
67327 frameCounter = 0.0;
67328 }
67329 else if (IsABestiaryIconDummy)
67330 {
67331 frame.Y = 0;
67332 }
67333 }
67334 break;
67335 }
67336 frameCounter += 1.0;
67337 if (frameCounter > 4.0)
67338 {
67339 frameCounter = 0.0;
67340 if (frame.Y > num * 3)
67341 {
67342 frame.Y = num * 3;
67343 }
67344 if (frame.Y > 0)
67345 {
67346 frame.Y -= num;
67347 frameCounter = 0.0;
67348 }
67349 }
67350 break;
67351 case 480:
67352 if (velocity.Y == 0f)
67353 {
67354 if (direction == 1)
67355 {
67356 spriteDirection = 1;
67357 }
67358 if (direction == -1)
67359 {
67360 spriteDirection = -1;
67361 }
67362 if (ai[2] < 0f)
67363 {
67364 frameCounter += 1.0;
67365 if (frameCounter > 3.0)
67366 {
67367 frame.Y += num;
67368 frameCounter = 0.0;
67369 }
67370 if (frame.Y >= Main.npcFrameCount[type] * num)
67371 {
67372 frame.Y = num * 21;
67373 }
67374 else if (frame.Y < num * 21)
67375 {
67376 frame.Y = num * 21;
67377 }
67378 }
67379 else if (velocity.X == 0f)
67380 {
67381 frameCounter += 1.0;
67382 if (frameCounter > 4.0)
67383 {
67384 frame.Y += num;
67385 frameCounter = 0.0;
67386 }
67387 if (frame.Y / num > 7)
67388 {
67389 frame.Y = 0;
67390 }
67391 }
67392 else
67393 {
67394 frameCounter += 1f + Math.Abs(velocity.X);
67395 if (frameCounter > 6.0)
67396 {
67397 frame.Y += num;
67398 frameCounter = 0.0;
67399 }
67400 if (frame.Y / num >= Main.npcFrameCount[type] - 4)
67401 {
67402 frame.Y = num * 10;
67403 }
67404 else if (frame.Y / num < 10)
67405 {
67406 frame.Y = num * 10;
67407 }
67408 }
67409 }
67410 else
67411 {
67412 frameCounter = 0.0;
67413 frame.Y = num * 8;
67414 }
67415 break;
67416 case 483:
67417 if (ai[0] == -1f)
67418 {
67419 frameCounter += 1.0;
67420 if (frameCounter > 4.0)
67421 {
67422 frame.Y += num;
67423 frameCounter = 0.0;
67424 }
67425 if (frame.Y > num * 21)
67426 {
67427 frame.Y = num * 21;
67428 }
67429 else if (frame.Y < num * 13)
67430 {
67431 frame.Y = num * 13;
67432 }
67433 rotation += velocity.X * 0.2f;
67434 }
67435 else
67436 {
67437 frameCounter += 1.0;
67438 if (frameCounter > 4.0)
67439 {
67440 frame.Y += num;
67441 frameCounter = 0.0;
67442 }
67443 if (frame.Y > num * 11)
67444 {
67445 frame.Y = 0;
67446 }
67447 rotation = velocity.X * 0.1f;
67448 }
67449 break;
67450 case 482:
67451 if (velocity.Y == 0f)
67452 {
67453 if (direction == 1)
67454 {
67455 spriteDirection = 1;
67456 }
67457 if (direction == -1)
67458 {
67459 spriteDirection = -1;
67460 }
67461 if (ai[2] < 0f)
67462 {
67463 frameCounter += 1.0;
67464 if (frameCounter > 3.0)
67465 {
67466 frame.Y += num;
67467 frameCounter = 0.0;
67468 }
67469 if (frame.Y >= Main.npcFrameCount[type] * num)
67470 {
67471 frame.Y = num * 11;
67472 }
67473 else if (frame.Y < num * 11)
67474 {
67475 frame.Y = num * 11;
67476 }
67477 }
67478 else if (velocity.X == 0f)
67479 {
67480 frameCounter += 1.0;
67481 frame.Y = 0;
67482 }
67483 else
67484 {
67485 frameCounter += 0.2f + Math.Abs(velocity.X);
67486 if (frameCounter > 8.0)
67487 {
67488 frame.Y += num;
67489 frameCounter = 0.0;
67490 }
67491 if (frame.Y / num >= Main.npcFrameCount[type] - 10)
67492 {
67493 frame.Y = num * 2;
67494 }
67495 else if (frame.Y / num < 2)
67496 {
67497 frame.Y = num * 2;
67498 }
67499 }
67500 }
67501 else
67502 {
67503 frameCounter = 0.0;
67504 frame.Y = num;
67505 }
67506 break;
67507 case 631:
67508 {
67509 int num51 = 100;
67510 int num52 = 32;
67511 int num53 = 8;
67512 if (velocity.Y == 0f)
67513 {
67515 if (ai[2] != 0f && ai[2] < (float)num51)
67516 {
67517 float num54 = ai[2] - (float)(num51 - num52);
67518 float amount = num54 / (float)num52;
67519 Player player = Main.player[target];
67520 bool flag3 = player != null && ((player.Center.X < base.Center.X) ? (direction == -1) : (direction == 1));
67521 bool flag4 = player?.Hitbox.Intersects(base.Hitbox) ?? false;
67522 if (player != null && flag3 && !flag4 && Collision.CanHit(player, this))
67523 {
67524 frame.Y = (int)MathHelper.Lerp(15f, Main.npcFrameCount[type], amount) * num;
67525 }
67526 else if (flag3 && flag4)
67527 {
67528 frame.Y = (int)MathHelper.Lerp(10f, 15f, amount) * num;
67529 }
67530 else
67531 {
67532 frame.Y = 0;
67533 }
67534 }
67535 else if (velocity.X == 0f)
67536 {
67537 frameCounter = 0.0;
67538 frame.Y = 0;
67539 }
67540 else
67541 {
67542 frameCounter += 0.2f + Math.Abs(velocity.X);
67543 if (frameCounter > 8.0)
67544 {
67545 frame.Y += num;
67546 frameCounter = 0.0;
67547 }
67548 if (frame.Y >= num53 * num)
67549 {
67550 frame.Y = num;
67551 }
67552 else if (frame.Y / num < 1)
67553 {
67554 frame.Y = num;
67555 }
67556 }
67557 }
67558 else
67559 {
67560 frameCounter = 0.0;
67561 frame.Y = 0;
67562 }
67563 break;
67564 }
67565 case 461:
67566 if (wet)
67567 {
67568 if (velocity.X < 0f)
67569 {
67570 direction = -1;
67571 }
67572 if (velocity.X > 0f)
67573 {
67574 direction = 1;
67575 }
67577 {
67578 rotation *= -1f;
67580 }
67581 float num234 = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
67582 if ((double)Math.Abs(rotation - num234) >= 3.14)
67583 {
67584 if (num234 < rotation)
67585 {
67586 rotation -= 6.28f;
67587 }
67588 else
67589 {
67590 rotation += 6.28f;
67591 }
67592 }
67593 rotation = (rotation * 4f + num234) / 5f;
67595 frameCounter += 1.0;
67596 if (frameCounter > 8.0)
67597 {
67598 frame.Y += num;
67599 frameCounter = 0.0;
67600 }
67601 if (frame.Y / num > 20)
67602 {
67603 frame.Y = num * 16;
67604 }
67605 else if (frame.Y / num < 16)
67606 {
67607 frame.Y = num * 19;
67608 }
67609 break;
67610 }
67611 if ((double)rotation > 3.14)
67612 {
67613 rotation -= 6.28f;
67614 }
67615 if ((double)rotation > -0.01 && (double)rotation < 0.01)
67616 {
67617 rotation = 0f;
67618 }
67619 else
67620 {
67621 rotation *= 0.9f;
67622 }
67623 if (velocity.Y == 0f)
67624 {
67625 if (direction == 1)
67626 {
67627 spriteDirection = 1;
67628 }
67629 if (direction == -1)
67630 {
67631 spriteDirection = -1;
67632 }
67633 if (velocity.X == 0f)
67634 {
67635 frame.Y = 0;
67636 frameCounter = 0.0;
67637 break;
67638 }
67639 if (frame.Y < num * 2)
67640 {
67641 frame.Y = num * 2;
67642 }
67643 frameCounter += Math.Abs(velocity.X) * 2f;
67644 frameCounter += 1.0;
67645 if (frameCounter > 6.0)
67646 {
67647 frame.Y += num;
67648 frameCounter = 0.0;
67649 }
67650 if (frame.Y / num > 15)
67651 {
67652 frame.Y = num * 2;
67653 }
67654 }
67655 else
67656 {
67657 frameCounter = 0.0;
67658 frame.Y = num;
67659 }
67660 break;
67661 case 586:
67662 {
67663 if (wet)
67664 {
67665 if (velocity.X < 0f)
67666 {
67667 direction = -1;
67668 }
67669 if (velocity.X > 0f)
67670 {
67671 direction = 1;
67672 }
67675 frameCounter += 1.0;
67676 if (frameCounter > 60.0)
67677 {
67678 frame.Y += num;
67679 frameCounter = 0.0;
67680 }
67681 if (frame.Y / num > 1)
67682 {
67683 frame.Y = 0;
67684 }
67685 else if (frame.Y / num < 0)
67686 {
67687 frame.Y = 0;
67688 }
67689 break;
67690 }
67691 if (velocity.Y == 0f)
67692 {
67694 }
67695 if (velocity.X == 0f)
67696 {
67697 frame.Y = num;
67698 frameCounter = 0.0;
67699 break;
67700 }
67701 int num228 = 6;
67702 num228 = 8;
67703 frameCounter += Math.Abs(velocity.X) * 1f;
67704 frameCounter += 0.5;
67705 if (frameCounter > (double)num228)
67706 {
67707 frame.Y += num;
67708 frameCounter = 0.0;
67709 }
67710 if (frame.Y / num >= Main.npcFrameCount[type])
67711 {
67712 frame.Y = 0;
67713 }
67714 break;
67715 }
67716 case 466:
67717 if (!IsABestiaryIconDummy && ai[2] <= 0f)
67718 {
67719 if (direction == 1)
67720 {
67721 spriteDirection = 1;
67722 }
67723 if (direction == -1)
67724 {
67725 spriteDirection = -1;
67726 }
67727 if (ai[2] == 0f)
67728 {
67729 frame.Y = 0;
67730 }
67731 else if (ai[2] < -8f)
67732 {
67733 frame.Y = num;
67734 }
67735 else
67736 {
67737 frame.Y = num * 2;
67738 }
67739 }
67740 else if (velocity.Y == 0f)
67741 {
67742 if (direction == 1)
67743 {
67744 spriteDirection = 1;
67745 }
67746 if (direction == -1)
67747 {
67748 spriteDirection = -1;
67749 }
67750 if (velocity.X == 0f)
67751 {
67752 frame.Y = num * 2;
67753 frameCounter = 0.0;
67754 break;
67755 }
67756 if (frame.Y / num < 4)
67757 {
67758 frame.Y = num * 4;
67759 }
67760 frameCounter += Math.Abs(velocity.X) * 2f;
67761 frameCounter += 1.0;
67762 if (frameCounter > 7.0)
67763 {
67764 frame.Y += num;
67765 frameCounter = 0.0;
67766 }
67767 if (frame.Y / num > 17)
67768 {
67769 frame.Y = num * 4;
67770 }
67771 if (frame.Y / num < 4)
67772 {
67773 frame.Y = num * 4;
67774 }
67775 }
67776 else
67777 {
67778 frameCounter = 0.0;
67779 frame.Y = num * 3;
67780 }
67781 break;
67782 case 471:
67783 {
67784 bool flag10 = false;
67785 if (ai[3] < 0f)
67786 {
67787 flag10 = true;
67788 }
67789 if (flag10)
67790 {
67791 if (direction == 1)
67792 {
67793 spriteDirection = 1;
67794 }
67795 if (direction == -1)
67796 {
67797 spriteDirection = -1;
67798 }
67799 frameCounter += Math.Abs(velocity.Length()) * 0.5f;
67800 frameCounter += 1.0;
67801 if (frameCounter < 6.0)
67802 {
67803 frame.Y = num * 17;
67804 break;
67805 }
67806 if (frameCounter < 12.0)
67807 {
67808 frame.Y = num * 18;
67809 break;
67810 }
67811 if (frameCounter < 18.0)
67812 {
67813 frame.Y = num * 19;
67814 break;
67815 }
67816 if (frameCounter < 23.0)
67817 {
67818 frame.Y = num * 18;
67819 break;
67820 }
67821 frame.Y = num * 18;
67822 frameCounter = 0.0;
67823 }
67824 else if (ai[3] == 1f)
67825 {
67826 frame.Y = num * 16;
67827 frameCounter = 0.0;
67828 }
67829 else if (velocity.Y == 0f)
67830 {
67831 if (direction == 1)
67832 {
67833 spriteDirection = 1;
67834 }
67835 if (direction == -1)
67836 {
67837 spriteDirection = -1;
67838 }
67839 if (velocity.X == 0f)
67840 {
67841 frame.Y = 0;
67842 frameCounter = 0.0;
67843 break;
67844 }
67845 frameCounter += Math.Abs(velocity.X) * 2f;
67846 frameCounter += 1.0;
67847 if (frameCounter > 7.0)
67848 {
67849 frame.Y += num;
67850 frameCounter = 0.0;
67851 }
67852 if (frame.Y / num > 15)
67853 {
67854 frame.Y = num * 2;
67855 }
67856 if (frame.Y / num < 2)
67857 {
67858 frame.Y = num * 2;
67859 }
67860 }
67861 else
67862 {
67863 frameCounter = 0.0;
67864 frame.Y = num;
67865 }
67866 break;
67867 }
67868 case 166:
67869 if (velocity.Y == 0f)
67870 {
67871 if (direction == 1)
67872 {
67873 spriteDirection = 1;
67874 }
67875 if (direction == -1)
67876 {
67877 spriteDirection = -1;
67878 }
67879 if (velocity.X == 0f)
67880 {
67881 frameCounter += 2.0;
67882 if (frameCounter > 7.0)
67883 {
67884 frame.Y += num;
67885 frameCounter = 0.0;
67886 }
67887 if (frame.Y / num > 5)
67888 {
67889 frame.Y = 0;
67890 }
67891 break;
67892 }
67894 frameCounter += 1.0;
67895 if (frameCounter > 9.0)
67896 {
67897 frame.Y += num;
67898 frameCounter = 0.0;
67899 }
67900 if (frame.Y / num > 12)
67901 {
67902 frame.Y = num * 7;
67903 }
67904 if (frame.Y / num < 7)
67905 {
67906 frame.Y = num * 7;
67907 }
67908 }
67909 else
67910 {
67911 frameCounter = 0.0;
67912 frame.Y = num * 6;
67913 }
67914 break;
67915 case 469:
67916 if (ai[2] == 1f)
67917 {
67918 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
67919 if (velocity.X < 0f)
67920 {
67921 direction = -1;
67922 }
67923 if (velocity.X > 0f)
67924 {
67925 direction = 1;
67926 }
67929 if (frameCounter > 11.0)
67930 {
67931 frame.Y += num;
67932 frameCounter = 0.0;
67933 }
67934 if (frame.Y / num > 5)
67935 {
67936 frame.Y = num * 2;
67937 }
67938 if (frame.Y / num < 2)
67939 {
67940 frame.Y = num * 2;
67941 }
67942 break;
67943 }
67944 rotation = 0f;
67945 if (velocity.Y == 0f)
67946 {
67947 if (direction == 1)
67948 {
67949 spriteDirection = 1;
67950 }
67951 if (direction == -1)
67952 {
67953 spriteDirection = -1;
67954 }
67955 if (velocity.X == 0f)
67956 {
67957 frameCounter = 0.0;
67958 frame.Y = 0;
67959 break;
67960 }
67962 frameCounter += 1.0;
67963 if (frameCounter > 9.0)
67964 {
67965 frame.Y += num;
67966 frameCounter = 0.0;
67967 }
67968 if (frame.Y / num > 11)
67969 {
67970 frame.Y = num * 6;
67971 }
67972 if (frame.Y / num < 6)
67973 {
67974 frame.Y = num * 6;
67975 }
67976 }
67977 else
67978 {
67979 frameCounter = 0.0;
67980 frame.Y = num;
67981 }
67982 break;
67983 case 351:
67984 if (velocity.Y == 0f)
67985 {
67986 if (direction == 1)
67987 {
67988 spriteDirection = 1;
67989 }
67990 if (direction == -1)
67991 {
67992 spriteDirection = -1;
67993 }
67994 if (velocity.X == 0f)
67995 {
67996 frame.Y = 0;
67997 frameCounter = 0.0;
67998 break;
67999 }
68000 if (frame.Y < num * 2)
68001 {
68002 frame.Y = num * 2;
68003 }
68004 frameCounter += Math.Abs(velocity.X) * 1f;
68005 frameCounter += 1.0;
68006 if (frameCounter > 8.0)
68007 {
68008 frame.Y += num;
68009 frameCounter = 0.0;
68010 }
68011 if (frame.Y / num >= Main.npcFrameCount[type])
68012 {
68013 frame.Y = num * 2;
68014 }
68015 }
68016 else
68017 {
68018 if (velocity.Y < 0f)
68019 {
68020 frame.Y = num;
68021 }
68022 else
68023 {
68024 frame.Y = num;
68025 }
68026 frameCounter = 0.0;
68027 }
68028 break;
68029 case 343:
68030 if (velocity.Y == 0f)
68031 {
68032 if (direction == 1)
68033 {
68034 spriteDirection = 1;
68035 }
68036 if (direction == -1)
68037 {
68038 spriteDirection = -1;
68039 }
68040 if (velocity.X == 0f)
68041 {
68042 frame.Y = num * 2;
68043 frameCounter = 0.0;
68044 break;
68045 }
68046 if (frame.Y < num * 2)
68047 {
68048 frame.Y = num * 2;
68049 }
68050 frameCounter += Math.Abs(velocity.X) * 1f;
68051 frameCounter += 1.0;
68052 if (frameCounter > 6.0)
68053 {
68054 frame.Y += num;
68055 frameCounter = 0.0;
68056 }
68057 if (frame.Y / num >= Main.npcFrameCount[type])
68058 {
68059 frame.Y = num * 2;
68060 }
68061 }
68062 else
68063 {
68064 if (velocity.Y < 0f)
68065 {
68066 frame.Y = 0;
68067 }
68068 else
68069 {
68070 frame.Y = num;
68071 }
68072 frameCounter = 0.0;
68073 }
68074 break;
68075 case 269:
68076 case 270:
68077 case 271:
68078 case 272:
68079 case 273:
68080 case 274:
68081 case 275:
68082 case 276:
68083 case 277:
68084 case 278:
68085 case 279:
68086 case 280:
68087 if (velocity.Y == 0f)
68088 {
68089 if (direction == 1)
68090 {
68091 spriteDirection = 1;
68092 }
68093 if (direction == -1)
68094 {
68095 spriteDirection = -1;
68096 }
68097 if (velocity.X == 0f)
68098 {
68099 if (type == 140)
68100 {
68101 frame.Y = num;
68102 frameCounter = 0.0;
68103 }
68104 else
68105 {
68106 frame.Y = 0;
68107 frameCounter = 0.0;
68108 }
68109 break;
68110 }
68111 if (frame.Y < num * 2)
68112 {
68113 frame.Y = num * 2;
68114 }
68115 frameCounter += Math.Abs(velocity.X) * 2f;
68116 frameCounter += 1.0;
68117 if (frameCounter > 6.0)
68118 {
68119 frame.Y += num;
68120 frameCounter = 0.0;
68121 }
68122 if (frame.Y / num >= Main.npcFrameCount[type])
68123 {
68124 frame.Y = num * 2;
68125 }
68126 }
68127 else
68128 {
68129 frameCounter = 0.0;
68130 frame.Y = 0;
68131 }
68132 break;
68133 case 230:
68134 if (velocity.Y == 0f)
68135 {
68136 rotation = 0f;
68137 if (direction == 1)
68138 {
68139 spriteDirection = 1;
68140 }
68141 if (direction == -1)
68142 {
68143 spriteDirection = -1;
68144 }
68145 if (velocity.X == 0f)
68146 {
68147 frame.Y = 0;
68148 frameCounter = 0.0;
68149 break;
68150 }
68151 frameCounter += Math.Abs(velocity.X) * 2f;
68152 frameCounter += 1.0;
68153 if (frameCounter > 10.0)
68154 {
68155 frame.Y += num;
68156 frameCounter = 0.0;
68157 }
68158 if (frame.Y / num >= Main.npcFrameCount[type])
68159 {
68160 frame.Y = 0;
68161 }
68162 }
68163 else
68164 {
68165 frameCounter = 0.0;
68166 frame.Y = 0;
68167 if (velocity.Y > 4f)
68168 {
68169 rotation -= velocity.Y * 0.01f;
68170 }
68171 }
68172 break;
68173 case 593:
68174 if (velocity.Y == 0f)
68175 {
68176 rotation = 0f;
68177 if (direction == 1)
68178 {
68179 spriteDirection = 1;
68180 }
68181 if (direction == -1)
68182 {
68183 spriteDirection = -1;
68184 }
68185 if (velocity.X == 0f)
68186 {
68187 frame.Y = 0;
68188 frameCounter = 0.0;
68189 break;
68190 }
68191 frameCounter += Math.Abs(velocity.X) * 2f;
68192 frameCounter += 1.0;
68193 if (frameCounter > 10.0)
68194 {
68195 frame.Y += num;
68196 frameCounter = 0.0;
68197 }
68198 if (frame.Y / num >= Main.npcFrameCount[type])
68199 {
68200 frame.Y = 0;
68201 }
68202 }
68203 else
68204 {
68205 frameCounter = 0.0;
68206 frame.Y = 0;
68207 if (velocity.Y > 4f)
68208 {
68209 rotation -= velocity.Y * 0.01f;
68210 }
68211 }
68212 break;
68213 case 290:
68214 if (velocity.Y == 0f)
68215 {
68216 if (direction == 1)
68217 {
68218 spriteDirection = 1;
68219 }
68220 if (direction == -1)
68221 {
68222 spriteDirection = -1;
68223 }
68224 if (ai[2] > 0f)
68225 {
68226 if (ai[1] < 10f)
68227 {
68228 frame.Y = num * 11;
68229 }
68230 else if (ai[1] < 20f)
68231 {
68232 frame.Y = num * 10;
68233 }
68234 else
68235 {
68236 frame.Y = num * 9;
68237 }
68238 break;
68239 }
68240 if (velocity.X == 0f)
68241 {
68242 frameCounter = 0.0;
68243 frame.Y = 0;
68244 break;
68245 }
68246 if (frame.Y < num * 2)
68247 {
68248 frame.Y = num * 2;
68249 }
68250 frameCounter += Math.Abs(velocity.X) * 1f;
68251 if (frameCounter > 6.0)
68252 {
68253 frame.Y += num;
68254 frameCounter = 0.0;
68255 }
68256 if (frame.Y > num * 8)
68257 {
68258 frame.Y = num * 2;
68259 }
68260 }
68261 else
68262 {
68263 frameCounter = 0.0;
68264 frame.Y = num;
68265 }
68266 break;
68267 case 110:
68268 case 214:
68269 case 215:
68270 case 216:
68271 case 293:
68272 if (velocity.Y == 0f)
68273 {
68274 if (direction == 1)
68275 {
68276 spriteDirection = 1;
68277 }
68278 if (direction == -1)
68279 {
68280 spriteDirection = -1;
68281 }
68282 if (ai[2] > 0f)
68283 {
68285 frame.Y = num * (int)ai[2];
68286 frameCounter = 0.0;
68287 break;
68288 }
68289 if (frame.Y < num * 6)
68290 {
68291 frame.Y = num * 6;
68292 }
68293 frameCounter += Math.Abs(velocity.X) * 2f;
68295 if (frameCounter > 6.0)
68296 {
68297 frame.Y += num;
68298 frameCounter = 0.0;
68299 }
68300 if (frame.Y / num >= Main.npcFrameCount[type])
68301 {
68302 frame.Y = num * 6;
68303 }
68304 }
68305 else
68306 {
68307 frameCounter = 0.0;
68308 frame.Y = 0;
68309 }
68310 break;
68311 case 206:
68312 if (velocity.Y == 0f)
68313 {
68314 if (direction == 1)
68315 {
68316 spriteDirection = 1;
68317 }
68318 if (direction == -1)
68319 {
68320 spriteDirection = -1;
68321 }
68322 if (ai[2] > 0f)
68323 {
68325 frame.Y = num * (int)ai[2];
68326 frameCounter = 0.0;
68327 break;
68328 }
68329 if (frame.Y < num * 6)
68330 {
68331 frame.Y = num * 6;
68332 }
68333 frameCounter += Math.Abs(velocity.X) * 2f;
68335 if (frameCounter > 6.0)
68336 {
68337 frame.Y += num;
68338 frameCounter = 0.0;
68339 }
68340 if (frame.Y / num >= Main.npcFrameCount[type])
68341 {
68342 frame.Y = num * 6;
68343 }
68344 }
68345 else
68346 {
68347 frameCounter = 0.0;
68348 frame.Y = 0;
68349 }
68350 break;
68351 case 350:
68352 if (velocity.Y == 0f)
68353 {
68354 if (direction == 1)
68355 {
68356 spriteDirection = 1;
68357 }
68358 if (direction == -1)
68359 {
68360 spriteDirection = -1;
68361 }
68362 if (ai[2] > 0f)
68363 {
68365 frame.Y = num * ((int)ai[2] - 1);
68366 frameCounter = 0.0;
68367 break;
68368 }
68369 if (frame.Y < num * 7)
68370 {
68371 frame.Y = num * 7;
68372 }
68373 frameCounter += Math.Abs(velocity.X) * 2f;
68374 frameCounter += velocity.X * 1.3f;
68375 if (frameCounter > 4.0)
68376 {
68377 frame.Y += num;
68378 frameCounter = 0.0;
68379 }
68380 if (frame.Y / num >= Main.npcFrameCount[type])
68381 {
68382 frame.Y = num * 7;
68383 }
68384 }
68385 else
68386 {
68387 frameCounter = 0.0;
68388 frame.Y = num * 5;
68389 }
68390 break;
68391 case 111:
68392 case 291:
68393 case 292:
68394 if (velocity.Y == 0f)
68395 {
68396 if (direction == 1)
68397 {
68398 spriteDirection = 1;
68399 }
68400 if (direction == -1)
68401 {
68402 spriteDirection = -1;
68403 }
68404 if (ai[2] > 0f)
68405 {
68407 frame.Y = num * ((int)ai[2] - 1);
68408 frameCounter = 0.0;
68409 break;
68410 }
68411 if (frame.Y < num * 7)
68412 {
68413 frame.Y = num * 7;
68414 }
68415 frameCounter += Math.Abs(velocity.X) * 2f;
68416 frameCounter += velocity.X * 1.3f;
68417 if (frameCounter > 6.0)
68418 {
68419 frame.Y += num;
68420 frameCounter = 0.0;
68421 }
68422 if (frame.Y / num >= Main.npcFrameCount[type])
68423 {
68424 frame.Y = num * 7;
68425 }
68426 }
68427 else
68428 {
68429 frameCounter = 0.0;
68430 frame.Y = num * 6;
68431 }
68432 break;
68433 case 257:
68434 if (velocity.Y == 0f)
68435 {
68436 if (direction == 1)
68437 {
68438 spriteDirection = 1;
68439 }
68440 if (direction == -1)
68441 {
68442 spriteDirection = -1;
68443 }
68444 }
68445 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
68446 {
68447 frameCounter = 0.0;
68448 frame.Y = num * 4;
68449 break;
68450 }
68451 if (velocity.X == 0f)
68452 {
68453 frameCounter = 0.0;
68454 frame.Y = 0;
68455 break;
68456 }
68458 if (frameCounter < 8.0)
68459 {
68460 frame.Y = 0;
68461 }
68462 else if (frameCounter < 16.0)
68463 {
68464 frame.Y = num;
68465 }
68466 else if (frameCounter < 24.0)
68467 {
68468 frame.Y = num * 2;
68469 }
68470 else if (frameCounter < 32.0)
68471 {
68472 frame.Y = num * 3;
68473 }
68474 else
68475 {
68476 frameCounter = 0.0;
68477 }
68478 break;
68479 case 258:
68480 if (velocity.Y == 0f)
68481 {
68482 if (direction == 1)
68483 {
68484 spriteDirection = 1;
68485 }
68486 if (direction == -1)
68487 {
68488 spriteDirection = -1;
68489 }
68490 }
68491 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
68492 {
68493 frameCounter += 1.0;
68494 if (frameCounter > 1.0)
68495 {
68496 frame.Y += num;
68497 frameCounter = 0.0;
68498 }
68499 if (frame.Y > num * 5 || frame.Y < num * 3)
68500 {
68501 frame.Y = num * 3;
68502 }
68503 }
68504 else if (velocity.X == 0f)
68505 {
68506 frameCounter = 0.0;
68507 frame.Y = 0;
68508 }
68509 else
68510 {
68512 if (frameCounter < 8.0)
68513 {
68514 frame.Y = 0;
68515 }
68516 else if (frameCounter < 16.0)
68517 {
68518 frame.Y = num;
68519 }
68520 else if (frameCounter < 24.0)
68521 {
68522 frame.Y = num * 2;
68523 }
68524 else
68525 {
68526 frameCounter = 0.0;
68527 }
68528 }
68529 break;
68530 case 348:
68531 if (velocity.Y == 0f)
68532 {
68533 if (direction == 1)
68534 {
68535 spriteDirection = 1;
68536 }
68537 if (direction == -1)
68538 {
68539 spriteDirection = -1;
68540 }
68541 }
68542 if (velocity.Y != 0f)
68543 {
68544 frameCounter = 0.0;
68545 frame.Y = num * 8;
68546 break;
68547 }
68548 if (velocity.X == 0f)
68549 {
68550 frameCounter = 0.0;
68551 frame.Y = 0;
68552 break;
68553 }
68555 frameCounter += 1.0;
68556 if (frameCounter > 6.0)
68557 {
68558 frame.Y += num;
68559 frameCounter = 0.0;
68560 }
68561 if (frame.Y > num * 7)
68562 {
68563 frame.Y = num;
68564 }
68565 break;
68566 case 349:
68567 frameCounter += 1.0;
68568 if (frameCounter > 3.0)
68569 {
68570 frame.Y += num;
68571 frameCounter = 0.0;
68572 }
68573 if (frame.Y > num * 7)
68574 {
68575 frame.Y = 0;
68576 }
68577 break;
68578 case 3:
68579 case 52:
68580 case 53:
68581 case 132:
68582 case 161:
68583 case 186:
68584 case 187:
68585 case 188:
68586 case 189:
68587 case 200:
68588 case 223:
68589 case 251:
68590 case 254:
68591 case 255:
68592 case 319:
68593 case 320:
68594 case 321:
68595 case 331:
68596 case 332:
68597 case 342:
68598 case 536:
68599 case 590:
68600 if (velocity.Y == 0f)
68601 {
68602 if (direction == 1)
68603 {
68604 spriteDirection = 1;
68605 }
68606 if (direction == -1)
68607 {
68608 spriteDirection = -1;
68609 }
68610 }
68611 if (velocity.Y != 0f || (direction == -1 && velocity.X > 0f) || (direction == 1 && velocity.X < 0f))
68612 {
68613 frameCounter = 0.0;
68614 frame.Y = num * 2;
68615 break;
68616 }
68617 if (velocity.X == 0f)
68618 {
68619 frameCounter = 0.0;
68620 frame.Y = 0;
68621 break;
68622 }
68624 if (frameCounter < 8.0)
68625 {
68626 frame.Y = 0;
68627 }
68628 else if (frameCounter < 16.0)
68629 {
68630 frame.Y = num;
68631 }
68632 else if (frameCounter < 24.0)
68633 {
68634 frame.Y = num * 2;
68635 }
68636 else if (frameCounter < 32.0)
68637 {
68638 frame.Y = num;
68639 }
68640 else
68641 {
68642 frameCounter = 0.0;
68643 }
68644 break;
68645 case 148:
68646 case 149:
68647 case 168:
68648 case 470:
68649 {
68650 int num50 = 0;
68651 if (localAI[0] == 2f)
68652 {
68653 num50 = 3;
68654 }
68655 if (localAI[0] == 3f)
68656 {
68657 num50 = 6;
68658 }
68659 if (localAI[0] == 4f)
68660 {
68661 num50 = 9;
68662 }
68663 num50 *= num;
68664 if (velocity.Y == 0f)
68665 {
68666 if (direction == 1)
68667 {
68668 spriteDirection = 1;
68669 }
68670 if (direction == -1)
68671 {
68672 spriteDirection = -1;
68673 }
68674 if (velocity.X == 0f)
68675 {
68676 frame.Y = num50;
68677 frameCounter = 0.0;
68678 break;
68679 }
68680 frameCounter += Math.Abs(velocity.X) * 1f;
68681 if (frameCounter < 6.0)
68682 {
68683 frame.Y = num50;
68684 break;
68685 }
68686 if (frameCounter < 12.0)
68687 {
68688 frame.Y = num + num50;
68689 break;
68690 }
68691 if (frameCounter < 15.0)
68692 {
68693 frame.Y = num * 2 + num50;
68694 break;
68695 }
68696 frameCounter = 0.0;
68697 frame.Y = num * 2 + num50;
68698 }
68699 else if (velocity.Y < 0f)
68700 {
68701 frameCounter = 0.0;
68702 frame.Y = num * 2 + num50;
68703 }
68704 else if (velocity.Y > 0f)
68705 {
68706 frameCounter = 0.0;
68707 frame.Y = num * 2 + num50;
68708 }
68709 break;
68710 }
68711 case 299:
68712 case 538:
68713 case 539:
68714 case 639:
68715 case 640:
68716 case 641:
68717 case 642:
68718 case 643:
68719 case 644:
68720 case 645:
68721 if (velocity.Y == 0f)
68722 {
68723 if (direction == 1)
68724 {
68725 spriteDirection = 1;
68726 }
68727 if (direction == -1)
68728 {
68729 spriteDirection = -1;
68730 }
68731 if (velocity.X == 0f)
68732 {
68733 frame.Y = 0;
68734 frameCounter = 0.0;
68735 break;
68736 }
68737 frameCounter += Math.Abs(velocity.X) * 0.5f;
68738 frameCounter += 1.0;
68739 if (frameCounter > 6.0)
68740 {
68741 frame.Y += num;
68742 frameCounter = 0.0;
68743 }
68744 if (frame.Y / num >= Main.npcFrameCount[type] - 1)
68745 {
68746 frame.Y = num;
68747 }
68748 }
68749 else if (velocity.Y < 0f)
68750 {
68751 frameCounter = 0.0;
68752 frame.Y = num * 2;
68753 }
68754 else if (velocity.Y > 0f)
68755 {
68756 frameCounter = 0.0;
68757 frame.Y = num * 4;
68758 }
68759 break;
68760 case 300:
68761 case 447:
68762 if (velocity.Y == 0f)
68763 {
68764 if (direction == 1)
68765 {
68766 spriteDirection = 1;
68767 }
68768 if (direction == -1)
68769 {
68770 spriteDirection = -1;
68771 }
68772 if (velocity.X == 0f)
68773 {
68774 frameCounter += 1.0;
68775 if (frameCounter > 8.0)
68776 {
68777 frame.Y += num;
68778 frameCounter = 0.0;
68779 }
68780 if (frame.Y / num > 1)
68781 {
68782 frame.Y = 0;
68783 }
68784 break;
68785 }
68786 frameCounter += Math.Abs(velocity.X) * 0.5f;
68787 frameCounter += 1.0;
68788 if (frameCounter > 6.0)
68789 {
68790 frame.Y += num;
68791 frameCounter = 0.0;
68792 }
68793 if (frame.Y / num >= Main.npcFrameCount[type])
68794 {
68795 frame.Y = num * 2;
68796 }
68797 }
68798 else
68799 {
68800 frameCounter += Math.Abs(velocity.X) * 0.5f;
68801 frameCounter += 1.0;
68802 if (frameCounter > 6.0)
68803 {
68804 frame.Y += num;
68805 frameCounter = 0.0;
68806 }
68807 if (frame.Y / num >= Main.npcFrameCount[type])
68808 {
68809 frame.Y = num * 2;
68810 }
68811 }
68812 break;
68813 case 610:
68814 if (velocity.Y == 0f)
68815 {
68816 if (direction == 1)
68817 {
68818 spriteDirection = 1;
68819 }
68820 if (direction == -1)
68821 {
68822 spriteDirection = -1;
68823 }
68824 if (velocity.X == 0f)
68825 {
68826 frameCounter += 1.0;
68827 if (frameCounter > 8.0)
68828 {
68829 frame.Y += num;
68830 frameCounter = 0.0;
68831 }
68832 if (frame.Y / num > 1)
68833 {
68834 frame.Y = 0;
68835 }
68836 break;
68837 }
68838 frameCounter += Math.Abs(velocity.X) * 0.5f;
68839 frameCounter += 1.0;
68840 if (frameCounter > 6.0)
68841 {
68842 frame.Y += num;
68843 frameCounter = 0.0;
68844 }
68845 if (frame.Y / num >= Main.npcFrameCount[type])
68846 {
68847 frame.Y = num * 2;
68848 }
68849 }
68850 else
68851 {
68852 frameCounter += Math.Abs(velocity.X) * 0.5f;
68853 frameCounter += 1.0;
68854 if (frameCounter > 6.0)
68855 {
68856 frame.Y += num;
68857 frameCounter = 0.0;
68858 }
68859 if (frame.Y / num >= Main.npcFrameCount[type])
68860 {
68861 frame.Y = num * 2;
68862 }
68863 }
68864 break;
68865 case 361:
68866 case 445:
68867 case 687:
68869 if (wet)
68870 {
68871 frameCounter = 0.0;
68872 if (velocity.X > 0.25f || velocity.X < -0.25f)
68873 {
68874 frame.Y = num * 10;
68875 }
68876 else if (velocity.X > 0.15f || velocity.X < -0.15f)
68877 {
68878 frame.Y = num * 11;
68879 }
68880 else
68881 {
68882 frame.Y = num * 12;
68883 }
68884 }
68885 else if (velocity.Y == 0f)
68886 {
68887 if (velocity.X == 0f)
68888 {
68889 frameCounter += 1.0;
68890 if (frameCounter > 6.0)
68891 {
68892 frameCounter = 0.0;
68893 frame.Y += num;
68894 }
68895 if (frame.Y > num * 5)
68896 {
68897 frame.Y = 0;
68898 }
68899 break;
68900 }
68901 frameCounter += 1.0;
68902 int num219 = 6;
68903 if (frameCounter < (double)num219)
68904 {
68905 frame.Y = 0;
68906 break;
68907 }
68908 if (frameCounter < (double)(num219 * 2))
68909 {
68910 frame.Y = num * 6;
68911 break;
68912 }
68913 if (frameCounter < (double)(num219 * 3))
68914 {
68915 frame.Y = num * 8;
68916 break;
68917 }
68918 frame.Y = num * 9;
68919 if (frameCounter >= (double)(num219 * 4 - 1))
68920 {
68921 frameCounter = 0.0;
68922 }
68923 }
68924 else if (velocity.Y > 0f)
68925 {
68926 frame.Y = num * 9;
68927 }
68928 else
68929 {
68930 frame.Y = num * 8;
68931 }
68932 break;
68933 case 616:
68934 case 617:
68935 {
68936 int num184 = 8;
68937 int num185 = 5;
68938 if (velocity.X == 0f)
68939 {
68940 num185 = 10;
68941 }
68943 if (wet)
68944 {
68945 frameCounter++;
68946 if (frameCounter > (double)num185)
68947 {
68948 frameCounter = 0.0;
68949 frame.Y += num;
68950 if (frame.Y > num * 13)
68951 {
68952 frame.Y = num * 8;
68953 }
68954 }
68955 break;
68956 }
68957 frameCounter++;
68958 if (frameCounter > (double)num184)
68959 {
68960 frameCounter = 0.0;
68961 frame.Y += num;
68962 if (frame.Y > num * 7)
68963 {
68964 frame.Y = 0;
68965 }
68966 }
68967 if (velocity.X == 0f)
68968 {
68969 frameCounter = 0.0;
68970 frame.Y = 0;
68971 }
68972 if (velocity.Y != 0f)
68973 {
68974 frameCounter = 0.0;
68975 frame.Y = num * 8;
68976 }
68977 break;
68978 }
68979 case 625:
68980 {
68981 int num174 = 7;
68982 int num175 = 4;
68983 if (velocity.X == 0f)
68984 {
68985 num175 = 8;
68986 }
68988 if (wet)
68989 {
68990 if (frame.Y < num * 6)
68991 {
68992 frame.Y = num * 6;
68993 }
68994 frameCounter++;
68995 if (frameCounter > (double)num175)
68996 {
68997 frameCounter = 0.0;
68998 frame.Y += num;
68999 if (frame.Y > num * 11)
69000 {
69001 frame.Y = num * 6;
69002 }
69003 }
69004 break;
69005 }
69006 if (frame.Y > num * 5)
69007 {
69008 frame.Y = 0;
69009 }
69010 frameCounter++;
69011 if (frameCounter > (double)num174)
69012 {
69013 frameCounter = 0.0;
69014 frame.Y += num;
69015 if (frame.Y > num * 5)
69016 {
69017 frame.Y = 0;
69018 }
69019 }
69020 if (velocity.X == 0f)
69021 {
69022 frameCounter = 0.0;
69023 frame.Y = 0;
69024 }
69025 break;
69026 }
69027 case 626:
69028 case 627:
69029 if (velocity.X != 0f)
69030 {
69031 spriteDirection = ((!(velocity.X < 0f)) ? 1 : (-1));
69032 }
69034 {
69035 frameCounter++;
69036 if (frameCounter > 5.0)
69037 {
69038 frameCounter = 0.0;
69039 frame.Y += num;
69040 }
69041 if (frame.Y > num * 5)
69042 {
69043 frame.Y = 0;
69044 }
69045 }
69046 else if (!wet)
69047 {
69048 frame.Y = 0;
69049 }
69050 else if (velocity.Length() > 0.15f)
69051 {
69052 frame.Y = num * 3;
69053 }
69054 else if (velocity.Length() > 0.05f)
69055 {
69056 frame.Y = num * 2;
69057 }
69058 else if (velocity.Length() > 0.025f)
69059 {
69060 frame.Y = num;
69061 }
69062 else
69063 {
69064 frame.Y = 0;
69065 }
69066 break;
69067 case 366:
69068 case 367:
69069 if (velocity.Y == 0f)
69070 {
69071 if (direction == 1)
69072 {
69073 spriteDirection = 1;
69074 }
69075 if (direction == -1)
69076 {
69077 spriteDirection = -1;
69078 }
69079 }
69080 if (velocity.X == 0f)
69081 {
69082 frame.Y = 0;
69083 frameCounter = 0.0;
69084 break;
69085 }
69086 frameCounter += Math.Abs(velocity.X) * 1f;
69087 frameCounter += 1.0;
69088 if (frameCounter > 6.0)
69089 {
69090 frame.Y += num;
69091 frameCounter = 0.0;
69092 }
69093 if (frame.Y / num >= Main.npcFrameCount[type])
69094 {
69095 frame.Y = 0;
69096 }
69097 break;
69098 case 46:
69099 case 47:
69100 case 303:
69101 case 337:
69102 case 443:
69103 case 464:
69104 case 540:
69105 case 614:
69106 case 646:
69107 case 647:
69108 case 648:
69109 case 649:
69110 case 650:
69111 case 651:
69112 case 652:
69113 if (velocity.Y == 0f)
69114 {
69115 if (direction == 1)
69116 {
69117 spriteDirection = 1;
69118 }
69119 if (direction == -1)
69120 {
69121 spriteDirection = -1;
69122 }
69123 if (velocity.X == 0f)
69124 {
69125 frame.Y = 0;
69126 frameCounter = 0.0;
69127 break;
69128 }
69129 frameCounter += Math.Abs(velocity.X) * 1f;
69130 frameCounter += 1.0;
69131 if (frameCounter > 6.0)
69132 {
69133 frame.Y += num;
69134 frameCounter = 0.0;
69135 }
69136 if (frame.Y / num >= Main.npcFrameCount[type])
69137 {
69138 frame.Y = 0;
69139 }
69140 }
69141 else if (velocity.Y < 0f)
69142 {
69143 frameCounter = 0.0;
69144 frame.Y = num * 4;
69145 }
69146 else if (velocity.Y > 0f)
69147 {
69148 frameCounter = 0.0;
69149 frame.Y = num * 6;
69150 }
69151 break;
69152 case 4:
69153 case 125:
69154 case 126:
69155 frameCounter += 1.0;
69156 if (frameCounter < 7.0)
69157 {
69158 frame.Y = 0;
69159 }
69160 else if (frameCounter < 14.0)
69161 {
69162 frame.Y = num;
69163 }
69164 else if (frameCounter < 21.0)
69165 {
69166 frame.Y = num * 2;
69167 }
69168 else
69169 {
69170 frameCounter = 0.0;
69171 frame.Y = 0;
69172 }
69173 if (ai[0] > 1f)
69174 {
69175 frame.Y += num * 3;
69176 }
69177 break;
69178 case 5:
69179 frameCounter += 1.0;
69180 if (frameCounter >= 8.0)
69181 {
69182 frame.Y += num;
69183 frameCounter = 0.0;
69184 }
69185 if (frame.Y >= num * Main.npcFrameCount[type])
69186 {
69187 frame.Y = 0;
69188 }
69189 break;
69190 case 94:
69191 frameCounter += 1.0;
69192 if (frameCounter < 6.0)
69193 {
69194 frame.Y = 0;
69195 break;
69196 }
69197 if (frameCounter < 12.0)
69198 {
69199 frame.Y = num;
69200 break;
69201 }
69202 if (frameCounter < 18.0)
69203 {
69204 frame.Y = num * 2;
69205 break;
69206 }
69207 frame.Y = num;
69208 if (frameCounter >= 23.0)
69209 {
69210 frameCounter = 0.0;
69211 }
69212 break;
69213 case 6:
69214 case 173:
69215 frameCounter += 1.0;
69216 if (frameCounter >= 8.0)
69217 {
69218 frame.Y += num;
69219 frameCounter = 0.0;
69220 }
69221 if (frame.Y >= num * Main.npcFrameCount[type])
69222 {
69223 frame.Y = 0;
69224 }
69225 break;
69226 case 24:
69227 if (velocity.Y == 0f)
69228 {
69229 if (direction == 1)
69230 {
69231 spriteDirection = 1;
69232 }
69233 if (direction == -1)
69234 {
69235 spriteDirection = -1;
69236 }
69237 }
69238 if (ai[1] > 0f)
69239 {
69240 if (frame.Y < 4)
69241 {
69242 frameCounter = 0.0;
69243 }
69244 frameCounter += 1.0;
69245 if (frameCounter <= 4.0)
69246 {
69247 frame.Y = num * 4;
69248 break;
69249 }
69250 if (frameCounter <= 8.0)
69251 {
69252 frame.Y = num * 5;
69253 break;
69254 }
69255 if (frameCounter <= 12.0)
69256 {
69257 frame.Y = num * 6;
69258 break;
69259 }
69260 if (frameCounter <= 16.0)
69261 {
69262 frame.Y = num * 7;
69263 break;
69264 }
69265 if (frameCounter <= 20.0)
69266 {
69267 frame.Y = num * 8;
69268 break;
69269 }
69270 frame.Y = num * 9;
69271 frameCounter = 100.0;
69272 break;
69273 }
69274 frameCounter += 1.0;
69275 if (frameCounter <= 4.0)
69276 {
69277 frame.Y = 0;
69278 break;
69279 }
69280 if (frameCounter <= 8.0)
69281 {
69282 frame.Y = num;
69283 break;
69284 }
69285 if (frameCounter <= 12.0)
69286 {
69287 frame.Y = num * 2;
69288 break;
69289 }
69290 frame.Y = num * 3;
69291 if (frameCounter >= 16.0)
69292 {
69293 frameCounter = 0.0;
69294 }
69295 break;
69296 case 29:
69297 case 32:
69298 case 45:
69299 case 172:
69300 case 281:
69301 case 282:
69302 case 283:
69303 case 284:
69304 case 285:
69305 case 286:
69306 if (velocity.Y == 0f)
69307 {
69308 if (direction == 1)
69309 {
69310 spriteDirection = 1;
69311 }
69312 if (direction == -1)
69313 {
69314 spriteDirection = -1;
69315 }
69316 }
69317 frame.Y = 0;
69318 if (velocity.Y != 0f)
69319 {
69320 frame.Y += num * 2;
69321 }
69322 else if (ai[1] > 0f)
69323 {
69324 frame.Y += num;
69325 }
69326 break;
69327 case 34:
69328 frameCounter += 1.0;
69329 if (frameCounter >= 4.0)
69330 {
69331 frame.Y += num;
69332 frameCounter = 0.0;
69333 }
69334 if (frame.Y >= num * Main.npcFrameCount[type])
69335 {
69336 frame.Y = 0;
69337 }
69338 break;
69339 case 624:
69340 if (velocity.Y == 0f)
69341 {
69343 }
69344 if (velocity.X == 0f && velocity.Y == 0f)
69345 {
69346 frameCounter = 0.0;
69347 frame.Y = 0;
69348 break;
69349 }
69350 if (velocity.Y < 0f)
69351 {
69352 frameCounter = 0.0;
69353 frame.Y = 9 * num;
69354 break;
69355 }
69356 if (velocity.Y > 0f)
69357 {
69358 frameCounter = 0.0;
69359 frame.Y = 10 * num;
69360 break;
69361 }
69363 if (frameCounter > 8.0)
69364 {
69365 int num55 = frame.Y / num;
69366 frameCounter -= 8.0;
69367 num55++;
69368 if (num55 > 8)
69369 {
69370 num55 = 1;
69371 }
69372 frame.Y = num55 * num;
69373 }
69374 break;
69375 case 628:
69376 spriteDirection = ((!(Main.WindForVisuals > 0f)) ? 1 : (-1));
69378 {
69379 int num3 = frame.Y / num;
69380 int num4 = 5;
69381 spriteDirection = 1;
69382 frameCounter++;
69383 if (frameCounter > (double)num4)
69384 {
69385 frameCounter -= num4;
69386 num3++;
69387 if (num3 > 5)
69388 {
69389 num3 = 0;
69390 }
69391 frame.Y = num3 * num;
69392 }
69393 }
69394 else if (ai[0] == 0f)
69395 {
69396 int num5 = frame.Y / num;
69397 int num6 = 8;
69398 if (num5 == 6)
69399 {
69400 frameCounter += 1f + 0.5f * Math.Abs(Main.WindForVisuals);
69401 if (frameCounter > (double)num6)
69402 {
69403 frameCounter -= num6;
69404 num5 = 0;
69405 frame.Y = num5 * num;
69406 }
69407 break;
69408 }
69409 if (num5 > 5)
69410 {
69411 num5 = 6;
69412 frameCounter = 0.0;
69413 frame.Y = num5 * num;
69414 break;
69415 }
69416 frameCounter += 1f + 0.5f * Math.Abs(Main.WindForVisuals);
69417 if (frameCounter > (double)num6)
69418 {
69419 frameCounter -= num6;
69420 num5++;
69421 if (num5 > 5)
69422 {
69423 num5 = 0;
69424 }
69425 frame.Y = num5 * num;
69426 }
69427 }
69428 else if (localAI[0] == 0f)
69429 {
69430 frameCounter++;
69431 if (!(frameCounter > 4.0))
69432 {
69433 break;
69434 }
69435 frameCounter = 0.0;
69436 int num7 = frame.Y / num;
69437 if (num7 == 6)
69438 {
69439 num7 = 7;
69440 }
69441 else if (num7 < 7)
69442 {
69443 num7 = 6;
69444 }
69445 else
69446 {
69447 num7++;
69448 if (num7 > 10)
69449 {
69450 num7 = 7;
69451 }
69452 }
69453 frame.Y = num7 * num;
69454 }
69455 else if (localAI[0] == 1f)
69456 {
69457 int num8 = frame.Y / num;
69458 num8 = (int)MathHelper.Lerp(7f, 20f, (float)frameCounter / 80f);
69459 if (num8 > 19)
69460 {
69461 num8 = 19;
69462 }
69463 if (num8 > 16)
69464 {
69465 num8 -= 9;
69466 }
69467 frameCounter++;
69468 if (frameCounter > 80.0)
69469 {
69470 frameCounter = 0.0;
69471 }
69472 frame.Y = num8 * num;
69473 }
69474 break;
69475 }
69476 if (aiStyle == 39 && type != 417)
69477 {
69478 if (ai[0] == 0f)
69479 {
69480 rotation = 0f;
69481 if (velocity.Y == 0f)
69482 {
69484 }
69485 else if (velocity.Y < 0f)
69486 {
69487 frameCounter = 0.0;
69488 }
69489 frameCounter += Math.Abs(velocity.X) * 1.1f;
69490 if (frameCounter < 6.0)
69491 {
69492 frame.Y = 0;
69493 }
69494 else if (frameCounter < 12.0)
69495 {
69496 frame.Y = num;
69497 }
69498 else if (frameCounter < 18.0)
69499 {
69500 frame.Y = num * 2;
69501 }
69502 else if (frameCounter < 24.0)
69503 {
69504 frame.Y = num * 3;
69505 }
69506 else if (frameCounter < 32.0)
69507 {
69508 frame.Y = num * 4;
69509 }
69510 else
69511 {
69512 frameCounter = 0.0;
69513 }
69514 }
69515 else if (ai[0] == 1f)
69516 {
69517 frameCounter = 0.0;
69518 if (ai[1] < 10f)
69519 {
69520 frame.Y = num * 5;
69521 }
69522 else if (ai[1] < 20f)
69523 {
69524 frame.Y = num * 6;
69525 }
69526 else
69527 {
69528 frame.Y = num * 7;
69529 }
69530 }
69531 else if (ai[0] == 5f)
69532 {
69533 frameCounter = 0.0;
69534 if (ai[1] < 10f)
69535 {
69536 frame.Y = num * 7;
69537 }
69538 else if (ai[1] < 20f)
69539 {
69540 frame.Y = num * 6;
69541 }
69542 else
69543 {
69544 frame.Y = num * 5;
69545 }
69546 }
69547 else
69548 {
69549 frameCounter = 0.0;
69550 frame.Y = num * 7;
69551 }
69552 }
69554 }
69555
69556 private static int FindFrame_FromSequence(int sequenceFrame, int[] frames)
69557 {
69558 int num = sequenceFrame;
69559 if (num >= frames.Length)
69560 {
69561 num = frames.Length - 1;
69562 }
69563 return frames[num];
69564 }
69565
69570
69575
69580
69581 public void SimpleFlyMovement(Vector2 desiredVelocity, float moveSpeed)
69582 {
69583 if (velocity.X < desiredVelocity.X)
69584 {
69585 velocity.X += moveSpeed;
69586 if (velocity.X < 0f && desiredVelocity.X > 0f)
69587 {
69588 velocity.X += moveSpeed;
69589 }
69590 }
69591 else if (velocity.X > desiredVelocity.X)
69592 {
69593 velocity.X -= moveSpeed;
69594 if (velocity.X > 0f && desiredVelocity.X < 0f)
69595 {
69596 velocity.X -= moveSpeed;
69597 }
69598 }
69599 if (velocity.Y < desiredVelocity.Y)
69600 {
69601 velocity.Y += moveSpeed;
69602 if (velocity.Y < 0f && desiredVelocity.Y > 0f)
69603 {
69604 velocity.Y += moveSpeed;
69605 }
69606 }
69607 else if (velocity.Y > desiredVelocity.Y)
69608 {
69609 velocity.Y -= moveSpeed;
69610 if (velocity.Y > 0f && desiredVelocity.Y < 0f)
69611 {
69612 velocity.Y -= moveSpeed;
69613 }
69614 }
69615 }
69616
69617 public void HealEffect(int healAmount, bool broadcast = true)
69618 {
69619 HealEffect(new Rectangle((int)position.X, (int)position.Y, width, height), healAmount, broadcast);
69620 }
69621
69622 public static void HealEffect(Rectangle r, int healAmount, bool broadcast = true)
69623 {
69624 if (broadcast && Main.netMode == 2)
69625 {
69626 NetMessage.SendData(81, -1, -1, null, (int)CombatText.HealLife.PackedValue, r.Center.X, r.Center.Y, healAmount);
69627 }
69628 else
69629 {
69631 }
69632 }
69633
69635 {
69636 float distanceToPlayer;
69638 }
69639
69641 {
69642 Vector2 center = base.Center;
69643 float num = float.MaxValue;
69644 int num2 = -1;
69645 for (int i = 0; i < 255; i++)
69646 {
69647 Player player = Main.player[i];
69648 if (player.active && !player.dead && !player.ghost)
69649 {
69650 float num3 = Vector2.DistanceSquared(center, player.Center);
69651 if (num3 < num)
69652 {
69653 num = num3;
69654 num2 = i;
69655 }
69656 }
69657 }
69658 if (num2 < 0)
69659 {
69660 for (int j = 0; j < 255; j++)
69661 {
69662 Player player = Main.player[j];
69663 if (player.active)
69664 {
69665 float num4 = Vector2.DistanceSquared(center, player.Center);
69666 if (num4 < num)
69667 {
69668 num = num4;
69669 num2 = j;
69670 }
69671 }
69672 }
69673 }
69674 distanceToPlayer = (float)Math.Sqrt(num);
69675 return num2;
69676 }
69677
69679 {
69680 if (Main.netMode == 2)
69681 {
69682 NetMessage.SendData(51, -1, -1, null, whoAmI, 4f);
69683 return;
69684 }
69685 for (int i = 0; i < 20; i++)
69686 {
69687 int num = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
69688 Main.dust[num].velocity *= 2f;
69689 Main.dust[num].noGravity = true;
69690 }
69691 for (int j = 0; j < 3; j++)
69692 {
69693 for (int k = 0; k < 2; k++)
69694 {
69695 int num2 = Gore.NewGore(new Vector2(position.X + (float)(width * j) * 0.45f - 20f, position.Y + (float)(height * k) * 0.5f + 10f), new Vector2(0f, 0f), 99, 1.1f);
69696 Main.gore[num2].velocity *= 0.3f;
69697 }
69698 }
69699 }
69700
69701 public static bool BigMimicSummonCheck(int x, int y, Player user)
69702 {
69703 if (Main.netMode == 1 || !Main.hardMode)
69704 {
69705 return false;
69706 }
69707 int num = Chest.FindChest(x, y);
69708 if (num < 0)
69709 {
69710 return false;
69711 }
69712 int num2 = 0;
69713 int num3 = 0;
69714 int num4 = 0;
69715 for (int i = 0; i < 40; i++)
69716 {
69717 ushort num5 = Main.tile[Main.chest[num].x, Main.chest[num].y].type;
69718 int num6 = Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36;
69719 if (TileID.Sets.BasicChest[num5] && (num5 != 21 || num6 < 5 || num6 > 6) && Main.chest[num].item[i] != null && Main.chest[num].item[i].type > 0)
69720 {
69721 if (Main.chest[num].item[i].type == 3092)
69722 {
69723 num2 += Main.chest[num].item[i].stack;
69724 }
69725 else if (Main.chest[num].item[i].type == 3091)
69726 {
69727 num3 += Main.chest[num].item[i].stack;
69728 }
69729 else
69730 {
69731 num4++;
69732 }
69733 }
69734 }
69735 if (num4 == 0 && num2 + num3 == 1)
69736 {
69737 if (num2 != 1)
69738 {
69739 _ = 1;
69740 }
69741 if (TileID.Sets.BasicChest[Main.tile[x, y].type])
69742 {
69743 if (Main.tile[x, y].frameX % 36 != 0)
69744 {
69745 x--;
69746 }
69747 if (Main.tile[x, y].frameY % 36 != 0)
69748 {
69749 y--;
69750 }
69751 int number = Chest.FindChest(x, y);
69752 for (int j = 0; j < 40; j++)
69753 {
69754 Main.chest[num].item[j] = new Item();
69755 }
69756 Chest.DestroyChest(x, y);
69757 for (int k = x; k <= x + 1; k++)
69758 {
69759 for (int l = y; l <= y + 1; l++)
69760 {
69761 if (TileID.Sets.BasicChest[Main.tile[k, l].type])
69762 {
69763 Main.tile[k, l].ClearTile();
69764 }
69765 }
69766 }
69767 int number2 = 1;
69768 if (Main.tile[x, y].type == 467)
69769 {
69770 number2 = 5;
69771 }
69772 NetMessage.SendData(34, -1, -1, null, number2, x, y, 0f, number);
69773 NetMessage.SendTileSquare(-1, x, y, 3);
69774 }
69775 int num7 = 475;
69776 if (num3 == 1)
69777 {
69778 num7 = ((!WorldGen.crimson) ? 473 : 474);
69779 }
69780 int num8 = NewNPC(user.GetNPCSource_TileInteraction(x, y), x * 16 + 16, y * 16 + 32, num7);
69781 Main.npc[num8].whoAmI = num8;
69782 NetMessage.SendData(23, -1, -1, null, num8);
69783 Main.npc[num8].BigMimicSpawnSmoke();
69784 }
69785 return false;
69786 }
69787
69789 {
69791 if (overrideTargetType.HasValue)
69792 {
69794 }
69795 switch (nearestTargetType)
69796 {
69797 case NPCUtils.TargetType.NPC:
69798 case NPCUtils.TargetType.TankPet:
69799 return true;
69800 case NPCUtils.TargetType.Player:
69801 {
69802 bool flag = true;
69803 Player nearestTankOwner = searchResults.NearestTankOwner;
69804 if (nearestTankOwner.dead || (nearestTankOwner.npcTypeNoAggro[type] && direction != 0))
69805 {
69806 flag = false;
69807 }
69808 if (!flag)
69809 {
69810 break;
69811 }
69812 float num = (float)(nearestTankOwner.width + nearestTankOwner.height + width + height) / 4f + 800f;
69813 if (nearestTankOwner.itemAnimation == 0 && nearestTankOwner.aggro < 0 && searchResults.NearestTankDistance > num)
69814 {
69815 if (oldTarget >= 0)
69816 {
69817 return oldTarget >= 255;
69818 }
69819 return true;
69820 }
69821 return true;
69822 }
69823 }
69824 return false;
69825 }
69826
69827 public void FaceTarget()
69828 {
69829 direction = ((!((float)targetRect.Center.X < base.Center.X)) ? 1 : (-1));
69830 directionY = ((!((float)targetRect.Center.Y < base.Center.Y)) ? 1 : (-1));
69831 }
69832
69833 public void TargetClosestUpgraded(bool faceTarget = true, Vector2? checkPosition = null)
69834 {
69835 int num = -1;
69836 int num2 = -1;
69837 int num3 = -1;
69838 Vector2 center = base.Center;
69839 if (checkPosition.HasValue)
69840 {
69841 center = checkPosition.Value;
69842 }
69843 bool flag = direction == 0;
69844 float num4 = 9999999f;
69845 for (int i = 0; i < 255; i++)
69846 {
69847 Player player = Main.player[i];
69848 if (!player.active || player.dead || player.ghost)
69849 {
69850 continue;
69851 }
69852 float num5 = Vector2.Distance(center, player.Center);
69853 num5 -= (float)player.aggro;
69854 bool flag2 = player.npcTypeNoAggro[type];
69855 if (flag2 && !flag)
69856 {
69857 num5 += 1000f;
69858 }
69859 if (num5 < num4)
69860 {
69861 num = i;
69862 num2 = -1;
69863 num4 = num5;
69864 }
69865 if (player.tankPet >= 0 && !flag2)
69866 {
69867 num5 = Vector2.Distance(center, Main.projectile[player.tankPet].Center);
69868 num5 -= 200f;
69869 if (num5 < num4 && num5 < 200f && Collision.CanHit(base.Center, 0, 0, Main.projectile[player.tankPet].Center, 0, 0))
69870 {
69871 num2 = player.tankPet;
69872 num4 = num5;
69873 }
69874 }
69875 }
69876 for (int j = 0; j < 200; j++)
69877 {
69878 NPC nPC = Main.npc[j];
69879 if (nPC.active && nPC.type == 548)
69880 {
69881 float num6 = Vector2.Distance(center, nPC.Center);
69882 if (num4 > num6)
69883 {
69884 num3 = j;
69885 num = -1;
69886 num2 = -1;
69887 num4 = num6;
69888 }
69889 }
69890 }
69891 if (num4 == 9999999f)
69892 {
69893 return;
69894 }
69895 if (num3 >= 0)
69896 {
69897 target = Main.npc[num3].WhoAmIToTargettingIndex;
69898 targetRect = Main.npc[num3].Hitbox;
69899 direction = ((!((float)targetRect.Center.X < base.Center.X)) ? 1 : (-1));
69900 directionY = ((!((float)targetRect.Center.Y < base.Center.Y)) ? 1 : (-1));
69901 return;
69902 }
69903 if (num2 >= 0)
69904 {
69905 target = Main.projectile[num2].owner;
69906 targetRect = Main.projectile[num2].Hitbox;
69907 direction = ((!((float)targetRect.Center.X < base.Center.X)) ? 1 : (-1));
69908 directionY = ((!((float)targetRect.Center.Y < base.Center.Y)) ? 1 : (-1));
69909 return;
69910 }
69911 if (num < 0 || num >= 255)
69912 {
69913 num = 0;
69914 }
69915 Player player2 = Main.player[num];
69916 targetRect = player2.Hitbox;
69917 target = num;
69918 if (player2.dead || (player2.npcTypeNoAggro[type] && !flag))
69919 {
69920 faceTarget = false;
69921 }
69922 if (faceTarget)
69923 {
69924 float num7 = (float)(player2.width + player2.height + width + height) / 4f + 800f;
69925 float num8 = num4 - (float)player2.aggro;
69926 if (player2.itemAnimation != 0 || player2.aggro >= 0 || !(num8 > num7) || oldTarget < 0 || oldTarget >= 255)
69927 {
69928 direction = ((!((float)targetRect.Center.X < base.Center.X)) ? 1 : (-1));
69929 directionY = ((!((float)targetRect.Center.Y < base.Center.Y)) ? 1 : (-1));
69930 }
69931 }
69932 }
69933
69934 public void TargetClosest(bool faceTarget = true)
69935 {
69936 float distance = 0f;
69937 float realDist = 0f;
69938 bool t = false;
69939 int tankTarget = -1;
69940 for (int i = 0; i < 255; i++)
69941 {
69942 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost)
69943 {
69945 }
69946 }
69948 }
69949
69950 public void TargetClosest_WOF(bool faceTarget = true)
69951 {
69952 float distance = 0f;
69953 float realDist = 0f;
69954 bool t = false;
69955 int tankTarget = -1;
69956 for (int i = 0; i < 255; i++)
69957 {
69958 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost && Main.player[i].gross)
69959 {
69961 }
69962 }
69964 }
69965
69966 private void TryTrackingTarget(ref float distance, ref float realDist, ref bool t, ref int tankTarget, int j)
69967 {
69968 float num = Math.Abs(Main.player[j].position.X + (float)(Main.player[j].width / 2) - position.X + (float)(width / 2)) + Math.Abs(Main.player[j].position.Y + (float)(Main.player[j].height / 2) - position.Y + (float)(height / 2));
69969 num -= (float)Main.player[j].aggro;
69970 if (Main.player[j].npcTypeNoAggro[type] && direction != 0)
69971 {
69972 num += 1000f;
69973 }
69974 if (!t || num < distance)
69975 {
69976 t = true;
69977 tankTarget = -1;
69978 realDist = Math.Abs(Main.player[j].position.X + (float)(Main.player[j].width / 2) - position.X + (float)(width / 2)) + Math.Abs(Main.player[j].position.Y + (float)(Main.player[j].height / 2) - position.Y + (float)(height / 2));
69979 distance = num;
69980 target = j;
69981 }
69982 if (Main.player[j].tankPet >= 0 && !Main.player[j].npcTypeNoAggro[type])
69983 {
69984 int tankPet = Main.player[j].tankPet;
69985 float num2 = Math.Abs(Main.projectile[tankPet].position.X + (float)(Main.projectile[tankPet].width / 2) - position.X + (float)(width / 2)) + Math.Abs(Main.projectile[tankPet].position.Y + (float)(Main.projectile[tankPet].height / 2) - position.Y + (float)(height / 2));
69986 num2 -= 200f;
69987 if (num2 < distance && num2 < 200f && Collision.CanHit(base.Center, 1, 1, Main.projectile[tankPet].Center, 1, 1))
69988 {
69989 tankTarget = tankPet;
69990 }
69991 }
69992 }
69993
69995 {
69996 if (tankTarget >= 0)
69997 {
69998 targetRect = new Rectangle((int)Main.projectile[tankTarget].position.X, (int)Main.projectile[tankTarget].position.Y, Main.projectile[tankTarget].width, Main.projectile[tankTarget].height);
69999 direction = 1;
70000 if ((float)(targetRect.X + targetRect.Width / 2) < position.X + (float)(width / 2))
70001 {
70002 direction = -1;
70003 }
70004 directionY = 1;
70005 if ((float)(targetRect.Y + targetRect.Height / 2) < position.Y + (float)(height / 2))
70006 {
70007 directionY = -1;
70008 }
70009 }
70010 else
70011 {
70012 if (target < 0 || target >= 255)
70013 {
70014 target = 0;
70015 }
70016 targetRect = new Rectangle((int)Main.player[target].position.X, (int)Main.player[target].position.Y, Main.player[target].width, Main.player[target].height);
70017 if (Main.player[target].dead)
70018 {
70019 faceTarget = false;
70020 }
70021 if (Main.player[target].npcTypeNoAggro[type] && direction != 0)
70022 {
70023 faceTarget = false;
70024 }
70025 if (faceTarget)
70026 {
70027 _ = Main.player[target].aggro;
70028 _ = (Main.player[target].height + Main.player[target].width + height + width) / 4;
70029 bool flag = oldTarget >= 0 && oldTarget <= 254;
70030 bool num = Main.player[target].itemAnimation == 0 && Main.player[target].aggro < 0;
70031 bool flag2 = !boss;
70032 if (!(num && flag && flag2))
70033 {
70034 direction = 1;
70035 if ((float)(targetRect.X + targetRect.Width / 2) < position.X + (float)(width / 2))
70036 {
70037 direction = -1;
70038 }
70039 directionY = 1;
70040 if ((float)(targetRect.Y + targetRect.Height / 2) < position.Y + (float)(height / 2))
70041 {
70042 directionY = -1;
70043 }
70044 }
70045 }
70046 }
70047 if (confused)
70048 {
70049 direction *= -1;
70050 }
70052 {
70053 netUpdate = true;
70054 }
70055 }
70056
70058 {
70059 return type == 668;
70060 }
70061
70063 {
70064 switch (type)
70065 {
70066 case 8:
70067 case 9:
70068 case 11:
70069 case 12:
70070 case 14:
70071 case 15:
70072 case 36:
70073 case 40:
70074 case 41:
70075 case 88:
70076 case 89:
70077 case 90:
70078 case 91:
70079 case 92:
70080 case 96:
70081 case 97:
70082 case 99:
70083 case 100:
70084 case 113:
70085 case 114:
70086 case 115:
70087 case 118:
70088 case 119:
70089 case 128:
70090 case 129:
70091 case 130:
70092 case 131:
70093 case 134:
70094 case 135:
70095 case 136:
70096 case 246:
70097 case 247:
70098 case 248:
70099 case 249:
70100 case 263:
70101 case 267:
70102 case 328:
70103 case 379:
70104 case 380:
70105 case 392:
70106 case 393:
70107 case 394:
70108 case 396:
70109 case 397:
70110 case 398:
70111 case 400:
70112 case 422:
70113 case 437:
70114 case 438:
70115 case 439:
70116 case 440:
70117 case 488:
70118 case 492:
70119 case 493:
70120 case 507:
70121 case 517:
70122 case 548:
70123 case 549:
70124 case 551:
70125 case 564:
70126 case 565:
70127 return true;
70128 case 139:
70129 if (npcsFoundForCheckActive[134])
70130 {
70131 return true;
70132 }
70133 break;
70134 case 552:
70135 case 553:
70136 case 554:
70137 case 555:
70138 case 556:
70139 case 557:
70140 case 558:
70141 case 559:
70142 case 560:
70143 case 561:
70144 case 562:
70145 case 563:
70146 case 566:
70147 case 567:
70148 case 568:
70149 case 569:
70150 case 570:
70151 case 571:
70152 case 572:
70153 case 573:
70154 case 574:
70155 case 575:
70156 case 576:
70157 case 577:
70158 case 578:
70159 if (npcsFoundForCheckActive[548])
70160 {
70161 return true;
70162 }
70163 break;
70164 }
70165 return false;
70166 }
70167
70168 public void CheckActive()
70169 {
70171 {
70172 return;
70173 }
70174 if (townNPC)
70175 {
70177 return;
70178 }
70180 bool flag2 = false;
70181 Rectangle rectangle = new Rectangle((int)(position.X + (float)(width / 2) - (float)activeRangeX), (int)(position.Y + (float)(height / 2) - (float)activeRangeY), activeRangeX * 2, activeRangeY * 2);
70182 Rectangle rectangle2 = new Rectangle((int)((double)(position.X + (float)(width / 2)) - (double)sWidth * 0.5 - (double)width), (int)((double)(position.Y + (float)(height / 2)) - (double)sHeight * 0.5 - (double)height), sWidth + width * 2, sHeight + height * 2);
70183 for (int i = 0; i < 255; i++)
70184 {
70185 if (!Main.player[i].active)
70186 {
70187 continue;
70188 }
70189 Rectangle hitbox = Main.player[i].Hitbox;
70190 if (rectangle.Intersects(hitbox))
70191 {
70192 flag2 = true;
70193 if (type != 25 && type != 30 && type != 33 && releaseOwner == 255 && lifeMax > 0)
70194 {
70196 {
70197 Main.player[i].nearbyActiveNPCs += npcSlots * Main.slimeRainNPCSlots;
70198 }
70199 else
70200 {
70201 Main.player[i].nearbyActiveNPCs += npcSlots;
70202 }
70203 }
70204 }
70205 if (flag)
70206 {
70207 continue;
70208 }
70209 if (rectangle2.Intersects(hitbox))
70210 {
70212 despawnEncouraged = false;
70213 if (i == Main.myPlayer && (type == 604 || type == 605))
70214 {
70215 LadyBugLuck(i, type == 605);
70216 }
70217 }
70218 if (boss)
70219 {
70220 flag2 = true;
70221 }
70222 switch (type)
70223 {
70224 case 7:
70225 case 10:
70226 case 13:
70227 case 35:
70228 case 36:
70229 case 39:
70230 case 87:
70231 case 127:
70232 case 128:
70233 case 129:
70234 case 130:
70235 case 131:
70236 case 392:
70237 case 393:
70238 case 394:
70239 case 491:
70240 case 492:
70241 flag2 = true;
70242 break;
70243 case 399:
70244 if (ai[0] == 2f || ai[0] == 1f)
70245 {
70247 }
70248 flag2 = true;
70249 break;
70250 case 583:
70251 case 584:
70252 case 585:
70253 if (!Main.dayTime && ai[2] == 0f)
70254 {
70255 flag2 = true;
70257 }
70258 break;
70259 }
70260 }
70261 if (flag)
70262 {
70263 return;
70264 }
70265 timeLeft--;
70266 if (timeLeft <= 0)
70267 {
70268 flag2 = false;
70269 }
70270 if (!flag2 && Main.netMode != 1)
70271 {
70272 noSpawnCycle = true;
70273 active = false;
70274 if (Main.netMode == 2)
70275 {
70276 netSkip = -1;
70277 life = 0;
70278 NetMessage.SendData(23, -1, -1, null, whoAmI);
70279 }
70280 if (extraValue > 0)
70281 {
70282 RevengeManager.CacheEnemy(this);
70283 }
70285 }
70286 }
70287
70289 {
70290 if (aiStyle != 6)
70291 {
70292 return;
70293 }
70294 int num = (int)ai[0];
70295 while (num != whoAmI && num > 0 && num < 200)
70296 {
70297 NPC nPC = Main.npc[num];
70298 if (nPC.active && nPC.aiStyle == 6)
70299 {
70300 nPC.active = false;
70301 if (Main.netMode == 2)
70302 {
70303 nPC.life = 0;
70304 nPC.netSkip = -1;
70305 NetMessage.SendData(23, -1, -1, null, num);
70306 }
70307 num = (int)nPC.ai[0];
70308 continue;
70309 }
70310 break;
70311 }
70312 }
70313
70315 {
70316 Rectangle rectangle = new Rectangle((int)(position.X + (float)(width / 2) - (float)townRangeX), (int)(position.Y + (float)(height / 2) - (float)townRangeY), townRangeX * 2, townRangeY * 2);
70317 for (int i = 0; i < 255; i++)
70318 {
70319 if (Main.player[i].active && rectangle.Intersects(Main.player[i].Hitbox))
70320 {
70321 Main.player[i].townNPCs += npcSlots;
70322 }
70323 }
70324 }
70325
70326 public void checkDead()
70327 {
70328 if (!active || (realLife >= 0 && realLife != whoAmI) || life > 0)
70329 {
70330 return;
70331 }
70332 if (type == 604 || type == 605)
70333 {
70334 LadyBugKilled(base.Center, type == 605);
70335 }
70336 if (type == 397 || type == 396)
70337 {
70338 if (ai[0] != -2f)
70339 {
70340 ai[0] = -2f;
70341 life = lifeMax;
70342 netUpdate = true;
70343 dontTakeDamage = true;
70344 if (Main.netMode != 1)
70345 {
70346 int num = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X, (int)base.Center.Y, 400);
70347 Main.npc[num].ai[3] = ai[3];
70348 Main.npc[num].netUpdate = true;
70349 }
70350 }
70351 return;
70352 }
70353 if (type == 398 && ai[0] != 2f)
70354 {
70355 ai[0] = 2f;
70356 life = lifeMax;
70357 netUpdate = true;
70358 dontTakeDamage = true;
70359 return;
70360 }
70361 if ((type == 517 || type == 422 || type == 507 || type == 493) && ai[2] != 1f)
70362 {
70363 ai[2] = 1f;
70364 ai[1] = 0f;
70365 life = lifeMax;
70366 dontTakeDamage = true;
70367 netUpdate = true;
70368 return;
70369 }
70370 if (type == 548 && ai[1] != 1f)
70371 {
70372 ai[1] = 1f;
70373 ai[0] = 0f;
70374 life = lifeMax;
70376 netUpdate = true;
70377 return;
70378 }
70379 if (Main.netMode != 1 && Main.getGoodWorld && (type == 42 || type == 176 || (type >= 231 && type <= 235)))
70380 {
70382 }
70383 if (Main.netMode != 1 && Main.getGoodWorld)
70384 {
70385 if (type == 13)
70386 {
70387 int num2 = NewNPC(GetSpawnSourceForNaturalSpawn(), (int)base.Center.X, (int)(position.Y + (float)height), -12);
70388 if (Main.netMode == 2 && num2 < 200)
70389 {
70390 NetMessage.SendData(23, -1, -1, null, num2);
70391 }
70392 }
70393 if (type == 36)
70394 {
70395 int num3 = 3;
70396 for (int i = 0; i < num3; i++)
70397 {
70398 int num4 = 1000;
70399 for (int j = 0; j < num4; j++)
70400 {
70401 int num5 = (int)(base.Center.X / 16f) + Main.rand.Next(-50, 51);
70402 int k;
70403 for (k = (int)(base.Center.Y / 16f) + Main.rand.Next(-50, 51); k < Main.maxTilesY - 200 && !WorldGen.SolidTile(num5, k); k++)
70404 {
70405 }
70406 k--;
70407 if (!WorldGen.SolidTile(num5, k))
70408 {
70409 int num6 = NewNPC(GetSpawnSourceForNaturalSpawn(), num5 * 16 + 8, k * 16, 32);
70410 if (Main.netMode == 2 && num6 < 200)
70411 {
70412 NetMessage.SendData(23, -1, -1, null, num6);
70413 }
70414 break;
70415 }
70416 }
70417 }
70418 }
70419 }
70420 noSpawnCycle = true;
70421 if (townNPC && type != 37 && type != 453)
70422 {
70423 if (Main.netMode != 2)
70424 {
70425 NPCLuck();
70426 }
70427 bool flag = true;
70429 int num7 = 19;
70430 if (type == 369 || type == 663 || NPCID.Sets.IsTownPet[type])
70431 {
70432 num7 = 36;
70433 flag = false;
70434 }
70436 if (flag)
70437 {
70438 for (int l = 0; l < 255; l++)
70439 {
70440 Player player = Main.player[l];
70441 if (player != null && player.active && player.difficulty != 2)
70442 {
70443 flag = false;
70444 break;
70445 }
70446 }
70447 }
70448 if (flag)
70449 {
70451 }
70452 if (Main.netMode == 0)
70453 {
70454 Main.NewText(networkText.ToString(), byte.MaxValue, 25, 25);
70455 }
70456 else if (Main.netMode == 2)
70457 {
70459 }
70460 }
70461 if (Main.netMode != 1 && !Main.IsItDay() && type == 54 && !AnyNPCs(35))
70462 {
70463 for (int m = 0; m < 255; m++)
70464 {
70465 if (Main.player[m].active && !Main.player[m].dead && Main.player[m].killClothier)
70466 {
70468 break;
70469 }
70470 }
70471 }
70473 {
70474 WorldGen.prioritizedTownNPCType = 0;
70475 }
70477 if (type == 229 && IsShimmerVariant)
70478 {
70480 }
70481 if (legacySoundStyle != null)
70482 {
70484 }
70485 if (type == 13 || type == 14 || type == 15)
70486 {
70487 DropEoWLoot();
70488 }
70489 else if (type == 134)
70490 {
70492 Vector2 center = Main.player[target].Center;
70493 float num8 = 100000000f;
70495 for (int n = 0; n < 200; n++)
70496 {
70497 if (Main.npc[n].active && (Main.npc[n].type == 134 || Main.npc[n].type == 135 || Main.npc[n].type == 136))
70498 {
70499 float num9 = Math.Abs(Main.npc[n].Center.X - center.X) + Math.Abs(Main.npc[n].Center.Y - center.Y);
70500 if (num9 < num8)
70501 {
70502 num8 = num9;
70503 vector2 = Main.npc[n].position;
70504 }
70505 }
70506 }
70507 position = vector2;
70508 NPCLoot();
70509 position = vector;
70510 }
70511 else
70512 {
70513 NPCLoot();
70514 }
70515 active = false;
70516 if (Main.getGoodWorld && Main.netMode != 1 && type == 631)
70517 {
70519 }
70525 {
70526 return;
70527 }
70528 int num10 = 1;
70529 switch (type)
70530 {
70531 case 216:
70532 num10 = 5;
70533 break;
70534 case 395:
70535 num10 = 10;
70536 break;
70537 case 491:
70538 num10 = 10;
70539 break;
70540 case 471:
70541 num10 = 10;
70542 break;
70543 case 472:
70544 num10 = 0;
70545 break;
70546 case 387:
70547 num10 = 0;
70548 break;
70549 }
70550 if (num10 > 0)
70551 {
70552 Main.invasionSize -= num10;
70553 if (Main.invasionSize < 0)
70554 {
70555 Main.invasionSize = 0;
70556 }
70557 if (Main.netMode != 1)
70558 {
70560 }
70561 if (Main.netMode == 2)
70562 {
70564 }
70565 }
70566 }
70567
70569 {
70570 if (Main.netMode != 1)
70571 {
70572 float num = 0.1f;
70573 if (Main.rand.Next(2) == 0)
70574 {
70575 num = -0.1f;
70576 }
70577 float num2;
70578 for (num2 = (float)Main.rand.Next(-35, 36) * 0.1f; num2 < 2f && num2 > -2f; num2 += (float)Main.rand.Next(-30, 31) * 0.1f)
70579 {
70580 }
70581 int num3 = Main.rand.Next(6);
70582 if (type != 17 && type != 441)
70583 {
70584 num3 = ((num3 != 0) ? (num3 + 200) : 43);
70585 }
70586 else
70587 {
70588 num3 = Main.rand.Next(5);
70589 num3 += 527;
70590 }
70591 int num4 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), position.X + (float)(width / 2), position.Y + (float)(height / 2), (float)Main.rand.Next(10, 30) * num + num2, (float)Main.rand.Next(-40, -20) * 0.1f, num3, 0, 0f, Main.myPlayer);
70592 Main.projectile[num4].miscText = deathText.ToString();
70593 }
70594 }
70595
70596 public static int GetNPCInvasionGroup(int npcID)
70597 {
70598 int result = 0;
70599 switch (npcID)
70600 {
70601 case 26:
70602 case 27:
70603 case 28:
70604 case 29:
70605 case 111:
70606 case 471:
70607 case 472:
70608 result = 1;
70609 break;
70610 case 143:
70611 case 144:
70612 case 145:
70613 result = 2;
70614 break;
70615 case 212:
70616 case 213:
70617 case 214:
70618 case 215:
70619 case 216:
70620 case 491:
70621 result = 3;
70622 break;
70623 case 381:
70624 case 382:
70625 case 383:
70626 case 385:
70627 case 386:
70628 case 387:
70629 case 388:
70630 case 389:
70631 case 390:
70632 case 391:
70633 case 395:
70634 result = 4;
70635 break;
70636 case 338:
70637 case 339:
70638 case 340:
70639 case 341:
70640 case 342:
70641 case 343:
70642 case 344:
70643 case 345:
70644 case 346:
70645 case 347:
70646 case 348:
70647 case 349:
70648 case 350:
70649 result = -1;
70650 break;
70651 case 305:
70652 case 306:
70653 case 307:
70654 case 308:
70655 case 309:
70656 case 310:
70657 case 311:
70658 case 312:
70659 case 313:
70660 case 314:
70661 case 315:
70662 case 325:
70663 case 326:
70664 case 327:
70665 case 329:
70666 case 330:
70667 result = -2;
70668 break;
70669 case 547:
70670 case 548:
70671 case 549:
70672 case 550:
70673 case 551:
70674 case 552:
70675 case 553:
70676 case 554:
70677 case 555:
70678 case 556:
70679 case 557:
70680 case 558:
70681 case 559:
70682 case 560:
70683 case 561:
70684 case 562:
70685 case 563:
70686 case 564:
70687 case 565:
70688 case 566:
70689 case 567:
70690 case 568:
70691 case 569:
70692 case 570:
70693 case 571:
70694 case 572:
70695 case 573:
70696 case 574:
70697 case 575:
70698 case 576:
70699 case 577:
70700 case 578:
70701 result = -3;
70702 break;
70703 }
70704 return result;
70705 }
70706
70707 private void DropEoWLoot(bool fromCheckDead = true)
70708 {
70709 bool flag = true;
70710 for (int i = 0; i < 200; i++)
70711 {
70712 if (i != whoAmI && Main.npc[i].active && (Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15))
70713 {
70714 flag = false;
70715 break;
70716 }
70717 }
70718 if (flag)
70719 {
70720 boss = true;
70721 NPCLoot();
70722 }
70723 else
70724 {
70725 NPCLoot();
70726 }
70727 }
70728
70730 {
70731 if (Main.masterMode)
70732 {
70733 return 2.5f;
70734 }
70735 if (Main.expertMode)
70736 {
70737 return 2f;
70738 }
70739 return 1f;
70740 }
70741
70743 {
70744 if (!Main.snowMoon)
70745 {
70746 return;
70747 }
70748 int num = 0;
70751 switch (waveNumber)
70752 {
70753 case 1:
70754 networkText = Lang.GetInvasionWaveText(2, 338, 350);
70755 break;
70756 case 2:
70757 networkText = Lang.GetInvasionWaveText(3, 338, 350, 342, 348);
70758 break;
70759 case 3:
70760 networkText = Lang.GetInvasionWaveText(4, 344, 338, 350, 342);
70761 break;
70762 case 4:
70763 networkText = Lang.GetInvasionWaveText(5, 344, 338, 350, 348);
70764 break;
70765 case 5:
70766 networkText = Lang.GetInvasionWaveText(6, 344, 350, 348, 347);
70767 break;
70768 case 6:
70769 networkText = Lang.GetInvasionWaveText(7, 346, 342, 350, 338);
70770 break;
70771 case 7:
70772 networkText = Lang.GetInvasionWaveText(8, 346, 347, 350, 348, 351);
70773 break;
70774 case 8:
70775 networkText = Lang.GetInvasionWaveText(9, 346, 344, 348, 347, 342);
70776 break;
70777 case 9:
70778 networkText = Lang.GetInvasionWaveText(10, 346, 344, 351, 338, 347);
70779 break;
70780 case 10:
70781 networkText = Lang.GetInvasionWaveText(11, 345, 352, 338, 342);
70782 break;
70783 case 11:
70784 networkText = Lang.GetInvasionWaveText(12, 345, 344, 342, 343, 338);
70785 break;
70786 case 12:
70787 networkText = Lang.GetInvasionWaveText(13, 345, 346, 342, 352, 343, 347);
70788 break;
70789 case 13:
70790 networkText = Lang.GetInvasionWaveText(14, 345, 346, 344, 343, 351);
70791 break;
70792 case 14:
70793 networkText = Lang.GetInvasionWaveText(15, 345, 346, 344, 343, 347);
70794 break;
70795 case 15:
70796 networkText = Lang.GetInvasionWaveText(16, 345, 346, 344, 343, 352);
70797 break;
70798 case 16:
70799 networkText = Lang.GetInvasionWaveText(17, 345, 346, 344, 343, 351, 347);
70800 break;
70801 case 17:
70802 networkText = Lang.GetInvasionWaveText(18, 345, 346, 344, 343, 348, 351);
70803 break;
70804 case 18:
70805 networkText = Lang.GetInvasionWaveText(19, 345, 346, 344, 343);
70806 break;
70807 case 19:
70808 networkText = Lang.GetInvasionWaveText(-1, 345, 346, 344);
70809 break;
70810 }
70811 float num2 = 0f;
70812 switch (type)
70813 {
70814 case 338:
70815 case 339:
70816 case 340:
70817 num2 = 1f;
70818 break;
70819 case 341:
70820 num2 = 20f;
70821 break;
70822 case 342:
70823 num2 = 2f;
70824 break;
70825 case 343:
70826 num2 = 18f;
70827 break;
70828 case 344:
70829 num2 = 50f;
70830 break;
70831 case 345:
70832 num2 = 150f;
70833 break;
70834 case 346:
70835 num2 = 100f;
70836 break;
70837 case 347:
70838 num2 = 8f;
70839 break;
70840 case 348:
70841 case 349:
70842 num2 = 4f;
70843 break;
70844 case 350:
70845 num2 = 3f;
70846 break;
70847 case 351:
70848 num2 = 10f;
70849 break;
70850 case 352:
70851 num2 = 5f;
70852 break;
70853 }
70855 float num3 = waveKills;
70856 waveKills += num2;
70858 if (waveKills >= (float)num && num != 0)
70859 {
70860 waveKills = 0f;
70861 waveNumber++;
70864 {
70865 if (Main.netMode == 0)
70866 {
70867 Main.NewText(networkText.ToString(), 175, 75);
70868 }
70869 else if (Main.netMode == 2)
70870 {
70872 }
70873 if (waveNumber == 15)
70874 {
70876 }
70877 }
70878 }
70879 if (waveKills != num3 && num2 != 0f)
70880 {
70881 if (Main.netMode != 1)
70882 {
70884 }
70885 if (Main.netMode == 2)
70886 {
70888 }
70889 }
70890 }
70891
70893 {
70894 if (!Main.pumpkinMoon)
70895 {
70896 return;
70897 }
70898 int num = 0;
70901 switch (waveNumber)
70902 {
70903 case 1:
70904 networkText = Lang.GetInvasionWaveText(2, 326, 305);
70905 break;
70906 case 2:
70907 networkText = Lang.GetInvasionWaveText(3, 329, 326);
70908 break;
70909 case 3:
70910 networkText = Lang.GetInvasionWaveText(4, 330, 326, 305);
70911 break;
70912 case 4:
70913 networkText = Lang.GetInvasionWaveText(5, 315, 329);
70914 break;
70915 case 5:
70916 networkText = Lang.GetInvasionWaveText(6, 325, 326, 305);
70917 break;
70918 case 6:
70919 networkText = Lang.GetInvasionWaveText(7, 325, 330, 329);
70920 break;
70921 case 7:
70922 networkText = Lang.GetInvasionWaveText(8, 315, 330, 329);
70923 break;
70924 case 8:
70925 networkText = Lang.GetInvasionWaveText(9, 325, 330, 329, 326, 305);
70926 break;
70927 case 9:
70928 networkText = Lang.GetInvasionWaveText(10, 327, 329, 326);
70929 break;
70930 case 10:
70931 networkText = Lang.GetInvasionWaveText(11, 325, 330, 326);
70932 break;
70933 case 11:
70934 networkText = Lang.GetInvasionWaveText(12, 327, 330);
70935 break;
70936 case 12:
70937 networkText = Lang.GetInvasionWaveText(13, 325, 315, 330, 329, 326);
70938 break;
70939 case 13:
70940 networkText = Lang.GetInvasionWaveText(14, 327, 325, 315, 330, 329, 326, 305);
70941 break;
70942 case 14:
70943 networkText = Lang.GetInvasionWaveText(15, 327, 325, 330, 326, 305);
70944 break;
70945 case 15:
70946 networkText = Lang.GetInvasionWaveText(16, 327, 315, 330, 329, 326);
70947 break;
70948 case 16:
70949 networkText = Lang.GetInvasionWaveText(17, 327, 325, 315, 330, 329);
70950 break;
70951 case 17:
70952 networkText = Lang.GetInvasionWaveText(18, 327, 325, 315, 330);
70953 break;
70954 case 18:
70955 networkText = Lang.GetInvasionWaveText(19, 327, 325, 315);
70956 break;
70957 case 19:
70958 networkText = Lang.GetInvasionWaveText(-1, 327, 325, 315);
70959 break;
70960 }
70961 float num2 = 0f;
70962 switch (type)
70963 {
70964 case 305:
70965 case 306:
70966 case 307:
70967 case 308:
70968 case 309:
70969 case 310:
70970 case 311:
70971 case 312:
70972 case 313:
70973 case 314:
70974 num2 = 1f;
70975 break;
70976 case 315:
70977 num2 = 50f;
70978 break;
70979 case 325:
70980 num2 = 75f;
70981 break;
70982 case 326:
70983 num2 = 2f;
70984 break;
70985 case 327:
70986 num2 = 150f;
70987 break;
70988 case 329:
70989 num2 = 5f;
70990 break;
70991 case 330:
70992 num2 = 10f;
70993 break;
70994 }
70996 float num3 = waveKills;
70997 waveKills += num2;
70999 if (waveKills >= (float)num && num != 0)
71000 {
71001 waveKills = 0f;
71002 waveNumber++;
71005 {
71006 if (Main.netMode == 0)
71007 {
71008 Main.NewText(networkText.ToString(), 175, 75);
71009 }
71010 else if (Main.netMode == 2)
71011 {
71013 }
71014 if (waveNumber == 15)
71015 {
71017 }
71018 }
71019 }
71020 if (waveKills != num3 && num2 != 0f)
71021 {
71022 if (Main.netMode != 1)
71023 {
71025 }
71026 if (Main.netMode == 2)
71027 {
71029 }
71030 }
71031 }
71032
71033 public static void ResetKillCount()
71034 {
71035 for (int i = 0; i < NPCID.Count; i++)
71036 {
71037 killCount[i] = 0;
71038 }
71039 }
71040
71041 public bool AnyInteractions()
71042 {
71043 if (Main.netMode == 0)
71044 {
71046 {
71047 return true;
71048 }
71049 }
71050 else
71051 {
71052 for (int i = 0; i < 255; i++)
71053 {
71054 if (playerInteraction[i])
71055 {
71056 return true;
71057 }
71058 }
71059 }
71060 return false;
71061 }
71062
71063 public bool IsDamageDodgeable()
71064 {
71065 switch (type)
71066 {
71067 case 21:
71068 case 68:
71069 return ai[1] != 2f;
71070 case 636:
71071 return !Main.dayTime;
71072 default:
71073 return true;
71074 }
71075 }
71076
71077 public static void SetEventFlagCleared(ref bool eventFlag, int gameEventId)
71078 {
71079 bool flag = eventFlag;
71080 eventFlag = true;
71081 if (eventFlag != flag)
71082 {
71084 }
71085 }
71086
71088 {
71089 switch (gameEventId)
71090 {
71091 default:
71092 LanternNight.NextNightIsLanternNight = true;
71093 break;
71094 case 10:
71095 LanternNight.NextNightIsLanternNight = true;
71097 break;
71098 case 16:
71099 case 17:
71100 case 18:
71101 LanternNight.NextNightIsLanternNight = true;
71103 {
71105 }
71106 break;
71107 case 4:
71108 case 21:
71109 case 22:
71110 break;
71111 }
71112 }
71113
71114 public void NPCLoot()
71115 {
71116 if (Main.netMode == 1 || type >= NPCID.Count || (Main.getGoodWorld && !downedBoss3 && (type == 31 || type == 294 || type == 296 || type == 295 || type == 32 || type == 34 || type == 71)))
71117 {
71118 return;
71119 }
71121 if (0 == 0)
71122 {
71125 {
71127 {
71128 Main.BestiaryTracker.Kills.RegisterKill(this);
71129 }
71131 }
71132 }
71134 {
71135 return;
71136 }
71142 {
71143 if (Main.netMode == 0)
71144 {
71145 Main.NewText(Lang.misc[32].Value, 50, byte.MaxValue, 130);
71146 }
71147 else if (Main.netMode == 2)
71148 {
71149 ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, 255, 130));
71150 }
71151 }
71154 }
71155
71157 {
71158 int num = type;
71159 if ((uint)(num - 13) <= 2u)
71160 {
71161 return boss;
71162 }
71163 return true;
71164 }
71165
71167 {
71168 int num = type;
71169 if ((uint)(num - 125) <= 1u && AnyNPCs((type == 125) ? 126 : 125))
71170 {
71171 value = 0f;
71172 boss = false;
71173 }
71174 }
71175
71177 {
71179 dropAttemptInfo.player = closestPlayer;
71180 dropAttemptInfo.npc = this;
71181 dropAttemptInfo.IsExpertMode = Main.expertMode;
71182 dropAttemptInfo.IsMasterMode = Main.masterMode;
71183 dropAttemptInfo.IsInSimulation = false;
71184 dropAttemptInfo.rng = Main.rand;
71186 Main.ItemDropSolver.TryDropping(info);
71187 }
71188
71189 public static void ResetBadgerHatTime()
71190 {
71191 EoCKilledToday = false;
71192 WoFKilledToday = false;
71193 }
71194
71196 {
71197 int stack = Main.rand.Next(5, 16);
71198 int num = 28;
71199 if (type == 113)
71200 {
71201 num = 188;
71202 }
71203 else if (type == 35)
71204 {
71205 num = 188;
71206 }
71207 else if (type == 668)
71208 {
71209 num = 188;
71210 }
71211 else if (type == 222)
71212 {
71213 num = 1134;
71214 }
71215 else if (type == 657)
71216 {
71217 num = 499;
71218 }
71219 else if (type > 113 && type < 222)
71220 {
71221 num = 499;
71222 }
71223 else if (type == 636)
71224 {
71225 num = 499;
71226 }
71227 else if (type == 245 || type == 262)
71228 {
71229 num = 499;
71230 }
71231 else if (type == 370)
71232 {
71233 num = 499;
71234 }
71235 else if (type == 395)
71236 {
71237 num = 499;
71238 }
71239 else if (type == 439)
71240 {
71241 num = 499;
71242 }
71243 else if (type == 398)
71244 {
71245 num = 3544;
71246 }
71247 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, num, stack);
71248 int num2 = Main.rand.Next(5) + 5;
71249 for (int i = 0; i < num2; i++)
71250 {
71252 }
71253 if (type == 4)
71254 {
71255 EoCKilledToday = true;
71256 }
71257 else if (type == 113)
71258 {
71259 WoFKilledToday = true;
71260 }
71262 {
71265 }
71266 }
71267
71269 {
71270 if (type == 125 || type == 126)
71271 {
71272 if (Main.netMode == 0)
71273 {
71274 Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", Language.GetTextValue("Enemies.TheTwins")), 175, 75);
71275 }
71276 else if (Main.netMode == 2)
71277 {
71278 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", NetworkText.FromKey("Enemies.TheTwins")), new Color(175, 75, 255));
71279 }
71280 }
71281 else if (type == 398)
71282 {
71283 if (Main.netMode == 0)
71284 {
71285 Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", Language.GetTextValue("Enemies.MoonLord")), 175, 75);
71286 }
71287 else if (Main.netMode == 2)
71288 {
71289 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", NetworkText.FromKey("Enemies.MoonLord")), new Color(175, 75, 255));
71290 }
71291 }
71292 else if (Main.netMode == 0)
71293 {
71294 Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", TypeName), 175, 75);
71295 }
71296 else if (Main.netMode == 2)
71297 {
71298 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", GetTypeNetName()), new Color(175, 75, 255));
71299 }
71300 }
71301
71303 {
71304 int num = (int)(position.X + (float)(width / 2)) / 16;
71305 int num2 = (int)(position.Y + (float)(height / 2)) / 16;
71306 int num3 = width / 2 / 16 + 1;
71307 for (int i = num - num3; i <= num + num3; i++)
71308 {
71309 for (int j = num2 - num3; j <= num2 + num3; j++)
71310 {
71311 if ((i == num - num3 || i == num + num3 || j == num2 - num3 || j == num2 + num3) && !Main.tile[i, j].active())
71312 {
71313 Main.tile[i, j].type = (ushort)(WorldGen.crimson ? 347 : 140);
71314 Main.tile[i, j].active(active: true);
71315 }
71316 Main.tile[i, j].lava(lava: false);
71317 Main.tile[i, j].liquid = 0;
71318 if (Main.netMode == 2)
71319 {
71320 NetMessage.SendTileSquare(-1, i, j);
71321 }
71322 else
71323 {
71325 }
71326 }
71327 }
71328 }
71329
71331 {
71332 if (lifeMax > 100 && type != 288 && value > 0f && HasPlayerTarget && Main.hardMode && downedPlantBoss && Main.player[target].ZoneDungeon)
71333 {
71334 int range = 13;
71335 if (Main.expertMode)
71336 {
71337 range = 9;
71338 }
71339 if (closestPlayer.RollLuck(range) == 0 && Main.wallDungeon[Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16].wall])
71340 {
71341 NewNPC(GetSpawnSource_NPCHurt(), (int)base.Center.X, (int)base.Center.Y, 288);
71342 }
71343 }
71344 }
71345
71347 {
71348 if (Main.slimeRain && Main.slimeRainNPC[type] && !AnyNPCs(50))
71349 {
71350 int num = 150;
71351 if (downedSlimeKing)
71352 {
71353 num /= 2;
71354 }
71356 if (Main.slimeRainKillCount >= num)
71357 {
71358 SpawnOnPlayer(closestPlayer.whoAmI, 50);
71359 Main.slimeRainKillCount = -num / 2;
71360 }
71361 }
71362 }
71363
71365 {
71367 switch (type)
71368 {
71369 case 305:
71370 case 306:
71371 case 307:
71372 case 308:
71373 case 309:
71374 case 310:
71375 case 311:
71376 case 312:
71377 case 313:
71378 case 314:
71379 case 329:
71380 case 330:
71381 if (closestPlayer.RollLuck(4) == 0)
71382 {
71384 }
71385 break;
71386 case 326:
71387 if (closestPlayer.RollLuck(6) == 0)
71388 {
71390 }
71391 break;
71392 case 315:
71394 break;
71395 case 341:
71396 {
71397 int num2 = Main.rand.Next(5, 11);
71398 for (int j = 0; j < num2; j++)
71399 {
71401 }
71402 break;
71403 }
71404 case 338:
71405 case 339:
71406 case 340:
71407 if (closestPlayer.RollLuck(5) == 0)
71408 {
71410 }
71411 break;
71412 case 342:
71413 if (Main.rand.Next(3) != 0)
71414 {
71416 }
71417 break;
71418 case 325:
71419 case 327:
71420 case 344:
71421 case 345:
71422 case 346:
71423 {
71424 int num = Main.rand.Next(6) + 6;
71425 for (int i = 0; i < num; i++)
71426 {
71428 }
71429 break;
71430 }
71431 case 267:
71432 if (Main.rand.Next(2) == 0 && closestPlayer.statLife < closestPlayer.statLifeMax2)
71433 {
71435 }
71436 break;
71437 case 13:
71438 case 14:
71439 case 15:
71440 if (Main.rand.Next(4) == 0 && closestPlayer.statLife < closestPlayer.statLifeMax2)
71441 {
71443 }
71444 break;
71445 case 116:
71446 case 117:
71447 case 118:
71448 case 119:
71449 if (!Main.expertMode || Main.rand.Next(5) == 0)
71450 {
71452 }
71453 break;
71454 case 139:
71455 if (Main.rand.Next(2) == 0)
71456 {
71458 }
71459 break;
71460 }
71461 }
71462
71464 {
71467 if (Main.remixWorld && !downedSlimeKing && AnyInteractions() && Main.AnyPlayerReadyToFightKingSlime() && type == 1 && !AnyNPCs(50) && Main.rand.Next(200) == 0)
71468 {
71469 SpawnOnPlayer(closestPlayer.whoAmI, 50);
71470 }
71471 switch (type)
71472 {
71473 case 216:
71474 SpawnBoss((int)position.X, (int)position.Y, 662, target);
71475 break;
71476 case 327:
71477 if (Main.pumpkinMoon)
71478 {
71480 }
71481 break;
71482 case 325:
71483 if (Main.pumpkinMoon)
71484 {
71486 }
71487 break;
71488 case 344:
71489 if (Main.snowMoon)
71490 {
71492 }
71493 break;
71494 case 345:
71495 if (Main.snowMoon)
71496 {
71498 }
71499 break;
71500 case 346:
71501 if (Main.snowMoon)
71502 {
71504 }
71505 break;
71506 case 552:
71507 case 553:
71508 case 554:
71509 if (DD2Event.Ongoing)
71510 {
71513 {
71515 }
71516 }
71517 break;
71518 case 555:
71519 case 556:
71520 case 557:
71521 case 558:
71522 case 559:
71523 case 560:
71524 case 561:
71525 case 562:
71526 case 563:
71527 case 564:
71528 case 565:
71529 case 568:
71530 case 569:
71531 case 570:
71532 case 571:
71533 case 572:
71534 case 573:
71535 case 574:
71536 case 575:
71537 case 576:
71538 case 577:
71539 case 578:
71541 {
71543 }
71544 break;
71545 case 412:
71546 case 413:
71547 case 414:
71548 case 415:
71549 case 416:
71550 case 417:
71551 case 418:
71552 case 419:
71553 case 518:
71555 {
71556 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, FindFirstNPC(517));
71557 }
71558 break;
71559 case 425:
71560 case 426:
71561 case 427:
71562 case 429:
71564 {
71565 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, FindFirstNPC(422));
71566 }
71567 break;
71568 case 420:
71569 case 421:
71570 case 423:
71571 case 424:
71573 {
71574 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, FindFirstNPC(507));
71575 }
71576 break;
71577 case 402:
71578 case 405:
71579 case 407:
71580 case 409:
71581 case 411:
71583 {
71584 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 629, 0, 0f, Main.myPlayer, FindFirstNPC(493));
71585 }
71586 break;
71587 case 517:
71588 downedTowerSolar = true;
71589 TowerActiveSolar = false;
71592 break;
71593 case 422:
71594 downedTowerVortex = true;
71595 TowerActiveVortex = false;
71598 break;
71599 case 507:
71600 downedTowerNebula = true;
71601 TowerActiveNebula = false;
71604 break;
71605 case 493:
71606 downedTowerStardust = true;
71607 TowerActiveStardust = false;
71610 break;
71611 case 245:
71613 break;
71614 case 370:
71616 break;
71617 case 636:
71619 break;
71620 case 668:
71622 break;
71623 case 657:
71625 break;
71626 case 22:
71628 {
71630 }
71631 break;
71632 case 614:
71633 {
71634 int num2 = 175;
71636 {
71637 num2 = 0;
71638 }
71639 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, 0f, 0f, 281, num2, 0f, Main.myPlayer, -2f, releaseOwner + 1);
71640 break;
71641 }
71642 case 109:
71643 if (!downedClown)
71644 {
71645 downedClown = true;
71646 if (Main.netMode == 2)
71647 {
71649 }
71650 }
71651 break;
71652 case 222:
71654 if (Main.netMode == 2)
71655 {
71657 }
71658 break;
71659 case 439:
71662 break;
71663 case 398:
71665 LunarApocalypseIsUp = false;
71666 break;
71667 case 50:
71668 if (Main.slimeRain)
71669 {
71672 }
71673 if (Main.netMode != 1 && !unlockedSlimeBlueSpawn)
71674 {
71677 }
71679 if (Main.netMode == 2)
71680 {
71682 }
71683 break;
71684 case 125:
71685 case 126:
71686 if (boss)
71687 {
71689 downedMechBossAny = true;
71690 }
71691 break;
71692 case 262:
71693 {
71694 bool num3 = downedPlantBoss;
71696 if (!num3)
71697 {
71698 if (Main.netMode == 0)
71699 {
71700 Main.NewText(Lang.misc[33].Value, 50, byte.MaxValue, 130);
71701 }
71702 else if (Main.netMode == 2)
71703 {
71704 ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[33].Key), new Color(50, 255, 130));
71705 }
71706 }
71707 break;
71708 }
71709 case 4:
71711 break;
71712 case 13:
71713 case 14:
71714 case 15:
71715 case 266:
71716 if (boss)
71717 {
71718 if (!downedBoss2 || Main.rand.Next(2) == 0)
71719 {
71720 WorldGen.spawnMeteor = true;
71721 }
71723 }
71724 break;
71725 case 35:
71726 if (boss)
71727 {
71729 }
71730 break;
71731 case 127:
71732 if (boss)
71733 {
71735 downedMechBossAny = true;
71736 }
71737 break;
71738 case 134:
71739 if (boss)
71740 {
71742 downedMechBossAny = true;
71743 }
71744 break;
71745 case 113:
71746 {
71747 if (Main.netMode == 1)
71748 {
71749 break;
71750 }
71752 bool eventFlag = Main.hardMode;
71755 {
71756 if (Main.netMode == 0)
71757 {
71758 Main.NewText(Lang.misc[32].Value, 50, byte.MaxValue, 130);
71759 }
71760 else if (Main.netMode == 2)
71761 {
71762 ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, 255, 130));
71763 }
71764 }
71766 break;
71767 }
71768 case 661:
71770 {
71771 int num = 636;
71772 if (!AnyNPCs(num))
71773 {
71774 Vector2 vector = base.Center + new Vector2(0f, -200f) + Main.rand.NextVector2Circular(50f, 50f);
71775 SpawnBoss((int)vector.X, (int)vector.Y, num, closestPlayer.whoAmI);
71776 }
71777 }
71778 break;
71779 }
71780 if (boss)
71781 {
71784 if (Main.netMode == 2)
71785 {
71787 }
71788 }
71789 }
71790
71792 {
71793 int num = NewNPC(GetSpawnSourceForNPCFromNPCAI(), (int)base.Center.X - 10, (int)base.Center.Y, 670);
71794 NPC obj = Main.npc[num];
71795 Vector2 movementVector = (obj.velocity = new Vector2(Main.rand.NextFloatDirection() * 3f, -10f));
71796 obj.netUpdate = true;
71799 {
71800 PositionInWorld = base.Center,
71801 MovementVector = movementVector,
71802 UniqueInfoPiece = 0
71803 });
71804 }
71805
71807 {
71808 if (type != 16 && type != 81 && type != 121 && closestPlayer.RollLuck(6) == 0 && lifeMax > 1 && damage > 0)
71809 {
71810 if (Main.rand.Next(2) == 0 && closestPlayer.statMana < closestPlayer.statManaMax2)
71811 {
71812 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 184);
71813 }
71814 else if (Main.rand.Next(2) == 0 && closestPlayer.statLife < closestPlayer.statLifeMax2)
71815 {
71816 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 58);
71817 }
71818 }
71819 if (type != 16 && type != 81 && type != 121 && closestPlayer.RollLuck(2) == 0 && lifeMax > 1 && damage > 0 && closestPlayer.statMana < closestPlayer.statManaMax2)
71820 {
71821 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 184);
71822 }
71823 }
71824
71826 {
71827 float num = 0f;
71828 float luck = closestPlayer.luck;
71829 int num2 = 1;
71830 if (Main.rand.NextFloat() < Math.Abs(luck))
71831 {
71832 num2 = 2;
71833 }
71834 for (int i = 0; i < num2; i++)
71835 {
71836 float num3 = value;
71837 if (midas)
71838 {
71839 num3 *= 1f + (float)Main.rand.Next(10, 51) * 0.01f;
71840 }
71841 num3 *= 1f + (float)Main.rand.Next(-20, 76) * 0.01f;
71842 if (Main.rand.Next(2) == 0)
71843 {
71844 num3 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
71845 }
71846 if (Main.rand.Next(4) == 0)
71847 {
71848 num3 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
71849 }
71850 if (Main.rand.Next(8) == 0)
71851 {
71852 num3 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
71853 }
71854 if (Main.rand.Next(16) == 0)
71855 {
71856 num3 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
71857 }
71858 if (Main.rand.Next(32) == 0)
71859 {
71860 num3 *= 1f + (float)Main.rand.Next(25, 51) * 0.01f;
71861 }
71862 if (Main.rand.Next(64) == 0)
71863 {
71864 num3 *= 1f + (float)Main.rand.Next(50, 101) * 0.01f;
71865 }
71866 if (Main.bloodMoon)
71867 {
71868 num3 *= 1f + (float)Main.rand.Next(101) * 0.01f;
71869 }
71870 if (i == 0)
71871 {
71872 num = num3;
71873 }
71874 else if (luck < 0f)
71875 {
71876 if (num3 < num)
71877 {
71878 num = num3;
71879 }
71880 }
71881 else if (num3 > num)
71882 {
71883 num = num3;
71884 }
71885 }
71886 num += (float)extraValue;
71887 while ((int)num > 0)
71888 {
71889 if (num > 1000000f)
71890 {
71891 int num4 = (int)(num / 1000000f);
71892 if (num4 > 50 && Main.rand.Next(5) == 0)
71893 {
71894 num4 /= Main.rand.Next(3) + 1;
71895 }
71896 if (Main.rand.Next(5) == 0)
71897 {
71898 num4 /= Main.rand.Next(3) + 1;
71899 }
71900 int num5 = num4;
71901 while (num5 > 999)
71902 {
71903 num5 -= 999;
71904 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 74, 999);
71905 }
71906 num -= (float)(1000000 * num4);
71907 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 74, num5);
71908 }
71909 else if (num > 10000f)
71910 {
71911 int num6 = (int)(num / 10000f);
71912 if (num6 > 50 && Main.rand.Next(5) == 0)
71913 {
71914 num6 /= Main.rand.Next(3) + 1;
71915 }
71916 if (Main.rand.Next(5) == 0)
71917 {
71918 num6 /= Main.rand.Next(3) + 1;
71919 }
71920 num -= (float)(10000 * num6);
71921 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 73, num6);
71922 }
71923 else if (num > 100f)
71924 {
71925 int num7 = (int)(num / 100f);
71926 if (num7 > 50 && Main.rand.Next(5) == 0)
71927 {
71928 num7 /= Main.rand.Next(3) + 1;
71929 }
71930 if (Main.rand.Next(5) == 0)
71931 {
71932 num7 /= Main.rand.Next(3) + 1;
71933 }
71934 num -= (float)(100 * num7);
71935 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 72, num7);
71936 }
71937 else
71938 {
71939 int num8 = (int)num;
71940 if (num8 > 50 && Main.rand.Next(5) == 0)
71941 {
71942 num8 /= Main.rand.Next(3) + 1;
71943 }
71944 if (Main.rand.Next(5) == 0)
71945 {
71946 num8 /= Main.rand.Next(4) + 1;
71947 }
71948 if (num8 < 1)
71949 {
71950 num8 = 1;
71951 }
71952 num -= (float)num8;
71953 Item.NewItem(GetItemSource_Loot(), (int)position.X, (int)position.Y, width, height, 71, num8);
71954 }
71955 }
71956 }
71957
71958 public static int GetStackForSlimeItemDrop(int item)
71959 {
71960 int num = 1;
71961 if (item == 8)
71962 {
71963 num = Main.rand.Next(5, 11);
71964 }
71965 else if (item == 166)
71966 {
71967 num = Main.rand.Next(2, 7);
71968 }
71969 else if (item == 965)
71970 {
71971 num = Main.rand.Next(20, 46);
71972 }
71973 else if ((item >= 11 && item <= 14) || (item >= 699 && item <= 702))
71974 {
71975 num = Main.rand.Next(3, 9);
71976 if (Main.rand.Next(2) == 0)
71977 {
71978 num += 5;
71979 }
71980 }
71981 else
71982 {
71983 switch (item)
71984 {
71985 case 71:
71986 num = Main.rand.Next(50, 100);
71987 break;
71988 case 72:
71989 num = Main.rand.Next(20, 100);
71990 break;
71991 case 73:
71992 num = Main.rand.Next(1, 3);
71993 break;
71994 }
71995 }
71996 return num;
71997 }
71998
72000 {
72001 if (netID < 0)
72002 {
72003 if (netID != -5)
72004 {
72005 return netID == -1;
72006 }
72007 return true;
72008 }
72009 if (!NPCID.Sets.ProjectileNPC[netID])
72010 {
72012 }
72013 return true;
72014 }
72015
72017 {
72018 int num = Item.NPCtoBanner(BannerID());
72019 if (num <= 0 || ExcludedFromDeathTally())
72020 {
72021 return;
72022 }
72023 killCount[num]++;
72024 if (Main.netMode == 2)
72025 {
72026 NetMessage.SendData(83, -1, -1, null, num);
72027 }
72029 if (killCount[num] % num2 == 0 && num > 0)
72030 {
72031 int num3 = Item.BannerToNPC(num);
72032 int num4 = lastInteraction;
72033 if (!Main.player[num4].active || Main.player[num4].dead)
72034 {
72035 num4 = FindClosestPlayer();
72036 }
72037 NetworkText networkText = NetworkText.FromKey("Game.EnemiesDefeatedAnnouncement", killCount[num], NetworkText.FromKey(Lang.GetNPCName(num3).Key));
72038 if (num4 >= 0 && num4 < 255)
72039 {
72040 networkText = NetworkText.FromKey("Game.EnemiesDefeatedByAnnouncement", Main.player[num4].name, killCount[num], NetworkText.FromKey(Lang.GetNPCName(num3).Key));
72041 }
72042 if (Main.netMode == 0)
72043 {
72044 Main.NewText(networkText.ToString(), 250, 250, 0);
72045 }
72046 else if (Main.netMode == 2)
72047 {
72049 }
72050 int num5 = Item.BannerToItem(num);
72051 Vector2 vector = position;
72052 if (num4 >= 0 && num4 < 255)
72053 {
72054 vector = Main.player[num4].position;
72055 }
72056 Item.NewItem(GetItemSource_Loot(), (int)vector.X, (int)vector.Y, width, height, num5);
72057 }
72058 }
72059
72061 {
72062 bool flag = false;
72063 if (realLife >= 0)
72064 {
72065 return Main.npc[realLife].AnyInteractions();
72066 }
72067 return AnyInteractions();
72068 }
72069
72071 {
72072 switch (type)
72073 {
72074 case 125:
72075 case 126:
72076 if (!AnyNPCs((type == 126) ? 125 : 126))
72077 {
72080 }
72081 break;
72082 case 127:
72083 case 134:
72086 break;
72087 case 13:
72088 case 14:
72089 case 15:
72090 if (boss)
72091 {
72093 }
72094 break;
72095 default:
72097 break;
72098 }
72099 }
72100
72102 {
72103 if (Main.netMode == 1)
72104 {
72105 return false;
72106 }
72107 if (type != 687)
72108 {
72109 return false;
72110 }
72112 Point point = base.Center.ToTileCoordinates();
72113 if (AI_AttemptToFindTeleportSpot(ref chosenTile, point.X, point.Y, 15, 8))
72114 {
72115 Vector2 newPos = new Vector2(chosenTile.X * 16f - (float)(width / 2), chosenTile.Y * 16f - (float)height);
72116 NetMessage.SendData(23, -1, -1, null, whoAmI);
72117 Teleport(newPos, 13);
72118 return true;
72119 }
72120 Vector2 vector = base.Center - new Vector2(20f);
72122 active = false;
72123 NetMessage.SendData(23, -1, -1, null, whoAmI);
72124 NetMessage.SendData(106, -1, -1, null, (int)vector.X, vector.Y);
72125 return false;
72126 }
72127
72128 public static void CatchNPC(int i, int who = -1)
72129 {
72130 if (!Main.npc[i].active)
72131 {
72132 return;
72133 }
72134 if (who == -1)
72135 {
72136 who = Main.myPlayer;
72137 }
72138 if (Main.netMode == 1)
72139 {
72140 Main.npc[i].active = false;
72141 NetMessage.SendData(70, -1, -1, null, i, who);
72142 }
72143 else if (Main.npc[i].catchItem > 0)
72144 {
72145 if (Main.npc[i].type == 687)
72146 {
72147 Main.npc[i].TryTeleportingCaughtMysticFrog();
72148 }
72149 else if (Main.npc[i].SpawnedFromStatue)
72150 {
72151 Vector2 vector = Main.npc[i].Center - new Vector2(20f);
72153 Main.npc[i].active = false;
72154 NetMessage.SendData(23, -1, -1, null, i);
72155 NetMessage.SendData(106, -1, -1, null, (int)vector.X, vector.Y);
72156 }
72157 else
72158 {
72159 new Item().SetDefaults(Main.npc[i].catchItem);
72160 Item.NewItem(GetSpawnSource_NPCCatch(who), (int)Main.player[who].Center.X, (int)Main.player[who].Center.Y, 0, 0, Main.npc[i].catchItem, 1, noBroadcast: false, 0, noGrabDelay: true);
72161 Main.npc[i].active = false;
72162 NetMessage.SendData(23, -1, -1, null, i);
72163 }
72164 }
72165 }
72166
72168 {
72169 if (itemType <= 0)
72170 {
72171 return;
72172 }
72173 if (Main.netMode == 2)
72174 {
72175 int num = Item.NewItem(GetItemSource_Loot(), (int)Position.X, (int)Position.Y, (int)HitboxSize.X, (int)HitboxSize.Y, itemType, itemStack, noBroadcast: true);
72177 for (int i = 0; i < 255; i++)
72178 {
72179 if (Main.player[i].active && (playerInteraction[i] || !interactionRequired))
72180 {
72181 NetMessage.SendData(90, i, -1, null, num);
72182 }
72183 }
72184 Main.item[num].active = false;
72185 }
72186 else if (Main.netMode == 0)
72187 {
72188 Item.NewItem(GetItemSource_Loot(), (int)Position.X, (int)Position.Y, (int)HitboxSize.X, (int)HitboxSize.Y, itemType, itemStack);
72189 }
72190 value = 0f;
72191 }
72192
72193 public void PlayerInteraction(int player)
72194 {
72195 bool flag = false;
72196 if ((realLife < 0) ? (lastInteraction == player) : (Main.npc[realLife].lastInteraction == player))
72197 {
72198 return;
72199 }
72200 if (type == 13 || type == 14 || type == 15)
72201 {
72202 for (int i = 0; i < 200; i++)
72203 {
72204 if (i != whoAmI && Main.npc[i].active && (Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15))
72205 {
72206 Main.npc[i].ApplyInteraction(player);
72207 }
72208 }
72209 }
72210 if (type == 134 || type == 135 || type == 136)
72211 {
72212 for (int j = 0; j < 200; j++)
72213 {
72214 if (j != whoAmI && Main.npc[j].active && (Main.npc[j].type == 134 || Main.npc[j].type == 135 || Main.npc[j].type == 136))
72215 {
72216 Main.npc[j].ApplyInteraction(player);
72217 }
72218 }
72219 }
72220 if (type == 35 || type == 36)
72221 {
72222 for (int k = 0; k < 200; k++)
72223 {
72224 if (k != whoAmI && Main.npc[k].active && (Main.npc[k].type == 35 || Main.npc[k].type == 36))
72225 {
72226 Main.npc[k].ApplyInteraction(player);
72227 }
72228 }
72229 }
72230 if (type == 113 || type == 114)
72231 {
72232 for (int l = 0; l < 200; l++)
72233 {
72234 if (l != whoAmI && Main.npc[l].active && (Main.npc[l].type == 113 || Main.npc[l].type == 114))
72235 {
72236 Main.npc[l].ApplyInteraction(player);
72237 }
72238 }
72239 }
72240 if (type >= 127 && type <= 131)
72241 {
72242 for (int m = 0; m < 200; m++)
72243 {
72244 if (m != whoAmI && Main.npc[m].active && Main.npc[m].type >= 127 && Main.npc[m].type <= 131)
72245 {
72246 Main.npc[m].ApplyInteraction(player);
72247 }
72248 }
72249 }
72250 if (type >= 245 && type <= 249)
72251 {
72252 for (int n = 0; n < 200; n++)
72253 {
72254 if (n != whoAmI && Main.npc[n].active && Main.npc[n].type >= 245 && Main.npc[n].type <= 249)
72255 {
72256 Main.npc[n].ApplyInteraction(player);
72257 }
72258 }
72259 }
72260 if ((type == 396 || type == 397) && Main.npc[(int)ai[3]].active && Main.npc[(int)ai[3]].type == 398)
72261 {
72262 Main.npc[(int)ai[3]].ApplyInteraction(player);
72263 }
72264 if ((type == 393 || type == 394) && Main.npc[(int)ai[0]].active && Main.npc[(int)ai[0]].type == 395)
72265 {
72266 Main.npc[(int)ai[0]].ApplyInteraction(player);
72267 }
72268 if (type == 492 && Main.npc[(int)ai[0]].active && Main.npc[(int)ai[0]].type == 491)
72269 {
72270 Main.npc[(int)ai[0]].ApplyInteraction(player);
72271 }
72272 if (type == 125 || type == 126)
72273 {
72274 for (int num = 0; num < 200; num++)
72275 {
72276 if (num != whoAmI && Main.npc[num].active && (Main.npc[num].type == 125 || Main.npc[num].type == 126))
72277 {
72278 Main.npc[num].ApplyInteraction(player);
72279 }
72280 }
72281 }
72282 ApplyInteraction(player);
72283 }
72284
72285 public void ApplyInteraction(int player)
72286 {
72287 if (realLife >= 0)
72288 {
72289 Main.npc[realLife].playerInteraction[player] = true;
72290 }
72291 else
72292 {
72293 playerInteraction[player] = true;
72294 }
72295 if (player < 255)
72296 {
72297 if (realLife >= 0)
72298 {
72299 Main.npc[realLife].lastInteraction = player;
72300 }
72301 else
72302 {
72303 lastInteraction = player;
72304 }
72305 }
72306 }
72307
72308 public static bool CanReleaseNPCs(int who)
72309 {
72310 float num = 0.7f;
72311 if (Main.netMode != 1)
72312 {
72313 num += 0.05f;
72314 }
72315 int num2 = 0;
72316 int num3 = 0;
72317 for (int i = 0; i < 200; i++)
72318 {
72319 if (Main.npc[i].active)
72320 {
72321 num3++;
72322 if (Main.npc[i].releaseOwner == who)
72323 {
72324 num2++;
72325 }
72326 }
72327 }
72328 int num4 = 0;
72329 for (int j = 0; j < 255; j++)
72330 {
72331 if (Main.player[j].active)
72332 {
72333 num4++;
72334 }
72335 }
72336 int num5 = (int)(200f * num / (float)num4);
72337 if ((float)num3 < 200f * num && num2 < num5)
72338 {
72339 return true;
72340 }
72341 return false;
72342 }
72343
72344 public static int ReleaseNPC(int x, int y, int Type, int Style, int who)
72345 {
72346 int num = -1;
72347 if (Main.netMode == 1)
72348 {
72349 NetMessage.SendData(71, -1, -1, null, x, y, Type, Style);
72350 }
72351 else if (Type >= 0 && Type < NPCID.Count && (Main.npcCatchable[Type] || who == Main.myPlayer) && CanReleaseNPCs(who))
72352 {
72353 switch (Type)
72354 {
72355 case 583:
72356 case 584:
72357 case 585:
72358 num = NewNPC(GetSpawnSource_NPCRelease(who), x, y, Type);
72359 Main.npc[num].releaseOwner = (short)who;
72360 Main.npc[num].ai[2] = 2f;
72361 Main.npc[num].TargetClosest();
72362 Main.npc[num].ai[3] = 0f;
72363 Main.npc[num].netUpdate = true;
72364 break;
72365 case 356:
72366 num = NewNPC(GetSpawnSource_NPCRelease(who), x, y, Type);
72367 Main.npc[num].ai[2] = Style;
72368 Main.npc[num].releaseOwner = (short)who;
72369 break;
72370 case 148:
72371 {
72372 int num3 = Type + Main.rand.Next(2);
72373 num = NewNPC(GetSpawnSource_NPCRelease(who), x, y, num3);
72374 Main.npc[num].releaseOwner = (short)who;
72375 break;
72376 }
72377 case 614:
72378 {
72379 num = NewNPC(GetSpawnSource_NPCRelease(who), x, y, Type);
72380 Main.npc[num].releaseOwner = (short)who;
72381 int num2 = Main.player[who].direction;
72382 if (Style > 2)
72383 {
72384 Style -= 2;
72385 Main.npc[num].SpawnedFromStatue = true;
72386 Main.npc[num].CanBeReplacedByOtherNPCs = true;
72387 }
72388 if (Style == 1)
72389 {
72390 num2 = 1;
72391 }
72392 if (Style == 2)
72393 {
72394 num2 = -1;
72395 }
72396 Main.npc[num].direction = num2;
72397 Main.npc[num].spriteDirection = num2;
72398 Main.npc[num].netUpdate = true;
72399 break;
72400 }
72401 default:
72402 num = NewNPC(GetSpawnSource_NPCRelease(who), x, y, Type);
72403 Main.npc[num].releaseOwner = (short)who;
72404 break;
72405 }
72406 }
72407 return num;
72408 }
72409
72410 public static void SlimeRainSpawns(int plr)
72411 {
72414 float num = 15f;
72415 Player player = Main.player[plr];
72416 if ((double)player.position.Y > Main.worldSurface * 16.0 + (double)(logicCheckScreenHeight / 2) || player.nearbyActiveNPCs > num)
72417 {
72418 return;
72419 }
72420 float num2 = player.nearbyActiveNPCs / num;
72421 int num3 = 45 + (int)(450f * num2);
72422 if (Main.expertMode)
72423 {
72424 num3 = (int)((double)num3 * 0.85);
72425 }
72426 if (Main.GameModeInfo.IsJourneyMode)
72427 {
72429 if (power != null && power.GetIsUnlocked())
72430 {
72431 if (power.GetShouldDisableSpawnsFor(plr))
72432 {
72433 return;
72434 }
72435 if (power.GetRemappedSliderValueFor(plr, out var num4))
72436 {
72437 num3 = (int)((float)num3 / num4);
72438 }
72439 }
72440 }
72441 if (Main.rand.Next(num3) != 0)
72442 {
72443 return;
72444 }
72445 int num5 = (int)(player.Center.X - (float)logicCheckScreenWidth);
72447 int minValue = (int)((double)player.Center.Y - (double)logicCheckScreenHeight * 1.5);
72448 int maxValue2 = (int)((double)player.Center.Y - (double)logicCheckScreenHeight * 0.75);
72449 int num6 = Main.rand.Next(num5, maxValue);
72450 int num7 = Main.rand.Next(minValue, maxValue2);
72451 num6 /= 16;
72452 num7 /= 16;
72453 if (num6 < 10 || num6 > Main.maxTilesX + 10 || (double)num7 < Main.worldSurface * 0.3 || (double)num7 > Main.worldSurface || Collision.SolidTiles(num6 - 3, num6 + 3, num7 - 5, num7 + 2) || Main.wallHouse[Main.tile[num6, num7].wall])
72454 {
72455 return;
72456 }
72457 int num8 = NewNPC(GetSpawnSourceForNaturalSpawn(), num6 * 16 + 8, num7 * 16, 1);
72458 if (Main.rand.Next(200) == 0)
72459 {
72460 Main.npc[num8].SetDefaults(-4);
72461 }
72462 else if (Main.expertMode)
72463 {
72464 if (Main.rand.Next(7) == 0)
72465 {
72466 Main.npc[num8].SetDefaults(-7);
72467 }
72468 else if (Main.rand.Next(3) == 0)
72469 {
72470 Main.npc[num8].SetDefaults(-3);
72471 }
72472 }
72473 else if (Main.rand.Next(10) == 0)
72474 {
72475 Main.npc[num8].SetDefaults(-7);
72476 }
72477 else if (Main.rand.Next(5) < 2)
72478 {
72479 Main.npc[num8].SetDefaults(-3);
72480 }
72481 }
72482
72483 public static bool Spawning_SandstoneCheck(int x, int y)
72484 {
72485 if (!WorldGen.InWorld(x, y, 10))
72486 {
72487 return false;
72488 }
72489 int num = 0;
72490 for (int i = 0; i < 8; i++)
72491 {
72492 Tile tile = Main.tile[x, y + i];
72493 if (!tile.active() || !TileID.Sets.Conversion.Sand[tile.type])
72494 {
72495 break;
72496 }
72497 num++;
72498 for (int j = 1; j <= 4; j++)
72499 {
72500 tile = Main.tile[x + j, y + i];
72501 if (!tile.active() || !TileID.Sets.Conversion.Sand[tile.type])
72502 {
72503 break;
72504 }
72505 num++;
72506 }
72507 for (int k = 1; k <= 4; k++)
72508 {
72509 tile = Main.tile[x - k, y + i];
72510 if (!tile.active() || !TileID.Sets.Conversion.Sand[tile.type])
72511 {
72512 break;
72513 }
72514 num++;
72515 }
72516 }
72517 if (Main.remixWorld)
72518 {
72519 return num >= 10;
72520 }
72521 return num >= 40;
72522 }
72523
72524 public static bool Spawning_FlyingAntlionCheck(int x, int y)
72525 {
72526 if (!WorldGen.InWorld(x, y, 10))
72527 {
72528 return false;
72529 }
72530 for (int i = 0; i < 50; i++)
72531 {
72532 if (y - i < 10)
72533 {
72534 return true;
72535 }
72536 Tile tile = Main.tile[x, y - i];
72538 {
72539 return false;
72540 }
72541 }
72542 return true;
72543 }
72544
72545 private static int RollDragonflyType(int tileType = 2)
72546 {
72547 if (tileType == 53)
72548 {
72549 return Main.rand.NextFromList(new short[3] { 595, 598, 600 });
72550 }
72551 return Main.rand.NextFromList(new short[3] { 596, 597, 599 });
72552 }
72553
72554 public static void ResetRemixHax()
72555 {
72556 Main.dayTime = dayTimeHax;
72557 Main.raining = rainingHax;
72558 Main.cloudAlpha = cloudAlphaHax;
72559 }
72560
72561 public static void SetRemixHax()
72562 {
72563 dayTimeHax = Main.dayTime;
72564 rainingHax = Main.raining;
72565 cloudAlphaHax = Main.cloudAlpha;
72566 }
72567
72568 public static bool SpawnTileOrAboveHasAnyWallInSet(int x, int y, bool[] wallTypes)
72569 {
72570 if (!WorldGen.InWorld(x, y, 2))
72571 {
72572 return false;
72573 }
72574 Tile tile = Main.tile[x, y];
72575 Tile tile2 = Main.tile[x, y - 1];
72576 if (tile == null || tile2 == null)
72577 {
72578 return false;
72579 }
72580 if (tile.wall < 0 || tile.wall >= WallID.Count || !wallTypes[tile.wall])
72581 {
72582 if (tile2.wall >= 0 && tile2.wall < WallID.Count)
72583 {
72584 return wallTypes[tile2.wall];
72585 }
72586 return false;
72587 }
72588 return true;
72589 }
72590
72591 public static void SpawnNPC()
72592 {
72593 if (noSpawnCycle)
72594 {
72595 noSpawnCycle = false;
72596 return;
72597 }
72598 bool tooWindyForButterflies = TooWindyForButterflies;
72599 bool flag = (double)Main.windSpeedTarget < -0.4 || (double)Main.windSpeedTarget > 0.4;
72600 RevengeManager.CheckRespawns();
72601 bool flag2 = false;
72602 bool flag3 = false;
72603 int num = 0;
72604 int num2 = 0;
72605 int num3 = 0;
72606 int num4 = 0;
72607 for (int i = 0; i < 255; i++)
72608 {
72609 if (Main.player[i].active)
72610 {
72611 num4++;
72612 }
72613 }
72614 float num5 = 0f;
72615 for (int j = 0; j < 200; j++)
72616 {
72617 if (Main.npc[j].active)
72618 {
72619 switch (Main.npc[j].type)
72620 {
72621 case 315:
72622 case 325:
72623 case 327:
72624 case 328:
72625 case 344:
72626 case 345:
72627 case 346:
72628 num5 += Main.npc[j].npcSlots;
72629 break;
72630 }
72631 }
72632 }
72633 float num6 = (int)((float)defaultMaxSpawns * (2f + 0.3f * (float)num4));
72634 for (int k = 0; k < 255; k++)
72635 {
72636 if (!Main.player[k].active || Main.player[k].dead)
72637 {
72638 continue;
72639 }
72640 flag3 = false;
72641 if (Main.player[k].isNearNPC(398, MoonLordFightingDistance))
72642 {
72643 continue;
72644 }
72645 if (Main.slimeRain)
72646 {
72647 SlimeRainSpawns(k);
72648 }
72649 bool flag4 = false;
72650 bool flag5 = false;
72651 bool flag6 = false;
72652 bool flag7 = false;
72653 bool flag8 = false;
72654 bool flag9 = false;
72655 bool flag10 = false;
72656 bool flag11 = false;
72657 bool flag12 = false;
72658 bool flag13 = false;
72659 bool flag14 = downedPlantBoss && Main.hardMode;
72661 if (Main.player[k].active && Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0 && ((double)Main.player[k].position.Y < Main.worldSurface * 16.0 + (double)sHeight || Main.remixWorld))
72662 {
72663 int num7 = 3000;
72664 if ((double)Main.player[k].position.X > Main.invasionX * 16.0 - (double)num7 && (double)Main.player[k].position.X < Main.invasionX * 16.0 + (double)num7)
72665 {
72666 flag6 = true;
72667 }
72668 else if (Main.invasionX >= (double)(Main.maxTilesX / 2 - 5) && Main.invasionX <= (double)(Main.maxTilesX / 2 + 5))
72669 {
72670 for (int l = 0; l < 200; l++)
72671 {
72672 if (Main.npc[l].townNPC && Math.Abs(Main.player[k].position.X - Main.npc[l].Center.X) < (float)num7)
72673 {
72674 if (Main.rand.Next(3) != 0)
72675 {
72676 flag6 = true;
72677 }
72678 break;
72679 }
72680 }
72681 }
72682 }
72683 if (Main.player[k].ZoneTowerSolar || Main.player[k].ZoneTowerNebula || Main.player[k].ZoneTowerVortex || Main.player[k].ZoneTowerStardust)
72684 {
72685 flag6 = true;
72686 }
72687 int num8 = (int)(Main.player[k].position.X + (float)(Main.player[k].width / 2)) / 16;
72688 int num9 = (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2)) / 16;
72689 if (Main.wallHouse[Main.tile[num8, num9].wall])
72690 {
72691 flag5 = true;
72692 }
72693 if (Main.tile[num8, num9].wall == 87)
72694 {
72695 flag4 = true;
72696 }
72697 flag2 = false;
72698 spawnRate = defaultSpawnRate;
72699 maxSpawns = defaultMaxSpawns;
72700 if (Main.hardMode)
72701 {
72702 spawnRate = (int)((double)defaultSpawnRate * 0.9);
72703 maxSpawns = defaultMaxSpawns + 1;
72704 }
72705 if (Main.player[k].position.Y > (float)(Main.UnderworldLayer * 16))
72706 {
72707 maxSpawns = (int)((float)maxSpawns * 2f);
72708 }
72709 else if ((double)Main.player[k].position.Y > Main.rockLayer * 16.0 + (double)sHeight)
72710 {
72711 if (Main.remixWorld)
72712 {
72713 if (Main.hardMode)
72714 {
72715 spawnRate = (int)((double)spawnRate * 0.45);
72716 maxSpawns = (int)((float)maxSpawns * 1.8f);
72717 }
72718 else
72719 {
72720 spawnRate = (int)((double)spawnRate * 0.5);
72721 maxSpawns = (int)((float)maxSpawns * 1.7f);
72722 }
72723 }
72724 else
72725 {
72726 spawnRate = (int)((double)spawnRate * 0.4);
72727 maxSpawns = (int)((float)maxSpawns * 1.9f);
72728 }
72729 }
72730 else if ((double)Main.player[k].position.Y > Main.worldSurface * 16.0 + (double)sHeight)
72731 {
72732 if (Main.remixWorld)
72733 {
72734 spawnRate = (int)((double)spawnRate * 0.4);
72735 maxSpawns = (int)((float)maxSpawns * 1.9f);
72736 }
72737 else if (Main.hardMode)
72738 {
72739 spawnRate = (int)((double)spawnRate * 0.45);
72740 maxSpawns = (int)((float)maxSpawns * 1.8f);
72741 }
72742 else
72743 {
72744 spawnRate = (int)((double)spawnRate * 0.5);
72745 maxSpawns = (int)((float)maxSpawns * 1.7f);
72746 }
72747 }
72748 else if (Main.remixWorld)
72749 {
72750 if (!Main.dayTime)
72751 {
72752 spawnRate = (int)((double)spawnRate * 0.6);
72753 maxSpawns = (int)((float)maxSpawns * 1.3f);
72754 }
72755 }
72756 else if (!Main.dayTime)
72757 {
72758 spawnRate = (int)((double)spawnRate * 0.6);
72759 maxSpawns = (int)((float)maxSpawns * 1.3f);
72760 if (Main.bloodMoon)
72761 {
72762 spawnRate = (int)((double)spawnRate * 0.3);
72763 maxSpawns = (int)((float)maxSpawns * 1.8f);
72764 }
72765 if ((Main.pumpkinMoon || Main.snowMoon) && (double)Main.player[k].position.Y < Main.worldSurface * 16.0)
72766 {
72767 spawnRate = (int)((double)spawnRate * 0.2);
72768 maxSpawns *= 2;
72769 }
72770 }
72771 else if (Main.dayTime && Main.eclipse)
72772 {
72773 spawnRate = (int)((double)spawnRate * 0.2);
72774 maxSpawns = (int)((float)maxSpawns * 1.9f);
72775 }
72776 if (Main.remixWorld)
72777 {
72778 if (!Main.dayTime)
72779 {
72780 if (Main.bloodMoon)
72781 {
72782 spawnRate = (int)((double)spawnRate * 0.3);
72783 maxSpawns = (int)((float)maxSpawns * 1.8f);
72784 if ((double)Main.player[k].position.Y > Main.rockLayer * 16.0 + (double)sHeight)
72785 {
72786 spawnRate = (int)((double)spawnRate * 0.6);
72787 }
72788 }
72790 {
72791 spawnRate = (int)((double)spawnRate * 0.2);
72792 maxSpawns *= 2;
72793 if ((double)Main.player[k].position.Y > Main.rockLayer * 16.0 + (double)sHeight)
72794 {
72795 spawnRate = (int)((double)spawnRate * 0.6);
72796 }
72797 }
72798 }
72799 else if (Main.dayTime && Main.eclipse)
72800 {
72801 spawnRate = (int)((double)spawnRate * 0.2);
72802 maxSpawns = (int)((float)maxSpawns * 1.9f);
72803 }
72804 }
72805 if (Main.player[k].ZoneSnow && (double)(Main.player[k].position.Y / 16f) < Main.worldSurface)
72806 {
72807 maxSpawns = (int)((float)maxSpawns + (float)maxSpawns * Main.cloudAlpha);
72808 spawnRate = (int)((float)spawnRate * (1f - Main.cloudAlpha + 1f) / 2f);
72809 }
72810 if (Main.drunkWorld && Main.tile[num8, num9].wall == 86)
72811 {
72812 spawnRate = (int)((double)spawnRate * 0.3);
72813 maxSpawns = (int)((float)maxSpawns * 1.8f);
72814 }
72815 if (Main.player[k].ZoneDungeon)
72816 {
72817 spawnRate = (int)((double)spawnRate * 0.3);
72818 maxSpawns = (int)((float)maxSpawns * 1.8f);
72819 }
72820 else if (Main.player[k].ZoneSandstorm)
72821 {
72822 spawnRate = (int)((float)spawnRate * (Main.hardMode ? 0.4f : 0.9f));
72823 maxSpawns = (int)((float)maxSpawns * (Main.hardMode ? 1.5f : 1.2f));
72824 }
72825 else if (Main.player[k].ZoneUndergroundDesert)
72826 {
72827 spawnRate = (int)((float)spawnRate * 0.2f);
72828 maxSpawns = (int)((float)maxSpawns * 3f);
72829 }
72830 else if (Main.player[k].ZoneJungle)
72831 {
72832 if (Main.player[k].townNPCs == 0f)
72833 {
72834 spawnRate = (int)((double)spawnRate * 0.4);
72835 maxSpawns = (int)((float)maxSpawns * 1.5f);
72836 }
72837 else if (Main.player[k].townNPCs == 1f)
72838 {
72839 spawnRate = (int)((double)spawnRate * 0.55);
72840 maxSpawns = (int)((double)maxSpawns * 1.4);
72841 }
72842 else if (Main.player[k].townNPCs == 2f)
72843 {
72844 spawnRate = (int)((double)spawnRate * 0.7);
72845 maxSpawns = (int)((float)maxSpawns * 1.3f);
72846 }
72847 else
72848 {
72849 spawnRate = (int)((double)spawnRate * 0.85);
72850 maxSpawns = (int)((float)maxSpawns * 1.2f);
72851 }
72852 }
72853 else if (Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson)
72854 {
72855 spawnRate = (int)((double)spawnRate * 0.65);
72856 maxSpawns = (int)((float)maxSpawns * 1.3f);
72857 }
72858 else if (Main.player[k].ZoneMeteor)
72859 {
72860 spawnRate = (int)((double)spawnRate * 0.4);
72861 maxSpawns = (int)((float)maxSpawns * 1.1f);
72862 }
72863 if (flag4)
72864 {
72865 spawnRate = (int)((float)spawnRate * 0.8f);
72866 maxSpawns = (int)((float)maxSpawns * 1.2f);
72867 if (Main.remixWorld)
72868 {
72869 spawnRate = (int)((double)spawnRate * 0.4);
72870 maxSpawns = (int)((float)maxSpawns * 1.5f);
72871 }
72872 }
72873 if (Main.remixWorld && (Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson) && (double)(Main.player[k].position.Y / 16f) < Main.worldSurface)
72874 {
72875 spawnRate = (int)((double)spawnRate * 0.5);
72876 maxSpawns *= 2;
72877 }
72878 if (Main.player[k].ZoneHallow && (double)Main.player[k].position.Y > Main.rockLayer * 16.0 + (double)sHeight)
72879 {
72880 spawnRate = (int)((double)spawnRate * 0.65);
72881 maxSpawns = (int)((float)maxSpawns * 1.3f);
72882 }
72883 if (Main.wofNPCIndex >= 0 && Main.player[k].position.Y > (float)(Main.UnderworldLayer * 16))
72884 {
72885 maxSpawns = (int)((float)maxSpawns * 0.3f);
72886 spawnRate *= 3;
72887 }
72888 if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.2)
72889 {
72890 spawnRate = (int)((float)spawnRate * 0.6f);
72891 }
72892 else if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.4)
72893 {
72894 spawnRate = (int)((float)spawnRate * 0.7f);
72895 }
72896 else if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.6)
72897 {
72898 spawnRate = (int)((float)spawnRate * 0.8f);
72899 }
72900 else if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.8)
72901 {
72902 spawnRate = (int)((float)spawnRate * 0.9f);
72903 }
72904 if ((double)(Main.player[k].position.Y / 16f) > (Main.worldSurface + Main.rockLayer) / 2.0 || Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson)
72905 {
72906 if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.2)
72907 {
72908 spawnRate = (int)((float)spawnRate * 0.7f);
72909 }
72910 else if ((double)Main.player[k].nearbyActiveNPCs < (double)maxSpawns * 0.4)
72911 {
72912 spawnRate = (int)((float)spawnRate * 0.9f);
72913 }
72914 }
72915 int maxValue = 65;
72916 if (Main.remixWorld && (double)(Main.player[k].position.Y / 16f) < Main.worldSurface && (Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson))
72917 {
72918 maxValue = 25;
72919 spawnRate = (int)((double)spawnRate * 0.8);
72920 maxSpawns *= 2;
72921 }
72922 if (Main.player[k].invis)
72923 {
72924 spawnRate = (int)((float)spawnRate * 1.2f);
72925 maxSpawns = (int)((float)maxSpawns * 0.8f);
72926 }
72927 if (Main.player[k].calmed)
72928 {
72929 spawnRate = (int)((float)spawnRate * 1.65f);
72930 maxSpawns = (int)((float)maxSpawns * 0.6f);
72931 }
72932 if (Main.player[k].sunflower)
72933 {
72934 spawnRate = (int)((float)spawnRate * 1.2f);
72935 maxSpawns = (int)((float)maxSpawns * 0.8f);
72936 }
72937 if (Main.player[k].anglerSetSpawnReduction)
72938 {
72939 spawnRate = (int)((float)spawnRate * 1.3f);
72940 maxSpawns = (int)((float)maxSpawns * 0.7f);
72941 }
72942 if (Main.player[k].enemySpawns)
72943 {
72944 spawnRate = (int)((double)spawnRate * 0.5);
72945 maxSpawns = (int)((float)maxSpawns * 2f);
72946 }
72947 if (Main.player[k].ZoneWaterCandle || Main.player[k].inventory[Main.player[k].selectedItem].type == 148)
72948 {
72949 if (!Main.player[k].ZonePeaceCandle && Main.player[k].inventory[Main.player[k].selectedItem].type != 3117)
72950 {
72951 spawnRate = (int)((double)spawnRate * 0.75);
72952 maxSpawns = (int)((float)maxSpawns * 1.5f);
72953 }
72954 }
72955 else if (Main.player[k].ZonePeaceCandle || Main.player[k].inventory[Main.player[k].selectedItem].type == 3117)
72956 {
72957 spawnRate = (int)((double)spawnRate * 1.3);
72958 maxSpawns = (int)((float)maxSpawns * 0.7f);
72959 }
72960 if (Main.player[k].ZoneShadowCandle || Main.player[k].inventory[Main.player[k].selectedItem].type == 5322)
72961 {
72962 Main.player[k].townNPCs = 0f;
72963 }
72964 if (Main.player[k].ZoneWaterCandle && (double)(Main.player[k].position.Y / 16f) < Main.worldSurface * 0.3499999940395355)
72965 {
72966 spawnRate = (int)((double)spawnRate * 0.5);
72967 }
72968 if (Main.player[k].isNearFairy())
72969 {
72970 spawnRate = (int)((float)spawnRate * 1.2f);
72971 maxSpawns = (int)((float)maxSpawns * 0.8f);
72972 }
72973 if ((double)spawnRate < (double)defaultSpawnRate * 0.1)
72974 {
72975 spawnRate = (int)((double)defaultSpawnRate * 0.1);
72976 }
72977 if (maxSpawns > defaultMaxSpawns * 3)
72978 {
72979 maxSpawns = defaultMaxSpawns * 3;
72980 }
72981 if (Main.getGoodWorld)
72982 {
72983 spawnRate = (int)((float)spawnRate * 0.8f);
72984 maxSpawns = (int)((float)maxSpawns * 1.2f);
72985 }
72986 if (Main.GameModeInfo.IsJourneyMode)
72987 {
72989 if (power != null && power.GetIsUnlocked())
72990 {
72991 if (power.GetShouldDisableSpawnsFor(k))
72992 {
72993 continue;
72994 }
72995 if (power.GetRemappedSliderValueFor(k, out var num10))
72996 {
72997 spawnRate = (int)((float)spawnRate / num10);
72998 maxSpawns = (int)((float)maxSpawns * num10);
72999 }
73000 }
73001 }
73002 if ((Main.pumpkinMoon || Main.snowMoon) && (Main.remixWorld || (double)Main.player[k].position.Y < Main.worldSurface * 16.0))
73003 {
73004 maxSpawns = (int)((double)defaultMaxSpawns * (2.0 + 0.3 * (double)num4));
73005 spawnRate = 20;
73006 }
73007 if (DD2Event.Ongoing && Main.player[k].ZoneOldOneArmy)
73008 {
73009 maxSpawns = defaultMaxSpawns;
73010 spawnRate = defaultSpawnRate;
73011 }
73012 if (flag6)
73013 {
73014 maxSpawns = (int)((double)defaultMaxSpawns * (2.0 + 0.3 * (double)num4));
73015 spawnRate = 20;
73016 }
73017 if (Main.player[k].ZoneDungeon && !downedBoss3)
73018 {
73019 spawnRate = 10;
73020 }
73021 if (!flag6 && ((!Main.bloodMoon && !Main.pumpkinMoon && !Main.snowMoon) || Main.dayTime) && (!Main.eclipse || !Main.dayTime) && !Main.player[k].ZoneDungeon && !Main.player[k].ZoneCorrupt && !Main.player[k].ZoneCrimson && !Main.player[k].ZoneMeteor && !Main.player[k].ZoneOldOneArmy)
73022 {
73023 if (Main.player[k].Center.Y / 16f > (float)Main.UnderworldLayer && (!Main.remixWorld || !((double)(Main.player[k].Center.X / 16f) > (double)Main.maxTilesX * 0.39 + 50.0) || !((double)(Main.player[k].Center.X / 16f) < (double)Main.maxTilesX * 0.61)))
73024 {
73025 if (Main.player[k].townNPCs == 1f)
73026 {
73027 if (Main.rand.Next(2) == 0)
73028 {
73029 flag5 = true;
73030 }
73031 if (Main.rand.Next(10) == 0)
73032 {
73033 flag12 = true;
73034 maxSpawns = (int)((double)(float)maxSpawns * 0.5);
73035 }
73036 else
73037 {
73038 spawnRate = (int)((double)(float)spawnRate * 1.25);
73039 }
73040 }
73041 else if (Main.player[k].townNPCs == 2f)
73042 {
73043 if (Main.rand.Next(4) != 0)
73044 {
73045 flag5 = true;
73046 }
73047 if (Main.rand.Next(5) == 0)
73048 {
73049 flag12 = true;
73050 maxSpawns = (int)((double)(float)maxSpawns * 0.5);
73051 }
73052 else
73053 {
73054 spawnRate = (int)((double)(float)spawnRate * 1.5);
73055 }
73056 }
73057 else if (Main.player[k].townNPCs >= 3f)
73058 {
73059 if (Main.rand.Next(10) != 0)
73060 {
73061 flag5 = true;
73062 }
73063 if (Main.rand.Next(3) == 0)
73064 {
73065 flag12 = true;
73066 maxSpawns = (int)((double)(float)maxSpawns * 0.5);
73067 }
73068 else
73069 {
73070 spawnRate = (int)((float)spawnRate * 2f);
73071 }
73072 }
73073 }
73074 else if (Main.player[k].townNPCs == 1f)
73075 {
73076 flag5 = true;
73077 if (Main.player[k].ZoneGraveyard)
73078 {
73079 spawnRate = (int)((double)(float)spawnRate * 1.66);
73080 if (Main.rand.Next(9) == 1)
73081 {
73082 flag12 = true;
73083 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73084 }
73085 }
73086 else if (Main.rand.Next(3) == 1)
73087 {
73088 flag12 = true;
73089 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73090 }
73091 else
73092 {
73093 spawnRate = (int)((float)spawnRate * 2f);
73094 }
73095 }
73096 else if (Main.player[k].townNPCs == 2f)
73097 {
73098 flag5 = true;
73099 if (Main.player[k].ZoneGraveyard)
73100 {
73101 spawnRate = (int)((double)(float)spawnRate * 2.33);
73102 if (Main.rand.Next(6) == 1)
73103 {
73104 flag12 = true;
73105 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73106 }
73107 }
73108 else if (Main.rand.Next(3) != 0)
73109 {
73110 flag12 = true;
73111 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73112 }
73113 else
73114 {
73115 spawnRate = (int)((float)spawnRate * 3f);
73116 }
73117 }
73118 else if (Main.player[k].townNPCs >= 3f)
73119 {
73120 flag5 = true;
73121 if (Main.player[k].ZoneGraveyard)
73122 {
73123 spawnRate = (int)((float)spawnRate * 3f);
73124 if (Main.rand.Next(3) == 1)
73125 {
73126 flag12 = true;
73127 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73128 }
73129 }
73130 else
73131 {
73132 if (!Main.expertMode || Main.rand.Next(30) != 0)
73133 {
73134 flag12 = true;
73135 }
73136 maxSpawns = (int)((double)(float)maxSpawns * 0.6);
73137 }
73138 }
73139 }
73140 bool flag15 = false;
73141 if (Main.player[k].active && !Main.player[k].dead && Main.player[k].nearbyActiveNPCs < (float)maxSpawns && Main.rand.Next(spawnRate) == 0)
73142 {
73143 bool flag16 = Main.player[k].ZoneTowerNebula || Main.player[k].ZoneTowerSolar || Main.player[k].ZoneTowerStardust || Main.player[k].ZoneTowerVortex;
73144 spawnRangeX = (int)((double)(sWidth / 16) * 0.7);
73145 spawnRangeY = (int)((double)(sHeight / 16) * 0.7);
73146 safeRangeX = (int)((double)(sWidth / 16) * 0.52);
73147 safeRangeY = (int)((double)(sHeight / 16) * 0.52);
73148 if (Main.player[k].inventory[Main.player[k].selectedItem].type == 1254 || Main.player[k].inventory[Main.player[k].selectedItem].type == 1299 || Main.player[k].scope)
73149 {
73150 float num11 = 1.5f;
73151 if (Main.player[k].inventory[Main.player[k].selectedItem].type == 1254 && Main.player[k].scope)
73152 {
73153 num11 = 1.25f;
73154 }
73155 else if (Main.player[k].inventory[Main.player[k].selectedItem].type == 1254)
73156 {
73157 num11 = 1.5f;
73158 }
73159 else if (Main.player[k].inventory[Main.player[k].selectedItem].type == 1299)
73160 {
73161 num11 = 1.5f;
73162 }
73163 else if (Main.player[k].scope)
73164 {
73165 num11 = 2f;
73166 }
73167 spawnRangeX += (int)((double)(sWidth / 16) * 0.5 / (double)num11);
73168 spawnRangeY += (int)((double)(sHeight / 16) * 0.5 / (double)num11);
73169 safeRangeX += (int)((double)(sWidth / 16) * 0.5 / (double)num11);
73170 safeRangeY += (int)((double)(sHeight / 16) * 0.5 / (double)num11);
73171 }
73172 int num12 = (int)(Main.player[k].position.X / 16f) - spawnRangeX;
73173 int num13 = (int)(Main.player[k].position.X / 16f) + spawnRangeX;
73174 int num14 = (int)(Main.player[k].position.Y / 16f) - spawnRangeY;
73175 int num15 = (int)(Main.player[k].position.Y / 16f) + spawnRangeY;
73176 int num16 = (int)(Main.player[k].position.X / 16f) - safeRangeX;
73177 int num17 = (int)(Main.player[k].position.X / 16f) + safeRangeX;
73178 int num18 = (int)(Main.player[k].position.Y / 16f) - safeRangeY;
73179 int num19 = (int)(Main.player[k].position.Y / 16f) + safeRangeY;
73180 if (num12 < 0)
73181 {
73182 num12 = 0;
73183 }
73184 if (num13 > Main.maxTilesX)
73185 {
73187 }
73188 if (num14 < 0)
73189 {
73190 num14 = 0;
73191 }
73192 if (num15 > Main.maxTilesY)
73193 {
73195 }
73196 for (int m = 0; m < 50; m++)
73197 {
73198 int num20 = Main.rand.Next(num12, num13);
73199 int num21 = Main.rand.Next(num14, num15);
73200 if (!Main.tile[num20, num21].nactive() || !Main.tileSolid[Main.tile[num20, num21].type])
73201 {
73202 if (!flag16 && Main.wallHouse[Main.tile[num20, num21].wall])
73203 {
73204 continue;
73205 }
73206 if (!flag6 && (double)num21 < Main.worldSurface * 0.3499999940395355 && !flag12 && ((double)num20 < (double)Main.maxTilesX * 0.45 || (double)num20 > (double)Main.maxTilesX * 0.55 || Main.hardMode))
73207 {
73208 num3 = Main.tile[num20, num21].type;
73209 num = num20;
73210 num2 = num21;
73211 flag2 = true;
73212 flag3 = true;
73213 }
73214 else if (!flag6 && (double)num21 < Main.worldSurface * 0.44999998807907104 && !flag12 && Main.hardMode && Main.rand.Next(10) == 0)
73215 {
73216 num3 = Main.tile[num20, num21].type;
73217 num = num20;
73218 num2 = num21;
73219 flag2 = true;
73220 flag3 = true;
73221 }
73222 else
73223 {
73224 for (int n = num21; n < Main.maxTilesY && n < num15; n++)
73225 {
73226 if (Main.tile[num20, n].nactive() && Main.tileSolid[Main.tile[num20, n].type])
73227 {
73229 {
73230 num3 = Main.tile[num20, n].type;
73231 num = num20;
73232 num2 = n;
73233 flag2 = true;
73234 }
73235 break;
73236 }
73237 }
73238 }
73239 if (Main.player[k].ZoneShadowCandle)
73240 {
73241 flag5 = false;
73242 }
73243 else if (!flag3 && Main.player[k].afkCounter >= AFKTimeNeededForNoWorms)
73244 {
73245 flag5 = true;
73246 }
73247 if (flag2)
73248 {
73249 int num22 = num - spawnSpaceX / 2;
73250 int num23 = num + spawnSpaceX / 2;
73251 int num24 = num2 - spawnSpaceY;
73252 int num25 = num2;
73253 if (num22 < 0)
73254 {
73255 flag2 = false;
73256 }
73257 if (num23 > Main.maxTilesX)
73258 {
73259 flag2 = false;
73260 }
73261 if (num24 < 0)
73262 {
73263 flag2 = false;
73264 }
73265 if (num25 > Main.maxTilesY)
73266 {
73267 flag2 = false;
73268 }
73269 if (flag2)
73270 {
73271 for (int num26 = num22; num26 < num23; num26++)
73272 {
73273 for (int num27 = num24; num27 < num25; num27++)
73274 {
73275 if (Main.tile[num26, num27].nactive() && Main.tileSolid[Main.tile[num26, num27].type])
73276 {
73277 flag2 = false;
73278 break;
73279 }
73280 if (Main.tile[num26, num27].lava())
73281 {
73282 flag2 = false;
73283 break;
73284 }
73285 }
73286 }
73287 }
73288 if (num >= num16 && num <= num17)
73289 {
73290 flag15 = true;
73291 }
73292 }
73293 }
73294 if (flag2 || flag2)
73295 {
73296 break;
73297 }
73298 }
73299 }
73300 if (flag2)
73301 {
73302 Rectangle rectangle = new Rectangle(num * 16, num2 * 16, 16, 16);
73303 for (int num28 = 0; num28 < 255; num28++)
73304 {
73305 if (Main.player[num28].active)
73306 {
73307 Rectangle rectangle2 = new Rectangle((int)(Main.player[num28].position.X + (float)(Main.player[num28].width / 2) - (float)(sWidth / 2) - (float)safeRangeX), (int)(Main.player[num28].position.Y + (float)(Main.player[num28].height / 2) - (float)(sHeight / 2) - (float)safeRangeY), sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
73308 if (rectangle.Intersects(rectangle2))
73309 {
73310 flag2 = false;
73311 }
73312 }
73313 }
73314 }
73315 if (flag2)
73316 {
73317 if (Main.player[k].ZoneDungeon && (!Main.tileDungeon[Main.tile[num, num2].type] || Main.tile[num, num2 - 1].wall == 0))
73318 {
73319 flag2 = false;
73320 }
73321 if (Main.tile[num, num2 - 1].liquid > 0 && Main.tile[num, num2 - 2].liquid > 0 && !Main.tile[num, num2 - 1].lava())
73322 {
73323 if (Main.tile[num, num2 - 1].shimmer())
73324 {
73325 flag2 = false;
73326 }
73327 if (Main.tile[num, num2 - 1].honey())
73328 {
73329 flag8 = true;
73330 }
73331 else
73332 {
73333 flag7 = true;
73334 }
73335 }
73336 int num29 = (int)Main.player[k].Center.X / 16;
73337 int num30 = (int)(Main.player[k].Bottom.Y + 8f) / 16;
73338 if (Main.tile[num, num2].type == 367)
73339 {
73340 flag10 = true;
73341 }
73342 else if (Main.tile[num, num2].type == 368)
73343 {
73344 flag9 = true;
73345 }
73346 else if (Main.tile[num29, num30].type == 367)
73347 {
73348 flag10 = true;
73349 }
73350 else if (Main.tile[num29, num30].type == 368)
73351 {
73352 flag9 = true;
73353 }
73354 else
73355 {
73356 int num31 = Main.rand.Next(20, 31);
73357 int num32 = Main.rand.Next(1, 4);
73358 if (num - num31 < 0)
73359 {
73360 num31 = num;
73361 }
73362 if (num2 - num31 < 0)
73363 {
73364 num31 = num2;
73365 }
73366 if (num + num31 >= Main.maxTilesX)
73367 {
73368 num31 = Main.maxTilesX - num - 1;
73369 }
73370 if (num2 + num31 >= Main.maxTilesY)
73371 {
73372 num31 = Main.maxTilesY - num2 - 1;
73373 }
73374 for (int num33 = num - num31; num33 <= num + num31; num33 += num32)
73375 {
73376 int num34 = Main.rand.Next(1, 4);
73377 for (int num35 = num2 - num31; num35 <= num2 + num31; num35 += num34)
73378 {
73379 if (Main.tile[num33, num35].type == 367)
73380 {
73381 flag10 = true;
73382 }
73383 if (Main.tile[num33, num35].type == 368)
73384 {
73385 flag9 = true;
73386 }
73387 }
73388 }
73389 num31 = Main.rand.Next(30, 61);
73390 num32 = Main.rand.Next(3, 7);
73391 if (num29 - num31 < 0)
73392 {
73393 num31 = num29;
73394 }
73395 if (num30 - num31 < 0)
73396 {
73397 num31 = num30;
73398 }
73399 if (num29 + num31 >= Main.maxTilesX)
73400 {
73401 num31 = Main.maxTilesX - num29 - 2;
73402 }
73403 if (num30 + num31 >= Main.maxTilesY)
73404 {
73405 num31 = Main.maxTilesY - num30 - 2;
73406 }
73407 for (int num36 = num29 - num31; num36 <= num29 + num31; num36 += num32)
73408 {
73409 int num37 = Main.rand.Next(3, 7);
73410 for (int num38 = num30 - num31; num38 <= num30 + num31; num38 += num37)
73411 {
73412 if (Main.tile[num36, num38].type == 367)
73413 {
73414 flag10 = true;
73415 }
73416 if (Main.tile[num36, num38].type == 368)
73417 {
73418 flag9 = true;
73419 }
73420 }
73421 }
73422 }
73423 if (flag8)
73424 {
73425 flag2 = false;
73426 }
73427 if ((num3 == 477 || num3 == 492) && !Main.bloodMoon && !Main.eclipse && Main.invasionType <= 0 && !Main.pumpkinMoon && !Main.snowMoon && !Main.slimeRain && Main.rand.Next(100) < 10)
73428 {
73429 flag2 = false;
73430 }
73431 }
73432 if (!flag2)
73433 {
73434 continue;
73435 }
73436 if (Main.remixWorld)
73437 {
73438 ResetRemixHax();
73439 }
73440 bool flag17 = (double)num2 <= Main.rockLayer;
73441 if (Main.remixWorld)
73442 {
73443 flag17 = (double)num2 > Main.rockLayer && num2 <= Main.maxTilesY - 190;
73444 }
73445 bool flag18 = (double)num2 > Main.rockLayer && num2 < Main.UnderworldLayer;
73447 {
73449 }
73450 if (flag18 && !Main.player[k].ZoneDungeon && !flag6)
73451 {
73452 if (Main.rand.Next(3) == 0)
73453 {
73454 int num39 = Main.rand.Next(5, 15);
73455 if (num - num39 >= 0 && num + num39 < Main.maxTilesX)
73456 {
73457 for (int num40 = num - num39; num40 < num + num39; num40++)
73458 {
73459 for (int num41 = num2 - num39; num41 < num2 + num39; num41++)
73460 {
73461 if (Main.tile[num40, num41].wall == 62)
73462 {
73463 flag11 = true;
73464 }
73465 }
73466 }
73467 }
73468 }
73469 else
73470 {
73471 int num42 = (int)Main.player[k].position.X / 16;
73472 int num43 = (int)Main.player[k].position.Y / 16;
73473 if (Main.tile[num42, num43].wall == 62)
73474 {
73475 flag11 = true;
73476 }
73477 }
73478 }
73479 if ((double)num2 < Main.rockLayer && num2 > 200 && !Main.player[k].ZoneDungeon && !flag6)
73480 {
73481 if (Main.rand.Next(3) == 0)
73482 {
73483 int num44 = Main.rand.Next(5, 15);
73484 if (num - num44 >= 0 && num + num44 < Main.maxTilesX)
73485 {
73486 for (int num45 = num - num44; num45 < num + num44; num45++)
73487 {
73488 for (int num46 = num2 - num44; num46 < num2 + num44; num46++)
73489 {
73491 {
73492 flag13 = true;
73493 }
73494 }
73495 }
73496 }
73497 }
73498 else
73499 {
73500 int num47 = (int)Main.player[k].position.X / 16;
73501 int num48 = (int)Main.player[k].position.Y / 16;
73503 {
73504 flag13 = true;
73505 }
73506 }
73507 }
73508 flag2 = false;
73509 int num49 = Main.tile[num, num2].type;
73510 int num50 = Main.tile[num, num2 - 1].wall;
73511 if (Main.tile[num, num2 - 2].wall == 244 || Main.tile[num, num2].wall == 244)
73512 {
73513 num50 = 244;
73514 }
73515 bool flag19 = (float)new Point(num8 - num, num9 - num2).X * Main.windSpeedTarget > 0f;
73516 bool flag20 = (double)num2 <= Main.worldSurface;
73517 bool flag21 = (double)num2 >= Main.rockLayer;
73518 bool flag22 = ((num < WorldGen.oceanDistance || num > Main.maxTilesX - WorldGen.oceanDistance) && Main.tileSand[num49] && (double)num2 < Main.rockLayer) || (num3 == 53 && WorldGen.oceanDepths(num, num2));
73520 bool flag24 = Main.cloudAlpha > 0f;
73521 int range = 10;
73522 if (Main.remixWorld)
73523 {
73525 flag21 = (((double)num2 > Main.worldSurface && (double)num2 < Main.rockLayer) ? true : false);
73526 if ((double)num2 < Main.worldSurface + 5.0)
73527 {
73528 Main.raining = false;
73529 Main.cloudAlpha = 0f;
73530 Main.dayTime = false;
73531 }
73532 range = 5;
73533 if (Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson)
73534 {
73535 flag22 = false;
73536 flag23 = false;
73537 }
73538 if ((double)num < (double)Main.maxTilesX * 0.43 || (double)num > (double)Main.maxTilesX * 0.57)
73539 {
73540 if ((double)num2 > Main.rockLayer - 200.0 && num2 < Main.maxTilesY - 200 && Main.rand.Next(2) == 0)
73541 {
73542 flag22 = true;
73543 }
73544 if ((double)num2 > Main.rockLayer - 200.0 && num2 < Main.maxTilesY - 200 && Main.rand.Next(2) == 0)
73545 {
73546 flag23 = true;
73547 }
73548 }
73549 if ((double)num2 > Main.rockLayer - 20.0)
73550 {
73551 if (num2 <= Main.maxTilesY - 190 && Main.rand.Next(3) != 0)
73552 {
73553 flag20 = true;
73554 Main.dayTime = false;
73555 if (Main.rand.Next(2) == 0)
73556 {
73557 Main.dayTime = true;
73558 }
73559 }
73560 else if ((Main.bloodMoon || (Main.eclipse && Main.dayTime)) && (double)num > (double)Main.maxTilesX * 0.38 + 50.0 && (double)num < (double)Main.maxTilesX * 0.62)
73561 {
73562 flag20 = true;
73563 }
73564 }
73565 }
73566 num49 = SpawnNPC_TryFindingProperGroundTileType(num49, num, num2);
73567 int newNPC = 200;
73568 int cattailX;
73569 int cattailY;
73570 if (Main.player[k].ZoneTowerNebula)
73571 {
73572 bool flag25 = true;
73573 int num51 = 0;
73574 while (flag25)
73575 {
73576 num51 = Utils.SelectRandom<int>(Main.rand, 424, 424, 424, 423, 423, 423, 421, 421, 421, 420, 420);
73577 flag25 = false;
73578 if (num51 == 424 && CountNPCS(num51) >= 3)
73579 {
73580 flag25 = true;
73581 }
73582 if (num51 == 423 && CountNPCS(num51) >= 3)
73583 {
73584 flag25 = true;
73585 }
73586 if (num51 == 420 && CountNPCS(num51) >= 3)
73587 {
73588 flag25 = true;
73589 }
73590 }
73591 if (num51 != 0)
73592 {
73593 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num51, 1);
73594 }
73595 }
73596 else if (Main.player[k].ZoneTowerVortex)
73597 {
73598 bool flag26 = true;
73599 int num52 = 0;
73600 while (flag26)
73601 {
73602 num52 = Utils.SelectRandom<int>(Main.rand, 429, 429, 429, 429, 427, 427, 425, 425, 426);
73603 flag26 = false;
73604 if (num52 == 425 && CountNPCS(num52) >= 3)
73605 {
73606 flag26 = true;
73607 }
73608 if (num52 == 426 && CountNPCS(num52) >= 3)
73609 {
73610 flag26 = true;
73611 }
73612 if (num52 == 429 && CountNPCS(num52) >= 4)
73613 {
73614 flag26 = true;
73615 }
73616 }
73617 if (num52 != 0)
73618 {
73619 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num52, 1);
73620 }
73621 }
73622 else if (Main.player[k].ZoneTowerStardust)
73623 {
73624 int num53 = Utils.SelectRandom<int>(Main.rand, 411, 411, 411, 409, 409, 407, 402, 405);
73625 if (num53 != 0)
73626 {
73627 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num53, 1);
73628 }
73629 }
73630 else if (Main.player[k].ZoneTowerSolar)
73631 {
73632 bool flag27 = true;
73633 int num54 = 0;
73634 while (flag27)
73635 {
73636 num54 = Utils.SelectRandom<int>(Main.rand, 518, 419, 418, 412, 417, 416, 415);
73637 flag27 = false;
73638 if (num54 == 418 && Main.rand.Next(2) == 0)
73639 {
73640 num54 = Utils.SelectRandom<int>(Main.rand, 415, 416, 419, 417);
73641 }
73642 if (num54 == 518 && CountNPCS(num54) >= 2)
73643 {
73644 flag27 = true;
73645 }
73646 if (num54 == 412 && CountNPCS(num54) >= 1)
73647 {
73648 flag27 = true;
73649 }
73650 }
73651 if (num54 != 0)
73652 {
73653 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num54, 1);
73654 }
73655 }
73656 else if (flag3)
73657 {
73658 int maxValue2 = 8;
73659 int maxValue3 = 30;
73660 bool flag28 = (float)Math.Abs(num - Main.maxTilesX / 2) / (float)(Main.maxTilesX / 2) > 0.33f && (Main.wallLight[Main.tile[num8, num9].wall] || Main.tile[num8, num9].wall == 73);
73661 if (flag28 && AnyDanger())
73662 {
73663 flag28 = false;
73664 }
73665 if (Main.player[k].ZoneWaterCandle)
73666 {
73667 maxValue2 = 3;
73668 maxValue3 = 10;
73669 }
73670 if (flag6 && Main.invasionType == 4)
73671 {
73672 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 388);
73673 }
73674 else if (flag28 && Main.hardMode && downedGolemBoss && ((!downedMartians && Main.rand.Next(maxValue2) == 0) || Main.rand.Next(maxValue3) == 0) && !AnyNPCs(399))
73675 {
73676 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 399);
73677 }
73678 else if (flag28 && Main.hardMode && downedGolemBoss && ((!downedMartians && Main.rand.Next(maxValue2) == 0) || Main.rand.Next(maxValue3) == 0) && !AnyNPCs(399) && (Main.player[k].inventory[Main.player[k].selectedItem].type == 148 || Main.player[k].ZoneWaterCandle))
73679 {
73680 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 399);
73681 }
73682 else if (Main.hardMode && !AnyNPCs(87) && !flag5 && Main.rand.Next(10) == 0)
73683 {
73684 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 87, 1);
73685 }
73686 else if (Main.hardMode && !AnyNPCs(87) && !flag5 && Main.rand.Next(10) == 0 && (Main.player[k].inventory[Main.player[k].selectedItem].type == 148 || Main.player[k].ZoneWaterCandle))
73687 {
73688 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 87, 1);
73689 }
73690 else if (!unlockedSlimePurpleSpawn && Main.player[k].RollLuck(25) == 0 && !AnyNPCs(686))
73691 {
73692 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 686);
73693 }
73694 else
73695 {
73696 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 48);
73697 }
73698 }
73699 else if (flag6)
73700 {
73701 if (Main.invasionType == 1)
73702 {
73703 if (Main.hardMode && !AnyNPCs(471) && Main.rand.Next(30) == 0)
73704 {
73705 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 471);
73706 }
73707 else if (Main.rand.Next(9) == 0)
73708 {
73709 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 29);
73710 }
73711 else if (Main.rand.Next(5) == 0)
73712 {
73713 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 26);
73714 }
73715 else if (Main.rand.Next(3) == 0)
73716 {
73717 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 111);
73718 }
73719 else if (Main.rand.Next(3) == 0)
73720 {
73721 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 27);
73722 }
73723 else
73724 {
73725 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 28);
73726 }
73727 }
73728 else if (Main.invasionType == 2)
73729 {
73730 if (Main.rand.Next(7) == 0)
73731 {
73732 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 145);
73733 }
73734 else if (Main.rand.Next(3) == 0)
73735 {
73736 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 143);
73737 }
73738 else
73739 {
73740 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 144);
73741 }
73742 }
73743 else if (Main.invasionType == 3)
73744 {
73745 if (Main.invasionSize < Main.invasionSizeStart / 2 && Main.rand.Next(20) == 0 && !AnyNPCs(491) && !Collision.SolidTiles(num - 20, num + 20, num2 - 40, num2 - 10))
73746 {
73747 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, (num2 - 10) * 16, 491);
73748 }
73749 else if (Main.rand.Next(30) == 0 && !AnyNPCs(216))
73750 {
73751 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 216);
73752 }
73753 else if (Main.rand.Next(11) == 0)
73754 {
73755 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 215);
73756 }
73757 else if (Main.rand.Next(9) == 0)
73758 {
73759 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 252);
73760 }
73761 else if (Main.rand.Next(7) == 0)
73762 {
73763 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 214);
73764 }
73765 else if (Main.rand.Next(3) == 0)
73766 {
73767 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 213);
73768 }
73769 else
73770 {
73771 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 212);
73772 }
73773 }
73774 else if (Main.invasionType == 4)
73775 {
73776 int num55 = 0;
73777 int num56 = Main.rand.Next(7);
73778 bool flag29 = (float)(Main.invasionSizeStart - Main.invasionSize) / (float)Main.invasionSizeStart >= 0.3f && !AnyNPCs(395);
73779 if (Main.rand.Next(45) == 0 && flag29)
73780 {
73781 num55 = 395;
73782 }
73783 else if (num56 >= 6)
73784 {
73785 if (Main.rand.Next(20) == 0 && flag29)
73786 {
73787 num55 = 395;
73788 }
73789 else
73790 {
73791 int num57 = Main.rand.Next(2);
73792 if (num57 == 0)
73793 {
73794 num55 = 390;
73795 }
73796 if (num57 == 1)
73797 {
73798 num55 = 386;
73799 }
73800 }
73801 }
73802 else if (num56 >= 4)
73803 {
73804 int num58 = Main.rand.Next(5);
73805 num55 = ((num58 < 2) ? 382 : ((num58 >= 4) ? 388 : 381));
73806 }
73807 else
73808 {
73809 int num59 = Main.rand.Next(4);
73810 if (num59 == 3)
73811 {
73812 if (!AnyNPCs(520))
73813 {
73814 num55 = 520;
73815 }
73816 else
73817 {
73818 num59 = Main.rand.Next(3);
73819 }
73820 }
73821 if (num59 == 0)
73822 {
73823 num55 = 385;
73824 }
73825 if (num59 == 1)
73826 {
73827 num55 = 389;
73828 }
73829 if (num59 == 2)
73830 {
73831 num55 = 383;
73832 }
73833 }
73834 if (num55 != 0)
73835 {
73836 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num55, 1);
73837 }
73838 }
73839 }
73840 else if (num50 == 244 && !Main.remixWorld)
73841 {
73842 if (flag7)
73843 {
73844 if (Main.player[k].RollLuck(goldCritterChance) == 0)
73845 {
73846 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 592);
73847 }
73848 else
73849 {
73850 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 55);
73851 }
73852 }
73853 else if ((double)num2 > Main.worldSurface)
73854 {
73855 if (Main.rand.Next(3) == 0)
73856 {
73857 if (Main.player[k].RollLuck(goldCritterChance) == 0)
73858 {
73859 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 447);
73860 }
73861 else
73862 {
73863 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 300);
73864 }
73865 }
73866 else if (Main.rand.Next(2) == 0)
73867 {
73868 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 359);
73869 }
73870 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
73871 {
73872 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 448);
73873 }
73874 else if (Main.rand.Next(3) != 0)
73875 {
73876 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 357);
73877 }
73878 }
73879 else if (Main.player[k].RollLuck(2) == 0)
73880 {
73881 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 624);
73882 Main.npc[newNPC].timeLeft *= 10;
73883 }
73884 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
73885 {
73886 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 443);
73887 }
73888 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
73889 {
73890 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 539);
73891 }
73892 else if (Main.halloween && Main.rand.Next(3) != 0)
73893 {
73894 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 303);
73895 }
73896 else if (Main.xMas && Main.rand.Next(3) != 0)
73897 {
73898 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 337);
73899 }
73900 else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
73901 {
73902 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 540);
73903 }
73904 else if (Main.rand.Next(3) == 0)
73905 {
73906 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Utils.SelectRandom(Main.rand, new short[2] { 299, 538 }));
73907 }
73908 else
73909 {
73910 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 46);
73911 }
73912 }
73913 else if (!savedBartender && DD2Event.ReadyToFindBartender && !AnyNPCs(579) && Main.rand.Next(80) == 0 && !flag7)
73914 {
73915 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 579);
73916 }
73917 else if (Main.tile[num, num2].wall == 62 || flag11)
73918 {
73919 bool flag30 = flag21 && num2 < Main.maxTilesY - 210;
73921 {
73922 flag30 = num2 < Main.maxTilesY - 210;
73923 }
73924 if (Main.tile[num, num2].wall == 62 && Main.rand.Next(8) == 0 && !flag7 && flag30 && !savedStylist && !AnyNPCs(354))
73925 {
73926 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 354);
73927 }
73928 else if (Main.hardMode && Main.rand.Next(10) != 0)
73929 {
73930 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 163);
73931 }
73932 else
73933 {
73934 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 164);
73935 }
73936 }
73937 else if ((SpawnTileOrAboveHasAnyWallInSet(num, num2, WallID.Sets.AllowsUndergroundDesertEnemiesToSpawn) || flag13) && WorldGen.checkUnderground(num, num2))
73938 {
73939 float num60 = 1.15f;
73940 if ((double)num2 > (Main.rockLayer * 2.0 + (double)Main.maxTilesY) / 3.0)
73941 {
73942 num60 *= 0.5f;
73943 }
73944 else if ((double)num2 > Main.rockLayer)
73945 {
73946 num60 *= 0.85f;
73947 }
73948 if (Main.rand.Next(20) == 0 && !flag7 && !savedGolfer && !AnyNPCs(589))
73949 {
73950 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 589);
73951 }
73952 else if (Main.hardMode && Main.rand.Next((int)(45f * num60)) == 0 && !flag5 && (double)num2 > Main.worldSurface + 100.0)
73953 {
73954 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 510);
73955 }
73956 else if (Main.rand.Next((int)(45f * num60)) == 0 && !flag5 && (double)num2 > Main.worldSurface + 100.0 && CountNPCS(513) == 0)
73957 {
73958 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 513);
73959 }
73960 else if (Main.hardMode && Main.rand.Next(5) != 0)
73961 {
73962 List<int> list = new List<int>();
73963 if (Main.player[k].ZoneCorrupt)
73964 {
73965 list.Add(525);
73966 list.Add(525);
73967 }
73968 if (Main.player[k].ZoneCrimson)
73969 {
73970 list.Add(526);
73971 list.Add(526);
73972 }
73973 if (Main.player[k].ZoneHallow)
73974 {
73975 list.Add(527);
73976 list.Add(527);
73977 }
73978 if (list.Count == 0)
73979 {
73980 list.Add(524);
73981 list.Add(524);
73982 }
73983 if (Main.player[k].ZoneCorrupt || Main.player[k].ZoneCrimson)
73984 {
73985 list.Add(533);
73986 list.Add(529);
73987 }
73988 else
73989 {
73990 list.Add(530);
73991 list.Add(528);
73992 }
73993 list.Add(532);
73994 int num61 = Utils.SelectRandom(Main.rand, list.ToArray());
73995 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num61);
73996 list.Clear();
73997 }
73998 else
73999 {
74000 int num62 = Utils.SelectRandom<int>(Main.rand, 69, 580, 580, 580, 581);
74001 if (Main.rand.Next(15) == 0)
74002 {
74003 num62 = 537;
74004 }
74005 else if (Main.rand.Next(10) == 0)
74006 {
74007 switch (num62)
74008 {
74009 case 580:
74010 num62 = 508;
74011 break;
74012 case 581:
74013 num62 = 509;
74014 break;
74015 }
74016 }
74017 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num62);
74018 }
74019 }
74020 else if (Main.hardMode && flag7 && Main.player[k].ZoneJungle && Main.rand.Next(3) != 0)
74021 {
74022 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 157);
74023 }
74024 else if (Main.hardMode && flag7 && Main.player[k].ZoneCrimson && Main.rand.Next(3) != 0)
74025 {
74026 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 242);
74027 }
74028 else if (Main.hardMode && flag7 && Main.player[k].ZoneCrimson && Main.rand.Next(3) != 0)
74029 {
74030 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 241);
74031 }
74032 else if ((!flag12 || (!savedAngler && !AnyNPCs(376))) && flag7 && flag22)
74033 {
74034 bool flag31 = false;
74035 if (!savedAngler && !AnyNPCs(376) && ((double)num2 < Main.worldSurface - 10.0 || Main.remixWorld))
74036 {
74037 int num63 = -1;
74038 for (int num64 = num2 - 1; num64 > num2 - 50; num64--)
74039 {
74040 if (Main.tile[num, num64].liquid == 0 && !WorldGen.SolidTile(num, num64) && !WorldGen.SolidTile(num, num64 + 1) && !WorldGen.SolidTile(num, num64 + 2))
74041 {
74042 num63 = num64 + 2;
74043 break;
74044 }
74045 }
74046 if (num63 > num2)
74047 {
74048 num63 = num2;
74049 }
74050 if (num63 > 0 && !flag15)
74051 {
74052 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num63 * 16, 376);
74053 flag31 = true;
74054 }
74055 }
74056 if (!flag31 && !flag15)
74057 {
74058 int num65 = -1;
74059 int num66 = -1;
74060 if (((double)num2 < Main.worldSurface || Main.remixWorld) && num2 > 50)
74061 {
74062 for (int num67 = num2 - 1; num67 > num2 - 50; num67--)
74063 {
74064 if (Main.tile[num, num67].liquid == 0 && !WorldGen.SolidTile(num, num67) && !WorldGen.SolidTile(num, num67 + 1) && !WorldGen.SolidTile(num, num67 + 2))
74065 {
74066 num65 = num67 + 2;
74067 if (!WorldGen.SolidTile(num, num65 + 1) && !WorldGen.SolidTile(num, num65 + 2) && !Main.wallHouse[Main.tile[num, num65 + 2].wall])
74068 {
74069 num66 = num65 + 2;
74070 }
74071 if (Main.wallHouse[Main.tile[num, num65].wall])
74072 {
74073 num65 = -1;
74074 }
74075 break;
74076 }
74077 }
74078 if (num65 > num2)
74079 {
74080 num65 = num2;
74081 }
74082 if (num66 > num2)
74083 {
74084 num66 = num2;
74085 }
74086 }
74087 if (num65 > 0 && !flag15 && Main.rand.Next(10) == 0)
74088 {
74089 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num65 * 16, 602);
74090 }
74091 else if (Main.rand.Next(10) == 0)
74092 {
74093 int num68 = Main.rand.Next(3);
74094 if (num68 == 0 && num65 > 0)
74095 {
74096 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num65 * 16, 625);
74097 }
74098 else if (num68 == 1 && num66 > 0)
74099 {
74100 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num66 * 16, 615);
74101 }
74102 else if (num68 == 2)
74103 {
74104 int num69 = num2;
74105 if (num66 > 0)
74106 {
74107 num69 = num66;
74108 }
74109 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74110 {
74111 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num69 * 16, 627);
74112 }
74113 else
74114 {
74115 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num69 * 16, 626);
74116 }
74117 }
74118 }
74119 else if (Main.rand.Next(40) == 0)
74120 {
74121 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 220);
74122 }
74123 else if (Main.rand.Next(18) == 0)
74124 {
74125 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 221);
74126 }
74127 else if (Main.rand.Next(8) == 0)
74128 {
74129 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 65);
74130 }
74131 else if (Main.rand.Next(3) == 0)
74132 {
74133 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 67);
74134 }
74135 else
74136 {
74137 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 64);
74138 }
74139 }
74140 }
74141 else if (!flag7 && !savedAngler && !AnyNPCs(376) && (num < WorldGen.beachDistance || num > Main.maxTilesX - WorldGen.beachDistance) && Main.tileSand[num49] && ((double)num2 < Main.worldSurface || Main.remixWorld))
74142 {
74143 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 376);
74144 }
74145 else if (!flag12 && flag7 && ((flag21 && Main.rand.Next(2) == 0) || num49 == 60))
74146 {
74147 bool flag32 = false;
74148 if (num49 == 60 && flag20 && num2 > 50 && Main.rand.Next(3) == 0 && Main.dayTime)
74149 {
74150 int num70 = -1;
74151 for (int num71 = num2 - 1; num71 > num2 - 50; num71--)
74152 {
74153 if (Main.tile[num, num71].liquid == 0 && !WorldGen.SolidTile(num, num71) && !WorldGen.SolidTile(num, num71 + 1) && !WorldGen.SolidTile(num, num71 + 2))
74154 {
74155 num70 = num71 + 2;
74156 break;
74157 }
74158 }
74159 if (num70 > num2)
74160 {
74161 num70 = num2;
74162 }
74163 if (num70 > 0 && !flag15)
74164 {
74165 flag32 = true;
74166 if (Main.rand.Next(4) == 0)
74167 {
74168 flag32 = true;
74169 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num70 * 16, 617);
74170 }
74171 else if (!flag && Main.cloudAlpha == 0f)
74172 {
74173 flag32 = true;
74174 int num72 = Main.rand.Next(1, 4);
74175 for (int num73 = 0; num73 < num72; num73++)
74176 {
74177 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74178 {
74179 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num70 * 16 - 16, 613);
74180 }
74181 else
74182 {
74183 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num70 * 16 - 16, 612);
74184 }
74185 }
74186 }
74187 }
74188 }
74189 if (!flag32)
74190 {
74191 if (Main.hardMode && Main.rand.Next(3) > 0)
74192 {
74193 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 102);
74194 }
74195 else
74196 {
74197 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 58);
74198 }
74199 }
74200 }
74201 else if (!flag12 && flag7 && (double)num2 > Main.worldSurface && Main.rand.Next(3) == 0)
74202 {
74203 if (Main.hardMode && Main.rand.Next(3) > 0)
74204 {
74205 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 103);
74206 }
74207 else
74208 {
74209 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 63);
74210 }
74211 }
74212 else if (flag7 && Main.rand.Next(4) == 0 && ((num > WorldGen.oceanDistance && num < Main.maxTilesX - WorldGen.oceanDistance) || (double)num2 > Main.worldSurface + 50.0))
74213 {
74214 if (Main.player[k].ZoneCorrupt)
74215 {
74216 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 57);
74217 }
74218 else if (Main.player[k].ZoneCrimson)
74219 {
74220 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 465);
74221 }
74222 else if ((double)num2 < Main.worldSurface && num2 > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
74223 {
74224 int num74 = -1;
74225 for (int num75 = num2 - 1; num75 > num2 - 50; num75--)
74226 {
74227 if (Main.tile[num, num75].liquid == 0 && !WorldGen.SolidTile(num, num75) && !WorldGen.SolidTile(num, num75 + 1) && !WorldGen.SolidTile(num, num75 + 2))
74228 {
74229 num74 = num75 + 2;
74230 break;
74231 }
74232 }
74233 if (num74 > num2)
74234 {
74235 num74 = num2;
74236 }
74237 if (num74 > 0 && !flag15)
74238 {
74239 if (Main.rand.Next(5) == 0 && (num3 == 2 || num3 == 477))
74240 {
74241 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num74 * 16, 616);
74242 }
74243 else if (num3 == 53)
74244 {
74245 if (Main.rand.Next(2) == 0 && !flag && Main.cloudAlpha == 0f)
74246 {
74247 int num76 = Main.rand.Next(1, 4);
74248 for (int num77 = 0; num77 < num76; num77++)
74249 {
74250 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74251 {
74252 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num74 * 16 - 16, 613);
74253 }
74254 else
74255 {
74256 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num74 * 16 - 16, 612);
74257 }
74258 }
74259 }
74260 else
74261 {
74262 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num74 * 16, 608);
74263 }
74264 }
74265 else if (Main.rand.Next(2) == 0)
74266 {
74267 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num74 * 16, 362);
74268 }
74269 else
74270 {
74271 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num74 * 16, 364);
74272 }
74273 }
74274 else if (num3 == 53 && num > WorldGen.beachDistance && num < Main.maxTilesX - WorldGen.beachDistance)
74275 {
74276 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num74 * 16, 607);
74277 }
74278 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74279 {
74280 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 592);
74281 }
74282 else
74283 {
74284 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 55);
74285 }
74286 }
74287 else if (num3 == 53 && num > WorldGen.beachDistance && num < Main.maxTilesX - WorldGen.beachDistance)
74288 {
74289 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 607);
74290 }
74291 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74292 {
74293 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 592);
74294 }
74295 else
74296 {
74297 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 55);
74298 }
74299 }
74300 else if (downedGoblins && Main.player[k].RollLuck(20) == 0 && !flag7 && flag21 && num2 < Main.maxTilesY - 210 && !savedGoblin && !AnyNPCs(105))
74301 {
74302 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 105);
74303 }
74304 else if (Main.hardMode && Main.player[k].RollLuck(20) == 0 && !flag7 && flag21 && num2 < Main.maxTilesY - 210 && !savedWizard && !AnyNPCs(106))
74305 {
74306 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 106);
74307 }
74308 else if (downedBoss3 && Main.player[k].RollLuck(20) == 0 && !flag7 && flag21 && num2 < Main.maxTilesY - 210 && !unlockedSlimeOldSpawn && !AnyNPCs(685))
74309 {
74310 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 685);
74311 }
74312 else if (flag12)
74313 {
74314 if (Main.player[k].ZoneGraveyard)
74315 {
74316 if (!flag7)
74317 {
74318 if (Main.rand.Next(2) == 0)
74319 {
74320 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 606);
74321 }
74322 else
74323 {
74324 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 610);
74325 }
74326 }
74327 }
74328 else if (!flag15 && flag23)
74329 {
74330 if (flag7)
74331 {
74332 int num78 = -1;
74333 int num79 = -1;
74334 if (((double)num2 < Main.worldSurface || Main.remixWorld) && num2 > 50)
74335 {
74336 for (int num80 = num2 - 1; num80 > num2 - 50; num80--)
74337 {
74338 if (Main.tile[num, num80].liquid == 0 && !WorldGen.SolidTile(num, num80) && !WorldGen.SolidTile(num, num80 + 1) && !WorldGen.SolidTile(num, num80 + 2))
74339 {
74340 num78 = num80 + 2;
74341 if (!WorldGen.SolidTile(num, num78 + 1) && !WorldGen.SolidTile(num, num78 + 2))
74342 {
74343 num79 = num78 + 2;
74344 }
74345 break;
74346 }
74347 }
74348 if (num78 > num2)
74349 {
74350 num78 = num2;
74351 }
74352 if (num79 > num2)
74353 {
74354 num79 = num2;
74355 }
74356 }
74357 if (Main.rand.Next(2) == 0)
74358 {
74359 int num81 = Main.rand.Next(3);
74360 if (num81 == 0 && num78 > 0)
74361 {
74362 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num78 * 16, 625);
74363 }
74364 else if (num81 == 1 && num79 > 0)
74365 {
74366 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num79 * 16, 615);
74367 }
74368 else if (num81 == 2)
74369 {
74370 int num82 = num2;
74371 if (num79 > 0)
74372 {
74373 num82 = num79;
74374 }
74375 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74376 {
74377 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num82 * 16, 627);
74378 }
74379 else
74380 {
74381 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num82 * 16, 626);
74382 }
74383 }
74384 }
74385 else if (num78 > 0 && !flag15)
74386 {
74387 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num78 * 16, 602);
74388 }
74389 }
74390 else
74391 {
74392 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 602);
74393 }
74394 }
74395 else if ((num49 == 2 || num49 == 477 || num49 == 53) && !tooWindyForButterflies && Main.raining && Main.dayTime && Main.rand.Next(2) == 0 && ((double)num2 <= Main.worldSurface || Main.remixWorld) && FindCattailTop(num, num2, out cattailX, out cattailY))
74396 {
74397 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74398 {
74399 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8, cattailY * 16, 601);
74400 }
74401 else
74402 {
74403 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8, cattailY * 16, RollDragonflyType(num49));
74404 }
74405 if (Main.rand.Next(3) == 0)
74406 {
74407 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8 - 16, cattailY * 16, RollDragonflyType(num49));
74408 }
74409 if (Main.rand.Next(3) == 0)
74410 {
74411 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8 + 16, cattailY * 16, RollDragonflyType(num49));
74412 }
74413 }
74414 else if (flag7)
74415 {
74416 if (flag20 && num2 > 50 && Main.rand.Next(3) != 0 && Main.dayTime)
74417 {
74418 int num83 = -1;
74419 for (int num84 = num2 - 1; num84 > num2 - 50; num84--)
74420 {
74421 if (Main.tile[num, num84].liquid == 0 && !WorldGen.SolidTile(num, num84) && !WorldGen.SolidTile(num, num84 + 1) && !WorldGen.SolidTile(num, num84 + 2))
74422 {
74423 num83 = num84 + 2;
74424 break;
74425 }
74426 }
74427 if (num83 > num2)
74428 {
74429 num83 = num2;
74430 }
74431 if (num83 > 0 && !flag15)
74432 {
74433 switch (num3)
74434 {
74435 case 60:
74436 if (Main.rand.Next(3) != 0 && !flag && Main.cloudAlpha == 0f)
74437 {
74438 int num87 = Main.rand.Next(1, 4);
74439 for (int num88 = 0; num88 < num87; num88++)
74440 {
74441 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74442 {
74443 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num83 * 16 - 16, 613);
74444 }
74445 else
74446 {
74447 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num83 * 16 - 16, 612);
74448 }
74449 }
74450 }
74451 else
74452 {
74453 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num83 * 16, 617);
74454 }
74455 break;
74456 case 53:
74457 if (Main.rand.Next(3) != 0 && !flag && Main.cloudAlpha == 0f)
74458 {
74459 int num85 = Main.rand.Next(1, 4);
74460 for (int num86 = 0; num86 < num85; num86++)
74461 {
74462 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74463 {
74464 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num83 * 16 - 16, 613);
74465 }
74466 else
74467 {
74468 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + Main.rand.Next(-16, 17), num83 * 16 - 16, 612);
74469 }
74470 }
74471 }
74472 else
74473 {
74474 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num83 * 16, 608);
74475 }
74476 break;
74477 default:
74478 if (Main.rand.Next(5) == 0 && (num3 == 2 || num3 == 477))
74479 {
74480 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num83 * 16, 616);
74481 }
74482 else if (Main.rand.Next(2) == 0)
74483 {
74484 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num83 * 16, 362);
74485 }
74486 else
74487 {
74488 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num83 * 16, 364);
74489 }
74490 break;
74491 }
74492 }
74493 else if (num3 == 53 && num > WorldGen.beachDistance && num < Main.maxTilesX - WorldGen.beachDistance)
74494 {
74495 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 607);
74496 }
74497 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74498 {
74499 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 592);
74500 }
74501 else
74502 {
74503 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 55);
74504 }
74505 }
74506 else if (num3 == 53 && num > WorldGen.beachDistance && num < Main.maxTilesX - WorldGen.beachDistance)
74507 {
74508 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 607);
74509 }
74510 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74511 {
74512 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 592);
74513 }
74514 else
74515 {
74516 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 55);
74517 }
74518 }
74519 else if (num49 == 147 || num49 == 161)
74520 {
74521 if (Main.rand.Next(2) == 0)
74522 {
74523 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 148);
74524 }
74525 else
74526 {
74527 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 149);
74528 }
74529 }
74530 else if (num49 == 60)
74531 {
74532 if (Main.dayTime && Main.rand.Next(3) != 0)
74533 {
74534 switch (Main.rand.Next(5))
74535 {
74536 case 0:
74537 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 671);
74538 break;
74539 case 1:
74540 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 672);
74541 break;
74542 case 2:
74543 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 673);
74544 break;
74545 case 3:
74546 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 674);
74547 break;
74548 default:
74549 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 675);
74550 break;
74551 }
74552 }
74553 else
74554 {
74555 SpawnNPC_SpawnFrog(num, num2, k);
74556 }
74557 }
74558 else if (num49 == 53)
74559 {
74560 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(366, 368));
74561 }
74562 else
74563 {
74564 if (num49 != 2 && num49 != 477 && num49 != 109 && num49 != 492 && !((double)num2 > Main.worldSurface))
74565 {
74566 break;
74567 }
74568 bool flag33 = flag20;
74570 {
74571 if (flag21 && Main.rand.Next(5) == 0)
74572 {
74573 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemSquirrelToSpawn());
74574 }
74575 else if (flag21 && Main.rand.Next(5) == 0)
74576 {
74577 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemBunnyToSpawn());
74578 }
74579 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74580 {
74581 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 448);
74582 }
74583 else if (Main.rand.Next(3) != 0)
74584 {
74585 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 357);
74586 }
74587 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74588 {
74589 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 593);
74590 }
74591 else
74592 {
74593 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 230);
74594 }
74595 }
74596 else if (!Main.dayTime && Main.numClouds <= 55 && Main.cloudBGActive == 0f && Star.starfallBoost > 3f && flag33 && Main.player[k].RollLuck(2) == 0)
74597 {
74598 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 484);
74599 }
74600 else if (!tooWindyForButterflies && !Main.dayTime && Main.rand.Next(fireFlyFriendly) == 0 && flag33)
74601 {
74602 int num89 = 355;
74603 if (num49 == 109)
74604 {
74605 num89 = 358;
74606 }
74607 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num89);
74608 if (Main.rand.Next(fireFlyMultiple) == 0)
74609 {
74610 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, num89);
74611 }
74612 if (Main.rand.Next(fireFlyMultiple) == 0)
74613 {
74614 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, num89);
74615 }
74616 if (Main.rand.Next(fireFlyMultiple) == 0)
74617 {
74618 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16 - 16, num89);
74619 }
74620 if (Main.rand.Next(fireFlyMultiple) == 0)
74621 {
74622 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16 + 16, num89);
74623 }
74624 }
74625 else if (Main.cloudAlpha == 0f && !Main.dayTime && Main.rand.Next(5) == 0 && flag33)
74626 {
74627 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 611);
74628 }
74629 else if (Main.dayTime && Main.time < 18000.0 && Main.rand.Next(3) != 0 && flag33)
74630 {
74631 int num90 = Main.rand.Next(4);
74632 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74633 {
74634 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 442);
74635 }
74636 else
74637 {
74638 switch (num90)
74639 {
74640 case 0:
74641 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 297);
74642 break;
74643 case 1:
74644 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 298);
74645 break;
74646 default:
74647 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 74);
74648 break;
74649 }
74650 }
74651 }
74652 else if (!tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(stinkBugChance) == 0 && flag33)
74653 {
74654 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 669);
74655 if (Main.rand.Next(4) == 0)
74656 {
74657 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, 669);
74658 }
74659 if (Main.rand.Next(4) == 0)
74660 {
74661 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, 669);
74662 }
74663 }
74664 else if (!tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(butterflyChance) == 0 && flag33)
74665 {
74666 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74667 {
74668 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 444);
74669 }
74670 else
74671 {
74672 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 356);
74673 }
74674 if (Main.rand.Next(4) == 0)
74675 {
74676 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, 356);
74677 }
74678 if (Main.rand.Next(4) == 0)
74679 {
74680 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, 356);
74681 }
74682 }
74683 else if (tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(butterflyChance / 2) == 0 && flag33)
74684 {
74685 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74686 {
74687 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 605);
74688 }
74689 else
74690 {
74691 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
74692 }
74693 if (Main.rand.Next(3) != 0)
74694 {
74695 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
74696 }
74697 if (Main.rand.Next(2) == 0)
74698 {
74699 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
74700 }
74701 if (Main.rand.Next(3) == 0)
74702 {
74703 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
74704 }
74705 if (Main.rand.Next(4) == 0)
74706 {
74707 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
74708 }
74709 }
74710 else if (Main.rand.Next(2) == 0 && flag33)
74711 {
74712 int num91 = Main.rand.Next(4);
74713 if (Main.player[k].RollLuck(goldCritterChance) == 0)
74714 {
74715 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 442);
74716 }
74717 else
74718 {
74719 switch (num91)
74720 {
74721 case 0:
74722 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 297);
74723 break;
74724 case 1:
74725 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 298);
74726 break;
74727 default:
74728 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 74);
74729 break;
74730 }
74731 }
74732 }
74733 else if (num2 > Main.UnderworldLayer)
74734 {
74735 if (Main.remixWorld && (double)(Main.player[k].Center.X / 16f) > (double)Main.maxTilesX * 0.39 + 50.0 && (double)(Main.player[k].Center.X / 16f) < (double)Main.maxTilesX * 0.61 && Main.rand.Next(2) == 0)
74736 {
74737 if (Main.rand.Next(2) == 0)
74738 {
74739 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemSquirrelToSpawn());
74740 }
74741 else
74742 {
74743 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemBunnyToSpawn());
74744 }
74745 }
74746 else
74747 {
74748 newNPC = SpawnNPC_SpawnLavaBaitCritters(num, num2);
74749 }
74750 }
74751 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
74752 {
74753 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 443);
74754 }
74755 else if (Main.player[k].RollLuck(goldCritterChance) == 0 && flag33)
74756 {
74757 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 539);
74758 }
74759 else if (Main.halloween && Main.rand.Next(3) != 0)
74760 {
74761 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 303);
74762 }
74763 else if (Main.xMas && Main.rand.Next(3) != 0)
74764 {
74765 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 337);
74766 }
74767 else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
74768 {
74769 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 540);
74770 }
74771 else if (Main.rand.Next(3) == 0)
74772 {
74773 if (Main.remixWorld)
74774 {
74775 if ((double)num2 < Main.rockLayer && (double)num2 > Main.worldSurface)
74776 {
74777 if (Main.rand.Next(5) == 0)
74778 {
74779 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemSquirrelToSpawn());
74780 }
74781 }
74782 else if (flag33)
74783 {
74784 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Utils.SelectRandom(Main.rand, new short[2] { 299, 538 }));
74785 }
74786 }
74787 else if ((double)num2 >= Main.rockLayer && num2 <= Main.UnderworldLayer)
74788 {
74789 if (Main.rand.Next(5) == 0)
74790 {
74791 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemSquirrelToSpawn());
74792 }
74793 }
74794 else if (flag33)
74795 {
74796 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Utils.SelectRandom(Main.rand, new short[2] { 299, 538 }));
74797 }
74798 }
74799 else if (Main.remixWorld)
74800 {
74801 if ((double)num2 < Main.rockLayer && (double)num2 > Main.worldSurface)
74802 {
74803 if ((double)num2 >= Main.rockLayer && num2 <= Main.UnderworldLayer)
74804 {
74805 if (Main.rand.Next(5) == 0)
74806 {
74807 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemBunnyToSpawn());
74808 }
74809 }
74810 else
74811 {
74812 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 46);
74813 }
74814 }
74815 }
74816 else if ((double)num2 >= Main.rockLayer && num2 <= Main.UnderworldLayer)
74817 {
74818 if (Main.rand.Next(5) == 0)
74819 {
74820 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, SpawnNPC_GetGemBunnyToSpawn());
74821 }
74822 }
74823 else
74824 {
74825 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 46);
74826 }
74827 }
74828 }
74829 else if (Main.player[k].ZoneDungeon)
74830 {
74831 int num92 = 0;
74832 ushort wall = Main.tile[num, num2].wall;
74833 ushort wall2 = Main.tile[num, num2 - 1].wall;
74834 if (wall == 94 || wall == 96 || wall == 98 || wall2 == 94 || wall2 == 96 || wall2 == 98)
74835 {
74836 num92 = 1;
74837 }
74838 if (wall == 95 || wall == 97 || wall == 99 || wall2 == 95 || wall2 == 97 || wall2 == 99)
74839 {
74840 num92 = 2;
74841 }
74842 if (Main.player[k].RollLuck(7) == 0)
74843 {
74844 num92 = Main.rand.Next(3);
74845 }
74846 bool flag34 = !downedBoss3;
74847 if (Main.drunkWorld && Main.player[k].position.Y / 16f < (float)(Main.dungeonY + 40))
74848 {
74849 flag34 = false;
74850 }
74851 if (flag34)
74852 {
74853 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 68);
74854 }
74855 else if (downedBoss3 && !savedMech && Main.rand.Next(5) == 0 && !flag7 && !AnyNPCs(123) && (double)num2 > (Main.worldSurface * 4.0 + Main.rockLayer) / 5.0)
74856 {
74857 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 123);
74858 }
74859 else if (flag14 && Main.rand.Next(30) == 0)
74860 {
74861 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 287);
74862 }
74863 else if (flag14 && num92 == 0 && Main.rand.Next(15) == 0)
74864 {
74865 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 293);
74866 }
74867 else if (flag14 && num92 == 1 && Main.rand.Next(15) == 0)
74868 {
74869 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 291);
74870 }
74871 else if (flag14 && num92 == 2 && Main.rand.Next(15) == 0)
74872 {
74873 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 292);
74874 }
74875 else if (flag14 && !AnyNPCs(290) && num92 == 0 && Main.rand.Next(35) == 0)
74876 {
74877 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 290);
74878 }
74879 else if (flag14 && (num92 == 1 || num92 == 2) && Main.rand.Next(30) == 0)
74880 {
74881 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 289);
74882 }
74883 else if (flag14 && Main.rand.Next(20) == 0)
74884 {
74885 int num93 = 281;
74886 if (num92 == 0)
74887 {
74888 num93 += 2;
74889 }
74890 if (num92 == 2)
74891 {
74892 num93 += 4;
74893 }
74894 num93 += Main.rand.Next(2);
74895 if (!AnyNPCs(num93))
74896 {
74897 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num93);
74898 }
74899 }
74900 else if (flag14 && Main.rand.Next(3) != 0)
74901 {
74902 int num94 = 269;
74903 if (num92 == 0)
74904 {
74905 num94 += 4;
74906 }
74907 if (num92 == 2)
74908 {
74909 num94 += 8;
74910 }
74911 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num94 + Main.rand.Next(4));
74912 }
74913 else if (Main.player[k].RollLuck(35) == 0)
74914 {
74915 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 71);
74916 }
74917 else if (num92 == 1 && Main.rand.Next(3) == 0 && !NearSpikeBall(num, num2))
74918 {
74919 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 70);
74920 }
74921 else if (num92 == 2 && Main.rand.Next(5) == 0)
74922 {
74923 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 72);
74924 }
74925 else if (num92 == 0 && Main.rand.Next(7) == 0)
74926 {
74927 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 34);
74928 }
74929 else if (Main.rand.Next(7) == 0)
74930 {
74931 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 32);
74932 }
74933 else
74934 {
74935 switch (Main.rand.Next(5))
74936 {
74937 case 0:
74938 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 294);
74939 break;
74940 case 1:
74941 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 295);
74942 break;
74943 case 2:
74944 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 296);
74945 break;
74946 default:
74947 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 31);
74948 if (Main.rand.Next(4) == 0)
74949 {
74950 Main.npc[newNPC].SetDefaults(-14);
74951 }
74952 else if (Main.rand.Next(5) == 0)
74953 {
74954 Main.npc[newNPC].SetDefaults(-13);
74955 }
74956 break;
74957 }
74958 }
74959 }
74960 else if (Main.player[k].ZoneMeteor)
74961 {
74962 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 23);
74963 }
74964 else if (DD2Event.Ongoing && Main.player[k].ZoneOldOneArmy)
74965 {
74967 }
74968 else if ((Main.remixWorld || (double)num2 <= Main.worldSurface) && !Main.dayTime && Main.snowMoon)
74969 {
74970 int num95 = waveNumber;
74971 if (Main.rand.Next(30) == 0 && CountNPCS(341) < 4)
74972 {
74973 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 341);
74974 }
74975 else if (num95 >= 20)
74976 {
74977 int num96 = Main.rand.Next(3);
74978 if (!(num5 >= (float)num4 * num6))
74979 {
74980 newNPC = num96 switch
74981 {
74982 0 => NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345),
74983 1 => NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346),
74984 _ => NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344),
74985 };
74986 }
74987 }
74988 else if (num95 >= 19)
74989 {
74990 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(345) < 4) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && CountNPCS(346) < 5) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) != 0 || CountNPCS(344) >= 7) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344))));
74991 }
74992 else if (num95 >= 18)
74993 {
74994 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(345) < 3) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && CountNPCS(346) < 4) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && CountNPCS(344) < 6) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348) : ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 351))))));
74995 }
74996 else if (num95 >= 17)
74997 {
74998 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(345) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && CountNPCS(346) < 3) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && CountNPCS(344) < 5) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(4) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 351))))));
74999 }
75000 else if (num95 >= 16)
75001 {
75002 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(345) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && CountNPCS(346) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && CountNPCS(344) < 4) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 352)))));
75003 }
75004 else if (num95 >= 15)
75005 {
75006 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(345)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && CountNPCS(346) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && CountNPCS(344) < 3) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347)))));
75007 }
75008 else
75009 {
75010 switch (num95)
75011 {
75012 case 14:
75013 if (Main.rand.Next(10) == 0 && !AnyNPCs(345))
75014 {
75015 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345);
75016 }
75017 else if (Main.rand.Next(10) == 0 && !AnyNPCs(346))
75018 {
75019 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346);
75020 }
75021 else if (Main.rand.Next(10) == 0 && !AnyNPCs(344))
75022 {
75023 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344);
75024 }
75025 else if (Main.rand.Next(3) == 0)
75026 {
75027 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343);
75028 }
75029 break;
75030 case 13:
75031 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(345)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && !AnyNPCs(346)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(3) != 0) ? ((Main.rand.Next(6) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 352))));
75032 break;
75033 case 12:
75034 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(345)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(10) == 0 && !AnyNPCs(344)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(8) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 343))));
75035 break;
75036 case 11:
75037 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(345)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 345) : ((Main.rand.Next(6) != 0) ? ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 352)));
75038 break;
75039 case 10:
75040 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(346)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && CountNPCS(344) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(6) != 0) ? ((Main.rand.Next(3) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 351))));
75041 break;
75042 case 9:
75043 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(346)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(10) == 0 && !AnyNPCs(344)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(2) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348))));
75044 break;
75045 case 8:
75046 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(346)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(8) != 0) ? ((Main.rand.Next(3) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 351)));
75047 break;
75048 case 7:
75049 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(346)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 346) : ((Main.rand.Next(3) != 0) ? ((Main.rand.Next(4) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)));
75050 break;
75051 case 6:
75052 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(344) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(4) != 0) ? ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 347)));
75053 break;
75054 case 5:
75055 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(344)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(4) != 0) ? ((Main.rand.Next(8) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350)));
75056 break;
75057 case 4:
75058 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(344)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 344) : ((Main.rand.Next(4) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350)));
75059 break;
75060 case 3:
75061 newNPC = ((Main.rand.Next(8) != 0) ? ((Main.rand.Next(4) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 348));
75062 break;
75063 case 2:
75064 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 350));
75065 break;
75066 default:
75067 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(338, 341)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 342));
75068 break;
75069 }
75070 }
75071 }
75072 else if ((Main.remixWorld || (double)num2 <= Main.worldSurface) && !Main.dayTime && Main.pumpkinMoon)
75073 {
75074 int num97 = waveNumber;
75075 if (waveNumber >= 20)
75076 {
75077 if (!(num5 >= (float)num4 * num6))
75078 {
75079 if (Main.rand.Next(2) == 0 && CountNPCS(327) < 2)
75080 {
75081 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75082 }
75083 else if (Main.rand.Next(3) != 0 && CountNPCS(325) < 2)
75084 {
75085 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325);
75086 }
75087 else if (CountNPCS(315) < 3)
75088 {
75089 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315);
75090 }
75091 }
75092 }
75093 else
75094 {
75095 switch (num97)
75096 {
75097 case 19:
75098 if (Main.rand.Next(5) == 0 && CountNPCS(327) < 2)
75099 {
75100 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75101 }
75102 else if (Main.rand.Next(5) == 0 && CountNPCS(325) < 2)
75103 {
75104 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325);
75105 }
75106 else if (!(num5 >= (float)num4 * num6) && CountNPCS(315) < 5)
75107 {
75108 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315);
75109 }
75110 break;
75111 case 18:
75112 if (Main.rand.Next(7) == 0 && CountNPCS(327) < 2)
75113 {
75114 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75115 }
75116 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(7) != 0 || CountNPCS(315) >= 3) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315)));
75117 break;
75118 case 17:
75119 if (Main.rand.Next(7) == 0 && CountNPCS(327) < 2)
75120 {
75121 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75122 }
75123 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(7) == 0 && CountNPCS(315) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315) : ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330))));
75124 break;
75125 case 16:
75126 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(327) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327) : ((Main.rand.Next(10) == 0 && CountNPCS(315) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315) : ((Main.rand.Next(6) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330))));
75127 break;
75128 case 15:
75129 if (Main.rand.Next(10) == 0 && !AnyNPCs(327))
75130 {
75131 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75132 }
75133 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(5) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330)));
75134 break;
75135 case 14:
75136 if (Main.rand.Next(10) == 0 && !AnyNPCs(327))
75137 {
75138 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327);
75139 }
75140 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(10) == 0 && !AnyNPCs(315)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315) : ((Main.rand.Next(10) != 0) ? ((Main.rand.Next(7) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330))));
75141 break;
75142 case 13:
75143 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(10) == 0 && CountNPCS(315) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315) : ((Main.rand.Next(6) != 0) ? ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330))));
75144 break;
75145 case 12:
75146 newNPC = ((Main.rand.Next(5) != 0 || AnyNPCs(327)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327));
75147 break;
75148 case 11:
75149 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330)));
75150 break;
75151 case 10:
75152 newNPC = ((Main.rand.Next(10) == 0 && !AnyNPCs(327)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 327) : ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329)));
75153 break;
75154 case 9:
75155 newNPC = ((Main.rand.Next(10) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(8) != 0) ? ((Main.rand.Next(5) != 0) ? ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330)));
75156 break;
75157 case 8:
75158 newNPC = ((Main.rand.Next(8) == 0 && CountNPCS(315) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315) : ((Main.rand.Next(4) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330)));
75159 break;
75160 case 7:
75161 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(4) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330)));
75162 break;
75163 case 6:
75164 newNPC = ((Main.rand.Next(7) == 0 && CountNPCS(325) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 325) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326)));
75165 break;
75166 case 5:
75167 newNPC = ((Main.rand.Next(10) != 0 || AnyNPCs(315)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 315));
75168 break;
75169 case 4:
75170 newNPC = ((Main.rand.Next(8) == 0 && !AnyNPCs(325)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 330) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326)));
75171 break;
75172 case 3:
75173 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 329));
75174 break;
75175 case 2:
75176 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315)) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 326));
75177 break;
75178 default:
75179 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(305, 315));
75180 break;
75181 }
75182 }
75183 }
75184 else if (((double)num2 <= Main.worldSurface || (Main.remixWorld && (double)num2 > Main.rockLayer)) && Main.dayTime && Main.eclipse)
75185 {
75186 bool flag35 = false;
75187 if (downedMechBoss1 && downedMechBoss2 && downedMechBoss3)
75188 {
75189 flag35 = true;
75190 }
75191 newNPC = ((downedPlantBoss && Main.rand.Next(80) == 0 && !AnyNPCs(477)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 477) : ((Main.rand.Next(50) == 0 && !AnyNPCs(251)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 251) : ((downedPlantBoss && Main.rand.Next(5) == 0 && !AnyNPCs(466)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 466) : ((downedPlantBoss && Main.rand.Next(20) == 0 && !AnyNPCs(463)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 463) : ((downedPlantBoss && Main.rand.Next(20) == 0 && CountNPCS(467) < 2) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 467) : ((Main.rand.Next(15) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 159) : ((flag35 && Main.rand.Next(13) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 253) : ((Main.rand.Next(8) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 469) : ((downedPlantBoss && Main.rand.Next(7) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 468) : ((downedPlantBoss && Main.rand.Next(5) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 460) : ((Main.rand.Next(4) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 162) : ((Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 461) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 166) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 462))))))))))))));
75192 }
75193 else if (SpawnNPC_CheckToSpawnUndergroundFairy(num, num2, k))
75194 {
75195 int num98 = Main.rand.Next(583, 586);
75196 if (Main.tenthAnniversaryWorld && !Main.getGoodWorld && Main.rand.Next(4) != 0)
75197 {
75198 num98 = 583;
75199 }
75200 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num98);
75201 Main.npc[newNPC].ai[2] = 2f;
75202 Main.npc[newNPC].TargetClosest();
75203 Main.npc[newNPC].ai[3] = 0f;
75204 }
75205 else if (!Main.remixWorld && !flag7 && (!Main.dayTime || Main.tile[num, num2].wall > 0) && Main.tile[num8, num9].wall == 244 && !Main.eclipse && !Main.bloodMoon && Main.player[k].RollLuck(30) == 0 && CountNPCS(624) <= Main.rand.Next(3))
75206 {
75207 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 624);
75208 }
75209 else if (!Main.player[k].ZoneCorrupt && !Main.player[k].ZoneCrimson && !flag7 && !Main.eclipse && !Main.bloodMoon && Main.player[k].RollLuck(range) == 0 && ((!Main.remixWorld && (double)num2 >= Main.worldSurface * 0.800000011920929 && (double)num2 < Main.worldSurface * 1.100000023841858) || (Main.remixWorld && (double)num2 > Main.rockLayer && num2 < Main.maxTilesY - 350)) && CountNPCS(624) <= Main.rand.Next(3) && (!Main.dayTime || Main.tile[num, num2].wall > 0) && (Main.tile[num, num2].wall == 63 || Main.tile[num, num2].wall == 2 || Main.tile[num, num2].wall == 196 || Main.tile[num, num2].wall == 197 || Main.tile[num, num2].wall == 198 || Main.tile[num, num2].wall == 199))
75210 {
75211 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 624);
75212 }
75213 else if (Main.hardMode && num3 == 70 && flag7)
75214 {
75215 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 256);
75216 }
75217 else if (num3 == 70 && (double)num2 <= Main.worldSurface && Main.rand.Next(3) != 0)
75218 {
75219 if ((!Main.hardMode && Main.rand.Next(6) == 0) || Main.rand.Next(12) == 0)
75220 {
75221 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 360);
75222 }
75223 else if (Main.rand.Next(3) != 0)
75224 {
75225 newNPC = ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 255) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 254));
75226 }
75227 else if (Main.rand.Next(4) != 0)
75228 {
75229 newNPC = ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 258) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 257));
75230 }
75231 else if (Main.hardMode && Main.rand.Next(3) != 0)
75232 {
75233 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 260);
75234 Main.npc[newNPC].ai[0] = num;
75235 Main.npc[newNPC].ai[1] = num2;
75236 Main.npc[newNPC].netUpdate = true;
75237 }
75238 else
75239 {
75240 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 259);
75241 Main.npc[newNPC].ai[0] = num;
75242 Main.npc[newNPC].ai[1] = num2;
75243 Main.npc[newNPC].netUpdate = true;
75244 }
75245 }
75246 else if (num3 == 70 && Main.hardMode && (double)num2 >= Main.worldSurface && Main.rand.Next(3) != 0 && (!Main.remixWorld || Main.getGoodWorld || num2 < Main.maxTilesY - 360))
75247 {
75248 if (Main.hardMode && Main.player[k].RollLuck(5) == 0)
75249 {
75250 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 374);
75251 }
75252 else if ((!Main.hardMode && Main.rand.Next(4) == 0) || Main.rand.Next(8) == 0)
75253 {
75254 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 360);
75255 }
75256 else if (Main.rand.Next(4) != 0)
75257 {
75258 newNPC = ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 258) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 257));
75259 }
75260 else if (Main.hardMode && Main.rand.Next(3) != 0)
75261 {
75262 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 260);
75263 Main.npc[newNPC].ai[0] = num;
75264 Main.npc[newNPC].ai[1] = num2;
75265 Main.npc[newNPC].netUpdate = true;
75266 }
75267 else
75268 {
75269 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 259);
75270 Main.npc[newNPC].ai[0] = num;
75271 Main.npc[newNPC].ai[1] = num2;
75272 Main.npc[newNPC].netUpdate = true;
75273 }
75274 }
75275 else if (Main.player[k].ZoneCorrupt && Main.rand.Next(maxValue) == 0 && !flag5)
75276 {
75277 newNPC = ((!Main.hardMode || Main.rand.Next(4) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 7, 1) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 98, 1));
75278 }
75279 else if (Main.remixWorld && !Main.hardMode && (double)num2 > Main.worldSurface && Main.player[k].RollLuck(100) == 0)
75280 {
75281 newNPC = ((!Main.player[k].ZoneSnow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 85) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 629));
75282 }
75283 else if (Main.hardMode && (double)num2 > Main.worldSurface && Main.player[k].RollLuck(Main.tenthAnniversaryWorld ? 25 : 75) == 0)
75284 {
75285 newNPC = ((Main.rand.Next(2) == 0 && Main.player[k].ZoneCorrupt && !AnyNPCs(473)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 473) : ((Main.rand.Next(2) == 0 && Main.player[k].ZoneCrimson && !AnyNPCs(474)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 474) : ((Main.rand.Next(2) == 0 && Main.player[k].ZoneHallow && !AnyNPCs(475)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 475) : ((Main.tenthAnniversaryWorld && Main.rand.Next(2) == 0 && Main.player[k].ZoneJungle && !AnyNPCs(476)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 476) : ((!Main.player[k].ZoneSnow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 85) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 629))))));
75286 }
75287 else if (Main.hardMode && Main.tile[num, num2].wall == 2 && Main.rand.Next(20) == 0)
75288 {
75289 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 85);
75290 }
75291 else if (Main.hardMode && (double)num2 <= Main.worldSurface && !Main.dayTime && (Main.rand.Next(20) == 0 || (Main.rand.Next(5) == 0 && Main.moonPhase == 4)))
75292 {
75293 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 82);
75294 }
75295 else if (Main.hardMode && Main.halloween && (double)num2 <= Main.worldSurface && !Main.dayTime && Main.rand.Next(10) == 0)
75296 {
75297 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 304);
75298 }
75299 else if (num49 == 60 && Main.player[k].RollLuck(500) == 0 && !Main.dayTime)
75300 {
75301 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 52);
75302 }
75303 else if (num49 == 60 && (double)num2 > Main.worldSurface && Main.rand.Next(60) == 0)
75304 {
75305 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 219);
75306 }
75307 else if ((double)num2 > Main.worldSurface && num2 < Main.maxTilesY - 210 && !Main.player[k].ZoneSnow && !Main.player[k].ZoneCrimson && !Main.player[k].ZoneCorrupt && !Main.player[k].ZoneJungle && !Main.player[k].ZoneHallow && Main.rand.Next(8) == 0)
75308 {
75309 if (Main.player[k].RollLuck(goldCritterChance) == 0)
75310 {
75311 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 448);
75312 }
75313 else
75314 {
75315 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 357);
75316 }
75317 }
75318 else if ((double)num2 > Main.worldSurface && num2 < Main.maxTilesY - 210 && !Main.player[k].ZoneSnow && !Main.player[k].ZoneCrimson && !Main.player[k].ZoneCorrupt && !Main.player[k].ZoneJungle && !Main.player[k].ZoneHallow && Main.rand.Next(13) == 0)
75319 {
75320 if (Main.player[k].RollLuck(goldCritterChance) == 0)
75321 {
75322 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 447);
75323 }
75324 else
75325 {
75326 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 300);
75327 }
75328 }
75329 else if ((double)num2 > Main.worldSurface && (double)num2 < (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && !Main.player[k].ZoneSnow && !Main.player[k].ZoneCrimson && !Main.player[k].ZoneCorrupt && !Main.player[k].ZoneHallow && Main.rand.Next(13) == 0)
75330 {
75331 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 359);
75332 }
75333 else if (flag20 && Main.player[k].ZoneJungle && !Main.player[k].ZoneCrimson && !Main.player[k].ZoneCorrupt && Main.rand.Next(7) == 0)
75334 {
75335 if (Main.dayTime && Main.time < 43200.00064373016 && Main.rand.Next(3) != 0)
75336 {
75337 switch (Main.rand.Next(5))
75338 {
75339 case 0:
75340 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 671);
75341 break;
75342 case 1:
75343 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 672);
75344 break;
75345 case 2:
75346 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 673);
75347 break;
75348 case 3:
75349 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 674);
75350 break;
75351 default:
75352 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 675);
75353 break;
75354 }
75355 }
75356 else
75357 {
75358 SpawnNPC_SpawnFrog(num, num2, k);
75359 }
75360 }
75361 else if (num49 == 225 && Main.rand.Next(2) == 0)
75362 {
75363 if (Main.hardMode && Main.rand.Next(4) != 0)
75364 {
75365 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 176);
75366 if (Main.rand.Next(10) == 0)
75367 {
75368 Main.npc[newNPC].SetDefaults(-18);
75369 }
75370 if (Main.rand.Next(10) == 0)
75371 {
75372 Main.npc[newNPC].SetDefaults(-19);
75373 }
75374 if (Main.rand.Next(10) == 0)
75375 {
75376 Main.npc[newNPC].SetDefaults(-20);
75377 }
75378 if (Main.rand.Next(10) == 0)
75379 {
75380 Main.npc[newNPC].SetDefaults(-21);
75381 }
75382 }
75383 else
75384 {
75385 switch (Main.rand.Next(8))
75386 {
75387 case 0:
75388 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 231);
75389 if (Main.rand.Next(4) == 0)
75390 {
75391 Main.npc[newNPC].SetDefaults(-56);
75392 }
75393 else if (Main.rand.Next(4) == 0)
75394 {
75395 Main.npc[newNPC].SetDefaults(-57);
75396 }
75397 break;
75398 case 1:
75399 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 232);
75400 if (Main.rand.Next(4) == 0)
75401 {
75402 Main.npc[newNPC].SetDefaults(-58);
75403 }
75404 else if (Main.rand.Next(4) == 0)
75405 {
75406 Main.npc[newNPC].SetDefaults(-59);
75407 }
75408 break;
75409 case 2:
75410 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 233);
75411 if (Main.rand.Next(4) == 0)
75412 {
75413 Main.npc[newNPC].SetDefaults(-60);
75414 }
75415 else if (Main.rand.Next(4) == 0)
75416 {
75417 Main.npc[newNPC].SetDefaults(-61);
75418 }
75419 break;
75420 case 3:
75421 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 234);
75422 if (Main.rand.Next(4) == 0)
75423 {
75424 Main.npc[newNPC].SetDefaults(-62);
75425 }
75426 else if (Main.rand.Next(4) == 0)
75427 {
75428 Main.npc[newNPC].SetDefaults(-63);
75429 }
75430 break;
75431 case 4:
75432 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 235);
75433 if (Main.rand.Next(4) == 0)
75434 {
75435 Main.npc[newNPC].SetDefaults(-64);
75436 }
75437 else if (Main.rand.Next(4) == 0)
75438 {
75439 Main.npc[newNPC].SetDefaults(-65);
75440 }
75441 break;
75442 default:
75443 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 42);
75444 if (Main.rand.Next(4) == 0)
75445 {
75446 Main.npc[newNPC].SetDefaults(-16);
75447 }
75448 else if (Main.rand.Next(4) == 0)
75449 {
75450 Main.npc[newNPC].SetDefaults(-17);
75451 }
75452 break;
75453 }
75454 }
75455 }
75456 else if (num49 == 60 && Main.hardMode && Main.rand.Next(3) != 0)
75457 {
75458 if (flag20 && !Main.dayTime && Main.rand.Next(3) == 0)
75459 {
75460 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 152);
75461 }
75462 else if (flag20 && Main.dayTime && Main.rand.Next(4) != 0)
75463 {
75464 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 177);
75465 }
75466 else if ((double)num2 > Main.worldSurface && Main.rand.Next(100) == 0)
75467 {
75468 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 205);
75469 }
75470 else if ((double)num2 > Main.worldSurface && Main.rand.Next(5) == 0)
75471 {
75472 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 236);
75473 }
75474 else if ((double)num2 > Main.worldSurface && Main.rand.Next(4) != 0)
75475 {
75476 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 176);
75477 if (Main.rand.Next(10) == 0)
75478 {
75479 Main.npc[newNPC].SetDefaults(-18);
75480 }
75481 if (Main.rand.Next(10) == 0)
75482 {
75483 Main.npc[newNPC].SetDefaults(-19);
75484 }
75485 if (Main.rand.Next(10) == 0)
75486 {
75487 Main.npc[newNPC].SetDefaults(-20);
75488 }
75489 if (Main.rand.Next(10) == 0)
75490 {
75491 Main.npc[newNPC].SetDefaults(-21);
75492 }
75493 }
75494 else if (Main.rand.Next(3) == 0)
75495 {
75496 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 175);
75497 Main.npc[newNPC].ai[0] = num;
75498 Main.npc[newNPC].ai[1] = num2;
75499 Main.npc[newNPC].netUpdate = true;
75500 }
75501 else
75502 {
75503 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 153);
75504 }
75505 }
75506 else if (((num49 == 226 || num49 == 232) && flag4) || (Main.remixWorld && flag4))
75507 {
75508 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 198) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 226));
75509 }
75510 else if (num50 == 86 && Main.rand.Next(8) != 0)
75511 {
75512 switch (Main.rand.Next(8))
75513 {
75514 case 0:
75515 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 231);
75516 if (Main.rand.Next(4) == 0)
75517 {
75518 Main.npc[newNPC].SetDefaults(-56);
75519 }
75520 else if (Main.rand.Next(4) == 0)
75521 {
75522 Main.npc[newNPC].SetDefaults(-57);
75523 }
75524 break;
75525 case 1:
75526 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 232);
75527 if (Main.rand.Next(4) == 0)
75528 {
75529 Main.npc[newNPC].SetDefaults(-58);
75530 }
75531 else if (Main.rand.Next(4) == 0)
75532 {
75533 Main.npc[newNPC].SetDefaults(-59);
75534 }
75535 break;
75536 case 2:
75537 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 233);
75538 if (Main.rand.Next(4) == 0)
75539 {
75540 Main.npc[newNPC].SetDefaults(-60);
75541 }
75542 else if (Main.rand.Next(4) == 0)
75543 {
75544 Main.npc[newNPC].SetDefaults(-61);
75545 }
75546 break;
75547 case 3:
75548 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 234);
75549 if (Main.rand.Next(4) == 0)
75550 {
75551 Main.npc[newNPC].SetDefaults(-62);
75552 }
75553 else if (Main.rand.Next(4) == 0)
75554 {
75555 Main.npc[newNPC].SetDefaults(-63);
75556 }
75557 break;
75558 case 4:
75559 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 235);
75560 if (Main.rand.Next(4) == 0)
75561 {
75562 Main.npc[newNPC].SetDefaults(-64);
75563 }
75564 else if (Main.rand.Next(4) == 0)
75565 {
75566 Main.npc[newNPC].SetDefaults(-65);
75567 }
75568 break;
75569 default:
75570 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 42);
75571 if (Main.rand.Next(4) == 0)
75572 {
75573 Main.npc[newNPC].SetDefaults(-16);
75574 }
75575 else if (Main.rand.Next(4) == 0)
75576 {
75577 Main.npc[newNPC].SetDefaults(-17);
75578 }
75579 break;
75580 }
75581 }
75582 else if (num49 == 60 && ((!Main.remixWorld && (double)num2 > (Main.worldSurface + Main.rockLayer) / 2.0) || (Main.remixWorld && ((double)num2 < Main.rockLayer || Main.rand.Next(2) == 0))))
75583 {
75584 if (Main.rand.Next(4) == 0)
75585 {
75586 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 204);
75587 }
75588 else if (Main.rand.Next(4) == 0)
75589 {
75590 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 43);
75591 Main.npc[newNPC].ai[0] = num;
75592 Main.npc[newNPC].ai[1] = num2;
75593 Main.npc[newNPC].netUpdate = true;
75594 }
75595 else
75596 {
75597 switch (Main.rand.Next(8))
75598 {
75599 case 0:
75600 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 231);
75601 if (Main.rand.Next(4) == 0)
75602 {
75603 Main.npc[newNPC].SetDefaults(-56);
75604 }
75605 else if (Main.rand.Next(4) == 0)
75606 {
75607 Main.npc[newNPC].SetDefaults(-57);
75608 }
75609 break;
75610 case 1:
75611 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 232);
75612 if (Main.rand.Next(4) == 0)
75613 {
75614 Main.npc[newNPC].SetDefaults(-58);
75615 }
75616 else if (Main.rand.Next(4) == 0)
75617 {
75618 Main.npc[newNPC].SetDefaults(-59);
75619 }
75620 break;
75621 case 2:
75622 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 233);
75623 if (Main.rand.Next(4) == 0)
75624 {
75625 Main.npc[newNPC].SetDefaults(-60);
75626 }
75627 else if (Main.rand.Next(4) == 0)
75628 {
75629 Main.npc[newNPC].SetDefaults(-61);
75630 }
75631 break;
75632 case 3:
75633 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 234);
75634 if (Main.rand.Next(4) == 0)
75635 {
75636 Main.npc[newNPC].SetDefaults(-62);
75637 }
75638 else if (Main.rand.Next(4) == 0)
75639 {
75640 Main.npc[newNPC].SetDefaults(-63);
75641 }
75642 break;
75643 case 4:
75644 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 235);
75645 if (Main.rand.Next(4) == 0)
75646 {
75647 Main.npc[newNPC].SetDefaults(-64);
75648 }
75649 else if (Main.rand.Next(4) == 0)
75650 {
75651 Main.npc[newNPC].SetDefaults(-65);
75652 }
75653 break;
75654 default:
75655 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 42);
75656 if (Main.rand.Next(4) == 0)
75657 {
75658 Main.npc[newNPC].SetDefaults(-16);
75659 }
75660 else if (Main.rand.Next(4) == 0)
75661 {
75662 Main.npc[newNPC].SetDefaults(-17);
75663 }
75664 break;
75665 }
75666 }
75667 }
75668 else if (num49 == 60 && Main.rand.Next(4) == 0)
75669 {
75670 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 51);
75671 }
75672 else if (num49 == 60 && Main.rand.Next(8) == 0)
75673 {
75674 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 56);
75675 Main.npc[newNPC].ai[0] = num;
75676 Main.npc[newNPC].ai[1] = num2;
75677 Main.npc[newNPC].netUpdate = true;
75678 }
75679 else if (Sandstorm.Happening && Main.player[k].ZoneSandstorm && TileID.Sets.Conversion.Sand[num49] && Spawning_SandstoneCheck(num, num2))
75680 {
75681 if (!downedBoss1 && !Main.hardMode)
75682 {
75683 newNPC = ((Main.rand.Next(2) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 546) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 69) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 61)));
75684 }
75685 else if (Main.hardMode && Main.rand.Next(20) == 0 && !AnyNPCs(541))
75686 {
75687 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 541);
75688 }
75689 else if (Main.hardMode && !flag5 && Main.rand.Next(3) == 0 && CountNPCS(510) < 4)
75690 {
75691 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, (num2 + 10) * 16, 510);
75692 }
75693 else if (!Main.hardMode || flag5 || Main.rand.Next(2) != 0)
75694 {
75695 newNPC = ((Main.hardMode && num49 == 53 && Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 78) : ((Main.hardMode && num49 == 112 && Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 79) : ((Main.hardMode && num49 == 234 && Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 630) : ((Main.hardMode && num49 == 116 && Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 80) : ((Main.rand.Next(2) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 546) : ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 581) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 580)))))));
75696 }
75697 else
75698 {
75699 int num99 = 542;
75700 if (TileID.Sets.Corrupt[num49])
75701 {
75702 num99 = 543;
75703 }
75704 if (TileID.Sets.Crimson[num49])
75705 {
75706 num99 = 544;
75707 }
75708 if (TileID.Sets.Hallow[num49])
75709 {
75710 num99 = 545;
75711 }
75712 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num99);
75713 }
75714 }
75715 else if (Main.hardMode && num49 == 53 && Main.rand.Next(3) == 0)
75716 {
75717 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 78);
75718 }
75719 else if (Main.hardMode && num49 == 112 && Main.rand.Next(2) == 0)
75720 {
75721 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 79);
75722 }
75723 else if (Main.hardMode && num49 == 234 && Main.rand.Next(2) == 0)
75724 {
75725 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 630);
75726 }
75727 else if (Main.hardMode && num49 == 116 && Main.rand.Next(2) == 0)
75728 {
75729 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 80);
75730 }
75731 else if (Main.hardMode && !flag7 && flag17 && (num49 == 116 || num49 == 117 || num49 == 109 || num49 == 164))
75732 {
75733 if (downedPlantBoss && (Main.remixWorld || (!Main.dayTime && Main.time < 16200.0)) && flag20 && Main.player[k].RollLuck(10) == 0 && !AnyNPCs(661))
75734 {
75735 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 661);
75736 }
75737 else if (!flag24 || AnyNPCs(244) || Main.rand.Next(12) != 0)
75738 {
75739 newNPC = ((!Main.dayTime && Main.rand.Next(2) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 122) : ((Main.rand.Next(10) != 0 && (!Main.player[k].ZoneWaterCandle || Main.rand.Next(10) != 0)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 75) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 86)));
75740 }
75741 else
75742 {
75743 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 244);
75744 }
75745 }
75746 else if (!flag5 && Main.hardMode && Main.rand.Next(50) == 0 && !flag7 && flag21 && (num49 == 116 || num49 == 117 || num49 == 109 || num49 == 164))
75747 {
75748 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 84);
75749 }
75750 else if ((num49 == 204 && Main.player[k].ZoneCrimson) || num49 == 199 || num49 == 200 || num49 == 203 || num49 == 234 || num49 == 662)
75751 {
75752 bool flag36 = (double)num2 >= Main.rockLayer;
75753 if (Main.remixWorld)
75754 {
75755 flag36 = (double)num2 <= Main.rockLayer;
75756 }
75757 if (Main.hardMode && flag36 && Main.rand.Next(40) == 0 && !flag5)
75758 {
75759 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 179);
75760 }
75761 else if (Main.hardMode && flag36 && Main.rand.Next(5) == 0 && !flag5)
75762 {
75763 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 182);
75764 }
75765 else if (Main.hardMode && flag36 && Main.rand.Next(2) == 0)
75766 {
75767 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 268);
75768 }
75769 else if (Main.hardMode && Main.rand.Next(3) == 0)
75770 {
75771 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 183);
75772 if (Main.rand.Next(3) == 0)
75773 {
75774 Main.npc[newNPC].SetDefaults(-24);
75775 }
75776 else if (Main.rand.Next(3) == 0)
75777 {
75778 Main.npc[newNPC].SetDefaults(-25);
75779 }
75780 }
75781 else if (Main.hardMode && (Main.rand.Next(2) == 0 || ((double)num2 > Main.worldSurface && !Main.remixWorld)))
75782 {
75783 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 174);
75784 }
75785 else if ((Main.tile[num, num2].wall > 0 && Main.rand.Next(4) != 0) || Main.rand.Next(8) == 0)
75786 {
75787 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 239);
75788 }
75789 else if (Main.rand.Next(2) == 0)
75790 {
75791 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 181);
75792 }
75793 else
75794 {
75795 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 173);
75796 if (Main.rand.Next(3) == 0)
75797 {
75798 Main.npc[newNPC].SetDefaults(-22);
75799 }
75800 else if (Main.rand.Next(3) == 0)
75801 {
75802 Main.npc[newNPC].SetDefaults(-23);
75803 }
75804 }
75805 }
75806 else if ((num49 == 22 && Main.player[k].ZoneCorrupt) || num49 == 23 || num49 == 25 || num49 == 112 || num49 == 163 || num49 == 661)
75807 {
75808 bool flag37 = (double)num2 >= Main.rockLayer;
75809 if (Main.remixWorld)
75810 {
75811 flag37 = (double)num2 <= Main.rockLayer;
75812 }
75813 if (Main.hardMode && flag37 && Main.rand.Next(40) == 0 && !flag5)
75814 {
75815 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 83);
75816 }
75817 else if (Main.hardMode && flag37 && Main.rand.Next(3) == 0)
75818 {
75819 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 101);
75820 Main.npc[newNPC].ai[0] = num;
75821 Main.npc[newNPC].ai[1] = num2;
75822 Main.npc[newNPC].netUpdate = true;
75823 }
75824 else if (Main.hardMode && Main.rand.Next(3) == 0)
75825 {
75826 newNPC = ((Main.rand.Next(3) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 81) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 121));
75827 }
75828 else if (Main.hardMode && (Main.rand.Next(2) == 0 || flag37))
75829 {
75830 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 94);
75831 }
75832 else
75833 {
75834 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 6);
75835 if (Main.rand.Next(3) == 0)
75836 {
75837 Main.npc[newNPC].SetDefaults(-11);
75838 }
75839 else if (Main.rand.Next(3) == 0)
75840 {
75841 Main.npc[newNPC].SetDefaults(-12);
75842 }
75843 }
75844 }
75845 else if (flag20)
75846 {
75847 bool flag38 = (float)Math.Abs(num - Main.maxTilesX / 2) / (float)(Main.maxTilesX / 2) > 0.33f;
75848 if (flag38 && AnyDanger())
75849 {
75850 flag38 = false;
75851 }
75852 if (Main.player[k].ZoneGraveyard && !flag7 && (num3 == 2 || num3 == 477) && Main.rand.Next(10) == 0)
75853 {
75854 if (Main.rand.Next(2) == 0)
75855 {
75856 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 606);
75857 }
75858 else
75859 {
75860 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 610);
75861 }
75862 }
75863 else if (Main.player[k].ZoneSnow && Main.hardMode && flag24 && !AnyNPCs(243) && Main.player[k].RollLuck(20) == 0)
75864 {
75865 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 243);
75866 }
75867 else if (!Main.player[k].ZoneSnow && Main.hardMode && flag24 && CountNPCS(250) < 2 && Main.rand.Next(10) == 0)
75868 {
75869 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 250);
75870 }
75871 else if (flag38 && Main.hardMode && downedGolemBoss && ((!downedMartians && Main.rand.Next(100) == 0) || Main.rand.Next(400) == 0) && !AnyNPCs(399))
75872 {
75873 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 399);
75874 }
75875 else if (!Main.player[k].ZoneGraveyard && Main.dayTime)
75876 {
75877 int num100 = Math.Abs(num - Main.spawnTileX);
75878 if (!flag7 && num100 < Main.maxTilesX / 2 && Main.rand.Next(15) == 0 && (num49 == 2 || num49 == 477 || num49 == 109 || num49 == 492 || num49 == 147 || num49 == 161))
75879 {
75880 if (num49 == 147 || num49 == 161)
75881 {
75882 if (Main.rand.Next(2) == 0)
75883 {
75884 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 148);
75885 }
75886 else
75887 {
75888 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 149);
75889 }
75890 }
75891 else if (!tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(stinkBugChance) == 0 && flag20)
75892 {
75893 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 669);
75894 if (Main.rand.Next(4) == 0)
75895 {
75896 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, 669);
75897 }
75898 if (Main.rand.Next(4) == 0)
75899 {
75900 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, 669);
75901 }
75902 }
75903 else if (!tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(butterflyChance) == 0 && flag20)
75904 {
75905 if (Main.player[k].RollLuck(goldCritterChance) == 0)
75906 {
75907 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 444);
75908 }
75909 else
75910 {
75911 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 356);
75912 }
75913 if (Main.rand.Next(4) == 0)
75914 {
75915 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, 356);
75916 }
75917 if (Main.rand.Next(4) == 0)
75918 {
75919 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, 356);
75920 }
75921 }
75922 else if (tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(butterflyChance / 2) == 0 && flag20)
75923 {
75924 if (Main.player[k].RollLuck(goldCritterChance) == 0)
75925 {
75926 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 605);
75927 }
75928 else
75929 {
75930 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
75931 }
75932 if (Main.rand.Next(3) != 0)
75933 {
75934 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
75935 }
75936 if (Main.rand.Next(2) == 0)
75937 {
75938 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
75939 }
75940 if (Main.rand.Next(3) == 0)
75941 {
75942 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
75943 }
75944 if (Main.rand.Next(4) == 0)
75945 {
75946 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 604);
75947 }
75948 }
75949 else if (Main.player[k].RollLuck(goldCritterChance) == 0)
75950 {
75951 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 443);
75952 }
75953 else if (Main.player[k].RollLuck(goldCritterChance) == 0 && (double)num2 <= Main.worldSurface)
75954 {
75955 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 539);
75956 }
75957 else if (Main.halloween && Main.rand.Next(3) != 0)
75958 {
75959 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 303);
75960 }
75961 else if (Main.xMas && Main.rand.Next(3) != 0)
75962 {
75963 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 337);
75964 }
75965 else if (BirthdayParty.PartyIsUp && Main.rand.Next(3) != 0)
75966 {
75967 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 540);
75968 }
75969 else if (Main.rand.Next(3) == 0 && (double)num2 <= Main.worldSurface)
75970 {
75971 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Utils.SelectRandom(Main.rand, new short[2] { 299, 538 }));
75972 }
75973 else
75974 {
75975 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 46);
75976 }
75977 }
75978 else if (!flag7 && num > WorldGen.beachDistance && num < Main.maxTilesX - WorldGen.beachDistance && Main.rand.Next(12) == 0 && num49 == 53)
75979 {
75980 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(366, 368));
75981 }
75982 else if ((num49 == 2 || num49 == 477 || num49 == 53) && !tooWindyForButterflies && !Main.raining && Main.dayTime && Main.rand.Next(3) != 0 && ((double)num2 <= Main.worldSurface || Main.remixWorld) && FindCattailTop(num, num2, out cattailX, out cattailY))
75983 {
75984 if (Main.player[k].RollLuck(goldCritterChance) == 0)
75985 {
75986 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8, cattailY * 16, 601);
75987 }
75988 else
75989 {
75990 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8, cattailY * 16, RollDragonflyType(num49));
75991 }
75992 if (Main.rand.Next(3) == 0)
75993 {
75994 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8 - 16, cattailY * 16, RollDragonflyType(num49));
75995 }
75996 if (Main.rand.Next(3) == 0)
75997 {
75998 NewNPC(GetSpawnSourceForNaturalSpawn(), cattailX * 16 + 8 + 16, cattailY * 16, RollDragonflyType(num49));
75999 }
76000 }
76001 else if (!flag7 && num100 < Main.maxTilesX / 3 && Main.dayTime && Main.time < 18000.0 && (num49 == 2 || num49 == 477 || num49 == 109 || num49 == 492) && Main.rand.Next(4) == 0 && (double)num2 <= Main.worldSurface && CountNPCS(74) + CountNPCS(297) + CountNPCS(298) < 6)
76002 {
76003 int num101 = Main.rand.Next(4);
76004 if (Main.player[k].RollLuck(goldCritterChance) == 0)
76005 {
76006 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 442);
76007 }
76008 else
76009 {
76010 switch (num101)
76011 {
76012 case 0:
76013 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 297);
76014 break;
76015 case 1:
76016 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 298);
76017 break;
76018 default:
76019 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 74);
76020 break;
76021 }
76022 }
76023 }
76024 else if (!flag7 && num100 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (num49 == 2 || num49 == 477 || num49 == 109 || num49 == 492 || num49 == 147))
76025 {
76026 int num102 = Main.rand.Next(4);
76027 if (Main.player[k].RollLuck(goldCritterChance) == 0)
76028 {
76029 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 442);
76030 }
76031 else
76032 {
76033 switch (num102)
76034 {
76035 case 0:
76036 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 297);
76037 break;
76038 case 1:
76039 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 298);
76040 break;
76041 default:
76042 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 74);
76043 break;
76044 }
76045 }
76046 }
76047 else if (!flag7 && num100 > Main.maxTilesX / 3 && num49 == 2 && Main.rand.Next(300) == 0 && !AnyNPCs(50))
76048 {
76049 SpawnOnPlayer(k, 50);
76050 }
76052 {
76053 if (!flag7 && Main.rand.Next(10) == 0)
76054 {
76055 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 602);
76056 }
76057 else if (flag7)
76058 {
76059 int num103 = -1;
76060 int num104 = -1;
76062 {
76063 for (int num105 = num2 - 1; num105 > num2 - 50; num105--)
76064 {
76065 if (Main.tile[num, num105].liquid == 0 && !WorldGen.SolidTile(num, num105) && !WorldGen.SolidTile(num, num105 + 1) && !WorldGen.SolidTile(num, num105 + 2))
76066 {
76067 num103 = num105 + 2;
76068 if (!WorldGen.SolidTile(num, num103 + 1) && !WorldGen.SolidTile(num, num103 + 2))
76069 {
76070 num104 = num103 + 2;
76071 }
76072 break;
76073 }
76074 }
76075 if (num103 > num2)
76076 {
76077 num103 = num2;
76078 }
76079 if (num104 > num2)
76080 {
76081 num104 = num2;
76082 }
76083 }
76084 if (Main.rand.Next(10) == 0)
76085 {
76086 int num106 = Main.rand.Next(3);
76087 if (num106 == 0 && num103 > 0)
76088 {
76089 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num103 * 16, 625);
76090 }
76091 else if (num106 == 1 && num104 > 0)
76092 {
76093 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num104 * 16, 615);
76094 }
76095 else if (num106 == 2)
76096 {
76097 int num107 = num2;
76098 if (num104 > 0)
76099 {
76100 num107 = num104;
76101 }
76102 if (Main.player[k].RollLuck(goldCritterChance) == 0)
76103 {
76104 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num107 * 16, 627);
76105 }
76106 else
76107 {
76108 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num107 * 16, 626);
76109 }
76110 }
76111 }
76112 }
76113 }
76114 else if (!flag7 && num49 == 53 && Main.rand.Next(5) == 0 && Spawning_SandstoneCheck(num, num2) && !flag7)
76115 {
76116 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 69);
76117 }
76118 else if (num49 == 53 && !flag7)
76119 {
76120 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 61);
76121 }
76122 else if (!flag7 && (num100 > Main.maxTilesX / 3 || Main.remixWorld) && (Main.rand.Next(15) == 0 || (!downedGoblins && WorldGen.shadowOrbSmashed && Main.rand.Next(7) == 0)))
76123 {
76124 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 73);
76125 }
76126 else if (Main.raining && Main.rand.Next(4) == 0)
76127 {
76128 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 224);
76129 }
76130 else if (!flag7 && Main.raining && Main.rand.Next(2) == 0)
76131 {
76132 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 225);
76133 }
76134 else if (!flag7 && num50 == 0 && isItAHappyWindyDay && flag19 && Main.rand.Next(3) != 0)
76135 {
76136 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 594);
76137 }
76138 else if (!flag7 && num50 == 0 && (num3 == 2 || num3 == 477) && isItAHappyWindyDay && flag19 && Main.rand.Next(10) != 0)
76139 {
76140 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 628);
76141 }
76142 else if (!flag7)
76143 {
76144 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 1);
76145 switch (num49)
76146 {
76147 case 60:
76148 Main.npc[newNPC].SetDefaults(-10);
76149 break;
76150 case 147:
76151 case 161:
76152 Main.npc[newNPC].SetDefaults(147);
76153 break;
76154 default:
76155 if (Main.halloween && Main.rand.Next(3) != 0)
76156 {
76157 Main.npc[newNPC].SetDefaults(302);
76158 }
76159 else if (Main.xMas && Main.rand.Next(3) != 0)
76160 {
76161 Main.npc[newNPC].SetDefaults(Main.rand.Next(333, 337));
76162 }
76163 else if (Main.rand.Next(3) == 0 || (num100 < 200 && !Main.expertMode))
76164 {
76165 Main.npc[newNPC].SetDefaults(-3);
76166 }
76167 else if (Main.rand.Next(10) == 0 && (num100 > 400 || Main.expertMode))
76168 {
76169 Main.npc[newNPC].SetDefaults(-7);
76170 }
76171 break;
76172 }
76173 }
76174 }
76175 else
76176 {
76177 if (!Main.player[k].ZoneGraveyard && !tooWindyForButterflies && (num49 == 2 || num49 == 477 || num49 == 109 || num49 == 492) && !Main.raining && Main.rand.Next(fireFlyChance) == 0 && (double)num2 <= Main.worldSurface)
76178 {
76179 int num108 = 355;
76180 if (num49 == 109)
76181 {
76182 num108 = 358;
76183 }
76184 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, num108);
76185 if (Main.rand.Next(fireFlyMultiple) == 0)
76186 {
76187 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 - 16, num2 * 16, num108);
76188 }
76189 if (Main.rand.Next(fireFlyMultiple) == 0)
76190 {
76191 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8 + 16, num2 * 16, num108);
76192 }
76193 if (Main.rand.Next(fireFlyMultiple) == 0)
76194 {
76195 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16 - 16, num108);
76196 }
76197 if (Main.rand.Next(fireFlyMultiple) == 0)
76198 {
76199 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16 + 16, num108);
76200 }
76201 }
76202 else if ((Main.halloween || Main.player[k].ZoneGraveyard) && Main.rand.Next(12) == 0)
76203 {
76204 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 301);
76205 }
76206 else if (Main.player[k].ZoneGraveyard && Main.rand.Next(30) == 0)
76207 {
76208 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 316);
76209 }
76210 else if (Main.player[k].ZoneGraveyard && Main.hardMode && (double)num2 <= Main.worldSurface && Main.rand.Next(10) == 0)
76211 {
76212 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 304);
76213 }
76214 else if (Main.rand.Next(6) == 0 || (Main.moonPhase == 4 && Main.rand.Next(2) == 0))
76215 {
76216 if (Main.hardMode && Main.rand.Next(3) == 0)
76217 {
76218 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 133);
76219 }
76220 else if (Main.halloween && Main.rand.Next(2) == 0)
76221 {
76222 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(317, 319));
76223 }
76224 else if (Main.rand.Next(2) == 0)
76225 {
76226 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 2);
76227 if (Main.rand.Next(4) == 0)
76228 {
76229 Main.npc[newNPC].SetDefaults(-43);
76230 }
76231 }
76232 else
76233 {
76234 switch (Main.rand.Next(5))
76235 {
76236 case 0:
76237 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 190);
76238 if (Main.rand.Next(3) == 0)
76239 {
76240 Main.npc[newNPC].SetDefaults(-38);
76241 }
76242 break;
76243 case 1:
76244 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 191);
76245 if (Main.rand.Next(3) == 0)
76246 {
76247 Main.npc[newNPC].SetDefaults(-39);
76248 }
76249 break;
76250 case 2:
76251 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 192);
76252 if (Main.rand.Next(3) == 0)
76253 {
76254 Main.npc[newNPC].SetDefaults(-40);
76255 }
76256 break;
76257 case 3:
76258 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 193);
76259 if (Main.rand.Next(3) == 0)
76260 {
76261 Main.npc[newNPC].SetDefaults(-41);
76262 }
76263 break;
76264 case 4:
76265 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 194);
76266 if (Main.rand.Next(3) == 0)
76267 {
76268 Main.npc[newNPC].SetDefaults(-42);
76269 }
76270 break;
76271 }
76272 }
76273 }
76274 else if (Main.hardMode && Main.rand.Next(50) == 0 && Main.bloodMoon && !AnyNPCs(109))
76275 {
76276 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 109);
76277 }
76278 else if (Main.rand.Next(250) == 0 && (Main.bloodMoon || Main.player[k].ZoneGraveyard))
76279 {
76280 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 53);
76281 }
76282 else if (Main.rand.Next(250) == 0 && (Main.bloodMoon || Main.player[k].ZoneGraveyard))
76283 {
76284 NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 536);
76285 }
76286 else if (!Main.dayTime && Main.moonPhase == 0 && Main.hardMode && Main.rand.Next(3) != 0)
76287 {
76288 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 104);
76289 }
76290 else if (!Main.dayTime && Main.hardMode && Main.rand.Next(3) == 0)
76291 {
76292 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 140);
76293 }
76294 else if (Main.bloodMoon && Main.rand.Next(5) < 2)
76295 {
76296 newNPC = ((Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 490) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 489));
76297 }
76298 else if (num3 == 147 || num3 == 161 || num3 == 163 || num3 == 164 || num3 == 162)
76299 {
76300 newNPC = ((!Main.player[k].ZoneGraveyard && Main.hardMode && Main.rand.Next(4) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 169) : ((!Main.player[k].ZoneGraveyard && Main.hardMode && Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 155) : ((!Main.expertMode || Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 161) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 431))));
76301 }
76302 else if (Main.raining && Main.rand.Next(2) == 0)
76303 {
76304 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 223);
76305 if (Main.rand.Next(3) == 0)
76306 {
76307 if (Main.rand.Next(2) == 0)
76308 {
76309 Main.npc[newNPC].SetDefaults(-54);
76310 }
76311 else
76312 {
76313 Main.npc[newNPC].SetDefaults(-55);
76314 }
76315 }
76316 }
76317 else
76318 {
76319 int num109 = Main.rand.Next(7);
76320 int num110 = 12;
76321 int maxValue4 = 20;
76322 if (Main.player[k].statLifeMax <= 100)
76323 {
76324 num110 = 5;
76325 num110 -= Main.CurrentFrameFlags.ActivePlayersCount / 2;
76326 if (num110 < 2)
76327 {
76328 num110 = 2;
76329 }
76330 }
76331 if (Main.player[k].ZoneGraveyard && Main.rand.Next(maxValue4) == 0)
76332 {
76333 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 632);
76334 }
76335 else if (Main.rand.Next(num110) == 0)
76336 {
76337 newNPC = ((!Main.expertMode || Main.rand.Next(2) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 590) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 591));
76338 }
76339 else if (Main.halloween && Main.rand.Next(2) == 0)
76340 {
76341 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(319, 322));
76342 }
76343 else if (Main.xMas && Main.rand.Next(2) == 0)
76344 {
76345 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(331, 333));
76346 }
76347 else if (num109 == 0 && Main.expertMode && Main.rand.Next(3) == 0)
76348 {
76349 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 430);
76350 }
76351 else if (num109 == 2 && Main.expertMode && Main.rand.Next(3) == 0)
76352 {
76353 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 432);
76354 }
76355 else if (num109 == 3 && Main.expertMode && Main.rand.Next(3) == 0)
76356 {
76357 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 433);
76358 }
76359 else if (num109 == 4 && Main.expertMode && Main.rand.Next(3) == 0)
76360 {
76361 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 434);
76362 }
76363 else if (num109 == 5 && Main.expertMode && Main.rand.Next(3) == 0)
76364 {
76365 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 435);
76366 }
76367 else if (num109 == 6 && Main.expertMode && Main.rand.Next(3) == 0)
76368 {
76369 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 436);
76370 }
76371 else
76372 {
76373 switch (num109)
76374 {
76375 case 0:
76376 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 3);
76377 if (Main.rand.Next(3) == 0)
76378 {
76379 if (Main.rand.Next(2) == 0)
76380 {
76381 Main.npc[newNPC].SetDefaults(-26);
76382 }
76383 else
76384 {
76385 Main.npc[newNPC].SetDefaults(-27);
76386 }
76387 }
76388 break;
76389 case 1:
76390 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 132);
76391 if (Main.rand.Next(3) == 0)
76392 {
76393 if (Main.rand.Next(2) == 0)
76394 {
76395 Main.npc[newNPC].SetDefaults(-28);
76396 }
76397 else
76398 {
76399 Main.npc[newNPC].SetDefaults(-29);
76400 }
76401 }
76402 break;
76403 case 2:
76404 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 186);
76405 if (Main.rand.Next(3) == 0)
76406 {
76407 if (Main.rand.Next(2) == 0)
76408 {
76409 Main.npc[newNPC].SetDefaults(-30);
76410 }
76411 else
76412 {
76413 Main.npc[newNPC].SetDefaults(-31);
76414 }
76415 }
76416 break;
76417 case 3:
76418 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 187);
76419 if (Main.rand.Next(3) == 0)
76420 {
76421 if (Main.rand.Next(2) == 0)
76422 {
76423 Main.npc[newNPC].SetDefaults(-32);
76424 }
76425 else
76426 {
76427 Main.npc[newNPC].SetDefaults(-33);
76428 }
76429 }
76430 break;
76431 case 4:
76432 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 188);
76433 if (Main.rand.Next(3) == 0)
76434 {
76435 if (Main.rand.Next(2) == 0)
76436 {
76437 Main.npc[newNPC].SetDefaults(-34);
76438 }
76439 else
76440 {
76441 Main.npc[newNPC].SetDefaults(-35);
76442 }
76443 }
76444 break;
76445 case 5:
76446 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 189);
76447 if (Main.rand.Next(3) == 0)
76448 {
76449 if (Main.rand.Next(2) == 0)
76450 {
76451 Main.npc[newNPC].SetDefaults(-36);
76452 }
76453 else
76454 {
76455 Main.npc[newNPC].SetDefaults(-37);
76456 }
76457 }
76458 break;
76459 case 6:
76460 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 200);
76461 if (Main.rand.Next(3) == 0)
76462 {
76463 if (Main.rand.Next(2) == 0)
76464 {
76465 Main.npc[newNPC].SetDefaults(-44);
76466 }
76467 else
76468 {
76469 Main.npc[newNPC].SetDefaults(-45);
76470 }
76471 }
76472 break;
76473 }
76474 }
76475 }
76476 if (Main.player[k].ZoneGraveyard)
76477 {
76478 Main.npc[newNPC].target = k;
76479 }
76480 }
76481 }
76482 else if (flag17)
76483 {
76484 if (!flag5 && Main.rand.Next(50) == 0 && !Main.player[k].ZoneSnow)
76485 {
76486 newNPC = ((!Main.hardMode) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 10, 1) : ((Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 10, 1) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 95, 1)));
76487 }
76488 else if (Main.hardMode && Main.rand.Next(3) == 0)
76489 {
76490 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 140);
76491 }
76492 else if (Main.hardMode && Main.rand.Next(4) != 0)
76493 {
76494 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 141);
76495 }
76496 else if (Main.remixWorld)
76497 {
76498 if (num3 == 147 || num3 == 161 || num3 == 163 || num3 == 164 || num3 == 162 || Main.player[k].ZoneSnow)
76499 {
76500 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 147);
76501 }
76502 else
76503 {
76504 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 1);
76505 if (Main.rand.Next(3) == 0)
76506 {
76507 Main.npc[newNPC].SetDefaults(-9);
76508 }
76509 else
76510 {
76511 Main.npc[newNPC].SetDefaults(-8);
76512 }
76513 }
76514 }
76515 else if (num49 == 147 || num49 == 161 || Main.player[k].ZoneSnow)
76516 {
76517 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 147);
76518 }
76519 else
76520 {
76521 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 1);
76522 if (Main.rand.Next(5) == 0)
76523 {
76524 Main.npc[newNPC].SetDefaults(-9);
76525 }
76526 else if (Main.rand.Next(2) == 0)
76527 {
76528 Main.npc[newNPC].SetDefaults(1);
76529 }
76530 else
76531 {
76532 Main.npc[newNPC].SetDefaults(-8);
76533 }
76534 }
76535 }
76536 else if (num2 > Main.maxTilesY - 190)
76537 {
76538 newNPC = ((Main.remixWorld && (double)num > (double)Main.maxTilesX * 0.38 + 50.0 && (double)num < (double)Main.maxTilesX * 0.62) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 59) : ((Main.hardMode && !savedTaxCollector && Main.rand.Next(20) == 0 && !AnyNPCs(534)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 534) : ((Main.rand.Next(8) == 0) ? SpawnNPC_SpawnLavaBaitCritters(num, num2) : ((Main.rand.Next(40) == 0 && !AnyNPCs(39)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 39, 1) : ((Main.rand.Next(14) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 24) : ((Main.rand.Next(7) == 0) ? ((Main.rand.Next(10) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 66) : ((!Main.hardMode || !downedMechBossAny || Main.rand.Next(5) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 62) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 156))) : ((Main.rand.Next(3) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 59) : ((!Main.hardMode || !downedMechBossAny || Main.rand.Next(5) == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 60) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 151)))))))));
76539 }
76540 else if (SpawnNPC_CheckToSpawnRockGolem(num, num2, k, num49))
76541 {
76542 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 631);
76543 }
76544 else if (Main.rand.Next(60) == 0)
76545 {
76546 newNPC = ((!Main.player[k].ZoneSnow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 217) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 218));
76547 }
76548 else if ((num49 == 116 || num49 == 117 || num49 == 164) && Main.hardMode && !flag5 && Main.rand.Next(8) == 0)
76549 {
76550 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 120);
76551 }
76552 else if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164 || num3 == 200) && !flag5 && Main.hardMode && Main.player[k].ZoneCorrupt && Main.rand.Next(30) == 0)
76553 {
76554 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 170);
76555 }
76556 else if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164 || num3 == 200) && !flag5 && Main.hardMode && Main.player[k].ZoneHallow && Main.rand.Next(30) == 0)
76557 {
76558 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 171);
76559 }
76560 else if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164 || num3 == 200) && !flag5 && Main.hardMode && Main.player[k].ZoneCrimson && Main.rand.Next(30) == 0)
76561 {
76562 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 180);
76563 }
76564 else if (Main.hardMode && Main.player[k].ZoneSnow && Main.rand.Next(10) == 0)
76565 {
76566 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 154);
76567 }
76568 else if (!flag5 && Main.rand.Next(100) == 0 && !Main.player[k].ZoneHallow)
76569 {
76570 newNPC = (Main.hardMode ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 95, 1) : ((!Main.player[k].ZoneSnow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 10, 1) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 185)));
76571 }
76572 else if (Main.player[k].ZoneSnow && Main.rand.Next(20) == 0)
76573 {
76574 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 185);
76575 }
76576 else if ((!Main.hardMode && Main.rand.Next(10) == 0) || (Main.hardMode && Main.rand.Next(20) == 0))
76577 {
76578 if (Main.player[k].ZoneSnow)
76579 {
76580 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 184);
76581 }
76582 else if (Main.rand.Next(3) == 0)
76583 {
76584 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 1);
76585 Main.npc[newNPC].SetDefaults(-6);
76586 }
76587 else
76588 {
76589 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 16);
76590 }
76591 }
76592 else if (!Main.hardMode && Main.rand.Next(4) == 0)
76593 {
76594 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 1);
76595 if (Main.player[k].ZoneJungle)
76596 {
76597 Main.npc[newNPC].SetDefaults(-10);
76598 }
76599 else if (Main.player[k].ZoneSnow)
76600 {
76601 Main.npc[newNPC].SetDefaults(184);
76602 }
76603 else
76604 {
76605 Main.npc[newNPC].SetDefaults(-6);
76606 }
76607 }
76608 else if (Main.rand.Next(2) != 0)
76609 {
76610 newNPC = ((Main.hardMode && (Main.player[k].ZoneHallow & (Main.rand.Next(2) == 0))) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 138) : (Main.player[k].ZoneJungle ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 51) : ((Main.player[k].ZoneGlowshroom && (num3 == 70 || num3 == 190)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 634) : ((Main.hardMode && Main.player[k].ZoneHallow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 137) : ((Main.hardMode && Main.rand.Next(6) > 0) ? ((Main.rand.Next(3) != 0 || (num3 != 147 && num3 != 161 && num3 != 162)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 93) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 150)) : ((num3 != 147 && num3 != 161 && num3 != 162) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 49) : ((!Main.hardMode) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 150) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 169))))))));
76611 }
76612 else if (Main.rand.Next(35) == 0 && CountNPCS(453) == 0)
76613 {
76614 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 453);
76615 }
76616 else if (Main.rand.Next(80) == 0)
76617 {
76618 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 195);
76619 }
76620 else if (Main.hardMode && (Main.remixWorld || (double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) && Main.rand.Next(200) == 0)
76621 {
76622 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 172);
76623 }
76624 else if ((Main.remixWorld || (double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) && (Main.rand.Next(200) == 0 || (Main.rand.Next(50) == 0 && (Main.player[k].armor[1].type == 4256 || (Main.player[k].armor[1].type >= 1282 && Main.player[k].armor[1].type <= 1287)) && Main.player[k].armor[0].type != 238)))
76625 {
76626 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 45);
76627 }
76628 else if (flag10 && Main.rand.Next(4) != 0)
76629 {
76630 newNPC = ((Main.rand.Next(6) == 0 || AnyNPCs(480) || !Main.hardMode) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 481) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 480));
76631 }
76632 else if (flag9 && Main.rand.Next(5) != 0)
76633 {
76634 newNPC = ((Main.rand.Next(6) == 0 || AnyNPCs(483)) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 482) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 483));
76635 }
76636 else if (Main.hardMode && Main.rand.Next(10) != 0)
76637 {
76638 if (Main.rand.Next(2) != 0)
76639 {
76640 newNPC = ((!Main.player[k].ZoneSnow) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 110) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 206));
76641 }
76642 else if (Main.player[k].ZoneSnow)
76643 {
76644 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 197);
76645 }
76646 else
76647 {
76648 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 77);
76649 if ((Main.remixWorld || (double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) && Main.rand.Next(5) == 0)
76650 {
76651 Main.npc[newNPC].SetDefaults(-15);
76652 }
76653 }
76654 }
76655 else if (!flag5 && (Main.halloween || Main.player[k].ZoneGraveyard) && Main.rand.Next(30) == 0)
76656 {
76657 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 316);
76658 }
76659 else if (Main.rand.Next(20) == 0)
76660 {
76661 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 44);
76662 }
76663 else if (num3 == 147 || num3 == 161 || num3 == 162)
76664 {
76665 newNPC = ((Main.rand.Next(15) != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 167) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 185));
76666 }
76667 else if (Main.player[k].ZoneSnow)
76668 {
76669 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 185);
76670 }
76671 else if (Main.rand.Next(3) == 0)
76672 {
76673 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, cavernMonsterType[Main.rand.Next(2), Main.rand.Next(3)]);
76674 }
76675 else if (Main.player[k].ZoneGlowshroom && (num3 == 70 || num3 == 190))
76676 {
76677 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 635);
76678 }
76679 else if (Main.halloween && Main.rand.Next(2) == 0)
76680 {
76681 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, Main.rand.Next(322, 325));
76682 }
76683 else if (Main.expertMode && Main.rand.Next(3) == 0)
76684 {
76685 int num111 = Main.rand.Next(4);
76686 newNPC = ((num111 == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 449) : ((num111 == 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 450) : ((num111 != 0) ? NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 452) : NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 451))));
76687 }
76688 else
76689 {
76690 switch (Main.rand.Next(4))
76691 {
76692 case 0:
76693 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 21);
76694 if (Main.rand.Next(3) == 0)
76695 {
76696 if (Main.rand.Next(2) == 0)
76697 {
76698 Main.npc[newNPC].SetDefaults(-47);
76699 }
76700 else
76701 {
76702 Main.npc[newNPC].SetDefaults(-46);
76703 }
76704 }
76705 break;
76706 case 1:
76707 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 201);
76708 if (Main.rand.Next(3) == 0)
76709 {
76710 if (Main.rand.Next(2) == 0)
76711 {
76712 Main.npc[newNPC].SetDefaults(-49);
76713 }
76714 else
76715 {
76716 Main.npc[newNPC].SetDefaults(-48);
76717 }
76718 }
76719 break;
76720 case 2:
76721 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 202);
76722 if (Main.rand.Next(3) == 0)
76723 {
76724 if (Main.rand.Next(2) == 0)
76725 {
76726 Main.npc[newNPC].SetDefaults(-51);
76727 }
76728 else
76729 {
76730 Main.npc[newNPC].SetDefaults(-50);
76731 }
76732 }
76733 break;
76734 case 3:
76735 newNPC = NewNPC(GetSpawnSourceForNaturalSpawn(), num * 16 + 8, num2 * 16, 203);
76736 if (Main.rand.Next(3) == 0)
76737 {
76738 if (Main.rand.Next(2) == 0)
76739 {
76740 Main.npc[newNPC].SetDefaults(-53);
76741 }
76742 else
76743 {
76744 Main.npc[newNPC].SetDefaults(-52);
76745 }
76746 }
76747 break;
76748 }
76749 }
76750 if (Main.npc[newNPC].type == 1 && Main.player[k].RollLuck(180) == 0)
76751 {
76752 Main.npc[newNPC].SetDefaults(-4);
76753 }
76754 if (Main.tenthAnniversaryWorld && Main.npc[newNPC].type == 1 && Main.player[k].RollLuck(180) == 0)
76755 {
76756 Main.npc[newNPC].SetDefaults(667);
76757 }
76758 if (Main.netMode == 2 && newNPC < 200)
76759 {
76760 NetMessage.SendData(23, -1, -1, null, newNPC);
76761 }
76762 break;
76763 }
76764 }
76765
76766 public static void SpawnNPC_SpawnFrog(int spawnTileX, int spawnTileY, int plr)
76767 {
76768 if (!unlockedSlimeYellowSpawn && Main.player[plr].RollLuck(30) == 0 && !AnyNPCs(687))
76769 {
76770 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 687);
76771 }
76772 else if (Main.player[plr].RollLuck(goldCritterChance) == 0)
76773 {
76774 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 445);
76775 }
76776 else
76777 {
76778 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 361);
76779 }
76780 }
76781
76783 {
76784 int num = Main.rand.Next(100);
76785 if (num < 5)
76786 {
76787 return 651;
76788 }
76789 if (num < 13)
76790 {
76791 return 652;
76792 }
76793 if (num < 23)
76794 {
76795 return 650;
76796 }
76797 if (num < 35)
76798 {
76799 return 649;
76800 }
76801 if (num < 51)
76802 {
76803 return 648;
76804 }
76805 if (num < 72)
76806 {
76807 return 647;
76808 }
76809 return 646;
76810 }
76811
76813 {
76814 int num = Main.rand.Next(100);
76815 if (num < 5)
76816 {
76817 return 644;
76818 }
76819 if (num < 13)
76820 {
76821 return 645;
76822 }
76823 if (num < 23)
76824 {
76825 return 643;
76826 }
76827 if (num < 35)
76828 {
76829 return 642;
76830 }
76831 if (num < 51)
76832 {
76833 return 641;
76834 }
76835 if (num < 72)
76836 {
76837 return 640;
76838 }
76839 return 639;
76840 }
76841
76842 private static bool SpawnNPC_CheckToSpawnRockGolem(int spawnTileX, int spawnTileY, int plr, int tileType)
76843 {
76844 if (!Main.hardMode || (tileType != 1 && !TileID.Sets.Conversion.Moss[tileType]) || Main.player[plr].ZoneSnow)
76845 {
76846 return false;
76847 }
76848 if (Main.rand.Next(60) != 0)
76849 {
76850 return false;
76851 }
76852 if (WorldGen.SolidTile(spawnTileX - 1, spawnTileY - 4) || WorldGen.SolidTile(spawnTileX, spawnTileY - 4) || WorldGen.SolidTile(spawnTileX + 1, spawnTileY - 4))
76853 {
76854 return false;
76855 }
76856 return true;
76857 }
76858
76859 private static bool SpawnNPC_CheckToSpawnUndergroundFairy(int spawnTileX, int spawnTileY, int plr)
76860 {
76861 if (!fairyLog)
76862 {
76863 return false;
76864 }
76865 int num = 500;
76867 {
76868 num = 250;
76869 }
76870 if (Main.hardMode)
76871 {
76872 num = (int)((float)num * 1.66f);
76873 }
76874 if (Main.player[plr].RollLuck(num) != 0)
76875 {
76876 return false;
76877 }
76878 if ((double)spawnTileY < (Main.worldSurface + Main.rockLayer) / 2.0 || spawnTileY >= Main.maxTilesY - 300)
76879 {
76880 return false;
76881 }
76882 if (AnyHelpfulFairies())
76883 {
76884 return false;
76885 }
76886 return true;
76887 }
76888
76889 private static int SpawnNPC_SpawnLavaBaitCritters(int spawnTileX, int spawnTileY)
76890 {
76891 if (Main.rand.Next(3) != 0)
76892 {
76893 if (Main.dayTime)
76894 {
76895 return NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 653);
76896 }
76897 if (Main.rand.Next(fireFlyMultiple) == 0)
76898 {
76899 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8 - 16, spawnTileY * 16, 654);
76900 }
76901 if (Main.rand.Next(fireFlyMultiple) == 0)
76902 {
76903 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8 + 16, spawnTileY * 16, 654);
76904 }
76905 if (Main.rand.Next(fireFlyMultiple) == 0)
76906 {
76907 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16 - 16, 654);
76908 }
76909 if (Main.rand.Next(fireFlyMultiple) == 0)
76910 {
76911 NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16 + 16, 654);
76912 }
76913 return NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 654);
76914 }
76915 return NewNPC(GetSpawnSourceForNaturalSpawn(), spawnTileX * 16 + 8, spawnTileY * 16, 655);
76916 }
76917
76918 private static int SpawnNPC_TryFindingProperGroundTileType(int spawnTileType, int x, int y)
76919 {
76920 if (!IsValidSpawningGroundTile(x, y))
76921 {
76922 for (int i = y + 1; i < y + 30; i++)
76923 {
76924 if (IsValidSpawningGroundTile(x, i))
76925 {
76926 return Main.tile[x, i].type;
76927 }
76928 }
76929 }
76930 return spawnTileType;
76931 }
76932
76933 public static bool IsValidSpawningGroundTile(int x, int y)
76934 {
76935 Tile tile = Main.tile[x, y];
76936 if (!tile.nactive())
76937 {
76938 return false;
76939 }
76940 if (!Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type])
76941 {
76942 return false;
76943 }
76945 {
76946 return false;
76947 }
76948 return true;
76949 }
76950
76951 public static bool FindCattailTop(int landX, int landY, out int cattailX, out int cattailY)
76952 {
76953 cattailX = landX;
76954 cattailY = landY;
76955 if (!WorldGen.InWorld(landX, landY, 31))
76956 {
76957 return false;
76958 }
76959 int num = 1;
76960 for (int i = landX - 30; i <= landX + 30; i++)
76961 {
76962 for (int j = landY - 20; j <= landY + 20; j++)
76963 {
76964 Tile tile = Main.tile[i, j];
76965 if (tile != null && tile.active() && tile.type == 519 && tile.frameX >= 180 && Main.rand.Next(num) == 0)
76966 {
76967 cattailX = i;
76968 cattailY = j;
76969 num++;
76970 }
76971 }
76972 }
76973 if (cattailX != landX || cattailY != landY)
76974 {
76975 return true;
76976 }
76977 return false;
76978 }
76979
76980 public static bool FindTreeBranch(int landX, int landY, out int treeBranchX, out int treeBranchY)
76981 {
76984 if (!WorldGen.InWorld(landX, landY, 11))
76985 {
76986 return false;
76987 }
76988 int num = 1;
76989 for (int i = landX - 10; i <= landX + 10; i++)
76990 {
76991 for (int j = landY - 30; j <= landY + 30; j++)
76992 {
76993 Tile tile = Main.tile[i, j];
76994 if (tile != null && tile.active() && TileID.Sets.IsATreeTrunk[tile.type])
76995 {
76996 int num2 = tile.frameX / 22;
76997 int num3 = tile.frameY / 66;
76998 if (((num2 == 3 && num3 == 0) || (num2 == 3 && num3 == 3) || (num2 == 4 && num3 == 1) || (num2 == 4 && num3 == 3) || (num2 == 2 && num3 == 3)) && Main.rand.Next(num) == 0)
76999 {
77000 treeBranchX = i;
77001 treeBranchY = j;
77002 num++;
77003 }
77004 }
77005 }
77006 }
77007 if (treeBranchX != landX || treeBranchY != landY)
77008 {
77009 return true;
77010 }
77011 return false;
77012 }
77013
77014 public static bool AnyDanger(bool quickBossNPCCheck = false, bool ignorePillarsAndMoonlordCountdown = false)
77015 {
77016 bool flag = false;
77017 if (!ignorePillarsAndMoonlordCountdown && MoonLordCountdown > 0)
77018 {
77019 flag = true;
77020 }
77021 if (Main.invasionType > 0)
77022 {
77023 flag = true;
77024 }
77026 {
77027 flag = true;
77028 }
77029 if (!flag)
77030 {
77032 {
77034 }
77035 else
77036 {
77037 for (int i = 0; i < 200; i++)
77038 {
77039 if (!Main.npc[i].active || (!Main.npc[i].boss && !NPCID.Sets.DangerThatPreventsOtherDangers[Main.npc[i].type]))
77040 {
77041 continue;
77042 }
77044 {
77045 switch (Main.npc[i].type)
77046 {
77047 case 422:
77048 case 493:
77049 case 507:
77050 case 517:
77051 continue;
77052 }
77053 }
77054 flag = true;
77055 }
77056 }
77057 }
77058 return flag;
77059 }
77060
77061 public static bool AnyoneNearCultists()
77062 {
77063 int num = FindFirstNPC(437);
77064 if (num == -1)
77065 {
77066 return false;
77067 }
77068 Rectangle rectangle = Utils.CenteredRectangle(Main.npc[num].Center, new Vector2(2500f, 1500f));
77069 Rectangle r = new Rectangle(0, 0, 2500, 1500);
77070 Vector2 vector = r.Size() / 2f;
77071 for (int i = 0; i < 255; i++)
77072 {
77073 if (Main.player[i].active)
77074 {
77075 r.X = (int)Main.player[i].Center.X - (int)vector.X;
77076 r.Y = (int)Main.player[i].Center.Y - (int)vector.Y;
77077 if (rectangle.Intersects(r))
77078 {
77079 return true;
77080 }
77081 }
77082 }
77083 return false;
77084 }
77085
77086 public static void SpawnWOF(Vector2 pos)
77087 {
77088 if (pos.Y / 16f < (float)(Main.maxTilesY - 205) || Main.wofNPCIndex >= 0 || Main.netMode == 1 || AnyNPCs(113))
77089 {
77090 return;
77091 }
77092 Player.FindClosest(pos, 16, 16);
77093 int num = 1;
77094 if (pos.X / 16f > (float)(Main.maxTilesX / 2))
77095 {
77096 num = -1;
77097 }
77098 bool flag = false;
77099 int num2 = (int)pos.X;
77100 int targetPlayerIndex = 0;
77101 while (!flag)
77102 {
77103 flag = true;
77104 for (int i = 0; i < 255; i++)
77105 {
77106 if (Main.player[i].active && Main.player[i].position.X > (float)(num2 - 1200) && Main.player[i].position.X < (float)(num2 + 1200))
77107 {
77108 num2 -= num * 16;
77109 flag = false;
77111 }
77112 }
77113 if (num2 / 16 < 20 || num2 / 16 > Main.maxTilesX - 20)
77114 {
77115 flag = true;
77116 }
77117 }
77118 int num3 = (int)pos.Y;
77119 int num4 = num2 / 16;
77120 int num5 = num3 / 16;
77121 int num6 = 0;
77122 int num7 = 1000;
77123 if (!WorldGen.InWorld(num4, num5, 2) || WorldGen.SolidTile(num4, num5) || Main.tile[num4, num5 - num6].liquid >= 100)
77124 {
77125 while (true)
77126 {
77127 num7--;
77128 if (num7 <= 0)
77129 {
77130 break;
77131 }
77132 try
77133 {
77134 if (WorldGen.InWorld(num4, num5 - num6, 2) && !WorldGen.SolidTile(num4, num5 - num6) && Main.tile[num4, num5 - num6].liquid < 100)
77135 {
77136 num5 -= num6;
77137 break;
77138 }
77139 if (WorldGen.InWorld(num4, num5 + num6, 2) && !WorldGen.SolidTile(num4, num5 + num6) && Main.tile[num4, num5 + num6].liquid < 100)
77140 {
77141 num5 += num6;
77142 break;
77143 }
77144 num6++;
77145 }
77146 catch
77147 {
77148 break;
77149 }
77150 }
77151 }
77152 int num8 = Main.UnderworldLayer + 10;
77153 int num9 = num8 + 70;
77154 if (num5 < num8)
77155 {
77156 num5 = num8;
77157 }
77158 if (num5 > num9)
77159 {
77160 num5 = num9;
77161 }
77162 num3 = num5 * 16;
77163 int num10 = NewNPC(GetBossSpawnSource(targetPlayerIndex), num2, num3, 113);
77164 if (Main.netMode == 0)
77165 {
77166 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[num10].TypeName), 175, 75);
77167 }
77168 else if (Main.netMode == 2)
77169 {
77170 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[num10].GetTypeNetName()), new Color(175, 75, 255));
77171 }
77172 }
77173
77174 public static void SpawnSkeletron(int onWho)
77175 {
77176 bool flag = true;
77177 bool flag2 = false;
77179 int num = 0;
77180 int num2 = 0;
77181 for (int i = 0; i < 200; i++)
77182 {
77183 if (Main.npc[i].active && Main.npc[i].type == 35)
77184 {
77185 flag = false;
77186 break;
77187 }
77188 }
77189 for (int j = 0; j < 200; j++)
77190 {
77191 if (!Main.npc[j].active)
77192 {
77193 continue;
77194 }
77195 if (Main.npc[j].type == 37)
77196 {
77197 flag2 = true;
77198 Main.npc[j].ai[3] = 1f;
77199 zero = Main.npc[j].position;
77200 num = Main.npc[j].width;
77201 num2 = Main.npc[j].height;
77202 if (Main.netMode == 2)
77203 {
77204 NetMessage.SendData(23, -1, -1, null, j);
77205 }
77206 }
77207 else if (Main.npc[j].type == 54)
77208 {
77209 flag2 = true;
77210 zero = Main.npc[j].position;
77211 num = Main.npc[j].width;
77212 num2 = Main.npc[j].height;
77213 }
77214 }
77215 if (flag && flag2)
77216 {
77217 int num3 = NewNPC(GetBossSpawnSource(onWho), (int)zero.X + num / 2, (int)zero.Y + num2 / 2, 35);
77218 Main.npc[num3].netUpdate = true;
77219 string nPCNameValue = Lang.GetNPCNameValue(35);
77220 if (Main.netMode == 0)
77221 {
77222 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", nPCNameValue), 175, 75);
77223 }
77224 else if (Main.netMode == 2)
77225 {
77226 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Lang.GetNPCName(35).ToNetworkText()), new Color(175, 75, 255));
77227 }
77228 }
77229 }
77230
77231 public static void SpawnFaelings(int plr)
77232 {
77233 if (AnyNPCs(677))
77234 {
77235 return;
77236 }
77237 int num = Main.rand.Next(2, 6);
77238 int num2 = (int)(Main.player[plr].position.X / 16f) - spawnRangeX * 2;
77239 int num3 = (int)(Main.player[plr].position.X / 16f) + spawnRangeX * 2;
77240 int num4 = (int)(Main.player[plr].position.Y / 16f) - spawnRangeY * 2;
77241 int num5 = (int)(Main.player[plr].position.Y / 16f) + spawnRangeY * 2;
77242 _ = Main.player[plr].position.X / 16f;
77243 _ = safeRangeX;
77244 _ = Main.player[plr].position.X / 16f;
77245 _ = safeRangeX;
77246 _ = Main.player[plr].position.Y / 16f;
77247 _ = safeRangeY;
77248 _ = Main.player[plr].position.Y / 16f;
77249 _ = safeRangeY;
77250 if (num2 < 0)
77251 {
77252 num2 = 0;
77253 }
77254 if (num3 > Main.maxTilesX)
77255 {
77257 }
77258 if (num4 < 0)
77259 {
77260 num4 = 0;
77261 }
77262 if (num5 > Main.maxTilesY)
77263 {
77265 }
77266 for (int i = 0; i < num; i++)
77267 {
77268 int num6 = 1000;
77269 for (int j = 0; j < num6; j++)
77270 {
77271 int num7 = Main.rand.Next(num2, num3);
77272 int num8 = Main.rand.Next(num4, num5);
77273 if (Main.tile[num7, num8].liquid <= 0 || !Main.tile[num7, num8].shimmer())
77274 {
77275 continue;
77276 }
77277 while (Main.tile[num7, num8].liquid > 0)
77278 {
77279 if (num8 < 50)
77280 {
77281 return;
77282 }
77283 num8--;
77284 }
77285 bool flag = true;
77286 Rectangle rectangle = new Rectangle(num7 * 16, num8 * 16, 16, 16);
77287 for (int k = 0; k < 255; k++)
77288 {
77289 if (Main.player[k].active)
77290 {
77291 Rectangle rectangle2 = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(sWidth / 2) - (float)safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(sHeight / 2) - (float)safeRangeY), sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
77292 if (rectangle.Intersects(rectangle2))
77293 {
77294 flag = false;
77295 }
77296 }
77297 }
77298 if (flag)
77299 {
77300 int num9 = NewNPC(GetSpawnSourceForNaturalSpawn(), num7 * 16 + 8, num8 * 16, 677);
77301 if (Main.netMode == 2 && num9 < 200)
77302 {
77303 NetMessage.SendData(23, -1, -1, null, num9);
77304 }
77305 break;
77306 }
77307 }
77308 }
77309 }
77310
77311 public static void SpawnOnPlayer(int plr, int Type)
77312 {
77313 if (Main.netMode == 1 || (Type == 262 && AnyNPCs(262)))
77314 {
77315 return;
77316 }
77317 switch (Type)
77318 {
77319 case 245:
77320 if (AnyNPCs(245))
77321 {
77322 return;
77323 }
77324 try
77325 {
77326 int num2 = (int)Main.player[plr].Center.X / 16;
77327 int num3 = (int)Main.player[plr].Center.Y / 16;
77328 int num4 = 0;
77329 int num5 = 0;
77330 for (int j = num2 - 20; j < num2 + 20; j++)
77331 {
77332 for (int k = num3 - 20; k < num3 + 20; k++)
77333 {
77334 if (Main.tile[j, k].active() && Main.tile[j, k].type == 237 && Main.tile[j, k].frameX == 18 && Main.tile[j, k].frameY == 0)
77335 {
77336 num4 = j;
77337 num5 = k;
77338 }
77339 }
77340 }
77341 if (num4 <= 0 || num5 <= 0)
77342 {
77343 return;
77344 }
77345 int num6 = num5 - 15;
77346 int num7 = num5 - 15;
77347 for (int num8 = num5; num8 > num5 - 50; num8--)
77348 {
77350 {
77351 num6 = num8;
77352 break;
77353 }
77354 }
77355 for (int l = num5; l < num5 + 50; l++)
77356 {
77357 if (WorldGen.SolidTile(num4, l))
77358 {
77359 num7 = l;
77360 break;
77361 }
77362 }
77363 num5 = (num6 + num6 + num7) / 3;
77364 int num9 = NewNPC(GetBossSpawnSource(plr), num4 * 16 + 8, num5 * 16, 245);
77365 Main.npc[num9].target = plr;
77366 string typeName2 = Main.npc[num9].TypeName;
77367 if (Main.netMode == 0)
77368 {
77369 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName2), 175, 75);
77370 }
77371 else if (Main.netMode == 2)
77372 {
77373 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[num9].GetTypeNetName()), new Color(175, 75, 255));
77374 }
77375 return;
77376 }
77377 catch
77378 {
77379 return;
77380 }
77381 case 370:
77382 {
77384 if (!player2.active || player2.dead)
77385 {
77386 return;
77387 }
77388 for (int i = 0; i < 1000; i++)
77389 {
77390 Projectile projectile = Main.projectile[i];
77391 if (projectile.active && projectile.bobber && projectile.owner == plr)
77392 {
77393 int num = NewNPC(GetBossSpawnSource(plr), (int)projectile.Center.X, (int)projectile.Center.Y + 100, 370);
77394 string typeName = Main.npc[num].TypeName;
77395 if (Main.netMode == 0)
77396 {
77397 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75);
77398 }
77399 else if (Main.netMode == 2)
77400 {
77401 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[num].GetTypeNetName()), new Color(175, 75, 255));
77402 }
77403 break;
77404 }
77405 }
77406 return;
77407 }
77408 case 398:
77409 if (!AnyNPCs(Type))
77410 {
77411 Player player = Main.player[plr];
77412 NewNPC(GetBossSpawnSource(plr), (int)player.Center.X, (int)player.Center.Y - 150, Type);
77413 if (Main.netMode == 0)
77414 {
77415 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Language.GetTextValue("Enemies.MoonLord")), 175, 75);
77416 }
77417 else if (Main.netMode == 2)
77418 {
77419 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", NetworkText.FromKey("Enemies.MoonLord")), new Color(175, 75, 255));
77420 }
77421 }
77422 return;
77423 }
77424 bool flag = false;
77425 int num10 = 0;
77426 int num11 = 0;
77427 int num12 = (int)(Main.player[plr].position.X / 16f) - spawnRangeX * 2;
77428 int num13 = (int)(Main.player[plr].position.X / 16f) + spawnRangeX * 2;
77429 int num14 = (int)(Main.player[plr].position.Y / 16f) - spawnRangeY * 2;
77430 int num15 = (int)(Main.player[plr].position.Y / 16f) + spawnRangeY * 2;
77431 int num16 = (int)(Main.player[plr].position.X / 16f) - safeRangeX;
77432 int num17 = (int)(Main.player[plr].position.X / 16f) + safeRangeX;
77433 int num18 = (int)(Main.player[plr].position.Y / 16f) - safeRangeY;
77434 int num19 = (int)(Main.player[plr].position.Y / 16f) + safeRangeY;
77435 if (num12 < 0)
77436 {
77437 num12 = 0;
77438 }
77439 if (num13 > Main.maxTilesX)
77440 {
77442 }
77443 if (num14 < 0)
77444 {
77445 num14 = 0;
77446 }
77447 if (num15 > Main.maxTilesY)
77448 {
77450 }
77451 for (int m = 0; m < 1000; m++)
77452 {
77453 for (int n = 0; n < 100; n++)
77454 {
77455 int num20 = Main.rand.Next(num12, num13);
77456 int num21 = Main.rand.Next(num14, num15);
77457 if (!Main.tile[num20, num21].nactive() || !Main.tileSolid[Main.tile[num20, num21].type])
77458 {
77459 if ((Main.wallHouse[Main.tile[num20, num21].wall] && m < 999) || (Type == 50 && m < 500 && Main.tile[num21, num21].wall > 0))
77460 {
77461 continue;
77462 }
77463 for (int num22 = num21; num22 < Main.maxTilesY; num22++)
77464 {
77465 if (Main.tile[num20, num22].nactive() && Main.tileSolid[Main.tile[num20, num22].type])
77466 {
77468 {
77469 _ = Main.tile[num20, num22].type;
77470 num10 = num20;
77471 num11 = num22;
77472 flag = true;
77473 }
77474 break;
77475 }
77476 }
77477 if (flag && Type == 50 && m < 900)
77478 {
77479 int num23 = 20;
77480 if (!Collision.CanHit(new Vector2(num10, num11 - 1) * 16f, 16, 16, new Vector2(num10, num11 - 1 - num23) * 16f, 16, 16) || !Collision.CanHit(new Vector2(num10, num11 - 1 - num23) * 16f, 16, 16, Main.player[plr].Center, 0, 0))
77481 {
77482 num10 = 0;
77483 num11 = 0;
77484 flag = false;
77485 }
77486 }
77487 if (flag && m < 999)
77488 {
77489 int num24 = num10 - spawnSpaceX / 2;
77490 int num25 = num10 + spawnSpaceX / 2;
77491 int num26 = num11 - spawnSpaceY;
77492 int num27 = num11;
77493 if (num24 < 0)
77494 {
77495 flag = false;
77496 }
77497 if (num25 > Main.maxTilesX)
77498 {
77499 flag = false;
77500 }
77501 if (num26 < 0)
77502 {
77503 flag = false;
77504 }
77505 if (num27 > Main.maxTilesY)
77506 {
77507 flag = false;
77508 }
77509 if (flag)
77510 {
77511 for (int num28 = num24; num28 < num25; num28++)
77512 {
77513 for (int num29 = num26; num29 < num27; num29++)
77514 {
77515 if (Main.tile[num28, num29].nactive() && Main.tileSolid[Main.tile[num28, num29].type])
77516 {
77517 flag = false;
77518 break;
77519 }
77520 }
77521 }
77522 }
77523 }
77524 }
77525 if (flag || flag)
77526 {
77527 break;
77528 }
77529 }
77530 if (flag && m < 999)
77531 {
77532 Rectangle rectangle = new Rectangle(num10 * 16, num11 * 16, 16, 16);
77533 for (int num30 = 0; num30 < 255; num30++)
77534 {
77535 if (Main.player[num30].active)
77536 {
77537 Rectangle rectangle2 = new Rectangle((int)(Main.player[num30].position.X + (float)(Main.player[num30].width / 2) - (float)(sWidth / 2) - (float)safeRangeX), (int)(Main.player[num30].position.Y + (float)(Main.player[num30].height / 2) - (float)(sHeight / 2) - (float)safeRangeY), sWidth + safeRangeX * 2, sHeight + safeRangeY * 2);
77538 if (rectangle.Intersects(rectangle2))
77539 {
77540 flag = false;
77541 }
77542 }
77543 }
77544 }
77545 if (flag)
77546 {
77547 break;
77548 }
77549 }
77550 if (flag)
77551 {
77552 int spawnPositionX = num10 * 16 + 8;
77553 int spawnPositionY = num11 * 16;
77554 SpawnBoss(spawnPositionX, spawnPositionY, Type, plr);
77555 }
77556 }
77557
77559 {
77560 if (amountWeWant <= 0)
77561 {
77562 return 0;
77563 }
77564 int num = 0;
77565 for (int i = 0; i < highestNPCSlotIndexWeWillPick; i++)
77566 {
77567 if (!Main.npc[i].active)
77568 {
77569 num++;
77570 if (num >= amountWeWant)
77571 {
77572 return amountWeWant;
77573 }
77574 }
77575 }
77576 return num;
77577 }
77578
77583
77584 public static void SpawnBoss(int spawnPositionX, int spawnPositionY, int Type, int targetPlayerIndex)
77585 {
77586 int num = 200;
77587 if (Type == 127 && mechQueen != -1)
77588 {
77589 num = (mechQueen = NewNPC(GetBossSpawnSource(targetPlayerIndex), spawnPositionX, spawnPositionY, Type, 100));
77590 Main.npc[mechQueen].ai[3] = mechQueen;
77591 }
77592 else
77593 {
77594 num = NewNPC(GetBossSpawnSource(targetPlayerIndex), spawnPositionX, spawnPositionY, Type, 1);
77595 }
77596 if (num == 200)
77597 {
77598 return;
77599 }
77600 Main.npc[num].target = targetPlayerIndex;
77601 Main.npc[num].timeLeft *= 20;
77602 string typeName = Main.npc[num].TypeName;
77603 if (Main.netMode == 2 && num < 200)
77604 {
77605 NetMessage.SendData(23, -1, -1, null, num);
77606 }
77607 if (Type == 134 || Type == 127 || Type == 126 || Type == 125)
77608 {
77610 }
77611 if (Type == 127 && mechQueen == num)
77612 {
77613 if (Main.netMode == 0)
77614 {
77615 Main.NewText(Lang.misc[107].Value, 175, 75);
77616 }
77617 else if (Main.netMode == 2)
77618 {
77619 ChatHelper.BroadcastChatMessage(Lang.misc[107].ToNetworkText(), new Color(175, 75, 255));
77620 }
77621 return;
77622 }
77623 switch (Type)
77624 {
77625 case 125:
77626 if (Main.netMode == 0)
77627 {
77628 Main.NewText(Lang.misc[48].Value, 175, 75);
77629 }
77630 else if (Main.netMode == 2)
77631 {
77632 ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255));
77633 }
77634 return;
77635 case 50:
77636 case 82:
77637 case 126:
77638 case 316:
77639 case 398:
77640 case 551:
77641 case 662:
77642 return;
77643 }
77644 if (Main.netMode == 0)
77645 {
77646 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75);
77647 }
77648 else if (Main.netMode == 2)
77649 {
77650 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[num].GetTypeNetName()), new Color(175, 75, 255));
77651 }
77652 }
77653
77654 public 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)
77655 {
77656 if (Main.getGoodWorld && Main.rand.Next(3) != 0)
77657 {
77658 if (Type == 46)
77659 {
77660 Type = 614;
77661 }
77662 if (Type == 62)
77663 {
77664 Type = 66;
77665 }
77666 }
77667 int availableNPCSlot = GetAvailableNPCSlot(Type, Start);
77668 if (availableNPCSlot >= 0)
77669 {
77670 Main.npc[availableNPCSlot] = new NPC();
77671 Main.npc[availableNPCSlot].SetDefaults(Type);
77673 GiveTownUniqueDataToNPCsThatNeedIt(Type, availableNPCSlot);
77674 Main.npc[availableNPCSlot].position.X = X - Main.npc[availableNPCSlot].width / 2;
77675 Main.npc[availableNPCSlot].position.Y = Y - Main.npc[availableNPCSlot].height;
77676 Main.npc[availableNPCSlot].active = true;
77677 Main.npc[availableNPCSlot].timeLeft = (int)((double)activeTime * 1.25);
77679 Main.npc[availableNPCSlot].ai[0] = ai0;
77680 Main.npc[availableNPCSlot].ai[1] = ai1;
77681 Main.npc[availableNPCSlot].ai[2] = ai2;
77682 Main.npc[availableNPCSlot].ai[3] = ai3;
77683 Main.npc[availableNPCSlot].target = Target;
77684 if (Type == 50)
77685 {
77686 if (Main.netMode == 0)
77687 {
77688 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[availableNPCSlot].TypeName), 175, 75);
77689 }
77690 else if (Main.netMode == 2)
77691 {
77692 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[availableNPCSlot].GetTypeNetName()), new Color(175, 75, 255));
77693 }
77694 }
77695 return availableNPCSlot;
77696 }
77697 return 200;
77698 }
77699
77700 private static int GetAvailableNPCSlot(int Type, int startIndex)
77701 {
77702 bool num = Type == 222 || Type == 245;
77703 int t = 200;
77704 int num2 = 1;
77705 if (num)
77706 {
77707 t--;
77708 Utils.Swap(ref startIndex, ref t);
77709 num2 = -1;
77710 }
77711 for (int i = startIndex; i != t; i += num2)
77712 {
77713 if (!Main.npc[i].active)
77714 {
77715 return i;
77716 }
77717 }
77718 for (int j = startIndex; j != t; j += num2)
77719 {
77720 if (Main.npc[j].CanBeReplacedByOtherNPCs)
77721 {
77722 return j;
77723 }
77724 }
77725 return -1;
77726 }
77727
77729 {
77730 NPC nPC = Main.npc[nextNPC];
77731 if (nPC.isLikeATownNPC)
77732 {
77733 nPC.GivenName = getNewNPCName(Type);
77734 if (TownNPCProfiles.Instance.GetProfile(Type, out var profile))
77735 {
77736 nPC.townNpcVariationIndex = profile.RollVariation();
77737 nPC.GivenName = profile.GetNameForVariant(nPC);
77738 }
77739 if (ShimmeredTownNPCs[Type])
77740 {
77741 nPC.townNpcVariationIndex = 1;
77742 }
77743 nPC.needsUniqueInfoUpdate = true;
77744 }
77745 }
77746
77748 {
77749 Color color = new Color(50, 255, 130);
77750 if (Main.netMode == 1)
77751 {
77752 if (!petBoughtFlag || AnyNPCs(npcType))
77753 {
77754 NetMessage.SendData(61, -1, -1, null, Main.myPlayer, netMessageData);
77755 }
77756 }
77757 else if (!petBoughtFlag)
77758 {
77759 petBoughtFlag = true;
77762 }
77763 else if (RerollVariationForNPCType(npcType))
77764 {
77765 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Misc.PetExchangeSuccess"), color);
77766 }
77767 else
77768 {
77769 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Misc.PetExchangeFail"), color);
77770 }
77771 }
77772
77773 public static bool RerollVariationForNPCType(int npcType)
77774 {
77775 for (int i = 0; i < 200; i++)
77776 {
77777 NPC nPC = Main.npc[i];
77778 if (nPC.active && nPC.type == npcType)
77779 {
77780 return nPC.RerollVariation();
77781 }
77782 }
77783 return false;
77784 }
77785
77786 public bool RerollVariation()
77787 {
77788 if (!TownNPCProfiles.Instance.GetProfile(type, out var profile))
77789 {
77790 return false;
77791 }
77792 int num = townNpcVariationIndex;
77793 int num2 = 0;
77794 while (num2++ < 100 && townNpcVariationIndex == num)
77795 {
77796 townNpcVariationIndex = profile.RollVariation();
77797 }
77798 if (num == townNpcVariationIndex)
77799 {
77800 return false;
77801 }
77802 GivenName = profile.GetNameForVariant(this);
77803 life = lifeMax;
77804 if (Main.netMode != 1)
77805 {
77807 particleOrchestraSettings.PositionInWorld = base.Center;
77808 particleOrchestraSettings.MovementVector = velocity;
77811 }
77812 NetMessage.TrySendData(56, -1, -1, null, whoAmI);
77813 return true;
77814 }
77815
77816 public void TransformVisuals(int oldType, int newType)
77817 {
77818 position += netOffset;
77819 if ((oldType == 158 && newType == 159) || (oldType == 159 && newType == 158))
77820 {
77822 int num = Gore.NewGore(new Vector2(position.X, position.Y - 10f), velocity, 99, scale);
77823 Main.gore[num].velocity *= 0.3f;
77824 num = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), velocity, 99, scale);
77825 Main.gore[num].velocity *= 0.3f;
77826 num = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 10f), velocity, 99, scale);
77827 Main.gore[num].velocity *= 0.3f;
77828 }
77829 else if (oldType == 478 && newType == 479)
77830 {
77831 for (int i = 0; i < 30; i++)
77832 {
77833 int num2 = Dust.NewDust(position, width, height, 238, 0f, -2f);
77834 if (Main.rand.Next(2) == 0)
77835 {
77836 Main.dust[num2].noGravity = true;
77837 }
77838 }
77839 Gore.NewGore(position, velocity, 684, scale);
77840 Gore.NewGore(position, velocity, 685, scale);
77841 Gore.NewGore(position, velocity, 686, scale);
77842 Gore.NewGore(position, velocity, 684 + Main.rand.Next(3), scale);
77843 }
77844 else if (oldType == 406 && newType == 405)
77845 {
77846 float num3 = Main.rand.Next(10, 21);
77847 float num4 = (float)Math.PI * 2f * Main.rand.NextFloat();
77848 Vector2 vector = new Vector2(22f, 22f);
77849 for (float num5 = 0f; num5 < num3; num5 += 1f)
77850 {
77851 Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 229)];
77852 Vector2 vector2 = Vector2.UnitY.RotatedBy(num5 * ((float)Math.PI * 2f) / num3 + num4);
77853 dust.position = base.Center + vector2 * vector / 2f;
77854 dust.velocity = vector2;
77855 dust.noGravity = true;
77856 dust.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77857 dust.velocity *= dust.scale;
77858 dust.fadeIn = Main.rand.NextFloat() * 2f;
77859 }
77860 }
77861 if (oldType == 428 && newType == 427)
77862 {
77863 for (int j = 0; j < 20; j++)
77864 {
77865 int num6 = Utils.SelectRandom<int>(Main.rand, 229, 240);
77866 Dust dust2 = Main.dust[Dust.NewDust(position, width, height, num6)];
77867 dust2.noGravity = true;
77868 dust2.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77869 dust2.fadeIn = 0.25f;
77870 dust2.velocity *= dust2.scale / 2f;
77871 }
77872 }
77873 if (oldType == 427 && newType == 426)
77874 {
77875 for (int k = 0; k < 30; k++)
77876 {
77877 int num7 = Utils.SelectRandom<int>(Main.rand, 229, 240, 240);
77878 Dust dust3 = Main.dust[Dust.NewDust(position, width, height, num7)];
77879 dust3.noGravity = true;
77880 dust3.scale = 0.6f + Main.rand.NextFloat() * 1.8f;
77881 dust3.fadeIn = 0.25f;
77882 dust3.velocity *= dust3.scale * 0.75f;
77883 }
77884 }
77885 position -= netOffset;
77886 }
77887
77888 public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0)
77889 {
77890 int extraInfo2 = 0;
77891 if (Style == 4)
77892 {
77893 extraInfo2 = lastPortalColorIndex;
77894 }
77895 float dustCountMult = ((teleportTime > 0f) ? 0.3f : 1f);
77896 Vector2 otherPosition = position;
77898 position = newPos;
77899 if (Style == 4)
77900 {
77901 lastPortalColorIndex = extraInfo;
77902 extraInfo2 = lastPortalColorIndex;
77903 }
77905 teleportTime = 1f;
77906 teleportStyle = Style;
77907 if (Main.netMode == 2 && Style != 4)
77908 {
77909 NetMessage.SendData(65, -1, -1, null, 1, whoAmI, newPos.X, newPos.Y, Style);
77910 }
77911 }
77912
77913 public void Transform(int newType)
77914 {
77915 if (Main.netMode != 1)
77916 {
77917 int num = extraValue;
77918 bool flag = false;
77919 if (value == 0f)
77920 {
77921 flag = true;
77922 }
77923 int[] array = new int[maxBuffs];
77924 int[] array2 = new int[maxBuffs];
77925 for (int i = 0; i < maxBuffs; i++)
77926 {
77927 array[i] = buffType[i];
77928 array2[i] = buffTime[i];
77929 }
77930 float num2 = shimmerTransparency;
77931 _ = height;
77932 int oldType = type;
77933 int num3 = life;
77934 int num4 = lifeMax;
77935 Vector2 vector = velocity;
77936 position.Y += height;
77937 int num5 = spriteDirection;
77938 bool spawnedFromStatue = SpawnedFromStatue;
77939 SetDefaultsKeepPlayerInteraction(newType);
77940 SpawnedFromStatue = spawnedFromStatue;
77941 spriteDirection = num5;
77942 TargetClosest();
77943 velocity = vector;
77944 position.Y -= height;
77945 for (int j = 0; j < maxBuffs; j++)
77946 {
77947 buffType[j] = array[j];
77948 buffTime[j] = array2[j];
77949 }
77950 if (flag)
77951 {
77952 value = 0f;
77953 }
77954 if (lifeMax == num4)
77955 {
77956 life = num3;
77957 }
77958 shimmerTransparency = num2;
77959 switch (newType)
77960 {
77961 case 107:
77962 case 108:
77963 case 124:
77964 case 353:
77965 case 369:
77966 case 550:
77967 case 588:
77968 case 679:
77969 case 680:
77970 case 683:
77971 case 684:
77972 UpdateHomeTileState(homeless: true, (int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)height) / 16);
77973 break;
77974 }
77975 extraValue = num;
77976 if (Main.netMode == 2)
77977 {
77978 netUpdate = true;
77979 NetMessage.SendData(23, -1, -1, null, whoAmI);
77980 NetMessage.SendData(54, -1, -1, null, whoAmI);
77981 }
77982 TransformVisuals(oldType, newType);
77983 GiveTownUniqueDataToNPCsThatNeedIt(type, whoAmI);
77984 if (townNPC)
77985 {
77986 homeless = true;
77988 }
77989 altTexture = 0;
77990 }
77991 }
77992
77993 public int checkArmorPenetration(int armorPenetration, float armorPenetrationPercent)
77994 {
77995 if (ichor)
77996 {
77997 armorPenetration += 15;
77998 }
77999 if (betsysCurse)
78000 {
78001 armorPenetration += 40;
78002 }
78003 armorPenetration += (int)((float)defense * armorPenetrationPercent);
78004 if (armorPenetration <= 0 || defense <= 0)
78005 {
78006 return 0;
78007 }
78008 if (armorPenetration > defense)
78009 {
78010 return defense / 2;
78011 }
78012 return armorPenetration / 2;
78013 }
78014
78015 public double StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection, bool crit = false, bool noEffect = false, bool fromNet = false)
78016 {
78017 if (Main.netMode == 0)
78018 {
78019 ignorePlayerInteractions++;
78020 }
78021 return StrikeNPC(Damage, knockBack, hitDirection, crit, noEffect, fromNet);
78022 }
78023
78024 public double StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit = false, bool noEffect = false, bool fromNet = false)
78025 {
78026 bool flag = Main.netMode == 0;
78027 if (flag && ignorePlayerInteractions > 0)
78028 {
78029 ignorePlayerInteractions--;
78030 flag = false;
78031 }
78032 if (!active || life <= 0)
78033 {
78034 return 0.0;
78035 }
78036 double num = Damage;
78037 num = Main.CalculateDamageNPCsTake((int)num, defense);
78038 if (crit)
78039 {
78040 num *= 2.0;
78041 }
78042 if (takenDamageMultiplier > 1f)
78043 {
78044 num *= (double)takenDamageMultiplier;
78045 }
78046 if ((takenDamageMultiplier > 1f || Damage != 9999) && lifeMax > 1)
78047 {
78048 if (friendly)
78049 {
78050 Color color = (crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly);
78051 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), color, (int)num, crit);
78052 }
78053 else
78054 {
78055 Color color2 = (crit ? CombatText.DamagedHostileCrit : CombatText.DamagedHostile);
78056 if (fromNet)
78057 {
78058 color2 = (crit ? CombatText.OthersDamagedHostileCrit : CombatText.OthersDamagedHostile);
78059 }
78060 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), color2, (int)num, crit);
78061 }
78062 }
78063 if (num >= 1.0)
78064 {
78065 if (flag)
78066 {
78067 PlayerInteraction(Main.myPlayer);
78068 }
78069 justHit = true;
78070 if ((type == 438 || type == 379) && Main.netMode != 1)
78071 {
78072 int num2 = (int)(0f - ai[3] - 1f);
78073 if (num2 > -1 && Main.npc[num2].localAI[0] == 0f)
78074 {
78075 Main.npc[num2].localAI[0] = 1f;
78076 }
78077 }
78078 if (townNPC)
78079 {
78080 if (aiStyle == 7 && (ai[0] == 3f || ai[0] == 4f || ai[0] == 16f || ai[0] == 17f))
78081 {
78082 NPC nPC = Main.npc[(int)ai[2]];
78083 if (nPC.active)
78084 {
78085 nPC.ai[0] = 1f;
78086 nPC.ai[1] = 300 + Main.rand.Next(300);
78087 nPC.ai[2] = 0f;
78088 nPC.localAI[3] = 0f;
78089 nPC.direction = hitDirection;
78090 nPC.netUpdate = true;
78091 }
78092 }
78093 ai[0] = 1f;
78094 ai[1] = 300 + Main.rand.Next(300);
78095 ai[2] = 0f;
78096 localAI[3] = 0f;
78097 direction = hitDirection;
78098 netUpdate = true;
78099 }
78100 if (aiStyle == 8 && Main.netMode != 1)
78101 {
78102 if (type == 172)
78103 {
78104 ai[0] = 450f;
78105 }
78106 else if (type == 283 || type == 284)
78107 {
78108 if (Main.rand.Next(2) == 0)
78109 {
78110 ai[0] = 390f;
78111 netUpdate = true;
78112 }
78113 }
78114 else if (type == 533)
78115 {
78116 if (Main.rand.Next(3) != 0)
78117 {
78118 ai[0] = 181f;
78119 netUpdate = true;
78120 }
78121 }
78122 else
78123 {
78124 ai[0] = 400f;
78125 }
78126 TargetClosest();
78127 }
78128 if (aiStyle == 97 && Main.netMode != 1)
78129 {
78130 localAI[1] = 1f;
78131 TargetClosest();
78132 }
78133 if (type == 371)
78134 {
78135 num = 0.0;
78136 ai[0] = 1f;
78137 ai[1] = 4f;
78138 dontTakeDamage = true;
78139 }
78140 if (type == 346 && (double)life >= (double)lifeMax * 0.5 && (double)life - num < (double)lifeMax * 0.5)
78141 {
78142 Gore.NewGore(position, velocity, 517);
78143 }
78144 if (type == 184)
78145 {
78146 localAI[0] = 60f;
78147 }
78148 if (type == 535)
78149 {
78150 localAI[0] = 60f;
78151 }
78152 if (type == 185)
78153 {
78154 localAI[0] = 1f;
78155 }
78156 if (!immortal)
78157 {
78158 if (realLife >= 0)
78159 {
78160 Main.npc[realLife].life -= (int)num;
78161 life = Main.npc[realLife].life;
78162 lifeMax = Main.npc[realLife].lifeMax;
78163 }
78164 else
78165 {
78166 life -= (int)num;
78167 }
78168 }
78169 if (knockBack > 0f && knockBackResist > 0f)
78170 {
78171 float num3 = knockBack * knockBackResist;
78172 if (onFire2)
78173 {
78174 num3 *= 1.1f;
78175 }
78176 if (num3 > 8f)
78177 {
78178 float num4 = num3 - 8f;
78179 num4 *= 0.9f;
78180 num3 = 8f + num4;
78181 }
78182 if (num3 > 10f)
78183 {
78184 float num5 = num3 - 10f;
78185 num5 *= 0.8f;
78186 num3 = 10f + num5;
78187 }
78188 if (num3 > 12f)
78189 {
78190 float num6 = num3 - 12f;
78191 num6 *= 0.7f;
78192 num3 = 12f + num6;
78193 }
78194 if (num3 > 14f)
78195 {
78196 float num7 = num3 - 14f;
78197 num7 *= 0.6f;
78198 num3 = 14f + num7;
78199 }
78200 if (num3 > 16f)
78201 {
78202 num3 = 16f;
78203 }
78204 if (crit)
78205 {
78206 num3 *= 1.4f;
78207 }
78208 int num8 = (int)num * 10;
78209 if (Main.expertMode)
78210 {
78211 num8 = (int)num * 15;
78212 }
78213 if (num8 > lifeMax)
78214 {
78216 {
78217 if (velocity.X > 0f)
78218 {
78219 velocity.X -= num3;
78220 }
78221 velocity.X -= num3;
78222 if (velocity.X < 0f - num3)
78223 {
78224 velocity.X = 0f - num3;
78225 }
78226 }
78227 else if (hitDirection > 0 && velocity.X < num3)
78228 {
78229 if (velocity.X < 0f)
78230 {
78231 velocity.X += num3;
78232 }
78233 velocity.X += num3;
78234 if (velocity.X > num3)
78235 {
78236 velocity.X = num3;
78237 }
78238 }
78239 if (type == 185)
78240 {
78241 num3 *= 1.5f;
78242 }
78243 num3 = (noGravity ? (num3 * -0.5f) : (num3 * -0.75f));
78244 if (velocity.Y > num3)
78245 {
78246 velocity.Y += num3;
78247 if (velocity.Y < num3)
78248 {
78249 velocity.Y = num3;
78250 }
78251 }
78252 }
78253 else
78254 {
78255 if (!noGravity)
78256 {
78257 velocity.Y = (0f - num3) * 0.75f * knockBackResist;
78258 }
78259 else
78260 {
78261 velocity.Y = (0f - num3) * 0.5f * knockBackResist;
78262 }
78263 velocity.X = num3 * (float)hitDirection * knockBackResist;
78264 }
78265 }
78266 if ((type == 113 || type == 114) && life <= 0)
78267 {
78268 for (int i = 0; i < 200; i++)
78269 {
78270 if (Main.npc[i].active && (Main.npc[i].type == 113 || Main.npc[i].type == 114))
78271 {
78272 Main.npc[i].HitEffect(hitDirection, num);
78273 }
78274 }
78275 }
78276 else
78277 {
78278 HitEffect(hitDirection, num);
78279 }
78280 if (HitSound != null)
78281 {
78282 SoundEngine.PlaySound(HitSound, position);
78283 }
78284 if (realLife >= 0)
78285 {
78286 Main.npc[realLife].checkDead();
78287 }
78288 else
78289 {
78290 checkDead();
78291 }
78292 return num;
78293 }
78294 return 0.0;
78295 }
78296
78297 public static void LadyBugKilled(Vector2 Position, bool GoldLadyBug = false)
78298 {
78299 Main.ladyBugRainBoost += ladyBugRainTime;
78300 if (Main.ladyBugRainBoost > maximumAmountOfTimesLadyBugRainCanStack)
78301 {
78302 Main.ladyBugRainBoost = maximumAmountOfTimesLadyBugRainCanStack;
78303 }
78304 int myPlayer = Main.myPlayer;
78305 if (!Main.player[myPlayer].active || Main.player[myPlayer].dead)
78306 {
78307 return;
78308 }
78309 Vector2 vector = Position - Main.player[myPlayer].Center;
78310 int num = 400;
78311 if (vector.Length() < (float)num)
78312 {
78313 if (vector.Length() < 100f)
78314 {
78315 vector = default(Vector2);
78316 }
78317 double num2 = 1.0 - (double)vector.Length() / (double)num;
78318 int num3 = (int)((double)ladyBugBadLuckTime * num2);
78319 if (GoldLadyBug)
78320 {
78321 num3 *= 2;
78322 }
78323 if (num3 < Main.player[myPlayer].ladyBugLuckTimeLeft)
78324 {
78325 Main.player[myPlayer].ladyBugLuckTimeLeft = num3;
78326 Main.player[myPlayer].luckNeedsSync = true;
78327 }
78328 }
78329 }
78330
78331 private void LadyBugLuck(int plr, bool GoldLadyBug = false)
78332 {
78333 if (releaseOwner != 255 || Main.player[plr].ladyBugLuckTimeLeft < 0)
78334 {
78335 return;
78336 }
78337 Vector2 vector = base.Center - Main.player[plr].Center;
78338 int num = 800;
78339 if (vector.Length() < (float)num)
78340 {
78341 if (vector.Length() < 30f)
78342 {
78343 vector = default(Vector2);
78344 }
78345 double x = 1.0 - (double)vector.Length() / (double)num;
78346 x = Math.Pow(x, 6.0);
78347 int num2 = (int)((double)ladyBugGoodLuckTime * x);
78348 if (GoldLadyBug)
78349 {
78350 num2 *= 2;
78351 }
78352 if (num2 > Main.player[plr].ladyBugLuckTimeLeft)
78353 {
78354 Main.player[plr].ladyBugLuckTimeLeft = num2;
78355 Main.player[plr].luckNeedsSync = true;
78356 }
78357 }
78358 }
78359
78360 private void NPCLuck()
78361 {
78362 int myPlayer = Main.myPlayer;
78363 if (type == 22)
78364 {
78365 if (Main.player[myPlayer].ladyBugLuckTimeLeft >= 0 && Main.player[myPlayer].active && !Main.player[myPlayer].dead)
78366 {
78367 int num = ladyBugGoodLuckTime / 3;
78368 if (num > Main.player[myPlayer].ladyBugLuckTimeLeft)
78369 {
78370 Main.player[myPlayer].ladyBugLuckTimeLeft = num;
78371 Main.player[myPlayer].luckNeedsSync = true;
78372 }
78373 }
78374 }
78375 else if (type != 54 && Main.player[myPlayer].active && !Main.player[myPlayer].dead)
78376 {
78377 int num2 = ladyBugBadLuckTime / 3;
78378 if (num2 < Main.player[myPlayer].ladyBugLuckTimeLeft)
78379 {
78380 Main.player[myPlayer].ladyBugLuckTimeLeft = num2;
78381 Main.player[myPlayer].luckNeedsSync = true;
78382 }
78383 }
78384 }
78385
78386 public void HitEffect(int hitDirection = 0, double dmg = 10.0)
78387 {
78388 //IL_24fe: Unknown result type (might be due to invalid IL or missing references)
78389 //IL_251d: Unknown result type (might be due to invalid IL or missing references)
78390 //IL_26fd: Unknown result type (might be due to invalid IL or missing references)
78391 if (!active)
78392 {
78393 return;
78394 }
78395 if (townNPC && life <= 0 && UsesPartyHat())
78396 {
78397 bool isShimmerVariant = IsShimmerVariant;
78398 bool flag = true;
78399 switch (type)
78400 {
78401 case 38:
78402 Gore.NewGore(position, velocity, IsShimmerVariant ? 1298 : 927);
78403 break;
78404 case 207:
78405 Gore.NewGore(position, velocity, IsShimmerVariant ? 1305 : 928);
78406 break;
78407 case 17:
78408 Gore.NewGore(position, velocity, IsShimmerVariant ? 1321 : 929);
78409 break;
78410 case 18:
78411 Gore.NewGore(position, velocity, IsShimmerVariant ? 1325 : 930);
78412 break;
78413 case 227:
78414 Gore.NewGore(position, velocity, IsShimmerVariant ? 1331 : 931);
78415 break;
78416 case 229:
78417 if (!IsShimmerVariant)
78418 {
78419 Gore.NewGore(position, velocity, 932);
78420 }
78421 break;
78422 case 142:
78423 Gore.NewGore(position, velocity, IsShimmerVariant ? 1339 : 933);
78424 break;
78425 case 453:
78426 Gore.NewGore(position, velocity, IsShimmerVariant ? 1343 : 934);
78427 break;
78428 case 178:
78429 Gore.NewGore(position, velocity, IsShimmerVariant ? 1348 : 935);
78430 break;
78431 case 353:
78432 Gore.NewGore(position, velocity, IsShimmerVariant ? 1351 : 936);
78433 break;
78434 case 368:
78435 Gore.NewGore(position, velocity, IsShimmerVariant ? 1363 : 937);
78436 break;
78437 case 108:
78438 Gore.NewGore(position, velocity, IsShimmerVariant ? 1373 : 938);
78439 break;
78440 case 588:
78441 Gore.NewGore(position, velocity, IsShimmerVariant ? 1311 : 1112);
78442 break;
78443 default:
78444 flag = false;
78445 break;
78446 }
78447 if (flag)
78448 {
78449 int num = 926;
78450 switch (GetPartyHatColor())
78451 {
78452 case PartyHatColor.Cyan:
78453 num = 940;
78454 break;
78455 case PartyHatColor.Pink:
78456 num = 939;
78457 break;
78458 case PartyHatColor.Purple:
78459 num = 941;
78460 break;
78461 case PartyHatColor.White:
78462 num = 942;
78463 break;
78464 }
78465 Gore.NewGore(position, velocity, num);
78466 }
78467 }
78468 if (daybreak && life <= 0)
78469 {
78470 Rectangle hitbox = base.Hitbox;
78471 for (int i = 0; i < 20; i++)
78472 {
78473 int num2 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
78474 int num3 = Dust.NewDust(hitbox.TopLeft(), width, height, num2, 0f, -2.5f);
78475 Main.dust[num3].alpha = 200;
78476 Dust dust = Main.dust[num3];
78477 dust.velocity *= 1.4f;
78478 dust = Main.dust[num3];
78479 dust.scale += Main.rand.NextFloat();
78480 }
78481 if (Main.netMode != 1)
78482 {
78483 for (int j = 0; j < 200; j++)
78484 {
78485 NPC nPC = Main.npc[j];
78486 if (nPC.active && !nPC.buffImmune[189] && Distance(nPC.Center) < 100f && !nPC.dontTakeDamage && nPC.lifeMax > 5 && !nPC.friendly && !nPC.townNPC)
78487 {
78488 nPC.AddBuff(189, 300);
78489 }
78490 }
78491 }
78492 }
78493 if (type == 686 && life <= 0)
78494 {
78495 short num4 = 1143;
78496 Vector2 vector = base.Bottom + (-Vector2.UnitY * 50f).RotatedBy(rotation);
78497 for (int k = 0; k < 3; k++)
78498 {
78499 Vector2 vector2 = vector + Main.rand.NextVector2Circular(15f, 15f);
78500 Gore gore = Gore.NewGorePerfect(vector2, Main.rand.NextVector2Circular(2f, 2f), num4 + Main.rand.Next(3));
78501 gore.velocity.Y -= Main.rand.NextFloat();
78502 Gore gore2 = gore;
78503 gore2.velocity *= 4f;
78504 }
78505 for (int l = 0; l < 1; l++)
78506 {
78507 Vector2 vector3 = base.Bottom + (-Vector2.UnitY * 50f).RotatedBy(rotation) + Main.rand.NextVector2Circular(5f, 5f);
78508 Gore gore3 = Gore.NewGorePerfect(vector3, Main.rand.NextVector2Circular(2f, 2f), 1146);
78509 gore3.velocity.Y -= Main.rand.NextFloat();
78510 Gore gore2 = gore3;
78511 gore2.velocity *= 4f;
78512 }
78513 if (Main.netMode != 1)
78514 {
78515 Vector2 vector4 = base.Bottom + new Vector2(0f, 48f);
78516 Vector2 vector5 = velocity;
78517 Transform(680);
78518 position = vector4;
78519 velocity = vector5;
78520 netUpdate = true;
78521 if (!unlockedSlimePurpleSpawn)
78522 {
78523 unlockedSlimePurpleSpawn = true;
78524 if (Main.netMode == 2)
78525 {
78527 }
78528 }
78529 }
78530 }
78531 if (type == 594 && life <= 0)
78532 {
78533 int num5 = 1125;
78534 num5 += (int)(ai[2] - 1f) * 3;
78535 Vector2 vector6 = base.Bottom + (-Vector2.UnitY * 50f).RotatedBy(rotation);
78536 for (int m = 0; m < 3; m++)
78537 {
78538 Vector2 vector7 = vector6 + Main.rand.NextVector2Circular(15f, 15f);
78539 Gore gore4 = Gore.NewGorePerfect(vector7, Main.rand.NextVector2Circular(2f, 2f), num5 + Main.rand.Next(3));
78540 gore4.velocity.Y -= Main.rand.NextFloat();
78541 Gore gore2 = gore4;
78542 gore2.velocity *= 4f;
78543 }
78544 for (int n = 0; n < 1; n++)
78545 {
78546 Vector2 vector8 = base.Bottom + (-Vector2.UnitY * 50f).RotatedBy(rotation) + Main.rand.NextVector2Circular(5f, 5f);
78547 Gore gore5 = Gore.NewGorePerfect(vector8, Main.rand.NextVector2Circular(2f, 2f), 1146);
78548 gore5.velocity.Y -= Main.rand.NextFloat();
78549 Gore gore2 = gore5;
78550 gore2.velocity *= 4f;
78551 }
78552 NPC nPC2 = AI_113_WindyBalloon_GetSlaveNPC();
78553 if (nPC2 != null)
78554 {
78555 nPC2.ai[0] = 0f;
78556 nPC2.position.Y -= 10f;
78557 nPC2.netUpdate = true;
78558 }
78559 }
78560 if (type == 661)
78561 {
78562 if (life > 0)
78563 {
78564 for (int num6 = 0; (double)num6 < dmg / (double)lifeMax * 100.0; num6++)
78565 {
78566 if (Main.rand.Next(5) == 0)
78567 {
78568 int num7 = 1;
78569 Color newColor = Main.hslToRgb((float)num6 / 100f % 1f, 1f, 0.5f) * 0.5f;
78570 int num8 = Dust.NewDust(position, width, height, 267, 0f, 0f, 0, newColor);
78571 Main.dust[num8].position = base.Center + Main.rand.NextVector2Circular(width, height);
78572 Main.dust[num8].velocity = Main.dust[num8].position - base.Center;
78573 Main.dust[num8].noGravity = true;
78574 Main.dust[num8].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * (float)num7;
78575 Main.dust[num8].scale = 0.35f;
78576 if (num8 != 6000)
78577 {
78579 Dust dust = dust2;
78580 dust.scale /= 2f;
78581 dust = dust2;
78582 dust.fadeIn *= 0.85f;
78583 dust2.color = new Color(255, 255, 255, 255) * 0.5f;
78584 }
78585 }
78586 }
78587 }
78588 else
78589 {
78590 for (int num9 = 0; (float)num9 < 100f; num9++)
78591 {
78592 if (Main.rand.Next(5) == 0)
78593 {
78594 int num10 = 1;
78595 Color newColor2 = Main.hslToRgb((float)num9 / 100f % 1f, 1f, 0.5f) * 0.5f;
78596 int num11 = Dust.NewDust(position, width, height, 267, 0f, 0f, 0, newColor2);
78597 Main.dust[num11].position = base.Center + Main.rand.NextVector2Circular(width, height);
78598 Main.dust[num11].velocity = (Main.dust[num11].position - base.Center) * 0.6f;
78599 Main.dust[num11].noGravity = true;
78600 Main.dust[num11].fadeIn = 0.7f + Main.rand.NextFloat() * 1.1f * (float)num10;
78601 Main.dust[num11].scale = 0.35f;
78602 if (num11 != 6000)
78603 {
78605 Dust dust = dust3;
78606 dust.scale /= 2f;
78607 dust = dust3;
78608 dust.fadeIn *= 0.85f;
78609 dust3.color = new Color(255, 255, 255, 255) * 0.5f;
78610 }
78611 }
78612 }
78613 }
78614 }
78615 if (type == 521)
78616 {
78617 if (life > 0)
78618 {
78619 for (int num12 = 0; (double)num12 < dmg / (double)lifeMax * 200.0; num12++)
78620 {
78621 Dust dust4 = Dust.NewDustDirect(position, width, height, 228, 6 * hitDirection, velocity.Y, 0, Color.Transparent, 3f);
78622 dust4.noGravity = true;
78623 Dust dust = dust4;
78624 dust.velocity *= 5f;
78625 }
78626 }
78627 else
78628 {
78629 for (int num13 = 0; (float)num13 < 200f; num13++)
78630 {
78631 Dust dust5 = Dust.NewDustDirect(position, width, height, 228, 6 * hitDirection, velocity.Y, 0, Color.Transparent, 3f);
78632 dust5.noGravity = true;
78633 Dust dust = dust5;
78634 dust.velocity *= 5f;
78635 }
78636 }
78637 }
78638 if (type == 668)
78639 {
78640 if (life > 0)
78641 {
78642 for (int num14 = 0; (double)num14 < dmg / (double)lifeMax * 100.0; num14++)
78643 {
78644 Dust.NewDust(position, width, height, 5, hitDirection, -1f, 0, default(Color), 1.2f);
78645 }
78646 }
78647 else
78648 {
78649 int num15 = 15;
78650 Vector2 vector9 = position - new Vector2(num15, num15);
78651 for (int num16 = 0; num16 < 120; num16++)
78652 {
78653 int num17 = Dust.NewDust(vector9, width + num15 * 2, height + num15 * 2, 5, 0f, 0f, 0, default(Color), 1.5f);
78654 Main.dust[num17].velocity = Main.rand.NextVector2Circular(4f, 4f);
78655 }
78656 Vector2 vector10 = velocity * 0.6f;
78657 Gore.NewGore(base.Bottom + new Vector2(-10f, 0f), vector10, 1274, scale);
78658 Gore.NewGore(base.Bottom + new Vector2(10f, 0f), vector10, 1274, scale);
78659 Gore.NewGore(base.Center, vector10, 1272, scale);
78660 Gore.NewGore(base.Center + new Vector2(-10f, 0f), vector10, 1273, scale);
78661 Gore.NewGore(base.Center + new Vector2(10f, 0f), vector10, 1273, scale);
78662 Gore.NewGore(base.Top, vector10, 1270, scale);
78663 Gore.NewGore(base.Top, vector10, 1271, scale);
78664 }
78665 }
78666 if (type == 636)
78667 {
78668 if (life > 0)
78669 {
78670 for (int num18 = 0; (double)num18 < dmg / (double)lifeMax * 100.0; num18++)
78671 {
78672 if (Main.rand.Next(2) == 0)
78673 {
78674 Dust.NewDust(position, width, height, 67, hitDirection, -1f);
78675 }
78676 else
78677 {
78678 Dust.NewDust(position, width, height, 69, hitDirection, -1f);
78679 }
78680 }
78681 }
78682 else
78683 {
78684 for (int num19 = 0; num19 < 50; num19++)
78685 {
78686 if (Main.rand.Next(2) == 0)
78687 {
78688 Dust.NewDust(position, width, height, 67, hitDirection, -1f);
78689 }
78690 else
78691 {
78692 Dust.NewDust(position, width, height, 69, 2 * hitDirection, -1f);
78693 }
78694 }
78695 Vector2 vector11 = velocity * 0.6f;
78696 Gore.NewGore(position + new Vector2(10f, -20f), vector11, 1262, scale);
78697 Gore.NewGore(position + new Vector2(10f, 40f), vector11, 1263, scale);
78698 Gore.NewGore(position + new Vector2(50f, 20f), vector11, 1264, scale);
78699 Gore.NewGore(position + new Vector2(-10f, -20f), vector11, 1265, scale);
78700 Gore.NewGore(position, vector11, 1266, scale);
78701 Gore.NewGore(position + new Vector2(-20f, -20f), vector11, 1267, scale);
78702 Gore.NewGore(position + new Vector2(-20f, 10f), vector11, 1268, scale);
78703 Gore.NewGore(position + new Vector2(60f, -20f), vector11, 1267, scale);
78704 Gore.NewGore(position + new Vector2(60f, 10f), vector11, 1268, scale);
78705 }
78706 }
78707 if (type == 657)
78708 {
78709 if (life <= 0)
78710 {
78711 Gore.NewGore(position, velocity, 1259, 0.8f);
78712 Gore.NewGore(position + base.Size * 0.5f, velocity, 1259, 0.8f);
78713 Gore.NewGore(position, velocity, 1258, scale);
78714 int num20 = 10;
78715 for (int num21 = 0; num21 < 150; num21++)
78716 {
78717 Color newColor3 = AI_121_QueenSlime_GetDustColor();
78718 newColor3.A = 200;
78719 int num22 = Dust.NewDust(position - new Vector2(num20, num20), width + num20 * 2, height + num20 * 2, 4, 8f * Main.rand.NextFloatDirection(), -2f + 6f * Main.rand.NextFloatDirection(), 50, newColor3, 1f + Main.rand.NextFloat() * 0.5f);
78720 Dust dust = Main.dust[num22];
78721 dust.velocity *= 0.65f;
78722 dust = Main.dust[num22];
78723 dust.velocity += velocity * 0.5f;
78724 if (Main.rand.Next(5) == 0)
78725 {
78726 Main.dust[num22].noGravity = true;
78727 dust = Main.dust[num22];
78728 dust.scale *= 1.2f;
78729 }
78730 }
78731 }
78732 else
78733 {
78734 for (int num23 = 0; num23 < 12; num23++)
78735 {
78736 Color newColor4 = AI_121_QueenSlime_GetDustColor();
78737 newColor4.A = 150;
78738 int num24 = Dust.NewDust(position, width, height, 4, 2 * hitDirection, -1f, 50, newColor4);
78739 Dust dust = Main.dust[num24];
78740 dust.velocity *= 0.3f;
78741 dust = Main.dust[num24];
78742 dust.velocity += velocity * 0.3f;
78743 if (Main.rand.Next(3) == 0)
78744 {
78745 Main.dust[num24].noGravity = true;
78746 dust = Main.dust[num24];
78747 dust.scale *= 1.2f;
78748 }
78749 }
78750 }
78751 }
78752 if (type >= 658 && type <= 660)
78753 {
78754 int num25 = 7;
78755 float num26 = 1f;
78756 int num27 = 4;
78757 Color newColor5 = new Color(78, 136, 255, 150);
78758 if (type == 659)
78759 {
78760 num27 = 243;
78761 newColor5 = default(Color);
78762 }
78763 if (type == 660)
78764 {
78765 newColor5 = new Color(150, 100, 200, 150);
78766 }
78767 if (life <= 0)
78768 {
78769 num26 = 1.5f;
78770 num25 = 40;
78771 if (type == 660)
78772 {
78773 Gore.NewGore(position, velocity, 1260, scale);
78774 Gore.NewGore(position, velocity, 1260, scale);
78775 }
78776 }
78777 for (int num28 = 0; num28 < num25; num28++)
78778 {
78779 int num29 = Dust.NewDust(position, width, height, num27, 2 * hitDirection, -1f, 80, newColor5, num26);
78780 if (Main.rand.Next(3) != 0)
78781 {
78782 Main.dust[num29].noGravity = true;
78783 }
78784 }
78785 }
78786 if (type == 667)
78787 {
78788 int num30 = 7;
78789 float num31 = 1.1f;
78790 int num32 = 10;
78791 Color newColor6 = default(Color);
78792 if (life <= 0)
78793 {
78794 num31 = 1.5f;
78795 num30 = 40;
78796 for (int num33 = 0; num33 < 8; num33++)
78797 {
78798 int num34 = Gore.NewGore(new Vector2(position.X, base.Center.Y - 10f), Vector2.Zero, 1218);
78799 Main.gore[num34].velocity = new Vector2((float)Main.rand.Next(1, 10) * 0.3f * 2.5f * (float)hitDirection, 0f - (3f + (float)Main.rand.Next(4) * 0.3f));
78800 }
78801 }
78802 else
78803 {
78804 for (int num35 = 0; num35 < 3; num35++)
78805 {
78806 int num36 = Gore.NewGore(new Vector2(position.X, base.Center.Y - 10f), Vector2.Zero, 1218);
78807 Main.gore[num36].velocity = new Vector2((float)Main.rand.Next(1, 10) * 0.3f * 2f * (float)hitDirection, 0f - (2.5f + (float)Main.rand.Next(4) * 0.3f));
78808 }
78809 }
78810 for (int num37 = 0; num37 < num30; num37++)
78811 {
78812 int num38 = Dust.NewDust(position, width, height, num32, 2 * hitDirection, -1f, 80, newColor6, num31);
78813 if (Main.rand.Next(3) != 0)
78814 {
78815 Main.dust[num38].noGravity = true;
78816 }
78817 }
78818 }
78819 if (type == 676)
78820 {
78821 int num39 = 8;
78822 float num40 = 1.1f;
78823 short num41 = 310;
78824 if (life <= 0)
78825 {
78826 num40 = 1.5f;
78827 num39 = 40;
78828 }
78829 for (int num42 = 0; num42 < num39; num42++)
78830 {
78831 Dust dust6 = Main.dust[Dust.NewDust(position, width, height, num41, 2 * hitDirection, -1f, 80, default(Color), num40)];
78832 if (Main.rand.Next(3) != 0)
78833 {
78834 dust6.noGravity = true;
78835 }
78836 Dust dust = dust6;
78837 dust.velocity *= 1.5f;
78838 dust = dust6;
78839 dust.velocity += velocity * 0.1f;
78840 }
78841 }
78842 if (type == 552 || type == 553 || type == 554)
78843 {
78844 if (life > 0)
78845 {
78846 for (int num43 = 0; (double)num43 < dmg / (double)lifeMax * 20.0; num43++)
78847 {
78848 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78849 }
78850 }
78851 else
78852 {
78853 for (int num44 = 0; (float)num44 < 20f; num44++)
78854 {
78855 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78856 }
78857 int num45 = 983;
78858 if (type == 553)
78859 {
78860 num45 = 1067;
78861 }
78862 else if (type == 554)
78863 {
78864 num45 = 1071;
78865 }
78866 Gore.NewGore(position, velocity, num45, scale);
78867 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num45 + 3, scale);
78868 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num45 + 2, scale);
78869 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num45 + 1, scale);
78870 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num45 + 1, scale);
78871 }
78872 }
78873 else if (type == 561 || type == 562 || type == 563)
78874 {
78875 if (life > 0)
78876 {
78877 for (int num46 = 0; (double)num46 < dmg / (double)lifeMax * 20.0; num46++)
78878 {
78879 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78880 }
78881 }
78882 else
78883 {
78884 for (int num47 = 0; (float)num47 < 20f; num47++)
78885 {
78886 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78887 }
78888 int num48 = 987;
78889 if (type == 562)
78890 {
78891 num48 = 1055;
78892 }
78893 else if (type == 563)
78894 {
78895 num48 = 1061;
78896 }
78897 Gore.NewGore(position, velocity, num48 + 3, scale);
78898 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num48, scale);
78899 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num48 + 4, scale);
78900 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num48 + 5, scale);
78901 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num48 + 2, scale);
78902 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num48 + 1, scale);
78903 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num48 + 1, scale);
78904 }
78905 }
78906 else if (type == 555 || type == 556 || type == 557)
78907 {
78908 if (life > 0)
78909 {
78910 for (int num49 = 0; (double)num49 < dmg / (double)lifeMax * 20.0; num49++)
78911 {
78912 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78913 }
78914 }
78915 else
78916 {
78917 int num50 = 1031;
78918 if (type == 556)
78919 {
78920 num50 = 1034;
78921 }
78922 if (type == 557)
78923 {
78924 num50 = 1037;
78925 }
78926 for (int num51 = 0; (float)num51 < 20f; num51++)
78927 {
78928 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78929 }
78930 Gore.NewGore(new Vector2(position.X, position.Y), velocity, num50, scale);
78931 Gore.NewGore(new Vector2(position.X + 10f, position.Y + 20f), velocity, num50 + 1, scale);
78932 Gore.NewGore(new Vector2(position.X + 10f, position.Y + 30f), velocity, num50 + 2, scale);
78933 }
78934 }
78935 else if (type == 551)
78936 {
78937 int num52 = (int)((float)life / (float)lifeMax * 100f);
78938 int num53 = (int)(((double)life + dmg) / (double)(float)lifeMax * 100.0);
78939 if (num52 != num53 && life > 0 && Main.netMode != 1)
78940 {
78942 }
78943 if (life > 0)
78944 {
78945 for (int num54 = 0; (double)num54 < dmg / (double)lifeMax * 20.0; num54++)
78946 {
78947 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78948 }
78949 }
78950 else
78951 {
78952 for (int num55 = 0; (float)num55 < 20f; num55++)
78953 {
78954 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78955 }
78956 if (spriteDirection != -1)
78957 {
78958 Gore.NewGore(position + new Vector2(0f, 54f), velocity, 1079, scale);
78959 Gore.NewGore(position + new Vector2(72f, 90f), velocity, 1080, scale);
78960 Gore.NewGore(position + new Vector2(102f, 94f), velocity, 1080, scale);
78961 Gore.NewGore(position + new Vector2(178f, 0f), velocity, 1081, scale);
78962 Gore.NewGore(position + new Vector2(136f, 12f), velocity, 1082, scale);
78963 Gore.NewGore(position + new Vector2(82f, 18f), velocity, 1083, scale);
78964 Gore.NewGore(position + new Vector2(100f, 26f), velocity, 1084, scale);
78965 Gore.NewGore(position + new Vector2(170f, 16f), velocity, 1085, scale);
78966 Gore.NewGore(position + new Vector2(190f, 10f), velocity, 1085, scale);
78967 Gore.NewGore(position + new Vector2(100f, 36f), velocity, 1086, scale);
78968 }
78969 else
78970 {
78971 Gore.NewGore(position + new Vector2(176f, 54f), velocity, 1079, scale);
78972 Gore.NewGore(position + new Vector2(158f, 90f), velocity, 1080, scale);
78973 Gore.NewGore(position + new Vector2(128f, 94f), velocity, 1080, scale);
78974 Gore.NewGore(position + new Vector2(0f, 0f), velocity, 1081, scale);
78975 Gore.NewGore(position + new Vector2(60f, 12f), velocity, 1082, scale);
78976 Gore.NewGore(position + new Vector2(88f, 18f), velocity, 1083, scale);
78977 Gore.NewGore(position + new Vector2(86f, 26f), velocity, 1084, scale);
78978 Gore.NewGore(position + new Vector2(40f, 16f), velocity, 1085, scale);
78979 Gore.NewGore(position + new Vector2(20f, 10f), velocity, 1085, scale);
78980 Gore.NewGore(position + new Vector2(142f, 36f), velocity, 1086, scale);
78981 }
78982 }
78983 }
78984 else if (type == 572 || type == 573)
78985 {
78986 if (life > 0)
78987 {
78988 for (int num56 = 0; (double)num56 < dmg / (double)lifeMax * 20.0; num56++)
78989 {
78990 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
78991 }
78992 }
78993 else
78994 {
78995 SoundEngine.GetActiveSound(SlotId.FromFloat(localAI[0]))?.Stop();
78996 SoundEngine.GetActiveSound(SlotId.FromFloat(localAI[1]))?.Stop();
78997 for (int num57 = 0; (float)num57 < 20f; num57++)
78998 {
78999 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79000 }
79001 Vector2 vector12 = base.Center - new Vector2(10f, 10f);
79002 Gore.NewGore(vector12, velocity, 993, scale);
79003 Gore.NewGore(new Vector2(vector12.X, vector12.Y + 20f), velocity, 996, scale);
79004 Gore.NewGore(new Vector2(vector12.X, vector12.Y + 20f), velocity, 995, scale);
79005 Gore.NewGore(new Vector2(vector12.X, vector12.Y + 34f), velocity, 994, scale);
79006 Gore.NewGore(new Vector2(vector12.X, vector12.Y + 34f), velocity, 994, scale);
79007 }
79008 }
79009 else if (type == 574 || type == 575)
79010 {
79011 if (life > 0)
79012 {
79013 for (int num58 = 0; (double)num58 < dmg / (double)lifeMax * 20.0; num58++)
79014 {
79015 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79016 }
79017 }
79018 else
79019 {
79020 SoundEngine.GetActiveSound(SlotId.FromFloat(localAI[2]))?.Stop();
79021 for (int num59 = 0; (float)num59 < 20f; num59++)
79022 {
79023 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79024 }
79025 int num60 = 1050;
79026 Vector2 vector13 = base.Center - new Vector2(30f, 10f);
79027 Gore.NewGore(new Vector2(vector13.X, vector13.Y + 10f), velocity, num60, scale);
79028 Gore.NewGore(new Vector2(vector13.X, vector13.Y + 30f), velocity, num60 + 1, scale);
79029 Gore.NewGore(new Vector2(vector13.X, vector13.Y + 30f), velocity, num60 + 2, scale);
79030 Gore.NewGore(new Vector2(vector13.X, vector13.Y + 0f), velocity, num60 + 3, scale);
79031 Gore.NewGore(new Vector2(vector13.X, vector13.Y + 0f), velocity, num60 + 4, scale);
79032 }
79033 }
79034 else if (type == 570 || type == 571)
79035 {
79036 if (life > 0)
79037 {
79038 for (int num61 = 0; (double)num61 < dmg / (double)lifeMax * 20.0; num61++)
79039 {
79040 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79041 }
79042 }
79043 else
79044 {
79045 for (int num62 = 0; (float)num62 < 20f; num62++)
79046 {
79047 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79048 }
79049 int num63 = ((type == 570) ? 1075 : 979);
79050 Gore.NewGore(position, velocity, num63, scale);
79051 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num63 + 2, scale);
79052 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num63 + 2, scale);
79053 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num63 + 3, scale);
79054 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num63 + 1, scale);
79055 }
79056 }
79057 else if (type == 568 || type == 569)
79058 {
79059 if (life > 0)
79060 {
79061 for (int num64 = 0; (double)num64 < dmg / (double)lifeMax * 20.0; num64++)
79062 {
79063 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79064 }
79065 }
79066 else
79067 {
79068 for (int num65 = 0; (float)num65 < 20f; num65++)
79069 {
79070 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79071 }
79072 Gore.NewGore(position, velocity, 1020, scale);
79073 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1021, scale);
79074 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1023, scale);
79075 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1022, scale);
79076 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1022, scale);
79077 }
79078 }
79079 else if (type == 558 || type == 559 || type == 560)
79080 {
79081 if (life > 0)
79082 {
79083 for (int num66 = 0; (double)num66 < dmg / (double)lifeMax * 20.0; num66++)
79084 {
79085 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79086 }
79087 }
79088 else
79089 {
79090 for (int num67 = 0; (float)num67 < 20f; num67++)
79091 {
79092 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79093 }
79094 int num68 = 974;
79095 if (type == 559)
79096 {
79097 num68 = 1040;
79098 }
79099 if (type == 560)
79100 {
79101 num68 = 1045;
79102 }
79103 Gore.NewGore(position, velocity, num68 + 2, scale);
79104 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, num68, scale);
79105 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, num68, scale);
79106 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, num68 + 4, scale);
79107 Gore.NewGore(new Vector2(position.X, position.Y + 24f), velocity, num68 + 1, scale);
79108 Gore.NewGore(new Vector2(position.X, position.Y + 24f), velocity, num68 + 3, scale);
79109 Gore.NewGore(new Vector2(position.X, position.Y + 24f), velocity, num68 + 3, scale);
79110 }
79111 }
79112 else if (type == 566 || type == 567)
79113 {
79114 if (life > 0)
79115 {
79116 for (int num69 = 0; (double)num69 < dmg / (double)lifeMax * 20.0; num69++)
79117 {
79118 Dust.NewDust(position, width, height, 236, hitDirection, -1f);
79119 }
79120 }
79121 else
79122 {
79123 for (int num70 = 0; (float)num70 < 20f; num70++)
79124 {
79125 Dust.NewDust(position, width, height, 236, hitDirection, -1f);
79126 }
79127 Gore.NewGore(position, velocity, 970, scale);
79128 if (Main.rand.Next(2) == 0)
79129 {
79130 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 972, scale);
79131 }
79132 if (Main.rand.Next(2) == 0)
79133 {
79134 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 972, scale);
79135 }
79136 if (Main.rand.Next(2) == 0)
79137 {
79138 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 973, scale);
79139 }
79140 if (Main.rand.Next(2) == 0)
79141 {
79142 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 973, scale);
79143 }
79144 if (Main.rand.Next(2) == 0)
79145 {
79146 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 971, scale);
79147 }
79148 if (Main.rand.Next(2) == 0)
79149 {
79150 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 971, scale);
79151 }
79152 }
79153 }
79154 else if (type == 576 || type == 577)
79155 {
79156 if (life > 0)
79157 {
79158 for (int num71 = 0; (double)num71 < dmg / (double)lifeMax * 20.0; num71++)
79159 {
79160 Dust.NewDust(position, width, height, 273, hitDirection, -1f);
79161 }
79162 }
79163 else
79164 {
79165 for (int num72 = 0; (float)num72 < 20f; num72++)
79166 {
79167 Dust.NewDust(position, width, height, 273, hitDirection, -1f);
79168 }
79169 if (spriteDirection == -1)
79170 {
79171 Gore.NewGore(position + new Vector2(0f, 0f), velocity, 1005 + ((Main.rand.Next(5) == 0) ? 1 : 0), scale);
79172 Gore.NewGore(position + new Vector2(18f, 28f), velocity, 1000, scale);
79173 int num73 = Gore.NewGore(position + new Vector2(-40f, 70f), velocity, 1001, scale);
79174 Main.gore[num73].rotation = (float)Math.PI;
79175 num73 = Gore.NewGore(position + new Vector2(4f, 28f), velocity, 1002, scale);
79176 Main.gore[num73].rotation = (float)Math.PI;
79177 Gore.NewGore(position + new Vector2(36f, 90f), velocity, 1003, scale);
79178 Gore.NewGore(position + new Vector2(32f, 90f), velocity, 1004, scale);
79179 }
79180 else
79181 {
79182 Gore.NewGore(position + new Vector2(48f, 0f), velocity, 1005 + ((Main.rand.Next(5) == 0) ? 1 : 0), scale);
79183 Gore.NewGore(position + new Vector2(22f, 28f), velocity, 1000, scale);
79184 Gore.NewGore(position + new Vector2(48f, 70f), velocity, 1001, scale);
79185 Gore.NewGore(position + new Vector2(4f, 28f), velocity, 1002, scale);
79186 Gore.NewGore(position + new Vector2(36f, 90f), velocity, 1003, scale);
79187 Gore.NewGore(position + new Vector2(32f, 90f), velocity, 1004, scale);
79188 }
79189 }
79190 }
79191 else if (type == 564 || type == 565)
79192 {
79193 if (life > 0)
79194 {
79195 for (int num74 = 0; (double)num74 < dmg / (double)lifeMax * 20.0; num74++)
79196 {
79197 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79198 }
79199 }
79200 else
79201 {
79202 for (int num75 = 0; (float)num75 < 20f; num75++)
79203 {
79204 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79205 }
79206 int num76 = 1009;
79207 Gore.NewGore(new Vector2(position.X, position.Y), velocity, num76, scale);
79208 Gore.NewGore(new Vector2(position.X, position.Y + 15f), velocity, num76 + 1, scale);
79209 Gore.NewGore(new Vector2(position.X, position.Y + 15f), velocity, num76 + 2, scale);
79210 Gore.NewGore(new Vector2(position.X, position.Y + 15f), velocity, num76 + 3, scale);
79211 Gore.NewGore(new Vector2(position.X - 20f, position.Y + 35f), velocity, num76 + 4, scale);
79212 Gore.NewGore(new Vector2(position.X, position.Y + 35f), velocity, num76 + 5, scale);
79213 Gore.NewGore(new Vector2(position.X, position.Y + 35f), velocity, num76 + 6, scale);
79214 Gore.NewGore(new Vector2(position.X, position.Y + 35f), velocity, num76 + 10, scale);
79215 Gore.NewGore(new Vector2(position.X, position.Y + 25f), velocity, num76 + 7, scale);
79216 Gore.NewGore(new Vector2(position.X, position.Y + 25f), velocity, num76 + 8, scale);
79217 Gore.NewGore(new Vector2(position.X, position.Y + 25f), velocity, num76 + 9, scale);
79218 }
79219 }
79220 else if (type == 578)
79221 {
79222 if (life > 0)
79223 {
79224 for (int num77 = 0; (double)num77 < dmg / (double)lifeMax * 20.0; num77++)
79225 {
79226 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79227 }
79228 }
79229 else
79230 {
79231 for (int num78 = 0; (float)num78 < 20f; num78++)
79232 {
79233 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
79234 }
79235 Gore.NewGore(position, velocity, 999, scale);
79236 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 998, scale);
79237 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 998, scale);
79238 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 997, scale);
79239 }
79240 }
79241 else if (type == 620)
79242 {
79243 if (life > 0)
79244 {
79245 for (int num79 = 0; (double)num79 < dmg / (double)lifeMax * 150.0; num79++)
79246 {
79247 Dust dust7 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79248 Dust dust = dust7;
79249 dust.velocity *= 2.5f;
79250 dust7.scale = 1.7f;
79251 }
79252 }
79253 else
79254 {
79255 for (int num80 = 0; (float)num80 < 150f; num80++)
79256 {
79257 Dust dust8 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79258 Dust dust = dust8;
79259 dust.velocity *= 2.5f;
79260 dust8.scale = 1.7f;
79261 }
79262 int num81 = 1183;
79263 Gore.NewGore(position, velocity, num81, scale);
79264 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num81 + 2, scale);
79265 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num81 + 3, scale);
79266 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num81 + 1, scale);
79267 }
79268 }
79269 else if (type == 619)
79270 {
79271 if (life > 0)
79272 {
79273 for (int num82 = 0; (double)num82 < dmg / (double)lifeMax * 150.0; num82++)
79274 {
79275 Dust dust9 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79276 Dust dust = dust9;
79277 dust.velocity *= 2.5f;
79278 dust9.fadeIn = 1.7f;
79279 }
79280 }
79281 else
79282 {
79283 for (int num83 = 0; (float)num83 < 150f; num83++)
79284 {
79285 Dust dust10 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79286 Dust dust = dust10;
79287 dust.velocity *= 2.5f;
79288 dust10.fadeIn = 1.7f;
79289 }
79290 int num84 = 1179;
79291 Gore.NewGore(position, velocity, num84, scale);
79292 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num84 + 2, scale);
79293 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num84 + 3, scale);
79294 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num84 + 1, scale);
79295 }
79296 }
79297 else if (type == 618)
79298 {
79299 if (life > 0)
79300 {
79301 for (int num85 = 0; (double)num85 < dmg / (double)lifeMax * 200.0; num85++)
79302 {
79303 Dust dust11 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79304 Dust dust = dust11;
79305 dust.velocity *= 2.5f;
79306 dust11.scale = 2f;
79307 }
79308 }
79309 else
79310 {
79311 for (int num86 = 0; (float)num86 < 200f; num86++)
79312 {
79313 Dust dust12 = Dust.NewDustDirect(position, width, height, 5, hitDirection, -1f);
79314 Dust dust = dust12;
79315 dust.velocity *= 2.5f;
79316 dust12.scale = 2.5f;
79317 }
79318 int num87 = 1172;
79319 Gore.NewGore(new Vector2(base.Right.X - 30f, position.Y), velocity, num87, scale);
79320 Gore.NewGore(position, velocity, num87, scale);
79321 Gore.NewGore(new Vector2(base.Right.X - 30f, position.Y), velocity, num87 + 1, scale);
79322 Gore.NewGore(position, velocity, num87 + 1, scale);
79323 Gore.NewGore(position, velocity, num87 + 2, scale);
79324 Gore.NewGore(position, velocity, num87 + 3, scale);
79325 Gore.NewGore(position, velocity, num87 + 4, scale);
79326 Gore.NewGore(position, velocity, num87 + 4, scale);
79327 Gore.NewGore(position, velocity, num87 + 5, scale);
79328 Gore.NewGore(position, velocity, num87 + 5, scale);
79329 Gore.NewGore(position, velocity, num87 + 6, scale);
79330 Gore.NewGore(position, velocity, num87 + 6, scale);
79331 }
79332 }
79333 else if (type == 541)
79334 {
79335 Color color = new Color(222, 108, 48) * 0.7f;
79336 if (life > 0)
79337 {
79338 for (int num88 = 0; (double)num88 < dmg / (double)lifeMax * 200.0; num88++)
79339 {
79340 Dust dust13 = Main.dust[Dust.NewDust(position, width, height, 268)];
79341 dust13.color = color;
79342 dust13.noGravity = true;
79343 dust13.scale = 1.5f;
79344 dust13.fadeIn = 0.7f;
79345 Dust dust = dust13;
79346 dust.velocity *= 3f;
79347 dust13 = Main.dust[Dust.NewDust(position, width, height, 268)];
79348 dust13.color = color;
79349 dust13.noGravity = true;
79350 dust13.scale = 1.5f;
79351 dust13.fadeIn = 0.7f;
79352 dust = dust13;
79353 dust.velocity *= 3f;
79354 }
79355 }
79356 else
79357 {
79358 for (int num89 = 0; num89 < 30; num89++)
79359 {
79360 Dust dust14 = Main.dust[Dust.NewDust(position, width, height, 268)];
79361 dust14.color = color;
79362 dust14.noGravity = true;
79363 dust14.scale = 1.5f;
79364 dust14.fadeIn = 0.7f;
79365 Dust dust = dust14;
79366 dust.velocity *= 3f;
79367 dust14 = Main.dust[Dust.NewDust(position, width, height, 268)];
79368 dust14.color = color;
79369 dust14.noGravity = true;
79370 dust14.scale = 1.5f;
79371 dust14.fadeIn = 0.7f;
79372 dust = dust14;
79373 dust.velocity *= 3f;
79374 }
79375 Gore.NewGore(position, velocity, 960, scale);
79376 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 961, scale);
79377 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 963, scale);
79378 Gore.NewGore(new Vector2(position.X, position.Y + 40f), velocity, 962, scale);
79379 }
79380 }
79381 else if (type == 546)
79382 {
79383 Color color2 = new Color(150, 108, 78) * 0.7f;
79384 if (life > 0)
79385 {
79386 for (int num90 = 0; (double)num90 < dmg / (double)lifeMax * 50.0; num90++)
79387 {
79388 Dust dust15 = Main.dust[Dust.NewDust(position, width, height, 268)];
79389 dust15.color = color2;
79390 dust15.noGravity = true;
79391 dust15.scale = 1.5f;
79392 dust15.fadeIn = 0.7f;
79393 Dust dust = dust15;
79394 dust.velocity *= 3f;
79395 dust15 = Main.dust[Dust.NewDust(position, width, height, 268)];
79396 dust15.color = color2;
79397 dust15.noGravity = true;
79398 dust15.scale = 1.5f;
79399 dust15.fadeIn = 0.7f;
79400 dust = dust15;
79401 dust.velocity *= 3f;
79402 }
79403 }
79404 else
79405 {
79406 for (int num91 = 0; num91 < 20; num91++)
79407 {
79408 Dust dust16 = Main.dust[Dust.NewDust(position, width, height, 268)];
79409 dust16.color = color2;
79410 dust16.noGravity = true;
79411 dust16.scale = 1.5f;
79412 dust16.fadeIn = 0.7f;
79413 Dust dust = dust16;
79414 dust.velocity *= 3f;
79415 dust16 = Main.dust[Dust.NewDust(position, width, height, 268)];
79416 dust16.color = color2;
79417 dust16.noGravity = true;
79418 dust16.scale = 1.5f;
79419 dust16.fadeIn = 0.7f;
79420 dust = dust16;
79421 dust.velocity *= 3f;
79422 }
79423 for (int num92 = 0; num92 < 20; num92++)
79424 {
79425 int num93 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
79426 Dust dust = Main.dust[num93];
79427 dust.velocity *= 2f;
79428 Main.dust[num93].noGravity = true;
79429 }
79430 Gore.NewGore(position, velocity, 964, scale);
79431 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 965, scale);
79432 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 966, scale);
79433 }
79434 }
79435 if (type == 378)
79436 {
79437 if (life > 0)
79438 {
79439 for (int num94 = 0; (double)num94 < dmg / (double)lifeMax * 50.0; num94++)
79440 {
79441 Dust.NewDust(position, width, height, 7);
79442 }
79443 }
79444 else
79445 {
79446 for (int num95 = 0; num95 < 20; num95++)
79447 {
79448 Dust.NewDust(position, width, height, 7);
79449 }
79450 }
79451 }
79452 if (type == 437 && dmg == 9999.0)
79453 {
79454 for (int num96 = 0; num96 < 6; num96++)
79455 {
79456 int num97 = Gore.NewGore(base.Center - new Vector2(10f), Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 5f, 728 + num96);
79457 }
79458 }
79459 if (type == 398 && dmg == 1337.0 && Main.netMode != 2)
79460 {
79461 MoonlordDeathDrama.ThrowPieces(base.Center, Main.rand.Next(100));
79462 }
79463 if (type == 488)
79464 {
79465 localAI[0] = (int)dmg;
79466 if (localAI[0] < 20f)
79467 {
79468 localAI[0] = 20f;
79469 }
79470 if (localAI[0] > 120f)
79471 {
79472 localAI[0] = 120f;
79473 }
79474 localAI[1] = hitDirection;
79475 }
79476 if (type == 583 || type == 584 || type == 585)
79477 {
79480 int num98 = 4;
79481 if (type == 584)
79482 {
79485 }
79486 if (type == 585)
79487 {
79490 }
79491 if (life > 0)
79492 {
79493 for (int num99 = 0; (double)num99 < dmg / (double)lifeMax * 50.0; num99++)
79494 {
79495 Dust dust17 = Dust.NewDustDirect(base.Center - new Vector2(num98) * 0.5f, num98 + 4, num98 + 4, 278, 0f, 0f, 200, Color.Lerp(value, value2, Main.rand.NextFloat()), 0.65f);
79496 dust17.noGravity = true;
79497 }
79498 }
79499 else
79500 {
79501 for (int num100 = 0; num100 < 20; num100++)
79502 {
79503 Dust dust18 = Dust.NewDustDirect(base.Center - new Vector2(num98) * 0.5f, num98 + 4, num98 + 4, 278, 0f, 0f, 200, Color.Lerp(value, value2, Main.rand.NextFloat()), 0.65f);
79504 Dust dust = dust18;
79505 dust.velocity *= 1.5f;
79506 dust18.noGravity = true;
79507 }
79508 }
79509 }
79510 else if (type >= 513 && type <= 515)
79511 {
79512 if (life > 0)
79513 {
79514 for (int num101 = 0; (double)num101 < dmg / (double)lifeMax * 100.0; num101++)
79515 {
79516 Dust.NewDust(position, width, height, 250, hitDirection, -1f, alpha, this.color, scale);
79517 }
79518 }
79519 else
79520 {
79521 for (int num102 = 0; num102 < 50; num102++)
79522 {
79523 Dust.NewDust(position, width, height, 250, hitDirection, -2f, alpha, this.color, scale);
79524 }
79525 int num103 = Gore.NewGore(position, velocity, type - 513 + 822);
79526 Main.gore[num103].alpha = alpha;
79527 }
79528 }
79529 else if (type >= 510 && type <= 512)
79530 {
79531 if (life > 0)
79532 {
79533 for (int num104 = 0; (double)num104 < dmg / (double)lifeMax * 100.0; num104++)
79534 {
79535 Dust.NewDust(position, width, height, 250, hitDirection, -1f, alpha, this.color, scale);
79536 }
79537 }
79538 else
79539 {
79540 for (int num105 = 0; num105 < 50; num105++)
79541 {
79542 Dust.NewDust(position, width, height, 250, hitDirection, -2f, alpha, this.color, scale);
79543 }
79544 int num106 = Gore.NewGore(position, velocity, type - 510 + 819);
79545 Main.gore[num106].alpha = alpha;
79546 }
79547 }
79548 else if (type >= 621 && type <= 623)
79549 {
79550 if (life > 0)
79551 {
79552 for (int num107 = 0; (double)num107 < dmg / (double)lifeMax * 100.0; num107++)
79553 {
79554 Dust.NewDust(position, width, height, 5, hitDirection, -1f, alpha, this.color, scale);
79555 }
79556 }
79557 else
79558 {
79559 for (int num108 = 0; num108 < 50; num108++)
79560 {
79561 Dust.NewDust(position, width, height, 5, hitDirection, -2f, alpha, this.color, scale);
79562 }
79563 int num109 = Gore.NewGore(position, velocity, type - 621 + 1187);
79564 Main.gore[num109].alpha = alpha;
79565 }
79566 }
79567 else if (type == 518 || type == 416)
79568 {
79569 if (life > 0)
79570 {
79571 for (int num110 = 0; (double)num110 < dmg / (double)lifeMax * 20.0; num110++)
79572 {
79573 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79574 if (Main.rand.Next(4) == 0)
79575 {
79576 Dust dust19 = Main.dust[Dust.NewDust(position, width, height, 6)];
79577 dust19.noGravity = true;
79578 dust19.scale = 1.5f;
79579 dust19.fadeIn = 1f;
79580 Dust dust = dust19;
79581 dust.velocity *= 3f;
79582 }
79583 }
79584 }
79585 else
79586 {
79587 for (int num111 = 0; num111 < 20; num111++)
79588 {
79589 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79590 if (Main.rand.Next(3) == 0)
79591 {
79592 Dust dust20 = Main.dust[Dust.NewDust(position, width, height, 6)];
79593 dust20.noGravity = true;
79594 dust20.scale = 1.5f;
79595 dust20.fadeIn = 1f;
79596 Dust dust = dust20;
79597 dust.velocity *= 3f;
79598 }
79599 }
79600 Gore.NewGore(position, velocity, 844, scale);
79601 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 845, scale);
79602 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 847, scale);
79603 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 835, scale);
79604 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 836, scale);
79605 }
79606 }
79607 else if (type == 419)
79608 {
79609 if (life > 0)
79610 {
79611 for (int num112 = 0; (double)num112 < dmg / (double)lifeMax * 20.0; num112++)
79612 {
79613 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79614 if (Main.rand.Next(4) == 0)
79615 {
79616 Dust dust21 = Main.dust[Dust.NewDust(position, width, height, 6)];
79617 dust21.noGravity = true;
79618 dust21.scale = 1.5f;
79619 dust21.fadeIn = 1f;
79620 Dust dust = dust21;
79621 dust.velocity *= 3f;
79622 }
79623 }
79624 }
79625 else
79626 {
79627 for (int num113 = 0; num113 < 20; num113++)
79628 {
79629 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79630 if (Main.rand.Next(3) == 0)
79631 {
79632 Dust dust22 = Main.dust[Dust.NewDust(position, width, height, 6)];
79633 dust22.noGravity = true;
79634 dust22.scale = 1.5f;
79635 dust22.fadeIn = 1f;
79636 Dust dust = dust22;
79637 dust.velocity *= 3f;
79638 }
79639 }
79640 Gore.NewGore(position, velocity, 844, scale);
79641 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 845, scale);
79642 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 846, scale);
79643 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 846, scale);
79644 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 847, scale);
79645 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 847, scale);
79646 }
79647 }
79648 else if (type == 412 || type == 413 || type == 414)
79649 {
79650 if (life > 0)
79651 {
79652 for (int num114 = 0; (double)num114 < dmg / (double)lifeMax * 50.0; num114++)
79653 {
79654 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79655 }
79656 }
79657 else
79658 {
79659 for (int num115 = 0; num115 < 6; num115++)
79660 {
79661 Dust.NewDust(position, width, height, 241, 2.5f * (float)hitDirection, -2.5f);
79662 }
79663 for (int num116 = 0; num116 < 2; num116++)
79664 {
79665 Dust.NewDust(position, width, height, 6, 2.5f * (float)hitDirection, -2.5f, 100, Color.Transparent, 2f);
79666 }
79667 Gore.NewGore(position, velocity, type - 412 + 828);
79668 }
79669 }
79670 else if (type == 415)
79671 {
79672 if (life > 0)
79673 {
79674 for (int num117 = 0; (double)num117 < dmg / (double)lifeMax * 20.0; num117++)
79675 {
79676 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79677 if (Main.rand.Next(4) == 0)
79678 {
79679 Dust dust23 = Main.dust[Dust.NewDust(position, width, height, 6)];
79680 dust23.noGravity = true;
79681 dust23.scale = 1.5f;
79682 dust23.fadeIn = 1f;
79683 Dust dust = dust23;
79684 dust.velocity *= 3f;
79685 }
79686 }
79687 }
79688 else
79689 {
79690 for (int num118 = 0; num118 < 40; num118++)
79691 {
79692 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79693 Dust dust24 = Main.dust[Dust.NewDust(position, width, height, 6)];
79694 dust24.noGravity = true;
79695 dust24.scale = 1.5f;
79696 dust24.fadeIn = 1f;
79697 Dust dust = dust24;
79698 dust.velocity *= 3f;
79699 }
79700 Gore.NewGore(base.Center, velocity * 0.8f, 831);
79701 Gore.NewGore(base.Center, velocity * 0.8f, 832);
79702 Gore.NewGore(base.Center, velocity * 0.9f, 833);
79703 Gore.NewGore(base.Center, velocity * 0.9f, 834);
79704 }
79705 }
79706 else if (type == 417)
79707 {
79708 if (life > 0)
79709 {
79710 for (int num119 = 0; (double)num119 < dmg / (double)lifeMax * 20.0; num119++)
79711 {
79712 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79713 if (Main.rand.Next(4) == 0)
79714 {
79715 Dust dust25 = Main.dust[Dust.NewDust(position, width, height, 6)];
79716 dust25.noGravity = true;
79717 dust25.scale = 1.5f;
79718 dust25.fadeIn = 1f;
79719 Dust dust = dust25;
79720 dust.velocity *= 3f;
79721 }
79722 }
79723 }
79724 else
79725 {
79726 for (int num120 = 0; num120 < 30; num120++)
79727 {
79728 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79729 if (Main.rand.Next(2) == 0)
79730 {
79731 Dust dust26 = Main.dust[Dust.NewDust(position, width, height, 6)];
79732 dust26.noGravity = true;
79733 dust26.scale = 1.5f;
79734 dust26.fadeIn = 1f;
79735 Dust dust = dust26;
79736 dust.velocity *= 3f;
79737 }
79738 }
79739 Gore.NewGore(position, velocity, 837, scale);
79740 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 838, scale);
79741 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 838, scale);
79742 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 838, scale);
79743 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 839, scale);
79744 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 839, scale);
79745 Gore.NewGore(new Vector2(position.X, position.Y + 38f), velocity, 840, scale);
79746 Gore.NewGore(new Vector2(position.X, position.Y + 38f), velocity, 840, scale);
79747 }
79748 }
79749 else if (type == 418)
79750 {
79751 if (life > 0)
79752 {
79753 for (int num121 = 0; (double)num121 < dmg / (double)lifeMax * 20.0; num121++)
79754 {
79755 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79756 if (Main.rand.Next(2) == 0)
79757 {
79758 Dust dust27 = Main.dust[Dust.NewDust(position, width, height, 6)];
79759 dust27.noGravity = true;
79760 dust27.scale = 1.5f;
79761 dust27.fadeIn = 1f;
79762 Dust dust = dust27;
79763 dust.velocity *= 3f;
79764 }
79765 }
79766 }
79767 else
79768 {
79769 for (int num122 = 0; num122 < 20; num122++)
79770 {
79771 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79772 Dust dust28 = Main.dust[Dust.NewDust(position, width, height, 6)];
79773 dust28.noGravity = true;
79774 dust28.scale = 1.5f;
79775 dust28.fadeIn = 1f;
79776 Dust dust = dust28;
79777 dust.velocity *= 3f;
79778 }
79779 Gore.NewGore(base.Center, velocity * 0.8f, 841);
79780 Gore.NewGore(base.Center, velocity * 0.8f, 842);
79781 Gore.NewGore(base.Center, velocity * 0.8f, 842);
79782 Gore.NewGore(base.Center, velocity * 0.9f, 843);
79783 Gore.NewGore(base.Center, velocity * 0.9f, 843);
79784 }
79785 }
79786 if (type == 516)
79787 {
79788 for (int num123 = 0; num123 < 20; num123++)
79789 {
79790 int num124 = Dust.NewDust(position, width, height, 6, 2.5f * (float)hitDirection, -2.5f);
79791 Dust dust = Main.dust[num124];
79792 dust.velocity *= 3f;
79793 dust = Main.dust[num124];
79794 dust.scale += Main.rand.NextFloat();
79795 if (Main.rand.Next(2) == 0)
79796 {
79797 num124 = Dust.NewDust(position, width, height, 259, 2.5f * (float)hitDirection, -2.5f);
79798 Main.dust[num124].noGravity = true;
79799 }
79800 }
79801 }
79802 if (type == 519)
79803 {
79804 Rectangle hitbox2 = base.Hitbox;
79805 for (int num125 = 0; num125 < oldPos.Length; num125 += 3)
79806 {
79807 hitbox2.X = (int)oldPos[num125].X;
79808 hitbox2.Y = (int)oldPos[num125].Y;
79809 for (int num126 = 0; num126 < 5; num126++)
79810 {
79811 int num127 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
79812 int num128 = Dust.NewDust(hitbox2.TopLeft(), width, height, num127, 2.5f * (float)hitDirection, -2.5f);
79813 Main.dust[num128].alpha = 200;
79814 Dust dust = Main.dust[num128];
79815 dust.velocity *= 2.4f;
79816 dust = Main.dust[num128];
79817 dust.scale += Main.rand.NextFloat();
79818 }
79819 }
79820 }
79821 if (type == 522)
79822 {
79823 Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732);
79824 float num129 = 24f;
79825 Vector2 vector14 = new Vector2(1.05f, 1f);
79826 for (float num130 = 0f; num130 < num129; num130++)
79827 {
79828 int num131 = Dust.NewDust(base.Center, 0, 0, 66, 0f, 0f, 0, Color.Transparent);
79829 Main.dust[num131].position = base.Center;
79830 Main.dust[num131].velocity = spinningpoint.RotatedBy((float)Math.PI * 2f * num130 / num129) * vector14 * (0.8f + Main.rand.NextFloat() * 0.4f) * 2f;
79831 Main.dust[num131].color = Color.SkyBlue;
79832 Main.dust[num131].noGravity = true;
79833 Dust dust = Main.dust[num131];
79834 dust.scale += 0.5f + Main.rand.NextFloat();
79835 }
79836 }
79837 else if (type == 426)
79838 {
79839 if (life > 0)
79840 {
79841 for (int num132 = 0; (double)num132 < dmg / (double)lifeMax * 50.0; num132++)
79842 {
79843 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79844 if (Main.rand.Next(4) == 0)
79845 {
79846 Dust dust29 = Main.dust[Dust.NewDust(position, width, height, 229)];
79847 dust29.noGravity = true;
79848 dust29.scale = 1.5f;
79849 dust29.fadeIn = 1f;
79850 Dust dust = dust29;
79851 dust.velocity *= 3f;
79852 }
79853 }
79854 }
79855 else
79856 {
79857 for (int num133 = 0; num133 < 20; num133++)
79858 {
79859 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79860 }
79861 for (int num134 = 0; num134 < 30; num134++)
79862 {
79863 int num135 = Utils.SelectRandom<int>(Main.rand, 229, 240, 161);
79864 Dust dust30 = Main.dust[Dust.NewDust(position, width, height, num135)];
79865 dust30.noGravity = true;
79866 dust30.scale = 1.25f + Main.rand.NextFloat();
79867 dust30.fadeIn = 0.25f;
79868 Dust dust = dust30;
79869 dust.velocity *= 2f;
79870 dust30.noLight = true;
79871 }
79872 Gore.NewGore(base.Top, velocity * 0.7f, 799);
79873 Gore.NewGore(base.Center, velocity * 0.8f, 800);
79874 Gore.NewGore(base.Center, velocity * 0.9f, 801);
79875 if (Main.netMode != 1)
79876 {
79877 int num136 = CountNPCS(428) + CountNPCS(427) + CountNPCS(426) * 3;
79878 int num137 = 20;
79879 if (num136 < num137)
79880 {
79881 for (int num138 = 0; num138 < 3; num138++)
79882 {
79883 int num139 = NewNPC(GetSpawnSource_NPCHurt(), (int)base.Center.X, (int)base.Center.Y, 428, whoAmI);
79884 Main.npc[num139].velocity = -Vector2.UnitY.RotatedByRandom(6.2831854820251465) * Main.rand.Next(3, 6) - Vector2.UnitY * 2f;
79885 Main.npc[num139].netUpdate = true;
79886 }
79887 }
79888 }
79889 }
79890 }
79891 else if (type == 427)
79892 {
79893 if (life > 0)
79894 {
79895 for (int num140 = 0; (double)num140 < dmg / (double)lifeMax * 20.0; num140++)
79896 {
79897 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79898 if (Main.rand.Next(2) == 0)
79899 {
79900 Dust dust31 = Main.dust[Dust.NewDust(position, width, height, 229)];
79901 dust31.noGravity = true;
79902 dust31.scale = 1.5f;
79903 dust31.fadeIn = 1f;
79904 Dust dust = dust31;
79905 dust.velocity *= 3f;
79906 }
79907 }
79908 }
79909 else
79910 {
79911 for (int num141 = 0; num141 < 10; num141++)
79912 {
79913 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79914 }
79915 for (int num142 = 0; num142 < 20; num142++)
79916 {
79917 int num143 = Utils.SelectRandom<int>(Main.rand, 229, 229, 240);
79918 Dust dust32 = Main.dust[Dust.NewDust(position, width, height, num143)];
79919 dust32.noGravity = true;
79920 dust32.scale = 1.25f + Main.rand.NextFloat();
79921 dust32.fadeIn = 0.25f;
79922 Dust dust = dust32;
79923 dust.velocity *= 3f;
79924 dust32.noLight = true;
79925 }
79926 Gore.NewGore(base.Center, velocity * 0.8f, 802);
79927 Gore.NewGore(base.Center, velocity * 0.9f, 803);
79928 Gore.NewGore(base.Center, velocity * 0.9f, 804);
79929 Gore.NewGore(base.Center, velocity * 0.8f, 805);
79930 }
79931 }
79932 else if (type == 429)
79933 {
79934 if (life > 0)
79935 {
79936 for (int num144 = 0; (double)num144 < dmg / (double)lifeMax * 20.0; num144++)
79937 {
79938 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79939 if (Main.rand.Next(4) == 0)
79940 {
79941 Dust dust33 = Main.dust[Dust.NewDust(position, width, height, 229)];
79942 dust33.noGravity = true;
79943 dust33.scale = 1.5f;
79944 dust33.fadeIn = 1f;
79945 Dust dust = dust33;
79946 dust.velocity *= 3f;
79947 }
79948 }
79949 }
79950 else
79951 {
79952 for (int num145 = 0; num145 < 20; num145++)
79953 {
79954 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
79955 if (Main.rand.Next(3) == 0)
79956 {
79957 Dust dust34 = Main.dust[Dust.NewDust(position, width, height, 229)];
79958 dust34.noGravity = true;
79959 dust34.scale = 1.5f;
79960 dust34.fadeIn = 1f;
79961 Dust dust = dust34;
79962 dust.velocity *= 3f;
79963 }
79964 }
79965 Gore.NewGore(position, velocity, 808, scale);
79966 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 809, scale);
79967 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 809, scale);
79968 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 810, scale);
79969 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 810, scale);
79970 if (Main.netMode != 1)
79971 {
79972 Point point = base.Center.ToTileCoordinates();
79973 Point point2 = Main.player[target].Center.ToTileCoordinates();
79974 Vector2 vector15 = Main.player[target].Center - base.Center;
79975 int num146 = 20;
79976 int num147 = 3;
79977 int num148 = 7;
79978 int num149 = 2;
79979 int num150 = 0;
79980 bool flag2 = false;
79981 if (vector15.Length() > 2000f)
79982 {
79983 flag2 = true;
79984 }
79985 while (!flag2 && num150 < 100)
79986 {
79987 num150++;
79988 int num151 = Main.rand.Next(point2.X - num146, point2.X + num146 + 1);
79989 int num152 = Main.rand.Next(point2.Y - num146, point2.Y - Math.Abs(num151 - point2.X) + 1);
79990 if ((num152 < point2.Y - num148 || num152 > point2.Y + num148 || num151 < point2.X - num148 || num151 > point2.X + num148) && (num152 < point.Y - num147 || num152 > point.Y + num147 || num151 < point.X - num147 || num151 > point.X + num147) && !Main.tile[num151, num152].nactive())
79991 {
79992 bool flag3 = true;
79993 if (flag3 && Main.tile[num151, num152].lava())
79994 {
79995 flag3 = false;
79996 }
79998 {
79999 flag3 = false;
80000 }
80001 if (flag3 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0))
80002 {
80003 flag3 = false;
80004 }
80005 if (flag3)
80006 {
80007 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), num151 * 16 + 8, num152 * 16 + 8, 0f, 0f, 578, 0, 1f, Main.myPlayer);
80008 flag2 = true;
80009 break;
80010 }
80011 }
80012 }
80013 }
80014 }
80015 }
80016 else if (type == 425)
80017 {
80018 if (life > 0)
80019 {
80020 for (int num153 = 0; (double)num153 < dmg / (double)lifeMax * 20.0; num153++)
80021 {
80022 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
80023 if (Main.rand.Next(4) == 0)
80024 {
80025 Dust dust35 = Main.dust[Dust.NewDust(position, width, height, 229)];
80026 dust35.noGravity = true;
80027 dust35.scale = 1.5f;
80028 dust35.fadeIn = 1f;
80029 Dust dust = dust35;
80030 dust.velocity *= 3f;
80031 }
80032 }
80033 }
80034 else
80035 {
80036 for (int num154 = 0; num154 < 20; num154++)
80037 {
80038 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
80039 if (Main.rand.Next(3) == 0)
80040 {
80041 Dust dust36 = Main.dust[Dust.NewDust(position, width, height, 229)];
80042 dust36.noGravity = true;
80043 dust36.scale = 1.5f;
80044 dust36.fadeIn = 1f;
80045 Dust dust = dust36;
80046 dust.velocity *= 3f;
80047 }
80048 }
80049 Gore.NewGore(position, velocity, 796, scale);
80050 Gore.NewGore(base.Center, velocity, 797, scale);
80051 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 798, scale);
80052 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 809, scale);
80053 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 809, scale);
80054 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 810, scale);
80055 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 810, scale);
80056 }
80057 }
80058 else if (type == 428)
80059 {
80060 if (life > 0)
80061 {
80062 for (int num155 = 0; (double)num155 < dmg / (double)lifeMax * 20.0; num155++)
80063 {
80064 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
80065 }
80066 }
80067 else
80068 {
80069 for (int num156 = 0; num156 < 10; num156++)
80070 {
80071 Dust.NewDust(position, width, height, 241, hitDirection, -1f);
80072 if (Main.rand.Next(2) == 0)
80073 {
80074 Dust.NewDust(position, width, height, 229);
80075 }
80076 else
80077 {
80078 Dust.NewDust(position, width, height, 240);
80079 }
80080 }
80081 Gore.NewGore(position, velocity * 0.8f, 806);
80082 Gore.NewGore(position, velocity * 0.8f, 807);
80083 }
80084 }
80085 else if (type == 424)
80086 {
80087 if (life > 0)
80088 {
80089 for (int num157 = 0; (double)num157 < dmg / (double)lifeMax * 20.0; num157++)
80090 {
80091 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80092 if (Main.rand.Next(4) == 0)
80093 {
80094 Dust dust37 = Main.dust[Dust.NewDust(position, width, height, 242)];
80095 dust37.noGravity = true;
80096 dust37.scale = 1.5f;
80097 dust37.fadeIn = 1f;
80098 Dust dust = dust37;
80099 dust.velocity *= 3f;
80100 }
80101 }
80102 }
80103 else
80104 {
80105 for (int num158 = 0; num158 < 20; num158++)
80106 {
80107 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80108 if (Main.rand.Next(3) == 0)
80109 {
80110 Dust dust38 = Main.dust[Dust.NewDust(position, width, height, 242)];
80111 dust38.noGravity = true;
80112 dust38.scale = 1.5f;
80113 dust38.fadeIn = 1f;
80114 Dust dust = dust38;
80115 dust.velocity *= 3f;
80116 }
80117 }
80118 Gore.NewGore(position, velocity, 793, scale);
80119 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 794, scale);
80120 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 794, scale);
80121 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 795, scale);
80122 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 795, scale);
80123 }
80124 }
80125 else if (type == 423)
80126 {
80127 if (life > 0)
80128 {
80129 for (int num159 = 0; (double)num159 < dmg / (double)lifeMax * 50.0; num159++)
80130 {
80131 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80132 if (Main.rand.Next(4) == 0)
80133 {
80134 Dust dust39 = Main.dust[Dust.NewDust(position, width, height, 242)];
80135 dust39.noGravity = true;
80136 dust39.scale = 1.5f;
80137 dust39.fadeIn = 1f;
80138 Dust dust = dust39;
80139 dust.velocity *= 3f;
80140 }
80141 }
80142 }
80143 else
80144 {
80145 for (int num160 = 0; num160 < 20; num160++)
80146 {
80147 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80148 Dust dust40 = Main.dust[Dust.NewDust(position, width, height, 242)];
80149 dust40.noGravity = true;
80150 dust40.scale = 1.5f;
80151 dust40.fadeIn = 1f;
80152 Dust dust = dust40;
80153 dust.velocity *= 3f;
80154 }
80155 Gore.NewGore(base.Center, velocity * 0.8f, 790);
80156 Gore.NewGore(base.Center, velocity * 0.8f, 791);
80157 Gore.NewGore(base.Center, velocity * 0.9f, 792);
80158 }
80159 }
80160 else if (type == 421)
80161 {
80162 if (life > 0)
80163 {
80164 for (int num161 = 0; (double)num161 < dmg / (double)lifeMax * 20.0; num161++)
80165 {
80166 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80167 if (Main.rand.Next(2) == 0)
80168 {
80169 Dust dust41 = Main.dust[Dust.NewDust(position, width, height, 242)];
80170 dust41.noGravity = true;
80171 dust41.scale = 1.5f;
80172 dust41.fadeIn = 1f;
80173 Dust dust = dust41;
80174 dust.velocity *= 3f;
80175 }
80176 }
80177 }
80178 else
80179 {
80180 for (int num162 = 0; num162 < 10; num162++)
80181 {
80182 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80183 Dust dust42 = Main.dust[Dust.NewDust(position, width, height, 242)];
80184 dust42.noGravity = true;
80185 dust42.scale = 1.5f;
80186 dust42.fadeIn = 1f;
80187 Dust dust = dust42;
80188 dust.velocity *= 3f;
80189 }
80190 Gore.NewGore(base.Center, velocity * 0.8f, 785);
80191 Gore.NewGore(base.Center, velocity * 0.8f, 786);
80192 Gore.NewGore(base.Center, velocity * 0.9f, 787);
80193 }
80194 }
80195 else if (type == 420)
80196 {
80197 if (life > 0)
80198 {
80199 for (int num163 = 0; (double)num163 < dmg / (double)lifeMax * 20.0; num163++)
80200 {
80201 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80202 if (Main.rand.Next(2) == 0)
80203 {
80204 Dust dust43 = Main.dust[Dust.NewDust(position, width, height, 242)];
80205 dust43.noGravity = true;
80206 dust43.scale = 1.5f;
80207 dust43.fadeIn = 1f;
80208 Dust dust = dust43;
80209 dust.velocity *= 3f;
80210 }
80211 }
80212 }
80213 else
80214 {
80215 for (int num164 = 0; num164 < 10; num164++)
80216 {
80217 Dust.NewDust(position, width, height, 249, hitDirection, -1f);
80218 Dust dust44 = Main.dust[Dust.NewDust(position, width, height, 242)];
80219 dust44.noGravity = true;
80220 dust44.scale = 1.5f;
80221 dust44.fadeIn = 1f;
80222 Dust dust = dust44;
80223 dust.velocity *= 3f;
80224 }
80225 Gore.NewGore(base.Center, velocity * 0.8f, 782);
80226 Gore.NewGore(base.Center, velocity * 0.8f, 783);
80227 Gore.NewGore(base.Center, velocity * 0.9f, 784);
80228 }
80229 }
80230 else if (type == 406 || type == 405)
80231 {
80232 if (life > 0)
80233 {
80234 for (int num165 = 0; (double)num165 < 10.0 + dmg / 10.0; num165++)
80235 {
80236 int num166 = width / 4;
80237 Vector2 vector16 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * Main.rand.Next(24, 41) / 8f;
80238 int num167 = Dust.NewDust(base.Center - Vector2.One * num166, num166 * 2, num166 * 2, 229);
80240 Vector2 vector17 = Vector2.Normalize(dust45.position - base.Center);
80241 dust45.position = base.Center + vector17 * num166 * scale - new Vector2(4f);
80242 if (num165 < 30)
80243 {
80244 dust45.velocity = vector17 * dust45.velocity.Length() * 2f;
80245 }
80246 else
80247 {
80248 dust45.velocity = 2f * vector17 * Main.rand.Next(45, 91) / 10f;
80249 }
80250 dust45.noGravity = true;
80251 dust45.scale = 0.7f + Main.rand.NextFloat();
80252 }
80253 }
80254 else
80255 {
80256 for (int num168 = 0; num168 < 60; num168++)
80257 {
80258 int num169 = width / 4;
80259 Vector2 vector18 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * Main.rand.Next(24, 41) / 8f;
80260 int num170 = Dust.NewDust(base.Center - Vector2.One * num169, num169 * 2, num169 * 2, 229);
80262 Vector2 vector19 = Vector2.Normalize(dust46.position - base.Center);
80263 dust46.position = base.Center + vector19 * num169 * scale - new Vector2(4f);
80264 if (num168 < 30)
80265 {
80266 dust46.velocity = vector19 * dust46.velocity.Length() * 2f;
80267 }
80268 else
80269 {
80270 dust46.velocity = 2f * vector19 * Main.rand.Next(45, 91) / 10f;
80271 }
80272 dust46.noGravity = true;
80273 dust46.scale = 0.7f;
80274 }
80275 if (type == 405)
80276 {
80277 int num171 = CountNPCS(406) + CountNPCS(405);
80278 int num172 = 4;
80279 if (num171 >= 4)
80280 {
80281 num172 = 3;
80282 }
80283 if (num171 >= 7)
80284 {
80285 num172 = 2;
80286 }
80287 if (num171 >= 10)
80288 {
80289 num172 = 1;
80290 }
80291 for (int num173 = 0; num173 < num172; num173++)
80292 {
80293 Vector2 vector20 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (3f + Main.rand.NextFloat() * 4f);
80294 int num174 = NewNPC(GetSpawnSource_NPCHurt(), (int)base.Center.X, (int)base.Bottom.Y, 406, whoAmI);
80295 Main.npc[num174].velocity = vector20;
80296 }
80297 }
80298 }
80299 }
80300 else if (type == 409)
80301 {
80302 if (life > 0)
80303 {
80304 for (int num175 = 0; (double)num175 < dmg / (double)lifeMax * 50.0; num175++)
80305 {
80306 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80307 if (Main.rand.Next(4) == 0)
80308 {
80309 Dust dust47 = Main.dust[Dust.NewDust(position, width, height, 229)];
80310 dust47.noGravity = true;
80311 }
80312 }
80313 }
80314 else
80315 {
80316 for (int num176 = 0; num176 < 20; num176++)
80317 {
80318 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80319 Dust dust48 = Main.dust[Dust.NewDust(position, width, height, 229)];
80320 dust48.noGravity = true;
80321 Dust dust = dust48;
80322 dust.velocity *= 3f;
80323 }
80324 Gore.NewGore(base.Center, velocity * 0.8f, 775);
80325 Gore.NewGore(base.Center, velocity * 0.8f, 776);
80326 Gore.NewGore(base.Center, velocity * 0.9f, 777);
80327 }
80328 }
80329 else if (type == 410)
80330 {
80331 if (life > 0)
80332 {
80333 for (int num177 = 0; (double)num177 < dmg / (double)lifeMax * 10.0; num177++)
80334 {
80335 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80336 if (Main.rand.Next(4) == 0)
80337 {
80338 Dust dust49 = Main.dust[Dust.NewDust(position, width, height, 229)];
80339 dust49.noGravity = true;
80340 }
80341 }
80342 }
80343 else
80344 {
80345 for (int num178 = 0; num178 < 5; num178++)
80346 {
80347 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80348 Dust dust50 = Main.dust[Dust.NewDust(position, width, height, 229)];
80349 dust50.noGravity = true;
80350 Dust dust = dust50;
80351 dust.velocity *= 3f;
80352 }
80353 }
80354 }
80355 else if (type == 407)
80356 {
80357 if (life > 0)
80358 {
80359 for (int num179 = 0; (double)num179 < dmg / (double)lifeMax * 50.0; num179++)
80360 {
80361 Dust.NewDust(position, width, height, 17, hitDirection, -1f, 0, Color.Transparent, 0.75f);
80362 if (Main.rand.Next(2) == 0)
80363 {
80364 Dust dust51 = Main.dust[Dust.NewDust(position, width, height, 229)];
80365 dust51.noGravity = true;
80366 }
80367 }
80368 }
80369 else
80370 {
80371 for (int num180 = 0; num180 < 20; num180++)
80372 {
80373 if (Main.rand.Next(3) != 0)
80374 {
80375 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80376 }
80377 Dust dust52 = Main.dust[Dust.NewDust(position, width, height, 229)];
80378 dust52.noGravity = true;
80379 Dust dust = dust52;
80380 dust.velocity *= 3f;
80381 }
80382 Gore.NewGore(base.Top, velocity * 0.8f, 778);
80383 Gore.NewGore(base.Top, velocity * 0.8f, 779);
80384 Gore.NewGore(base.Center, velocity * 0.9f, 780);
80385 Gore.NewGore(base.Center, velocity * 0.9f, 781);
80386 Gore.NewGore(base.Center, velocity * 0.9f, 780);
80387 Gore.NewGore(base.Center, velocity * 0.9f, 781);
80388 }
80389 }
80390 else if (type == 402)
80391 {
80392 if (life > 0)
80393 {
80394 for (int num181 = 0; (double)num181 < dmg / (double)lifeMax * 3.0; num181++)
80395 {
80396 if (Main.rand.Next(3) == 0)
80397 {
80398 Dust.NewDust(position, width, height, 17, hitDirection, -1f, 0, Color.Transparent, 0.75f);
80399 }
80400 if (Main.rand.Next(2) == 0)
80401 {
80402 Dust dust53 = Main.dust[Dust.NewDust(position, width, height, 229)];
80403 dust53.noGravity = true;
80404 }
80405 for (int num182 = 0; num182 < oldPos.Length; num182++)
80406 {
80407 if (Main.rand.Next(4) == 0)
80408 {
80409 if (oldPos[num182] == Vector2.Zero)
80410 {
80411 break;
80412 }
80413 if (Main.rand.Next(3) == 0)
80414 {
80415 Dust.NewDust(oldPos[num182], width, height, 17, hitDirection, -1f, 0, Color.Transparent, 0.75f);
80416 }
80417 if (Main.rand.Next(2) == 0)
80418 {
80419 Dust dust54 = Main.dust[Dust.NewDust(oldPos[num182], width, height, 229)];
80420 dust54.noGravity = true;
80421 }
80422 }
80423 }
80424 }
80425 }
80426 else
80427 {
80428 for (int num183 = 0; num183 < 5; num183++)
80429 {
80430 if (Main.rand.Next(3) == 0)
80431 {
80432 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80433 }
80434 Dust dust55 = Main.dust[Dust.NewDust(position, width, height, 229)];
80435 dust55.noGravity = true;
80436 Dust dust = dust55;
80437 dust.velocity *= 3f;
80438 }
80439 for (int num184 = 0; num184 < oldPos.Length; num184++)
80440 {
80441 if (Main.rand.Next(4) != 0)
80442 {
80443 continue;
80444 }
80445 if (oldPos[num184] == Vector2.Zero)
80446 {
80447 break;
80448 }
80449 for (int num185 = 0; num185 < 2; num185++)
80450 {
80451 if (Main.rand.Next(3) == 0)
80452 {
80453 Dust.NewDust(oldPos[num184], width, height, 17, hitDirection, -1f);
80454 }
80455 Dust dust56 = Main.dust[Dust.NewDust(oldPos[num184], width, height, 229)];
80456 dust56.noGravity = true;
80457 Dust dust = dust56;
80458 dust.velocity *= 3f;
80459 }
80460 }
80461 }
80462 }
80463 else if (type == 411)
80464 {
80465 if (life > 0)
80466 {
80467 for (int num186 = 0; (double)num186 < dmg / (double)lifeMax * 20.0; num186++)
80468 {
80469 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80470 if (Main.rand.Next(4) == 0)
80471 {
80472 Dust dust57 = Main.dust[Dust.NewDust(position, width, height, 229)];
80473 dust57.noGravity = true;
80474 }
80475 }
80476 }
80477 else
80478 {
80479 for (int num187 = 0; num187 < 20; num187++)
80480 {
80481 Dust.NewDust(position, width, height, 17, hitDirection, -1f);
80482 if (Main.rand.Next(2) == 0)
80483 {
80484 Dust dust58 = Main.dust[Dust.NewDust(position, width, height, 229)];
80485 dust58.noGravity = true;
80486 }
80487 }
80488 Gore.NewGore(position, velocity, 772, scale);
80489 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 773, scale);
80490 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 773, scale);
80491 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 774, scale);
80492 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 774, scale);
80493 }
80494 }
80495 else if (type == 491)
80496 {
80497 if (life <= 0)
80498 {
80499 Vector2 vector21 = base.Center - new Vector2(60f);
80500 Vector2 vector22 = new Vector2((spriteDirection != 1) ? 1 : (-1), 0f).RotatedBy(rotation);
80501 Gore.NewGore(vector21 + vector22 * (width / 2), velocity, 858, scale);
80502 Gore.NewGore(vector21 + vector22 * (width / 3), velocity, 857, scale);
80503 for (int num188 = -1; num188 < 2; num188++)
80504 {
80505 Gore.NewGore(vector21 + vector22 * ((float)width * (0.45f + (float)num188 * 0.1f)), velocity, 859, scale);
80506 Gore.NewGore(vector21 + vector22 * ((float)width * (0.4f + (float)num188 * 0.1f)), velocity, 859, scale);
80507 Gore.NewGore(vector21 + vector22 * ((float)width * (0.35f + (float)num188 * 0.1f)), velocity, 859, scale);
80508 }
80509 for (int num189 = -1; num189 < 2; num189++)
80510 {
80511 Gore.NewGore(vector21 + vector22 * ((float)width * 0.35f) - new Vector2(0f, 200f) + Utils.RandomVector2(Main.rand, -40f, 40f), velocity, Utils.SelectRandom<int>(Main.rand, 860, 892, 893), scale);
80512 Gore.NewGore(vector21 + vector22 * ((float)width * 0.15f) - new Vector2(0f, 200f) + Utils.RandomVector2(Main.rand, -40f, 40f), velocity, Utils.SelectRandom<int>(Main.rand, 860, 892, 893), scale);
80513 Gore.NewGore(vector21 + vector22 * ((float)width * -0.35f) - new Vector2(0f, 200f) + Utils.RandomVector2(Main.rand, -40f, 40f), velocity, Utils.SelectRandom<int>(Main.rand, 860, 892, 893), scale);
80514 Gore.NewGore(vector21 + vector22 * ((float)width * -0.15f) - new Vector2(0f, 300f) + Utils.RandomVector2(Main.rand, -40f, 40f), velocity, Utils.SelectRandom<int>(Main.rand, 860, 892, 893), scale);
80515 Gore.NewGore(vector21 + vector22 * ((float)width * -0.15f) - new Vector2(0f, 300f) + Utils.RandomVector2(Main.rand, -40f, 40f), velocity, Utils.SelectRandom<int>(Main.rand, 860, 892, 893), scale);
80516 }
80517 for (int num190 = 0; num190 < 2; num190++)
80518 {
80519 Gore.NewGore(vector21 + vector22 * ((float)width * 0.15f) - new Vector2(0f, 160 + 60 * num190), velocity, 855, scale);
80520 Gore.NewGore(vector21 + vector22 * ((float)width * -0.15f) - new Vector2(0f, 160 + 60 * num190), velocity, 855, scale);
80521 }
80522 for (int num191 = -1; num191 < 2; num191++)
80523 {
80524 Gore.NewGore(vector21 + vector22 * ((float)width * (0.25f + (float)num191 * 0.1f)) - new Vector2(0f, 20 + 40 * num191), velocity, 854, scale);
80525 Gore.NewGore(vector21 + vector22 * ((float)width * (-0.45f + (float)num191 * 0.1f)) - new Vector2(0f, 20 + 40 * num191), velocity, 853, scale);
80526 Gore.NewGore(vector21 + vector22 * ((float)width * (0.05f + (float)num191 * 0.1f)) - new Vector2(0f, 20 + 40 * num191), velocity, 856, scale);
80527 }
80528 for (int num192 = 0; num192 < 30; num192++)
80529 {
80530 int num193 = Main.rand.Next(861, 863);
80531 int num194 = Gore.NewGore(base.Center - new Vector2(60f), Vector2.Zero, num193);
80532 Main.gore[num194].alpha = 100;
80533 Main.gore[num194].velocity = Vector2.Transform(new Vector2(4f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
80534 Main.gore[num194].position = new Vector2(position.X - 20f + ((float)width + 40f) * Main.rand.NextFloat(), position.Y - 240f + (float)(height + 240 - 20) * Main.rand.NextFloat());
80535 }
80536 for (int num195 = 0; num195 < 120; num195++)
80537 {
80538 int num196 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
80539 Main.dust[num196].noGravity = true;
80540 Dust dust = Main.dust[num196];
80541 dust.velocity *= 5f;
80542 num196 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
80543 dust = Main.dust[num196];
80544 dust.velocity *= 4f;
80545 Main.dust[num196].noGravity = true;
80546 }
80547 if (Main.netMode != 1)
80548 {
80549 for (int num197 = 0; num197 < 4; num197++)
80550 {
80551 float num198 = (float)(num197 < 2).ToDirectionInt() * ((float)Math.PI / 8f + (float)Math.PI / 4f * Main.rand.NextFloat());
80552 Vector2 vector23 = new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.5f - 0.5f).RotatedBy(num198) * 6f;
80553 Projectile.NewProjectile(GetSpawnSource_ForProjectile(), base.Center.X, base.Center.Y, vector23.X, vector23.Y, 594, 0, 0f, Main.myPlayer);
80554 }
80555 }
80556 }
80557 }
80558 else if (type == 492)
80559 {
80560 if (life <= 0)
80561 {
80562 for (int num199 = 0; num199 < 7; num199++)
80563 {
80564 int num200 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
80565 Dust dust = Main.dust[num200];
80566 dust.velocity *= 1.4f;
80567 }
80568 for (int num201 = 0; num201 < 10; num201++)
80569 {
80570 int num202 = Main.rand.Next(61, 64);
80571 int num203 = Gore.NewGore(position, Vector2.Zero, num202);
80572 Main.gore[num203].alpha = 100;
80573 Main.gore[num203].velocity = Vector2.Transform(new Vector2(1f, 0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.2831854820251465)));
80574 }
80575 }
80576 }
80577 else if (type >= 524 && type <= 527)
80578 {
80579 int num204 = 0;
80580 int num205 = 5;
80581 int num206 = 863;
80582 if (type == 525)
80583 {
80584 num204 = 75;
80585 num206 = 867;
80586 }
80587 else if (type == 526)
80588 {
80589 num204 = 170;
80590 num206 = 871;
80591 }
80592 else if (type == 527)
80593 {
80594 num204 = 67;
80595 num206 = 879;
80596 }
80597 if (life > 0)
80598 {
80599 for (int num207 = 0; (double)num207 < dmg / (double)lifeMax * 20.0; num207++)
80600 {
80601 Dust.NewDust(position, width, height, num205, hitDirection, -1f);
80602 if (Main.rand.Next(4) == 0 && num204 > 0)
80603 {
80604 Dust dust59 = Main.dust[Dust.NewDust(position, width, height, num204)];
80605 dust59.noGravity = true;
80606 dust59.scale = 1.5f;
80607 dust59.fadeIn = 1f;
80608 Dust dust = dust59;
80609 dust.velocity *= 3f;
80610 }
80611 }
80612 }
80613 else
80614 {
80615 for (int num208 = 0; num208 < 20; num208++)
80616 {
80617 Dust.NewDust(position, width, height, num205, hitDirection, -1f);
80618 if (Main.rand.Next(3) == 0 && num204 > 0)
80619 {
80620 Dust dust60 = Main.dust[Dust.NewDust(position, width, height, num204)];
80621 dust60.noGravity = true;
80622 dust60.scale = 1.5f;
80623 dust60.fadeIn = 1f;
80624 Dust dust = dust60;
80625 dust.velocity *= 3f;
80626 }
80627 }
80628 Gore.NewGore(position, velocity, num206, scale);
80629 Gore.NewGore(position, velocity, num206 + 1, scale);
80630 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num206 + 2, scale);
80631 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num206 + 2, scale);
80632 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num206 + 3, scale);
80633 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num206 + 3, scale);
80634 }
80635 }
80636 else if (type >= 528 && type <= 529)
80637 {
80638 int num209 = 5;
80639 int num210 = 875;
80640 if (type == 529)
80641 {
80642 num210 = 876;
80643 }
80644 if (life > 0)
80645 {
80646 for (int num211 = 0; (double)num211 < dmg / (double)lifeMax * 20.0; num211++)
80647 {
80648 Dust.NewDust(position, width, height, num209, hitDirection, -1f);
80649 }
80650 }
80651 else
80652 {
80653 for (int num212 = 0; num212 < 20; num212++)
80654 {
80655 Dust.NewDust(position, width, height, num209, hitDirection, -1f);
80656 }
80657 Gore.NewGore(position, velocity, num210, scale);
80658 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 877, scale);
80659 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 877, scale);
80660 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 878, scale);
80661 }
80662 }
80663 else if (type == 530 || type == 531)
80664 {
80665 if (life > 0)
80666 {
80667 for (int num213 = 0; (double)num213 < dmg / (double)lifeMax * 30.0; num213++)
80668 {
80669 Dust.NewDust(position, width, height, 250, hitDirection, -1f, 100);
80670 }
80671 }
80672 else
80673 {
80674 for (int num214 = 0; num214 < 20; num214++)
80675 {
80676 Dust.NewDust(position, width, height, 250, 2.5f * (float)hitDirection, -2.5f, 100);
80677 }
80678 Gore.NewGore(position, velocity, 883);
80679 Gore.NewGore(position, velocity, 884);
80680 Gore.NewGore(position, velocity, 885);
80681 Gore.NewGore(position, velocity, 886);
80682 Gore.NewGore(position, velocity, 887);
80683 }
80684 }
80685 else if (type == 532)
80686 {
80687 if (life > 0)
80688 {
80689 for (int num215 = 0; (double)num215 < dmg / (double)lifeMax * 50.0; num215++)
80690 {
80691 Dust.NewDust(position, width, height, 5, hitDirection, -1f, 100);
80692 }
80693 }
80694 else
80695 {
80696 for (int num216 = 0; num216 < 50; num216++)
80697 {
80698 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f, 100);
80699 }
80700 Gore.NewGore(position, velocity, 888);
80701 Gore.NewGore(position, velocity, 889);
80702 Gore.NewGore(position, velocity, 890);
80703 Gore.NewGore(position, velocity, 891);
80704 }
80705 }
80706 else if (type == 533)
80707 {
80708 if (life > 0)
80709 {
80710 for (int num217 = 0; (double)num217 < dmg / (double)lifeMax * 50.0; num217++)
80711 {
80712 int num218 = Dust.NewDust(position, width, height, 27, 0f, 0f, 50, default(Color), 1.5f);
80713 Dust dust = Main.dust[num218];
80714 dust.velocity *= 2f;
80715 Main.dust[num218].noGravity = true;
80716 }
80717 }
80718 else
80719 {
80720 for (int num219 = 0; num219 < 40; num219++)
80721 {
80722 int num220 = Dust.NewDust(position, width, height, 27, 0f, 0f, 50, default(Color), 1.5f);
80723 Dust dust = Main.dust[num220];
80724 dust.velocity *= 2f;
80725 Main.dust[num220].noGravity = true;
80726 Main.dust[num220].fadeIn = 1f;
80727 }
80728 }
80729 }
80730 else if (type == 460)
80731 {
80732 if (life > 0)
80733 {
80734 for (int num221 = 0; (double)num221 < dmg / (double)lifeMax * 100.0; num221++)
80735 {
80736 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80737 }
80738 }
80739 else
80740 {
80741 for (int num222 = 0; num222 < 50; num222++)
80742 {
80743 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80744 }
80745 Gore.NewGore(position, velocity, 643, scale);
80746 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 645, scale);
80747 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 644, scale);
80748 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 646, scale);
80749 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 646, scale);
80750 }
80751 }
80752 else if (type == 477)
80753 {
80754 if (life > 0)
80755 {
80756 for (int num223 = 0; (double)num223 < dmg / (double)lifeMax * 100.0; num223++)
80757 {
80758 Dust.NewDust(position, width, height, 237, hitDirection, -1f);
80759 }
80760 }
80761 else
80762 {
80763 for (int num224 = 0; num224 < 50; num224++)
80764 {
80765 Dust.NewDust(position, width, height, 237, 2.5f * (float)hitDirection, -2.5f);
80766 }
80767 Gore.NewGore(position, velocity, 687, scale);
80768 Gore.NewGore(position, velocity, 688, scale);
80769 Gore.NewGore(position, velocity, 689, scale);
80770 Gore.NewGore(position, velocity, 690, scale);
80771 Gore.NewGore(position, velocity, 691, scale);
80772 }
80773 }
80774 else if (type == 479)
80775 {
80776 if (life > 0)
80777 {
80778 for (int num225 = 0; (double)num225 < dmg / (double)lifeMax * 100.0; num225++)
80779 {
80780 Dust.NewDust(position, width, height, 237, hitDirection, -1f);
80781 }
80782 }
80783 else
80784 {
80785 for (int num226 = 0; num226 < 50; num226++)
80786 {
80787 Dust.NewDust(position, width, height, 237, 2.5f * (float)hitDirection, -2.5f);
80788 }
80789 Gore.NewGore(position, velocity, 681, scale);
80790 Gore.NewGore(position, velocity, 682, scale);
80791 Gore.NewGore(position, velocity, 683, scale);
80792 }
80793 }
80794 else if (type == 478)
80795 {
80796 if (life > 0)
80797 {
80798 for (int num227 = 0; num227 < 10; num227++)
80799 {
80800 int num228 = Dust.NewDust(position, width, height, 238, hitDirection, -1f);
80801 Main.dust[num228].noGravity = true;
80802 }
80803 }
80804 else
80805 {
80806 for (int num229 = 0; num229 < 50; num229++)
80807 {
80808 Dust.NewDust(position, width, height, 237 + Main.rand.Next(2), 2.5f * (float)hitDirection, -2.5f);
80809 }
80810 Gore.NewGore(position, velocity, 684, scale);
80811 Gore.NewGore(position, velocity, 685, scale);
80812 Gore.NewGore(position, velocity, 686, scale);
80813 Gore.NewGore(position, velocity, 684 + Main.rand.Next(3), scale);
80814 }
80815 }
80816 else if (type == 466)
80817 {
80818 if (life > 0)
80819 {
80820 for (int num230 = 0; (double)num230 < dmg / (double)lifeMax * 100.0; num230++)
80821 {
80822 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80823 }
80824 }
80825 else
80826 {
80827 for (int num231 = 0; num231 < 50; num231++)
80828 {
80829 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80830 }
80831 Gore.NewGore(position, velocity, 656, scale);
80832 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 657, scale);
80833 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 659, scale);
80834 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 658, scale);
80835 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 658, scale);
80836 }
80837 }
80838 else if (type == 468)
80839 {
80840 if (life > 0)
80841 {
80842 for (int num232 = 0; (double)num232 < dmg / (double)lifeMax * 100.0; num232++)
80843 {
80844 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80845 }
80846 }
80847 else
80848 {
80849 for (int num233 = 0; num233 < 50; num233++)
80850 {
80851 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80852 }
80853 Gore.NewGore(position, velocity, 662, scale);
80854 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 663, scale);
80855 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 663, scale);
80856 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 664, scale);
80857 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 664, scale);
80858 }
80859 }
80860 else if (type == 469)
80861 {
80862 if (life > 0)
80863 {
80864 for (int num234 = 0; (double)num234 < dmg / (double)lifeMax * 100.0; num234++)
80865 {
80866 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80867 }
80868 }
80869 else
80870 {
80871 for (int num235 = 0; num235 < 50; num235++)
80872 {
80873 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80874 }
80875 Gore.NewGore(position, velocity, 665, scale);
80876 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 666, scale);
80877 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 666, scale);
80878 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 667, scale);
80879 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 667, scale);
80880 }
80881 }
80882 else if (type == 463)
80883 {
80884 if (life > 0)
80885 {
80886 for (int num236 = 0; (double)num236 < dmg / (double)lifeMax * 100.0; num236++)
80887 {
80888 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80889 }
80890 }
80891 else
80892 {
80893 for (int num237 = 0; num237 < 50; num237++)
80894 {
80895 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80896 }
80897 Gore.NewGore(position, velocity, 653, scale);
80898 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 654, scale);
80899 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 654, scale);
80900 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 655, scale);
80901 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 655, scale);
80902 }
80903 }
80904 else if (type == 461)
80905 {
80906 if (life > 0)
80907 {
80908 for (int num238 = 0; (double)num238 < dmg / (double)lifeMax * 100.0; num238++)
80909 {
80910 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80911 }
80912 }
80913 else
80914 {
80915 for (int num239 = 0; num239 < 50; num239++)
80916 {
80917 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80918 }
80919 Gore.NewGore(position, velocity, 647, scale);
80920 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 648, scale);
80921 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 648, scale);
80922 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 649, scale);
80923 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 649, scale);
80924 }
80925 }
80926 else if (type == 462)
80927 {
80928 if (life > 0)
80929 {
80930 for (int num240 = 0; (double)num240 < dmg / (double)lifeMax * 100.0; num240++)
80931 {
80932 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80933 }
80934 }
80935 else
80936 {
80937 for (int num241 = 0; num241 < 50; num241++)
80938 {
80939 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80940 }
80941 Gore.NewGore(position, velocity, 650, scale);
80942 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 651, scale);
80943 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 651, scale);
80944 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 652, scale);
80945 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 652, scale);
80946 }
80947 }
80948 else if (type == 379 || type == 438)
80949 {
80950 if (life > 0)
80951 {
80952 for (int num242 = 0; (double)num242 < dmg / (double)(lifeMax * 50); num242++)
80953 {
80954 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
80955 }
80956 }
80957 else
80958 {
80959 for (int num243 = 0; num243 < 30; num243++)
80960 {
80961 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80962 }
80963 Gore.NewGore(position, velocity, 900, scale);
80964 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 901, scale);
80965 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 901, scale);
80966 }
80967 }
80968 else if (type == 439)
80969 {
80970 if (life > 0)
80971 {
80972 for (int num244 = 0; (double)num244 < dmg / (double)lifeMax * 100.0; num244++)
80973 {
80974 int num245 = Dust.NewDust(position, width, height, 5, 0f, 0f, 0, default(Color), 1.5f);
80975 Dust dust = Main.dust[num245];
80976 dust.velocity *= 1.5f;
80977 Main.dust[num245].noGravity = true;
80978 }
80979 }
80980 else
80981 {
80982 for (int num246 = 0; num246 < 30; num246++)
80983 {
80984 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
80985 }
80986 for (int num247 = 0; num247 < 10; num247++)
80987 {
80988 int num248 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
80989 Dust dust = Main.dust[num248];
80990 dust.velocity *= 2f;
80991 Main.dust[num248].noGravity = true;
80992 }
80993 int num249 = Main.rand.Next(1, 4);
80994 for (int num250 = 0; num250 < num249; num250++)
80995 {
80996 int num251 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), Main.rand.Next(11, 14), scale);
80998 gore2.velocity *= 0.8f;
80999 }
81000 Gore.NewGore(position, velocity, 902, scale);
81001 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 903, scale);
81002 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 901, scale);
81003 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 901, scale);
81004 }
81005 }
81006 else if (type == 440)
81007 {
81008 if (life <= 0)
81009 {
81010 for (int num252 = 0; num252 < 10; num252++)
81011 {
81012 int num253 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
81013 Dust dust = Main.dust[num253];
81014 dust.velocity *= 2f;
81015 Main.dust[num253].noGravity = true;
81016 }
81017 int num254 = Main.rand.Next(1, 4);
81018 for (int num255 = 0; num255 < num254; num255++)
81019 {
81020 int num256 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), Main.rand.Next(11, 14), scale);
81022 gore2.velocity *= 0.8f;
81023 }
81024 }
81025 }
81026 else if (type >= 454 && type <= 459)
81027 {
81028 if (life > 0)
81029 {
81030 for (int num257 = 0; (double)num257 < dmg / (double)lifeMax * 50.0; num257++)
81031 {
81032 int num258 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
81033 Dust dust = Main.dust[num258];
81034 dust.velocity *= 1.5f;
81035 Main.dust[num258].noGravity = true;
81036 }
81037 }
81038 else
81039 {
81040 for (int num259 = 0; num259 < 10; num259++)
81041 {
81042 int num260 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
81043 Dust dust = Main.dust[num260];
81044 dust.velocity *= 2f;
81045 Main.dust[num260].noGravity = true;
81046 }
81047 int num261 = Main.rand.Next(1, 4);
81048 for (int num262 = 0; num262 < num261; num262++)
81049 {
81050 int num263 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), Main.rand.Next(11, 14), scale);
81052 gore2.velocity *= 0.8f;
81053 }
81054 }
81055 }
81056 if (type == 372 || type == 373)
81057 {
81058 if (life > 0)
81059 {
81060 for (int num264 = 0; (double)num264 < dmg / (double)lifeMax * 100.0; num264++)
81061 {
81062 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
81063 }
81064 }
81065 else
81066 {
81067 for (int num265 = 0; num265 < 75; num265++)
81068 {
81069 int num266 = Dust.NewDust(base.Center - Vector2.One * 25f, 50, 50, 5, 2 * hitDirection, -2f);
81070 Dust dust = Main.dust[num266];
81071 dust.velocity /= 2f;
81072 }
81073 Gore.NewGore(base.Center, velocity * 0.8f, 583);
81074 Gore.NewGore(base.Center, velocity * 0.8f, 577);
81075 Gore.NewGore(base.Center, velocity * 0.9f, 578);
81076 Gore.NewGore(base.Center, velocity, 579);
81077 }
81078 }
81079 if (type == 371)
81080 {
81081 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 3);
81082 if (life <= 0)
81083 {
81084 Vector2 center = base.Center;
81085 for (int num267 = 0; num267 < 60; num267++)
81086 {
81087 int num268 = 25;
81088 Vector2 vector24 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * Main.rand.Next(24, 41) / 8f;
81089 int num269 = Dust.NewDust(base.Center - Vector2.One * num268, num268 * 2, num268 * 2, 212);
81091 Vector2 vector25 = Vector2.Normalize(dust61.position - base.Center);
81092 dust61.position = base.Center + vector25 * 25f * scale;
81093 if (num267 < 30)
81094 {
81095 dust61.velocity = vector25 * dust61.velocity.Length();
81096 }
81097 else
81098 {
81099 dust61.velocity = vector25 * Main.rand.Next(45, 91) / 10f;
81100 }
81101 dust61.color = Main.hslToRgb((float)(0.4000000059604645 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f);
81102 dust61.color = Color.Lerp(dust61.color, Color.White, 0.3f);
81103 dust61.noGravity = true;
81104 dust61.scale = 0.7f;
81105 }
81106 }
81107 }
81108 if (type == 370)
81109 {
81110 if (life > 0)
81111 {
81112 for (int num270 = 0; (double)num270 < dmg / (double)lifeMax * 100.0; num270++)
81113 {
81114 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
81115 }
81116 }
81117 else
81118 {
81119 for (int num271 = 0; num271 < 150; num271++)
81120 {
81121 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
81122 }
81123 Gore.NewGore(base.Center - Vector2.UnitX * 20f * direction, velocity, 576, scale);
81124 Gore.NewGore(base.Center - Vector2.UnitY * 30f, velocity, 574, scale);
81125 Gore.NewGore(base.Center, velocity, 575, scale);
81126 Gore.NewGore(base.Center + Vector2.UnitX * 20f * direction, velocity, 573, scale);
81127 Gore.NewGore(base.Center - Vector2.UnitY * 30f, velocity, 574, scale);
81128 Gore.NewGore(base.Center, velocity, 575, scale);
81129 }
81130 }
81131 else if (type == 381)
81132 {
81133 if (life > 0)
81134 {
81135 for (int num272 = 0; (double)num272 < dmg / (double)(lifeMax * 50); num272++)
81136 {
81137 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81138 }
81139 }
81140 else
81141 {
81142 for (int num273 = 0; num273 < 30; num273++)
81143 {
81144 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81145 }
81146 Gore.NewGore(position, velocity, 587, scale);
81147 Gore.NewGore(position, velocity, 590, scale);
81148 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 588, scale);
81149 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 589, scale);
81150 }
81151 }
81152 else if (type == 382 || type == 390)
81153 {
81154 if (life > 0)
81155 {
81156 for (int num274 = 0; (double)num274 < dmg / (double)(lifeMax * 50); num274++)
81157 {
81158 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81159 }
81160 }
81161 else
81162 {
81163 for (int num275 = 0; num275 < 30; num275++)
81164 {
81165 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81166 }
81167 Gore.NewGore(position, velocity, 591, scale);
81168 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 592, scale);
81169 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 593, scale);
81170 }
81171 }
81172 else if (type == 383)
81173 {
81174 if (life > 0)
81175 {
81176 for (int num276 = 0; (double)num276 < dmg / (double)(lifeMax * 50); num276++)
81177 {
81178 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81179 }
81180 }
81181 else
81182 {
81183 for (int num277 = 0; num277 < 30; num277++)
81184 {
81185 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81186 }
81187 Gore.NewGore(position, velocity, 594, scale);
81188 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 595, scale);
81189 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 596, scale);
81190 }
81191 }
81192 else if (type == 384)
81193 {
81194 if (life > 0)
81195 {
81196 for (int num278 = 0; (double)num278 < dmg / (double)lifeMax * 50.0; num278++)
81197 {
81198 int num279 = Dust.NewDust(position, width, height, 226, -1 * hitDirection, -1f);
81199 Main.dust[num279].position = Vector2.Lerp(Main.dust[num279].position, base.Center, 0.25f);
81200 Main.dust[num279].scale = 0.5f;
81201 }
81202 }
81203 else
81204 {
81205 for (int num280 = 0; num280 < 70; num280++)
81206 {
81207 int num281 = Dust.NewDust(position, width, height, 226, -2.5f * (float)hitDirection, -2.5f);
81208 Main.dust[num281].scale = 0.5f;
81209 }
81210 }
81211 }
81212 else if (type == 385)
81213 {
81214 if (life > 0)
81215 {
81216 for (int num282 = 0; (double)num282 < dmg / (double)(lifeMax * 50); num282++)
81217 {
81218 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81219 }
81220 }
81221 else
81222 {
81223 for (int num283 = 0; num283 < 30; num283++)
81224 {
81225 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81226 }
81227 Gore.NewGore(position, velocity, 597, scale);
81228 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 598, scale);
81229 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 599, scale);
81230 }
81231 }
81232 else if (type == 386)
81233 {
81234 if (life > 0)
81235 {
81236 for (int num284 = 0; (double)num284 < dmg / (double)(lifeMax * 50); num284++)
81237 {
81238 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81239 }
81240 }
81241 else
81242 {
81243 for (int num285 = 0; num285 < 30; num285++)
81244 {
81245 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81246 }
81247 Gore.NewGore(position, velocity, 600, scale);
81248 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 601, scale);
81249 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 602, scale);
81250 }
81251 }
81252 if (type == 387)
81253 {
81254 if (life > 0)
81255 {
81256 for (int num286 = 0; (double)num286 < dmg / (double)lifeMax * 20.0; num286++)
81257 {
81258 int num287 = Dust.NewDust(position, width, height, 226, -1 * hitDirection, -1f);
81259 Main.dust[num287].position = Vector2.Lerp(Main.dust[num287].position, base.Center, 0.25f);
81260 Main.dust[num287].scale = 0.5f;
81261 }
81262 }
81263 else
81264 {
81265 for (int num288 = 0; num288 < 30; num288++)
81266 {
81267 int num289 = Dust.NewDust(position, width, height, 226, -1.5f * (float)hitDirection, -1.5f);
81268 Main.dust[num289].scale = 0.5f;
81269 }
81270 Gore.NewGore(position, velocity, 603, scale);
81271 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 603, scale);
81272 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 604, scale);
81273 }
81274 }
81275 if (type == 520)
81276 {
81277 if (life > 0)
81278 {
81279 for (int num290 = 0; (double)num290 < dmg / (double)lifeMax * 20.0; num290++)
81280 {
81281 int num291 = Dust.NewDust(position, width, height, 226, -1 * hitDirection, -1f);
81282 Main.dust[num291].position = Vector2.Lerp(Main.dust[num291].position, base.Center, 0.25f);
81283 Main.dust[num291].scale = 0.5f;
81284 }
81285 }
81286 else
81287 {
81288 for (int num292 = 0; num292 < 30; num292++)
81289 {
81290 int num293 = Dust.NewDust(position, width, height, 226, -1.5f * (float)hitDirection, -1.5f);
81291 Main.dust[num293].scale = 0.5f;
81292 }
81293 Gore.NewGore(position, velocity, 851, scale);
81294 Gore.NewGore(position, velocity, 852, scale);
81295 Gore.NewGore(new Vector2(position.X, position.Y + 80f), velocity, 848, scale);
81296 Gore.NewGore(new Vector2(position.X, position.Y + 80f), velocity, 849, scale);
81297 Gore.NewGore(new Vector2(position.X, position.Y + 80f), velocity, 850, scale);
81298 }
81299 }
81300 else if (type == 389)
81301 {
81302 if (life > 0)
81303 {
81304 for (int num294 = 0; (double)num294 < dmg / (double)(lifeMax * 50); num294++)
81305 {
81306 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81307 }
81308 }
81309 else
81310 {
81311 for (int num295 = 0; num295 < 30; num295++)
81312 {
81313 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81314 }
81315 Gore.NewGore(position, velocity, 904, scale);
81316 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 905, scale);
81317 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 906, scale);
81318 }
81319 }
81320 else if (type == 388)
81321 {
81322 if (life > 0)
81323 {
81324 for (int num296 = 0; (double)num296 < dmg / (double)(lifeMax * 50); num296++)
81325 {
81326 int num297 = Dust.NewDust(position, width, height, 226, -1 * hitDirection, -1f);
81327 Main.dust[num297].position = Vector2.Lerp(Main.dust[num297].position, base.Center, 0.25f);
81328 Main.dust[num297].scale = 0.5f;
81329 }
81330 }
81331 else
81332 {
81333 for (int num298 = 0; num298 < 10; num298++)
81334 {
81335 int num299 = Dust.NewDust(position, width, height, 226, -2.5f * (float)hitDirection, -2.5f);
81336 Main.dust[num299].scale = 0.5f;
81337 }
81338 Vector2 vector26 = velocity;
81339 if (ai[0] == 3f)
81340 {
81341 vector26 = rotation.ToRotationVector2();
81342 if (spriteDirection == 1)
81343 {
81344 vector26.X *= -1f;
81345 }
81346 vector26 *= 5f;
81347 }
81348 Gore.NewGore(base.Center - new Vector2(10f, 10f), vector26, 605, scale);
81349 Gore.NewGore(base.Center - new Vector2(10f, 10f), vector26, 606, scale);
81350 }
81351 }
81352 else if (type == 399)
81353 {
81354 if (life > 0)
81355 {
81356 for (int num300 = 0; (double)num300 < dmg / (double)(lifeMax * 50); num300++)
81357 {
81358 int num301 = Dust.NewDust(position, width, height, 226, -1 * hitDirection, -1f);
81359 Main.dust[num301].position = Vector2.Lerp(Main.dust[num301].position, base.Center, 0.25f);
81360 Main.dust[num301].scale = 0.5f;
81361 }
81362 }
81363 else
81364 {
81365 for (int num302 = 0; num302 < 10; num302++)
81366 {
81367 int num303 = Dust.NewDust(position, width, height, 226, -2.5f * (float)hitDirection, -2.5f);
81368 Main.dust[num303].scale = 0.5f;
81369 }
81370 Vector2 vector27 = velocity;
81371 if (ai[0] == 3f)
81372 {
81373 vector27 = rotation.ToRotationVector2();
81374 if (spriteDirection == 1)
81375 {
81376 vector27.X *= -1f;
81377 }
81378 vector27 *= 5f;
81379 }
81380 Gore.NewGore(base.Center - new Vector2(10f, 10f), vector27, 898, scale);
81381 Gore.NewGore(base.Center - new Vector2(10f, 10f), vector27, 899, scale);
81382 }
81383 }
81384 else if (type == 391)
81385 {
81386 if (life > 0)
81387 {
81388 for (int num304 = 0; (double)num304 < dmg / (double)(lifeMax * 50); num304++)
81389 {
81390 Dust.NewDust(position, width, height, 227, hitDirection, -1f);
81391 }
81392 }
81393 else
81394 {
81395 for (int num305 = 0; num305 < 30; num305++)
81396 {
81397 Dust.NewDust(position, width, height, 227, 2.5f * (float)hitDirection, -2.5f);
81398 }
81399 Gore.NewGore(position + Vector2.UnitX * width / 2f, velocity, 607, scale);
81400 Gore.NewGore(position + Vector2.UnitX * width / 2f, velocity, 608, scale);
81401 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 609, scale);
81402 }
81403 }
81404 if (type == 392 || type == 394 || type == 393 || type == 395)
81405 {
81406 if (life > 0)
81407 {
81408 for (int num306 = 0; (double)num306 < dmg / (double)lifeMax * 20.0; num306++)
81409 {
81410 int num307 = Dust.NewDust(position, width, height, 228, -1 * hitDirection, -1f);
81411 Main.dust[num307].position = Vector2.Lerp(Main.dust[num307].position, base.Center, 0.25f);
81412 Main.dust[num307].scale = 0.5f;
81413 }
81414 }
81415 else
81416 {
81417 for (int num308 = 0; num308 < 30; num308++)
81418 {
81419 int num309 = Dust.NewDust(position, width, height, 228, -1.5f * (float)hitDirection, -1.5f);
81420 Main.dust[num309].scale = 0.5f;
81421 }
81422 Vector2 center2 = base.Center;
81423 if (type == 395)
81424 {
81425 Gore.NewGore(center2 + new Vector2(-20f, -10f), velocity, 610, scale);
81426 Gore.NewGore(center2 + new Vector2(20f, -10f), velocity, 611, scale);
81427 Gore.NewGore(center2 + new Vector2(-50f, 0f), velocity, 612, scale);
81428 Gore.NewGore(center2 + new Vector2(50f, 0f), velocity, 613, scale);
81429 Gore.NewGore(center2 + new Vector2(-60f, 10f), velocity, 614, scale);
81430 Gore.NewGore(center2 + new Vector2(0f, 30f), velocity, 615, scale);
81431 }
81432 if (type == 393)
81433 {
81434 Gore.NewGore(center2, velocity, 616, scale);
81435 }
81436 if (type == 394)
81437 {
81438 Gore.NewGore(center2, velocity, 617, scale);
81439 }
81440 }
81441 }
81442 else if (type == 482 || type == 483)
81443 {
81444 if (life > 0)
81445 {
81446 for (int num310 = 0; (double)num310 < dmg / (double)(lifeMax * 50); num310++)
81447 {
81448 Dust.NewDust(position, width, height, 240, hitDirection, -1f);
81449 }
81450 }
81451 else
81452 {
81453 for (int num311 = 0; num311 < 30; num311++)
81454 {
81455 Dust.NewDust(position, width, height, 240, 2.5f * (float)hitDirection, -2.5f);
81456 }
81457 if (type == 482)
81458 {
81459 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 718, scale);
81460 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 719, scale);
81461 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 720, scale);
81462 Gore.NewGore(new Vector2(position.X, position.Y + 40f), velocity, 721, scale);
81463 }
81464 }
81465 }
81466 else if (type == 631)
81467 {
81468 if (life > 0)
81469 {
81470 for (int num312 = 0; (double)num312 < dmg / (double)(lifeMax * 50); num312++)
81471 {
81472 Dust.NewDust(position, width, height, 1, hitDirection, -1f);
81473 }
81474 }
81475 else
81476 {
81477 for (int num313 = 0; num313 < 30; num313++)
81478 {
81479 Dust.NewDust(position, width, height, 1, 2.5f * (float)hitDirection, -2.5f);
81480 }
81481 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1210, scale);
81482 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 1211, scale);
81483 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1212, scale);
81484 Gore.NewGore(new Vector2(position.X, position.Y + 40f), velocity, 1213, scale);
81485 }
81486 }
81487 if ((type >= 442 && type <= 448) || type == 539 || type == 592 || type == 593 || type == 601 || type == 605 || type == 627)
81488 {
81489 if (life > 0)
81490 {
81491 for (int num314 = 0; num314 < 10; num314++)
81492 {
81493 Dust.NewDust(position, width, height, Main.rand.Next(232, 234), hitDirection, -1f);
81494 }
81495 }
81496 else
81497 {
81498 for (int num315 = 0; num315 < 20; num315++)
81499 {
81500 Dust.NewDust(position, width, height, Main.rand.Next(232, 234), 2 * hitDirection, -2f);
81501 }
81502 }
81503 }
81504 if (type == 653 && life <= 0)
81505 {
81506 for (int num316 = 0; num316 < 6; num316++)
81507 {
81508 int num317 = Dust.NewDust(position, width, height, 174, 2 * hitDirection, -2f);
81509 if (Main.rand.Next(2) == 0)
81510 {
81511 Main.dust[num317].noGravity = true;
81512 Main.dust[num317].scale = 1.5f * scale;
81513 }
81514 else
81515 {
81516 Main.dust[num317].scale = 0.8f * scale;
81517 }
81518 }
81519 }
81520 if (type == 333 || type == 334 || type == 335 || type == 336)
81521 {
81523 if (type == 333)
81524 {
81525 newColor7 = new Color(73, 147, 221, 200);
81526 }
81527 if (type == 334)
81528 {
81529 newColor7 = new Color(24, 146, 79, 200);
81530 }
81531 if (type == 335)
81532 {
81533 newColor7 = new Color(194, 46, 50, 200);
81534 }
81535 if (type == 336)
81536 {
81537 newColor7 = new Color(228, 200, 1, 200);
81538 }
81539 if (life > 0)
81540 {
81541 for (int num318 = 0; (double)num318 < dmg / (double)lifeMax * 100.0; num318++)
81542 {
81543 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 150, newColor7);
81544 }
81545 }
81546 else
81547 {
81548 for (int num319 = 0; num319 < 50; num319++)
81549 {
81550 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, 150, newColor7);
81551 }
81552 }
81553 }
81554 if (type == 537)
81555 {
81556 if (life > 0)
81557 {
81558 for (int num320 = 0; (double)num320 < dmg / (double)lifeMax * 100.0; num320++)
81559 {
81560 Dust.NewDust(position, width, height, 32, hitDirection, -1f);
81561 }
81562 }
81563 else
81564 {
81565 for (int num321 = 0; num321 < 50; num321++)
81566 {
81567 Dust.NewDust(position, width, height, 32, 2 * hitDirection, -2f);
81568 }
81569 }
81570 }
81571 if (type == 1 || type == 16 || type == 71 || type == 244 || type == 535)
81572 {
81573 if (life > 0)
81574 {
81575 for (int num322 = 0; (double)num322 < dmg / (double)lifeMax * 100.0; num322++)
81576 {
81577 Dust.NewDust(position, width, height, 4, hitDirection, -1f, alpha, this.color);
81578 }
81579 }
81580 else
81581 {
81582 for (int num323 = 0; num323 < 50; num323++)
81583 {
81584 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, alpha, this.color);
81585 }
81586 if (Main.netMode != 1 && type == 16)
81587 {
81588 int num324 = Main.rand.Next(2) + 2;
81589 for (int num325 = 0; num325 < num324; num325++)
81590 {
81591 int num326 = NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), 1);
81592 Main.npc[num326].SetDefaults(-5);
81593 Main.npc[num326].velocity.X = velocity.X * 2f;
81594 Main.npc[num326].velocity.Y = velocity.Y;
81595 Main.npc[num326].velocity.X += (float)Main.rand.Next(-20, 20) * 0.1f + (float)(num325 * direction) * 0.3f;
81596 Main.npc[num326].velocity.Y -= (float)Main.rand.Next(0, 10) * 0.1f + (float)num325;
81597 Main.npc[num326].ai[0] = -1000 * Main.rand.Next(3);
81598 if (Main.netMode == 2 && num326 < 200)
81599 {
81600 NetMessage.SendData(23, -1, -1, null, num326);
81601 }
81602 }
81603 }
81604 }
81605 }
81606 if (type == 352)
81607 {
81608 if (life > 0)
81609 {
81610 for (int num327 = 0; (double)num327 < dmg / (double)lifeMax * 100.0; num327++)
81611 {
81612 int num328 = Dust.NewDust(position, width, height, 67, hitDirection, -1f);
81613 Main.dust[num328].noGravity = true;
81614 }
81615 }
81616 else
81617 {
81618 for (int num329 = 0; num329 < 60; num329++)
81619 {
81620 int num330 = Dust.NewDust(position, width, height, 67, 2 * hitDirection, -2f);
81621 Main.dust[num330].noGravity = true;
81622 }
81623 }
81624 }
81625 if (type >= 305 && type <= 314)
81626 {
81627 if (life > 0)
81628 {
81629 for (int num331 = 0; (double)num331 < dmg / (double)lifeMax * 100.0; num331++)
81630 {
81631 Dust.NewDust(position, width, height, 194, hitDirection, -1f, 0, default(Color), 1.1f);
81632 }
81633 }
81634 else
81635 {
81636 for (int num332 = 0; num332 < 60; num332++)
81637 {
81638 Dust.NewDust(position, width, height, 194, 2 * hitDirection, -2f, 0, default(Color), 1.1f);
81639 }
81640 Gore.NewGore(position, velocity, 441, scale);
81641 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 442, scale);
81642 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 443, scale);
81643 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 444, scale);
81644 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 445, scale);
81645 }
81646 }
81647 if (type == 327)
81648 {
81649 if (life > 0)
81650 {
81651 for (int num333 = 0; (double)num333 < dmg / (double)lifeMax * 100.0; num333++)
81652 {
81653 Dust.NewDust(position, width, height, 189, hitDirection, -1f, 0, default(Color), 1.1f);
81654 }
81655 }
81656 else
81657 {
81658 for (int num334 = 0; num334 < 60; num334++)
81659 {
81660 Dust.NewDust(position, width, height, 189, 2 * hitDirection, -2f, 0, default(Color), 1.1f);
81661 }
81662 for (int num335 = 476; num335 <= 484; num335++)
81663 {
81664 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, num335, scale);
81665 }
81666 }
81667 }
81668 if (type == 325)
81669 {
81670 if (life > 0)
81671 {
81672 for (int num336 = 0; (double)num336 < dmg / (double)lifeMax * 100.0; num336++)
81673 {
81674 Dust.NewDust(position, width, height, 191, hitDirection, -1f, 0, default(Color), 1.1f);
81675 }
81676 }
81677 else
81678 {
81679 for (int num337 = 0; num337 < 60; num337++)
81680 {
81681 Dust.NewDust(position, width, height, 191, 2 * hitDirection, -2f, 0, default(Color), 1.1f);
81682 }
81683 for (int num338 = 469; num338 <= 475; num338++)
81684 {
81685 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, num338, scale);
81686 }
81687 }
81688 }
81689 if (type == 345 && life <= 0)
81690 {
81691 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, 513, scale);
81692 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, 514, scale);
81693 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, 514, scale);
81694 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, 515, scale);
81695 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, 516, scale);
81696 }
81697 if (type == 344)
81698 {
81699 if (life > 0)
81700 {
81701 for (int num339 = 0; (double)num339 < dmg / (double)lifeMax * 100.0; num339++)
81702 {
81703 Dust.NewDust(position, width, height, 196, hitDirection, -1f);
81704 }
81705 }
81706 else
81707 {
81708 for (int num340 = 0; num340 < 60; num340++)
81709 {
81710 Dust.NewDust(position, width, height, 196, 2 * hitDirection, -2f);
81711 }
81712 for (int num341 = 508; num341 <= 512; num341++)
81713 {
81714 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, num341, scale);
81715 }
81716 for (int num342 = 509; num342 <= 512; num342++)
81717 {
81718 Gore.NewGore(new Vector2(position.X, position.Y), velocity * 0f, num342, scale);
81719 }
81720 }
81721 }
81722 if (type == 326)
81723 {
81724 if (life > 0)
81725 {
81726 for (int num343 = 0; (double)num343 < dmg / (double)lifeMax * 100.0; num343++)
81727 {
81728 Dust.NewDust(position, width, height, 191, hitDirection, -1f, 0, default(Color), 1.1f);
81729 }
81730 }
81731 else
81732 {
81733 for (int num344 = 0; num344 < 60; num344++)
81734 {
81735 Dust.NewDust(position, width, height, 191, 2 * hitDirection, -2f, 0, default(Color), 1.1f);
81736 }
81737 }
81738 }
81739 if (type == 304)
81740 {
81741 if (life > 0)
81742 {
81743 for (int num345 = 0; (double)num345 < dmg / (double)lifeMax * 100.0; num345++)
81744 {
81745 Dust.NewDust(position, width, height, 189, hitDirection, -1f, 0, default(Color), 1.3f);
81746 }
81747 }
81748 else
81749 {
81750 for (int num346 = 0; num346 < 60; num346++)
81751 {
81752 Dust.NewDust(position, width, height, 189, 2 * hitDirection, -2f, 0, default(Color), 1.3f);
81753 }
81754 }
81755 }
81756 if (type == 302)
81757 {
81758 if (life > 0)
81759 {
81760 for (int num347 = 0; (double)num347 < dmg / (double)lifeMax * 100.0; num347++)
81761 {
81762 Dust.NewDust(position, width, height, 192, hitDirection, -1f, 100, new Color(100, 100, 100, 100));
81763 }
81764 }
81765 else
81766 {
81767 for (int num348 = 0; num348 < 50; num348++)
81768 {
81769 Dust.NewDust(position, width, height, 192, 2 * hitDirection, -2f, 100, new Color(100, 100, 100, 100));
81770 }
81771 Gore.NewGore(position, velocity, 440, scale);
81772 }
81773 }
81774 if (type >= 245 && type <= 249)
81775 {
81776 if (life > 0)
81777 {
81778 for (int num349 = 0; (double)num349 < dmg / (double)lifeMax * 100.0; num349++)
81779 {
81780 Dust.NewDust(position, width, height, 148, hitDirection, -1f);
81781 }
81782 }
81783 else if (type == 246)
81784 {
81785 if (Main.netMode != 1)
81786 {
81787 NewNPC(GetSpawnSource_NPCHurt(), (int)base.Center.X, (int)position.Y + height, 249, whoAmI);
81788 }
81789 }
81790 else
81791 {
81792 for (int num350 = 0; num350 < 50; num350++)
81793 {
81794 Dust.NewDust(position, width, height, 148, 2 * hitDirection, -2f);
81795 }
81796 if (type == 245)
81797 {
81798 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 368, scale);
81799 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 370, scale);
81800 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 368, scale);
81801 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 370, scale);
81802 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 368, scale);
81803 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 370, scale);
81804 Gore.NewGore(position, velocity, 360, scale);
81805 Gore.NewGore(position, velocity, 361, scale);
81806 Gore.NewGore(position, velocity, 362, scale);
81807 Gore.NewGore(position, velocity, 363, scale);
81808 Gore.NewGore(position, velocity, 364, scale);
81809 Gore.NewGore(position, velocity, 367, scale);
81810 Gore.NewGore(position, velocity, 366, scale);
81811 }
81812 else if (type == 249)
81813 {
81814 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 368, scale);
81815 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 370, scale);
81816 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 368, scale);
81817 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 370, scale);
81818 Gore.NewGore(position, velocity, 365, scale);
81819 Gore.NewGore(position, velocity, 363, scale);
81820 Gore.NewGore(position, velocity, 362, scale);
81821 }
81822 else
81823 {
81824 Gore.NewGore(position, velocity, 369, scale);
81825 Gore.NewGore(position, velocity, 371, scale);
81826 Gore.NewGore(position, velocity, 370, scale);
81827 }
81828 }
81829 }
81830 if (type == 288 && life <= 0)
81831 {
81832 for (int num351 = 0; num351 < 50; num351++)
81833 {
81834 int num352 = Dust.NewDust(position, width, height, 180, velocity.X, velocity.Y);
81835 Dust dust = Main.dust[num352];
81836 dust.velocity *= 2f;
81837 Main.dust[num352].noGravity = true;
81838 Main.dust[num352].scale = 1.4f;
81839 }
81840 }
81841 if (type == 204)
81842 {
81843 if (life > 0)
81844 {
81845 for (int num353 = 0; (double)num353 < dmg / (double)lifeMax * 100.0; num353++)
81846 {
81847 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 100, new Color(149, 208, 104));
81848 }
81849 }
81850 else
81851 {
81852 for (int num354 = 0; num354 < 50; num354++)
81853 {
81854 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, 100, new Color(149, 208, 104));
81855 }
81856 }
81857 }
81858 if (type == 225)
81859 {
81860 if (life > 0)
81861 {
81862 for (int num355 = 0; (double)num355 < dmg / (double)lifeMax * 100.0; num355++)
81863 {
81864 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 100, new Color(0, 80, 255, 100));
81865 }
81866 }
81867 else
81868 {
81869 for (int num356 = 0; num356 < 50; num356++)
81870 {
81871 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, 100, new Color(0, 80, 255, 100));
81872 }
81873 Gore.NewGore(position, velocity, 314, scale);
81874 }
81875 }
81876 if (type == 243)
81877 {
81878 if (life > 0)
81879 {
81880 for (int num357 = 0; (double)num357 < dmg / (double)lifeMax * 150.0; num357++)
81881 {
81882 Dust.NewDust(position, width, height, 161, hitDirection, -1f);
81883 }
81884 }
81885 else
81886 {
81887 for (int num358 = 0; num358 < 200; num358++)
81888 {
81889 Dust.NewDust(position, width, height, 161, 2 * hitDirection, -2f);
81890 }
81891 Gore.NewGore(position, velocity, 359, scale);
81892 }
81893 }
81894 if ((type == 210 || type == 211) && life <= 0)
81895 {
81896 for (int num359 = 0; num359 < 6; num359++)
81897 {
81898 int num360 = Dust.NewDust(position, width, height, 150, 2 * hitDirection, -2f);
81899 if (Main.rand.Next(2) == 0)
81900 {
81901 Main.dust[num360].noGravity = true;
81902 Main.dust[num360].scale = 1.5f;
81903 }
81904 else
81905 {
81906 Main.dust[num360].scale = 0.8f;
81907 }
81908 }
81909 }
81910 if ((type == 355 || type == 358 || type == 654) && life <= 0)
81911 {
81912 for (int num361 = 0; num361 < 6; num361++)
81913 {
81914 int num362 = Dust.NewDust(position, width, height, 198, 2 * hitDirection, -2f);
81915 if (Main.rand.Next(2) == 0)
81916 {
81917 Main.dust[num362].noGravity = true;
81918 Main.dust[num362].scale = 1.5f * scale;
81919 }
81920 else
81921 {
81922 Main.dust[num362].scale = 0.8f * scale;
81923 }
81924 }
81925 }
81926 if (type == 677 && life <= 0)
81927 {
81929 {
81930 PositionInWorld = base.Center,
81931 MovementVector = velocity
81932 });
81933 for (int num363 = 0; num363 < 6; num363++)
81934 {
81935 int num364 = Dust.NewDust(position, width, height, 310, 2 * hitDirection, -2f);
81936 if (Main.rand.Next(2) == 0)
81937 {
81938 Main.dust[num364].noGravity = true;
81939 Main.dust[num364].scale = 1.5f * scale;
81940 }
81941 else
81942 {
81943 Main.dust[num364].scale = 0.8f * scale;
81944 }
81945 }
81946 }
81947 if (type == 604 && life <= 0)
81948 {
81949 for (int num365 = 0; num365 < 6; num365++)
81950 {
81951 int num366 = Dust.NewDust(position, width, height, 198, 2 * hitDirection, -2f);
81952 if (Main.rand.Next(2) == 0)
81953 {
81954 Main.dust[num366].noGravity = true;
81955 Main.dust[num366].scale = 1.5f * scale;
81956 }
81957 else
81958 {
81959 Main.dust[num366].scale = 0.8f * scale;
81960 }
81961 }
81962 if (Main.rand.Next(2) == 0)
81963 {
81964 Gore.NewGore(position, velocity, 1148);
81965 }
81966 if (Main.rand.Next(2) == 0)
81967 {
81968 Gore.NewGore(position, velocity, 1149);
81969 }
81970 }
81971 if (type == 669 && life <= 0)
81972 {
81973 for (int num367 = 0; num367 < 6; num367++)
81974 {
81975 int num368 = Dust.NewDust(position, width, height, 198, 2 * hitDirection, -2f);
81976 if (Main.rand.Next(2) == 0)
81977 {
81978 Main.dust[num368].noGravity = true;
81979 Main.dust[num368].scale = 1.5f * scale;
81980 }
81981 else
81982 {
81983 Main.dust[num368].scale = 0.8f * scale;
81984 }
81985 }
81986 if (Main.rand.Next(2) == 0)
81987 {
81988 Gore.NewGore(position, velocity, 1275);
81989 }
81990 if (Main.rand.Next(2) == 0)
81991 {
81992 Gore.NewGore(position, velocity, 1276);
81993 }
81994 }
81995 if (type == 356 && life <= 0)
81996 {
81997 for (int num369 = 0; num369 < 6; num369++)
81998 {
81999 int num370 = Dust.NewDust(position, width, height, 199, 2 * hitDirection, -2f);
82000 if (Main.rand.Next(2) == 0)
82001 {
82002 Main.dust[num370].noGravity = true;
82003 Main.dust[num370].scale = 1.5f * scale;
82004 }
82005 else
82006 {
82007 Main.dust[num370].scale = 0.8f * scale;
82008 }
82009 }
82010 }
82011 if (type >= 484 && type <= 487 && life <= 0)
82012 {
82013 for (int num371 = 0; num371 < 6; num371++)
82014 {
82015 int num372 = Dust.NewDust(position, width, height, 248 + type - 484, 2 * hitDirection, -2f);
82016 if (Main.rand.Next(2) == 0)
82017 {
82018 Main.dust[num372].noGravity = true;
82019 Main.dust[num372].scale = 1.2f * scale;
82020 }
82021 else
82022 {
82023 Main.dust[num372].scale = 0.7f * scale;
82024 }
82025 }
82026 }
82027 if (type == 357 && life <= 0)
82028 {
82029 for (int num373 = 0; num373 < 6; num373++)
82030 {
82031 int num374 = Dust.NewDust(position, width, height, 200, 2 * hitDirection, -2f);
82032 if (Main.rand.Next(2) == 0)
82033 {
82034 Main.dust[num374].noGravity = true;
82035 Main.dust[num374].scale = 1.2f * scale;
82036 }
82037 else
82038 {
82039 Main.dust[num374].scale = 0.7f * scale;
82040 }
82041 }
82042 }
82043 if (type == 606 && life <= 0)
82044 {
82045 for (int num375 = 0; num375 < 6; num375++)
82046 {
82047 int num376 = Dust.NewDust(position, width, height, 124, 2 * hitDirection, -2f);
82048 if (Main.rand.Next(2) == 0)
82049 {
82050 Main.dust[num376].noGravity = true;
82051 Main.dust[num376].scale = 1.2f * scale;
82052 }
82053 else
82054 {
82055 Main.dust[num376].scale = 0.7f * scale;
82056 }
82057 }
82058 }
82059 if (type == 377 && life <= 0)
82060 {
82061 for (int num377 = 0; num377 < 6; num377++)
82062 {
82063 int num378 = Dust.NewDust(position, width, height, 40, 2 * hitDirection, -2f);
82064 if (Main.rand.Next(2) == 0)
82065 {
82066 Main.dust[num378].noGravity = true;
82067 Main.dust[num378].scale = 1.2f * scale;
82068 }
82069 else
82070 {
82071 Main.dust[num378].scale = 0.7f * scale;
82072 }
82073 }
82074 }
82075 if (type == 374 || type == 375)
82076 {
82077 for (int num379 = 0; num379 < 6; num379++)
82078 {
82079 int num380 = Dust.NewDust(position, width, height, 165, 0f, 0f, 50, default(Color), 1.5f);
82080 Dust dust = Main.dust[num380];
82081 dust.velocity *= 2f;
82082 Main.dust[num380].noGravity = true;
82083 }
82084 }
82085 if (type == 359)
82086 {
82087 if (life <= 0)
82088 {
82089 for (int num381 = 0; num381 < 6; num381++)
82090 {
82091 int num382 = Dust.NewDust(position, width, height, 201, 2 * hitDirection, -2f);
82092 if (Main.rand.Next(2) == 0)
82093 {
82094 Main.dust[num382].noGravity = true;
82095 Main.dust[num382].scale = 1.2f * scale;
82096 }
82097 else
82098 {
82099 Main.dust[num382].scale = 0.7f * scale;
82100 }
82101 }
82102 }
82103 Gore.NewGore(position, velocity, 547, scale);
82104 Gore.NewGore(position, velocity, 548, scale);
82105 }
82106 if (type == 360)
82107 {
82108 if (life <= 0)
82109 {
82110 for (int num383 = 0; num383 < 6; num383++)
82111 {
82112 int num384 = Dust.NewDust(position, width, height, 202, 2 * hitDirection, -2f);
82113 if (Main.rand.Next(2) == 0)
82114 {
82115 Main.dust[num384].noGravity = true;
82116 Main.dust[num384].scale = 1.2f * scale;
82117 }
82118 else
82119 {
82120 Main.dust[num384].scale = 0.7f * scale;
82121 }
82122 }
82123 }
82124 Gore.NewGore(position, velocity, 549, scale);
82125 Gore.NewGore(position, velocity, 550, scale);
82126 }
82127 if (type == 655)
82128 {
82129 if (life <= 0)
82130 {
82131 for (int num385 = 0; num385 < 6; num385++)
82132 {
82133 int num386 = Dust.NewDust(position, width, height, 174, 2 * hitDirection, -2f);
82134 if (Main.rand.Next(2) == 0)
82135 {
82136 Main.dust[num386].noGravity = true;
82137 Main.dust[num386].scale = 1.2f * scale;
82138 }
82139 else
82140 {
82141 Main.dust[num386].scale = 0.7f * scale;
82142 }
82143 }
82144 }
82145 Gore.NewGore(position, velocity, 1256, scale);
82146 }
82147 if (type == 154)
82148 {
82149 if (life > 0)
82150 {
82151 for (int num387 = 0; (double)num387 < dmg / (double)lifeMax * 50.0; num387++)
82152 {
82153 int num388 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, velocity.X, velocity.Y, 90, default(Color), 1.5f);
82154 Main.dust[num388].noGravity = true;
82155 Dust dust = Main.dust[num388];
82156 dust.velocity *= 0.2f;
82157 }
82158 }
82159 else
82160 {
82161 for (int num389 = 0; num389 < 50; num389++)
82162 {
82163 int num390 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67, velocity.X, velocity.Y, 90, default(Color), 1.5f);
82164 Main.dust[num390].noGravity = true;
82165 Dust dust = Main.dust[num390];
82166 dust.velocity *= 0.2f;
82167 }
82168 Gore.NewGore(position, velocity, 180, scale);
82169 }
82170 }
82171 if (type == 147 || type == 184)
82172 {
82173 if (life > 0)
82174 {
82175 for (int num391 = 0; (double)num391 < dmg / (double)lifeMax * 50.0; num391++)
82176 {
82177 int num392 = Dust.NewDust(position, width, height, 76, hitDirection, -1f);
82178 Main.dust[num392].noGravity = true;
82179 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 100, new Color(97, 200, 255, 100));
82180 }
82181 }
82182 else
82183 {
82184 for (int num393 = 0; num393 < 30; num393++)
82185 {
82186 int num394 = Dust.NewDust(position, width, height, 76, hitDirection, -2f);
82187 Main.dust[num394].noGravity = true;
82188 Dust.NewDust(position, width, height, 4, hitDirection, -2f, 100, new Color(97, 200, 255, 100));
82189 }
82190 }
82191 }
82192 if (type == 143 || type == 144 || type == 145)
82193 {
82194 if (life > 0)
82195 {
82196 for (int num395 = 0; (double)num395 < dmg / (double)lifeMax * 100.0; num395++)
82197 {
82198 int num396 = Dust.NewDust(position, width, height, 76, hitDirection, -1f);
82199 Main.dust[num396].noGravity = true;
82200 }
82201 }
82202 else
82203 {
82204 for (int num397 = 0; num397 < 50; num397++)
82205 {
82206 int num398 = Dust.NewDust(position, width, height, 76, hitDirection, -1f);
82207 Main.dust[num398].noGravity = true;
82208 Dust dust = Main.dust[num398];
82209 dust.scale *= 1.2f;
82210 }
82211 }
82212 }
82213 if (type == 141)
82214 {
82215 if (life > 0)
82216 {
82217 for (int num399 = 0; (double)num399 < dmg / (double)lifeMax * 100.0; num399++)
82218 {
82219 Dust.NewDust(position, width, height, 4, hitDirection, -1f, alpha, new Color(210, 230, 140));
82220 }
82221 }
82222 else
82223 {
82224 for (int num400 = 0; num400 < 50; num400++)
82225 {
82226 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, alpha, new Color(210, 230, 140));
82227 }
82228 }
82229 }
82230 if (type == 112 || type == 666)
82231 {
82232 for (int num401 = 0; num401 < 20; num401++)
82233 {
82234 int num402 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 18, 0f, 0f, 100, default(Color), 2f);
82235 if (Main.rand.Next(2) == 0)
82236 {
82237 Dust dust = Main.dust[num402];
82238 dust.scale *= 0.6f;
82239 }
82240 else
82241 {
82242 Dust dust = Main.dust[num402];
82243 dust.velocity *= 1.4f;
82244 Main.dust[num402].noGravity = true;
82245 }
82246 }
82247 }
82248 if (type == 183)
82249 {
82250 if (life > 0)
82251 {
82252 for (int num403 = 0; (double)num403 < dmg / (double)lifeMax * 100.0; num403++)
82253 {
82254 Dust.NewDust(position, width, height, 136, 0f, 0f, alpha, this.color);
82255 }
82256 }
82257 else
82258 {
82259 for (int num404 = 0; num404 < 50; num404++)
82260 {
82261 int num405 = Dust.NewDust(position, width, height, 136, hitDirection, 0f, alpha, this.color);
82262 Dust dust = Main.dust[num405];
82263 dust.velocity *= 2f;
82264 }
82265 }
82266 }
82267 if (type == 81 || type == 121)
82268 {
82269 if (life > 0)
82270 {
82271 for (int num406 = 0; (double)num406 < dmg / (double)lifeMax * 100.0; num406++)
82272 {
82273 Dust.NewDust(position, width, height, 14, 0f, 0f, alpha, this.color);
82274 }
82275 }
82276 else
82277 {
82278 for (int num407 = 0; num407 < 50; num407++)
82279 {
82280 int num408 = Dust.NewDust(position, width, height, 14, hitDirection, 0f, alpha, this.color);
82281 Dust dust = Main.dust[num408];
82282 dust.velocity *= 2f;
82283 }
82284 if (Main.netMode != 1)
82285 {
82286 if (type == 121)
82287 {
82288 int num409 = NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), 81);
82289 Main.npc[num409].SetDefaults(-2);
82290 Main.npc[num409].velocity.X = velocity.X;
82291 Main.npc[num409].velocity.Y = velocity.Y;
82292 Gore.NewGore(position, velocity, 94, scale);
82293 if (Main.netMode == 2 && num409 < 200)
82294 {
82295 NetMessage.SendData(23, -1, -1, null, num409);
82296 }
82297 }
82298 else if (scale >= 1f)
82299 {
82300 int num410 = Main.rand.Next(2) + 2;
82301 for (int num411 = 0; num411 < num410; num411++)
82302 {
82303 int num412 = NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), 1);
82304 Main.npc[num412].SetDefaults(-1);
82305 Main.npc[num412].velocity.X = velocity.X * 3f;
82306 Main.npc[num412].velocity.Y = velocity.Y;
82307 Main.npc[num412].velocity.X += (float)Main.rand.Next(-10, 10) * 0.1f + (float)(num411 * direction) * 0.3f;
82308 Main.npc[num412].velocity.Y -= (float)Main.rand.Next(0, 10) * 0.1f + (float)num411;
82309 Main.npc[num412].ai[1] = num411;
82310 if (Main.netMode == 2 && num412 < 200)
82311 {
82312 NetMessage.SendData(23, -1, -1, null, num412);
82313 }
82314 }
82315 }
82316 }
82317 }
82318 }
82319 if (type == 120 || type == 137 || type == 138)
82320 {
82321 if (life > 0)
82322 {
82323 for (int num413 = 0; (double)num413 < dmg / (double)lifeMax * 50.0; num413++)
82324 {
82325 int num414 = Dust.NewDust(position, width, height, 71, 0f, 0f, 200);
82326 Dust dust = Main.dust[num414];
82327 dust.velocity *= 1.5f;
82328 }
82329 }
82330 else
82331 {
82332 for (int num415 = 0; num415 < 50; num415++)
82333 {
82334 int num416 = Dust.NewDust(position, width, height, 71, hitDirection, 0f, 200);
82335 Dust dust = Main.dust[num416];
82336 dust.velocity *= 1.5f;
82337 }
82338 }
82339 }
82340 if (type == 122)
82341 {
82342 if (life > 0)
82343 {
82344 for (int num417 = 0; (double)num417 < dmg / (double)lifeMax * 50.0; num417++)
82345 {
82346 int num418 = Dust.NewDust(position, width, height, 72, 0f, 0f, 200);
82347 Dust dust = Main.dust[num418];
82348 dust.velocity *= 1.5f;
82349 }
82350 }
82351 else
82352 {
82353 for (int num419 = 0; num419 < 50; num419++)
82354 {
82355 int num420 = Dust.NewDust(position, width, height, 72, hitDirection, 0f, 200);
82356 Dust dust = Main.dust[num420];
82357 dust.velocity *= 1.5f;
82358 }
82359 }
82360 }
82361 if (type == 75)
82362 {
82363 if (life > 0)
82364 {
82365 for (int num421 = 0; (double)num421 < dmg / (double)lifeMax * 50.0; num421++)
82366 {
82367 Dust.NewDust(position, width, height, 55, 0f, 0f, 200, this.color);
82368 }
82369 }
82370 else
82371 {
82372 for (int num422 = 0; num422 < 50; num422++)
82373 {
82374 int num423 = Dust.NewDust(position, width, height, 55, hitDirection, 0f, 200, this.color);
82375 Dust dust = Main.dust[num423];
82376 dust.velocity *= 2f;
82377 }
82378 }
82379 }
82380 if (type == 63 || type == 64 || type == 103)
82381 {
82382 Color newColor8 = new Color(50, 120, 255, 100);
82383 if (type == 64)
82384 {
82385 newColor8 = new Color(225, 70, 140, 100);
82386 }
82387 if (type == 103)
82388 {
82389 newColor8 = new Color(70, 225, 140, 100);
82390 }
82391 if (life > 0)
82392 {
82393 for (int num424 = 0; (double)num424 < dmg / (double)lifeMax * 50.0; num424++)
82394 {
82395 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 0, newColor8);
82396 }
82397 }
82398 else
82399 {
82400 for (int num425 = 0; num425 < 25; num425++)
82401 {
82402 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, 0, newColor8);
82403 }
82404 }
82405 }
82406 else
82407 {
82408 if (type == 59 || type == 60 || type == 151)
82409 {
82410 if (life > 0)
82411 {
82412 for (int num426 = 0; (double)num426 < dmg / (double)lifeMax * 80.0; num426++)
82413 {
82414 int num427 = Dust.NewDust(position, width, height, 6, hitDirection * 2, -1f, alpha, default(Color), 1.5f);
82415 if (Main.rand.Next(8) != 0)
82416 {
82417 Main.dust[num427].noGravity = true;
82418 }
82419 }
82420 return;
82421 }
82422 for (int num428 = 0; num428 < 40; num428++)
82423 {
82424 int num429 = Dust.NewDust(position, width, height, 6, hitDirection * 2, -1f, alpha, default(Color), 1.5f);
82425 if (Main.rand.Next(8) != 0)
82426 {
82427 Main.dust[num429].noGravity = true;
82428 }
82429 }
82430 if (Main.expertMode && type == 59 && Main.netMode != 1 && !Main.remixWorld)
82431 {
82432 try
82433 {
82434 int num430 = (int)(base.Center.X / 16f);
82435 int num431 = (int)(base.Center.Y / 16f);
82436 if (!WorldGen.SolidTile(num430, num431) && Main.tile[num430, num431].liquid == 0)
82437 {
82438 Main.tile[num430, num431].liquid = (byte)Main.rand.Next(50, 150);
82439 Main.tile[num430, num431].lava(lava: true);
82440 Main.tile[num430, num431].honey(honey: false);
82442 }
82443 }
82444 catch
82445 {
82446 }
82447 }
82448 if ((type != 151 && type != 60) || Main.netMode == 1 || !Main.remixWorld || !Main.getGoodWorld)
82449 {
82450 return;
82451 }
82452 try
82453 {
82454 int num432 = (int)(base.Center.X / 16f);
82455 int num433 = (int)(base.Center.Y / 16f);
82456 if (!WorldGen.SolidTile(num432, num433) && Main.tile[num432, num433].liquid == 0)
82457 {
82458 Main.tile[num432, num433].liquid = (byte)Main.rand.Next(50, 150);
82459 Main.tile[num432, num433].lava(lava: true);
82460 Main.tile[num432, num433].honey(honey: false);
82462 }
82463 return;
82464 }
82465 catch
82466 {
82467 return;
82468 }
82469 }
82470 if (type == 50)
82471 {
82472 if (life > 0)
82473 {
82474 for (int num434 = 0; (double)num434 < dmg / (double)lifeMax * 300.0; num434++)
82475 {
82476 Dust.NewDust(position, width, height, 4, hitDirection, -1f, 175, new Color(0, 80, 255, 100));
82477 }
82478 return;
82479 }
82480 for (int num435 = 0; num435 < 200; num435++)
82481 {
82482 Dust.NewDust(position, width, height, 4, 2 * hitDirection, -2f, 175, new Color(0, 80, 255, 100));
82483 }
82484 Gore.NewGore(base.Center + new Vector2(-40f, -height / 2), velocity, 734);
82485 if (Main.netMode == 1)
82486 {
82487 return;
82488 }
82489 int num436 = Main.rand.Next(4) + 4;
82490 for (int num437 = 0; num437 < num436; num437++)
82491 {
82492 int x = (int)(position.X + (float)Main.rand.Next(width - 32));
82493 int y = (int)(position.Y + (float)Main.rand.Next(height - 32));
82494 int num438 = NewNPC(GetSpawnSource_NPCHurt(), x, y, 1, whoAmI + 1);
82495 Main.npc[num438].SetDefaults(1);
82496 Main.npc[num438].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
82497 Main.npc[num438].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
82498 Main.npc[num438].ai[0] = -1000 * Main.rand.Next(3);
82499 Main.npc[num438].ai[1] = 0f;
82500 if (Main.netMode == 2 && num438 < 200)
82501 {
82502 NetMessage.SendData(23, -1, -1, null, num438);
82503 }
82504 }
82505 }
82506 else if (type == 153)
82507 {
82508 if (life > 0)
82509 {
82510 for (int num439 = 0; (double)num439 < dmg / (double)lifeMax * 30.0; num439++)
82511 {
82512 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82513 }
82514 return;
82515 }
82516 for (int num440 = 0; num440 < 15; num440++)
82517 {
82518 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82519 }
82520 Gore.NewGore(position, velocity, 177);
82521 Gore.NewGore(position, velocity, 178);
82522 Gore.NewGore(position, velocity, 179);
82523 Gore.NewGore(position, velocity, 179);
82524 }
82525 else if (type == 177)
82526 {
82527 if (life > 0)
82528 {
82529 for (int num441 = 0; (double)num441 < dmg / (double)lifeMax * 30.0; num441++)
82530 {
82531 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82532 }
82533 return;
82534 }
82535 for (int num442 = 0; num442 < 15; num442++)
82536 {
82537 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82538 }
82539 Gore.NewGore(position, velocity, 234);
82540 Gore.NewGore(position, velocity, 235);
82541 Gore.NewGore(position, velocity, 236);
82542 Gore.NewGore(position, velocity, 236);
82543 }
82544 else if (type >= 494 && type <= 495)
82545 {
82546 if (life > 0)
82547 {
82548 for (int num443 = 0; (double)num443 < dmg / (double)lifeMax * 30.0; num443++)
82549 {
82550 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82551 }
82552 return;
82553 }
82554 for (int num444 = 0; num444 < 15; num444++)
82555 {
82556 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82557 }
82558 int num445 = (type - 494) * 2;
82559 Gore.NewGore(position, velocity, 736 + num445);
82560 Gore.NewGore(position, velocity, 735 + num445);
82561 }
82562 else if (type >= 496 && type <= 497)
82563 {
82564 if (life > 0)
82565 {
82566 for (int num446 = 0; (double)num446 < dmg / (double)lifeMax * 30.0; num446++)
82567 {
82568 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82569 }
82570 return;
82571 }
82572 for (int num447 = 0; num447 < 15; num447++)
82573 {
82574 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82575 }
82576 int num448 = type - 496;
82577 Gore.NewGore(position, velocity, 739 + num448);
82578 }
82579 else if (type >= 498 && type <= 506)
82580 {
82581 if (life > 0)
82582 {
82583 for (int num449 = 0; (double)num449 < dmg / (double)lifeMax * 30.0; num449++)
82584 {
82585 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82586 }
82587 return;
82588 }
82589 for (int num450 = 0; num450 < 15; num450++)
82590 {
82591 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82592 }
82593 int num451 = type - 498;
82594 Gore.NewGore(position, velocity, 750 + num451);
82595 Gore.NewGore(new Vector2(position.X, position.Y + 16f), velocity, 741 + num451);
82596 Gore.NewGore(new Vector2(position.X, position.Y + 18f), velocity, 759 + num451);
82597 }
82598 else if (type == 49 || type == 51 || type == 93 || type == 150 || type == 152 || type == 226)
82599 {
82600 if (life > 0)
82601 {
82602 for (int num452 = 0; (double)num452 < dmg / (double)lifeMax * 30.0; num452++)
82603 {
82604 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82605 }
82606 return;
82607 }
82608 for (int num453 = 0; num453 < 15; num453++)
82609 {
82610 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82611 }
82612 if (type == 51)
82613 {
82614 Gore.NewGore(position, velocity, 83);
82615 }
82616 else if (type == 93)
82617 {
82618 Gore.NewGore(position, velocity, 107);
82619 }
82620 else if (type == 150)
82621 {
82622 Gore.NewGore(position, velocity, 164);
82623 Gore.NewGore(position, velocity, 165);
82624 }
82625 else if (type == 152)
82626 {
82627 Gore.NewGore(position, velocity, 175);
82628 Gore.NewGore(position, velocity, 176);
82629 Gore.NewGore(position, velocity, 176);
82630 }
82631 else if (type == 226)
82632 {
82633 Gore.NewGore(position, velocity, 317);
82634 Gore.NewGore(position, velocity, 318);
82635 Gore.NewGore(position, velocity, 318);
82636 Gore.NewGore(position, velocity, 319);
82637 }
82638 else
82639 {
82640 Gore.NewGore(position, velocity, 82);
82641 }
82642 }
82643 else if (type == 611)
82644 {
82645 if (life > 0)
82646 {
82647 for (int num454 = 0; (double)num454 < dmg / (double)lifeMax * 30.0; num454++)
82648 {
82649 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82650 }
82651 return;
82652 }
82653 for (int num455 = 0; num455 < 15; num455++)
82654 {
82655 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82656 }
82657 Gore.NewGore(position, velocity, 1164);
82658 Gore.NewGore(position, velocity, 1164);
82659 Gore.NewGore(position, velocity, 1165);
82660 }
82661 else if (type == 624)
82662 {
82663 if (life > 0)
82664 {
82665 for (int num456 = 0; (double)num456 < dmg / (double)lifeMax * 20.0; num456++)
82666 {
82667 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82668 }
82669 return;
82670 }
82671 for (int num457 = 0; num457 < 10; num457++)
82672 {
82673 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82674 }
82675 Gore.NewGore(position, velocity, 1190);
82676 Gore.NewGore(position, velocity, 1191);
82677 Gore.NewGore(position, velocity, 1192);
82678 Gore.NewGore(position, velocity, 1193);
82679 }
82680 else if (type == 628)
82681 {
82682 if (life > 0)
82683 {
82684 for (int num458 = 0; (double)num458 < dmg / (double)lifeMax * 20.0; num458++)
82685 {
82686 Dust.NewDust(position, width, height, 3, hitDirection, -1f);
82687 }
82688 return;
82689 }
82690 for (int num459 = 0; num459 < 10; num459++)
82691 {
82692 Dust.NewDust(position, width, height, 3, 2 * hitDirection, -2f);
82693 }
82694 Gore.NewGore(position, velocity, 1205);
82695 Gore.NewGore(position, velocity, 1206);
82696 Gore.NewGore(position, velocity, 1206);
82697 Gore.NewGore(position, velocity, 1207);
82698 }
82699 else if (type >= 646 && type <= 652)
82700 {
82701 int num460 = 138;
82702 if (type < 652)
82703 {
82704 num460 = 86 + (type - 646);
82705 }
82706 if (life > 0)
82707 {
82708 for (int num461 = 0; (double)num461 < dmg / (double)lifeMax * 20.0; num461++)
82709 {
82710 Dust.NewDust(position, width, height, num460, hitDirection, -1f);
82711 }
82712 return;
82713 }
82714 for (int num462 = 0; num462 < 10; num462++)
82715 {
82716 Dust.NewDust(position, width, height, num460, 2 * hitDirection, -2f);
82717 }
82718 int num463 = (type - 646) * 2;
82719 Gore.NewGore(position, velocity, 1234 + num463);
82720 Gore.NewGore(position, velocity, 1235 + num463);
82721 }
82722 else if (type >= 639 && type <= 645)
82723 {
82724 int num464 = 138;
82725 if (type < 645)
82726 {
82727 num464 = 86 + (type - 639);
82728 }
82729 if (life > 0)
82730 {
82731 for (int num465 = 0; (double)num465 < dmg / (double)lifeMax * 20.0; num465++)
82732 {
82733 Dust.NewDust(position, width, height, num464, hitDirection, -1f);
82734 }
82735 return;
82736 }
82737 for (int num466 = 0; num466 < 10; num466++)
82738 {
82739 Dust.NewDust(position, width, height, num464, 2 * hitDirection, -2f);
82740 }
82741 Gore.NewGore(position, velocity, 1227 + (type - 639));
82742 }
82743 else if (type == 46 || type == 55 || type == 67 || type == 74 || type == 102 || type == 224 || type == 230 || type == 297 || type == 298 || type == 299 || type == 300 || type == 303 || type == 337 || type == 538 || type == 540 || type == 587 || type == 610 || type == 614 || type == 616 || type == 617 || type == 625 || type == 626 || type == 627 || type == 615 || type == 671 || type == 672 || type == 673 || type == 674 || type == 675)
82744 {
82745 if (life > 0)
82746 {
82747 for (int num467 = 0; (double)num467 < dmg / (double)lifeMax * 20.0; num467++)
82748 {
82749 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82750 }
82751 return;
82752 }
82753 for (int num468 = 0; num468 < 10; num468++)
82754 {
82755 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82756 }
82757 if (type == 46 || type == 303 || type == 337 || type == 540)
82758 {
82759 Gore.NewGore(position, velocity, 76);
82760 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 77);
82761 if (type == 303)
82762 {
82763 for (int num469 = 0; num469 < 10; num469++)
82764 {
82765 Dust.NewDust(position, width, height, 193, 2 * hitDirection, -2f);
82766 }
82767 }
82768 if (type == 540)
82769 {
82770 Gore.NewGore(position, velocity, 926);
82771 }
82772 }
82773 else if (type == 67)
82774 {
82775 Gore.NewGore(position, velocity, 95);
82776 Gore.NewGore(position, velocity, 95);
82777 Gore.NewGore(position, velocity, 96);
82778 }
82779 else if (type == 55 || type == 230)
82780 {
82781 Gore.NewGore(position, velocity, 553);
82782 Gore.NewGore(position, velocity, 554);
82783 }
82784 else if (type == 615)
82785 {
82786 Gore.NewGore(position, velocity, 1198);
82787 Gore.NewGore(position, velocity, 1199);
82788 Gore.NewGore(position, velocity, 1200);
82789 Gore.NewGore(position, velocity, 1200);
82790 }
82791 else if (type == 74)
82792 {
82793 Gore.NewGore(position, velocity, 100);
82794 }
82795 else if (type == 297)
82796 {
82797 Gore.NewGore(position, velocity, 431);
82798 }
82799 else if (type == 298)
82800 {
82801 Gore.NewGore(position, velocity, 432);
82802 }
82803 else if (type == 671)
82804 {
82805 Gore.NewGore(position, velocity, 1277);
82806 Gore.NewGore(base.Center + new Vector2(4f, 0f), velocity, 1279);
82807 Gore.NewGore(base.Center + new Vector2(-4f, 0f), velocity, 1279);
82808 }
82809 else if (type == 672)
82810 {
82811 Gore.NewGore(position, velocity, 1280);
82812 Gore.NewGore(base.Center + new Vector2(4f, 0f), velocity, 1281);
82813 Gore.NewGore(base.Center + new Vector2(-4f, 0f), velocity, 1281);
82814 }
82815 else if (type == 673)
82816 {
82817 Gore.NewGore(position, velocity, 1282);
82818 Gore.NewGore(base.Center + new Vector2(4f, 0f), velocity, 1283);
82819 Gore.NewGore(base.Center + new Vector2(-4f, 0f), velocity, 1283);
82820 }
82821 else if (type == 674)
82822 {
82823 Gore.NewGore(position, velocity, 1284);
82824 Gore.NewGore(base.Center + new Vector2(4f, 0f), velocity, 1285);
82825 Gore.NewGore(base.Center + new Vector2(-4f, 0f), velocity, 1285);
82826 }
82827 else if (type == 675)
82828 {
82829 Gore.NewGore(position, velocity, 1286);
82830 Gore.NewGore(base.Center + new Vector2(4f, 0f), velocity, 1287);
82831 Gore.NewGore(base.Center + new Vector2(-4f, 0f), velocity, 1287);
82832 }
82833 else if (type == 299)
82834 {
82835 Gore.NewGore(position, velocity, 433);
82836 }
82837 else if (type == 538)
82838 {
82839 Gore.NewGore(position, velocity, 897);
82840 }
82841 else if (type == 300)
82842 {
82843 Gore.NewGore(position, velocity, 434);
82844 }
82845 else if (type == 610)
82846 {
82847 Gore.NewGore(position, velocity, 1163);
82848 }
82849 else if (type == 626)
82850 {
82851 Gore.NewGore(position, velocity, 1197);
82852 }
82853 else if (type == 102)
82854 {
82855 Gore.NewGore(position, velocity, 116);
82856 }
82857 else if (type == 224)
82858 {
82859 Gore.NewGore(position, velocity, 312);
82860 Gore.NewGore(position, velocity, 313);
82861 }
82862 else if (type == 587)
82863 {
82864 for (int num470 = 0; num470 < 50; num470++)
82865 {
82866 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
82867 }
82868 Gore.NewGore(position, velocity, 1104);
82869 Gore.NewGore(position, velocity, 1105);
82870 }
82871 else if (type == 616)
82872 {
82873 Gore.NewGore(position, velocity, 1166);
82874 Gore.NewGore(position, velocity, 1167);
82875 Gore.NewGore(position, velocity, 1168);
82876 Gore.NewGore(position, velocity, 1168);
82877 }
82878 else if (type == 617)
82879 {
82880 Gore.NewGore(position, velocity, 1169);
82881 Gore.NewGore(position, velocity, 1170);
82882 Gore.NewGore(position, velocity, 1171);
82883 Gore.NewGore(position, velocity, 1171);
82884 }
82885 else if (type == 625)
82886 {
82887 Gore.NewGore(position, velocity, 1194);
82888 Gore.NewGore(position, velocity, 1195);
82889 Gore.NewGore(position, velocity, 1196);
82890 Gore.NewGore(position, velocity, 1196);
82891 }
82892 }
82893 else if (type == 148 || type == 149 || type == 168 || type == 470)
82894 {
82895 if (life > 0)
82896 {
82897 for (int num471 = 0; (double)num471 < dmg / (double)lifeMax * 20.0; num471++)
82898 {
82899 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82900 }
82901 return;
82902 }
82903 for (int num472 = 0; num472 < 10; num472++)
82904 {
82905 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82906 }
82907 if (type == 148)
82908 {
82909 Gore.NewGore(position, velocity, 160);
82910 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 161);
82911 }
82912 else if (type == 149)
82913 {
82914 Gore.NewGore(position, velocity, 162);
82915 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 163);
82916 }
82917 else if (type == 168)
82918 {
82919 Gore.NewGore(position, velocity, 215);
82920 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 216);
82921 }
82922 else if (type == 470)
82923 {
82924 Gore.NewGore(position, velocity, 673);
82925 Gore.NewGore(position, velocity, 672);
82926 Gore.NewGore(position, velocity, 674);
82927 }
82928 }
82929 else if (type == 361)
82930 {
82931 if (life > 0)
82932 {
82933 for (int num473 = 0; (double)num473 < dmg / (double)lifeMax * 20.0; num473++)
82934 {
82935 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
82936 }
82937 return;
82938 }
82939 for (int num474 = 0; num474 < 10; num474++)
82940 {
82941 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82942 }
82943 Gore.NewGore(position, velocity, 551);
82944 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 552);
82945 }
82946 else if (type == 687)
82947 {
82948 if (life > 0)
82949 {
82950 for (int num475 = 0; (double)num475 < dmg / (double)lifeMax * 20.0; num475++)
82951 {
82952 Dust.NewDust(position, width, height, 16, hitDirection, -1f);
82953 }
82954 }
82955 else
82956 {
82957 Vector2 vector28 = base.Center - new Vector2(20f);
82959 }
82960 }
82961 else if (type == 685)
82962 {
82963 if (life > 0)
82964 {
82965 for (int num476 = 0; (double)num476 < dmg / (double)lifeMax * 20.0; num476++)
82966 {
82967 Dust.NewDust(position, width, height, 0, hitDirection, -1f);
82968 }
82969 }
82970 else
82971 {
82972 Vector2 vector29 = base.Center - new Vector2(20f);
82974 }
82975 }
82976 else if (type == 607)
82977 {
82978 if (life > 0)
82979 {
82980 for (int num477 = 0; (double)num477 < dmg / (double)lifeMax * 20.0; num477++)
82981 {
82982 Dust.NewDust(position, width, height, 45, hitDirection, -1f);
82983 }
82984 return;
82985 }
82986 for (int num478 = 0; num478 < 10; num478++)
82987 {
82988 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
82989 }
82990 Gore.NewGore(position, velocity, 1152);
82991 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1153);
82992 }
82993 else if (type == 366 || type == 367)
82994 {
82995 if (life > 0)
82996 {
82997 for (int num479 = 0; (double)num479 < dmg / (double)lifeMax * 20.0; num479++)
82998 {
82999 Dust.NewDust(position, width, height, 203, hitDirection, -1f);
83000 }
83001 return;
83002 }
83003 for (int num480 = 0; num480 < 10; num480++)
83004 {
83005 Dust.NewDust(position, width, height, 203, 2 * hitDirection, -2f);
83006 }
83007 if (type == 366)
83008 {
83009 Gore.NewGore(position, velocity, 561);
83010 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 562);
83011 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 563);
83012 }
83013 else
83014 {
83015 Gore.NewGore(position, velocity, 564);
83016 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 565);
83017 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 566);
83018 }
83019 }
83020 else if (type >= 362 && type <= 365)
83021 {
83022 if (life > 0)
83023 {
83024 for (int num481 = 0; (double)num481 < dmg / (double)lifeMax * 20.0; num481++)
83025 {
83026 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83027 }
83028 return;
83029 }
83030 for (int num482 = 0; num482 < 10; num482++)
83031 {
83032 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83033 }
83034 if (type == 362 || type == 363)
83035 {
83036 Gore.NewGore(position, velocity, 555);
83037 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 556);
83038 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 557);
83039 }
83040 else
83041 {
83042 Gore.NewGore(position, velocity, 558);
83043 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 559);
83044 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 560);
83045 }
83046 }
83047 else if (type == 602 || type == 603)
83048 {
83049 if (life > 0)
83050 {
83051 for (int num483 = 0; (double)num483 < dmg / (double)lifeMax * 20.0; num483++)
83052 {
83053 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83054 }
83055 return;
83056 }
83057 for (int num484 = 0; num484 < 10; num484++)
83058 {
83059 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83060 }
83061 if (type == 602 || type == 603)
83062 {
83063 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1150);
83064 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1151);
83065 }
83066 }
83067 else if (type == 608 || type == 609)
83068 {
83069 if (life > 0)
83070 {
83071 for (int num485 = 0; (double)num485 < dmg / (double)lifeMax * 20.0; num485++)
83072 {
83073 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83074 }
83075 return;
83076 }
83077 for (int num486 = 0; num486 < 10; num486++)
83078 {
83079 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83080 }
83081 if (type == 608 || type == 609)
83082 {
83083 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1154);
83084 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1155);
83085 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 1156);
83086 }
83087 }
83088 else if (type == 348 || type == 349)
83089 {
83090 if (life > 0)
83091 {
83092 for (int num487 = 0; (double)num487 < dmg / (double)lifeMax * 20.0; num487++)
83093 {
83094 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83095 }
83096 return;
83097 }
83098 for (int num488 = 0; num488 < 10; num488++)
83099 {
83100 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83101 }
83102 Gore.NewGore(position, velocity, 528);
83103 Gore.NewGore(position, velocity, 529);
83104 Gore.NewGore(position, velocity, 530);
83105 Gore.NewGore(position, velocity, 531);
83106 Gore.NewGore(position, velocity, 532);
83107 }
83108 else if (type == 351)
83109 {
83110 if (life > 0)
83111 {
83112 for (int num489 = 0; (double)num489 < dmg / (double)lifeMax * 20.0; num489++)
83113 {
83114 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83115 }
83116 return;
83117 }
83118 for (int num490 = 0; num490 < 10; num490++)
83119 {
83120 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83121 }
83122 Gore.NewGore(position, velocity, 538);
83123 Gore.NewGore(position, velocity, 539);
83124 Gore.NewGore(position, velocity, 540);
83125 Gore.NewGore(position, velocity, 541);
83126 Gore.NewGore(position, velocity, 542);
83127 }
83128 else if (type == 350)
83129 {
83130 if (life > 0)
83131 {
83132 for (int num491 = 0; (double)num491 < dmg / (double)lifeMax * 20.0; num491++)
83133 {
83134 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83135 }
83136 return;
83137 }
83138 for (int num492 = 0; num492 < 10; num492++)
83139 {
83140 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83141 }
83142 Gore.NewGore(position, velocity, 533);
83143 Gore.NewGore(position, velocity, 534);
83144 Gore.NewGore(position, velocity, 535);
83145 Gore.NewGore(position, velocity, 536);
83146 }
83147 else if (type == 47 || type == 57 || type == 58 || type == 464 || type == 465)
83148 {
83149 if (life > 0)
83150 {
83151 for (int num493 = 0; (double)num493 < dmg / (double)lifeMax * 20.0; num493++)
83152 {
83153 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83154 }
83155 return;
83156 }
83157 for (int num494 = 0; num494 < 10; num494++)
83158 {
83159 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83160 }
83161 if (type == 57)
83162 {
83163 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 84);
83164 }
83165 else if (type == 58)
83166 {
83167 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 85);
83168 }
83169 else if (type == 464)
83170 {
83171 Gore.NewGore(position, velocity, 668);
83172 Gore.NewGore(position, velocity, 669);
83173 }
83174 else if (type == 465)
83175 {
83176 Gore.NewGore(position, velocity, 670);
83177 Gore.NewGore(position, velocity, 671);
83178 }
83179 else
83180 {
83181 Gore.NewGore(position, velocity, 78);
83182 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 79);
83183 }
83184 }
83185 else if (type == 173 || type == 174 || type == 181 || type == 182 || type == 268)
83186 {
83187 if (life > 0)
83188 {
83189 for (int num495 = 0; (double)num495 < dmg / (double)lifeMax * 100.0; num495++)
83190 {
83191 Dust.NewDust(position, width, height, 5, hitDirection, -1f, alpha);
83192 }
83193 return;
83194 }
83195 for (int num496 = 0; num496 < 50; num496++)
83196 {
83197 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f, alpha);
83198 }
83199 if (type == 173)
83200 {
83201 Gore.NewGore(position, velocity, 223);
83202 Gore.NewGore(position, velocity, 224);
83203 }
83204 else if (type == 174)
83205 {
83206 Gore.NewGore(position, velocity, 225);
83207 Gore.NewGore(position, velocity, 226);
83208 }
83209 else if (type == 181)
83210 {
83211 Gore.NewGore(position, velocity, 237);
83212 }
83213 else if (type == 182)
83214 {
83215 Gore.NewGore(position, velocity, 238);
83216 Gore.NewGore(position, velocity, 239);
83217 }
83218 else if (type == 268)
83219 {
83220 Gore.NewGore(position, velocity, 403);
83221 Gore.NewGore(position, velocity, 404);
83222 Gore.NewGore(position, velocity, 405);
83223 }
83224 }
83225 else if (type == 2 || type == 190 || type == 191 || type == 192 || type == 193 || type == 194 || type == 317 || type == 318)
83226 {
83227 if (life > 0)
83228 {
83229 for (int num497 = 0; (double)num497 < dmg / (double)lifeMax * 100.0; num497++)
83230 {
83231 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83232 }
83233 return;
83234 }
83235 for (int num498 = 0; num498 < 50; num498++)
83236 {
83237 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83238 }
83239 if (type == 190)
83240 {
83241 Gore.NewGore(position, velocity, 249, scale);
83242 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 2, scale);
83243 }
83244 else if (type == 191)
83245 {
83246 Gore.NewGore(position, velocity, 248, scale);
83247 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 2, scale);
83248 }
83249 else if (type == 192)
83250 {
83251 Gore.NewGore(position, velocity, 247, scale);
83252 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 2, scale);
83253 }
83254 else if (type == 193)
83255 {
83256 Gore.NewGore(position, velocity, 252, scale);
83257 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 253, scale);
83258 }
83259 else if (type == 194)
83260 {
83261 Gore.NewGore(position, velocity, 250, scale);
83262 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 251, scale);
83263 }
83264 else if (type == 317)
83265 {
83266 Gore.NewGore(position, velocity, 447, scale);
83267 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 448, scale);
83268 }
83269 else if (type == 318)
83270 {
83271 Gore.NewGore(position, velocity, 449, scale);
83272 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 450, scale);
83273 }
83274 else
83275 {
83276 Gore.NewGore(position, velocity, 1, scale);
83277 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 2, scale);
83278 }
83279 }
83280 else if (type == 157)
83281 {
83282 if (life > 0)
83283 {
83284 for (int num499 = 0; (double)num499 < dmg / (double)lifeMax * 100.0; num499++)
83285 {
83286 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83287 }
83288 return;
83289 }
83290 for (int num500 = 0; num500 < 50; num500++)
83291 {
83292 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83293 }
83294 Gore.NewGore(position, velocity, 186);
83295 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 187);
83296 }
83297 else if (type == 133)
83298 {
83299 if (life > 0)
83300 {
83301 for (int num501 = 0; (double)num501 < dmg / (double)lifeMax * 100.0; num501++)
83302 {
83303 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83304 }
83305 if ((float)life < (float)lifeMax * 0.5f && localAI[0] == 0f)
83306 {
83307 localAI[0] = 1f;
83308 Gore.NewGore(position, velocity, 1);
83309 }
83310 }
83311 else
83312 {
83313 for (int num502 = 0; num502 < 50; num502++)
83314 {
83315 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83316 }
83317 Gore.NewGore(position, velocity, 155);
83318 Gore.NewGore(new Vector2(position.X, position.Y + 14f), velocity, 155);
83319 }
83320 }
83321 else if (type == 69 || type == 581 || type == 580 || type == 508 || type == 509 || type == 582)
83322 {
83323 float num503 = 100f;
83324 float num504 = 50f;
83325 if (type == 582)
83326 {
83327 num503 = 30f;
83328 num504 = 10f;
83329 }
83330 if (life > 0)
83331 {
83332 for (int num505 = 0; (double)num505 < dmg / (double)lifeMax * (double)num503; num505++)
83333 {
83334 Dust.NewDust(position, width, height, 250, hitDirection, -1f);
83335 }
83336 return;
83337 }
83338 for (int num506 = 0; (float)num506 < num504; num506++)
83339 {
83340 Dust.NewDust(position, width, height, 250, 2 * hitDirection, -2f);
83341 }
83342 if (type == 69)
83343 {
83344 Gore.NewGore(position, velocity, 97);
83345 Gore.NewGore(position, velocity, 98);
83346 }
83347 else if (type == 580)
83348 {
83349 Gore.NewGore(position, velocity, 1094);
83350 Gore.NewGore(position, velocity, 1095);
83351 Gore.NewGore(position, velocity, 1096);
83352 Gore.NewGore(position, velocity, 1097);
83353 }
83354 else if (type == 581)
83355 {
83356 Gore.NewGore(position, velocity, 1098);
83357 Gore.NewGore(position, velocity, 1099);
83358 Gore.NewGore(position, velocity, 1100);
83359 Gore.NewGore(position, velocity, 1101);
83360 Gore.NewGore(position, velocity, 1101);
83361 }
83362 else if (type == 508)
83363 {
83364 Gore.NewGore(position, velocity, 811);
83365 Gore.NewGore(position, velocity, 812);
83366 Gore.NewGore(position, velocity, 813);
83367 Gore.NewGore(position, velocity, 814);
83368 }
83369 else if (type == 509)
83370 {
83371 Gore.NewGore(position, velocity, 815);
83372 Gore.NewGore(position, velocity, 816);
83373 Gore.NewGore(position, velocity, 817);
83374 Gore.NewGore(position, velocity, 818);
83375 Gore.NewGore(position, velocity, 818);
83376 }
83377 else if (type == 582)
83378 {
83379 Gore.NewGore(position, velocity, 1102);
83380 Gore.NewGore(position, velocity, 1103);
83381 }
83382 }
83383 else if (type == 61)
83384 {
83385 if (life > 0)
83386 {
83387 for (int num507 = 0; (double)num507 < dmg / (double)lifeMax * 100.0; num507++)
83388 {
83389 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83390 }
83391 return;
83392 }
83393 for (int num508 = 0; num508 < 50; num508++)
83394 {
83395 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83396 }
83397 Gore.NewGore(position, velocity, 86);
83398 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 87);
83399 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 88);
83400 }
83401 else if (type == 301)
83402 {
83403 if (life > 0)
83404 {
83405 for (int num509 = 0; (double)num509 < dmg / (double)lifeMax * 100.0; num509++)
83406 {
83407 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83408 }
83409 return;
83410 }
83411 for (int num510 = 0; num510 < 50; num510++)
83412 {
83413 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83414 }
83415 Gore.NewGore(position, velocity, 438);
83416 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity, 439);
83417 }
83418 else if (type == 252)
83419 {
83420 if (life > 0)
83421 {
83422 for (int num511 = 0; (double)num511 < dmg / (double)lifeMax * 100.0; num511++)
83423 {
83424 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83425 }
83426 return;
83427 }
83428 for (int num512 = 0; num512 < 50; num512++)
83429 {
83430 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83431 }
83432 Gore.NewGore(position, velocity, 373);
83433 Gore.NewGore(position, velocity, 374);
83434 }
83435 else if (type == 489 || type == 586)
83436 {
83437 if (life > 0)
83438 {
83439 for (int num513 = 0; (double)num513 < dmg / (double)lifeMax * 100.0; num513++)
83440 {
83441 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83442 }
83443 return;
83444 }
83445 for (int num514 = 0; num514 < 50; num514++)
83446 {
83447 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83448 }
83449 if (type == 489)
83450 {
83451 Gore.NewGore(position, velocity, 722, scale);
83452 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 723, scale);
83453 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 723, scale);
83454 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 724, scale);
83455 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 724, scale);
83456 }
83457 if (type == 586)
83458 {
83459 Gore.NewGore(position, velocity, 1106, scale);
83460 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1107, scale);
83461 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1107, scale);
83462 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1108, scale);
83463 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1108, scale);
83464 }
83465 }
83466 else if (type == 534)
83467 {
83468 if (life > 0)
83469 {
83470 for (int num515 = 0; (double)num515 < dmg / (double)lifeMax * 100.0; num515++)
83471 {
83472 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83473 }
83474 return;
83475 }
83476 for (int num516 = 0; num516 < 50; num516++)
83477 {
83478 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83479 }
83480 Gore.NewGore(position, velocity, 894, scale);
83481 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 895, scale);
83482 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 895, scale);
83483 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 896, scale);
83484 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 896, scale);
83485 }
83486 else if (type == 490)
83487 {
83488 if (life > 0)
83489 {
83490 for (int num517 = 0; (double)num517 < dmg / (double)lifeMax * 100.0; num517++)
83491 {
83492 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83493 }
83494 return;
83495 }
83496 for (int num518 = 0; num518 < 50; num518++)
83497 {
83498 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83499 }
83500 Gore.NewGore(position, velocity, 725, scale);
83501 Gore.NewGore(position, velocity, 726, scale);
83502 Gore.NewGore(position, velocity, 727, scale);
83503 Gore.NewGore(position, velocity, 725 + Main.rand.Next(3), scale);
83504 Gore.NewGore(position, velocity, 725 + Main.rand.Next(3), scale);
83505 }
83506 else if (type == 65 || (type >= 542 && type <= 545))
83507 {
83508 if (life > 0)
83509 {
83510 for (int num519 = 0; (double)num519 < dmg / (double)lifeMax * 150.0; num519++)
83511 {
83512 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83513 }
83514 return;
83515 }
83516 for (int num520 = 0; num520 < 75; num520++)
83517 {
83518 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83519 }
83520 if (type == 65)
83521 {
83522 Gore.NewGore(position, velocity * 0.8f, 89);
83523 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 90);
83524 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 91);
83525 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 92);
83526 }
83527 if (type == 542)
83528 {
83529 Gore.NewGore(position, velocity * 0.8f, 944);
83530 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 945);
83531 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 946);
83532 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 947);
83533 }
83534 if (type == 543)
83535 {
83536 Gore.NewGore(position, velocity * 0.8f, 948);
83537 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 949);
83538 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 950);
83539 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 951);
83540 }
83541 if (type == 544)
83542 {
83543 Gore.NewGore(position, velocity * 0.8f, 952);
83544 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 953);
83545 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 954);
83546 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 955);
83547 }
83548 if (type == 545)
83549 {
83550 Gore.NewGore(position, velocity * 0.8f, 956);
83551 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 957);
83552 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 958);
83553 Gore.NewGore(new Vector2(position.X + 14f, position.Y), velocity * 0.8f, 959);
83554 }
83555 }
83556 else if (type == 195 || type == 196)
83557 {
83558 if (life > 0)
83559 {
83560 for (int num521 = 0; (double)num521 < dmg / (double)lifeMax * 150.0; num521++)
83561 {
83562 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83563 }
83564 return;
83565 }
83566 for (int num522 = 0; num522 < 75; num522++)
83567 {
83568 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83569 }
83570 Gore.NewGore(position, velocity, 254, scale);
83571 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 255, scale);
83572 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 255, scale);
83573 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 256, scale);
83574 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 256, scale);
83575 }
83576 else if (type == 198 || type == 199)
83577 {
83578 if (life > 0)
83579 {
83580 for (int num523 = 0; (double)num523 < dmg / (double)lifeMax * 150.0; num523++)
83581 {
83582 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83583 }
83584 return;
83585 }
83586 for (int num524 = 0; num524 < 75; num524++)
83587 {
83588 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
83589 }
83590 Gore.NewGore(position, velocity, 258, scale);
83591 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 259, scale);
83592 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 259, scale);
83593 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 260, scale);
83594 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 260, scale);
83595 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 261, scale);
83596 }
83597 else if (type == 206)
83598 {
83599 if (life > 0)
83600 {
83601 for (int num525 = 0; (double)num525 < dmg / (double)lifeMax * 150.0; num525++)
83602 {
83603 Dust.NewDust(position, width, height, 137, hitDirection, -1f);
83604 }
83605 return;
83606 }
83607 for (int num526 = 0; num526 < 75; num526++)
83608 {
83609 Dust.NewDust(position, width, height, 137, 2 * hitDirection, -2f);
83610 }
83611 Gore.NewGore(position, velocity, 273, scale);
83612 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 274, scale);
83613 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 274, scale);
83614 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 275, scale);
83615 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 275, scale);
83616 }
83617 else if (type == 342)
83618 {
83619 if (life > 0)
83620 {
83621 for (int num527 = 0; (double)num527 < dmg / (double)lifeMax * 100.0; num527++)
83622 {
83623 Dust.NewDust(position, width, height, 0, hitDirection, -1f);
83624 }
83625 return;
83626 }
83627 for (int num528 = 0; num528 < 50; num528++)
83628 {
83629 Dust.NewDust(position, width, height, 0, 2.5f * (float)hitDirection, -2.5f);
83630 }
83631 Gore.NewGore(position, velocity, 500, scale);
83632 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 501, scale);
83633 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 501, scale);
83634 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 502, scale);
83635 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 502, scale);
83636 }
83637 else if (type >= 338 && type <= 340)
83638 {
83639 if (life > 0)
83640 {
83641 for (int num529 = 0; (double)num529 < dmg / (double)lifeMax * 100.0; num529++)
83642 {
83643 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83644 }
83645 return;
83646 }
83647 for (int num530 = 0; num530 < 50; num530++)
83648 {
83649 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83650 }
83651 if (type == 338)
83652 {
83653 Gore.NewGore(position, velocity, 494, scale);
83654 }
83655 if (type == 339)
83656 {
83657 Gore.NewGore(position, velocity, 495, scale);
83658 }
83659 if (type == 340)
83660 {
83661 Gore.NewGore(position, velocity, 496, scale);
83662 }
83663 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 497, scale);
83664 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 498, scale);
83665 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 499, scale);
83666 }
83667 else if (type == 343)
83668 {
83669 if (life > 0)
83670 {
83671 for (int num531 = 0; (double)num531 < dmg / (double)lifeMax * 100.0; num531++)
83672 {
83673 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83674 }
83675 return;
83676 }
83677 for (int num532 = 0; num532 < 50; num532++)
83678 {
83679 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83680 }
83681 Gore.NewGore(position, velocity, 503, scale);
83682 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 504, scale);
83683 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 505, scale);
83684 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 506, scale);
83685 }
83686 else if ((type >= 430 && type <= 436) || type == 590 || type == 591 || type == 3 || type == 52 || type == 53 || type == 536 || type == 104 || type == 109 || type == 331 || type == 332 || type == 132 || type == 161 || type == 162 || type == 186 || type == 187 || type == 188 || type == 189 || type == 200 || type == 223 || type == 251 || type == 319 || type == 320 || type == 321 || type == 632)
83687 {
83688 if (life > 0)
83689 {
83690 for (int num533 = 0; (double)num533 < dmg / (double)lifeMax * 100.0; num533++)
83691 {
83692 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83693 }
83694 if (type == 186 && Main.rand.Next(5) == 0)
83695 {
83696 Gore.NewGore(position, velocity, 242);
83697 }
83698 if (type == 632 && Main.rand.Next(5) == 0)
83699 {
83700 Gore.NewGore(position, velocity, 1217);
83701 }
83702 if (type == 187)
83703 {
83704 for (int num534 = 0; (double)num534 < dmg / (double)lifeMax * 200.0; num534++)
83705 {
83706 Dust.NewDust(position, width, 24, 4, hitDirection, -1f, 125, new Color(0, 80, 255, 100));
83707 }
83708 }
83709 if ((type == 590 || type == 591) && !wet)
83710 {
83711 for (int num535 = 0; num535 < 3; num535++)
83712 {
83713 Dust.NewDust(position, width, 24, 6, hitDirection, -1f, 125, new Color(0, 80, 255, 100));
83714 }
83715 }
83716 return;
83717 }
83718 for (int num536 = 0; num536 < 50; num536++)
83719 {
83720 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
83721 }
83722 if (type == 187 || type == 433)
83723 {
83724 for (int num537 = 0; num537 < 25; num537++)
83725 {
83726 Dust.NewDust(position, width, 24, 4, hitDirection, -1f, 125, new Color(0, 80, 255, 100));
83727 }
83728 }
83729 if (type == 104)
83730 {
83731 Gore.NewGore(position, velocity, 117, scale);
83732 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 118, scale);
83733 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 118, scale);
83734 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 119, scale);
83735 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 119, scale);
83736 return;
83737 }
83738 if (type == 632)
83739 {
83740 Gore.NewGore(position, velocity, 1214, scale);
83741 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1215, scale);
83742 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 1215, scale);
83743 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1216, scale);
83744 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 1216, scale);
83745 if (Main.netMode != 1)
83746 {
83747 int num538 = Main.rand.Next(2) + 2;
83748 for (int num539 = 0; num539 < num538; num539++)
83749 {
83750 Vector2 vector30 = new Vector2((float)Main.rand.Next(-10, 10) * 0.2f, -3.5f - (float)Main.rand.Next(5, 10) * 0.3f - (float)num539 * 0.5f);
83751 int num540 = NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)position.Y + Main.rand.Next(height / 2) + 10, 606);
83752 Main.npc[num540].velocity = vector30;
83753 Main.npc[num540].netUpdate = true;
83754 }
83755 }
83756 return;
83757 }
83758 if (type == 331)
83759 {
83760 Gore.NewGore(position, velocity, 488, scale);
83761 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 489, scale);
83762 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 489, scale);
83763 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 490, scale);
83764 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 490, scale);
83765 return;
83766 }
83767 if (type == 332)
83768 {
83769 Gore.NewGore(position, velocity, 491, scale);
83770 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 492, scale);
83771 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 492, scale);
83772 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 493, scale);
83773 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 493, scale);
83774 return;
83775 }
83776 if (type == 109)
83777 {
83778 Gore.NewGore(position, velocity, 121, scale);
83779 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 122, scale);
83780 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 122, scale);
83781 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 123, scale);
83782 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 123, scale);
83783 Gore.NewGore(new Vector2(position.X, position.Y + 46f), velocity, 120, scale);
83784 return;
83785 }
83786 if (type == 161 || type == 431)
83787 {
83788 Gore.NewGore(position, velocity, 191, scale);
83789 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 192, scale);
83790 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 192, scale);
83791 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 193, scale);
83792 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 193, scale);
83793 return;
83794 }
83795 if (type == 162)
83796 {
83797 Gore.NewGore(position, velocity, 194, scale);
83798 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 195, scale);
83799 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 195, scale);
83800 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 196, scale);
83801 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 196, scale);
83802 return;
83803 }
83804 if (type == 188 || type == 434)
83805 {
83806 Gore.NewGore(position, velocity, 243, scale);
83807 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 244, scale);
83808 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 244, scale);
83809 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 245, scale);
83810 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 245, scale);
83811 return;
83812 }
83813 if (type == 200 || type == 436)
83814 {
83815 Gore.NewGore(position, velocity, 262, scale);
83816 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 263, scale);
83817 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 263, scale);
83818 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 264, scale);
83819 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 264, scale);
83820 return;
83821 }
83822 if (type == 319)
83823 {
83824 Gore.NewGore(position, velocity, 451, scale);
83825 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 453, scale);
83826 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 453, scale);
83827 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 452, scale);
83828 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 452, scale);
83829 return;
83830 }
83831 if (type == 320)
83832 {
83833 Gore.NewGore(position, velocity, 454, scale);
83834 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 455, scale);
83835 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 456, scale);
83836 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 456, scale);
83837 return;
83838 }
83839 if (type == 321)
83840 {
83841 Gore.NewGore(position, velocity, 457, scale);
83842 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 458, scale);
83843 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 458, scale);
83844 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 459, scale);
83845 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 459, scale);
83846 return;
83847 }
83848 if (type == 223)
83849 {
83850 Gore.NewGore(position, velocity, 309, scale);
83851 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 310, scale);
83852 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 310, scale);
83853 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 311, scale);
83854 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 311, scale);
83855 return;
83856 }
83857 if (type == 132)
83858 {
83859 Gore.NewGore(position, velocity, 154);
83860 }
83861 else if (type == 186 || type == 432)
83862 {
83863 Gore.NewGore(position, velocity, 241);
83864 }
83865 else if (type == 189 || type == 435)
83866 {
83867 Gore.NewGore(position, velocity, 246);
83868 }
83869 else if (type == 251)
83870 {
83871 Gore.NewGore(position, velocity, 372);
83872 }
83873 else if (type != 187 && type != 433)
83874 {
83875 Gore.NewGore(position, velocity, 3);
83876 }
83877 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 4);
83878 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 4);
83879 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 5);
83880 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 5);
83881 if (type == 186 || type == 432)
83882 {
83883 Gore.NewGore(position, velocity, 242);
83884 }
83885 if ((type == 186 || type == 432) && Main.rand.Next(2) == 0)
83886 {
83887 Gore.NewGore(position, velocity, 242);
83888 }
83889 }
83890 else if (type == 83 || type == 84 || type == 179)
83891 {
83892 if (life > 0)
83893 {
83894 for (int num541 = 0; (double)num541 < dmg / (double)lifeMax * 50.0; num541++)
83895 {
83896 int num542 = Dust.NewDust(position, width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
83897 Main.dust[num542].noGravity = true;
83898 }
83899 return;
83900 }
83901 for (int num543 = 0; num543 < 20; num543++)
83902 {
83903 int num544 = Dust.NewDust(position, width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
83904 Dust dust = Main.dust[num544];
83905 dust.velocity *= 2f;
83906 Main.dust[num544].noGravity = true;
83907 }
83908 int num545 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)), 61, scale);
83910 gore2.velocity *= 0.5f;
83911 num545 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)), 61, scale);
83912 gore2 = Main.gore[num545];
83913 gore2.velocity *= 0.5f;
83914 num545 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)), 61, scale);
83915 gore2 = Main.gore[num545];
83916 gore2.velocity *= 0.5f;
83917 }
83918 else if (type == 262 || type == 263 || type == 264)
83919 {
83920 if (life > 0)
83921 {
83922 for (int num546 = 0; (double)num546 < dmg / (double)lifeMax * 100.0; num546++)
83923 {
83924 if (type == 262 && life > lifeMax / 2 && Main.rand.Next(3) != 0)
83925 {
83926 Dust.NewDust(position, width, height, 166, hitDirection, -1f);
83927 }
83928 else if (type == 265 && Main.rand.Next(3) != 0)
83929 {
83930 Dust.NewDust(position, width, height, 166, hitDirection, -1f);
83931 }
83932 else
83933 {
83934 Dust.NewDust(position, width, height, 167, hitDirection, -1f);
83935 }
83936 }
83937 return;
83938 }
83939 for (int num547 = 0; num547 < 150; num547++)
83940 {
83941 if (type == 265 && Main.rand.Next(3) != 0)
83942 {
83943 Dust.NewDust(position, width, height, 166, 2 * hitDirection, -2f);
83944 }
83945 else
83946 {
83947 Dust.NewDust(position, width, height, 167, 2 * hitDirection, -2f);
83948 }
83949 }
83950 if (type == 262)
83951 {
83952 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 381, scale);
83953 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 382, scale);
83954 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 383, scale);
83955 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 384, scale);
83956 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 385, scale);
83957 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 386, scale);
83958 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 386, scale);
83959 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 387, scale);
83960 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 387, scale);
83961 }
83962 if (type == 263)
83963 {
83964 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 390, scale);
83965 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 391, scale);
83966 }
83967 if (type == 264)
83968 {
83969 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 388, scale);
83970 Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), velocity, 389, scale);
83971 }
83972 }
83973 else if (type == 265)
83974 {
83975 if (life >= 0)
83976 {
83977 return;
83978 }
83979 for (int num548 = 0; num548 < 15; num548++)
83980 {
83981 if (Main.rand.Next(3) != 0)
83982 {
83983 Dust.NewDust(position, width, height, 166, hitDirection, -1f);
83984 }
83985 else
83986 {
83987 Dust.NewDust(position, width, height, 167, hitDirection, -1f);
83988 }
83989 }
83990 }
83991 else if (type == 266)
83992 {
83993 if (life > 0)
83994 {
83995 for (int num549 = 0; (double)num549 < dmg / (double)lifeMax * 100.0; num549++)
83996 {
83997 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
83998 }
83999 return;
84000 }
84001 for (int num550 = 0; num550 < 150; num550++)
84002 {
84003 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
84004 }
84005 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 396);
84006 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 397);
84007 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 398);
84008 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 399);
84009 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 400);
84010 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 401);
84011 }
84012 else if (type == 267)
84013 {
84014 if (life > 0)
84015 {
84016 for (int num551 = 0; (double)num551 < dmg / (double)lifeMax * 50.0; num551++)
84017 {
84018 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84019 }
84020 return;
84021 }
84022 for (int num552 = 0; num552 < 20; num552++)
84023 {
84024 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
84025 }
84026 Gore.NewGore(position, velocity, 402);
84027 }
84028 else if (type == 4 || type == 126 || type == 125)
84029 {
84030 if (life > 0)
84031 {
84032 for (int num553 = 0; (double)num553 < dmg / (double)lifeMax * 100.0; num553++)
84033 {
84034 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84035 }
84036 return;
84037 }
84038 for (int num554 = 0; num554 < 150; num554++)
84039 {
84040 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
84041 }
84042 for (int num555 = 0; num555 < 2; num555++)
84043 {
84044 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2);
84045 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7);
84046 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9);
84047 if (type == 4)
84048 {
84049 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 10);
84050 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
84051 }
84052 else if (type == 125)
84053 {
84054 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 146);
84055 }
84056 else if (type == 126)
84057 {
84058 Gore.NewGore(position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 145);
84059 }
84060 }
84061 if (type == 125 || type == 126)
84062 {
84063 for (int num556 = 0; num556 < 10; num556++)
84064 {
84065 int num557 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
84066 Dust dust = Main.dust[num557];
84067 dust.velocity *= 1.4f;
84068 }
84069 for (int num558 = 0; num558 < 5; num558++)
84070 {
84071 int num559 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
84072 Main.dust[num559].noGravity = true;
84073 Dust dust = Main.dust[num559];
84074 dust.velocity *= 5f;
84075 num559 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
84076 dust = Main.dust[num559];
84077 dust.velocity *= 3f;
84078 }
84079 int num560 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
84081 gore2.velocity *= 0.4f;
84082 Main.gore[num560].velocity.X += 1f;
84083 Main.gore[num560].velocity.Y += 1f;
84084 num560 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
84085 gore2 = Main.gore[num560];
84086 gore2.velocity *= 0.4f;
84087 Main.gore[num560].velocity.X -= 1f;
84088 Main.gore[num560].velocity.Y += 1f;
84089 num560 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
84090 gore2 = Main.gore[num560];
84091 gore2.velocity *= 0.4f;
84092 Main.gore[num560].velocity.X += 1f;
84093 Main.gore[num560].velocity.Y -= 1f;
84094 num560 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
84095 gore2 = Main.gore[num560];
84096 gore2.velocity *= 0.4f;
84097 Main.gore[num560].velocity.X -= 1f;
84098 Main.gore[num560].velocity.Y -= 1f;
84099 }
84100 }
84101 else if (type == 5)
84102 {
84103 if (life > 0)
84104 {
84105 for (int num561 = 0; (double)num561 < dmg / (double)lifeMax * 50.0; num561++)
84106 {
84107 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84108 }
84109 return;
84110 }
84111 for (int num562 = 0; num562 < 20; num562++)
84112 {
84113 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
84114 }
84115 Gore.NewGore(position, velocity, 6);
84116 Gore.NewGore(position, velocity, 7);
84117 }
84118 else if (type == 113 || type == 114)
84119 {
84120 if (life > 0)
84121 {
84122 for (int num563 = 0; num563 < 20; num563++)
84123 {
84124 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84125 }
84126 return;
84127 }
84128 for (int num564 = 0; num564 < 50; num564++)
84129 {
84130 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -1f);
84131 }
84132 if (type == 114)
84133 {
84134 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 137, scale);
84135 Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2)), velocity, 139, scale);
84136 Gore.NewGore(new Vector2(position.X + (float)(width / 2), position.Y), velocity, 139, scale);
84137 Gore.NewGore(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), velocity, 137, scale);
84138 return;
84139 }
84140 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 137, scale);
84141 Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2)), velocity, 138, scale);
84142 Gore.NewGore(new Vector2(position.X + (float)(width / 2), position.Y), velocity, 138, scale);
84143 Gore.NewGore(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), velocity, 137, scale);
84144 if (!(Main.player[Main.myPlayer].position.Y / 16f > (float)(Main.maxTilesY - 250)))
84145 {
84146 return;
84147 }
84148 int num565 = (int)Main.screenPosition.Y;
84149 int num566 = num565 + Main.screenWidth;
84150 int num567 = (int)position.X;
84151 if (direction > 0)
84152 {
84153 num567 -= 80;
84154 }
84155 int num568 = num567 + 140;
84156 int num569 = num567;
84157 for (int num570 = num565; num570 < num566; num570 += 50)
84158 {
84159 for (; num569 < num568; num569 += 46)
84160 {
84161 for (int num571 = 0; num571 < 5; num571++)
84162 {
84163 Dust.NewDust(new Vector2(num569, num570), 32, 32, 5, (float)Main.rand.Next(-60, 61) * 0.1f, (float)Main.rand.Next(-60, 61) * 0.1f);
84164 }
84165 Gore.NewGore(Velocity: new Vector2((float)Main.rand.Next(-80, 81) * 0.1f, (float)Main.rand.Next(-60, 21) * 0.1f), Position: new Vector2(num569, num570), Type: Main.rand.Next(140, 143));
84166 }
84167 num569 = num567;
84168 }
84169 }
84170 else if (type == 115 || type == 116)
84171 {
84172 if (life > 0)
84173 {
84174 for (int num572 = 0; num572 < 5; num572++)
84175 {
84176 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84177 }
84178 return;
84179 }
84180 if (type == 115 && Main.netMode != 1)
84181 {
84182 NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), 116);
84183 for (int num573 = 0; num573 < 10; num573++)
84184 {
84185 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84186 }
84187 return;
84188 }
84189 for (int num574 = 0; num574 < 20; num574++)
84190 {
84191 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84192 }
84193 Gore.NewGore(position, velocity, 132, scale);
84194 Gore.NewGore(position, velocity, 133, scale);
84195 }
84196 else if (type >= 117 && type <= 119)
84197 {
84198 if (life > 0)
84199 {
84200 for (int num575 = 0; num575 < 5; num575++)
84201 {
84202 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84203 }
84204 return;
84205 }
84206 for (int num576 = 0; num576 < 10; num576++)
84207 {
84208 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84209 }
84210 Gore.NewGore(position, velocity, 134 + type - 117, scale);
84211 }
84212 else if (type == 217 || type == 218 || type == 219)
84213 {
84214 if (life > 0)
84215 {
84216 for (int num577 = 0; (double)num577 < dmg / (double)lifeMax * 100.0; num577++)
84217 {
84218 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84219 }
84220 return;
84221 }
84222 for (int num578 = 0; num578 < 50; num578++)
84223 {
84224 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84225 }
84226 if (type == 217)
84227 {
84228 int num579 = Gore.NewGore(position, velocity, 292, scale);
84229 num579 = Gore.NewGore(position, velocity, 293, scale);
84230 }
84231 if (type == 218)
84232 {
84233 int num579 = Gore.NewGore(position, velocity, 295, scale);
84234 num579 = Gore.NewGore(position, velocity, 296, scale);
84235 }
84236 if (type == 219)
84237 {
84238 int num579 = Gore.NewGore(position, velocity, 294, scale);
84239 }
84240 }
84241 else if (type == 222)
84242 {
84243 if (life > 0)
84244 {
84245 for (int num580 = 0; (double)num580 < dmg / (double)lifeMax * 100.0; num580++)
84246 {
84247 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84248 }
84249 return;
84250 }
84251 for (int num581 = 0; num581 < 50; num581++)
84252 {
84253 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84254 }
84255 Gore.NewGore(new Vector2(position.X, position.Y - 35f), velocity, 303, scale);
84256 Gore.NewGore(new Vector2(position.X, position.Y - 45f), velocity, 304, scale);
84257 Gore.NewGore(new Vector2(position.X, position.Y), velocity, 305, scale);
84258 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 306, scale);
84259 Gore.NewGore(new Vector2(position.X, position.Y + 10f), velocity, 307, scale);
84260 Gore.NewGore(new Vector2(position.X, position.Y - 10f), velocity, 308, scale);
84261 }
84262 else if (type == 6 || type == 94 || type == 166)
84263 {
84264 if (life > 0)
84265 {
84266 for (int num582 = 0; (double)num582 < dmg / (double)lifeMax * 100.0; num582++)
84267 {
84268 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84269 }
84270 return;
84271 }
84272 for (int num583 = 0; num583 < 50; num583++)
84273 {
84274 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84275 }
84276 if (type == 94)
84277 {
84278 int num584 = Gore.NewGore(position, velocity, 108, scale);
84279 num584 = Gore.NewGore(position, velocity, 108, scale);
84280 num584 = Gore.NewGore(position, velocity, 109, scale);
84281 num584 = Gore.NewGore(position, velocity, 110, scale);
84282 }
84283 else if (type == 166)
84284 {
84285 int num584 = Gore.NewGore(position, velocity, 209, scale);
84286 num584 = Gore.NewGore(position, velocity, 210, scale);
84287 num584 = Gore.NewGore(position, velocity, 211, scale);
84288 }
84289 else
84290 {
84291 int num584 = Gore.NewGore(position, velocity, 14, scale);
84292 Main.gore[num584].alpha = alpha;
84293 num584 = Gore.NewGore(position, velocity, 15, scale);
84294 Main.gore[num584].alpha = alpha;
84295 }
84296 }
84297 else if (type == 101)
84298 {
84299 if (life > 0)
84300 {
84301 for (int num585 = 0; (double)num585 < dmg / (double)lifeMax * 100.0; num585++)
84302 {
84303 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84304 }
84305 return;
84306 }
84307 for (int num586 = 0; num586 < 50; num586++)
84308 {
84309 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84310 }
84311 int num587 = Gore.NewGore(position, velocity, 110, scale);
84312 num587 = Gore.NewGore(position, velocity, 114, scale);
84313 num587 = Gore.NewGore(position, velocity, 114, scale);
84314 num587 = Gore.NewGore(position, velocity, 115, scale);
84315 }
84316 else if (type == 7 || type == 8 || type == 9)
84317 {
84318 if (life > 0)
84319 {
84320 for (int num588 = 0; (double)num588 < dmg / (double)lifeMax * 100.0; num588++)
84321 {
84322 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84323 }
84324 return;
84325 }
84326 for (int num589 = 0; num589 < 50; num589++)
84327 {
84328 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84329 }
84330 int num590 = Gore.NewGore(position, velocity, type - 7 + 18);
84331 Main.gore[num590].alpha = alpha;
84332 }
84333 else if (type == 98 || type == 99 || type == 100)
84334 {
84335 if (life > 0)
84336 {
84337 for (int num591 = 0; (double)num591 < dmg / (double)lifeMax * 100.0; num591++)
84338 {
84339 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84340 }
84341 return;
84342 }
84343 for (int num592 = 0; num592 < 50; num592++)
84344 {
84345 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84346 }
84347 int num593 = Gore.NewGore(position, velocity, 110);
84348 Main.gore[num593].alpha = alpha;
84349 }
84350 else if (type == 10 || type == 11 || type == 12)
84351 {
84352 if (life > 0)
84353 {
84354 for (int num594 = 0; (double)num594 < dmg / (double)lifeMax * 50.0; num594++)
84355 {
84356 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84357 }
84358 return;
84359 }
84360 for (int num595 = 0; num595 < 10; num595++)
84361 {
84362 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84363 }
84364 Gore.NewGore(position, velocity, type - 7 + 18);
84365 }
84366 else if (type == 95 || type == 96 || type == 97)
84367 {
84368 if (life > 0)
84369 {
84370 for (int num596 = 0; (double)num596 < dmg / (double)lifeMax * 50.0; num596++)
84371 {
84372 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84373 }
84374 return;
84375 }
84376 for (int num597 = 0; num597 < 10; num597++)
84377 {
84378 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84379 }
84380 Gore.NewGore(position, velocity, type - 95 + 111);
84381 }
84382 else if (type == 13 || type == 14 || type == 15)
84383 {
84384 if (life > 0)
84385 {
84386 for (int num598 = 0; (double)num598 < dmg / (double)lifeMax * 100.0; num598++)
84387 {
84388 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
84389 }
84390 return;
84391 }
84392 for (int num599 = 0; num599 < 50; num599++)
84393 {
84394 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
84395 }
84396 if (type == 13)
84397 {
84398 Gore.NewGore(position, velocity, 24);
84399 Gore.NewGore(position, velocity, 25);
84400 }
84401 else if (type == 14)
84402 {
84403 Gore.NewGore(position, velocity, 26);
84404 Gore.NewGore(position, velocity, 27);
84405 }
84406 else
84407 {
84408 Gore.NewGore(position, velocity, 28);
84409 Gore.NewGore(position, velocity, 29);
84410 }
84411 }
84412 else if (type == 17)
84413 {
84414 if (life > 0)
84415 {
84416 for (int num600 = 0; (double)num600 < dmg / (double)lifeMax * 100.0; num600++)
84417 {
84418 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84419 }
84420 return;
84421 }
84422 for (int num601 = 0; num601 < 50; num601++)
84423 {
84424 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84425 }
84426 if (altTexture == 0)
84427 {
84428 Gore.NewGore(position, velocity, IsShimmerVariant ? 1320 : 30);
84429 }
84430 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1322 : 31);
84431 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1322 : 31);
84432 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1323 : 32);
84433 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1323 : 32);
84434 }
84435 else if (type == 441)
84436 {
84437 if (life > 0)
84438 {
84439 for (int num602 = 0; (double)num602 < dmg / (double)lifeMax * 100.0; num602++)
84440 {
84441 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84442 }
84443 return;
84444 }
84445 for (int num603 = 0; num603 < 50; num603++)
84446 {
84447 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84448 }
84449 Gore.NewGore(position, velocity, IsShimmerVariant ? 1358 : 768);
84450 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1359 : 769);
84451 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1361 : 770);
84452 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1360 : 771);
84453 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1360 : 771);
84454 }
84455 else if (type == 86)
84456 {
84457 if (life > 0)
84458 {
84459 for (int num604 = 0; (double)num604 < dmg / (double)lifeMax * 100.0; num604++)
84460 {
84461 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84462 }
84463 return;
84464 }
84465 for (int num605 = 0; num605 < 50; num605++)
84466 {
84467 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84468 }
84469 Gore.NewGore(position, velocity, 101);
84470 Gore.NewGore(position, velocity, 102);
84471 Gore.NewGore(position, velocity, 103);
84472 Gore.NewGore(position, velocity, 103);
84473 Gore.NewGore(position, velocity, 104);
84474 Gore.NewGore(position, velocity, 104);
84475 Gore.NewGore(position, velocity, 105);
84476 }
84477 else if (type == 155)
84478 {
84479 if (life > 0)
84480 {
84481 for (int num606 = 0; (double)num606 < dmg / (double)lifeMax * 100.0; num606++)
84482 {
84483 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84484 }
84485 return;
84486 }
84487 for (int num607 = 0; num607 < 50; num607++)
84488 {
84489 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84490 }
84491 Gore.NewGore(position, velocity, 181);
84492 Gore.NewGore(position, velocity, 182);
84493 Gore.NewGore(position, velocity, 183);
84494 }
84495 else if (type == 329)
84496 {
84497 if (life > 0)
84498 {
84499 for (int num608 = 0; (double)num608 < dmg / (double)lifeMax * 100.0; num608++)
84500 {
84501 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84502 }
84503 return;
84504 }
84505 for (int num609 = 0; num609 < 50; num609++)
84506 {
84507 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84508 }
84509 Gore.NewGore(position, velocity, 485);
84510 Gore.NewGore(position, velocity, 486);
84511 Gore.NewGore(position, velocity, 487);
84512 }
84513 else if (type == 163 || type == 238)
84514 {
84515 if (life > 0)
84516 {
84517 for (int num610 = 0; (double)num610 < dmg / (double)lifeMax * 100.0; num610++)
84518 {
84519 Dust.NewDust(position, width, height, 18, hitDirection, -1f);
84520 }
84521 return;
84522 }
84523 for (int num611 = 0; num611 < 50; num611++)
84524 {
84525 Dust.NewDust(position, width, height, 18, 2.5f * (float)hitDirection, -2.5f);
84526 }
84527 Gore.NewGore(position, velocity, 205);
84528 Gore.NewGore(position, velocity, 206);
84529 Gore.NewGore(position, velocity, 206);
84530 Gore.NewGore(position, velocity, 206);
84531 Gore.NewGore(position, velocity, 206);
84532 }
84533 else if (type == 164 || type == 165)
84534 {
84535 if (life > 0)
84536 {
84537 for (int num612 = 0; (double)num612 < dmg / (double)lifeMax * 100.0; num612++)
84538 {
84539 Dust.NewDust(position, width, height, 18, hitDirection, -1f);
84540 }
84541 return;
84542 }
84543 for (int num613 = 0; num613 < 50; num613++)
84544 {
84545 Dust.NewDust(position, width, height, 18, 2.5f * (float)hitDirection, -2.5f);
84546 }
84547 Gore.NewGore(position, velocity, 207);
84548 Gore.NewGore(position, velocity, 208);
84549 Gore.NewGore(position, velocity, 208);
84550 Gore.NewGore(position, velocity, 208);
84551 Gore.NewGore(position, velocity, 208);
84552 }
84553 else if (type == 239 || type == 240)
84554 {
84555 if (life > 0)
84556 {
84557 for (int num614 = 0; (double)num614 < dmg / (double)lifeMax * 100.0; num614++)
84558 {
84559 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84560 }
84561 return;
84562 }
84563 for (int num615 = 0; num615 < 50; num615++)
84564 {
84565 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84566 }
84567 Gore.NewGore(position, velocity, 351);
84568 Gore.NewGore(position, velocity, 352);
84569 Gore.NewGore(position, velocity, 352);
84570 Gore.NewGore(position, velocity, 353);
84571 Gore.NewGore(position, velocity, 353);
84572 }
84573 else if (type == 236 || type == 237)
84574 {
84575 if (life > 0)
84576 {
84577 for (int num616 = 0; (double)num616 < dmg / (double)lifeMax * 100.0; num616++)
84578 {
84579 Dust.NewDust(position, width, height, 18, hitDirection, -1f);
84580 }
84581 return;
84582 }
84583 for (int num617 = 0; num617 < 50; num617++)
84584 {
84585 Dust.NewDust(position, width, height, 18, 2.5f * (float)hitDirection, -2.5f);
84586 }
84587 Gore.NewGore(position, velocity, 332);
84588 Gore.NewGore(position, velocity, 333);
84589 Gore.NewGore(position, velocity, 334);
84590 Gore.NewGore(position, velocity, 335);
84591 Gore.NewGore(position, velocity, 335);
84592 }
84593 else if (type == 241)
84594 {
84595 if (life > 0)
84596 {
84597 for (int num618 = 0; (double)num618 < dmg / (double)lifeMax * 100.0; num618++)
84598 {
84599 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84600 }
84601 return;
84602 }
84603 for (int num619 = 0; num619 < 50; num619++)
84604 {
84605 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84606 }
84607 Gore.NewGore(position, velocity, 354);
84608 Gore.NewGore(position, velocity, 355);
84609 }
84610 else if (type == 242)
84611 {
84612 if (life > 0)
84613 {
84614 for (int num620 = 0; (double)num620 < dmg / (double)lifeMax * 100.0; num620++)
84615 {
84616 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84617 }
84618 return;
84619 }
84620 for (int num621 = 0; num621 < 50; num621++)
84621 {
84622 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84623 }
84624 Gore.NewGore(position, velocity, 356);
84625 Gore.NewGore(position, velocity, 357);
84626 Gore.NewGore(position, velocity, 357);
84627 Gore.NewGore(position, velocity, 358);
84628 Gore.NewGore(position, velocity, 358);
84629 }
84630 else if (type >= 105 && type <= 108)
84631 {
84632 if (life > 0)
84633 {
84634 for (int num622 = 0; (double)num622 < dmg / (double)lifeMax * 100.0; num622++)
84635 {
84636 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84637 }
84638 return;
84639 }
84640 for (int num623 = 0; num623 < 50; num623++)
84641 {
84642 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84643 }
84644 if (type == 105 || type == 107)
84645 {
84646 Gore.NewGore(position, velocity, IsShimmerVariant ? 1308 : 124);
84647 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1309 : 125);
84648 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1309 : 125);
84649 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1310 : 126);
84650 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1310 : 126);
84651 return;
84652 }
84653 if (altTexture == 0 || type == 106)
84654 {
84655 Gore.NewGore(position, velocity, IsShimmerVariant ? 1373 : 127);
84656 }
84657 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1374 : 128);
84658 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1375 : 128);
84659 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1376 : 129);
84660 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1376 : 129);
84661 }
84662 else if (type == 123 || type == 124)
84663 {
84664 if (life > 0)
84665 {
84666 for (int num624 = 0; (double)num624 < dmg / (double)lifeMax * 100.0; num624++)
84667 {
84668 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84669 }
84670 return;
84671 }
84672 for (int num625 = 0; num625 < 50; num625++)
84673 {
84674 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84675 }
84676 Gore.NewGore(position, velocity, IsShimmerVariant ? 1317 : 151);
84677 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1318 : 152);
84678 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1318 : 152);
84679 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1319 : 153);
84680 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1319 : 153);
84681 }
84682 else if (type == 22)
84683 {
84684 if (life > 0)
84685 {
84686 for (int num626 = 0; (double)num626 < dmg / (double)lifeMax * 100.0; num626++)
84687 {
84688 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84689 }
84690 return;
84691 }
84692 for (int num627 = 0; num627 < 50; num627++)
84693 {
84694 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84695 }
84696 Gore.NewGore(position, velocity, IsShimmerVariant ? 1314 : 73);
84697 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1315 : 74);
84698 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1315 : 74);
84699 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1316 : 75);
84700 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1316 : 75);
84701 }
84702 else if (type == 550)
84703 {
84704 if (life > 0)
84705 {
84706 for (int num628 = 0; (double)num628 < dmg / (double)lifeMax * 100.0; num628++)
84707 {
84708 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84709 }
84710 return;
84711 }
84712 for (int num629 = 0; num629 < 50; num629++)
84713 {
84714 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84715 }
84716 Gore.NewGore(new Vector2(position.X, position.Y + 0f), velocity, IsShimmerVariant ? 1355 : 967);
84717 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1356 : 968);
84718 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 20f), velocity, IsShimmerVariant ? 1356 : 968);
84719 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1357 : 969);
84720 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 34f), velocity, IsShimmerVariant ? 1357 : 969);
84721 }
84722 else if (type == 588 || type == 589)
84723 {
84724 if (life > 0)
84725 {
84726 for (int num630 = 0; (double)num630 < dmg / (double)lifeMax * 100.0; num630++)
84727 {
84728 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84729 }
84730 return;
84731 }
84732 for (int num631 = 0; num631 < 50; num631++)
84733 {
84734 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84735 }
84736 if (altTexture == 0)
84737 {
84738 Gore.NewGore(new Vector2(position.X, position.Y + 0f), velocity, IsShimmerVariant ? 1311 : 1109);
84739 }
84740 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1312 : 1110);
84741 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 20f), velocity, IsShimmerVariant ? 1312 : 1110);
84742 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1313 : 1111);
84743 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 34f), velocity, IsShimmerVariant ? 1313 : 1111);
84744 }
84745 else if (type == 633)
84746 {
84747 if (life > 0)
84748 {
84749 for (int num632 = 0; (double)num632 < dmg / (double)lifeMax * 100.0; num632++)
84750 {
84751 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84752 }
84753 return;
84754 }
84755 for (int num633 = 0; num633 < 50; num633++)
84756 {
84757 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84758 }
84759 int num634 = 1219;
84760 int num635 = 1220;
84761 if (altTexture == 2)
84762 {
84763 num634 = 1223;
84764 num635 = 1224;
84765 }
84766 if (IsShimmerVariant)
84767 {
84768 num634 = 1377;
84769 num635 = 1379;
84770 if (altTexture == 2)
84771 {
84772 num634 = 1378;
84773 num635 = 1380;
84774 }
84775 }
84776 Gore.NewGore(new Vector2(position.X, position.Y + 0f), velocity, num634);
84777 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num635);
84778 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 20f), velocity, num635);
84779 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1382 : 1221);
84780 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1381 : 1222);
84781 Gore.NewGore(new Vector2(position.X + 8f, position.Y + 34f), velocity, IsShimmerVariant ? 1381 : 1222);
84782 }
84783 else if (type == 368)
84784 {
84785 if (life > 0)
84786 {
84787 for (int num636 = 0; (double)num636 < dmg / (double)lifeMax * 100.0; num636++)
84788 {
84789 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84790 }
84791 return;
84792 }
84793 for (int num637 = 0; num637 < 50; num637++)
84794 {
84795 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84796 }
84797 if (altTexture == 0)
84798 {
84799 Gore.NewGore(position, velocity, IsShimmerVariant ? 1362 : 567);
84800 }
84801 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1364 : 568);
84802 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1364 : 568);
84803 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1365 : 569);
84804 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1365 : 569);
84805 }
84806 else if (type == 369 || type == 376 || type == 663 || NPCID.Sets.IsTownPet[type])
84807 {
84808 if (life <= 0)
84809 {
84810 for (int num638 = 0; num638 < 25; num638++)
84811 {
84812 int num639 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
84813 Dust dust = Main.dust[num639];
84814 dust.velocity *= 1.4f;
84815 Main.dust[num639].noLight = true;
84816 Main.dust[num639].noGravity = true;
84817 }
84818 int num640 = 0;
84819 num640 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
84820 Main.gore[num640].scale = 1f;
84821 Main.gore[num640].velocity.X += 1f;
84822 Main.gore[num640].velocity.Y += 1f;
84823 num640 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
84824 Main.gore[num640].scale = 1f;
84825 Main.gore[num640].velocity.X -= 1f;
84826 Main.gore[num640].velocity.Y += 1f;
84827 num640 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
84828 Main.gore[num640].scale = 1f;
84829 Main.gore[num640].velocity.X += 1f;
84830 Main.gore[num640].velocity.Y -= 1f;
84831 num640 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
84832 Main.gore[num640].scale = 1f;
84833 Main.gore[num640].velocity.X -= 1f;
84834 Main.gore[num640].velocity.Y -= 1f;
84835 }
84836 }
84837 else if (type == 227)
84838 {
84839 if (life > 0)
84840 {
84841 for (int num641 = 0; (double)num641 < dmg / (double)lifeMax * 100.0; num641++)
84842 {
84843 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84844 }
84845 return;
84846 }
84847 for (int num642 = 0; num642 < 50; num642++)
84848 {
84849 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84850 }
84851 if (altTexture == 0)
84852 {
84853 Gore.NewGore(position, velocity, IsShimmerVariant ? 1331 : 320);
84854 }
84855 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1334 : 321);
84856 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1333 : 322);
84857 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1332 : 323);
84858 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1332 : 323);
84859 }
84860 else if (type == 228)
84861 {
84862 if (life > 0)
84863 {
84864 for (int num643 = 0; (double)num643 < dmg / (double)lifeMax * 100.0; num643++)
84865 {
84866 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84867 }
84868 return;
84869 }
84870 for (int num644 = 0; num644 < 50; num644++)
84871 {
84872 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84873 }
84874 Gore.NewGore(position, velocity, IsShimmerVariant ? 1369 : 324);
84875 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1370 : 325);
84876 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1372 : 326);
84877 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1371 : 327);
84878 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1371 : 327);
84879 }
84880 else if (type == 229)
84881 {
84882 if (life > 0)
84883 {
84884 for (int num645 = 0; (double)num645 < dmg / (double)lifeMax * 100.0; num645++)
84885 {
84886 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84887 }
84888 return;
84889 }
84890 if (IsShimmerVariant)
84891 {
84892 for (int num646 = 0; num646 < 50; num646++)
84893 {
84894 int num647 = Dust.NewDust(position, width, height, 180, velocity.X, velocity.Y);
84895 Dust dust = Main.dust[num647];
84896 dust.velocity *= 2f;
84897 Main.dust[num647].noGravity = true;
84898 Main.dust[num647].scale = 1.4f;
84899 }
84900 return;
84901 }
84902 for (int num648 = 0; num648 < 50; num648++)
84903 {
84904 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84905 }
84906 if (altTexture == 0)
84907 {
84908 Gore.NewGore(position, velocity, 328);
84909 }
84910 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 329);
84911 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 329);
84912 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 330);
84913 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 330);
84914 }
84915 else if (type == 142)
84916 {
84917 if (life > 0)
84918 {
84919 for (int num649 = 0; (double)num649 < dmg / (double)lifeMax * 100.0; num649++)
84920 {
84921 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84922 }
84923 return;
84924 }
84925 for (int num650 = 0; num650 < 50; num650++)
84926 {
84927 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84928 }
84929 if (altTexture == 0)
84930 {
84931 Gore.NewGore(position, velocity, IsShimmerVariant ? 1338 : 157);
84932 }
84933 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1340 : 158);
84934 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1340 : 158);
84935 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1341 : 159);
84936 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1341 : 159);
84937 }
84938 else if (type == 178)
84939 {
84940 if (life > 0)
84941 {
84942 for (int num651 = 0; (double)num651 < dmg / (double)lifeMax * 100.0; num651++)
84943 {
84944 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84945 }
84946 return;
84947 }
84948 for (int num652 = 0; num652 < 50; num652++)
84949 {
84950 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84951 }
84952 if (altTexture == 0)
84953 {
84954 Gore.NewGore(position, velocity, IsShimmerVariant ? 1348 : 231);
84955 }
84956 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1349 : 232);
84957 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1349 : 232);
84958 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1350 : 233);
84959 }
84960 else if (type == 353 || type == 354)
84961 {
84962 if (life > 0)
84963 {
84964 for (int num653 = 0; (double)num653 < dmg / (double)lifeMax * 100.0; num653++)
84965 {
84966 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84967 }
84968 return;
84969 }
84970 for (int num654 = 0; num654 < 50; num654++)
84971 {
84972 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
84973 }
84974 if (altTexture == 0)
84975 {
84976 Gore.NewGore(position, velocity, IsShimmerVariant ? 1353 : 544);
84977 }
84978 if (!IsShimmerVariant)
84979 {
84980 Gore.NewGore(position, velocity, 543);
84981 }
84982 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1353 : 546);
84983 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1353 : 546);
84984 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1354 : 545);
84985 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1354 : 545);
84986 }
84987 else if (type == 37)
84988 {
84989 if (life > 0)
84990 {
84991 for (int num655 = 0; (double)num655 < dmg / (double)lifeMax * 100.0; num655++)
84992 {
84993 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
84994 }
84995 return;
84996 }
84997 for (int num656 = 0; num656 < 50; num656++)
84998 {
84999 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85000 }
85001 Gore.NewGore(position, velocity, IsShimmerVariant ? 1328 : 58);
85002 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1329 : 59);
85003 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1329 : 59);
85004 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1330 : 60);
85005 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1330 : 60);
85006 }
85007 else if (type == 54)
85008 {
85009 if (life > 0)
85010 {
85011 for (int num657 = 0; (double)num657 < dmg / (double)lifeMax * 100.0; num657++)
85012 {
85013 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85014 }
85015 return;
85016 }
85017 for (int num658 = 0; num658 < 50; num658++)
85018 {
85019 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85020 }
85021 Gore.NewGore(position, velocity, IsShimmerVariant ? 1291 : 58);
85022 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1292 : 59);
85023 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1292 : 59);
85024 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1293 : 60);
85025 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1293 : 60);
85026 }
85027 else if (type == 160)
85028 {
85029 if (life > 0)
85030 {
85031 for (int num659 = 0; (double)num659 < dmg / (double)lifeMax * 100.0; num659++)
85032 {
85033 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85034 }
85035 return;
85036 }
85037 for (int num660 = 0; num660 < 50; num660++)
85038 {
85039 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85040 }
85041 Gore.NewGore(position, velocity, IsShimmerVariant ? 1366 : 188);
85042 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1367 : 189);
85043 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1367 : 189);
85044 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1368 : 190);
85045 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1368 : 190);
85046 }
85047 else if (type == 18)
85048 {
85049 if (life > 0)
85050 {
85051 for (int num661 = 0; (double)num661 < dmg / (double)lifeMax * 100.0; num661++)
85052 {
85053 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85054 }
85055 return;
85056 }
85057 for (int num662 = 0; num662 < 50; num662++)
85058 {
85059 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85060 }
85061 if (altTexture == 0)
85062 {
85063 Gore.NewGore(position, velocity, IsShimmerVariant ? 1324 : 33);
85064 }
85065 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1326 : 34);
85066 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1326 : 34);
85067 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1327 : 35);
85068 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1327 : 35);
85069 }
85070 else if (type == 19)
85071 {
85072 if (life > 0)
85073 {
85074 for (int num663 = 0; (double)num663 < dmg / (double)lifeMax * 100.0; num663++)
85075 {
85076 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85077 }
85078 return;
85079 }
85080 for (int num664 = 0; num664 < 50; num664++)
85081 {
85082 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85083 }
85084 Gore.NewGore(position, velocity, IsShimmerVariant ? 1288 : 36);
85085 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1289 : 37);
85086 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1289 : 37);
85087 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1290 : 38);
85088 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1290 : 38);
85089 }
85090 else if (type == 38)
85091 {
85092 if (life > 0)
85093 {
85094 for (int num665 = 0; (double)num665 < dmg / (double)lifeMax * 100.0; num665++)
85095 {
85096 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85097 }
85098 return;
85099 }
85100 for (int num666 = 0; num666 < 50; num666++)
85101 {
85102 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85103 }
85104 if (altTexture == 0)
85105 {
85106 Gore.NewGore(position, velocity, IsShimmerVariant ? 1297 : 64);
85107 }
85108 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1299 : 65);
85109 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1299 : 65);
85110 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1300 : 66);
85111 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1300 : 66);
85112 }
85113 else if (type == 20)
85114 {
85115 if (life > 0)
85116 {
85117 for (int num667 = 0; (double)num667 < dmg / (double)lifeMax * 100.0; num667++)
85118 {
85119 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85120 }
85121 return;
85122 }
85123 for (int num668 = 0; num668 < 50; num668++)
85124 {
85125 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85126 }
85127 Gore.NewGore(position, velocity, IsShimmerVariant ? 1301 : 39);
85128 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1302 : 40);
85129 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1302 : 40);
85130 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1303 : 41);
85131 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1303 : 41);
85132 }
85133 else if (type == 207)
85134 {
85135 if (life > 0)
85136 {
85137 for (int num669 = 0; (double)num669 < dmg / (double)lifeMax * 100.0; num669++)
85138 {
85139 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85140 }
85141 return;
85142 }
85143 for (int num670 = 0; num670 < 50; num670++)
85144 {
85145 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85146 }
85147 if (altTexture == 0)
85148 {
85149 Gore.NewGore(position, velocity, IsShimmerVariant ? 1304 : 283);
85150 }
85151 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1306 : 284);
85152 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1306 : 284);
85153 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1307 : 285);
85154 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1307 : 285);
85155 }
85156 else if (type == 208)
85157 {
85158 if (life > 0)
85159 {
85160 for (int num671 = 0; (double)num671 < dmg / (double)lifeMax * 100.0; num671++)
85161 {
85162 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85163 }
85164 return;
85165 }
85166 for (int num672 = 0; num672 < 50; num672++)
85167 {
85168 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85169 }
85170 Gore.NewGore(position, velocity, IsShimmerVariant ? 1335 : 286);
85171 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1336 : 287);
85172 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1336 : 287);
85173 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1337 : 288);
85174 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1337 : 288);
85175 }
85176 else if (type == 663)
85177 {
85178 if (life > 0)
85179 {
85180 for (int num673 = 0; (double)num673 < dmg / (double)lifeMax * 100.0; num673++)
85181 {
85182 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85183 }
85184 }
85185 else
85186 {
85187 for (int num674 = 0; num674 < 50; num674++)
85188 {
85189 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85190 }
85191 }
85192 }
85193 else if (type == 209)
85194 {
85195 if (life > 0)
85196 {
85197 for (int num675 = 0; (double)num675 < dmg / (double)lifeMax * 100.0; num675++)
85198 {
85199 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85200 }
85201 return;
85202 }
85203 for (int num676 = 0; num676 < 50; num676++)
85204 {
85205 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85206 }
85207 Gore.NewGore(position, velocity, IsShimmerVariant ? 1294 : 289);
85208 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1295 : 290);
85209 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1295 : 290);
85210 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1296 : 291);
85211 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1296 : 291);
85212 }
85213 else if (type >= 212 && type <= 216)
85214 {
85215 if (life > 0)
85216 {
85217 for (int num677 = 0; (double)num677 < dmg / (double)lifeMax * 100.0; num677++)
85218 {
85219 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
85220 }
85221 return;
85222 }
85223 for (int num678 = 0; num678 < 50; num678++)
85224 {
85225 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
85226 }
85227 if (type == 212)
85228 {
85229 Gore.NewGore(position, velocity, 336);
85230 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 337);
85231 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 337);
85232 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 338);
85233 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 338);
85234 }
85235 else if (type == 213)
85236 {
85237 Gore.NewGore(position, velocity, 339);
85238 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 340);
85239 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 340);
85240 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 341);
85241 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 341);
85242 }
85243 else if (type == 214)
85244 {
85245 Gore.NewGore(position, velocity, 342);
85246 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 343);
85247 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 343);
85248 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 344);
85249 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 344);
85250 }
85251 else if (type == 215)
85252 {
85253 Gore.NewGore(position, velocity, 345);
85254 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 346);
85255 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 346);
85256 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 347);
85257 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 347);
85258 }
85259 else if (type == 216)
85260 {
85261 Gore.NewGore(position, velocity, 348);
85262 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 349);
85263 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 349);
85264 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 350);
85265 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 350);
85266 }
85267 }
85268 else if (type == 220 || type == 221)
85269 {
85270 if (life > 0)
85271 {
85272 for (int num679 = 0; (double)num679 < dmg / (double)lifeMax * 50.0; num679++)
85273 {
85274 Dust.NewDust(position, width, height, 151, hitDirection, -1f, 0, default(Color), 0.7f);
85275 }
85276 return;
85277 }
85278 for (int num680 = 0; num680 < 20; num680++)
85279 {
85280 Dust.NewDust(position, width, height, 151, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 0.7f);
85281 }
85282 if (type == 221)
85283 {
85284 Gore.NewGore(position, velocity, 298, scale);
85285 Gore.NewGore(position, velocity, 299, scale);
85286 }
85287 else
85288 {
85289 Gore.NewGore(position, velocity, 297, scale);
85290 }
85291 }
85292 else if (type == 21 || type == 31 || type == 294 || type == 295 || type == 296 || type == 32 || type == 44 || type == 45 || type == 77 || type == 110 || type == 167 || type == 197 || type == 201 || type == 202 || type == 203 || type == 287 || type == 291 || type == 292 || type == 293 || (type >= 322 && type <= 324) || type == 481 || (type >= 449 && type <= 452))
85293 {
85294 if (life > 0)
85295 {
85296 for (int num681 = 0; (double)num681 < dmg / (double)lifeMax * 50.0; num681++)
85297 {
85298 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85299 }
85300 return;
85301 }
85302 for (int num682 = 0; num682 < 20; num682++)
85303 {
85304 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85305 }
85306 if (type == 167)
85307 {
85308 Gore.NewGore(position, velocity, 213, scale);
85309 Gore.NewGore(position, velocity, 214, scale);
85310 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85311 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85312 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 212, scale);
85313 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 212, scale);
85314 return;
85315 }
85316 if (type == 197)
85317 {
85318 Gore.NewGore(position, velocity, 257, scale);
85319 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85320 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85321 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 212, scale);
85322 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 212, scale);
85323 return;
85324 }
85325 if (type == 481)
85326 {
85327 Gore.NewGore(position, velocity, 695, scale);
85328 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 696, scale);
85329 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 696, scale);
85330 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 697, scale);
85331 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 697, scale);
85332 return;
85333 }
85334 if (type == 201 || type == 450)
85335 {
85336 Gore.NewGore(position, velocity, 265, scale);
85337 Gore.NewGore(position, velocity, 267, scale);
85338 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85339 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85340 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85341 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85342 return;
85343 }
85344 if (type == 202 || type == 451)
85345 {
85346 Gore.NewGore(position, velocity, 268, scale);
85347 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85348 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85349 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85350 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85351 return;
85352 }
85353 if (type == 203 || type == 452)
85354 {
85355 Gore.NewGore(position, velocity, 269, scale);
85356 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85357 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85358 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 266, scale);
85359 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 266, scale);
85360 return;
85361 }
85362 if (type == 322)
85363 {
85364 Gore.NewGore(position, velocity, 460, scale);
85365 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 461, scale);
85366 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 462, scale);
85367 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 461, scale);
85368 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 462, scale);
85369 return;
85370 }
85371 if (type == 323)
85372 {
85373 Gore.NewGore(position, velocity, 463, scale);
85374 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 465, scale);
85375 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 464, scale);
85376 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 464, scale);
85377 return;
85378 }
85379 if (type == 324)
85380 {
85381 Gore.NewGore(position, velocity, 466, scale);
85382 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 467, scale);
85383 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 467, scale);
85384 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 468, scale);
85385 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 468, scale);
85386 return;
85387 }
85388 Gore.NewGore(position, velocity, 42, scale);
85389 if (type == 77)
85390 {
85391 Gore.NewGore(position, velocity, 106, scale);
85392 }
85393 if (type == 110)
85394 {
85395 Gore.NewGore(position, velocity, 130, scale);
85396 }
85397 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85398 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85399 if (type == 110)
85400 {
85401 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 131, scale);
85402 }
85403 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85404 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85405 }
85406 else if (type == 453)
85407 {
85408 if (life > 0)
85409 {
85410 for (int num683 = 0; (double)num683 < dmg / (double)lifeMax * 50.0; num683++)
85411 {
85412 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85413 }
85414 return;
85415 }
85416 for (int num684 = 0; num684 < 20; num684++)
85417 {
85418 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85419 }
85420 if (altTexture == 0)
85421 {
85422 Gore.NewGore(position, velocity, IsShimmerVariant ? 1342 : 638, scale);
85423 }
85424 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1346 : 639, scale);
85425 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, IsShimmerVariant ? 1345 : 640, scale);
85426 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1344 : 641, scale);
85427 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, IsShimmerVariant ? 1347 : 642, scale);
85428 }
85429 else if ((type >= 269 && type <= 276) || (type >= 281 && type <= 286))
85430 {
85431 if (life > 0)
85432 {
85433 for (int num685 = 0; (double)num685 < dmg / (double)lifeMax * 50.0; num685++)
85434 {
85435 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85436 }
85437 return;
85438 }
85439 for (int num686 = 0; num686 < 20; num686++)
85440 {
85441 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85442 }
85443 Gore.NewGore(position, velocity, 42, scale);
85444 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85445 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 43, scale);
85446 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85447 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 44, scale);
85448 if (type == 269)
85449 {
85450 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 406, scale);
85451 }
85452 if (type == 270)
85453 {
85454 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 407, scale);
85455 }
85456 if (type == 271 || type == 272)
85457 {
85458 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 408, scale);
85459 }
85460 if (type == 274)
85461 {
85462 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 409, scale);
85463 }
85464 if (type == 276)
85465 {
85466 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 410, scale);
85467 }
85468 }
85469 else if (type >= 277 && type <= 280)
85470 {
85471 if (life > 0)
85472 {
85473 for (int num687 = 0; (double)num687 < dmg / (double)lifeMax * 100.0; num687++)
85474 {
85475 int num688 = Dust.NewDust(position, width, height, 174, hitDirection, -1f);
85476 Main.dust[num688].scale = 1.1f;
85477 Main.dust[num688].noGravity = true;
85478 }
85479 return;
85480 }
85481 for (int num689 = 0; num689 < 75; num689++)
85482 {
85483 int num690 = Dust.NewDust(position, width, height, 174, 1.5f * (float)hitDirection, -0.5f);
85484 Dust dust = Main.dust[num690];
85485 dust.velocity *= 2f;
85486 Main.dust[num690].scale = 1.4f;
85487 Main.dust[num690].noGravity = true;
85488 }
85489 }
85490 else if (type == 341)
85491 {
85492 int num691 = 196;
85493 if (life > 0)
85494 {
85495 for (int num692 = 0; (double)num692 < dmg / (double)lifeMax * 50.0; num692++)
85496 {
85497 Dust.NewDust(position, width, height, num691);
85498 }
85499 return;
85500 }
85501 for (int num693 = 0; num693 < 20; num693++)
85502 {
85503 Dust.NewDust(position, width, height, num691);
85504 }
85505 int num694 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 61, scale);
85507 gore2.velocity *= 0.3f;
85508 num694 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), 62, scale);
85509 gore2 = Main.gore[num694];
85510 gore2.velocity *= 0.3f;
85511 num694 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 10f), new Vector2(hitDirection, 0f), 63, scale);
85512 gore2 = Main.gore[num694];
85513 gore2.velocity *= 0.3f;
85514 }
85515 else if (type == 85 || type == 629)
85516 {
85517 int num695 = 7;
85518 if (ai[3] == 2f)
85519 {
85520 num695 = 10;
85521 }
85522 if (ai[3] == 3f)
85523 {
85524 num695 = 37;
85525 }
85526 if (life > 0)
85527 {
85528 for (int num696 = 0; (double)num696 < dmg / (double)lifeMax * 50.0; num696++)
85529 {
85530 Dust.NewDust(position, width, height, num695);
85531 }
85532 return;
85533 }
85534 for (int num697 = 0; num697 < 20; num697++)
85535 {
85536 Dust.NewDust(position, width, height, num695);
85537 }
85538 int num698 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 61, scale);
85540 gore2.velocity *= 0.3f;
85541 num698 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), 62, scale);
85542 gore2 = Main.gore[num698];
85543 gore2.velocity *= 0.3f;
85544 num698 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 10f), new Vector2(hitDirection, 0f), 63, scale);
85545 gore2 = Main.gore[num698];
85546 gore2.velocity *= 0.3f;
85547 }
85548 else if (type == 473 || type == 474 || type == 475 || type == 476)
85549 {
85550 int num699 = 31;
85551 if (life > 0)
85552 {
85553 for (int num700 = 0; (double)num700 < dmg / (double)lifeMax * 50.0; num700++)
85554 {
85555 Dust.NewDust(position, width, height, num699);
85556 }
85557 return;
85558 }
85559 for (int num701 = 0; num701 < 20; num701++)
85560 {
85561 Dust.NewDust(position, width, height, num699);
85562 }
85563 int num702 = Gore.NewGore(base.Center, new Vector2(hitDirection, 0f), 61, scale);
85565 gore2.velocity *= 0.3f;
85566 num702 = Gore.NewGore(base.Center, new Vector2(hitDirection, 0f), 62, scale);
85567 gore2 = Main.gore[num702];
85568 gore2.velocity *= 0.3f;
85569 num702 = Gore.NewGore(base.Center, new Vector2(hitDirection, 0f), 63, scale);
85570 gore2 = Main.gore[num702];
85571 gore2.velocity *= 0.3f;
85572 }
85573 else if (type == 169)
85574 {
85575 if (life > 0)
85576 {
85577 for (int num703 = 0; (double)num703 < dmg / (double)lifeMax * 50.0; num703++)
85578 {
85579 int num704 = Dust.NewDust(position, width, height, 92, 0f, 0f, 0, default(Color), 1.5f);
85580 Dust dust = Main.dust[num704];
85581 dust.velocity *= 1.5f;
85582 Main.dust[num704].noGravity = true;
85583 }
85584 return;
85585 }
85586 for (int num705 = 0; num705 < 100; num705++)
85587 {
85588 int num706 = Dust.NewDust(position, width, height, 92, 0f, 0f, 0, default(Color), 1.5f);
85589 Main.dust[num706].scale = 1.5f;
85590 Dust dust = Main.dust[num706];
85591 dust.velocity *= 2f;
85592 Main.dust[num706].noGravity = true;
85593 }
85594 }
85595 else if (type == 170 || type == 180)
85596 {
85597 if (life > 0)
85598 {
85599 for (int num707 = 0; (double)num707 < dmg / (double)lifeMax * 50.0; num707++)
85600 {
85601 int num708 = Dust.NewDust(position, width, height, 54, 0f, 0f, 0, default(Color), 1.5f);
85602 Dust dust = Main.dust[num708];
85603 dust.velocity *= 1.5f;
85604 Main.dust[num708].noGravity = true;
85605 }
85606 return;
85607 }
85608 for (int num709 = 0; num709 < 10; num709++)
85609 {
85610 int num710 = Dust.NewDust(position, width, height, 54, 0f, 0f, 0, default(Color), 1.5f);
85611 Dust dust = Main.dust[num710];
85612 dust.velocity *= 2f;
85613 Main.dust[num710].noGravity = true;
85614 }
85615 for (int num711 = 0; num711 < 4; num711++)
85616 {
85617 int num712 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), 99, scale);
85619 gore2.velocity *= 0.3f;
85620 }
85621 }
85622 else if (type == 171)
85623 {
85624 if (life > 0)
85625 {
85626 for (int num713 = 0; (double)num713 < dmg / (double)lifeMax * 50.0; num713++)
85627 {
85628 int num714 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
85629 Dust dust = Main.dust[num714];
85630 dust.velocity *= 1.5f;
85631 Main.dust[num714].noGravity = true;
85632 }
85633 return;
85634 }
85635 for (int num715 = 0; num715 < 10; num715++)
85636 {
85637 int num716 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
85638 Dust dust = Main.dust[num716];
85639 dust.velocity *= 2f;
85640 Main.dust[num716].noGravity = true;
85641 }
85642 for (int num717 = 0; num717 < 4; num717++)
85643 {
85644 int num718 = 11 + num717;
85645 if (num718 > 13)
85646 {
85647 num718 = Main.rand.Next(11, 14);
85648 }
85649 int num719 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), num718, scale);
85651 gore2.velocity *= 0.3f;
85652 }
85653 }
85654 else if (type == 290)
85655 {
85656 if (life <= 0)
85657 {
85658 for (int num720 = 0; num720 < 10; num720++)
85659 {
85660 int num721 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
85661 Dust dust = Main.dust[num721];
85662 dust.velocity *= 2f;
85663 Main.dust[num721].noGravity = true;
85664 }
85665 int num722 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(11, 14), scale);
85667 gore2.velocity *= 0.5f;
85668 num722 = Gore.NewGore(new Vector2(position.X, position.Y + 20f), default(Vector2), Main.rand.Next(11, 14), scale);
85669 gore2 = Main.gore[num722];
85670 gore2.velocity *= 0.5f;
85671 num722 = Gore.NewGore(new Vector2(position.X, position.Y + 40f), default(Vector2), Main.rand.Next(11, 14), scale);
85672 gore2 = Main.gore[num722];
85673 gore2.velocity *= 0.5f;
85674 }
85675 }
85676 else if (type >= 87 && type <= 92)
85677 {
85678 if (life > 0)
85679 {
85680 for (int num723 = 0; (double)num723 < dmg / (double)lifeMax * 50.0; num723++)
85681 {
85682 int num724 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
85683 Dust dust = Main.dust[num724];
85684 dust.velocity *= 1.5f;
85685 Main.dust[num724].noGravity = true;
85686 }
85687 return;
85688 }
85689 for (int num725 = 0; num725 < 10; num725++)
85690 {
85691 int num726 = Dust.NewDust(position, width, height, 16, 0f, 0f, 0, default(Color), 1.5f);
85692 Dust dust = Main.dust[num726];
85693 dust.velocity *= 2f;
85694 Main.dust[num726].noGravity = true;
85695 }
85696 int num727 = Main.rand.Next(1, 4);
85697 for (int num728 = 0; num728 < num727; num728++)
85698 {
85699 int num729 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), Main.rand.Next(11, 14), scale);
85701 gore2.velocity *= 0.8f;
85702 }
85703 }
85704 else if (type == 78 || type == 79 || type == 80 || type == 630)
85705 {
85706 if (life > 0)
85707 {
85708 for (int num730 = 0; (double)num730 < dmg / (double)lifeMax * 50.0; num730++)
85709 {
85710 int num731 = Dust.NewDust(position, width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
85711 Dust dust = Main.dust[num731];
85712 dust.velocity *= 2f;
85713 Main.dust[num731].noGravity = true;
85714 }
85715 return;
85716 }
85717 for (int num732 = 0; num732 < 20; num732++)
85718 {
85719 int num733 = Dust.NewDust(position, width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
85720 Dust dust = Main.dust[num733];
85721 dust.velocity *= 2f;
85722 Main.dust[num733].noGravity = true;
85723 }
85724 int num734 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 61, scale);
85726 gore2.velocity *= 0.3f;
85727 num734 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 10f), new Vector2(hitDirection, 0f), 62, scale);
85728 gore2 = Main.gore[num734];
85729 gore2.velocity *= 0.3f;
85730 num734 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 10f), new Vector2(hitDirection, 0f), 63, scale);
85731 gore2 = Main.gore[num734];
85732 gore2.velocity *= 0.3f;
85733 }
85734 else if (type == 82 || type == 158 || type == 159 || type == 250 || type == 253)
85735 {
85736 if (life > 0)
85737 {
85738 for (int num735 = 0; (double)num735 < dmg / (double)lifeMax * 50.0; num735++)
85739 {
85740 int num736 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
85741 Dust dust = Main.dust[num736];
85742 dust.velocity *= 2f;
85743 Main.dust[num736].noGravity = true;
85744 }
85745 return;
85746 }
85747 for (int num737 = 0; num737 < 20; num737++)
85748 {
85749 int num738 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
85750 Dust dust = Main.dust[num738];
85751 dust.velocity *= 2f;
85752 Main.dust[num738].noGravity = true;
85753 }
85754 int num739 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 99, scale);
85756 gore2.velocity *= 0.3f;
85757 num739 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 15f), new Vector2(hitDirection, 0f), 99, scale);
85758 gore2 = Main.gore[num739];
85759 gore2.velocity *= 0.3f;
85760 num739 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 20f), new Vector2(hitDirection, 0f), 99, scale);
85761 gore2 = Main.gore[num739];
85762 gore2.velocity *= 0.3f;
85763 }
85764 else if (type == 316 || type == 330)
85765 {
85766 if (life > 0)
85767 {
85768 for (int num740 = 0; (double)num740 < dmg / (double)lifeMax * 100.0; num740++)
85769 {
85770 int num741 = Dust.NewDust(position, width, height, 192, hitDirection, -1f, 100, new Color(100, 100, 100, 100));
85771 Main.dust[num741].noGravity = true;
85772 }
85773 }
85774 else
85775 {
85776 for (int num742 = 0; num742 < 50; num742++)
85777 {
85778 int num743 = Dust.NewDust(position, width, height, 192, 2 * hitDirection, -2f, 100, new Color(100, 100, 100, 100));
85779 Main.dust[num743].noGravity = true;
85780 }
85781 }
85782 }
85783 else if (type == 662)
85784 {
85785 if (life > 0)
85786 {
85787 for (int num744 = 0; (double)num744 < dmg / (double)lifeMax * 100.0; num744++)
85788 {
85789 int num745 = Dust.NewDust(position, width, height, 180, velocity.X, velocity.Y);
85790 Dust dust = Main.dust[num745];
85791 dust.velocity *= 2f;
85792 Main.dust[num745].noGravity = true;
85793 Main.dust[num745].scale = 1.4f;
85794 }
85795 }
85796 else
85797 {
85798 for (int num746 = 0; num746 < 50; num746++)
85799 {
85800 int num747 = Dust.NewDust(position, width, height, 180, velocity.X, velocity.Y);
85801 Dust dust = Main.dust[num747];
85802 dust.velocity *= 2f;
85803 Main.dust[num747].noGravity = true;
85804 Main.dust[num747].scale = 1.4f;
85805 }
85806 }
85807 }
85808 else if (type == 315)
85809 {
85810 if (life > 0)
85811 {
85812 for (int num748 = 0; (double)num748 < dmg / (double)lifeMax * 50.0; num748++)
85813 {
85814 int num749 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
85815 Dust dust = Main.dust[num749];
85816 dust.velocity *= 2f;
85817 Main.dust[num749].noGravity = true;
85818 }
85819 return;
85820 }
85821 for (int num750 = 0; num750 < 20; num750++)
85822 {
85823 int num751 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
85824 Dust dust = Main.dust[num751];
85825 dust.velocity *= 2f;
85826 Main.dust[num751].noGravity = true;
85827 }
85828 int num752 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 99, scale);
85830 gore2.velocity *= 0.3f;
85831 num752 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 15f), new Vector2(hitDirection, 0f), 99, scale);
85832 gore2 = Main.gore[num752];
85833 gore2.velocity *= 0.3f;
85834 num752 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 20f), new Vector2(hitDirection, 0f), 99, scale);
85835 gore2 = Main.gore[num752];
85836 gore2.velocity *= 0.3f;
85837 num752 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2(hitDirection, 0f), 446, scale);
85838 gore2 = Main.gore[num752];
85839 gore2.velocity *= 0.1f;
85840 }
85841 else if (type == 254 || type == 255 || type == 256 || type == 257 || type == 258 || type == 259 || type == 260 || type == 261 || type == 634 || type == 635)
85842 {
85843 if (life > 0)
85844 {
85845 for (int num753 = 0; (double)num753 < dmg / (double)lifeMax * 50.0; num753++)
85846 {
85847 int num754 = Dust.NewDust(position, width, height, 165, 0f, 0f, 50, default(Color), 1.5f);
85848 Dust dust = Main.dust[num754];
85849 dust.velocity *= 2f;
85850 Main.dust[num754].noGravity = true;
85851 }
85852 return;
85853 }
85854 for (int num755 = 0; num755 < 20; num755++)
85855 {
85856 int num756 = Dust.NewDust(position, width, height, 165, 0f, 0f, 50, default(Color), 1.5f);
85857 Dust dust = Main.dust[num756];
85858 dust.velocity *= 2f;
85859 Main.dust[num756].noGravity = true;
85860 }
85861 if (type != 261)
85862 {
85863 int num757 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 375, scale);
85865 gore2.velocity *= 0.3f;
85866 num757 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 15f), new Vector2(hitDirection, 0f), 376, scale);
85867 gore2 = Main.gore[num757];
85868 gore2.velocity *= 0.3f;
85869 num757 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 20f), new Vector2(hitDirection, 0f), 377, scale);
85870 gore2 = Main.gore[num757];
85871 gore2.velocity *= 0.3f;
85872 }
85873 }
85874 else if (type == 140)
85875 {
85876 if (life <= 0)
85877 {
85878 for (int num758 = 0; num758 < 20; num758++)
85879 {
85880 int num759 = Dust.NewDust(position, width, height, 54, 0f, 0f, 50, default(Color), 1.5f);
85881 Dust dust = Main.dust[num759];
85882 dust.velocity *= 2f;
85883 Main.dust[num759].noGravity = true;
85884 }
85885 int num760 = Gore.NewGore(new Vector2(position.X, position.Y - 10f), new Vector2(hitDirection, 0f), 99, scale);
85887 gore2.velocity *= 0.3f;
85888 num760 = Gore.NewGore(new Vector2(position.X, position.Y + (float)(height / 2) - 15f), new Vector2(hitDirection, 0f), 99, scale);
85889 gore2 = Main.gore[num760];
85890 gore2.velocity *= 0.3f;
85891 num760 = Gore.NewGore(new Vector2(position.X, position.Y + (float)height - 20f), new Vector2(hitDirection, 0f), 99, scale);
85892 gore2 = Main.gore[num760];
85893 gore2.velocity *= 0.3f;
85894 }
85895 }
85896 else if (type == 39 || type == 40 || type == 41)
85897 {
85898 if (life > 0)
85899 {
85900 for (int num761 = 0; (double)num761 < dmg / (double)lifeMax * 50.0; num761++)
85901 {
85902 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85903 }
85904 return;
85905 }
85906 for (int num762 = 0; num762 < 20; num762++)
85907 {
85908 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85909 }
85910 Gore.NewGore(position, velocity, type - 39 + 67);
85911 }
85912 else if (type == 34)
85913 {
85914 if (life > 0)
85915 {
85916 for (int num763 = 0; (double)num763 < dmg / (double)lifeMax * 30.0; num763++)
85917 {
85918 int num764 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 15, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1.8f);
85919 Main.dust[num764].noLight = true;
85920 Main.dust[num764].noGravity = true;
85921 Dust dust = Main.dust[num764];
85922 dust.velocity *= 1.3f;
85923 num764 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 0, default(Color), 0.9f);
85924 Main.dust[num764].noLight = true;
85925 dust = Main.dust[num764];
85926 dust.velocity *= 1.3f;
85927 }
85928 }
85929 else
85930 {
85931 for (int num765 = 0; num765 < 15; num765++)
85932 {
85933 int num766 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 15, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1.8f);
85934 Main.dust[num766].noLight = true;
85935 Main.dust[num766].noGravity = true;
85936 Dust dust = Main.dust[num766];
85937 dust.velocity *= 1.3f;
85938 num766 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 0, default(Color), 0.9f);
85939 Main.dust[num766].noLight = true;
85940 dust = Main.dust[num766];
85941 dust.velocity *= 1.3f;
85942 }
85943 }
85944 }
85945 else if (type == 289)
85946 {
85947 if (life > 0)
85948 {
85949 for (int num767 = 0; (double)num767 < dmg / (double)lifeMax * 30.0; num767++)
85950 {
85951 int num768 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1.8f);
85952 Main.dust[num768].noLight = true;
85953 Main.dust[num768].noGravity = true;
85954 Dust dust = Main.dust[num768];
85955 dust.velocity *= 1.3f;
85956 }
85957 }
85958 else
85959 {
85960 for (int num769 = 0; num769 < 50; num769++)
85961 {
85962 int num770 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1.8f);
85963 Main.dust[num770].noLight = true;
85964 Main.dust[num770].noGravity = true;
85965 Dust dust = Main.dust[num770];
85966 dust.velocity *= 1.3f;
85967 }
85968 }
85969 }
85970 else if (type == 35 || type == 36)
85971 {
85972 if (life > 0)
85973 {
85974 for (int num771 = 0; (double)num771 < dmg / (double)lifeMax * 100.0; num771++)
85975 {
85976 Dust.NewDust(position, width, height, 26, hitDirection, -1f);
85977 }
85978 return;
85979 }
85980 for (int num772 = 0; num772 < 150; num772++)
85981 {
85982 Dust.NewDust(position, width, height, 26, 2.5f * (float)hitDirection, -2.5f);
85983 }
85984 if (type == 35)
85985 {
85986 Gore.NewGore(position, velocity, 54);
85987 Gore.NewGore(position, velocity, 55);
85988 return;
85989 }
85990 Gore.NewGore(position, velocity, 56);
85991 Gore.NewGore(position, velocity, 57);
85992 Gore.NewGore(position, velocity, 57);
85993 Gore.NewGore(position, velocity, 57);
85994 }
85995 else if (type == 139)
85996 {
85997 if (life <= 0)
85998 {
85999 for (int num773 = 0; num773 < 10; num773++)
86000 {
86001 int num774 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86002 Dust dust = Main.dust[num774];
86003 dust.velocity *= 1.4f;
86004 }
86005 for (int num775 = 0; num775 < 5; num775++)
86006 {
86007 int num776 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86008 Main.dust[num776].noGravity = true;
86009 Dust dust = Main.dust[num776];
86010 dust.velocity *= 5f;
86011 num776 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86012 dust = Main.dust[num776];
86013 dust.velocity *= 3f;
86014 }
86015 int num777 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86017 gore2.velocity *= 0.4f;
86018 Main.gore[num777].velocity.X += 1f;
86019 Main.gore[num777].velocity.Y += 1f;
86020 num777 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86021 gore2 = Main.gore[num777];
86022 gore2.velocity *= 0.4f;
86023 Main.gore[num777].velocity.X -= 1f;
86024 Main.gore[num777].velocity.Y += 1f;
86025 num777 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86026 gore2 = Main.gore[num777];
86027 gore2.velocity *= 0.4f;
86028 Main.gore[num777].velocity.X += 1f;
86029 Main.gore[num777].velocity.Y -= 1f;
86030 num777 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86031 gore2 = Main.gore[num777];
86032 gore2.velocity *= 0.4f;
86033 Main.gore[num777].velocity.X -= 1f;
86034 Main.gore[num777].velocity.Y -= 1f;
86035 }
86036 }
86037 else if (type == 467)
86038 {
86039 if (life <= 0)
86040 {
86041 for (int num778 = 0; num778 < 7; num778++)
86042 {
86043 int num779 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86044 Dust dust = Main.dust[num779];
86045 dust.velocity *= 1.4f;
86046 }
86047 for (int num780 = 0; num780 < 3; num780++)
86048 {
86049 int num781 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86050 Main.dust[num781].noGravity = true;
86051 Dust dust = Main.dust[num781];
86052 dust.velocity *= 5f;
86053 num781 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86054 dust = Main.dust[num781];
86055 dust.velocity *= 3f;
86056 }
86057 Gore.NewGore(position, velocity, 660);
86058 Gore.NewGore(position, velocity, 660);
86059 }
86060 }
86061 else if (type >= 134 && type <= 136)
86062 {
86063 if (type == 135 && life > 0 && Main.netMode != 1)
86064 {
86065 int maxValue = 25;
86066 if (IsMechQueenUp)
86067 {
86068 maxValue = 50;
86069 }
86070 if (ai[2] == 0f && Main.rand.Next(maxValue) == 0)
86071 {
86072 ai[2] = 1f;
86073 int num782 = NewNPC(GetSpawnSource_NPCHurt(), (int)(position.X + (float)(width / 2)), (int)(position.Y + (float)height), 139);
86074 if (Main.netMode == 2 && num782 < 200)
86075 {
86076 NetMessage.SendData(23, -1, -1, null, num782);
86077 }
86078 netUpdate = true;
86079 }
86080 }
86081 if (life > 0)
86082 {
86083 return;
86084 }
86085 Gore.NewGore(position, velocity, 156);
86086 if (Main.rand.Next(2) == 0)
86087 {
86088 for (int num783 = 0; num783 < 10; num783++)
86089 {
86090 int num784 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86091 Dust dust = Main.dust[num784];
86092 dust.velocity *= 1.4f;
86093 }
86094 for (int num785 = 0; num785 < 5; num785++)
86095 {
86096 int num786 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86097 Main.dust[num786].noGravity = true;
86098 Dust dust = Main.dust[num786];
86099 dust.velocity *= 5f;
86100 num786 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86101 dust = Main.dust[num786];
86102 dust.velocity *= 3f;
86103 }
86104 int num787 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86106 gore2.velocity *= 0.4f;
86107 Main.gore[num787].velocity.X += 1f;
86108 Main.gore[num787].velocity.Y += 1f;
86109 num787 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86110 gore2 = Main.gore[num787];
86111 gore2.velocity *= 0.4f;
86112 Main.gore[num787].velocity.X -= 1f;
86113 Main.gore[num787].velocity.Y += 1f;
86114 num787 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86115 gore2 = Main.gore[num787];
86116 gore2.velocity *= 0.4f;
86117 Main.gore[num787].velocity.X += 1f;
86118 Main.gore[num787].velocity.Y -= 1f;
86119 num787 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86120 gore2 = Main.gore[num787];
86121 gore2.velocity *= 0.4f;
86122 Main.gore[num787].velocity.X -= 1f;
86123 Main.gore[num787].velocity.Y -= 1f;
86124 }
86125 }
86126 else if (type == 347)
86127 {
86128 if (life <= 0)
86129 {
86130 Gore.NewGore(position, velocity, 524);
86131 Gore.NewGore(position, velocity, 525);
86132 Gore.NewGore(position, velocity, 526);
86133 Gore.NewGore(position, velocity, 527);
86134 for (int num788 = 0; num788 < 7; num788++)
86135 {
86136 int num789 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86137 Dust dust = Main.dust[num789];
86138 dust.velocity *= 1.4f;
86139 }
86140 for (int num790 = 0; num790 < 4; num790++)
86141 {
86142 int num791 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86143 Main.dust[num791].noGravity = true;
86144 Dust dust = Main.dust[num791];
86145 dust.velocity *= 5f;
86146 num791 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86147 dust = Main.dust[num791];
86148 dust.velocity *= 3f;
86149 }
86150 int num792 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86152 gore2.velocity *= 0.4f;
86153 Main.gore[num792].velocity.X += 1f;
86154 Main.gore[num792].velocity.Y += 1f;
86155 num792 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86156 gore2 = Main.gore[num792];
86157 gore2.velocity *= 0.4f;
86158 Main.gore[num792].velocity.X -= 1f;
86159 Main.gore[num792].velocity.Y -= 1f;
86160 }
86161 }
86162 else if (type == 346)
86163 {
86164 if (life <= 0)
86165 {
86166 Gore.NewGore(position, velocity, 518);
86167 Gore.NewGore(position, velocity, 519);
86168 Gore.NewGore(position, velocity, 520);
86169 Gore.NewGore(position, velocity, 521);
86170 Gore.NewGore(position, velocity, 522);
86171 Gore.NewGore(position, velocity, 523);
86172 for (int num793 = 0; num793 < 10; num793++)
86173 {
86174 int num794 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86175 Dust dust = Main.dust[num794];
86176 dust.velocity *= 1.4f;
86177 }
86178 for (int num795 = 0; num795 < 5; num795++)
86179 {
86180 int num796 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86181 Main.dust[num796].noGravity = true;
86182 Dust dust = Main.dust[num796];
86183 dust.velocity *= 5f;
86184 num796 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86185 dust = Main.dust[num796];
86186 dust.velocity *= 3f;
86187 }
86188 int num797 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86190 gore2.velocity *= 0.4f;
86191 Main.gore[num797].velocity.X += 1f;
86192 Main.gore[num797].velocity.Y += 1f;
86193 num797 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86194 gore2 = Main.gore[num797];
86195 gore2.velocity *= 0.4f;
86196 Main.gore[num797].velocity.X -= 1f;
86197 Main.gore[num797].velocity.Y += 1f;
86198 num797 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86199 gore2 = Main.gore[num797];
86200 gore2.velocity *= 0.4f;
86201 Main.gore[num797].velocity.X += 1f;
86202 Main.gore[num797].velocity.Y -= 1f;
86203 num797 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86204 gore2 = Main.gore[num797];
86205 gore2.velocity *= 0.4f;
86206 Main.gore[num797].velocity.X -= 1f;
86207 Main.gore[num797].velocity.Y -= 1f;
86208 }
86209 }
86210 else if (type == 127)
86211 {
86212 if (life <= 0)
86213 {
86214 Gore.NewGore(position, velocity, 149);
86215 Gore.NewGore(position, velocity, 150);
86216 for (int num798 = 0; num798 < 10; num798++)
86217 {
86218 int num799 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86219 Dust dust = Main.dust[num799];
86220 dust.velocity *= 1.4f;
86221 }
86222 for (int num800 = 0; num800 < 5; num800++)
86223 {
86224 int num801 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86225 Main.dust[num801].noGravity = true;
86226 Dust dust = Main.dust[num801];
86227 dust.velocity *= 5f;
86228 num801 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86229 dust = Main.dust[num801];
86230 dust.velocity *= 3f;
86231 }
86232 int num802 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86234 gore2.velocity *= 0.4f;
86235 Main.gore[num802].velocity.X += 1f;
86236 Main.gore[num802].velocity.Y += 1f;
86237 num802 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86238 gore2 = Main.gore[num802];
86239 gore2.velocity *= 0.4f;
86240 Main.gore[num802].velocity.X -= 1f;
86241 Main.gore[num802].velocity.Y += 1f;
86242 num802 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86243 gore2 = Main.gore[num802];
86244 gore2.velocity *= 0.4f;
86245 Main.gore[num802].velocity.X += 1f;
86246 Main.gore[num802].velocity.Y -= 1f;
86247 num802 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86248 gore2 = Main.gore[num802];
86249 gore2.velocity *= 0.4f;
86250 Main.gore[num802].velocity.X -= 1f;
86251 Main.gore[num802].velocity.Y -= 1f;
86252 }
86253 }
86254 else if (type >= 128 && type <= 131)
86255 {
86256 if (life <= 0)
86257 {
86258 Gore.NewGore(position, velocity, 147);
86259 Gore.NewGore(position, velocity, 148);
86260 for (int num803 = 0; num803 < 10; num803++)
86261 {
86262 int num804 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
86263 Dust dust = Main.dust[num804];
86264 dust.velocity *= 1.4f;
86265 }
86266 for (int num805 = 0; num805 < 5; num805++)
86267 {
86268 int num806 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
86269 Main.dust[num806].noGravity = true;
86270 Dust dust = Main.dust[num806];
86271 dust.velocity *= 5f;
86272 num806 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
86273 dust = Main.dust[num806];
86274 dust.velocity *= 3f;
86275 }
86276 int num807 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86278 gore2.velocity *= 0.4f;
86279 Main.gore[num807].velocity.X += 1f;
86280 Main.gore[num807].velocity.Y += 1f;
86281 num807 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86282 gore2 = Main.gore[num807];
86283 gore2.velocity *= 0.4f;
86284 Main.gore[num807].velocity.X -= 1f;
86285 Main.gore[num807].velocity.Y += 1f;
86286 num807 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86287 gore2 = Main.gore[num807];
86288 gore2.velocity *= 0.4f;
86289 Main.gore[num807].velocity.X += 1f;
86290 Main.gore[num807].velocity.Y -= 1f;
86291 num807 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
86292 gore2 = Main.gore[num807];
86293 gore2.velocity *= 0.4f;
86294 Main.gore[num807].velocity.X -= 1f;
86295 Main.gore[num807].velocity.Y -= 1f;
86296 }
86297 }
86298 else if (type == 23)
86299 {
86300 if (life > 0)
86301 {
86302 for (int num808 = 0; (double)num808 < dmg / (double)lifeMax * 100.0; num808++)
86303 {
86304 int num809 = 25;
86305 if (Main.rand.Next(2) == 0)
86306 {
86307 num809 = 6;
86308 }
86309 Dust.NewDust(position, width, height, num809, hitDirection, -1f);
86310 int num810 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
86311 Main.dust[num810].noGravity = true;
86312 }
86313 return;
86314 }
86315 for (int num811 = 0; num811 < 50; num811++)
86316 {
86317 int num812 = 25;
86318 if (Main.rand.Next(2) == 0)
86319 {
86320 num812 = 6;
86321 }
86322 Dust.NewDust(position, width, height, num812, 2 * hitDirection, -2f);
86323 }
86324 for (int num813 = 0; num813 < 50; num813++)
86325 {
86326 int num814 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2.5f);
86327 Dust dust = Main.dust[num814];
86328 dust.velocity *= 6f;
86329 Main.dust[num814].noGravity = true;
86330 }
86331 }
86332 else if (type == 24)
86333 {
86334 if (life > 0)
86335 {
86336 for (int num815 = 0; (double)num815 < dmg / (double)lifeMax * 100.0; num815++)
86337 {
86338 int num816 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X, velocity.Y, 100, default(Color), 2.5f);
86339 Main.dust[num816].noGravity = true;
86340 }
86341 return;
86342 }
86343 for (int num817 = 0; num817 < 50; num817++)
86344 {
86345 int num818 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, velocity.X, velocity.Y, 100, default(Color), 2.5f);
86346 Main.dust[num818].noGravity = true;
86347 Dust dust = Main.dust[num818];
86348 dust.velocity *= 2f;
86349 }
86350 Gore.NewGore(position, velocity, 45);
86351 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 46);
86352 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 46);
86353 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 47);
86354 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 47);
86355 }
86356 else if (type == 25)
86357 {
86359 for (int num819 = 0; num819 < 20; num819++)
86360 {
86361 int num820 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 2f);
86362 Main.dust[num820].noGravity = true;
86363 Dust dust = Main.dust[num820];
86364 dust.velocity *= 2f;
86365 num820 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
86366 dust = Main.dust[num820];
86367 dust.velocity *= 2f;
86368 }
86369 }
86370 else if (type == 33)
86371 {
86373 for (int num821 = 0; num821 < 20; num821++)
86374 {
86375 int num822 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1.2f);
86376 Main.dust[num822].noGravity = true;
86377 Dust dust = Main.dust[num822];
86378 dust.velocity *= 2f;
86379 num822 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 0.6f);
86380 dust = Main.dust[num822];
86381 dust.velocity *= 2f;
86382 }
86383 }
86384 else if (type == 26 || type == 27 || type == 28 || type == 29 || type == 73 || type == 111)
86385 {
86386 if (life > 0)
86387 {
86388 for (int num823 = 0; (double)num823 < dmg / (double)lifeMax * 100.0; num823++)
86389 {
86390 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86391 }
86392 return;
86393 }
86394 for (int num824 = 0; num824 < 50; num824++)
86395 {
86396 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
86397 }
86398 int num825 = 48;
86399 int num826 = 49;
86400 int num827 = 50;
86401 if (type == 111)
86402 {
86403 num825 = 623;
86404 num826 = 624;
86405 num827 = 625;
86406 }
86407 else if (type == 26)
86408 {
86409 num825 = 626;
86410 num826 = 627;
86411 num827 = 628;
86412 }
86413 else if (type == 73)
86414 {
86415 num825 = 629;
86416 num826 = 630;
86417 num827 = 631;
86418 }
86419 else if (type == 27)
86420 {
86421 num825 = 632;
86422 num826 = 633;
86423 num827 = 634;
86424 }
86425 else if (type == 28)
86426 {
86427 num825 = 635;
86428 num826 = 636;
86429 num827 = 637;
86430 }
86431 Gore.NewGore(position, velocity, num825, scale);
86432 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num826, scale);
86433 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, num826, scale);
86434 if (type == 111)
86435 {
86436 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 131, scale);
86437 }
86438 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num827, scale);
86439 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, num827, scale);
86440 }
86441 else if (type == 471)
86442 {
86443 if (life > 0)
86444 {
86445 for (int num828 = 0; (double)num828 < dmg / (double)lifeMax * 100.0; num828++)
86446 {
86447 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86448 }
86449 return;
86450 }
86451 for (int num829 = 0; num829 < 50; num829++)
86452 {
86453 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
86454 }
86455 Gore.NewGore(position, velocity, 675, scale);
86456 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 676, scale);
86457 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 677, scale);
86458 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 678, scale);
86459 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 678, scale);
86460 }
86461 else if (type == 472)
86462 {
86463 if (life > 0)
86464 {
86465 for (int num830 = 0; (double)num830 < dmg / (double)lifeMax * 100.0; num830++)
86466 {
86467 int num831 = Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86468 if (Main.rand.Next(3) != 0)
86469 {
86470 Main.dust[num831].noGravity = true;
86471 }
86472 Main.dust[num831].alpha = 100;
86473 }
86474 return;
86475 }
86476 for (int num832 = 0; num832 < 50; num832++)
86477 {
86478 int num833 = Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
86479 if (Main.rand.Next(3) != 0)
86480 {
86481 Main.dust[num833].noGravity = true;
86482 }
86483 Main.dust[num833].alpha = 100;
86484 }
86485 Gore.NewGore(position, velocity, 679, scale);
86486 Gore.NewGore(position, velocity, 680, scale);
86487 }
86488 else if (type == 480)
86489 {
86490 if (life > 0)
86491 {
86492 for (int num834 = 0; (double)num834 < dmg / (double)lifeMax * 100.0; num834++)
86493 {
86494 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86495 }
86496 return;
86497 }
86498 for (int num835 = 0; num835 < 50; num835++)
86499 {
86500 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
86501 }
86502 Gore.NewGore(position, velocity, 692, scale);
86503 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 693, scale);
86504 Gore.NewGore(new Vector2(position.X, position.Y + 20f), velocity, 693, scale);
86505 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 694, scale);
86506 Gore.NewGore(new Vector2(position.X, position.Y + 34f), velocity, 694, scale);
86507 }
86508 else if (type == 185)
86509 {
86510 if (life > 0)
86511 {
86512 for (int num836 = 0; (double)num836 < dmg / (double)lifeMax * 100.0; num836++)
86513 {
86514 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86515 }
86516 return;
86517 }
86518 for (int num837 = 0; num837 < 50; num837++)
86519 {
86520 Dust.NewDust(position, width, height, 5, 2.5f * (float)hitDirection, -2.5f);
86521 }
86522 Gore.NewGore(position, velocity, 240, scale);
86523 }
86524 else if (type == 30 || type == 665)
86525 {
86527 for (int num838 = 0; num838 < 20; num838++)
86528 {
86529 int num839 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 2f);
86530 Main.dust[num839].noGravity = true;
86531 Dust dust = Main.dust[num839];
86532 dust.velocity *= 2f;
86533 num839 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
86534 dust = Main.dust[num839];
86535 dust.velocity *= 2f;
86536 }
86537 }
86538 else if (type == 42 || type == 176 || type == 205 || (type >= 231 && type <= 235))
86539 {
86540 if (life > 0)
86541 {
86542 for (int num840 = 0; (double)num840 < dmg / (double)lifeMax * 100.0; num840++)
86543 {
86544 Dust.NewDust(position, width, height, 18, hitDirection, -1f, alpha, this.color, scale);
86545 }
86546 return;
86547 }
86548 for (int num841 = 0; num841 < 50; num841++)
86549 {
86550 Dust.NewDust(position, width, height, 18, hitDirection, -2f, alpha, this.color, scale);
86551 }
86552 if (type == 205)
86553 {
86554 Gore.NewGore(position, velocity, 270, scale);
86555 Gore.NewGore(position, velocity, 271, scale);
86556 Gore.NewGore(position, velocity, 271, scale);
86557 Gore.NewGore(position, velocity, 272, scale);
86558 }
86559 else if (type == 176)
86560 {
86561 Gore.NewGore(position, velocity, 229, scale);
86562 Gore.NewGore(position, velocity, 230, scale);
86563 }
86564 else
86565 {
86566 Gore.NewGore(position, velocity, 70, scale);
86567 Gore.NewGore(position, velocity, 71, scale);
86568 }
86569 }
86570 else if (type == 43 || type == 56)
86571 {
86572 if (life > 0)
86573 {
86574 for (int num842 = 0; (double)num842 < dmg / (double)lifeMax * 100.0; num842++)
86575 {
86576 Dust.NewDust(position, width, height, 40, hitDirection, -1f, alpha, this.color, 1.2f);
86577 }
86578 return;
86579 }
86580 for (int num843 = 0; num843 < 50; num843++)
86581 {
86582 Dust.NewDust(position, width, height, 40, hitDirection, -2f, alpha, this.color, 1.2f);
86583 }
86584 Gore.NewGore(position, velocity, 72);
86585 Gore.NewGore(position, velocity, 72);
86586 }
86587 else if (type == 175)
86588 {
86589 if (life > 0)
86590 {
86591 for (int num844 = 0; (double)num844 < dmg / (double)lifeMax * 100.0; num844++)
86592 {
86593 Dust.NewDust(position, width, height, 40, hitDirection, -1f, alpha, this.color, 1.2f);
86594 }
86595 return;
86596 }
86597 for (int num845 = 0; num845 < 50; num845++)
86598 {
86599 Dust.NewDust(position, width, height, 40, hitDirection, -2f, alpha, this.color, 1.2f);
86600 }
86601 Gore.NewGore(position, velocity, 227);
86602 Gore.NewGore(position, velocity, 228);
86603 }
86604 else if (type == 48)
86605 {
86606 if (life > 0)
86607 {
86608 for (int num846 = 0; (double)num846 < dmg / (double)lifeMax * 100.0; num846++)
86609 {
86610 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86611 }
86612 return;
86613 }
86614 for (int num847 = 0; num847 < 50; num847++)
86615 {
86616 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
86617 }
86618 Gore.NewGore(position, velocity, 80);
86619 Gore.NewGore(position, velocity, 81);
86620 }
86621 else if (type == 62 || type == 66)
86622 {
86623 if (life > 0)
86624 {
86625 for (int num848 = 0; (double)num848 < dmg / (double)lifeMax * 100.0; num848++)
86626 {
86627 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86628 }
86629 return;
86630 }
86631 for (int num849 = 0; num849 < 50; num849++)
86632 {
86633 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
86634 }
86635 Gore.NewGore(position, velocity, 93);
86636 Gore.NewGore(position, velocity, 94);
86637 Gore.NewGore(position, velocity, 94);
86638 }
86639 else
86640 {
86641 if (type != 156)
86642 {
86643 return;
86644 }
86645 if (life > 0)
86646 {
86647 for (int num850 = 0; (double)num850 < dmg / (double)lifeMax * 100.0; num850++)
86648 {
86649 Dust.NewDust(position, width, height, 5, hitDirection, -1f);
86650 }
86651 return;
86652 }
86653 for (int num851 = 0; num851 < 50; num851++)
86654 {
86655 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
86656 }
86657 Gore.NewGore(position, velocity, 184);
86658 Gore.NewGore(position, velocity, 185);
86659 Gore.NewGore(position, velocity, 185);
86660 }
86661 }
86662 }
86663
86664 public static int CountNPCS(int Type)
86665 {
86666 int num = 0;
86667 for (int i = 0; i < 200; i++)
86668 {
86669 if (Main.npc[i].active && Main.npc[i].type == Type)
86670 {
86671 num++;
86672 }
86673 }
86674 return num;
86675 }
86676
86677 public static bool AnyHelpfulFairies()
86678 {
86679 for (int i = 0; i < 200; i++)
86680 {
86681 if (Main.npc[i].active && (Main.npc[i].type == 583 || Main.npc[i].type == 584 || Main.npc[i].type == 585) && Main.npc[i].ai[2] > 1f)
86682 {
86683 return true;
86684 }
86685 }
86686 return false;
86687 }
86688
86689 public static bool AnyNPCs(int Type)
86690 {
86691 for (int i = 0; i < 200; i++)
86692 {
86693 if (Main.npc[i].active && Main.npc[i].type == Type)
86694 {
86695 return true;
86696 }
86697 }
86698 return false;
86699 }
86700
86701 public static int FindFirstNPC(int Type)
86702 {
86703 for (int i = 0; i < 200; i++)
86704 {
86705 if (Main.npc[i].active && Main.npc[i].type == Type)
86706 {
86707 return i;
86708 }
86709 }
86710 return -1;
86711 }
86712
86713 public static bool NearSpikeBall(int x, int y)
86714 {
86715 Rectangle rectangle = new Rectangle(x * 16 - 300, y * 16 - 300, 600, 600);
86716 for (int i = 0; i < 200; i++)
86717 {
86718 if (Main.npc[i].active && Main.npc[i].aiStyle == 20)
86719 {
86720 Rectangle rectangle2 = new Rectangle((int)Main.npc[i].ai[1], (int)Main.npc[i].ai[2], 20, 20);
86721 if (rectangle.Intersects(rectangle2))
86722 {
86723 return true;
86724 }
86725 }
86726 }
86727 return false;
86728 }
86729
86730 public int FindBuffIndex(int type)
86731 {
86732 if (buffImmune[type])
86733 {
86734 return -1;
86735 }
86736 for (int i = 0; i < maxBuffs; i++)
86737 {
86738 if (buffTime[i] >= 1 && buffType[i] == type)
86739 {
86740 return i;
86741 }
86742 }
86743 return -1;
86744 }
86745
86746 public void AddBuff(int type, int time, bool quiet = false)
86747 {
86748 if (buffImmune[type])
86749 {
86750 return;
86751 }
86752 if (!quiet)
86753 {
86754 if (Main.netMode == 1)
86755 {
86756 NetMessage.SendData(53, -1, -1, null, whoAmI, type, time);
86757 }
86758 else if (Main.netMode == 2)
86759 {
86760 NetMessage.SendData(54, -1, -1, null, whoAmI);
86761 }
86762 }
86763 int num = -1;
86764 for (int i = 0; i < maxBuffs; i++)
86765 {
86766 if (buffType[i] == type)
86767 {
86768 if (buffTime[i] < time)
86769 {
86770 buffTime[i] = time;
86771 }
86772 return;
86773 }
86774 }
86775 while (num == -1)
86776 {
86777 int num2 = -1;
86778 for (int j = 0; j < maxBuffs; j++)
86779 {
86780 if (!Main.debuff[buffType[j]])
86781 {
86782 num2 = j;
86783 break;
86784 }
86785 }
86786 if (num2 == -1)
86787 {
86788 return;
86789 }
86790 for (int k = num2; k < maxBuffs; k++)
86791 {
86792 if (buffType[k] == 0)
86793 {
86794 num = k;
86795 break;
86796 }
86797 }
86798 if (num == -1)
86799 {
86800 DelBuff(num2);
86801 }
86802 }
86803 buffType[num] = type;
86804 buffTime[num] = time;
86805 }
86806
86808 {
86810 {
86811 return;
86812 }
86813 int num = FindBuffIndex(buffTypeToRemove);
86814 if (num != -1)
86815 {
86816 DelBuff(num);
86817 if (Main.netMode == 1)
86818 {
86819 NetMessage.SendData(137, -1, -1, null, whoAmI, buffTypeToRemove);
86820 }
86821 }
86822 }
86823
86824 public void DelBuff(int buffIndex)
86825 {
86826 buffTime[buffIndex] = 0;
86827 buffType[buffIndex] = 0;
86828 for (int i = 0; i < maxBuffs - 1; i++)
86829 {
86830 if (buffTime[i] == 0 || buffType[i] == 0)
86831 {
86832 for (int j = i + 1; j < maxBuffs; j++)
86833 {
86834 buffTime[j - 1] = buffTime[j];
86835 buffType[j - 1] = buffType[j];
86836 buffTime[j] = 0;
86837 buffType[j] = 0;
86838 }
86839 }
86840 }
86841 if (Main.netMode == 2)
86842 {
86843 NetMessage.SendData(54, -1, -1, null, whoAmI);
86844 }
86845 }
86846
86848 {
86849 return new Rectangle((int)position.X, (int)position.Y, width, height);
86850 }
86851
86852 public bool CanBeChasedBy(object attacker = null, bool ignoreDontTakeDamage = false)
86853 {
86854 if (active && chaseable && lifeMax > 5 && (!dontTakeDamage || ignoreDontTakeDamage) && !friendly)
86855 {
86856 return !immortal;
86857 }
86858 return false;
86859 }
86860
86862 {
86863 if (CountsAsACritter || immortal)
86864 {
86865 return false;
86866 }
86867 return true;
86868 }
86869
86870 public void moneyPing(Vector2 pos)
86871 {
86872 SoundEngine.PlaySound(38, pos);
86873 int num = 244;
86874 if (extraValue >= 1000000)
86875 {
86876 num = 247;
86877 }
86878 else if (extraValue >= 10000)
86879 {
86880 num = 246;
86881 }
86882 else if (extraValue >= 100)
86883 {
86884 num = 245;
86885 }
86886 for (int i = 0; i < 20; i++)
86887 {
86888 int num2 = Dust.NewDust(pos - new Vector2(1f, 2f), 10, 14, num, 0f, 0f, 254, default(Color), 0.25f);
86889 Main.dust[num2].velocity *= 0.2f;
86890 }
86891 }
86892
86893 public void IdleSounds()
86894 {
86895 if (!(shimmerTransparency > 0f))
86896 {
86897 if ((type == 239 || type == 240) && Main.rand.Next(900) == 0)
86898 {
86899 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(24, 26));
86900 }
86901 else if ((type == 62 || type == 156) && Main.rand.Next(700) == 0)
86902 {
86903 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(26, 30));
86904 }
86905 else if (type == 177 && Main.rand.Next(600) == 0)
86906 {
86907 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(30, 32));
86908 }
86909 else if (type == 226 && Main.rand.Next(800) == 0)
86910 {
86911 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 32);
86912 }
86913 else if (type == 153 && Main.rand.Next(1000) == 0)
86914 {
86915 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 33);
86916 }
86917 else if (wet && (type == 63 || type == 64 || type == 103) && Main.rand.Next(1000) == 0)
86918 {
86919 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(34, 36));
86920 }
86921 else if ((type == 198 || type == 199) && Main.rand.Next(1000) == 0)
86922 {
86923 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(36, 38));
86924 }
86925 else if ((type == 170 || type == 180 || type == 171) && Main.rand.Next(600) == 0)
86926 {
86927 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(38, 41));
86928 }
86929 else if (type == 250 && Main.rand.Next(700) == 0)
86930 {
86931 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(41, 44));
86932 }
86933 else if (type == 580 && Main.rand.Next(800) == 0)
86934 {
86935 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 44);
86936 }
86937 else if (type == 582 && Main.rand.Next(800) == 0)
86938 {
86939 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 44);
86940 }
86941 else if (type == 581 && Main.rand.Next(800) == 0)
86942 {
86943 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(44, 47));
86944 }
86945 else if (type == 508 && Main.rand.Next(800) == 0)
86946 {
86947 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 44);
86948 }
86949 else if (type == 509 && Main.rand.Next(800) == 0)
86950 {
86951 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(44, 47));
86952 }
86953 else if (type == 494 && Main.rand.Next(600) == 0)
86954 {
86955 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 47);
86956 }
86957 else if (type == 467 && Main.rand.Next(700) == 0)
86958 {
86959 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(48, 50));
86960 }
86961 else if (type == 468 && Main.rand.Next(700) == 0)
86962 {
86963 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(50, 53));
86964 }
86965 else if (type == 288 && Main.rand.Next(400) == 0)
86966 {
86967 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(53, 55));
86968 }
86969 else if ((type == 524 || type == 525 || type == 526 || type == 527) && Main.rand.Next(700) == 0)
86970 {
86971 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(55, 57));
86972 }
86973 else if ((type == 496 || type == 497) && Main.rand.Next(600) == 0)
86974 {
86975 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(57, 59));
86976 }
86977 else if (type == 389 && Main.rand.Next(800) == 0)
86978 {
86979 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(59, 61));
86980 }
86981 else if (type == 471 && Main.rand.Next(600) == 0)
86982 {
86983 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(61, 63));
86984 }
86985 else if (type == 482 && Main.rand.Next(600) == 0)
86986 {
86987 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(63, 66));
86988 }
86989 else if (type == 388 && Main.rand.Next(700) == 0)
86990 {
86991 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(66, 69));
86992 }
86993 else if (type == 520 && Main.rand.Next(800) == 0)
86994 {
86995 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(69, 73));
86996 }
86997 else if (type == 477 && Main.rand.Next(600) == 0)
86998 {
86999 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 73);
87000 }
87001 else if (type == 258 && Main.rand.Next(700) == 0)
87002 {
87003 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(74, 78));
87004 }
87005 else if (type == 252 && Main.rand.Next(700) == 0)
87006 {
87007 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 78);
87008 }
87009 else if (type == 469 && Main.rand.Next(700) == 0)
87010 {
87011 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(79, 81));
87012 }
87013 else if ((type == 253 || type == 82) && Main.rand.Next(700) == 0)
87014 {
87015 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(81, 84));
87016 }
87017 else if (type >= 498 && type <= 506 && Main.rand.Next(600) == 0)
87018 {
87019 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(84, 86));
87020 }
87021 else if (type == 391 && Main.rand.Next(700) == 0)
87022 {
87023 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, Main.rand.Next(86, 87));
87024 }
87025 }
87026 }
87027
87028 public void UpdateAltTexture()
87029 {
87030 if (townNPC)
87031 {
87032 int oldAltTexture = altTexture;
87033 bool flag = BirthdayParty.PartyIsUp || ForcePartyHatOn;
87034 if (type == 441 || type == 453 || type == 633)
87035 {
87036 flag = false;
87037 }
87038 altTexture = 0;
87039 if (flag)
87040 {
87041 altTexture = 1;
87042 }
87043 if (type == 633 && ShouldBestiaryGirlBeLycantrope())
87044 {
87045 altTexture = 2;
87046 }
87047 if (!ForcePartyHatOn)
87048 {
87049 MakeTransitionEffectsForTextureChanges(oldAltTexture, altTexture);
87050 }
87051 }
87052 }
87053
87055 {
87056 if (oldAltTexture == 0 && currentAltTexture == 1)
87057 {
87058 for (int i = 0; i < 20; i++)
87059 {
87060 Dust.NewDust(position, width, height / 4, 139 + Main.rand.Next(4), 0f, -2f);
87061 }
87062 }
87063 if (oldAltTexture == 1 && currentAltTexture == 0)
87064 {
87065 Utils.PoofOfSmoke(position);
87066 }
87067 if (type != 633)
87068 {
87069 return;
87070 }
87071 int num = 2;
87072 if ((oldAltTexture == 0 && currentAltTexture == num) || (oldAltTexture == num && currentAltTexture == 0))
87073 {
87074 for (int j = 0; j < 20; j++)
87075 {
87076 Dust dust = Dust.NewDustDirect(position, width, height, 262, 0f, -2f);
87077 dust.noGravity = true;
87078 dust.scale = 2f;
87079 }
87080 }
87081 }
87082
87083 public static void ResetNetOffsets()
87084 {
87085 offSetDelayTime = 180;
87086 for (int i = 0; i < 200; i++)
87087 {
87088 Main.npc[i].netOffset *= 0f;
87089 }
87090 }
87091
87092 public void UpdateNPC(int i)
87093 {
87094 whoAmI = i;
87095 if (!active)
87096 {
87097 return;
87098 }
87099 if (offSetDelayTime > 0)
87100 {
87101 netOffset *= 0f;
87102 }
87103 else if (Main.netMode == 2)
87104 {
87105 netOffset *= 0f;
87106 }
87107 else if (Main.multiplayerNPCSmoothingRange <= 0)
87108 {
87109 netOffset *= 0f;
87110 }
87111 else if (netOffset != new Vector2(0f, 0f))
87112 {
87114 {
87115 netOffset *= 0f;
87116 }
87117 else if (NPCID.Sets.NoMultiplayerSmoothingByAI[aiStyle])
87118 {
87119 netOffset *= 0f;
87120 }
87121 else
87122 {
87123 float num = 2f;
87125 float num3 = netOffset.Length();
87126 if (num3 > num2)
87127 {
87128 netOffset.Normalize();
87129 netOffset *= num2;
87130 num3 = netOffset.Length();
87131 }
87132 num += num3 / num2 * num;
87133 Vector2 vector = netOffset;
87134 vector.Normalize();
87135 vector *= num;
87136 netOffset -= vector;
87137 if (netOffset.Length() < num)
87138 {
87139 netOffset *= 0f;
87140 }
87141 if (townNPC)
87142 {
87143 if (Vector2.Distance(position, new Vector2(homeTileX * 16 + 8 - width / 2, (float)(homeTileY * 16 - height) - 0.1f)) < 1f)
87144 {
87145 netOffset *= 0f;
87146 }
87147 if (ai[0] == 25f)
87148 {
87149 netOffset *= 0f;
87150 }
87151 }
87152 }
87153 }
87154 UpdateAltTexture();
87155 if (type == 368)
87156 {
87157 travelNPC = true;
87158 }
87159 if (Main.netMode != 2)
87160 {
87161 UpdateNPC_CastLights();
87162 }
87163 UpdateNPC_TeleportVisuals();
87164 UpdateNPC_CritterSounds();
87165 TrySyncingUniqueTownNPCData(i);
87166 if (aiStyle == 7 && position.Y > Main.bottomWorld - 640f + (float)height && Main.netMode != 1 && !Main.xMas)
87167 {
87168 StrikeNPCNoInteraction(9999, 0f, 0);
87169 if (Main.netMode == 2)
87170 {
87171 NetMessage.SendData(28, -1, -1, null, whoAmI, 9999f);
87172 }
87173 }
87174 if (Main.netMode == 1)
87175 {
87176 bool flag = false;
87177 int num4 = (int)(position.X + (float)(width / 2)) / 16;
87178 int num5 = (int)(position.Y + (float)(height / 2)) / 16;
87179 try
87180 {
87182 {
87183 if (Main.tile[num4, num5] == null)
87184 {
87185 flag = true;
87186 }
87187 else if (Main.tile[num4 - 3, num5] == null)
87188 {
87189 flag = true;
87190 }
87191 else if (Main.tile[num4 + 3, num5] == null)
87192 {
87193 flag = true;
87194 }
87195 else if (Main.tile[num4, num5 - 3] == null)
87196 {
87197 flag = true;
87198 }
87199 else if (Main.tile[num4, num5 + 3] == null)
87200 {
87201 flag = true;
87202 }
87203 }
87204 }
87205 catch
87206 {
87207 flag = true;
87208 }
87209 if (flag)
87210 {
87211 return;
87212 }
87213 }
87214 UpdateNPC_BuffFlagsReset();
87215 UpdateNPC_BuffSetFlags();
87216 UpdateNPC_SoulDrainDebuff();
87217 UpdateNPC_BuffClearExpiredBuffs();
87218 UpdateNPC_BuffApplyDOTs();
87219 UpdateNPC_BuffApplyVFX();
87220 UpdateNPC_BloodMoonTransformations();
87221 UpdateNPC_UpdateGravity(out var maxFallSpeed);
87222 if (soundDelay > 0)
87223 {
87224 soundDelay--;
87225 }
87226 if (life <= 0)
87227 {
87228 active = false;
87229 UpdateNetworkCode(i);
87230 netUpdate = false;
87231 justHit = false;
87232 return;
87233 }
87234 oldTarget = target;
87235 oldDirection = direction;
87236 oldDirectionY = directionY;
87237 float num6 = 1f + Math.Abs(velocity.X) / 3f;
87238 if (gfxOffY > 0f)
87239 {
87240 gfxOffY -= num6 * stepSpeed;
87241 if (gfxOffY < 0f)
87242 {
87243 gfxOffY = 0f;
87244 }
87245 }
87246 else if (gfxOffY < 0f)
87247 {
87248 gfxOffY += num6 * stepSpeed;
87249 if (gfxOffY > 0f)
87250 {
87251 gfxOffY = 0f;
87252 }
87253 }
87254 if (gfxOffY > 16f)
87255 {
87256 gfxOffY = 16f;
87257 }
87258 if (gfxOffY < -16f)
87259 {
87260 gfxOffY = -16f;
87261 }
87262 TryPortalJumping();
87263 IdleSounds();
87264 AI();
87265 SubAI_HandleTemporaryCatchableNPCPlayerInvulnerability();
87266 if (Main.netMode != 2 && extraValue > 0)
87267 {
87268 int num7 = 244;
87269 float num8 = 30f;
87270 if (extraValue >= 1000000)
87271 {
87272 num7 = 247;
87273 num8 *= 0.25f;
87274 }
87275 else if (extraValue >= 10000)
87276 {
87277 num7 = 246;
87278 num8 *= 0.5f;
87279 }
87280 else if (extraValue >= 100)
87281 {
87282 num7 = 245;
87283 num8 *= 0.75f;
87284 }
87285 if (Main.rand.Next((int)num8) == 0)
87286 {
87287 position += netOffset;
87288 int num9 = Dust.NewDust(position, width, height, num7, 0f, 0f, 254, default(Color), 0.25f);
87289 Main.dust[num9].velocity *= 0.1f;
87290 position -= netOffset;
87291 }
87292 }
87293 for (int j = 0; j < 256; j++)
87294 {
87295 if (immune[j] > 0)
87296 {
87297 immune[j]--;
87298 }
87299 }
87300 if (!noGravity && !noTileCollide)
87301 {
87302 int num10 = (int)(position.X + (float)(width / 2)) / 16;
87303 int num11 = (int)(position.Y + (float)(height / 2)) / 16;
87304 if (WorldGen.InWorld(num10, num11) && Main.tile[num10, num11] == null)
87305 {
87306 gravity = 0f;
87307 velocity.X = 0f;
87308 velocity.Y = 0f;
87309 }
87310 }
87311 if (!noGravity)
87312 {
87313 velocity.Y += gravity;
87314 if (velocity.Y > maxFallSpeed)
87315 {
87316 velocity.Y = maxFallSpeed;
87317 }
87318 }
87319 if ((double)velocity.X < 0.005 && (double)velocity.X > -0.005)
87320 {
87321 velocity.X = 0f;
87322 }
87323 if (Main.netMode != 1 && type != 37 && (friendly || NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[type]))
87324 {
87325 if (townNPC)
87326 {
87327 CheckDrowning();
87328 }
87329 CheckLifeRegen();
87330 GetHurtByOtherNPCs(NPCID.Sets.AllNPCs);
87331 }
87332 if (Main.netMode != 1 && (npcsFoundForCheckActive[210] || npcsFoundForCheckActive[211]) && !NPCID.Sets.HurtingBees[type])
87333 {
87334 GetHurtByOtherNPCs(NPCID.Sets.HurtingBees);
87335 }
87336 if (!noTileCollide)
87337 {
87338 UpdateCollision();
87339 }
87340 else
87341 {
87342 oldPosition = position;
87343 oldDirection = direction;
87344 position += velocity;
87345 if (onFire && boss && Main.netMode != 1 && Collision.WetCollision(position, width, height))
87346 {
87347 for (int k = 0; k < maxBuffs; k++)
87348 {
87349 if (buffType[k] == 24)
87350 {
87351 DelBuff(k);
87352 }
87353 }
87354 }
87355 }
87356 if (Main.netMode != 1 && !noTileCollide && lifeMax > 1 && Collision.SwitchTiles(position, width, height, oldPosition, 2) && (type == 46 || type == 148 || type == 149 || type == 303 || type == 361 || type == 362 || type == 364 || type == 366 || type == 367 || (type >= 442 && type <= 448) || type == 602 || type == 608 || type == 614 || type == 687))
87357 {
87358 ai[0] = 1f;
87359 ai[1] = 400f;
87360 ai[2] = 0f;
87361 }
87362 FindFrame();
87363 UpdateNPC_UpdateTrails();
87364 UpdateNetworkCode(i);
87365 CheckActive();
87366 netUpdate = false;
87367 justHit = false;
87368 }
87369
87371 {
87372 if (type >= 0 && type < NPCID.Count && Main.npcCatchable[type])
87373 {
87374 if (releaseOwner != 255 || SpawnedFromStatue)
87375 {
87376 catchableNPCTempImmunityCounter = 0;
87377 }
87378 bool num = friendly;
87379 if (catchableNPCTempImmunityCounter > 0)
87380 {
87381 catchableNPCTempImmunityCounter--;
87382 friendly = true;
87383 }
87384 else
87385 {
87386 friendly = false;
87387 }
87388 if (num != friendly)
87389 {
87390 netUpdate = true;
87391 }
87392 }
87393 }
87394
87396 {
87397 if (Main.netMode == 1 && needsUniqueInfoUpdate && isLikeATownNPC)
87398 {
87399 needsUniqueInfoUpdate = false;
87400 NetMessage.SendData(56, -1, -1, null, npcIndex);
87401 }
87402 }
87403
87404 private void UpdateNetworkCode(int i)
87405 {
87406 if (!active)
87407 {
87408 netUpdate = true;
87409 }
87410 if (Main.netMode != 2)
87411 {
87412 return;
87413 }
87414 if (Main.npcStreamSpeed > 0 && !townNPC && NPCID.Sets.UsesMultiplayerProximitySyncing[type] && (double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) >= 0.5)
87415 {
87416 netStream++;
87417 if (netStream >= Main.npcStreamSpeed)
87418 {
87419 for (int j = 0; j < 255; j++)
87420 {
87421 if (Main.player[j].active)
87422 {
87423 netStream = 0;
87424 float num = Math.Abs(base.Center.X - Main.player[j].Center.X) + Math.Abs(base.Center.Y - Main.player[j].Center.Y);
87425 if (num < 250f)
87426 {
87427 streamPlayer[j] -= 8;
87428 }
87429 else if (num < 500f)
87430 {
87431 streamPlayer[j] -= 4;
87432 }
87433 else if (num < 1000f)
87434 {
87435 streamPlayer[j] -= 2;
87436 }
87437 else if (num < 1500f)
87438 {
87439 streamPlayer[j]--;
87440 }
87441 if (streamPlayer[j] <= 0)
87442 {
87443 streamPlayer[j] = 8;
87444 NetMessage.SendData(23, j, -1, null, i);
87445 }
87446 }
87447 }
87448 }
87449 }
87450 if (townNPC || aiStyle == 16)
87451 {
87452 netSpam = 0;
87453 }
87454 if (netUpdate2)
87455 {
87456 netUpdate = true;
87457 }
87458 if (!active)
87459 {
87460 netSpam = 0;
87461 }
87462 if (netUpdate)
87463 {
87464 if (boss)
87465 {
87466 _ = oldPosition - position;
87467 if (netSpam <= 15)
87468 {
87469 netSpam += 5;
87470 NetMessage.SendData(23, -1, -1, null, i);
87471 netUpdate2 = false;
87472 }
87473 else
87474 {
87475 netUpdate2 = true;
87476 }
87477 }
87478 else if (netSpam <= 90)
87479 {
87480 netSpam += 30;
87481 NetMessage.SendData(23, -1, -1, null, i);
87482 netUpdate2 = false;
87483 }
87484 else
87485 {
87486 netUpdate2 = true;
87487 }
87488 }
87489 if (netSpam > 0)
87490 {
87491 netSpam--;
87492 }
87493 if (active && townNPC && TypeToDefaultHeadIndex(type) > 0)
87494 {
87495 if (homeless != oldHomeless || homeTileX != oldHomeTileX || homeTileY != oldHomeTileY)
87496 {
87497 byte householdStatus = WorldGen.TownManager.GetHouseholdStatus(this);
87498 NetMessage.SendData(60, -1, -1, null, i, Main.npc[i].homeTileX, Main.npc[i].homeTileY, (int)householdStatus);
87499 }
87500 oldHomeless = homeless;
87501 oldHomeTileX = homeTileX;
87502 oldHomeTileY = homeTileY;
87503 }
87504 }
87505
87507 {
87508 return new EntitySource_ByItemSourceId(this, itemSourceId);
87509 }
87510
87515
87517 {
87519 }
87520
87522 {
87523 return new EntitySource_Parent(this);
87524 }
87525
87527 {
87528 return new EntitySource_Parent(this);
87529 }
87530
87532 {
87533 return new EntitySource_Parent(this);
87534 }
87535
87537 {
87538 return new EntitySource_SpawnNPC();
87539 }
87540
87542 {
87543 return new EntitySource_SpawnNPC();
87544 }
87545
87547 {
87548 return new EntitySource_Parent(this);
87549 }
87550
87552 {
87553 return new EntitySource_Loot(this);
87554 }
87555
87557 {
87558 int num = NPCID.Sets.TrailingMode[type];
87559 if (num == 0)
87560 {
87561 if (localAI[3] <= 0f)
87562 {
87563 localAI[3] = 2f;
87564 for (int num2 = oldPos.Length - 1; num2 > 0; num2--)
87565 {
87566 oldPos[num2] = oldPos[num2 - 1];
87567 }
87568 oldPos[0] = position + netOffset;
87569 }
87570 localAI[3] -= 1f;
87571 }
87572 if (num == 1)
87573 {
87574 for (int num3 = oldPos.Length - 1; num3 > 0; num3--)
87575 {
87576 oldPos[num3] = oldPos[num3 - 1];
87577 }
87578 oldPos[0] = position + netOffset;
87579 }
87580 if (num == 2)
87581 {
87582 if ((int)ai[0] == 4 || ai[0] == 5f || ai[0] == 6f)
87583 {
87584 for (int num4 = oldPos.Length - 1; num4 > 0; num4--)
87585 {
87586 oldPos[num4] = oldPos[num4 - 1];
87587 oldRot[num4] = oldRot[num4 - 1];
87588 }
87589 oldPos[0] = position + netOffset;
87590 oldRot[0] = rotation;
87591 }
87592 else
87593 {
87594 for (int num5 = oldPos.Length - 1; num5 >= 0; num5--)
87595 {
87596 oldPos[num5] = position + netOffset;
87597 oldRot[num5] = rotation;
87598 }
87599 }
87600 }
87601 if (num == 3)
87602 {
87603 for (int num6 = oldPos.Length - 1; num6 > 0; num6--)
87604 {
87605 oldPos[num6] = oldPos[num6 - 1];
87606 oldRot[num6] = oldRot[num6 - 1];
87607 }
87608 oldPos[0] = position + netOffset;
87609 oldRot[0] = rotation;
87610 }
87611 switch (num)
87612 {
87613 case 4:
87614 {
87615 for (int num9 = oldPos.Length - 1; num9 > 0; num9--)
87616 {
87617 oldPos[num9] = oldPos[num9 - 1];
87618 Lighting.AddLight((int)position.X / 16, (int)position.Y / 16, 0.3f, 0f, 0.2f);
87619 }
87620 oldPos[0] = position + netOffset;
87621 break;
87622 }
87623 case 5:
87624 {
87625 for (int num8 = oldPos.Length - 1; num8 > 0; num8--)
87626 {
87627 oldPos[num8] = oldPos[num8 - 1];
87628 }
87629 oldPos[0] = position + netOffset;
87630 break;
87631 }
87632 case 6:
87633 {
87634 for (int num10 = oldPos.Length - 1; num10 > 0; num10--)
87635 {
87636 oldPos[num10] = oldPos[num10 - 1];
87637 }
87638 oldPos[0] = position + netOffset;
87639 break;
87640 }
87641 case 7:
87642 {
87643 for (int num7 = oldPos.Length - 1; num7 > 0; num7--)
87644 {
87645 oldPos[num7] = oldPos[num7 - 1];
87646 oldRot[num7] = oldRot[num7 - 1];
87647 }
87648 oldPos[0] = position + netOffset;
87649 oldRot[0] = rotation;
87650 break;
87651 }
87652 }
87653 }
87654
87655 private void UpdateNPC_UpdateGravity(out float maxFallSpeed)
87656 {
87657 maxFallSpeed = 10f;
87658 gravity = 0.3f;
87659 if (type == 258)
87660 {
87661 gravity = 0.1f;
87662 if (velocity.Y > 3f)
87663 {
87664 velocity.Y = 3f;
87665 }
87666 }
87667 else if (type == 425 && ai[2] == 1f)
87668 {
87669 gravity = 0.1f;
87670 }
87671 else if ((type == 576 || type == 577) && ai[0] > 0f && ai[1] == 2f)
87672 {
87673 gravity = 0.45f;
87674 if (velocity.Y > 32f)
87675 {
87676 velocity.Y = 32f;
87677 }
87678 }
87679 else if (type == 427 && ai[2] == 1f)
87680 {
87681 gravity = 0.1f;
87682 if (velocity.Y > 4f)
87683 {
87684 velocity.Y = 4f;
87685 }
87686 }
87687 else if (type == 426)
87688 {
87689 gravity = 0.1f;
87690 if (velocity.Y > 3f)
87691 {
87692 velocity.Y = 3f;
87693 }
87694 }
87695 else if (type == 541)
87696 {
87697 gravity = 0f;
87698 }
87699 else if (aiStyle == 7 && ai[0] == 25f)
87700 {
87701 gravity = 0f;
87702 }
87703 float num = (float)Main.maxTilesX / 4200f;
87704 num *= num;
87705 float num2 = (float)((double)(position.Y / 16f - (60f + 10f * num)) / (Main.worldSurface / 6.0));
87706 if ((double)num2 < 0.25)
87707 {
87708 num2 = 0.25f;
87709 }
87710 if (num2 > 1f)
87711 {
87712 num2 = 1f;
87713 }
87714 gravity *= num2;
87715 if (wet)
87716 {
87717 if (shimmerWet)
87718 {
87719 gravity = 0.15f;
87720 maxFallSpeed = 5.5f;
87721 }
87722 else if (honeyWet)
87723 {
87724 gravity = 0.1f;
87725 maxFallSpeed = 4f;
87726 }
87727 else
87728 {
87729 gravity = 0.2f;
87730 maxFallSpeed = 7f;
87731 }
87732 }
87733 }
87734
87736 {
87737 if (!soulDrain)
87738 {
87739 return;
87740 }
87741 int num = 1100;
87742 for (int i = 0; i < 255; i++)
87743 {
87744 if (Main.player[i].active && !Main.player[i].dead && (base.Center - Main.player[i].position).Length() < (float)num && Main.player[i].inventory[Main.player[i].selectedItem].type == 3006 && Main.player[i].itemAnimation > 0)
87745 {
87746 if (i == Main.myPlayer)
87747 {
87748 Main.player[i].soulDrain++;
87749 }
87750 if (Main.rand.Next(3) != 0)
87751 {
87752 Vector2 center = base.Center;
87753 center.X += (float)Main.rand.Next(-100, 100) * 0.05f;
87754 center.Y += (float)Main.rand.Next(-100, 100) * 0.05f;
87755 center += velocity;
87756 int num2 = Dust.NewDust(center, 1, 1, 235);
87757 Main.dust[num2].velocity *= 0f;
87758 Main.dust[num2].scale = (float)Main.rand.Next(70, 85) * 0.01f;
87759 Main.dust[num2].fadeIn = i + 1;
87760 }
87761 }
87762 }
87763 }
87764
87765 public static Color buffColor(Color newColor, float R, float G, float B, float A)
87766 {
87767 newColor.R = (byte)((float)(int)newColor.R * R);
87768 newColor.G = (byte)((float)(int)newColor.G * G);
87769 newColor.B = (byte)((float)(int)newColor.B * B);
87770 newColor.A = (byte)((float)(int)newColor.A * A);
87771 return newColor;
87772 }
87773
87775 {
87776 return Main.player[Main.myPlayer].detectCreature;
87777 }
87778
87780 {
87781 if (!canDisplayBuffs)
87782 {
87783 return npcColor;
87784 }
87785 float num = 1f;
87786 float num2 = 1f;
87787 float num3 = 1f;
87788 float a = 1f;
87789 if (poisoned)
87790 {
87791 num *= 0.65f;
87792 num3 *= 0.75f;
87793 npcColor = buffColor(npcColor, num, num2, num3, a);
87794 }
87795 if (venom)
87796 {
87797 num2 *= 0.45f;
87798 num *= 0.75f;
87799 npcColor = buffColor(npcColor, num, num2, num3, a);
87800 }
87801 if (midas)
87802 {
87803 num3 *= 0.3f;
87804 num *= 0.85f;
87805 npcColor = buffColor(npcColor, num, num2, num3, a);
87806 }
87807 if (betsysCurse)
87808 {
87809 num *= 0.8f;
87810 num2 *= 0.6f;
87811 npcColor = buffColor(npcColor, num, num2, num3, a);
87812 }
87813 if (oiled)
87814 {
87815 num *= 0.4f;
87816 num2 *= 0.4f;
87817 num3 *= 0.4f;
87818 npcColor = buffColor(npcColor, num, num2, num3, a);
87819 }
87820 if (stinky)
87821 {
87822 num *= 0.7f;
87823 num3 *= 0.55f;
87824 npcColor = buffColor(npcColor, num, num2, num3, a);
87825 }
87826 if (drippingSlime)
87827 {
87828 num *= 0.8f;
87829 num2 *= 0.8f;
87830 npcColor = buffColor(npcColor, num, num2, num3, a);
87831 }
87832 if (drippingSparkleSlime)
87833 {
87834 num3 *= 0.85f;
87835 num2 *= 0.75f;
87836 npcColor = buffColor(npcColor, num, num2, num3, a);
87837 }
87838 if (ichor)
87839 {
87840 npcColor = new Color(255, 255, 0, 255);
87841 }
87842 if (CanApplyHunterPotionEffects() && lifeMax > 1)
87843 {
87844 byte b;
87845 byte b2;
87846 byte b3;
87847 if (friendly || catchItem > 0 || (damage == 0 && lifeMax == 5))
87848 {
87849 b = 50;
87850 b2 = byte.MaxValue;
87851 b3 = 50;
87852 }
87853 else
87854 {
87855 b = byte.MaxValue;
87856 b2 = 50;
87857 b3 = 50;
87858 }
87859 if (npcColor.R < b)
87860 {
87861 npcColor.R = b;
87862 }
87863 if (npcColor.G < b2)
87864 {
87865 npcColor.G = b2;
87866 }
87867 if (npcColor.B < b3)
87868 {
87869 npcColor.B = b3;
87870 }
87871 }
87872 return npcColor;
87873 }
87874
87876 {
87877 if (!canDisplayBuffs)
87878 {
87879 return;
87880 }
87881 position += netOffset;
87882 if (markedByScytheWhip && Main.rand.Next(3) == 0)
87883 {
87885 {
87886 MovementVector = Main.rand.NextVector2Circular(1f, 1f),
87887 PositionInWorld = Main.rand.NextVector2FromRectangle(base.Hitbox)
87888 });
87889 }
87890 if (poisoned && Main.rand.Next(30) == 0)
87891 {
87892 Dust dust = Dust.NewDustDirect(position, width, height, 46, 0f, 0f, 120, default(Color), 0.2f);
87893 dust.noGravity = true;
87894 dust.fadeIn = 1.9f;
87895 }
87896 if (venom && Main.rand.Next(10) == 0)
87897 {
87898 Dust dust2 = Dust.NewDustDirect(position, width, height, 171, 0f, 0f, 100, default(Color), 0.5f);
87899 dust2.noGravity = true;
87900 dust2.fadeIn = 1.5f;
87901 }
87902 if (shadowFlame && Main.rand.Next(5) < 4)
87903 {
87904 Dust dust3 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 27, velocity.X * 0.4f, velocity.Y * 0.4f, 180, default(Color), 1.95f);
87905 dust3.noGravity = true;
87906 dust3.velocity *= 0.75f;
87907 dust3.velocity.X *= 0.75f;
87908 dust3.velocity.Y -= 1f;
87909 if (Main.rand.Next(4) == 0)
87910 {
87911 dust3.noGravity = false;
87912 dust3.scale *= 0.5f;
87913 }
87914 }
87915 if (onFire)
87916 {
87917 if (Main.rand.Next(4) < 3)
87918 {
87919 Dust dust4 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87920 dust4.noGravity = true;
87921 dust4.velocity *= 1.8f;
87922 dust4.velocity.Y -= 0.5f;
87923 if (Main.rand.Next(4) == 0)
87924 {
87925 dust4.noGravity = false;
87926 dust4.scale *= 0.5f;
87927 }
87928 }
87929 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87930 }
87931 if (onFire3)
87932 {
87933 if (Main.rand.Next(4) < 3)
87934 {
87935 Dust dust5 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87936 dust5.noGravity = true;
87937 dust5.velocity *= 1.8f;
87938 dust5.velocity.Y -= 0.5f;
87939 if (Main.rand.Next(4) == 0)
87940 {
87941 dust5.noGravity = false;
87942 dust5.scale *= 0.5f;
87943 }
87944 dust5.customData = 0;
87945 }
87946 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87947 }
87948 if (daybreak)
87949 {
87950 if (Main.rand.Next(4) < 3)
87951 {
87952 Dust dust6 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 158, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87953 dust6.noGravity = true;
87954 dust6.velocity *= 2.8f;
87955 dust6.velocity.Y -= 0.5f;
87956 if (Main.rand.Next(4) == 0)
87957 {
87958 dust6.noGravity = false;
87959 dust6.scale *= 0.5f;
87960 }
87961 }
87962 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87963 }
87964 if (betsysCurse)
87965 {
87966 if (Main.rand.Next(4) < 3)
87967 {
87968 Dust dust7 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 55, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87969 dust7.noGravity = true;
87970 dust7.velocity *= 2.8f;
87971 dust7.velocity.Y -= 1.5f;
87972 dust7.noGravity = false;
87973 dust7.scale = 0.9f;
87974 dust7.color = new Color(0, 0, 180, 255);
87975 dust7.velocity *= 0.2f;
87976 }
87977 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.6f, 0.1f, 0.9f);
87978 }
87979 if (oiled && Main.rand.Next(3) != 0)
87980 {
87981 int num = 175;
87982 Color newColor = new Color(0, 0, 0, 250);
87983 Vector2 vector = position;
87984 vector.X -= 2f;
87985 vector.Y -= 2f;
87986 if (Main.rand.Next(2) == 0)
87987 {
87988 Dust dust8 = Dust.NewDustDirect(vector, width + 4, height + 2, 4, 0f, 0f, num, newColor, 1.4f);
87989 if (Main.rand.Next(2) == 0)
87990 {
87991 dust8.alpha += 25;
87992 }
87993 if (Main.rand.Next(2) == 0)
87994 {
87995 dust8.alpha += 25;
87996 }
87997 dust8.noLight = true;
87998 dust8.velocity *= 0.2f;
87999 dust8.velocity.Y += 0.2f;
88000 dust8.velocity += velocity;
88001 }
88002 }
88003 if (dryadWard && velocity.X != 0f && Main.rand.Next(4) == 0)
88004 {
88005 Dust dust9 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y + (float)height - 2f), width + 4, 4, 163, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.5f);
88006 dust9.noGravity = true;
88007 dust9.noLight = true;
88008 dust9.velocity *= 0f;
88009 }
88010 if (dryadBane && Main.rand.Next(4) == 0)
88011 {
88012 Dust dust10 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y), width + 4, height, 163, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.5f);
88013 dust10.noGravity = true;
88014 dust10.velocity *= new Vector2(Main.rand.NextFloat() * 4f - 2f, 0f);
88015 dust10.noLight = true;
88016 }
88017 if (loveStruck && Main.rand.Next(5) == 0)
88018 {
88019 Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
88020 vector2.Normalize();
88021 vector2.X *= 0.66f;
88022 int num2 = Gore.NewGore(position + new Vector2(Main.rand.Next(width + 1), Main.rand.Next(height + 1)), vector2 * Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f);
88023 Main.gore[num2].sticky = false;
88024 Main.gore[num2].velocity *= 0.4f;
88025 Main.gore[num2].velocity.Y -= 0.6f;
88026 }
88027 if (stinky && Main.rand.Next(5) == 0)
88028 {
88029 Vector2 vector3 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
88030 vector3.Normalize();
88031 vector3.X *= 0.66f;
88032 vector3.Y = Math.Abs(vector3.Y);
88033 Vector2 vector4 = vector3 * Main.rand.Next(3, 5) * 0.25f;
88034 Dust dust11 = Dust.NewDustDirect(position, width, height, 188, vector4.X, vector4.Y * 0.5f, 100, default(Color), 1.5f);
88035 dust11.velocity *= 0.1f;
88036 dust11.velocity.Y -= 0.5f;
88037 }
88038 if (dripping && Main.rand.Next(4) != 0)
88039 {
88040 Vector2 vector5 = position;
88041 vector5.X -= 2f;
88042 vector5.Y -= 2f;
88043 if (Main.rand.Next(2) == 0)
88044 {
88045 Dust dust12 = Dust.NewDustDirect(vector5, width + 4, height + 2, 211, 0f, 0f, 50, default(Color), 0.8f);
88046 if (Main.rand.Next(2) == 0)
88047 {
88048 dust12.alpha += 25;
88049 }
88050 if (Main.rand.Next(2) == 0)
88051 {
88052 dust12.alpha += 25;
88053 }
88054 dust12.noLight = true;
88055 dust12.velocity *= 0.2f;
88056 dust12.velocity.Y += 0.2f;
88057 dust12.velocity += velocity;
88058 }
88059 else
88060 {
88061 Dust dust13 = Dust.NewDustDirect(vector5, width + 8, height + 8, 211, 0f, 0f, 50, default(Color), 1.1f);
88062 if (Main.rand.Next(2) == 0)
88063 {
88064 dust13.alpha += 25;
88065 }
88066 if (Main.rand.Next(2) == 0)
88067 {
88068 dust13.alpha += 25;
88069 }
88070 dust13.noLight = true;
88071 dust13.noGravity = true;
88072 dust13.velocity *= 0.2f;
88073 dust13.velocity.Y += 1f;
88074 dust13.velocity += velocity;
88075 }
88076 }
88077 if (drippingSlime && Main.rand.Next(4) != 0)
88078 {
88079 int num3 = 175;
88080 Color newColor2 = new Color(0, 80, 255, 100);
88081 Vector2 vector6 = position;
88082 vector6.X -= 2f;
88083 vector6.Y -= 2f;
88084 if (Main.rand.Next(2) == 0)
88085 {
88086 Dust dust14 = Dust.NewDustDirect(vector6, width + 4, height + 2, 4, 0f, 0f, num3, newColor2, 1.4f);
88087 if (Main.rand.Next(2) == 0)
88088 {
88089 dust14.alpha += 25;
88090 }
88091 if (Main.rand.Next(2) == 0)
88092 {
88093 dust14.alpha += 25;
88094 }
88095 dust14.noLight = true;
88096 dust14.velocity *= 0.2f;
88097 dust14.velocity.Y += 0.2f;
88098 dust14.velocity += velocity;
88099 }
88100 }
88101 if (drippingSparkleSlime && Main.rand.Next(4) != 0)
88102 {
88103 int num4 = 150;
88104 Vector2 vector7 = position;
88105 vector7.X -= 2f;
88106 vector7.Y -= 2f;
88107 if (Main.rand.Next(2) == 0)
88108 {
88109 Dust dust15 = Dust.NewDustDirect(vector7, width + 4, height + 2, 243, 0f, 0f, num4);
88110 if (Main.rand.Next(2) == 0)
88111 {
88112 dust15.alpha += 25;
88113 }
88114 if (Main.rand.Next(2) == 0)
88115 {
88116 dust15.alpha += 25;
88117 }
88118 dust15.noLight = true;
88119 dust15.velocity *= 0.2f;
88120 dust15.velocity.Y += 0.2f;
88121 dust15.velocity += velocity;
88122 }
88123 }
88124 if (onFrostBurn)
88125 {
88126 if (Main.rand.Next(4) < 3)
88127 {
88128 Dust dust16 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88129 dust16.noGravity = true;
88130 dust16.velocity *= 1.8f;
88131 dust16.velocity.Y -= 0.5f;
88132 if (Main.rand.Next(4) == 0)
88133 {
88134 dust16.noGravity = false;
88135 dust16.scale *= 0.5f;
88136 }
88137 }
88138 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.1f, 0.6f, 1f);
88139 }
88140 if (onFrostBurn2)
88141 {
88142 if (Main.rand.Next(4) < 3)
88143 {
88144 Dust dust17 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88145 dust17.noGravity = true;
88146 dust17.velocity *= 1.8f;
88147 dust17.velocity.Y -= 0.5f;
88148 if (Main.rand.Next(4) == 0)
88149 {
88150 dust17.noGravity = false;
88151 dust17.scale *= 0.5f;
88152 }
88153 }
88154 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.1f, 0.6f, 1f);
88155 }
88156 if (onFire2)
88157 {
88158 if (Main.rand.Next(4) < 3)
88159 {
88160 Dust dust18 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 75, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88161 dust18.noGravity = true;
88162 dust18.velocity *= 1.8f;
88163 dust18.velocity.Y -= 0.5f;
88164 if (Main.rand.Next(4) == 0)
88165 {
88166 dust18.noGravity = false;
88167 dust18.scale *= 0.5f;
88168 }
88169 }
88170 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
88171 }
88172 netShimmer = false;
88173 if (shimmering)
88174 {
88175 shimmerTransparency += 0.01f;
88176 if (Main.netMode != 1 && (double)shimmerTransparency > 0.9)
88177 {
88178 GetShimmered();
88179 }
88180 if (shimmerTransparency > 1f)
88181 {
88182 shimmerTransparency = 1f;
88183 }
88184 }
88185 else if (shimmerTransparency > 0f)
88186 {
88187 if (justHit)
88188 {
88189 shimmerTransparency -= 0.1f;
88190 }
88191 if (buffImmune[353])
88192 {
88193 shimmerTransparency -= 0.015f;
88194 }
88195 else
88196 {
88197 shimmerTransparency -= 0.001f;
88198 }
88199 if (shimmerTransparency < 0f)
88200 {
88201 shimmerTransparency = 0f;
88202 }
88203 }
88204 position -= netOffset;
88205 }
88206
88207 private void GetShimmered()
88208 {
88209 if (SpawnedFromStatue)
88210 {
88211 if (Main.netMode == 0)
88212 {
88213 Item.ShimmerEffect(base.Center);
88214 }
88215 else
88216 {
88217 NetMessage.SendData(146, -1, -1, null, 0, (int)base.Center.X, (int)base.Center.Y);
88218 }
88219 noSpawnCycle = true;
88220 active = false;
88221 if (Main.netMode == 2)
88222 {
88223 netSkip = -1;
88224 life = 0;
88225 NetMessage.SendData(23, -1, -1, null, whoAmI);
88226 }
88227 }
88228 else if (NPCID.Sets.ShimmerTransformToNPC[type] >= 0)
88229 {
88231 if (Main.netMode == 0)
88232 {
88233 Item.ShimmerEffect(base.Center);
88234 }
88235 else
88236 {
88237 NetMessage.SendData(146, -1, -1, null, 0, (int)base.Center.X, (int)base.Center.Y);
88238 }
88239 }
88240 else if (NPCID.Sets.ShimmerTransformToItem[type] >= 0)
88241 {
88242 int num = Item.NewItem(GetItemSource_Misc(8), (int)position.X, (int)position.Y, width, height, NPCID.Sets.ShimmerTransformToItem[type]);
88243 Main.item[num].stack = 1;
88244 Main.item[num].shimmerTime = 1f;
88245 Main.item[num].shimmered = true;
88246 Main.item[num].shimmerWet = true;
88247 Main.item[num].wet = true;
88248 Main.item[num].velocity *= 0.1f;
88249 Main.item[num].playerIndexTheItemIsReservedFor = Main.myPlayer;
88250 NetMessage.SendData(145, -1, -1, null, num, 1f);
88251 if (Main.netMode == 0)
88252 {
88253 Item.ShimmerEffect(base.Center);
88254 }
88255 else
88256 {
88257 NetMessage.SendData(146, -1, -1, null, 0, (int)base.Center.X, (int)base.Center.Y);
88258 }
88259 noSpawnCycle = true;
88260 active = false;
88261 if (Main.netMode == 2)
88262 {
88263 netSkip = -1;
88264 life = 0;
88265 NetMessage.SendData(23, -1, -1, null, whoAmI);
88266 }
88267 }
88269 {
88270 ai[0] = 25f;
88271 ai[1] = 0f;
88272 ai[2] = 0f;
88273 ai[3] = 0f;
88274 netUpdate = true;
88275 shimmerTransparency = 0.89f;
88276 int num2 = FindBuffIndex(353);
88277 if (num2 != -1)
88278 {
88279 DelBuff(num2);
88280 }
88281 }
88282 }
88283
88285 {
88286 if (dontTakeDamage)
88287 {
88288 return;
88289 }
88290 int num = lifeRegenExpectedLossPerSecond;
88291 if (poisoned)
88292 {
88293 if (lifeRegen > 0)
88294 {
88295 lifeRegen = 0;
88296 }
88297 lifeRegen -= 12;
88298 }
88299 if (onFire)
88300 {
88301 if (lifeRegen > 0)
88302 {
88303 lifeRegen = 0;
88304 }
88305 lifeRegen -= 8;
88306 }
88307 if (onFire3)
88308 {
88309 if (lifeRegen > 0)
88310 {
88311 lifeRegen = 0;
88312 }
88313 lifeRegen -= 30;
88314 if (num < 5)
88315 {
88316 num = 5;
88317 }
88318 }
88319 if (onFrostBurn)
88320 {
88321 if (lifeRegen > 0)
88322 {
88323 lifeRegen = 0;
88324 }
88325 lifeRegen -= 16;
88326 if (num < 2)
88327 {
88328 num = 2;
88329 }
88330 }
88331 if (onFrostBurn2)
88332 {
88333 if (lifeRegen > 0)
88334 {
88335 lifeRegen = 0;
88336 }
88337 lifeRegen -= 50;
88338 if (num < 10)
88339 {
88340 num = 10;
88341 }
88342 }
88343 if (onFire2)
88344 {
88345 if (lifeRegen > 0)
88346 {
88347 lifeRegen = 0;
88348 }
88349 lifeRegen -= 48;
88350 if (num < 10)
88351 {
88352 num = 10;
88353 }
88354 }
88355 if (venom)
88356 {
88357 if (lifeRegen > 0)
88358 {
88359 lifeRegen = 0;
88360 }
88361 lifeRegen -= 60;
88362 if (num < 15)
88363 {
88364 num = 15;
88365 }
88366 }
88367 if (shadowFlame)
88368 {
88369 if (lifeRegen > 0)
88370 {
88371 lifeRegen = 0;
88372 }
88373 lifeRegen -= 30;
88374 if (num < 5)
88375 {
88376 num = 5;
88377 }
88378 }
88379 if (oiled && (onFire || onFire2 || onFire3 || onFrostBurn || onFrostBurn2 || shadowFlame))
88380 {
88381 if (lifeRegen > 0)
88382 {
88383 lifeRegen = 0;
88384 }
88385 lifeRegen -= 50;
88386 if (num < 10)
88387 {
88388 num = 10;
88389 }
88390 }
88391 if (javelined)
88392 {
88393 if (lifeRegen > 0)
88394 {
88395 lifeRegen = 0;
88396 }
88397 int num2 = 0;
88398 int num3 = 1;
88399 for (int i = 0; i < 1000; i++)
88400 {
88401 if (Main.projectile[i].active && Main.projectile[i].type == 598 && Main.projectile[i].ai[0] == 1f && Main.projectile[i].ai[1] == (float)whoAmI)
88402 {
88403 num2++;
88404 }
88405 }
88406 lifeRegen -= num2 * 2 * 3;
88407 if (num < num2 * 3 / num3)
88408 {
88409 num = num2 * 3 / num3;
88410 }
88411 }
88412 if (tentacleSpiked)
88413 {
88414 if (lifeRegen > 0)
88415 {
88416 lifeRegen = 0;
88417 }
88418 int num4 = 0;
88419 int num5 = 1;
88420 for (int j = 0; j < 1000; j++)
88421 {
88422 if (Main.projectile[j].active && Main.projectile[j].type == 971 && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)whoAmI)
88423 {
88424 num4++;
88425 }
88426 }
88427 lifeRegen -= num4 * 2 * 3;
88428 if (num < num4 * 3 / num5)
88429 {
88430 num = num4 * 3 / num5;
88431 }
88432 }
88433 if (bloodButchered)
88434 {
88435 if (lifeRegen > 0)
88436 {
88437 lifeRegen = 0;
88438 }
88439 int num6 = 0;
88440 int num7 = 1;
88441 for (int k = 0; k < 1000; k++)
88442 {
88443 if (Main.projectile[k].active && Main.projectile[k].type == 975 && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == (float)whoAmI)
88444 {
88445 num6++;
88446 }
88447 }
88448 lifeRegen -= num6 * 2 * 4;
88449 if (num < num6 * 4 / num7)
88450 {
88451 num = num6 * 4 / num7;
88452 }
88453 }
88454 if (daybreak)
88455 {
88456 if (lifeRegen > 0)
88457 {
88458 lifeRegen = 0;
88459 }
88460 int num8 = 0;
88461 int num9 = 4;
88462 for (int l = 0; l < 1000; l++)
88463 {
88464 if (Main.projectile[l].active && Main.projectile[l].type == 636 && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)whoAmI)
88465 {
88466 num8++;
88467 }
88468 }
88469 if (num8 == 0)
88470 {
88471 num8 = 1;
88472 }
88473 lifeRegen -= num8 * 2 * 100;
88474 if (num < num8 * 100 / num9)
88475 {
88476 num = num8 * 100 / num9;
88477 }
88478 }
88479 if (celled)
88480 {
88481 if (lifeRegen > 0)
88482 {
88483 lifeRegen = 0;
88484 }
88485 int num10 = 0;
88486 for (int m = 0; m < 1000; m++)
88487 {
88488 if (Main.projectile[m].active && Main.projectile[m].type == 614 && Main.projectile[m].ai[0] == 1f && Main.projectile[m].ai[1] == (float)whoAmI)
88489 {
88490 num10++;
88491 }
88492 }
88493 lifeRegen -= num10 * 2 * 20;
88494 if (num < num10 * 20)
88495 {
88496 num = num10 * 20 / 2;
88497 }
88498 }
88499 if (dryadBane)
88500 {
88501 int num11 = 4;
88502 float num12 = 1f;
88503 if (lifeRegen > 0)
88504 {
88505 lifeRegen = 0;
88506 }
88507 if (downedBoss1)
88508 {
88509 num12 += 0.1f;
88510 }
88511 if (downedBoss2)
88512 {
88513 num12 += 0.1f;
88514 }
88515 if (downedBoss3)
88516 {
88517 num12 += 0.1f;
88518 }
88519 if (downedQueenBee)
88520 {
88521 num12 += 0.1f;
88522 }
88523 if (Main.hardMode)
88524 {
88525 num12 += 0.4f;
88526 }
88527 if (downedMechBoss1)
88528 {
88529 num12 += 0.15f;
88530 }
88531 if (downedMechBoss2)
88532 {
88533 num12 += 0.15f;
88534 }
88535 if (downedMechBoss3)
88536 {
88537 num12 += 0.15f;
88538 }
88539 if (downedPlantBoss)
88540 {
88541 num12 += 0.15f;
88542 }
88543 if (downedGolemBoss)
88544 {
88545 num12 += 0.15f;
88546 }
88547 if (downedAncientCultist)
88548 {
88549 num12 += 0.15f;
88550 }
88551 if (Main.expertMode)
88552 {
88553 num12 *= Main.GameModeInfo.TownNPCDamageMultiplier;
88554 }
88555 num11 = (int)((float)num11 * num12);
88556 lifeRegen -= 2 * num11;
88557 if (num < num11)
88558 {
88559 num = num11 / 3;
88560 }
88561 }
88562 if (soulDrain && realLife == -1)
88563 {
88564 if (lifeRegen > 0)
88565 {
88566 lifeRegen = 0;
88567 }
88568 lifeRegen -= 50;
88569 if (num < 5)
88570 {
88571 num = 5;
88572 }
88573 }
88574 if (lifeRegen <= -240 && num < 2)
88575 {
88576 num = 2;
88577 }
88578 lifeRegenCount += lifeRegen;
88579 while (lifeRegenCount >= 120)
88580 {
88581 lifeRegenCount -= 120;
88582 if (!immortal)
88583 {
88584 if (life < lifeMax)
88585 {
88586 life++;
88587 }
88588 if (life > lifeMax)
88589 {
88590 life = lifeMax;
88591 }
88592 }
88593 }
88594 if (num > 0)
88595 {
88596 while (lifeRegenCount <= -120 * num)
88597 {
88598 lifeRegenCount += 120 * num;
88599 int num13 = whoAmI;
88600 if (realLife >= 0)
88601 {
88602 num13 = realLife;
88603 }
88604 if (!Main.npc[num13].immortal)
88605 {
88606 Main.npc[num13].life -= num;
88607 }
88608 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, num, dramatic: false, dot: true);
88609 if (Main.npc[num13].life > 0 || Main.npc[num13].immortal)
88610 {
88611 continue;
88612 }
88613 Main.npc[num13].life = 1;
88614 if (Main.netMode != 1)
88615 {
88616 Main.npc[num13].StrikeNPCNoInteraction(9999, 0f, 0);
88617 if (Main.netMode == 2)
88618 {
88619 NetMessage.SendData(28, -1, -1, null, num13, 9999f);
88620 }
88621 }
88622 }
88623 return;
88624 }
88625 while (lifeRegenCount <= -120)
88626 {
88627 lifeRegenCount += 120;
88628 int num14 = whoAmI;
88629 if (realLife >= 0)
88630 {
88631 num14 = realLife;
88632 }
88633 if (!Main.npc[num14].immortal)
88634 {
88635 Main.npc[num14].life--;
88636 }
88637 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, 1, dramatic: false, dot: true);
88638 if (Main.npc[num14].life > 0 || Main.npc[num14].immortal)
88639 {
88640 continue;
88641 }
88642 Main.npc[num14].life = 1;
88643 if (Main.netMode != 1)
88644 {
88645 Main.npc[num14].StrikeNPCNoInteraction(9999, 0f, 0);
88646 if (Main.netMode == 2)
88647 {
88648 NetMessage.SendData(28, -1, -1, null, num14, 9999f);
88649 }
88650 }
88651 }
88652 }
88653
88655 {
88656 if (Main.netMode == 1)
88657 {
88658 return;
88659 }
88660 for (int i = 0; i < maxBuffs; i++)
88661 {
88662 if (buffType[i] > 0 && buffTime[i] <= 0)
88663 {
88664 DelBuff(i);
88665 if (Main.netMode == 2)
88666 {
88667 NetMessage.SendData(54, -1, -1, null, whoAmI);
88668 }
88669 }
88670 }
88671 }
88672
88674 {
88675 if (Main.netMode != 1 && Main.bloodMoon)
88676 {
88677 bool flag = false;
88678 if (value == 0f)
88679 {
88680 flag = true;
88681 }
88682 AttemptToConvertNPCToEvil(WorldGen.crimson);
88683 if (flag)
88684 {
88685 value = 0f;
88686 }
88687 }
88688 }
88689
88690 public void AttemptToConvertNPCToEvil(bool crimson)
88691 {
88692 if (type == 46 || type == 303 || type == 337 || type == 443 || type == 540)
88693 {
88694 if (crimson)
88695 {
88696 Transform(464);
88697 }
88698 else
88699 {
88700 Transform(47);
88701 }
88702 }
88703 else if (type == 55 || type == 230 || type == 592 || type == 593)
88704 {
88705 if (crimson)
88706 {
88707 Transform(465);
88708 }
88709 else
88710 {
88711 Transform(57);
88712 }
88713 }
88714 else if (type == 148 || type == 149)
88715 {
88716 if (crimson)
88717 {
88718 Transform(470);
88719 }
88720 else
88721 {
88722 Transform(168);
88723 }
88724 }
88725 }
88726
88727 public void UpdateNPC_BuffSetFlags(bool lowerBuffTime = true)
88728 {
88729 for (int i = 0; i < maxBuffs; i++)
88730 {
88731 if (buffType[i] <= 0 || buffTime[i] <= 0)
88732 {
88733 continue;
88734 }
88735 if (lowerBuffTime)
88736 {
88737 buffTime[i]--;
88738 }
88739 if (buffType[i] == 20)
88740 {
88741 poisoned = true;
88742 }
88743 if (buffType[i] == 70)
88744 {
88745 venom = true;
88746 }
88747 if (buffType[i] == 24)
88748 {
88749 onFire = true;
88750 }
88751 if (buffType[i] == 72)
88752 {
88753 midas = true;
88754 }
88755 if (buffType[i] == 69)
88756 {
88757 ichor = true;
88758 }
88759 if (buffType[i] == 31)
88760 {
88761 confused = true;
88762 }
88763 if (buffType[i] == 39)
88764 {
88765 onFire2 = true;
88766 }
88767 if (buffType[i] == 44)
88768 {
88769 onFrostBurn = true;
88770 }
88771 if (buffType[i] == 103)
88772 {
88773 dripping = true;
88774 }
88775 if (buffType[i] == 137)
88776 {
88777 drippingSlime = true;
88778 }
88779 if (buffType[i] == 320)
88780 {
88781 drippingSparkleSlime = true;
88782 }
88783 if (buffType[i] == 119)
88784 {
88785 loveStruck = true;
88786 }
88787 if (buffType[i] == 120)
88788 {
88789 stinky = true;
88790 }
88791 if (buffType[i] == 151)
88792 {
88793 soulDrain = true;
88794 }
88795 if (buffType[i] == 153)
88796 {
88797 shadowFlame = true;
88798 }
88799 if (buffType[i] == 165)
88800 {
88801 dryadWard = true;
88802 }
88803 if (buffType[i] == 169)
88804 {
88805 javelined = true;
88806 }
88807 if (buffType[i] == 337)
88808 {
88809 tentacleSpiked = true;
88810 }
88811 if (buffType[i] == 344)
88812 {
88813 bloodButchered = true;
88814 }
88815 if (buffType[i] == 183)
88816 {
88817 celled = true;
88818 }
88819 if (buffType[i] == 186)
88820 {
88821 dryadBane = true;
88822 }
88823 if (buffType[i] == 189)
88824 {
88825 daybreak = true;
88826 }
88827 if (buffType[i] == 203)
88828 {
88829 betsysCurse = true;
88830 }
88831 if (buffType[i] == 204)
88832 {
88833 oiled = true;
88834 }
88835 if (buffType[i] == 310)
88836 {
88837 markedByScytheWhip = true;
88838 }
88839 if (buffType[i] == 323)
88840 {
88841 onFire3 = true;
88842 }
88843 if (buffType[i] == 324)
88844 {
88845 onFrostBurn2 = true;
88846 }
88847 if (buffType[i] == 353)
88848 {
88849 if (buffImmune[353])
88850 {
88851 DelBuff(i);
88852 }
88853 else
88854 {
88855 shimmering = true;
88856 }
88857 }
88858 }
88859 }
88860
88862 {
88863 lifeRegen = 0;
88864 soulDrain = false;
88865 poisoned = false;
88866 venom = false;
88867 shadowFlame = false;
88868 onFire = false;
88869 midas = false;
88870 ichor = false;
88871 onFrostBurn = false;
88872 onFrostBurn2 = false;
88873 onFire2 = false;
88874 onFire3 = false;
88875 confused = false;
88876 loveStruck = false;
88877 dryadWard = false;
88878 stinky = false;
88879 dripping = false;
88880 drippingSlime = false;
88881 drippingSparkleSlime = false;
88882 daybreak = false;
88883 javelined = false;
88884 tentacleSpiked = false;
88885 bloodButchered = false;
88886 celled = false;
88887 dryadBane = false;
88888 betsysCurse = false;
88889 oiled = false;
88890 markedByScytheWhip = false;
88891 shimmering = false;
88892 lifeRegenExpectedLossPerSecond = -1;
88893 }
88894
88896 {
88897 if (!(teleportTime > 0f))
88898 {
88899 return;
88900 }
88901 if (teleportStyle == 0)
88902 {
88903 if ((float)Main.rand.Next(100) <= 100f * teleportTime * 2f)
88904 {
88905 int num = Dust.NewDust(new Vector2(getRect().X, getRect().Y), getRect().Width, getRect().Height, 159);
88906 Main.dust[num].scale = teleportTime * 1.5f;
88907 Main.dust[num].noGravity = true;
88908 Main.dust[num].velocity *= 1.1f;
88909 }
88910 }
88911 else if (teleportStyle == 4)
88912 {
88913 teleportTime -= 0.02f;
88914 if ((float)Main.rand.Next(100) <= 100f * teleportTime)
88915 {
88916 Dust obj = Main.dust[Dust.NewDust(position, width, height, 263)];
88917 obj.color = PortalHelper.GetPortalColor(lastPortalColorIndex);
88918 obj.noLight = true;
88919 obj.noGravity = true;
88920 obj.scale = 1.2f;
88921 obj.fadeIn = 0.4f;
88922 }
88923 }
88924 else if (teleportStyle == 12)
88925 {
88926 teleportTime -= 0.02f;
88927 if ((float)Main.rand.Next(100) <= 100f * teleportTime)
88928 {
88929 Dust obj2 = Main.dust[Dust.NewDust(position, width, height, 263)];
88930 obj2.color = Main.hslToRgb((float)(Main.timeForVisualEffects / 60.0) % 1f, 1f, 0.75f, 0);
88931 obj2.noLight = true;
88932 obj2.noGravity = true;
88933 obj2.scale = 1.2f;
88934 obj2.fadeIn = 0.4f;
88935 }
88936 }
88937 else if (teleportStyle == 13)
88938 {
88939 teleportTime = 0f;
88940 }
88941 teleportTime = Math.Max(0f, teleportTime - 0.005f);
88942 }
88943
88945 {
88946 if (Main.netMode == 2)
88947 {
88948 return;
88949 }
88950 if (type == 611 && !Main.dayTime && Main.rand.Next(700) == 0)
88951 {
88952 SoundEngine.PlaySound(46, (int)position.X, (int)position.Y);
88953 }
88954 if (type >= 602 && type <= 603 && Main.dayTime && Main.rand.Next(1200) == 0)
88955 {
88956 SoundEngine.PlaySound(44, (int)position.X, (int)position.Y);
88957 }
88958 if (type >= 362 && type <= 365)
88959 {
88960 if (Main.dayTime && Main.rand.Next(200) == 0)
88961 {
88962 SoundEngine.PlaySound(30, (int)position.X, (int)position.Y);
88963 }
88964 }
88965 else if (type == 361 || type == 445 || type == 687)
88966 {
88967 if ((double)Math.Abs(velocity.X) < 0.5 && (!Main.dayTime || (double)position.Y > Main.worldSurface * 16.0) && Main.rand.Next(200) == 0)
88968 {
88969 SoundEngine.PlaySound(31, (int)position.X, (int)position.Y);
88970 }
88971 }
88972 else if (type == 74 || type == 297 || type == 298 || type == 442 || type == 671 || type == 672 || type == 673 || type == 674 || type == 675)
88973 {
88974 if (!Main.dayTime || !(Main.time < 18000.0))
88975 {
88976 return;
88977 }
88978 int maxValue = 400;
88979 if (Main.rand.Next(maxValue) != 0)
88980 {
88981 return;
88982 }
88983 if (type == 74)
88984 {
88985 if (Main.rand.Next(3) != 0)
88986 {
88987 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 14);
88988 }
88989 else
88990 {
88991 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 18);
88992 }
88993 }
88994 if (type == 297)
88995 {
88996 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 16);
88997 }
88998 if (type == 298)
88999 {
89000 if (Main.rand.Next(3) != 0)
89001 {
89002 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 17);
89003 }
89004 else
89005 {
89006 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 19);
89007 }
89008 }
89009 if (type == 674 || type == 675)
89010 {
89011 SoundEngine.PlaySound(67, (int)position.X, (int)position.Y);
89012 }
89013 if (type == 671 || type == 672)
89014 {
89015 SoundEngine.PlaySound(68, (int)position.X, (int)position.Y);
89016 }
89017 if (type == 673)
89018 {
89019 SoundEngine.PlaySound(69, (int)position.X, (int)position.Y);
89020 }
89021 if (type == 442)
89022 {
89023 switch (Main.rand.Next(5))
89024 {
89025 case 0:
89026 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 16);
89027 break;
89028 case 1:
89029 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 17);
89030 break;
89031 case 2:
89032 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 19);
89033 break;
89034 case 3:
89035 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 14);
89036 break;
89037 default:
89038 SoundEngine.PlaySound(32, (int)position.X, (int)position.Y, 18);
89039 break;
89040 }
89041 }
89042 }
89043 else if ((type == 300 || type == 447 || type == 610) && Main.rand.Next(1800) == 0)
89044 {
89045 SoundEngine.PlaySound(33, (int)position.X, (int)position.Y);
89046 }
89047 }
89048
89050 {
89051 if ((type >= 442 && type <= 448) || type == 539 || type == 592 || type == 593 || type == 601 || type == 605 || type == 627)
89052 {
89053 position += netOffset;
89054 Color color = Lighting.GetColor((int)base.Center.X / 16, (int)base.Center.Y / 16);
89055 if (color.R > 20 || color.B > 20 || color.G > 20)
89056 {
89057 int num = color.R;
89058 if (color.G > num)
89059 {
89060 num = color.G;
89061 }
89062 if (color.B > num)
89063 {
89064 num = color.B;
89065 }
89066 num /= 30;
89067 if (Main.rand.Next(300) < num)
89068 {
89069 int num2 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, new Color(255, 255, 0), 0.5f);
89070 Main.dust[num2].velocity *= 0f;
89071 }
89072 }
89073 position -= netOffset;
89074 }
89075 if (type == 160)
89076 {
89077 float num3 = (float)Main.rand.Next(28, 42) * 0.005f;
89078 num3 += (float)(270 - Main.mouseTextColor) / 500f;
89079 float num4 = 0.1f;
89080 float num5 = 0.3f + num3 / 2f;
89081 float num6 = 0.6f + num3;
89082 if (townNpcVariationIndex == 1)
89083 {
89084 float num7 = num4;
89085 num4 = num6;
89086 num6 = num7;
89087 }
89088 float num8 = 0.35f;
89089 num4 *= num8;
89090 num5 *= num8;
89091 num6 *= num8;
89092 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num4, num5, num6);
89093 }
89094 if ((type >= 254 && type <= 261) || type == 634 || type == 635)
89095 {
89096 float num9 = (float)Main.rand.Next(28, 42) * 0.005f;
89097 num9 += (float)(270 - Main.mouseTextColor) / 500f;
89098 float num10 = 0.1f;
89099 float num11 = 0.3f + num9 / 2f;
89100 float num12 = 0.6f + num9;
89101 float num13 = 0.35f;
89102 if (type == 634)
89103 {
89104 num13 = 0.65f;
89105 }
89106 num10 *= num13;
89107 num11 *= num13;
89108 num12 *= num13;
89109 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num10, num11, num12);
89110 }
89111 if (type == 209)
89112 {
89113 float num14 = (float)Main.rand.Next(28, 42) * 0.005f;
89114 num14 += (float)(270 - Main.mouseTextColor) / 500f;
89115 float num15 = 0.1f;
89116 float num16 = 0.3f + num14 / 2f;
89117 float num17 = 0.4f + num14 / 2f;
89118 float num18 = 0.35f;
89119 num15 *= num18;
89120 num16 *= num18;
89121 num17 *= num18;
89122 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num15, num16, num17);
89123 if (ai[0] == 12f)
89124 {
89125 Lighting.AddLight(base.Top, 0.3f, 0.1f, 0.1f);
89126 }
89127 }
89128 if (type == 44)
89129 {
89130 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + 4f) / 16, 0.9f, 0.75f, 0.5f);
89131 }
89132 }
89133
89135 {
89136 if (dontTakeDamage || dontTakeDamageFromHostiles || immortal)
89137 {
89138 return;
89139 }
89140 int specialHitSetter = 1;
89141 float damageMultiplier = 1f;
89142 if (immune[255] != 0)
89143 {
89144 return;
89145 }
89146 Rectangle hitbox = base.Hitbox;
89147 for (int i = 0; i < 200; i++)
89148 {
89149 NPC nPC = Main.npc[i];
89150 if (acceptableNPCIDs[nPC.type] && nPC.active && !nPC.friendly && nPC.damage > 0)
89151 {
89152 Rectangle npcRect = nPC.Hitbox;
89153 GetMeleeCollisionData(hitbox, i, ref specialHitSetter, ref damageMultiplier, ref npcRect);
89154 if (hitbox.Intersects(npcRect) && (type != 453 || !NPCID.Sets.Skeletons[nPC.type]) && nPC.type != 624)
89155 {
89156 BeHurtByOtherNPC(i, nPC);
89157 break;
89158 }
89159 }
89160 }
89161 }
89162
89164 {
89165 int num = 30;
89166 if (type == 548)
89167 {
89168 num = 20;
89169 }
89170 int num2 = Main.DamageVar(thatNPC.damage);
89171 int num3 = 6;
89172 int num4 = ((!(thatNPC.Center.X > base.Center.X)) ? 1 : (-1));
89173 double num5 = StrikeNPCNoInteraction(num2, num3, num4);
89174 if (Main.netMode != 0)
89175 {
89176 NetMessage.SendData(28, -1, -1, null, whoAmI, num2, num3, num4);
89177 }
89178 netUpdate = true;
89179 immune[255] = num;
89180 if (dryadWard)
89181 {
89182 num2 = (int)num5 / 3;
89183 num3 = 6;
89184 num4 *= -1;
89185 thatNPC.StrikeNPCNoInteraction(num2, num3, num4);
89186 if (Main.netMode != 0)
89187 {
89188 NetMessage.SendData(28, -1, -1, null, npcIndex, num2, num3, num4);
89189 }
89190 thatNPC.netUpdate = true;
89191 thatNPC.immune[255] = num;
89192 }
89193 if (NPCID.Sets.HurtingBees[thatNPC.type])
89194 {
89195 num2 = damage;
89196 num3 = 6;
89197 num4 *= -1;
89198 thatNPC.StrikeNPCNoInteraction(num2, num3, num4);
89199 if (Main.netMode != 0)
89200 {
89201 NetMessage.SendData(28, -1, -1, null, npcIndex, num2, num3, num4);
89202 }
89203 thatNPC.netUpdate = true;
89204 thatNPC.immune[255] = num;
89205 }
89206 }
89207
89208 private void CheckLifeRegen()
89209 {
89210 if (life < lifeMax)
89211 {
89212 friendlyRegen++;
89213 if (dryadWard)
89214 {
89215 friendlyRegen += 10;
89216 }
89217 if (friendlyRegen > 180)
89218 {
89219 friendlyRegen = 0;
89220 life++;
89221 netUpdate = true;
89222 }
89223 }
89224 }
89225
89226 public void GetImmuneTime(int fromWho, int time)
89227 {
89228 if (fromWho == -1)
89229 {
89230 for (int i = 0; i < immune.Length; i++)
89231 {
89232 immune[i] = time;
89233 }
89234 }
89235 else if (fromWho >= 0 && fromWho < immune.Length)
89236 {
89237 immune[fromWho] = time;
89238 }
89239 }
89240
89241 private void UpdateCollision()
89242 {
89243 Collision_WalkDownSlopes();
89244 bool lava = Collision_LavaCollision();
89245 lava = Collision_WaterCollision(lava);
89246 if (!wet)
89247 {
89248 lavaWet = false;
89249 honeyWet = false;
89250 shimmerWet = false;
89251 }
89252 if (wetCount > 0)
89253 {
89254 wetCount--;
89255 }
89256 bool fall = Collision_DecideFallThroughPlatforms();
89257 oldVelocity = velocity;
89258 collideX = false;
89259 collideY = false;
89260 FishTransformationDuringRain();
89261 GetTileCollisionParameters(out var cPosition, out var cWidth, out var cHeight);
89262 Vector2 oldDryVelocity = velocity;
89263 ApplyTileCollision(fall, cPosition, cWidth, cHeight);
89264 if (wet)
89265 {
89266 if (shimmerWet)
89267 {
89268 Collision_MoveWhileWet(oldDryVelocity, shimmerMovementSpeed);
89269 }
89270 else if (honeyWet)
89271 {
89272 Collision_MoveWhileWet(oldDryVelocity, honeyMovementSpeed);
89273 }
89274 else if (lavaWet)
89275 {
89276 Collision_MoveWhileWet(oldDryVelocity, lavaMovementSpeed);
89277 }
89278 else
89279 {
89280 Collision_MoveWhileWet(oldDryVelocity, waterMovementSpeed);
89281 }
89282 }
89283 else
89284 {
89285 Collision_MoveWhileDry();
89286 }
89287 if (aiStyle == 67)
89288 {
89289 Collision_MoveSnailOnSlopes();
89290 }
89291 else if (type != 72 && type != 247 && type != 248 && (type < 542 || type > 545) && (!NPCID.Sets.BelongsToInvasionOldOnesArmy[type] || !noGravity))
89292 {
89293 Collision_MoveSlopesAndStairFall(fall);
89294 if (townNPC)
89295 {
89296 Collision.StepConveyorBelt(this, 1f);
89297 }
89298 }
89299 }
89300
89302 {
89303 if (Collision.up)
89304 {
89305 velocity.Y = 0.01f;
89306 }
89307 if (oldVelocity.X != velocity.X)
89308 {
89309 collideX = true;
89310 }
89311 if (oldVelocity.Y != velocity.Y)
89312 {
89313 collideY = true;
89314 }
89315 oldPosition = position;
89316 oldDirection = direction;
89317 position += velocity;
89318 }
89319
89321 {
89322 if (type == 72)
89323 {
89324 Collision_MoveBlazingWheel();
89325 }
89326 else if (type >= 542 && type <= 545)
89327 {
89328 Collision_MoveSandshark(fall, cPosition, cWidth, cHeight);
89329 }
89330 else if (type == 405 || type == 406)
89331 {
89332 Collision_MoveStardustCell(fall, cPosition, cWidth, cHeight);
89333 }
89334 else if (type == 417)
89335 {
89336 Collision_MoveSolarSroller(fall, cPosition, cWidth, cHeight);
89337 }
89338 else
89339 {
89340 Collision_MoveNormal(fall, cPosition, cWidth, cHeight);
89341 }
89342 }
89343
89345 {
89346 if (fall)
89347 {
89348 stairFall = true;
89349 }
89350 if (aiStyle == 7)
89351 {
89352 int num = (int)base.Center.X / 16;
89353 int num2 = (int)position.Y / 16;
89354 if (WorldGen.InWorld(num, num2))
89355 {
89356 int num3 = 16;
89357 bool flag = false;
89358 if (Main.tile[num, num2] != null && Main.tile[num, num2].active() && Main.tileSolid[Main.tile[num, num2].type])
89359 {
89360 flag = true;
89361 }
89362 if (!townNPC)
89363 {
89364 flag = false;
89365 }
89366 if (!Main.dayTime || Main.eclipse)
89367 {
89368 flag = true;
89369 }
89370 else
89371 {
89372 int num4 = (int)(position.Y + (float)height) / 16;
89373 if (homeTileY - num4 > num3)
89374 {
89375 flag = true;
89376 }
89377 }
89378 if (flag)
89379 {
89380 if ((position.Y + (float)height - 8f) / 16f < (float)homeTileY)
89381 {
89382 stairFall = true;
89383 }
89384 else
89385 {
89386 stairFall = false;
89387 }
89388 }
89389 }
89390 }
89391 GetTileCollisionParameters(out var cPosition, out var cWidth, out var cHeight);
89392 Vector2 vector = position - cPosition;
89393 Vector4 vector2 = Collision.SlopeCollision(cPosition, velocity, cWidth, cHeight, gravity, stairFall);
89394 if (Collision.stairFall)
89395 {
89396 stairFall = true;
89397 }
89398 else if (!fall)
89399 {
89400 stairFall = false;
89401 }
89402 if (Collision.stair && Math.Abs(vector2.Y - position.Y) > 8f)
89403 {
89404 gfxOffY -= vector2.Y - position.Y;
89405 stepSpeed = 2f;
89406 }
89407 position.X = vector2.X;
89408 position.Y = vector2.Y;
89409 velocity.X = vector2.Z;
89410 velocity.Y = vector2.W;
89411 position += vector;
89412 }
89413
89415 {
89416 Vector4 vector = Collision.SlopeCollision(position, velocity, width, height, gravity);
89417 if (position.X != vector.X || position.Y != vector.Y)
89418 {
89419 if (ai[2] == 0f && velocity.Y > 0f && ((direction < 0 && rotation == 1.57f && spriteDirection == 1) || (direction > 0 && rotation == 4.71f && spriteDirection == -1)))
89420 {
89421 direction *= -direction;
89422 }
89423 ai[2] = 2f;
89424 directionY = 1;
89425 rotation = 0f;
89426 }
89427 position.X = vector.X;
89428 position.Y = vector.Y;
89429 velocity.X = vector.Z;
89430 velocity.Y = vector.W;
89431 }
89432
89434 {
89435 velocity = Collision.TileCollision(cPosition, velocity, cWidth, cHeight, fall, fall);
89436 }
89437
89439 {
89440 if (!Main.remixWorld)
89441 {
89443 }
89444 }
89445
89447 {
89448 velocity = Collision.TileCollision(cPosition, velocity, cWidth, cHeight, fall, fall);
89449 if (ai[0] != 6f || !(velocity != oldVelocity))
89450 {
89451 return;
89452 }
89453 ai[2] -= 1f;
89454 ai[3] = 1f;
89455 if (ai[2] > 0f)
89456 {
89457 if (velocity.X != 0f && velocity.X != oldVelocity.X)
89458 {
89459 velocity.X = (0f - oldVelocity.X) * 0.9f;
89460 direction *= -1;
89461 }
89462 if (velocity.Y != 0f && velocity.Y != oldVelocity.Y)
89463 {
89464 velocity.Y = (0f - oldVelocity.Y) * 0.9f;
89465 }
89466 }
89467 }
89468
89470 {
89471 velocity = Collision.TileCollision(cPosition, velocity, cWidth, cHeight, fall, fall);
89472 if (velocity != oldVelocity)
89473 {
89474 if (velocity.X != 0f && velocity.X != oldVelocity.X)
89475 {
89476 velocity.X = (0f - oldVelocity.X) * 0.8f;
89477 }
89478 if (velocity.Y != 0f && velocity.Y != oldVelocity.Y)
89479 {
89480 velocity.Y = (0f - oldVelocity.Y) * 0.8f;
89481 }
89482 }
89483 }
89484
89486 {
89487 Vector2 vector = new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2));
89488 int num = 12;
89489 int num2 = 12;
89490 vector.X -= num / 2;
89491 vector.Y -= num2 / 2;
89492 velocity = Collision.noSlopeCollision(vector, velocity, num, num2, fallThrough: true, fall2: true);
89493 }
89494
89496 {
89497 if (Collision.up)
89498 {
89499 velocity.Y = 0.01f;
89500 }
89501 Vector2 vector = velocity * Slowdown;
89502 if (velocity.X != oldDryVelocity.X)
89503 {
89504 vector.X = velocity.X;
89505 collideX = true;
89506 }
89507 if (velocity.Y != oldDryVelocity.Y)
89508 {
89509 vector.Y = velocity.Y;
89510 collideY = true;
89511 }
89512 oldPosition = position;
89513 oldDirection = direction;
89514 position += vector;
89515 }
89516
89518 {
89519 cPosition = position;
89520 cWidth = width;
89521 cHeight = height;
89522 if (type == 594)
89523 {
89524 int num = (int)(44f + 20f * ai[1]);
89525 cPosition.Y += num;
89526 cHeight += num;
89527 cPosition.X += cWidth / 2;
89528 cWidth = (int)(6f + 26f * ai[1]);
89529 cPosition.X -= cWidth / 2;
89530 }
89531 if (type == 686)
89532 {
89533 int num2 = 64;
89534 cPosition.Y += num2;
89535 cHeight += num2;
89536 cPosition.X += cWidth / 2;
89537 cWidth = 32;
89538 cPosition.X -= cWidth / 2;
89539 }
89540 if (type == 243)
89541 {
89542 cHeight = 90;
89543 }
89544 if (type == 290)
89545 {
89546 cHeight = 40;
89547 }
89548 if (type == 351)
89549 {
89550 cHeight = 40;
89551 }
89552 if (type == 482)
89553 {
89554 cHeight = 40;
89555 }
89556 if (type == 351 || type == 343 || type == 348 || type == 349)
89557 {
89558 cHeight = 40;
89559 }
89560 if (type == 391)
89561 {
89562 for (int i = 0; i < 200; i++)
89563 {
89564 if (Main.npc[i].active && Main.npc[i].type == 390 && Main.npc[i].ai[0] == (float)whoAmI)
89565 {
89566 cHeight = 62;
89567 break;
89568 }
89569 }
89570 }
89571 if (type == 415)
89572 {
89573 for (int j = 0; j < 200; j++)
89574 {
89575 if (Main.npc[j].active && Main.npc[j].type == 416 && Main.npc[j].ai[0] == (float)whoAmI)
89576 {
89577 cHeight = 62;
89578 break;
89579 }
89580 }
89581 }
89582 if (type == 576 || type == 577)
89583 {
89584 cPosition.X += 32f;
89585 cWidth -= 64;
89586 }
89587 if (cHeight != height)
89588 {
89589 cPosition.Y += height - cHeight;
89590 }
89591 }
89592
89594 {
89595 if (Main.netMode == 1)
89596 {
89597 return;
89598 }
89599 if (type == 230 && wet)
89600 {
89601 int num = direction;
89602 Vector2 vector = velocity;
89603 Transform(55);
89604 direction = num;
89605 velocity = vector;
89606 wet = true;
89607 if (velocity.Y < 0f)
89608 {
89609 velocity.Y = 0f;
89610 }
89611 }
89612 else if (type == 55 && !wet && Main.raining)
89613 {
89614 int num2 = direction;
89615 Vector2 vector2 = velocity;
89616 Transform(230);
89617 direction = num2;
89618 velocity = vector2;
89619 UpdateHomeTileState(homeless, (int)(position.X / 16f) + 10 * direction, homeTileY);
89620 }
89621 else if (type == 593 && wet)
89622 {
89623 int num3 = direction;
89624 Vector2 vector3 = velocity;
89625 Transform(592);
89626 direction = num3;
89627 velocity = vector3;
89628 wet = true;
89629 if (velocity.Y < 0f)
89630 {
89631 velocity.Y = 0f;
89632 }
89633 }
89634 else if (type == 592 && !wet && Main.raining)
89635 {
89636 int num4 = direction;
89637 Vector2 vector4 = velocity;
89638 Transform(593);
89639 direction = num4;
89640 velocity = vector4;
89641 UpdateHomeTileState(homeless, (int)(position.X / 16f) + 10 * direction, homeTileY);
89642 }
89643 }
89644
89646 {
89647 bool result = false;
89648 if (type == 2 || type == -43 || type == 190 || type == 191 || type == 192 || type == 193 || type == 194 || type == 317 || type == 318 || type == 133)
89649 {
89650 result = true;
89651 }
89652 if (aiStyle == 10)
89653 {
89654 result = true;
89655 }
89656 if (aiStyle == 5)
89657 {
89658 result = true;
89659 }
89660 if (aiStyle == 40)
89661 {
89662 result = true;
89663 }
89664 if (aiStyle == 44)
89665 {
89666 result = true;
89667 }
89668 if (type == 467)
89669 {
89670 result = true;
89671 }
89672 if (type == 477)
89673 {
89674 result = true;
89675 }
89676 if (aiStyle == 22)
89677 {
89678 result = true;
89679 }
89680 if (aiStyle == 49)
89681 {
89682 result = true;
89683 }
89684 if (aiStyle == 14)
89685 {
89686 result = true;
89687 }
89688 if (type == 173)
89689 {
89690 result = true;
89691 }
89692 if (type == 469 && ai[2] == 1f)
89693 {
89694 result = true;
89695 }
89696 if (aiStyle == 3 && directionY == 1)
89697 {
89698 result = true;
89699 }
89700 if (type == 210 || type == 211)
89701 {
89702 result = true;
89703 }
89704 if (type == 50 && target >= 0 && Main.player[target].position.Y > position.Y + (float)height)
89705 {
89706 result = true;
89707 }
89708 if (type == 657 && target >= 0 && Main.player[target].position.Y > base.Bottom.Y)
89709 {
89710 result = true;
89711 }
89712 if (aiStyle == 26 && target >= 0 && Main.player[target].Bottom.Y - velocity.Y > base.Bottom.Y)
89713 {
89714 result = true;
89715 }
89716 if (type == 247 || type == 248)
89717 {
89718 result = true;
89719 }
89720 if (type == 245 && target >= 0 && Main.player[target].position.Y > position.Y + (float)height)
89721 {
89722 result = true;
89723 }
89724 if (type >= 542 && type <= 545)
89725 {
89726 result = true;
89727 }
89728 if (aiStyle == 107 && directionY == 1)
89729 {
89730 result = true;
89731 }
89732 if (type == 418)
89733 {
89734 result = true;
89735 }
89736 if (aiStyle == 87 && Main.player[target].position.Y > position.Y + (float)height)
89737 {
89738 result = true;
89739 }
89740 if (type == 405 || type == 406)
89741 {
89742 result = true;
89743 }
89744 if (type == 490)
89745 {
89746 result = true;
89747 }
89748 if (type == 301)
89749 {
89750 result = true;
89751 }
89752 if (aiStyle == 7)
89753 {
89754 int num = 16;
89755 bool flag = false;
89756 if (townNPC && (!Main.dayTime || Main.invasionType > 0 || Main.eclipse))
89757 {
89758 flag = true;
89759 }
89760 else
89761 {
89762 int num2 = (int)(position.Y + (float)height) / 16;
89763 if (homeTileY - num2 > num)
89764 {
89765 result = true;
89766 }
89767 }
89768 if (flag && (position.Y + (float)height - 8f) / 16f < (float)(homeTileY - 1))
89769 {
89770 result = true;
89771 }
89772 }
89773 if (type == 620)
89774 {
89775 result = ((target >= 0 && Main.player[target].position.Y > base.Bottom.Y) ? true : false);
89776 }
89777 return result;
89778 }
89779
89780 private bool Collision_WaterCollision(bool lava)
89781 {
89782 bool flag = false;
89783 if (type == 72 || aiStyle == 21 || aiStyle == 67 || type == 376 || type == 579 || type == 541 || (aiStyle == 7 && ai[0] == 25f))
89784 {
89785 flag = false;
89786 wetCount = 0;
89787 lava = false;
89788 }
89789 else
89790 {
89791 flag = Collision.WetCollision(position, width, height);
89792 if (Collision.honey)
89793 {
89794 honeyWet = true;
89795 }
89796 if (Collision.shimmer)
89797 {
89798 shimmerWet = true;
89799 AddBuff(353, 100);
89800 }
89801 }
89802 if (aiStyle == 116)
89803 {
89804 wetCount = 10;
89805 }
89806 if (flag)
89807 {
89808 if (onFire && !lavaWet && Main.netMode != 1)
89809 {
89810 for (int i = 0; i < maxBuffs; i++)
89811 {
89812 if (buffType[i] == 24)
89813 {
89814 DelBuff(i);
89815 }
89816 }
89817 }
89818 if (!wet && wetCount == 0)
89819 {
89820 wetCount = 10;
89821 if (!lava)
89822 {
89823 if (shimmerWet)
89824 {
89825 if (type != 617 && type != 616 && type != 625)
89826 {
89827 for (int j = 0; j < 30; j++)
89828 {
89829 int num = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
89830 Main.dust[num].velocity.Y -= 4f;
89831 Main.dust[num].velocity.X *= 2.5f;
89832 Main.dust[num].scale = 0.8f;
89833 Main.dust[num].noGravity = true;
89834 switch (Main.rand.Next(6))
89835 {
89836 case 0:
89837 Main.dust[num].color = new Color(255, 255, 210);
89838 break;
89839 case 1:
89840 Main.dust[num].color = new Color(190, 245, 255);
89841 break;
89842 case 2:
89843 Main.dust[num].color = new Color(255, 150, 255);
89844 break;
89845 default:
89846 Main.dust[num].color = new Color(190, 175, 255);
89847 break;
89848 }
89849 }
89850 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89851 {
89852 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
89853 }
89854 }
89855 }
89856 else if (honeyWet)
89857 {
89858 for (int k = 0; k < 10; k++)
89859 {
89860 int num2 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
89861 Main.dust[num2].velocity.Y -= 1f;
89862 Main.dust[num2].velocity.X *= 2.5f;
89863 Main.dust[num2].scale = 1.3f;
89864 Main.dust[num2].alpha = 100;
89865 Main.dust[num2].noGravity = true;
89866 }
89867 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89868 {
89869 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89870 }
89871 }
89872 else if (type != 617 && type != 616 && type != 625)
89873 {
89874 for (int l = 0; l < 30; l++)
89875 {
89876 int num3 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
89877 Main.dust[num3].velocity.Y -= 4f;
89878 Main.dust[num3].velocity.X *= 2.5f;
89879 Main.dust[num3].scale *= 0.8f;
89880 Main.dust[num3].alpha = 100;
89881 Main.dust[num3].noGravity = true;
89882 }
89883 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89884 {
89885 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
89886 }
89887 }
89888 }
89889 else
89890 {
89891 for (int m = 0; m < 10; m++)
89892 {
89893 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
89894 Main.dust[num4].velocity.Y -= 1.5f;
89895 Main.dust[num4].velocity.X *= 2.5f;
89896 Main.dust[num4].scale = 1.3f;
89897 Main.dust[num4].alpha = 100;
89898 Main.dust[num4].noGravity = true;
89899 }
89900 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89901 {
89902 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89903 }
89904 }
89905 }
89906 wet = true;
89907 }
89908 else if (wet)
89909 {
89910 velocity.X *= 0.5f;
89911 wet = false;
89912 if (type == 620 && GetTargetData().Center.Y < base.Center.Y)
89913 {
89914 velocity.Y -= 8f;
89915 }
89916 if (wetCount == 0)
89917 {
89918 wetCount = 10;
89919 if (!lavaWet)
89920 {
89921 if (shimmerWet)
89922 {
89923 if (type != 617 && type != 616 && type != 625)
89924 {
89925 for (int n = 0; n < 30; n++)
89926 {
89927 int num5 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
89928 Main.dust[num5].velocity.Y -= 4f;
89929 Main.dust[num5].velocity.X *= 2.5f;
89930 Main.dust[num5].scale = 0.8f;
89931 Main.dust[num5].noGravity = true;
89932 switch (Main.rand.Next(6))
89933 {
89934 case 0:
89935 Main.dust[num5].color = new Color(255, 255, 210);
89936 break;
89937 case 1:
89938 Main.dust[num5].color = new Color(190, 245, 255);
89939 break;
89940 case 2:
89941 Main.dust[num5].color = new Color(255, 150, 255);
89942 break;
89943 default:
89944 Main.dust[num5].color = new Color(190, 175, 255);
89945 break;
89946 }
89947 }
89948 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89949 {
89950 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
89951 }
89952 }
89953 }
89954 else if (honeyWet)
89955 {
89956 for (int num6 = 0; num6 < 10; num6++)
89957 {
89958 int num7 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
89959 Main.dust[num7].velocity.Y -= 1f;
89960 Main.dust[num7].velocity.X *= 2.5f;
89961 Main.dust[num7].scale = 1.3f;
89962 Main.dust[num7].alpha = 100;
89963 Main.dust[num7].noGravity = true;
89964 }
89965 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 300 && type != 59 && aiStyle != 39 && !noGravity)
89966 {
89967 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89968 }
89969 }
89970 else if (type != 617 && type != 616 && type != 625)
89971 {
89972 for (int num8 = 0; num8 < 30; num8++)
89973 {
89974 int num9 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
89975 Main.dust[num9].velocity.Y -= 4f;
89976 Main.dust[num9].velocity.X *= 2.5f;
89977 Main.dust[num9].scale *= 0.8f;
89978 Main.dust[num9].alpha = 100;
89979 Main.dust[num9].noGravity = true;
89980 }
89981 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89982 {
89983 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
89984 }
89985 }
89986 }
89987 else
89988 {
89989 for (int num10 = 0; num10 < 10; num10++)
89990 {
89991 int num11 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
89992 Main.dust[num11].velocity.Y -= 1.5f;
89993 Main.dust[num11].velocity.X *= 2.5f;
89994 Main.dust[num11].scale = 1.3f;
89995 Main.dust[num11].alpha = 100;
89996 Main.dust[num11].noGravity = true;
89997 }
89998 if (aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89999 {
90000 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
90001 }
90002 }
90003 }
90004 }
90005 return lava;
90006 }
90007
90009 {
90010 bool flag = Collision.LavaCollision(position, width, height);
90011 if (type == 441)
90012 {
90013 flag = false;
90014 }
90015 if (flag)
90016 {
90017 lavaWet = true;
90018 if (!lavaImmune && !dontTakeDamage && Main.netMode != 1 && immune[255] == 0)
90019 {
90020 immune[255] = 30;
90021 if (Main.remixWorld && !friendly)
90022 {
90023 AddBuff(24, 180);
90024 }
90025 else
90026 {
90027 AddBuff(24, 420);
90028 StrikeNPCNoInteraction(50, 0f, 0);
90029 if (Main.netMode == 2)
90030 {
90031 NetMessage.SendData(28, -1, -1, null, whoAmI, 50f);
90032 }
90033 }
90034 }
90035 }
90036 return flag;
90037 }
90038
90040 {
90041 _ = velocity;
90042 Vector4 vector = Collision.WalkDownSlope(position, velocity, width, height, gravity);
90043 position.X = vector.X;
90044 position.Y = vector.Y;
90045 velocity.X = vector.Z;
90046 velocity.Y = vector.W;
90047 }
90048
90049 public static void setFireFlyChance()
90050 {
90051 if (Main.rand == null)
90052 {
90053 Main.rand = new UnifiedRandom((int)DateTime.Now.Ticks);
90054 }
90055 if (WorldGen.genRand.Next(9) == 0)
90056 {
90057 fireFlyChance = Main.rand.Next(5, 10);
90058 fireFlyFriendly = Main.rand.Next(1, 4);
90059 fireFlyMultiple = Main.rand.Next(3, 8);
90060 }
90061 else if (WorldGen.genRand.Next(3) == 0)
90062 {
90063 fireFlyChance = 999999;
90064 fireFlyFriendly = 999999;
90065 fireFlyMultiple = 999999;
90066 }
90067 else
90068 {
90069 fireFlyChance = Main.rand.Next(10, 60);
90070 fireFlyFriendly = Main.rand.Next(2, 15);
90071 fireFlyMultiple = Main.rand.Next(6, 30);
90072 }
90073 if (Main.rand.Next(3) == 0)
90074 {
90075 butterflyChance = 999999;
90076 stinkBugChance = Main.rand.Next(1, 14);
90077 if (WorldGen.genRand.Next(5) == 0)
90078 {
90079 stinkBugChance = 999999;
90080 }
90081 }
90082 else
90083 {
90084 stinkBugChance = 999999;
90085 butterflyChance = Main.rand.Next(1, 21);
90086 if (WorldGen.genRand.Next(5) == 0)
90087 {
90088 butterflyChance = 999999;
90089 }
90090 }
90092 {
90093 fireFlyChance = Math.Max(1, (int)((float)fireFlyChance * 0.5f));
90094 butterflyChance = Math.Max(1, (int)((float)butterflyChance * 0.5f));
90095 }
90096 }
90097
90099 {
90100 return Color.White;
90101 }
90102
90104 {
90105 if (IsABestiaryIconDummy)
90106 {
90108 }
90109 float num = (float)(255 - alpha) / 255f;
90110 int num2 = (int)((float)(int)newColor.R * num);
90111 int num3 = (int)((float)(int)newColor.G * num);
90112 int num4 = (int)((float)(int)newColor.B * num);
90113 int num5 = newColor.A - alpha;
90114 if (type == 402)
90115 {
90116 return new Color(255, 255, 255, 255);
90117 }
90118 if (type == 484)
90119 {
90120 return new Color(250, 250, 250, 200);
90121 }
90122 if (type >= 542 && type <= 545 && num2 + num3 + num4 > 10 && num2 + num3 + num4 >= 60)
90123 {
90124 num2 *= 2;
90125 num3 *= 2;
90126 num4 *= 2;
90127 if (num2 > 255)
90128 {
90129 num2 = 255;
90130 }
90131 if (num3 > 255)
90132 {
90133 num3 = 255;
90134 }
90135 if (num4 > 255)
90136 {
90137 num4 = 255;
90138 }
90139 }
90140 if (type == 681)
90141 {
90142 return Color.Lerp(newColor, Color.White, 0.4f) * Opacity;
90143 }
90144 if (type == 683 || type == 687)
90145 {
90146 float num6 = Utils.Remap(Utils.WrappedLerp(0.75f, 1f, (float)Main.timeForVisualEffects % 120f / 120f), 0f, 1f, 0.5f, 1f);
90147 Color result = Color.Lerp(newColor, new Color(255, 255, 100), 0.4f * num6) * Opacity;
90148 if (result.B < num4)
90149 {
90150 result.B = (byte)num4;
90151 }
90152 return result;
90153 }
90154 if (type == 658 || type == 659 || type == 660)
90155 {
90156 return Color.Lerp(newColor, Color.White, 0.4f) * Opacity;
90157 }
90158 if (type == 662)
90159 {
90160 Color color = Color.Lerp(Color.White, Color.Cyan, 0.5f);
90161 color.A /= 4;
90162 return color * Opacity;
90163 }
90164 if ((type >= 454 && type <= 459) || type == 521)
90165 {
90167 newColor.A = 150;
90168 newColor *= (float)num5 / 255f;
90169 return newColor;
90170 }
90171 if (type == 636)
90172 {
90174 return newColor * Opacity;
90175 }
90176 if (type == 440)
90177 {
90178 byte b = 180;
90179 if (Main.expertMode)
90180 {
90181 b = 210;
90182 }
90183 b = (byte)((float)(int)b * num);
90184 return new Color(b, b, b, b);
90185 }
90186 if (type == 583 || type == 584 || type == 585)
90187 {
90189 return newColor;
90190 }
90191 if (type == 516)
90192 {
90193 return new Color(alpha, alpha, alpha, alpha);
90194 }
90195 if (type == 522)
90196 {
90197 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
90198 }
90199 if (type == 523)
90200 {
90201 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
90202 }
90203 if (type == 395 || type == 519)
90204 {
90206 return newColor;
90207 }
90208 if (type == 370 && ai[0] != -1f && ai[0] < 9f)
90209 {
90210 float num7 = MathHelper.Lerp(num, 1f, 0.25f);
90211 if (num7 > 1f)
90212 {
90213 num7 = 1f;
90214 }
90215 num4 = (int)((float)(int)newColor.B * num7);
90216 }
90217 if (type == 30 || type == 665)
90218 {
90219 return new Color(250, 250, 250, 100);
90220 }
90221 if (!IsABestiaryIconDummy && (type == 25 || type == 30 || type == 665 || type == 59 || type == 60))
90222 {
90223 return new Color(200, 200, 200, 0);
90224 }
90225 if (type == 360)
90226 {
90227 num2 = newColor.R;
90228 num3 = newColor.G;
90229 num4 = newColor.B;
90230 if (num2 < 75)
90231 {
90232 num2 = 75;
90233 }
90234 if (num3 < 175)
90235 {
90236 num3 = 175;
90237 }
90238 if (num4 < 255)
90239 {
90240 num4 = 255;
90241 }
90242 return new Color(num2, num3, num4, 255);
90243 }
90244 if (type == 655)
90245 {
90246 num2 = newColor.R;
90247 num3 = newColor.G;
90248 num4 = newColor.B;
90249 if (num2 < 255)
90250 {
90251 num2 = 255;
90252 }
90253 if (num3 < 100)
90254 {
90255 num3 = 100;
90256 }
90257 if (num4 < 50)
90258 {
90259 num4 = 50;
90260 }
90261 return new Color(num2, num3, num4, 255);
90262 }
90263 if (type == 352)
90264 {
90265 return new Color(255, 255, 255, 200);
90266 }
90267 if (type == 72)
90268 {
90269 num2 = newColor.R;
90270 num3 = newColor.G;
90271 num4 = newColor.B;
90272 }
90273 else
90274 {
90275 if (type == 288)
90276 {
90277 return new Color(200, 200, 200, 0);
90278 }
90279 if (type == 289)
90280 {
90281 return new Color(250, 250, 250, 50);
90282 }
90283 if (type >= 254 && type <= 261)
90284 {
90285 num4 = 255;
90286 if (num2 < 100)
90287 {
90288 num2 = 100;
90289 }
90290 if (num3 < 150)
90291 {
90292 num3 = 150;
90293 }
90294 }
90295 else if (type == 374 || type == 634 || type == 635)
90296 {
90297 num4 = 255;
90298 if (num2 < 100)
90299 {
90300 num2 = 100;
90301 }
90302 if (num3 < 150)
90303 {
90304 num3 = 150;
90305 }
90306 }
90307 else
90308 {
90309 if (type == 549)
90310 {
90312 newColor *= (float)num5 / 255f;
90313 return newColor;
90314 }
90315 if (type == 64 || type == 63 || type == 75 || type == 103 || type == 400)
90316 {
90317 num2 = (int)((double)(int)newColor.R * 1.5);
90318 num3 = (int)((double)(int)newColor.G * 1.5);
90319 num4 = (int)((double)(int)newColor.B * 1.5);
90320 if (num2 > 255)
90321 {
90322 num2 = 255;
90323 }
90324 if (num3 > 255)
90325 {
90326 num3 = 255;
90327 }
90328 if (num4 > 255)
90329 {
90330 num4 = 255;
90331 }
90332 }
90333 }
90334 }
90335 if (shimmerTransparency > 0f && !CanApplyHunterPotionEffects())
90336 {
90337 num2 = (byte)((float)num2 * (1f - shimmerTransparency));
90338 num3 = (byte)((float)num3 * (1f - shimmerTransparency));
90339 num4 = (byte)((float)num4 * (1f - shimmerTransparency));
90340 num5 = (byte)((float)num5 * (1f - shimmerTransparency));
90341 }
90342 if (num5 < 0)
90343 {
90344 num5 = 0;
90345 }
90346 if (num5 > 255)
90347 {
90348 num5 = 255;
90349 }
90350 return new Color(num2, num3, num4, num5);
90351 }
90352
90354 {
90355 if (shimmerTransparency > 0f && !CanApplyHunterPotionEffects())
90356 {
90357 newColor.R = (byte)((float)(int)newColor.R * (1f - shimmerTransparency));
90358 newColor.G = (byte)((float)(int)newColor.G * (1f - shimmerTransparency));
90359 newColor.B = (byte)((float)(int)newColor.B * (1f - shimmerTransparency));
90360 newColor.A = (byte)((float)(int)newColor.A * (1f - shimmerTransparency));
90361 }
90362 return newColor;
90363 }
90364
90366 {
90367 if (IsABestiaryIconDummy)
90368 {
90369 newColor = GetBestiaryEntryColor();
90370 }
90371 int num = color.R - (255 - newColor.R);
90372 int num2 = color.G - (255 - newColor.G);
90373 int num3 = color.B - (255 - newColor.B);
90374 int num4 = color.A - (255 - newColor.A);
90375 if (num < 0)
90376 {
90377 num = 0;
90378 }
90379 if (num > 255)
90380 {
90381 num = 255;
90382 }
90383 if (num2 < 0)
90384 {
90385 num2 = 0;
90386 }
90387 if (num2 > 255)
90388 {
90389 num2 = 255;
90390 }
90391 if (num3 < 0)
90392 {
90393 num3 = 0;
90394 }
90395 if (num3 > 255)
90396 {
90397 num3 = 255;
90398 }
90399 if (num4 < 0)
90400 {
90401 num4 = 0;
90402 }
90403 if (num4 > 255)
90404 {
90405 num4 = 255;
90406 }
90407 if (shimmerTransparency > 0f && !CanApplyHunterPotionEffects())
90408 {
90409 num = (byte)((float)num * (1f - shimmerTransparency));
90410 num2 = (byte)((float)num2 * (1f - shimmerTransparency));
90411 num3 = (byte)((float)num3 * (1f - shimmerTransparency));
90412 num4 = (byte)((float)num4 * (1f - shimmerTransparency));
90413 }
90414 return new Color(num, num2, num3, num4);
90415 }
90416
90418 {
90419 if (!Main.bloodMoon || Main.dayTime)
90420 {
90421 if (Main.moonPhase == 0)
90422 {
90423 return !Main.dayTime;
90424 }
90425 return false;
90426 }
90427 return true;
90428 }
90429
90430 public string GetChat()
90431 {
90432 PreventJojaColaDialog = false;
90433 RerollDryadText = 0;
90435 bool flag = false;
90436 bool flag2 = false;
90437 bool flag3 = false;
90438 bool flag4 = false;
90439 bool flag5 = false;
90440 bool flag6 = false;
90441 bool flag7 = false;
90442 bool flag8 = false;
90443 bool flag9 = false;
90444 bool flag10 = false;
90445 bool flag11 = false;
90446 bool flag12 = false;
90447 bool flag13 = false;
90448 bool flag14 = false;
90449 bool flag15 = false;
90450 bool flag16 = false;
90451 bool flag17 = false;
90453 for (int i = 0; i < 200; i++)
90454 {
90455 if (Main.npc[i].active)
90456 {
90457 if (Main.npc[i].type == 17)
90458 {
90459 flag = true;
90460 }
90461 else if (Main.npc[i].type == 18)
90462 {
90463 flag2 = true;
90464 }
90465 else if (Main.npc[i].type == 19)
90466 {
90467 flag3 = true;
90468 }
90469 else if (Main.npc[i].type == 20)
90470 {
90471 flag4 = true;
90472 }
90473 else if (Main.npc[i].type == 37)
90474 {
90475 flag5 = true;
90476 }
90477 else if (Main.npc[i].type == 38)
90478 {
90479 flag6 = true;
90480 }
90481 else if (Main.npc[i].type == 124)
90482 {
90483 flag7 = true;
90484 }
90485 else if (Main.npc[i].type == 107)
90486 {
90487 flag8 = true;
90488 }
90489 else if (Main.npc[i].type == 54)
90490 {
90491 flag9 = true;
90492 }
90493 else if (Main.npc[i].type == 160)
90494 {
90495 flag10 = true;
90496 }
90497 else if (Main.npc[i].type == 178)
90498 {
90499 flag11 = true;
90500 }
90501 else if (Main.npc[i].type == 229)
90502 {
90503 flag12 = true;
90504 }
90505 else if (Main.npc[i].type == 209)
90506 {
90507 flag13 = true;
90508 }
90509 else if (Main.npc[i].type == 208)
90510 {
90511 flag14 = true;
90512 }
90513 else if (Main.npc[i].type == 353)
90514 {
90515 flag15 = true;
90516 }
90517 else if (Main.npc[i].type == 22)
90518 {
90519 flag16 = true;
90520 }
90521 else if (Main.npc[i].type == 441)
90522 {
90523 flag17 = true;
90524 }
90525 }
90526 }
90527 string result = "";
90528 string specialEventText = "";
90529 if (type == 17)
90530 {
90531 result = (HasSpecialEventText("Merchant", out specialEventText) ? specialEventText : ((!downedBoss1 && Main.rand.Next(3) == 0) ? ((Main.player[Main.myPlayer].statLifeMax < 200) ? Lang.dialog(1) : ((Main.player[Main.myPlayer].statDefense > 10) ? Lang.dialog(3) : Lang.dialog(2))) : (Main.dayTime ? ((Main.time < 16200.0) ? (Main.rand.Next(3) switch
90532 {
90533 0 => Lang.dialog(4),
90534 1 => Lang.dialog(5),
90535 _ => Lang.dialog(6),
90536 }) : ((Main.time > 37800.0) ? (Main.rand.Next(3) switch
90537 {
90538 0 => Lang.dialog(7),
90539 1 => Lang.dialog(8),
90540 _ => Lang.dialog(9),
90541 }) : (Main.rand.Next(3) switch
90542 {
90543 0 => Lang.dialog(10),
90544 1 => Lang.dialog(11),
90545 _ => Lang.dialog(12),
90546 }))) : (Main.bloodMoon ? ((flag2 && flag7 && Main.rand.Next(3) == 0) ? Lang.dialog(13) : (Main.rand.Next(4) switch
90547 {
90548 0 => Lang.dialog(14),
90549 1 => Lang.dialog(15),
90550 2 => Lang.dialog(16),
90551 _ => Lang.dialog(17),
90552 })) : ((Main.time < 9720.0) ? ((Main.rand.Next(2) != 0) ? Lang.dialog(19) : Lang.dialog(18)) : ((Main.time > 22680.0) ? ((Main.rand.Next(2) != 0) ? Lang.dialog(21) : Lang.dialog(20)) : (Main.rand.Next(3) switch
90553 {
90554 0 => Lang.dialog(22),
90555 1 => Lang.dialog(23),
90556 _ => Lang.dialog(24),
90557 })))))));
90558 }
90559 else if (type == 18)
90560 {
90561 if (HasSpecialEventText("Nurse", out specialEventText))
90562 {
90563 result = specialEventText;
90564 }
90565 else if (Main.bloodMoon)
90566 {
90567 result = (((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax2 * 0.66) ? (Main.rand.Next(3) switch
90568 {
90569 0 => Lang.dialog(25),
90570 1 => Lang.dialog(26),
90571 _ => Lang.dialog(27),
90572 }) : (Main.rand.Next(4) switch
90573 {
90574 0 => Lang.dialog(28),
90575 1 => Lang.dialog(29),
90576 2 => Lang.dialog(30),
90577 _ => Lang.dialog(31),
90578 }));
90579 }
90580 else if (Main.rand.Next(5) == 0 && Main.LocalPlayer.numberOfDeathsPVE > 1)
90581 {
90582 int numberOfDeathsPVE = Main.LocalPlayer.numberOfDeathsPVE;
90583 int num = 25;
90584 int num2 = 100;
90585 string text = "Low";
90586 if (numberOfDeathsPVE >= num2)
90587 {
90588 text = "High";
90589 }
90590 else if (numberOfDeathsPVE >= num)
90591 {
90592 text = "Medium";
90593 }
90594 result = Language.GetTextValueWith("NurseSpecialText.DeathCount" + text, obj);
90595 }
90596 else if (Main.rand.Next(3) == 0 && !downedBoss3)
90597 {
90598 result = Lang.dialog(32);
90599 }
90600 else if (flag6 && Main.rand.Next(4) == 0)
90601 {
90602 result = Lang.dialog(33);
90603 }
90604 else if (flag3 && Main.rand.Next(4) == 0)
90605 {
90606 result = Lang.dialog(34);
90607 }
90608 else if (flag16 && Main.rand.Next(4) == 0)
90609 {
90610 result = Lang.dialog(35);
90611 }
90612 else if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax2 * 0.33)
90613 {
90614 result = Main.rand.Next(5) switch
90615 {
90616 0 => Lang.dialog(36),
90617 1 => Lang.dialog(37),
90618 2 => Lang.dialog(38),
90619 3 => Lang.dialog(39),
90620 _ => Lang.dialog(40),
90621 };
90622 }
90623 else if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax2 * 0.66)
90624 {
90625 result = Main.rand.Next(7) switch
90626 {
90627 0 => Lang.dialog(41),
90628 1 => Lang.dialog(42),
90629 2 => Lang.dialog(43),
90630 3 => Lang.dialog(44),
90631 4 => Lang.dialog(45),
90632 5 => Lang.dialog(46),
90633 _ => Lang.dialog(47),
90634 };
90635 }
90636 else
90637 {
90639 int num3 = Main.rand.Next(4 + array.Length);
90640 result = ((num3 >= 4) ? array[num3 - 4].FormatWith(obj) : (num3 switch
90641 {
90642 0 => Lang.dialog(48),
90643 1 => Lang.dialog(49),
90644 2 => Lang.dialog(50),
90645 _ => Lang.dialog(51),
90646 }));
90647 }
90648 }
90649 else if (type == 19)
90650 {
90651 result = (HasSpecialEventText("ArmsDealer", out specialEventText) ? specialEventText : ((flag16 && downedBoss3 && !Main.hardMode) ? Lang.dialog(58) : ((flag2 && Main.rand.Next(5) == 0) ? Lang.dialog(59) : ((flag2 && Main.rand.Next(5) == 0) ? Lang.dialog(60) : ((flag4 && Main.rand.Next(5) == 0) ? Lang.dialog(61) : ((flag6 && Main.rand.Next(5) == 0) ? Lang.dialog(62) : ((flag6 && Main.rand.Next(5) == 0) ? Lang.dialog(63) : (Main.bloodMoon ? ((Main.rand.Next(2) != 0) ? Lang.dialog(65) : Lang.dialog(64)) : (Main.rand.Next(3) switch
90652 {
90653 0 => Lang.dialog(66),
90654 1 => Lang.dialog(67),
90655 _ => Lang.dialog(68),
90656 })))))))));
90657 }
90658 else if (type == 20)
90659 {
90660 result = (HasSpecialEventText("Dryad", out specialEventText) ? specialEventText : ((DD2Event.DownedInvasionT1 && Main.rand.Next(6) == 0) ? ((!DD2Event.DownedInvasionT2) ? Language.GetTextValueWith("DryadSpecialText.AfterDD2Tier1", obj) : Language.GetTextValueWith("DryadSpecialText.AfterDD2Tier2", obj)) : ((!downedBoss2 && Main.rand.Next(3) == 0) ? ((!WorldGen.crimson) ? Lang.dialog(69) : Lang.dialog(332)) : ((flag3 && Main.rand.Next(6) == 0) ? Lang.dialog(70) : ((flag && Main.rand.Next(6) == 0) ? Lang.dialog(71) : ((flag5 && Main.rand.Next(6) == 0) ? Lang.dialog(72) : ((flag10 && Main.rand.Next(6) == 0) ? Lang.dialog(238) : (Main.bloodMoon ? (Main.rand.Next(4) switch
90661 {
90662 0 => Lang.dialog(73),
90663 1 => Lang.dialog(74),
90664 2 => Lang.dialog(75),
90665 _ => Lang.dialog(76),
90666 }) : (Main.rand.Next(5) switch
90667 {
90668 0 => (!WorldGen.crimson) ? Lang.dialog(77) : Lang.dialog(333),
90669 1 => Lang.dialog(78),
90670 2 => Lang.dialog(79),
90671 3 => Lang.dialog(80),
90672 _ => Lang.dialog(81),
90673 })))))))));
90674 if (Main.LocalPlayer.HasItem(5275))
90675 {
90676 result = Language.GetTextValue("StardewTalk.PlayerHasColaButIsNotHoldingIt");
90677 }
90678 }
90679 else if (type == 37)
90680 {
90681 result = ((!Main.dayTime || Main.remixWorld) ? ((Main.player[Main.myPlayer].statLifeMax < 300 || Main.player[Main.myPlayer].statDefense < 10) ? (Main.rand.Next(4) switch
90682 {
90683 0 => Lang.dialog(85),
90684 1 => Lang.dialog(86),
90685 2 => Lang.dialog(87),
90686 _ => Lang.dialog(88),
90687 }) : (Main.rand.Next(4) switch
90688 {
90689 0 => Lang.dialog(89),
90690 1 => Lang.dialog(90),
90691 2 => Lang.dialog(91),
90692 _ => Lang.dialog(92),
90693 })) : (Main.rand.Next(3) switch
90694 {
90695 0 => Lang.dialog(82),
90696 1 => Lang.dialog(83),
90697 _ => Lang.dialog(84),
90698 }));
90699 }
90700 else if (type == 38)
90701 {
90702 result = (HasSpecialEventText("Demolitionist", out specialEventText) ? specialEventText : ((!downedBoss2 && Main.rand.Next(3) == 0) ? Lang.dialog(93) : (Main.bloodMoon ? (Main.rand.Next(3) switch
90703 {
90704 0 => Lang.dialog(94),
90705 1 => Lang.dialog(95),
90706 _ => Lang.dialog(96),
90707 }) : (((DD2Event.DownedInvasionT1 || DD2Event.Ongoing) && Main.rand.Next(5) == 0) ? Language.GetTextValueWith("DemolitionistSpecialText.AfterDD2Start", obj) : ((flag3 && Main.rand.Next(5) == 0) ? Lang.dialog(97) : ((flag3 && Main.rand.Next(5) == 0) ? Lang.dialog(98) : ((flag2 && Main.rand.Next(4) == 0) ? Lang.dialog(99) : ((flag4 && Main.rand.Next(4) == 0) ? Lang.dialog(100) : ((!Main.dayTime) ? (Main.rand.Next(4) switch
90708 {
90709 0 => Lang.dialog(101),
90710 1 => Lang.dialog(102),
90711 2 => Lang.dialog(103),
90712 _ => Lang.dialog(104),
90713 }) : (Main.rand.Next(5) switch
90714 {
90715 0 => Lang.dialog(105),
90716 1 => Lang.dialog(106),
90717 2 => Lang.dialog(107),
90718 3 => Lang.dialog(108),
90719 _ => Lang.dialog(109),
90720 }))))))))));
90721 }
90722 else if (type == 54)
90723 {
90724 result = (HasSpecialEventText("Clothier", out specialEventText) ? specialEventText : ((!flag7 && Main.rand.Next(2) == 0) ? Lang.dialog(110) : ((flag10 && Main.rand.Next(6) == 0) ? Lang.dialog(237) : (Main.bloodMoon ? Lang.dialog(111) : ((flag2 && Main.rand.Next(4) == 0) ? Lang.dialog(112) : ((Main.player[Main.myPlayer].head == 24) ? Lang.dialog(113) : (Main.rand.Next(6) switch
90725 {
90726 0 => Lang.dialog(114),
90727 1 => Lang.dialog(115),
90728 2 => Lang.dialog(116),
90729 3 => Lang.dialog(117),
90730 4 => Lang.dialog(118),
90731 _ => Lang.dialog(119),
90732 })))))));
90733 }
90734 else if (type == 105)
90735 {
90736 result = Lang.dialog(120);
90737 }
90738 else if (type == 107)
90739 {
90740 if (homeless)
90741 {
90742 result = Main.rand.Next(5) switch
90743 {
90744 0 => Lang.dialog(121),
90745 1 => Lang.dialog(122),
90746 2 => Lang.dialog(123),
90747 3 => Lang.dialog(124),
90748 _ => Lang.dialog(125),
90749 };
90750 }
90751 else if (HasSpecialEventText("GoblinTinkerer", out specialEventText))
90752 {
90753 result = specialEventText;
90754 }
90755 else if (flag7 && Main.rand.Next(5) == 0)
90756 {
90757 result = Lang.dialog(126);
90758 }
90759 else if (flag15 && Main.rand.Next(5) == 0)
90760 {
90761 result = Lang.dialog(309);
90762 }
90763 else
90764 {
90765 LocalizedText[] array2 = Language.FindAll(Lang.CreateDialogFilter("GoblinTinkererChatter.", obj));
90766 int num4 = Main.rand.Next(array2.Length + 5);
90767 result = ((num4 >= 5) ? array2[num4 - 5].FormatWith(obj) : ((!Main.dayTime) ? (num4 switch
90768 {
90769 0 => Lang.dialog(127),
90770 1 => Lang.dialog(128),
90771 2 => Lang.dialog(129),
90772 3 => Lang.dialog(130),
90773 _ => Lang.dialog(131),
90774 }) : (num4 switch
90775 {
90776 0 => Lang.dialog(132),
90777 1 => Lang.dialog(133),
90778 2 => Lang.dialog(134),
90779 3 => Lang.dialog(135),
90780 _ => Lang.dialog(136),
90781 })));
90782 }
90783 }
90784 else if (type == 106)
90785 {
90786 result = Lang.dialog(137);
90787 }
90788 else if (type == 108)
90789 {
90790 if (homeless)
90791 {
90792 int num5 = Main.rand.Next(3);
90793 if (num5 == 0)
90794 {
90795 result = Lang.dialog(138);
90796 }
90797 else if (num5 == 1 && !Main.player[Main.myPlayer].Male)
90798 {
90799 result = Lang.dialog(139);
90800 }
90801 else
90802 {
90803 switch (num5)
90804 {
90805 case 1:
90806 result = Lang.dialog(140);
90807 break;
90808 case 2:
90809 result = Lang.dialog(141);
90810 break;
90811 }
90812 }
90813 }
90814 else if (HasLuckTextForWizard(out specialEventText))
90815 {
90816 result = specialEventText;
90817 }
90818 else if (HasSpecialEventText("Wizard", out specialEventText))
90819 {
90820 result = specialEventText;
90821 }
90822 else if (DD2Event.DownedInvasionT1 && Main.rand.Next(6) == 0)
90823 {
90824 result = Language.GetTextValueWith("WizardSpecialText.AfterDD2Tier1", obj);
90825 }
90826 else if (Main.player[Main.myPlayer].Male && flag16 && Main.rand.Next(6) == 0)
90827 {
90828 result = Lang.dialog(142);
90829 }
90830 else if (Main.player[Main.myPlayer].Male && flag6 && Main.rand.Next(6) == 0)
90831 {
90832 result = Lang.dialog(143);
90833 }
90834 else if (Main.player[Main.myPlayer].Male && flag8 && Main.rand.Next(6) == 0)
90835 {
90836 result = Lang.dialog(144);
90837 }
90838 else if (!Main.player[Main.myPlayer].Male && flag2 && Main.rand.Next(6) == 0)
90839 {
90840 result = Lang.dialog(145);
90841 }
90842 else if (!Main.player[Main.myPlayer].Male && flag7 && Main.rand.Next(6) == 0)
90843 {
90844 result = Lang.dialog(146);
90845 }
90846 else if (!Main.player[Main.myPlayer].Male && flag4 && Main.rand.Next(6) == 0)
90847 {
90848 result = Lang.dialog(147);
90849 }
90850 else if (Main.dayTime)
90851 {
90852 result = Main.rand.Next(5) switch
90853 {
90854 0 => Lang.dialog(151),
90855 1 => Lang.dialog(152),
90856 2 => Lang.dialog(153),
90857 3 => Lang.dialog(154),
90858 _ => Lang.dialog(155),
90859 };
90860 }
90861 else
90862 {
90863 switch (Main.rand.Next(3))
90864 {
90865 case 0:
90866 result = Lang.dialog(148);
90867 break;
90868 case 1:
90869 result = Lang.dialog(149);
90870 break;
90871 case 2:
90872 result = Lang.dialog(150);
90873 break;
90874 }
90875 }
90876 }
90877 else if (type == 123)
90878 {
90879 result = Lang.dialog(156);
90880 }
90881 else if (type == 124)
90882 {
90883 if (homeless)
90884 {
90885 result = Main.rand.Next(4) switch
90886 {
90887 0 => Lang.dialog(157),
90888 1 => Lang.dialog(158),
90889 2 => Lang.dialog(159),
90890 _ => Lang.dialog(160),
90891 };
90892 }
90893 else if (HasSpecialEventText("Mechanic", out specialEventText))
90894 {
90895 result = specialEventText;
90896 }
90897 else if (Main.bloodMoon)
90898 {
90899 result = Main.rand.Next(4) switch
90900 {
90901 0 => Lang.dialog(161),
90902 1 => Lang.dialog(162),
90903 2 => Lang.dialog(163),
90904 _ => Lang.dialog(164),
90905 };
90906 }
90907 else if (flag8 && Main.rand.Next(6) == 0)
90908 {
90909 result = Lang.dialog(165);
90910 }
90911 else if (flag3 && Main.rand.Next(6) == 0)
90912 {
90913 result = Lang.dialog(166);
90914 }
90915 else
90916 {
90918 int num6 = Main.rand.Next(3 + array3.Length);
90919 result = ((num6 >= 3) ? array3[num6 - 3].FormatWith(obj) : (num6 switch
90920 {
90921 0 => Lang.dialog(167),
90922 1 => Lang.dialog(168),
90923 _ => Lang.dialog(169),
90924 }));
90925 }
90926 }
90927 else if (type == 22)
90928 {
90929 result = (HasSpecialEventText("Guide", out specialEventText) ? specialEventText : (Main.bloodMoon ? (Main.rand.Next(3) switch
90930 {
90931 0 => Lang.dialog(170),
90932 1 => Lang.dialog(171),
90933 _ => Lang.dialog(172),
90934 }) : ((LanternNight.LanternsUp && !downedMoonlord) ? Language.GetTextValue("GuideSpecialText.Lantern1") : ((LanternNight.LanternsUp && downedMoonlord) ? Language.GetTextValue("GuideSpecialText.Lantern2") : (Main.eclipse ? Language.GetTextValue("GuideSpecialText.Eclipse") : (Main.slimeRain ? Language.GetTextValue("GuideSpecialText.SlimeRain") : ((!Main.dayTime) ? Lang.dialog(173) : ((Main.hardMode && flag17 && Main.rand.Next(8) == 0) ? Language.GetTextValueWith("GuideChatter.Chatter_1", obj) : ((Main.hardMode && Main.rand.Next(8) == 0) ? Language.GetTextValue("GuideChatter.Chatter_2") : (Main.rand.Next(3) switch
90935 {
90936 0 => Lang.dialog(174),
90937 1 => Lang.dialog(175),
90938 _ => Lang.dialog(176),
90939 }))))))))));
90940 }
90941 else if (type == 142)
90942 {
90943 int num7 = Main.rand.Next(3);
90944 if (HasSpecialEventText("Santa", out specialEventText))
90945 {
90946 result = specialEventText;
90947 }
90948 else
90949 {
90950 switch (num7)
90951 {
90952 case 0:
90953 result = Lang.dialog(224);
90954 break;
90955 case 1:
90956 result = Lang.dialog(225);
90957 break;
90958 case 2:
90959 result = Lang.dialog(226);
90960 break;
90961 }
90962 }
90963 }
90964 else if (type == 160)
90965 {
90966 int num8 = Main.rand.Next(6);
90967 if (HasSpecialEventText("Truffle", out specialEventText))
90968 {
90969 result = specialEventText;
90970 }
90971 else if (flag4 && Main.rand.Next(6) == 0)
90972 {
90973 result = Lang.dialog(232);
90974 }
90975 else if (flag9 && Main.rand.Next(6) == 0)
90976 {
90977 result = Lang.dialog(236);
90978 }
90979 else
90980 {
90981 switch (num8)
90982 {
90983 case 0:
90984 result = Lang.dialog(231);
90985 break;
90986 case 1:
90987 result = Lang.dialog(233);
90988 break;
90989 case 2:
90990 result = Lang.dialog(234);
90991 break;
90992 case 3:
90993 result = Lang.dialog(235);
90994 break;
90995 case 4:
90996 result = Lang.dialog(240);
90997 break;
90998 case 5:
90999 result = Lang.dialog(241);
91000 break;
91001 }
91002 }
91003 }
91004 else if (type == 178)
91005 {
91006 int num9 = Main.rand.Next(5);
91007 if (HasSpecialEventText("Steampunker", out specialEventText))
91008 {
91009 result = specialEventText;
91010 }
91011 else if (Main.bloodMoon && Main.rand.Next(3) == 0)
91012 {
91013 result = Lang.dialog(245);
91014 }
91015 else if (flag13 && Main.rand.Next(6) == 0)
91016 {
91017 result = Lang.dialog(246);
91018 }
91019 else if (flag12 && Main.rand.Next(6) == 0)
91020 {
91021 result = Lang.dialog(247);
91022 }
91023 else
91024 {
91025 switch (num9)
91026 {
91027 case 0:
91028 result = Lang.dialog(242);
91029 break;
91030 case 1:
91031 result = Lang.dialog(243);
91032 break;
91033 case 2:
91034 result = Lang.dialog(244);
91035 break;
91036 case 3:
91037 result = Lang.dialog(248);
91038 break;
91039 case 4:
91040 result = Lang.dialog(249);
91041 break;
91042 }
91043 }
91044 }
91045 else if (type == 207)
91046 {
91047 int num10 = Main.rand.Next(3);
91048 if (HasSpecialEventText("DyeTrader", out specialEventText))
91049 {
91050 result = specialEventText;
91051 }
91052 else if (flag12 && Main.rand.Next(6) == 0)
91053 {
91054 result = Lang.dialog(260);
91055 }
91056 else
91057 {
91058 switch (num10)
91059 {
91060 case 0:
91061 result = Lang.dialog(257);
91062 break;
91063 case 1:
91064 result = Lang.dialog(258);
91065 break;
91066 case 2:
91067 result = Lang.dialog(259);
91068 break;
91069 }
91070 }
91071 }
91072 else if (type == 208)
91073 {
91074 if (freeCake)
91075 {
91076 int num11 = Main.rand.Next(1, 4);
91077 result = Language.GetTextValueWith("PartyGirlSpecialText.Cake" + num11, obj);
91078 }
91079 else
91080 {
91081 int num12 = Main.rand.Next(7);
91082 if (HasSpecialEventText("PartyGirl", out specialEventText))
91083 {
91084 result = specialEventText;
91085 }
91086 else if (DD2Event.DownedInvasionT1 && Main.rand.Next(5) == 0)
91087 {
91088 result = Language.GetTextValueWith("PartyGirlSpecialText.AfterDD2Tier1", obj);
91089 }
91090 else if (Main.player[Main.myPlayer].Male && Main.rand.Next(5) == 0)
91091 {
91092 result = Lang.dialog(268);
91093 }
91094 else if (flag15 && Main.rand.Next(5) == 0)
91095 {
91096 result = Lang.dialog(310);
91097 }
91098 else
91099 {
91100 switch (num12)
91101 {
91102 case 0:
91103 result = Lang.dialog(265);
91104 break;
91105 case 1:
91106 result = Lang.dialog(266);
91107 break;
91108 case 2:
91109 result = Lang.dialog(267);
91110 break;
91111 case 3:
91112 result = Lang.dialog(269);
91113 break;
91114 case 4:
91115 result = Lang.dialog(270);
91116 break;
91117 case 5:
91118 result = Lang.dialog(271);
91119 break;
91120 case 6:
91121 result = Lang.dialog(272);
91122 break;
91123 }
91124 }
91125 }
91126 }
91127 else if (type == 209)
91128 {
91129 if (HasSpecialEventText("Cyborg", out specialEventText))
91130 {
91131 result = specialEventText;
91132 }
91133 else if (flag12 && Main.rand.Next(6) == 0)
91134 {
91135 result = Lang.dialog(284);
91136 }
91137 else if (flag11 && Main.rand.Next(6) == 0)
91138 {
91139 result = Lang.dialog(283);
91140 }
91141 else
91142 {
91144 int num13 = Main.rand.Next(5 + array4.Length);
91145 if (num13 >= 5)
91146 {
91147 result = array4[num13 - 5].FormatWith(obj);
91148 }
91149 else
91150 {
91151 switch (num13)
91152 {
91153 case 0:
91154 result = Lang.dialog(280);
91155 break;
91156 case 1:
91157 result = Lang.dialog(281);
91158 break;
91159 case 2:
91160 result = Lang.dialog(282);
91161 break;
91162 case 3:
91163 result = Lang.dialog(285);
91164 break;
91165 case 4:
91166 result = Lang.dialog(286);
91167 break;
91168 }
91169 }
91170 }
91171 }
91172 else if (type == 227)
91173 {
91174 int num14 = Main.rand.Next(5);
91175 if (HasSpecialEventText("Painter", out specialEventText))
91176 {
91177 result = specialEventText;
91178 }
91179 else if (Main.hardMode && Main.rand.Next(7) == 0)
91180 {
91181 result = Lang.dialog(250);
91182 }
91183 else if (flag14 && Main.rand.Next(6) == 0)
91184 {
91185 result = Lang.dialog(251);
91186 }
91187 else
91188 {
91189 switch (num14)
91190 {
91191 case 0:
91192 result = Lang.dialog(252);
91193 break;
91194 case 1:
91195 result = Lang.dialog(253);
91196 break;
91197 case 2:
91198 result = Lang.dialog(254);
91199 break;
91200 case 3:
91201 result = Lang.dialog(255);
91202 break;
91203 case 4:
91204 result = Lang.dialog(256);
91205 break;
91206 }
91207 }
91208 }
91209 else if (type == 228)
91210 {
91211 int num15 = Main.rand.Next(4);
91212 if (HasSpecialEventText("WitchDoctor", out specialEventText))
91213 {
91214 result = specialEventText;
91215 }
91216 else if (flag2 && Main.rand.Next(4) == 0)
91217 {
91218 result = Lang.dialog(263);
91219 }
91220 else
91221 {
91222 switch (num15)
91223 {
91224 case 0:
91225 result = Lang.dialog(261);
91226 break;
91227 case 1:
91228 result = Lang.dialog(262);
91229 break;
91230 case 2:
91231 result = Lang.dialog(264);
91232 break;
91233 case 3:
91234 result = Language.GetTextValueWith("WitchDoctorSpecialText.AfterDD2Tier1", obj);
91235 break;
91236 }
91237 }
91238 }
91239 else if (type == 229)
91240 {
91242 int num16 = Main.rand.Next(6 + array5.Length);
91243 if (num16 >= 6)
91244 {
91245 result = array5[num16 - 6].FormatWith(obj);
91246 }
91247 else if (HasSpecialEventText("Pirate", out specialEventText))
91248 {
91249 result = specialEventText;
91250 }
91251 else if (!Main.player[Main.myPlayer].Male && Main.rand.Next(5) == 0)
91252 {
91253 result = Lang.dialog(276);
91254 }
91255 else
91256 {
91257 switch (num16)
91258 {
91259 case 0:
91260 result = Lang.dialog(273);
91261 break;
91262 case 1:
91263 result = Lang.dialog(274);
91264 break;
91265 case 2:
91266 result = Lang.dialog(275);
91267 break;
91268 case 3:
91269 result = Lang.dialog(277);
91270 break;
91271 case 4:
91272 result = Lang.dialog(278);
91273 break;
91274 case 5:
91275 result = Lang.dialog(279);
91276 break;
91277 }
91278 }
91279 }
91280 else if (type == 354)
91281 {
91282 result = Lang.dialog(Main.rand.Next(315, 319));
91283 }
91284 else if (type == 353)
91285 {
91286 if (HasSpecialEventText("Stylist", out specialEventText))
91287 {
91288 result = specialEventText;
91289 }
91290 else if (Main.bloodMoon)
91291 {
91292 switch (Main.rand.Next(3))
91293 {
91294 case 0:
91295 result = Lang.dialog(304);
91296 break;
91297 case 1:
91298 result = Lang.dialog(305);
91299 break;
91300 case 2:
91301 result = Lang.dialog(306);
91302 break;
91303 }
91304 }
91305 else if (Main.dayTime && Main.time < 16200.0 && Main.rand.Next(3) == 0)
91306 {
91307 result = Lang.dialog(311);
91308 }
91309 else if (Main.player[Main.myPlayer].Male && Main.rand.Next(3) == 0)
91310 {
91311 switch (Main.rand.Next(2))
91312 {
91313 case 0:
91314 result = Lang.dialog(293);
91315 break;
91316 case 1:
91317 result = Lang.dialog(300);
91318 break;
91319 }
91320 }
91321 else if (!Main.player[Main.myPlayer].Male && Main.rand.Next(3) == 0)
91322 {
91323 switch (Main.rand.Next(3))
91324 {
91325 case 0:
91326 result = Lang.dialog(291);
91327 break;
91328 case 1:
91329 result = Lang.dialog(292);
91330 break;
91331 case 2:
91332 result = Lang.dialog(312);
91333 break;
91334 }
91335 }
91336 else if (flag14 && flag7 && flag2 && flag3 && Main.rand.Next(5) == 0)
91337 {
91338 result = Lang.dialog(307);
91339 }
91340 else if (flag14 && Main.rand.Next(5) == 0)
91341 {
91342 result = Lang.dialog(302);
91343 }
91344 else if (flag6 && Main.rand.Next(5) == 0)
91345 {
91346 result = Lang.dialog(303);
91347 }
91348 else if (flag13 && Main.rand.Next(5) == 0)
91349 {
91350 result = Lang.dialog(308);
91351 }
91352 else
91353 {
91355 int num17 = ((Main.moonPhase < 3) ? 5 : 4);
91356 int num18 = Main.rand.Next(num17 + array6.Length);
91357 if (num18 >= num17)
91358 {
91359 result = array6[num18 - num17].FormatWith(obj);
91360 }
91361 else if (Main.moonPhase < 3)
91362 {
91363 switch (num18)
91364 {
91365 case 0:
91366 result = Lang.dialog(287);
91367 break;
91368 case 1:
91369 result = Lang.dialog(288);
91370 break;
91371 case 2:
91372 result = Lang.dialog(289);
91373 break;
91374 case 3:
91375 result = Lang.dialog(290);
91376 break;
91377 case 4:
91378 result = Lang.dialog(294);
91379 break;
91380 }
91381 }
91382 else if (Main.moonPhase < 6)
91383 {
91384 switch (num18)
91385 {
91386 case 0:
91387 result = Lang.dialog(295);
91388 break;
91389 case 1:
91390 result = Lang.dialog(296);
91391 break;
91392 case 2:
91393 result = Lang.dialog(297);
91394 break;
91395 case 3:
91396 result = Lang.dialog(298);
91397 break;
91398 }
91399 }
91400 else
91401 {
91402 switch (num18)
91403 {
91404 case 0:
91405 result = Lang.dialog(299);
91406 break;
91407 case 1:
91408 result = Lang.dialog(301);
91409 break;
91410 case 2:
91411 result = Lang.dialog(313);
91412 break;
91413 case 3:
91414 result = Lang.dialog(314);
91415 break;
91416 }
91417 }
91418 }
91419 }
91420 else if (type == 368)
91421 {
91422 result = (HasSpecialEventText("TravellingMerchant", out specialEventText) ? specialEventText : ((flag16 && Main.rand.Next(5) == 0) ? Lang.dialog(319) : ((flag && Main.rand.Next(5) == 0) ? Lang.dialog(320) : ((!flag9 || Main.rand.Next(5) != 0) ? Lang.dialog(Main.rand.Next(322, 331)) : Lang.dialog(321)))));
91423 }
91424 else if (type == 376)
91425 {
91426 result = Lang.dialog(Main.rand.Next(353, 356));
91427 }
91428 else if (type == 369)
91429 {
91430 result = ((Main.rand.Next(5) == 0 && Main.LocalPlayer.anglerQuestsFinished > 1) ? Lang.AnglerQuestCountChat(this) : (HasSpecialEventText("Angler", out specialEventText) ? specialEventText : (Main.bloodMoon ? ((Main.rand.Next(3) == 0) ? Language.SelectRandom(Lang.CreateDialogFilter("AnglerSpecialText.BloodMoonFishing")).FormatWith(obj) : (Main.anglerQuestFinished ? Lang.dialog(Main.rand.Next(350, 353)) : Lang.dialog(Main.rand.Next(348, 350)))) : ((!Main.anglerQuestFinished) ? Lang.dialog(Main.rand.Next(334, 338)) : ((!flag4 || Main.rand.Next(5) != 0) ? Language.SelectRandom(Lang.CreateDialogFilter("AnglerChatter.", obj)).FormatWith(obj) : Lang.dialog(347))))));
91431 }
91432 else if (type == 453)
91433 {
91434 result = ((!HasSpecialEventText("SkeletonMerchant", out specialEventText)) ? Lang.dialog(Main.rand.Next(356, 364)) : specialEventText);
91435 }
91436 else if (type == 441)
91437 {
91438 result = (HasSpecialEventText("TaxCollector", out specialEventText) ? specialEventText : ((Main.rand.Next(6) == 0 && flag4) ? Lang.dialog(371) : ((Main.rand.Next(6) == 0 && flag3) ? Lang.dialog(372) : ((Main.rand.Next(6) == 0 && flag6) ? Lang.dialog(373) : ((!(Main.rand.Next(6) == 0 && flag)) ? Lang.dialog(Main.rand.Next(364, 370)) : Lang.dialog(374))))));
91439 }
91440 else if (type == 579)
91441 {
91442 result = Language.GetTextValue("BartenderSpecialText.FirstMeeting");
91443 }
91444 else if (type == 550)
91445 {
91446 result = ((!HasSpecialEventText("Bartender", out specialEventText)) ? Lang.BartenderChat(this) : specialEventText);
91447 }
91448 else if (type == 589)
91449 {
91450 result = ((Main.rand.Next(2) != 0) ? Language.GetTextValue("GolferSpecialText.FirstMeeting2") : Language.GetTextValue("GolferSpecialText.FirstMeeting1"));
91451 }
91452 else if (type == 588)
91453 {
91454 if (Main.rand.Next(3) != 0 && HasSpecialEventText("Golfer", out specialEventText))
91455 {
91456 result = specialEventText;
91457 }
91458 else if (Main.rand.Next(3) == 0)
91459 {
91460 string text2 = ((Main.LocalPlayer.golferScoreAccumulated >= 2000) ? "GolferQuestsChatterMaster" : ((Main.LocalPlayer.golferScoreAccumulated >= 1000) ? "GolferQuestsChatterJourneyman" : ((Main.LocalPlayer.golferScoreAccumulated < 500) ? "GolferQuestsChatterBeginner" : "GolferQuestsChatterApprentice")));
91461 result = Language.SelectRandom(Lang.CreateDialogFilter(text2 + ".")).FormatWith(obj);
91462 }
91463 else
91464 {
91465 result = Lang.GolferChat(this);
91466 }
91467 }
91468 else if (type == 633)
91469 {
91470 result = ((ShouldBestiaryGirlBeLycantrope() || !HasSpecialEventText("BestiaryGirl", out specialEventText)) ? Lang.BestiaryGirlChat(this) : specialEventText);
91471 }
91472 else if (type == 663)
91473 {
91474 result = ((!HasSpecialEventText("Princess", out specialEventText)) ? Lang.PrincessChat(this) : specialEventText);
91475 }
91476 else if (type == 637)
91477 {
91478 result = ((!HasSpecialEventText("Cat", out specialEventText)) ? Lang.CatChat(this) : specialEventText);
91479 }
91480 else if (type == 638)
91481 {
91482 result = ((!HasSpecialEventText("Dog", out specialEventText)) ? Lang.DogChat(this) : specialEventText);
91483 }
91484 else if (type == 656)
91485 {
91486 result = ((!HasSpecialEventText("Bunny", out specialEventText)) ? Lang.BunnyChat(this) : specialEventText);
91487 }
91488 else if (NPCID.Sets.IsTownSlime[type])
91489 {
91490 result = ((!HasSpecialEventText("Slime", out specialEventText)) ? Lang.SlimeChat(this) : specialEventText);
91491 }
91492 return result;
91493 }
91494
91495 public object Clone()
91496 {
91497 return MemberwiseClone();
91498 }
91499
91501 {
91502 specialEventText = null;
91504 if (Main.rand.Next(3) == 0)
91505 {
91506 float normalizedLuck = Main.player[Main.myPlayer].NormalizedLuck;
91507 if (normalizedLuck == 0f)
91508 {
91509 return false;
91510 }
91511 string text = null;
91512 text = ((normalizedLuck < -0.6f) ? "WizardSpecialText.LuckIsCursed" : ((normalizedLuck < -0.4f) ? "WizardSpecialText.LuckIsTerrible" : ((normalizedLuck < -0.2f) ? "WizardSpecialText.LuckIsPoor" : ((normalizedLuck < 0f) ? "WizardSpecialText.LuckIsBad" : ((normalizedLuck < 0.25f) ? "WizardSpecialText.LuckIsGood" : ((normalizedLuck < 0.5f) ? "WizardSpecialText.LuckIsGreat" : ((!(normalizedLuck < 0.75f)) ? "WizardSpecialText.LuckIsGodly" : "WizardSpecialText.LuckIsAmazing")))))));
91514 return true;
91515 }
91516 return false;
91517 }
91518
91520 {
91521 specialEventText = null;
91523 if (Main.LocalPlayer.ZoneGraveyard && Main.rand.Next(3) == 0 && GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Graveyard", substitutes, ref specialEventText))
91524 {
91525 return true;
91526 }
91527 if (BirthdayParty.PartyIsUp && Main.rand.Next(3) == 0 && !NPCID.Sets.HasNoPartyText[type] && GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Party", substitutes, ref specialEventText))
91528 {
91529 return true;
91530 }
91531 if (Main.raining && !Main.IsItStorming && Main.rand.Next(3) == 0 && GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Rain", substitutes, ref specialEventText))
91532 {
91533 return true;
91534 }
91535 if (Main.IsItAHappyWindyDay && Main.rand.Next(3) == 0 && GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Windy", substitutes, ref specialEventText))
91536 {
91537 return true;
91538 }
91539 if (Main.IsItStorming && Main.rand.Next(3) == 0 && GetSpecialEventTextIfNotEmpty(specialTextCategoryKey + "SpecialText.Storm", substitutes, ref specialEventText))
91540 {
91541 return true;
91542 }
91543 return false;
91544 }
91545
91547 {
91550 {
91552 return true;
91553 }
91554 return false;
91555 }
91556
91557 public void CheckDrowning()
91558 {
91559 bool flag = Collision.DrownCollision(position, width, height, 1f);
91560 if (Main.netMode != 1)
91561 {
91562 if (flag)
91563 {
91564 if (++breathCounter >= 7)
91565 {
91566 breathCounter = 0;
91567 breath--;
91568 if (breath <= 0)
91569 {
91570 friendlyRegen = 0;
91571 breath = 0;
91572 life -= 2;
91573 if (life % 24 < 2)
91574 {
91575 netUpdate = true;
91576 }
91577 if (life <= 0)
91578 {
91579 life = 1;
91580 StrikeNPCNoInteraction(2, 0f, 0);
91581 if (Main.netMode != 0)
91582 {
91583 NetMessage.SendData(28, -1, -1, null, whoAmI, 2f);
91584 }
91585 }
91586 }
91587 }
91588 }
91589 else
91590 {
91591 breath += 3;
91592 if (breath > 200)
91593 {
91594 breath = 200;
91595 }
91596 breathCounter = 0;
91597 }
91598 }
91599 if (flag && Main.rand.Next(20) == 0 && !lavaWet && !honeyWet && !shimmerWet)
91600 {
91601 int num = 0;
91602 int num2 = 0;
91603 if (type == 369)
91604 {
91605 num2 = 8;
91606 }
91607 Dust.NewDust(new Vector2(position.X + (float)((10 + num) * direction), position.Y + (float)num2 + 4f), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
91608 }
91609 }
91610
91611 public void TryPortalJumping()
91612 {
91613 if (townNPC && Main.netMode != 1)
91614 {
91616 }
91617 }
91618
91620 {
91622 if (((nPC.type >= 430 && nPC.type <= 436) || nPC.type == 591) && nPC.ai[2] > 5f)
91623 {
91624 int num = 34;
91625 if (nPC.spriteDirection < 0)
91626 {
91627 npcRect.X -= num;
91628 npcRect.Width += num;
91629 }
91630 else
91631 {
91632 npcRect.Width += num;
91633 }
91634 damageMultiplier *= 1.25f;
91635 }
91636 else if (nPC.type >= 494 && nPC.type <= 495 && nPC.ai[2] > 5f)
91637 {
91638 int num2 = 18;
91639 if (nPC.spriteDirection < 0)
91640 {
91641 npcRect.X -= num2;
91642 npcRect.Width += num2;
91643 }
91644 else
91645 {
91646 npcRect.Width += num2;
91647 }
91648 damageMultiplier *= 1.25f;
91649 }
91650 else if (nPC.type == 460)
91651 {
91652 Rectangle rectangle = new Rectangle(0, 0, 30, 14);
91653 rectangle.X = (int)nPC.Center.X;
91654 if (nPC.direction < 0)
91655 {
91656 rectangle.X -= rectangle.Width;
91657 }
91658 rectangle.Y = (int)nPC.position.Y + nPC.height - 20;
91659 if (victimHitbox.Intersects(rectangle))
91660 {
91662 damageMultiplier *= 1.35f;
91663 }
91664 }
91665 else if (nPC.type == 417 && nPC.ai[0] == 6f && nPC.ai[3] > 0f && nPC.ai[3] < 4f)
91666 {
91668 if (victimHitbox.Intersects(rectangle2))
91669 {
91671 damageMultiplier *= 1.35f;
91672 }
91673 }
91674 else if (nPC.type == 466)
91675 {
91676 Rectangle rectangle3 = new Rectangle(0, 0, 30, 8);
91677 rectangle3.X = (int)nPC.Center.X;
91678 if (nPC.direction < 0)
91679 {
91680 rectangle3.X -= rectangle3.Width;
91681 }
91682 rectangle3.Y = (int)nPC.position.Y + nPC.height - 32;
91683 if (victimHitbox.Intersects(rectangle3))
91684 {
91686 damageMultiplier *= 1.75f;
91687 }
91688 }
91689 else if (nPC.type == 576 || nPC.type == 577)
91690 {
91691 NPC nPC2 = nPC;
91692 bool flag = true;
91693 int y = nPC2.frame.Y;
91694 int num3 = 0;
91695 int num4 = 0;
91696 Rectangle rectangle4 = new Rectangle(0, 0, 30, 8);
91697 switch (y)
91698 {
91699 case 15:
91700 specialHitSetter = 2;
91701 rectangle4.Width = 120;
91702 rectangle4.Height = 30;
91703 num4 = 24;
91704 break;
91705 case 16:
91706 specialHitSetter = 2;
91707 rectangle4.Width = 120;
91708 rectangle4.Height = 60;
91709 num3 = 10;
91710 break;
91711 case 17:
91712 specialHitSetter = 2;
91713 rectangle4.Width = 100;
91714 rectangle4.Height = 90;
91715 num3 = 50;
91716 break;
91717 case 18:
91718 specialHitSetter = 2;
91719 rectangle4.Width = 100;
91720 rectangle4.Height = 50;
91721 num3 = 90;
91722 num4 = 10;
91723 break;
91724 default:
91725 flag = false;
91726 break;
91727 }
91728 if (flag)
91729 {
91730 rectangle4.X = (int)nPC2.Center.X - num3 * nPC2.direction;
91731 if (nPC2.direction < 0)
91732 {
91733 rectangle4.X -= rectangle4.Width;
91734 }
91735 rectangle4.Y = (int)nPC2.Center.Y - rectangle4.Height + num4;
91736 if (victimHitbox.Intersects(rectangle4))
91737 {
91739 damageMultiplier *= 1.75f;
91740 }
91741 }
91742 }
91743 else if ((nPC.type == 552 || nPC.type == 553 || nPC.type == 554) && nPC.ai[0] > 0f && nPC.ai[0] < 24f)
91744 {
91745 Rectangle rectangle5 = new Rectangle(0, 0, 34, 14);
91746 rectangle5.X = (int)nPC.Center.X;
91747 if (nPC.direction < 0)
91748 {
91749 rectangle5.X -= rectangle5.Width;
91750 }
91751 rectangle5.Y = (int)nPC.position.Y + nPC.height - 20;
91752 if (victimHitbox.Intersects(rectangle5))
91753 {
91755 damageMultiplier *= 1.35f;
91756 }
91757 }
91758 else
91759 {
91760 if (nPC.type != 668)
91761 {
91762 return;
91763 }
91764 npcRect.Height -= 80;
91765 NPC nPC3 = nPC;
91766 bool flag2 = true;
91767 int y2 = nPC3.frame.Y;
91768 int num5 = 0;
91769 int num6 = 0;
91770 Rectangle rectangle6 = new Rectangle(0, 0, 30, 8);
91771 if (y2 == 15)
91772 {
91773 rectangle6.Width = 64;
91774 rectangle6.Height = 180;
91775 num6 = 80;
91776 num5 = -42;
91777 if (nPC3.ai[0] == 4f)
91778 {
91779 flag2 = false;
91780 }
91781 }
91782 else
91783 {
91784 flag2 = false;
91785 }
91786 if (flag2)
91787 {
91788 rectangle6.X = (int)nPC3.Center.X - num5 * nPC3.direction;
91789 if (nPC3.direction < 0)
91790 {
91791 rectangle6.X -= rectangle6.Width;
91792 }
91793 rectangle6.Y = (int)nPC3.Center.Y - rectangle6.Height + num6;
91794 if (victimHitbox.Intersects(rectangle6))
91795 {
91797 }
91798 }
91799 }
91800 }
91801
91802 public string GetBestiaryCreditId()
91803 {
91805 }
91806
91807 public override string ToString()
91808 {
91809 return "name:" + TypeName + ", active:" + active.ToString() + ", whoAmI:" + whoAmI;
91810 }
91811}
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float Max(float value1, float value2)
Definition MathHelper.cs:41
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static float Min(float value1, float value2)
Definition MathHelper.cs:36
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static double Cos(double d)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Pow(double x, double y)
static double Ceiling(double a)
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static void PlaySound(int type, Vector2 position, int style=1)
static ActiveSound GetActiveSound(SlotId id)
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static bool DestroyChest(int X, int Y)
Definition Chest.cs:691
static int FindChest(int X, int Y)
Definition Chest.cs:546
static bool CanHit(Entity source, Entity target)
Definition Collision.cs:344
static bool WetCollision(Vector2 Position, int Width, int Height)
static bool stair
Definition Collision.cs:20
static bool DrownCollision(Vector2 Position, int Width, int Height, float gravDir=-1f, bool includeSlopes=false)
static bool GetWaterLineIterate(Point pt, out float waterLineHeight)
static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp=100, int maxExpandDown=100)
static bool up
Definition Collision.cs:32
static bool honey
Definition Collision.cs:24
static bool stairFall
Definition Collision.cs:22
static bool CanHitLine(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2)
Definition Collision.cs:551
static Vector4 WalkDownSlope(Vector2 Position, Vector2 Velocity, int Width, int Height, float gravity=0f)
static Vector2 TileCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1)
static void StepDown(ref Vector2 position, ref Vector2 velocity, int width, int height, ref float stepSpeed, ref float gfxOffY, int gravDir=1, bool waterWalk=false)
static Vector4 SlopeCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, float gravity=0f, bool fall=false)
static Vector2 AdvancedTileCollision(bool[] forcedIgnoredTiles, Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1)
static Vector2 noSlopeCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false)
static bool shimmer
Definition Collision.cs:26
static void StepUp(ref Vector2 position, ref Vector2 velocity, int width, int height, ref float stepSpeed, ref float gfxOffY, int gravDir=1, bool holdsMatching=false, int specialChecksMode=0)
static bool LavaCollision(Vector2 Position, int Width, int Height)
static bool SolidTilesVersatile(int startX, int endX, int startY, int endY)
static bool SolidCollision(Vector2 Position, int Width, int Height)
static bool SwitchTiles(Vector2 Position, int Width, int Height, Vector2 oldPosition, int objType)
static void StepConveyorBelt(Entity entity, float gravDir)
static bool SolidTiles(Vector2 position, int width, int height)
static bool GetWaterLine(Point pt, out float waterLineHeight)
static readonly Color DamagedFriendly
Definition CombatText.cs:8
static readonly Color LifeRegenNegative
Definition CombatText.cs:26
static readonly Color OthersDamagedHostile
Definition CombatText.cs:16
static int NewText(Rectangle location, Color color, int amount, bool dramatic=false, bool dot=false)
Definition CombatText.cs:54
static readonly Color HealLife
Definition CombatText.cs:20
static readonly Color DamagedHostile
Definition CombatText.cs:12
static readonly GameModeData NormalMode
static readonly GameModeData MasterMode
static readonly GameModeData ExpertMode
static Dictionary< int, TileEntity > ByID
Definition TileEntity.cs:18
static bool SearchAvoidedByNPCs(int x, int y)
static bool CastLightOpen(int x, int y)
static Dust CloneDust(int dustIndex)
Definition Dust.cs:233
static int dustWater()
Definition Dust.cs:340
static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:73
float scale
Definition Dust.cs:28
static Dust NewDustPerfect(Vector2 Position, int Type, Vector2? Velocity=null, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:52
static Dust NewDustDirect(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:63
Vector2 velocity
Definition Dust.cs:22
Vector2 DirectionFrom(Vector2 Source)
Definition Entity.cs:202
float AngleTo(Vector2 Destination)
Definition Entity.cs:177
Vector2 oldPosition
Definition Entity.cs:18
bool honeyWet
Definition Entity.cs:34
Vector2 Center
Definition Entity.cs:43
bool shimmerWet
Definition Entity.cs:32
Vector2 Top
Definition Entity.cs:79
int oldDirection
Definition Entity.cs:22
Vector2 Bottom
Definition Entity.cs:115
Vector2 velocity
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:187
Rectangle Hitbox
Definition Entity.cs:164
Vector2 position
Definition Entity.cs:14
Vector2 oldVelocity
Definition Entity.cs:20
byte wetCount
Definition Entity.cs:36
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
static Tile GetTileSafely(Vector2 position)
Definition Framing.cs:419
static void HandleSpecialEvent(Player player, int eventID)
static void BroadcastParticleSpawn(ParticleOrchestraType type, ParticleOrchestraSettings settings)
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static bool CheckFloor(Vector2 Center, out Point[] spawnPoints)
static void SpawnMonsterFromGate(Vector2 gateBottom)
Definition DD2Event.cs:524
static void CheckProgress(int slainMonsterID)
Definition DD2Event.cs:338
static bool CanRaiseGoblinsHere(Vector2 spot)
Definition DD2Event.cs:683
static void RaiseGoblins(NPC caller, Vector2 spot)
Definition DD2Event.cs:700
static void StopInvasion(bool win=false)
Definition DD2Event.cs:269
static void SpawnNPC(ref int newNPC)
Definition DD2Event.cs:167
static void AnnounceGoblinDeath(NPC n)
Definition DD2Event.cs:678
static void ThrowPieces(Vector2 MoonlordCoreCenter, int DramaSeed)
static void RequestLight(float light, Vector2 spot)
static Color GetPortalColor(int colorIndex)
static void TryGoingThroughPortals(Entity ent)
static ? Vector2 FindSpotWithoutShimmer(Entity entity, int startX, int startY, int expand, bool allowSolidTop)
static Asset< Texture2D >[] Npc
static int NewBubbleNPC(WorldUIAnchor bubbleAnchor, int time, WorldUIAnchor other=null)
static int NewBubble(int emoticon, WorldUIAnchor bubbleAnchor, int time)
static Gore NewGorePerfect(Vector2 Position, Vector2 Velocity, int Type, float Scale=1f)
Definition Gore.cs:1275
static Gore NewGoreDirect(Vector2 Position, Vector2 Velocity, int Type, float Scale=1f)
Definition Gore.cs:1283
static int NewGore(Vector2 Position, Vector2 Velocity, int Type, float Scale=1f)
Definition Gore.cs:1288
static FilterManager Scene
Definition Filters.cs:5
static int Bullet
Definition AmmoID.cs:114
static bool[] CanBeRemovedByNetMessage
Definition BuffID.cs:26
static readonly int Count
Definition BuffID.cs:1069
static Dictionary< int, string > NpcBestiaryCreditIdsByNpcNetIds
static int[] ItemsForStuffCannon
Definition ItemID.cs:73
static bool[] ItemsThatCountAsBombsForDemolitionistToSpawn
Definition ItemID.cs:55
static int[] KillsToBanner
Definition ItemID.cs:1022
static int[] ShimmerTransformToNPC
Definition NPCID.cs:4222
static bool[] AllNPCs
Definition NPCID.cs:4174
static bool[] NeedsExpertScaling
Definition NPCID.cs:4184
static bool[] IsDragonfly
Definition NPCID.cs:4164
static Dictionary< int, NPCDebuffImmunityData > DebuffImmunitySets
Definition NPCID.cs:108
static int[] PrettySafe
Definition NPCID.cs:4230
static bool[] Skeletons
Definition NPCID.cs:4238
static bool[] TakesDamageFromHostilesWithoutBeingFriendly
Definition NPCID.cs:4172
static float[] StatueSpawnedDropRarity
Definition NPCID.cs:4180
static int[] AttackFrameCount
Definition NPCID.cs:4212
static bool[] BelongsToInvasionOldOnesArmy
Definition NPCID.cs:4166
static bool[] TownCritter
Definition NPCID.cs:4200
static bool[] UsesMultiplayerProximitySyncing
Definition NPCID.cs:4192
static bool[] IsTownPet
Definition NPCID.cs:4099
static int[] ShimmerTransformToItem
Definition NPCID.cs:4218
static bool[] CanConvertIntoCopperSlimeTownNPC
Definition NPCID.cs:4103
static bool[] NoMultiplayerSmoothingByType
Definition NPCID.cs:4194
static bool[] UsesNewTargetting
Definition NPCID.cs:4170
static Color[] MagicAuraColor
Definition NPCID.cs:4232
static int[] AttackTime
Definition NPCID.cs:4224
static bool[] ShimmerImmunity
Definition NPCID.cs:4216
static bool[] NoMultiplayerSmoothingByAI
Definition NPCID.cs:4196
static bool[] IsTownSlime
Definition NPCID.cs:4101
static int[] AttackType
Definition NPCID.cs:4228
static bool[] NoEarlymodeLootWhenSpawnedFromStatue
Definition NPCID.cs:4182
static int[] TrailCacheLength
Definition NPCID.cs:4190
static int[] BossHeadTextures
Definition NPCID.cs:4240
static int[] TrailingMode
Definition NPCID.cs:4162
static int[] ExtraFramesCount
Definition NPCID.cs:4210
static bool[] PositiveNPCTypesExcludedFromDeathTally
Definition NPCID.cs:4242
static int[] AttackAverageChance
Definition NPCID.cs:4226
static bool[] DangerThatPreventsOtherDangers
Definition NPCID.cs:4246
static bool[] FighterUsesDD2PortalAppearEffect
Definition NPCID.cs:4178
static bool[] ProjectileNPC
Definition NPCID.cs:4186
static bool[] ShimmerTownTransform
Definition NPCID.cs:4220
static bool[] HurtingBees
Definition NPCID.cs:4176
static int[] DangerDetectRange
Definition NPCID.cs:4214
static bool[] DontDoHardmodeScaling
Definition NPCID.cs:4095
static bool[] HasNoPartyText
Definition NPCID.cs:4204
static int FromNetId(int id)
Definition NPCID.cs:11757
static readonly short Count
Definition NPCID.cs:11744
static bool[] IsAnNPCAttachedExplosive
static readonly LegacySoundStyle NPCHit27
Definition SoundID.cs:220
static readonly LegacySoundStyle NPCHit57
Definition SoundID.cs:280
static readonly LegacySoundStyle Item119
Definition SoundID.cs:652
static readonly LegacySoundStyle NPCHit16
Definition SoundID.cs:198
static readonly LegacySoundStyle NPCHit49
Definition SoundID.cs:264
static readonly LegacySoundStyle Item163
Definition SoundID.cs:740
static readonly LegacySoundStyle DD2_OgreHurt
Definition SoundID.cs:888
static readonly LegacySoundStyle DD2_DarkMageHurt
Definition SoundID.cs:824
static readonly LegacySoundStyle Item10
Definition SoundID.cs:434
static readonly LegacySoundStyle DD2_WitherBeastAuraPulse
Definition SoundID.cs:900
static readonly LegacySoundStyle DD2_BetsyHurt
Definition SoundID.cs:808
static readonly LegacySoundStyle DD2_OgreGroundPound
Definition SoundID.cs:886
static readonly LegacySoundStyle NPCDeath43
Definition SoundID.cs:366
static readonly LegacySoundStyle DD2_SkeletonDeath
Definition SoundID.cs:894
static readonly LegacySoundStyle NPCHit46
Definition SoundID.cs:258
static readonly LegacySoundStyle NPCDeath66
Definition SoundID.cs:412
static readonly LegacySoundStyle NPCDeath5
Definition SoundID.cs:290
static readonly LegacySoundStyle DD2_OgreRoar
Definition SoundID.cs:890
static readonly LegacySoundStyle NPCDeath31
Definition SoundID.cs:342
static readonly LegacySoundStyle DD2_EtherianPortalOpen
Definition SoundID.cs:920
static readonly LegacySoundStyle NPCHit30
Definition SoundID.cs:226
static readonly LegacySoundStyle DD2_KoboldIgnite
Definition SoundID.cs:864
static readonly LegacySoundStyle NPCDeath38
Definition SoundID.cs:356
static readonly LegacySoundStyle NPCHit28
Definition SoundID.cs:222
static readonly LegacySoundStyle NPCDeath40
Definition SoundID.cs:360
static readonly LegacySoundStyle Item39
Definition SoundID.cs:492
static readonly LegacySoundStyle NPCHit41
Definition SoundID.cs:248
static readonly LegacySoundStyle NPCHit12
Definition SoundID.cs:190
static readonly LegacySoundStyle NPCHit56
Definition SoundID.cs:278
static readonly LegacySoundStyle DD2_WyvernScream
Definition SoundID.cs:912
static readonly LegacySoundStyle NPCDeath14
Definition SoundID.cs:308
static readonly LegacySoundStyle DD2_WinScene
Definition SoundID.cs:928
static readonly LegacySoundStyle DeerclopsHit
Definition SoundID.cs:960
static readonly LegacySoundStyle NPCHit54
Definition SoundID.cs:274
static readonly LegacySoundStyle DD2_JavelinThrowersHurt
Definition SoundID.cs:854
static readonly LegacySoundStyle NPCDeath26
Definition SoundID.cs:332
static readonly LegacySoundStyle NPCDeath45
Definition SoundID.cs:370
static readonly LegacySoundStyle DD2_WitherBeastCrystalImpact
Definition SoundID.cs:902
static readonly LegacySoundStyle DD2_GoblinBomberHurt
Definition SoundID.cs:844
static readonly LegacySoundStyle NPCHit22
Definition SoundID.cs:210
static readonly LegacySoundStyle Item14
Definition SoundID.cs:442
static readonly LegacySoundStyle NPCDeath17
Definition SoundID.cs:314
static readonly LegacySoundStyle DD2_BetsyScream
Definition SoundID.cs:810
static readonly LegacySoundStyle DD2_KoboldScreamChargeLoop
Definition SoundID.cs:868
static readonly LegacySoundStyle Item167
Definition SoundID.cs:748
static readonly LegacySoundStyle Item150
Definition SoundID.cs:714
static readonly LegacySoundStyle DD2_OgreDeath
Definition SoundID.cs:884
static readonly LegacySoundStyle NPCHit3
Definition SoundID.cs:172
static readonly LegacySoundStyle NPCHit50
Definition SoundID.cs:266
static readonly LegacySoundStyle DD2_LightningBugDeath
Definition SoundID.cs:876
static readonly LegacySoundStyle NPCDeath48
Definition SoundID.cs:376
static readonly LegacySoundStyle NPCDeath12
Definition SoundID.cs:304
static readonly LegacySoundStyle NPCDeath54
Definition SoundID.cs:388
static readonly LegacySoundStyle NPCHit53
Definition SoundID.cs:272
static readonly LegacySoundStyle DD2_KoboldFlyerChargeScream
Definition SoundID.cs:870
static readonly LegacySoundStyle NPCHit13
Definition SoundID.cs:192
static readonly LegacySoundStyle DD2_KoboldHurt
Definition SoundID.cs:862
static readonly LegacySoundStyle NPCHit34
Definition SoundID.cs:234
static readonly LegacySoundStyle NPCHit17
Definition SoundID.cs:200
static readonly LegacySoundStyle DD2_DarkMageCastHeal
Definition SoundID.cs:818
static readonly LegacySoundStyle NPCDeath34
Definition SoundID.cs:348
static readonly LegacySoundStyle Item161
Definition SoundID.cs:736
static readonly LegacySoundStyle DD2_GoblinHurt
Definition SoundID.cs:838
static readonly LegacySoundStyle DD2_GoblinScream
Definition SoundID.cs:840
static readonly LegacySoundStyle NPCDeath52
Definition SoundID.cs:384
static readonly LegacySoundStyle NPCHit24
Definition SoundID.cs:214
static readonly LegacySoundStyle NPCHit29
Definition SoundID.cs:224
static readonly LegacySoundStyle NPCDeath39
Definition SoundID.cs:358
static readonly LegacySoundStyle NPCDeath63
Definition SoundID.cs:406
static readonly LegacySoundStyle NPCHit20
Definition SoundID.cs:206
static readonly LegacySoundStyle NPCHit11
Definition SoundID.cs:188
static readonly LegacySoundStyle Item4
Definition SoundID.cs:422
static readonly LegacySoundStyle Item165
Definition SoundID.cs:744
static readonly LegacySoundStyle DD2_WyvernHurt
Definition SoundID.cs:910
static readonly LegacySoundStyle NPCDeath49
Definition SoundID.cs:378
static readonly LegacySoundStyle DD2_KoboldIgniteLoop
Definition SoundID.cs:866
static readonly LegacySoundStyle DD2_GoblinBomberDeath
Definition SoundID.cs:842
static readonly LegacySoundStyle NPCHit44
Definition SoundID.cs:254
static readonly LegacySoundStyle NPCDeath20
Definition SoundID.cs:320
static readonly LegacySoundStyle NPCDeath23
Definition SoundID.cs:326
static readonly LegacySoundStyle Item34
Definition SoundID.cs:482
static readonly LegacySoundStyle DD2_KoboldFlyerDeath
Definition SoundID.cs:872
static readonly LegacySoundStyle NPCDeath1
Definition SoundID.cs:282
static readonly LegacySoundStyle NPCDeath36
Definition SoundID.cs:352
static readonly LegacySoundStyle NPCDeath21
Definition SoundID.cs:322
static readonly LegacySoundStyle NPCDeath11
Definition SoundID.cs:302
static readonly LegacySoundStyle NPCHit14
Definition SoundID.cs:194
static readonly LegacySoundStyle NPCDeath13
Definition SoundID.cs:306
static readonly LegacySoundStyle NPCDeath33
Definition SoundID.cs:346
static readonly LegacySoundStyle Item164
Definition SoundID.cs:742
static readonly LegacySoundStyle NPCHit23
Definition SoundID.cs:212
static readonly LegacySoundStyle Item160
Definition SoundID.cs:734
static readonly LegacySoundStyle NPCDeath2
Definition SoundID.cs:284
static readonly LegacySoundStyle NPCHit39
Definition SoundID.cs:244
static readonly LegacySoundStyle NPCDeath56
Definition SoundID.cs:392
static readonly LegacySoundStyle DD2_KoboldDeath
Definition SoundID.cs:858
static readonly LegacySoundStyle NPCDeath32
Definition SoundID.cs:344
static readonly LegacySoundStyle NPCDeath15
Definition SoundID.cs:310
static readonly LegacySoundStyle DD2_WitherBeastDeath
Definition SoundID.cs:904
static readonly LegacySoundStyle DD2_OgreAttack
Definition SoundID.cs:882
static readonly LegacySoundStyle NPCDeath35
Definition SoundID.cs:350
static readonly LegacySoundStyle Item17
Definition SoundID.cs:448
static readonly LegacySoundStyle NPCDeath16
Definition SoundID.cs:312
static readonly LegacySoundStyle NPCDeath18
Definition SoundID.cs:316
static readonly LegacySoundStyle DD2_JavelinThrowersDeath
Definition SoundID.cs:852
static readonly LegacySoundStyle NPCDeath29
Definition SoundID.cs:338
static readonly LegacySoundStyle DD2_LightningBugHurt
Definition SoundID.cs:878
static readonly LegacySoundStyle DD2_BetsyFlameBreath
Definition SoundID.cs:804
static readonly LegacySoundStyle NPCHit43
Definition SoundID.cs:252
static readonly LegacySoundStyle NPCHit51
Definition SoundID.cs:268
static readonly LegacySoundStyle Item5
Definition SoundID.cs:424
static readonly LegacySoundStyle NPCHit8
Definition SoundID.cs:182
static readonly LegacySoundStyle NPCDeath22
Definition SoundID.cs:324
static readonly LegacySoundStyle DD2_WitherBeastHurt
Definition SoundID.cs:906
static readonly LegacySoundStyle NPCHit1
Definition SoundID.cs:168
static readonly LegacySoundStyle NPCHit18
Definition SoundID.cs:202
static readonly LegacySoundStyle NPCHit9
Definition SoundID.cs:184
static readonly LegacySoundStyle DeerclopsDeath
Definition SoundID.cs:962
static readonly LegacySoundStyle NPCHit55
Definition SoundID.cs:276
static readonly LegacySoundStyle NPCDeath19
Definition SoundID.cs:318
static readonly LegacySoundStyle Item12
Definition SoundID.cs:438
static readonly LegacySoundStyle DD2_GoblinBomberScream
Definition SoundID.cs:846
static readonly LegacySoundStyle NPCDeath57
Definition SoundID.cs:394
static readonly LegacySoundStyle DD2_SkeletonHurt
Definition SoundID.cs:896
static readonly LegacySoundStyle DD2_BetsyFlyingCircleAttack
Definition SoundID.cs:806
static readonly LegacySoundStyle NPCHit45
Definition SoundID.cs:256
static readonly LegacySoundStyle DeerclopsRubbleAttack
Definition SoundID.cs:968
static readonly LegacySoundStyle NPCHit52
Definition SoundID.cs:270
static readonly LegacySoundStyle DD2_DrakinDeath
Definition SoundID.cs:830
static readonly LegacySoundStyle NPCHit26
Definition SoundID.cs:218
static readonly LegacySoundStyle DD2_OgreSpit
Definition SoundID.cs:892
static readonly LegacySoundStyle Item162
Definition SoundID.cs:738
static readonly LegacySoundStyle NPCDeath41
Definition SoundID.cs:362
static readonly LegacySoundStyle NPCHit15
Definition SoundID.cs:196
static readonly LegacySoundStyle DeerclopsScream
Definition SoundID.cs:964
static readonly LegacySoundStyle NPCDeath3
Definition SoundID.cs:286
static readonly LegacySoundStyle NPCDeath60
Definition SoundID.cs:400
static readonly LegacySoundStyle DD2_CrystalCartImpact
Definition SoundID.cs:924
static readonly LegacySoundStyle NPCHit2
Definition SoundID.cs:170
static readonly LegacySoundStyle NPCHit32
Definition SoundID.cs:230
static readonly LegacySoundStyle NPCHit47
Definition SoundID.cs:260
static readonly LegacySoundStyle NPCHit48
Definition SoundID.cs:262
static readonly LegacySoundStyle NPCHit40
Definition SoundID.cs:246
static readonly LegacySoundStyle DD2_DrakinShot
Definition SoundID.cs:834
static readonly LegacySoundStyle NPCHit19
Definition SoundID.cs:204
static readonly LegacySoundStyle DD2_KoboldExplosion
Definition SoundID.cs:860
static readonly LegacySoundStyle DD2_JavelinThrowersTaunt
Definition SoundID.cs:856
static readonly LegacySoundStyle DD2_KoboldFlyerHurt
Definition SoundID.cs:874
static readonly LegacySoundStyle DD2_DarkMageSummonSkeleton
Definition SoundID.cs:826
static readonly LegacySoundStyle Item170
Definition SoundID.cs:754
static readonly LegacySoundStyle NPCDeath53
Definition SoundID.cs:386
static readonly LegacySoundStyle NPCDeath27
Definition SoundID.cs:334
static readonly LegacySoundStyle NPCDeath6
Definition SoundID.cs:292
static readonly LegacySoundStyle NPCDeath8
Definition SoundID.cs:296
static readonly LegacySoundStyle NPCDeath61
Definition SoundID.cs:402
static readonly LegacySoundStyle NPCDeath50
Definition SoundID.cs:380
static readonly LegacySoundStyle DD2_DrakinBreathIn
Definition SoundID.cs:828
static readonly LegacySoundStyle NPCDeath65
Definition SoundID.cs:410
static readonly LegacySoundStyle NPCDeath59
Definition SoundID.cs:398
static readonly LegacySoundStyle NPCDeath9
Definition SoundID.cs:298
static readonly LegacySoundStyle DD2_DrakinHurt
Definition SoundID.cs:832
static readonly LegacySoundStyle DeerclopsStep
Definition SoundID.cs:970
static readonly LegacySoundStyle NPCDeath4
Definition SoundID.cs:288
static readonly LegacySoundStyle NPCDeath44
Definition SoundID.cs:368
static readonly LegacySoundStyle DD2_JavelinThrowersAttack
Definition SoundID.cs:850
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle NPCDeath58
Definition SoundID.cs:396
static readonly LegacySoundStyle NPCDeath10
Definition SoundID.cs:300
static readonly LegacySoundStyle DD2_WyvernDeath
Definition SoundID.cs:908
static readonly LegacySoundStyle NPCDeath47
Definition SoundID.cs:374
static readonly LegacySoundStyle NPCDeath7
Definition SoundID.cs:294
static readonly LegacySoundStyle NPCHit37
Definition SoundID.cs:240
static readonly LegacySoundStyle NPCHit6
Definition SoundID.cs:178
static readonly LegacySoundStyle NPCDeath64
Definition SoundID.cs:408
static readonly LegacySoundStyle DD2_WyvernDiveDown
Definition SoundID.cs:914
static readonly LegacySoundStyle NPCHit4
Definition SoundID.cs:174
static readonly LegacySoundStyle NPCDeath51
Definition SoundID.cs:382
static readonly LegacySoundStyle NPCDeath42
Definition SoundID.cs:364
static readonly LegacySoundStyle NPCHit31
Definition SoundID.cs:228
static readonly LegacySoundStyle NPCHit7
Definition SoundID.cs:180
static readonly LegacySoundStyle NPCHit21
Definition SoundID.cs:208
static readonly LegacySoundStyle NPCDeath24
Definition SoundID.cs:328
static readonly LegacySoundStyle NPCHit33
Definition SoundID.cs:232
static readonly LegacySoundStyle DD2_BetsyWindAttack
Definition SoundID.cs:814
static readonly LegacySoundStyle NPCDeath62
Definition SoundID.cs:404
static readonly LegacySoundStyle DD2_EtherianPortalIdleLoop
Definition SoundID.cs:918
static readonly LegacySoundStyle NPCDeath25
Definition SoundID.cs:330
static readonly LegacySoundStyle NPCDeath30
Definition SoundID.cs:340
static readonly LegacySoundStyle NPCHit36
Definition SoundID.cs:238
static readonly LegacySoundStyle DD2_EtherianPortalSpawnEnemy
Definition SoundID.cs:922
static readonly LegacySoundStyle NPCDeath55
Definition SoundID.cs:390
static readonly LegacySoundStyle NPCDeath46
Definition SoundID.cs:372
static readonly LegacySoundStyle NPCDeath28
Definition SoundID.cs:336
static readonly LegacySoundStyle DD2_BetsySummon
Definition SoundID.cs:812
static readonly LegacySoundStyle NPCHit5
Definition SoundID.cs:176
static readonly LegacySoundStyle NPCHit38
Definition SoundID.cs:242
static readonly LegacySoundStyle NPCHit25
Definition SoundID.cs:216
static readonly LegacySoundStyle DD2_GoblinDeath
Definition SoundID.cs:836
static readonly LegacySoundStyle NPCHit42
Definition SoundID.cs:250
static readonly LegacySoundStyle DD2_BetsyDeath
Definition SoundID.cs:798
static readonly LegacySoundStyle NPCDeath37
Definition SoundID.cs:354
static readonly LegacySoundStyle Item172
Definition SoundID.cs:758
static readonly LegacySoundStyle DD2_GoblinBomberThrow
Definition SoundID.cs:848
static readonly LegacySoundStyle DD2_DarkMageDeath
Definition SoundID.cs:820
static readonly LegacySoundStyle NPCHit35
Definition SoundID.cs:236
static bool[] Crimson
Definition TileID.cs:249
static bool[] CanBeSatOnForNPCs
Definition TileID.cs:133
static bool[] IsSkippedForNPCSpawningGroundTypeCheck
Definition TileID.cs:251
static bool[] FriendlyFairyCanLureTo
Definition TileID.cs:303
static bool[] BasicChest
Definition TileID.cs:223
static bool[] Ore
Definition TileID.cs:295
static bool[] Platforms
Definition TileID.cs:163
static bool[] InteractibleByNPCs
Definition TileID.cs:273
static bool[] Corrupt
Definition TileID.cs:235
static bool[] IsATreeTrunk
Definition TileID.cs:91
static bool[] Hallow
Definition TileID.cs:241
static void TorchColor(int torchID, out float R, out float G, out float B)
Definition TorchID.cs:164
static bool[] AllowsUndergroundDesertEnemiesToSpawn
Definition WallID.cs:38
static readonly ushort Count
Definition WallID.cs:753
static void ShimmerEffect(Vector2 shimmerPositon)
Definition Item.cs:48303
static int buyPrice(int platinum=0, int gold=0, int silver=0, int copper=0)
Definition Item.cs:47979
static int BannerToItem(int banner)
Definition Item.cs:1246
static int NPCtoBanner(int i)
Definition Item.cs:1296
void SetDefaults(int Type=0)
Definition Item.cs:47332
static int NewItem(IEntitySource source, Vector2 pos, Vector2 randomBox, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false)
Definition Item.cs:49697
static int BannerToNPC(int i)
Definition Item.cs:2040
static object CreateDialogSubstitutionObject(NPC npc=null)
Definition Lang.cs:74
static string GetNPCNameValue(int netID)
Definition Lang.cs:143
static string BunnyChat(NPC npc)
Definition Lang.cs:339
static string AnglerQuestCountChat(NPC npc)
Definition Lang.cs:257
static string dialog(int l, bool english=false)
Definition Lang.cs:138
static string BestiaryGirlChat(NPC npc)
Definition Lang.cs:310
static string PrincessChat(NPC npc)
Definition Lang.cs:321
static string GolferChat(NPC npc)
Definition Lang.cs:304
static LocalizedText[] misc
Definition Lang.cs:25
static string SlimeChat(NPC npc)
Definition Lang.cs:345
static string CatChat(NPC npc)
Definition Lang.cs:327
static string DogChat(NPC npc)
Definition Lang.cs:333
static string BartenderChat(NPC npc)
Definition Lang.cs:293
static LanguageSearchFilter CreateDialogFilter(string startsWith, object substitutions)
Definition Lang.cs:388
static LocalizedText GetNPCName(int netID)
Definition Lang.cs:148
static NetworkText GetInvasionWaveText(int wave, params short[] npcIds)
Definition Lang.cs:1112
static Color GetColor(Point tileCoords)
Definition Lighting.cs:182
static void AddLight(Vector2 position, Vector3 rgb)
Definition Lighting.cs:137
static LocalizedText[] FindAll(Regex regex)
Definition Language.cs:55
static LocalizedText RandomFromCategory(string categoryName, UnifiedRandom random=null)
Definition Language.cs:70
static LocalizedText SelectRandom(LanguageSearchFilter filter, UnifiedRandom random=null)
Definition Language.cs:65
static string GetTextValue(string key)
Definition Language.cs:15
static string GetTextValueWith(string key, object obj)
Definition Language.cs:40
static readonly LocalizedText Empty
static readonly NetworkText Empty
static NetworkText FromLiteral(string text)
static NetworkText FromKey(string key, params object[] substitutions)
static bool AnyActiveBossNPC
Definition Main.cs:93
static bool IsItAHappyWindyDay
Definition Main.cs:2869
static int invasionProgressIcon
Definition Main.cs:1986
static int wofDrawAreaBottom
Definition Main.cs:832
static bool halloween
Definition Main.cs:688
static int npcStreamSpeed
Definition Main.cs:433
static bool[] tileDungeon
Definition Main.cs:1465
static float windSpeedCurrent
Definition Main.cs:1360
static bool raining
Definition Main.cs:1310
static double time
Definition Main.cs:1284
static bool slimeRain
Definition Main.cs:1166
static float bottomWorld
Definition Main.cs:1112
static int maxTilesY
Definition Main.cs:1116
static float cloudAlpha
Definition Main.cs:1302
static int spawnTileY
Definition Main.cs:1811
static float windSpeedTarget
Definition Main.cs:1362
static bool[] tileSolidTop
Definition Main.cs:1469
static bool[] npcCatchable
Definition Main.cs:1655
static double invasionX
Definition Main.cs:1972
static Chest[] chest
Definition Main.cs:1699
static int[] npcFrameCount
Definition Main.cs:2002
static Item[] item
Definition Main.cs:1681
static int invasionSizeStart
Definition Main.cs:1980
static bool[] slimeRainNPC
Definition Main.cs:1162
static bool anglerQuestFinished
Definition Main.cs:1847
static double worldSurface
Definition Main.cs:1272
static int numClouds
Definition Main.cs:1356
static int myPlayer
Definition Main.cs:1801
static int DiscoR
Definition Main.cs:1062
static int netMode
Definition Main.cs:2095
static double rockLayer
Definition Main.cs:1274
static bool[] wallDungeon
Definition Main.cs:1443
static Gore[] gore
Definition Main.cs:1687
static bool[] wallHouse
Definition Main.cs:1441
static void ReportInvasionProgress(int progress, int progressMax, int icon, int progressWave)
Definition Main.cs:44714
static bool expertMode
Definition Main.cs:2737
static bool masterMode
Definition Main.cs:2717
static bool dayTime
Definition Main.cs:1282
static bool dedServ
Definition Main.cs:1226
static double CalculateDamageNPCsTake(int Damage, int Defense)
Definition Main.cs:62895
static int wofNPCIndex
Definition Main.cs:828
static int[] projFrames
Definition Main.cs:1326
static bool IsItDay()
Definition Main.cs:59621
static bool bloodMoon
Definition Main.cs:1296
static bool zenithWorld
Definition Main.cs:353
static bool xMas
Definition Main.cs:686
static float WindForVisuals
Definition Main.cs:2827
static double timeForVisualEffects
Definition Main.cs:1286
static int slimeRainKillCount
Definition Main.cs:1168
static Main instance
Definition Main.cs:283
static bool AnyPlayerReadyToFightKingSlime()
Definition Main.cs:61878
static int DamageVar(float dmg, float luck=0f)
Definition Main.cs:62870
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static int moonPhase
Definition Main.cs:1288
static void StartInvasion(int type=1)
Definition Main.cs:61241
static byte mouseTextColor
Definition Main.cs:1751
static void StopSlimeRain(bool announce=true)
Definition Main.cs:61545
static void NewText(string newText, byte R=byte.MaxValue, byte G=byte.MaxValue, byte B=byte.MaxValue)
Definition Main.cs:61429
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
static int maxTilesX
Definition Main.cs:1114
static short[] tileOreFinderPriority
Definition Main.cs:1475
static int dungeonX
Definition Main.cs:1218
static bool[] tileSand
Definition Main.cs:1651
static int DiscoG
Definition Main.cs:1066
static int LogicCheckScreenWidth
Definition Main.cs:1896
static bool getGoodWorld
Definition Main.cs:341
static bool[] tileSolid
Definition Main.cs:1471
static Tile[,] tile
Definition Main.cs:1675
static BestiaryUnlocksTracker BestiaryTracker
Definition Main.cs:1868
static int spawnTileX
Definition Main.cs:1809
static int dungeonY
Definition Main.cs:1220
static bool eclipse
Definition Main.cs:1312
static Projectile[] projectile
Definition Main.cs:1691
static GameModeData GameModeInfo
Definition Main.cs:2682
static int invasionType
Definition Main.cs:1970
static int invasionDelay
Definition Main.cs:1976
static int DiscoB
Definition Main.cs:1064
static ItemDropResolver ItemDropSolver
Definition Main.cs:1866
static int LogicCheckScreenHeight
Definition Main.cs:1898
static UnifiedRandom rand
Definition Main.cs:1387
static int worldID
Definition Main.cs:1262
static NPC[] npc
Definition Main.cs:1685
static int multiplayerNPCSmoothingRange
Definition Main.cs:1731
static bool dontStarveWorld
Definition Main.cs:345
static float slimeRainNPCSlots
Definition Main.cs:1160
static int[] timeItemSlotCannotBeReusedFor
Definition Main.cs:1683
static bool tenthAnniversaryWorld
Definition Main.cs:343
static double slimeRainTime
Definition Main.cs:1164
static bool[] wallLight
Definition Main.cs:1445
static int invasionProgress
Definition Main.cs:1988
static int dayRate
Definition Main.cs:746
static int screenWidth
Definition Main.cs:1719
static float cloudBGActive
Definition Main.cs:628
static bool drunkWorld
Definition Main.cs:339
static int UnderworldLayer
Definition Main.cs:2825
static int invasionProgressMax
Definition Main.cs:1990
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static bool snowMoon
Definition Main.cs:1300
static bool pumpkinMoon
Definition Main.cs:1298
static int mouseY
Definition Main.cs:606
static bool[] tileFrameImportant
Definition Main.cs:1495
static int wofDrawAreaTop
Definition Main.cs:830
static Player LocalPlayer
Definition Main.cs:2829
static AnchoredEntitiesCollection sittingManager
Definition Main.cs:2255
static bool hardMode
Definition Main.cs:1022
static int ladyBugRainBoost
Definition Main.cs:2605
static Player[] player
Definition Main.cs:1803
static int mouseX
Definition Main.cs:604
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static int invasionSize
Definition Main.cs:1974
static bool[] debuff
Definition Main.cs:784
static bool IsItStorming
Definition Main.cs:2871
static bool remixWorld
Definition Main.cs:349
static Dust[] dust
Definition Main.cs:1677
static Dictionary< int, GameModeData > RegisteredGameModes
Definition Main.cs:315
static void TeleportEffect(Microsoft.Xna.Framework.Rectangle effectRect, int Style, int extraInfo=0, float dustCountMult=1f, TeleportationSide side=TeleportationSide.Entry, Vector2 otherPosition=default(Vector2))
Definition Main.cs:12270
int breath
Definition NPC.cs:565
bool HasGivenName
Definition NPC.cs:746
bool boss
Definition NPC.cs:515
Vector2 netOffset
Definition NPC.cs:103
static bool Spawning_FlyingAntlionCheck(int x, int y)
Definition NPC.cs:72524
static bool FindTreeBranch(int landX, int landY, out int treeBranchX, out int treeBranchY)
Definition NPC.cs:76980
void AI_114_Dragonflies()
Definition NPC.cs:40930
NPCSpawnParams GetMatchingSpawnParams()
Definition NPC.cs:12140
void AI_117_BloodNautilus()
Definition NPC.cs:40338
void UpdateNPC_CritterSounds()
Definition NPC.cs:88944
void AI_026_Unicorns()
Definition NPC.cs:54580
static void SpawnNPC_SpawnFrog(int spawnTileX, int spawnTileY, int plr)
Definition NPC.cs:76766
void AI_123_Deerclops_TryMakingSpike(ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset)
Definition NPC.cs:37690
int[] immune
Definition NPC.cs:441
static bool GetNPCLocation(int i, bool seekHead, bool averageDirection, out int index, out Vector2 pos)
Definition NPC.cs:12664
int timeLeft
Definition NPC.cs:457
static bool downedChristmasSantank
Definition NPC.cs:379
void SetDefaults(int Type, NPCSpawnParams spawnparams=default(NPCSpawnParams))
Definition NPC.cs:2523
bool dontCountMe
Definition NPC.cs:209
bool drippingSparkleSlime
Definition NPC.cs:93
static int ladyBugBadLuckTime
Definition NPC.cs:628
static int GetDestroyerSegmentsCount()
Definition NPC.cs:44202
float GetMyBalance()
Definition NPC.cs:12262
void GetTileCollisionParameters(out Vector2 cPosition, out int cWidth, out int cHeight)
Definition NPC.cs:89517
int checkArmorPenetration(int armorPenetration, float armorPenetrationPercent)
Definition NPC.cs:77993
void FindFrame()
Definition NPC.cs:59052
bool netAlways
Definition NPC.cs:171
static bool downedTowerSolar
Definition NPC.cs:385
void TargetClosestUpgraded(bool faceTarget=true, Vector2? checkPosition=null)
Definition NPC.cs:69833
static int TypeToDefaultHeadIndex(int type)
Definition NPC.cs:1651
bool SupportsNPCTargets
Definition NPC.cs:704
string FullName
Definition NPC.cs:735
void SpawnWithHigherTime(int timeMult)
Definition NPC.cs:1385
bool dryadBane
Definition NPC.cs:275
static CoinLossRevengeSystem RevengeManager
Definition NPC.cs:439
bool CanTalk
Definition NPC.cs:641
void Collision_MoveSnailOnSlopes()
Definition NPC.cs:89414
void UpdateNPC_BuffApplyDOTs()
Definition NPC.cs:88284
static int maxAttack
Definition NPC.cs:133
void HealEffect(int healAmount, bool broadcast=true)
Definition NPC.cs:69617
static string GetFullnameByID(int npcID)
Definition NPC.cs:1036
static int townRangeY
Definition NPC.cs:195
static bool fairyLog
Definition NPC.cs:616
void CheckDrowning()
Definition NPC.cs:91557
static bool downedFrost
Definition NPC.cs:357
int FindBuffIndex(int type)
Definition NPC.cs:86730
void ScaleStats_ApplyGameMode(GameModeData gameModeData)
Definition NPC.cs:12340
int netSpam
Definition NPC.cs:67
static bool savedAngler
Definition NPC.cs:293
void AI_003_Fighters()
Definition NPC.cs:48965
static void ResetNetOffsets()
Definition NPC.cs:87083
int defense
Definition NPC.cs:463
void AI_110_Betsy()
Definition NPC.cs:54095
static bool noSpawnCycle
Definition NPC.cs:199
void NPCLoot()
Definition NPC.cs:71114
static void GiveTownUniqueDataToNPCsThatNeedIt(int Type, int nextNPC)
Definition NPC.cs:77728
void UpdateNPC_BuffSetFlags(bool lowerBuffTime=true)
Definition NPC.cs:88727
int damage
Definition NPC.cs:461
const int NaturalMoonlordCountdownTime
Definition NPC.cs:55
bool ShouldFaceTarget(ref NPCUtils.TargetSearchResults searchResults, NPCUtils.TargetType? overrideTargetType=null)
Definition NPC.cs:69788
void ScaleStats_ApplyExpertTweaks()
Definition NPC.cs:12289
void SpawnStardustMark_StardustWorm()
Definition NPC.cs:37033
bool HittableForOnHitRewards()
Definition NPC.cs:86861
NetworkText GetTypeNetName()
Definition NPC.cs:1468
Color GetMagicAuraColor()
Definition NPC.cs:46208
bool ShouldBestiaryGirlBeLycantrope()
Definition NPC.cs:90417
int GetAttackDamage_ForProjectiles_MultiLerp(float normalDamage, float expertDamage, float masterDamage)
Definition NPC.cs:1092
static bool AnyHelpfulFairies()
Definition NPC.cs:86677
static int CountNPCS(int Type)
Definition NPC.cs:86664
bool immortal
Definition NPC.cs:261
static int stinkBugChance
Definition NPC.cs:147
float[] localAI
Definition NPC.cs:449
int spriteDirection
Definition NPC.cs:517
static bool SpawnAllowed_Nurse()
Definition NPC.cs:1194
bool CountsAsACritter
Definition NPC.cs:853
bool chaseable
Definition NPC.cs:263
static int spawnRangeY
Definition NPC.cs:183
static string firstNPCName(int npcType)
Definition NPC.cs:1537
float Opacity
Definition NPC.cs:810
bool DoesntDespawnToInactivity()
Definition NPC.cs:70062
static void UpdateFoundActiveNPCs()
Definition NPC.cs:1265
bool teleporting
Definition NPC.cs:131
bool ForcePartyHatOn
Definition NPC.cs:35
static bool boughtCat
Definition NPC.cs:301
static void ResetRemixHax()
Definition NPC.cs:72554
static void OnGameEventClearedForTheFirstTime(int gameEventId)
Definition NPC.cs:71087
bool HasLuckTextForWizard(out string specialEventText)
Definition NPC.cs:91500
int oldTarget
Definition NPC.cs:499
bool confused
Definition NPC.cs:253
static bool unlockedSlimeRainbowSpawn
Definition NPC.cs:315
void AI_107_ImprovedWalkers()
Definition NPC.cs:55138
static bool downedTowers
Definition NPC.cs:773
static bool unlockedSlimeGreenSpawn
Definition NPC.cs:309
static bool downedTowerVortex
Definition NPC.cs:387
static bool downedMechBoss2
Definition NPC.cs:425
void AI_001_SetRainbowSlimeColor()
Definition NPC.cs:54011
void AI_120_HallowBoss_DashTo(Vector2 targetPosition)
Definition NPC.cs:40154
bool onFire2
Definition NPC.cs:227
bool venom
Definition NPC.cs:239
void Teleport(Vector2 newPos, int Style=0, int extraInfo=0)
Definition NPC.cs:77888
static int FindFrame_FromSequence(int sequenceFrame, int[] frames)
Definition NPC.cs:69556
float lavaMovementSpeed
Definition NPC.cs:39
static int goldCritterChance
Definition NPC.cs:69
bool AI_007_TownEntities_CheckIfWillDrown(bool currentlyDrowning)
Definition NPC.cs:48887
static bool downedFishron
Definition NPC.cs:369
void DiscourageDespawn(int despawnTime)
Definition NPC.cs:1399
bool stinky
Definition NPC.cs:257
void CheckProgressPumpkinMoon()
Definition NPC.cs:70892
static bool MechSpawn(float x, float y, int type)
Definition NPC.cs:1561
static bool unlockedSlimePurpleSpawn
Definition NPC.cs:313
static bool NearSpikeBall(int x, int y)
Definition NPC.cs:86713
static int ShieldStrengthTowerNebula
Definition NPC.cs:403
void EncourageDespawn(int despawnTime)
Definition NPC.cs:1390
int friendlyRegen
Definition NPC.cs:563
static bool savedTaxCollector
Definition NPC.cs:285
void Collision_MoveSandshark(bool fall, Vector2 cPosition, int cWidth, int cHeight)
Definition NPC.cs:89438
void AI_045_Golem()
Definition NPC.cs:13310
static int MoonLordFightingDistance
Definition NPC.cs:49
static void SpawnBoss(int spawnPositionX, int spawnPositionY, int Type, int targetPlayerIndex)
Definition NPC.cs:77584
bool soulDrain
Definition NPC.cs:243
bool Boss_CanShootExtraAt(int playerIndex, int rotationIndexToAttack, int rotationSize, float attackScanDistance, bool alwaysSkipMainTarget=true)
Definition NPC.cs:40172
static bool downedBoss2
Definition NPC.cs:347
int aiAction
Definition NPC.cs:451
void AI_001_Slimes()
Definition NPC.cs:53292
static void CatchNPC(int i, int who=-1)
Definition NPC.cs:72128
bool oldHomeless
Definition NPC.cs:549
static int maximumAmountOfTimesLadyBugRainCanStack
Definition NPC.cs:632
bool poisoned
Definition NPC.cs:235
static readonly int maxBuffs
Definition NPC.cs:211
void TweakSwingStats(int swingMax, int swingCurrent, int aimDir, ref Rectangle itemRectangle)
Definition NPC.cs:58967
static void setFireFlyChance()
Definition NPC.cs:90049
static int waveNumber
Definition NPC.cs:77
static int ShieldStrengthTowerSolar
Definition NPC.cs:399
void AI_124_DeerclopsLeg()
Definition NPC.cs:37843
static bool savedGolfer
Definition NPC.cs:299
static bool WoFKilledToday
Definition NPC.cs:614
void AI_108_DivingFlyer()
Definition NPC.cs:57725
bool reflectsProjectiles
Definition NPC.cs:571
bool Collision_DecideFallThroughPlatforms()
Definition NPC.cs:89645
int lifeMax
Definition NPC.cs:479
static int crimsonBoss
Definition NPC.cs:165
int lifeRegenExpectedLossPerSecond
Definition NPC.cs:251
bool dryadWard
Definition NPC.cs:259
string GivenName
Definition NPC.cs:761
static int ignorePlayerInteractions
Definition NPC.cs:624
bool CanApplyHunterPotionEffects()
Definition NPC.cs:87774
static int SpawnNPC_SpawnLavaBaitCritters(int spawnTileX, int spawnTileY)
Definition NPC.cs:76889
static int ShieldStrengthTowerMax
Definition NPC.cs:785
void AI_109_DarkMage()
Definition NPC.cs:58162
void BigMimicSpawnSmoke()
Definition NPC.cs:69678
static bool TowerActiveStardust
Definition NPC.cs:417
bool closeDoor
Definition NPC.cs:557
static bool SpawnAllowed_Demolitionist()
Definition NPC.cs:1103
static void HaveDryadDoStardewAnimation()
Definition NPC.cs:12987
IEntitySource GetSpawnSource_NPCHurt()
Definition NPC.cs:87521
string TypeName
Definition NPC.cs:732
bool markedByScytheWhip
Definition NPC.cs:237
void Collision_MoveNormal(bool fall, Vector2 cPosition, int cWidth, int cHeight)
Definition NPC.cs:89433
float gfxOffY
Definition NPC.cs:125
Color GetAlpha(Color newColor)
Definition NPC.cs:90103
static readonly int[] _deerclopsAttack3Frames
Definition NPC.cs:599
void moneyPing(Vector2 pos)
Definition NPC.cs:86870
void AI_120_HallowBoss()
Definition NPC.cs:39149
void ApplyTileCollision(bool fall, Vector2 cPosition, int cWidth, int cHeight)
Definition NPC.cs:89320
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:69934
int aiStyle
Definition NPC.cs:453
int breathCounter
Definition NPC.cs:569
static int butterflyChance
Definition NPC.cs:145
static int[] killCount
Definition NPC.cs:71
void TryTrackingTarget(ref float distance, ref float realDist, ref bool t, ref int tankTarget, int j)
Definition NPC.cs:69966
static int safeRangeY
Definition NPC.cs:187
static readonly int[,] MoonLordAttacksArray2
Definition NPC.cs:47
NetworkText GetFullNetName()
Definition NPC.cs:1490
static bool savedMech
Definition NPC.cs:291
static bool unlockedMerchantSpawn
Definition NPC.cs:323
bool coldDamage
Definition NPC.cs:469
static Color AI_121_QueenSlime_GetDustColor()
Definition NPC.cs:38257
Vector2 GetMechQueenCenter()
Definition NPC.cs:44211
float GetMoonEventPointScalar()
Definition NPC.cs:70729
static readonly int AFKTimeNeededForNoWorms
Definition NPC.cs:95
static int FindFirstNPC(int Type)
Definition NPC.cs:86701
bool ichor
Definition NPC.cs:223
void UpdateNPC_BuffApplyVFX()
Definition NPC.cs:87875
static int spawnSpaceX
Definition NPC.cs:121
bool AI_120_HallowBoss_IsGenuinelyEnraged()
Definition NPC.cs:39019
static bool SpawnAllowed_ArmsDealer()
Definition NPC.cs:1128
bool setFrameSize
Definition NPC.cs:159
bool isLikeATownNPC
Definition NPC.cs:822
Rectangle getRect()
Definition NPC.cs:86847
static bool ShouldEmpressBeEnraged()
Definition NPC.cs:39121
float takenDamageMultiplier
Definition NPC.cs:117
static void UpdateRGBPeriheralProbe()
Definition NPC.cs:1286
int AI_123_Deerclops_TryMakingSpike_FindBestY(ref Point sourceTileCoords, int x)
Definition NPC.cs:37703
static bool unlockedSlimeBlueSpawn
Definition NPC.cs:307
bool hide
Definition NPC.cs:491
static bool downedMechBossAny
Definition NPC.cs:421
void SetDefaults_ForNetId(int Type, float scaleOverride)
Definition NPC.cs:2502
void GetShimmered()
Definition NPC.cs:88207
void AI_123_Deerclops_Movement(bool haltMovement, bool goHome)
Definition NPC.cs:37760
static int ladyBugRainTime
Definition NPC.cs:630
static bool downedEmpressOfLight
Definition NPC.cs:393
void AI_121_QueenSlime_FlyMovement()
Definition NPC.cs:38264
void DropTombstoneTownNPC(NetworkText deathText)
Definition NPC.cs:70568
int townNpcVariationIndex
Definition NPC.cs:101
int oldHomeTileX
Definition NPC.cs:551
int BannerID()
Definition NPC.cs:1786
bool netUpdate2
Definition NPC.cs:509
static void SpawnWOF(Vector2 pos)
Definition NPC.cs:77086
void AI_111_DD2LightningBug()
Definition NPC.cs:58563
static int[,] cavernMonsterType
Definition NPC.cs:579
void UpdateHomeTileState(bool homeless, int x, int y)
Definition NPC.cs:46195
static int FindFrame_Deerclops_GetAttack2Frame(int sequenceFrame)
Definition NPC.cs:69571
void AI_112_FairyCritter()
Definition NPC.cs:41303
static int GetEaterOfWorldsSegmentsCount()
Definition NPC.cs:44171
static float gravity
Definition NPC.cs:129
static bool unlockedDyeTraderSpawn
Definition NPC.cs:329
int GetShootingFrame(float circleY)
Definition NPC.cs:58831
bool canDisplayBuffs
Definition NPC.cs:219
static bool savedWizard
Definition NPC.cs:289
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:864
static int GetAvailableNPCSlot(int Type, int startIndex)
Definition NPC.cs:77700
bool CanBeReplacedByOtherNPCs
Definition NPC.cs:87
void DropItemInstanced(Vector2 Position, Vector2 HitboxSize, int itemType, int itemStack=1, bool interactionRequired=true)
Definition NPC.cs:72167
bool despawnEncouraged
Definition NPC.cs:575
float GetLifePercent()
Definition NPC.cs:1484
static int[] MoonEventRequiredPointsPerWaveLookup
Definition NPC.cs:605
static void ResetBadgerHatTime()
Definition NPC.cs:71189
static bool travelNPC
Definition NPC.cs:539
static bool downedHalloweenKing
Definition NPC.cs:373
void AI_87_BigMimic_FireStuffCannonBurst()
Definition NPC.cs:37940
float[] oldRot
Definition NPC.cs:157
bool AI_003_Gnomes_ShouldTurnToStone()
Definition NPC.cs:48952
bool dontTakeDamageFromHostiles
Definition NPC.cs:279
bool netShimmer
Definition NPC.cs:577
static bool boughtDog
Definition NPC.cs:303
void DoDeathEvents_AdvanceSlimeRain(Player closestPlayer)
Definition NPC.cs:71346
bool noGravity
Definition NPC.cs:503
string GivenOrTypeName
Definition NPC.cs:749
bool oiled
Definition NPC.cs:283
static int MaxMoonLordCountdown
Definition NPC.cs:53
static int townRangeX
Definition NPC.cs:193
float waterMovementSpeed
Definition NPC.cs:37
static void ResetKillCount()
Definition NPC.cs:71033
static bool downedBoss1
Definition NPC.cs:345
static int fireFlyChance
Definition NPC.cs:141
float shimmerMovementSpeed
Definition NPC.cs:43
void CountKillForAchievements()
Definition NPC.cs:72070
int[] buffTime
Definition NPC.cs:215
void TargetClosest_WOF(bool faceTarget=true)
Definition NPC.cs:69950
int defDefense
Definition NPC.cs:467
string GetChat()
Definition NPC.cs:90430
static bool downedSlimeKing
Definition NPC.cs:353
bool needsUniqueInfoUpdate
Definition NPC.cs:153
void PopAllAttachedProjectilesAndTakeDamageForThem()
Definition NPC.cs:12848
void getGoodAdjustments()
Definition NPC.cs:11963
static bool unlockedPrincessSpawn
Definition NPC.cs:337
bool TryTeleportingCaughtMysticFrog()
Definition NPC.cs:72101
static bool RerollVariationForNPCType(int npcType)
Definition NPC.cs:77773
void UpdateNPC_CastLights()
Definition NPC.cs:89049
static int spawnRangeX
Definition NPC.cs:181
float[] ai
Definition NPC.cs:447
bool SpawnedFromStatue
Definition NPC.cs:85
static int GetStackForSlimeItemDrop(int item)
Definition NPC.cs:71958
Color GetShimmerColor(Color newColor)
Definition NPC.cs:90353
static int GetEaterOfWorldsSegmentsCountByGamemode(int gamemode)
Definition NPC.cs:44180
static bool savedGoblin
Definition NPC.cs:287
static int SpawnNPC_TryFindingProperGroundTileType(int spawnTileType, int x, int y)
Definition NPC.cs:76918
int oldDirectionY
Definition NPC.cs:497
void CheckProgressFrostMoon()
Definition NPC.cs:70742
static bool TowerActiveVortex
Definition NPC.cs:413
static int[,] InitializeMoonLordAttacks2()
Definition NPC.cs:995
void AI_87_BigMimic_ShootItem(int itemID)
Definition NPC.cs:37950
void CreateBrickBoxForWallOfFlesh()
Definition NPC.cs:71302
int extraValue
Definition NPC.cs:525
static int GetNPCInvasionGroup(int npcID)
Definition NPC.cs:70596
static int defaultSpawnRate
Definition NPC.cs:203
int doorX
Definition NPC.cs:559
void AttemptToConvertNPCToEvil(bool crimson)
Definition NPC.cs:88690
void FaceTarget()
Definition NPC.cs:69827
bool AI_007_TownEntities_IsInAGoodRestingSpot(int tileX, int tileY, int idealRestX, int idealRestY)
Definition NPC.cs:46069
static int sWidth
Definition NPC.cs:177
static bool unlockedTruffleSpawn
Definition NPC.cs:331
static bool empressRageMode
Definition NPC.cs:585
static void SpawnFaelings(int plr)
Definition NPC.cs:77231
static bool taxCollector
Definition NPC.cs:111
Rectangle targetRect
Definition NPC.cs:481
static bool IsDeerclopsHostile()
Definition NPC.cs:37117
const float nameOverDistance
Definition NPC.cs:81
static bool combatBookWasUsed
Definition NPC.cs:339
bool HasPlayerTarget
Definition NPC.cs:681
static IEntitySource GetSpawnSource_NPCCatch(int whoCatchedIt)
Definition NPC.cs:87516
void getZenithSeedAdjustmentsBeforeEverything()
Definition NPC.cs:11954
bool midas
Definition NPC.cs:221
static readonly int[] _deerclopsAttack1Frames
Definition NPC.cs:587
void AI_123_Deerclops_FindSpotToSpawnSpike(int howMany, int whichOne, ref int x, ref int y)
Definition NPC.cs:37654
int housingCategory
Definition NPC.cs:547
float strengthMultiplier
Definition NPC.cs:535
void AI_002_FloatingEye()
Definition NPC.cs:45577
static int maxSpawns
Definition NPC.cs:435
void NPCLoot_DropMoney(Player closestPlayer)
Definition NPC.cs:71825
static bool FindCattailTop(int landX, int landY, out int cattailX, out int cattailY)
Definition NPC.cs:76951
static bool[] ShimmeredTownNPCs
Definition NPC.cs:97
void UpdateNPC_BuffFlagsReset()
Definition NPC.cs:88861
void NPCLoot_DropCommonLifeAndMana(Player closestPlayer)
Definition NPC.cs:71806
static bool downedTowerStardust
Definition NPC.cs:391
int homeTileX
Definition NPC.cs:543
static int LunarShieldPowerNormal
Definition NPC.cs:407
float knockBackResist
Definition NPC.cs:495
int doorY
Definition NPC.cs:561
bool GetFairyTreasureCoords(out Point treasureCoords)
Definition NPC.cs:41935
void DoDeathEvents_SummonDungeonSpirit(Player closestPlayer)
Definition NPC.cs:71330
static float totalInvasionPoints
Definition NPC.cs:73
static bool unlockedSlimeRedSpawn
Definition NPC.cs:317
void GetBirdFlightRecommendation(int downScanRange, int upRange, Point tCoords, out bool goDownwards, out bool goUpwards)
Definition NPC.cs:41905
bool dontTakeDamage
Definition NPC.cs:527
static bool downedMechBoss3
Definition NPC.cs:427
void CountKillForBannersAndDropThem()
Definition NPC.cs:72016
void ApplyInteraction(int player)
Definition NPC.cs:72285
static int LunarShieldPowerMax
Definition NPC.cs:409
static bool BusyWithAnyInvasionOfSorts()
Definition NPC.cs:1048
static void HealEffect(Rectangle r, int healAmount, bool broadcast=true)
Definition NPC.cs:69622
void UpdateNetworkCode(int i)
Definition NPC.cs:87404
void SpawnPassiveShadowHands(float lifePercent, int shadowHandDamage)
Definition NPC.cs:37533
void SetFrameSize()
Definition NPC.cs:59042
static int ShieldStrengthTowerStardust
Definition NPC.cs:405
static int ReleaseNPC(int x, int y, int Type, int Style, int who)
Definition NPC.cs:72344
void AI_047_GolemFist()
Definition NPC.cs:13035
bool friendly
Definition NPC.cs:555
void AI_007_TownEntities()
Definition NPC.cs:46226
static bool downedPirates
Definition NPC.cs:359
static int ShieldStrengthTowerVortex
Definition NPC.cs:401
float stepSpeed
Definition NPC.cs:127
void NPCLoot_DropItems(Player closestPlayer)
Definition NPC.cs:71176
void AI_007_TownEntities_Shimmer_TeleportToLandingSpot()
Definition NPC.cs:48702
static bool downedMoonlord
Definition NPC.cs:383
static void SlimeRainSpawns(int plr)
Definition NPC.cs:72410
float value
Definition NPC.cs:523
void CheckActive()
Definition NPC.cs:70168
void LazySetLiquidMovementDD2()
Definition NPC.cs:12099
double StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
Definition NPC.cs:78024
static bool IsValidSpawningGroundTile(int x, int y)
Definition NPC.cs:76933
static bool unlockedPartyGirlSpawn
Definition NPC.cs:327
static bool freeCake
Definition NPC.cs:119
void UpdateNPC_UpdateTrails()
Definition NPC.cs:87556
static bool PreventJojaColaDialog
Definition NPC.cs:636
static bool IsMechQueenUp
Definition NPC.cs:834
void AI_065_Butterflies()
Definition NPC.cs:38028
void SetDefaultsKeepPlayerInteraction(int Type)
Definition NPC.cs:2488
static float GetBalance()
Definition NPC.cs:12256
bool onFire
Definition NPC.cs:225
static bool BigMimicSummonCheck(int x, int y, Player user)
Definition NPC.cs:69701
void TryPortalJumping()
Definition NPC.cs:91611
bool GetWereThereAnyInteractions()
Definition NPC.cs:72060
float scale
Definition NPC.cs:493
void AI_007_TownEntities_GetWalkPrediction(int myTileX, int homeFloorX, bool canBreathUnderWater, bool currentlyDrowning, int tileX, int tileY, out bool keepwalking, out bool avoidFalling)
Definition NPC.cs:48813
static bool DespawnEncouragement_AIStyle2_FloatingEye_IsDiscouraged(int npcID, Vector2 npcPosition, int target=255)
Definition NPC.cs:46056
static bool AnyDanger(bool quickBossNPCCheck=false, bool ignorePillarsAndMoonlordCountdown=false)
Definition NPC.cs:77014
bool trapImmune
Definition NPC.cs:471
static string GetFirstNPCNameOrNull(int npcType)
Definition NPC.cs:1549
int lifeRegen
Definition NPC.cs:247
bool betsysCurse
Definition NPC.cs:281
static int spawnRate
Definition NPC.cs:433
static bool TowerActiveSolar
Definition NPC.cs:411
bool CanBeChasedBy(object attacker=null, bool ignoreDontTakeDamage=false)
Definition NPC.cs:86852
void CopyInteractions(NPC npc)
Definition NPC.cs:44162
void AI_119_Dandelion()
Definition NPC.cs:40194
bool collideX
Definition NPC.cs:511
bool collideY
Definition NPC.cs:513
void Collision_MoveSolarSroller(bool fall, Vector2 cPosition, int cWidth, int cHeight)
Definition NPC.cs:89446
void NPCLoot_DropHeals(Player closestPlayer)
Definition NPC.cs:71364
static bool AnyNPCs(int Type)
Definition NPC.cs:86689
static int SpawnNPC_GetGemBunnyToSpawn()
Definition NPC.cs:76782
static int FindFrame_Deerclops_GetAttack1Frame(int sequenceFrame)
Definition NPC.cs:69566
void SetNetShimmerEffect()
Definition NPC.cs:2517
int type
Definition NPC.cs:445
static void TransformCopperSlime(int npcIndex)
Definition NPC.cs:12960
static bool SpawnNPC_CheckToSpawnUndergroundFairy(int spawnTileX, int spawnTileY, int plr)
Definition NPC.cs:76859
void GetLifeStats(out int statLife, out int statLifeMax)
Definition NPC.cs:1473
void AI_069_DukeFishron()
Definition NPC.cs:41994
bool HasValidTarget
Definition NPC.cs:665
void AI_124_ElderSlimeChest()
Definition NPC.cs:36807
static int GetActivePlayerCount()
Definition NPC.cs:12272
void AI_121_QueenSlime()
Definition NPC.cs:38340
int GetAttackDamage_LerpBetweenFinalValues(float normalDamage, float expertDamage)
Definition NPC.cs:1072
int alpha
Definition NPC.cs:489
static int safeRangeX
Definition NPC.cs:185
Color color
Definition NPC.cs:487
const int NPC_TARGETS_START
Definition NPC.cs:31
bool ExcludedFromDeathTally()
Definition NPC.cs:71999
void AI_120_HallowBoss_DoMagicEffect(Vector2 spot, int effectType, float progress)
Definition NPC.cs:39028
static int maxAI
Definition NPC.cs:65
LegacySoundStyle DeathSound
Definition NPC.cs:475
bool DoesntDespawnToInactivityAndCountsNPCSlots()
Definition NPC.cs:70057
IEntitySource GetSpawnSourceForProjectileNPC()
Definition NPC.cs:87531
static bool CanReleaseNPCs(int who)
Definition NPC.cs:72308
static bool IsADeerclopsNearScreen()
Definition NPC.cs:37649
void ScaleStats_ApplyMultiplayerStats(int numPlayers, float balance, float boost, float bossAdjustment)
Definition NPC.cs:12357
bool[] playerInteraction
Definition NPC.cs:113
NetworkText GetGivenOrTypeNetName()
Definition NPC.cs:1499
void UpdateNPC(int i)
Definition NPC.cs:87092
int altTexture
Definition NPC.cs:99
static void SetRemixHax()
Definition NPC.cs:72561
static bool downedQueenBee
Definition NPC.cs:351
static bool downedHalloweenTree
Definition NPC.cs:371
double StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
Definition NPC.cs:78015
void Collision_WalkDownSlopes()
Definition NPC.cs:90039
static int RollDragonflyType(int tileType=2)
Definition NPC.cs:72545
static Color buffColor(Color newColor, float R, float G, float B, float A)
Definition NPC.cs:87765
Color GetBestiaryEntryColor()
Definition NPC.cs:90098
bool RerollVariation()
Definition NPC.cs:77786
static void FairyEffects(Vector2 Position, int type)
Definition NPC.cs:41872
bool AnyInteractions()
Definition NPC.cs:71041
void TransformVisuals(int oldType, int newType)
Definition NPC.cs:77816
static bool downedChristmasTree
Definition NPC.cs:377
static bool WouldBeEncouragedToDespawn(int aistyle, int type)
Definition NPC.cs:1408
int GetBossHeadTextureIndex()
Definition NPC.cs:1698
static int RerollDryadText
Definition NPC.cs:638
float rotation
Definition NPC.cs:501
bool IsDamageDodgeable()
Definition NPC.cs:71063
bool bloodButchered
Definition NPC.cs:271
static string getNewNPCNameInner(int npcType)
Definition NPC.cs:1422
static int deerclopsBoss
Definition NPC.cs:167
static bool unlockedSlimeOldSpawn
Definition NPC.cs:311
bool UsesPartyHat()
Definition NPC.cs:58991
static bool downedGoblins
Definition NPC.cs:355
static float waveKills
Definition NPC.cs:75
void AI_122_PirateGhost()
Definition NPC.cs:37975
bool AI_AttemptToFindTeleportSpot(ref Vector2 chosenTile, int targetTileX, int targetTileY, int rangeFromTargetTile=20, int telefragPreventionDistanceInTiles=5, int solidTileCheckFluff=1, bool solidTileCheckCentered=false, bool teleportInAir=false)
Definition NPC.cs:12861
static readonly int[] _deerclopsAttack2Frames
Definition NPC.cs:593
void AI_000_TransformBoundNPC(int playerID, int npcType)
Definition NPC.cs:38017
bool behindTiles
Definition NPC.cs:519
string GetBestiaryCreditId()
Definition NPC.cs:91802
void DelBuff(int buffIndex)
Definition NPC.cs:86824
static int AI_001_Slimes_GenerateItemInsideBody(bool isBallooned)
Definition NPC.cs:54020
void SubAI_HandleTemporaryCatchableNPCPlayerInvulnerability()
Definition NPC.cs:87370
void DoDeathEvents_CelebrateBossDeath()
Definition NPC.cs:71268
static void SpawnSkeletron(int onWho)
Definition NPC.cs:77174
static int FindFrame_Deerclops_GetAttack3Frame(int sequenceFrame)
Definition NPC.cs:69576
const float nameOverIncrement
Definition NPC.cs:79
static int[] attackNPC
Definition NPC.cs:135
Vector2 GetFairyCircleOffset(float elapsedTime, float circleRotation, float circleHeight)
Definition NPC.cs:41930
static bool downedClown
Definition NPC.cs:361
static bool Spawning_SandstoneCheck(int x, int y)
Definition NPC.cs:72483
double frameCounter
Definition NPC.cs:483
void AI_125_ClumsySlimeBalloon()
Definition NPC.cs:36812
IEntitySource GetSpawnSourceForNPCFromNPCAI()
Definition NPC.cs:87546
float shimmerTransparency
Definition NPC.cs:207
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)
Definition NPC.cs:77654
static void SpawnOnPlayer(int plr, int Type)
Definition NPC.cs:77311
IEntitySource GetItemSource_Misc(int itemSourceId)
Definition NPC.cs:87506
int FindClosestPlayer(out float distanceToPlayer)
Definition NPC.cs:69640
void IdleSounds()
Definition NPC.cs:86893
bool shimmering
Definition NPC.cs:245
bool lavaImmune
Definition NPC.cs:521
SpriteEffects GetBossHeadSpriteEffects()
Definition NPC.cs:1775
void AI_084_LunaticCultist()
Definition NPC.cs:56687
void AI_116_WaterStriders()
Definition NPC.cs:40732
static bool peddlersSatchelWasUsed
Definition NPC.cs:343
bool noTileCollide
Definition NPC.cs:505
void FishTransformationDuringRain()
Definition NPC.cs:89593
int defDamage
Definition NPC.cs:465
int lastInteraction
Definition NPC.cs:115
int catchableNPCTempImmunityCounter
Definition NPC.cs:529
static int offSetDelayTime
Definition NPC.cs:634
void AI_007_FindGoodRestingSpot(int myTileX, int myTileY, out int floorX, out int floorY)
Definition NPC.cs:46090
static bool SpawnMechQueen(int onWhichPlayer)
Definition NPC.cs:13579
float npcSlots
Definition NPC.cs:197
IEntitySource GetItemSource_Loot()
Definition NPC.cs:87551
void AI_037_Destroyer()
Definition NPC.cs:42979
static IEntitySource GetBossSpawnSource(int targetPlayerIndex)
Definition NPC.cs:77579
static float cloudAlphaHax
Definition NPC.cs:622
static void LadyBugKilled(Vector2 Position, bool GoldLadyBug=false)
Definition NPC.cs:78297
static bool SpawnAllowed_Merchant()
Definition NPC.cs:1211
override string ToString()
Definition NPC.cs:91807
static bool AnyoneNearCultists()
Definition NPC.cs:77061
bool Collision_LavaCollision()
Definition NPC.cs:90008
void AI_007_AttemptToPlayIdleAnimationsForPets(int petIdleChance)
Definition NPC.cs:48892
static int activeRangeX
Definition NPC.cs:189
static bool EoCKilledToday
Definition NPC.cs:612
int GetAttackDamage_ScaledByStrength(float normalDamage)
Definition NPC.cs:1057
bool stairFall
Definition NPC.cs:137
void CheckActive_WormSegments()
Definition NPC.cs:70288
void ReflectProjectile(Projectile proj)
Definition NPC.cs:58806
bool[] buffImmune
Definition NPC.cs:217
void LadyBugLuck(int plr, bool GoldLadyBug=false)
Definition NPC.cs:78331
static void ClearFoundActiveNPCs()
Definition NPC.cs:1257
void AI_113_WindyBalloon()
Definition NPC.cs:41103
void checkDead()
Definition NPC.cs:70326
static string getNewNPCName(int npcType)
Definition NPC.cs:1417
int GetAttackDamage_ForProjectiles(float normalDamage, float expertDamage)
Definition NPC.cs:1082
void BloodNautilus_CallForHelp()
Definition NPC.cs:40688
static int spawnSpaceY
Definition NPC.cs:123
static int fireFlyFriendly
Definition NPC.cs:139
static bool rainingHax
Definition NPC.cs:620
static int MoonLordCountdown
Definition NPC.cs:51
int oldHomeTileY
Definition NPC.cs:553
void AddIntoPlayersTownNPCSlots()
Definition NPC.cs:70314
void UpdateAltTexture()
Definition NPC.cs:87028
bool canGhostHeal
Definition NPC.cs:265
int netID
Definition NPC.cs:531
void Collision_MoveSlopesAndStairFall(bool fall)
Definition NPC.cs:89344
static int[] lazyNPCOwnedProjectileSearchArray
Definition NPC.cs:431
void UpdateNPC_UpdateGravity(out float maxFallSpeed)
Definition NPC.cs:87655
int netStream
Definition NPC.cs:149
static void SetEventFlagCleared(ref bool eventFlag, int gameEventId)
Definition NPC.cs:71077
bool AI_120_HallowBoss_IsInPhase2()
Definition NPC.cs:39010
static bool combatBookVolumeTwoWasUsed
Definition NPC.cs:341
void HitEffect(int hitDirection=0, double dmg=10.0)
Definition NPC.cs:78386
void AI_118_Seahorses()
Definition NPC.cs:40282
int rarity
Definition NPC.cs:109
Tuple< Vector2, float > GetSwingStats(int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight)
Definition NPC.cs:58864
bool HasSpecialEventText(string specialTextCategoryKey, out string specialEventText)
Definition NPC.cs:91519
void Collision_MoveWhileWet(Vector2 oldDryVelocity, float Slowdown=0.5f)
Definition NPC.cs:89495
static bool unlockedNurseSpawn
Definition NPC.cs:335
float nameOver
Definition NPC.cs:83
static IEntitySource GetSpawnSource_NPCRelease(int whoReleasedIt)
Definition NPC.cs:87511
bool justHit
Definition NPC.cs:455
bool tentacleSpiked
Definition NPC.cs:269
void UpdateCollision()
Definition NPC.cs:89241
void SetDefaultsFromNetId(int id, NPCSpawnParams spawnparams=default(NPCSpawnParams))
Definition NPC.cs:1795
void Collision_MoveBlazingWheel()
Definition NPC.cs:89485
bool GetSpecialEventTextIfNotEmpty(string specialTextKey, object substitutes, ref string specialEventText)
Definition NPC.cs:91546
void SpawnStardustMark_StardustTower()
Definition NPC.cs:36945
static bool downedGolemBoss
Definition NPC.cs:365
static void SpawnNPC()
Definition NPC.cs:72591
void CheckLifeRegen()
Definition NPC.cs:89208
static bool LunarApocalypseIsUp
Definition NPC.cs:419
bool CanBeTalkedTo
Definition NPC.cs:653
const int breathMax
Definition NPC.cs:567
void TrySyncingUniqueTownNPCData(int npcIndex)
Definition NPC.cs:87395
bool dripping
Definition NPC.cs:89
void AI_115_LadyBugs()
Definition NPC.cs:40794
bool CanReflectProjectile(Projectile proj)
Definition NPC.cs:58784
static bool downedMartians
Definition NPC.cs:367
bool drippingSlime
Definition NPC.cs:91
static int mechQueen
Definition NPC.cs:581
float GetBossHeadRotation()
Definition NPC.cs:1749
bool celled
Definition NPC.cs:273
static bool TowersDefeated
Definition NPC.cs:798
bool ShouldRunAway(ref NPCAimedTarget targetData, bool isChasing)
Definition NPC.cs:37515
static bool boughtBunny
Definition NPC.cs:305
void ReflectProjectiles(Rectangle myRect)
Definition NPC.cs:58773
string _givenName
Definition NPC.cs:175
void PlayerInteraction(int player)
Definition NPC.cs:72193
int TranslatedTargetIndex
Definition NPC.cs:707
static void GetMeleeCollisionData(Rectangle victimHitbox, int enemyIndex, ref int specialHitSetter, ref float damageMultiplier, ref Rectangle npcRect)
Definition NPC.cs:91619
void DoDeathEvents(Player closestPlayer)
Definition NPC.cs:71463
bool javelined
Definition NPC.cs:267
static bool downedChristmasIceQueen
Definition NPC.cs:375
bool homeless
Definition NPC.cs:541
void DoDeathEvents_BeforeLoot(Player closestPlayer)
Definition NPC.cs:71166
static bool downedAncientCultist
Definition NPC.cs:381
static int golemBoss
Definition NPC.cs:161
float GetAttackDamage_LerpBetweenFinalValuesFloat(float normalDamage, float expertDamage)
Definition NPC.cs:1062
bool IsShimmerVariant
Definition NPC.cs:721
static bool downedBoss3
Definition NPC.cs:349
void MakeTransitionEffectsForTextureChanges(int oldAltTexture, int currentAltTexture)
Definition NPC.cs:87054
static void GetStatScalingFactors(int numPlayers, out float balance, out float boost)
Definition NPC.cs:12645
void Transform(int newType)
Definition NPC.cs:77913
void DoDeathEvents_DropBossPotionsAndHearts()
Definition NPC.cs:71195
short releaseOwner
Definition NPC.cs:107
static void UnlockOrExchangePet(ref bool petBoughtFlag, int npcType, string textKeyForLicense, int netMessageData)
Definition NPC.cs:77747
static readonly int[,,,] MoonLordAttacksArray
Definition NPC.cs:45
void GetHurtByOtherNPCs(bool[] acceptableNPCIDs)
Definition NPC.cs:89134
static int SpawnNPC_GetGemSquirrelToSpawn()
Definition NPC.cs:76812
int life
Definition NPC.cs:477
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:87526
static bool[] npcsFoundForCheckActive
Definition NPC.cs:429
int lastPortalColorIndex
Definition NPC.cs:573
static void SetWorldSpecificMonstersByWorldID()
Definition NPC.cs:12106
bool IsNPCValidForBestiaryKillCredit()
Definition NPC.cs:71156
void AI_123_Deerclops_MakeSpikesForward(int AISLOT_PhaseCounter, NPCAimedTarget targetData)
Definition NPC.cs:37579
static IEntitySource GetSpawnSourceForTownSpawn()
Definition NPC.cs:87541
int teleportStyle
Definition NPC.cs:59
static bool unlockedSlimeYellowSpawn
Definition NPC.cs:319
static bool downedPlantBoss
Definition NPC.cs:363
const int ItemMoonlordCountdownTime
Definition NPC.cs:57
short catchItem
Definition NPC.cs:105
static int ladyBugGoodLuckTime
Definition NPC.cs:626
bool NPCCanStickToWalls()
Definition NPC.cs:48929
void DropEoWLoot(bool fromCheckDead=true)
Definition NPC.cs:70707
int soundDelay
Definition NPC.cs:437
static bool DespawnEncouragement_AIStyle3_Fighters_CanBeBusyWithAction(int npcID)
Definition NPC.cs:53283
static bool savedBartender
Definition NPC.cs:297
static bool TooWindyForButterflies
Definition NPC.cs:850
void AI_123_Deerclops_ShootRubbleUp(ref NPCAimedTarget targetData, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, float upBiasPerSpike, int whichOne)
Definition NPC.cs:37557
static bool SpawnAllowed_DyeTrader()
Definition NPC.cs:1153
bool shadowFlame
Definition NPC.cs:241
bool Collision_WaterCollision(bool lava)
Definition NPC.cs:89780
void UpdateNPC_BloodMoonTransformations()
Definition NPC.cs:88673
static bool dayTimeHax
Definition NPC.cs:618
void UpdateNPC_BuffClearExpiredBuffs()
Definition NPC.cs:88654
static int defaultMaxSpawns
Definition NPC.cs:205
float teleportTime
Definition NPC.cs:61
void AI_007_TownEntities_TeleportToHome(int homeFloorX, int homeFloorY)
Definition NPC.cs:48783
void ScaleStats(int? activePlayersCount, GameModeData gameModeData, float? strengthOverride)
Definition NPC.cs:12149
static void TransformElderSlime(int npcIndex)
Definition NPC.cs:12933
int FindClosestPlayer()
Definition NPC.cs:69634
void UpdateNPC_SoulDrainDebuff()
Definition NPC.cs:87735
bool onFrostBurn2
Definition NPC.cs:233
void NPCLuck()
Definition NPC.cs:78360
bool daybreak
Definition NPC.cs:277
static bool unlockedDemolitionistSpawn
Definition NPC.cs:325
static IEntitySource GetSpawnSourceForNaturalSpawn()
Definition NPC.cs:87536
void SetDefaults_ForNetId(int Type, NPCSpawnParams spawnparams, float scaleOverride)
Definition NPC.cs:2512
void AI_005_EaterOfSouls()
Definition NPC.cs:43476
void getTenthAnniversaryAdjustments()
Definition NPC.cs:11884
PartyHatColor GetPartyHatColor()
Definition NPC.cs:59016
static int brainOfGravity
Definition NPC.cs:583
bool loveStruck
Definition NPC.cs:255
void GetImmuneTime(int fromWho, int time)
Definition NPC.cs:89226
static bool TowerActiveNebula
Definition NPC.cs:415
void ScaleStats_UseStrengthMultiplier(float strength)
Definition NPC.cs:12206
static bool DespawnEncouragement_AIStyle3_Fighters_NotDiscouraged(int npcID, Vector2 position, NPC npcInstance)
Definition NPC.cs:53251
float honeyMovementSpeed
Definition NPC.cs:41
int[] buffType
Definition NPC.cs:213
Color GetNPCColorTintedByBuffs(Color npcColor)
Definition NPC.cs:87779
static int activeTime
Definition NPC.cs:201
bool onFire3
Definition NPC.cs:229
void AI_006_Worms()
Definition NPC.cs:44220
static int immuneTime
Definition NPC.cs:63
int realLife
Definition NPC.cs:173
static bool SpawnTileOrAboveHasAnyWallInSet(int x, int y, bool[] wallTypes)
Definition NPC.cs:72568
void SetTargetTrackingValues(bool faceTarget, float realDist, int tankTarget)
Definition NPC.cs:69994
bool onFrostBurn
Definition NPC.cs:231
NPC AI_113_WindyBalloon_GetSlaveNPC()
Definition NPC.cs:41282
void BloodNautilus_GetMouthPositionAndRotation(out Vector2 mouthPosition, out Vector2 mouthDirection)
Definition NPC.cs:58795
Rectangle frame
Definition NPC.cs:485
int directionY
Definition NPC.cs:443
NetworkText GetGivenNetName()
Definition NPC.cs:1508
object Clone()
Definition NPC.cs:91495
static bool downedMechBoss1
Definition NPC.cs:423
int[] streamPlayer
Definition NPC.cs:151
void SimpleFlyMovement(Vector2 desiredVelocity, float moveSpeed)
Definition NPC.cs:69581
Vector2? AI_007_TownEntities_Shimmer_ScanForBestSpotToLandOn()
Definition NPC.cs:48724
int lifeRegenCount
Definition NPC.cs:249
void Collision_MoveWhileDry()
Definition NPC.cs:89301
int WhoAmIToTargettingIndex
Definition NPC.cs:718
static int GetBrainOfCthuluCreepersCount()
Definition NPC.cs:44193
bool netUpdate
Definition NPC.cs:507
Vector2[] oldPos
Definition NPC.cs:155
bool IsABestiaryIconDummy
Definition NPC.cs:33
void AI_123_Deerclops_MakeSpikesBothSides(int AISLOT_PhaseCounter, NPCAimedTarget targetData)
Definition NPC.cs:37615
static bool downedDeerclops
Definition NPC.cs:397
void Collision_MoveStardustCell(bool fall, Vector2 cPosition, int cWidth, int cHeight)
Definition NPC.cs:89469
int statsAreScaledForThisManyPlayers
Definition NPC.cs:533
Color GetColor(Color newColor)
Definition NPC.cs:90365
void AI_007_TryForcingSitting(int homeFloorX, int homeFloorY)
Definition NPC.cs:46159
static ? float TryFindingFloor(Vector2 searchStartPositionInWorld, int searchRange, out int tilesTraveled)
Definition NPC.cs:37920
int target
Definition NPC.cs:459
static bool unlockedSlimeCopperSpawn
Definition NPC.cs:321
static int plantBoss
Definition NPC.cs:163
static bool SpawnNPC_CheckToSpawnRockGolem(int spawnTileX, int spawnTileY, int plr, int tileType)
Definition NPC.cs:76842
static int activeRangeY
Definition NPC.cs:191
void AI_123_Deerclops()
Definition NPC.cs:37141
static int fireFlyMultiple
Definition NPC.cs:143
void StingerExplosion()
Definition NPC.cs:46036
static bool unlockedArmsDealerSpawn
Definition NPC.cs:333
void AddBuff(int type, int time, bool quiet=false)
Definition NPC.cs:86746
static int GetAvailableAmountOfNPCsToSpawnUpToSlot(int amountWeWant, int highestNPCSlotIndexWeWillPick=100)
Definition NPC.cs:77558
void ViolentlySpawnNerdySlime()
Definition NPC.cs:71791
int netSkip
Definition NPC.cs:169
bool townNPC
Definition NPC.cs:537
bool HasNPCTarget
Definition NPC.cs:693
void RequestBuffRemoval(int buffTypeToRemove)
Definition NPC.cs:86807
void AI()
Definition NPC.cs:13607
static bool downedTowerNebula
Definition NPC.cs:389
static bool downedQueenSlime
Definition NPC.cs:395
int homeTileY
Definition NPC.cs:545
LegacySoundStyle HitSound
Definition NPC.cs:473
static int[,,,] InitializeMoonLordAttacks()
Definition NPC.cs:877
void BeHurtByOtherNPC(int npcIndex, NPC thatNPC)
Definition NPC.cs:89163
static void setNPCName(string newName, int npcType, bool resetExtras=false)
Definition NPC.cs:1513
static void ClearFoundNPCTypesForBestiary()
Definition NPC.cs:1278
static bool savedStylist
Definition NPC.cs:295
void UpdateNPC_TeleportVisuals()
Definition NPC.cs:88895
static int sHeight
Definition NPC.cs:179
static void SendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:88
static bool TrySendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:75
static void SendTileSquare(int whoAmi, int tileX, int tileY, int xSize, int ySize, TileChangeType changeType=TileChangeType.None)
bool[] npcTypeNoAggro
Definition Player.cs:2547
bool creativeGodMode
Definition Player.cs:1529
int FindBuffIndex(int type)
Definition Player.cs:4425
Item[] miscDyes
Definition Player.cs:1173
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
static byte FindClosest(Vector2 Position, int Width, int Height)
Definition Player.cs:4011
Item[] inventory
Definition Player.cs:1257
float nearbyActiveNPCs
Definition Player.cs:1133
static void RandomizeInsanityShadowFor(Entity targetEntity, bool isHostile, out Vector2 spawnposition, out Vector2 spawnvelocity, out float ai0, out float ai1)
bool IsAttachedTo(NPC npc)
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)
static void FindRecipes(bool canDelayCheck=false)
Definition Recipe.cs:453
static bool IsValidForOreFinder(Tile t)
static float starfallBoost
Definition Star.cs:33
static bool CanSpawnSandstormHostile(Vector2 position, int expandUp, int expandDown)
static void CheckArenaScore(Vector2 arenaCenter, out Point xLeftEnd, out Point xRightEnd, int walkerWidthInTiles=5, int walkerHeightInTiles=10)
bool nactive()
Definition Tile.cs:257
ushort type
Definition Tile.cs:8
short frameX
Definition Tile.cs:22
bool active()
Definition Tile.cs:565
bool shimmer()
Definition Tile.cs:396
ushort wall
Definition Tile.cs:10
static void TargetClosestBetsy(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:308
static void TargetClosestCommon(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:303
static void TargetClosestOldOnesInvasion(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:261
static void TargetClosestDownwindFromNPC(NPC searcher, float distanceMaxX, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:289
static void TargetClosestNonBees(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
Definition NPCUtils.cs:275
static Vector2 Vector2FromElipse(Vector2 angleVector, Vector2 elipseSizes)
Definition Utils.cs:609
static float Remap(float fromValue, float fromMin, float fromMax, float toMin, float toMax, bool clamped=true)
Definition Utils.cs:233
static Vector2 RandomVector2(UnifiedRandom random, float min, float max)
Definition Utils.cs:1823
static float WrappedLerp(float value1, float value2, float percent)
Definition Utils.cs:193
static void PoofOfSmoke(Vector2 position)
Definition Utils.cs:695
static ChaseResults GetChaseResults(Vector2 chaserPosition, float chaserSpeed, Vector2 runnerPosition, Vector2 runnerVelocity)
Definition Utils.cs:247
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203
static bool PlotTileLine(Vector2 start, Vector2 end, float width, TileActionAttempt plot)
Definition Utils.cs:1670
static Vector2 FactorAcceleration(Vector2 currentVelocity, float timeToInterception, Vector2 descendOfProjectile, int framesOfLenience)
Definition Utils.cs:299
static float MultiLerp(float percent, params float[] floats)
Definition Utils.cs:180
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
Definition Searches.cs:123
static bool Find(Point origin, GenSearch search, out Point result)
Definition WorldUtils.cs:27
static bool GeneratePlanteraBulbOnAllMechsDefeated()
static bool ActiveAndWalkableTile(int i, int j)
static bool SolidTile(Tile testTile)
static void CheckAchievement_RealEstateAndTownSlimes()
Definition WorldGen.cs:2158
static TownRoomManager TownManager
Definition WorldGen.cs:892
static bool OpenDoor(int i, int j, int direction)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static int prioritizedTownNPCType
Definition WorldGen.cs:1024
static void MessageLunarApocalypse()
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool CloseDoor(int i, int j, bool forced=false)
static readonly int oceanDistance
Definition WorldGen.cs:926
static bool ShiftTallGate(int x, int y, bool closing, bool forced=false)
static bool SolidTile2(Tile testTile)
static bool crimson
Definition WorldGen.cs:932
static bool checkUnderground(int x, int y)
Definition WorldGen.cs:6251
static void StartHardmode()
static bool InAPlaceWithWind(Vector2 position, int width, int height)
static bool oceanDepths(int x, int y)
Definition WorldGen.cs:7142
static readonly int beachDistance
Definition WorldGen.cs:928
static void QuickFindHome(int npc)
Definition WorldGen.cs:2227
static int KillTile_MakeTileDust(int i, int j, Tile tileCache)
static void UpdateLunarApocalypse()
static void TriggerLunarApocalypse()
static bool SolidTileAllowBottomSlope(int i, int j)
static int KillTile_GetTileDustAmount(bool fail, Tile tileCache)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static bool shadowOrbSmashed
Definition WorldGen.cs:974
static void SpawnPlanteraThorns(Vector2 position)
static bool SolidOrSlopedTile(Tile tile)
static Color LightSeaGreen
Definition Color.cs:220
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static Matrix CreateRotationZ(float radians)
Definition Matrix.cs:746
bool Intersects(Rectangle value)
Definition Rectangle.cs:129
static Rectangle Intersect(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:143
static Rectangle Union(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:197
static float Dot(Vector2 value1, Vector2 value2)
Definition Vector2.cs:121
static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
Definition Vector2.cs:201
static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
Definition Vector2.cs:273
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317
static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:255
static float DistanceSquared(Vector2 value1, Vector2 value2)
Definition Vector2.cs:107
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80
static DateTime Now
Definition DateTime.cs:103
static bool CanPlace(int x, int y, int type, int style, int dir, out TileObject objectData, bool onlyCheck=false, int? forcedRandom=null)